Assuming n is a positive multiple of 4, the sensitivity of nisanExample is n/2+2. It is achieved by any x with Hamming weight n/2+2: flipping any of its n/2+2 one-bits moves the input into the accepting layer of weight n/2+1.
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_sensitivity 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
125import FormalConjectures.Paper.StrongSensitivityConjecture
namespace Submission
open StrongSensitivityConjecture Finset
/-- The acceptance test of `nisanExample` (for `n = 4 * c`) in terms of the Hamming weight. -/def acc (c k : ℕ) : Bool := decide (k = 2 * c ∨ k = 2 * c + 1)
lemma nisan_eq (c : ℕ) (x : Fin (4 * c) → Bool) :
nisanExample (4 * c) x = acc c (univ.filter fun j => x j).card := by
have hq : ((4 * c : ℕ) : ℚ) / 2 = ((2 * c : ℕ) : ℚ) := by push_cast; ring
have hq' : ((2 * c : ℕ) : ℚ) + 1 = ((2 * c + 1 : ℕ) : ℚ) := by push_cast; ring
simp only [nisanExample, acc, hq, hq', Finset.mem_insert,
Finset.mem_singleton, Nat.cast_inj]
lemma card_flip_true {n : ℕ} (x : Fin n → Bool) (i : Fin n) (hi : x i = true) :
(univ.filter fun j => StrongSensitivityConjecture.flip x {i} j).card + 1 = (univ.filter fun j => x j).card := by
have h : univ.filter (fun j => StrongSensitivityConjecture.flip x {i} j) =
(univ.filter fun j => x j).erase i := by
ext j
by_cases hj : j = i
· subst hj; simp [StrongSensitivityConjecture.flip, hi]
· simp [StrongSensitivityConjecture.flip, hj]
rw [h, card_erase_add_one (by simp [hi])]
lemma card_flip_false {n : ℕ} (x : Fin n → Bool) (i : Fin n) (hi : x i = false) :
(univ.filter fun j => StrongSensitivityConjecture.flip x {i} j).card = (univ.filter fun j => x j).card + 1 := by
have h : univ.filter (fun j => StrongSensitivityConjecture.flip x {i} j) =
insert i (univ.filter fun j => x j) := by
ext j
by_cases hj : j = i
· subst hj; simp [StrongSensitivityConjecture.flip, hi]
· simp [StrongSensitivityConjecture.flip, hj]
rw [h, card_insert_of_notMem (by simp [hi])]
lemma per_i (c : ℕ) (x : Fin (4 * c) → Bool) (i : Fin (4 * c))
(hs : acc c (univ.filter fun j => StrongSensitivityConjecture.flip x {i} j).card ≠ acc c (univ.filter fun j => x j).card) :
(x i = true ∧ acc c ((univ.filter fun j => x j).card - 1) ≠ acc c (univ.filter fun j => x j).card) ∨
(x i = false ∧ acc c ((univ.filter fun j => x j).card + 1) ≠ acc c (univ.filter fun j => x j).card) := by
cases hx : x i
· right
rw [card_flip_false x i hx] at hs
exact ⟨rfl, hs⟩
· left
have h := card_flip_true x i hx
rw [← h] at hs ⊢
rw [Nat.add_sub_cancel]
exact ⟨rfl, hs⟩
lemma acc_succ (c k : ℕ) (h : acc c (k + 1) ≠ acc c k) : 2 * c ≤ k + 1 := by
unfold acc at h
by_cases h1 : k = 2 * c <;> by_cases h2 : k = 2 * c + 1 <;>
by_cases h3 : k + 1 = 2 * c <;> by_cases h4 : k + 1 = 2 * c + 1 <;> simp_all <;> omega
lemma acc_pred (c k : ℕ) (h : acc c (k - 1) ≠ acc c k) : k ≤ 2 * c + 2 := by
unfold acc at h
by_cases h1 : k = 2 * c <;> by_cases h2 : k = 2 * c + 1 <;>
by_cases h3 : k - 1 = 2 * c <;> by_cases h4 : k - 1 = 2 * c + 1 <;> simp_all <;> omega
lemma acc_excl (c k : ℕ) (h : acc c (k - 1) ≠ acc c k) : acc c (k + 1) = acc c k := by
unfold acc at h ⊢
by_cases h1 : k = 2 * c <;> by_cases h2 : k = 2 * c + 1 <;>
by_cases h3 : k - 1 = 2 * c <;> by_cases h4 : k - 1 = 2 * c + 1 <;>
by_cases h5 : k + 1 = 2 * c <;> by_cases h6 : k + 1 = 2 * c + 1 <;> simp_all <;> omega
lemma sens_le (c : ℕ) (x : Fin (4 * c) → Bool) :
sensitivityAt (nisanExample (4 * c)) x ≤ 2 * c + 2 := by
unfold sensitivityAt
simp only [nisan_eq]
by_cases hQ : acc c ((univ.filter fun j => x j).card + 1) ≠ acc c (univ.filter fun j => x j).card
· refine le_trans (card_le_card (t := univ.filter fun i => x i = false) ?_) ?_
· intro i hi
simp only [mem_filter, mem_univ, true_and] at hi ⊢
rcases per_i c x i hi with h | h
· exact absurd (acc_excl c _ h.2) hQ
· exact h.1
· have hc := card_filter_add_card_filter_not (s := (univ : Finset (Fin (4 * c))))
(fun i => x i = true)
have h2 := acc_succ c _ hQ
simp only [Bool.not_eq_true, card_univ, Fintype.card_fin] at hc
omega
· by_cases hP : acc c ((univ.filter fun j => x j).card - 1) ≠ acc c (univ.filter fun j => x j).card
· refine le_trans (card_le_card (t := univ.filter fun i => x i = true) ?_) ?_
· intro i hi
simp only [mem_filter, mem_univ, true_and] at hi ⊢
rcases per_i c x i hi with h | h
· exact h.1
· exact absurd h.2 hQ
· have h2 := acc_pred c _ hP
exact h2
· refine le_trans (card_le_card (t := (∅ : Finset (Fin (4 * c)))) ?_) (by simp)
intro i hi
simp only [mem_filter, mem_univ, true_and] at hi
rcases per_i c x i hi with h | h
· exact absurd h.2 hP
· exact absurd h.2 hQ
lemma sens_ge (c : ℕ) (hc : 1 ≤ c) :
∃ x : Fin (4 * c) → Bool, 2 * c + 2 ≤ sensitivityAt (nisanExample (4 * c)) x := by
obtain ⟨S, hSsub, hScard⟩ := Finset.exists_subset_card_eq
(show 2 * c + 2 ≤ (univ : Finset (Fin (4 * c))).card by simp; omega)
refine ⟨fun i => decide (i ∈ S), ?_⟩
unfold sensitivityAt
simp only [nisan_eq]
have hk : (univ.filter fun j => decide (j ∈ S) = true).card = 2 * c + 2 := by simp [hScard]
rw [hk]
refine le_trans (le_of_eq hk.symm) (card_le_card ?_)
intro i hi
simp only [mem_filter, mem_univ, true_and, decide_eq_true_eq] at hi ⊢
have h := card_flip_true (fun j => decide (j ∈ S)) i (by simpa using hi)
rw [hk] at h
rw [show (univ.filter fun j => StrongSensitivityConjecture.flip (fun j => decide (j ∈ S)) {i} j).card = 2 * c + 1 by omega]
simp [acc]
theorem solution : type_of% @StrongSensitivityConjecture.nisanExample_sensitivity := by
intro n hn hn_pos
obtain ⟨c, rfl⟩ := hn
have h2 : 4 * c / 2 = 2 * c := by omega
rw [h2]
refine le_antisymm ?_ ?_
· unfold sensitivity
exact Finset.sup_le fun x _ => sens_le c x
· obtain ⟨x, hx⟩ := sens_ge c (by omega)
exact le_trans hx (le_sup (mem_univ x))
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/3395722e-9071-4bf2-8e66-4a38120210cb.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_sensitivity := @_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 3395722e-9071-4bf2-8e66-4a38120210cb.lean proof-key.pem with OpenSSL 3.