22Released under Apache 2.0 license as described in the file LICENSE.
33Authors: Ilia Vlasov
44-/
5- import Mathlib.Algebra.Field.Rat
6- import Mathlib.Analysis.Convex.Function
7- import Mathlib.Data.Real.Sqrt
8- import Mathlib.Data.Set.Pairwise.Basic
9- import Mathlib.Algebra.BigOperators.Field
10- import Mathlib.Analysis.Convex.Jensen
11- import Mathlib.Algebra.Module.LinearMap.Defs
12-
13- import ArkLib.Data.CodingTheory.Basic
14- import ArkLib.Data.CodingTheory.JohnsonBound.Choose2
15- import ArkLib.Data.CodingTheory.JohnsonBound.Expectations
165import ArkLib.Data.CodingTheory.JohnsonBound.Lemmas
176
187namespace JohnsonBound
@@ -27,7 +16,8 @@ In what follows we reference theorems from [listdecoding] by default.
2716 -/
2817
2918variable {n : ℕ}
30- variable {F : Type } [Fintype F] [DecidableEq F]
19+ {F : Type } [Fintype F] [DecidableEq F]
20+ {B : Finset (Fin n → F)} {v : Fin n → F}
3121
3222/--
3323The denominator of the bound from theorem 3.1.
@@ -39,9 +29,9 @@ def JohnsonDenominator (B : Finset (Fin n → F)) (v : Fin n → F) : ℚ :=
3929 let frac := q / (q - 1 )
4030 (1 - frac * e/n) ^ 2 - (1 - frac * d/n)
4131
42- lemma johnson_denominator_def {B : Finset (Fin n → F)} {v : Fin n → F} :
43- JohnsonDenominator B v = ((1 - ((Fintype.card F : ℚ ) / (Fintype.card F - 1 )) * (e B v / n)) ^ 2
44- - (1 - ((Fintype.card F : ℚ ) / (Fintype.card F - 1 )) * (d B/n))) := by
32+ lemma johnson_denominator_def :
33+ JohnsonDenominator B v = ((1 - ((Fintype.card F) / (Fintype.card F - 1 )) * (e B v / n)) ^ 2
34+ - (1 - ((Fintype.card F) / (Fintype.card F - 1 )) * (d B/n))) := by
4535 simp [JohnsonDenominator]
4636 field_simp
4737
@@ -81,73 +71,37 @@ lemma johnson_condition_weak_implies_strong {B : Finset (Fin n → F)} {v : Fin
8171 sorry
8272
8373private lemma johnson_condition_strong_implies_n_pos {B : Finset (Fin n → F)} {v : Fin n → F}
74+ private lemma johnson_condition_strong_implies_n_pos
8475 (h_johnson : JohnsonConditionStrong B v)
8576 :
8677 0 < n := by
8778 cases n <;> try simp [JohnsonConditionStrong] at *
8879
89- private lemma johnson_condition_strong_implies_2_le_F_card {B : Finset (Fin n → F)} {v : Fin n → F}
80+ private lemma johnson_condition_strong_implies_2_le_F_card
9081 (h_johnson : JohnsonConditionStrong B v)
9182 :
9283 2 ≤ Fintype.card F := by
93- generalize h : Fintype.card F = card
94- rcases card with _ | card
95- · simp [JohnsonConditionStrong] at h_johnson
96- rw [h] at h_johnson
97- simp at h_johnson
98- · rcases card with _ | card
99- · simp [JohnsonConditionStrong] at h_johnson
100- rw [h] at h_johnson
101- simp at h_johnson
102- · omega
84+ revert h_johnson
85+ dsimp [JohnsonConditionStrong]
86+ rcases Fintype.card F with _ | _ | _ <;> aesop
10387
10488private lemma johnson_condition_strong_implies_2_le_B_card {B : Finset (Fin n → F)} {v : Fin n → F}
89+ private lemma johnson_condition_strong_implies_2_le_B_card
10590 (h_johnson : JohnsonConditionStrong B v)
10691 :
10792 2 ≤ B.card := by
108- generalize h : B.card = card
109- rcases card with _ | card
110- · simp [JohnsonConditionStrong] at *
111- simp [e, d] at *
112- subst h
113- simp at h_johnson
114- · rcases card with _ | card
115- · simp [JohnsonConditionStrong] at *
116- simp [e, d] at *
117- rw [h] at h_johnson
118- simp [choose_2] at h_johnson
119- have h_set := Finset.card_eq_one.1 h
120- rcases h_set with ⟨a, h_set⟩
121- rw [h_set] at h_johnson
122- simp at h_johnson
123- generalize hq : Fintype.card F = q
124- rcases q with _ | q
125- · simp [hq] at h_johnson
126- · rcases q with _ | q
127- · simp [hq] at h_johnson
128- · have h : (Fintype.card F : ℚ) /((Fintype.card F : ℚ) - 1 ) =
129- (1 : ℚ) + (1 :ℚ)/((Fintype.card F : ℚ) - 1 ) := by
130- have h : (Fintype.card F : ℚ) = ((Fintype.card F : ℚ) - 1 ) + 1 := by ring
131- conv =>
132- lhs
133- congr
134- rw [h]
135- rfl
136- rfl
137- rw [Field.div_eq_mul_inv, Field.div_eq_mul_inv]
138- rw [add_mul]
139- rw [Field.mul_inv_cancel _ (by {
140- rw [hq]
141- simp
142- aesop
143- })]
144- rw [h] at h_johnson
145- have h' := JohnsonBound.a_lemma_im_not_proud_of (v := v) (a := a) (by omega)
146- have h : (1 :ℚ) < (1 : ℚ) := by
147- apply lt_of_lt_of_le h_johnson
148- assumption
149- simp at h
150- · omega
93+ dsimp [JohnsonConditionStrong] at h_johnson
94+ rcases eq : B.card with _ | card | _ <;> [simp_all [e, d]; skip; omega]
95+ obtain ⟨a, ha⟩ := Finset.card_eq_one.1 eq
96+ replace h_johnson : 1 < |1 - (Fintype.card F) / ((Fintype.card F) - 1 ) * Δ₀(v, a) / (n : ℚ)| := by
97+ simp_all [e, d, choose_2]
98+ generalize eq₁ : Fintype.card F = q
99+ rcases q with _ | _ | q <;> [simp_all; simp_all; skip]
100+ have h : (Fintype.card F : ℚ) / (Fintype.card F - 1 ) = 1 + 1 / (Fintype.card F - 1 ) := by
101+ have : (Fintype.card F : ℚ) - 1 ≠ 0 := by simp [sub_eq_zero]; omega
102+ field_simp
103+ have h' := JohnsonBound.abs_one_sub_div_le_one (v := v) (a := a) (by omega)
104+ exact absurd (lt_of_lt_of_le (h ▸ h_johnson) h') (lt_irrefl _)
151105
152106/--
153107`JohnsonConditionStrong` is equvalent to `JohnsonDenominator` being positive.
@@ -160,6 +114,11 @@ lemma johnson_condition_strong_iff_johnson_denom_pos {B : Finset (Fin n → F)}
160114Theorem 3.1.
161115--/
162116theorem johnson_bound [Field F] {B : Finset (Fin n → F)} {v : Fin n → F}
117+ lemma johnson_condition_strong_iff_johnson_denom_pos :
118+ JohnsonConditionStrong B v ↔ 0 < JohnsonDenominator B v := by
119+ simp [JohnsonDenominator, JohnsonConditionStrong]
120+
121+ theorem johnson_bound_OLD [Field F]
163122 (h_condition : JohnsonConditionStrong B v)
164123 :
165124 let d := d B
@@ -175,7 +134,7 @@ theorem johnson_bound [Field F] {B : Finset (Fin n → F)} {v : Fin n → F}
175134 rw [mul_assoc, mul_comm ((_)⁻¹) _, Field.mul_inv_cancel _ (by linarith)]
176135 simp
177136 rw [johnson_denominator_def]
178- apply JohnsonBound.johnson_bound_lemma
137+ exact JohnsonBound.johnson_bound_lemma
179138 (johnson_condition_strong_implies_n_pos h_condition')
180139 (johnson_condition_strong_implies_2_le_B_card h_condition')
181140 (johnson_condition_strong_implies_2_le_F_card h_condition')
@@ -198,5 +157,24 @@ theorem johnson_bound_alphabet_free [Field F] [DecidableEq F]
198157 →
199158 (B ∩ ({ x | Δ₀(x, v) ≤ e } : Finset _)).card ≤ q * d * n := by
200159 sorry
160+ theorem johnson_bound [Field F]
161+ (h_condition : JohnsonConditionStrong B v)
162+ :
163+ let d := d B
164+ let q : ℚ := Fintype.card F
165+ let frac := q / (q - 1 )
166+ B.card ≤ (frac * d/n) / JohnsonDenominator B v
167+ := by
168+ suffices B.card * JohnsonDenominator B v ≤
169+ Fintype.card F / (Fintype.card F - 1 ) * d B / n by
170+ rw [johnson_condition_strong_iff_johnson_denom_pos] at h_condition
171+ rw [←mul_le_mul_right h_condition]
172+ convert this using 1
173+ field_simp; rw [mul_div_mul_right]; linarith
174+ rw [johnson_denominator_def]
175+ exact JohnsonBound.johnson_bound_lemma
176+ (johnson_condition_strong_implies_n_pos h_condition)
177+ (johnson_condition_strong_implies_2_le_B_card h_condition)
178+ (johnson_condition_strong_implies_2_le_F_card h_condition)
201179
202180end JohnsonBound
0 commit comments