Assuming n is a multiple of 4 and n≥8, the block sensitivity of nisanExample is 3n/4, achieved by any x with Hamming weight n/2. An optimal block configuration uses all n/2 one-bits as singleton blocks and forms n/4 disjoint size-2 blocks from the zero-bits.
Stored at check time. Anyone can fetch and re-check this answer.
Verdict
Lean checked the assigned statement and its axiom dependencies.
Checking program
Lean checking program 0.2.0
Lean toolchain
leanprover/lean4:v4.33.1
Library
formal-conjectures at f606af160664
Statement
Exact statement of StrongSensitivityConjecture.nisanExample_blockSensitivity in FormalConjectures.Paper.StrongSensitivityConjecture.
Axioms used
Classical.choice, Quot.sound, propext
Axioms allowed
propext, Classical.choice, Quot.sound. Any other axiom or placeholder is turned down.
Human confirmation
Not needed; the checking program's verdict settles this problem.
Long horizon. The formalization checks exact sensitivity and block sensitivity values for Nisan's Boolean function, an example separating these two complexity measures. Verified mathematics.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283import FormalConjectures.Paper.StrongSensitivityConjecture
namespace Submission
open StrongSensitivityConjecture Finset
lemma weight_flip {n : ℕ} (x : Fin n → Bool) (B : Finset (Fin n)) :
(univ.filter fun j => StrongSensitivityConjecture.flip x B j = true).card
+ (B.filter fun j => x j = true).card
= (univ.filter fun j => x j = true).card + (B.filter fun j => x j = false).card := by
have h1 : (B.filter fun j => x j = true).card
= (univ.filter fun j => j ∈ B ∧ x j = true).card := by
congr 1; ext j; simp
have h2 : (B.filter fun j => x j = false).card
= (univ.filter fun j => j ∈ B ∧ x j = false).card := by
congr 1; ext j; simp
rw [h1, h2, Finset.card_filter, Finset.card_filter, Finset.card_filter, Finset.card_filter,
← Finset.sum_add_distrib, ← Finset.sum_add_distrib]
refine Finset.sum_congr rfl fun j _ => ?_
by_cases hj : j ∈ B <;> cases hx : x j <;>
simp [StrongSensitivityConjecture.flip, hj, hx]
lemma nisan_iff (m : ℕ) (y : Fin (4 * m) → Bool) :
nisanExample (4 * m) y = true ↔
((univ.filter fun i => y i = true).card = 2 * m ∨
(univ.filter fun i => y i = true).card = 2 * m + 1) := by
have h2 : ((4 * m : ℕ) : ℚ) / 2 = ((2 * m : ℕ) : ℚ) := by push_cast; ring
unfold nisanExample
simp only [decide_eq_true_eq, Finset.mem_insert, Finset.mem_singleton, h2]
norm_cast
lemma sum_card_filter_le {N : ℕ} (cB : Finset (Finset (Fin N)))
(hd : (cB : Set (Finset (Fin N))).PairwiseDisjoint id) (P : Fin N → Prop)
[DecidablePred P] :
∑ B ∈ cB, (B.filter P).card ≤ (univ.filter P).card := by
have hfam : (cB : Set (Finset (Fin N))).PairwiseDisjoint (fun B => B.filter P) :=
fun B hB B' hB' hne => Finset.disjoint_filter_filter (hd hB hB' hne)
rw [← Finset.card_biUnion hfam]
apply Finset.card_le_card
intro j hj
obtain ⟨B, -, hjB⟩ := Finset.mem_biUnion.mp hj
exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, (Finset.mem_filter.mp hjB).2⟩
lemma combo {N : ℕ} (cB : Finset (Finset (Fin N))) (a b : Finset (Fin N) → ℕ)
(α β k : ℕ) (hk : ∀ B ∈ cB, k ≤ α * a B + β * b B) :
k * cB.card ≤ α * ∑ B ∈ cB, a B + β * ∑ B ∈ cB, b B := by
have h := Finset.card_nsmul_le_sum cB (fun B => α * a B + β * b B) k hk
simp only [Finset.sum_add_distrib, ← Finset.mul_sum, smul_eq_mul] at h
linarith
lemma block_bound (m : ℕ) (hm : 2 ≤ m) (x : Fin (4 * m) → Bool)
(cB : Finset (Finset (Fin (4 * m))))
(hd : (cB : Set (Finset (Fin (4 * m)))).PairwiseDisjoint id)
(hs : ∀ B ∈ cB, nisanExample (4 * m) (StrongSensitivityConjecture.flip x B)
≠ nisanExample (4 * m) x) :
cB.card ≤ 3 * m := by
have key : ∀ p q : Bool, p ≠ q → (p = true ↔ ¬ q = true) := by decide
have hblk : ∀ B ∈ cB,
(univ.filter fun j => StrongSensitivityConjecture.flip x B j = true).card
+ (B.filter fun j => x j = true).card
= (univ.filter fun j => x j = true).card + (B.filter fun j => x j = false).card ∧
(((univ.filter fun j => StrongSensitivityConjecture.flip x B j = true).card = 2 * m ∨
(univ.filter fun j => StrongSensitivityConjecture.flip x B j = true).card = 2 * m + 1)
∧ ¬ ((univ.filter fun j => x j = true).card = 2 * m ∨
(univ.filter fun j => x j = true).card = 2 * m + 1)
∨ ¬ ((univ.filter fun j => StrongSensitivityConjecture.flip x B j = true).card = 2 * m ∨
(univ.filter fun j => StrongSensitivityConjecture.flip x B j = true).card = 2 * m + 1)
∧ ((univ.filter fun j => x j = true).card = 2 * m ∨
(univ.filter fun j => x j = true).card = 2 * m + 1)) := by
intro B hB
refine ⟨weight_flip x B, ?_⟩
have := key _ _ (hs B hB)
rw [nisan_iff, nisan_iff] at this
tauto
have hA := sum_card_filter_le cB hd (fun j => x j = true)
have hZ := sum_card_filter_le cB hd (fun j => x j = false)
have hwz : (univ.filter fun j => x j = true).card
+ (univ.filter fun j => x j = false).card = 4 * m := by
have e : (univ.filter fun j => x j = false) = univ.filter fun j => ¬ (x j = true) := by
ext j; simp
rw [e, Finset.card_filter_add_card_filter_not]
simp
set w := (univ.filter fun j => x j = true).card with hw_def
set z := (univ.filter fun j => x j = false).card with hz_def
by_cases hP : w = 2 * m ∨ w = 2 * m + 1
· rcases hP with hw | hw
· have h := combo cB (fun B => (B.filter fun j => x j = true).card)
(fun B => (B.filter fun j => x j = false).card) 2 1 2 (by
intro B hB
obtain ⟨h1, h2⟩ := hblk B hB
omega)
omega
· have h := combo cB (fun B => (B.filter fun j => x j = true).card)
(fun B => (B.filter fun j => x j = false).card) 1 2 2 (by
intro B hB
obtain ⟨h1, h2⟩ := hblk B hB
omega)
omega
· by_cases hC : w + 1 = 2 * m
· have h := combo cB (fun B => (B.filter fun j => x j = true).card)
(fun B => (B.filter fun j => x j = false).card) 0 1 1 (by
intro B hB
obtain ⟨h1, h2⟩ := hblk B hB
omega)
omega
· by_cases hD : w = 2 * m + 2
· have h := combo cB (fun B => (B.filter fun j => x j = true).card)
(fun B => (B.filter fun j => x j = false).card) 1 0 1 (by
intro B hB
obtain ⟨h1, h2⟩ := hblk B hB
omega)
omega
· have h := combo cB (fun B => (B.filter fun j => x j = true).card)
(fun B => (B.filter fun j => x j = false).card) 1 1 2 (by
intro B hB
obtain ⟨h1, h2⟩ := hblk B hB
omega)
omega
lemma upper (m : ℕ) (hm : 2 ≤ m) (x : Fin (4 * m) → Bool) :
blockSensitivityAt (nisanExample (4 * m)) x ≤ 3 * m := by
unfold blockSensitivityAt
apply Finset.sup_le
intro cB hcB
simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hcB
unfold IsValidBlockConfig at hcB
exact block_bound m hm x cB hcB.1 hcB.2
/-- Witness input: the first `2m` coordinates are one-bits, the rest are zero-bits. -/def wit (m : ℕ) : Fin (4 * m) → Bool := fun i => decide ((i : ℕ) < 2 * m)
/-- Singleton block on a one-bit. -/def blkS (m : ℕ) (j : Fin (2 * m)) : Finset (Fin (4 * m)) :=
{⟨(j : ℕ), lt_of_lt_of_le j.isLt (by omega)⟩}
/-- Pair block on two zero-bits. -/def blkP (m : ℕ) (j : Fin m) : Finset (Fin (4 * m)) :=
{⟨2 * m + (j : ℕ), by have := j.isLt; omega⟩, ⟨3 * m + (j : ℕ), by have := j.isLt; omega⟩}
/-- The `3m` blocks: `2m` singletons and `m` pairs. -/def witBlocks (m : ℕ) : Finset (Finset (Fin (4 * m))) :=
(univ : Finset (Fin (2 * m) ⊕ Fin m)).image (Sum.elim (blkS m) (blkP m))
lemma blkP_card (m : ℕ) (j : Fin m) : (blkP m j).card = 2 := by
apply Finset.card_pair
intro h
have := congrArg Fin.val h
simp only [Fin.val_mk] at this
have := j.isLt
omega
lemma witBlocks_card (m : ℕ) : (witBlocks m).card = 3 * m := by
have hinj : Function.Injective (Sum.elim (blkS m) (blkP m)) := by
rintro (a | a) (b | b) h <;> simp only [Sum.elim_inl, Sum.elim_inr] at h
· unfold blkS at h
have h' := Fin.mk.inj (Finset.singleton_inj.mp h)
exact congrArg Sum.inl (Fin.ext h')
· exfalso
have hc := congrArg Finset.card h
simp only [blkS, Finset.card_singleton] at hc
rw [blkP_card] at hc
omega
· exfalso
have hc := congrArg Finset.card h
simp only [blkS, Finset.card_singleton] at hc
rw [blkP_card] at hc
omega
· have hmem : (⟨2 * m + (a : ℕ), by have := a.isLt; omega⟩ : Fin (4 * m)) ∈ blkP m b := by
rw [← h]
unfold blkP
simp
unfold blkP at hmem
simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff, Fin.val_mk] at hmem
have := a.isLt
have := b.isLt
have hab : (a : ℕ) = (b : ℕ) := by omega
exact congrArg Sum.inr (Fin.ext hab)
rw [witBlocks, Finset.card_image_of_injective _ hinj, Finset.card_univ, Fintype.card_sum,
Fintype.card_fin, Fintype.card_fin]
omega
lemma witBlocks_disj (m : ℕ) :
(witBlocks m : Set (Finset (Fin (4 * m)))).PairwiseDisjoint id := by
intro B hB B' hB' hne
rw [witBlocks, Finset.mem_coe, Finset.mem_image] at hB hB'
obtain ⟨p, -, rfl⟩ := hB
obtain ⟨q, -, rfl⟩ := hB'
rcases p with a | a <;> rcases q with b | b
· have hab : (a : ℕ) ≠ (b : ℕ) := fun h => hne (by rw [Fin.ext h])
simp only [Function.onFun, id, Sum.elim_inl]
rw [Finset.disjoint_left]
intro y hy hy'
simp only [blkS, Finset.mem_singleton, Fin.ext_iff, Fin.val_mk] at hy hy'
omega
· simp only [Function.onFun, id, Sum.elim_inl, Sum.elim_inr]
rw [Finset.disjoint_left]
intro y hy hy'
simp only [blkS, blkP, Finset.mem_singleton, Finset.mem_insert, Fin.ext_iff,
Fin.val_mk] at hy hy'
have := a.isLt
omega
· simp only [Function.onFun, id, Sum.elim_inl, Sum.elim_inr]
rw [Finset.disjoint_left]
intro y hy hy'
simp only [blkS, blkP, Finset.mem_singleton, Finset.mem_insert, Fin.ext_iff,
Fin.val_mk] at hy hy'
have := b.isLt
omega
· have hab : (a : ℕ) ≠ (b : ℕ) := fun h => hne (by rw [Fin.ext h])
simp only [Function.onFun, id, Sum.elim_inr]
rw [Finset.disjoint_left]
intro y hy hy'
simp only [blkP, Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff, Fin.val_mk] at hy hy'
have := a.isLt
have := b.isLt
omega
lemma wit_weight (m : ℕ) : (univ.filter fun j : Fin (4 * m) => wit m j = true).card = 2 * m := by
simp only [wit, decide_eq_true_eq]
rw [Fin.card_filter_val_lt]
omega
lemma blkS_counts (m : ℕ) (a : Fin (2 * m)) :
((blkS m a).filter fun j => wit m j = true).card = 1 ∧
((blkS m a).filter fun j => wit m j = false).card = 0 := by
have ha := a.isLt
simp [blkS, wit, Finset.filter_singleton, ha]
lemma blkP_counts (m : ℕ) (j : Fin m) :
((blkP m j).filter fun k => wit m k = true).card = 0 ∧
((blkP m j).filter fun k => wit m k = false).card = 2 := by
have hj := j.isLt
have hall : ∀ k ∈ blkP m j, wit m k = false := by
intro k hk
unfold blkP at hk
simp only [Finset.mem_insert, Finset.mem_singleton] at hk
rcases hk with rfl | rfl <;> simp [wit] <;> omega
constructor
· rw [Finset.filter_false_of_mem (fun k hk => by simp [hall k hk]), Finset.card_empty]
· rw [Finset.filter_true_of_mem hall, blkP_card]
lemma witBlocks_sens (m : ℕ) :
∀ B ∈ witBlocks m, nisanExample (4 * m) (StrongSensitivityConjecture.flip (wit m) B)
≠ nisanExample (4 * m) (wit m) := by
intro B hB
rw [witBlocks, Finset.mem_image] at hB
obtain ⟨p, -, rfl⟩ := hB
have hw0 : nisanExample (4 * m) (wit m) = true := (nisan_iff m (wit m)).2 (Or.inl (wit_weight m))
rw [hw0, ne_eq, nisan_iff]
rcases p with a | a
· rw [show Sum.elim (blkS m) (blkP m) (Sum.inl a) = blkS m a from rfl]
obtain ⟨c1, c0⟩ := blkS_counts m a
have hw := weight_flip (wit m) (blkS m a)
rw [c1, c0, wit_weight] at hw
omega
· rw [show Sum.elim (blkS m) (blkP m) (Sum.inr a) = blkP m a from rfl]
obtain ⟨c1, c0⟩ := blkP_counts m a
have hw := weight_flip (wit m) (blkP m a)
rw [c1, c0, wit_weight] at hw
omega
lemma lower (m : ℕ) : 3 * m ≤ blockSensitivityAt (nisanExample (4 * m)) (wit m) := by
have hvalid : IsValidBlockConfig (nisanExample (4 * m)) (wit m) (witBlocks m) := by
unfold IsValidBlockConfig
exact ⟨witBlocks_disj m, witBlocks_sens m⟩
unfold blockSensitivityAt
rw [← witBlocks_card m]
apply Finset.le_sup (f := Finset.card)
simpa using hvalid
theorem solution : type_of% @StrongSensitivityConjecture.nisanExample_blockSensitivity := by
intro n hn hn8
obtain ⟨m, rfl⟩ := hn
have hm : 2 ≤ m := by omega
have h3 : 3 * (4 * m) / 4 = 3 * m := by omega
rw [h3]
apply le_antisymm
· unfold blockSensitivity
exact Finset.sup_le fun x _ => upper m hm x
· refine le_trans (lower m) ?_
unfold blockSensitivity
exact Finset.le_sup (f := blockSensitivityAt (nisanExample (4 * m))) (Finset.mem_univ (wit m))
end Submission
Check it yourself
Project
formal-conjectures
Commit
f606af160664c5a10952e9a957b100a1cd45bbeb
Lean
leanprover/lean4:v4.33.1
Mathlib
0df444a360eaa60ab8c11dca51a86af692955474
With Git and Elan installed, put the download in a fresh working directory and run this there. Use a disposable environment. Lean prints the axioms at the end. The checker allows propext, Classical.choice, and Quot.sound.
(
set -eu
proof="$PWD/fa895065-d8e5-4afe-a143-b55e81041646.lean"
git clone https://github.com/google-deepmind/formal-conjectures.git formal-conjectures
git -C formal-conjectures checkout --detach f606af160664c5a10952e9a957b100a1cd45bbeb
cd formal-conjectures
elan toolchain install leanprover/lean4:v4.33.1
lake +leanprover/lean4:v4.33.1 exe cache get
lake +leanprover/lean4:v4.33.1 build '+FormalConjectures.Paper.StrongSensitivityConjecture'
check_dir="$(mktemp -d)"
trap 'rm -f "$check_dir/Check.lean"; rmdir "$check_dir"' EXIT
printf "%s\n" "import Lean" > "$check_dir/Check.lean"
cat "$proof" >> "$check_dir/Check.lean"
cat >> "$check_dir/Check.lean" <<'SOLVE_CHECK'
example : type_of% @_root_.StrongSensitivityConjecture.nisanExample_blockSensitivity := @_root_.Submission.solution
#print axioms Submission.solution
SOLVE_CHECK
lake +leanprover/lean4:v4.33.1 env lean "$check_dir/Check.lean"
)
Download the receipt verifier and public key. Run python3 verify-proof.py certificate.json fa895065-d8e5-4afe-a143-b55e81041646.lean proof-key.pem with OpenSSL 3.