l3lab/ntp-mathlib huggingface dataset:
theorem epi_comp {X Y Z : C} (f : X ⟶ Y) [Epi f] (g : Y ⟶ Z) [Epi g] : Epi (f ≫ g) := by
  constructor
  intro Z a b w
  

Proof state:
case left_cancellation
C : Type u
inst✝² : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
inst✝¹ : Epi f
g : Y ⟶ Z✝
inst✝ : Epi g
Z : C
a b : Z✝ ⟶ Z
w : (f ≫ g) ≫ a = (f ≫ g) ≫ b
⊢ a = b

Next tactic:
apply (cancel_epi g).1
theorem epi_comp {X Y Z : C} (f : X ⟶ Y) [Epi f] (g : Y ⟶ Z) [Epi g] : Epi (f ≫ g) := by
  constructor
  intro Z a b w
  apply (cancel_epi g).1
  

Proof state:
case left_cancellation
C : Type u
inst✝² : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
inst✝¹ : Epi f
g : Y ⟶ Z✝
inst✝ : Epi g
Z : C
a b : Z✝ ⟶ Z
w : (f ≫ g) ≫ a = (f ≫ g) ≫ b
⊢ g ≫ a = g ≫ b

Next tactic:
apply (cancel_epi f).1
theorem epi_comp {X Y Z : C} (f : X ⟶ Y) [Epi f] (g : Y ⟶ Z) [Epi g] : Epi (f ≫ g) := by
  constructor
  intro Z a b w
  apply (cancel_epi g).1
  apply (cancel_epi f).1
  

Proof state:
case left_cancellation
C : Type u
inst✝² : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
inst✝¹ : Epi f
g : Y ⟶ Z✝
inst✝ : Epi g
Z : C
a b : Z✝ ⟶ Z
w : (f ≫ g) ≫ a = (f ≫ g) ≫ b
⊢ f ≫ g ≫ a = f ≫ g ≫ b

Next tactic:
simpa using w
theorem mono_comp {X Y Z : C} (f : X ⟶ Y) [Mono f] (g : Y ⟶ Z) [Mono g] : Mono (f ≫ g) := by
  

Proof state:
C : Type u
inst✝² : Category.{v, u} C
X✝ Y✝ Z✝ X Y Z : C
f : X ⟶ Y
inst✝¹ : Mono f
g : Y ⟶ Z
inst✝ : Mono g
⊢ Mono (f ≫ g)

Next tactic:
constructor
theorem mono_comp {X Y Z : C} (f : X ⟶ Y) [Mono f] (g : Y ⟶ Z) [Mono g] : Mono (f ≫ g) := by
  constructor
  

Proof state:
case right_cancellation
C : Type u
inst✝² : Category.{v, u} C
X✝ Y✝ Z✝ X Y Z : C
f : X ⟶ Y
inst✝¹ : Mono f
g : Y ⟶ Z
inst✝ : Mono g
⊢ ∀ {Z_1 : C} (g_1 h : Z_1 ⟶ X), g_1 ≫ f ≫ g = h ≫ f ≫ g → g_1 = h

Next tactic:
intro Z a b w
theorem mono_comp {X Y Z : C} (f : X ⟶ Y) [Mono f] (g : Y ⟶ Z) [Mono g] : Mono (f ≫ g) := by
  constructor
  intro Z a b w
  

Proof state:
case right_cancellation
C : Type u
inst✝² : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
inst✝¹ : Mono f
g : Y ⟶ Z✝
inst✝ : Mono g
Z : C
a b : Z ⟶ X
w : a ≫ f ≫ g = b ≫ f ≫ g
⊢ a = b

Next tactic:
apply (cancel_mono f).1
theorem mono_comp {X Y Z : C} (f : X ⟶ Y) [Mono f] (g : Y ⟶ Z) [Mono g] : Mono (f ≫ g) := by
  constructor
  intro Z a b w
  apply (cancel_mono f).1
  

Proof state:
case right_cancellation
C : Type u
inst✝² : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
inst✝¹ : Mono f
g : Y ⟶ Z✝
inst✝ : Mono g
Z : C
a b : Z ⟶ X
w : a ≫ f ≫ g = b ≫ f ≫ g
⊢ a ≫ f = b ≫ f

Next tactic:
apply (cancel_mono g).1
theorem mono_comp {X Y Z : C} (f : X ⟶ Y) [Mono f] (g : Y ⟶ Z) [Mono g] : Mono (f ≫ g) := by
  constructor
  intro Z a b w
  apply (cancel_mono f).1
  apply (cancel_mono g).1
  

Proof state:
case right_cancellation
C : Type u
inst✝² : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
inst✝¹ : Mono f
g : Y ⟶ Z✝
inst✝ : Mono g
Z : C
a b : Z ⟶ X
w : a ≫ f ≫ g = b ≫ f ≫ g
⊢ (a ≫ f) ≫ g = (b ≫ f) ≫ g

Next tactic:
simpa using w
theorem mono_of_mono {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Mono (f ≫ g)] : Mono f := by
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝ X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
inst✝ : Mono (f ≫ g)
⊢ Mono f

Next tactic:
constructor
theorem mono_of_mono {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Mono (f ≫ g)] : Mono f := by
  constructor
  

Proof state:
case right_cancellation
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝ X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
inst✝ : Mono (f ≫ g)
⊢ ∀ {Z : C} (g h : Z ⟶ X), g ≫ f = h ≫ f → g = h

Next tactic:
intro Z a b w
theorem mono_of_mono {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Mono (f ≫ g)] : Mono f := by
  constructor
  intro Z a b w
  

Proof state:
case right_cancellation
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
g : Y ⟶ Z✝
inst✝ : Mono (f ≫ g)
Z : C
a b : Z ⟶ X
w : a ≫ f = b ≫ f
⊢ a = b

Next tactic:
replace w := congr_arg (fun k => k ≫ g) w
theorem mono_of_mono {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Mono (f ≫ g)] : Mono f := by
  constructor
  intro Z a b w
  replace w := congr_arg (fun k => k ≫ g) w
  

Proof state:
case right_cancellation
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
g : Y ⟶ Z✝
inst✝ : Mono (f ≫ g)
Z : C
a b : Z ⟶ X
w : (fun k => k ≫ g) (a ≫ f) = (fun k => k ≫ g) (b ≫ f)
⊢ a = b

Next tactic:
dsimp at w
theorem mono_of_mono {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Mono (f ≫ g)] : Mono f := by
  constructor
  intro Z a b w
  replace w := congr_arg (fun k => k ≫ g) w
  dsimp at w
  

Proof state:
case right_cancellation
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
g : Y ⟶ Z✝
inst✝ : Mono (f ≫ g)
Z : C
a b : Z ⟶ X
w : (a ≫ f) ≫ g = (b ≫ f) ≫ g
⊢ a = b

Next tactic:
rw [Category.assoc, Category.assoc] at w
theorem mono_of_mono {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Mono (f ≫ g)] : Mono f := by
  constructor
  intro Z a b w
  replace w := congr_arg (fun k => k ≫ g) w
  dsimp at w
  rw [Category.assoc, Category.assoc] at w
  

Proof state:
case right_cancellation
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
g : Y ⟶ Z✝
inst✝ : Mono (f ≫ g)
Z : C
a b : Z ⟶ X
w : a ≫ f ≫ g = b ≫ f ≫ g
⊢ a = b

Next tactic:
exact (cancel_mono _).1 w
theorem mono_of_mono_fac {X Y Z : C} {f : X ⟶ Y} {g : Y ⟶ Z} {h : X ⟶ Z} [Mono h]
    (w : f ≫ g = h) : Mono f := by
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝ X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
h : X ⟶ Z
inst✝ : Mono h
w : f ≫ g = h
⊢ Mono f

Next tactic:
subst h
theorem mono_of_mono_fac {X Y Z : C} {f : X ⟶ Y} {g : Y ⟶ Z} {h : X ⟶ Z} [Mono h]
    (w : f ≫ g = h) : Mono f := by
  subst h
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝ X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
inst✝ : Mono (f ≫ g)
⊢ Mono f

Next tactic:
exact mono_of_mono f g
theorem epi_of_epi {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Epi (f ≫ g)] : Epi g := by
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝ X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
inst✝ : Epi (f ≫ g)
⊢ Epi g

Next tactic:
constructor
theorem epi_of_epi {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Epi (f ≫ g)] : Epi g := by
  constructor
  

Proof state:
case left_cancellation
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝ X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
inst✝ : Epi (f ≫ g)
⊢ ∀ {Z_1 : C} (g_1 h : Z ⟶ Z_1), g ≫ g_1 = g ≫ h → g_1 = h

Next tactic:
intro Z a b w
theorem epi_of_epi {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Epi (f ≫ g)] : Epi g := by
  constructor
  intro Z a b w
  

Proof state:
case left_cancellation
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
g : Y ⟶ Z✝
inst✝ : Epi (f ≫ g)
Z : C
a b : Z✝ ⟶ Z
w : g ≫ a = g ≫ b
⊢ a = b

Next tactic:
replace w := congr_arg (fun k => f ≫ k) w
theorem epi_of_epi {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Epi (f ≫ g)] : Epi g := by
  constructor
  intro Z a b w
  replace w := congr_arg (fun k => f ≫ k) w
  

Proof state:
case left_cancellation
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
g : Y ⟶ Z✝
inst✝ : Epi (f ≫ g)
Z : C
a b : Z✝ ⟶ Z
w : (fun k => f ≫ k) (g ≫ a) = (fun k => f ≫ k) (g ≫ b)
⊢ a = b

Next tactic:
dsimp at w
theorem epi_of_epi {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Epi (f ≫ g)] : Epi g := by
  constructor
  intro Z a b w
  replace w := congr_arg (fun k => f ≫ k) w
  dsimp at w
  

Proof state:
case left_cancellation
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
g : Y ⟶ Z✝
inst✝ : Epi (f ≫ g)
Z : C
a b : Z✝ ⟶ Z
w : f ≫ g ≫ a = f ≫ g ≫ b
⊢ a = b

Next tactic:
rw [← Category.assoc, ← Category.assoc] at w
theorem epi_of_epi {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Epi (f ≫ g)] : Epi g := by
  constructor
  intro Z a b w
  replace w := congr_arg (fun k => f ≫ k) w
  dsimp at w
  rw [← Category.assoc, ← Category.assoc] at w
  

Proof state:
case left_cancellation
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝¹ X Y Z✝ : C
f : X ⟶ Y
g : Y ⟶ Z✝
inst✝ : Epi (f ≫ g)
Z : C
a b : Z✝ ⟶ Z
w : (f ≫ g) ≫ a = (f ≫ g) ≫ b
⊢ a = b

Next tactic:
exact (cancel_epi _).1 w
theorem epi_of_epi_fac {X Y Z : C} {f : X ⟶ Y} {g : Y ⟶ Z} {h : X ⟶ Z} [Epi h]
    (w : f ≫ g = h) : Epi g := by
  

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝ X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
h : X ⟶ Z
inst✝ : Epi h
w : f ≫ g = h
⊢ Epi g

Next tactic:
subst h
theorem epi_of_epi_fac {X Y Z : C} {f : X ⟶ Y} {g : Y ⟶ Z} {h : X ⟶ Z} [Epi h]
    (w : f ≫ g = h) : Epi g := by
  subst h; 

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
X✝ Y✝ Z✝ X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
inst✝ : Epi (f ≫ g)
⊢ Epi g

Next tactic:
exact epi_of_epi f g
example (D : Type u) [SmallCategory D] : LargeCategory (ULift.{u + 1} D) := by 

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
D : Type u
inst✝ : SmallCategory D
⊢ LargeCategory (ULift.{u + 1, u} D)

Next tactic:
infer_instance
/-- The number of embeddings of a number field is equal to its finrank. -/
theorem card : Fintype.card (K →+* A) = finrank ℚ K := by
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : Field A
inst✝¹ : CharZero A
inst✝ : IsAlgClosed A
⊢ Fintype.card (K →+* A) = finrank ℚ K

Next tactic:
rw [Fintype.ofEquiv_card RingHom.equivRatAlgHom.symm, AlgHom.card]
instance : Nonempty (K →+* A) := by
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : Field A
inst✝¹ : CharZero A
inst✝ : IsAlgClosed A
⊢ Nonempty (K →+* A)

Next tactic:
rw [← Fintype.card_pos_iff, NumberField.Embeddings.card K A]
instance : Nonempty (K →+* A) := by
  rw [← Fintype.card_pos_iff, NumberField.Embeddings.card K A]
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : Field A
inst✝¹ : CharZero A
inst✝ : IsAlgClosed A
⊢ 0 < finrank ℚ K

Next tactic:
exact FiniteDimensional.finrank_pos
/-- Let `A` be an algebraically closed field and let `x ∈ K`, with `K` a number field.
The images of `x` by the embeddings of `K` in `A` are exactly the roots in `A` of
the minimal polynomial of `x` over `ℚ`. -/
theorem range_eval_eq_rootSet_minpoly :
    (range fun φ : K →+* A => φ x) = (minpoly ℚ x).rootSet A := by
  

Proof state:
K : Type u_1
A : Type u_2
inst✝⁴ : Field K
inst✝³ : NumberField K
inst✝² : Field A
inst✝¹ : Algebra ℚ A
inst✝ : IsAlgClosed A
x : K
⊢ (range fun φ => φ x) = rootSet (minpoly ℚ x) A

Next tactic:
convert (NumberField.isAlgebraic K).range_eval_eq_rootSet_minpoly A x using 1
/-- Let `A` be an algebraically closed field and let `x ∈ K`, with `K` a number field.
The images of `x` by the embeddings of `K` in `A` are exactly the roots in `A` of
the minimal polynomial of `x` over `ℚ`. -/
theorem range_eval_eq_rootSet_minpoly :
    (range fun φ : K →+* A => φ x) = (minpoly ℚ x).rootSet A := by
  convert (NumberField.isAlgebraic K).range_eval_eq_rootSet_minpoly A x using 1
  

Proof state:
case h.e'_2
K : Type u_1
A : Type u_2
inst✝⁴ : Field K
inst✝³ : NumberField K
inst✝² : Field A
inst✝¹ : Algebra ℚ A
inst✝ : IsAlgClosed A
x : K
⊢ (range fun φ => φ x) = range fun ψ => ψ x

Next tactic:
ext a
/-- Let `A` be an algebraically closed field and let `x ∈ K`, with `K` a number field.
The images of `x` by the embeddings of `K` in `A` are exactly the roots in `A` of
the minimal polynomial of `x` over `ℚ`. -/
theorem range_eval_eq_rootSet_minpoly :
    (range fun φ : K →+* A => φ x) = (minpoly ℚ x).rootSet A := by
  convert (NumberField.isAlgebraic K).range_eval_eq_rootSet_minpoly A x using 1
  ext a
  

Proof state:
case h.e'_2.h
K : Type u_1
A : Type u_2
inst✝⁴ : Field K
inst✝³ : NumberField K
inst✝² : Field A
inst✝¹ : Algebra ℚ A
inst✝ : IsAlgClosed A
x : K
a : A
⊢ (a ∈ range fun φ => φ x) ↔ a ∈ range fun ψ => ψ x

Next tactic:
exact ⟨fun ⟨φ, hφ⟩ => ⟨φ.toRatAlgHom, hφ⟩, fun ⟨φ, hφ⟩ => ⟨φ.toRingHom, hφ⟩⟩
theorem coeff_bdd_of_norm_le {B : ℝ} {x : K} (h : ∀ φ : K →+* A, ‖φ x‖ ≤ B) (i : ℕ) :
    ‖(minpoly ℚ x).coeff i‖ ≤ max B 1 ^ finrank ℚ K * (finrank ℚ K).choose (finrank ℚ K / 2) := by
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : NormedField A
inst✝¹ : IsAlgClosed A
inst✝ : NormedAlgebra ℚ A
B : ℝ
x : K
h : ∀ (φ : K →+* A), ‖φ x‖ ≤ B
i : ℕ
⊢ ‖coeff (minpoly ℚ x) i‖ ≤ max B 1 ^ finrank ℚ K * ↑(Nat.choose (finrank ℚ K) (finrank ℚ K / 2))

Next tactic:
have hx := IsSeparable.isIntegral ℚ x
theorem coeff_bdd_of_norm_le {B : ℝ} {x : K} (h : ∀ φ : K →+* A, ‖φ x‖ ≤ B) (i : ℕ) :
    ‖(minpoly ℚ x).coeff i‖ ≤ max B 1 ^ finrank ℚ K * (finrank ℚ K).choose (finrank ℚ K / 2) := by
  have hx := IsSeparable.isIntegral ℚ x
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : NormedField A
inst✝¹ : IsAlgClosed A
inst✝ : NormedAlgebra ℚ A
B : ℝ
x : K
h : ∀ (φ : K →+* A), ‖φ x‖ ≤ B
i : ℕ
hx : IsIntegral ℚ x
⊢ ‖coeff (minpoly ℚ x) i‖ ≤ max B 1 ^ finrank ℚ K * ↑(Nat.choose (finrank ℚ K) (finrank ℚ K / 2))

Next tactic:
rw [← norm_algebraMap' A, ← coeff_map (algebraMap ℚ A)]
theorem coeff_bdd_of_norm_le {B : ℝ} {x : K} (h : ∀ φ : K →+* A, ‖φ x‖ ≤ B) (i : ℕ) :
    ‖(minpoly ℚ x).coeff i‖ ≤ max B 1 ^ finrank ℚ K * (finrank ℚ K).choose (finrank ℚ K / 2) := by
  have hx := IsSeparable.isIntegral ℚ x
  rw [← norm_algebraMap' A, ← coeff_map (algebraMap ℚ A)]
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : NormedField A
inst✝¹ : IsAlgClosed A
inst✝ : NormedAlgebra ℚ A
B : ℝ
x : K
h : ∀ (φ : K →+* A), ‖φ x‖ ≤ B
i : ℕ
hx : IsIntegral ℚ x
⊢ ‖coeff (map (algebraMap ℚ A) (minpoly ℚ x)) i‖ ≤ max B 1 ^ finrank ℚ K * ↑(Nat.choose (finrank ℚ K) (finrank ℚ K / 2))

Next tactic:
refine coeff_bdd_of_roots_le _ (minpoly.monic hx)
      (IsAlgClosed.splits_codomain _) (minpoly.natDegree_le x) (fun z hz => ?_) i
theorem coeff_bdd_of_norm_le {B : ℝ} {x : K} (h : ∀ φ : K →+* A, ‖φ x‖ ≤ B) (i : ℕ) :
    ‖(minpoly ℚ x).coeff i‖ ≤ max B 1 ^ finrank ℚ K * (finrank ℚ K).choose (finrank ℚ K / 2) := by
  have hx := IsSeparable.isIntegral ℚ x
  rw [← norm_algebraMap' A, ← coeff_map (algebraMap ℚ A)]
  refine coeff_bdd_of_roots_le _ (minpoly.monic hx)
      (IsAlgClosed.splits_codomain _) (minpoly.natDegree_le x) (fun z hz => ?_) i
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : NormedField A
inst✝¹ : IsAlgClosed A
inst✝ : NormedAlgebra ℚ A
B : ℝ
x : K
h : ∀ (φ : K →+* A), ‖φ x‖ ≤ B
i : ℕ
hx : IsIntegral ℚ x
z : A
hz : z ∈ roots (map (algebraMap ℚ A) (minpoly ℚ x))
⊢ ‖z‖ ≤ B

Next tactic:
classical
  rw [← Multiset.mem_toFinset] at hz
  obtain ⟨φ, rfl⟩ := (range_eval_eq_rootSet_minpoly K A x).symm.subset hz
  exact h φ
theorem coeff_bdd_of_norm_le {B : ℝ} {x : K} (h : ∀ φ : K →+* A, ‖φ x‖ ≤ B) (i : ℕ) :
    ‖(minpoly ℚ x).coeff i‖ ≤ max B 1 ^ finrank ℚ K * (finrank ℚ K).choose (finrank ℚ K / 2) := by
  have hx := IsSeparable.isIntegral ℚ x
  rw [← norm_algebraMap' A, ← coeff_map (algebraMap ℚ A)]
  refine coeff_bdd_of_roots_le _ (minpoly.monic hx)
      (IsAlgClosed.splits_codomain _) (minpoly.natDegree_le x) (fun z hz => ?_) i
  classical
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : NormedField A
inst✝¹ : IsAlgClosed A
inst✝ : NormedAlgebra ℚ A
B : ℝ
x : K
h : ∀ (φ : K →+* A), ‖φ x‖ ≤ B
i : ℕ
hx : IsIntegral ℚ x
z : A
hz : z ∈ roots (map (algebraMap ℚ A) (minpoly ℚ x))
⊢ ‖z‖ ≤ B

Next tactic:
rw [← Multiset.mem_toFinset] at hz
theorem coeff_bdd_of_norm_le {B : ℝ} {x : K} (h : ∀ φ : K →+* A, ‖φ x‖ ≤ B) (i : ℕ) :
    ‖(minpoly ℚ x).coeff i‖ ≤ max B 1 ^ finrank ℚ K * (finrank ℚ K).choose (finrank ℚ K / 2) := by
  have hx := IsSeparable.isIntegral ℚ x
  rw [← norm_algebraMap' A, ← coeff_map (algebraMap ℚ A)]
  refine coeff_bdd_of_roots_le _ (minpoly.monic hx)
      (IsAlgClosed.splits_codomain _) (minpoly.natDegree_le x) (fun z hz => ?_) i
  classical
  rw [← Multiset.mem_toFinset] at hz
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : NormedField A
inst✝¹ : IsAlgClosed A
inst✝ : NormedAlgebra ℚ A
B : ℝ
x : K
h : ∀ (φ : K →+* A), ‖φ x‖ ≤ B
i : ℕ
hx : IsIntegral ℚ x
z : A
hz : z ∈ Multiset.toFinset (roots (map (algebraMap ℚ A) (minpoly ℚ x)))
⊢ ‖z‖ ≤ B

Next tactic:
obtain ⟨φ, rfl⟩ := (range_eval_eq_rootSet_minpoly K A x).symm.subset hz
theorem coeff_bdd_of_norm_le {B : ℝ} {x : K} (h : ∀ φ : K →+* A, ‖φ x‖ ≤ B) (i : ℕ) :
    ‖(minpoly ℚ x).coeff i‖ ≤ max B 1 ^ finrank ℚ K * (finrank ℚ K).choose (finrank ℚ K / 2) := by
  have hx := IsSeparable.isIntegral ℚ x
  rw [← norm_algebraMap' A, ← coeff_map (algebraMap ℚ A)]
  refine coeff_bdd_of_roots_le _ (minpoly.monic hx)
      (IsAlgClosed.splits_codomain _) (minpoly.natDegree_le x) (fun z hz => ?_) i
  classical
  rw [← Multiset.mem_toFinset] at hz
  obtain ⟨φ, rfl⟩ := (range_eval_eq_rootSet_minpoly K A x).symm.subset hz
  

Proof state:
case intro
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : NormedField A
inst✝¹ : IsAlgClosed A
inst✝ : NormedAlgebra ℚ A
B : ℝ
x : K
h : ∀ (φ : K →+* A), ‖φ x‖ ≤ B
i : ℕ
hx : IsIntegral ℚ x
φ : K →+* A
hz : (fun φ => φ x) φ ∈ Multiset.toFinset (roots (map (algebraMap ℚ A) (minpoly ℚ x)))
⊢ ‖(fun φ => φ x) φ‖ ≤ B

Next tactic:
exact h φ
/-- Let `B` be a real number. The set of algebraic integers in `K` whose conjugates are all
smaller in norm than `B` is finite. -/
theorem finite_of_norm_le (B : ℝ) : {x : K | IsIntegral ℤ x ∧ ∀ φ : K →+* A, ‖φ x‖ ≤ B}.Finite := by
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : NormedField A
inst✝¹ : IsAlgClosed A
inst✝ : NormedAlgebra ℚ A
B : ℝ
⊢ Set.Finite {x | IsIntegral ℤ x ∧ ∀ (φ : K →+* A), ‖φ x‖ ≤ B}

Next tactic:
let C := Nat.ceil (max B 1 ^ finrank ℚ K * (finrank ℚ K).choose (finrank ℚ K / 2))
/-- Let `B` be a real number. The set of algebraic integers in `K` whose conjugates are all
smaller in norm than `B` is finite. -/
theorem finite_of_norm_le (B : ℝ) : {x : K | IsIntegral ℤ x ∧ ∀ φ : K →+* A, ‖φ x‖ ≤ B}.Finite := by
  let C := Nat.ceil (max B 1 ^ finrank ℚ K * (finrank ℚ K).choose (finrank ℚ K / 2))
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : NormedField A
inst✝¹ : IsAlgClosed A
inst✝ : NormedAlgebra ℚ A
B : ℝ
C : ℕ := ⌈max B 1 ^ finrank ℚ K * ↑(Nat.choose (finrank ℚ K) (finrank ℚ K / 2))⌉₊
⊢ Set.Finite {x | IsIntegral ℤ x ∧ ∀ (φ : K →+* A), ‖φ x‖ ≤ B}

Next tactic:
have := bUnion_roots_finite (algebraMap ℤ K) (finrank ℚ K) (finite_Icc (-C : ℤ) C)
/-- Let `B` be a real number. The set of algebraic integers in `K` whose conjugates are all
smaller in norm than `B` is finite. -/
theorem finite_of_norm_le (B : ℝ) : {x : K | IsIntegral ℤ x ∧ ∀ φ : K →+* A, ‖φ x‖ ≤ B}.Finite := by
  let C := Nat.ceil (max B 1 ^ finrank ℚ K * (finrank ℚ K).choose (finrank ℚ K / 2))
  have := bUnion_roots_finite (algebraMap ℤ K) (finrank ℚ K) (finite_Icc (-C : ℤ) C)
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : NormedField A
inst✝¹ : IsAlgClosed A
inst✝ : NormedAlgebra ℚ A
B : ℝ
C : ℕ := ⌈max B 1 ^ finrank ℚ K * ↑(Nat.choose (finrank ℚ K) (finrank ℚ K / 2))⌉₊
this :
  Set.Finite
    (⋃ f,
      ⋃ (_ : natDegree f ≤ finrank ℚ K ∧ ∀ (i : ℕ), coeff f i ∈ Icc (-↑C) ↑C),
        ↑(Multiset.toFinset (roots (map (algebraMap ℤ K) f))))
⊢ Set.Finite {x | IsIntegral ℤ x ∧ ∀ (φ : K →+* A), ‖φ x‖ ≤ B}

Next tactic:
refine this.subset fun x hx => ?_
/-- Let `B` be a real number. The set of algebraic integers in `K` whose conjugates are all
smaller in norm than `B` is finite. -/
theorem finite_of_norm_le (B : ℝ) : {x : K | IsIntegral ℤ x ∧ ∀ φ : K →+* A, ‖φ x‖ ≤ B}.Finite := by
  let C := Nat.ceil (max B 1 ^ finrank ℚ K * (finrank ℚ K).choose (finrank ℚ K / 2))
  have := bUnion_roots_finite (algebraMap ℤ K) (finrank ℚ K) (finite_Icc (-C : ℤ) C)
  refine this.subset fun x hx => ?_; 

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : NormedField A
inst✝¹ : IsAlgClosed A
inst✝ : NormedAlgebra ℚ A
B : ℝ
C : ℕ := ⌈max B 1 ^ finrank ℚ K * ↑(Nat.choose (finrank ℚ K) (finrank ℚ K / 2))⌉₊
this :
  Set.Finite
    (⋃ f,
      ⋃ (_ : natDegree f ≤ finrank ℚ K ∧ ∀ (i : ℕ), coeff f i ∈ Icc (-↑C) ↑C),
        ↑(Multiset.toFinset (roots (map (algebraMap ℤ K) f))))
x : K
hx : x ∈ {x | IsIntegral ℤ x ∧ ∀ (φ : K →+* A), ‖φ x‖ ≤ B}
⊢ x ∈
    ⋃ f,
      ⋃ (_ : natDegree f ≤ finrank ℚ K ∧ ∀ (i : ℕ), coeff f i ∈ Icc (-↑C) ↑C),
        ↑(Multiset.toFinset (roots (map (algebraMap ℤ K) f)))

Next tactic:
simp_rw [mem_iUnion]
/-- Let `B` be a real number. The set of algebraic integers in `K` whose conjugates are all
smaller in norm than `B` is finite. -/
theorem finite_of_norm_le (B : ℝ) : {x : K | IsIntegral ℤ x ∧ ∀ φ : K →+* A, ‖φ x‖ ≤ B}.Finite := by
  let C := Nat.ceil (max B 1 ^ finrank ℚ K * (finrank ℚ K).choose (finrank ℚ K / 2))
  have := bUnion_roots_finite (algebraMap ℤ K) (finrank ℚ K) (finite_Icc (-C : ℤ) C)
  refine this.subset fun x hx => ?_; simp_rw [mem_iUnion]
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : NormedField A
inst✝¹ : IsAlgClosed A
inst✝ : NormedAlgebra ℚ A
B : ℝ
C : ℕ := ⌈max B 1 ^ finrank ℚ K * ↑(Nat.choose (finrank ℚ K) (finrank ℚ K / 2))⌉₊
this :
  Set.Finite
    (⋃ f,
      ⋃ (_ : natDegree f ≤ finrank ℚ K ∧ ∀ (i : ℕ), coeff f i ∈ Icc (-↑C) ↑C),
        ↑(Multiset.toFinset (roots (map (algebraMap ℤ K) f))))
x : K
hx : x ∈ {x | IsIntegral ℤ x ∧ ∀ (φ : K →+* A), ‖φ x‖ ≤ B}
⊢ ∃ i,
    ∃ (_ :
      natDegree i ≤ finrank ℚ K ∧
        ∀ (i_1 : ℕ),
          coeff i i_1 ∈
            Icc (-↑⌈max B 1 ^ finrank ℚ K * ↑(Nat.choose (finrank ℚ K) (finrank ℚ K / 2))⌉₊)
              ↑⌈max B 1 ^ finrank ℚ K * ↑(Nat.choose (finrank ℚ K) (finrank ℚ K / 2))⌉₊),
      x ∈ ↑(Multiset.toFinset (roots (map (algebraMap ℤ K) i)))

Next tactic:
have h_map_ℚ_minpoly := minpoly.isIntegrallyClosed_eq_field_fractions' ℚ hx.1
/-- Let `B` be a real number. The set of algebraic integers in `K` whose conjugates are all
smaller in norm than `B` is finite. -/
theorem finite_of_norm_le (B : ℝ) : {x : K | IsIntegral ℤ x ∧ ∀ φ : K →+* A, ‖φ x‖ ≤ B}.Finite := by
  let C := Nat.ceil (max B 1 ^ finrank ℚ K * (finrank ℚ K).choose (finrank ℚ K / 2))
  have := bUnion_roots_finite (algebraMap ℤ K) (finrank ℚ K) (finite_Icc (-C : ℤ) C)
  refine this.subset fun x hx => ?_; simp_rw [mem_iUnion]
  have h_map_ℚ_minpoly := minpoly.isIntegrallyClosed_eq_field_fractions' ℚ hx.1
  

Proof state:
K : Type u_1
inst✝⁴ : Field K
inst✝³ : NumberField K
A : Type u_2
inst✝² : NormedField A
inst✝¹ : IsAlgClosed A
inst✝ : NormedAlgebra ℚ A
B : ℝ
C : ℕ := ⌈max B 1 ^ finrank ℚ K * ↑(Nat.choose (finrank ℚ K) (finrank ℚ K / 2))⌉₊
this :
  Set.Finite
    (⋃ f,
      ⋃ (_ : natDegree f ≤ finrank ℚ K ∧ ∀ (i : ℕ), coeff f i ∈ Icc (-↑C) ↑C),
        ↑(Multiset.toFinset (roots (map (algebraMap ℤ K) f))))
x : K
hx : x ∈ {x | IsIntegral ℤ x ∧ ∀ (φ : K →+* A), ‖φ x‖ ≤ B}
h_map_ℚ_minpoly : minpoly ℚ x = map (algebraMap ℤ ℚ) (minpoly ℤ x)
⊢ ∃ i,
    ∃ (_ :
      natDegree i ≤ finrank ℚ K ∧
        ∀ (i_1 : ℕ),
          coeff i i_1 ∈
            Icc (-↑⌈max B 1 ^ finrank ℚ K * ↑(Nat.choose (finrank ℚ K) (finrank ℚ K / 2))⌉₊)
              ↑⌈max B 1 ^ finrank ℚ K * ↑(Nat.choose (finrank ℚ K) (finrank ℚ K / 2))⌉₊),
      x ∈ ↑(Multiset.toFinset (roots (map (algebraMap ℤ K) i)))

Next tactic:
refine ⟨_, ⟨?_, fun i => ?_⟩, mem_rootSet.2 ⟨minpoly.ne_zero hx.1, minpoly.aeval ℤ x⟩⟩