Effective Integer Semantics and Direct Analytic Comparison
DefinitionMonodromy_EffectivenessDevelops primitive-recursive integer interpretations of finite native words and programs, bounded prime-exponent and tape readouts, and a partial-recursive upper bound on the realizable function class. Defines a direct three-real-coordinate comparator using sinc for exact zero tests on integer points and normalized root weights for routing; its complete lattice evaluation agrees with the native integer semantics.
-- Generated by Lean-fact skeleton subtraction; original source is frozen in imports/monodromy/source.
module
public import Definitions.Def_Monodromy_Continuation
public import Definitions.Def_Monodromy_IntegerPrimrec
public import Definitions.Def_Monodromy_Tape
public import Lean.Elab.Tactic.Omega
public import Mathlib.Analysis.Analytic.Constructions
public import Mathlib.Analysis.Analytic.IsolatedZeros
public import Mathlib.Analysis.Analytic.Linear
public import Mathlib.Analysis.Calculus.DSlope
public import Mathlib.Analysis.Calculus.Deriv.Add
public import Mathlib.Analysis.Calculus.Deriv.Comp
public import Mathlib.Analysis.Calculus.Deriv.Mul
public import Mathlib.Analysis.Calculus.Deriv.Pow
public import Mathlib.Analysis.Complex.Basic
public import Mathlib.Analysis.Complex.CoveringMap
public import Mathlib.Analysis.Real.Pi.Bounds
public import Mathlib.Analysis.SpecialFunctions.Complex.Analytic
public import Mathlib.Analysis.SpecialFunctions.Complex.Circle
public import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
public import Mathlib.Analysis.SpecialFunctions.Trigonometric.Sinc
public import Mathlib.Computability.PartrecCode
public import Mathlib.Computability.Primrec.Basic
public import Mathlib.Computability.Primrec.List
public import Mathlib.Computability.StateTransition
public import Mathlib.Computability.TuringMachine.PostTuringMachine
public import Mathlib.Data.Fin.Basic
public import Mathlib.Data.Fintype.Card
public import Mathlib.Data.Int.ModEq
public import Mathlib.Data.Nat.Digits.Lemmas
public import Mathlib.Logic.Equiv.Fin.Rotate
public import Mathlib.Logic.Function.Conjugate
public import Mathlib.RingTheory.RootsOfUnity.Complex
public import Mathlib.Tactic.FieldSimp
public import Mathlib.Tactic.FunProp
public import Mathlib.Tactic.Linarith
public import Mathlib.Tactic.Ring
public import Mathlib.Topology.Homotopy.Lifting
@[expose] public section
/-!
# The effective content of cover execution
Fixed words of the five native loops have primitive recursive integer
interpretations. Complete native word execution
agrees with this proof interpretation, including results and divergence.
The trajectory-generating core uses the actual covering lifts throughout.
-/
@[expose] public section
namespace Monodromy.Effectiveness
end Monodromy.Effectiveness
noncomputable section
namespace Monodromy.CoupledContinuation
namespace Program
variable {degree : ℕ} [NeZero degree]
end Program
end Monodromy.CoupledContinuation
namespace Monodromy.PrimeReadout
/-- A bounded search reads a prime exponent without an unbounded factorization oracle. -/
def exponent (prime input : ℕ) : ℕ := input.findGreatest (fun power => prime ^ power ∣ input)
end Monodromy.PrimeReadout
namespace Monodromy.TapeCode.Readout
/-- The same fixed positional code is effective on finite words. -/
def wordCode (a : ℕ) (word : List (Fin a)) : ℕ :=
Nat.ofDigits (a + 1) (word.map Fin.val)
section Decoder
variable {a : ℕ} [NeZero a]
/-- The unused last residue is interpreted as blank by a fixed finite table. -/
def extend (read : Fin a → ℕ → ℕ) (letter : Fin (a + 1)) : ℕ → ℕ :=
Fin.lastCases (read 0) read letter
def digit (a : ℕ) (value : ℕ) : Fin (a + 1) :=
⟨value % (a + 1), Nat.mod_lt _ (Nat.succ_pos a)⟩
def step (read : Fin a → ℕ → ℕ) (state : ℕ × ℕ) : ℕ × ℕ :=
(state.1 / (a + 1), extend read (digit a state.1) state.2)
def run (read : Fin a → ℕ → ℕ) (fuel : ℕ) (state : ℕ × ℕ) : ℕ × ℕ :=
(step read)^[fuel] state
/-- A bounded numeric readout, independent of the program producing the code. -/
def decode (read : Fin a → ℕ → ℕ) (value : ℕ) : ℕ :=
(run read value (value, 0)).2
variable (read : Fin a → ℕ → ℕ) (neutral : ∀ initial, read 0 initial = initial)
theorem fold_blanks (neutral : ∀ initial, read 0 initial = initial) (count initial : ℕ) :
(List.replicate count (0 : Fin a)).foldl (fun total letter => read letter total) initial = initial := by
induction count generalizing initial with
| zero => rfl
| succ count recursive => simpa only [List.replicate_succ, List.foldl_cons, neutral] using recursive initial
/-- Neutral blank padding makes the human-readable fold a function of the complete half-tape. -/
def tapeFold (neutral : ∀ initial, read 0 initial = initial) (tape : Turing.ListBlank (Fin a)) (initial : ℕ) : ℕ :=
tape.liftOn (fun word => word.foldl (fun total letter => read letter total) initial) (by
rintro first _ ⟨count, rfl⟩
simp [List.foldl_append, Fin.default_eq_zero, fold_blanks read neutral])
end Decoder
end Monodromy.TapeCode.Readout
/-!
## Direct analytic comparison
The same finite word table has a globally real analytic successor on three
real coordinates. Its complete execution on the exact integer lattice agrees
with native transport. The comparison evaluates formulas directly and carries
no assertion about off-lattice conjugacy, physical robustness, or equal cost.
-/
namespace Monodromy.AnalyticComparison
/-- An analytic exact zero indicator on the integer lattice. -/
def zero (x : ℝ) : ℝ := Real.sinc (Real.pi * x)
/-- A real analytic cardinal selector for the finite control residue. -/
def weight (degree : ℕ) [NeZero degree] (marked : Fin degree) (x : ℝ) : ℝ :=
(Choice.kernel (fun z : ℂ => z ^ degree) (Radix.omega degree marked : ℂ)
(Radix.readRoot degree ((2 * Real.pi) * x) : ℂ)).re
end Monodromy.AnalyticComparison
namespace Monodromy.AnalyticComparison
open CoupledContinuation
abbrev State := (ℝ × ℝ) × ℝ
def embed (labels : Labels) : State :=
(((labels.1.1 : ℝ), (labels.1.2 : ℝ)), (labels.2 : ℝ))
/-- These analytic shears evaluate formulas directly, with no path-lifting operation. -/
def gate (operation : Gate) (backward : Bool) (state : State) : State :=
let displacement : ℝ := if backward then -1 else 1
match operation with
| .left => ((state.1.1 + displacement, state.1.2), state.2)
| .right => ((state.1.1, state.1.2 + displacement), state.2)
| .zeroLeft => (state.1, state.2 + displacement * zero state.1.1)
| .zeroRight => (state.1, state.2 + displacement * zero state.1.2)
| .control => (state.1, state.2 + displacement)
def word : Word → State → State
| [], state => state
| (operation, backward) :: rest, state => word rest (gate operation backward state)
variable {degree : ℕ} [NeZero degree]
/-- A finite analytic successor over three real coordinates. -/
def next (program : Program degree) (state : State) : State :=
∑ index, weight degree index state.2 • word (program.table index) state
def halt (program : Program degree) (state : State) : ℝ :=
∑ index, weight degree index state.2 * if program.stop index then 1 else 0
def step (program : Program degree) (state : State) : Option State :=
if halt program state = 1 then none else some (next program state)
def eval (program : Program degree) : State → Part State :=
StateTransition.eval (step program)
end Monodromy.AnalyticComparison
Read-back
What the Lean code literally says, in plain math · OpenAI Codex (independent agent)
For any naturals , exponent returns the greatest natural satisfying , by bounded search with default if there is no match; no primality or positivity hypothesis is imposed, and in particular input gives , base gives , and base gives . For any natural alphabet size , wordCode of a finite word in is its little-endian base- digit value; the empty word has code zero, and if only the empty word exists. Decoding requires and an arbitrary read table : the extension sends the extra residue to the read operation for symbol and all smaller residues to their own operations; digit takes remainder modulo ; a decoder step on gives with that extended interpretation. run iterates for any supplied natural fuel, and decode of performs exactly steps from and returns the accumulator, hence decode of is . If additionally for every natural , the included fold equality says any number of blank zeros leaves any initial accumulator unchanged, and tapeFold lifts the left fold of this read table, with arbitrary initial accumulator, to half-tapes modulo trailing blank padding; without that neutrality hypothesis only the bounded numeric decoder is defined. The real-coordinate interfaces define , with sinc equal to at zero and elsewhere, and for each positive natural and define , where is the divided slope of at divided by its derivative at , with divided slope on the diagonal equal to that derivative. Real states are triples and integer labels embed by coordinatewise casts. Given displacement for backward and otherwise, the five real gates respectively replace by , replace by , replace by , replace by , or replace by , leaving all other coordinates fixed. A word applies its letters in list order and the empty word is identity. For any positive-degree native word/stop table, the real successor is , a weighted sum of whole output triples, and the real halt quantity is . Its optional step is absent exactly when that quantity equals and otherwise returns the successor; evaluation is partial terminal-state iteration and is undefined if no absent step is reached. These formulas are defined on every real state, with no lattice-membership premise in their definitions.
Confirmed by the mission captain (proposal self-audit).