Skip to content

Latest commit

 

History

History
267 lines (181 loc) · 8.6 KB

File metadata and controls

267 lines (181 loc) · 8.6 KB

Wolfram's Claims → HeytingLean Proofs

This document maps claims from Stephen Wolfram's "The Ruliology of Lambdas" to machine-verified proofs in HeytingLean.


Legend

Symbol Meaning
PROVEN Fully machine-verified in Lean 4
📐 FORMALIZED Structure defined, key lemmas proven
🔬 COMPUTATIONAL Executable verification (decidable)
📖 STATED Prop-level specification, proof pending

I. Confluence (Church–Rosser)

Wolfram's Claim

"If a lambda terminates, all evaluations...that terminate will terminate with the same result."

This is the Church–Rosser property: β-reduction is confluent.

HeytingLean Proof

-- Lambda/Confluence.lean:508
theorem Steps.churchRosser {t u v : Term} (htu : Steps t u) (htv : Steps t v) :
    ∃ w : Term, Steps u w ∧ Steps v w
Status Location Lines
PROVEN Lambda/Confluence.lean 519

Proof Strategy: Takahashi-style parallel reduction → diamond property → confluence.

Key intermediate results:

  • Par.diamond — Parallel reduction has diamond property
  • Par.develop — Complete development function
  • church_rosser_reflTransGen — Confluence for ReflTransGen Par

II. Lambda ↔ Combinator Translation

Wolfram's Claim

"At a fundamental level the ruliology of systems whose behavior is not obviously simple will be at least at some level the same" between lambdas and combinators.

Size-4 lambdas convert to combinators; lambda representations are typically "slightly smaller" due to de Bruijn indices.

HeytingLean Proofs

-- Lambda/SKYBridge.lean
-- λ → SK compilation
def Term.compileCExp : Term → Option (Bracket.CExp Nat)

-- SK → λ encoding
def KEnc : Term  -- λλ1
def SEnc : Term  -- λλλ((2 0)(1 0))
def YEnc : Term  -- λ(λ(1(0 0)))(λ(1(0 0)))

-- Simulation theorem: SK steps are simulated by λ β-joinability
theorem Bridge.ofComb_simulates_step_joinable (c c' : Comb) (h : Comb.Step c c') :
    StepsLemmas.Joinable (ofComb c) (ofComb c')
Status Location Key Results
PROVEN Lambda/SKYBridge.lean ofComb_simulates_step_joinable
PROVEN BracketAbstractionCorrectness.lean bracket_beta_join

What This Proves: Every SK combinator reduction step corresponds to joinable β-reductions on the λ-encodings. This formalizes the "same ruliology" claim.


III. Multiway Systems

Wolfram's Claim

"At size 6, multiway graphs begin showing branching—and merging."

"One lambda creating a loop rather than terminating."

HeytingLean Formalization

-- Lambda/Beta.lean
-- One-step β-reduction
inductive Step : Term → Term → Prop
  | head : Step (.app (.lam body) arg) (Term.substTop arg body)
  | appL : Step f f' → Step (.app f a) (.app f' a)
  | appR : Step a a' → Step (.app f a) (.app f a')
  | lam  : Step t t' → Step (.lam t) (.lam t')

-- Multiway enumeration (all possible next states)
def stepEdgesList (t : Term) : List (EventData × Term)

-- Path-labeled events for causal tracking
structure EventData where
  path : RedexPath
  tag  : RuleTag
Status Location Key Results
📐 FORMALIZED Lambda/Beta.lean Step, Steps, stepEdgesList
🔬 COMPUTATIONAL Lambda/Beta.lean stepEdgesList returns all branches

Multiway Enumeration: stepEdgesList enumerates ALL possible β-reductions at each step, enabling exploration of the full multiway graph.


IV. Term Enumeration

Wolfram's Claim

"The number of lambdas grows rapidly with size" following roughly factorial growth.

HeytingLean Formalization

-- Lambda/Syntax.lean
-- Size metric (node count)
def nodeCount : Term → Nat
  | .var _ => 1
  | .app f a => 1 + f.nodeCount + a.nodeCount
  | .lam body => 1 + body.nodeCount

-- Lambda/Enumeration.lean
-- Bounded enumeration of closed terms
def enumClosed (maxSize : Nat) : List Term
Status Location Key Results
📐 FORMALIZED Lambda/Syntax.lean nodeCount, leafCount
🔬 COMPUTATIONAL Lambda/Enumeration.lean enumClosed

V. Substitution Calculus

Wolfram's Claim (Implicit)

The entire β-reduction system depends on correct substitution with variable capture avoidance.

HeytingLean Proofs

-- Lambda/ShiftSubst.lean (44,557 bytes of proofs!)

-- Core operations
def shift : Term → Nat → Nat → Term      -- de Bruijn shifting
def subst : Term → Nat → Term → Term     -- substitution
def substTop : Term → Term → Term        -- β-reduction substitution
def shiftDown : Term → Nat → Nat → Term  -- inverse shift

-- Key lemmas (selection)
theorem shift_subst_comm ...             -- shift/subst commutation
theorem subst_subst_swap ...             -- substitution swap
theorem shift_substTop ...               -- shift through substTop
theorem shiftDown_substTop ...           -- shiftDown through substTop
Status Location Lines
PROVEN Lambda/ShiftSubst.lean 1,200+

This is the foundational infrastructure that makes everything else work. Without correct shift/subst, Church-Rosser cannot be proven.


VI. Linear Lambdas

Wolfram's Claim

"Linear lambdas...can never increase in size during beta reduction."

"Evaluation always terminates for a linear lambda."

HeytingLean Status

Status Notes
📖 STATED Not yet formalized; requires linearity predicate

Future Work: Define IsLinear : Term → Prop and prove:

  • linear_step_nodeCount_le — Linear terms don't grow
  • linear_termination — Linear terms always terminate

VII. Undecidability

Wolfram's Claim

"Whether evaluation terminates is fundamentally undecidable—in the sense that no finite computation whatsoever can guarantee to answer it."

HeytingLean Status

Status Notes
📖 META This is a meta-theorem about the formalism itself

The undecidability of the halting problem for λ-calculus is a classical result (equivalent to Turing machine halting). Our formalization doesn't prove this directly but is consistent with it—we provide stepEdgesList for finite exploration but no terminates : Term → Bool.


VIII. Causal Graphs

Wolfram's Claim

"Evaluations display varying causal structures—from simple, linear causal graphs for sequentially dependent reductions to complex branching."

HeytingLean Formalization

-- Lambda/Beta.lean
structure EventData where
  path : RedexPath   -- WHERE the reduction happened
  tag  : RuleTag     -- WHAT rule was applied

-- Lambda/Ruliology.lean
-- Bounded multiway exploration with full event data
def exploreMultiwayBounded (t : Term) (maxSteps : Nat) : MultiwayResult
Status Location
📐 FORMALIZED Lambda/Beta.lean, Lambda/Ruliology.lean

The RedexPath tracks the position of each reduction, enabling reconstruction of causal dependencies.


Summary Table

Wolfram Claim HeytingLean Status Key Theorem
Confluence (Church-Rosser) PROVEN Steps.churchRosser
λ ↔ SK equivalence PROVEN ofComb_simulates_step_joinable
Bracket abstraction correctness PROVEN bracket_beta_join
Substitution calculus PROVEN ShiftSubst.lean (44KB)
Multiway enumeration 📐 FORMALIZED stepEdgesList
Term enumeration 🔬 COMPUTATIONAL enumClosed
Causal tracking 📐 FORMALIZED EventData, RedexPath
Linear lambda termination 📖 STATED Future work
Halting undecidability 📖 META Classical result

What This Formalization Achieves

  1. Machine-verified Church-Rosser: The central theorem of λ-calculus, proven in ~520 lines via Takahashi parallel reduction.

  2. Executable Ruliology: stepEdgesList and exploreMultiwayBounded let you computationally explore the multiway graphs Wolfram discusses.

  3. Bridge to Combinators: Formal proof that SK combinator reductions are faithfully simulated by λ β-reduction.

  4. Foundational Rigor: 44KB of shift/substitution lemmas ensure the entire development is on solid ground.

This is not just a formalization—it's a verification that Wolfram's ruliological observations about λ-calculus rest on mathematically sound foundations.