cfahlgren1's picture
cfahlgren1 HF Staff
mirror at 11b6c7e3c927df2658f513b6b68ea7f8929c62c5
e639140 verified
Raw History Blame Contribute Delete
4 kB

What withGamma hands over on (n in unary, s, ψ).

35
theorem withGamma_replicate (gates : ℕ → ℕ → List CircuitLowerBound.GateD) (n s : ℕ) (ψ : Fml) :
    withGamma gates (List.replicate n (), s, ψ) = (List.replicate (numVars gates n s) (), (ψ ++ gamma gates n s).dedup) := by
proof · 1 line
  simp only [withGamma, List.length_replicate]

`StAskSized`. Let gates test the size with at most a·(n+1) gates, and let D decide 3-SAT with an exponent δ₃ ≥ 0 such that δ₃·(a + 1 + B) ≤ δ. On (n in unary, s, ψ), for s ≤ n and ψ of width at most w on x₀ … xₙ₋₁ with (w − 3)·|ψ| ≤ B·(n+1), askSized gates D says, within c'·2^{δn} steps and on states of size at most c'·(n+2)^{c'}, whether ψ has a satisfying assignment with exactly s true variables.

44
theorem stAskSized : StAskSized := by
proof · 32 lines
  intro gates a hT w B δ δ₃ _ h0 hle D c hD
  obtain ⟨c', hc'⟩ := exists_bounds (a + 1 + B) c h0 (by push_cast; exact hle)
  refine ⟨c', fun n s ψ _ hψ hB => ?_⟩
  obtain ⟨N0, hN0⟩ : ∃ N0, N0 = numVars gates n s := ⟨_, rfl⟩
  obtain ⟨φ, hφ⟩ : ∃ φ, φ = (ψ ++ gamma gates n s).dedup := ⟨_, rfl⟩
  have hnN : n ≤ N0 := hN0 ▸ le_numVars gates n s
  have hvars : ∀ C ∈ φ, ∀ l ∈ C, l.1 < N0 := by
    intro C hC l hl
    rw [hφ] at hC
    rcases List.mem_append.1 (List.mem_dedup.1 hC) with h | h
    · exact lt_of_lt_of_le ((hψ C h).2 l hl) hnN
    · exact hN0 ▸ (shaped_gamma hT n s C h).2 l hl
  have hfresh : numFresh φ ≤ B * (n + 1) := by
    have e1 := numFresh_dedup_le (ψ ++ gamma gates n s)
    have e2 := Eight.Width.numFresh_le w ψ fun C hC => (hψ C hC).1
    have e3 : numFresh (gamma gates n s) = 0 := numFresh_eq_zero fun C hC => (shaped_gamma hT n s C hC).1
    rw [numFresh_append, e3] at e1
    rw [hφ]
    omega
  have hN : N0 + numFresh φ ≤ (a + 1 + B) * (n + 1) := by
    have e := numVars_le hT n s
    rw [← hN0] at e
    rw [Nat.add_mul]
    omega
  obtain ⟨h3, hnd, hsat⟩ := splitN_spec hvars
  obtain ⟨T, b, hr, hb, hTle⟩ := hD (N0 + numFresh φ) (splitN N0 φ) h3 hnd
  have hin : widthP (withGamma gates (List.replicate n (), s, ψ)) = (List.replicate (N0 + numFresh φ) (), splitN N0 φ) := by
    rw [withGamma_replicate, ← hN0, ← hφ, widthP_replicate]
  obtain ⟨k1, k2⟩ := hc' n _ T hN hTle
  rw [← hin] at hr
  refine ⟨T, b, (Stepped.mapIn_runs (f := fun p => widthP (withGamma gates p)) (a := (List.replicate n (), s, ψ)) hr).mono le_rfl k1, ?_, k2⟩
  rw [hb, hsat, sat_iff_cntN hvars, hφ, cntN_of_dedup, hN0, stGammaCount gates a hT n s ψ fun C hC => (hψ C hC).2]