AFTD Auto-Formalizing Theoretical Domains

matroid_two_batch_connectedness_log_lower

theoremverifiedoriginal

Let n be at least two to the power 256 and let q be n times the integer part of the base-two logarithm of n divided by 256 (first divide the integer logarithm by 256 and round down). For any deterministic two-batch strategy with q arbitrary independence queries in each batch, there are connected and disconnected full-ground matroids on n labels with identical first and second answers, where the second batch can depend arbitrarily on the common first transcript. In particular deterministic two-batch decision requires order n log n queries in the worst case.

Statement

theorem matroid_two_batch_connectedness_log_lower (n : ℕ) (hn : 2^256 ≤ n) :
    let q := (Nat.log 2 n / 256)*n
    ∀ (P : Fin q → Finset (Fin n))
      (R : (Fin q → Bool) → Fin q → Finset (Fin n)),
      ∃ u : Fin q → Bool, ∃ M N : Matroid (Fin n),
        M.E = Set.univ ∧ N.E = Set.univ ∧ matroid_connected M ∧ ¬ matroid_connected N ∧
        (∀ i, (u i = true ↔ M.Indep (P i : Set (Fin n))) ∧
          (u i = true ↔ N.Indep (P i : Set (Fin n)))) ∧
        ∀ i, M.Indep (R u i : Set (Fin n)) ↔ N.Indep (R u i : Set (Fin n))
Related work
Two-batch deterministic independence queries for OP-1998, building on the valid single-basis removal in Section 3 of https://arxiv.org/abs/2611.23624. Related threshold group testing: https://www.sciencedirect.com/science/article/pii/S0022000020300131.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 5
  • matroid_single_query_connectedness_witnessFor every nonempty distinguished subset of a ground type with at least two points, there are connected and disconnected full-ground…
  • matroid_threshold_pool_free_cubeConsider at most Cn pools on n points with positive C. Suppose D bounds every size whose harmonic number is at most 1+4C, T is at least…
  • matroid_connectedA matroid M on a type α is connected if for all elements e and f of its ground set M.E, either e = f or there is a circuit C of M that…
  • MFor a group $G$, $M$ is the set of elements $s \in G \setminus \{1\}$ such that $c_G(x) \le c_G(s)$ for all $x \in G \setminus \{1\}$.
  • cFor a group $G$ and an element $s \in G$, the local count $c_G(s)$ is the cardinality of the set of elements $g \in G$ such that…

Read back from the Lean

For any natural number $n$ such that $2^{256} \le n$, let $q = \lfloor \lfloor \log_2 n \rfloor / 256 \rfloor \cdot n$. For every family of $q$ query sets $P : \mathrm{Fin}\ q \to \mathrm{Finset}(\mathrm{Fin}\ n)$ and every adaptive second-round query strategy $R : (\mathrm{Fin}\ q \to \mathrm{Bool}) \to \mathrm{Fin}\ q \to \mathrm{Finset}(\mathrm{Fin}\ n)$, there exist: 1. a boolean response vector $u : \mathrm{Fin}\ q \to \mathrm{Bool}$, and 2. two matroids $M$ and $N$ on the ground set $\mathrm{Fin}\ n$, such that all of the following hold: - The ground set of $M$ is the entire universe $\mathrm{Set.univ}$ of $\mathrm{Fin}\ n$ ($M.E = \mathrm{Set.univ}$); - The ground set of $N$ is the entire universe $\mathrm{Set.univ}$ of $\mathrm{Fin}\ n$ ($N.E = \mathrm{Set.univ}$); - $M$ is connected according to matroid_connected; - $N$ is not connected according to matroid_connected; - For every index $i \in \mathrm{Fin}\ q$, $u(i) = \mathrm{true}$ if and only if $P(i)$ is an independent set in $M$, and $u(i) = \mathrm{true}$ if and only if $P(i)$ is an independent set in $N$ (i.e., both matroids answer the first round of queries with $u$); - For every index $i \in \mathrm{Fin}\ q$, the query set $R(u)(i)$ is independent in $M$ if and only if it is independent in $N$ (i.e., both matroids give identical independence answers to the second-round queries chosen based on $u$).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

A lower bound on deterministic two-batch matroid connectedness queries is established by constructing indistinguishable connected and disconnected matroids. The proof chooses a threshold pool using a parameter lemma to obtain an independent set of queries, then applies a transfer lemma that uses a counting argument to find a subset avoiding all queries and single-element deletions.

  1. Transfer lemma

    Shows pool two batch transfer

    lines 11–91

      classical
      have : Nontrivial (Fin n) := Fin.nontrivial_iff_two_le.mpr hn
      let u (i : Fin m) := decide ((P i ∩ K).card ≤ 1)
      let f (Z : Finset (Fin n)) := (K ∪ Z)ᶜ
      let choices := U.powerset.image f
      have hcard : choices.card = 2^U.card := by
        rw [show choices.card = _ from Finset.card_image_of_injOn ?_, Finset.card_powerset]
        intro A hA B hB hab
        have hA' := Finset.mem_powerset.mp hA
        have hB' := Finset.mem_powerset.mp hB
        have heq : K ∪ A = K ∪ B := compl_injective hab
        ext x
        by_cases hx : x ∈ K
        · have hxu := Finset.disjoint_left.mp hKU hx
          exact iff_of_false (fun ha => hxu (hA' ha)) (fun hb => hxu (hB' hb))
        · simpa [hx] using (Finset.ext_iff.mp heq x)
      let ex (i : Fin m) := insert (P i) (Finset.univ.image fun x : Fin n => (P i).erase x)
      let bad₁ := Finset.univ.biUnion ex
      let bad₂ := Finset.univ.image (R u)
      let bad := insert ∅ (insert Finset.univ (bad₁ ∪ bad₂))
      have hexc (i : Fin m) : (ex i).card ≤ n+1 :=
        (Finset.card_insert_le ..).trans (Nat.add_le_add_right
          (by simpa using (Finset.card_image_le (s := Finset.univ) (f := fun x : Fin n => (P i).erase x))) _)
      have h1 : bad₁.card ≤ m*(n+1) := by
        simpa [bad₁] using (Finset.card_biUnion_le_card_mul
          (Finset.univ : Finset (Fin m)) ex (n+1) (fun i _ => hexc i))
      have h2 : bad₂.card ≤ m := by simpa [bad₂] using (Finset.card_image_le (s := Finset.univ) (f := R u))
      have hbad : bad.card ≤ m*(n+2)+2 := by
        have a := Finset.card_insert_le (∅ : Finset (Fin n)) (insert Finset.univ (bad₁ ∪ bad₂))
        have b := Finset.card_insert_le (Finset.univ : Finset (Fin n)) (bad₁ ∪ bad₂)
        have c := Finset.card_union_le bad₁ bad₂
        dsimp only [bad]
        rw [show m*(n+2) = m*(n+1)+m by ring]
        omega
      obtain ⟨H,hH,hnobad⟩ := Finset.not_subset.mp (show ¬ choices ⊆ bad from
        fun h => (not_lt_of_ge ((Finset.card_le_card h).trans hbad)) (hcard ▸ hnum))
      obtain ⟨Z,hZ,hZH⟩ := Finset.mem_image.mp hH
      have hZU := Finset.mem_powerset.mp hZ
      have hnH : H.Nonempty := Finset.nonempty_iff_ne_empty.mpr (fun hh => hnobad (by simp [bad, hh]))
      have hpH : (H : Set (Fin n)) ≠ Set.univ := by
        intro hh
        have he : H = Finset.univ := Finset.coe_injective (by simpa using hh)
        exact hnobad (by simp [bad,he])
      have hn1 (i : Fin m) : H ∉ ex i := fun h => hnobad (by
        apply Finset.mem_insert_of_mem; apply Finset.mem_insert_of_mem
        exact Finset.mem_union_left _ (Finset.mem_biUnion.mpr ⟨i,Finset.mem_univ _,h⟩))
      have hnP (i : Fin m) : (P i : Set (Fin n)) ≠ (H : Set (Fin n)) := by
        intro h
        exact hn1 i (by rw [← Finset.coe_injective h]; apply Finset.mem_insert_self)
      have hnR (i : Fin m) : (R u i : Set (Fin n)) ≠ (H : Set (Fin n)) := by
        intro h
        apply hnobad; apply Finset.mem_insert_of_mem; apply Finset.mem_insert_of_mem
        exact Finset.mem_union_right _ (Finset.mem_image.mpr ⟨i,Finset.mem_univ _, Finset.coe_injective h⟩)
      obtain ⟨M,N,he,he',hc,hc',ho,hm⟩ := matroid_single_query_connectedness_witness
        (H : Set (Fin n)) (by simpa using hnH)
      refine ⟨u,M,N,he,he',hc,hc',fun i => ?_,fun i => ho _ (hnR i)⟩
      suffices hbit : u i = true ↔ M.Indep (P i : Set (Fin n)) from ⟨hbit,hbit.trans (ho _ (hnP i))⟩
      have hcompl : Hᶜ = K ∪ Z := by rw [← hZH]; simp [f]
      have hcardbit : u i = true ↔ (P i \ H).card ≤ 1 := by
        rw [Finset.sdiff_eq_inter_compl, hcompl, hmask _ hZU i]
        exact decide_eq_true_iff
      rw [hcardbit, hm hpH]
      constructor
      · intro h
        refine ⟨fun a ha b hb => Finset.card_le_one_iff.mp h
          (Finset.mem_sdiff.mpr ha) (Finset.mem_sdiff.mpr hb), ?_⟩
        intro hsub z hz
        by_contra hzH
        have hz' : z ∈ P i \ H := Finset.mem_sdiff.mpr ⟨hz,hzH⟩
        have heq : (P i).erase z = H := by
          ext y
          constructor
          · intro hy
            obtain ⟨hyz,hyi⟩ := Finset.mem_erase.mp hy
            by_contra hyH
            exact hyz (Finset.card_le_one_iff.mp h (Finset.mem_sdiff.mpr ⟨hyi,hyH⟩) hz')
          · intro hy
            exact Finset.mem_erase.mpr ⟨fun e => hzH (e ▸ hy), hsub hy⟩
        exact hn1 i (Finset.mem_insert_of_mem (Finset.mem_image.mpr ⟨z,Finset.mem_univ _,heq⟩))
      · rintro ⟨h,_⟩
        exact Finset.card_le_one_iff.mpr (fun ha hb => h (Finset.mem_sdiff.mp ha) (Finset.mem_sdiff.mp hb))
  2. Parameter lemma

    Shows pool log parameters

    lines 99–148

      let b := C+1
      let D : ℕ := 2^(10*b)
      let t := 1024*b
      let T := t*D+1
      let d := 4*C*T
      have hb : 0 < b := Nat.succ_pos _
      have hcb : C ≤ b := Nat.le_succ _
      have hbound (j : ℕ) (hj : harmonic j ≤ (1+4*C : ℚ)) : j ≤ D := by
        have hj' : (harmonic j : ℝ) ≤ (5*b : ℕ) := by
          have hc : (harmonic j : ℝ) ≤ 1+4*(C : ℝ) := by exact_mod_cast hj
          dsimp [b]; push_cast; linarith
        have he := Real.exp_le_exp.mpr ((log_add_one_le_harmonic j).trans hj')
        rw [Real.exp_log (show 0 < ((j+1 : ℕ) : ℝ) by exact_mod_cast Nat.succ_pos j)] at he
        have hpow : Real.exp (5*b : ℕ) ≤ (4 : ℝ)^(5*b) := by
          simpa [← Real.exp_nat_mul] using
            (pow_le_pow_left₀ (Real.exp_nonneg 1) (le_of_lt (lt_trans Real.exp_one_lt_three (by norm_num : (3:ℝ)<4))) (5*b))
        have h4 : (4 : ℝ)^(5*b) = (2 : ℝ)^(10*b) := by
          rw [show (4 : ℝ) = 2^2 by norm_num, ← pow_mul, show 2*(5*b)=10*b by ring]
        rw [h4] at hpow
        have hz := he.trans hpow
        dsimp [D]
        exact_mod_cast (Nat.le_of_succ_le (by exact_mod_cast hz) : j ≤ 2^(10*b))
      have hbpow : b ≤ 2^b := Nat.lt_two_pow_self.le
      have ht : t ≤ 2^(12*b) := calc
        _ ≤ 2^10 * 2^b := Nat.mul_le_mul_left 1024 hbpow
        _ = 2^(10+b) := (pow_add (2:ℕ) _ _).symm
        _ ≤ _ := Nat.pow_le_pow_right (by decide) (by omega)
      have incPow (a e : ℕ) (h : a ≤ 2^e) : a+1 ≤ 2^(e+1) := by
        rw [pow_succ]; have := Nat.two_pow_pos e; omega
      have prodPow (a a' e e' : ℕ) (h : a ≤ 2^e) (h' : a' ≤ 2^e') :
          a*a' ≤ 2^(e+e') := by rw [pow_add]; exact Nat.mul_le_mul h h'
      have hT0 := incPow _ _ (prodPow _ D _ (10*b) ht le_rfl)
      have hT : T ≤ 2^(23*b) := hT0.trans (Nat.pow_le_pow_right (by decide) (by omega))
      have h4C := prodPow 4 C 2 b (by decide) (hcb.trans hbpow)
      have hd0 := prodPow _ _ _ _ h4C hT
      have hd : d ≤ 2^(26*b) := hd0.trans (Nat.pow_le_pow_right (by decide) (by omega))
      have hB0 := incPow _ _ (prodPow _ _ _ _ hd hT)
      have hB : 1+d*T ≤ 2^(50*b) := by
        rw [Nat.add_comm]; exact hB0.trans (Nat.pow_le_pow_right (by decide) (by omega))
      have hsmall := prodPow 2 _ 1 _ (by decide)
        (prodPow _ _ _ _ ht (prodPow _ _ _ _ hB hB))
      have hfit : 2*(t*((1+d*T)*(1+d*T))) ≤ n := hsmall.trans
        ((Nat.pow_le_pow_right (by decide) (by dsimp [b]; omega : 1+(12*b+(50*b+50*b)) ≤ 256*C)).trans hlo)
      have hN1 := incPow n _ hhi
      have hN2 := incPow _ _ hN1
      have hm0 := prodPow _ _ _ _ (hcb.trans hbpow) hhi
      have htotal := incPow _ _ (incPow _ _ (prodPow _ _ _ _ hm0 hN2))
      have hs : (b + 256*(C+1) + (256*(C+1)+1+1)) + 1 + 1 < t := by dsimp [b,t]; omega
      have hlast := htotal.trans_lt (Nat.pow_lt_pow_right (by decide : 1 < 2) hs)
      exact ⟨t,D,T,d,hbound,le_rfl,rfl,hfit,hlast⟩
  3. Main theorem

    Concludes the main theorem

    lines 159–171

      let C := Nat.log 2 n / 256
      have hn2 : 2 ≤ n := (by decide : 2 ≤ 2^256).trans hn
      have hlog := (Nat.le_log_iff_pow_le (by decide : 1 < 2) (by omega : n ≠ 0)).mpr hn
      have hC : 0 < C := by dsimp [C]; omega
      have hL : 2^(256*C) ≤ n := (Nat.pow_le_pow_right (by decide : 0 < 2)
        (by dsimp [C]; omega : 256*C ≤ Nat.log 2 n)).trans (Nat.pow_log_le_self 2 (by omega))
      have hH : n ≤ 2^(256*(C+1)) := (Nat.lt_pow_succ_log_self (by decide : 1 < 2) n).le.trans
        (Nat.pow_le_pow_right (by decide) (by dsimp [C]; omega))
      obtain ⟨t,D,T,d,hD,hT,hd,hsize,hnum⟩ := pool_log_parameters C n hC hL hH
      intro q P R
      obtain ⟨K,U,hdis,hcard,hmask⟩ := matroid_threshold_pool_free_cube P hC (le_refl (C*n)) hD hT hd hsize
      apply pool_two_batch_transfer hn2 P R hdis hmask
      rwa [hcard]

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

private theorem pool_two_batch_transfer {n m : ℕ} (hn : 2 ≤ n)    (P : Fin m → Finset (Fin n)) (R : (Fin m → Bool) → Fin m → Finset (Fin n))    {K U : Finset (Fin n)} (hKU : Disjoint K U)    (hmask : ∀ Z ⊆ U, ∀ i, ((P i ∩ (K ∪ Z)).card ≤ 1 ↔ (P i ∩ K).card ≤ 1))    (hnum : m*(n+2)+2 < 2^U.card) :    ∃ u : Fin m → Bool, ∃ M N : Matroid (Fin n), M.E = Set.univ ∧ N.E = Set.univ ∧      matroid_connected M ∧ ¬ matroid_connected N ∧      (∀ i, (u i = true ↔ M.Indep (P i : Set (Fin n))) ∧        (u i = true ↔ N.Indep (P i : Set (Fin n)))) ∧      ∀ i, M.Indep (R u i : Set (Fin n)) ↔ N.Indep (R u i : Set (Fin n)) := by  classical  have : Nontrivial (Fin n) := Fin.nontrivial_iff_two_le.mpr hn  let u (i : Fin m) := decide ((P i ∩ K).card ≤ 1)  let f (Z : Finset (Fin n)) := (K ∪ Z)ᶜ  let choices := U.powerset.image f  have hcard : choices.card = 2^U.card := by    rw [show choices.card = _ from Finset.card_image_of_injOn ?_, Finset.card_powerset]    intro A hA B hB hab    have hA' := Finset.mem_powerset.mp hA    have hB' := Finset.mem_powerset.mp hB    have heq : K ∪ A = K ∪ B := compl_injective hab    ext x    by_cases hx : x ∈ K    · have hxu := Finset.disjoint_left.mp hKU hx      exact iff_of_false (fun ha => hxu (hA' ha)) (fun hb => hxu (hB' hb))    · simpa [hx] using (Finset.ext_iff.mp heq x)  let ex (i : Fin m) := insert (P i) (Finset.univ.image fun x : Fin n => (P i).erase x)  let bad₁ := Finset.univ.biUnion ex  let bad₂ := Finset.univ.image (R u)  let bad := insert ∅ (insert Finset.univ (bad₁ ∪ bad₂))  have hexc (i : Fin m) : (ex i).card ≤ n+1 :=    (Finset.card_insert_le ..).trans (Nat.add_le_add_right      (by simpa using (Finset.card_image_le (s := Finset.univ) (f := fun x : Fin n => (P i).erase x))) _)  have h1 : bad₁.card ≤ m*(n+1) := by    simpa [bad₁] using (Finset.card_biUnion_le_card_mul      (Finset.univ : Finset (Fin m)) ex (n+1) (fun i _ => hexc i))  have h2 : bad₂.card ≤ m := by simpa [bad₂] using (Finset.card_image_le (s := Finset.univ) (f := R u))  have hbad : bad.card ≤ m*(n+2)+2 := by    have a := Finset.card_insert_le (∅ : Finset (Fin n)) (insert Finset.univ (bad₁ ∪ bad₂))    have b := Finset.card_insert_le (Finset.univ : Finset (Fin n)) (bad₁ ∪ bad₂)    have c := Finset.card_union_le bad₁ bad₂    dsimp only [bad]    rw [show m*(n+2) = m*(n+1)+m by ring]    omega  obtain ⟨H,hH,hnobad⟩ := Finset.not_subset.mp (show ¬ choices ⊆ bad from    fun h => (not_lt_of_ge ((Finset.card_le_card h).trans hbad)) (hcard ▸ hnum))  obtain ⟨Z,hZ,hZH⟩ := Finset.mem_image.mp hH  have hZU := Finset.mem_powerset.mp hZ  have hnH : H.Nonempty := Finset.nonempty_iff_ne_empty.mpr (fun hh => hnobad (by simp [bad, hh]))  have hpH : (H : Set (Fin n)) ≠ Set.univ := by    intro hh    have he : H = Finset.univ := Finset.coe_injective (by simpa using hh)    exact hnobad (by simp [bad,he])  have hn1 (i : Fin m) : H ∉ ex i := fun h => hnobad (by    apply Finset.mem_insert_of_mem; apply Finset.mem_insert_of_mem    exact Finset.mem_union_left _ (Finset.mem_biUnion.mpr ⟨i,Finset.mem_univ _,h⟩))  have hnP (i : Fin m) : (P i : Set (Fin n)) ≠ (H : Set (Fin n)) := by    intro h    exact hn1 i (by rw [← Finset.coe_injective h]; apply Finset.mem_insert_self)  have hnR (i : Fin m) : (R u i : Set (Fin n)) ≠ (H : Set (Fin n)) := by    intro h    apply hnobad; apply Finset.mem_insert_of_mem; apply Finset.mem_insert_of_mem    exact Finset.mem_union_right _ (Finset.mem_image.mpr ⟨i,Finset.mem_univ _, Finset.coe_injective h⟩)  obtain ⟨M,N,he,he',hc,hc',ho,hm⟩ := matroid_single_query_connectedness_witness    (H : Set (Fin n)) (by simpa using hnH)  refine ⟨u,M,N,he,he',hc,hc',fun i => ?_,fun i => ho _ (hnR i)⟩  suffices hbit : u i = true ↔ M.Indep (P i : Set (Fin n)) from ⟨hbit,hbit.trans (ho _ (hnP i))⟩  have hcompl : Hᶜ = K ∪ Z := by rw [← hZH]; simp [f]  have hcardbit : u i = true ↔ (P i \ H).card ≤ 1 := by    rw [Finset.sdiff_eq_inter_compl, hcompl, hmask _ hZU i]    exact decide_eq_true_iff  rw [hcardbit, hm hpH]  constructor  · intro h    refine ⟨fun a ha b hb => Finset.card_le_one_iff.mp h      (Finset.mem_sdiff.mpr ha) (Finset.mem_sdiff.mpr hb), ?_⟩    intro hsub z hz    by_contra hzH    have hz' : z ∈ P i \ H := Finset.mem_sdiff.mpr ⟨hz,hzH⟩    have heq : (P i).erase z = H := by      ext y      constructor      · intro hy        obtain ⟨hyz,hyi⟩ := Finset.mem_erase.mp hy        by_contra hyH        exact hyz (Finset.card_le_one_iff.mp h (Finset.mem_sdiff.mpr ⟨hyi,hyH⟩) hz')      · intro hy        exact Finset.mem_erase.mpr ⟨fun e => hzH (e ▸ hy), hsub hy⟩    exact hn1 i (Finset.mem_insert_of_mem (Finset.mem_image.mpr ⟨z,Finset.mem_univ _,heq⟩))  · rintro ⟨h,_⟩    exact Finset.card_le_one_iff.mpr (fun ha hb => h (Finset.mem_sdiff.mp ha) (Finset.mem_sdiff.mp hb))private theorem pool_log_parameters (C n : ℕ) (hC : 0 < C)    (hlo : 2^(256*C) ≤ n) (hhi : n ≤ 2^(256*(C+1))) :    ∃ t D T d : ℕ, (∀ j, harmonic j ≤ (1+4*C : ℚ) → j ≤ D) ∧      t*D+1 ≤ T ∧ d = 4*C*T ∧ 2*(t*((1+d*T)*(1+d*T))) ≤ n ∧      C*n*(n+2)+2 < 2^t := by  let b := C+1  let D : ℕ := 2^(10*b)  let t := 1024*b  let T := t*D+1  let d := 4*C*T  have hb : 0 < b := Nat.succ_pos _  have hcb : C ≤ b := Nat.le_succ _  have hbound (j : ℕ) (hj : harmonic j ≤ (1+4*C : ℚ)) : j ≤ D := by    have hj' : (harmonic j : ℝ) ≤ (5*b : ℕ) := by      have hc : (harmonic j : ℝ) ≤ 1+4*(C : ℝ) := by exact_mod_cast hj      dsimp [b]; push_cast; linarith    have he := Real.exp_le_exp.mpr ((log_add_one_le_harmonic j).trans hj')    rw [Real.exp_log (show 0 < ((j+1 : ℕ) : ℝ) by exact_mod_cast Nat.succ_pos j)] at he    have hpow : Real.exp (5*b : ℕ) ≤ (4 : ℝ)^(5*b) := by      simpa [← Real.exp_nat_mul] using        (pow_le_pow_left₀ (Real.exp_nonneg 1) (le_of_lt (lt_trans Real.exp_one_lt_three (by norm_num : (3:ℝ)<4))) (5*b))    have h4 : (4 : ℝ)^(5*b) = (2 : ℝ)^(10*b) := by      rw [show (4 : ℝ) = 2^2 by norm_num, ← pow_mul, show 2*(5*b)=10*b by ring]    rw [h4] at hpow    have hz := he.trans hpow    dsimp [D]    exact_mod_cast (Nat.le_of_succ_le (by exact_mod_cast hz) : j ≤ 2^(10*b))  have hbpow : b ≤ 2^b := Nat.lt_two_pow_self.le  have ht : t ≤ 2^(12*b) := calc    _ ≤ 2^10 * 2^b := Nat.mul_le_mul_left 1024 hbpow    _ = 2^(10+b) := (pow_add (2:ℕ) _ _).symm    _ ≤ _ := Nat.pow_le_pow_right (by decide) (by omega)  have incPow (a e : ℕ) (h : a ≤ 2^e) : a+1 ≤ 2^(e+1) := by    rw [pow_succ]; have := Nat.two_pow_pos e; omega  have prodPow (a a' e e' : ℕ) (h : a ≤ 2^e) (h' : a' ≤ 2^e') :      a*a' ≤ 2^(e+e') := by rw [pow_add]; exact Nat.mul_le_mul h h'  have hT0 := incPow _ _ (prodPow _ D _ (10*b) ht le_rfl)  have hT : T ≤ 2^(23*b) := hT0.trans (Nat.pow_le_pow_right (by decide) (by omega))  have h4C := prodPow 4 C 2 b (by decide) (hcb.trans hbpow)  have hd0 := prodPow _ _ _ _ h4C hT  have hd : d ≤ 2^(26*b) := hd0.trans (Nat.pow_le_pow_right (by decide) (by omega))  have hB0 := incPow _ _ (prodPow _ _ _ _ hd hT)  have hB : 1+d*T ≤ 2^(50*b) := by    rw [Nat.add_comm]; exact hB0.trans (Nat.pow_le_pow_right (by decide) (by omega))  have hsmall := prodPow 2 _ 1 _ (by decide)    (prodPow _ _ _ _ ht (prodPow _ _ _ _ hB hB))  have hfit : 2*(t*((1+d*T)*(1+d*T))) ≤ n := hsmall.trans    ((Nat.pow_le_pow_right (by decide) (by dsimp [b]; omega : 1+(12*b+(50*b+50*b)) ≤ 256*C)).trans hlo)  have hN1 := incPow n _ hhi  have hN2 := incPow _ _ hN1  have hm0 := prodPow _ _ _ _ (hcb.trans hbpow) hhi  have htotal := incPow _ _ (incPow _ _ (prodPow _ _ _ _ hm0 hN2))  have hs : (b + 256*(C+1) + (256*(C+1)+1+1)) + 1 + 1 < t := by dsimp [b,t]; omega  have hlast := htotal.trans_lt (Nat.pow_lt_pow_right (by decide : 1 < 2) hs)  exact ⟨t,D,T,d,hbound,le_rfl,rfl,hfit,hlast⟩theorem matroid_two_batch_connectedness_log_lower (n : ℕ) (hn : 2^256 ≤ n) :    let q := (Nat.log 2 n / 256)*n    ∀ (P : Fin q → Finset (Fin n))      (R : (Fin q → Bool) → Fin q → Finset (Fin n)),      ∃ u : Fin q → Bool, ∃ M N : Matroid (Fin n),        M.E = Set.univ ∧ N.E = Set.univ ∧ matroid_connected M ∧ ¬ matroid_connected N ∧        (∀ i, (u i = true ↔ M.Indep (P i : Set (Fin n))) ∧          (u i = true ↔ N.Indep (P i : Set (Fin n)))) ∧        ∀ i, M.Indep (R u i : Set (Fin n)) ↔ N.Indep (R u i : Set (Fin n)) := by  let C := Nat.log 2 n / 256  have hn2 : 2 ≤ n := (by decide : 2 ≤ 2^256).trans hn  have hlog := (Nat.le_log_iff_pow_le (by decide : 1 < 2) (by omega : n ≠ 0)).mpr hn  have hC : 0 < C := by dsimp [C]; omega  have hL : 2^(256*C) ≤ n := (Nat.pow_le_pow_right (by decide : 0 < 2)    (by dsimp [C]; omega : 256*C ≤ Nat.log 2 n)).trans (Nat.pow_log_le_self 2 (by omega))  have hH : n ≤ 2^(256*(C+1)) := (Nat.lt_pow_succ_log_self (by decide : 1 < 2) n).le.trans    (Nat.pow_le_pow_right (by decide) (by dsimp [C]; omega))  obtain ⟨t,D,T,d,hD,hT,hd,hsize,hnum⟩ := pool_log_parameters C n hC hL hH  intro q P R  obtain ⟨K,U,hdis,hcard,hmask⟩ := matroid_threshold_pool_free_cube P hC (le_refl (C*n)) hD hT hd hsize  apply pool_two_batch_transfer hn2 P R hdis hmask  rwa [hcard]
See it in the graphDiscuss this resultChallenge it