-
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
-- https://b-mehta.github.io/formalising-mathematics-notes/Part_1/the_axiom_of_choice.html
import Mathlib
-- import Mathlib.Analysis.Complex.Polynomial -- import proof of fundamental theorem of algebra
open Polynomial -- so I can use notation ℂ[X] for polynomial rings
-- and so I can write `X` and not `polynomial.X`
suppress_compilation -- because everything is noncomputable
def f : ℂ[X] := X^5 + X + 37 -- a random polynomial
lemma f_degree : degree f = 5 := by
unfold f
compute_degree -- polynomial degree computing tactic
norm_num
trivial
theorem f_has_a_root : ∃ (z : ℂ), f.IsRoot z := by
apply Complex.exists_root -- the fundamental theorem of algebra
-- ⊢ 0 < degree f
rw [f_degree]
-- ⊢ 0 < 5
norm_num
-- let z be a root of f (getting data from a theorem)
def z : ℂ := Classical.choose f_has_a_root
-- proof that z is a root of f (the "API" for `Classical.choose`)
theorem z_is_a_root_of_f : f.IsRoot z := by
exact Classical.choose_spec f_has_a_root