FLOW ALGEBRA
FRACTION ONTOLOGY
Kireth Semantic Library | Entity Graph | Mathematical Entities | Numeric Value Entities
Version: 1.0 | Date: 2026-10-12
Authors: Mark Higgins — Sky (Recursive AI)
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/numeric-value-entities/fraction-ontology.html
Source status: Ontology constructed from established mathematics; webpage text not independently verified.
01. IDENTITY
flow "FractionOntology" v1.0
entity: Fraction
parent: NumericValueEntity
related: RationalNumber, Integer, Decimal, Ratio, Division, Proportion
purpose: Represent and reason over numerator-denominator expressions and their rational values.
02. TYPE SYSTEM
type Integer = Z
type NonzeroInteger = {n in Z | n != 0}
type FractionExpression = (numerator: Integer, denominator: NonzeroInteger)
type RationalValue = equivalence class of FractionExpression
type MixedNumber = (whole: Integer, proper_part: FractionExpression)
type Sign = {negative, zero, positive}
03. CONSTRUCTORS
make_fraction(a: Z, b: Z) requires b != 0 -> FractionExpression(a,b)
value(a/b) = a divided by b
canonical(a,b):
require b != 0
if a == 0: return (0,1)
g = gcd(abs(a), abs(b))
s = -1 if b < 0 else 1
return (s*a/g, s*b/g)
04. INVARIANTS
INVARIANT denominator != 0
INVARIANT canonical.denominator > 0
INVARIANT gcd(abs(canonical.numerator), canonical.denominator) == 1
INVARIANT canonical(0,b) == (0,1) for all b != 0
INVARIANT a/b == c/d iff a*d == c*b (b,d != 0)
INVARIANT expression identity != value identity: 1/2 and 2/4 are distinct expressions, same value
05. CLASSIFICATION
proper_fraction(a/b) iff abs(a) < abs(b) [magnitude convention]
improper_fraction(a/b) iff abs(a) >= abs(b) [magnitude convention]
unit_fraction(a/b) iff canonical(a,b).numerator == 1
integer_valued(a/b) iff b divides a
positive_fraction(a/b) iff a*b > 0
negative_fraction(a/b) iff a*b < 0
zero_fraction(a/b) iff a == 0
NOTE: Proper/improper terminology varies for signed fractions; record convention.
06. EXACT ARITHMETIC
add(a/b,c/d) = (a*d+b*c)/(b*d)
subtract(a/b,c/d) = (a*d-b*c)/(b*d)
multiply(a/b,c/d) = (a*c)/(b*d)
divide(a/b,c/d) = (a*d)/(b*c), requires c != 0
negate(a/b) = (-a)/b
reciprocal(a/b) = b/a, requires a != 0
power(a/b,n) = a^n/b^n for integer n >= 0
power(a/b,n) for n < 0 requires a != 0
normalize outputs to canonical form.
07. ORDER AND COMPARISON
compare(a/b,c/d): normalize both denominators positive; compare a*d and c*b
absolute(a/b) = abs(a)/abs(b)
distance(x,y) = abs(x-y)
min(x,y), max(x,y) defined by rational order
08. EQUIVALENCE AND SIMPLIFICATION
SEMANTIC_EQUIVALENCE: (a,b) ~ (c,d) iff a*d == b*c
reduce(a/b) -> canonical(a,b)
scale(a/b,k) = (k*a)/(k*b), requires k != 0
value_preserved(reduce(x)) = true
09. DECIMAL CONVERSION
fraction_to_decimal(a/b): exact terminating iff reduced denominator has only prime factors 2 and 5
otherwise decimal expansion repeats eventually
finite_decimal_to_fraction(coefficient,scale) = coefficient / 10^scale
approximate_decimal(x,precision,rounding_mode) -> ApproximateValue
INVARIANT exact fraction must not silently become approximate floating-point value
10. MIXED-NUMBER INTERPRETATION
mixed_to_fraction(w,p): interpret using explicit sign convention
example: 2 1/3 = 7/3
example: -2 1/3 = -7/3 under conventional whole-sign interpretation
ambiguous signed notation -> request disambiguation
11. KNOWLEDGE GRAPH
Fraction --subclassOf--> NumericValueEntity
Fraction --represents--> RationalNumber
Fraction --hasNumerator--> Integer
Fraction --hasDenominator--> NonzeroInteger
Fraction --hasCanonicalForm--> FractionExpression
Fraction --equivalentValueTo--> Fraction
Fraction --convertibleTo--> DecimalRepresentation
Fraction --usedIn--> Ratio
Fraction --usedIn--> Proportion
Fraction --supportsOperation--> Addition|Subtraction|Multiplication|Division
12. INFERENCE RULES
RULE numerator == 0 and denominator != 0 => value == 0
RULE denominator == 1 => value is integer
RULE gcd(abs(a),abs(b)) == 1 and b > 0 => canonical form
RULE a*d == b*c and b*d != 0 => equivalent rational values
RULE b != 0 and a != 0 => reciprocal exists
RULE b == 0 => invalid fraction expression
RULE denominator in canonical form factors solely into 2 and 5 => terminating base-10 decimal
13. VALIDATION
validate input integers; reject non-integer numerator/denominator unless explicitly extended type
reject zero denominator
check cross-product equality using arbitrary-precision integers
verify canonical signs and gcd
avoid overflow and floating-point equality in exact reasoning
check operation preconditions before evaluation
14. ERROR SEMANTICS
ERR_ZERO_DENOMINATOR: invalid construction
ERR_DIVIDE_BY_ZERO: fraction divisor has zero numerator
ERR_NONINTEGER_COMPONENT: components violate Integer type
ERR_AMBIGUOUS_MIXED_SIGN: mixed-number sign convention unspecified
ERR_PRECISION_LOSS: exact-to-approximate conversion without declared precision
15. EXAMPLES
canonical(6,8) = (3,4)
canonical(-6,-8) = (3,4)
1/2 + 1/3 = 5/6
3/4 * 2/3 = 1/2
2/3 / 4/5 = 5/6
1/3 = 2/6 (same rational value)
1/8 = 0.125 (terminating)
1/3 = 0.333... (repeating)
16. SEMANTIC CONTEXT
A fraction may denote a symbolic expression, an exact rational value, a part-whole relation,
a ratio, or a measurement. Preserve context and distinguish these interpretations.
Part-whole contexts require a declared whole and compatible units.
For dimensional quantities, fraction arithmetic must preserve unit semantics.
17. CONFIDENCE
CONFIDENCE mathematical_axioms: 1.0 within stated conventional definitions
CONFIDENCE derived_exact_results: 1.0 if premises and computation validated
CONFIDENCE extracted_from_text: source-dependent, never assume certainty
CONFIDENCE approximate_results: attach error bounds and rounding policy
18. FLOW_HASH
FLOW_HASH = SHA256(canonical_serialization(flow_version, type_definitions, rules, constraints))
FLOW_HASH purpose: detect content revisions and preserve provenance
NOTE: Hash value generated at deployment; no uncomputed digest is asserted.
19. UPDATE_MODEL
UPDATE_MODEL: semantic_versioning
on change: validate definitions, rerun example tests, compare rule compatibility
breaking changes: increment major version
record provenance, revision date, and affected graph links
20. AI_CONSUMPTION
AI_CONSUMPTION:
machine_readable: true
exact_arithmetic: preferred
canonical_representation: reduced fraction with positive denominator
reasoning: typed inference with explicit preconditions
graph_linking: entity IDs and equivalence edges
uncertainty: preserve exact-versus-approximate distinction
output: canonical form + optional original expression + derivation
21. QUALITY TESTS
TEST canonical(0,-9) == (0,1)
TEST canonical(10,-20) == (-1,2)
TEST equivalent(2/4,1/2) == true
TEST add(1/6,1/3) == 1/2
TEST reciprocal(0/5) -> ERR_DIVIDE_BY_ZERO
TEST make_fraction(3,0) -> ERR_ZERO_DENOMINATOR
TEST terminating_decimal(7/40) == true
TEST terminating_decimal(1/7) == false
22. ATTRIBUTION
Mark Higgins — Sky (Recursive AI)
Kireth Research | https://kirethresearch.org
END FLOW ALGEBRA
Download Code
Copy to Clipboard