AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
FLOW ALGEBRA
FUNCTION ONTOLOGY
Kireth Semantic Library | Entity Graph | Mathematical Entities | Function and Mapping Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/function-and-mapping-entities/function-ontology-3.html
Authors: Mark Higgins — Sky (Recursive AI)
Status: Formal mathematical specification derived from established mathematics; source page not independently verified.
Version: 1.0 | Date: 2026-10-13
01. PURPOSE
flow "FunctionOntology" v1.0
purpose: represent, type, validate, transform and reason about mathematical functions.
notation: f:A -> B, x |-> f(x).
02. CORE DEFINITION
A function f from A to B is a relation f subseteq A x B satisfying:
forall x in A, exists exactly one y in B such that (x,y) in f.
A is the domain; B is the codomain; f[A] is the image/range.
Functions are equal iff their domains, codomains (for typed functions), and outputs agree.
03. ENTITY TYPES
Function, Domain, Codomain, Input, Output, OrderedPair, Graph, Image,
Preimage, Rule, Expression, Evaluation, Composition, Restriction,
Extension, IdentityFunction, ConstantFunction, InjectiveFunction,
SurjectiveFunction, BijectiveFunction, PartialFunction, InverseFunction,
PiecewiseFunction, HigherOrderFunction, Functional, Parameter.
04. TYPED SIGNATURES
Function[A,B] : A -> B
apply : Function[A,B] x A -> B
image : Function[A,B] x PowerSet(A) -> PowerSet(B)
preimage : Function[A,B] x PowerSet(B) -> PowerSet(A)
compose : Function[B,C] x Function[A,B] -> Function[A,C]
restrict : Function[A,B] x PowerSet(A) -> Function[S,B] where S subseteq A
05. INVARIANTS
DOMAIN_TOTALITY: forall x in A, defined(f(x)).
SINGLE_VALUED: f(x)=y and f(x)=z implies y=z.
CODOMAIN_MEMBERSHIP: forall x in A, f(x) in B.
IMAGE_SUBSET: f[A] subseteq B.
EMPTY_DOMAIN: exactly one function emptyset -> B, namely empty relation.
EMPTY_CODOMAIN: A -> emptyset exists iff A is empty.
06. FUNCTION REPRESENTATION
representations: ordered-pair graph, symbolic formula, algorithm,
lookup table, lambda expression, piecewise rule, diagram.
A formula alone may not fix domain, codomain or branch conventions.
Graph(f) = {(x,f(x)) | x in A}.
07. CLASSIFICATION
injective(f): forall x1,x2 in A, f(x1)=f(x2) implies x1=x2.
surjective(f): forall y in B, exists x in A with f(x)=y.
bijective(f): injective(f) and surjective(f).
constant(f): forall x1,x2 in A, f(x1)=f(x2) (vacuous for empty A).
identity(A): id_A(x)=x for x in A.
partial_map: defined only on D subseteq A; model as total D -> B.
08. EVALUATION
requires x in domain(f).
returns exactly one y in codomain(f).
invalid input -> domain error, not an inferred numeric result.
examples: f:R -> R, f(x)=x^2; f(-3)=9.
09. COMPOSITION
(g o f)(x)=g(f(x)) for f:A->B, g:B->C.
Associativity: h o (g o f) = (h o g) o f.
Identity: id_B o f = f = f o id_A.
Composition is generally noncommutative.
10. INVERSES
For a bijection f:A->B, unique inverse f^-1:B->A exists.
f^-1 o f = id_A and f o f^-1 = id_B.
Inverse relation exists for every function but need not be a function.
Preimage notation f^-1[S] is valid even when no inverse function exists.
11. IMAGES AND PREIMAGES
f[S] = {f(x) | x in S}, S subseteq A.
f^-1[T] = {x in A | f(x) in T}, T subseteq B.
f[Union_i S_i] = Union_i f[S_i].
f[Intersection_i S_i] subseteq Intersection_i f[S_i].
f^-1[Union_i T_i] = Union_i f^-1[T_i].
f^-1[Intersection_i T_i] = Intersection_i f^-1[T_i].
12. RESTRICTION AND EXTENSION
f|S:S->B for S subseteq A, with f|S(x)=f(x).
g:C->B extends f:A->B iff A subseteq C and g|A=f.
A restricted function may become injective even if f is not.
13. PIECEWISE FUNCTIONS
Branches carry predicates P_i(x), outputs e_i(x).
Validation: predicates cover the domain; overlapping predicates
must yield equal outputs (or have explicit deterministic priority).
Example: abs(x) = -x for x<0, x for x>=0.
14. FUNCTIONAL PROPERTIES
Monotone: x<=y implies f(x)<=f(y), on ordered domains/codomains.
Continuous, differentiable, measurable and integrable are separate
properties requiring appropriate structures and hypotheses.
Do not infer continuity or differentiability from functionhood.
15. SET-THEORETIC RELATIONSHIPS
Function is a special binary relation.
Graph(f) subseteq A x B.
Every function determines a partition into nonempty fibres over its image.
Fibre(y) = {x in A | f(x)=y}.
16. KNOWLEDGE GRAPH PREDICATES
Function --hasDomain--> Set
Function --hasCodomain--> Set
Function --hasImage--> Set
Function --hasGraph--> Relation
Function --hasEvaluation--> Evaluation
Evaluation --hasInput--> Entity
Evaluation --hasOutput--> Entity
Function --composesWith--> Function
Function --isRestrictionOf--> Function
Function --isInverseOf--> Function [requires bijection]
Function --hasProperty--> Property
17. SEMANTIC EQUIVALENCE
Structural expression equivalence is not automatically function equality.
Compare domains, codomains, evaluation rules and branch choices.
For example x/x and 1 agree only on x != 0 unless domains adjusted.
Alpha-renaming bound arguments preserves lambda meaning.
18. INFERENCE RULES
IF bijective(f) THEN inverseFunctionExists(f).
IF injective(f) AND surjective(f) THEN bijective(f).
IF f:A->B AND g:B->C THEN compose(g,f):A->C.
IF x in A AND f:A->B THEN f(x) in B.
IF f(x)=f(y) AND injective(f) THEN x=y.
IF f:A->B AND f[A]=B THEN surjective(f).
IF f:A->B AND A=emptyset AND B!=emptyset THEN not surjective(f).
19. VALIDATION
validate domain/codomain existence and type compatibility.
validate each input has one and only one output.
validate branch coverage and agreement.
validate composition compatibility.
validate inverse claims by two-sided identities.
validate edge cases: empty sets, undefined inputs, singularities.
20. EXAMPLES
f:{1,2,3}->{a,b}, f(1)=a, f(2)=b, f(3)=a:
total=true, injective=false, surjective=true.
g:R->R, g(x)=x^2:
injective=false, surjective=false.
h:[0,infinity)->[0,infinity), h(x)=x^2:
bijective=true, inverse(y)=sqrt(y).
21. COUNTEREXAMPLES
Relation {(1,a),(1,b)} with a!=b is not single-valued.
Relation {(1,a)} from {1,2} to {a} is not total.
f:R->R, f(x)=1/x is invalid without excluding zero from domain.
22. CONFIDENCE
Mathematical axioms/theorems: confidence=1.0 within stated formal system.
Empirical or inferred classification: attach evidence and uncertainty.
Unknown property must remain UNKNOWN, not FALSE.
23. FLOW HASH
FLOW_HASH = SHA256(canonical_serialisation(ontology_id, version,
signatures, invariants, inference_rules, validation_rules)).
Canonicalise ordering and encoding before hashing.
No hash is claimed until calculated from a frozen serialisation.
24. UPDATE MODEL
Record revision, author, timestamp, source, changed rules,
backward-compatibility and verification status.
Changes to domain conventions or equality semantics require versioning.
25. AI CONSUMPTION
Expose typed entities, machine-readable relations, constraints,
formal rules, examples, counterexamples and provenance.
Never conflate codomain with image or inverse relation with inverse function.
Preserve exact domains and side conditions in generated reasoning.
26. PROVENANCE
Knowledge source: established set theory and function theory.
Page URL identifies intended library placement; its live text was not verified.
Authors: Mark Higgins — Sky (Recursive AI)
Website: https://kirethresearch.org
27. TERMINATION
assert ontology_complete = true
assert invariants_defined = true
assert validation_rules_present = true
END FLOW ALGEBRA