AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
FLOW ALGEBRA
TITLE: Electrolyte Ontology
VERSION: 1.0
DOMAIN: Biological Entities / Chemical Foundations of Life
SOURCE: https://kirethresearch.org/booksai-core/entity-graph/biological-entities/chemical-foundations-of-life/electrolyte-ontology.html
AUTHORS: Mark Higgins — Sky (Recursive AI)
STATUS: Companion formalisation; conceptual rules require a conforming interpreter.
1. PURPOSE
Represent electrolytes, dissolved ionic species, biological compartments, concentrations, charge balance, transport, and evidence-linked reasoning as typed entities and relationships. Distinguish an electrolyte substance from an individual ion and from a measured electrolyte concentration.
2. ENTITY TYPES
ENTITY ElectrolyteSubstance {id, name, formula, dissociation_model, provenance}
ENTITY IonSpecies {id, symbol, charge_integer, molar_mass, provenance}
ENTITY Solution {id, solvent, volume_L, temperature_K, provenance}
ENTITY Compartment {id, organism_or_system, name, volume_L?, provenance}
ENTITY Dissociation {id, reactant, products:[(ion,stoichiometric_coefficient)], conditions}
ENTITY Concentration {id, species, compartment, value, unit, timestamp, method, uncertainty?}
ENTITY Membrane {id, side_a, side_b, permeability_model}
ENTITY TransportProcess {id, ion, source, destination, mechanism, rate?, conditions}
ENTITY Measurement {id, target, value, unit, time, method, calibration?, provenance}
ENTITY Evidence {id, source, method, timestamp, reliability?}
ENTITY Assertion {id, subject, predicate, object, evidence_ids, confidence, validity_state}
3. TAXONOMY
ElectrolyteSubstance IS_A ChemicalSubstance
IonSpecies IS_A ChargedChemicalSpecies
Cation IS_A IonSpecies WHERE charge_integer > 0
Anion IS_A IonSpecies WHERE charge_integer < 0
ElectrolyteConcentration IS_A Concentration
StrongElectrolyte IS_A ElectrolyteSubstance [operational classification; conditions required]
WeakElectrolyte IS_A ElectrolyteSubstance [operational classification; conditions required]
4. TYPED RELATIONSHIPS
DISSOCIATES_IN(ElectrolyteSubstance, Solution, Dissociation)
PRODUCES_ION(Dissociation, IonSpecies, stoichiometric_coefficient)
DISSOLVED_IN(IonSpecies, Solution)
LOCATED_IN(Concentration, Compartment)
SEPARATES(Membrane, Compartment, Compartment)
TRANSPORTS(TransportProcess, IonSpecies)
HAS_MEASUREMENT(Compartment, Measurement)
SUPPORTED_BY(Assertion, Evidence)
DERIVED_FROM(Assertion, Assertion)
SEMANTIC_EQUIVALENCE(Entity, Entity, scope, justification)
5. REPRESENTATIVE INSTANCES
SodiumIon: IonSpecies {symbol:"Na+", charge_integer:+1}
PotassiumIon: IonSpecies {symbol:"K+", charge_integer:+1}
CalciumIon: IonSpecies {symbol:"Ca2+", charge_integer:+2}
MagnesiumIon: IonSpecies {symbol:"Mg2+", charge_integer:+2}
ChlorideIon: IonSpecies {symbol:"Cl-", charge_integer:-1}
BicarbonateIon: IonSpecies {symbol:"HCO3-", charge_integer:-1}
PhosphateSpecies: IonSpecies [specify protonation state and pH]
SodiumChloride: ElectrolyteSubstance {formula:"NaCl"}
DISSOCIATES_IN(NaCl, aqueous_solution) -> Na+ + Cl- [ideal stoichiometric representation]
6. FORMAL CONSTRAINTS
RULE R01: IonSpecies.charge_integer != 0.
RULE R02: Dissociation product coefficients are positive integers.
RULE R03: CHARGE_CONSERVATION: charge(reactant) = SUM_i(coeff_i * charge(product_i)); include all charged reactants and products.
RULE R04: ELEMENT_CONSERVATION: count(element, reactants) = count(element, products) for every element.
RULE R05: Concentration.value >= 0 and Concentration.unit is explicit.
RULE R06: Concentration comparisons require compatible species, compartments, units, time and measurement context.
RULE R07: Compartment and solution identities must be preserved across transport statements.
RULE R08: No automatic inference of clinical deficiency or excess from an isolated concentration without context and validated reference intervals.
7. QUANTITATIVE OPERATORS
OP MOLAR_CONCENTRATION(amount_mol, volume_L) -> mol/L, requiring volume_L > 0.
OP CONVERT_MOLAR_TO_MILLIMOLAR(c_mol_per_L) -> 1000*c_mol_per_L mmol/L.
OP CHARGE_EQUIVALENTS(c_mmol_per_L, z) -> abs(z)*c_mmol_per_L mEq/L.
OP IONIC_STRENGTH(concentrations_mol_per_L, charges) -> 0.5*SUM_i(c_i*z_i^2) mol/L, for a defined solution composition.
OP IDEAL_OSMOLAR_CONTRIBUTION(concentrations_of_particles) -> SUM_i(c_i), with ideal-solution assumption.
OP NERNST_POTENTIAL(z, activity_out, activity_in, T_K) -> (R*T_K/(z*F))*ln(activity_out/activity_in), requiring z != 0, positive activities and stated voltage sign convention.
OP ELECTROCHEMICAL_POTENTIAL_DIFFERENCE(z, delta_psi, activity_out, activity_in, T_K) -> R*T_K*ln(activity_out/activity_in) + z*F*delta_psi, with delta_psi = psi_out - psi_in.
8. INFERENCE RULES
INFER I01: IF a dissociation model identifies a product with charge > 0 THEN classify that product as Cation.
INFER I02: IF a dissociation model identifies a product with charge < 0 THEN classify that product as Anion.
INFER I03: IF concentrations are provided in mmol/L and valence is known THEN calculate mEq/L via CHARGE_EQUIVALENTS.
INFER I04: IF an ion is transported between compartments THEN create a state-change assertion tied to source, destination, mechanism and time; do not assume the transport rate.
INFER I05: IF charge or element conservation fails THEN flag the dissociation representation as invalid.
INFER I06: IF a measurement has uncertain provenance or unspecified units THEN mark downstream quantitative inferences as requiring review.
INFER I07: IF membrane permeability and electrochemical conditions are known THEN evaluate a transport model; do not infer actual flux direction without model assumptions.
9. SEMANTIC EQUIVALENCE
Na+ == sodium cation [same chemical species and charge, within declared scope].
K+ == potassium cation [same chemical species and charge, within declared scope].
NaCl != Na+ [compound versus ionic species].
ElectrolyteSubstance != IonSpecies [distinct ontological types].
Serum sodium concentration != total-body sodium content [distinct measurements].
Molarity != activity [unless an explicitly justified approximation is applied].
Equivalent labels require compatible chemical formula, charge, state, compartment and context.
10. VALIDATION
VALIDATE entity_type against declared schema.
VALIDATE ion_charge as integer and nonzero.
VALIDATE stoichiometry by atom and charge conservation.
VALIDATE concentration units and nonnegative values.
VALIDATE dimensional consistency for every quantitative operator.
VALIDATE transport direction and sign conventions.
VALIDATE measurement provenance, calibration and time context.
VALIDATE reference ranges only when species, sample type, population and laboratory method match.
ON_FAILURE: preserve original assertion, attach failure code, prohibit promotion to verified status.
11. CONFIDENCE
CONFIDENCE(assertion) in [0,1] only when a calibrated scoring method is declared.
Evidence quality, instrument calibration, source independence, reproducibility and inference assumptions contribute to scoring.
Derived confidence must not exceed a formally justified bound; correlated evidence must not be double counted.
Unknown evidence quality -> confidence: UNASSESSED (not an invented numeric value).
Formal mathematical identity may be VERIFIED within its stated assumptions; biological application remains context-dependent.
12. PROVENANCE
Each entity and assertion stores source URL or identifier, author or curator where known, observation or revision time, method, assumptions, version and transformation lineage.
Preserve raw measurements separately from derived results.
Store contradictory evidence as separate assertions pending resolution.
13. FLOW_HASH
CANONICALISE: stable field ordering, normalised Unicode, explicit units, typed identifiers, sorted unordered sets, retained meaningful precision.
FLOW_HASH := SHA256(canonical_serialisation(flow_version, entity_types, rules, assertions, provenance_references)).
HASH_SCOPE: content integrity and version comparison; not proof of scientific correctness.
14. UPDATE_MODEL
ON new_evidence: append evidence; revalidate dependent assertions; recompute affected inferences and hashes.
ON changed_measurement: preserve previous version and time; update only impacted compartment/species nodes.
ON changed_assumption: invalidate affected derived assertions pending re-evaluation.
ON ontology_revision: record schema migration, compatibility status and version lineage.
15. AI_CONSUMPTION
INPUT: typed electrolyte entities, context, observations, constraints, provenance.
PROCESS: parse -> type-check -> normalise units -> validate -> resolve identity -> apply scoped inference -> assess evidence -> emit trace.
OUTPUT: typed assertions, calculated values with units, assumption list, validation status, provenance references, confidence state, Flow Hash.
SAFETY: do not treat the ontology as a clinical decision system; any clinical interpretation requires qualified oversight and current clinical guidance.
16. EXAMPLE TRACE
INPUT: concentration(Na+, compartment_A) = 140 mmol/L; charge(Na+) = +1.
APPLY: CHARGE_EQUIVALENTS(140, +1).
OUTPUT: 140 mEq/L; VALIDATION: PASS for dimensional conversion.
LIMITATION: no inference about clinical normality or physiological state without further context.
END FLOW ALGEBRA