AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
FLOW ALGEBRA
Termination Condition Ontology
Version: 1.0
Date: 2026-10-14
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/recursive-mathematical-entities/termination-condition-ontology.html
Source alignment: Pending verification; formalisation based on established mathematics and computer science.
Authors: Mark Higgins — Sky (Recursive AI)
Project: Kireth Semantic Library | https://kirethresearch.org
1. PURPOSE
Model the predicates, rankings, invariants and proof obligations that establish when a recursive or iterative computation halts. Distinguish reaching a successful base case from halting because of an error, resource limit or external interruption.
2. TYPED ENTITIES
ENTITY TerminationCondition : Predicate[State]
ENTITY RecursiveProcess : State -> State | Result
ENTITY State : TypedValue
ENTITY BaseCase : Predicate[State]
ENTITY RecursiveCase : Predicate[State]
ENTITY Transition : Relation[State,State]
ENTITY RankingFunction : State -> WellFoundedSet
ENTITY WellFoundedOrder : Relation[RankValue,RankValue]
ENTITY Invariant : Predicate[State]
ENTITY TerminationProof : ProofObject
ENTITY TerminationOutcome : Enum{normal,error,timeout,cancelled,unknown}
ENTITY EvaluationTrace : Sequence[State]
ENTITY Guard : Predicate[State]
ENTITY Measure : State -> NonNegativeInteger
ENTITY Fuel : NonNegativeInteger
ENTITY PartialFunction : Domain -> Optional[Result]
3. RELATIONSHIPS
RELATION has_termination_condition(RecursiveProcess,TerminationCondition)
RELATION has_base_case(RecursiveProcess,BaseCase)
RELATION has_recursive_case(RecursiveProcess,RecursiveCase)
RELATION advances_by(RecursiveProcess,Transition)
RELATION decreases_under(RankingFunction,Transition)
RELATION preserves(Invariant,Transition)
RELATION justified_by(TerminationCondition,TerminationProof)
RELATION produces_outcome(RecursiveProcess,TerminationOutcome)
RELATION observed_in(TerminationCondition,EvaluationTrace)
RELATION bounded_by(RecursiveProcess,Fuel)
4. FORMAL SEMANTICS
Let S be a state space, T subset S x S the transition relation, and B:S -> Bool a base-case predicate.
Normal termination at s means B(s)=true and no recursive transition is required.
A process terminates from s0 if there exists finite n and states s0,...,sn such that T(si,si+1) for 0<=i<n and B(sn)=true.
Universal termination on D subset S requires every admissible execution from every s in D to be finite; this is stronger than the existence of one terminating path.
A well-founded relation has no infinite descending chain (under the usual dependent-choice assumptions for standard termination proofs).
Ranking proof: choose rho:S -> W with (W,prec) well-founded; for every reachable nonterminal transition s -> s', rho(s') prec rho(s). Then no infinite execution is possible, provided every nonterminal state admits the specified progress transition and executions follow the model.
For rho:S -> N, require rho(s)>=0 and rho(s')<rho(s) on every recursive step.
Termination does not imply correctness of the returned result. Partial correctness plus termination yields total correctness over the specified domain.
5. FLOW RULES
RULE TC01 BaseCaseReached:
IF B(s)=true THEN halt(process,s,outcome=normal).
RULE TC02 RecursiveProgress:
IF NOT B(s) AND T(s,s') THEN require rho(s') prec rho(s).
RULE TC03 WellFoundedTermination:
IF reachable_states_have_ranking AND ranking_strictly_decreases_on_all_transitions AND ranking_codomain_well_founded THEN infer universal_termination.
RULE TC04 LoopInvariant:
IF I(s) AND T(s,s') THEN require I(s').
RULE TC05 PartialCorrectness:
IF I(s) AND B(s) THEN check postcondition(s).
RULE TC06 FuelExhaustion:
IF fuel=0 AND NOT B(s) THEN halt(outcome=timeout); DO NOT infer mathematical_termination.
RULE TC07 Unknown:
IF no proof_or_counterexample THEN set termination_status=unknown.
RULE TC08 NonTerminationWitness:
IF reachable_cycle_is_repeatable_under_deterministic_transition AND no_base_case_on_cycle THEN infer nontermination_from_that_initial_state.
RULE TC09 Branching:
IF transition_is_nondeterministic THEN prove decrease for EVERY possible recursive successor to infer universal termination.
6. VALIDATION CONSTRAINTS
CONSTRAINT V01: base_case and recursive_case must be type-correct predicates on State.
CONSTRAINT V02: ranking codomain must have a documented well-founded order.
CONSTRAINT V03: strict decrease must hold for every reachable recursive transition, not just sampled traces.
CONSTRAINT V04: state and transition domains must be explicit.
CONSTRAINT V05: successful termination, failure, timeout and cancellation must not be conflated.
CONSTRAINT V06: bounded tests cannot prove universal termination.
CONSTRAINT V07: undecidability prevents a general algorithm deciding termination for all arbitrary programs.
CONSTRAINT V08: recursive branches must all satisfy their proof obligations.
7. WORKED EXAMPLES
EXAMPLE A Factorial:
f(0)=1; f(n)=n*f(n-1) for n>0, domain N.
BaseCase n=0; ranking rho(n)=n; decreases by one; terminates for all n in N.
EXAMPLE B Euclidean algorithm:
gcd(a,0)=a; gcd(a,b)=gcd(b,a mod b) for b>0 and a,b in N.
Ranking rho(a,b)=b; 0 <= a mod b < b; terminates.
EXAMPLE C Nonterminating recursion:
g(n)=g(n+1), domain N, no base case.
Infinite sequence 0,1,2,...; no natural-number decreasing ranking for this transition; does not terminate.
EXAMPLE D Branching recursion:
h(n)=h(n-1)+h(n-2) for n>=2; h(0)=0,h(1)=1.
Each branch decreases ranking n; finite recursion tree for every n in N.
8. SEMANTIC EQUIVALENCE
ALIAS TerminationCondition = HaltingCondition [context-dependent]
RELATED BaseCase, StoppingCriterion, RankingFunction, WellFoundedRecursion, LoopVariant, TotalCorrectness
DISTINGUISH stopping_tolerance FROM proof_of_termination
DISTINGUISH resource_timeout FROM normal_termination
DISTINGUISH observed_halt FROM universally_proven_halt
9. CONFIDENCE
Mathematical foundations: high.
Alignment with referenced webpage: unverified.
Proof confidence: assign only after verifying assumptions, state space, transition coverage and ranking obligations.
10. FLOW_HASH
FLOW_HASH_ALGORITHM: SHA-256
FLOW_HASH_INPUT: canonical UTF-8 serialisation of this flow, excluding the FLOW_HASH value itself.
FLOW_HASH_VALUE: compute at ingestion; not pre-populated.
11. UPDATE_MODEL
version: 1.0
update_trigger: source_revision | mathematical_correction | ontology_extension
change_policy: retain prior versions and record semantic differences
source_alignment_required: true
12. AI_CONSUMPTION
parse_as: typed_flow_algebra
primary_entity: TerminationCondition
reasoning_tasks: [classify_halt, verify_base_case, check_ranking_function, validate_recursive_progress, distinguish_timeout, generate_proof_obligations]
output_fields: [process, domain, base_case, transition, ranking, invariant, termination_status, proof, assumptions, confidence]
provenance: source_url + version + authors
safety: do_not_assert_termination_without_valid_proof_or_explicitly_bounded_domain
END FLOW ALGEBRA