Skip to main content

Number Theory Ontology

Number Theory
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 11 October 2026
Audio Overview
FLOW ALGEBRA
TITLE: Number Theory Ontology
DOMAIN: Discrete Mathematics / Number Theory
SOURCE_URL: https://kirethresearch.org/booksai-core/discrete-mathematics-ontologies/number-theory/number-theory-ontology.html
VERSION: 1.0
AUTHORSHIP: Mark Higgins — Sky (Recursive AI)
SITE: https://kirethresearch.org
STATUS: Formal mathematical synthesis; source webpage not independently verified.

1. ONTOLOGY
ontology NumberTheoryOntology {
  entity Integer : Z
  entity NaturalNumber : N
  entity Prime : {p in N | p > 1 and divisors(p) = {1,p}}
  entity Composite : {n in N | n > 1 and not prime(n)}
  entity Divisor : Integer
  entity Congruence : Relation(Integer,Integer,PositiveInteger)
  entity ResidueClass : Set(Integer)
  entity GCD : NonnegativeInteger
  entity LCM : NonnegativeInteger
  entity DiophantineEquation : Equation(IntegerVariables)
  relation divides(a:Integer,b:Integer) : Boolean
  relation coprime(a:Integer,b:Integer) : Boolean
  relation congruent(a:Integer,b:Integer,m:PositiveInteger) : Boolean
}

2. TYPED DEFINITIONS
flow Divisibility(a:Z,b:Z) -> Boolean:
  return exists k:Z such_that b = a*k

flow PrimeTest(n:N) -> Boolean:
  require n >= 0
  return n > 1 and not exists d:N such_that 2 <= d <= floor(sqrt(n)) and d divides n

flow GCD(a:Z,b:Z) -> N0:
  require (a,b) != (0,0)
  return greatest positive d such_that d divides a and d divides b

flow LCM(a:Z,b:Z) -> N0:
  if a == 0 or b == 0: return 0
  return abs(a*b) / GCD(a,b)

flow Congruence(a:Z,b:Z,m:N_positive) -> Boolean:
  return m divides (a-b)

3. FUNDAMENTAL LAWS
LAW EuclideanDivision:
  forall a:Z, b:Z where b > 0:
    exists_unique q,r:Z such_that a=b*q+r and 0<=r<b

LAW FundamentalTheoremArithmetic:
  forall n:N where n>1:
    n has a unique prime factorisation up to factor ordering

LAW BezoutIdentity:
  forall a,b:Z where (a,b)!=(0,0):
    exists x,y:Z such_that a*x+b*y=GCD(a,b)

LAW EuclidLemma:
  prime(p) and p divides (a*b) => (p divides a or p divides b)

LAW GCD_LCM:
  forall a,b:Z where (a,b)!=(0,0):
    GCD(a,b)*LCM(a,b)=abs(a*b)

LAW CongruenceCompatibility:
  a≡b (mod m) and c≡d (mod m) =>
    a+c≡b+d (mod m) and a*c≡b*d (mod m)

LAW FermatLittleTheorem:
  prime(p) and not (p divides a) => a^(p-1)≡1 (mod p)

LAW EulerTheorem:
  m>1 and GCD(a,m)=1 => a^phi(m)≡1 (mod m)

LAW ChineseRemainderTheorem:
  pairwise_coprime(m_1,...,m_k) =>
    system x≡a_i (mod m_i) has unique solution modulo product(m_i)

4. EXECUTABLE OPERATIONS
flow EuclideanGCD(a:Z,b:Z) -> N0:
  require (a,b)!=(0,0)
  x=abs(a); y=abs(b)
  while y!=0:
    (x,y)=(y,x mod y)
  return x

flow ExtendedGCD(a:Z,b:Z) -> (g:N0,x:Z,y:Z):
  require (a,b)!=(0,0)
  return coefficients satisfying a*x+b*y=g and g=GCD(a,b)

flow ModularInverse(a:Z,m:N_positive) -> Optional[Z]:
  require m>1
  (g,x,y)=ExtendedGCD(a,m)
  if g!=1: return NONE
  return x mod m

flow PrimeFactorisation(n:N) -> Multiset[Prime]:
  require n>1
  result=empty_multiset
  for d from 2 while d*d<=n:
    while n mod d==0:
      result.add(d); n=n/d
  if n>1: result.add(n)
  return result

flow LinearDiophantine(a:Z,b:Z,c:Z) -> SolutionFamily:
  if a==0 and b==0:
    return ALL_INTEGER_PAIRS if c==0 else NO_SOLUTION
  g=GCD(a,b)
  if c mod g!=0: return NO_SOLUTION
  obtain x0,y0 such_that a*x0+b*y0=c
  return {(x0+(b/g)*t, y0-(a/g)*t) | t in Z}

5. SEMANTIC RELATIONSHIPS
RELATION Prime IS_A NaturalNumber
RELATION Composite IS_A NaturalNumber
RELATION Divisibility DEFINES FactorRelation
RELATION PrimeFactorisation SUPPORTS GCD
RELATION PrimeFactorisation SUPPORTS LCM
RELATION Congruence DEFINES ResidueClass
RELATION GCD SUPPORTS Coprimality
RELATION Coprimality ENABLES ModularInverse
RELATION EuclideanAlgorithm COMPUTES GCD
RELATION BezoutIdentity CERTIFIES GCD
RELATION ChineseRemainderTheorem COMBINES ModularCongruences
RELATION NumberTheory SUPPORTS Cryptography
RELATION NumberTheory SUPPORTS DiscreteMathematics

6. INFERENCE RULES
RULE DivisibilityTransitivity:
  a divides b and b divides c => a divides c
RULE CoprimeInverse:
  GCD(a,m)=1 and m>1 => exists inverse(a) modulo m
RULE PrimeFactor:
  n>1 => exists prime p such_that p divides n
RULE CongruenceEquivalence:
  a≡b (mod m) and b≡c (mod m) => a≡c (mod m)
RULE DiophantineSolvability:
  (a,b)!=(0,0) => [a*x+b*y=c has integer solution iff GCD(a,b) divides c]

7. VALIDATION
CHECK domain_types are explicit
CHECK modulus > 0 for congruence
CHECK gcd(0,0) is undefined in this ontology
CHECK prime(0)=false and prime(1)=false
CHECK lcm(a,0)=0
CHECK modular inverse exists iff gcd(a,m)=1 for m>1
CHECK prime factorisation requires n>1
CHECK arithmetic uses exact integer operations
CHECK no unsupported assertion that all Diophantine equations are decidable
CHECK algorithm preconditions before execution

8. SEMANTIC_EQUIVALENCE
EQUIVALENCE "a divides b" <=> "b is a multiple of a"
EQUIVALENCE "a congruent b modulo m" <=> "m divides (a-b)"
EQUIVALENCE "relatively prime" <=> "coprime"
EQUIVALENCE "greatest common factor" <=> "greatest common divisor"
EQUIVALENCE "unique prime decomposition" <=> "prime factorisation unique up to order"

9. CONFIDENCE
CONFIDENCE mathematical_definitions: 1.00
CONFIDENCE standard_theorems: 1.00
CONFIDENCE alignment_with_live_page: unverified
CONFIDENCE computational_results: conditional_on_exact_arithmetic_and_preconditions

10. FLOW_HASH
FLOW_HASH:
  algorithm: SHA-256
  input: canonical UTF-8 bytes of this flow excluding FLOW_HASH value
  value: COMPUTE_ON_INGEST
  note: Do not treat an uncomputed placeholder as a digest.

11. UPDATE_MODEL
UPDATE_MODEL:
  version: 1.0
  strategy: semantic_versioning
  preserve: mathematical_truths_and_source_provenance
  validate: definitions, laws, type_constraints, executable_preconditions
  on_change: recompute_flow_hash_and_revalidate_dependencies

12. AI_CONSUMPTION
AI_CONSUMPTION:
  representation: typed_ontology_and_rule_flow
  parse_mode: deterministic
  reasoning: exact_symbolic_where_possible
  retrieval_keys: [number_theory, integer, prime, divisibility, gcd, lcm, congruence, modular_arithmetic, diophantine]
  required_checks: [type_safety, preconditions, mathematical_consistency, provenance]
  prohibit: [fabricated_proofs, invalid_modular_division, unsupported_source_claims]
  output: verified_result_or_explicit_uncertainty

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