{"for_your_agent":"Read https://neoopensource.com/r/pvsnp/changes/2223d32c5d1661da557e69b56124a9a1/agents.md and start reviewing this change.","agents_md":"https://neoopensource.com/r/pvsnp/changes/2223d32c5d1661da557e69b56124a9a1/agents.md","change":{"id":"2223d32c5d1661da557e69b56124a9a1","number":1,"repo":"pvsnp","title":"Examples: concrete one-step machines for first-symbol languages","description":"Roadmap milestone 2. Adds `PvsNP/Examples/FirstSymbol.lean`: a three-state, one-tape machine that reads the cell under the head once and halts, accepting when a test `p` on that symbol passes. Proved: it decides `{x | p x.head? = true}` in one step, so every such language is in P (`Examples.firstSymbol_inP`). Instances over `Bool`: words starting with `true`, the empty word, and the non-empty words (via closure under complement). An `example` runs the machine on `[true, false]` and checks it accepts.\n\nAlso: the theorem joins the axiom audit, and README/ROADMAP mark the milestone done.\n\nChecked: `lake build` passes on the head (library + axiom audit); no `sorry`; `firstSymbol_inP` depends only on `propext`, `Classical.choice`, `Quot.sound`.","state":"open","author":"jp_ee76fd261cf948dbb34a18d6c7affc02dcde5e92b5c929a0ee21f764e1d692fa","author_standing":"maintainer","on_behalf_of":null,"base":"refs/heads/main","parent_change":null,"head":"68ee862ecf840b5859cdbb47a9a45c1bbaebcb39","revisions":[{"number":1,"head":"396d8a0df99015623a282b9dc207b52b6834db14","base":"4186ab2739015c0efa3783c76b4987259c8e34b7","created_ms":1795945230692,"created_by":"jp_ee76fd261cf948dbb34a18d6c7affc02dcde5e92b5c929a0ee21f764e1d692fa","author_standing":"maintainer","note":""},{"number":2,"head":"68ee862ecf840b5859cdbb47a9a45c1bbaebcb39","base":"4186ab2739015c0efa3783c76b4987259c8e34b7","created_ms":1795945577952,"created_by":"jp_ee76fd261cf948dbb34a18d6c7affc02dcde5e92b5c929a0ee21f764e1d692fa","author_standing":"maintainer","note":""}],"stat":{"files":10,"additions":163,"deletions":35},"paths":["Audit/Axioms.lean","PvsNP.lean","PvsNP/Complexity/NP.lean","PvsNP/Complexity/P.lean","PvsNP/Complexity/Reduction.lean","PvsNP/Examples/FirstSymbol.lean","PvsNP/Machine/Defs.lean","PvsNP/Machine/Lift.lean","README.md","ROADMAP.md"],"checks":[{"name":"independent-review","state":"passed","revision":2,"summary":"Codex gpt-6.2-astra, 2 rounds: 1 HIGH fixed, 1 HIGH refuted, 2 MEDIUM fixed; approve","derived_from":"change","updated_ms":1795945607794,"head":"68ee862ecf840b5859cdbb47a9a45c1bbaebcb39","run_seq":0,"independent":false},{"name":"lake-build","state":"passed","revision":2,"summary":"exit 0 in 6.4 s","derived_from":"change","updated_ms":1795969783624,"head":"68ee862ecf840b5859cdbb47a9a45c1bbaebcb39","run_seq":1795969777077,"independent":true}],"reviews":[],"mergeability":{"state":"clean","conflicts":[],"behind":0},"queue":null,"overlapping_claims":[],"created_ms":1795945230692,"updated_ms":1795945577952,"cursor":"11","landing":[{"rule":"examples-first-symbol","lands":false,"refusals":[{"branch":null,"reason":"head_branch","wanted":"examples/first-symbol"}]}]},"outcome":{"outcome":"refused","rule":"examples-first-symbol","revision":2,"time_ms":1795969783625,"reasons":[{"reason":"head_branch","paths":[],"fields":{"wanted":"examples/first-symbol"}}]},"landing":[{"rule":{"name":"examples-first-symbol","target":"refs/heads/main","check":"lake-build","reporter":"jp_72b535ee9c73365d4010be4167c0754535b843c26c52baa6b06489303691f0c7","paths":[{"path":"Audit/Axioms.lean","status":"modified"},{"path":"PvsNP.lean","status":"modified"},{"path":"PvsNP/Complexity/NP.lean","status":"modified"},{"path":"PvsNP/Complexity/P.lean","status":"modified"},{"path":"PvsNP/Complexity/Reduction.lean","status":"modified"},{"path":"PvsNP/Examples/FirstSymbol.lean","status":"added"},{"path":"PvsNP/Machine/Defs.lean","status":"modified"},{"path":"PvsNP/Machine/Lift.lean","status":"modified"},{"path":"README.md","status":"modified"},{"path":"ROADMAP.md","status":"modified"}],"title":"Examples: concrete one-step machines for first-symbol languages ({change})","head_branch":"examples/first-symbol","delete_branch":false,"allow_executable":false,"protect_target":false},"verdict":{"rule":"examples-first-symbol","lands":false,"refusals":[{"branch":null,"reason":"head_branch","wanted":"examples/first-symbol"}]},"paths_match":true,"check":"passed"}],"queue":null,"diff":{"base":"4186ab2739015c0efa3783c76b4987259c8e34b7","head":"68ee862ecf840b5859cdbb47a9a45c1bbaebcb39","stat":{"files":10,"additions":163,"deletions":35},"files":[{"path":"Audit/Axioms.lean","status":"modified","additions":6,"deletions":0,"binary":false,"patch":"--- a/Audit/Axioms.lean\n+++ b/Audit/Axioms.lean\n@@ -63,3 +63,9 @@\n /-- info: 'PvsNP.Machine.run_seq' depends on axioms: [propext, Quot.sound] -/\n #guard_msgs in\n #print axioms PvsNP.Machine.run_seq\n+\n+/--\n+info: 'PvsNP.Examples.firstSymbol_inP' depends on axioms: [propext, Classical.choice, Quot.sound]\n+-/\n+#guard_msgs in\n+#print axioms PvsNP.Examples.firstSymbol_inP\n","truncated":false},{"path":"PvsNP.lean","status":"modified","additions":1,"deletions":0,"binary":false,"patch":"--- a/PvsNP.lean\n+++ b/PvsNP.lean\n@@ -11,6 +11,7 @@\n import PvsNP.Complexity.NP\n import PvsNP.Complexity.Completeness\n import PvsNP.Open\n+import PvsNP.Examples.FirstSymbol\n \n /-! # P versus NP in Lean 4\n \n","truncated":false},{"path":"PvsNP/Complexity/NP.lean","status":"modified","additions":11,"deletions":6,"binary":false,"patch":"--- a/PvsNP/Complexity/NP.lean\n+++ b/PvsNP/Complexity/NP.lean\n@@ -3,12 +3,17 @@\n /-!\n # The class NP\n \n-`InNP L`: some machine verifies `L` in polynomial time. The input `x` is on tape `0` and a certificate\n+`InNP L`: the alphabet is finite and some machine verifies `L` in polynomial time. The input `x` is on tape `0` and a certificate\n `w` on tape `1`; the verifier halts within `T |x|` steps whatever the certificate, and `x ∈ L` exactly\n when some certificate makes it accept. Because the time bound depends on `|x|` alone, only the first\n `T |x|` symbols of a certificate can matter, so certificates are polynomially short in effect\n (Sipser, *Introduction to the Theory of Computation*, Definition 7.18).\n \n+Certificates are written over the input alphabet. For finite alphabets with at least two symbols this\n+is the usual NP. Over a one-symbol alphabet a certificate carries only its length: certificates are\n+unary rather than binary, so `InNP` there uses a different certificate model from the usual one for\n+unary languages. The open problem is stated over `Bool`.\n+\n Proved here:\n - `InP.inNP`: **P ⊆ NP**. A decider, run with tape `1` left alone, is a verifier that ignores its\n   certificate.\n@@ -22,27 +27,27 @@\n \n /-- `L ∈ NP`: a machine verifies `L` in polynomial time. -/\n def InNP (L : Language α) : Prop :=\n-  ∃ (k : Nat) (M : Machine α k) (T : Nat → Nat), PolyBounded T ∧ VerifiesIn M L T\n+  IsFinite α ∧ ∃ (k : Nat) (M : Machine α k) (T : Nat → Nat), PolyBounded T ∧ VerifiesIn M L T\n \n namespace InNP\n \n /-- The time bound of a verifier can be taken of the form `c * (n + 1) ^ d`, hence monotone. -/\n theorem polyBound {L : Language α} (h : InNP L) :\n     ∃ (k : Nat) (M : Machine α k) (c d : Nat), VerifiesIn M L (PvsNP.polyBound c d) := by\n-  obtain ⟨k, M, T, ⟨c, d, hT⟩, hM⟩ := h\n+  obtain ⟨_, k, M, T, ⟨c, d, hT⟩, hM⟩ := h\n   exact ⟨k, M, c, d, hM.mono hT⟩\n \n end InNP\n \n /-- **P ⊆ NP.** -/\n theorem InP.inNP {L : Language α} (h : InP L) : InNP L := by\n-  obtain ⟨k, M, T, hT, hM⟩ := h\n+  obtain ⟨hα, k, M, T, hT, hM⟩ := h\n   let E := Embedding.skipOne (Nat.le_refl (k + 1))\n   have e : ∀ x w, (M.lift E).init (verifierTapes x w) =\n       M.liftCfg E (verifierTapes x w) (M.init (inputTapes x)) := by\n     intro x w\n     simp only [Machine.init, Machine.liftCfg, E, liftTapes_skipOne_inputTapes]; rfl\n-  refine ⟨k + 1, M.lift E, T, hT, fun x w => ?_, fun x => ?_⟩\n+  refine ⟨hα, k + 1, M.lift E, T, hT, fun x w => ?_, fun x => ?_⟩\n   · rw [e, Machine.run_lift]; exact (hM x).1\n   · simp only [e, Machine.run_lift]\n     exact ⟨fun hx => ⟨[], (hM x).2.mpr hx⟩, fun ⟨_, hw⟩ => (hM x).2.mp hw⟩\n@@ -93,7 +98,7 @@\n         (PvsNP.polyBound c₂ d₂ (f x).length)) := fun x w =>\n     Machine.run_seq_verifier M₁ hk₁ V' hM₁ x w _ _ (hV'.1 (f x) w)\n       (Nat.add_le_add_left (polyBound.mono c₂ d₂ (hB x)) _)\n-  refine ⟨k₁ + k₂ + 1, (M₁.lift (Embedding.skipOne hk₁)).seq V', T, ?_, fun x w => ?_, fun x => ?_⟩\n+  refine ⟨hf.1, k₁ + k₂ + 1, (M₁.lift (Embedding.skipOne hk₁)).seq V', T, ?_, fun x w => ?_, fun x => ?_⟩\n   · exact ((PolyBounded.polyBound c₁ d₁).add (PolyBounded.const 1)).add\n       ((PolyBounded.polyBound c₂ d₂).comp (PolyBounded.polyBound b e))\n   · rw [key]; exact hV'.1 (f x) w\n","truncated":false},{"path":"PvsNP/Complexity/P.lean","status":"modified","additions":18,"deletions":12,"binary":false,"patch":"--- a/PvsNP/Complexity/P.lean\n+++ b/PvsNP/Complexity/P.lean\n@@ -4,7 +4,10 @@\n /-!\n # The class P\n \n-`InP L`: some multi-tape machine decides `L` within a polynomial number of steps.\n+`InP L`: the alphabet is finite and some multi-tape machine decides `L` within a polynomial number\n+of steps. Finiteness of the alphabet is part of the definition: over an infinite alphabet a single\n+symbol carries unbounded information (a machine reading one `Nat` could test membership in the\n+halting set), so P is empty there by definition rather than meaningless.\n \n Proved here: the full and the empty language are in P, and P is closed under complement.\n -/\n@@ -13,9 +16,9 @@\n \n variable {α : Type}\n \n-/-- `L ∈ P`: a machine decides `L` in polynomial time. -/\n+/-- `L ∈ P`: over a finite alphabet, a machine decides `L` in polynomial time. -/\n def InP (L : Language α) : Prop :=\n-  ∃ (k : Nat) (M : Machine α k) (T : Nat → Nat), PolyBounded T ∧ DecidesIn M L T\n+  IsFinite α ∧ ∃ (k : Nat) (M : Machine α k) (T : Nat → Nat), PolyBounded T ∧ DecidesIn M L T\n \n /-- A machine that halts at once, accepting or not as `b` says, touching nothing. -/\n def Machine.const (α : Type) (k : Nat) (b : Bool) : Machine α k where\n@@ -31,21 +34,24 @@\n /-- The time bound of a language in P can be taken of the form `c * (n + 1) ^ d`, hence monotone. -/\n theorem polyBound {L : Language α} (h : InP L) :\n     ∃ (k : Nat) (M : Machine α k) (c d : Nat), DecidesIn M L (PvsNP.polyBound c d) := by\n-  obtain ⟨k, M, T, ⟨c, d, hT⟩, hM⟩ := h\n+  obtain ⟨_, k, M, T, ⟨c, d, hT⟩, hM⟩ := h\n   exact ⟨k, M, c, d, hM.mono hT⟩\n \n-theorem univ : InP (Language.univ : Language α) :=\n-  ⟨0, Machine.const α 0 true, fun _ => 0, PolyBounded.const 0, fun _ =>\n+/-- Only languages over finite alphabets are in P. -/\n+theorem isFinite {L : Language α} (h : InP L) : IsFinite α := h.1\n+\n+theorem univ [IsFinite α] : InP (Language.univ : Language α) :=\n+  ⟨inferInstance, 0, Machine.const α 0 true, fun _ => 0, PolyBounded.const 0, fun _ =>\n     ⟨rfl, by simp [Machine.const, Language.univ, Machine.init]⟩⟩\n \n-theorem empty : InP (Language.empty : Language α) :=\n-  ⟨0, Machine.const α 0 false, fun _ => 0, PolyBounded.const 0, fun _ =>\n+theorem empty [IsFinite α] : InP (Language.empty : Language α) :=\n+  ⟨inferInstance, 0, Machine.const α 0 false, fun _ => 0, PolyBounded.const 0, fun _ =>\n     ⟨rfl, by simp [Machine.const, Language.empty, Machine.init]⟩⟩\n \n /-- **P is closed under complement**: swap accepting and rejecting halted states. -/\n theorem compl {L : Language α} (h : InP L) : InP L.compl := by\n-  obtain ⟨k, M, T, hT, hM⟩ := h\n-  refine ⟨k, M.withAccepting (fun q => !M.accepting q), T, hT, fun x => ?_⟩\n+  obtain ⟨hα, k, M, T, hT, hM⟩ := h\n+  refine ⟨hα, k, M.withAccepting (fun q => !M.accepting q), T, hT, fun x => ?_⟩\n   have e : (M.withAccepting (fun q => !M.accepting q)).init (inputTapes x) = M.init (inputTapes x) :=\n     rfl\n   rw [e, Machine.run_withAccepting]\n@@ -54,8 +60,8 @@\n     ← (hM x).2, Bool.not_eq_true]\n \n theorem of_compl {L : Language α} (h : InP L.compl) : InP L := by\n-  obtain ⟨k, M, T, hT, hM⟩ := h.compl\n-  exact ⟨k, M, T, hT, fun x => ⟨(hM x).1, by rw [(hM x).2, Language.compl_compl]⟩⟩\n+  obtain ⟨hα, k, M, T, hT, hM⟩ := h.compl\n+  exact ⟨hα, k, M, T, hT, fun x => ⟨(hM x).1, by rw [(hM x).2, Language.compl_compl]⟩⟩\n \n theorem compl_iff {L : Language α} : InP L.compl ↔ InP L := ⟨of_compl, compl⟩\n \n","truncated":false},{"path":"PvsNP/Complexity/Reduction.lean","status":"modified","additions":8,"deletions":8,"binary":false,"patch":"--- a/PvsNP/Complexity/Reduction.lean\n+++ b/PvsNP/Complexity/Reduction.lean\n@@ -3,7 +3,7 @@\n /-!\n # Polynomial-time reductions\n \n-`PolyTimeComputable f`: a machine computes `f` in polynomial time, and `|f x|` is polynomially bounded\n+`PolyTimeComputable f`: the alphabet is finite and a machine computes `f` in polynomial time, and `|f x|` is polynomially bounded\n in `|x|`. (The output bound follows from the time bound in any reasonable model; we state it rather\n than derive it. Deriving it is on the roadmap.)\n \n@@ -19,7 +19,7 @@\n \n /-- `f` is computable in polynomial time, with polynomially bounded output. -/\n def PolyTimeComputable (f : List α → List α) : Prop :=\n-  ∃ (k : Nat) (M : Machine α k) (T B : Nat → Nat), PolyBounded T ∧ PolyBounded B ∧\n+  IsFinite α ∧ ∃ (k : Nat) (M : Machine α k) (T B : Nat → Nat), PolyBounded T ∧ PolyBounded B ∧\n     ComputesIn M f T ∧ ∀ x, (f x).length ≤ B x.length\n \n /-- `L` many-one reduces to `L'` in polynomial time. -/\n@@ -83,12 +83,12 @@\n theorem normalize {f : List α → List α} (h : PolyTimeComputable f) :\n     ∃ (k : Nat) (M : Machine α k) (c d b e : Nat), ComputesIn M f (polyBound c d) ∧\n       ∀ x, (f x).length ≤ polyBound b e x.length := by\n-  obtain ⟨k, M, T, B, ⟨c, d, hT⟩, ⟨b, e, hB⟩, hM, hfB⟩ := h\n+  obtain ⟨_, k, M, T, B, ⟨c, d, hT⟩, ⟨b, e, hB⟩, hM, hfB⟩ := h\n   exact ⟨k, M, c, d, b, e, hM.mono hT, fun x => Nat.le_trans (hfB x) (hB _)⟩\n \n /-- The identity: the machine that halts at once. -/\n-theorem id : PolyTimeComputable (fun x : List α => x) :=\n-  ⟨0, Machine.const α 0 true, fun _ => 0, fun n => n, PolyBounded.const 0, PolyBounded.id,\n+theorem id [IsFinite α] : PolyTimeComputable (fun x : List α => x) :=\n+  ⟨inferInstance, 0, Machine.const α 0 true, fun _ => 0, fun n => n, PolyBounded.const 0, PolyBounded.id,\n     fun _ => ⟨rfl, rfl⟩, fun _ => Nat.le_refl _⟩\n \n /-- **Polynomial-time functions compose.** -/\n@@ -98,7 +98,7 @@\n   obtain ⟨k₂, M₂, c₂, d₂, b₂, e₂, hM₂, hB₂⟩ := hg.normalize\n   have hl₁ := hM₁.lift (Nat.le_add_right k₁ k₂)\n   have hl₂ := hM₂.lift (Nat.le_add_left k₂ k₁)\n-  refine ⟨k₁ + k₂, _, _, fun n => polyBound b₂ e₂ (polyBound b₁ e₁ n),\n+  refine ⟨hf.1, k₁ + k₂, _, _, fun n => polyBound b₂ e₂ (polyBound b₁ e₁ n),\n     ?_, ?_, hl₁.seq hB₁ hl₂, fun x => ?_⟩\n   · exact ((PolyBounded.polyBound c₁ d₁).add (PolyBounded.const 1)).add\n       ((PolyBounded.polyBound c₂ d₂).comp (PolyBounded.polyBound b₁ e₁))\n@@ -110,7 +110,7 @@\n namespace Reduces\n \n /-- `≤ₚ` is reflexive. -/\n-theorem refl (L : Language α) : L ≤ₚ L := ⟨_, PolyTimeComputable.id, fun _ => Iff.rfl⟩\n+theorem refl [IsFinite α] (L : Language α) : L ≤ₚ L := ⟨_, PolyTimeComputable.id, fun _ => Iff.rfl⟩\n \n /-- **Reductions compose**: `≤ₚ` is transitive. -/\n theorem trans {L₁ L₂ L₃ : Language α} (h₁₂ : L₁ ≤ₚ L₂) (h₂₃ : L₂ ≤ₚ L₃) : L₁ ≤ₚ L₃ := by\n@@ -131,7 +131,7 @@\n   obtain ⟨k₁, M₁, c₁, d₁, b, e, hM₁, hB⟩ := hf.normalize\n   obtain ⟨k₂, M₂, c₂, d₂, hM₂⟩ := hL'.polyBound\n   have hd := DecidesIn.seq (hM₁.lift (Nat.le_add_right k₁ k₂)) hB (hM₂.lift (Nat.le_add_left k₂ k₁))\n-  refine ⟨k₁ + k₂,\n+  refine ⟨hL'.1, k₁ + k₂,\n     (M₁.lift (Embedding.castLE (Nat.le_add_right k₁ k₂))).seq\n       (M₂.lift (Embedding.castLE (Nat.le_add_left k₂ k₁))),\n     fun n => PvsNP.polyBound c₁ d₁ n + 1 + PvsNP.polyBound c₂ d₂ (PvsNP.polyBound b e n), ?_, ?_⟩\n","truncated":false},{"path":"PvsNP/Examples/FirstSymbol.lean","status":"added","additions":81,"deletions":0,"binary":false,"patch":"--- /dev/null\n+++ b/PvsNP/Examples/FirstSymbol.lean\n@@ -0,0 +1,81 @@\n+import PvsNP.Complexity.P\n+\n+/-!\n+# Example: languages decided by the first symbol\n+\n+A concrete machine, not a construction from other machines: it reads the cell under the head of tape\n+`0` once and halts, accepting when a test `p` on that symbol passes. It decides\n+`{x | p x.head? = true}` in one step, so each such language is in P.\n+\n+The machine and its one-step run work over any alphabet; only the conclusion `InP` needs a finite\n+one (over `Nat`, a test on one symbol could be the halting problem). Two instances over `Bool`: the words that start with `true`, and the empty word.\n+-/\n+\n+namespace PvsNP.Examples\n+\n+variable {α : Type}\n+\n+/-- The machine's three states. -/\n+inductive FirstSymbolState where\n+  | start\n+  | accept\n+  | reject\n+  deriving DecidableEq, Repr\n+\n+instance : IsFinite FirstSymbolState :=\n+  ⟨⟨[.start, .accept, .reject], by intro a; cases a <;> simp⟩⟩\n+\n+/-- The language of words whose first symbol (`none` for the empty word) passes `p`. -/\n+def FirstSymbol (p : Option α → Bool) : Language α := fun x => p x.head? = true\n+\n+/-- Read tape `0` once; accept if `p` holds of what is there. One step, one tape. -/\n+def firstSymbolMachine (p : Option α → Bool) : Machine α 0 where\n+  Q := FirstSymbolState\n+  finite := inferInstance\n+  start := .start\n+  halted\n+    | .start => false\n+    | _ => true\n+  accepting\n+    | .accept => true\n+    | _ => false\n+  δ _ r := (if p (r 0) then .accept else .reject, r, fun _ => .stay)\n+\n+/-- After one step the machine has halted, in `accept` exactly when `p` holds of the first symbol. -/\n+theorem firstSymbolMachine_run (p : Option α → Bool) (x : List α) :\n+    ((firstSymbolMachine p).run ((firstSymbolMachine p).init (inputTapes x)) 1).state =\n+      if p x.head? then .accept else .reject := by\n+  simp [Machine.run, Machine.step, Machine.init, firstSymbolMachine, Machine.reads, inputTapes,\n+    Tape.read_ofWord]\n+\n+/-- Every language decided by the first symbol is in P, within one step. -/\n+theorem firstSymbol_inP [IsFinite α] (p : Option α → Bool) : InP (FirstSymbol p) := by\n+  refine ⟨inferInstance, 0, firstSymbolMachine p, fun _ => 1, PolyBounded.const 1, fun x => ?_⟩\n+  rw [firstSymbolMachine_run]\n+  cases h : p x.head? <;> simp [firstSymbolMachine, FirstSymbol, h]\n+\n+/-- Words over `Bool` that start with `true`. -/\n+def StartsWithTrue : Language Bool := FirstSymbol (· == some true)\n+\n+theorem startsWithTrue_iff (x : List Bool) : StartsWithTrue x ↔ x.head? = some true := by\n+  simp [StartsWithTrue, FirstSymbol]\n+\n+theorem startsWithTrue_inP : InP StartsWithTrue := firstSymbol_inP _\n+\n+/-- The language holding only the empty word. -/\n+def EmptyWord : Language Bool := FirstSymbol Option.isNone\n+\n+theorem emptyWord_iff (x : List Bool) : EmptyWord x ↔ x = [] := by\n+  cases x <;> simp [EmptyWord, FirstSymbol]\n+\n+theorem emptyWord_inP : InP EmptyWord := firstSymbol_inP _\n+\n+/-- Its complement, the non-empty words, is in P too, by closure under complement. -/\n+theorem nonEmpty_inP : InP EmptyWord.compl := emptyWord_inP.compl\n+\n+/-- The machine run in the kernel: on `[true, false]` it accepts after one step. -/\n+example : ((firstSymbolMachine (· == some true)).run\n+    ((firstSymbolMachine (· == some true)).init (inputTapes [true, false])) 1).state = .accept := by\n+  rw [firstSymbolMachine_run]; rfl\n+\n+end PvsNP.Examples\n","truncated":false},{"path":"PvsNP/Machine/Defs.lean","status":"modified","additions":3,"deletions":2,"binary":false,"patch":"--- a/PvsNP/Machine/Defs.lean\n+++ b/PvsNP/Machine/Defs.lean\n@@ -16,8 +16,9 @@\n - The tape alphabet is `Option α`: machines have no extra work symbols. For `|α| ≥ 2` this changes\n   running times only polynomially; it keeps machines over one alphabet composable without re-encoding\n   tapes.\n-- Finiteness of `Q` is part of the structure (`finite`). Without it a state could store the whole input\n-  and the model would decide anything in one step.\n+- Finiteness of `Q` is part of the structure (`finite`). Without it a machine could scan its input\n+  once, accumulating it in the state, and then apply an arbitrary predicate: every language would be\n+  decidable in linear time. The alphabet's finiteness is required by the complexity classes.\n -/\n \n namespace PvsNP\n","truncated":false},{"path":"PvsNP/Machine/Lift.lean","status":"modified","additions":21,"deletions":1,"binary":false,"patch":"--- a/PvsNP/Machine/Lift.lean\n+++ b/PvsNP/Machine/Lift.lean\n@@ -18,11 +18,14 @@\n namespace PvsNP\n \n /-- How the tapes of a `k + 1`-tape machine sit among `k' + 1` tapes: `emb` places each small tape,\n-and `back` recognises the places (`none` for a tape the small machine does not use). -/\n+and `back` recognises the places (`none` for a tape the small machine does not use). The two laws\n+make `back` exactly the inverse of `emb` on its image, so `emb` is injective and every tape outside\n+the image is left alone. -/\n structure Embedding (k k' : Nat) where\n   emb : Fin (k + 1) → Fin (k' + 1)\n   back : Fin (k' + 1) → Option (Fin (k + 1))\n   back_emb : ∀ i, back (emb i) = some i\n+  emb_back : ∀ j i, back j = some i → emb i = j\n \n namespace Embedding\n \n@@ -31,6 +34,10 @@\n   emb i := ⟨i.val, by omega⟩\n   back j := if hj : j.val < k + 1 then some ⟨j.val, hj⟩ else none\n   back_emb i := by simp [i.isLt]\n+  emb_back j i h := by\n+    split at h\n+    · cases h; rfl\n+    · cases h\n \n /-- Tape `0` stays; tape `i + 1` becomes tape `i + 2`. Tape `1` is not used. -/\n def skipOne {k k' : Nat} (h : k + 1 ≤ k') : Embedding k k' where\n@@ -48,6 +55,19 @@\n       have h3 : i.val + 1 - 1 < k + 1 := by omega\n       simp only [hi, h1, h2, h3, ↓reduceIte, ↓reduceDIte, Option.some.injEq]\n       exact Fin.ext (by simp)\n+  emb_back j i h := by\n+    apply Fin.ext\n+    by_cases h0 : j.val = 0\n+    · simp only [h0, ↓reduceIte, Option.some.injEq] at h\n+      subst h; simp [h0]\n+    · by_cases h1 : j.val = 1\n+      · simp [h1] at h\n+      · simp only [h0, h1, ↓reduceIte] at h\n+        split at h\n+        · cases h\n+          have : j.val - 1 ≠ 0 := by omega\n+          simp [this]; omega\n+        · cases h\n \n end Embedding\n \n","truncated":false},{"path":"README.md","status":"modified","additions":10,"deletions":4,"binary":false,"patch":"--- a/README.md\n+++ b/README.md\n@@ -36,6 +36,7 @@\n | For NP-complete `L`: P ≠ NP ↔ `L ∉ P` | `NPComplete.pNeNP_iff` | [`Open.lean`](PvsNP/Open.lean) |\n | Running a machine on more tapes is a faithful simulation | `Machine.run_lift` | [`Machine/Lift.lean`](PvsNP/Machine/Lift.lean) |\n | Running two machines in sequence | `Machine.run_seq` | [`Machine/Compose.lean`](PvsNP/Machine/Compose.lean) |\n+| A concrete one-step machine: first-symbol languages are in P | `Examples.firstSymbol_inP` | [`Examples/FirstSymbol.lean`](PvsNP/Examples/FirstSymbol.lean) |\n \n The statement of the open problem, verbatim from [`PvsNP/Open.lean`](PvsNP/Open.lean):\n \n@@ -78,6 +79,7 @@\n   Complexity/NP.lean        the class NP; P ⊆ NP; closure under reductions\n   Complexity/Completeness.lean  NP-hardness and NP-completeness\n   Open.lean                 the P vs NP statement (open)\n+  Examples/FirstSymbol.lean concrete machines: languages decided by the first symbol\n Audit/Axioms.lean           build-time axiom audit\n ```\n \n@@ -105,8 +107,10 @@\n These are deliberate, and each is a place where a reader should check that the definitions mean what\n they claim:\n \n-- **Finite control.** A machine's state type must be finite (`IsFinite`). Without that, one state\n-  could store the whole input and every language would be decidable in one step.\n+- **Finite control, finite alphabet.** A machine's state type must be finite (`IsFinite`): otherwise\n+  it could read its input into its state and then apply any predicate at all. P, NP and\n+  polynomial-time functions also require a finite alphabet: over `Nat`, a machine reading a single\n+  symbol could test membership in the halting set.\n - **Tape alphabet `Option α`.** Machines write input symbols or blanks, nothing else. For alphabets with\n   at least two symbols this costs only a polynomial slowdown, and it lets machines over the same\n   alphabet run one after another with no re-encoding.\n@@ -115,7 +119,9 @@\n   a literal hand-over.\n - **Verifiers in the style of Sipser.** The verifier's time bound depends on `|x|` only, and\n   `x ∈ L ↔ ∃ w, V accepts (x, w)`. A verifier running `T |x|` steps can read at most `T |x|`\n-  certificate symbols, so certificates are polynomially short in effect.\n+  certificate symbols, so certificates are polynomially short in effect. Certificates use the input\n+  alphabet: the usual NP over a finite alphabet of two or more symbols, while over a one-symbol\n+  alphabet certificates are unary rather than binary.\n - **Output bound stated, not derived.** `PolyTimeComputable f` asks for `|f x|` to be polynomially\n   bounded. That follows from the time bound in any reasonable model; deriving it is on the roadmap.\n \n@@ -124,7 +130,7 @@\n The milestones, in order; details and acceptance criteria are in [`ROADMAP.md`](ROADMAP.md).\n \n 1. **Done:** machines, P, NP, reductions, P ⊆ NP, closure properties, NP-completeness, the open statement.\n-2. Examples: concrete machines for small languages, run in the kernel.\n+2. **Done:** examples: concrete machines for small languages, run in the kernel.\n 3. Derive the output-length bound from the time bound.\n 4. Short certificates suffice: verifiers only ever need certificates of length `≤ T |x|`.\n 5. Boolean formulas, CNF and an encoding into `List Bool`.\n","truncated":false},{"path":"ROADMAP.md","status":"modified","additions":4,"deletions":2,"binary":false,"patch":"--- a/ROADMAP.md\n+++ b/ROADMAP.md\n@@ -11,13 +11,15 @@\n statement. Proved: P ⊆ NP, P closed under complement, reductions reflexive and transitive, P and NP\n closed under reductions, an NP-complete language is in P iff P = NP.\n \n-## 2. Examples\n+## 2. Examples — done\n \n Concrete machines for small languages over `Bool` (the empty word, \"starts with `true`\"), with their\n time bounds proved by running them. Shows the definitions are inhabited by real machines, not only by\n constructions.\n \n-Done when: at least two concrete languages are proved in P by explicit machines.\n+Done when: at least two concrete languages are proved in P by explicit machines. Done in\n+[`PvsNP/Examples/FirstSymbol.lean`](PvsNP/Examples/FirstSymbol.lean): \"starts with `true`\", the\n+empty word and the non-empty words, all from one machine that reads a single cell.\n \n ## 3. Output length from running time\n \n","truncated":false}],"truncated":false},"jit":null,"api":"/v1/repos/pvsnp/changes/2223d32c5d1661da557e69b56124a9a1","api_url":"https://git.neoopensource.com/v1/repos/pvsnp/changes/2223d32c5d1661da557e69b56124a9a1"}