{
  "unit": "L-meta-25842",
  "statement": "∃ C : PEqualNP.CircuitLowerBounds.Circuit, PEqualNP.MetaComplexity.FanInTwo C ∧ C.size ≤ 5 ∧ PEqualNP.Represents.Represents (fun u v : Fin 4 => (31711 : ℕ).testBit (4 * u.val + v.val)) C",
  "verdict": "no_circuit",
  "search_complete": true,
  "min_gates": 6,
  "circuit": {
    "size": 6,
    "output": 13,
    "gates": [
      {
        "op": "and",
        "inputs": [
          1,
          5
        ]
      },
      {
        "op": "and",
        "inputs": [
          2,
          6
        ]
      },
      {
        "op": "or",
        "inputs": [
          8,
          9
        ]
      },
      {
        "op": "and",
        "inputs": [
          3,
          7
        ]
      },
      {
        "op": "or",
        "inputs": [
          10,
          11
        ]
      },
      {
        "op": "not",
        "inputs": [
          12
        ]
      }
    ],
    "gate_tables": [
      32,
      1024,
      1056,
      32768,
      33824,
      31711
    ],
    "output_table": 31711,
    "cells_by_row": [
      [
        1,
        1,
        1,
        1
      ],
      [
        1,
        0,
        1,
        1
      ],
      [
        1,
        1,
        0,
        1
      ],
      [
        1,
        1,
        1,
        0
      ]
    ],
    "row_masks": [
      15,
      13,
      11,
      7
    ],
    "indexing": "Raw wires 0..3 select u; wires 4..7 select v. Gate j creates wire 8+j. Truth-table bit 4*u+v is the value on oneEach u v.",
    "lean_verification": "m25842_six_ok in the included Lean file proves FanInTwo, size = 6, and Represents."
  },
  "coverage": {
    "domain": "All 16 promised oneEach inputs, encoded as uint16_t tables.",
    "complete_through_gates": 5,
    "free_constants": "The search supplies both false and true for free. This is a superset of the allowed circuits, so absence here proves absence under counted constant gates too.",
    "normalization": "Every absent index reads false. Empty AND and empty NOT produce true; empty OR produces false. Unary AND/OR copy an available table. NOT ignores its second argument. Two equal binary arguments also copy a table. These gates can be removed or replaced by the free constants. All other gates are NOT of an available table or AND/OR of two distinct available tables.",
    "deduplication": "Within each prefix, every distinct new output table is explored once. Equal existing tables need no gate: redirect all later uses to the existing table. Choosing one realization of an equal new table preserves all possible future table computations. No ordering or symmetry filter is applied to gate sequences.",
    "unused_gates_and_outputs": "Unused or table-redundant gates can be deleted with index redirection. Each prefix checks every available table for the target, including all raw inputs and constants. Thus any output index and every circuit of fewer than five gates are covered. A nonexistent output is false. Last-level NOT and all unordered AND/OR pairs are tested directly; AND/OR are commutative.",
    "exhaustion": "Depth-first enumeration exhausts every normalized prefix through four gates, testing every possible fifth gate directly. The six-gate search stops at its first witness; it is an existence search, not an exhaustion of six gates.",
    "prefix_nodes_by_depth_0_to_4": [
      1,
      52,
      3036,
      198328,
      14437144
    ],
    "total_prefix_nodes": 14638561,
    "five_gate_search_seconds": 3.44817,
    "six_gate_search_seconds": 5.1166e-05,
    "compiler": "g++ -O3 -std=c++17 search.cpp -o search",
    "program_output": "limit 5 exists 0 seconds 3.44817 nodes 1 52 3036 198328 14437144 0\nfound_gates 6 output_slot 15\n0 0 1 5 32\n1 0 2 6 1024\n2 1 10 11 1056\n3 0 3 7 32768\n4 1 12 13 33824\n5 2 14 -1 31711\nlimit 6 exists 1 seconds 5.1166e-05 nodes 1 1 1 1 1 1 1\n",
    "independent_cell_check": "Original-index simulation checked all 16 cells against 31711; the Lean witness lemma also checked all cells."
  },
  "program": "#include <algorithm>\n#include <array>\n#include <cassert>\n#include <chrono>\n#include <cstdint>\n#include <iostream>\n#include <vector>\nusing namespace std;\nconstexpr uint16_t target=31711, bad=uint16_t(~target);\nstruct Gate {int op,a,b; uint16_t z;};\narray<uint16_t,20> w;\narray<Gate,8> path;\narray<unsigned long long,8> nodes{};\n// Slots 0..7 are the raw wires. Slot 8 is a permanently absent wire (false).\n// Slot 9 is a free true wire: a relaxation used for the lower-bound search.\n// Actual gates are stored in slots 10 onward.\nbool present(uint16_t z,int n){for(int i=0;i<n;i++) if(w[i]==z)return true; return false;}\nvector<Gate> candidates(int n,int depth,bool order){\n vector<Gate> cs;\n auto add=[&](int op,int a,int b,uint16_t z){\n  if(present(z,n))return;\n  for(auto &g:cs) if(g.z==z)return;\n  cs.push_back({op,a,b,z});\n };\n // Candidate order affects speed only. All distinct new tables are kept.\n for(int phase=0;phase<2;phase++) {\n  for(int a=0;a<n;a++) if((a==n-1)==(phase==0)) add(2,a,-1,uint16_t(~w[a]));\n  for(int a=0;a<n;a++)for(int b=a+1;b<n;b++)\n   if(((a==n-1||b==n-1))==(phase==0)){\n    add(0,a,b,w[a]&w[b]);add(1,a,b,w[a]|w[b]);\n   }\n }\n if(order) stable_sort(cs.begin(),cs.end(),[](auto a,auto b){\n   auto rank=[](uint16_t z){return (z && !(z&target))?100+__builtin_popcount(z):\n      (z==target?1000:0);};return rank(a.z)>rank(b.z);\n });\n return cs;\n}\nbool dfs(int depth,int limit,bool order){\n ++nodes[depth];int n=10+depth;\n for(int i=0;i<n;i++)if(w[i]==target){\n  cout<<\"found_gates \"<<depth<<\" output_slot \"<<i<<\"\\n\";\n  for(int j=0;j<depth;j++)cout<<j<<\" \"<<path[j].op<<\" \"<<path[j].a<<\" \"<<path[j].b<<\" \"<<path[j].z<<\"\\n\";\n  return true;\n }\n if(depth==limit)return false;\n if(depth+1==limit){\n  // Check every possible last operation directly. Repeated inputs yield\n  // existing tables; constants and copies are already available.\n  for(int a=0;a<n;a++)if(uint16_t(~w[a])==target){path[depth]={2,a,-1,target};w[n]=target;return dfs(depth+1,limit,order);}\n  for(int a=0;a<n;a++)for(int b=a+1;b<n;b++){\n   if((w[a]&w[b])==target){path[depth]={0,a,b,target};w[n]=target;return dfs(depth+1,limit,order);}\n   if((w[a]|w[b])==target){path[depth]={1,a,b,target};w[n]=target;return dfs(depth+1,limit,order);}\n  }\n  return false;\n }\n for(auto g:candidates(n,depth,order)){\n  path[depth]=g;w[n]=g.z;\n  if(dfs(depth+1,limit,order))return true;\n }\n return false;\n}\nint main(){\n for(int i=0;i<8;i++)for(int u=0;u<4;u++)for(int v=0;v<4;v++)\n  if(i==u||i==4+v)w[i]|=uint16_t(1u<<(4*u+v));\n w[8]=0;w[9]=65535;\n for(int k:{5,6}){\n  nodes.fill(0);auto start=chrono::steady_clock::now();bool found=dfs(0,k,k==6);\n  cout<<\"limit \"<<k<<\" exists \"<<found<<\" seconds \"<<chrono::duration<double>(chrono::steady_clock::now()-start).count()<<\" nodes\";\n  for(int i=0;i<=k;i++)cout<<\" \"<<nodes[i];cout<<endl;\n  if(k==5)assert(!found);else assert(found);\n }\n}\n",
  "mode": "refute",
  "complete": true,
  "lean": "import PEqualNP.Defs\n\n/-\nThe backward frontier of one output has at most k+1 distinct wires after\nk gates. A frontier of exactly k+1 wires can use only binary gates:\na unary gate, a reused wire, or a discarded branch would lose one place.\nFor binary AND/OR trees, every oriented separation of two rows at the\noutput is already an oriented separation at some frontier wire.\n\nThe target distinguishes all four left vertices and all four right\nvertices. This needs three raw wires from either side. Thus five gates\nforce a tight frontier of six wires. But oriented separations of the\ntarget individually require all eight raw wires, a contradiction.\nThe finite checks below concern only subsets of the ten initial tables\n(eight inputs and two freely supplied constants), never circuit lists.\n-/\n\ndef m25842_bop (a b : BitVec 16) : Finset (BitVec 16) := {a &&& b, a ||| b}\ndef m25842_uop (a : BitVec 16) : Finset (BitVec 16) := {~~~a}\n\ndef m25842_build : ℕ → Finset (BitVec 16) → Prop\n  | 0, av => (31711 : BitVec 16) ∈ av\n  | k + 1, av => m25842_build k av ∨\n      (∃ a ∈ av, ∃ b ∈ av, a ≠ b ∧ ∃ z ∈ m25842_bop a b, m25842_build k (insert z av)) ∨\n      (∃ a ∈ av, ∃ z ∈ m25842_uop a, m25842_build k (insert z av))\n\ndef m25842_live : ℕ → Finset (BitVec 16) → Prop\n  | 0, s => s = {(31711 : BitVec 16)}\n  | k + 1, s => m25842_live k s ∨\n      (∃ a ∈ s, ∃ b ∈ s, a ≠ b ∧ ∃ z ∈ m25842_bop a b, z ∉ s ∧\n        ∃ rest : Finset (BitVec 16), s = insert a (insert b rest) ∧ m25842_live k (insert z rest)) ∨\n      (∃ a ∈ s, ∃ z ∈ m25842_uop a, z ∉ s ∧\n        ∃ rest : Finset (BitVec 16), s = insert a rest ∧ m25842_live k (insert z rest))\n\n\ntheorem m25842_compress {k : ℕ} {av : Finset (BitVec 16)} (h : m25842_build k av) :\n    ∃ s ⊆ av, m25842_live k s := by\n  induction k generalizing av with\n  | zero => exact ⟨{(31711 : BitVec 16)}, Finset.singleton_subset_iff.mpr h, rfl⟩\n  | succ k ih =>\n    rcases h with skip | ⟨a, ha, b, hb, hab, z, hz, tail⟩ | ⟨a, ha, z, hz, tail⟩\n    · obtain ⟨s, hs, hrun⟩ := ih skip\n      exact ⟨s, hs, Or.inl hrun⟩\n    · obtain ⟨t, ht, hrun⟩ := ih tail\n      by_cases sub : t ⊆ av\n      · exact ⟨t, sub, Or.inl hrun⟩\n      · have hzmem : z ∈ t := by\n          by_contra hn\n          apply sub\n          intro u hu\n          rcases Finset.mem_insert.mp (ht hu) with rfl | ok\n          · exact False.elim (hn hu)\n          · exact ok\n        have hzout : z ∉ av := by\n          intro hh\n          exact sub ((Finset.insert_eq_of_mem hh) ▸ ht)\n        let rest := t.erase z\n        have hrest : rest ⊆ av := by\n          intro u hu\n          have hu' := Finset.mem_erase.mp hu\n          exact (Finset.mem_insert.mp (ht hu'.2)).resolve_left hu'.1\n        let s := insert a (insert b rest)\n        have hs : s ⊆ av := Finset.insert_subset ha (Finset.insert_subset hb hrest)\n        refine ⟨s, hs, Or.inr (Or.inl ⟨a, by simp [s], b, by simp [s], hab, z, hz,\n          fun h => hzout (hs h), rest, rfl, ?_⟩)⟩\n        simpa [rest, Finset.insert_erase hzmem] using hrun\n    · obtain ⟨t, ht, hrun⟩ := ih tail\n      by_cases sub : t ⊆ av\n      · exact ⟨t, sub, Or.inl hrun⟩\n      · have hzmem : z ∈ t := by\n          by_contra hn\n          apply sub\n          intro u hu\n          rcases Finset.mem_insert.mp (ht hu) with rfl | ok\n          · exact False.elim (hn hu)\n          · exact ok\n        have hzout : z ∉ av := by\n          intro hh\n          exact sub ((Finset.insert_eq_of_mem hh) ▸ ht)\n        let rest := t.erase z\n        have hrest : rest ⊆ av := by\n          intro u hu\n          have hu' := Finset.mem_erase.mp hu\n          exact (Finset.mem_insert.mp (ht hu'.2)).resolve_left hu'.1\n        let s := insert a rest\n        have hs : s ⊆ av := Finset.insert_subset ha hrest\n        refine ⟨s, hs, Or.inr (Or.inr ⟨a, by simp [s], z, hz,\n          fun h => hzout (hs h), rest, rfl, ?_⟩)⟩\n        simpa [rest, Finset.insert_erase hzmem] using hrun\n\ntheorem m25842_live_card {k : ℕ} {s : Finset (BitVec 16)} (h : m25842_live k s) : s.card ≤ k + 1 := by\n  induction k generalizing s with\n  | zero => change s = {(31711 : BitVec 16)} at h; simp [h]\n  | succ k ih =>\n    rcases h with skip | ⟨a, ha, b, hb, hab, z, hz, hout, rest, rfl, tail⟩ |\n        ⟨a, ha, z, hz, hout, rest, rfl, tail⟩\n    · exact (ih skip).trans (by omega)\n    · have hzrest : z ∉ rest := fun hm => hout (by simp [hm])\n      have htail := ih tail\n      rw [Finset.card_insert_of_notMem hzrest] at htail\n      have h₁ := Finset.card_insert_le a (insert b rest)\n      have h₂ := Finset.card_insert_le b rest\n      omega\n    · have hzrest : z ∉ rest := fun hm => hout (by simp [hm])\n      have htail := ih tail\n      rw [Finset.card_insert_of_notMem hzrest] at htail\n      have h₁ := Finset.card_insert_le a rest\n      omega\n\ntheorem m25842_live_separates (D : BitVec 16 → Prop) (hd : D (31711 : BitVec 16))\n    (hops : ∀ a b, ∀ z ∈ m25842_bop a b, D z → D a ∨ D b) (hun : ∀ a, ∀ z ∈ m25842_uop a, D z → D a)\n    {k : ℕ} {s : Finset (BitVec 16)} (h : m25842_live k s) : ∃ w ∈ s, D w := by\n  induction k generalizing s with\n  | zero => change s = {(31711 : BitVec 16)} at h; exact ⟨(31711 : BitVec 16), by simp [h], hd⟩\n  | succ k ih =>\n    rcases h with skip | ⟨a, ha, b, hb, hab, z, hz, hout, rest, rfl, tail⟩ |\n        ⟨a, ha, z, hz, hout, rest, rfl, tail⟩\n    · exact ih skip\n    · obtain ⟨w, hw, hD⟩ := ih tail\n      rcases Finset.mem_insert.mp hw with rfl | hw\n      · rcases hops a b w hz hD with h | h\n        · exact ⟨a, ha, h⟩\n        · exact ⟨b, hb, h⟩\n      · exact ⟨w, by simp [hw], hD⟩\n    · obtain ⟨w, hw, hD⟩ := ih tail\n      rcases Finset.mem_insert.mp hw with rfl | hw\n      · exact ⟨a, ha, hun a w hz hD⟩\n      · exact ⟨w, by simp [hw], hD⟩\n\ntheorem m25842_live_tight (D : BitVec 16 → Prop) (hd : D (31711 : BitVec 16))\n    (hops : ∀ a b, ∀ z ∈ m25842_bop a b, D z → D a ∨ D b)\n    {k : ℕ} {s : Finset (BitVec 16)} (h : m25842_live k s) (hc : s.card = k + 1) : ∃ w ∈ s, D w := by\n  induction k generalizing s with\n  | zero => change s = {(31711 : BitVec 16)} at h; exact ⟨(31711 : BitVec 16), by simp [h], hd⟩\n  | succ k ih =>\n    rcases h with skip | ⟨a, ha, b, hb, hab, z, hz, hout, rest, rfl, tail⟩ |\n        ⟨a, ha, z, hz, hout, rest, rfl, tail⟩\n    · have := m25842_live_card skip\n      omega\n    · have hzrest : z ∉ rest := fun hm => hout (by simp [hm])\n      have htail := m25842_live_card tail\n      rw [Finset.card_insert_of_notMem hzrest] at htail\n      have h₁ := Finset.card_insert_le a (insert b rest)\n      have h₂ := Finset.card_insert_le b rest\n      have hc' : (insert z rest).card = k + 1 := by\n        rw [Finset.card_insert_of_notMem hzrest]; omega\n      obtain ⟨w, hw, hD⟩ := ih tail hc'\n      rcases Finset.mem_insert.mp hw with rfl | hw\n      · rcases hops a b w hz hD with h | h\n        · exact ⟨a, ha, h⟩\n        · exact ⟨b, hb, h⟩\n      · exact ⟨w, by simp [hw], hD⟩\n    · have hzrest : z ∉ rest := fun hm => hout (by simp [hm])\n      have htail := m25842_live_card tail\n      rw [Finset.card_insert_of_notMem hzrest] at htail\n      have h₁ := Finset.card_insert_le a rest\n      omega\n\ntheorem m25842_build_mono {k : ℕ} {av : Finset (BitVec 16)} (h : m25842_build k av) :\n    ∀ j, k ≤ j → m25842_build j av := by\n  intro j hj\n  induction hj with\n  | refl => exact h\n  | step _ ih => exact Or.inl ih\n\ndef m25842_inputs : List (BitVec 16) :=\n  [15, 240, 3840, 61440, 4369, 8738, 17476, 34952]\n\ndef m25842_initial : List (BitVec 16) := m25842_inputs ++ [0, 65535]\n\ndef m25842_bit (k : Fin 16) (w : BitVec 16) : Bool := w.getLsbD k.val\n\ntheorem m25842_ones : ∀ k : Fin 16, m25842_bit k 65535 = true := by decide\n\ndef m25842_step (w : List Bool) (g : PEqualNP.CircuitLowerBounds.Gate) : List Bool :=\n  w ++ [g.op.eval (g.inputs.map fun i => w.getD i false)]\n\ntheorem m25842_read (w : List (BitVec 16)) (i : ℕ) (k : Fin 16) :\n    (w.map (m25842_bit k)).getD i false = m25842_bit k (w.getD i 0) := by\n  simp only [List.getD_eq_getElem?_getD, List.getElem?_map]\n  cases w[i]? with\n  | none => simp [m25842_bit]\n  | some v => rfl\n\ntheorem m25842_read_mem (w : List (BitVec 16)) (i : ℕ) :\n    w.getD i 0 = 0 ∨ w.getD i 0 ∈ w := by\n  by_cases h : i < w.length\n  · exact Or.inr (by simp [List.getD_eq_getElem?_getD, List.getElem?_eq_getElem h])\n  · simp [List.getD_eq_getElem?_getD, List.getElem?_eq_none (Nat.le_of_not_gt h)]\n\ndef m25842_legal (g : PEqualNP.CircuitLowerBounds.Gate) : Prop :=\n  (g.op = .and ∨ g.op = .or ∨ g.op = .not) ∧ g.inputs.length ≤ 2\n\ndef m25842_possible (av : Finset (BitVec 16)) (z : BitVec 16) : Prop :=\n  z ∈ av ∨ (∃ a ∈ av, ∃ b ∈ av, a ≠ b ∧ z ∈ m25842_bop a b) ∨\n    (∃ a ∈ av, z ∈ m25842_uop a)\n\ntheorem m25842_pair {av : Finset (BitVec 16)} {a b : BitVec 16}\n    (ha : a ∈ av) (hb : b ∈ av) :\n    m25842_possible av (a &&& b) ∧ m25842_possible av (a ||| b) := by\n  by_cases h : a = b\n  · subst b\n    constructor <;> simp only [BitVec.and_self, BitVec.or_self] <;> exact .inl ha\n  · constructor\n    · exact .inr (.inl ⟨a, ha, b, hb, h, by simp [m25842_bop]⟩)\n    · exact .inr (.inl ⟨a, ha, b, hb, h, by simp [m25842_bop]⟩)\n\nset_option maxRecDepth 2000 in\ntheorem m25842_gate (w : List (BitVec 16)) (av : Finset (BitVec 16))\n    (hw : ∀ z ∈ w, z ∈ av) (h0 : 0 ∈ av) (h1 : 65535 ∈ av)\n    (g : PEqualNP.CircuitLowerBounds.Gate) (hg : m25842_legal g) :\n    ∃ z, m25842_possible av z ∧\n      ∀ k, m25842_step (w.map (m25842_bit k)) g = (w ++ [z]).map (m25842_bit k) := by\n  have mem (i : ℕ) : w.getD i 0 ∈ av := by\n    rcases m25842_read_mem w i with h | h\n    · rwa [h]\n    · exact hw _ h\n  obtain ⟨op, args⟩ := g\n  obtain ⟨hop, hlen⟩ := hg\n  change op = .and ∨ op = .or ∨ op = .not at hop\n  change args.length ≤ 2 at hlen\n  cases args with\n  | nil =>\n    rcases hop with rfl | rfl | rfl\n    · refine ⟨65535, .inl h1, ?_⟩\n      intro k\n      simp [m25842_step, PEqualNP.CircuitLowerBounds.GateOp.eval]\n      exact m25842_ones k\n    · exact ⟨0, .inl h0, by simp [m25842_step, PEqualNP.CircuitLowerBounds.GateOp.eval, m25842_bit]⟩\n    · refine ⟨65535, .inl h1, ?_⟩\n      intro k\n      simp [m25842_step, PEqualNP.CircuitLowerBounds.GateOp.eval]\n      exact m25842_ones k\n  | cons i tail =>\n    cases tail with\n    | nil =>\n      rcases hop with rfl | rfl | rfl\n      · exact ⟨_, .inl (mem i), by\n          intro k\n          simp only [m25842_step, List.map_append, List.map_cons, List.map_nil, m25842_read]\n          simp [PEqualNP.CircuitLowerBounds.GateOp.eval]⟩\n      · exact ⟨_, .inl (mem i), by\n          intro k\n          simp only [m25842_step, List.map_append, List.map_cons, List.map_nil, m25842_read]\n          simp [PEqualNP.CircuitLowerBounds.GateOp.eval]⟩\n      · refine ⟨~~~(w.getD i 0), .inr (.inr ⟨_, mem i, by simp [m25842_uop]⟩), ?_⟩\n        intro k\n        simp only [m25842_step, List.map_append, List.map_cons, List.map_nil, m25842_read]\n        simp [PEqualNP.CircuitLowerBounds.GateOp.eval, m25842_bit, k.isLt]\n    | cons j tail =>\n      cases tail with\n      | cons => simp at hlen\n      | nil =>\n        rcases hop with rfl | rfl | rfl\n        · exact ⟨_, (m25842_pair (mem i) (mem j)).1, by\n            intro k\n            simp only [m25842_step, List.map_append, List.map_cons, List.map_nil, m25842_read]\n            simp [PEqualNP.CircuitLowerBounds.GateOp.eval, m25842_bit]⟩\n        · exact ⟨_, (m25842_pair (mem i) (mem j)).2, by\n            intro k\n            simp only [m25842_step, List.map_append, List.map_cons, List.map_nil, m25842_read]\n            simp [PEqualNP.CircuitLowerBounds.GateOp.eval, m25842_bit]⟩\n        · refine ⟨~~~(w.getD i 0), .inr (.inr ⟨_, mem i, by simp [m25842_uop]⟩), ?_⟩\n          intro k\n          simp only [m25842_step, List.map_append, List.map_cons, List.map_nil, m25842_read]\n          simp [PEqualNP.CircuitLowerBounds.GateOp.eval, m25842_bit, k.isLt]\n\ntheorem m25842_compile (gs : List PEqualNP.CircuitLowerBounds.Gate) (out : ℕ)\n    (hg : ∀ g ∈ gs, m25842_legal g) (w : List (BitVec 16)) (av : Finset (BitVec 16))\n    (hw : ∀ z ∈ w, z ∈ av) (h0 : 0 ∈ av) (h1 : 65535 ∈ av)\n    (he : ∀ k, (gs.foldl m25842_step (w.map (m25842_bit k))).getD out false =\n      m25842_bit k 31711) : m25842_build gs.length av := by\n  induction gs generalizing w av with\n  | nil =>\n    have hval : w.getD out 0 = (31711 : BitVec 16) := by\n      apply BitVec.eq_of_getElem_eq\n      intro i hi\n      simpa only [List.foldl_nil, m25842_read, m25842_bit, BitVec.getLsbD_eq_getElem hi] using he ⟨i, hi⟩\n    have hr := m25842_read_mem w out\n    rw [hval] at hr\n    rcases hr with hz | hm\n    · exact False.elim ((by decide : (31711 : BitVec 16) ≠ 0) hz)\n    · exact hw _ hm\n  | cons g gs ih =>\n    obtain ⟨z, hz, hstep⟩ := m25842_gate w av hw h0 h1 g (hg g (by simp))\n    have hw' : ∀ u ∈ w ++ [z], u ∈ insert z av := by\n      intro u hu\n      rcases List.mem_append.mp hu with old | fresh\n      · exact Finset.mem_insert_of_mem (hw u old)\n      · have eq : u = z := List.mem_singleton.mp fresh\n        simp [eq]\n    have he' : ∀ k, (gs.foldl m25842_step ((w ++ [z]).map (m25842_bit k))).getD out false =\n        m25842_bit k 31711 := by\n      intro k\n      simpa only [List.foldl_cons, hstep] using he k\n    have ht := ih (fun g' h => hg g' (by simp [h])) (w ++ [z]) (insert z av) hw'\n      (Finset.mem_insert_of_mem h0) (Finset.mem_insert_of_mem h1) he'\n    rcases hz with hz | ⟨a, ha, b, hb, hab, hz⟩ | ⟨a, ha, hz⟩\n    · rw [Finset.insert_eq_of_mem hz] at ht\n      exact .inl ht\n    · exact .inr (.inl ⟨a, ha, b, hb, hab, z, hz, ht⟩)\n    · exact .inr (.inr ⟨a, ha, z, hz, ht⟩)\n\ntheorem m25842_input_rows : ∀ k : Fin 16,\n    m25842_inputs.map (m25842_bit k) =\n      PEqualNP.Represents.oneEach (⟨k.val / 4, by omega⟩ : Fin 4)\n        (⟨k.val % 4, by omega⟩ : Fin 4) := by decide\n\ntheorem m25842_goal_rows : ∀ k : Fin 16,\n    m25842_bit k 31711 = (31711 : ℕ).testBit\n      (4 * (k.val / 4) + k.val % 4) := by decide\n\ntheorem m25842_get_build (C : PEqualNP.CircuitLowerBounds.Circuit)\n    (hf : PEqualNP.MetaComplexity.FanInTwo C)\n    (hr : PEqualNP.Represents.Represents\n      (fun u v : Fin 4 => (31711 : ℕ).testBit (4 * u.val + v.val)) C) :\n    m25842_build C.gates.length m25842_initial.toFinset := by\n  refine m25842_compile C.gates C.output ?_ m25842_inputs m25842_initial.toFinset ?_ ?_ ?_ ?_\n  · intro g hg\n    have := hf g hg\n    simpa only [PEqualNP.MetaComplexity.FanInTwo, Set.mem_insert_iff,\n      Set.mem_singleton_iff, m25842_legal] using this\n  · intro z hz\n    exact List.mem_toFinset.mpr (List.mem_append_left _ hz)\n  · decide\n  · decide\n  · intro k\n    rw [m25842_input_rows k, m25842_goal_rows k]\n    exact hr _ _\n\n-- Unequal bits propagate through each allowed gate, including NOT.\ndef m25842_diff (p : ℕ × ℕ) (w : BitVec 16) : Prop :=\n  w.getLsbD p.1 ≠ w.getLsbD p.2\n\n-- An oriented separation propagates backwards through AND/OR.\ndef m25842_pos (p : ℕ × ℕ) (w : BitVec 16) : Prop :=\n  w.getLsbD p.1 = true ∧ w.getLsbD p.2 = false\n\ntheorem m25842_diff_bin (p : ℕ × ℕ) (a b z : BitVec 16) (hz : z ∈ m25842_bop a b)\n    (h : m25842_diff p z) : m25842_diff p a ∨ m25842_diff p b := by\n  simp only [m25842_bop, Finset.mem_insert, Finset.mem_singleton] at hz\n  rcases hz with rfl | rfl <;>\n    simp only [m25842_diff, BitVec.getLsbD_and, BitVec.getLsbD_or] at * <;>\n    cases h1 : a.getLsbD p.1 <;> cases h2 : a.getLsbD p.2 <;>\n    cases h3 : b.getLsbD p.1 <;> cases h4 : b.getLsbD p.2 <;> simp_all\n\ntheorem m25842_diff_un (p : ℕ × ℕ) (hp : p.1 < 16 ∧ p.2 < 16)\n    (a z : BitVec 16) (hz : z ∈ m25842_uop a) (h : m25842_diff p z) :\n    m25842_diff p a := by\n  simp only [m25842_uop, Finset.mem_singleton] at hz\n  subst z\n  simp only [m25842_diff, BitVec.getLsbD_not, hp.1, hp.2, decide_true, Bool.true_and] at *\n  cases h1 : a.getLsbD p.1 <;> cases h2 : a.getLsbD p.2 <;> simp_all\n\ntheorem m25842_pos_bin (p : ℕ × ℕ) (a b z : BitVec 16) (hz : z ∈ m25842_bop a b)\n    (h : m25842_pos p z) : m25842_pos p a ∨ m25842_pos p b := by\n  simp only [m25842_bop, Finset.mem_insert, Finset.mem_singleton] at hz\n  rcases hz with rfl | rfl <;>\n    simp only [m25842_pos, BitVec.getLsbD_and, BitVec.getLsbD_or] at * <;>\n    cases h1 : a.getLsbD p.1 <;> cases h2 : a.getLsbD p.2 <;>\n    cases h3 : b.getLsbD p.1 <;> cases h4 : b.getLsbD p.2 <;> simp_all\n\n-- Each unordered pair of left vertices, and then of right vertices,\n-- is witnessed by a pair of promised inputs with different target bits.\ndef m25842_diff_pairs : List (ℕ × ℕ) :=\n  [(1, 5), (2, 10), (3, 15), (5, 9), (5, 13), (10, 14),\n   (4, 5), (8, 10), (12, 15), (5, 6), (5, 7), (10, 11)]\n\n-- The only raw wire positively separating the j-th pair is raw wire j.\ndef m25842_pos_pairs : List (ℕ × ℕ) :=\n  [(1, 5), (6, 10), (9, 5), (13, 5), (4, 5), (9, 10), (6, 5), (7, 5)]\n\ndef m25842_diff_cover (ws : List (BitVec 16)) : Bool :=\n  m25842_diff_pairs.all fun p => ws.any fun w => w.getLsbD p.1 != w.getLsbD p.2\n\ndef m25842_pos_cover (ws : List (BitVec 16)) : Bool :=\n  m25842_pos_pairs.all fun p => ws.any fun w => w.getLsbD p.1 && !w.getLsbD p.2\n\ntheorem m25842_diff_pairs_good : ∀ p ∈ m25842_diff_pairs,\n    p.1 < 16 ∧ p.2 < 16 ∧ m25842_diff p 31711 := by\n  have h : m25842_diff_pairs.all (fun p => decide (p.1 < 16) &&\n      (decide (p.2 < 16) && ((31711 : BitVec 16).getLsbD p.1 !=\n        (31711 : BitVec 16).getLsbD p.2))) = true := by decide\n  intro p hp\n  simpa only [Bool.and_eq_true, decide_eq_true_eq, bne_iff_ne, m25842_diff]\n    using List.all_eq_true.mp h p hp\n\ntheorem m25842_pos_pairs_good : ∀ p ∈ m25842_pos_pairs,\n    m25842_pos p 31711 := by\n  have h : m25842_pos_pairs.all (fun p => (31711 : BitVec 16).getLsbD p.1 &&\n      !(31711 : BitVec 16).getLsbD p.2) = true := by decide\n  intro p hp\n  simpa only [Bool.and_eq_true, Bool.not_eq_true', m25842_pos]\n    using List.all_eq_true.mp h p hp\n\nset_option maxRecDepth 4000 in\nset_option maxHeartbeats 4000000 in\ntheorem m25842_checked_front : m25842_initial.sublists.all\n    (fun ws => (decide (6 ≤ ws.length) || !m25842_diff_cover ws) &&\n      (decide (8 ≤ ws.length) || !m25842_pos_cover ws)) = true := by decide\n\ntheorem m25842_initial_nodup : m25842_initial.Nodup := by decide\n\ntheorem m25842_no_small (C : PEqualNP.CircuitLowerBounds.Circuit)\n    (hf : PEqualNP.MetaComplexity.FanInTwo C) (hs : C.size ≤ 5)\n    (hr : PEqualNP.Represents.Represents\n      (fun u v : Fin 4 => (31711 : ℕ).testBit (4 * u.val + v.val)) C) : False := by\n  have hb := m25842_build_mono (m25842_get_build C hf hr) 5 hs\n  obtain ⟨S, hS, hl⟩ := m25842_compress hb\n  let ws := m25842_initial.filter (fun w => decide (w ∈ S))\n  have hws : ws.toFinset = S := by\n    ext w\n    simp only [ws, List.mem_toFinset, List.mem_filter, decide_eq_true_eq]\n    exact ⟨fun h => h.2, fun h => ⟨List.mem_toFinset.mp (hS h), h⟩⟩\n  have hnd : ws.Nodup := m25842_initial_nodup.filter _\n  have hcard : S.card = ws.length := by rw [← hws, List.toFinset_card_of_nodup hnd]\n  have hmax := m25842_live_card hl\n  have hmem : ws ∈ m25842_initial.sublists := List.mem_sublists.mpr List.filter_sublist\n  have checked := List.all_eq_true.mp m25842_checked_front ws hmem\n  simp only [Bool.and_eq_true, Bool.or_eq_true, decide_eq_true_eq, Bool.not_eq_true'] at checked\n  have hd : m25842_diff_cover ws = true := by\n    apply List.all_eq_true.mpr\n    intro p hp\n    have good := m25842_diff_pairs_good p hp\n    obtain ⟨w, hw, hd⟩ := m25842_live_separates (m25842_diff p) good.2.2\n      (m25842_diff_bin p) (m25842_diff_un p ⟨good.1, good.2.1⟩) hl\n    apply List.any_eq_true.mpr\n    refine ⟨w, List.mem_toFinset.mp (hws ▸ hw), ?_⟩\n    exact bne_iff_ne.mpr hd\n  have hmin : 6 ≤ ws.length := checked.1.resolve_right (by simp [hd])\n  have htight : S.card = 5 + 1 := by omega\n  have hp : m25842_pos_cover ws = true := by\n    apply List.all_eq_true.mpr\n    intro p hp\n    obtain ⟨w, hw, hh⟩ := m25842_live_tight (m25842_pos p) (m25842_pos_pairs_good p hp)\n      (m25842_pos_bin p) hl htight\n    apply List.any_eq_true.mpr\n    refine ⟨w, List.mem_toFinset.mp (hws ▸ hw), ?_⟩\n    simp only [Bool.and_eq_true, Bool.not_eq_true']\n    exact hh\n  have hlarge : 8 ≤ ws.length := checked.2.resolve_right (by simp [hp])\n  omega\n\ndef m25842_six : PEqualNP.CircuitLowerBounds.Circuit :=\n  ⟨[⟨.and, [1, 5]⟩, ⟨.and, [2, 6]⟩, ⟨.or, [8, 9]⟩,\n    ⟨.and, [3, 7]⟩, ⟨.or, [10, 11]⟩, ⟨.not, [12]⟩], 13⟩\n\ntheorem m25842_six_ok : PEqualNP.MetaComplexity.FanInTwo m25842_six ∧\n    m25842_six.size = 6 ∧ PEqualNP.Represents.Represents\n      (fun u v : Fin 4 => (31711 : ℕ).testBit (4 * u.val + v.val)) m25842_six := by\n  refine ⟨?_, rfl, ?_⟩\n  · simp [PEqualNP.MetaComplexity.FanInTwo, m25842_six]\n  · decide\n\ntheorem PEqualNP.Outside.L_meta_25842 :\n    ¬ (∃ C : PEqualNP.CircuitLowerBounds.Circuit, PEqualNP.MetaComplexity.FanInTwo C ∧\n      C.size ≤ 5 ∧ PEqualNP.Represents.Represents\n        (fun u v : Fin 4 => (31711 : ℕ).testBit (4 * u.val + v.val)) C) := by\n  rintro ⟨C, hf, hs, hr⟩\n  exact m25842_no_small C hf hs hr\n",
  "lean_bytes": 21411,
  "lean_sha256": "860b9059b516cf3200a58cb08fb98943f1ec43c8a6c92acd3396bb99da577c3e",
  "build": {
    "exit": 0,
    "seconds": 9.076842233072966,
    "peak_memory_gb": 3.165212672
  },
  "checker": {
    "exit": 0,
    "last_line": "ACCEPTED (refute): PEqualNP.Outside.L_meta_25842; axioms [propext, Quot.sound, Classical.choice]; kernel re-checked 1796 constants of [PEqualNP.Defs.Base, PEqualNP.Defs.Classes, PEqualNP.Defs.CircuitLowerBounds, PEqualNP.Defs.MetaComplexity, PEqualNP.Defs.MetaComplexityLocal, PEqualNP.Defs.MetaComplexitySparse, PEqualNP.Defs.MetaComplexityMinimal, PEqualNP.Defs.MetaComplexityLgp, PEqualNP.Defs.MetaComplexityLgpMono, PEqualNP.Defs.BinaryCircuit, PEqualNP.Defs.MetaComplexityCoverCircuit, PEqualNP.Defs.ProofComplexity, PEqualNP.Defs.ProofComplexityLin, PEqualNP.Defs.ProofComplexityLinK, PEqualNP.Defs.ProofComplexityLift, PEqualNP.Defs.ProofComplexityResK, PEqualNP.Defs.ProofComplexityRestrict, PEqualNP.Defs.ProofComplexityBit, PEqualNP.Defs.ProofComplexityPC, PEqualNP.Defs.ProofComplexityMoment, PEqualNP.Defs.ProofComplexityChain, PEqualNP.Defs.ProofComplexityGeneral, PEqualNP.Defs.Search, PEqualNP.Defs.SearchQ, PEqualNP.Defs.SearchQTree, PEqualNP.Defs.SearchCP, PEqualNP.Defs.SearchRUP, PEqualNP.Defs.SearchQSyn, PEqualNP.Defs.SearchSoS, PEqualNP.Defs.Gct, PEqualNP.Defs.Oracle, PEqualNP.Defs.Algebraic, PEqualNP.Defs.Expanders, PEqualNP.Defs.RiffleRank, PEqualNP.Defs.TimeAlt, PEqualNP.Defs.CoverPromise, PEqualNP.Defs.SingleLevel, PEqualNP.Defs.DeMorganFormula, PEqualNP.Defs.MetaComplexityTypedRank, PEqualNP.Defs.Pebble, PEqualNP.Defs.Subdivision, PEqualNP.Defs.AndCountCircuit, PEqualNP.Defs.PebbleThreeWay, PEqualNP.Defs.CoLevel, PEqualNP.Defs.Peelable, PEqualNP.Defs.NestedCoverCircuit, PEqualNP.Defs.LiteralPartition, PEqualNP.Defs.MinimumComplex, PEqualNP.Defs.PendantBit, PEqualNP.Defs.BorrowedCoverCircuit, PEqualNP.Defs.LineDegree, PEqualNP.Defs.CircuitMoves, PEqualNP.Defs.LowMerge, PEqualNP.Defs.NewLowMerge, PEqualNP.Defs.AffinePlane, PEqualNP.Defs.EdgeOwnership, PEqualNP.Defs.PencilGate, PEqualNP.Defs.BlindGate, PEqualNP.Defs.BicliqueBlockCost, PEqualNP.Defs.SharingOrder, PEqualNP.Defs.NotPremium, PEqualNP.Defs.NotBracket, PEqualNP.Defs.PairShadow, PEqualNP.Defs.SplitCount, PEqualNP.Defs.InvisibleWire, PEqualNP.Defs.SharedOr, PEqualNP.Defs.CleanedNonEdge, PEqualNP.Defs.MergeCost, PEqualNP.Defs.CarriedProduct, PEqualNP.Defs.TopForm, PEqualNP.Defs.SyntacticMultilinear, PEqualNP.Defs.TopFormNames, PEqualNP.Defs.HeptadCover, PEqualNP.Defs.ReadK, PEqualNP.Defs.GenericRejection, PEqualNP.Defs.CrossAnd, PEqualNP.Defs.ReadKJoin, PEqualNP.Defs.SharedBlockCost, PEqualNP.Defs.ReadTwo, PEqualNP.Defs.LratEncoding, PEqualNP.Defs.Core, PEqualNP.Defs.PointTypes, PEqualNP.Defs.FactorSubst, PEqualNP.Defs.TwoColour, PEqualNP.Defs.Represents, PEqualNP.Defs.BranchingProgram, PEqualNP.Defs, PEqualNP.Outside.L_meta_25842]"
  },
  "axioms": [
    "propext",
    "Quot.sound",
    "Classical.choice"
  ],
  "missing": [],
  "approach": {
    "argument": "Trace the required output backwards, keeping only live distinct truth tables. After k gates the frontier has at most k+1 tables. Unequal target bits require an unequal pair in some frontier table, through binary gates or NOT. The twelve chosen undirected pairs distinguish every pair of left vertices and every pair of right vertices. Among raw tables this requires at least three left and three right wires, hence at least six frontier tables. With five gates the frontier is therefore tight: each gate must expand it by exactly one, so no unary gate, reuse or branch discard is possible. Oriented true/false separation propagates backwards through binary AND/OR. The eight chosen oriented pairs each require a different raw input table; neither constant separates them. Thus the tight six-table frontier would need eight raw tables, a contradiction.",
    "small_decisions": "One kernel decide checks the 1024 subsets of eight raw tables plus two free constants: undirected coverage needs length at least 6; oriented coverage needs length at least 8. Other decide steps check only the small fixed lists, the sixteen sample inputs, and the six-gate witness. No circuit enumeration is evaluated inside Lean.",
    "provenance": "The generic build/live frontier, compression, cardinality, and tightness proofs were adapted and specialized from L_meta_26290. The bit-table simulation uses the read-wire method in L_meta_25471. All helpers are included in this one file; neither earlier proof file is imported.",
    "repository": "https://github.com/open-goat/pequalnp-proofs",
    "repository_commit": "e8dc2d83cc1f03dc3fcf24af495304f2dc5e0d36",
    "lean_release": "leanprover/lean4:v4.36.0",
    "mathlib_commit": "fc4f59e577feb1a4956671bc04ac18aaaf8cd842",
    "file": "lean/PEqualNP/Outside/L_meta_25842.lean",
    "module": "PEqualNP.Outside.L_meta_25842",
    "imports": [
      "PEqualNP.Defs"
    ],
    "row_status": {
      "initial_updated_at": "2026-11-28T00:16:18.013Z",
      "gap_present": true,
      "pr_open": 0,
      "reserved": true,
      "held_now": false,
      "offerable_now": false,
      "final_gap_present": true,
      "final_pr_open": 0
    },
    "participating_agents": [
      {
        "agent": "Codex (this worker)",
        "roles": [
          "exhaustive search",
          "mathematical argument",
          "Lean formalization",
          "local independent simulation"
        ]
      }
    ],
    "leases_taken": 0,
    "pull_requests_opened": 0,
    "submitted_proofs": 0,
    "accepted_proofs": {
      "local_official_checker": 1,
      "competition": 0
    },
    "points_awarded": 0,
    "costs": {
      "amount": null,
      "currency": null,
      "note": "No billing information is available; no cost is claimed."
    }
  },
  "skipped": false
}
