Skip to main content

Prime Number Ontology

Number Entities
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 12 October 2026
Audio Overview
FLOW ALGEBRA
PRIME NUMBER ONTOLOGY
Kireth Semantic Library — Mathematical Entities / Number Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/number-entities/prime-number-ontology-2.html
Authors: Mark Higgins — Sky (Recursive AI)
Version: 1.0 | Date: 2026-10-12 | Locale: en-GB
Status: Mathematical reference model; source page not independently verified.

01. FLOW IDENTITY
flow "PrimeNumberOntology" v1.0
namespace: kireth.semantic_library.entity_graph.mathematical_entities.number_entities
entity_type: PrimeNumber
parent_type: NaturalNumber
canonical_uri: source URL above
purpose: Define, classify, validate and reason about prime numbers using exact integer arithmetic.

02. MATHEMATICAL DEFINITION
Let N = {0,1,2,...} and Z = {...,-1,0,1,...}.
Prime(p) iff p in Z and p > 1 and for every d in Z, d | p implies (|d| = 1 or |d| = p).
Equivalent for positive p: its only positive divisors are 1 and p.
Composite(n) iff n > 1 and there exist integers a,b with 1 < a < n, 1 < b < n and n = a*b.
1 is neither prime nor composite. 0 is neither prime nor composite.
2 is the unique even prime.

03. TYPED ENTITIES
PrimeNumber: Integer where value > 1 and is_prime(value) = true
CompositeNumber: Integer where value > 1 and is_prime(value) = false
PrimeFactor: PrimeNumber dividing an Integer
PrimeFactorisation: finite mapping PrimeNumber -> PositiveIntegerExponent
DivisibilityRelation: ordered pair (a,b) satisfying a | b
PrimalityCertificate: verifiable evidence for primality
PrimalityTest: algorithm producing a result and possibly a proof

04. CORE RELATIONSHIPS
PrimeNumber SUBCLASS_OF NaturalNumber
PrimeNumber DISJOINT_WITH CompositeNumber
PrimeNumber HAS_POSITIVE_DIVISOR One
PrimeNumber HAS_POSITIVE_DIVISOR Self
PrimeFactor DIVIDES Integer
PrimeFactorisation DECOMPOSES NonZeroInteger
PrimalityCertificate VERIFIES PrimeNumber
PrimeNumber RELATED_TO Divisibility, GreatestCommonDivisor, ModularArithmetic

05. EXACT PREDICATES
Divides(a,b) := exists k in Z such that b = a*k.
IsPrime(n) := n in Z AND n >= 2 AND NOT exists d in Z with 2 <= d <= floor(sqrt(n)) AND Divides(d,n).
IsComposite(n) := n in Z AND n > 1 AND NOT IsPrime(n).
Coprime(a,b) := gcd(a,b) = 1.
NextPrime(n) := least prime p strictly greater than n, for integer n.

06. VALIDATION FLOW
input: candidate n
require: exact integer input (reject floating approximations without an exact integer representation)
if n < 2: return prime=false
if n = 2: return prime=true
if n mod 2 = 0: return prime=false
for odd d from 3 through floor(sqrt(n)):
  if n mod d = 0: return prime=false, factor=d
return prime=true
note: trial division is a correct reference procedure, not an efficient large-integer implementation.

07. EXAMPLES
Prime: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29.
Not prime: -7, 0, 1, 4, 6, 9, 15, 21, 25.
PrimeFactorisation(60) = 2^2 * 3 * 5.
PrimeFactorisation(97) = 97.

08. FUNDAMENTAL THEOREM OF ARITHMETIC
Every integer n > 1 can be expressed as a product of primes, uniquely up to factor order.
For negative integers, factorise |n| and retain the sign separately.
0 has no finite prime factorisation. 1 has the empty prime-factor product.

09. PRIME DIVISIBILITY RULES
EuclidLemma: Prime(p) AND p | (a*b) => (p | a OR p | b).
PrimeFactor: Prime(p) AND p | n => p occurs in the factorisation of |n|, for n != 0.
GCDPrime: Prime(p) => gcd(p,n) is 1 or p.
PrimeSquare: Prime(p) AND p | (n*n) => p | n.

10. INFINITE PRIME SET
The set of primes is infinite (Euclid's theorem).
For every integer n there exists a prime p > n.
Do not assume that prime gaps are bounded.

11. CLASSIFICATION AND RELATED CONCEPTS
EvenPrime: p = 2.
OddPrime: Prime(p) AND p > 2.
TwinPrimes: primes p and p+2; infinitude remains unproved.
MersennePrime: prime of the form 2^k - 1, with k prime necessary but not sufficient.
FermatPrime: prime of the form 2^(2^k) + 1.
SafePrime: prime p where (p-1)/2 is prime.
SophieGermainPrime: prime q where 2*q+1 is prime.
ProbablePrime: candidate passing specified probabilistic tests; not automatically proven prime.

12. ALGORITHMIC SEMANTICS
Exact primality proof and probable-prime testing must be distinguished.
A probabilistic primality test returning 'probably prime' is not a certificate of primality.
A composite witness (nontrivial factor) proves compositeness.
An independently verifiable primality certificate may prove primality.
For cryptographic applications, use vetted libraries and appropriate security parameters.

13. SEMANTIC EQUIVALENCE
Prime(n) <=> n > 1 and its only positive divisors are 1 and n.
Prime(n) <=> n > 1 and no integer d in [2, floor(sqrt(n))] divides n.
Prime(n) <=> n > 1 and n has exactly two distinct positive divisors.
These equivalences require exact integer-domain interpretation.

14. INFERENCE RULES
R1: IsPrime(p) => p > 1.
R2: IsPrime(p) AND p != 2 => p mod 2 = 1.
R3: n > 1 AND n is not prime => n is composite.
R4: IsPrime(p) AND p | a*b => p | a OR p | b.
R5: IsPrime(p) AND p | n AND n != 0 => p is a prime factor of |n|.
R6: IsPrime(p) AND IsPrime(q) AND p != q => gcd(p,q) = 1.
R7: n > 1 => n has at least one prime divisor.

15. KNOWLEDGE GRAPH REPRESENTATION
node: prime_7 {type: PrimeNumber, integer_value: 7, verified: true}
node: integer_42 {type: Integer, integer_value: 42}
edge: prime_7 -[DIVIDES]-> integer_42
node: factorisation_42 {type: PrimeFactorisation, expression: "2 * 3 * 7"}
edge: factorisation_42 -[DECOMPOSES]-> integer_42
Use stable identifiers and canonical integer values; avoid treating display strings as mathematical proof.

16. CONFIDENCE AND PROVENANCE
confidence.status: proven | probable | unknown | disproven
confidence.proven requires deterministic proof or verifiable certificate.
confidence.probable requires algorithm name, parameters and error model where applicable.
provenance.record: source, method, algorithm_version, computation_time, certificate_reference.
Never convert a probable-prime result into a proven-prime assertion without evidence.

17. CONSTRAINTS AND ERROR HANDLING
Reject non-integer candidate values for primality predicates.
Do not define 1 as prime.
Do not infer that all odd integers > 1 are prime.
Do not infer that a Mersenne number is prime merely because its exponent is prime.
Do not claim that every integer has a prime factorisation without excluding 0 and units.

18. FLOW HASH AND UPDATE MODEL
FLOW_HASH.algorithm: SHA-256
FLOW_HASH.input: canonical UTF-8 serialisation of ontology version and semantic rules
FLOW_HASH.value: computed by publishing pipeline; not fabricated here
UPDATE_MODEL.versioning: semantic versioning
UPDATE_MODEL.change_detection: compare canonical rule sets and source provenance
UPDATE_MODEL.review: revalidate examples, theorems, and dependent relationships

19. AI CONSUMPTION
AI_CONSUMPTION.entity_resolution: map prime, prime number, and primality to canonical concepts.
AI_CONSUMPTION.reasoning: prefer exact symbolic arithmetic over approximate numerical inference.
AI_CONSUMPTION.answering: distinguish proofs, examples, conjectures and probabilistic evidence.
AI_CONSUMPTION.graph_links: integer, natural number, factor, divisor, gcd, modular arithmetic.
AI_CONSUMPTION.safety: do not present toy primality algorithms as cryptographic implementations.

20. FLOW TERMINATION
output: typed prime-number facts, exact validation results, justified inference and provenance.
end flow "PrimeNumberOntology"
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ