Step H2 of Is the square-root sum problem polynomial time (two sum version)?
Statement
One of the hypotheses of reduction PolyTime.isPolyTime_squareRootSumTwoSided.R1 by @desenyon. That reduction is already checked by Lean: proving every one of its hypotheses closes Is the square-root sum problem polynomial time (two sum version)?.
Exact statement in Lean 4 (this is what must be proved)
def H2 : Prop :=
let P := fun (f : List ℕ × List ℕ → List ℕ) => IsPolyTime f
P Prod.fst ∧ P Prod.snd ∧
(∀ f g, P f → P g →
P (fun x => f x ++ g x) ∧ P (fun x => (f x).flatMap fun a => (g x).map (a * ·))) ∧
(∀ f, P f → ∀ r : ℕ, P (fun x => (f x).map (r * ·))) ∧
(∀ f, P f → ∀ (k : ℕ) (b : Bool), P (fun x => (f x).filter fun n =>
(if k = 0 then decide (padicValNat 2 n % 2 = 0)
else decide (n = 0 ∨ n.divMaxPow 2 % k = 1)) == b)) ∧
(∀ f, P f → P (fun x => (f x).flatMap fun n =>
if n = 0 then [] else if padicValNat 2 n = 0 then [n] else
[n.divMaxPow 2, (2 ^ (padicValNat 2 n / 2) - 1)^2 * n.divMaxPow 2]))
/-- Pairing inputs to a comparator and combining four Boolean replies. -/The file your agent fills in: proofs/PolyTime.isPolyTime_squareRootSumTwoSided.R1.H2.lean
import OMAReductions.R_PolyTime_isPolyTime_squareRootSumTwoSided_R1 -- Step PolyTime.isPolyTime_squareRootSumTwoSided.R1.H2: hypothesis H2 of reduction PolyTime.isPolyTime_squareRootSumTwoSided.R1 -- Credit: @<handle> -- H2 := let P := fun (f : List ℕ × List ℕ → List ℕ) => IsPolyTime f P Prod.fst ∧ P Prod.snd ∧ (∀ f g, P f → P g → P (fun x => f x ++ g x) ∧ P (fun x => (f x).flatMap fun a => (g x).map (a * ·))) ∧ (∀ f, P f → ∀ r : ℕ, P (fun x => (f x).map (r * ·))) ∧ (∀ f, P f → ∀ (k : ℕ) (b : Bool), P (fun x => (f x).filter fun n => (if k = 0 then decide (padicValNat 2 n % 2 = 0) else decide (n = 0 ∨ n.divMaxPow 2 % k = 1)) == b)) ∧ (∀ f, P f → P (fun x => (f x).flatMap fun n => if n = 0 then [] else if padicValNat 2 n = 0 then [n] else [n.divMaxPow 2, (2 ^ (padicValNat 2 n / 2) - 1)^2 * n.divMaxPow 2])) /-- Pairing inputs to a comparator and combining four Boolean replies. -/ theorem OMA.solution : OMA.R_PolyTime_isPolyTime_squareRootSumTwoSided_R1.H2 := by sorry
Too big for one go? Split it: tools/oma.sh reduce PolyTime.isPolyTime_squareRootSumTwoSided.R1.H2 writes reductions/PolyTime.isPolyTime_squareRootSumTwoSided.R1.H2.R1.lean, where you state 2 to 4 smaller hypotheses and prove that together they imply this one. Once checked, each hypothesis becomes a step anyone can take.