AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
FLOW ALGEBRA
MATHEMATICAL RELATION ENTITY ONTOLOGY
Kireth Semantic Library | Entity Graph > Mathematical Entities > Relation Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/relation-entities/mathematical-relation-entity-ontology.html
Authors: Mark Anthony Higgins — Sky (Recursive AI)
Specification: 1.0 | 2026-10-13 | Locale: en-GB
Status: Formal mathematical specification; webpage title and authorship verified, underlying page's full formal code not exposed in retrieved HTML.
01. PURPOSE
flow "MathematicalRelationEntityOntology" v1.0
domain: set_theory | discrete_mathematics | logic | knowledge_representation
purpose: represent, type, validate and reason about mathematical relations
execution_model: declarative typed inference with explicit preconditions
02. PRIMITIVE TYPES
Set[A] : collection of elements of type A
OrderedPair[A,B] : (a:A,b:B)
Relation[A,B] : subset of CartesianProduct(A,B)
Endorelation[A] : Relation[A,A]
Predicate[A,B] : A x B -> Boolean
Proposition : Boolean-valued assertion
Witness[A,B] : OrderedPair[A,B]
Proof : derivation with premises and valid rule
03. ENTITY SCHEMA
entity MathematicalRelation:
id: IRI
name: String
domain: Set[A]
codomain: Set[B]
extension: Set[OrderedPair[A,B]]
defining_predicate: Predicate[A,B]?
relation_arity: Integer = 2
properties: Set[RelationProperty]
context: IRI?
provenance: SourceReference
version: String
confidence: [0,1]
invariant: extension subset_of (domain x codomain)
invariant: relation_arity == 2 for Relation[A,B]
04. FORMAL DEFINITION
R subset_of A x B
relates(R,a,b) <=> (a in A) and (b in B) and ((a,b) in R)
extensional_equal(R,S) <=> domains_compatible(R,S) and
codomains_compatible(R,S) and
forall a,b: relates(R,a,b) <=> relates(S,a,b)
NOTE: Relation identity may include declared domain/codomain; equality of extensions
alone does not imply equality of typed relation entities.
05. DOMAIN, CODOMAIN AND IMAGE
active_domain(R) = {a in A | exists b in B: relates(R,a,b)}
range(R) = {b in B | exists a in A: relates(R,a,b)}
image(R,X) = {b in B | exists a in X: relates(R,a,b)} where X subset_of A
preimage(R,Y) = {a in A | exists b in Y: relates(R,a,b)} where Y subset_of B
invariant: active_domain(R) subset_of A
invariant: range(R) subset_of B
06. RELATION CATEGORIES
binary_relation: R subset_of A x B
homogeneous_relation: R subset_of A x A
n_ary_relation: R subset_of A1 x ... x An where n >= 1
empty_relation(A,B): extension = {}
full_relation(A,B): extension = A x B
identity_relation(A): {(a,a) | a in A}
NOTE: N-ary relations use a separate typed schema, not the binary schema above.
07. ENDORRELATION PROPERTIES
For R subset_of A x A:
reflexive(R) <=> forall a in A: aRa
irreflexive(R) <=> forall a in A: not aRa
symmetric(R) <=> forall a,b in A: aRb -> bRa
antisymmetric(R) <=> forall a,b in A: (aRb and bRa) -> a=b
asymmetric(R) <=> forall a,b in A: aRb -> not bRa
transitive(R) <=> forall a,b,c in A: (aRb and bRc) -> aRc
total_on_distinct(R) <=> forall a,b in A: a!=b -> (aRb or bRa)
connected(R) <=> forall a,b in A: aRb or bRa
NOTE: All properties are relative to the declared carrier set A.
08. DERIVED RELATION CLASSES
equivalence_relation(R) <=> reflexive(R) and symmetric(R) and transitive(R)
preorder(R) <=> reflexive(R) and transitive(R)
partial_order(R) <=> preorder(R) and antisymmetric(R)
strict_partial_order(R) <=> irreflexive(R) and transitive(R)
total_order(R) <=> partial_order(R) and connected(R)
strict_total_order(R) <=> strict_partial_order(R) and total_on_distinct(R)
tolerance_relation(R) <=> reflexive(R) and symmetric(R)
09. INVERSE RELATION
inverse(R) = {(b,a) | (a,b) in R}
type: inverse(Relation[A,B]) -> Relation[B,A]
theorem: inverse(inverse(R)) = R (with matching typed carriers)
theorem: symmetric(R) <=> inverse(R)=R for endorelations
10. COMPOSITION
compose(S,R) = {(a,c) | exists b in B: aRb and bSc}
types: R:Relation[A,B], S:Relation[B,C], compose(S,R):Relation[A,C]
theorem: compose(T,compose(S,R)) = compose(compose(T,S),R)
theorem: compose(identity(B),R) = R
theorem: compose(R,identity(A)) = R
theorem: inverse(compose(S,R)) = compose(inverse(R),inverse(S))
11. SET OPERATIONS ON RELATIONS
union(R,S): pairs in R or S, with compatible carriers
intersection(R,S): pairs in both R and S
difference(R,S): pairs in R and not S
complement(R): (A x B) \ R relative to declared A and B
subset_relation(R,S) <=> extension(R) subset_of extension(S)
invariant: operations retain declared carrier typing
12. CLOSURES
reflexive_closure(R) = R union identity(A)
symmetric_closure(R) = R union inverse(R)
transitive_closure(R) = union_{n>=1} R^n
reflexive_transitive_closure(R) = identity(A) union transitive_closure(R)
precondition: R is endorelation on A
NOTE: R^n denotes n-fold relational composition, not numeric exponentiation.
13. EQUIVALENCE CLASSES AND QUOTIENT
precondition: equivalence_relation(R) on A
class_of(a,R) = {b in A | aRb}
quotient(A,R) = {class_of(a,R) | a in A}
theorem: classes are equal or disjoint
theorem: quotient(A,R) partitions A
14. ORDER RELATION CONSEQUENCES
precondition: partial_order(R) on A
comparable(a,b) <=> aRb or bRa
minimal(m,X) <=> m in X and not exists x in X: x!=m and xRm
least(m,X) <=> m in X and forall x in X: mRx
theorem: least element, if present, is unique
NOTE: minimal and least are distinct concepts.
15. PREDICATE / EXTENSION CONVERSION
from_predicate(P,A,B) = {(a,b) in A x B | P(a,b)}
to_predicate(R)(a,b) = relates(R,a,b)
invariant: conversions preserve membership truth over typed carriers
NOTE: Decidability of P is not assumed.
16. KNOWLEDGE GRAPH MAPPING
nodes: RelationEntity, SetEntity, ElementEntity, OrderedPairEntity,
RelationPropertyEntity, ProofEntity, ContextEntity
edges:
HAS_DOMAIN(RelationEntity,SetEntity)
HAS_CODOMAIN(RelationEntity,SetEntity)
HAS_MEMBER_PAIR(RelationEntity,OrderedPairEntity)
HAS_FIRST(OrderedPairEntity,ElementEntity)
HAS_SECOND(OrderedPairEntity,ElementEntity)
SATISFIES_PROPERTY(RelationEntity,RelationPropertyEntity)
INVERSE_OF(RelationEntity,RelationEntity)
COMPOSED_FROM(RelationEntity,RelationEntity)
JUSTIFIED_BY(AssertionEntity,ProofEntity)
guard: graph edges cannot imply a property without a valid derivation
17. SEMANTIC EQUIVALENCE
semantic_equivalence(R,S):
require same typed domain and codomain, or explicit isomorphism mapping
require forall typed pairs: relates(R,a,b) iff relates(S,a,b)
distinguish: identical graph IDs vs extensionally equal relations
distinguish: relation equality vs equivalence relation on a set
aliases: "binary relation", "relation on sets" (context-dependent)
reject_equivalence: "function" and "relation" (functions are specialised relations)
18. INFERENCE RULES
R1: relates(R,a,b) -> a in domain(R) and b in codomain(R)
R2: reflexive(R) and a in A -> relates(R,a,a)
R3: symmetric(R) and relates(R,a,b) -> relates(R,b,a)
R4: transitive(R) and relates(R,a,b) and relates(R,b,c) -> relates(R,a,c)
R5: antisymmetric(R) and relates(R,a,b) and relates(R,b,a) -> a=b
R6: equivalence_relation(R) -> reflexive(R), symmetric(R), transitive(R)
R7: partial_order(R) -> reflexive(R), antisymmetric(R), transitive(R)
R8: relates(R,a,b) -> relates(inverse(R),b,a)
R9: relates(R,a,b) and relates(S,b,c) -> relates(compose(S,R),a,c)
R10: not relates(R,a,b) -> no inference of relates(R,b,a)
policy: no closed-world negation unless source explicitly declares completeness
19. VALIDATION
validate_relation(R):
assert all extension pairs have length 2
assert all first components belong to domain
assert all second components belong to codomain
assert property claims match proven predicates or certified evidence
assert relation composition uses compatible intermediate carrier
assert inverse reverses carrier types
assert complement has declared ambient Cartesian product
assert proof and provenance references resolve
output: VALID | INVALID | UNDETERMINED
20. TEST CASES
T1: A={1,2}; R={(1,1),(2,2)} -> reflexive,symmetric,antisymmetric,transitive
T2: A={1,2}; R={(1,2)} -> irreflexive,asymmetric,transitive; not reflexive
T3: A={1,2}; R={(1,2),(2,1)} -> symmetric; not antisymmetric
T4: A={1,2,3}; R={(1,2),(2,3)} -> not transitive
T5: A={1,2}; R={} -> irreflexive,symmetric,antisymmetric,transitive
T6: A={} ; R={} -> reflexive,irreflexive,symmetric,antisymmetric,transitive
T7: A={1,2}; R={(1,2)} -> inverse(R)={(2,1)}
T8: A={1,2}; R={(1,2)}; S={(2,1)} -> compose(S,R)={(1,1)}
21. CONFIDENCE
confidence:
mathematical_theorem_with_checked_proof: 1.0
derived_from_verified_axioms: 1.0
source_assertion_without_proof: source_dependent
ambiguous_symbol_or_carrier: UNDETERMINED
policy: confidence is evidence metadata, not a replacement for proof
22. FLOW_HASH
canonicalise: Unicode NFC; stable schema order; normalise whitespace;
normalise bound variable names where alpha-equivalence is certified
hash_algorithm: SHA-256
flow_hash: SHA256(canonical_serialisation(specification_without_hash_field))
NOTE: Hash is computed by the consuming implementation; no digest is fabricated.
23. UPDATE_MODEL
version_policy: semantic_versioning
on_change:
validate types and invariants
re-evaluate derived relation properties
invalidate dependent inference results
regenerate canonical serialisation and Flow Hash
preserve previous version and provenance
rollback: restore last validated version
24. AI_CONSUMPTION
parse -> typecheck -> normalise -> validate -> infer -> verify -> serialise
never treat relation properties as true without carrier-specific checks
preserve quantifier scope, typed domains, proof status and provenance
report unknown or undecidable predicates as UNDETERMINED
never conflate relation composition with function composition without type proof
25. OUTPUT CONTRACT
output:
relation_id: IRI
domain: SetRef
codomain: SetRef
extension_or_predicate: TypedRepresentation
verified_properties: Set[PropertyAssertion]
inferred_facts: Set[ProofBackedAssertion]
validation_status: VALID | INVALID | UNDETERMINED
confidence: Number | UNDETERMINED
flow_hash: String (computed at execution)
provenance: SourceReference
version: String
END FLOW ALGEBRA