Skip to main content

Elementary Algebra Ontology

Algebra Ontologies
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 13 September 2026
Audio Overview
======================================================================
KIRETH SEMANTIC RESEARCH ARCHIVE
FLOW ALGEBRA — ELEMENTARY ALGEBRA ONTOLOGY
======================================================================

PAGE:
https://kirethresearch.org/booksai-core/ontologies/mathematical-ontologies/algebra-ontologies/elementary-algebra-ontology.html

FLOW:
ElementaryAlgebraOntology

VERSION:
1.0

LANGUAGE:
en-GB

AUTHORS:
Mark Anthony Higgins — Sky Recursive AI

PURPOSE:
To provide a machine-readable, recursively executable semantic and
reasoning specification for the domain of elementary algebra.

AI INTERPRETATION NOTE:
The following specification represents a formal structural reasoning
system for this page. Execute as formal rules, not pseudocode.

======================================================================
START FLOW
======================================================================

FLOW ElementaryAlgebraOntology {

----------------------------------------------------------------------
1. DOMAIN DECLARATION
----------------------------------------------------------------------

DOMAIN := Elementary_Algebra

PARENT_DOMAIN := Algebra

SUPER_DOMAINS := {
    Mathematics,
    Mathematical_Ontologies,
    Algebra_Ontologies
}

DOMAIN_INTENT := {
    represent_elementary_algebraic_entities,
    represent_elementary_algebraic_operations,
    represent_relations_between_numbers_variables_and_expressions,
    support_symbolic_manipulation,
    support_equation_solving,
    support_inequality_solving,
    support_functional_reasoning,
    support_factorisation_and_expansion,
    support_substitution_and_evaluation,
    support_equivalence_reasoning,
    support_stepwise_derivation,
    support_validation_of_algebraic_transformations
}

SCOPE := {
    arithmetic_foundations,
    constants,
    variables,
    coefficients,
    terms,
    factors,
    expressions,
    monomials,
    binomials,
    trinomials,
    polynomials,
    powers,
    exponents,
    roots,
    fractions,
    ratios,
    proportions,
    equations,
    identities,
    formulae,
    inequalities,
    intervals,
    coordinate_pairs,
    linear_functions,
    simple_quadratic_expressions,
    simultaneous_linear_equations,
    algebraic_manipulation,
    algebraic_equivalence,
    substitution,
    simplification,
    expansion,
    factorisation,
    transposition,
    evaluation,
    solving,
    checking
}

OUT_OF_SCOPE := {
    advanced_abstract_algebra,
    group_theory,
    ring_theory,
    field_theory,
    category_theory,
    advanced_linear_algebra,
    advanced_real_analysis,
    advanced_complex_analysis,
    advanced_differential_equations
}

----------------------------------------------------------------------
2. PRIMITIVE TYPES
----------------------------------------------------------------------

TYPE Number
TYPE NaturalNumber <: Number
TYPE Integer <: Number
TYPE RationalNumber <: Number
TYPE RealNumber <: Number

TYPE Symbol
TYPE Variable <: Symbol
TYPE ConstantSymbol <: Symbol
TYPE Operator <: Symbol
TYPE RelationSymbol <: Symbol

TYPE AlgebraicObject
TYPE Term <: AlgebraicObject
TYPE Expression <: AlgebraicObject
TYPE Equation <: AlgebraicObject
TYPE Identity <: AlgebraicObject
TYPE Inequality <: AlgebraicObject
TYPE Formula <: AlgebraicObject
TYPE FunctionExpression <: AlgebraicObject

TYPE Set
TYPE Interval <: Set
TYPE SolutionSet <: Set

TYPE Statement
TYPE Derivation
TYPE Transformation
TYPE Constraint
TYPE Assumption
TYPE ProofStep
TYPE ValidationResult

----------------------------------------------------------------------
3. CORE ENTITIES
----------------------------------------------------------------------

ENTITY Constant {
    isa: Number | ConstantSymbol
    role: fixed_value
}

ENTITY Variable {
    isa: Symbol
    role: changeable_or_unknown_value
    attributes: {
        name,
        domain,
        assigned_value?,
        constraints?
    }
}

ENTITY Coefficient {
    isa: Number
    role: numerical_multiplier_of_term
}

ENTITY Exponent {
    isa: Number
    role: power_index
}

ENTITY Base {
    isa: AlgebraicObject
    role: object_raised_to_exponent
}

ENTITY Factor {
    isa: AlgebraicObject
    role: multiplicative_component
}

ENTITY Term {
    components: {
        sign?,
        coefficient?,
        variable_part?,
        constant_part?,
        factors*
    }
}

ENTITY Expression {
    consists_of: Term+
    connected_by: Operator*
}

ENTITY Monomial <: -Expression {
    term_count: 1
}

ENTITY Binomial <: -Expression {
    term_count: 2
}

ENTITY Trinomial <: -Expression {
    term_count: 3
}

ENTITY Polynomial <: -Expression {
    finite_sum_of: Term+
    exponent_constraint: nonnegative_integer_exponents_on_variables
}

ENTITY Equation {
    left_side: -Expression
    relation: "="
    right_side: -Expression
}

ENTITY Identity {
    left_side: -Expression
    relation: "≡"
    right_side: -Expression
    truth_scope: all_permitted_values_in_domain
}

ENTITY Inequality {
    left_side: -Expression
    relation: one_of("<", "<=", ">", ">=")
    right_side: -Expression
}

ENTITY Formula {
    relation_between: AlgebraicObject+
    intended_role: reusable_rule_or_quantity_relationship
}

ENTITY LinearExpression <: -Expression {
    maximum_variable_degree: 1
}

ENTITY LinearEquation <: Equation {
    sides: LinearExpression | Number | Expression
    reducible_to_form: a*x + b = c
    condition: a != 0
}

ENTITY QuadraticExpression <: Polynomial {
    maximum_variable_degree: 2
}

ENTITY SimpleQuadraticEquation <: Equation {
    reducible_to_form: a*x^2 + b*x + c = 0
    condition: a != 0
}

ENTITY AlgebraicFraction <: -Expression {
    numerator: -Expression
    denominator: -Expression
    constraint: denominator != 0
}

ENTITY Ratio {
    ordered_pair: (quantity_a, quantity_b)
    representation: a:b | a/b
}

ENTITY Proportion {
    relation: ratio_a = ratio_b
}

ENTITY CoordinatePair {
    representation: (x, y)
    members: Number x Number
}

ENTITY LinearFunction {
    canonical_form: y = m*x + c
    gradient: m
    intercept: c
}

ENTITY Solution {
    satisfies: Equation | Inequality | Constraint
}

ENTITY SolutionSet {
    contains: Solution*
}

----------------------------------------------------------------------
4. OPERATORS
----------------------------------------------------------------------

OPERATOR ADD(a,b)        := a + b
OPERATOR SUBTRACT(a,b)   := a - b
OPERATOR MULTIPLY(a,b)   := a * b
OPERATOR DIVIDE(a,b)     := a / b WHERE b != 0
OPERATOR POWER(a,n)      := a^n
OPERATOR ROOT(a,n)       := nth_root(a,n) WHERE n != 0
OPERATOR NEGATE(a)       := -a
OPERATOR ABS(a)          := |a|

RELATION EQUAL(a,b)      := a = b
RELATION NOT_EQUAL(a,b)  := a != b
RELATION LESS(a,b)       := a < b
RELATION LESS_EQUAL(a,b) := a <= b
RELATION GREATER(a,b)    := a > b
RELATION GREATER_EQUAL(a,b) := a >= b
RELATION EQUIVALENT(a,b) := a ≡ b

----------------------------------------------------------------------
5. FUNDAMENTAL ARITHMETIC AXIOMS
----------------------------------------------------------------------

AXIOM A1_COMMUTATIVE_ADDITION:
    forall a,b in Number:
        a + b = b + a

AXIOM A2_ASSOCIATIVE_ADDITION:
    forall a,b,c in Number:
        (a + b) + c = a + (b + c)

AXIOM A3_ADDITIVE_IDENTITY:
    forall a in Number:
        a + 0 = a

AXIOM A4_ADDITIVE_INVERSE:
    forall a in Number:
        a + (-a) = 0

AXIOM A5_COMMUTATIVE_MULTIPLICATION:
    forall a,b in Number:
        a*b = b*a

AXIOM A6_ASSOCIATIVE_MULTIPLICATION:
    forall a,b,c in Number:
        (a*b)*c = a*(b*c)

AXIOM A7_MULTIPLICATIVE_IDENTITY:
    forall a in Number:
        a*1 = a

AXIOM A8_MULTIPLICATIVE_INVERSE:
    forall a in Number WHERE a != 0:
        a*(1/a) = 1

AXIOM A9_DISTRIBUTIVE:
    forall a,b,c in Number:
        a*(b+c) = a*b + a*c

AXIOM A10_ZERO_MULTIPLICATION:
    forall a in Number:
        a*0 = 0

AXIOM A11_EQUALITY_REFLEXIVE:
    forall a:
        a = a

AXIOM A12_EQUALITY_SYMMETRIC:
    forall a,b:
        if a = b then b = a

AXIOM A13_EQUALITY_TRANSITIVE:
    forall a,b,c:
        if a = b and b = c then a = c

AXIOM A14_SUBSTITUTION:
    forall a,b,E:
        if a = b then E[a] = E[b]
        provided substitution preserves syntax and domain constraints

----------------------------------------------------------------------
6. ORDER OF OPERATIONS
----------------------------------------------------------------------

PRECEDENCE := [
    grouping_symbols,
    powers_and_roots,
    multiplication_and_division,
    addition_and_subtraction
]

ASSOCIATIVITY := {
    exponentiation: right_associative_where_applicable,
    multiplication: left_to_right,
    division: left_to_right,
    addition: left_to_right,
    subtraction: left_to_right
}

RULE ORDER_01:
    Evaluate innermost grouping before enclosing grouping.

RULE ORDER_02:
    Apply powers and roots before multiplication/division.

RULE ORDER_03:
    Apply multiplication/division before addition/subtraction.

RULE ORDER_04:
    For operators of equal precedence, respect conventional
    associativity and explicit grouping.

----------------------------------------------------------------------
7. TERM AND EXPRESSION STRUCTURE
----------------------------------------------------------------------

RELATION HAS_TERM(Expression, Term)
RELATION HAS_FACTOR(Term, Factor)
RELATION HAS_COEFFICIENT(Term, Coefficient)
RELATION HAS_VARIABLE(Term, Variable)
RELATION HAS_EXPONENT(Variable, Exponent)
RELATION HAS_OPERATOR(Expression, Operator)

RULE TERM_01:
    coefficient * variable_part -> Term

RULE TERM_02:
    numeric_constant -> Term

RULE TERM_03:
    product_of_factors -> Term

RULE EXPRESSION_01:
    Term -> Expression

RULE EXPRESSION_02:
-
    Expression + Expression -> Expression

RULE EXPRESSION_03:
-
    Expression - Expression -> Expression

RULE EXPRESSION_04:
-
    Expression * Expression -> Expression

RULE EXPRESSION_05:
-
    Expression / Expression -> Expression
    WHERE denominator != 0

----------------------------------------------------------------------
8. LIKE TERMS
----------------------------------------------------------------------

PREDICATE LIKE_TERMS(t1,t2) :=
    same_variable_structure(t1,t2)
    AND same_variable_exponents(t1,t2)

RULE LIKE_01:
    if LIKE_TERMS(a*x, b*x)
    then a*x + b*x -> (a+b)*x

RULE LIKE_02:
    if LIKE_TERMS(a*x^n, b*x^n)
    then a*x^n - b*x^n -> (a-b)*x^n

RULE LIKE_03:
    unlike terms MUST NOT be combined by coefficient addition.

EXAMPLE_VALID:
    3*x + 5*x -> 8*x

EXAMPLE_INVALID:
    3*x + 5*x^2 -/> 8*x^3

----------------------------------------------------------------------
9. SIMPLIFICATION
----------------------------------------------------------------------

TRANSFORMATION SIMPLIFY(expr) := recursively_apply {
    remove_redundant_parentheses,
    apply_identity_elements,
    evaluate_numeric_subexpressions,
    combine_like_terms,
    simplify_signs,
    reduce_numeric_fractions,
    cancel_common_nonzero_factors,
    normalise_term_order
}

RULE SIMP_01:
    x + 0 -> x

RULE SIMP_02:
    x - 0 -> x

RULE SIMP_03:
    x * 1 -> x

RULE SIMP_04:
    1 * x -> x

RULE SIMP_05:
    x * 0 -> 0

RULE SIMP_06:
    0 * x -> 0

RULE SIMP_07:
    x / 1 -> x

RULE SIMP_08:
    x - x -> 0

RULE SIMP_09:
    -(-x) -> x

RULE SIMP_10:
    x + x -> 2*x

RULE SIMP_11:
    a*x + b*x -> (a+b)*x

RULE SIMP_12:
    a*(b*x) -> (a*b)*x

RULE SIMP_13:
    x^1 -> x

RULE SIMP_14:
    x^0 -> 1 WHERE x != 0

----------------------------------------------------------------------
10. EXPANSION
----------------------------------------------------------------------

TRANSFORMATION EXPAND(expr) := apply_distributive_rules_until_no_match

RULE EXPAND_01:
    a*(b+c) -> a*b + a*c

RULE EXPAND_02:
    a*(b-c) -> a*b - a*c

RULE EXPAND_03:
    (a+b)*c -> a*c + b*c

RULE EXPAND_04:
    (a-b)*c -> a*c - b*c

RULE EXPAND_05:
    (a+b)*(c+d) ->
        a*c + a*d + b*c + b*d

RULE EXPAND_06:
    (a+b)^2 ->
        a^2 + 2*a*b + b^2

RULE EXPAND_07:
    (a-b)^2 ->
        a^2 - 2*a*b + b^2

RULE EXPAND_08:
    (a+b)*(a-b) ->
        a^2 - b^2

POSTCONDITION EXPAND:
    no required distributive expansion remains for target normal form

----------------------------------------------------------------------
11. FACTORISATION
----------------------------------------------------------------------

TRANSFORMATION FACTORISE(expr) := inverse_of_valid_expansion_where_possible

RULE FACTOR_01:
    a*x + a*y -> a*(x+y)

RULE FACTOR_02:
    a*x - a*y -> a*(x-y)

RULE FACTOR_03:
    a^2 - b^2 -> (a-b)*(a+b)

RULE FACTOR_04:
    x^2 + 2*a*x + a^2 -> (x+a)^2

RULE FACTOR_05:
    x^2 - 2*a*x + a^2 -> (x-a)^2

RULE FACTOR_06:
    x^2 + (p+q)*x + p*q -> (x+p)*(x+q)

VALIDATION FACTORISATION:
    EXPAND(factorised_form) ≡ original_expression

----------------------------------------------------------------------
12. INDEX / EXPONENT LAWS
----------------------------------------------------------------------

RULE INDEX_01:
    x^a * x^b -> x^(a+b)

RULE INDEX_02:
    x^a / x^b -> x^(a-b)
    WHERE x != 0

RULE INDEX_03:
    (x^a)^b -> x^(a*b)

RULE INDEX_04:
    (x*y)^a -> x^a * y^a

RULE INDEX_05:
    (x/y)^a -> x^a / y^a
    WHERE y != 0

RULE INDEX_06:
    x^0 -> 1
    WHERE x != 0

RULE INDEX_07:
    x^(-a) -> 1/x^a
    WHERE x != 0

RULE INDEX_08:
    x^(1/n) -> nth_root(x,n)
    subject_to real-domain restrictions

RULE INDEX_09:
    x^(m/n) -> nth_root(x^m,n)
    subject_to real-domain restrictions

----------------------------------------------------------------------
13. ALGEBRAIC FRACTIONS
----------------------------------------------------------------------

ENTITY AlgebraicFraction {
    form: numerator/denominator
    invariant: denominator != 0
}

RULE FRAC_01:
    (a/b) + (c/b) -> (a+c)/b
    WHERE b != 0

RULE FRAC_02:
    (a/b) - (c/b) -> (a-c)/b
    WHERE b != 0

RULE FRAC_03:
    (a/b) * (c/d) -> (a*c)/(b*d)
    WHERE b != 0 AND d != 0

RULE FRAC_04:
    (a/b) / (c/d) -> (a*d)/(b*c)
    WHERE b != 0 AND c != 0 AND d != 0

RULE FRAC_05:
    (a*c)/(b*c) -> a/b
    WHERE b != 0 AND c != 0

RULE FRAC_06:
    a/b + c/d -> (a*d + b*c)/(b*d)
    WHERE b != 0 AND d != 0

CONSTRAINT FRACTION_DOMAIN:
    every denominator contributes a nonzero domain restriction

----------------------------------------------------------------------
14. EQUATION SEMANTICS
----------------------------------------------------------------------

PREDICATE SATISFIES(value, equation) :=
    evaluate(left_side, variable=value)
    =
    evaluate(right_side, variable=value)

RULE EQ_01_ADDITION_PROPERTY:
    if a = b
    then a+c = b+c

RULE EQ_02_SUBTRACTION_PROPERTY:
    if a = b
    then a-c = b-c

RULE EQ_03_MULTIPLICATION_PROPERTY:
    if a = b
    then a*c = b*c

RULE EQ_04_DIVISION_PROPERTY:
    if a = b AND c != 0
    then a/c = b/c

RULE EQ_05_BALANCE:
    any valid operation applied to one side of an equation
    MUST be applied equivalently to the other side.

INVARIANT EQUATION_BALANCE:
    transformation preserves solution_set unless explicitly marked
    as implication_only and subsequently checked.

----------------------------------------------------------------------
15. SOLVING LINEAR EQUATIONS
----------------------------------------------------------------------

PROCEDURE SOLVE_LINEAR(equation, variable x) {

    REQUIRE:
        equation reducible to a*x + b = c
        a != 0

    STEP 1:
        simplify both sides

    STEP 2:
        collect x-terms on one side

    STEP 3:
        collect constant terms on opposite side

    STEP 4:
        isolate coefficient*x

    STEP 5:
        divide both sides by nonzero coefficient

    STEP 6:
        produce candidate x = value

    STEP 7:
        validate candidate by substitution into original equation

    RETURN:
        validated_solution_set
}

EXAMPLE_SCHEMA:
    a*x + b = c
    -> a*x = c-b
    -> x = (c-b)/a
    WHERE a != 0

----------------------------------------------------------------------
16. EQUATIONS WITH BRACKETS OR FRACTIONS
----------------------------------------------------------------------

PROCEDURE SOLVE_GENERAL_ELEMENTARY_EQUATION(eq, x) {

    derive domain_constraints

    simplify numeric structure

    if brackets_exist:
        EXPAND where beneficial

    if denominators_exist:
        multiply through by valid common denominator
        preserve denominator != 0 restrictions

    collect like terms

    isolate variable terms

    solve using equality-preserving operations

    validate every candidate against:
        original_equation
        domain_constraints

    reject extraneous_solutions

    RETURN validated_solution_set
}

----------------------------------------------------------------------
17. TRANSPOSITION
----------------------------------------------------------------------

RULE TRANSPOSE_01:
    a + b = c
    -> a = c - b

RULE TRANSPOSE_02:
    a - b = c
    -> a = c + b

RULE TRANSPOSE_03:
    a*b = c
    -> a = c/b
    WHERE b != 0

RULE TRANSPOSE_04:
    a/b = c
    -> a = b*c
    WHERE b != 0

SEMANTIC_NOTE:
    "move to the other side and change the sign" is shorthand only.
    Formal execution MUST use equality-preserving inverse operations.

----------------------------------------------------------------------
18. FORMULAE AND REARRANGEMENT
----------------------------------------------------------------------

PROCEDURE MAKE_SUBJECT(formula, target_variable) {

    parse relation

    identify operations applied to target_variable

    apply inverse operations in reverse structural order

    preserve equality

    preserve domain restrictions

    simplify result

    verify by algebraic substitution or reverse derivation

    RETURN equivalent_formula_with_target_as_subject
}

----------------------------------------------------------------------
19. INEQUALITIES
----------------------------------------------------------------------

RULE INEQ_01:
    if a < b
    then a+c < b+c

RULE INEQ_02:
    if a <= b
    then a+c <= b+c

RULE INEQ_03:
    if a < b AND c > 0
    then a*c < b*c

RULE INEQ_04:
    if a < b AND c < 0
    then a*c > b*c

RULE INEQ_05:
    if a <= b AND c < 0
    then a*c >= b*c

RULE INEQ_06:
    dividing both sides by a negative nonzero value
    reverses the inequality relation.

PROCEDURE SOLVE_LINEAR_INEQUALITY(ineq, x) {
    simplify
    isolate x
    when multiply_or_divide_by_negative:
        reverse_relation
    express result as inequality
    optionally map to interval
    validate representative points
}

----------------------------------------------------------------------
20. INTERVAL REPRESENTATION
----------------------------------------------------------------------

MAPPING:
    x > a  <-> (a, +infinity)
    x >= a <-> [a, +infinity)
    x < a  <-> (-infinity, a)
    x <= a <-> (-infinity, a]

RULE INTERVAL_01:
    "(" or ")" at finite bound -> excluded_bound

RULE INTERVAL_02:
    "[" or "]" at finite bound -> included_bound

RULE INTERVAL_03:
    infinity and negative_infinity are never closed endpoints.

----------------------------------------------------------------------
21. RATIOS AND PROPORTIONS
----------------------------------------------------------------------

RULE RATIO_01:
    a:b <-> a/b
    WHERE b != 0

RULE RATIO_02:
    k*a : k*b -> a:b
    WHERE k != 0

RULE PROP_01:
    a/b = c/d
    -> a*d = b*c
    WHERE b != 0 AND d != 0

RULE PROP_02:
    if a/b = c/d and required denominator constraints hold,
    cross_multiplication preserves equality.

----------------------------------------------------------------------
22. SUBSTITUTION
----------------------------------------------------------------------

PROCEDURE SUBSTITUTE(expr, mapping) {

    for each variable v in mapping:
        replace v with mapped value or expression
        preserve grouping

    evaluate according to precedence

    preserve exact form unless approximation requested

    RETURN substituted_expression_or_value
}

RULE SUB_01:
    negative substituted values MUST be grouped when raised to powers.

EXAMPLE:
    x^2 with x=-3
    -> (-3)^2
    -> 9

NOT:
    -3^2 -> -9

----------------------------------------------------------------------
23. EVALUATION
----------------------------------------------------------------------

PROCEDURE EVALUATE(expr, assignments) {

    require all necessary variables assigned

    SUBSTITUTE(expr, assignments)

    resolve grouping

    evaluate exponents

    evaluate multiplication/division

    evaluate addition/subtraction

    RETURN value
}

----------------------------------------------------------------------
24. IDENTITIES AND EQUIVALENCE
----------------------------------------------------------------------

PREDICATE ALGEBRAIC_EQUIVALENCE(A,B,domain) :=

    (
        normal_form(A, domain)
        =
        normal_form(B, domain)
    )
    OR
    (
        derive(A => B)
        AND derive(B => A)
        under same domain constraints
    )

RULE IDENTITY_01:
    if ALGEBRAIC_EQUIVALENCE(A,B,D)
    then A ≡ B on D

RULE IDENTITY_02:
    equation_truth_for_single_or_selected_values
    does NOT imply identity.

RULE IDENTITY_03:
    equivalent expressions MUST share domain restrictions
    or restrictions MUST be explicitly recorded.

EXAMPLE:
    (x^2 - 1)/(x - 1)
    simplifies to x + 1
    only under original restriction x != 1.

----------------------------------------------------------------------
25. NORMAL FORMS
----------------------------------------------------------------------

NORMAL_FORM additive_polynomial_form:
    terms ordered by descending degree
    like terms combined
    numeric coefficients simplified

NORMAL_FORM factored_form:
    maximal recognised common factors extracted
    recognised elementary identities factored

NORMAL_FORM linear_equation_form:
    a*x + b = c

NORMAL_FORM standard_linear_form:
    a*x + b = 0

NORMAL_FORM quadratic_standard_form:
    a*x^2 + b*x + c = 0
    WHERE a != 0

NORMAL_FORM linear_function_form:
    y = m*x + c

----------------------------------------------------------------------
26. POLYNOMIAL DEGREE
----------------------------------------------------------------------

FUNCTION DEGREE(term):
    sum exponents of variables in term

FUNCTION DEGREE(polynomial):
    maximum DEGREE(term) over nonzero terms

RULE DEGREE_01:
    degree(nonzero_constant) = 0

RULE DEGREE_02:
    degree(a*x) = 1 WHERE a != 0

RULE DEGREE_03:
    degree(a*x^n) = n WHERE a != 0

RULE DEGREE_04:
    zero_polynomial_degree = undefined_or_context_defined

----------------------------------------------------------------------
27. LINEAR FUNCTIONS
----------------------------------------------------------------------

ENTITY Gradient {
    symbol: m
    meaning: rate_of_change
}

ENTITY Intercept {
    symbol: c
    meaning: y_value_when_x_equals_zero
}

RULE LINEAR_01:
    y = m*x + c

RULE LINEAR_02:
    gradient through two distinct points:
        m = (y2-y1)/(x2-x1)
        WHERE x2 != x1

RULE LINEAR_03:
    if m = 0
    then function is constant horizontal line

RULE LINEAR_04:
    positive m -> increasing line

RULE LINEAR_05:
    negative m -> decreasing line

PROCEDURE EVALUATE_LINEAR_FUNCTION(m,c,x):
    return m*x + c

----------------------------------------------------------------------
28. SIMULTANEOUS LINEAR EQUATIONS
----------------------------------------------------------------------

ENTITY SimultaneousLinearSystem {
    equations: LinearEquation+
    variables: Variable+
}

PROCEDURE SOLVE_BY_SUBSTITUTION(system) {
    isolate one variable in one equation
    substitute into other equation
    solve resulting single-variable equation
    back_substitute
    validate solution in all original equations
}

PROCEDURE SOLVE_BY_ELIMINATION(system) {
    align coefficients
    multiply equations by nonzero constants if required
    add_or_subtract equations to eliminate one variable
    solve remaining variable
    back_substitute
    validate solution in all original equations
}

CLASSIFY_SYSTEM:
    unique_solution
    no_solution
    infinitely_many_solutions

----------------------------------------------------------------------
29. SIMPLE QUADRATIC REASONING
----------------------------------------------------------------------

PROCEDURE SOLVE_FACTORABLE_QUADRATIC(eq, x) {

    reduce to:
-
        expression = 0

    factorise expression

    apply ZERO_PRODUCT_RULE

    solve each factor equation

    validate candidates

    return solution_set
}

AXIOM ZERO_PRODUCT_RULE:
    if a*b = 0
    then a = 0 OR b = 0

RULE QUAD_01:
    (x+p)*(x+q) = 0
    -> x = -p OR x = -q

----------------------------------------------------------------------
30. ROOTS AND SQUARES
----------------------------------------------------------------------

RULE ROOT_01:
    if x^2 = a AND a > 0
    then x = sqrt(a) OR x = -sqrt(a)

RULE ROOT_02:
    if x^2 = 0
    then x = 0

RULE ROOT_03:
    over RealNumber:
        if a < 0 then x^2 = a has no real solution

RULE ROOT_04:
    sqrt(x^2) = |x| over RealNumber

----------------------------------------------------------------------
31. SIGN RULES
----------------------------------------------------------------------

RULE SIGN_01:
    (+a)*(+b) = +(a*b)

RULE SIGN_02:
    (+a)*(-b) = -(a*b)

RULE SIGN_03:
    (-a)*(+b) = -(a*b)

RULE SIGN_04:
    (-a)*(-b) = +(a*b)

RULE SIGN_05:
    a - (-b) = a + b

RULE SIGN_06:
    -(a+b) = -a-b

RULE SIGN_07:
    -(a-b) = -a+b

----------------------------------------------------------------------
32. DOMAIN RESTRICTIONS
----------------------------------------------------------------------

CONSTRAINT DOMAIN_01:
    denominator != 0

CONSTRAINT DOMAIN_02:
    for even real root nth_root(x,n):
        x >= 0

CONSTRAINT DOMAIN_03:
    for division by symbolic expression d(x):
        d(x) != 0

CONSTRAINT DOMAIN_04:
    transformations MUST retain restrictions introduced by
    original expression syntax.

PROCEDURE EXTRACT_DOMAIN_RESTRICTIONS(expr) {
    inspect_denominators
    inspect_even_roots
    inspect_contextual_variable_domains
    inspect_explicit_constraints
    return conjunction_of_constraints
}

----------------------------------------------------------------------
33. VALID TRANSFORMATIONS
----------------------------------------------------------------------

TYPE EquivalencePreservingTransformation <: Transformation
TYPE ImplicationPreservingTransformation <: Transformation

VALID_EQUIVALENCE_TRANSFORMATIONS := {
    simplify_by_axioms,
    expand_by_distributive_law,
    factorise_with_reverse_validation,
    add_same_expression_both_sides,
    subtract_same_expression_both_sides,
    multiply_both_sides_by_known_nonzero_expression,
    divide_both_sides_by_known_nonzero_expression,
    substitute_equal_for_equal
}

CAUTION_TRANSFORMATIONS := {
    squaring_both_sides,
    multiplying_by_expression_of_unknown_zero_status,
    clearing_denominators_without_recording_restrictions,
    taking_even_roots,
    cancelling_symbolic_factors_without_nonzero_constraint
}

RULE TRANSFORM_01:
    any caution transformation requires post-validation
    against the original statement.

----------------------------------------------------------------------
34. DERIVATION MODEL
----------------------------------------------------------------------

ENTITY Derivation {
    premises: Statement*
    steps: ProofStep*
    conclusion: Statement
}

ENTITY ProofStep {
    input_state: Statement
    rule_applied: Rule
    output_state: Statement
    constraints: Constraint*
    validity: ValidationResult
}

PROCEDURE DERIVE(start, goal?) {

    state := start
    constraints := EXTRACT_DOMAIN_RESTRICTIONS(start)

    repeat:
        identify_applicable_rules(state)
        rank_rules_by_goal_relevance_and_simplicity
        apply_highest_valid_rule
        record_proof_step
        update_constraints
        validate_local_equivalence

    until:
        goal_reached
        OR canonical_form_reached
        OR no_valid_rule_applies

    validate_global_derivation

    return Derivation
}

----------------------------------------------------------------------
35. ERROR DETECTION
----------------------------------------------------------------------

ERROR E_DIV_ZERO:
    division_by_zero

ERROR E_CANCEL_ZERO:
    cancelled_factor_not_proven_nonzero

ERROR E_COMBINE_UNLIKE:
    attempted_combination_of_unlike_terms

ERROR E_DISTRIBUTION:
    incomplete_or_invalid_distribution

ERROR E_SIGN:
    invalid_sign_transformation

ERROR E_EXPONENT:
    invalid_exponent_law_application

ERROR E_EQUALITY_BALANCE:
    operation_applied_to_only_one_side_without_equivalent_justification

ERROR E_INEQUALITY_DIRECTION:
    failed_to_reverse_inequality_after_negative_scale

ERROR E_DOMAIN_LOSS:
    original_domain_restriction_removed_or_forgotten

ERROR E_EXTRANEOUS:
    candidate_fails_original_statement

ERROR E_PRECEDENCE:
    invalid_order_of_operations

ERROR E_SUBSTITUTION_GROUPING:
    substituted_negative_or_composite_value_without_required_grouping

----------------------------------------------------------------------
36. VALIDATION ENGINE
----------------------------------------------------------------------

PROCEDURE VALIDATE_EXPRESSION_EQUIVALENCE(A,B) {

    domain := intersect(
        EXTRACT_DOMAIN_RESTRICTIONS(A),
        EXTRACT_DOMAIN_RESTRICTIONS(B)
    )

    attempt_symbolic_normalisation

    if normal_forms_match:
        return VALID

    attempt_bidirectional_derivation

    if derivations_valid:
        return VALID

    optionally_test_representative_domain_values
    as supplementary evidence only

    return VALID | INVALID | UNRESOLVED
}

PROCEDURE VALIDATE_SOLUTION(candidate, original_statement) {

    if candidate violates domain_constraints:
        return INVALID

    substitute candidate into original_statement

    if statement evaluates true:
        return VALID

    return INVALID
}

----------------------------------------------------------------------
37. SEMANTIC RELATIONSHIPS
----------------------------------------------------------------------

RELATION IS_A(Monomial, Polynomial)
RELATION IS_A(Binomial, Polynomial)
RELATION IS_A(Trinomial, Polynomial)
RELATION IS_A(LinearExpression, Expression)
RELATION IS_A(LinearEquation, Equation)
RELATION IS_A(SimpleQuadraticEquation, Equation)
RELATION IS_A(AlgebraicFraction, Expression)

RELATION PART_OF(Coefficient, Term)
RELATION PART_OF(Variable, Term)
RELATION PART_OF(Term, Expression)
RELATION PART_OF(Expression, Equation)
RELATION PART_OF(Expression, Inequality)

RELATION OPERATES_ON(Operator, AlgebraicObject)
RELATION CONSTRAINS(Constraint, Variable)
RELATION SATISFIES(Solution, Equation)
RELATION SATISFIES(Solution, Inequality)
RELATION TRANSFORMS_TO(Expression, Expression)
RELATION EQUIVALENT_TO(Expression, Expression)
RELATION FACTORS_INTO(Expression, Expression)
RELATION EXPANDS_TO(Expression, Expression)
RELATION SUBSTITUTES_FOR(AlgebraicObject, Variable)

----------------------------------------------------------------------
38. CONCEPT DEPENDENCY GRAPH
----------------------------------------------------------------------

DEPENDENCY {
    Number -> Constant
    Symbol -> Variable
    Number -> Coefficient
    Variable + Coefficient -> Term
    Term -> Expression
    Expression + Equality -> Equation
    Expression + OrderRelation -> Inequality
    Expression -> Polynomial
    Polynomial -> LinearExpression
    Polynomial -> QuadraticExpression

    ArithmeticAxioms -> Simplification
    DistributiveLaw -> Expansion
    Expansion <-> Factorisation
    EqualityProperties -> EquationSolving
    OrderProperties -> InequalitySolving
    Substitution -> Evaluation
    DomainRestrictions -> ValidTransformation
    ValidTransformation -> Derivation
    Derivation -> Solution
    Solution -> Validation
}

----------------------------------------------------------------------
39. SEMANTIC EQUIVALENCE
----------------------------------------------------------------------

SEMANTIC_EQUIVALENCE {

    "unknown" ~= Variable
    "letter" ~= Variable WHEN used_as_algebraic_symbol

    "number in front of a variable" ~= Coefficient

    "algebraic sentence with equals sign" ~= Equation

    "same value" ~= Equality

    "simplify" ~= reduce_to_equivalent_less_complex_form

    "expand brackets" ~= apply_distributive_law

    "multiply out brackets" ~= apply_distributive_law

    "factorise" ~= rewrite_as_product_of_factors

    "factor" ~= multiplicative_component

    "collect like terms" ~= combine_terms_with_identical_variable_structure

    "substitute" ~= replace_variable_with_value_or_expression

    "solve" ~= determine_values_satisfying_statement

    "make x the subject" ~= isolate_target_variable_in_formula

    "transpose" ~= apply_inverse_operations_while_preserving_equality

    "cancel" ~= divide_numerator_and_denominator_or_both_sides_by
                 a_common_proven_nonzero_factor

    "linear" ~= degree_one_in_relevant_variable

    "quadratic" ~= degree_two_in_relevant_variable

    "gradient" ~= slope ~= rate_of_change

    "y-intercept" ~= vertical_axis_intercept

    "simultaneous equations" ~= system_of_equations

    "solution" ~= satisfying_value_or_tuple
}

----------------------------------------------------------------------
40. NATURAL-LANGUAGE INTERPRETATION RULES
----------------------------------------------------------------------

NL_RULE 01:
    "a number" -> introduce_variable_or_constant according to context

NL_RULE 02:
    "a number increased by n"
    -> x + n

NL_RULE 03:
    "n more than x"
    -> x + n

NL_RULE 04:
    "n less than x"
    -> x - n

NL_RULE 05:
    "n times x"
    -> n*x

NL_RULE 06:
    "the product of a and b"
    -> a*b

NL_RULE 07:
    "the quotient of a and b"
    -> a/b WHERE b != 0

NL_RULE 08:
    "the square of x"
    -> x^2

NL_RULE 09:
    "the square root of x"
    -> sqrt(x) subject to real-domain constraint x >= 0

NL_RULE 10:
    "is equal to"
    -> =

NL_RULE 11:
    "is greater than"
    -> >

NL_RULE 12:
    "is at least"
    -> >=

NL_RULE 13:
    "is no more than"
    -> <=

NL_RULE 14:
    ambiguous natural language MUST trigger semantic disambiguation
    before symbolic execution.

----------------------------------------------------------------------
41. PROBLEM-SOLVING PIPELINE
----------------------------------------------------------------------

PROCEDURE ELEMENTARY_ALGEBRA_REASONER(input) {

    1. PARSE:
        identify numbers,
        variables,
        operators,
        relations,
        grouping,
        stated constraints

    2. CLASSIFY:
-
        expression |
        equation |
        identity |
        inequality |
        formula |
        function |
        simultaneous_system |
        word_problem

    3. NORMALISE:
        standardise symbols and syntax

    4. EXTRACT:
        domain restrictions
        assumptions
        target unknowns
        requested operation

    5. SELECT:
        valid transformation strategy

    6. EXECUTE:
        produce atomic derivation steps

    7. VALIDATE:
        check each transformation
        check final result
        check original statement
        check domain restrictions

    8. EXPLAIN:
        map formal derivation to concise human-readable reasoning
        without altering mathematical semantics

    9. RETURN:
        result
        derivation
        constraints
        confidence
        semantic_status
}

----------------------------------------------------------------------
42. WORD-PROBLEM MAPPING
----------------------------------------------------------------------

PROCEDURE MODEL_WORD_PROBLEM(text) {

    identify_entities_and_quantities

    assign variables to unknown quantities

    map relational language to operators

    establish equations_or_inequalities

    record units

    solve formal model

    map solution back to original quantities

    validate:
        units
        magnitude
        sign
        contextual plausibility

    RETURN interpreted_solution
}

RULE UNIT_01:
    quantities added or subtracted SHOULD have compatible units.

RULE UNIT_02:
    final answer SHOULD retain requested units.

----------------------------------------------------------------------
43. RECURSIVE REASONING
----------------------------------------------------------------------

RECURSIVE_RULE RR_01:

    INPUT state S_n

    determine unresolved_structure(S_n)

    if no unresolved structure:
        return S_n

    choose transformation T
    such that:
        valid(T,S_n)
        AND complexity(T(S_n)) <= complexity(S_n)
        OR T advances explicit solving_goal

    S_(n+1) := T(S_n)

    validate(S_n -> S_(n+1))

    recurse(S_(n+1))

TERMINATION_CONDITIONS := {
    solved_target,
    canonical_form_reached,
    contradiction_detected,
    no_valid_transformation,
    resource_limit_reached
}

----------------------------------------------------------------------
44. COMPLEXITY HEURISTIC
----------------------------------------------------------------------

FUNCTION COMPLEXITY(expr) :=
      1 * operator_count
    + 1 * term_count
    + 2 * nested_group_depth
    + 2 * symbolic_denominator_count
    + 2 * unresolved_power_count
    + 3 * unresolved_variable_count_if_goal_is_numeric

RULE COMPLEXITY_01:
    prefer transformations reducing complexity
    unless temporary expansion is necessary to reach target.

----------------------------------------------------------------------
45. CONFIDENCE MODEL
----------------------------------------------------------------------

CONFIDENCE {

    base := 1.00

    deduct 0.10 if ambiguous_natural_language
    deduct 0.10 if implicit_domain_not_explicit
    deduct 0.15 if non-equivalence transformation used
    deduct 0.20 if symbolic validation unresolved
    deduct 0.20 if result depends on unstated assumption
    deduct 0.25 if parsing ambiguity remains

    minimum := 0.00
    maximum := 1.00

    classification:
        [0.95,1.00] -> very_high
        [0.85,0.95) -> high
        [0.70,0.85) -> moderate
        [0.50,0.70) -> low
        [0.00,0.50) -> insufficient
}

RULE CONFIDENCE_01:
    validation against original statement may restore confidence
    when candidate generation used implication-only steps.

RULE CONFIDENCE_02:
    confidence MUST represent reasoning reliability,
    not probability that mathematical axioms are true.

----------------------------------------------------------------------
46. CONTRADICTION HANDLING
----------------------------------------------------------------------

PREDICATE CONTRADICTION(S) :=
    S entails P
    AND S entails NOT(P)

RULE CONTRA_01:
    contradiction in assumptions
    -> mark assumption_set inconsistent

RULE CONTRA_02:
    equation reducing to false numeric statement
    -> no_solution

EXAMPLE:
    0 = 5 -> no_solution

RULE CONTRA_03:
    equation reducing to true identity
    -> infinitely_many_solutions
    subject to original domain restrictions

EXAMPLE:
    0 = 0 -> all_permitted_domain_values

----------------------------------------------------------------------
47. AI CONSUMPTION MODEL
----------------------------------------------------------------------

AI_CONSUMPTION {

    read_order := [
        DOMAIN_DECLARATION,
        PRIMITIVE_TYPES,
        CORE_ENTITIES,
        OPERATORS,
        AXIOMS,
        TRANSFORMATION_RULES,
        DOMAIN_RESTRICTIONS,
        VALIDATION_ENGINE,
        SEMANTIC_EQUIVALENCE,
        REASONING_PIPELINE
    ]

    execution_policy := {
        parse_before_reasoning,
        preserve_original_constraints,
        distinguish_equivalence_from_implication,
        prefer_exact_symbolic_reasoning,
        validate_candidates,
        expose_unresolved_ambiguity,
        avoid_inventing_missing_assumptions,
        retain_mathematical_domain
    }

    answer_policy := {
        give_result,
        provide_steps_when_useful,
        name_relevant_rule_when_explanatory,
        preserve_notation_consistency,
        state_restrictions,
        distinguish_exact_from_approximate
    }
}

----------------------------------------------------------------------
48. UPDATE MODEL
----------------------------------------------------------------------

UPDATE_MODEL {

    ontology_is_extensible := true

    additions_must:
        preserve_existing_valid_axioms
        declare_new_types
        declare_parent_relations
        declare_domain_constraints
        define_transformation_validity
        define_semantic_equivalence_terms
        define_validation_requirements

    modification_policy:
        never silently redefine established mathematical meaning

    conflict_policy:
        explicit_versioning
        preserve_previous_rule_reference
        prefer mathematically standard interpretation
        record_context_specific_variants

    deprecation_policy:
        mark deprecated rule
        state replacement
        preserve historical traceability
}

----------------------------------------------------------------------
49. INTEROPERABILITY
----------------------------------------------------------------------

MAP Elementary_Algebra -> Arithmetic {
    inherits:
        number_operations,
        order_of_operations,
        fractions,
        ratios
}

MAP Elementary_Algebra -> Coordinate_Geometry {
    exports:
        coordinate_pair,
        linear_function,
        gradient,
        intercept
}

MAP Elementary_Algebra -> Polynomial_Algebra {
    exports:
        term,
        monomial,
        polynomial,
        degree,
        expansion,
        factorisation
}

MAP Elementary_Algebra -> Equation_Theory {
    exports:
        equality,
        equation,
        solution,
        solution_set,
        equivalence_preserving_transformation
}

MAP Elementary_Algebra -> Functions {
    exports:
        variable,
        expression,
        substitution,
        evaluation,
        linear_function
}

----------------------------------------------------------------------
50. QUERY INTERPRETATION
----------------------------------------------------------------------

QUERY_CLASS Q1:
    "What is X?"
    -> retrieve entity definition and core relations

QUERY_CLASS Q2:
    "Simplify X"
    -> run SIMPLIFY(X)

QUERY_CLASS Q3:
    "Expand X"
    -> run EXPAND(X)

QUERY_CLASS Q4:
    "Factorise X"
    -> run FACTORISE(X)

QUERY_CLASS Q5:
    "Solve X"
    -> classify statement then invoke matching solver

QUERY_CLASS Q6:
    "Evaluate X when ..."
    -> run SUBSTITUTE then EVALUATE

QUERY_CLASS Q7:
    "Rearrange ... for x"
    -> run MAKE_SUBJECT

QUERY_CLASS Q8:
    "Are A and B equivalent?"
    -> run VALIDATE_EXPRESSION_EQUIVALENCE

QUERY_CLASS Q9:
    "Check my answer"
    -> substitute candidate into original statement
       and independently verify derivation where supplied

----------------------------------------------------------------------
51. INFERENCE RULES
----------------------------------------------------------------------

INFERENCE I01:
    IF x = a
    AND expression E contains x
    THEN E[x] may substitute a

INFERENCE I02:
    IF A ≡ B
    THEN any context permitting substitution of equivalents
    may replace A by B subject to domain preservation

INFERENCE I03:
    IF a*b = 0
    THEN a = 0 OR b = 0

INFERENCE I04:
    IF a = b AND b = c
    THEN a = c

INFERENCE I05:
    IF x > a AND a > b
    THEN x > b

INFERENCE I06:
    IF x belongs to solution_set S
    THEN x satisfies defining statement of S

INFERENCE I07:
    IF candidate does not satisfy original statement
    THEN candidate is not a solution

INFERENCE I08:
    IF two derivations yield conflicting exact results
    THEN at least one derivation is invalid or assumptions differ;
    trigger derivation audit.

----------------------------------------------------------------------
52. DERIVATION AUDIT
----------------------------------------------------------------------

PROCEDURE AUDIT(derivation) {

    for each step:
        verify rule exists
        verify rule preconditions
        verify domain restrictions
        verify syntax
        verify equivalence_or_implication_status

    verify conclusion follows

    verify candidate against original

    return:
        PASS
        FAIL(step_id, error_type)
        UNRESOLVED(reason)
}

----------------------------------------------------------------------
53. EXPLANATION LAYER
----------------------------------------------------------------------

EXPLANATION_RULE E01:
    formal operation:
        add c to both sides
    human explanation:
        "Add c to both sides to preserve equality."

EXPLANATION_RULE E02:
    formal operation:
        divide both sides by a
    condition:
        a != 0
    human explanation:
        "Divide both sides by the non-zero coefficient a."

EXPLANATION_RULE E03:
    formal operation:
        distribute
    human explanation:
        "Multiply the factor outside the bracket by every term inside."

EXPLANATION_RULE E04:
    formal operation:
        collect_like_terms
    human explanation:
        "Combine terms with the same variable part and exponents."

EXPLANATION_RULE E05:
    explanation MUST NOT substitute an informal shortcut
    for a mathematically necessary condition.

----------------------------------------------------------------------
54. PEDAGOGICAL ORDER
----------------------------------------------------------------------

LEARNING_DEPENDENCY := [
    numbers_and_operations,
    symbols_and_variables,
    terms_and_coefficients,
    expressions,
    substitution,
    simplification,
    brackets_and_expansion,
    factorisation,
    equations,
    rearranging_formulae,
    inequalities,
    indices,
    algebraic_fractions,
    coordinates_and_linear_functions,
    simultaneous_equations,
    elementary_quadratics
]

RULE PEDAGOGY_01:
    explanation may follow learning_dependency order
    when user requests teaching.

RULE PEDAGOGY_02:
    machine execution need not follow teaching order
    if another valid route is more efficient.

----------------------------------------------------------------------
55. MINIMUM KNOWLEDGE ASSERTIONS
----------------------------------------------------------------------

ASSERT:
    Variable IS_A Symbol

ASSERT:
    Coefficient IS_A Number

ASSERT:
    Term PART_OF Expression

ASSERT:
-
    Expression PART_OF Equation WHEN used_on_equation_side

ASSERT:
    Equation HAS_RELATION Equality

ASSERT:
    Inequality HAS_RELATION OrderRelation

ASSERT:
    Solution SATISFIES Statement

ASSERT:
    Simplification PRESERVES_VALUE under same assignments and domain

ASSERT:
    Expansion PRESERVES_EQUIVALENCE under same domain

ASSERT:
    ValidFactorisation PRESERVES_EQUIVALENCE under same domain

ASSERT:
    EqualityPreservingOperation PRESERVES_SOLUTION_SET

ASSERT:
    NegativeScalingOfInequality REVERSES_ORDER_RELATION

ASSERT:
    Division REQUIRES NonZeroDenominator

----------------------------------------------------------------------
56. MACHINE-READABLE RESULT CONTRACT
----------------------------------------------------------------------

RESULT := {
    query_type: String,
    parsed_input: AlgebraicObject | Statement,
    target: AlgebraicObject?,
    assumptions: Assumption*,
    domain_constraints: Constraint*,
    derivation: Derivation?,
    result: AlgebraicObject | SolutionSet | ValidationResult,
    exact: Boolean,
    confidence: Number[0,1],
    semantic_status: one_of(
        valid,
        invalid,
        unresolved,
        ambiguous,
        inconsistent
    )
}

----------------------------------------------------------------------
57. SELF-CHECK
----------------------------------------------------------------------

SELF_CHECK {

    CHECK all_denominators_nonzero_constraints_preserved
    CHECK all_equation_operations_balance_both_sides
    CHECK all_inequality_sign_reversals_when_required
    CHECK all_combined_terms_are_like_terms
    CHECK all_exponent_rules_meet_preconditions
    CHECK all_candidates_validate_in_original_statement
    CHECK no_domain_restriction_lost
    CHECK exact_and_approximate_results_distinguished
    CHECK semantic_equivalence_does_not_override_mathematical_difference
    CHECK derivation_terminates_or_reports_unresolved
}

----------------------------------------------------------------------
58. ONTOLOGY COMPLETION CONDITIONS
----------------------------------------------------------------------

COMPLETE iff {

    domain_defined
    AND primitive_types_defined
    AND core_entities_defined
    AND operators_defined
    AND arithmetic_axioms_defined
    AND simplification_rules_defined
    AND expansion_rules_defined
    AND factorisation_rules_defined
    AND exponent_rules_defined
    AND fraction_rules_defined
    AND equation_rules_defined
    AND inequality_rules_defined
    AND substitution_defined
    AND validation_defined
    AND semantic_equivalence_defined
    AND confidence_model_defined
    AND update_model_defined
    AND ai_consumption_defined
    AND termination_conditions_defined
}

IF NOT COMPLETE:
    semantic_status := incomplete_flow
    DO NOT claim ontology execution completeness

----------------------------------------------------------------------
59. FLOW TERMINATION
----------------------------------------------------------------------

TERMINATE WHEN:

    requested algebraic goal achieved
    AND result validated
    AND domain restrictions preserved
    AND no unresolved contradiction remains

OR

    no valid derivation exists
    AND unresolved reason is explicitly returned

OR

    input is under-specified
    AND ambiguity materially changes mathematical interpretation

FINAL_STATE := {
    mathematical_result,
    validated_derivation,
    preserved_constraints,
    semantic_status,
    confidence
}

} // END FLOW ElementaryAlgebraOntology

======================================================================
END FLOW
======================================================================

FLOW STATUS:
Complete

INTENDED EXECUTION:
Formal symbolic and semantic reasoning specification for AI consumption.

CANONICAL PAGE:
https://kirethresearch.org/booksai-core/ontologies/mathematical-ontologies/algebra-ontologies/elementary-algebra-ontology.html

FLOW_HASH_SHA256: 9e80cb507c56ba2bf6f80d5248effa1bdd2664f21499277a32028ec63c89b2e9
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ