l3lab/ntp-mathlib huggingface dataset:
/-- Given an algebra between two fields, create an algebra between their two rings of integers. -/
instance inst_ringOfIntegersAlgebra [Algebra K L] : Algebra (𝓞 K) (𝓞 L) :=
  RingHom.toAlgebra
    { toFun := fun k => ⟨algebraMap K L k, IsIntegral.algebraMap k.2⟩
      map_zero' := Subtype.ext <| by simp only [Subtype.coe_mk, Subalgebra.coe_zero, map_zero]
      map_one' := Subtype.ext <| by simp only [Subtype.coe_mk, Subalgebra.coe_one, map_one]
      map_add' := fun x y =>
        Subtype.ext <| by simp only [map_add, Subalgebra.coe_add, Subtype.coe_mk]
      map_mul' := fun x y =>
        Subtype.ext <| by 

Proof state:
K : Type u_1
L : Type u_2
inst✝² : Field K
inst✝¹ : Field L
nf : NumberField K
inst✝ : Algebra K L
x y : ↥(𝓞 K)
⊢ ↑(OneHom.toFun
        { toFun := fun k => { val := (algebraMap K L) ↑k, property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) },
          map_one' :=
            (_ :
              (fun k => { val := (algebraMap K L) ↑k, property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) }) 1 = 1) }
        (x * y)) =
    ↑(OneHom.toFun
          { toFun := fun k => { val := (algebraMap K L) ↑k, property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) },
            map_one' :=
              (_ :
                (fun k => { val := (algebraMap K L) ↑k, property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) }) 1 = 1) }
          x *
        OneHom.toFun
          { toFun := fun k => { val := (algebraMap K L) ↑k, property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) },
            map_one' :=
              (_ :
                (fun k => { val := (algebraMap K L) ↑k, property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) }) 1 = 1) }
          y)

Next tactic:
simp only [Subalgebra.coe_mul, map_mul, Subtype.coe_mk]
/-- Given an algebra between two fields, create an algebra between their two rings of integers. -/
instance inst_ringOfIntegersAlgebra [Algebra K L] : Algebra (𝓞 K) (𝓞 L) :=
  RingHom.toAlgebra
    { toFun := fun k => ⟨algebraMap K L k, IsIntegral.algebraMap k.2⟩
      map_zero' := Subtype.ext <| by 

Proof state:
K : Type u_1
L : Type u_2
inst✝² : Field K
inst✝¹ : Field L
nf : NumberField K
inst✝ : Algebra K L
⊢ ↑(OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := fun k => { val := (algebraMap K L) ↑k, property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) },
                map_one' :=
                  (_ :
                    (fun k => { val := (algebraMap K L) ↑k, property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) }) 1 =
                      1) },
            map_mul' :=
              (_ :
                ∀ (x y : ↥(𝓞 K)),
                  OneHom.toFun
                      {
                        toFun := fun k =>
                          { val := (algebraMap K L) ↑k, property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) },
                        map_one' :=
                          (_ :
                            (fun k =>
                                  { val := (algebraMap K L) ↑k, property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) })
                                1 =
                              1) }
                      (x * y) =
                    OneHom.toFun
                        {
                          toFun := fun k =>
                            { val := (algebraMap K L) ↑k, property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) },
                          map_one' :=
                            (_ :
                              (fun k =>
                                    { val := (algebraMap K L) ↑k,
                                      property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) })
                                  1 =
                                1) }
                        x *
                      OneHom.toFun
                        {
                          toFun := fun k =>
                            { val := (algebraMap K L) ↑k, property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) },
                          map_one' :=
                            (_ :
                              (fun k =>
                                    { val := (algebraMap K L) ↑k,
                                      property := (_ : IsIntegral ℤ ((algebraMap K L) ↑k)) })
                                  1 =
                                1) }
                        y) })
        0) =
    ↑0

Next tactic:
simp only [Subtype.coe_mk, Subalgebra.coe_zero, map_zero]
/-- The ring of integers of a number field is not a field. -/
theorem not_isField : ¬IsField (𝓞 K) := by
  

Proof state:
K : Type u_1
L : Type u_2
inst✝¹ : Field K
inst✝ : Field L
nf : NumberField K
⊢ ¬IsField ↥(𝓞 K)

Next tactic:
have h_inj : Function.Injective (algebraMap ℤ (𝓞 K)) := RingHom.injective_int (algebraMap ℤ (𝓞 K))
/-- The ring of integers of a number field is not a field. -/
theorem not_isField : ¬IsField (𝓞 K) := by
  have h_inj : Function.Injective (algebraMap ℤ (𝓞 K)) := RingHom.injective_int (algebraMap ℤ (𝓞 K))
  

Proof state:
K : Type u_1
L : Type u_2
inst✝¹ : Field K
inst✝ : Field L
nf : NumberField K
h_inj : Injective ⇑(algebraMap ℤ ↥(𝓞 K))
⊢ ¬IsField ↥(𝓞 K)

Next tactic:
intro hf
/-- The ring of integers of a number field is not a field. -/
theorem not_isField : ¬IsField (𝓞 K) := by
  have h_inj : Function.Injective (algebraMap ℤ (𝓞 K)) := RingHom.injective_int (algebraMap ℤ (𝓞 K))
  intro hf
  

Proof state:
K : Type u_1
L : Type u_2
inst✝¹ : Field K
inst✝ : Field L
nf : NumberField K
h_inj : Injective ⇑(algebraMap ℤ ↥(𝓞 K))
hf : IsField ↥(𝓞 K)
⊢ False

Next tactic:
exact Int.not_isField
    (((IsIntegralClosure.isIntegral_algebra ℤ K).isField_iff_isField h_inj).mpr hf)
theorem mem_span_integralBasis {x : K} :
    x ∈ Submodule.span ℤ (Set.range (integralBasis K)) ↔ x ∈ 𝓞 K := by
  

Proof state:
K : Type u_1
L : Type u_2
inst✝¹ : Field K
inst✝ : Field L
nf : NumberField K
x : K
⊢ x ∈ Submodule.span ℤ (Set.range ⇑(integralBasis K)) ↔ x ∈ 𝓞 K

Next tactic:
rw [integralBasis, Basis.localizationLocalization_span, Subalgebra.range_isScalarTower_toAlgHom,
    Subalgebra.mem_toSubmodule]
instance numberField : NumberField ℚ where
  to_charZero := inferInstance
  to_finiteDimensional := by
  -- The vector space structure of `ℚ` over itself can arise in multiple ways:
  -- all fields are vector spaces over themselves (used in `Rat.finiteDimensional`)
  -- all char 0 fields have a canonical embedding of `ℚ` (used in `NumberField`).
  -- Show that these coincide:
    

Proof state:
⊢ FiniteDimensional ℚ ℚ

Next tactic:
convert (inferInstance : FiniteDimensional ℚ ℚ)
/-- The quotient of `ℚ[X]` by the ideal generated by an irreducible polynomial of `ℚ[X]`
is a number field. -/
instance {f : Polynomial ℚ} [hf : Fact (Irreducible f)] : NumberField (AdjoinRoot f) where
  to_charZero := charZero_of_injective_algebraMap (algebraMap ℚ _).injective
  to_finiteDimensional := by 

Proof state:
f : Polynomial ℚ
hf : Fact (Irreducible f)
⊢ FiniteDimensional ℚ (AdjoinRoot f)

Next tactic:
convert (AdjoinRoot.powerBasis hf.out.ne_zero).finiteDimensional
theorem iSup_decode₂ [CompleteLattice α] (f : β → α) :
    ⨆ (i : ℕ) (b ∈ decode₂ β i), f b = (⨆ b, f b) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Encodable β
inst✝ : CompleteLattice α
f : β → α
⊢ ⨆ i, ⨆ b ∈ decode₂ β i, f b = ⨆ b, f b

Next tactic:
rw [iSup_comm]
theorem iSup_decode₂ [CompleteLattice α] (f : β → α) :
    ⨆ (i : ℕ) (b ∈ decode₂ β i), f b = (⨆ b, f b) := by
  rw [iSup_comm]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Encodable β
inst✝ : CompleteLattice α
f : β → α
⊢ ⨆ j, ⨆ i, ⨆ (_ : j ∈ decode₂ β i), f j = ⨆ b, f b

Next tactic:
simp only [mem_decode₂, iSup_iSup_eq_right]
theorem iUnion_decode₂_cases {f : β → Set α} {C : Set α → Prop} (H0 : C ∅) (H1 : ∀ b, C (f b)) {n} :
    C (⋃ b ∈ decode₂ β n, f b) :=
  match decode₂ β n with
  | none => by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Encodable β
f : β → Set α
C : Set α → Prop
H0 : C ∅
H1 : ∀ (b : β), C (f b)
n : ℕ
⊢ C (⋃ b ∈ none, f b)

Next tactic:
simp only [Option.mem_def, iUnion_of_empty, iUnion_empty]
theorem iUnion_decode₂_cases {f : β → Set α} {C : Set α → Prop} (H0 : C ∅) (H1 : ∀ b, C (f b)) {n} :
    C (⋃ b ∈ decode₂ β n, f b) :=
  match decode₂ β n with
  | none => by
    simp only [Option.mem_def, iUnion_of_empty, iUnion_empty]
    

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Encodable β
f : β → Set α
C : Set α → Prop
H0 : C ∅
H1 : ∀ (b : β), C (f b)
n : ℕ
⊢ C ∅

Next tactic:
apply H0
theorem iUnion_decode₂_cases {f : β → Set α} {C : Set α → Prop} (H0 : C ∅) (H1 : ∀ b, C (f b)) {n} :
    C (⋃ b ∈ decode₂ β n, f b) :=
  match decode₂ β n with
  | none => by
    simp only [Option.mem_def, iUnion_of_empty, iUnion_empty]
    apply H0
  | some b => by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Encodable β
f : β → Set α
C : Set α → Prop
H0 : C ∅
H1 : ∀ (b : β), C (f b)
n : ℕ
b : β
⊢ C (⋃ b_1 ∈ some b, f b_1)

Next tactic:
convert H1 b
theorem iUnion_decode₂_cases {f : β → Set α} {C : Set α → Prop} (H0 : C ∅) (H1 : ∀ b, C (f b)) {n} :
    C (⋃ b ∈ decode₂ β n, f b) :=
  match decode₂ β n with
  | none => by
    simp only [Option.mem_def, iUnion_of_empty, iUnion_empty]
    apply H0
  | some b => by
    convert H1 b
    

Proof state:
case h.e'_1
α : Type u_1
β : Type u_2
inst✝ : Encodable β
f : β → Set α
C : Set α → Prop
H0 : C ∅
H1 : ∀ (b : β), C (f b)
n : ℕ
b : β
⊢ ⋃ b_1 ∈ some b, f b_1 = f b

Next tactic:
simp [ext_iff]
theorem iUnion_decode₂_disjoint_on {f : β → Set α} (hd : Pairwise (Disjoint on f)) :
    Pairwise (Disjoint on fun i => ⋃ b ∈ decode₂ β i, f b) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Encodable β
f : β → Set α
hd : Pairwise (Disjoint on f)
⊢ Pairwise (Disjoint on fun i => ⋃ b ∈ decode₂ β i, f b)

Next tactic:
rintro i j ij
theorem iUnion_decode₂_disjoint_on {f : β → Set α} (hd : Pairwise (Disjoint on f)) :
    Pairwise (Disjoint on fun i => ⋃ b ∈ decode₂ β i, f b) := by
  rintro i j ij
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Encodable β
f : β → Set α
hd : Pairwise (Disjoint on f)
i j : ℕ
ij : i ≠ j
⊢ (Disjoint on fun i => ⋃ b ∈ decode₂ β i, f b) i j

Next tactic:
refine' disjoint_left.mpr fun x => _
theorem iUnion_decode₂_disjoint_on {f : β → Set α} (hd : Pairwise (Disjoint on f)) :
    Pairwise (Disjoint on fun i => ⋃ b ∈ decode₂ β i, f b) := by
  rintro i j ij
  refine' disjoint_left.mpr fun x => _
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Encodable β
f : β → Set α
hd : Pairwise (Disjoint on f)
i j : ℕ
ij : i ≠ j
x : α
⊢ x ∈ (fun i => ⋃ b ∈ decode₂ β i, f b) i → x ∉ (fun i => ⋃ b ∈ decode₂ β i, f b) j

Next tactic:
suffices ∀ a, encode a = i → x ∈ f a → ∀ b, encode b = j → x ∉ f b by simpa [decode₂_eq_some]
theorem iUnion_decode₂_disjoint_on {f : β → Set α} (hd : Pairwise (Disjoint on f)) :
    Pairwise (Disjoint on fun i => ⋃ b ∈ decode₂ β i, f b) := by
  rintro i j ij
  refine' disjoint_left.mpr fun x => _
  suffices ∀ a, encode a = i → x ∈ f a → ∀ b, encode b = j → x ∉ f b by 

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Encodable β
f : β → Set α
hd : Pairwise (Disjoint on f)
i j : ℕ
ij : i ≠ j
x : α
this : ∀ (a : β), encode a = i → x ∈ f a → ∀ (b : β), encode b = j → x ∉ f b
⊢ x ∈ (fun i => ⋃ b ∈ decode₂ β i, f b) i → x ∉ (fun i => ⋃ b ∈ decode₂ β i, f b) j

Next tactic:
simpa [decode₂_eq_some]
theorem iUnion_decode₂_disjoint_on {f : β → Set α} (hd : Pairwise (Disjoint on f)) :
    Pairwise (Disjoint on fun i => ⋃ b ∈ decode₂ β i, f b) := by
  rintro i j ij
  refine' disjoint_left.mpr fun x => _
  suffices ∀ a, encode a = i → x ∈ f a → ∀ b, encode b = j → x ∉ f b by simpa [decode₂_eq_some]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Encodable β
f : β → Set α
hd : Pairwise (Disjoint on f)
i j : ℕ
ij : i ≠ j
x : α
⊢ ∀ (a : β), encode a = i → x ∈ f a → ∀ (b : β), encode b = j → x ∉ f b

Next tactic:
rintro a rfl ha b rfl hb
theorem iUnion_decode₂_disjoint_on {f : β → Set α} (hd : Pairwise (Disjoint on f)) :
    Pairwise (Disjoint on fun i => ⋃ b ∈ decode₂ β i, f b) := by
  rintro i j ij
  refine' disjoint_left.mpr fun x => _
  suffices ∀ a, encode a = i → x ∈ f a → ∀ b, encode b = j → x ∉ f b by simpa [decode₂_eq_some]
  rintro a rfl ha b rfl hb
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Encodable β
f : β → Set α
hd : Pairwise (Disjoint on f)
x : α
a : β
ha : x ∈ f a
b : β
ij : encode a ≠ encode b
hb : x ∈ f b
⊢ False

Next tactic:
exact (hd (mt (congr_arg encode) ij)).le_bot ⟨ha, hb⟩
@[simp]
theorem fst_natCast (n : ℕ) : (n : α × β).fst = n := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : AddMonoidWithOne α
inst✝ : AddMonoidWithOne β
n : ℕ
⊢ (↑n).1 = ↑n

Next tactic:
induction n
@[simp]
theorem fst_natCast (n : ℕ) : (n : α × β).fst = n := by induction n <;> 

Proof state:
case zero
α : Type u_1
β : Type u_2
inst✝¹ : AddMonoidWithOne α
inst✝ : AddMonoidWithOne β
⊢ (↑Nat.zero).1 = ↑Nat.zero

Next tactic:
simp [*]
@[simp]
theorem fst_natCast (n : ℕ) : (n : α × β).fst = n := by induction n <;> 

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝¹ : AddMonoidWithOne α
inst✝ : AddMonoidWithOne β
n✝ : ℕ
n_ih✝ : (↑n✝).1 = ↑n✝
⊢ (↑(Nat.succ n✝)).1 = ↑(Nat.succ n✝)

Next tactic:
simp [*]
@[simp]
theorem snd_natCast (n : ℕ) : (n : α × β).snd = n := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : AddMonoidWithOne α
inst✝ : AddMonoidWithOne β
n : ℕ
⊢ (↑n).2 = ↑n

Next tactic:
induction n
@[simp]
theorem snd_natCast (n : ℕ) : (n : α × β).snd = n := by induction n <;> 

Proof state:
case zero
α : Type u_1
β : Type u_2
inst✝¹ : AddMonoidWithOne α
inst✝ : AddMonoidWithOne β
⊢ (↑Nat.zero).2 = ↑Nat.zero

Next tactic:
simp [*]
@[simp]
theorem snd_natCast (n : ℕ) : (n : α × β).snd = n := by induction n <;> 

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝¹ : AddMonoidWithOne α
inst✝ : AddMonoidWithOne β
n✝ : ℕ
n_ih✝ : (↑n✝).2 = ↑n✝
⊢ (↑(Nat.succ n✝)).2 = ↑(Nat.succ n✝)

Next tactic:
simp [*]
theorem not_ringChar_dvd_of_invertible {t : ℕ} [Invertible (t : K)] : ¬ringChar K ∣ t := by
  

Proof state:
K : Type u_1
inst✝¹ : Field K
t : ℕ
inst✝ : Invertible ↑t
⊢ ¬ringChar K ∣ t

Next tactic:
rw [← ringChar.spec, ← Ne.def]
theorem not_ringChar_dvd_of_invertible {t : ℕ} [Invertible (t : K)] : ¬ringChar K ∣ t := by
  rw [← ringChar.spec, ← Ne.def]
  

Proof state:
K : Type u_1
inst✝¹ : Field K
t : ℕ
inst✝ : Invertible ↑t
⊢ ↑t ≠ 0

Next tactic:
exact nonzero_of_invertible (t : K)
instance invertibleTwo : Invertible (2 : K) :=
  invertibleOfNonzero (mod_cast (by 

Proof state:
K : Type u_1
inst✝¹ : DivisionRing K
inst✝ : CharZero K
⊢ 2 ≠ 0

Next tactic:
decide
instance invertibleThree : Invertible (3 : K) :=
  invertibleOfNonzero (mod_cast (by 

Proof state:
K : Type u_1
inst✝¹ : DivisionRing K
inst✝ : CharZero K
⊢ 3 ≠ 0

Next tactic:
decide
/-- The presheaf of dependently typed functions on `X`, with fibres given by a type family `T`.
There is no requirement that the functions are continuous, here.
-/
def presheafToTypes (T : X → Type v) : X.Presheaf (Type v) where
  obj U := ∀ x : U.unop, T x
  map {U V} i g := fun x : V.unop => g (i.unop x)
  map_id U := by
    

Proof state:
X : TopCat
T : ↑X → Type v
U : (Opens ↑X)ᵒᵖ
⊢ { obj := fun U => (x : ↥U.unop) → T ↑x,
          map := fun {U V} i g x => g ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x) }.map
      (𝟙 U) =
    𝟙
      ({ obj := fun U => (x : ↥U.unop) → T ↑x,
            map := fun {U V} i g x => g ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x) }.obj
        U)

Next tactic:
ext g
/-- The presheaf of dependently typed functions on `X`, with fibres given by a type family `T`.
There is no requirement that the functions are continuous, here.
-/
def presheafToTypes (T : X → Type v) : X.Presheaf (Type v) where
  obj U := ∀ x : U.unop, T x
  map {U V} i g := fun x : V.unop => g (i.unop x)
  map_id U := by
    ext g
    

Proof state:
case h.h
X : TopCat
T : ↑X → Type v
U : (Opens ↑X)ᵒᵖ
g :
  { obj := fun U => (x : ↥U.unop) → T ↑x,
        map := fun {U V} i g x => g ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x) }.obj
    U
x✝ : ↥U.unop
⊢ { obj := fun U => (x : ↥U.unop) → T ↑x,
          map := fun {U V} i g x => g ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x) }.map
      (𝟙 U) g x✝ =
    𝟙
      ({ obj := fun U => (x : ↥U.unop) → T ↑x,
            map := fun {U V} i g x => g ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x) }.obj
        U)
      g x✝

Next tactic:
rfl
/-- The presheaf of functions on `X` with values in a type `T`.
There is no requirement that the functions are continuous, here.
-/
def presheafToType (T : Type v) : X.Presheaf (Type v) where
  obj U := U.unop → T
  map {U V} i g := g ∘ i.unop
  map_id U := by
    

Proof state:
X : TopCat
T : Type v
U : (Opens ↑X)ᵒᵖ
⊢ { obj := fun U => ↥U.unop → T,
          map := fun {U V} i g => g ∘ fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) } }.map
      (𝟙 U) =
    𝟙
      ({ obj := fun U => ↥U.unop → T,
            map := fun {U V} i g => g ∘ fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) } }.obj
        U)

Next tactic:
ext g
/-- The presheaf of functions on `X` with values in a type `T`.
There is no requirement that the functions are continuous, here.
-/
def presheafToType (T : Type v) : X.Presheaf (Type v) where
  obj U := U.unop → T
  map {U V} i g := g ∘ i.unop
  map_id U := by
    ext g
    

Proof state:
case h.h
X : TopCat
T : Type v
U : (Opens ↑X)ᵒᵖ
g :
  { obj := fun U => ↥U.unop → T,
        map := fun {U V} i g => g ∘ fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) } }.obj
    U
x✝ : ↥U.unop
⊢ { obj := fun U => ↥U.unop → T,
          map := fun {U V} i g => g ∘ fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) } }.map
      (𝟙 U) g x✝ =
    𝟙
      ({ obj := fun U => ↥U.unop → T,
            map := fun {U V} i g => g ∘ fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) } }.obj
        U)
      g x✝

Next tactic:
rfl
/-- The (bundled) commutative ring of continuous functions from a topological space
to a topological commutative ring, with pointwise multiplication. -/
def continuousFunctions (X : TopCat.{v}ᵒᵖ) (R : TopCommRingCat.{v}) : CommRingCat.{v} :=
  -- Porting note : Lean did not see through that `X.unop ⟶ R` is just continuous functions
  -- hence forms a ring
  @CommRingCat.of (X.unop ⟶ (forget₂ TopCommRingCat TopCat).obj R) <|
  show CommRing (ContinuousMap _ _) by 

Proof state:
X✝ : TopCat
X : TopCatᵒᵖ
R : TopCommRingCat
⊢ CommRing C(↑X.unop, ↑((forget₂ TopCommRingCat TopCat).obj R))

Next tactic:
infer_instance
/-- Pulling back functions into a topological ring along a continuous map is a ring homomorphism. -/
def pullback {X Y : TopCatᵒᵖ} (f : X ⟶ Y) (R : TopCommRingCat) :
    continuousFunctions X R ⟶ continuousFunctions Y R where
  toFun g := f.unop ≫ g
  map_one' := rfl
  map_zero' := rfl
  map_add' := by aesop_cat
  map_mul' := by 

Proof state:
X✝ : TopCat
X Y : TopCatᵒᵖ
f : X ⟶ Y
R : TopCommRingCat
⊢ ∀ (x y : ↑(continuousFunctions X R)),
    OneHom.toFun { toFun := fun g => f.unop ≫ g, map_one' := (_ : (fun g => f.unop ≫ g) 1 = (fun g => f.unop ≫ g) 1) }
        (x * y) =
      OneHom.toFun { toFun := fun g => f.unop ≫ g, map_one' := (_ : (fun g => f.unop ≫ g) 1 = (fun g => f.unop ≫ g) 1) }
          x *
        OneHom.toFun
          { toFun := fun g => f.unop ≫ g, map_one' := (_ : (fun g => f.unop ≫ g) 1 = (fun g => f.unop ≫ g) 1) } y

Next tactic:
aesop_cat
/-- An upgraded version of the Yoneda embedding, observing that the continuous maps
from `X : TopCat` to `R : TopCommRingCat` form a commutative ring, functorial in both `X` and
`R`. -/
def commRingYoneda : TopCommRingCat.{u} ⥤ TopCat.{u}ᵒᵖ ⥤ CommRingCat.{u} where
  obj R :=
    { obj := fun X => continuousFunctions X R
      map := fun {X Y} f => continuousFunctions.pullback f R
      map_id := fun X => by
        

Proof state:
X✝ : TopCat
R : TopCommRingCat
X : TopCatᵒᵖ
⊢ { obj := fun X => continuousFunctions X R, map := fun {X Y} f => continuousFunctions.pullback f R }.map (𝟙 X) =
    𝟙 ({ obj := fun X => continuousFunctions X R, map := fun {X Y} f => continuousFunctions.pullback f R }.obj X)

Next tactic:
ext
/-- An upgraded version of the Yoneda embedding, observing that the continuous maps
from `X : TopCat` to `R : TopCommRingCat` form a commutative ring, functorial in both `X` and
`R`. -/
def commRingYoneda : TopCommRingCat.{u} ⥤ TopCat.{u}ᵒᵖ ⥤ CommRingCat.{u} where
  obj R :=
    { obj := fun X => continuousFunctions X R
      map := fun {X Y} f => continuousFunctions.pullback f R
      map_id := fun X => by
        ext
        

Proof state:
case w
X✝ : TopCat
R : TopCommRingCat
X : TopCatᵒᵖ
x✝ :
  (forget CommRingCat).obj
    ({ obj := fun X => continuousFunctions X R, map := fun {X Y} f => continuousFunctions.pullback f R }.obj X)
⊢ ({ obj := fun X => continuousFunctions X R, map := fun {X Y} f => continuousFunctions.pullback f R }.map (𝟙 X)) x✝ =
    (𝟙 ({ obj := fun X => continuousFunctions X R, map := fun {X Y} f => continuousFunctions.pullback f R }.obj X)) x✝

Next tactic:
rfl
/-- An upgraded version of the Yoneda embedding, observing that the continuous maps
from `X : TopCat` to `R : TopCommRingCat` form a commutative ring, functorial in both `X` and
`R`. -/
def commRingYoneda : TopCommRingCat.{u} ⥤ TopCat.{u}ᵒᵖ ⥤ CommRingCat.{u} where
  obj R :=
    { obj := fun X => continuousFunctions X R
      map := fun {X Y} f => continuousFunctions.pullback f R
      map_id := fun X => by
        ext
        rfl
      map_comp := fun {X Y Z} f g => rfl }
  map {R S} φ :=
    { app := fun X => continuousFunctions.map X φ
      naturality := fun X Y f => rfl }
  map_id X := by
    

Proof state:
X✝ : TopCat
X : TopCommRingCat
⊢ {
          obj := fun R =>
            CategoryTheory.Functor.mk
              { obj := fun X => continuousFunctions X R, map := fun {X Y} f => continuousFunctions.pullback f R },
          map := fun {R S} φ => NatTrans.mk fun X => continuousFunctions.map X φ }.map
      (𝟙 X) =
    𝟙
      ({
            obj := fun R =>
              CategoryTheory.Functor.mk
                { obj := fun X => continuousFunctions X R, map := fun {X Y} f => continuousFunctions.pullback f R },
            map := fun {R S} φ => NatTrans.mk fun X => continuousFunctions.map X φ }.obj
        X)

Next tactic:
ext
/-- An upgraded version of the Yoneda embedding, observing that the continuous maps
from `X : TopCat` to `R : TopCommRingCat` form a commutative ring, functorial in both `X` and
`R`. -/
def commRingYoneda : TopCommRingCat.{u} ⥤ TopCat.{u}ᵒᵖ ⥤ CommRingCat.{u} where
  obj R :=
    { obj := fun X => continuousFunctions X R
      map := fun {X Y} f => continuousFunctions.pullback f R
      map_id := fun X => by
        ext
        rfl
      map_comp := fun {X Y Z} f g => rfl }
  map {R S} φ :=
    { app := fun X => continuousFunctions.map X φ
      naturality := fun X Y f => rfl }
  map_id X := by
    ext
    

Proof state:
case w.h.w
X✝ : TopCat
X : TopCommRingCat
x✝¹ : TopCatᵒᵖ
x✝ :
  (forget CommRingCat).obj
    (({
              obj := fun R =>
                CategoryTheory.Functor.mk
                  { obj := fun X => continuousFunctions X R, map := fun {X Y} f => continuousFunctions.pullback f R },
              map := fun {R S} φ => NatTrans.mk fun X => continuousFunctions.map X φ }.obj
          X).obj
      x✝¹)
⊢ (({
                obj := fun R =>
                  CategoryTheory.Functor.mk
                    { obj := fun X => continuousFunctions X R, map := fun {X Y} f => continuousFunctions.pullback f R },
                map := fun {R S} φ => NatTrans.mk fun X => continuousFunctions.map X φ }.map
            (𝟙 X)).app
        x✝¹)
      x✝ =
    ((𝟙
            ({
                  obj := fun R =>
                    CategoryTheory.Functor.mk
                      { obj := fun X => continuousFunctions X R,
                        map := fun {X Y} f => continuousFunctions.pullback f R },
                  map := fun {R S} φ => NatTrans.mk fun X => continuousFunctions.map X φ }.obj
              X)).app
        x✝¹)
      x✝

Next tactic:
rfl
@[simp]
theorem eval_one_cyclotomic_prime {R : Type*} [CommRing R] {p : ℕ} [hn : Fact p.Prime] :
    eval 1 (cyclotomic p R) = p := by
  

Proof state:
R : Type u_1
inst✝ : CommRing R
p : ℕ
hn : Fact (Nat.Prime p)
⊢ eval 1 (cyclotomic p R) = ↑p

Next tactic:
simp only [cyclotomic_prime, eval_X, one_pow, Finset.sum_const, eval_pow, eval_finset_sum,
    Finset.card_range, smul_one_eq_coe]