{"gap": "L-meta-765", "path": "lean/PEqualNP/Outside/L_meta_765.lean", "scope": "full", "source": "import PEqualNP.Defs\nimport PEqualNP.MetaComplexity.L112\nimport PEqualNP.MetaComplexity.L153\n\nopen PEqualNP.CircuitLowerBounds PEqualNP.MetaComplexity\n\nnamespace PEqualNP.Outside.L_meta_765\n\ndef f6 : (Fin 6 → Bool) → Bool := fun x =>\n  (x 0 && x 1) || (x 2 && x 3) || (x 3 && x 4) || (x 4 && x 5) || (x 5 && x 2)\n\ndef g4 : (Fin 4 → Bool) → Bool := fun x =>\n  (x 0 && x 1) || (x 1 && x 2) || (x 2 && x 3) || (x 3 && x 0)\n\ndef pt (k : ℕ) : Fin 6 → Bool := fun i => decide (i.val / 2 = k)\n\ntheorem getD_app (x : List Bool) (v : Bool) (o : ℕ) :\n    (x ++ [v]).getD o false =\n      if o < x.length then x.getD o false else if o = x.length then v else false := by\n  by_cases h1 : o < x.length\n  · rw [if_pos h1]\n    simp [List.getD_eq_getElem?_getD, List.getElem?_append_left h1]\n  · rw [if_neg h1]\n    by_cases h2 : o = x.length\n    · rw [if_pos h2]\n      subst h2\n      simp [List.getD_eq_getElem?_getD]\n    · rw [if_neg h2]\n      have h3 : (x ++ [v])[o]? = none := by\n        rw [List.getElem?_eq_none]\n        simp\n        omega\n      simp [List.getD_eq_getElem?_getD, h3]\n\ntheorem ofFn_getD (x : Fin 6 → Bool) (i : ℕ) (h : i < 6) :\n    (List.ofFn x).getD i false = x ⟨i, h⟩ := by\n  rw [List.getD_eq_getElem?_getD, List.getElem?_eq_getElem (by simpa using h)]\n  simp\n\ntheorem ofFn_getD_ge (x : Fin 6 → Bool) (i : ℕ) (h : 6 ≤ i) :\n    (List.ofFn x).getD i false = false := by\n  have h3 : (List.ofFn x)[i]? = none := by\n    rw [List.getElem?_eq_none]\n    simp\n    omega\n  simp [List.getD_eq_getElem?_getD, h3]\n\ntheorem eval_one (g : Gate) (o : ℕ) (x : List Bool) :\n    Circuit.eval ⟨[g], o⟩ x =\n      (x ++ [g.op.eval (g.inputs.map fun i => x.getD i false)]).getD o false := rfl\n\ntheorem dep (C : Circuit) (hs : C.size ≤ 1) (hI : ∀ g ∈ C.gates, g.inputs.length ≤ 2) (n : ℕ) :\n    ∃ a b : ℕ, ∀ x y : List Bool, x.length = n → y.length = n →\n      x.getD a false = y.getD a false → x.getD b false = y.getD b false →\n        C.eval x = C.eval y := by\n  obtain ⟨gates, o⟩ := C\n  rcases gates with _ | ⟨g, _ | ⟨g', t⟩⟩\n  · exact ⟨o, o, fun x y _ _ h _ => h⟩\n  · have hg : g.inputs.length ≤ 2 := hI g (by simp)\n    by_cases ho : o < n\n    · refine ⟨o, o, fun x y hx hy h _ => ?_⟩\n      rw [eval_one, eval_one, getD_app, getD_app, hx, hy, if_pos ho, if_pos ho]\n      exact h\n    · by_cases ho2 : o = n\n      · rcases hl : g.inputs with _ | ⟨i, _ | ⟨j, _ | ⟨k, r⟩⟩⟩\n        · refine ⟨0, 0, fun x y hx hy _ _ => ?_⟩\n          rw [eval_one, eval_one, getD_app, getD_app, hx, hy, if_neg ho, if_neg ho,\n            if_pos ho2, if_pos ho2]\n          simp only [hl, List.map_nil]\n        · refine ⟨i, i, fun x y hx hy h _ => ?_⟩\n          rw [eval_one, eval_one, getD_app, getD_app, hx, hy, if_neg ho, if_neg ho,\n            if_pos ho2, if_pos ho2]\n          simp only [hl, List.map_cons, List.map_nil, h]\n        · refine ⟨i, j, fun x y hx hy h h' => ?_⟩\n          rw [eval_one, eval_one, getD_app, getD_app, hx, hy, if_neg ho, if_neg ho,\n            if_pos ho2, if_pos ho2]\n          simp only [hl, List.map_cons, List.map_nil, h, h']\n        · rw [hl] at hg\n          simp only [List.length_cons] at hg\n          omega\n      · refine ⟨0, 0, fun x y hx hy _ _ => ?_⟩\n        rw [eval_one, eval_one, getD_app, getD_app, hx, hy, if_neg ho, if_neg ho,\n          if_neg ho2, if_neg ho2]\n  · exfalso\n    have h2 : (g :: g' :: t).length ≤ 1 := hs\n    simp only [List.length_cons] at h2\n    omega\n\ntheorem agree (k a : ℕ) (h1 : a / 2 ≠ k) :\n    (List.ofFn (pt k)).getD a false = (List.ofFn (fun _ : Fin 6 => false)).getD a false := by\n  by_cases ha : a < 6\n  · rw [ofFn_getD _ a ha, ofFn_getD _ a ha]\n    simp [pt, h1]\n  · rw [ofFn_getD_ge _ a (by omega), ofFn_getD_ge _ a (by omega)]\n\ntheorem small (s : ℕ) (hs : s < 2) : ¬ HasCircuitSize 6 f6 s := by\n  rintro ⟨C, hF, hsz, hev⟩\n  have hI : ∀ g ∈ C.gates, g.inputs.length ≤ 2 := fun g hg => (hF g hg).2\n  have hsz1 : C.size ≤ 1 := by omega\n  obtain ⟨a, b, hab⟩ := dep C hsz1 hI 6\n  have hz : f6 (fun _ => false) = false := by decide\n  have key : ∀ k : ℕ, f6 (pt k) = true → a / 2 = k ∨ b / 2 = k := by\n    intro k hk\n    by_contra hcon\n    have h1 : a / 2 ≠ k := fun h => hcon (Or.inl h)\n    have h2 : b / 2 ≠ k := fun h => hcon (Or.inr h)\n    have h3 := hab (List.ofFn (pt k)) (List.ofFn (fun _ : Fin 6 => false)) (by simp) (by simp)\n      (agree k a h1) (agree k b h2)\n    rw [hev, hev, hk, hz] at h3\n    exact absurd h3 (by decide)\n  have p0 : f6 (pt 0) = true := by decide\n  have p1 : f6 (pt 1) = true := by decide\n  have p2 : f6 (pt 2) = true := by decide\n  have k0 := key 0 p0\n  have k1 := key 1 p1\n  have k2 := key 2 p2\n  omega\n\ntheorem hnc4 : ∃ y y' : Fin 4 → Bool, g4 y ≠ g4 y' :=\n  ⟨fun _ => false, fun _ => true, by decide⟩\n\ntheorem bool6 : ∀ a b c d e f : Bool,\n    ((a && b) || ((c && d) || (d && e) || (e && f) || (f && c))) =\n      ((a && b) || (c && d) || (d && e) || (e && f) || (f && c)) := by\n  decide\n\ntheorem key (t : ℕ) : HasCircuitSize 6 f6 (t + 2) ↔ HasCircuitSize 4 g4 t := by\n  have h := PEqualNP.MetaComplexity.L153 4 t g4 hnc4\n  have e : (fun x : Fin (2 + 4) → Bool =>\n      (x (Fin.castAdd 4 0) && x (Fin.castAdd 4 1)) || g4 (fun j : Fin 4 => x (Fin.natAdd 2 j)))\n      = f6 := by\n    funext x\n    first\n      | exact bool6 (x 0) (x 1) (x 2) (x 3) (x 4) (x 5)\n      | exact bool6 _ _ _ _ _ _\n      | (revert x; decide)\n  rw [e] at h\n  exact h\n\ntheorem main (s : ℕ) : HasCircuitSize 6 f6 s ↔ 5 ≤ s := by\n  constructor\n  · intro h\n    rcases Nat.lt_or_ge s 2 with hs | hs\n    · exact absurd h (small s hs)\n    · obtain ⟨t, rfl⟩ : ∃ t, s = t + 2 := ⟨s - 2, by omega⟩\n      have h1 : HasCircuitSize 4 g4 t := (key t).1 h\n      have h2 : 3 ≤ t := (PEqualNP.MetaComplexity.L112 t).1 h1\n      omega\n  · intro h\n    obtain ⟨t, rfl⟩ : ∃ t, s = t + 2 := ⟨s - 2, by omega⟩\n    exact (key t).2 ((PEqualNP.MetaComplexity.L112 t).2 (by omega))\n\nend PEqualNP.Outside.L_meta_765\n\ntheorem PEqualNP.Outside.L_meta_765 : ∀ s : ℕ, PEqualNP.MetaComplexity.HasCircuitSize 6 (fun x : Fin 6 → Bool => (x 0 && x 1) || (x 2 && x 3) || (x 3 && x 4) || (x 4 && x 5) || (x 5 && x 2)) s ↔ 5 ≤ s :=\n  fun s => PEqualNP.Outside.L_meta_765.main s\n", "localCheck": "incomplete", "reasoning": "Status: the gap is open (not in checked or withdrawn of gaps.json, updated 2026-11-23). The file is complete but UNCHECKED: the machine had no space to install Lean (about 1 GB free, Lean plus Mathlib need several GB), so neither tools/check-lean.mjs nor Lean itself ran; localCheck is incomplete and tactic steps may need repair. Argument: (1) f6 equals (x0&&x1) || g4(x2..x5) by Bool or-associativity (decide on 6 bools), g4 the 4-cycle edge function of L112, nonconstant (all-false vs all-true). L153 with k=4 gives HasCircuitSize 6 f6 (t+2) iff HasCircuitSize 4 g4 t, and L112 gives that iff 3<=t, so s>=2 gives s>=5 iff HasCircuitSize holds. (2) Budgets 0 and 1: a circuit with at most one gate has output depending on at most two coordinates a,b (lemma dep: no gate gives an input wire or false; one gate with at most two inputs reads at most two wires). The points pt k (true on the pair {2k,2k+1}), k=0,1,2, have f6 true while f6 of all-false is false, so each pair must contain a or b by 2 disjoint-pair pigeonhole, impossible with three disjoint pairs (omega on a/2, b/2). Upper direction for s>=5 comes from the same iff at t=s-2.", "sources": ["https://github.com/brilliant-hq/pequalnp-proofs/tree/e3b1828a4423909b34c8d8184be1e208451c631a", "https://data.pequalnp.com/data/desk/gaps.json"]}