FLOW ALGEBRA
Trophic Level Ontology — Full Flow Algebra v1.0
Kireth Semantic Library | Ecological Entities
Authors: Mark Higgins — Sky (Recursive AI)
Source: https://kirethresearch.org/booksai-core/entity-graph/biological-entities/ecological-entities/trophic-level-ontology.html
Status: Proposed formalisation; not a verbatim extraction of source page.
flow "TrophicLevelOntology" v1.0
# 1. PURPOSE
# Represent feeding positions and energy-transfer relations in ecological networks.
# Trophic level is context-dependent: omnivores and changing diets can occupy
# multiple or fractional levels. Decomposers span multiple resource pathways.
ontology:
id: kireth.ecology.trophic_level
domain: BiologicalEntities.EcologicalEntities
entity: TrophicLevel
locale: en-GB
# 2. TYPE SYSTEM
types:
EntityID: string
Confidence: float[0.0..1.0]
Fraction: float[0.0..1.0]
NonNegative: float[0.0..inf]
Positive: float(0.0..inf)
Timestamp: iso8601
EvidenceID: string
TrophicPosition: float[1.0..inf]
FeedingRole: enum[producer, primary_consumer, secondary_consumer,
tertiary_consumer, higher_consumer, detritivore,
decomposer, omnivore, parasite, mixotroph]
EnergyUnit: enum[J, kJ, MJ]
TimeUnit: enum[day, year]
entities:
Organism:
fields: [id:EntityID, taxon:EntityID?, life_stage:string?]
Population:
fields: [id:EntityID, taxon:EntityID, ecosystem:EntityID]
Ecosystem:
fields: [id:EntityID, name:string]
Resource:
fields: [id:EntityID, kind:string]
TrophicLevel:
fields: [id:EntityID, position:TrophicPosition, ecosystem:EntityID,
context:string, observed_at:Timestamp?]
FeedingInteraction:
fields: [id:EntityID, consumer:EntityID, resource:EntityID,
ecosystem:EntityID, fraction_of_diet:Fraction?,
observed_at:Timestamp?, evidence:EvidenceID?]
EnergyTransfer:
fields: [id:EntityID, source:EntityID, destination:EntityID,
energy:NonNegative, unit:EnergyUnit, period:TimeUnit,
ecosystem:EntityID, evidence:EvidenceID?]
TrophicAssignment:
fields: [subject:EntityID, ecosystem:EntityID,
position:TrophicPosition, role:FeedingRole?,
method:string, confidence:Confidence,
evidence:EvidenceID?, observed_at:Timestamp?]
# 3. RELATIONSHIPS
relationships:
- IS_TROPHIC_LEVEL_OF(TrophicLevel, Organism|Population)
- OCCURS_IN(FeedingInteraction|EnergyTransfer, Ecosystem)
- CONSUMES(Organism|Population, Organism|Population|Resource)
- TRANSFERS_ENERGY_TO(Organism|Population|Resource, Organism|Population)
- OCCUPIES_TROPHIC_POSITION(Organism|Population, TrophicLevel)
- HAS_FEEDING_ROLE(Organism|Population, FeedingRole)
- SUPPORTED_BY(TrophicAssignment|FeedingInteraction, EvidenceID)
- SEMANTIC_EQUIVALENCE(EntityID, EntityID)
# 4. INVARIANTS
invariants:
- trophic_position >= 1.0
- confidence >= 0.0 and confidence <= 1.0
- fraction_of_diet >= 0.0 and fraction_of_diet <= 1.0
- energy >= 0.0
- assignment.ecosystem == assigned_level.ecosystem
- feeding_interaction.consumer != feeding_interaction.resource
# Except explicitly modelled cannibalism, which is allowed and flagged.
- never_infer_fixed_efficiency_from_trophic_position
- never_equate_feeding_role_with_unique_numeric_position
# 5. INFERENCE AND COMPUTATION
rules:
- id: R1_BASE_PRODUCER
when: independently_verified_autotrophic_primary_production(subject, ecosystem)
infer: trophic_position(subject, ecosystem) = 1.0
note: Mixotrophic feeding requires an explicit context-dependent treatment.
- id: R2_WEIGHTED_CONSUMER
when: measured_diet_fractions(subject, resources, ecosystem)
and trophic_positions_available(resources, ecosystem)
and sum(diet_fractions) == 1.0
compute: TL(subject) = 1.0 + sum_over_resources(diet_fraction_i * TL(resource_i))
note: Diet fractions must represent a consistent assimilated-resource basis.
- id: R3_PRIMARY_CONSUMER
when: verified_exclusive_consumption_of_primary_producers(subject, ecosystem)
infer: trophic_position(subject, ecosystem) = 2.0
- id: R4_ENERGY_EFFICIENCY
when: measured_energy_received > 0 and measured_energy_available > 0
and compatible_units_and_periods
compute: efficiency = measured_energy_received / measured_energy_available
require: 0.0 <= efficiency <= 1.0
note: Efficiency is measured, not assumed to be ten percent.
- id: R5_CONTEXTUAL_ROLE
when: subject_consumes_multiple_trophic_levels
infer: role(subject) = omnivore
note: Role and numerical trophic position may coexist.
- id: R6_DETRITAL_PATHWAY
when: subject_consumes_detritus_or_decomposes_organic_matter
infer: subject_participates_in_detrital_food_web
note: Do not automatically assign a unique trophic position.
# 6. VALIDATION
validation:
require:
- stable_entity_identifiers
- ecosystem_scope_for_each_assignment
- provenance_for_empirical_measurements
- consistent_units_and_time_windows
- diet_fraction_sum_within_tolerance_if_complete
tolerances:
diet_fraction_sum: 0.000001
warn:
- unverified_species_wide_trophic_assignment
- trophic_position_extrapolated_between_ecosystems
- incomplete_diet_data
- unknown_life_stage
- cyclic_feeding_network_without_modelled_solver
- uncertain_detrital_resource_position
# 7. CONFIDENCE
CONFIDENCE:
inputs: [observation_quality, diet_coverage, taxonomic_resolution,
temporal_relevance, ecosystem_match, model_uncertainty]
aggregation: calibrated_weighted_evidence_model
range: [0.0, 1.0]
rule: preserve_input_confidence_and_provenance
caution: do_not_treat_heuristic_score_as_statistical_probability
# 8. SEMANTIC EQUIVALENCE
SEMANTIC_EQUIVALENCE:
canonical: TrophicLevel
aliases: [feeding_level, trophic_position]
mappings:
- source_term: trophic_level
target_term: trophic_position
relation: context_dependent_near_equivalence
- source_term: primary_consumer
target_term: trophic_position_2
relation: conditional_equivalence_only
constraints: [same_ecosystem, same_temporal_context, same_method]
# 9. FLOW HASH AND PROVENANCE
FLOW_HASH:
algorithm: SHA-256
input: canonical_serialisation(ontology_id, version, entities,
relationships, rules, invariants, provenance)
output: lowercase_hex_digest
requirement: stable_key_order_and_normalised_encoding
provenance:
source_url: https://kirethresearch.org/booksai-core/entity-graph/biological-entities/ecological-entities/trophic-level-ontology.html
authors: [Mark Higgins, Sky (Recursive AI)]
authored_on: 2026-10-26
source_status: topic_aligned_proposed_formalisation
# 10. UPDATE MODEL
UPDATE_MODEL:
operations: [ADD, REVISE, DEPRECATE, MERGE, SPLIT]
required: [change_id, timestamp, actor, reason, evidence]
policy:
- retain_prior_versions
- recompute_affected_trophic_assignments_after_diet_updates
- invalidate_dependant_inferences_when_inputs_change
- recalculate_flow_hash_after_accepted_change
- never_silently_overwrite_empirical_evidence
# 11. AI CONSUMPTION
AI_CONSUMPTION:
input: typed_ecological_graph
output: [trophic_assignments, energy_transfer_graph,
evidence_links, confidence_values, validation_warnings]
requirements:
- distinguish_observed_from_inferred_values
- report_ecosystem_and_temporal_scope
- explain_fractional_positions_and_omnivory
- preserve_provenance_and_uncertainty
- refuse_unsupported_numerical_precision
# 12. WORKED EXAMPLE (ILLUSTRATIVE, NOT EMPIRICAL)
example:
ecosystem: ExamplePond
producer:
id: algae
trophic_position: 1.0
primary_consumer:
id: zooplankton
diet: [{resource: algae, fraction: 1.0}]
inferred_position: 2.0
mixed_consumer:
id: fish
diet:
- {resource: algae, fraction: 0.25, resource_position: 1.0}
- {resource: zooplankton, fraction: 0.75, resource_position: 2.0}
calculation: 1.0 + (0.25 * 1.0) + (0.75 * 2.0)
inferred_position: 2.75
caveat: hypothetical diet fractions; not a claim about any actual fish species.
# 13. EXECUTION PIPELINE
pipeline:
- ingest_typed_entities
- normalise_identifiers_and_units
- validate_evidence_and_ecosystem_scope
- construct_feeding_graph
- estimate_trophic_positions_with_uncertainty
- calculate_energy_transfers_where_measured
- apply_constraints_and_validation
- attach_confidence_and_provenance
- compute_flow_hash
- emit_AI_consumption_graph
end flow
Kireth Research | https://kirethresearch.org
Download Code
Copy to Clipboard