Lax307052.ConfigurationGraph
The bounded configuration graph
concepts/Lax307052/ConfigurationGraph.lean · lax-307052
No public endorsements yet.
Loading review…
Sign in with ORCIDConcept map
Definition
Vertices are configurations whose work tape has a fixed finite bound. Edges are machine transitions. Acceptance is reachability from the initial configuration to a terminal accepting configuration. The search predicate replaces reachability by the recursive finite graph test.
Lean source view on GitHub
| 1 | import Lax307052.BoundedConfigurations |
| 2 | import Lax307052.Reachability |
| 3 | import Mathlib.Data.Fintype.EquivFin |
| 4 | import Mathlib.Data.Nat.Log |
| 5 | |
| 6 | /-! |
| 7 | --- |
| 8 | title: The bounded configuration graph |
| 9 | type: definition |
| 10 | --- |
| 11 | Vertices are configurations whose work tape has a fixed finite bound. |
| 12 | Edges are machine transitions. Acceptance is reachability from the initial |
| 13 | configuration to a terminal accepting configuration. The search predicate |
| 14 | replaces reachability by the recursive finite graph test. |
| 15 | -/ |
| 16 | |
| 17 | namespace Lax307052.ConfigurationGraph |
| 18 | |
| 19 | open Lax434930.PolynomialTime Lax434930.SpaceMachines BoundedConfigurations Reachability |
| 20 | |
| 21 | noncomputable def numbering (M : Machine) (n s : ℕ) : |
| 22 | Config M n s ≃ Fin (Fintype.card (Config M n s)) := Fintype.equivFin _ |
| 23 | |
| 24 | noncomputable def graph (M : Machine) (w : Word) (s : ℕ) : |
| 25 | Graph (Fintype.card (Config M w.length s)) := by |
| 26 | classical |
| 27 | exact fun a b => decide (M.Step w (expand ((numbering M w.length s).symm a)) |
| 28 | (expand ((numbering M w.length s).symm b))) |
| 29 | |
| 30 | def AcceptsBounded (M : Machine) (w : Word) (s : ℕ) : Prop := |
| 31 | ∃ a b : Config M w.length s, |
| 32 | expand a = M.initial ∧ M.Terminal w (expand b) ∧ M.accept b.state = true ∧ |
| 33 | Reachable (graph M w s) (numbering M w.length s a) (numbering M w.length s b) |
| 34 | |
| 35 | def SearchAccepts (M : Machine) (w : Word) (s : ℕ) : Prop := |
| 36 | ∃ a b : Config M w.length s, |
| 37 | expand a = M.initial ∧ M.Terminal w (expand b) ∧ M.accept b.state = true ∧ |
| 38 | search (graph M w s) (Nat.clog 2 (Fintype.card (Config M w.length s))) |
| 39 | (numbering M w.length s a) (numbering M w.length s b) = true |
| 40 | |
| 41 | end Lax307052.ConfigurationGraph |
| 42 |
Community review
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above; your ORCID profile must share a public name.
0 comments