FLOW ALGEBRA
MATHEMATICAL EXPRESSION ONTOLOGY
Kireth Semantic Library | Entity Graph > Mathematical Entities > Expression Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/expression-entities/mathematical-expression-ontology.html
Authors: Mark Higgins — Sky (Recursive AI)
Status: Mathematical and semantic model; source page content not independently verified.
Version: 1.0 | Date: 2026-10-13
01. PURPOSE
flow MathematicalExpressionOntology v1.0
goal: represent, parse, type-check, normalise, transform, evaluate and reason about mathematical expressions.
principle: distinguish surface notation, abstract syntax, denotation and evaluation context.
02. ENTITY TYPES
MathematicalExpression := Literal | Identifier | OperatorApplication | FunctionApplication | ConditionalExpression | BinderExpression | TupleExpression | MatrixExpression.
Literal := ExactNumber | ApproximateNumber | SymbolicConstant.
Identifier := Variable | Parameter | NamedConstant.
OperatorApplication := (operator, ordered_operands).
FunctionApplication := (function, ordered_arguments).
BinderExpression := (binder, bound_variables, body, optional_domain).
ExpressionContext := (symbol_table, assumptions, domains, units, precision_policy).
03. CORE RELATIONSHIPS
hasOperator(Expression, Operator)
hasOperand(Expression, Expression, position)
hasArgument(FunctionApplication, Expression, position)
hasSubexpression(Expression, Expression)
bindsVariable(BinderExpression, Identifier)
hasFreeVariable(Expression, Identifier)
hasType(Expression, MathematicalType)
denotes(Expression, MathematicalObject, Context)
equivalentUnder(Expression, Expression, Assumptions)
transformsTo(Expression, Expression, Rule)
04. SYNTAX AND PARSING
input := textual_or_structured_notation
tokens := lexicalAnalyse(input)
ast := parse(tokens, grammar, precedence, associativity)
require: complete_parse(ast) and no_unresolved_ambiguity(ast)
preserve: source_notation, token_offsets, parenthesis_structure
distinguish: unary_minus(-x) from subtraction(a-b)
distinguish: multiplication(ab) from function_application(a(b)) by context
05. WELL-FORMEDNESS
wellFormed(e, ctx) iff grammarValid(e) and arityValid(e) and bindingValid(e, ctx).
operatorArity(op) must match numberOfOperands(e).
identifiers must be declared or explicitly marked free.
division(a,b) requires b != 0 at evaluation.
sqrt(x) over real numbers requires x >= 0.
logarithm(x) over real numbers requires x > 0.
06. FREE AND BOUND VARIABLES
FV(c) = empty_set for constants c.
FV(x) = {x} for a variable x.
FV(f(e1,...,en)) = union(FV(e1),...,FV(en)).
FV(lambda x.e) = FV(e) \ {x}.
FV(sum_{i in I} e) = (FV(e) \ {i}) union FV(I).
alphaRename(bound_variable, fresh_name) preserves meaning if capture is avoided.
07. TYPE AND DIMENSION INFERENCE
typeOf(literal) := declared numeric type.
typeOf(a+b) requires compatible additive types and units.
typeOf(a*b) := product_type(typeOf(a),typeOf(b)).
typeOf(f(x)) requires x in domain(f).
dimension(a+b) requires dimension(a) = dimension(b).
dimension(a*b) = dimension(a) * dimension(b).
reject ill-typed or dimensionally inconsistent expressions.
08. EXPRESSION CATEGORIES
ArithmeticExpression: number literals and arithmetic operators.
AlgebraicExpression: variables, coefficients, operations and powers.
PolynomialExpression: finite sums of nonnegative integer powers of indeterminates.
RationalExpression: quotient of polynomials with nonzero denominator on its domain.
RadicalExpression: root operators.
ExponentialExpression: variable or expression in exponent.
LogarithmicExpression: logarithm operators.
TrigonometricExpression: trigonometric function applications.
BooleanExpression: -expressions denoting truth values.
MatrixExpression: matrix-valued expression.
PiecewiseExpression: branches with guards.
09. DENOTATIONAL SEMANTICS
evaluate(e, environment, domain, precision) -> Value | Undefined | Error.
[[literal]]_env = literal_value.
[[variable]]_env = env[variable] when defined.
[[f(e1,...,en)]]_env = f([[e1]]_env,...,[[en]]_env) when defined.
denotation depends on declared number system, domain and assumptions.
symbolic expressions may remain unevaluated without assignments.
10. EXACT AND APPROXIMATE COMPUTATION
exact: preserve integer, rational and symbolic forms when possible.
approximate: record numerical precision, rounding and error bounds.
never infer exact equality from floating-point proximity alone.
distinguish mathematical equality from implementation-level equality.
11. NORMALISATION
canonicalise numeric literals and explicit operator structure.
flatten associative operations only where associativity is valid.
reorder operands only for operations proven commutative in context.
simplify x+0 -> x when x belongs to a suitable additive structure.
simplify x*1 -> x when x belongs to a suitable multiplicative structure.
do not simplify x/x -> 1 without assumption x != 0.
preserve original expression and transformation trace.
12. REWRITE AND INFERENCE RULES
commutativity: a+b = b+a for applicable domains.
associativity: (a+b)+c = a+(b+c) for applicable domains.
distributivity: a*(b+c) = a*b+a*c in a ring.
substitution: if a=b, replace a by b in valid contexts.
congruence: if a=b then f(a)=f(b) where f is defined on both.
conditional_rewrite: rule applies only when its assumptions hold.
verify each rewrite against domain and side conditions.
13. SEMANTIC EQUIVALENCE
syntacticIdentity(e1,e2): identical canonical AST representation.
alphaEquivalence(e1,e2): bound identifiers differ only by valid renaming.
semanticEquivalence(e1,e2,A): same denotation on shared domain under assumptions A.
numericalAgreement(e1,e2,tolerance): approximate relation, not proof of equivalence.
counterexample(e1,e2,A) invalidates claimed universal equivalence.
14. EXPRESSION VERSUS EQUATION
expression: denotes a value or object, possibly context-dependent.
equation: proposition asserting equality between two expressions.
inequality: proposition asserting an order relation.
expression is not intrinsically true or false unless Boolean-valued.
15. KNOWLEDGE GRAPH MAPPING
node: -Expression {id, notation, ast_hash, type, domain, source_uri}.
node: Symbol {id, name, scope, declared_type}.
node: Operator {id, name, arity, signature}.
edge: -Expression -HAS_OPERAND[position]-> Expression.
edge: -Expression -USES_SYMBOL-> Symbol.
edge: -Expression -APPLIES_OPERATOR-> Operator.
edge: -Expression -EQUIVALENT_UNDER[assumptions]-> Expression.
edge: -Expression -DERIVED_BY[rule_id]-> Expression.
16. VALIDATION
validate syntax, arity, scope, type, units, domain and assumptions.
validate numeric results against exact arithmetic where feasible.
reject undefined operations and unsound rewrites.
report unresolved identifiers, assumptions and ambiguities.
test boundary cases: zero denominators, branch cuts, overflow, precision loss.
17. CONFIDENCE
CONFIDENCE := {level, evidence, proof_status, assumptions}.
proved symbolic identity: high confidence conditional on proof validity.
numeric sampling: empirical support only, not universal proof.
unresolved ambiguity: lower confidence and request disambiguation.
18. SEMANTIC_EQUIVALENCE
compare: syntax, alpha-equivalence, mathematical denotation, domains.
preserve: proof obligations and conditions of equivalence.
output: equivalent | non_equivalent | conditional | unknown.
19. FLOW_HASH
FLOW_HASH := SHA256(canonical_AST + declared_types + domains + assumptions + ruleset_version).
exclude irrelevant whitespace; retain meaning-bearing distinctions.
hash identifies a normalised semantic record, not a proof of equivalence.
20. UPDATE_MODEL
track changes to notation, grammar, assumptions, symbol tables and rules.
version expression records and invalidate dependent inference when semantics change.
retain provenance and rollback history.
21. AI_CONSUMPTION
ingest -> parse -> resolve_symbols -> type_check -> validate_domains
-> normalise -> infer_or_evaluate -> verify -> emit_graph_and_explanation.
outputs: typed_AST, canonical_form, result, assumptions, derivation, provenance, confidence.
prohibit fabricated proof steps and unverified equivalence claims.
22. EXAMPLES
e1: 2*(x+3)
e2: 2*x+6
equivalentUnder(e1,e2, arithmetic_over_real_numbers) = true.
e3: x/x
equivalentUnder(e3,1,x != 0) = true.
equivalentUnder(e3,1,all_real_x) = false due to undefined x=0.
e4: sum_{i=1}^n i
alphaEquivalent(e4,sum_{j=1}^n j) = true.
23. PROVENANCE AND ATTRIBUTION
project: Kireth Semantic Library.
authors: Mark Higgins — Sky (Recursive AI).
source_page: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/expression-entities/mathematical-expression-ontology.html
note: Independent formalisation using established mathematics; webpage text not verified.
END FLOW ALGEBRA
Download Code
Copy to Clipboard