AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
FLOW ALGEBRA
FREE VARIABLE ONTOLOGY
Kireth Semantic Library | Mathematical Entities / Symbolic Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/symbolic-entities/free-variable-ontology-2.html
Authors: Mark Higgins — Sky (Recursive AI)
Status: mathematical reference synthesis; source webpage not independently verified
Version: 1.0 | Date: 2026-10-13
01. PURPOSE
flow "FreeVariableOntology" v1.0
domain: mathematical_logic | symbolic_computation | formal_semantics
entity: FreeVariable
objective: identify, type, resolve and preserve unbound variable occurrences
output: typed semantic graph and capture-safe symbolic transformations
02. CORE DEFINITIONS
VariableOccurrence := occurrence(identifier, expression, position)
Binder := lambda | forall | exists | summation | product | integral | comprehension | let | formal_parameter
bound(o,E) := an enclosing binder in E binds occurrence o under the language's scope rules
free(o,E) := variable_occurrence(o,E) AND NOT bound(o,E)
FV(E) := { identifier(o) | free(o,E) }
Note: free/bound is a property of an occurrence relative to an expression and binding conventions.
03. ENTITY SCHEMA
FreeVariableOccurrence:
identifier: SymbolID
expression: -ExpressionID
position: SourceSpan
lexical_scope: ScopeID
declared_type: Type?
inferred_type: Type?
resolution: unresolved | environment_binding | symbolic_parameter
provenance: SourceReference
confidence: [0,1]
Expression:
syntax_tree: AST
free_variables: Set[SymbolID]
bound_variables: Set[SymbolID]
semantic_context: ContextID
04. BASIC RECURSIVE RULES (UNTYPED LAMBDA CALCULUS)
FV(x) = {x}
FV(c) = {} for a constant c
FV(E1 E2) = FV(E1) union FV(E2)
FV(lambda x.E) = FV(E) minus {x}
FV((E1,E2)) = FV(E1) union FV(E2)
FV(f(E1,...,En)) = union_i FV(Ei), for a constant function symbol f
In a language with variable function symbols, include FV(f) as well.
05. LOGICAL QUANTIFIERS
FV(not P) = FV(P)
FV(P and Q) = FV(P) union FV(Q)
FV(P or Q) = FV(P) union FV(Q)
FV(P implies Q) = FV(P) union FV(Q)
FV(forall x.P) = FV(P) minus {x}
FV(exists x.P) = FV(P) minus {x}
ClosedFormula(P) iff FV(P) = {}
OpenFormula(P) iff FV(P) != {}
06. MATHEMATICAL BINDING CONVENTIONS
FV(sum_{i=1}^n a_i) normally includes n and a (as an indexed family), but not i.
FV(integral f(x) dx) excludes integration variable x when the integral is a binding construct.
FV({x in S | P(x,y)}) = FV(S) union (FV(P) minus {x}) when x is locally bound.
Bounds and domains are analysed according to their explicit scoping semantics.
An index symbol is not automatically bound merely because it is a subscript.
07. FREE-VERSUS-BOUND DISTINCTION
Example: lambda x.(x+y)
bound_occurrence: x
free_occurrence: y
FV: {y}
Example: forall x.(P(x,z) and exists y.Q(y,x))
FV: {z}
Example: x + (lambda x.x)
first_x: free
lambda_body_x: bound
FV: {x}
A symbol can have free and bound occurrences in the same expression.
08. ENVIRONMENTS AND INTERPRETATION
environment rho: SymbolID -> Value
eval(E,rho) requires values for relevant free identifiers.
Closed expressions can be evaluated without external variable assignments, subject to constants and interpretation.
An environment binding does not turn a syntactically free occurrence into a bound occurrence.
Context-sensitive name resolution must not conflate lexical binding and external assignment.
09. SUBSTITUTION
E[x := T] replaces free occurrences of x in E with T.
FV(E[x := T]) subseteq (FV(E) minus {x}) union FV(T)
Equality holds under ordinary capture-avoiding substitution when x occurs free in E,
except where details of the language's syntax and substitution semantics impose conditions.
Binder conflict requires alpha-renaming before substitution.
Example: (lambda y.x)[x := y] -> lambda z.y, where z is fresh.
Incorrect: lambda y.y (captures the formerly free y).
10. ALPHA EQUIVALENCE
lambda x.x ==alpha lambda y.y
lambda x.(x+z) ==alpha lambda y.(y+z)
lambda x.y !=alpha lambda y.y when x and y are distinct and y is free in the first.
Alpha-renaming changes bound names only and preserves free-variable identity.
FV(E) = FV(E') whenever E ==alpha E'.
11. SHADOWING AND SCOPE
Inner binders may shadow outer binders of the same identifier.
Example: lambda x.(x + (lambda x.x)) has FV = {}.
Every bound occurrence resolves to its nearest applicable lexical binder.
A free occurrence has no enclosing applicable binder in the analysed expression.
Scope may depend on the formal language and construct.
12. TYPE AND DOMAIN CONSTRAINTS
infer_type(x, Gamma) = Gamma[x] when x has a type assignment.
Free variables may have types even without local binders.
Type-checking must verify operations against declared or inferred types.
An unresolved free variable is not automatically an error in an open symbolic formula.
Example: x + 2 constrains x to a compatible additive numeric domain.
13. SEMANTIC RELATIONSHIPS
FreeVariableOccurrence --instanceOf--> VariableOccurrence
FreeVariableOccurrence --occursIn--> Expression
FreeVariableOccurrence --hasIdentifier--> SymbolID
FreeVariableOccurrence --hasScope--> ScopeID
FreeVariableOccurrence --requiresAssignmentFrom--> Environment
Binder --binds--> BoundVariableOccurrence
Expression --hasFreeVariable--> SymbolID
Substitution --targets--> FreeVariableOccurrence
AlphaEquivalence --preserves--> FreeVariableSet
14. KNOWLEDGE GRAPH REPRESENTATION
node: -expression:E1 {kind: LambdaExpression}
node: binder:B1 {symbol: x, kind: lambda}
node: occurrence:O1 {symbol: x, status: bound}
node: occurrence:O2 {symbol: y, status: free}
edge: B1 binds O1
edge: O1 occursIn E1
edge: O2 occursIn E1
edge: E1 hasFreeVariable y
Avoid asserting that an identifier is globally free without an expression context.
15. INFERENCE RULES
R1: identifier occurrence without applicable lexical binder -> free occurrence.
R2: occurrence resolved to enclosing binder -> bound occurrence.
R3: FV of application -> union of component FV sets.
R4: FV of binding expression -> remove identifiers bound in its body, respecting scope.
R5: FV(E) empty -> E is syntactically closed.
R6: alpha-equivalent expressions -> identical free-variable sets.
R7: substitution would capture free identifier -> rename conflicting binder first.
R8: external value assignment -> preserve syntactic free/bound classification.
16. SEMANTIC EQUIVALENCE
Canonicalisation: parse AST -> resolve binders -> alpha-normalise -> derive FV.
Same free-variable set does NOT imply expression equivalence.
Alpha-equivalence implies equal FV sets, but the converse does not hold.
Equivalent expressions under a chosen theory can have different syntactic FV sets.
Example: x-x and 0 are arithmetically equal but have FV {x} and {} respectively.
Record equivalence type: syntactic | alpha | logical | denotational.
17. VALIDATION
V1: all occurrences have unique source positions or AST identifiers.
V2: all binder edges respect lexical scope.
V3: free occurrences have no applicable enclosing binder.
V4: FV is calculated from occurrences, not symbol spelling alone.
V5: capture-avoiding substitution is enforced.
V6: alpha-renaming preserves FV and semantics.
V7: external environments are distinguished from lexical binders.
V8: language-specific binding rules are declared.
18. CONFIDENCE
CONFIDENCE:
exact_formal_parse: 1.00 when syntax and scope are fully specified
inferred_notation: contextual; requires documented assumptions
ambiguous_scoping: unresolved until conventions are established
Confidence is evidence about classification, not probability that a theorem is true.
19. FLOW HASH
FLOW_HASH:
inputs: ontology_version | canonical_AST | binding_map | type_context | rule_set_version
algorithm: SHA-256
encoding: UTF-8
canonicalisation: deterministic ordering and alpha-normalised binder identifiers
purpose: detect semantic-model changes and support reproducibility
Do not claim a hash value without computing it.
20. UPDATE MODEL
UPDATE_MODEL:
trigger: syntax_change | scope_change | type_change | ontology_revision
steps: parse -> resolve -> classify -> infer -> validate -> hash -> publish
invalidate: dependent FV sets and substitution results after scope changes
preserve: source references, version history and change provenance
21. AI CONSUMPTION
AI_CONSUMPTION:
format: typed entity graph and deterministic inference rules
retrieval_keys: identifier | expression | binder | scope | free_variable_set
uses: theorem proving | symbolic simplification | program analysis | query logic | AI reasoning
safeguards: no implicit capture | no free/bound conflation | explicit language semantics
output: FV set | occurrence classifications | binding edges | diagnostics | provenance
22. TEST CASES
T1: FV(x+y) = {x,y}
T2: FV(lambda x.x+y) = {y}
T3: FV(forall x.P(x,z)) = {z}
T4: FV(lambda x.lambda y.(x+y)) = {}
T5: FV((lambda x.x) y) = {y}
T6: capture-avoiding substitution of y for x in lambda y.x produces lambda z.y.
T7: FV(x-x) = {x} despite algebraic equivalence to 0.
23. PROVENANCE AND AUTHORSHIP
Primary page: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/symbolic-entities/free-variable-ontology-2.html
Content basis: established formal logic, lambda calculus and symbolic mathematics.
Page verification: not independently verified for this version.
Authorship: Mark Higgins — Sky (Recursive AI)
Project: Kireth Semantic Library | https://kirethresearch.org
END FLOW ALGEBRA