Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Sensitivity separation: MinmaxQ2Types (complete source module)

Definition
BS2_b3ba934b_MinmaxQ2Types

by yousofy · Oct 27, 2026 · Mathlib 0df444a (Lean v4.33.1)

block-sensitivitysensitivitysensitivity-first-two-20261025

Complete Lean source module MinmaxQ2Types from the two verified sensitivity separation proofs. The module supplies the definitions, auxiliary lemmas, and exact finite certificates used by its dependent modules. All original declarations and proof bodies are retained; only local import module paths are changed for Prove2Me. The final campaign goals are published separately as theorems with submitted solutions.

Definition code
/- Exact q2 type and prefix identities for actual min/max candidates. -/
import Definitions.Def_BS2_b3ba934b_MinmaxPrefixCaps
import Definitions.Def_BS2_b3ba934b_RecordCapStats

set_option autoImplicit false
set_option maxHeartbeats 6000000
set_option maxRecDepth 20000
set_option linter.unusedSectionVars false

namespace ThreeBoundMinmaxQ2
open OAI.Paper320 ThreeBoundWitness ThreeBoundProfiles
open ThreeBoundMinmaxTransfer ThreeBoundMinmaxCandidates ThreeBoundMinmaxCaps
open scoped Classical BigOperators
noncomputable section
variable {L I V : Type} [LinearOrder L] [Fintype I] [Fintype V]

theorem budget_eq (k : Fin 8) : ThreeBoundHighTypes.budget 2 k=ThreeBoundQ2.budget k := by
  fin_cases k <;> rfl

theorem isGuard_eq (k : Fin 8) : ThreeBoundHighTypes.isGuard 2 k=ThreeBoundQ2.isGuard k := by
  fin_cases k <;> rfl

theorem positivePrefix_eq (b : ℕ) (k : Fin 8) :
    ThreeBoundHighTypes.positivePrefix 2 b k=ThreeBoundQ2.positivePrefix b k := by
  fin_cases k <;> simp [ThreeBoundHighTypes.positivePrefix,
    ThreeBoundQ2.positivePrefix,ThreeBoundQ2.positiveLevel]

theorem kind_target_prefix_iff
    (S : Stage L I V) (F : L → (I → Bool) → Bool) (hF : Nested F)
    (i j : L) (P : PairData S F i j) (x : ((V × Bool) × I) → Bool)
    (hQ : S.tolerance j ≤ 2) (w : V) (kind : Fin 8)
    (hk : ThreeBoundHighTypes.OfKind 2
      (PositiveCandidate S F P.strongLower P.strongUpper j x w)
      (GuardCandidate S F P.strongLower P.strongUpper j x w) kind) (q : ℕ) :
    w ∈ targetPrefix S F P.strongLower P.strongUpper j x q ↔
      ThreeBoundQ2.positivePrefix q kind=true := by
  have hhigh : w ∈ highHeads S F P.strongLower P.strongUpper j x :=
    Finset.mem_filter.mpr ⟨Finset.mem_univ _,ThreeBoundHighTypes.ofKind_high 2 _ _ kind hk⟩
  have he := ThreeBoundHighTypes.positivePrefix_iff 2 (failed S F j x w).card q _ _ kind
    (fun b hb => ⟨hb.1.1.trans hQ,hb.1.2.1⟩)
    (fun b hb => ⟨hb.1.trans hQ,hb.2.1⟩) hk
  rw [positivePrefix_eq] at he
  rw [← he]
  simp only [targetPrefix,Finset.mem_filter,Finset.mem_univ,true_and]
  constructor
  · rintro ⟨b,hb,ht⟩
    exact ⟨b,hb,ht,high_guards_true S F hF i j P x w hhigh⟩
  · rintro ⟨b,hb,hp⟩
    exact ⟨b,hb,hp.1⟩

theorem prefix_high_eq
    (S : Stage L I V) (F : L → (I → Bool) → Bool) (hF : Nested F)
    (i j : L) (P : PairData S F i j) (x : ((V × Bool) × I) → Bool)
    (hQ : S.tolerance j ≤ 2) (tag : V → Fin 8)
    (hk : ∀ w ∈ highHeads S F P.strongLower P.strongUpper j x,
      ThreeBoundHighTypes.OfKind 2
        (PositiveCandidate S F P.strongLower P.strongUpper j x w)
        (GuardCandidate S F P.strongLower P.strongUpper j x w) (tag w)) (q : ℕ) :
    targetPrefix S F P.strongLower P.strongUpper j x q ∩
        highHeads S F P.strongLower P.strongUpper j x =
      (highHeads S F P.strongLower P.strongUpper j x).filter
        fun w => ThreeBoundQ2.positivePrefix q (tag w)=true := by
  ext w
  simp only [Finset.mem_inter,Finset.mem_filter]
  constructor
  · rintro ⟨ht,hh⟩
    exact ⟨hh,(kind_target_prefix_iff S F hF i j P x hQ w (tag w) (hk w hh) q).1 ht⟩
  · rintro ⟨hh,ht⟩
    exact ⟨(kind_target_prefix_iff S F hF i j P x hQ w (tag w) (hk w hh) q).2 ht,hh⟩

theorem outside_high_eq
    (S : Stage L I V) (F : L → (I → Bool) → Bool) (hF : Nested F)
    (i j : L) (P : PairData S F i j) (x : ((V × Bool) × I) → Bool)
    (hQ : S.tolerance j ≤ 2) (tag : V → Fin 8)
    (hk : ∀ w ∈ highHeads S F P.strongLower P.strongUpper j x,
      ThreeBoundHighTypes.OfKind 2
        (PositiveCandidate S F P.strongLower P.strongUpper j x w)
        (GuardCandidate S F P.strongLower P.strongUpper j x w) (tag w)) (q b : ℕ) :
    ((highHeads S F P.strongLower P.strongUpper j x \
      targetPrefix S F P.strongLower P.strongUpper j x q).filter
      fun w => (failed S F j x w).card ≤ b) =
      (highHeads S F P.strongLower P.strongUpper j x).filter fun w =>
        ThreeBoundQ2.positivePrefix q (tag w)=false ∧ ThreeBoundQ2.budget (tag w) ≤ b := by
  ext w
  simp only [Finset.mem_filter,Finset.mem_sdiff]
  by_cases hh : w ∈ highHeads S F P.strongLower P.strongUpper j x
  · have ht := kind_target_prefix_iff S F hF i j P x hQ w (tag w) (hk w hh) q
    have hc := ThreeBoundHighTypes.ofKind_count 2 (failed S F j x w).card _ _ (tag w)
      (fun b hb => hb.1.2.1) (fun b hb => hb.2.1) (hk w hh)
    rw [budget_eq] at hc
    simp only [hh,true_and,hc,ht]
    cases ThreeBoundQ2.positivePrefix q (tag w) <;> simp
  · simp [hh]

theorem guardSources_eq_filter
    (S : Stage L I V) (F : L → (I → Bool) → Bool)
    (i j : L) (P : PairData S F i j) (x : ((V × Bool) × I) → Bool)
    (hQ : S.tolerance j ≤ 2) (tag : V → Fin 8)
    (hk : ∀ w ∈ highHeads S F P.strongLower P.strongUpper j x,
      ThreeBoundHighTypes.OfKind 2
        (PositiveCandidate S F P.strongLower P.strongUpper j x w)
        (GuardCandidate S F P.strongLower P.strongUpper j x w) (tag w)) :
    guardSources S F P.strongLower P.strongUpper j x =
      (highHeads S F P.strongLower P.strongUpper j x).filter
        fun w => ThreeBoundQ2.isGuard (tag w)=true := by
  ext w
  constructor
  · intro hw
    have hg := (Finset.mem_filter.mp hw).2
    have hh : w ∈ highHeads S F P.strongLower P.strongUpper j x :=
      Finset.mem_filter.mpr ⟨Finset.mem_univ _,Or.inr hg⟩
    refine Finset.mem_filter.mpr ⟨hh,?_⟩
    rw [← isGuard_eq]
    exact (ThreeBoundHighTypes.guard_iff 2 (failed S F j x w).card _ _ (tag w)
      (fun b hb => ⟨hb.1.1.trans hQ,hb.1.2.1⟩)
      (fun b hb => ⟨hb.1.trans hQ,hb.2.1⟩) (hk w hh)).1 hg
  · intro hw
    obtain ⟨hh,hg⟩ := Finset.mem_filter.mp hw
    rw [← isGuard_eq] at hg
    exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,
      (ThreeBoundHighTypes.guard_iff 2 (failed S F j x w).card _ _ (tag w)
        (fun b hb => ⟨hb.1.1.trans hQ,hb.1.2.1⟩)
        (fun b hb => ⟨hb.1.trans hQ,hb.2.1⟩) (hk w hh)).2 hg⟩

end
end ThreeBoundMinmaxQ2

#print axioms ThreeBoundMinmaxQ2.kind_target_prefix_iff
#print axioms ThreeBoundMinmaxQ2.guardSources_eq_filter
Source
Attached verified checkpoint block_sensitivity_three_bounds; lean_project/MinmaxQ2Types.lean; original SHA-256 43ceccecd356e1288f72565c26dd1e022fe0f565822a19f58779e218f6c78658; campaign https://prove2.me/campaigns/block-sensitivity-vs-sensitivity

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me