AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
FLOW ALGEBRA
TOTAL FUNCTION ONTOLOGY
Kireth Semantic Library | Mathematical Entities | Function and Mapping Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/function-and-mapping-entities/total-function-ontology.html
Authors: Mark Higgins — Sky (Recursive AI)
Status: formal mathematical synthesis; source page not independently verified
Version: 1.0 | Date: 2026-10-13
01. PURPOSE
flow "TotalFunctionOntology" v1.0
intent: model functions defined at every element of their declared domain
foundation: set theory, function theory, typed semantic graphs
02. ENTITY TYPES
TotalFunction: Function
Domain: Set
Codomain: Set
Input: Entity
Output: Entity
OrderedPair: Tuple[2]
Graph: Set[OrderedPair]
Image: Set
Preimage: Set
Predicate: BooleanExpression
Proof: Evidence
03. CORE DEFINITION
total(f:A->B) iff forall x in A, exists exactly one y in B: (x,y) in graph(f)
graph(f) subseteq A x B
domain(graph(f)) = A
range(f) subseteq B
Note: totality is relative to the declared domain A.
04. TYPE SIGNATURES
declare f: A -> B
apply: Function[A,B] x A -> B
graph: Function[A,B] -> PowerSet(A x B)
image: Function[A,B] x PowerSet(A) -> PowerSet(B)
preimage: Function[A,B] x PowerSet(B) -> PowerSet(A)
05. WELL-FORMEDNESS
A and B must be sets in the chosen foundation
each graph pair has first component in A and second component in B
each x in A has one and only one output
no input in A may be left undefined
no input in A may map to two distinct outputs
06. TOTAL VERSUS PARTIAL
partial_function(p,A,B): graph(p) subseteq A x B and outputs unique
total_function(p,A,B): partial_function(p,A,B) and dom(graph(p))=A
every total function is a partial function relative to A,B
not every partial function is total relative to A,B
a partial function is total on its effective domain
07. EMPTY DOMAIN
if A=empty and B any set, empty graph is the unique total function A->B
if A nonempty and B=empty, no total function A->B exists
if A=B=empty, exactly one total function exists
08. DOMAIN AND CODOMAIN
declared_domain(f)=A
declared_codomain(f)=B
image(f)={f(x) | x in A}
image(f) subseteq B
totality does not imply surjectivity
09. EVALUATION
require x in A
evaluate(f,x) = unique y such that (x,y) in graph(f)
if x not in A, evaluation is outside declared function signature
do not classify out-of-domain calls as evidence of non-totality
10. GRAPH CONSTRUCTION
graph(f)={(x,f(x)) | x in A}
domain(graph(f))=A
functional(graph(f))=true
graph uniquely determines f when A and B are fixed
11. COMPOSITION
given f:A->B and g:B->C total
compose(g,f):A->C
(g o f)(x)=g(f(x))
total(compose(g,f))=true
associativity: h o (g o f)=(h o g) o f for compatible types
12. IDENTITY
id_A:A->A
id_A(x)=x
total(id_A)=true
f o id_A=f
id_B o f=f
13. RESTRICTION
for S subseteq A, f|S:S->B is total
graph(f|S)={(x,f(x)) | x in S}
restricting a total function to S preserves totality relative to S
14. EXTENSION
extending f:A->B to A' superset A requires an output in B for every new input
if B=empty and A' nonempty, no extension exists
an extension F satisfies F(x)=f(x) for all x in A
15. INJECTIVITY
injective(f) iff forall x1,x2 in A: f(x1)=f(x2) implies x1=x2
injectivity independent of totality
16. SURJECTIVITY
surjective(f) iff image(f)=B
surjectivity independent of totality
17. BIJECTIVITY
bijective(f) iff injective(f) and surjective(f)
bijective total f:A->B has a total inverse f^-1:B->A
non-bijective total functions do not have two-sided functional inverses
18. IMAGE AND PREIMAGE
image(f,S)={f(x) | x in S} for S subseteq A
preimage(f,T)={x in A | f(x) in T} for T subseteq B
preimage(f,B)=A
preimage(f,empty)=empty
preimage(f,T1 union T2)=preimage(f,T1) union preimage(f,T2)
preimage(f,T1 intersect T2)=preimage(f,T1) intersect preimage(f,T2)
19. FINITE CARDINALITY
if |A|=m and |B|=n>0, number of total functions A->B is n^m
if A=empty, number of total functions is 1 for any B
if A nonempty and B=empty, number is 0
finite injective f:A->B requires |A|<=|B|
finite surjective f:A->B requires |A|>=|B|
20. EXAMPLES
square:R->R, square(x)=x*x; total=true
reciprocal:R\{0}->R, reciprocal(x)=1/x; total=true
reciprocal:R->R with undefined value at 0; total=false
constant:A->B, constant(x)=b0; total if b0 in B
length:FiniteStrings->NaturalNumbers; total=true
21. NON-EXAMPLES
graph={(1,a)} over A={1,2}, B={a,b}: not total
graph={(1,a),(1,b)} over A={1}, B={a,b}: not a function
expression 1/x over declared domain R without definition at zero: not total
22. KNOWLEDGE GRAPH SCHEMA
TotalFunction --isA--> Function
TotalFunction --hasDomain--> Domain
TotalFunction --hasCodomain--> Codomain
TotalFunction --hasGraph--> Graph
TotalFunction --mapsInputTo--> Output
TotalFunction --hasImage--> Image
TotalFunction --composesWith--> TotalFunction
TotalFunction --restrictsTo--> TotalFunction
TotalFunction --mayBe--> InjectiveFunction
TotalFunction --mayBe--> SurjectiveFunction
TotalFunction --mayBe--> BijectiveFunction
23. INFERENCE RULES
R1: functional(R) and dom(R)=A and R subseteq A x B => total(R,A,B)
R2: total(f,A,B) and total(g,B,C) => total(g o f,A,C)
R3: total(f,A,B) and S subseteq A => total(f|S,S,B)
R4: total(f,A,B) and injective(f) and surjective(f) => bijective(f)
R5: bijective(f:A->B) => total(f^-1,B,A)
R6: total(f,A,B) => preimage(f,B)=A
24. CONSTRAINTS
enforce exactly_one_output_per_declared_input
enforce output_in_codomain
enforce graph_domain_equals_declared_domain
reject missing_input_mapping
reject multiple_distinct_outputs_for_same_input
distinguish partiality from out_of_domain_evaluation
25. SEMANTIC EQUIVALENCE
aliases: ["everywhere-defined function on its domain", "total mapping"]
sameFunction(f,g) requires compatible declared domains/codomains and pointwise equality
extensionalEquality(f,g) iff forall x in A: f(x)=g(x), for common A and B
caution: identical graphs with different declared codomains need not be identical typed functions
26. VALIDATION CASES
CASE T01: f:{1,2}->{a,b}, graph={(1,a),(2,a)} => PASS total
CASE T02: f:{1,2}->{a,b}, graph={(1,a)} => FAIL total
CASE T03: f:{1}->{a,b}, graph={(1,a),(1,b)} => FAIL functional
CASE T04: f:empty->empty, graph=empty => PASS total
CASE T05: f:{1}->empty => FAIL existence
CASE T06: f:R\{0}->R, f(x)=1/x => PASS total
CASE T07: f:R->R, f(x)=1/x undefined at 0 => FAIL total
27. CONFIDENCE
formal_definition: 1.00
mathematical_laws: 1.00 within classical set-theoretic semantics
external_source_alignment: unverified
inferred_taxonomy_links: review_before_publication
28. FLOW_HASH
hash_algorithm: SHA-256
canonicalisation: UTF-8, LF, normalised field order, stable identifiers
hash_input: canonical flow excluding computed hash field
FLOW_HASH: COMPUTE_ON_PUBLICATION
29. UPDATE_MODEL
version: 1.0
update_policy: semantic-versioning
triggers: definition_change, theorem_correction, schema_revision, provenance_update
preserve_previous_versions: true
verify_test_cases_after_update: true
30. AI_CONSUMPTION
mode: typed_ontology_and_rule_graph
entity_resolution: exact_id_then_contextual_alias
parse_signature_before_evaluation: true
validate_totality_relative_to_declared_domain: true
retain_domain_codomain_distinction: true
emit_proof_or_counterexample: true
reject_unsupported_inference: true
31. PROVENANCE
canonical_page: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/function-and-mapping-entities/total-function-ontology.html
source_page_content_verified: false
mathematical_basis: standard set theory and function theory
authors: Mark Higgins — Sky (Recursive AI)
research_site: https://kirethresearch.org
32. TERMINATION
status: COMPLETE
validation: definition, edge cases, composition and examples included
end_flow: true
END FLOW ALGEBRA