AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
FLOW ALGEBRA
BOUND VARIABLE ONTOLOGY
Kireth Semantic Library | Mathematical Entities > Symbolic Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/symbolic-entities/bound-variable-ontology-2.html
Authors: Mark Higgins — Sky (Recursive AI)
Version: 1.0 | 2026-10-13
Status: Mathematical synthesis; source page not independently verified.
01. PURPOSE
flow "BoundVariableOntology" v1.0
objective: represent, resolve, rename and validate variables bound by lexical or mathematical operators
scope: mathematical logic, lambda calculus, quantified formulas, sums, products, integrals, set builders and formal languages
02. ENTITY TYPES
entity BoundVariable <: Variable
entity Binder <: SymbolicOperator
entity BindingOccurrence <: SymbolOccurrence
entity VariableOccurrence <: SymbolOccurrence
entity Scope <: -ExpressionRegion
entity Expression <: SymbolicEntity
entity Environment <: Mapping
entity AlphaEquivalence <: SemanticRelationship
entity FreeVariable <: Variable
03. CORE RELATIONS
binds(Binder, BindingOccurrence)
has_scope(Binder, Scope)
occurs_in(VariableOccurrence, Expression)
resolves_to(VariableOccurrence, BindingOccurrence)
shadows(BindingOccurrence, BindingOccurrence)
alpha_equivalent(Expression, Expression)
free_in(Variable, Expression)
bound_in(VariableOccurrence, Expression)
04. TYPED SCHEMA
BindingOccurrence:
symbol: Identifier
binder_id: UniqueIdentifier
declared_type: Type?
scope_id: UniqueIdentifier
source_span: Span?
VariableOccurrence:
symbol: Identifier
resolved_binding_id: UniqueIdentifier?
source_span: Span?
Binder:
kind: {forall, exists, lambda, summation, product, integral, set_comprehension, let, other}
declarations: List[BindingOccurrence]
scope: -Expression
05. SEMANTIC DEFINITION
A variable occurrence is bound iff it resolves to an enclosing applicable binder.
An identifier spelling alone does not determine bound status.
A variable can have both bound and free occurrences in distinct contexts.
A binder's scope is syntax-dependent; never infer scope from typography alone.
06. FORMAL RULES: FIRST-ORDER LOGIC
FV(P(t1,...,tn)) = union(FV(ti))
FV(not phi) = FV(phi)
FV(phi and psi) = FV(phi) union FV(psi)
FV(forall x . phi) = FV(phi) minus {x}
FV(exists x . phi) = FV(phi) minus {x}
Bound occurrence: x in P(x) under forall x . P(x)
Free occurrence: y in forall x . P(x,y)
07. LAMBDA CALCULUS
FV(x) = {x}
FV(lambda x . M) = FV(M) minus {x}
FV(M N) = FV(M) union FV(N)
alpha: lambda x . x ==alpha lambda y . y
not_alpha: lambda x . y !=alpha lambda y . y (when x != y)
beta: (lambda x . M) N -> M[x := N] with capture-avoiding substitution
08. INDEXED BINDERS
sum_{i=1}^{n} a_i: i bound in summand; n may remain free
product_{k=1}^{m} f(k): k bound in product body
integral_a^b f(x) dx: x bound by integration notation, subject to formal grammar
{x in S | P(x)}: x bound in predicate, and often expression, under set-builder grammar
Do not confuse an indexed free variable with a dummy index.
09. BINDING RESOLUTION
input: abstract syntax tree with binder declarations and occurrence nodes
traverse(node, environment):
if binder:
allocate unique binding IDs
extend environment only over specified scope
traverse scoped children with extended environment
if variable occurrence:
resolve to nearest applicable binding of same identifier
otherwise classify as free
if exiting binder scope:
restore outer environment
output: occurrence-to-binding edges, free-variable set, diagnostics
10. SHADOWING
forall x . (P(x) and exists x . Q(x))
The x in P(x) resolves to outer binder.
The x in Q(x) resolves to inner binder.
Two same-spelled declarations are not identical bindings.
11. ALPHA RENAMING
rename_bound(binding_id, fresh_symbol):
rename declaration and precisely those occurrences resolved to binding_id
reject if renaming captures a free variable or changes binding resolution
preserve denotation and binding graph
alpha_equivalent(A,B) iff canonical binding-aware representations match
de Bruijn indices may provide a canonical representation for lambda terms.
12. CAPTURE-AVOIDING SUBSTITUTION
substitute(M, x, N):
replace free occurrences of x in M only
if a binder in M would capture a free variable of N, alpha-rename first
never substitute inside a binder's scope where that binder binds x
example: (lambda y . x)[x := y] => lambda z . y, with z fresh
invalid naive result: lambda y . y
13. INVARIANTS
every bound occurrence resolves to exactly one binding declaration
each binding declaration has a defined scope
lexical shadowing uses the nearest applicable binder
alpha-renaming preserves free-variable sets up to identical free identifiers
alpha-equivalence does not require identical binder names
unbound occurrences are not automatically errors: open expressions are valid
14. RELATIONSHIP GRAPH
BoundVariable --is_a--> Variable
BoundVariable --declared_by--> Binder
Binder --defines--> Scope
VariableOccurrence --resolves_to--> BindingOccurrence
BindingOccurrence --may_shadow--> BindingOccurrence
BoundVariable --contrasts_with--> FreeVariable
AlphaEquivalence --preserves--> BindingStructure
Substitution --requires--> CaptureAvoidance
15. INFERENCE RULES
R1: resolves_to(o,b) => bound_in(o,scope(b)) when o lies in applicable scope
R2: no applicable binder for o => free_occurrence(o)
R3: same spelling and different binding IDs => distinct declarations
R4: alpha_equivalent(A,B) => FV(A) = FV(B)
R5: substitution capture risk => rename conflicting binder before replacement
R6: nested binder of same symbol => inner binding shadows outer within inner scope
16. SEMANTIC EQUIVALENCE
exact_symbol_match: lexical only; insufficient for identity
binding_identity: unique declaration ID and resolution edges
alpha_equivalence: equivalence modulo safe renaming of bound variables
semantic_equivalence: broader than alpha-equivalence and depends on interpretation
example: forall x P(x) alpha-equivalent to forall z P(z)
caution: forall x P(x) is not generally equivalent to exists x P(x)
17. VALIDATION
validate AST grammar and binder scope boundaries
validate each resolved binding ID exists
validate occurrences lie within declared binder scope
validate type compatibility when typed variables are used
validate alpha-renaming against capture
validate substitution against variable capture
validate shadowing policy without treating legal shadowing as invalid
18. CONFIDENCE
mathematical_axioms: 1.00 when derivations are checked under stated formalism
parse_confidence: based on syntactic ambiguity and grammar coverage
resolution_confidence: 1.00 for unambiguous valid AST, otherwise flagged
source_alignment: unverified until linked page is inspected
never conflate semantic certainty with empirical model confidence
19. FLOW_HASH
canonicalise: normalise AST, binder IDs and relation ordering
canonical_hash: HASH(canonical_binding_aware_representation)
raw_source_hash: HASH(original_source_text)
algorithm: SHA-256 (implementation choice)
record algorithm, version and canonicalisation method
alpha-normalised hash may be equal for alpha-equivalent expressions
20. UPDATE_MODEL
on_expression_change: reparse affected scope, rebuild binding edges
on_binder_rename: recompute capture checks and alpha-normalised representation
on_scope_change: invalidate dependent resolution and free-variable sets
on_grammar_update: version parser and revalidate affected expressions
maintain provenance and prior canonical hashes
21. AI_CONSUMPTION
output:
ontology_id: "mathematical.symbolic.bound_variable"
entity_types: [BoundVariable, Binder, BindingOccurrence, VariableOccurrence, Scope]
relations: [binds, has_scope, resolves_to, shadows, alpha_equivalent]
operations: [resolve_bindings, free_variables, alpha_rename, substitute_capture_avoiding]
evidence: [AST, binding_edges, source_spans, validation_results]
use_cases: theorem proving, symbolic algebra, program analysis, formal verification, semantic retrieval
safety: do not infer binding from plain text without an explicit parsing model
22. TEST CASES
T1: forall x P(x) => FV = {}
T2: forall x P(x,y) => FV = {y}
T3: lambda x . x => bound x; FV = {}
T4: lambda x . y => free y; FV = {y}
T5: lambda x . x ==alpha lambda z . z => true
T6: lambda x . y ==alpha lambda y . y => false when x != y
T7: (lambda y . x)[x := y] => alpha-equivalent to lambda z . y, z fresh
T8: forall x (P(x) and exists x Q(x)) => distinct binding IDs
23. PROVENANCE
source_url: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/symbolic-entities/bound-variable-ontology-2.html
authored_for: Kireth Semantic Library
attribution: Mark Higgins — Sky (Recursive AI)
disclosure: AI-assisted ontology synthesis
note: This document is a formal companion model, not a verified transcription of the webpage.
END FLOW ALGEBRA