OAI/Computability/FiniteCompiler/Validator.lean
57 declarations, 0 contain sorry, 0 declared as axioms
Finite tape validation, scan reversal, and bounded cleanup.
- inductive
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Headline 15Source documentation
The validator states I,J,J',N,V and its fresh machine handoff.
inductive Head | initial | left | right | workspace | suffix | start deriving DecidableEq /-- A cell includes every tag field, even unused ones. -/
Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.cell
- abbrev
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Cellline 20Source documentation
A cell includes every tag field, even unused ones.
abbrev Cell (S Γ : Type*) := Base S × Tag S Γ
Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Base, OAI.FiniteAlgebraicEnvelopes.Compiler.Tag
- def
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.cellline 22 - structure
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Sectorline 27Source documentation
A headed sector in zipper notation. The left list is in reverse order, so its head is exactly the cell adjacent to the validator.
structure Sector (S Γ : Type*) where …
- inductive
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Stepline 37Source documentation
Literal internal equations compiler-validation, oriented as in the source. There is no entry from P and no transition from the machine back here.
inductive Step {S Γ : Type*} (blank : Γ) : Sector S Γ → Sector S Γ → Prop | initial_workspace (l r : List (Cell S Γ)) (lb rb : Bool) : Step blank ⟨.initial, cell blank .workspace :: l, r, lb, rb⟩ ⟨.initial, l, cell blank .workspace :: r, lb, rb⟩ | initial_cut (l r : List (Cell S Γ)) (lb rb : Bool) : Step blank ⟨.initial, cell blank .cutC :: l, r, lb, rb⟩ ⟨.left, l, cell blank .cutC :: r, lb, rb⟩ | left_anchor (a : S) (l r : List (Cell S Γ)) (lb rb : Bool) : Step blank ⟨.left, cell blank (.anchor a) :: l, r, lb, rb⟩ ⟨.left, l, cell blank (.anchor a) :: r, lb, rb⟩ | left_boundary (r : List (Cell S Γ)) (rb : Bool) : Step blank ⟨.left, [], r, true, rb⟩ ⟨.right, [], r, true, rb⟩ …Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Sector, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Cell, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.cell
- theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.step_deterministicline 67 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.step_leftUniqueline 73Source documentation
Validator reverse determinism, not asserted for machine phases.
theorem step_leftUnique {S Γ : Type*} (blank : Γ) : Relator.LeftUnique (@Step S Γ blank) := by …Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Step
- def
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Entryline 79Source documentation
An entry has clean D immediately right of its I head.
def Entry {S Γ : Type*} (blank : Γ) (s : Sector S Γ) : Prop := …Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Sector
- theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.entry_no_predecessorline 82 - def
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.skeletonline 89Source documentation
Ordered cells and both flags are preserved by every internal validator step.
def skeleton {S Γ : Type*} (s : Sector S Γ) : List (Cell S Γ) × Bool × Bool := …Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Sector, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Cell
- theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.step_skeletonline 93 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.reaches_skeletonline 97 - inductive
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Anchorsline 107Source documentation
Exact clean-anchor language; dirty tags are not accepted.
inductive Anchors : List (Cell S Γ) → Prop | nil : Anchors [] | cons (a : S) {l} : Anchors l → Anchors (cell blank (.anchor a) :: l) /-- The right suffix tested from N: clean workspace, D, then clean anchors. -/Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Cell, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.cell, OAI.FiniteAlgebraicEnvelopes.Compiler.clean
- inductive
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Tailline 112Source documentation
The right suffix tested from N: clean workspace, D, then clean anchors.
inductive Tail : List (Cell S Γ) → Prop | cut {l} : Anchors blank l → Tail (cell blank .cutD :: l) | work {l} : Tail l → Tail (cell blank .workspace :: l) /-- The right suffix tested from J': anchors, C, workspace, D, anchors. -/Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Cell, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Anchors, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.cell
- inductive
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Bodyline 117Source documentation
The right suffix tested from J': anchors, C, workspace, D, anchors.
inductive Body : List (Cell S Γ) → Prop | cut {l} : Tail blank l → Body (cell blank .cutC :: l) | anchor (a : S) {l} : Body l → Body (cell blank (.anchor a) :: l) /-- The reversed left side tested from I: workspace, C, then anchors. -/Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Cell, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Tail, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.cell
- inductive
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Leftline 122Source documentation
The reversed left side tested from I: workspace, C, then anchors.
inductive Left : List (Cell S Γ) → Prop | cut {l} : Anchors blank l → Left (cell blank .cutC :: l) | work {l} : Left l → Left (cell blank .workspace :: l) /-- Necessary future checks at each phase. Already-scanned cells need not be constrained: backwards propagation recovers exactly the checks made. -/Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Cell, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Anchors, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.cell
- def
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Readyline 128Source documentation
Necessary future checks at each phase. Already-scanned cells need not be constrained: backwards propagation recovers exactly the checks made.
def Ready (s : Sector S Γ) : Prop := …
Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Sector
- theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.ready_predecessorline 139 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.reaches_readyline 176 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.anchors_iffline 182 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.left_iffline 196 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.passing_entryline 217Source documentation
Every entry which reaches handoff has the FULL clean form in the manuscript: both boundaries, all clean tags, anchors on each side, and one quota. In particular this is not a cleanliness assumption on the input.
theorem passing_entry {a b : Sector S Γ} (ha : Entry blank a) (hab : ReflTransGen (Step blank) a b) (hb : b.head = .start) : ∃ (x y : List S) (s : ℕ), a = ⟨.initial, List.replicate s (cell blank .workspace) ++ cell blank .cutC :: (x.map (fun c => cell blank (.anchor c))).reverse, cell blank .cutD :: y.map (fun c => cell blank (.anchor c)), true, true⟩ := by …Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Sector, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Entry, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Step, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.cell
- theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.initial_workspacesline 238 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.left_anchorsline 251 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.right_anchorsline 262 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.workspace_manyline 273 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.suffix_anchorsline 286 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.clean_entry_reachesline 299Source documentation
Conversely every full clean entry passes the validator, with all cells left of the head at the handoff to the simulated program.
theorem clean_entry_reaches (x y : List S) (s : ℕ) : ReflTransGen (Step blank) ⟨.initial, List.replicate s (cell blank .workspace) ++ cell blank .cutC :: (x.map (fun a => cell blank (.anchor a))).reverse, cell blank .cutD :: y.map (fun a => cell blank (.anchor a)), true, true⟩ ⟨.start, (y.map (fun a => cell blank (.anchor a))).reverse ++ cell blank .cutD :: (List.replicate s (cell blank .workspace) ++ cell blank .cutC :: (x.map (fun a => cell blank (.anchor a))).reverse), [], true, true⟩ := by …Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Step, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.cell
- def
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.measureline 329Source documentation
A strictly decreasing validator measure, valid for every dirty sector.
def measure (s : Sector S Γ) : ℕ := …
Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Sector
- theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.measure_decreasesline 339 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.source_eq_of_reachesline 350Source documentation
A source vertex cannot be reached from a different vertex.
theorem source_eq_of_reaches {a b : α} (hb : ∀ c, ¬ r c b) (hab : ReflTransGen r a b) : a = b := by … - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.sources_unique_of_joinline 357Source documentation
In a reverse-deterministic graph, two sources reaching the same vertex agree.
theorem sources_unique_of_join (hr : Relator.LeftUnique r) {a b c : α} (ha : ∀ x, ¬ r x a) (hb : ∀ x, ¬ r x b) (hac : ReflTransGen r a c) (hbc : ReflTransGen r b c) : a = b := by … - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.entries_uniqueline 376 - def
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.baseSkeletonline 383Source documentation
The machine may alter tags but never these ordered bases or outer flags.
def baseSkeleton (s : Sector S Γ) : List (Base S) × Bool × Bool := …
Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Sector, OAI.FiniteAlgebraicEnvelopes.Compiler.Base
- theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.clean_anchorsline 386 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.clean_leftline 392 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.clean_tailline 398 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.cutD_not_mem_leftline 404 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.passing_entries_uniqueline 411Source documentation
Passing entries are determined by their invariant base sequence, with no injectivity hypothesis on the subsequent simulated-machine transitions.
theorem passing_entries_unique {a b : Sector S Γ} (ha : Entry blank a) (hb : Entry blank b) (hra : Ready blank a) (hrb : Ready blank b) (hs : baseSkeleton a = baseSkeleton b) : a = b := by …Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Sector, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Entry, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Ready, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.baseSkeleton
- abbrev
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.Cfgline 445 - def
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.Activeline 449Source documentation
Only the fresh handoff and machine configurations participate in simulation; in particular there is no return to I,J,J',N,V.
def Active : Cfg S Γ M → Prop | .inl v => v.head = .start | .inr _ => True /-- The internal graph consists of literal validator equations and simulator edges. These edges contain neither quota insertion nor exit to cleanup. -/Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.Cfg
- inductive
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.Stepline 455Source documentation
The internal graph consists of literal validator equations and simulator edges. These edges contain neither quota insertion nor exit to cleanup.
inductive Step (r : Cfg S Γ M → Cfg S Γ M → Prop) : Cfg S Γ M → Cfg S Γ M → Prop | validator {v w} : Validator.Step blank v w → Step r (.inl v) (.inl w) | machine {a b} : Active a → Active b → r a b → Step r a bMentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.Cfg, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Step, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.Active
- theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.validator_not_startline 460 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.deterministicline 464 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.path_decompositionline 479Source documentation
A path starting in the validator either stays there, or first reaches its fresh handoff. This explicitly excludes a dirty bypass of validation.
theorem path_decomposition {r : Cfg S Γ M → Cfg S Γ M → Prop} {a : Sector S Γ} {b : Cfg S Γ M} (h : ReflTransGen (Step blank r) (.inl a) b) : (∃ v, b = .inl v ∧ ReflTransGen (Validator.Step blank) a v) ∨ ∃ v, ReflTransGen (Validator.Step blank) a v ∧ v.head = .start := by …Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.Cfg, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Sector, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.Step, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Step
- theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.reaches_activeline 492 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.path_to_validatorline 502Source documentation
Pulling a path back from a non-handoff validator configuration never encounters a simulator edge.
theorem path_to_validator {r : Cfg S Γ M → Cfg S Γ M → Prop} {a c : Cfg S Γ M} (h : ReflTransGen (Step blank r) a c) {b : Sector S Γ} (hc : c = .inl b) (hb : b.head ≠ .start) : ∃ v, a = .inl v ∧ ReflTransGen (Validator.Step blank) v b := by …Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.Cfg, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.Step, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Sector, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Step
- def
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.baseSkeletonline 518 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.step_basesline 522 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.connected_basesline 532 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.entries_uniqueline 544Source documentation
Entry uniqueness survives arbitrary reverse branching in the simulated machine. This is source Lemma compiler-components on all dirty sectors.
theorem entries_unique {r : Cfg S Γ M → Cfg S Γ M → Prop} (hdet : Relator.RightUnique r) (hbase : ∀ a b, r a b → baseSkeleton bases a = baseSkeleton bases b) {a b : Sector S Γ} (ha : Entry blank a) (hb : Entry blank b) (hab : EqvGen (Step blank r) (.inl a) (.inl b)) : a = b := by …Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.Cfg, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.baseSkeleton, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Sector, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Entry, OAI.FiniteAlgebraicEnvelopes.Compiler.Validator.Extended.Step
- structure
OAI.FiniteAlgebraicEnvelopes.Compiler.Scan.Sectorline 579Source documentation
A list zipper for the same finite-scan semantics. Left cells are nearest first. This representation permits induction on literal scan paths.
structure Sector (Head Base Tag : Type*) where …
Mentions: OAI.FiniteAlgebraicEnvelopes.Compiler.Base, OAI.FiniteAlgebraicEnvelopes.Compiler.Tag
- def
OAI.FiniteAlgebraicEnvelopes.Compiler.Scan.stepline 589 - def
OAI.FiniteAlgebraicEnvelopes.Compiler.Scan.Stepline 604 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Scan.deterministicline 606 - def
OAI.FiniteAlgebraicEnvelopes.Compiler.Scan.baseSkeletonline 610 - theorem
OAI.FiniteAlgebraicEnvelopes.Compiler.Scan.step_skeletonline 613