Skip to content

Commit 25ff469

Browse files
committed
Merge branch 'MR-manifolds-boundary' into integral_curve
2 parents c1f3395 + f8e3340 commit 25ff469

File tree

477 files changed

+8751
-3063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

477 files changed

+8751
-3063
lines changed

.github/workflows/bors.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ jobs:
125125
- name: cleanup
126126
run: |
127127
find . -name . -o -prune -exec rm -rf -- {} +
128-
# Delete all but the 10 most recent toolchains.
128+
# Delete all but the 5 most recent toolchains.
129129
# Make sure to delete both the `~/.elan/toolchains/X` directory and the `~/.elan/update-hashes/X` file.
130130
# Skip symbolic links (`-type d`), the current directory (`! -name .`), and `nightly` and `stable`.
131-
cd ~/.elan/toolchains && find . -maxdepth 1 -type d ! -name . -print0 | xargs -0 ls -1td | grep -v 'nightly$' | grep -v 'stable$' | tail -n +11 | xargs -I {} sh -c 'echo {} && rm -rf "{}" && rm "../update-hashes/{}"' || true
131+
cd ~/.elan/toolchains && find . -maxdepth 1 -type d ! -name . -print0 | xargs -0 ls -1td | grep -v 'nightly$' | grep -v 'stable$' | tail -n +6 | xargs -I {} sh -c 'echo {} && rm -rf "{}" && rm "../update-hashes/{}"' || true
132132
133133
# The Hoskinson runners may not have jq installed, so do that now.
134134
- name: 'Setup jq'
@@ -242,14 +242,18 @@ jobs:
242242
243243
- name: test mathlib
244244
id: test
245-
run: make -j 8 test
245+
run: |
246+
# Tests use parts of ProofWidgets not imported by Mathlib.
247+
# Ensure everything has been built.
248+
lake build ProofWidgets
249+
make -j 8 test
246250
247251
- name: lint mathlib
248252
id: lint
249253
uses: liskin/gh-problem-matcher-wrap@v2
250254
with:
251255
linters: gcc
252-
run: env LEAN_ABORT_ON_PANIC=1 lake exe runMathlibLinter
256+
run: env LEAN_ABORT_ON_PANIC=1 lake exe runLinter Mathlib
253257

254258
- name: check environments using lean4checker
255259
id: lean4checker

.github/workflows/build.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ jobs:
132132
- name: cleanup
133133
run: |
134134
find . -name . -o -prune -exec rm -rf -- {} +
135-
# Delete all but the 10 most recent toolchains.
135+
# Delete all but the 5 most recent toolchains.
136136
# Make sure to delete both the `~/.elan/toolchains/X` directory and the `~/.elan/update-hashes/X` file.
137137
# Skip symbolic links (`-type d`), the current directory (`! -name .`), and `nightly` and `stable`.
138-
cd ~/.elan/toolchains && find . -maxdepth 1 -type d ! -name . -print0 | xargs -0 ls -1td | grep -v 'nightly$' | grep -v 'stable$' | tail -n +11 | xargs -I {} sh -c 'echo {} && rm -rf "{}" && rm "../update-hashes/{}"' || true
138+
cd ~/.elan/toolchains && find . -maxdepth 1 -type d ! -name . -print0 | xargs -0 ls -1td | grep -v 'nightly$' | grep -v 'stable$' | tail -n +6 | xargs -I {} sh -c 'echo {} && rm -rf "{}" && rm "../update-hashes/{}"' || true
139139
140140
# The Hoskinson runners may not have jq installed, so do that now.
141141
- name: 'Setup jq'
@@ -249,14 +249,18 @@ jobs:
249249
250250
- name: test mathlib
251251
id: test
252-
run: make -j 8 test
252+
run: |
253+
# Tests use parts of ProofWidgets not imported by Mathlib.
254+
# Ensure everything has been built.
255+
lake build ProofWidgets
256+
make -j 8 test
253257
254258
- name: lint mathlib
255259
id: lint
256260
uses: liskin/gh-problem-matcher-wrap@v2
257261
with:
258262
linters: gcc
259-
run: env LEAN_ABORT_ON_PANIC=1 lake exe runMathlibLinter
263+
run: env LEAN_ABORT_ON_PANIC=1 lake exe runLinter Mathlib
260264

261265
- name: check environments using lean4checker
262266
id: lean4checker

.github/workflows/build.yml.in

+8-4
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ jobs:
111111
- name: cleanup
112112
run: |
113113
find . -name . -o -prune -exec rm -rf -- {} +
114-
# Delete all but the 10 most recent toolchains.
114+
# Delete all but the 5 most recent toolchains.
115115
# Make sure to delete both the `~/.elan/toolchains/X` directory and the `~/.elan/update-hashes/X` file.
116116
# Skip symbolic links (`-type d`), the current directory (`! -name .`), and `nightly` and `stable`.
117-
cd ~/.elan/toolchains && find . -maxdepth 1 -type d ! -name . -print0 | xargs -0 ls -1td | grep -v 'nightly$' | grep -v 'stable$' | tail -n +11 | xargs -I {} sh -c 'echo {} && rm -rf "{}" && rm "../update-hashes/{}"' || true
117+
cd ~/.elan/toolchains && find . -maxdepth 1 -type d ! -name . -print0 | xargs -0 ls -1td | grep -v 'nightly$' | grep -v 'stable$' | tail -n +6 | xargs -I {} sh -c 'echo {} && rm -rf "{}" && rm "../update-hashes/{}"' || true
118118

119119
# The Hoskinson runners may not have jq installed, so do that now.
120120
- name: 'Setup jq'
@@ -228,14 +228,18 @@ jobs:
228228

229229
- name: test mathlib
230230
id: test
231-
run: make -j 8 test
231+
run: |
232+
# Tests use parts of ProofWidgets not imported by Mathlib.
233+
# Ensure everything has been built.
234+
lake build ProofWidgets
235+
make -j 8 test
232236

233237
- name: lint mathlib
234238
id: lint
235239
uses: liskin/gh-problem-matcher-wrap@v2
236240
with:
237241
linters: gcc
238-
run: env LEAN_ABORT_ON_PANIC=1 lake exe runMathlibLinter
242+
run: env LEAN_ABORT_ON_PANIC=1 lake exe runLinter Mathlib
239243

240244
- name: check environments using lean4checker
241245
id: lean4checker

.github/workflows/build_fork.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ jobs:
129129
- name: cleanup
130130
run: |
131131
find . -name . -o -prune -exec rm -rf -- {} +
132-
# Delete all but the 10 most recent toolchains.
132+
# Delete all but the 5 most recent toolchains.
133133
# Make sure to delete both the `~/.elan/toolchains/X` directory and the `~/.elan/update-hashes/X` file.
134134
# Skip symbolic links (`-type d`), the current directory (`! -name .`), and `nightly` and `stable`.
135-
cd ~/.elan/toolchains && find . -maxdepth 1 -type d ! -name . -print0 | xargs -0 ls -1td | grep -v 'nightly$' | grep -v 'stable$' | tail -n +11 | xargs -I {} sh -c 'echo {} && rm -rf "{}" && rm "../update-hashes/{}"' || true
135+
cd ~/.elan/toolchains && find . -maxdepth 1 -type d ! -name . -print0 | xargs -0 ls -1td | grep -v 'nightly$' | grep -v 'stable$' | tail -n +6 | xargs -I {} sh -c 'echo {} && rm -rf "{}" && rm "../update-hashes/{}"' || true
136136
137137
# The Hoskinson runners may not have jq installed, so do that now.
138138
- name: 'Setup jq'
@@ -246,14 +246,18 @@ jobs:
246246
247247
- name: test mathlib
248248
id: test
249-
run: make -j 8 test
249+
run: |
250+
# Tests use parts of ProofWidgets not imported by Mathlib.
251+
# Ensure everything has been built.
252+
lake build ProofWidgets
253+
make -j 8 test
250254
251255
- name: lint mathlib
252256
id: lint
253257
uses: liskin/gh-problem-matcher-wrap@v2
254258
with:
255259
linters: gcc
256-
run: env LEAN_ABORT_ON_PANIC=1 lake exe runMathlibLinter
260+
run: env LEAN_ABORT_ON_PANIC=1 lake exe runLinter Mathlib
257261

258262
- name: check environments using lean4checker
259263
id: lean4checker

.vscode/settings.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
"files.insertFinalNewline": true,
88
"files.trimFinalNewlines": true,
99
"files.trimTrailingWhitespace": true,
10-
"githubPullRequests.ignoredPullRequestBranches": ["master"]
10+
"githubPullRequests.ignoredPullRequestBranches": [
11+
"master"
12+
],
13+
"git.ignoreLimitWarning": true
1114
}

Archive/Examples/IfNormalization/WithoutAesop.lean

+5-5
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,27 @@ def normalize' (l : AList (fun _ : ℕ => Bool)) :
6666
refine ⟨fun _ => ?_, fun _ => ?_⟩
6767
· congr
6868
ext w
69-
by_cases w = v <;> rename_i x
69+
by_cases h : w = v <;> rename_i x
7070
· substs h
7171
simp_all
7272
· simp_all
7373
· congr
7474
ext w
75-
by_cases w = v <;> rename_i x
75+
by_cases h : w = v <;> rename_i x
7676
· substs h
7777
simp_all
7878
· simp_all
7979
· simp only [cond_true, h, ht₁]
8080
refine ⟨fun _ => ?_, fun _ => ?_⟩
8181
· congr
8282
ext w
83-
by_cases w = v <;> rename_i x
83+
by_cases h : w = v <;> rename_i x
8484
· substs h
8585
simp_all
8686
· simp_all
8787
· congr
8888
ext w
89-
by_cases w = v <;> rename_i x
89+
by_cases h : w = v <;> rename_i x
9090
· substs h
9191
simp_all
9292
· simp_all
@@ -105,7 +105,7 @@ def normalize' (l : AList (fun _ : ℕ => Bool)) :
105105
constructor <;> assumption
106106
· have := ht₃ w
107107
have := he₃ w
108-
by_cases w = v
108+
by_cases h : w = v
109109
· subst h; simp_all
110110
· simp_all? says simp_all only [Option.elim, ne_eq, normalized, Bool.and_eq_true,
111111
Bool.not_eq_true', not_false_eq_true, AList.lookup_insert_ne]

Archive/Imo/Imo1981Q3.lean

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Kevin Lacker
55
-/
66
import Mathlib.Data.Int.Lemmas
7-
import Mathlib.Data.Nat.Fib
7+
import Mathlib.Data.Nat.Fib.Basic
88
import Mathlib.Tactic.Linarith
99
import Mathlib.Tactic.LinearCombination
1010

@@ -97,25 +97,25 @@ namespace NatPredicate
9797

9898
variable {N}
9999

100-
nonrec theorem m_le_n {m n : ℕ} (h1 : NatPredicate N m n) : m ≤ n := by exact_mod_cast h1.m_le_n
100+
nonrec theorem m_le_n {m n : ℕ} (h1 : NatPredicate N m n) : m ≤ n := mod_cast h1.m_le_n
101101
#align imo1981_q3.nat_predicate.m_le_n Imo1981Q3.NatPredicate.m_le_n
102102

103-
nonrec theorem eq_imp_1 {n : ℕ} (h1 : NatPredicate N n n) : n = 1 := by exact_mod_cast h1.eq_imp_1
103+
nonrec theorem eq_imp_1 {n : ℕ} (h1 : NatPredicate N n n) : n = 1 := mod_cast h1.eq_imp_1
104104
#align imo1981_q3.nat_predicate.eq_imp_1 Imo1981Q3.NatPredicate.eq_imp_1
105105

106106
nonrec theorem reduction {m n : ℕ} (h1 : NatPredicate N m n) (h2 : 1 < n) :
107107
NatPredicate N (n - m) m := by
108108
have : m ≤ n := h1.m_le_n
109-
exact_mod_cast h1.reduction (by exact_mod_cast h2)
109+
exact mod_cast h1.reduction (mod_cast h2)
110110
#align imo1981_q3.nat_predicate.reduction Imo1981Q3.NatPredicate.reduction
111111

112-
theorem n_pos {m n : ℕ} (h1 : NatPredicate N m n) : 0 < n := by exact_mod_cast h1.n_range.left
112+
theorem n_pos {m n : ℕ} (h1 : NatPredicate N m n) : 0 < n := mod_cast h1.n_range.left
113113
#align imo1981_q3.nat_predicate.n_pos Imo1981Q3.NatPredicate.n_pos
114114

115-
theorem m_pos {m n : ℕ} (h1 : NatPredicate N m n) : 0 < m := by exact_mod_cast h1.m_range.left
115+
theorem m_pos {m n : ℕ} (h1 : NatPredicate N m n) : 0 < m := mod_cast h1.m_range.left
116116
#align imo1981_q3.nat_predicate.m_pos Imo1981Q3.NatPredicate.m_pos
117117

118-
theorem n_le_N {m n : ℕ} (h1 : NatPredicate N m n) : n ≤ N := by exact_mod_cast h1.n_range.right
118+
theorem n_le_N {m n : ℕ} (h1 : NatPredicate N m n) : n ≤ N := mod_cast h1.n_range.right
119119
set_option linter.uppercaseLean3 false in
120120
#align imo1981_q3.nat_predicate.n_le_N Imo1981Q3.NatPredicate.n_le_N
121121

Archive/Imo/Imo1987Q1.lean

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ holds true for `n = 0` as well, so we first prove it, then deduce the original v
2525
`n ≥ 1`. -/
2626

2727

28+
set_option autoImplicit true
29+
2830
variable (α : Type*) [Fintype α] [DecidableEq α]
2931

3032
open scoped BigOperators Nat

Archive/Imo/Imo1988Q6.lean

+4-4
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ theorem constant_descent_vieta_jumping (x y : ℕ) {claim : Prop} {H : ℕ →
184184
· -- For the second condition, we note that it suffices to check that c ≠ m_x.
185185
suffices hc : c ≠ mx
186186
· refine' lt_of_le_of_ne _ hc
187-
exact_mod_cast c_lt
187+
exact mod_cast c_lt
188188
-- However, recall that B(m_x) ≠ m_x + m_y.
189189
-- If c = m_x, we can prove B(m_x) = m_x + m_y.
190190
contrapose! hm_B₂
@@ -237,14 +237,14 @@ theorem imo1988_q6 {a b : ℕ} (h : a * b + 1 ∣ a ^ 2 + b ^ 2) :
237237
· have hpos : z * z + x * x > 0 := by
238238
apply add_pos_of_nonneg_of_pos
239239
· apply mul_self_nonneg
240-
· apply mul_pos <;> exact_mod_cast hx
240+
· apply mul_pos <;> exact mod_cast hx
241241
have hzx : z * z + x * x = (z * x + 1) * k := by
242242
rw [← sub_eq_zero, ← h_root]
243243
ring
244244
rw [hzx] at hpos
245245
replace hpos : z * x + 1 > 0 := pos_of_mul_pos_left hpos (Int.ofNat_zero_le k)
246246
replace hpos : z * x ≥ 0 := Int.le_of_lt_add_one hpos
247-
apply nonneg_of_mul_nonneg_left hpos (by exact_mod_cast hx)
247+
apply nonneg_of_mul_nonneg_left hpos (mod_cast hx)
248248
· contrapose! hV₀ with x_lt_z
249249
apply ne_of_gt
250250
calc
@@ -284,7 +284,7 @@ example {a b : ℕ} (h : a * b ∣ a ^ 2 + b ^ 2 + 1) : 3 * a * b = a ^ 2 + b ^
284284
· -- Show the descent step.
285285
intro x y _ hx h_base _ z _ _ hV₀
286286
constructor
287-
· have zy_pos : z * y ≥ 0 := by rw [hV₀]; exact_mod_cast Nat.zero_le _
287+
· have zy_pos : z * y ≥ 0 := by rw [hV₀]; exact mod_cast Nat.zero_le _
288288
apply nonneg_of_mul_nonneg_left zy_pos
289289
linarith
290290
· contrapose! hV₀ with x_lt_z

Archive/Imo/Imo1994Q1.lean

+1-5
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,7 @@ theorem imo1994_q1 (n : ℕ) (m : ℕ) (A : Finset ℕ) (hm : A.card = m + 1)
8989
simp only [mem_map, mem_Icc, mem_Ioc, Fin.zero_le, true_and_iff, Equiv.subLeft_apply,
9090
Function.Embedding.coeFn_mk, exists_prop, RelEmbedding.coe_toEmbedding] at hx ⊢
9191
rcases hx with ⟨i, ⟨hi, rfl⟩⟩
92-
have h1 : a i + a (Fin.last m - k) ≤ n := by
93-
-- Porting note: Original proof was `by linarith only [h, a.monotone hi]`
94-
have := a.monotone hi
95-
simp only at this ⊢
96-
linarith only [h, this]
92+
have h1 : a i + a (Fin.last m - k) ≤ n := by linarith only [h, a.monotone hi]
9793
have h2 : a i + a (Fin.last m - k) ∈ A := hadd _ (ha _) _ (ha _) h1
9894
rw [← mem_coe, ← range_orderEmbOfFin A hm, Set.mem_range] at h2
9995
cases' h2 with j hj

Archive/Imo/Imo2013Q5.lean

+9-9
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ theorem le_of_all_pow_lt_succ {x y : ℝ} (hx : 1 < x) (hy : 1 < y)
5454
_ = x ^ n - y ^ n := geom_sum₂_mul x y n
5555
-- Choose n larger than 1 / (x - y).
5656
obtain ⟨N, hN⟩ := exists_nat_gt (1 / (x - y))
57-
have hNp : 0 < N := by exact_mod_cast (one_div_pos.mpr hxmy).trans hN
57+
have hNp : 0 < N := mod_cast (one_div_pos.mpr hxmy).trans hN
5858
have :=
5959
calc
6060
1 = (x - y) * (1 / (x - y)) := by field_simp
@@ -113,7 +113,7 @@ theorem fx_gt_xm1 {f : ℚ → ℝ} {x : ℚ} (hx : 1 ≤ x)
113113
(x - 1 : ℝ) < f x := by
114114
have hx0 :=
115115
calc
116-
(x - 1 : ℝ) < ⌊x⌋₊ := by exact_mod_cast Nat.sub_one_lt_floor x
116+
(x - 1 : ℝ) < ⌊x⌋₊ := mod_cast Nat.sub_one_lt_floor x
117117
_ ≤ f ⌊x⌋₊ := H4 _ (Nat.floor_pos.2 hx)
118118
obtain h_eq | h_lt := (Nat.floor_le <| zero_le_one.trans hx).eq_or_lt
119119
· rwa [h_eq] at hx0
@@ -143,12 +143,12 @@ theorem fixed_point_of_pos_nat_pow {f : ℚ → ℝ} {n : ℕ} (hn : 0 < n)
143143
(H1 : ∀ x y, 0 < x → 0 < y → f (x * y) ≤ f x * f y) (H4 : ∀ n : ℕ, 0 < n → (n : ℝ) ≤ f n)
144144
(H5 : ∀ x : ℚ, 1 < x → (x : ℝ) ≤ f x) {a : ℚ} (ha1 : 1 < a) (hae : f a = a) :
145145
f (a ^ n) = a ^ n := by
146-
have hh0 : (a : ℝ) ^ n ≤ f (a ^ n) := by exact_mod_cast H5 (a ^ n) (one_lt_pow ha1 hn.ne')
146+
have hh0 : (a : ℝ) ^ n ≤ f (a ^ n) := mod_cast H5 (a ^ n) (one_lt_pow ha1 hn.ne')
147147
have hh1 :=
148148
calc
149149
f (a ^ n) ≤ f a ^ n := pow_f_le_f_pow hn ha1 H1 H4
150150
_ = (a : ℝ) ^ n := by rw [← hae]
151-
exact_mod_cast hh1.antisymm hh0
151+
exact mod_cast hh1.antisymm hh0
152152
#align imo2013_q5.fixed_point_of_pos_nat_pow Imo2013Q5.fixed_point_of_pos_nat_pow
153153

154154
theorem fixed_point_of_gt_1 {f : ℚ → ℝ} {x : ℚ} (hx : 1 < x)
@@ -170,7 +170,7 @@ theorem fixed_point_of_gt_1 {f : ℚ → ℝ} {x : ℚ} (hx : 1 < x)
170170
_ = f (a ^ N) := by ring_nf
171171
_ = a ^ N := (fixed_point_of_pos_nat_pow hNp H1 H4 H5 ha1 hae)
172172
_ = x + (a ^ N - x) := by ring
173-
have heq := h1.antisymm (by exact_mod_cast h2)
173+
have heq := h1.antisymm (mod_cast h2)
174174
linarith [H5 x hx, H5 _ h_big_enough]
175175
#align imo2013_q5.fixed_point_of_gt_1 Imo2013Q5.fixed_point_of_gt_1
176176

@@ -191,7 +191,7 @@ theorem imo2013_q5 (f : ℚ → ℝ) (H1 : ∀ x y, 0 < x → 0 < y → f (x * y
191191
calc
192192
↑(pn + 2) * f x = (↑pn + 1 + 1) * f x := by norm_cast
193193
_ = (↑pn + 1) * f x + f x := by ring
194-
_ ≤ f (↑pn.succ * x) + f x := by exact_mod_cast add_le_add_right (hpn pn.succ_pos) (f x)
194+
_ ≤ f (↑pn.succ * x) + f x := mod_cast add_le_add_right (hpn pn.succ_pos) (f x)
195195
_ ≤ f ((↑pn + 1) * x + x) := by exact_mod_cast H2 _ _ (mul_pos pn.cast_add_one_pos hx) hx
196196
_ = f ((↑pn + 1 + 1) * x) := by ring_nf
197197
_ = f (↑(pn + 2) * x) := by norm_cast
@@ -216,10 +216,10 @@ theorem imo2013_q5 (f : ℚ → ℝ) (H1 : ∀ x y, 0 < x → 0 < y → f (x * y
216216
have hxnm1 : ∀ n : ℕ, 0 < n → (x : ℝ) ^ n - 1 < f x ^ n := by
217217
intro n hn
218218
calc
219-
(x : ℝ) ^ n - 1 < f (x ^ n) := by
220-
exact_mod_cast fx_gt_xm1 (one_le_pow_of_one_le hx.le n) H1 H2 H4
219+
(x : ℝ) ^ n - 1 < f (x ^ n) :=
220+
mod_cast fx_gt_xm1 (one_le_pow_of_one_le hx.le n) H1 H2 H4
221221
_ ≤ f x ^ n := pow_f_le_f_pow hn hx H1 H4
222-
have hx' : 1 < (x : ℝ) := by exact_mod_cast hx
222+
have hx' : 1 < (x : ℝ) := mod_cast hx
223223
have hxp : 0 < x := by positivity
224224
exact le_of_all_pow_lt_succ' hx' (f_pos_of_pos hxp H1 H4) hxnm1
225225
have h_f_commutes_with_pos_nat_mul : ∀ n : ℕ, 0 < n → ∀ x : ℚ, 0 < x → f (n * x) = n * f x := by

Archive/Imo/Imo2020Q2.lean

+8-10
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,15 @@ theorem imo2020_q2 (a b c d : ℝ) (hd0 : 0 < d) (hdc : d ≤ c) (hcb : c ≤ b)
3131
(a + 2 * b + 3 * c + 4 * d) * a ^ a * b ^ b * c ^ c * d ^ d =
3232
(a + 2 * b + 3 * c + 4 * d) * (a ^ a * b ^ b * c ^ c * d ^ d) := by ac_rfl
3333
_ ≤ (a + 2 * b + 3 * c + 4 * d) * (a * a + b * b + c * c + d * d) := by gcongr; linarith
34-
_ = (a + 2 * b + 3 * c + 4 * d) * (a * a) + (a + 2 * b + 3 * c + 4 * d) * (b * b)
35-
+ (a + 2 * b + 3 * c + 4 * d) * (c * c) + (a + 2 * b + 3 * c + 4 * d) * (d * d) := by ring
36-
_ ≤ (a + 3 * b + 3 * c + 3 * d) * (a * a) + (3 * a + b + 3 * c + 3 * d) * (b * b)
37-
+ (3 * a + 3 * b + c + 3 * d) * (c * c) + (3 * a + 3 * b + 3 * c + d) * (d * d) := by
38-
-- Porting note: after #2220 is fixed we can change all `a * a` to `a ^ 2` and automation
39-
-- will work better
40-
gcongr ?_ * _ + ?_ * _ + ?_ * _ + ?_ * _ <;> (try linarith) <;> apply mul_self_nonneg
41-
_ < (a + 3 * b + 3 * c + 3 * d) * (a * a) + (3 * a + b + 3 * c + 3 * d) * (b * b)
42-
+ (3 * a + 3 * b + c + 3 * d) * (c * c) + (3 * a + 3 * b + 3 * c + d) * (d * d)
34+
_ = (a + 2 * b + 3 * c + 4 * d) * a ^ 2 + (a + 2 * b + 3 * c + 4 * d) * b ^ 2
35+
+ (a + 2 * b + 3 * c + 4 * d) * c ^ 2 + (a + 2 * b + 3 * c + 4 * d) * d ^ 2 := by ring
36+
_ ≤ (a + 3 * b + 3 * c + 3 * d) * a ^ 2 + (3 * a + b + 3 * c + 3 * d) * b ^ 2
37+
+ (3 * a + 3 * b + c + 3 * d) * c ^ 2 + (3 * a + 3 * b + 3 * c + d) * d ^ 2 := by
38+
gcongr ?_ * _ + ?_ * _ + ?_ * _ + ?_ * _ <;> linarith
39+
_ < (a + 3 * b + 3 * c + 3 * d) * a ^ 2 + (3 * a + b + 3 * c + 3 * d) * b ^ 2
40+
+ (3 * a + 3 * b + c + 3 * d) * c ^ 2 + (3 * a + 3 * b + 3 * c + d) * d ^ 2
4341
+ (6 * a * b * c + 6 * a * b * d + 6 * a * c * d + 6 * b * c * d) :=
4442
(lt_add_of_pos_right _ (by apply_rules [add_pos, mul_pos, zero_lt_one] <;> linarith))
45-
_ = HPow.hPow (a + b + c + d) 3 := by ring -- Porting note: See issue #2220
43+
_ = (a + b + c + d) ^ 3 := by ring
4644
_ = 1 := by simp [h1]
4745
#align imo2020_q2 imo2020_q2

Archive/Sensitivity.lean

+2-2
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ theorem g_injective : Injective (g m) := by
353353

354354
theorem f_image_g (w : V m.succ) (hv : ∃ v, g m v = w) : f m.succ w = √ (m + 1) • w := by
355355
rcases hv with ⟨v, rfl⟩
356-
have : √ (m + 1) * √ (m + 1) = m + 1 := Real.mul_self_sqrt (by exact_mod_cast zero_le _)
356+
have : √ (m + 1) * √ (m + 1) = m + 1 := Real.mul_self_sqrt (mod_cast zero_le _)
357357
rw [f_succ_apply, g_apply]
358358
simp [this, f_squared, smul_add, add_smul, smul_smul, V]
359359
abel
@@ -400,7 +400,7 @@ theorem exists_eigenvalue (H : Set (Q m.succ)) (hH : Card H ≥ 2 ^ m + 1) :
400400
let W := Span (e '' H)
401401
let img := range (g m)
402402
suffices 0 < dim (W ⊓ img) by
403-
exact_mod_cast exists_mem_ne_zero_of_rank_pos this
403+
exact mod_cast exists_mem_ne_zero_of_rank_pos this
404404
have dim_le : dim (W ⊔ img) ≤ 2 ^ (m + 1 : Cardinal) := by
405405
convert ← rank_submodule_le (W ⊔ img)
406406
rw [← Nat.cast_succ]

0 commit comments

Comments
 (0)