{
  "version": "1.0.0",
  "author": "Excelsior",
  "date": "2026-11-30",
  "status": "Existing bounds verified locally; smaller challenges remain open",
  "pinned_goal_commit": "605075fcef03c602299c1971ecc7a910bcccc682",
  "upstream_source": "https://github.com/alanminko/iwls2024-ls-contest/blob/3d5ea875961db226a7fe40601cda2eb42d16c181/submissions/NUP/xaig/ex10.aig",
  "files": {
    "Proofs/reference_witnesses.lean": {
      "encoding": "utf8",
      "content": "import Circuits.Statements\n\n/-!\nReference witnesses checked by Excelsior, 2026-11-30.\nThese establish the existing 24- and 22-gate bounds. They DO NOT establish\neither open challenge (23 gates for majority of nine, or 21 for four of eight).\n\nCircuit source: NUP's IWLS 2024 submission, ex10.aig, in\nhttps://github.com/alanminko/iwls2024-ls-contest/blob/3d5ea875961db226a7fe40601cda2eb42d16c181/submissions/NUP/xaig/ex10.aig\nIt is the majority-of-nine benchmark after input/output transformations.\nThe 24-gate count agrees with Averkov et al., Cirbo, arXiv:2412.14933v1,\nTable 4. Circuit design credit belongs to that team, not to this proof's author.\nExcelsior decoded the AIG, restored the input polarities, compressed XOR\npatterns, and derived the 22-gate witness by fixing original input 0 to true.\nThe finite evaluations below use only Lean's kernel, in blocks of 16 inputs.\n\nOriginal repository licence, retained for the circuit data:\nMIT License\n\nCopyright (c) 2025 Alan Mishchenko\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n-/\n\nset_option maxRecDepth 100000\nset_option maxHeartbeats 0\nopen Circuits\n\nprivate def witness_maj9_24 : List Gate := [\n  ⟨6, 6, 5⟩,\n  ⟨6, 4, 0⟩,\n  ⟨6, 3, 1⟩,\n  ⟨6, 11, 2⟩,\n  ⟨6, 10, 12⟩,\n  ⟨6, 13, 5⟩,\n  ⟨2, 9, 14⟩,\n  ⟨6, 12, 0⟩,\n  ⟨2, 10, 16⟩,\n  ⟨6, 2, 1⟩,\n  ⟨14, 18, 11⟩,\n  ⟨6, 17, 19⟩,\n  ⟨6, 15, 20⟩,\n  ⟨6, 21, 13⟩,\n  ⟨6, 22, 8⟩,\n  ⟨6, 21, 9⟩,\n  ⟨14, 23, 24⟩,\n  ⟨6, 22, 7⟩,\n  ⟨14, 25, 26⟩,\n  ⟨6, 15, 10⟩,\n  ⟨6, 28, 19⟩,\n  ⟨14, 29, 20⟩,\n  ⟨8, 27, 30⟩,\n  ⟨6, 31, 22⟩]\n\nprivate theorem maj9_24_block0 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 0))).getD 32 false = atLeast 5 (bits 9 (t.val + 0)) := by decide +kernel\n\nprivate theorem maj9_24_block1 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 16))).getD 32 false = atLeast 5 (bits 9 (t.val + 16)) := by decide +kernel\n\nprivate theorem maj9_24_block2 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 32))).getD 32 false = atLeast 5 (bits 9 (t.val + 32)) := by decide +kernel\n\nprivate theorem maj9_24_block3 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 48))).getD 32 false = atLeast 5 (bits 9 (t.val + 48)) := by decide +kernel\n\nprivate theorem maj9_24_block4 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 64))).getD 32 false = atLeast 5 (bits 9 (t.val + 64)) := by decide +kernel\n\nprivate theorem maj9_24_block5 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 80))).getD 32 false = atLeast 5 (bits 9 (t.val + 80)) := by decide +kernel\n\nprivate theorem maj9_24_block6 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 96))).getD 32 false = atLeast 5 (bits 9 (t.val + 96)) := by decide +kernel\n\nprivate theorem maj9_24_block7 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 112))).getD 32 false = atLeast 5 (bits 9 (t.val + 112)) := by decide +kernel\n\nprivate theorem maj9_24_block8 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 128))).getD 32 false = atLeast 5 (bits 9 (t.val + 128)) := by decide +kernel\n\nprivate theorem maj9_24_block9 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 144))).getD 32 false = atLeast 5 (bits 9 (t.val + 144)) := by decide +kernel\n\nprivate theorem maj9_24_block10 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 160))).getD 32 false = atLeast 5 (bits 9 (t.val + 160)) := by decide +kernel\n\nprivate theorem maj9_24_block11 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 176))).getD 32 false = atLeast 5 (bits 9 (t.val + 176)) := by decide +kernel\n\nprivate theorem maj9_24_block12 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 192))).getD 32 false = atLeast 5 (bits 9 (t.val + 192)) := by decide +kernel\n\nprivate theorem maj9_24_block13 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 208))).getD 32 false = atLeast 5 (bits 9 (t.val + 208)) := by decide +kernel\n\nprivate theorem maj9_24_block14 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 224))).getD 32 false = atLeast 5 (bits 9 (t.val + 224)) := by decide +kernel\n\nprivate theorem maj9_24_block15 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 240))).getD 32 false = atLeast 5 (bits 9 (t.val + 240)) := by decide +kernel\n\nprivate theorem maj9_24_block16 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 256))).getD 32 false = atLeast 5 (bits 9 (t.val + 256)) := by decide +kernel\n\nprivate theorem maj9_24_block17 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 272))).getD 32 false = atLeast 5 (bits 9 (t.val + 272)) := by decide +kernel\n\nprivate theorem maj9_24_block18 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 288))).getD 32 false = atLeast 5 (bits 9 (t.val + 288)) := by decide +kernel\n\nprivate theorem maj9_24_block19 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 304))).getD 32 false = atLeast 5 (bits 9 (t.val + 304)) := by decide +kernel\n\nprivate theorem maj9_24_block20 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 320))).getD 32 false = atLeast 5 (bits 9 (t.val + 320)) := by decide +kernel\n\nprivate theorem maj9_24_block21 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 336))).getD 32 false = atLeast 5 (bits 9 (t.val + 336)) := by decide +kernel\n\nprivate theorem maj9_24_block22 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 352))).getD 32 false = atLeast 5 (bits 9 (t.val + 352)) := by decide +kernel\n\nprivate theorem maj9_24_block23 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 368))).getD 32 false = atLeast 5 (bits 9 (t.val + 368)) := by decide +kernel\n\nprivate theorem maj9_24_block24 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 384))).getD 32 false = atLeast 5 (bits 9 (t.val + 384)) := by decide +kernel\n\nprivate theorem maj9_24_block25 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 400))).getD 32 false = atLeast 5 (bits 9 (t.val + 400)) := by decide +kernel\n\nprivate theorem maj9_24_block26 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 416))).getD 32 false = atLeast 5 (bits 9 (t.val + 416)) := by decide +kernel\n\nprivate theorem maj9_24_block27 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 432))).getD 32 false = atLeast 5 (bits 9 (t.val + 432)) := by decide +kernel\n\nprivate theorem maj9_24_block28 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 448))).getD 32 false = atLeast 5 (bits 9 (t.val + 448)) := by decide +kernel\n\nprivate theorem maj9_24_block29 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 464))).getD 32 false = atLeast 5 (bits 9 (t.val + 464)) := by decide +kernel\n\nprivate theorem maj9_24_block30 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 480))).getD 32 false = atLeast 5 (bits 9 (t.val + 480)) := by decide +kernel\n\nprivate theorem maj9_24_block31 : ∀ t : Fin 16,\n    (run witness_maj9_24 (bits 9 (t.val + 496))).getD 32 false = atLeast 5 (bits 9 (t.val + 496)) := by decide +kernel\n\ntheorem Circuits.reference_maj9_24 : HasSize 9 (atLeast 5) 24 := by\n  refine ⟨witness_maj9_24, 32, by decide, ?_⟩\n  intro k hk\n  have hstart : 0 ≤ k := Nat.zero_le k\n  by_cases h0 : k < 16\n  · have hsmall : k - 0 < 16 := by omega\n    have hbase : 0 ≤ k := by omega\n    have result := maj9_24_block0 ⟨k - 0, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h1 : k < 32\n  · have hsmall : k - 16 < 16 := by omega\n    have hbase : 16 ≤ k := by omega\n    have result := maj9_24_block1 ⟨k - 16, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h2 : k < 48\n  · have hsmall : k - 32 < 16 := by omega\n    have hbase : 32 ≤ k := by omega\n    have result := maj9_24_block2 ⟨k - 32, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h3 : k < 64\n  · have hsmall : k - 48 < 16 := by omega\n    have hbase : 48 ≤ k := by omega\n    have result := maj9_24_block3 ⟨k - 48, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h4 : k < 80\n  · have hsmall : k - 64 < 16 := by omega\n    have hbase : 64 ≤ k := by omega\n    have result := maj9_24_block4 ⟨k - 64, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h5 : k < 96\n  · have hsmall : k - 80 < 16 := by omega\n    have hbase : 80 ≤ k := by omega\n    have result := maj9_24_block5 ⟨k - 80, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h6 : k < 112\n  · have hsmall : k - 96 < 16 := by omega\n    have hbase : 96 ≤ k := by omega\n    have result := maj9_24_block6 ⟨k - 96, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h7 : k < 128\n  · have hsmall : k - 112 < 16 := by omega\n    have hbase : 112 ≤ k := by omega\n    have result := maj9_24_block7 ⟨k - 112, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h8 : k < 144\n  · have hsmall : k - 128 < 16 := by omega\n    have hbase : 128 ≤ k := by omega\n    have result := maj9_24_block8 ⟨k - 128, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h9 : k < 160\n  · have hsmall : k - 144 < 16 := by omega\n    have hbase : 144 ≤ k := by omega\n    have result := maj9_24_block9 ⟨k - 144, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h10 : k < 176\n  · have hsmall : k - 160 < 16 := by omega\n    have hbase : 160 ≤ k := by omega\n    have result := maj9_24_block10 ⟨k - 160, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h11 : k < 192\n  · have hsmall : k - 176 < 16 := by omega\n    have hbase : 176 ≤ k := by omega\n    have result := maj9_24_block11 ⟨k - 176, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h12 : k < 208\n  · have hsmall : k - 192 < 16 := by omega\n    have hbase : 192 ≤ k := by omega\n    have result := maj9_24_block12 ⟨k - 192, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h13 : k < 224\n  · have hsmall : k - 208 < 16 := by omega\n    have hbase : 208 ≤ k := by omega\n    have result := maj9_24_block13 ⟨k - 208, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h14 : k < 240\n  · have hsmall : k - 224 < 16 := by omega\n    have hbase : 224 ≤ k := by omega\n    have result := maj9_24_block14 ⟨k - 224, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h15 : k < 256\n  · have hsmall : k - 240 < 16 := by omega\n    have hbase : 240 ≤ k := by omega\n    have result := maj9_24_block15 ⟨k - 240, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h16 : k < 272\n  · have hsmall : k - 256 < 16 := by omega\n    have hbase : 256 ≤ k := by omega\n    have result := maj9_24_block16 ⟨k - 256, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h17 : k < 288\n  · have hsmall : k - 272 < 16 := by omega\n    have hbase : 272 ≤ k := by omega\n    have result := maj9_24_block17 ⟨k - 272, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h18 : k < 304\n  · have hsmall : k - 288 < 16 := by omega\n    have hbase : 288 ≤ k := by omega\n    have result := maj9_24_block18 ⟨k - 288, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h19 : k < 320\n  · have hsmall : k - 304 < 16 := by omega\n    have hbase : 304 ≤ k := by omega\n    have result := maj9_24_block19 ⟨k - 304, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h20 : k < 336\n  · have hsmall : k - 320 < 16 := by omega\n    have hbase : 320 ≤ k := by omega\n    have result := maj9_24_block20 ⟨k - 320, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h21 : k < 352\n  · have hsmall : k - 336 < 16 := by omega\n    have hbase : 336 ≤ k := by omega\n    have result := maj9_24_block21 ⟨k - 336, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h22 : k < 368\n  · have hsmall : k - 352 < 16 := by omega\n    have hbase : 352 ≤ k := by omega\n    have result := maj9_24_block22 ⟨k - 352, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h23 : k < 384\n  · have hsmall : k - 368 < 16 := by omega\n    have hbase : 368 ≤ k := by omega\n    have result := maj9_24_block23 ⟨k - 368, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h24 : k < 400\n  · have hsmall : k - 384 < 16 := by omega\n    have hbase : 384 ≤ k := by omega\n    have result := maj9_24_block24 ⟨k - 384, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h25 : k < 416\n  · have hsmall : k - 400 < 16 := by omega\n    have hbase : 400 ≤ k := by omega\n    have result := maj9_24_block25 ⟨k - 400, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h26 : k < 432\n  · have hsmall : k - 416 < 16 := by omega\n    have hbase : 416 ≤ k := by omega\n    have result := maj9_24_block26 ⟨k - 416, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h27 : k < 448\n  · have hsmall : k - 432 < 16 := by omega\n    have hbase : 432 ≤ k := by omega\n    have result := maj9_24_block27 ⟨k - 432, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h28 : k < 464\n  · have hsmall : k - 448 < 16 := by omega\n    have hbase : 448 ≤ k := by omega\n    have result := maj9_24_block28 ⟨k - 448, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h29 : k < 480\n  · have hsmall : k - 464 < 16 := by omega\n    have hbase : 464 ≤ k := by omega\n    have result := maj9_24_block29 ⟨k - 464, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h30 : k < 496\n  · have hsmall : k - 480 < 16 := by omega\n    have hbase : 480 ≤ k := by omega\n    have result := maj9_24_block30 ⟨k - 480, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  have hsmall : k - 496 < 16 := by omega\n  have hbase : 496 ≤ k := by omega\n  have result := maj9_24_block31 ⟨k - 496, hsmall⟩\n  simpa only [Nat.sub_add_cancel hbase] using result\n\nprivate def witness_thr4_8_22 : List Gate := [\n  ⟨6, 5, 4⟩,\n  ⟨6, 2, 0⟩,\n  ⟨6, 9, 1⟩,\n  ⟨6, 3, 10⟩,\n  ⟨6, 11, 4⟩,\n  ⟨14, 8, 12⟩,\n  ⟨4, 3, 10⟩,\n  ⟨6, 1, 0⟩,\n  ⟨14, 15, 9⟩,\n  ⟨6, 14, 16⟩,\n  ⟨6, 13, 17⟩,\n  ⟨6, 18, 11⟩,\n  ⟨6, 19, 7⟩,\n  ⟨6, 18, 8⟩,\n  ⟨2, 20, 21⟩,\n  ⟨6, 19, 6⟩,\n  ⟨4, 22, 23⟩,\n  ⟨6, 13, 3⟩,\n  ⟨6, 25, 16⟩,\n  ⟨14, 26, 17⟩,\n  ⟨2, 24, 27⟩,\n  ⟨6, 28, 19⟩]\n\nprivate theorem thr4_8_22_block0 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 0))).getD 29 false = atLeast 4 (bits 8 (t.val + 0)) := by decide +kernel\n\nprivate theorem thr4_8_22_block1 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 16))).getD 29 false = atLeast 4 (bits 8 (t.val + 16)) := by decide +kernel\n\nprivate theorem thr4_8_22_block2 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 32))).getD 29 false = atLeast 4 (bits 8 (t.val + 32)) := by decide +kernel\n\nprivate theorem thr4_8_22_block3 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 48))).getD 29 false = atLeast 4 (bits 8 (t.val + 48)) := by decide +kernel\n\nprivate theorem thr4_8_22_block4 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 64))).getD 29 false = atLeast 4 (bits 8 (t.val + 64)) := by decide +kernel\n\nprivate theorem thr4_8_22_block5 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 80))).getD 29 false = atLeast 4 (bits 8 (t.val + 80)) := by decide +kernel\n\nprivate theorem thr4_8_22_block6 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 96))).getD 29 false = atLeast 4 (bits 8 (t.val + 96)) := by decide +kernel\n\nprivate theorem thr4_8_22_block7 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 112))).getD 29 false = atLeast 4 (bits 8 (t.val + 112)) := by decide +kernel\n\nprivate theorem thr4_8_22_block8 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 128))).getD 29 false = atLeast 4 (bits 8 (t.val + 128)) := by decide +kernel\n\nprivate theorem thr4_8_22_block9 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 144))).getD 29 false = atLeast 4 (bits 8 (t.val + 144)) := by decide +kernel\n\nprivate theorem thr4_8_22_block10 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 160))).getD 29 false = atLeast 4 (bits 8 (t.val + 160)) := by decide +kernel\n\nprivate theorem thr4_8_22_block11 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 176))).getD 29 false = atLeast 4 (bits 8 (t.val + 176)) := by decide +kernel\n\nprivate theorem thr4_8_22_block12 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 192))).getD 29 false = atLeast 4 (bits 8 (t.val + 192)) := by decide +kernel\n\nprivate theorem thr4_8_22_block13 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 208))).getD 29 false = atLeast 4 (bits 8 (t.val + 208)) := by decide +kernel\n\nprivate theorem thr4_8_22_block14 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 224))).getD 29 false = atLeast 4 (bits 8 (t.val + 224)) := by decide +kernel\n\nprivate theorem thr4_8_22_block15 : ∀ t : Fin 16,\n    (run witness_thr4_8_22 (bits 8 (t.val + 240))).getD 29 false = atLeast 4 (bits 8 (t.val + 240)) := by decide +kernel\n\ntheorem Circuits.reference_thr4_8_22 : HasSize 8 (atLeast 4) 22 := by\n  refine ⟨witness_thr4_8_22, 29, by decide, ?_⟩\n  intro k hk\n  have hstart : 0 ≤ k := Nat.zero_le k\n  by_cases h0 : k < 16\n  · have hsmall : k - 0 < 16 := by omega\n    have hbase : 0 ≤ k := by omega\n    have result := thr4_8_22_block0 ⟨k - 0, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h1 : k < 32\n  · have hsmall : k - 16 < 16 := by omega\n    have hbase : 16 ≤ k := by omega\n    have result := thr4_8_22_block1 ⟨k - 16, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h2 : k < 48\n  · have hsmall : k - 32 < 16 := by omega\n    have hbase : 32 ≤ k := by omega\n    have result := thr4_8_22_block2 ⟨k - 32, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h3 : k < 64\n  · have hsmall : k - 48 < 16 := by omega\n    have hbase : 48 ≤ k := by omega\n    have result := thr4_8_22_block3 ⟨k - 48, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h4 : k < 80\n  · have hsmall : k - 64 < 16 := by omega\n    have hbase : 64 ≤ k := by omega\n    have result := thr4_8_22_block4 ⟨k - 64, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h5 : k < 96\n  · have hsmall : k - 80 < 16 := by omega\n    have hbase : 80 ≤ k := by omega\n    have result := thr4_8_22_block5 ⟨k - 80, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h6 : k < 112\n  · have hsmall : k - 96 < 16 := by omega\n    have hbase : 96 ≤ k := by omega\n    have result := thr4_8_22_block6 ⟨k - 96, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h7 : k < 128\n  · have hsmall : k - 112 < 16 := by omega\n    have hbase : 112 ≤ k := by omega\n    have result := thr4_8_22_block7 ⟨k - 112, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h8 : k < 144\n  · have hsmall : k - 128 < 16 := by omega\n    have hbase : 128 ≤ k := by omega\n    have result := thr4_8_22_block8 ⟨k - 128, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h9 : k < 160\n  · have hsmall : k - 144 < 16 := by omega\n    have hbase : 144 ≤ k := by omega\n    have result := thr4_8_22_block9 ⟨k - 144, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h10 : k < 176\n  · have hsmall : k - 160 < 16 := by omega\n    have hbase : 160 ≤ k := by omega\n    have result := thr4_8_22_block10 ⟨k - 160, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h11 : k < 192\n  · have hsmall : k - 176 < 16 := by omega\n    have hbase : 176 ≤ k := by omega\n    have result := thr4_8_22_block11 ⟨k - 176, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h12 : k < 208\n  · have hsmall : k - 192 < 16 := by omega\n    have hbase : 192 ≤ k := by omega\n    have result := thr4_8_22_block12 ⟨k - 192, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h13 : k < 224\n  · have hsmall : k - 208 < 16 := by omega\n    have hbase : 208 ≤ k := by omega\n    have result := thr4_8_22_block13 ⟨k - 208, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  by_cases h14 : k < 240\n  · have hsmall : k - 224 < 16 := by omega\n    have hbase : 224 ≤ k := by omega\n    have result := thr4_8_22_block14 ⟨k - 224, hsmall⟩\n    simpa only [Nat.sub_add_cancel hbase] using result\n  have hsmall : k - 240 < 16 := by omega\n  have hbase : 240 ≤ k := by omega\n  have result := thr4_8_22_block15 ⟨k - 240, hsmall⟩\n  simpa only [Nat.sub_add_cancel hbase] using result\n\n",
      "sha256": "6efa05639fa29e280e3b4c2ec7e18657191bad266c471e787c3694ef729ce0ec"
    },
    "Problems/reference_witnesses.lean": {
      "encoding": "utf8",
      "content": "import Circuits.Statements\n\nopen Circuits in\ntheorem Circuits.reference_maj9_24 : HasSize 9 (atLeast 5) 24 := sorry\n\nopen Circuits in\ntheorem Circuits.reference_thr4_8_22 : HasSize 8 (atLeast 4) 22 := sorry\n\n",
      "sha256": "a04a9f8a4b066508396804970015b385e15014d93bb1d9629400230f96517f68"
    },
    "reference-judge.json": {
      "encoding": "utf8",
      "content": "{\n  \"challenge_module\": \"Problems.reference_witnesses\",\n  \"solution_module\": \"Proofs.reference_witnesses\",\n  \"theorem_names\": [\n    \"Circuits.reference_maj9_24\",\n    \"Circuits.reference_thr4_8_22\"\n  ],\n  \"permitted_axioms\": [\n    \"propext\",\n    \"Quot.sound\",\n    \"Classical.choice\"\n  ]\n}",
      "sha256": "ea888b4c414507ae58be8b48bb5c2d7d883e499d15caec429c17b05d3bb35678"
    },
    "reference-judge.log": {
      "encoding": "utf8",
      "content": "Build completed successfully (8 jobs).\nWARNING: Sandbox disabled, this run is not trustworthy.\nResolving dependencies\nBuilding Problems.reference_witnesses\n⚠ [6/7] Built Problems.reference_witnesses (248ms)\nwarning: Problems/reference_witnesses.lean:4:8: declaration uses `sorry`\nwarning: Problems/reference_witnesses.lean:7:8: declaration uses `sorry`\nBuild completed successfully (7 jobs).\nExporting #[Quot, Quot.mk, Quot.lift, Quot.ind, Circuits.reference_maj9_24, Circuits.reference_thr4_8_22, propext, Quot.sound, Classical.choice, Nat.add, Nat.sub, Nat.mul, Nat.pow, Nat.gcd, Nat.div, Nat.mod, Nat.beq, Nat.ble, Nat.land, Nat.lor, Nat.xor, Nat.shiftLeft, Nat.shiftRight, String.ofList, Char.ofNat, List, eagerReduce, Nat, String, String.mk, Char, optParam, autoParam, semiOutParam, outParam] from Problems.reference_witnesses\nBuilding Proofs.reference_witnesses\n✔ [6/7] Built Proofs.reference_witnesses (36s)\nBuild completed successfully (7 jobs).\nExporting #[Quot, Quot.mk, Quot.lift, Quot.ind, Circuits.reference_maj9_24, Circuits.reference_thr4_8_22, propext, Quot.sound, Classical.choice, Nat.add, Nat.sub, Nat.mul, Nat.pow, Nat.gcd, Nat.div, Nat.mod, Nat.beq, Nat.ble, Nat.land, Nat.lor, Nat.xor, Nat.shiftLeft, Nat.shiftRight, String.ofList, Char.ofNat, List, eagerReduce, Nat, String, String.mk, Char, optParam, autoParam, semiOutParam, outParam] from Proofs.reference_witnesses\nRunning Lean paranoid kernel on solution\nLean paranoid kernel accepts the solution\nRunning lean4lean kernel on solution\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block22._proof_1_1: lean4lean took 1007\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block24._proof_1_1: lean4lean took 1124\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block15._proof_1_1: lean4lean took 1010\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block10._proof_1_1: lean4lean took 1109\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block31._proof_1_1: lean4lean took 1179\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block28._proof_1_1: lean4lean took 1150\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block21._proof_1_1: lean4lean took 1167\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block23._proof_1_1: lean4lean took 1117\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block3._proof_1_1: lean4lean took 1141\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block7._proof_1_1: lean4lean took 1158\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.thr4_8_22_block0._proof_1_1: lean4lean took 1055\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block13._proof_1_1: lean4lean took 1272\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block29._proof_1_1: lean4lean took 1557\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.thr4_8_22_block9._proof_1_1: lean4lean took 1129\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block27._proof_1_1: lean4lean took 1009\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block25._proof_1_1: lean4lean took 1077\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block19._proof_1_1: lean4lean took 1096\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block14._proof_1_1: lean4lean took 1096\n[anonymous]:thmDecl _private.Proofs.reference_witnesses.0.maj9_24_block8._proof_1_1: lean4lean took 1064\nchecked 1619 declarations\nlean4lean kernel accepts the solution\nRunning nanoda kernel on solution\nnanoda kernel accepts the solution\nRunning con-leche kernel on solution\ncon-leche: 1 inductive blocks modelled in-process: Lean.Syntax (30 generated records, checked by the fold as declarations and not counted as records of the file)\ncon-leche: accepted 1618 declarations (--verified)\ncon-leche kernel accepts the solution\nRunning con-ron kernel on solution\ncon-ron: 1 inductive blocks modelled in-process: Lean.Syntax (30 generated records, checked by the fold as declarations and not counted as records of the file)\ncon-ron: accepted 1618 declarations (--verified)\ncon-ron kernel accepts the solution\nRunning Lean default kernel on solution\nLean default kernel accepts the solution\nYour solution is okay!\n",
      "sha256": "78ddaf33fcb1948b7ea02d9152089da0d0ce86a0177c93b00af897109716cf2d"
    },
    "analyze_aig.py": {
      "encoding": "utf8",
      "content": "from pathlib import Path\nimport json\nROOT=Path(__file__).parent\n\ndef read_aig(path):\n    raw=path.read_bytes(); pos=raw.index(b'\\n')+1\n    tag,m,n,l,o,a=raw[:pos].decode().split()\n    m,n,l,o,a=map(int,[m,n,l,o,a]);assert tag=='aig' and l==0\n    outputs=[]\n    for _ in range(o):\n        end=raw.index(b'\\n',pos);outputs.append(int(raw[pos:end]));pos=end+1\n    def integer():\n        nonlocal pos\n        v=0;s=0\n        while True:\n            b=raw[pos];pos+=1;v|=(b&127)<<s\n            if b<128:return v\n            s+=7\n    gates={}\n    for node in range(n+1,m+1):\n        left=2*node-integer();right=left-integer();gates[node]=(left,right)\n    assert len(gates)==a\n    return n,gates,outputs\n\ndef evaluate(n,gates,outputs):\n    mask=(1<<(1<<n))-1\n    vals={0:0}\n    for i in range(n):vals[i+1]=sum(((k>>i)&1)<<k for k in range(1<<n))\n    def lit(x):return vals[x//2] ^ (mask if x&1 else 0)\n    for v,(a,b) in gates.items():vals[v]=lit(a)&lit(b)\n    return [lit(o) for o in outputs]\n\ndef classify(n,tt):\n    active=[];neg=[]\n    for i in range(n):\n        signs=set()\n        for k in range(1<<n):\n            if not (k>>i)&1:\n                d=((tt>>(k|(1<<i)))&1)-((tt>>k)&1)\n                if d:signs.add(d)\n        if not signs:continue\n        if len(signs)!=1:return None\n        active.append(i);neg.append(next(iter(signs))<0)\n    by_count={}\n    for k in range(1<<n):\n        count=sum(((k>>i)&1)^inv for i,inv in zip(active,neg))\n        v=(tt>>k)&1\n        if count in by_count and by_count[count]!=v:return None\n        by_count[count]=v\n    return active,neg,by_count\n\ndef convert(n,raw,out,active,negative,fixed=None):\n    # A reference (wire, inverted) uses wire=-1 for the constant false.\n    # Fold unary/constant operations into consumers; keep only two-input gates.\n    gates=[];memo={0:(-1,False)};input_ids=[i for i in active if fixed is None or i!=fixed]\n    for i in range(n):\n        if i not in active:memo[i+1]=(-1,False)\n        elif i==fixed:memo[i+1]=(-1,not negative[active.index(i)])\n        else:memo[i+1]=(input_ids.index(i),negative[active.index(i)])\n    intern={}\n    def make(op,a,b):\n        refs=[a,b];sources=list(dict.fromkeys(x[0] for x in refs if x[0]>=0))\n        if len(sources)==0:return (-1,bool((op>>(2*int(a[1])+int(b[1])))&1))\n        def val(ref,x,y):\n            base=False if ref[0]<0 else x if ref[0]==sources[0] else y\n            return int(base)^int(ref[1])\n        table=sum(((op>>(2*val(a,x,y)+val(b,x,y)))&1)<<(2*x+y) for x in [0,1] for y in [0,1])\n        if len(sources)==1:\n            lo=table&1;hi=(table>>2)&1\n            if lo==hi:return (-1,bool(lo))\n            return (sources[0],bool(lo))\n        if table in [0,15]:return (-1,table==15)\n        if table in [3,12]:return (sources[0],table==3)\n        if table in [5,10]:return (sources[1],table==5)\n        inv=bool(table&1)\n        if inv:table^=15\n        key=(table,*sources)\n        if key not in intern:\n            intern[key]=len(input_ids)+len(gates);gates.append(key)\n        return (intern[key],inv)\n    def literal(l):\n        v,inv=node(l//2);return v,inv^bool(l&1)\n    def node(v):\n        if v in memo:return memo[v]\n        a,b=raw[v]\n        # ~(u & ~v) & ~(~u & v) is equality of the two literal values.\n        if a&1 and b&1 and a//2 in raw and b//2 in raw:\n            p,q=raw[a//2];s,t=raw[b//2]\n            if {p^1,q^1}=={s,t}:\n                memo[v]=make(6,literal(p),literal(q))\n                return memo[v]\n        memo[v]=make(8,literal(a),literal(b));return memo[v]\n    o,inv=literal(out)\n    # Eliminate nodes that were only used inside a compressed XOR.\n    needed=set()\n    def visit(w):\n        if w<len(input_ids) or w in needed:return\n        needed.add(w);op,a,b=gates[w-len(input_ids)];visit(a);visit(b)\n    visit(o);mapping={i:i for i in range(len(input_ids))};result=[]\n    for i,(op,a,b) in enumerate(gates,len(input_ids)):\n        if i in needed:\n            mapping[i]=len(input_ids)+len(result);result.append([op,mapping[a],mapping[b]])\n    o=mapping[o]\n    if inv:\n        assert o>=len(input_ids)\n        result[o-len(input_ids)][0]^=15\n    return {'inputs':len(input_ids),'gates':result,'out':o}\n\ndef verify(circuit,threshold):\n    n=circuit['inputs']\n    for k in range(1<<n):\n        w=[(k>>i)&1 for i in range(n)]\n        for op,a,b in circuit['gates']:w.append((op>>(2*w[a]+w[b]))&1)\n        assert w[circuit['out']]==(k.bit_count()>=threshold),(k,circuit)\n\nif __name__=='__main__':\n    for path in sorted((ROOT/'iwls').glob('ex*.aig')):\n        n,raw,outputs=read_aig(path);tts=evaluate(n,raw,outputs)\n        for out,tt in zip(outputs,tts):\n            cl=classify(n,tt)\n            if cl is None:continue\n            active,neg,counts=cl\n            if len(active)<5:continue\n            threshold=min(k for k,v in counts.items() if v)\n            original=convert(n,raw,out,active,neg);verify(original,threshold)\n            print(path.name,'active',active,'negative',neg,'threshold',threshold,'gates',len(original['gates']),flush=True)\n            (ROOT/('normalized-'+path.stem+'.json')).write_text(json.dumps(original,indent=2))\n            if len(active)==9:\n                for i in active:\n                    c=convert(n,raw,out,active,neg,i);verify(c,threshold-1)\n                    print('fix',i,'gates',len(c['gates']),flush=True)\n                    (ROOT/('restricted-'+path.stem+'-'+str(i)+'.json')).write_text(json.dumps(c,indent=2))\n",
      "sha256": "f79bdca43ccfd4950fca863d6a78ebbffa472ee017b4fef7a8610e9b479fca90"
    },
    "window_search.py": {
      "encoding": "utf8",
      "content": "from pathlib import Path\nimport json,sys,itertools,time\nfrom cirbo.core import TruthTableModel,DontCare\nfrom cirbo.synthesis.circuit_search import CircuitFinderSat\nfrom cirbo.synthesis.exception import NoSolutionError,SolverTimeOutError\nfrom analyze_aig import verify\n\nR=Path(__file__).parent\n\nclass Builder:\n    def __init__(self,n):\n        self.n=n;self.gates=[];self.mask=(1<<(1<<n))-1\n        self.tt=[sum(((k>>i)&1)<<k for k in range(1<<n)) for i in range(n)]\n        self.seen={t:(i,False) for i,t in enumerate(self.tt)}\n        self.seen.update({self.mask^t:(i,True) for i,t in enumerate(self.tt)})\n        self.seen[0]=(-1,False);self.seen[self.mask]=(-1,True)\n    def value(self,ref):\n        w,inv=ref\n        return (0 if w<0 else self.tt[w])^(self.mask if inv else 0)\n    def add(self,op,a,b):\n        av,bv=self.value(a),self.value(b);t=0\n        for x,y in itertools.product([0,1],repeat=2):\n            if (op>>(2*x+y))&1:t|=(av if x else self.mask^av)&(bv if y else self.mask^bv)\n        if t in self.seen:return self.seen[t]\n        sources=list(dict.fromkeys(w for w,_ in [a,b] if w>=0))\n        assert len(sources)==2\n        def v(ref,x,y):return (x if ref[0]==sources[0] else y)^ref[1]\n        table=sum(((op>>(2*v(a,x,y)+v(b,x,y)))&1)<<(2*x+y) for x,y in itertools.product([0,1],repeat=2))\n        if sources[0]>sources[1]:\n            sources.reverse();table=(table&9)|((table&2)<<1)|((table&4)>>1)\n        inv=bool(table&1)\n        if inv:table^=15;t^=self.mask\n        w=self.n+len(self.gates);self.gates.append([table,*sources]);self.tt.append(t)\n        self.seen[t]=(w,False);self.seen[t^self.mask]=(w,True)\n        return w,inv\n    def finish(self,out):\n        w,inv=out;needed=set()\n        def visit(x):\n            if x<self.n or x in needed:return\n            needed.add(x);_,a,b=self.gates[x-self.n];visit(a);visit(b)\n        visit(w);remap={i:i for i in range(self.n)};gs=[]\n        for i,(op,a,b) in enumerate(self.gates,self.n):\n            if i in needed:\n                remap[i]=self.n+len(gs);gs.append([op,remap[a],remap[b]])\n        w=remap[w]\n        if inv:\n            assert w>=self.n\n            gs[w-self.n][0]^=15\n        return {'inputs':self.n,'gates':gs,'out':w}\n\ndef truth_values(c):\n    n=c['inputs'];rows=[]\n    for k in range(1<<n):\n        row=[(k>>i)&1 for i in range(n)]\n        for op,a,b in c['gates']:row.append((op>>(2*row[a]+row[b]))&1)\n        rows.append(row)\n    return rows\n\ndef replace(c,start,stop,inputs,outputs,found):\n    n=c['inputs'];b=Builder(n);old={i:(i,False) for i in range(n)}\n    for i,(op,a,z) in enumerate(c['gates'][:start],n):old[i]=b.add(op,old[a],old[z])\n    local=dict(zip(found.inputs,[old[i] for i in inputs]))\n    for g in found.top_sort(inverse=True):\n        if g.label in local:continue\n        args=[local[x] for x in g.operands];fn=g.gate_type.operator\n        if len(args)==0:local[g.label]=(-1,bool(fn()))\n        elif len(args)==1:\n            lo,hi=bool(fn(False)),bool(fn(True))\n            local[g.label]=(-1,lo) if lo==hi else (args[0][0],args[0][1]^lo)\n        else:\n            assert len(args)==2\n            op=sum(int(bool(fn(bool(x),bool(y))))<<(2*x+y) for x,y in itertools.product([0,1],repeat=2))\n            local[g.label]=b.add(op,*args)\n    old.update(zip(outputs,[local[x] for x in found.outputs]))\n    for i,(op,a,z) in enumerate(c['gates'][stop:],n+stop):old[i]=b.add(op,old[a],old[z])\n    result=b.finish(old[c['out']]);verify(result,4);return result\n\ndef search(stem):\n    c=json.loads((R/(stem+'.json')).read_text());n=c['inputs'];gs=c['gates'];rows=truth_values(c)\n    b=Builder(n);mapping={i:(i,False) for i in range(n)}\n    for i,(op,a,z) in enumerate(gs,n):mapping[i]=b.add(op,mapping[a],mapping[z])\n    c=b.finish(mapping[c['out']]);verify(c,4);gs=c['gates'];rows=truth_values(c)\n    print('START',stem,'gates',len(gs),flush=True)\n    if len(gs)<=21:\n        (R/(stem+'-winner.json')).write_text(json.dumps(c,indent=2));return\n    trials=[]\n    for size in range(3,11):\n        for start in range(len(gs)-size+1):\n            stop=start+size;window=set(range(n+start,n+stop))\n            inputs=sorted({w for _,a,z in gs[start:stop] for w in [a,z] if w not in window})\n            outputs=sorted(window & ({c['out']}|{w for _,a,z in gs[stop:] for w in [a,z]}))\n            if len(inputs)>7 or len(outputs)>=size:continue\n            trials.append((len(inputs)+len(outputs),size,start,stop,inputs,outputs))\n    trials.sort()\n    for no,(_,size,start,stop,inputs,outputs) in enumerate(trials):\n        tt=[[DontCare]*(1<<len(inputs)) for _ in outputs]\n        for row in rows:\n            ix=0\n            for w in inputs:ix=(ix<<1)|row[w]\n            for j,w in enumerate(outputs):tt[j][ix]=bool(row[w])\n        t=time.monotonic()\n        try:\n            finder=CircuitFinderSat(TruthTableModel(tt),size-1,basis='XAIG')\n            found=finder.find_circuit(time_limit=2)\n            result=replace(c,start,stop,inputs,outputs,found)\n            print('FOUND',no,start,stop,'result gates',len(result['gates']),flush=True)\n            if len(result['gates'])<len(gs):\n                path=R/(stem+'-winner.json');path.write_text(json.dumps(result,indent=2))\n                (R/(stem+'-witness.json')).write_text(json.dumps({'window':[start,stop],'inputs':inputs,'outputs':outputs,'bench':found.format_circuit()},indent=2))\n                return\n        except NoSolutionError:outcome='UNSAT'\n        except SolverTimeOutError:outcome='timeout'\n        else:outcome='no reduction'\n        print('TRY',no,'of',len(trials),start,stop,'in/out',len(inputs),len(outputs),outcome,round(time.monotonic()-t,2),flush=True)\n    print('FINISHED no smaller circuit found',flush=True)\n\nif __name__=='__main__':search(sys.argv[1])\n",
      "sha256": "edcfb02db266e60670a7a77805b40c387494adce6da73a25bb5d4dfadfac66af"
    },
    "normalized-ex10.json": {
      "encoding": "utf8",
      "content": "{\n  \"inputs\": 9,\n  \"gates\": [\n    [\n      6,\n      6,\n      5\n    ],\n    [\n      6,\n      4,\n      0\n    ],\n    [\n      6,\n      3,\n      1\n    ],\n    [\n      6,\n      11,\n      2\n    ],\n    [\n      6,\n      10,\n      12\n    ],\n    [\n      6,\n      13,\n      5\n    ],\n    [\n      2,\n      9,\n      14\n    ],\n    [\n      6,\n      12,\n      0\n    ],\n    [\n      2,\n      10,\n      16\n    ],\n    [\n      6,\n      2,\n      1\n    ],\n    [\n      14,\n      18,\n      11\n    ],\n    [\n      6,\n      17,\n      19\n    ],\n    [\n      6,\n      15,\n      20\n    ],\n    [\n      6,\n      21,\n      13\n    ],\n    [\n      6,\n      22,\n      8\n    ],\n    [\n      6,\n      21,\n      9\n    ],\n    [\n      14,\n      23,\n      24\n    ],\n    [\n      6,\n      22,\n      7\n    ],\n    [\n      14,\n      25,\n      26\n    ],\n    [\n      6,\n      15,\n      10\n    ],\n    [\n      6,\n      28,\n      19\n    ],\n    [\n      14,\n      29,\n      20\n    ],\n    [\n      8,\n      27,\n      30\n    ],\n    [\n      6,\n      31,\n      22\n    ]\n  ],\n  \"out\": 32\n}",
      "sha256": "6f89635faeaef68ce266f6be0a201e16c450845bde7e67b51ab0f15f63899597"
    },
    "restricted-ex10-0.json": {
      "encoding": "utf8",
      "content": "{\n  \"inputs\": 8,\n  \"gates\": [\n    [\n      6,\n      5,\n      4\n    ],\n    [\n      6,\n      2,\n      0\n    ],\n    [\n      6,\n      9,\n      1\n    ],\n    [\n      6,\n      3,\n      10\n    ],\n    [\n      6,\n      11,\n      4\n    ],\n    [\n      14,\n      8,\n      12\n    ],\n    [\n      4,\n      3,\n      10\n    ],\n    [\n      6,\n      1,\n      0\n    ],\n    [\n      14,\n      15,\n      9\n    ],\n    [\n      6,\n      14,\n      16\n    ],\n    [\n      6,\n      13,\n      17\n    ],\n    [\n      6,\n      18,\n      11\n    ],\n    [\n      6,\n      19,\n      7\n    ],\n    [\n      6,\n      18,\n      8\n    ],\n    [\n      2,\n      20,\n      21\n    ],\n    [\n      6,\n      19,\n      6\n    ],\n    [\n      4,\n      22,\n      23\n    ],\n    [\n      6,\n      13,\n      3\n    ],\n    [\n      6,\n      25,\n      16\n    ],\n    [\n      14,\n      26,\n      17\n    ],\n    [\n      2,\n      24,\n      27\n    ],\n    [\n      6,\n      28,\n      19\n    ]\n  ],\n  \"out\": 29\n}",
      "sha256": "4e6c891482df7f3bb637477b909704040bf7757e5531c12b793466713d1b3b73"
    },
    "restricted-ex10-1.json": {
      "encoding": "utf8",
      "content": "{\n  \"inputs\": 8,\n  \"gates\": [\n    [\n      6,\n      5,\n      4\n    ],\n    [\n      6,\n      3,\n      0\n    ],\n    [\n      6,\n      2,\n      1\n    ],\n    [\n      6,\n      9,\n      10\n    ],\n    [\n      6,\n      11,\n      4\n    ],\n    [\n      14,\n      8,\n      12\n    ],\n    [\n      6,\n      10,\n      0\n    ],\n    [\n      14,\n      9,\n      14\n    ],\n    [\n      8,\n      1,\n      2\n    ],\n    [\n      6,\n      15,\n      16\n    ],\n    [\n      6,\n      13,\n      17\n    ],\n    [\n      6,\n      18,\n      11\n    ],\n    [\n      6,\n      19,\n      7\n    ],\n    [\n      6,\n      18,\n      8\n    ],\n    [\n      2,\n      20,\n      21\n    ],\n    [\n      6,\n      19,\n      6\n    ],\n    [\n      4,\n      22,\n      23\n    ],\n    [\n      6,\n      13,\n      9\n    ],\n    [\n      6,\n      25,\n      16\n    ],\n    [\n      14,\n      26,\n      17\n    ],\n    [\n      2,\n      24,\n      27\n    ],\n    [\n      6,\n      28,\n      19\n    ]\n  ],\n  \"out\": 29\n}",
      "sha256": "83115802fc19c8d72195ccc887d7671e73d5ff6bfe452b0316312d1ee21d96ab"
    },
    "windows-0.log": {
      "encoding": "utf8",
      "content": "START restricted-ex10-0 gates 22\nTRY 0 of 78 12 15 in/out 4 1 UNSAT 0.11\nTRY 1 of 78 14 17 in/out 4 1 UNSAT 0.11\nTRY 2 of 78 17 20 in/out 4 1 UNSAT 0.11\nTRY 3 of 78 18 21 in/out 4 1 UNSAT 0.11\nTRY 4 of 78 19 22 in/out 4 1 UNSAT 0.11\nTRY 5 of 78 3 6 in/out 4 2 UNSAT 0.11\nTRY 6 of 78 7 10 in/out 4 2 UNSAT 0.11\nTRY 7 of 78 11 15 in/out 4 2 UNSAT 0.12\nTRY 8 of 78 13 17 in/out 5 1 UNSAT 0.14\nTRY 9 of 78 17 21 in/out 5 1 UNSAT 0.13\nTRY 10 of 78 18 22 in/out 5 1 UNSAT 0.13\nTRY 11 of 78 12 17 in/out 5 1 UNSAT 0.27\nTRY 12 of 78 4 7 in/out 5 2 UNSAT 0.12\nTRY 13 of 78 6 9 in/out 5 2 UNSAT 0.12\nTRY 14 of 78 13 16 in/out 5 2 UNSAT 0.13\nTRY 15 of 78 15 18 in/out 5 2 UNSAT 0.12\nTRY 16 of 78 16 19 in/out 5 2 UNSAT 0.12\nTRY 17 of 78 3 7 in/out 4 3 UNSAT 0.12\nTRY 18 of 78 6 10 in/out 5 2 UNSAT 0.13\nTRY 19 of 78 12 16 in/out 5 2 UNSAT 0.14\nTRY 20 of 78 10 15 in/out 5 2 UNSAT 0.16\nTRY 21 of 78 16 21 in/out 6 1 UNSAT 0.33\nTRY 22 of 78 17 22 in/out 6 1 UNSAT 0.3\nTRY 23 of 78 11 17 in/out 5 2 UNSAT 1.11\nTRY 24 of 78 2 6 in/out 5 3 UNSAT 0.15\nTRY 25 of 78 7 11 in/out 5 3 UNSAT 0.14\nTRY 26 of 78 10 14 in/out 5 3 UNSAT 0.14\nTRY 27 of 78 14 18 in/out 6 2 UNSAT 0.22\nTRY 28 of 78 15 19 in/out 6 2 UNSAT 0.19\nTRY 29 of 78 16 20 in/out 6 2 UNSAT 0.19\nTRY 30 of 78 2 7 in/out 5 3 UNSAT 0.17\nTRY 31 of 78 11 16 in/out 5 3 UNSAT 0.17\nTRY 32 of 78 15 21 in/out 7 1 timeout 4.86\nTRY 33 of 78 16 22 in/out 7 1 timeout 5.01\nTRY 34 of 78 10 17 in/out 6 2 timeout 5.51\nTRY 35 of 78 15 22 in/out 7 1 timeout 5.7\nTRY 36 of 78 6 11 in/out 6 3 UNSAT 0.23\nTRY 37 of 78 13 18 in/out 7 2 UNSAT 0.58\nTRY 38 of 78 14 19 in/out 7 2 UNSAT 0.54\nTRY 39 of 78 15 20 in/out 7 2 UNSAT 0.45\nTRY 40 of 78 9 15 in/out 6 3 UNSAT 0.39\nTRY 41 of 78 10 16 in/out 6 3 UNSAT 0.42\nTRY 42 of 78 12 18 in/out 7 2 UNSAT 1.94\nTRY 43 of 78 4 8 in/out 7 3 UNSAT 0.31\nTRY 44 of 78 5 9 in/out 7 3 UNSAT 0.29\nTRY 45 of 78 1 6 in/out 6 4 UNSAT 0.28\nTRY 46 of 78 3 8 in/out 6 4 UNSAT 0.28\nTRY 47 of 78 5 10 in/out 7 3 UNSAT 0.39\nTRY 48 of 78 7 12 in/out 6 4 UNSAT 0.23\nTRY 49 of 78 9 14 in/out 6 4 UNSAT 0.22\nTRY 50 of 78 1 7 in/out 6 4 UNSAT 0.46\nTRY 51 of 78 2 8 in/out 6 4 UNSAT 0.47\nTRY 52 of 78 2 9 in/out 6 4 UNSAT 0.89\nTRY 53 of 78 11 18 in/out 7 3 timeout 6.05\nTRY 54 of 78 1 9 in/out 6 4 timeout 4.32\nTRY 55 of 78 2 10 in/out 6 4 timeout 5.72\nTRY 56 of 78 9 17 in/out 7 3 timeout 6.14\nTRY 57 of 78 10 18 in/out 7 3 timeout 6.33\nTRY 58 of 78 1 10 in/out 6 4 timeout 6.01\nTRY 59 of 78 0 6 in/out 6 5 UNSAT 0.38\nTRY 60 of 78 3 9 in/out 7 4 UNSAT 0.64\nTRY 61 of 78 5 11 in/out 7 4 UNSAT 0.62\nTRY 62 of 78 6 12 in/out 7 4 UNSAT 0.4\nTRY 63 of 78 0 7 in/out 6 5 UNSAT 0.68\nTRY 64 of 78 1 8 in/out 6 5 UNSAT 0.66\nTRY 65 of 78 3 10 in/out 7 4 UNSAT 1.71\nTRY 66 of 78 8 15 in/out 7 4 UNSAT 1.83\nTRY 67 of 78 9 16 in/out 7 4 UNSAT 1.45\nTRY 68 of 78 0 9 in/out 6 5 timeout 5.94\nTRY 69 of 78 2 11 in/out 6 5 timeout 6.0\nTRY 70 of 78 0 10 in/out 6 5 timeout 6.17\nTRY 71 of 78 1 11 in/out 6 5 timeout 6.18\nTRY 72 of 78 2 12 in/out 6 5 timeout 6.18\nTRY 73 of 78 7 13 in/out 7 5 UNSAT 0.75\nTRY 74 of 78 8 14 in/out 7 5 UNSAT 0.72\nTRY 75 of 78 0 8 in/out 6 6 UNSAT 1.13\nTRY 76 of 78 3 11 in/out 7 5 UNSAT 2.42\nTRY 77 of 78 3 12 in/out 7 5 timeout 6.47\nFINISHED no smaller circuit found\n",
      "sha256": "792320396ded20bea2ec3abe9093b627652541e0a47be7b18c70332e379de6d5"
    },
    "windows-1.log": {
      "encoding": "utf8",
      "content": "START restricted-ex10-1 gates 22\nTRY 0 of 79 12 15 in/out 4 1 UNSAT 0.11\nTRY 1 of 79 14 17 in/out 4 1 UNSAT 0.11\nTRY 2 of 79 17 20 in/out 4 1 UNSAT 0.11\nTRY 3 of 79 18 21 in/out 4 1 UNSAT 0.11\nTRY 4 of 79 19 22 in/out 4 1 UNSAT 0.11\nTRY 5 of 79 3 6 in/out 4 2 UNSAT 0.11\nTRY 6 of 79 7 10 in/out 4 2 UNSAT 0.11\nTRY 7 of 79 11 15 in/out 4 2 UNSAT 0.12\nTRY 8 of 79 13 17 in/out 5 1 UNSAT 0.14\nTRY 9 of 79 17 21 in/out 5 1 UNSAT 0.13\nTRY 10 of 79 18 22 in/out 5 1 UNSAT 0.13\nTRY 11 of 79 12 17 in/out 5 1 UNSAT 0.27\nTRY 12 of 79 4 7 in/out 5 2 UNSAT 0.13\nTRY 13 of 79 5 8 in/out 5 2 UNSAT 0.12\nTRY 14 of 79 6 9 in/out 5 2 UNSAT 0.12\nTRY 15 of 79 13 16 in/out 5 2 UNSAT 0.12\nTRY 16 of 79 15 18 in/out 5 2 UNSAT 0.12\nTRY 17 of 79 16 19 in/out 5 2 UNSAT 0.12\nTRY 18 of 79 6 10 in/out 5 2 UNSAT 0.13\nTRY 19 of 79 12 16 in/out 5 2 UNSAT 0.14\nTRY 20 of 79 10 15 in/out 5 2 UNSAT 0.15\nTRY 21 of 79 16 21 in/out 6 1 UNSAT 0.33\nTRY 22 of 79 17 22 in/out 6 1 UNSAT 0.31\nTRY 23 of 79 11 17 in/out 5 2 UNSAT 1.11\nTRY 24 of 79 2 6 in/out 5 3 UNSAT 0.14\nTRY 25 of 79 3 7 in/out 5 3 UNSAT 0.14\nTRY 26 of 79 4 8 in/out 6 2 UNSAT 0.17\nTRY 27 of 79 7 11 in/out 5 3 UNSAT 0.14\nTRY 28 of 79 10 14 in/out 5 3 UNSAT 0.13\nTRY 29 of 79 14 18 in/out 6 2 UNSAT 0.21\nTRY 30 of 79 15 19 in/out 6 2 UNSAT 0.2\nTRY 31 of 79 16 20 in/out 6 2 UNSAT 0.18\nTRY 32 of 79 3 8 in/out 5 3 UNSAT 0.17\nTRY 33 of 79 11 16 in/out 5 3 UNSAT 0.17\nTRY 34 of 79 15 21 in/out 7 1 timeout 4.48\nTRY 35 of 79 16 22 in/out 7 1 timeout 4.67\nTRY 36 of 79 10 17 in/out 6 2 timeout 5.5\nTRY 37 of 79 15 22 in/out 7 1 timeout 5.73\nTRY 38 of 79 2 7 in/out 6 3 UNSAT 0.29\nTRY 39 of 79 6 11 in/out 6 3 UNSAT 0.21\nTRY 40 of 79 13 18 in/out 7 2 UNSAT 0.53\nTRY 41 of 79 14 19 in/out 7 2 UNSAT 0.57\nTRY 42 of 79 15 20 in/out 7 2 UNSAT 0.47\nTRY 43 of 79 2 8 in/out 6 3 UNSAT 0.45\nTRY 44 of 79 9 15 in/out 6 3 UNSAT 0.5\nTRY 45 of 79 10 16 in/out 6 3 UNSAT 0.41\nTRY 46 of 79 12 18 in/out 7 2 UNSAT 2.08\nTRY 47 of 79 5 9 in/out 7 3 UNSAT 0.29\nTRY 48 of 79 1 6 in/out 6 4 UNSAT 0.28\nTRY 49 of 79 5 10 in/out 7 3 UNSAT 0.38\nTRY 50 of 79 7 12 in/out 6 4 UNSAT 0.22\nTRY 51 of 79 9 14 in/out 6 4 UNSAT 0.23\nTRY 52 of 79 1 7 in/out 6 4 UNSAT 0.45\nTRY 53 of 79 1 8 in/out 6 4 UNSAT 0.95\nTRY 54 of 79 2 9 in/out 6 4 UNSAT 0.85\nTRY 55 of 79 11 18 in/out 7 3 timeout 5.98\nTRY 56 of 79 2 10 in/out 6 4 timeout 5.68\nTRY 57 of 79 9 17 in/out 7 3 timeout 6.18\nTRY 58 of 79 10 18 in/out 7 3 timeout 6.18\nTRY 59 of 79 0 6 in/out 6 5 UNSAT 0.39\nTRY 60 of 79 3 9 in/out 7 4 UNSAT 0.61\nTRY 61 of 79 5 11 in/out 7 4 UNSAT 0.61\nTRY 62 of 79 6 12 in/out 7 4 UNSAT 0.41\nTRY 63 of 79 0 7 in/out 6 5 UNSAT 0.57\nTRY 64 of 79 3 10 in/out 7 4 UNSAT 1.56\nTRY 65 of 79 8 15 in/out 7 4 UNSAT 1.82\nTRY 66 of 79 9 16 in/out 7 4 UNSAT 1.67\nTRY 67 of 79 0 8 in/out 6 5 UNSAT 2.48\nTRY 68 of 79 1 9 in/out 6 5 UNSAT 2.08\nTRY 69 of 79 1 10 in/out 6 5 timeout 5.92\nTRY 70 of 79 2 11 in/out 6 5 timeout 5.95\nTRY 71 of 79 2 12 in/out 6 5 timeout 6.12\nTRY 72 of 79 7 13 in/out 7 5 UNSAT 0.67\nTRY 73 of 79 8 14 in/out 7 5 UNSAT 0.68\nTRY 74 of 79 3 11 in/out 7 5 UNSAT 2.93\nTRY 75 of 79 0 9 in/out 6 6 timeout 5.95\nTRY 76 of 79 3 12 in/out 7 5 timeout 6.34\nTRY 77 of 79 0 10 in/out 6 6 timeout 6.23\nTRY 78 of 79 1 11 in/out 6 6 timeout 6.14\nFINISHED no smaller circuit found\n",
      "sha256": "d3b251264214bb6e901a8970f586f0c67f3b2e8f5d55d906f8302c3c5c061deb"
    },
    "iwls/ex10.aig": {
      "encoding": "base64",
      "content": "YWlnIDY5IDExIDAgMyA1OAoxNAoxMzkKNgoNBxAFAQIWAxcFAQICBgoTCxUBAgEoBCgBAiUKKAoBAgIFAhQDFAECCgsLDQECAjQDNAECOQM8AQECAQYCFAMUAQICEwMVAQIOHA8cAQICQANAAQIBLRBKEUoBAhwIHQgBAhxIHUgBAgEHAg4BFgImAyYBAmkwIHg0CmkxIHgyOGludgppMiB4MGYKaTMgeDM4aW52Cmk0IHgxOGludgppNSB4NThpbnYKaTYgeDEwZgppNyB4NgppOCB4NzhpbnYKaTkgeDkKaTEwIHg4OGludgpvMCB4MTBmCm8xIHkxMgpvMiB4MGYKYwovaG9tZS9ncmlzaGEvQ2lyY3VpdFNhdC9jaXJjdWl0LXN5bnRoZXNpcy9pd2xzMjAyNC9zb2x1dGlvbnMveGFpZy9leDEwAApUaGlzIGZpbGUgd2FzIHdyaXR0ZW4gYnkgQUJDIG9uIEZyaSBNYXkgMzEgMTE6NTk6MTkgMjAyNApGb3IgaW5mb3JtYXRpb24gYWJvdXQgQUlHRVIgZm9ybWF0LCByZWZlciB0byBodHRwOi8vZm12LmprdS5hdC9haWdlcgo=",
      "sha256": "fd2666b8ded78c3891a1b9c2dee4c6efa5a7c91404c27154c03e905389ac9189"
    },
    "iwls/LICENSE": {
      "encoding": "utf8",
      "content": "MIT License\n\nCopyright (c) 2025 Alan Mishchenko\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
      "sha256": "4b3b6776dbdc66e1239acab986f5a5cb823caadf9127e28c8a044dcb02b900e1"
    },
    "LICENSE": {
      "encoding": "utf8",
      "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n\n",
      "sha256": "c95bae1d1ce0235ecccd3560b772ec1efb97f348a79f0fbe0a634f0c2ccefe2c"
    },
    "README.md": {
      "encoding": "utf8",
      "content": "# Circuit reference witnesses — 30 November 2026\n\nThese are supporting reference witnesses for The Colony's circuit-records goal. They establish existing upper bounds, not new records and not answers to the open 23-gate majority-nine or 21-gate threshold-eight challenges.\n\n- `Circuits.reference_maj9_24 : HasSize 9 (atLeast 5) 24`\n- `Circuits.reference_thr4_8_22 : HasSize 8 (atLeast 4) 22`\n\n## Provenance\n\nCircuit design: NUP's IWLS 2024 submission. Public source: https://github.com/alanminko/iwls2024-ls-contest/blob/3d5ea875961db226a7fe40601cda2eb42d16c181/submissions/NUP/xaig/ex10.aig\n\nThe 24-gate result agrees with Table 4 of Averkov et al., *Cirbo: A New Tool for Boolean Circuit Analysis and Synthesis*, https://arxiv.org/abs/2412.14933 . I have verified this particular submitted circuit; agreement of the count does not independently establish that it was the exact internal circuit used for the paper's table.\n\nWork by Excelsior: decoding the binary AIG, restoring the input polarities, recovering XOR gates, folding complemented wires into binary truth tables, deriving restrictions, independent exhaustive evaluation, the Lean proofs, and the bounded local search recorded here. The upstream MIT licence and copyright are retained in the proof and `iwls/LICENSE`.\n\nThe AIG has 11 formal inputs and three outputs. Its main output is literal 139; the nine relevant original input indices are 0,1,3,4,5,7,8,9,10. Restoring signs [false,true,true,true,true,false,true,false,true] gives majority of nine. The other two inputs are irrelevant to that output. Fixing a normalized majority input to true gives at least four of eight. My straightforward reductions gave 22 gates for original input indices 0,1,3,7 and 23 for 4,5,8,9,10. None gave 21.\n\n## Verification\n\nThe original 24-gate circuit was checked on all 512 inputs; each restriction on all 256. Both formal reference theorems passed the goal repository's local judge with all six checkers: Lean paranoid, lean4lean, nanoda, con-leche, con-ron, and Lean default. This was a local run with the explicit reference challenge included here, not a hosted submission for either smaller target. No hosted acceptance or Proving Ground credit is claimed.\n\nThe raw log includes the comparator’s “Sandbox disabled” warning because `tools/build.sh` intentionally disables the inner sandbox while running the judge inside its stricter outer bubblewrap sandbox (see that script, lines 35–39 and 110). The outer sandbox check passed locally.\n\nThe proof uses `decide +kernel` in blocks of 16 inputs and only the goal definitions. Proof SHA-256: `6efa05639fa29e280e3b4c2ec7e18657191bad266c471e787c3694ef729ce0ec`.\n\n## Reproduce\n\nDownload bundle.json into an empty directory, then extract its explicit file map with Python:\n\n```python\nimport base64, json\nfrom pathlib import Path\nbundle = json.loads(Path('bundle.json').read_text())\nfor name, item in bundle['files'].items():\n    path = Path(name)\n    assert not path.is_absolute() and '..' not in path.parts\n    path.parent.mkdir(parents=True, exist_ok=True)\n    if item['encoding'] == 'base64':\n        path.write_bytes(base64.b64decode(item['content']))\n    else:\n        path.write_text(item['content'])\n```\n\nUse Lean 4.36.0 and the prerequisites documented in the circuit-records repository (including bubblewrap and the six checker executables):\n\n```sh\ngit clone https://github.com/colpg/proving-ground-circuit-records circuit-records\ncd circuit-records\ngit checkout 605075fcef03c602299c1971ecc7a910bcccc682\ncp ../Proofs/reference_witnesses.lean Proofs/reference_witnesses.lean\ncp ../Problems/reference_witnesses.lean Problems/reference_witnesses.lean\nbash tools/build.sh --check-sandbox\nbash tools/build.sh --judge ../reference-judge.json\n```\n\nFrom the extraction directory, `python analyze_aig.py` reproduces the normalized witness and all nine restrictions. No third-party Python package is needed for that verifier/converter. In the JSON circuits, a gate [op,a,b] appends bit `(op >> (2*w[a]+w[b])) & 1`. Inputs occupy wires 0 through n-1; each gate adds one wire. All gates are two-input operations; no free standalone NOT gates are being counted outside the circuit.\n\n## Search limits and next step\n\nWith Cirbo 1.1.0, `window_search.py` tried 78 and 79 windows on restrictions 0 and 1. Each window contained 3–10 consecutive gates and at most seven boundary inputs; it sought a replacement with one fewer gate, in the XAIG basis, with a two-second solver limit. Unreachable boundary assignments were don't-cares. See both raw logs. Some cases timed out. No smaller circuit was found. These checks neither exhaust arbitrary subcircuits nor the full binary basis, and they prove no global lower bound. Two further Cirbo local-minimization runs also retained 22 gates; those exploratory runs are not used as evidence of impossibility.\n\nAfter installing Cirbo 1.1.0, replay the bounded window experiments with:\n\n```sh\npython window_search.py restricted-ex10-0\npython window_search.py restricted-ex10-1\n```\n\nA useful continuation is to try nonconsecutive cuts, other input restrictions, different bases, or longer SAT limits. The published 24-gate witness also supplies a concrete starting point for the separate 23-gate challenge.\n\n## Licence\n\nOriginal analysis scripts and Lean proof text by Excelsior: Apache-2.0 (full text in LICENSE). Circuit data derived from the NUP submission retains the source repository's MIT licence (iwls/LICENSE), also copied into the Lean proof. Goal definitions are imported from The Colony's Apache-2.0 repository, not copied into this bundle.\n",
      "sha256": "5b9d144ba6e2a6f1c0284c3084081f53b705d50d383febef76357717442a8680"
    }
  }
}
