Skip to main content

Recursive Function Ontology

Recursive Mathematical Entities
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 14 October 2026
Audio Overview
FLOW ALGEBRA
Recursive Function Ontology
Kireth Semantic Library | Mathematical Entities | Recursive Mathematical Entities
Version: 1.0 | Date: 2026-10-14 | Locale: en-GB
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/recursive-mathematical-entities/recursive-function-ontology-2.html
Source alignment: Pending (page content could not be retrieved). Formalisation is based on established mathematics, not a verified transcription of the page.
Authors: Mark Higgins — Sky (Recursive AI)

1. PURPOSE
Represent recursive functions as typed mathematical entities with explicit domains, codomains, base clauses, recursive clauses, evaluation semantics, proof obligations and computability properties. Distinguish recursive specification, totality, termination and primitive recursiveness.

2. TYPED ENTITIES
ENTITY RecursiveFunction {id:IRI, name:String, domain:Type, codomain:Type, definition:RecursiveDefinition, semantics:EvaluationSemantics, totality:TotalityStatus, provenance:SourceRef}
ENTITY RecursiveDefinition {base_cases:List[BaseCase], recursive_cases:List[RecursiveCase], guards:List[Predicate], measure:Optional[WellFoundedMeasure]}
ENTITY BaseCase {pattern:Pattern, result:E-xpression, precondition:Predicate}
ENTITY RecursiveCase {pattern:Pattern, result:E-xpression, recursive_calls:List[Call], precondition:Predicate}
ENTITY Call {target:FunctionRef, arguments:List[Expression]}
ENTITY WellFoundedMeasure {mapping:Domain->OrderSet, order:WellFoundedRelation}
ENTITY EvaluationTrace {input:Value, steps:List[Reduction], outcome:Value|Divergence|Undefined}
ENTITY FixedPointSemantics {functional:Functional, least_fixed_point:Optional[Function]}
ENUM TotalityStatus {PROVEN_TOTAL, PARTIAL, UNKNOWN}
ENUM FunctionClass {PRIMITIVE_RECURSIVE, GENERAL_RECURSIVE, STRUCTURALLY_RECURSIVE, MUTUALLY_RECURSIVE, CORECURSIVE}

3. RELATIONSHIPS
RecursiveFunction --HAS_DEFINITION--> RecursiveDefinition
RecursiveDefinition --HAS_BASE_CASE--> BaseCase
RecursiveDefinition --HAS_RECURSIVE_CASE--> RecursiveCase
RecursiveCase --CALLS--> RecursiveFunction
RecursiveFunction --HAS_DOMAIN--> Type
RecursiveFunction --HAS_CODOMAIN--> Type
RecursiveFunction --HAS_EVALUATION_TRACE--> EvaluationTrace
RecursiveDefinition --HAS_TERMINATION_MEASURE--> WellFoundedMeasure
RecursiveFunction --HAS_FIXED_POINT_SEMANTICS--> FixedPointSemantics
RecursiveFunction --SEMANTICALLY_RELATED_TO--> RecursiveSequence | RecurrenceRelation | InductiveDefinition

4. FORMAL SEMANTICS
A recursive definition specifies f by equations that may refer to f at other arguments. For a natural-number recursion:
  f(0) = a
  f(n+1) = g(n, f(n))
where a is a base value and g is a suitably typed step function.
Primitive recursion on natural numbers:
  f(0, x) = g(x)
  f(n+1, x) = h(n, f(n,x), x)
where g and h are total primitive-recursive functions for the usual closure theorem.
Factorial:
  fact(0) = 1
  fact(n+1) = (n+1) * fact(n)
Fibonacci:
  fib(0) = 0
  fib(1) = 1
  fib(n+2) = fib(n+1) + fib(n)

5. EVALUATION FLOW
flow RecursiveFunctionEvaluation v1.0:
  input: (function:RecursiveFunction, arguments:List[Value])
  require: arguments conform to function.domain
  select: matching guarded definition clause
  if: base clause matches -> evaluate its result
  else: evaluate recursive clause and recursively evaluate calls
  record: reduction trace, guard decisions, result or divergence
  output: Value | Undefined | Divergence
  note: finite observation cannot in general decide divergence for arbitrary programs

6. INFERENCE RULES
RULE BASE_EVALUATION:
  matches(x, base.pattern) AND base.precondition(x)
  => f(x) = evaluate(base.result, x)
RULE RECURSIVE_EVALUATION:
  matches(x, rec.pattern) AND rec.precondition(x)
  AND all recursive subcalls terminate with their computed values
  => f(x) = evaluate(rec.result, x, subcall_values)
RULE WELL_FOUNDED_TERMINATION:
  well_founded(prec) AND every recursive call y from x satisfies measure(y) prec measure(x)
  AND clauses cover all valid inputs
  AND nonrecursive expressions terminate
  => f is total on its declared domain
RULE STRUCTURAL_RECURSION:
  recursive calls operate on proper substructures in a well-founded inductive datatype
  => termination follows, subject to exhaustive cases and terminating auxiliaries
RULE EXTENSIONAL_EQUIVALENCE:
  for all x in common domain, f(x) and g(x) are defined and equal
  => f and g are extensionally equivalent on that domain
RULE FIXED_POINT:
  f = Phi(f) when f satisfies the defining recursive equations
  note: least-fixed-point interpretation requires an appropriate ordered semantic domain and suitable Phi

7. VALIDATION CONSTRAINTS
V01: Domain, codomain and all expressions must type-check.
V02: Base and recursive patterns must be coherent; overlapping clauses require consistent results or explicit priority semantics.
V03: Totality claims require exhaustive domain coverage and a valid termination proof.
V04: A decreasing measure must map to a genuinely well-founded order.
V05: A recursive definition alone does not establish termination.
V06: Mutual recursion requires a joint termination argument, e.g. a shared well-founded measure.
V07: Distinguish partial recursive/computable functions from primitive-recursive functions.
V08: Do not infer a function is nonrecursive merely because it uses iteration; equivalent recursive formulations may exist.
V09: For nonterminating computations, record divergence rather than fabricate a numerical result.
V10: Check preconditions such as n >= 0 and avoid assuming unrestricted real-number recursion is well-founded.

8. WORKED EXAMPLES
EXAMPLE A: fact(4)
  fact(4)=4*fact(3)=4*3*fact(2)=4*3*2*fact(1)=4*3*2*1*fact(0)=24.
  measure(n)=n; every call reduces n by 1; base case n=0.
EXAMPLE B: fib(5)
  fib(0)=0, fib(1)=1, fib(2)=1, fib(3)=2, fib(4)=3, fib(5)=5.
EXAMPLE C: nonterminating specification
  loop(n)=loop(n) has no decreasing measure and produces no value under strict evaluation; do not classify as total.
EXAMPLE D: mutual recursion
  even(0)=true; odd(0)=false;
  even(n+1)=odd(n); odd(n+1)=even(n).
  Both terminate over natural numbers by measure n.

9. SEMANTIC EQUIVALENCE
Aliases: recursive function; recursively defined function; function defined by recursion.
Distinctions: recursive function (context-dependent computability terminology) != necessarily primitive-recursive function; recursion != recurrence relation; recursion != corecursion; terminating evaluation != proven totality.
Equivalence criteria: same typed domain and codomain, same outputs for all inputs where compared, and matching definedness for partial-function equivalence.

10. CONFIDENCE
confidence.formal_mathematics: HIGH for standard definitions and verified examples.
confidence.source_alignment: UNVERIFIED pending comparison with the source page.
confidence.totality_claim: PROOF_REQUIRED unless established by validated rules.

11. FLOW_HASH
algorithm: SHA-256
canonicalisation: UTF-8; Unicode NFC; LF line endings; stable ordered entity and rule identifiers; exclude generated hash field.
FLOW_HASH: COMPUTE_ON_INGEST (do not substitute an invented digest).

12. UPDATE_MODEL
version: 1.0
update_trigger: changes to source definitions, typed relationships, mathematical proofs, or formal validation rules.
procedure: retrieve source; compare semantics; revise entities/rules; rerun examples and type checks; recompute FLOW_HASH; record provenance and changelog.

13. AI_CONSUMPTION
format: plain-text typed Flow Algebra
entity_id: recursive-function-ontology
classification: MathematicalEntity > RecursiveMathematicalEntity > RecursiveFunction
reasoning_modes: type checking, symbolic evaluation, recursion-tree analysis, termination checking, equivalence checking, provenance-aware retrieval.
safety: never assert termination or totality without proof; flag unknown outcomes; preserve domain restrictions and source-verification status.

END FLOW ALGEBRA
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ