FLOW ALGEBRA
INTEGER ONTOLOGY — FULL FORMALISATION
Kireth Semantic Library | Entity Graph > Mathematical Entities > Number Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/number-entities/integer-ontology-2.html
Version: 1.0 | 2026-10-12 | Locale: en-GB
Authors: Mark Higgins — Sky (Recursive AI)
Status: Subject-based formalisation; source webpage not independently verified.
01. PURPOSE
flow IntegerOntology v1.0
intent: model integers, their canonical representations, arithmetic,
ordering, divisibility, proofs and machine-readable semantics.
universe: Z = {...,-2,-1,0,1,2,...}
invariant: every Integer denotes one exact mathematical value.
02. TYPES
type Integer = Z
type Natural = {n in Z | n >= 0} # convention stated explicitly
type PositiveInteger = {n in Z | n > 0}
type NegativeInteger = {n in Z | n < 0}
type NonzeroInteger = {n in Z | n != 0}
type Boolean = {true,false}
type IntegerPair = Integer x Integer
type Divisor = NonzeroInteger
type CongruenceModulus = PositiveInteger
type Proof = {premises,rule,conclusion,certificate}
type Claim = {predicate,arguments,context,provenance}
03. ENTITY GRAPH
Integer IS_A Number
Integer SUBSET_OF Rational
Natural SUBSET_OF Integer
Integer HAS_PROPERTY exact,discrete,ordered,countably_infinite
Integer SUPPORTS addition,subtraction,multiplication
Integer SUPPORTS euclidean_division,divisibility,congruence
Integer HAS_REPRESENTATION decimal,binary,octal,hexadecimal
Integer HAS_RELATION less_than,equal_to,divides,congruent_modulo
04. CANONICAL CONSTRUCTION
construct Z from pairs (a,b) in N x N
interpret (a,b) as a-b
equivalence: (a,b) ~ (c,d) iff a+d = b+c
quotient: Z := (N x N)/~
add([a,b],[c,d]) = [a+c,b+d]
negate([a,b]) = [b,a]
multiply([a,b],[c,d]) = [ac+bd,ad+bc]
require: operations respect equivalence classes.
05. SIGN AND ORDER
sign(n) = -1 if n<0; 0 if n=0; 1 if n>0
abs(n) = n if n>=0 else -n
compare(a,b) = sign(a-b)
order: total, transitive, antisymmetric
successor(n) = n+1
predecessor(n) = n-1
interval(a,b) = {n in Z | a<=n<=b}
06. ARITHMETIC OPERATIONS
add: Z x Z -> Z
subtract: Z x Z -> Z
multiply: Z x Z -> Z
negate: Z -> Z
power: Z x Natural -> Z; 0^0 is undefined by this flow
division: Z x NonzeroInteger -> Rational
closure: addition,subtraction,multiplication
not_closed: exact division in general
07. ALGEBRAIC LAWS
add(a,b)=add(b,a)
multiply(a,b)=multiply(b,a)
add(add(a,b),c)=add(a,add(b,c))
multiply(multiply(a,b),c)=multiply(a,multiply(b,c))
multiply(a,add(b,c))=add(multiply(a,b),multiply(a,c))
add(a,0)=a
multiply(a,1)=a
add(a,-a)=0
multiply(a,0)=0
integral_domain: a*b=0 => a=0 or b=0
units(Z) = {-1,1}
08. EUCLIDEAN DIVISION
input: a in Z, d in NonzeroInteger
output: unique q,r in Z
constraint: a=d*q+r and 0<=r<abs(d)
remainder(a,d) := r
quotient(a,d) := q
guard: d != 0
note: programming-language % may implement different conventions.
09. DIVISIBILITY
divides(d,n) iff exists k in Z: n=d*k
gcd(a,b) >= 0
gcd(a,b) divides a and b
gcd(a,b) is greatest common divisor for (a,b)!=(0,0)
gcd(0,0)=0 by explicit convention
lcm(a,b)=abs(a*b)/gcd(a,b) when a*b!=0
lcm(a,0)=0
coprime(a,b) iff gcd(a,b)=1
bezout: exists x,y in Z: a*x+b*y=gcd(a,b)
10. PRIME AND COMPOSITE
prime(p) iff p>1 and positive_divisors(p)={1,p}
composite(n) iff n>1 and not prime(n)
0,1 and negative integers are neither positive primes nor composites
fundamental_theorem: every n>1 has unique prime factorisation
uniqueness: up to factor ordering
11. MODULAR ARITHMETIC
congruent(a,b,m) iff m>0 and m divides (a-b)
residue(a,m) = remainder(a,m)
congruence: equivalence relation for fixed m>0
preserve: addition and multiplication modulo m
inverse_mod(a,m) exists iff gcd(a,m)=1
no_inverse otherwise
12. PARITY
even(n) iff remainder(n,2)=0
odd(n) iff remainder(n,2)=1
even(n) XOR odd(n)
even(a)+even(b) => even(a+b)
odd(a)+odd(b) => even(a+b)
odd(a)*odd(b) => odd(a*b)
13. REPRESENTATIONS
parse_integer(text,base) -> Result[Integer,ParseError]
base in {2,...,36}
canonical_decimal(n): sign only for n<0, no redundant leading zeros
numeric_identity independent_of numeral_base
distinguish: exact mathematical integer vs fixed-width machine integer
reject: invalid digits, ambiguous sign, malformed input
14. MACHINE INTEGER BOUNDARY
signed_w_bit_range = [-2^(w-1), 2^(w-1)-1]
unsigned_w_bit_range = [0,2^w-1]
overflow_policy: checked | saturating | wrapping | arbitrary_precision
require: policy declared before machine arithmetic
never silently equate overflowed value with exact Z result
15. FORMAL INFERENCE RULES
R1: Integer(a) and Integer(b) => Integer(a+b)
R2: Integer(a) => Integer(-a)
R3: a<b and b<c => a<c
R4: divides(d,a) and divides(d,b) => divides(d,a+b)
R5: congruent(a,b,m) and congruent(b,c,m) => congruent(a,c,m)
R6: gcd(a,m)=1 => modular_inverse_exists(a,m)
R7: prime(p) and divides(p,a*b) => divides(p,a) or divides(p,b)
R8: a*b=0 => a=0 or b=0
every_rule: record premises, constraints, derivation, provenance.
16. PROOF AND VALIDATION
prove(claim) -> Proof | Unknown | Counterexample
verify(proof): independently check each inference step
disprove(universal_claim): provide valid counterexample
exact_integer_claim: confidence=1 only if formally established
unverified_claim: do not promote to mathematical theorem
17. EXAMPLE EXECUTIONS
euclidean_division(-17,5) -> q=-4,r=3
gcd(54,24) -> 6
congruent(17,5,12) -> true
inverse_mod(3,11) -> 4
prime(1) -> false
abs(-9) -> 9
7/2 -> Rational(7,2), not Integer
18. SEMANTIC_EQUIVALENCE
equivalent_integer_literals('10', '1010', bases=(10,2)) -> true
equivalent_integer_literals('-0','0', bases=(10,10)) -> true
equal_value(a,b) iff normalise(a)=normalise(b)
preserve: declared numeric domain, sign, exactness, unit context
do_not_conflate: integer 2 with string '2' before explicit parsing
19. CONFIDENCE
CONFIDENCE(claim): float in [0,1]
formally_verified: 1.0 subject to proof system assumptions
empirical_or_model_generated: calibrated estimate, not proof
contradiction: mark inconsistent; do not average conflicting truths
confidence_metadata: {method,evidence,assumptions,version}
20. FLOW_HASH
FLOW_HASH := SHA256(canonical_utf8(flow_version,ontology_id,
declarations,axioms,rules,normalisation_policy))
canonicalise: stable key order, newline format, Unicode NFC
exclude: volatile timestamps and non-semantic presentation metadata
verify: recompute hash on ingestion and compare to stored digest
21. UPDATE_MODEL
UPDATE_MODEL(event):
validate(event.schema,event.provenance)
classify(event as axiom_change | rule_change | example_change)
check backward_compatibility and proof_dependencies
invalidate affected derived claims and cached proofs
increment ontology_version
recompute FLOW_HASH
publish change_log and reproducible validation results
22. AI_CONSUMPTION
AI_CONSUMPTION:
ontology_id: integer-ontology
entity_type: MathematicalEntity.Integer
domain: exact_arithmetic
output: {typed_entities,relations,rules,proofs,provenance,hash}
require: explicit domains and division-by-zero guards
require: exact arithmetic for formal conclusions
distinguish: theorem, conjecture, approximation, example
refuse: fabricated proofs or unsupported equivalences
23. INTEROPERABILITY
maps_to: NumberOntology, NaturalNumberOntology, WholeNumberOntology
maps_to: RationalNumberOntology, PrimeNumberOntology
supports: AlgebraOntology, NumberTheoryOntology, FormalLogicOntology
serialization: UTF-8 plain text, optional JSON-LD/RDF mapping
identity: stable ontology URI plus canonical concept identifiers
24. VALIDATION CHECKLIST
[ ] integer domains declared
[ ] zero and negative cases covered
[ ] division and modulus conventions explicit
[ ] arithmetic laws consistent
[ ] proofs independently verifiable
[ ] machine overflow policy explicit
[ ] semantic equivalence exact
[ ] FLOW_HASH reproducible
[ ] UPDATE_MODEL dependency-safe
[ ] AI_CONSUMPTION provenance preserved
END FLOW ALGEBRA
Download Code
Copy to Clipboard