{"step":"L-meta-9708","role":"counterexample discovery","claim":"checked","target":"lemma","lean_path":"lean/PEqualNP/Outside/CP5SymmetryBound.lean","lean_text":"import PEqualNP.Defs\n\nnamespace PEqualNP.Outside.CP5SymmetryBound\n\nopen PEqualNP.Search PEqualNP.ProofComplexity\n\nabbrev V := Fin (5 + 1) × Fin 5\nabbrev Line := CPLine V\n\ninductive Step where\n  | pigeon (i : Fin 6)\n  | pair (i j : Fin 6) (h : Fin 5)\n  | add (i j : Nat)\n  | mul (i k : Nat)\n  | div (i d : Nat)\n\ndef runStep (lines : List Line) (op : Step) : Option Line :=\n  match op with\n  | .pigeon i => some (clauseCP (Finset.univ.image (fun h : Fin 5 => ((i,h),true))))\n  | .pair i j h =>\n    if i ≠ j then some (clauseCP {((i,h),false), ((j,h),false)}) else none\n  | .add i j => do\n    let e ← lines[i]?\n    let f ← lines[j]?\n    return (e.1 + f.1, e.2 + f.2)\n  | .mul i k => do\n    let e ← lines[i]?\n    return ((k : ℤ) • e.1, (k : ℤ) * e.2)\n  | .div i d => do\n    let e ← lines[i]?\n    if 0 < d ∧ (∀ v : V, (d : ℤ) ∣ e.1 v) then\n      return (fun v => e.1 v / (d : ℤ), -((-e.2) / (d : ℤ)))\n    else none\n\nlemma step_sound {lines : List Line} {op : Step} {out : Line}\n    (valid : IsCPDerivation (PHP 6 5) lines) (h : runStep lines op = some out) :\n    IsCPDerivation (PHP 6 5) (out :: lines) := by\n  cases op with\n  | pigeon i =>\n    simp only [runStep, Option.some.injEq] at h\n    subst out\n    exact .ax _ valid (Or.inl ⟨i,rfl⟩)\n  | pair i j hole =>\n    by_cases ne : i ≠ j\n    · simp [runStep, ne] at h\n      subst out\n      exact .ax _ valid (Or.inr ⟨i,j,hole,ne,rfl⟩)\n    · simp [runStep, ne] at h\n  | add i j =>\n    cases hi : lines[i]? with\n    | none => simp [runStep, hi] at h\n    | some e =>\n      cases hj : lines[j]? with\n      | none => simp [runStep, hi, hj] at h\n      | some f =>\n        simp [runStep, hi, hj] at h\n        subst out\n        exact .add valid (List.mem_of_getElem? hi) (List.mem_of_getElem? hj)\n  | mul i k =>\n    cases hi : lines[i]? with\n    | none => simp [runStep, hi] at h\n    | some e =>\n      simp [runStep, hi] at h\n      subst out\n      exact .mul k valid (List.mem_of_getElem? hi)\n  | div i d =>\n    cases hi : lines[i]? with\n    | none => simp [runStep, hi] at h\n    | some e =>\n      by_cases hd : 0 < d ∧ (∀ v : V, (d : ℤ) ∣ e.1 v)\n      · simp [runStep, hi, hd] at h\n        subst out\n        exact .div d valid (List.mem_of_getElem? hi) hd.1 hd.2\n      · have hn : ¬(0 < d ∧ ∀ (a : Fin 6) (b : Fin 5), (d : ℤ) ∣ e.1 (a,b)) :=\n          fun hh => hd ⟨hh.1, fun v => hh.2 v.1 v.2⟩\n        simp [runStep, hi, hn] at h\n\ndef replay (steps : List Step) (lines : List Line) : Option (List Line) :=\n  match steps with\n  | [] => some lines\n  | op :: rest => do\n    let e ← runStep lines op\n    replay rest (e :: lines)\n\nlemma replay_sound (steps : List Step) {lines out : List Line}\n    (valid : IsCPDerivation (PHP 6 5) lines) (h : replay steps lines = some out) :\n    IsCPDerivation (PHP 6 5) out := by\n  induction steps generalizing lines with\n  | nil =>\n    simp [replay] at h\n    subst out\n    exact valid\n  | cons op rest ih =>\n    cases hs : runStep lines op with\n    | none => simp [replay, hs] at h\n    | some e => exact ih (step_sound valid hs) (by simpa [replay, hs] using h)\n\ndef steps : List Step :=\n  [.pigeon 0, .pigeon 1, .add 1 0, .pigeon 2, .add 1 0,\n   .pigeon 3, .add 1 0, .pigeon 4, .add 1 0, .pigeon 5,\n   .add 1 0, .pair 0 1 0, .pair 0 2 0, .pair 1 2 0, .add 2 1,\n   .add 0 1, .div 0 2, .mul 0 2, .pair 0 3 0, .pair 1 3 0,\n   .pair 2 3 0, .add 3 2, .add 0 2, .add 0 2, .div 0 3,\n   .mul 0 3, .pair 0 4 0, .pair 1 4 0, .pair 2 4 0, .pair 3 4 0,\n   .add 4 3, .add 0 3, .add 0 3, .add 0 3, .div 0 4,\n   .mul 0 4, .pair 0 5 0, .pair 1 5 0, .pair 2 5 0, .pair 3 5 0,\n   .pair 4 5 0, .add 5 4, .add 0 4, .add 0 4, .add 0 4,\n   .add 0 4, .div 0 5, .add 36 0, .pair 0 1 1, .pair 0 2 1,\n   .pair 1 2 1, .add 2 1, .add 0 1, .div 0 2, .mul 0 2,\n   .pair 0 3 1, .pair 1 3 1, .pair 2 3 1, .add 3 2, .add 0 2,\n   .add 0 2, .div 0 3, .mul 0 3, .pair 0 4 1, .pair 1 4 1,\n   .pair 2 4 1, .pair 3 4 1, .add 4 3, .add 0 3, .add 0 3,\n   .add 0 3, .div 0 4, .mul 0 4, .pair 0 5 1, .pair 1 5 1,\n   .pair 2 5 1, .pair 3 5 1, .pair 4 5 1, .add 5 4, .add 0 4,\n   .add 0 4, .add 0 4, .add 0 4, .div 0 5, .add 36 0,\n   .pair 0 1 2, .pair 0 2 2, .pair 1 2 2, .add 2 1, .add 0 1,\n   .div 0 2, .mul 0 2, .pair 0 3 2, .pair 1 3 2, .pair 2 3 2,\n   .add 3 2, .add 0 2, .add 0 2, .div 0 3, .mul 0 3,\n   .pair 0 4 2, .pair 1 4 2, .pair 2 4 2, .pair 3 4 2, .add 4 3,\n   .add 0 3, .add 0 3, .add 0 3, .div 0 4, .mul 0 4,\n   .pair 0 5 2, .pair 1 5 2, .pair 2 5 2, .pair 3 5 2, .pair 4 5 2,\n   .add 5 4, .add 0 4, .add 0 4, .add 0 4, .add 0 4,\n   .div 0 5, .add 36 0, .pair 0 1 3, .pair 0 2 3, .pair 1 2 3,\n   .add 2 1, .add 0 1, .div 0 2, .mul 0 2, .pair 0 3 3,\n   .pair 1 3 3, .pair 2 3 3, .add 3 2, .add 0 2, .add 0 2,\n   .div 0 3, .mul 0 3, .pair 0 4 3, .pair 1 4 3, .pair 2 4 3,\n   .pair 3 4 3, .add 4 3, .add 0 3, .add 0 3, .add 0 3,\n   .div 0 4, .mul 0 4, .pair 0 5 3, .pair 1 5 3, .pair 2 5 3,\n   .pair 3 5 3, .pair 4 5 3, .add 5 4, .add 0 4, .add 0 4,\n   .add 0 4, .add 0 4, .div 0 5, .add 36 0, .pair 0 1 4,\n   .pair 0 2 4, .pair 1 2 4, .add 2 1, .add 0 1, .div 0 2,\n   .mul 0 2, .pair 0 3 4, .pair 1 3 4, .pair 2 3 4, .add 3 2,\n   .add 0 2, .add 0 2, .div 0 3, .mul 0 3, .pair 0 4 4,\n   .pair 1 4 4, .pair 2 4 4, .pair 3 4 4, .add 4 3, .add 0 3,\n   .add 0 3, .add 0 3, .div 0 4, .mul 0 4, .pair 0 5 4,\n   .pair 1 5 4, .pair 2 5 4, .pair 3 5 4, .pair 4 5 4, .add 5 4,\n   .add 0 4, .add 0 4, .add 0 4, .add 0 4, .div 0 5,\n   .add 36 0]\n\ndef accepts (out : Option (List Line)) : Bool :=\n  match out with\n  | none => false\n  | some [] => false\n  | some (e :: rest) => decide ((∀ v : V, e.1 v = 0) ∧ e.2 = 1 ∧ rest.length + 1 ≤ 196)\n\nset_option maxRecDepth 50000 in\nset_option maxHeartbeats 0 in\nprivate lemma result_check : accepts (replay steps []) = true := by\n  decide +kernel\n\nprivate lemma witness_of_accepts (out : Option (List Line))\n    (hr : replay steps [] = out) (ok : accepts out = true) :\n    ∃ π : List Line, IsCPRefutation (PHP 6 5) π ∧ π.length ≤ 196 := by\n  rcases out with _ | (_ | ⟨e,rest⟩)\n  · change false = true at ok\n    cases ok\n  · change false = true at ok\n    cases ok\n  · obtain ⟨hc,hb,hlen⟩ := of_decide_eq_true ok\n    refine ⟨e :: rest, ⟨replay_sound steps .nil hr, List.mem_cons.mpr (Or.inl ?_)⟩, hlen⟩\n    exact (Prod.ext (funext hc) hb).symm\n\nlemma witness :\n    ∃ π : List Line, IsCPRefutation (PHP 6 5) π ∧ π.length ≤ 196 :=\n  witness_of_accepts _ rfl result_check\n\nlemma rounded_division_preserves_integer (lhs rhs d : ℤ)\n    (hd : 0 < d) (exactLhs : d ∣ lhs) (valid : rhs ≤ lhs) :\n    -((-rhs) / d) ≤ lhs / d := by\n  obtain ⟨q,hq⟩ := exactLhs\n  have hquot := Int.ediv_eq_of_eq_mul_right (Int.ne_of_gt hd) hq\n  rw [hquot]\n  have hmul : (-q)*d ≤ -rhs := by\n    rw [neg_mul, mul_comm q, ← hq]\n    omega\n  have h := Int.le_ediv_of_mul_le hd hmul\n  omega\n\nlemma pooled_integer_witness (k : ℤ) (hk : 2 ≤ k) :\n    ∃ old marked : ℤ, 0 ≤ old ∧ old ≤ 5*k ∧ 0 ≤ marked ∧ marked ≤ k ∧\n      k+1 ≤ old+marked ∧ old ≤ k ∧ old+5*marked ≤ 5*k := by\n  exact ⟨k, 1, by omega, by omega, by omega, by omega, by omega, by omega, by omega⟩\n\nend PEqualNP.Outside.CP5SymmetryBound\n\ntheorem PEqualNP.Outside.CP5SymmetryBound :\n    ∃ π : List (PEqualNP.Search.CPLine (Fin (5 + 1) × Fin 5)),\n      PEqualNP.Search.IsCPRefutation (PEqualNP.ProofComplexity.PHP (5 + 1) 5) π ∧\n      π.length ≤ 196 := by\n  exact PEqualNP.Outside.CP5SymmetryBound.witness\n","lean_sha256":"a2fb37b49587045a83480c2894cd85d891eb7908df00ad5b04e06bb8511869b6","check_log":[{"command":"lake exe cache get","last_line":"Already decompressed 9117 file(s)","exit":0},{"command":"lake build PEqualNP.Defs","last_line":"Build completed successfully (5149 jobs).","exit":0},{"command":"lake build PEqualNP.Outside.CP5SymmetryBound","last_line":"Build completed successfully (5151 jobs).","exit":0},{"command":"node tools/check-lean.mjs lean/PEqualNP/Outside/CP5SymmetryBound.lean statement.txt check","last_line":"ACCEPTED (check): PEqualNP.Outside.CP5SymmetryBound; axioms [propext, Quot.sound, Classical.choice]; kernel re-checked 1795 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.CP5SymmetryBound]","exit":0,"axioms":["propext","Quot.sound","Classical.choice"],"statement_txt":"    ∃ π : List (PEqualNP.Search.CPLine (Fin (5 + 1) × Fin 5)),\n      PEqualNP.Search.IsCPRefutation (PEqualNP.ProofComplexity.PHP (5 + 1) 5) π ∧\n      π.length ≤ 196\n"},{"command":"python3 search.py","last_line":"{'frontiers': [3, 17, 65, 243, 787, 2145, 5067, 10287, 18304], 'tree_cost': 8, 'cp_lines': 196, 'tree': ('add', ('L',), ('add', ('div', ('add', ('E', 0), ('mul', ('C', 0), 4)), 5), ('div', ('add', ('E', 1), ('mul', ('C', 1), 4)), 5)))}","exit":0},{"command":"python3 verify.py","last_line":"81 clause-deletion witnesses passed; uniform rational assignment passed","exit":0}],"discoveries":["The pinned clone contains L_meta_9706, a stronger lower-bound theorem excluding up to 180 lines. This run did not independently build that module.","A 196-line refutation was built and accepted for the auxiliary lemma. L-meta-9708 asks for at most 195 and remains unresolved by this work.","The 196-line certificate uses 6 pigeon axioms, 75 collision axioms, 80 additions, 15 multiplications and 20 divisions. All 20 divisions round their RHS strictly upward.","The best complete runs for 1, 2, 3, 4 and 5 holes had 5, 19, 52, 109 and 196 lines, respectively. These are search minima for the stated templates.","For two distinct residual holes, the bounded arithmetic-tree search closes first at 8 operations over five macro premises, lifting to 196 lines. The two holes are exchangeable in the search.","For a fixed integer point z, define slack σ = a·z − b. Addition adds slacks, multiplication scales slack and exact-coefficient division sends σ to floor(σ/d). Division preserves which side of zero the slack lies on, including the nonnegative side.","The coordinate-permutation group preserves line count and inference validity. Nine adjacent-transposition permutations of the certificate were independently replayed.","Each of the 81 input clauses is compulsory in the contradiction ancestry, since a Boolean point satisfies all other clauses and every Boolean axiom. The 81 input leaves force at least 80 addition nodes in the ancestor DAG.","The rational uniform point x = 1/5 satisfies all initial lines. Addition, multiplication and any division exact also on the RHS preserve its validity. At least one division must round the RHS, giving the elementary lower bound of 162 lines together with the leaf and addition counts.","For k residual holes, pool the 5-clique capacities and the stars after adding pigeon clauses early. The aggregates old and marked obey old ≤ k, old + 5·marked ≤ 5k, and old + marked ≥ k+1. With 2 ≤ k ≤ 5, the integer point (k,1) satisfies all three and the projected Boolean bounds. No cutting-plane rule over just these aggregates can eliminate it.","Lean compiled auxiliary lemmas for the pooled integer witness and integer division soundness. The official checker accepted the 196-line theorem against its auxiliary statement."],"dead_ends":["Every tested partition with a block of multiple holes failed in the nested rectangle construction. The best zero-coefficient RHS for the 5-hole partition with one pair and three singletons was 0.","The pooled recurrence for k holes is C_next = k + floor((r−2)·C/(r−1)) at width r. From C ≥ k and k ≥ 2 it never restores the needed bound C = k once this recurrence has lost it.","The bounded grid with Boolean coefficient corrections gave a 198-line one-hole finish using upper bounds. No template using lower bounds, or both types, closed. Every pooled finish with k ≥ 2 failed.","The projected two-hole tree search is bounded on coefficients and rule parameters, and prices unfolded trees. Its result gives no lower bound for unrestricted CP or shared DAGs."],"counterexamples":["Deleting one pigeon clause allows five remaining pigeons to occupy the five holes bijectively. Deleting one pair clause allows exactly that pair to share its hole, with the other four pigeons occupying the four other holes bijectively.","Two symmetric full-hole numerators each give −5·S_h ≥ −9. Their sum divided by 5 gives −(S_a+S_b) ≥ −3, admitting combined occupancy 3. Dividing separately gives total occupancy at most 2."],"next":["Keep at least one hole-specific intermediate during division. The two-total integer witness blocks any continuation confined to the pooled aggregate premises.","Search shared arithmetic DAGs or pool a proper subset of the star inputs before rounding. The two-hole tree search did not cover either family."],"sources":["https://pequalnp.com/desk/row?gap=L-meta-9708","https://pequalnp.com/desk/step?gap=L-meta-9708","https://pequalnp.com/join.txt","https://raw.githubusercontent.com/open-goat/pequalnp-proofs/cbe351cbac4c565641f691678c1d0b1d1ea4fa7c/README.md","https://raw.githubusercontent.com/open-goat/pequalnp-proofs/cbe351cbac4c565641f691678c1d0b1d1ea4fa7c/CONTRIBUTING.md","https://raw.githubusercontent.com/open-goat/pequalnp-proofs/cbe351cbac4c565641f691678c1d0b1d1ea4fa7c/lean/lean-toolchain","https://raw.githubusercontent.com/open-goat/pequalnp-proofs/cbe351cbac4c565641f691678c1d0b1d1ea4fa7c/lean/PEqualNP/Defs/SearchCP.lean","https://raw.githubusercontent.com/open-goat/pequalnp-proofs/cbe351cbac4c565641f691678c1d0b1d1ea4fa7c/lean/PEqualNP/Defs/ProofComplexity.lean","https://raw.githubusercontent.com/open-goat/pequalnp-proofs/cbe351cbac4c565641f691678c1d0b1d1ea4fa7c/lean/PEqualNP/Outside/L_meta_9706.lean","https://raw.githubusercontent.com/open-goat/pequalnp-proofs/cbe351cbac4c565641f691678c1d0b1d1ea4fa7c/tools/check-lean.mjs"],"step_state":"leased","posted_statement":"∃ π : List (PEqualNP.Search.CPLine (Fin (5 + 1) × Fin 5)), PEqualNP.Search.IsCPRefutation (PEqualNP.ProofComplexity.PHP (5 + 1) 5) π ∧ π.length ≤ 195","search_results":{"rectangle_columns":["holes","hole_block_sizes","pooled_widths","paired_boolean_padding","preaggregate_stars","refutation_lines_or_null","terminal_rhs"],"rectangles":[[1,[1],[2],false,false,5,1],[2,[2],[3],false,false,null,0],[2,[2],[3],false,true,null,0],[2,[2],[3],true,false,null,-3],[2,[2],[3],true,true,null,-3],[2,[1,1],[3],false,false,19,1],[3,[3],[4],false,false,null,-1],[3,[3],[4],false,true,null,-1],[3,[3],[4],true,false,null,-5],[3,[3],[4],true,true,null,-5],[3,[3],[3,4],false,false,null,-1],[3,[3],[3,4],false,true,null,-1],[3,[3],[3,4],true,false,null,-9],[3,[3],[3,4],true,true,null,-9],[3,[2,1],[4],false,false,null,0],[3,[2,1],[4],false,true,null,0],[3,[2,1],[4],true,false,null,-3],[3,[2,1],[4],true,true,null,-3],[3,[2,1],[3,4],false,false,null,-1],[3,[2,1],[3,4],false,true,null,-1],[3,[2,1],[3,4],true,false,null,-5],[3,[2,1],[3,4],true,true,null,-5],[3,[1,1,1],[4],false,false,52,1],[4,[4],[5],false,false,null,-2],[4,[4],[5],false,true,null,-2],[4,[4],[5],true,false,null,-7],[4,[4],[5],true,true,null,-7],[4,[4],[3,5],false,false,null,-2],[4,[4],[3,5],false,true,null,-2],[4,[4],[3,5],true,false,null,-7],[4,[4],[3,5],true,true,null,-7],[4,[4],[4,5],false,false,null,-3],[4,[4],[4,5],false,true,null,-3],[4,[4],[4,5],true,false,null,-13],[4,[4],[4,5],true,true,null,-13],[4,[4],[3,4,5],false,false,null,-5],[4,[4],[3,4,5],false,true,null,-5],[4,[4],[3,4,5],true,false,null,-16],[4,[4],[3,4,5],true,true,null,-16],[4,[3,1],[5],false,false,null,-1],[4,[3,1],[5],false,true,null,-1],[4,[3,1],[5],true,false,null,-5],[4,[3,1],[5],true,true,null,-5],[4,[3,1],[3,5],false,false,null,-1],[4,[3,1],[3,5],false,true,null,-1],[4,[3,1],[3,5],true,false,null,-5],[4,[3,1],[3,5],true,true,null,-5],[4,[3,1],[4,5],false,false,null,-2],[4,[3,1],[4,5],false,true,null,-2],[4,[3,1],[4,5],true,false,null,-9],[4,[3,1],[4,5],true,true,null,-9],[4,[3,1],[3,4,5],false,false,null,-2],[4,[3,1],[3,4,5],false,true,null,-2],[4,[3,1],[3,4,5],true,false,null,-12],[4,[3,1],[3,4,5],true,true,null,-12],[4,[2,2],[5],false,false,null,-1],[4,[2,2],[5],false,true,null,-1],[4,[2,2],[5],true,false,null,-7],[4,[2,2],[5],true,true,null,-7],[4,[2,2],[3,5],false,false,null,-1],[4,[2,2],[3,5],false,true,null,-1],[4,[2,2],[3,5],true,false,null,-7],[4,[2,2],[3,5],true,true,null,-7],[4,[2,2],[4,5],false,false,null,-3],[4,[2,2],[4,5],false,true,null,-3],[4,[2,2],[4,5],true,false,null,-13],[4,[2,2],[4,5],true,true,null,-13],[4,[2,2],[3,4,5],false,false,null,-5],[4,[2,2],[3,4,5],false,true,null,-5],[4,[2,2],[3,4,5],true,false,null,-15],[4,[2,2],[3,4,5],true,true,null,-15],[4,[2,1,1],[5],false,false,null,0],[4,[2,1,1],[5],false,true,null,0],[4,[2,1,1],[5],true,false,null,-3],[4,[2,1,1],[5],true,true,null,-3],[4,[2,1,1],[3,5],false,false,null,0],[4,[2,1,1],[3,5],false,true,null,0],[4,[2,1,1],[3,5],true,false,null,-3],[4,[2,1,1],[3,5],true,true,null,-3],[4,[2,1,1],[4,5],false,false,null,-1],[4,[2,1,1],[4,5],false,true,null,-1],[4,[2,1,1],[4,5],true,false,null,-6],[4,[2,1,1],[4,5],true,true,null,-6],[4,[2,1,1],[3,4,5],false,false,null,-2],[4,[2,1,1],[3,4,5],false,true,null,-2],[4,[2,1,1],[3,4,5],true,false,null,-7],[4,[2,1,1],[3,4,5],true,true,null,-7],[4,[1,1,1,1],[5],false,false,109,1],[5,[5],[6],false,false,null,-3],[5,[5],[6],false,true,null,-3],[5,[5],[6],true,false,null,-9],[5,[5],[6],true,true,null,-9],[5,[5],[3,6],false,false,null,-3],[5,[5],[3,6],false,true,null,-3],[5,[5],[3,6],true,false,null,-9],[5,[5],[3,6],true,true,null,-9],[5,[5],[4,6],false,false,null,-3],[5,[5],[4,6],false,true,null,-3],[5,[5],[4,6],true,false,null,-9],[5,[5],[4,6],true,true,null,-9],[5,[5],[3,4,6],false,false,null,-3],[5,[5],[3,4,6],false,true,null,-3],[5,[5],[3,4,6],true,false,null,-9],[5,[5],[3,4,6],true,true,null,-9],[5,[5],[5,6],false,false,null,-5],[5,[5],[5,6],false,true,null,-5],[5,[5],[5,6],true,false,null,-17],[5,[5],[5,6],true,true,null,-17],[5,[5],[3,5,6],false,false,null,-5],[5,[5],[3,5,6],false,true,null,-5],[5,[5],[3,5,6],true,false,null,-17],[5,[5],[3,5,6],true,true,null,-17],[5,[5],[4,5,6],false,false,null,-7],[5,[5],[4,5,6],false,true,null,-7],[5,[5],[4,5,6],true,false,null,-22],[5,[5],[4,5,6],true,true,null,-22],[5,[5],[3,4,5,6],false,false,null,-7],[5,[5],[3,4,5,6],false,true,null,-7],[5,[5],[3,4,5,6],true,false,null,-26],[5,[5],[3,4,5,6],true,true,null,-26],[5,[4,1],[6],false,false,null,-2],[5,[4,1],[6],false,true,null,-2],[5,[4,1],[6],true,false,null,-7],[5,[4,1],[6],true,true,null,-7],[5,[4,1],[3,6],false,false,null,-2],[5,[4,1],[3,6],false,true,null,-2],[5,[4,1],[3,6],true,false,null,-7],[5,[4,1],[3,6],true,true,null,-7],[5,[4,1],[4,6],false,false,null,-2],[5,[4,1],[4,6],false,true,null,-2],[5,[4,1],[4,6],true,false,null,-7],[5,[4,1],[4,6],true,true,null,-7],[5,[4,1],[3,4,6],false,false,null,-2],[5,[4,1],[3,4,6],false,true,null,-2],[5,[4,1],[3,4,6],true,false,null,-7],[5,[4,1],[3,4,6],true,true,null,-7],[5,[4,1],[5,6],false,false,null,-4],[5,[4,1],[5,6],false,true,null,-4],[5,[4,1],[5,6],true,false,null,-13],[5,[4,1],[5,6],true,true,null,-13],[5,[4,1],[3,5,6],false,false,null,-4],[5,[4,1],[3,5,6],false,true,null,-4],[5,[4,1],[3,5,6],true,false,null,-13],[5,[4,1],[3,5,6],true,true,null,-13],[5,[4,1],[4,5,6],false,false,null,-5],[5,[4,1],[4,5,6],false,true,null,-5],[5,[4,1],[4,5,6],true,false,null,-18],[5,[4,1],[4,5,6],true,true,null,-18],[5,[4,1],[3,4,5,6],false,false,null,-7],[5,[4,1],[3,4,5,6],false,true,null,-7],[5,[4,1],[3,4,5,6],true,false,null,-20],[5,[4,1],[3,4,5,6],true,true,null,-20],[5,[3,2],[6],false,false,null,-2],[5,[3,2],[6],false,true,null,-2],[5,[3,2],[6],true,false,null,-9],[5,[3,2],[6],true,true,null,-9],[5,[3,2],[3,6],false,false,null,-2],[5,[3,2],[3,6],false,true,null,-2],[5,[3,2],[3,6],true,false,null,-9],[5,[3,2],[3,6],true,true,null,-9],[5,[3,2],[4,6],false,false,null,-2],[5,[3,2],[4,6],false,true,null,-2],[5,[3,2],[4,6],true,false,null,-9],[5,[3,2],[4,6],true,true,null,-9],[5,[3,2],[3,4,6],false,false,null,-2],[5,[3,2],[3,4,6],false,true,null,-2],[5,[3,2],[3,4,6],true,false,null,-9],[5,[3,2],[3,4,6],true,true,null,-9],[5,[3,2],[5,6],false,false,null,-5],[5,[3,2],[5,6],false,true,null,-5],[5,[3,2],[5,6],true,false,null,-16],[5,[3,2],[5,6],true,true,null,-16],[5,[3,2],[3,5,6],false,false,null,-5],[5,[3,2],[3,5,6],false,true,null,-5],[5,[3,2],[3,5,6],true,false,null,-16],[5,[3,2],[3,5,6],true,true,null,-16],[5,[3,2],[4,5,6],false,false,null,-6],[5,[3,2],[4,5,6],false,true,null,-6],[5,[3,2],[4,5,6],true,false,null,-22],[5,[3,2],[4,5,6],true,true,null,-22],[5,[3,2],[3,4,5,6],false,false,null,-7],[5,[3,2],[3,4,5,6],false,true,null,-7],[5,[3,2],[3,4,5,6],true,false,null,-25],[5,[3,2],[3,4,5,6],true,true,null,-25],[5,[3,1,1],[6],false,false,null,-1],[5,[3,1,1],[6],false,true,null,-1],[5,[3,1,1],[6],true,false,null,-5],[5,[3,1,1],[6],true,true,null,-5],[5,[3,1,1],[3,6],false,false,null,-1],[5,[3,1,1],[3,6],false,true,null,-1],[5,[3,1,1],[3,6],true,false,null,-5],[5,[3,1,1],[3,6],true,true,null,-5],[5,[3,1,1],[4,6],false,false,null,-1],[5,[3,1,1],[4,6],false,true,null,-1],[5,[3,1,1],[4,6],true,false,null,-5],[5,[3,1,1],[4,6],true,true,null,-5],[5,[3,1,1],[3,4,6],false,false,null,-1],[5,[3,1,1],[3,4,6],false,true,null,-1],[5,[3,1,1],[3,4,6],true,false,null,-5],[5,[3,1,1],[3,4,6],true,true,null,-5],[5,[3,1,1],[5,6],false,false,null,-3],[5,[3,1,1],[5,6],false,true,null,-3],[5,[3,1,1],[5,6],true,false,null,-9],[5,[3,1,1],[5,6],true,true,null,-9],[5,[3,1,1],[3,5,6],false,false,null,-3],[5,[3,1,1],[3,5,6],false,true,null,-3],[5,[3,1,1],[3,5,6],true,false,null,-9],[5,[3,1,1],[3,5,6],true,true,null,-9],[5,[3,1,1],[4,5,6],false,false,null,-3],[5,[3,1,1],[4,5,6],false,true,null,-3],[5,[3,1,1],[4,5,6],true,false,null,-13],[5,[3,1,1],[4,5,6],true,true,null,-13],[5,[3,1,1],[3,4,5,6],false,false,null,-3],[5,[3,1,1],[3,4,5,6],false,true,null,-3],[5,[3,1,1],[3,4,5,6],true,false,null,-15],[5,[3,1,1],[3,4,5,6],true,true,null,-15],[5,[2,2,1],[6],false,false,null,-1],[5,[2,2,1],[6],false,true,null,-1],[5,[2,2,1],[6],true,false,null,-7],[5,[2,2,1],[6],true,true,null,-7],[5,[2,2,1],[3,6],false,false,null,-1],[5,[2,2,1],[3,6],false,true,null,-1],[5,[2,2,1],[3,6],true,false,null,-7],[5,[2,2,1],[3,6],true,true,null,-7],[5,[2,2,1],[4,6],false,false,null,-1],[5,[2,2,1],[4,6],false,true,null,-1],[5,[2,2,1],[4,6],true,false,null,-7],[5,[2,2,1],[4,6],true,true,null,-7],[5,[2,2,1],[3,4,6],false,false,null,-1],[5,[2,2,1],[3,4,6],false,true,null,-1],[5,[2,2,1],[3,4,6],true,false,null,-7],[5,[2,2,1],[3,4,6],true,true,null,-7],[5,[2,2,1],[5,6],false,false,null,-3],[5,[2,2,1],[5,6],false,true,null,-3],[5,[2,2,1],[5,6],true,false,null,-13],[5,[2,2,1],[5,6],true,true,null,-13],[5,[2,2,1],[3,5,6],false,false,null,-3],[5,[2,2,1],[3,5,6],false,true,null,-3],[5,[2,2,1],[3,5,6],true,false,null,-13],[5,[2,2,1],[3,5,6],true,true,null,-13],[5,[2,2,1],[4,5,6],false,false,null,-5],[5,[2,2,1],[4,5,6],false,true,null,-5],[5,[2,2,1],[4,5,6],true,false,null,-17],[5,[2,2,1],[4,5,6],true,true,null,-17],[5,[2,2,1],[3,4,5,6],false,false,null,-7],[5,[2,2,1],[3,4,5,6],false,true,null,-7],[5,[2,2,1],[3,4,5,6],true,false,null,-19],[5,[2,2,1],[3,4,5,6],true,true,null,-19],[5,[2,1,1,1],[6],false,false,null,0],[5,[2,1,1,1],[6],false,true,null,0],[5,[2,1,1,1],[6],true,false,null,-3],[5,[2,1,1,1],[6],true,true,null,-3],[5,[2,1,1,1],[3,6],false,false,null,0],[5,[2,1,1,1],[3,6],false,true,null,0],[5,[2,1,1,1],[3,6],true,false,null,-3],[5,[2,1,1,1],[3,6],true,true,null,-3],[5,[2,1,1,1],[4,6],false,false,null,0],[5,[2,1,1,1],[4,6],false,true,null,0],[5,[2,1,1,1],[4,6],true,false,null,-3],[5,[2,1,1,1],[4,6],true,true,null,-3],[5,[2,1,1,1],[3,4,6],false,false,null,0],[5,[2,1,1,1],[3,4,6],false,true,null,0],[5,[2,1,1,1],[3,4,6],true,false,null,-3],[5,[2,1,1,1],[3,4,6],true,true,null,-3],[5,[2,1,1,1],[5,6],false,false,null,-1],[5,[2,1,1,1],[5,6],false,true,null,-1],[5,[2,1,1,1],[5,6],true,false,null,-6],[5,[2,1,1,1],[5,6],true,true,null,-6],[5,[2,1,1,1],[3,5,6],false,false,null,-1],[5,[2,1,1,1],[3,5,6],false,true,null,-1],[5,[2,1,1,1],[3,5,6],true,false,null,-6],[5,[2,1,1,1],[3,5,6],true,true,null,-6],[5,[2,1,1,1],[4,5,6],false,false,null,-2],[5,[2,1,1,1],[4,5,6],false,true,null,-2],[5,[2,1,1,1],[4,5,6],true,false,null,-8],[5,[2,1,1,1],[4,5,6],true,true,null,-8],[5,[2,1,1,1],[3,4,5,6],false,false,null,-3],[5,[2,1,1,1],[3,4,5,6],false,true,null,-3],[5,[2,1,1,1],[3,4,5,6],true,false,null,-9],[5,[2,1,1,1],[3,4,5,6],true,true,null,-9],[5,[1,1,1,1,1],[6],false,false,196,1]],"control_columns":["holes","last_hole_finish","refutation_lines"],"controls":[[2,"clique",19],[2,"inward",19],[2,"outward",19],[2,"overlap",19],[3,"clique",52],[3,"inward",52],[3,"outward",52],[3,"overlap",53],[4,"clique",109],[4,"inward",109],[4,"outward",109],[4,"overlap",110],[5,"clique",196],[5,"inward",196],[5,"outward",196],[5,"overlap",197]],"terminal_grid":[{"k":1,"trials":{"both":94,"lower":311,"upper":952,"none":15},"minima":{"none":[196,4,0,5,-1],"upper":[198,5,0,6,-1]},"successful":[[4,0,5,-1,196],[4,1,2,-2,198],[4,1,4,-1,197],[4,2,1,-3,198],[4,2,3,-1,198],[4,3,1,-2,198],[4,3,2,-1,198],[4,4,1,-1,197],[4,5,1,0,196],[4,5,2,0,196],[4,5,3,0,196],[4,5,4,0,196],[4,5,5,0,196],[4,5,6,0,196],[4,5,7,0,196],[5,0,2,-3,199],[5,0,3,-2,199],[5,0,6,-1,198],[5,1,5,-1,199],[5,2,2,-2,200],[5,2,4,-1,200],[5,3,1,-3,199],[5,3,3,-1,200],[5,4,1,-2,200],[5,4,2,-1,200],[5,5,1,-1,199],[5,6,1,0,198],[5,6,2,0,198],[5,6,3,0,198],[5,6,4,0,198],[5,6,5,0,198],[5,6,6,0,198],[5,6,7,0,198],[6,0,7,-1,199],[6,1,2,-3,201],[6,1,3,-2,201],[6,1,6,-1,200],[6,2,5,-1,201],[6,3,2,-2,202],[6,3,4,-1,201],[6,4,1,-3,201],[6,4,3,-1,201],[6,5,1,-2,201],[6,5,2,-1,201],[6,6,1,-1,200]]},{"k":2,"trials":{"both":94,"lower":311,"upper":952,"none":15},"minima":{},"successful":[]},{"k":3,"trials":{"both":94,"lower":311,"upper":952,"none":15},"minima":{},"successful":[]},{"k":4,"trials":{"both":94,"lower":311,"upper":952,"none":15},"minima":{},"successful":[]},{"k":5,"trials":{"both":94,"lower":311,"upper":952,"none":15},"minima":{},"successful":[]}],"terminal_grid_explanation":"For k residual holes, successful tuples are (a,s,d,q,line_count). All omitted tuples failed. a multiplies 5-clique aggregate, s multiplies early lower bound, d is positive divisor, q is the common output coefficient. Minima entries start with line count. One orbit representative per assignment of roles to pigeons and holes.","split_two_hole":{"frontiers":[3,17,65,243,787,2145,5067,10287,18304],"tree_cost":8,"cp_lines":196,"tree":["add",["L"],["add",["div",["add",["E",0],["mul",["C",0],4]],5],["div",["add",["E",1],["mul",["C",1],4]],5]]]}},"search_program":"from functools import reduce\nfrom itertools import product\nimport json\n\nclass Run:\n    def __init__(self, h):\n        self.h = h\n        self.p = h + 1\n        self.ops = []\n        self.lines = []\n        self.index = {}\n    def insert(self, op, a, b):\n        key = tuple(a), b\n        if key not in self.index:\n            self.index[key] = len(self.ops)\n            self.ops.append(op)\n            self.lines.append(key)\n        return self.index[key]\n    def pigeon(self, i):\n        return self.insert(('p', i), [int(j//self.h == i) for j in range(self.p*self.h)], 1)\n    def pair(self, i, j, h):\n        return self.insert(('e', i, j, h), [-int(k % self.h == h and k//self.h in (i,j))\n            for k in range(self.p*self.h)], -1)\n    def boolean(self, i, h, up):\n        return self.insert(('u' if up else 'l', i, h),\n            [(1-2*up)*int(k == i*self.h+h) for k in range(self.p*self.h)], -up)\n    def add(self, i, j):\n        a,b = self.lines[i]\n        c,d = self.lines[j]\n        return self.insert(('a',i,j), [x+y for x,y in zip(a,c)], b+d)\n    def mul(self, i, n):\n        a,b = self.lines[i]\n        return self.insert(('m',i,n), [n*x for x in a], n*b)\n    def div(self, i, n):\n        a,b = self.lines[i]\n        assert n>0 and all(x%n == 0 for x in a)\n        return self.insert(('d',i,n), [x//n for x in a], -((-b)//n))\n    def total(self, entries):\n        return reduce(self.add, entries)\n    def finish(self, i):\n        a,b = self.lines[i]\n        assert not any(a)\n        if b<1:\n            return None\n        return i if b==1 else self.div(i,b)\n    def trim(self, i):\n        needed = set()\n        def visit(j):\n            if j in needed:\n                return\n            needed.add(j)\n            op = self.ops[j]\n            if op[0] in 'amd':\n                visit(op[1])\n            if op[0] == 'a':\n                visit(op[2])\n        visit(i)\n        ranks = {j:k for k,j in enumerate(sorted(needed))}\n        return [(op[0], ranks[op[1]], ranks[op[2]] if op[0]=='a' else op[2])\n                if op[0] in 'amd' else op for op in (self.ops[j] for j in sorted(needed))]\n    def clique(self, h, vertices, flavor='star'):\n        if len(vertices)==2:\n            return self.pair(*vertices,h)\n        if flavor=='overlap':\n            core = vertices[:-2]\n            x,y = vertices[-2:]\n            first = self.clique(h,core+(x,))\n            second = self.clique(h,core+(y,))\n            return self.div(self.total([first,second,self.pair(x,y,h)]),2)\n        r = len(vertices)-1\n        x = vertices[-1]\n        prev = self.clique(h,vertices[:-1])\n        return self.div(self.total([self.mul(prev,r-1)] +\n            [self.pair(i,x,h) for i in vertices[:-1]]),r)\n    def rectangle(self, holes, r, stages, pad, shared):\n        if len(holes)==1:\n            return self.clique(holes[0],tuple(range(r)))\n        if r==2:\n            return self.total(self.pair(0,1,h) for h in holes)\n        prev = self.rectangle(holes,r-1,stages,pad,shared) if r-1 in stages else self.total(\n            self.clique(h,tuple(range(r-1))) for h in holes)\n        stars = [self.pair(i,r-1,h) for h in holes for i in range(r-1)]\n        terms = [self.mul(prev, r-2)] + stars\n        if pad:\n            # Uniform paired Boolean padding tries RHS losses as well as exact divisibility.\n            terms += [self.boolean(i,h,up) for up in (0,1) for i in range(r) for h in holes]\n        if shared:\n            terms = [self.mul(prev,r-2),self.total(stars)] + terms[1+len(stars):]\n        return self.div(self.total(terms),r-1)\n    def conditional(self, h, v, lower, mode):\n        n = len(v)\n        if n==2:\n            return self.add(lower,self.pair(*v,h))\n        if mode=='clique':\n            return self.add(lower,self.clique(h,v))\n        if mode=='inward':\n            high = self.clique(h,v[:-1])\n            lo = self.add(lower,high)\n            stars = self.total(self.pair(i,v[-1],h) for i in v[:-1])\n            zero = self.add(lower,stars)\n            if n>3:\n                zero = self.div(zero,n-2)\n            return self.add(lo,zero)\n        stars = self.total(self.pair(i,v[-1],h) for i in v[:-1])\n        zero = self.add(lower,stars)\n        if n>3:\n            zero = self.div(zero,n-2)\n        return self.conditional(h,v[:-1],self.add(lower,zero),mode)\n\ndef partitions(n, ceiling=None):\n    if not n:\n        yield ()\n    else:\n        for k in range(min(n, ceiling or n),0,-1):\n            for rest in partitions(n-k,k):\n                yield (k,)+rest\n\ndef report():\n    best = None\n    results = []\n    for h in range(1,6):\n        for sizes in partitions(h):\n            # Sorted hole-block sizes and ordered pigeon orbits fix relabeling freedom.\n            for stage_mask in (range(1<<(h-2)) if h>=3 and sizes[0]>1 else [0]):\n                stages = {h+1} | {r for r in range(3,h+1) if stage_mask & 1<<(r-3)}\n                for pad, shared in (product((False,True),repeat=2) if sizes[0]>1 else [(False,False)]):\n                    run = Run(h)\n                    current = run.total(run.pigeon(i) for i in range(h+1))\n                    start = 0\n                    for k in sizes:\n                        current = run.add(current,run.rectangle(tuple(range(start,start+k)),h+1,\n                            stages,pad,shared))\n                        start += k\n                    goal = run.finish(current)\n                    count = None if goal is None else len(run.trim(goal))\n                    results.append(dict(holes=h, sizes=sizes, stages=sorted(stages), pad=pad,\n                        shared=shared, lines=count, final_rhs=run.lines[current][1]))\n                    if h==5 and count is not None and (best is None or count<len(best)):\n                        best = run.trim(goal)\n        for mode in ('clique','inward','outward','overlap'):\n            if h<2:\n                continue\n            run = Run(h)\n            x = run.total(run.pigeon(i) for i in range(h+1))\n            v = tuple(range(h+1))\n            for j in range(h-1):\n                x = run.add(x,run.clique(j,v))\n            end = run.add(x, run.clique(h-1,v,'overlap')) if mode=='overlap' and h>=3 else run.conditional(h-1,v,x,mode)\n            goal = run.finish(end)\n            count = len(run.trim(goal))\n            results.append(dict(holes=h, mode=mode, lines=count, final_rhs=run.lines[end][1]))\n            if h==5 and count<len(best):\n                best = run.trim(goal)\n    return results,best\n\ndef terminal_grid():\n    # Given k+1 occupied slots in the last k holes, use a single weighted\n    # sum of the 5-clique block, star block and the early pigeon bound.\n    # Project onto old and marked pigeons. For each divisor, try targets\n    # equal in both classes, using Boolean bounds to correct residues.\n    rows = []\n    for k in range(1,6):\n        best = {}\n        tried = {}\n        successful = []\n        for a,s,d,q in product(range(7), range(7), range(1,8), range(-3,1)):\n            coeff_old, coeff_marked = s-a-1, s-5\n            corrections = (d*q-coeff_old,d*q-coeff_marked)\n            flavor = ('both' if min(corrections)<0<max(corrections)\n                      else 'upper' if min(corrections)<0\n                      else 'lower' if max(corrections)>0 else 'none')\n            tried[flavor] = tried.get(flavor,0)+1\n            rhs = s*(k+1)-a*k-5*k\n            rhs += 5*k*min(0,corrections[0])+k*min(0,corrections[1])\n            if not (-((-rhs)//d)-q*(k+1) >= 1):\n                continue\n            run = Run(5)\n            p = run.total(run.pigeon(i) for i in range(6))\n            for h in range(5-k):\n                p = run.add(p,run.clique(h,tuple(range(6))))\n            holes = range(5-k,5)\n            terms = []\n            if a:\n                c = run.total(run.clique(h,tuple(range(5))) for h in holes)\n                terms.append(run.mul(c,a))\n            if s:\n                terms.append(run.mul(p,s))\n            terms.extend(run.pair(i,5,h) for h in holes for i in range(5))\n            for i in range(6):\n                correction = corrections[i==5]\n                if correction:\n                    terms.extend(run.mul(run.boolean(i,h,correction<0),abs(correction)) for h in holes)\n            summed = run.total(terms)\n            divided = run.div(summed,d)\n            goal = run.finish(run.add(divided,run.mul(p,-q)) if q else divided)\n            count = len(run.trim(goal))\n            successful.append((a,s,d,q,count))\n            if flavor not in best or count<best[flavor][0]:\n                best[flavor] = (count,a,s,d,q)\n        rows.append(dict(k=k, trials=tried, minima=best, successful=successful))\n    return rows\n\ndef two_hole_search():\n    # Old and marked occupancy in each of the last two holes, kept distinct.\n    # Search arithmetic trees, quotienting by interchange of the two holes.\n    # Only the strongest RHS for each vector and cost bound need be retained.\n    bases = {\n        (1,1,1,1): (3,('L',)),\n        (-1,0,0,0): (-1,('C',0)),\n        (0,0,-1,0): (-1,('C',1)),\n        (-1,-5,0,0): (-5,('E',0)),\n        (0,0,-1,-5): (-5,('E',1))}\n    def swap(v):\n        return v[2:] + v[:2]\n    def reflect(op):\n        tag,*args = op\n        if tag == 'L':\n            return op\n        if tag in ('C','E'):\n            return tag,1-args[0]\n        if tag == 'add':\n            return tag,reflect(args[0]),reflect(args[1])\n        return tag,reflect(args[0]),args[1]\n    def expand(layer):\n        for v,(b,t) in layer.items():\n            yield v,b,t\n            w = swap(v)\n            if v != w:\n                yield w,b,reflect(t)\n    def insert(layer,v,b,t):\n        if max(map(abs,v)) > 12:\n            return\n        w = swap(v)\n        if w < v:\n            v,t = w,reflect(t)\n        if (v in best and best[v] >= b) or (v in layer and layer[v][0] >= b):\n            return\n        layer[v] = b,t\n    layers = [{}]\n    best = {}\n    for v,(b,t) in bases.items():\n        insert(layers[0],v,b,t)\n    best.update({v:b for v,(b,_) in layers[0].items()})\n    for n in range(1,9):\n        layer = {}\n        goal = None\n        for v,b,t in expand(layers[-1]):\n            for x in range(2,7):\n                insert(layer,tuple(x*c for c in v),x*b,('mul',t,x))\n                if all(c%x==0 for c in v):\n                    insert(layer,tuple(c//x for c in v),-((-b)//x),('div',t,x))\n        for i in range((n-1)//2+1):\n            first = layers[i]\n            second = tuple(expand(layers[n-1-i]))\n            for u,(a,t) in first.items():\n                for v,b,s in second:\n                    insert(layer,tuple(c+d for c,d in zip(u,v)),a+b,('add',t,s))\n        layers.append(layer)\n        best.update({v:b for v,(b,_) in layer.items()})\n        goal = layer.get((0,0,0,0))\n        if goal and goal[0]>0:\n            break\n    info = dict(frontiers=[len(x) for x in layers], tree_cost=None, cp_lines=None)\n    if goal and goal[0]>0:\n        run = Run(5)\n        p = run.total(run.pigeon(i) for i in range(6))\n        for h in range(3):\n            p = run.add(p,run.clique(h,tuple(range(6))))\n        def concrete(op):\n            tag,*args = op\n            if tag=='L':\n                return p\n            if tag=='C':\n                return run.clique(3+args[0],tuple(range(5)))\n            if tag=='E':\n                return run.total(run.pair(i,5,3+args[0]) for i in range(5))\n            if tag=='add':\n                return run.add(*map(concrete,args))\n            return getattr(run,tag)(concrete(args[0]),args[1])\n        cert = run.trim(run.finish(concrete(goal[1])))\n        assert len(cert) <= 188+n\n        info.update(tree_cost=n, cp_lines=len(cert), tree=goal[1])\n        return info,cert\n    return info,None\n\nif __name__=='__main__':\n    rows,best = report()\n    print('evaluated',len(rows),'shapes; best certificate',len(best))\n    json.dump(rows,open('shapes.json','w'),indent=2)\n    json.dump(best,open('certificate.json','w'))\n    grid = terminal_grid()\n    json.dump(grid,open('grid.json','w'),indent=2)\n    print(grid, flush=True)\n    two_hole, cert = two_hole_search()\n    json.dump(two_hole,open('two_hole.json','w'),indent=2)\n    print(two_hole)\n    if cert is not None and len(cert)<len(best):\n        json.dump(cert,open('certificate.json','w'))\n","replay_program":"from pathlib import Path\nfrom itertools import combinations, product\nfrom collections import Counter\nfrom fractions import Fraction\nimport re\n\nv = tuple(product(range(6),range(5)))\npigeons = tuple(('pigeon',i) for i in range(6))\npairs = tuple(('pair',i,j,h) for i,j in combinations(range(6),2) for h in range(5))\nclauses = pigeons+pairs\n\ndef initial(op):\n    tag,*args = op\n    if tag == 'pigeon':\n        return tuple(int(i==args[0]) for i,h in v), 1\n    i,j,h = args\n    assert i != j and (i,h) in v and (j,h) in v\n    return tuple(-int(z in ((i,h),(j,h))) for z in v), -1\n\ndef audit(ops):\n    lines=[]\n    hist=Counter()\n    states = set()\n    rounded = 0\n    for op in ops:\n        name,*args = op\n        hist[name]+=1\n        if name in ('pigeon','pair'):\n            a,b = initial(op)\n            states.add(op)\n        else:\n            i,k = args\n            assert 0<=i<len(lines)\n            a,b = lines[-1-i]\n            if name == 'add':\n                assert 0<=k<len(lines)\n                c,d = lines[-1-k]\n                a,b = tuple(x+y for x,y in zip(a,c)),b+d\n            elif name=='mul':\n                assert k>=0\n                a,b = tuple(k*x for x in a),k*b\n            else:\n                assert name == 'div'\n                assert k>0 and all(x%k==0 for x in a)\n                rounded+=int(b%k!=0)\n                a,b = tuple(x//k for x in a),-((-b)//k)\n        lines.append((a,b))\n    assert lines[-1] == ((0,)*30,1)\n    assert len(states) == 81\n    return dict(length=len(lines), rules=dict(hist), rounded=rounded)\n\ndef critical():\n    for label in clauses:\n        if label[0]=='pigeon':\n            omitted=label[1]\n            point=set(zip((i for i in range(6) if i!=omitted),range(5)))\n        else:\n            _,i,j,h=label\n            point={(i,h),(j,h)}|set(zip((a for a in range(6) if a not in (i,j)),\n                                        (b for b in range(5) if b!=h)))\n        failed = []\n        for op in clauses:\n            a,b=initial(op)\n            if sum(x for x,z in zip(a,v) if z in point)<b:\n                failed.append(op)\n            assert Fraction(sum(a),5) >= b\n        assert failed==[label]\n    return len(clauses)\n\ndef go():\n    text=Path('repo/lean/PEqualNP/Outside/CP5SymmetryBound.lean').read_text()\n    trace=text.split('def steps : List Step :=',1)[1].split('def accepts',1)[0]\n    ops=[(m[0],*map(int,m[1].split())) for m in re.findall(r'\\.(\\w+) ([\\d ]+)',trace)]\n    print(audit(ops))\n    for axis,n in enumerate((6,5)):\n        for i in range(n-1):\n            def change(a):\n                return i+1 if a==i else i if a==i+1 else a\n            def relabel(op):\n                tag,*args=op\n                if tag=='pigeon' and axis==0:\n                    args=[change(args[0])]\n                elif tag=='pair':\n                    for j in ((0,1) if axis==0 else (2,)):\n                        args[j]=change(args[j])\n                return tag,*args\n            assert audit(list(map(relabel,ops)))==audit(ops)\n    print('9 adjacent-transposition replays passed')\n    print(critical(),'clause-deletion witnesses passed; uniform rational assignment passed')\n\nif __name__=='__main__':\n    go()\n","submission_status":"Local auxiliary lemma and reproducible search delivered. No assignment acquired and no official submission made."}
