l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem lookupFinsupp_support [DecidableEq α] [DecidableEq M] (l : AList fun _x : α => M) :
    l.lookupFinsupp.support = (l.1.filter fun x => Sigma.snd x ≠ 0).keys.toFinset := by
  convert rfl; 

Proof state:
case h.e'_3
α : Type u_1
M : Type u_2
inst✝² : Zero M
inst✝¹ : DecidableEq α
inst✝ : DecidableEq M
l : AList fun _x => M
⊢ toFinset (List.keys (filter (fun x => decide (x.snd ≠ 0)) l.entries)) = (lookupFinsupp l).support

Next tactic:
congr
@[simp]
theorem lookupFinsupp_support [DecidableEq α] [DecidableEq M] (l : AList fun _x : α => M) :
    l.lookupFinsupp.support = (l.1.filter fun x => Sigma.snd x ≠ 0).keys.toFinset := by
  convert rfl; congr
  · 

Proof state:
case h.e'_3.h.e_2.h
α : Type u_1
M : Type u_2
inst✝² : Zero M
inst✝¹ : DecidableEq α
inst✝ : DecidableEq M
l : AList fun _x => M
⊢ (fun a b => inst✝¹ a b) = fun a b => Classical.decEq α a b

Next tactic:
apply Subsingleton.elim
@[simp]
theorem lookupFinsupp_support [DecidableEq α] [DecidableEq M] (l : AList fun _x : α => M) :
    l.lookupFinsupp.support = (l.1.filter fun x => Sigma.snd x ≠ 0).keys.toFinset := by
  convert rfl; congr
  · apply Subsingleton.elim
  · 

Proof state:
case h.e'_3.h.e_3.h.e_a.e_p
α : Type u_1
M : Type u_2
inst✝² : Zero M
inst✝¹ : DecidableEq α
inst✝ : DecidableEq M
l : AList fun _x => M
⊢ (fun x => decide (x.snd ≠ 0)) = fun x => decide (x.snd ≠ 0)

Next tactic:
funext
@[simp]
theorem lookupFinsupp_support [DecidableEq α] [DecidableEq M] (l : AList fun _x : α => M) :
    l.lookupFinsupp.support = (l.1.filter fun x => Sigma.snd x ≠ 0).keys.toFinset := by
  convert rfl; congr
  · apply Subsingleton.elim
  · funext; 

Proof state:
case h.e'_3.h.e_3.h.e_a.e_p.h
α : Type u_1
M : Type u_2
inst✝² : Zero M
inst✝¹ : DecidableEq α
inst✝ : DecidableEq M
l : AList fun _x => M
x✝ : (_ : α) × M
⊢ decide (x✝.snd ≠ 0) = decide (x✝.snd ≠ 0)

Next tactic:
congr
theorem lookupFinsupp_eq_iff_of_ne_zero [DecidableEq α] {l : AList fun _x : α => M} {a : α} {x : M}
    (hx : x ≠ 0) : l.lookupFinsupp a = x ↔ x ∈ l.lookup a := by
  

Proof state:
α : Type u_1
M : Type u_2
inst✝¹ : Zero M
inst✝ : DecidableEq α
l : AList fun _x => M
a : α
x : M
hx : x ≠ 0
⊢ (lookupFinsupp l) a = x ↔ x ∈ lookup a l

Next tactic:
rw [lookupFinsupp_apply]
theorem lookupFinsupp_eq_iff_of_ne_zero [DecidableEq α] {l : AList fun _x : α => M} {a : α} {x : M}
    (hx : x ≠ 0) : l.lookupFinsupp a = x ↔ x ∈ l.lookup a := by
  rw [lookupFinsupp_apply]
  

Proof state:
α : Type u_1
M : Type u_2
inst✝¹ : Zero M
inst✝ : DecidableEq α
l : AList fun _x => M
a : α
x : M
hx : x ≠ 0
⊢ Option.getD (lookup a l) 0 = x ↔ x ∈ lookup a l

Next tactic:
cases' lookup a l with m
theorem lookupFinsupp_eq_iff_of_ne_zero [DecidableEq α] {l : AList fun _x : α => M} {a : α} {x : M}
    (hx : x ≠ 0) : l.lookupFinsupp a = x ↔ x ∈ l.lookup a := by
  rw [lookupFinsupp_apply]
  cases' lookup a l with m <;> 

Proof state:
case none
α : Type u_1
M : Type u_2
inst✝¹ : Zero M
inst✝ : DecidableEq α
l : AList fun _x => M
a : α
x : M
hx : x ≠ 0
⊢ Option.getD none 0 = x ↔ x ∈ none

Next tactic:
simp [hx.symm]
theorem lookupFinsupp_eq_iff_of_ne_zero [DecidableEq α] {l : AList fun _x : α => M} {a : α} {x : M}
    (hx : x ≠ 0) : l.lookupFinsupp a = x ↔ x ∈ l.lookup a := by
  rw [lookupFinsupp_apply]
  cases' lookup a l with m <;> 

Proof state:
case some
α : Type u_1
M : Type u_2
inst✝¹ : Zero M
inst✝ : DecidableEq α
l : AList fun _x => M
a : α
x : M
hx : x ≠ 0
m : M
⊢ Option.getD (some m) 0 = x ↔ x ∈ some m

Next tactic:
simp [hx.symm]
theorem lookupFinsupp_eq_zero_iff [DecidableEq α] {l : AList fun _x : α => M} {a : α} :
    l.lookupFinsupp a = 0 ↔ a ∉ l ∨ (0 : M) ∈ l.lookup a := by
  

Proof state:
α : Type u_1
M : Type u_2
inst✝¹ : Zero M
inst✝ : DecidableEq α
l : AList fun _x => M
a : α
⊢ (lookupFinsupp l) a = 0 ↔ a ∉ l ∨ 0 ∈ lookup a l

Next tactic:
rw [lookupFinsupp_apply, ← lookup_eq_none]
theorem lookupFinsupp_eq_zero_iff [DecidableEq α] {l : AList fun _x : α => M} {a : α} :
    l.lookupFinsupp a = 0 ↔ a ∉ l ∨ (0 : M) ∈ l.lookup a := by
  rw [lookupFinsupp_apply, ← lookup_eq_none]
  

Proof state:
α : Type u_1
M : Type u_2
inst✝¹ : Zero M
inst✝ : DecidableEq α
l : AList fun _x => M
a : α
⊢ Option.getD (lookup a l) 0 = 0 ↔ lookup a l = none ∨ 0 ∈ lookup a l

Next tactic:
cases' lookup a l with m
theorem lookupFinsupp_eq_zero_iff [DecidableEq α] {l : AList fun _x : α => M} {a : α} :
    l.lookupFinsupp a = 0 ↔ a ∉ l ∨ (0 : M) ∈ l.lookup a := by
  rw [lookupFinsupp_apply, ← lookup_eq_none]
  cases' lookup a l with m <;> 

Proof state:
case none
α : Type u_1
M : Type u_2
inst✝¹ : Zero M
inst✝ : DecidableEq α
l : AList fun _x => M
a : α
⊢ Option.getD none 0 = 0 ↔ none = none ∨ 0 ∈ none

Next tactic:
simp
theorem lookupFinsupp_eq_zero_iff [DecidableEq α] {l : AList fun _x : α => M} {a : α} :
    l.lookupFinsupp a = 0 ↔ a ∉ l ∨ (0 : M) ∈ l.lookup a := by
  rw [lookupFinsupp_apply, ← lookup_eq_none]
  cases' lookup a l with m <;> 

Proof state:
case some
α : Type u_1
M : Type u_2
inst✝¹ : Zero M
inst✝ : DecidableEq α
l : AList fun _x => M
a : α
m : M
⊢ Option.getD (some m) 0 = 0 ↔ some m = none ∨ 0 ∈ some m

Next tactic:
simp
@[simp]
theorem empty_lookupFinsupp : lookupFinsupp (∅ : AList fun _x : α => M) = 0 := by
  

Proof state:
α : Type u_1
M : Type u_2
inst✝ : Zero M
⊢ lookupFinsupp ∅ = 0

Next tactic:
classical
    ext
    simp
@[simp]
theorem empty_lookupFinsupp : lookupFinsupp (∅ : AList fun _x : α => M) = 0 := by
  classical
    

Proof state:
α : Type u_1
M : Type u_2
inst✝ : Zero M
⊢ lookupFinsupp ∅ = 0

Next tactic:
ext
@[simp]
theorem empty_lookupFinsupp : lookupFinsupp (∅ : AList fun _x : α => M) = 0 := by
  classical
    ext
    

Proof state:
case h
α : Type u_1
M : Type u_2
inst✝ : Zero M
a✝ : α
⊢ (lookupFinsupp ∅) a✝ = 0 a✝

Next tactic:
simp
@[simp]
theorem insert_lookupFinsupp [DecidableEq α] (l : AList fun _x : α => M) (a : α) (m : M) :
    (l.insert a m).lookupFinsupp = l.lookupFinsupp.update a m := by
  

Proof state:
α : Type u_1
M : Type u_2
inst✝¹ : Zero M
inst✝ : DecidableEq α
l : AList fun _x => M
a : α
m : M
⊢ lookupFinsupp (insert a m l) = Finsupp.update (lookupFinsupp l) a m

Next tactic:
ext b
@[simp]
theorem insert_lookupFinsupp [DecidableEq α] (l : AList fun _x : α => M) (a : α) (m : M) :
    (l.insert a m).lookupFinsupp = l.lookupFinsupp.update a m := by
  ext b
  

Proof state:
case h
α : Type u_1
M : Type u_2
inst✝¹ : Zero M
inst✝ : DecidableEq α
l : AList fun _x => M
a : α
m : M
b : α
⊢ (lookupFinsupp (insert a m l)) b = (Finsupp.update (lookupFinsupp l) a m) b

Next tactic:
by_cases h : b = a
@[simp]
theorem insert_lookupFinsupp [DecidableEq α] (l : AList fun _x : α => M) (a : α) (m : M) :
    (l.insert a m).lookupFinsupp = l.lookupFinsupp.update a m := by
  ext b
  by_cases h : b = a <;> 

Proof state:
case pos
α : Type u_1
M : Type u_2
inst✝¹ : Zero M
inst✝ : DecidableEq α
l : AList fun _x => M
a : α
m : M
b : α
h : b = a
⊢ (lookupFinsupp (insert a m l)) b = (Finsupp.update (lookupFinsupp l) a m) b

Next tactic:
simp [h]
@[simp]
theorem insert_lookupFinsupp [DecidableEq α] (l : AList fun _x : α => M) (a : α) (m : M) :
    (l.insert a m).lookupFinsupp = l.lookupFinsupp.update a m := by
  ext b
  by_cases h : b = a <;> 

Proof state:
case neg
α : Type u_1
M : Type u_2
inst✝¹ : Zero M
inst✝ : DecidableEq α
l : AList fun _x => M
a : α
m : M
b : α
h : ¬b = a
⊢ (lookupFinsupp (insert a m l)) b = (Finsupp.update (lookupFinsupp l) a m) b

Next tactic:
simp [h]
@[simp]
theorem singleton_lookupFinsupp (a : α) (m : M) :
    (singleton a m).lookupFinsupp = Finsupp.single a m := by
  

Proof state:
α : Type u_1
M : Type u_2
inst✝ : Zero M
a : α
m : M
⊢ lookupFinsupp (singleton a m) = fun₀ | a => m

Next tactic:
classical
  -- porting note: was `simp [← AList.insert_empty]` but timeout issues
  simp only [← AList.insert_empty, insert_lookupFinsupp, empty_lookupFinsupp, Finsupp.zero_update]
@[simp]
theorem singleton_lookupFinsupp (a : α) (m : M) :
    (singleton a m).lookupFinsupp = Finsupp.single a m := by
  classical
  -- porting note: was `simp [← AList.insert_empty]` but timeout issues
  

Proof state:
α : Type u_1
M : Type u_2
inst✝ : Zero M
a : α
m : M
⊢ lookupFinsupp (singleton a m) = fun₀ | a => m

Next tactic:
simp only [← AList.insert_empty, insert_lookupFinsupp, empty_lookupFinsupp, Finsupp.zero_update]
@[simp]
theorem _root_.Finsupp.toAList_lookupFinsupp (f : α →₀ M) : f.toAList.lookupFinsupp = f := by
  

Proof state:
α : Type u_1
M : Type u_2
inst✝ : Zero M
f : α →₀ M
⊢ lookupFinsupp (Finsupp.toAList f) = f

Next tactic:
ext a
@[simp]
theorem _root_.Finsupp.toAList_lookupFinsupp (f : α →₀ M) : f.toAList.lookupFinsupp = f := by
  ext a
  

Proof state:
case h
α : Type u_1
M : Type u_2
inst✝ : Zero M
f : α →₀ M
a : α
⊢ (lookupFinsupp (Finsupp.toAList f)) a = f a

Next tactic:
classical
    by_cases h : f a = 0
    · suffices f.toAList.lookup a = none by simp [h, this]
      · simp [lookup_eq_none, h]
    · suffices f.toAList.lookup a = some (f a) by simp [h, this]
      · apply mem_lookup_iff.2
        simpa using h
@[simp]
theorem _root_.Finsupp.toAList_lookupFinsupp (f : α →₀ M) : f.toAList.lookupFinsupp = f := by
  ext a
  classical
    

Proof state:
case h
α : Type u_1
M : Type u_2
inst✝ : Zero M
f : α →₀ M
a : α
⊢ (lookupFinsupp (Finsupp.toAList f)) a = f a

Next tactic:
by_cases h : f a = 0
@[simp]
theorem _root_.Finsupp.toAList_lookupFinsupp (f : α →₀ M) : f.toAList.lookupFinsupp = f := by
  ext a
  classical
    by_cases h : f a = 0
    · 

Proof state:
case pos
α : Type u_1
M : Type u_2
inst✝ : Zero M
f : α →₀ M
a : α
h : f a = 0
⊢ (lookupFinsupp (Finsupp.toAList f)) a = f a

Next tactic:
suffices f.toAList.lookup a = none by simp [h, this]
@[simp]
theorem _root_.Finsupp.toAList_lookupFinsupp (f : α →₀ M) : f.toAList.lookupFinsupp = f := by
  ext a
  classical
    by_cases h : f a = 0
    · suffices f.toAList.lookup a = none by 

Proof state:
α : Type u_1
M : Type u_2
inst✝ : Zero M
f : α →₀ M
a : α
h : f a = 0
this : lookup a (Finsupp.toAList f) = none
⊢ (lookupFinsupp (Finsupp.toAList f)) a = f a

Next tactic:
simp [h, this]
@[simp]
theorem _root_.Finsupp.toAList_lookupFinsupp (f : α →₀ M) : f.toAList.lookupFinsupp = f := by
  ext a
  classical
    by_cases h : f a = 0
    · suffices f.toAList.lookup a = none by simp [h, this]
      · 

Proof state:
case pos
α : Type u_1
M : Type u_2
inst✝ : Zero M
f : α →₀ M
a : α
h : f a = 0
⊢ lookup a (Finsupp.toAList f) = none

Next tactic:
simp [lookup_eq_none, h]
@[simp]
theorem _root_.Finsupp.toAList_lookupFinsupp (f : α →₀ M) : f.toAList.lookupFinsupp = f := by
  ext a
  classical
    by_cases h : f a = 0
    · suffices f.toAList.lookup a = none by simp [h, this]
      · simp [lookup_eq_none, h]
    · 

Proof state:
case neg
α : Type u_1
M : Type u_2
inst✝ : Zero M
f : α →₀ M
a : α
h : ¬f a = 0
⊢ (lookupFinsupp (Finsupp.toAList f)) a = f a

Next tactic:
suffices f.toAList.lookup a = some (f a) by simp [h, this]
@[simp]
theorem _root_.Finsupp.toAList_lookupFinsupp (f : α →₀ M) : f.toAList.lookupFinsupp = f := by
  ext a
  classical
    by_cases h : f a = 0
    · suffices f.toAList.lookup a = none by simp [h, this]
      · simp [lookup_eq_none, h]
    · suffices f.toAList.lookup a = some (f a) by 

Proof state:
α : Type u_1
M : Type u_2
inst✝ : Zero M
f : α →₀ M
a : α
h : ¬f a = 0
this : lookup a (Finsupp.toAList f) = some (f a)
⊢ (lookupFinsupp (Finsupp.toAList f)) a = f a

Next tactic:
simp [h, this]
@[simp]
theorem _root_.Finsupp.toAList_lookupFinsupp (f : α →₀ M) : f.toAList.lookupFinsupp = f := by
  ext a
  classical
    by_cases h : f a = 0
    · suffices f.toAList.lookup a = none by simp [h, this]
      · simp [lookup_eq_none, h]
    · suffices f.toAList.lookup a = some (f a) by simp [h, this]
      · 

Proof state:
case neg
α : Type u_1
M : Type u_2
inst✝ : Zero M
f : α →₀ M
a : α
h : ¬f a = 0
⊢ lookup a (Finsupp.toAList f) = some (f a)

Next tactic:
apply mem_lookup_iff.2
@[simp]
theorem _root_.Finsupp.toAList_lookupFinsupp (f : α →₀ M) : f.toAList.lookupFinsupp = f := by
  ext a
  classical
    by_cases h : f a = 0
    · suffices f.toAList.lookup a = none by simp [h, this]
      · simp [lookup_eq_none, h]
    · suffices f.toAList.lookup a = some (f a) by simp [h, this]
      · apply mem_lookup_iff.2
        

Proof state:
case neg
α : Type u_1
M : Type u_2
inst✝ : Zero M
f : α →₀ M
a : α
h : ¬f a = 0
⊢ { fst := a, snd := f a } ∈ (Finsupp.toAList f).entries

Next tactic:
simpa using h
/-- The inclusion of `R_hat` in `K_hat` as a homomorphism of additive monoids. -/
@[simps]
def Coe.addMonoidHom : AddMonoidHom (R_hat R K) (K_hat R K) where
  toFun := (↑)
  map_zero' := rfl
  map_add' x y := by
    -- Porting note: was `ext v`
    

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v : HeightOneSpectrum R
x y : R_hat R K
⊢ ZeroHom.toFun { toFun := fun x v => ↑(x v), map_zero' := (_ : (fun x v => ↑(x v)) 0 = (fun x v => ↑(x v)) 0) }
      (x + y) =
    ZeroHom.toFun { toFun := fun x v => ↑(x v), map_zero' := (_ : (fun x v => ↑(x v)) 0 = (fun x v => ↑(x v)) 0) } x +
      ZeroHom.toFun { toFun := fun x v => ↑(x v), map_zero' := (_ : (fun x v => ↑(x v)) 0 = (fun x v => ↑(x v)) 0) } y

Next tactic:
refine funext fun v => ?_
/-- The inclusion of `R_hat` in `K_hat` as a homomorphism of additive monoids. -/
@[simps]
def Coe.addMonoidHom : AddMonoidHom (R_hat R K) (K_hat R K) where
  toFun := (↑)
  map_zero' := rfl
  map_add' x y := by
    -- Porting note: was `ext v`
    refine funext fun v => ?_
    

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v✝ : HeightOneSpectrum R
x y : R_hat R K
v : HeightOneSpectrum R
⊢ ZeroHom.toFun { toFun := fun x v => ↑(x v), map_zero' := (_ : (fun x v => ↑(x v)) 0 = (fun x v => ↑(x v)) 0) } (x + y)
      v =
    (ZeroHom.toFun { toFun := fun x v => ↑(x v), map_zero' := (_ : (fun x v => ↑(x v)) 0 = (fun x v => ↑(x v)) 0) } x +
        ZeroHom.toFun { toFun := fun x v => ↑(x v), map_zero' := (_ : (fun x v => ↑(x v)) 0 = (fun x v => ↑(x v)) 0) }
          y)
      v

Next tactic:
simp only [coe_apply, Pi.add_apply, Subring.coe_add]
/-- The inclusion of `R_hat` in `K_hat` as a homomorphism of additive monoids. -/
@[simps]
def Coe.addMonoidHom : AddMonoidHom (R_hat R K) (K_hat R K) where
  toFun := (↑)
  map_zero' := rfl
  map_add' x y := by
    -- Porting note: was `ext v`
    refine funext fun v => ?_
    simp only [coe_apply, Pi.add_apply, Subring.coe_add]
    -- Porting note: added
    

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v✝ : HeightOneSpectrum R
x y : R_hat R K
v : HeightOneSpectrum R
⊢ ↑((x + y) v) = ((fun v => ↑(x v)) + fun v => ↑(y v)) v

Next tactic:
erw [Pi.add_apply, Pi.add_apply, Subring.coe_add]
/-- The inclusion of `R_hat` in `K_hat` as a ring homomorphism. -/
@[simps]
def Coe.ringHom : RingHom (R_hat R K) (K_hat R K) :=
  { Coe.addMonoidHom R K with
    toFun := (↑)
    map_one' := rfl
    map_mul' := fun x y => by
      -- Porting note: was `ext p`
      

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v : HeightOneSpectrum R
src✝ : R_hat R K →+ K_hat R K := addMonoidHom R K
x y : R_hat R K
⊢ OneHom.toFun { toFun := fun x v => ↑(x v), map_one' := (_ : (fun x v => ↑(x v)) 1 = (fun x v => ↑(x v)) 1) } (x * y) =
    OneHom.toFun { toFun := fun x v => ↑(x v), map_one' := (_ : (fun x v => ↑(x v)) 1 = (fun x v => ↑(x v)) 1) } x *
      OneHom.toFun { toFun := fun x v => ↑(x v), map_one' := (_ : (fun x v => ↑(x v)) 1 = (fun x v => ↑(x v)) 1) } y

Next tactic:
refine funext fun p => ?_
/-- The inclusion of `R_hat` in `K_hat` as a ring homomorphism. -/
@[simps]
def Coe.ringHom : RingHom (R_hat R K) (K_hat R K) :=
  { Coe.addMonoidHom R K with
    toFun := (↑)
    map_one' := rfl
    map_mul' := fun x y => by
      -- Porting note: was `ext p`
      refine funext fun p => ?_
      

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v : HeightOneSpectrum R
src✝ : R_hat R K →+ K_hat R K := addMonoidHom R K
x y : R_hat R K
p : HeightOneSpectrum R
⊢ OneHom.toFun { toFun := fun x v => ↑(x v), map_one' := (_ : (fun x v => ↑(x v)) 1 = (fun x v => ↑(x v)) 1) } (x * y)
      p =
    (OneHom.toFun { toFun := fun x v => ↑(x v), map_one' := (_ : (fun x v => ↑(x v)) 1 = (fun x v => ↑(x v)) 1) } x *
        OneHom.toFun { toFun := fun x v => ↑(x v), map_one' := (_ : (fun x v => ↑(x v)) 1 = (fun x v => ↑(x v)) 1) } y)
      p

Next tactic:
simp only [Pi.mul_apply, Subring.coe_mul]
/-- The inclusion of `R_hat` in `K_hat` as a ring homomorphism. -/
@[simps]
def Coe.ringHom : RingHom (R_hat R K) (K_hat R K) :=
  { Coe.addMonoidHom R K with
    toFun := (↑)
    map_one' := rfl
    map_mul' := fun x y => by
      -- Porting note: was `ext p`
      refine funext fun p => ?_
      simp only [Pi.mul_apply, Subring.coe_mul]
      -- Porting note: added
      

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v : HeightOneSpectrum R
src✝ : R_hat R K →+ K_hat R K := addMonoidHom R K
x y : R_hat R K
p : HeightOneSpectrum R
⊢ ↑((x * y) p) = ((fun v => ↑(x v)) * fun v => ↑(y v)) p

Next tactic:
erw [Pi.mul_apply, Pi.mul_apply, Subring.coe_mul]
instance : Algebra K (K_hat R K) :=
  (by 

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v : HeightOneSpectrum R
⊢ Algebra K ((v : HeightOneSpectrum R) → HeightOneSpectrum.adicCompletion K v)

Next tactic:
infer_instance
instance ProdAdicCompletions.algebra' : Algebra R (K_hat R K) :=
  (by 

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v : HeightOneSpectrum R
⊢ Algebra R ((v : HeightOneSpectrum R) → HeightOneSpectrum.adicCompletion K v)

Next tactic:
infer_instance
instance : IsScalarTower R K (K_hat R K) :=
  (by 

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v : HeightOneSpectrum R
⊢ IsScalarTower R K ((v : HeightOneSpectrum R) → HeightOneSpectrum.adicCompletion K v)

Next tactic:
infer_instance
instance : Algebra R (R_hat R K) :=
  (by 

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v : HeightOneSpectrum R
⊢ Algebra R ((v : HeightOneSpectrum R) → ↥(adicCompletionIntegers K v))

Next tactic:
infer_instance
instance ProdAdicCompletions.isScalarTower_completions : IsScalarTower R (R_hat R K) (K_hat R K) :=
  (by 

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v : HeightOneSpectrum R
⊢ IsScalarTower R ((v : HeightOneSpectrum R) → ↥(adicCompletionIntegers K v))
    ((v : HeightOneSpectrum R) → HeightOneSpectrum.adicCompletion K v)

Next tactic:
infer_instance
/-- The sum of two finite adèles is a finite adèle. -/
theorem add {x y : K_hat R K} (hx : x.IsFiniteAdele) (hy : y.IsFiniteAdele) :
    (x + y).IsFiniteAdele := by
  

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v : HeightOneSpectrum R
x y : K_hat R K
hx : IsFiniteAdele x
hy : IsFiniteAdele y
⊢ IsFiniteAdele (x + y)

Next tactic:
rw [IsFiniteAdele, Filter.eventually_cofinite] at hx hy ⊢
/-- The sum of two finite adèles is a finite adèle. -/
theorem add {x y : K_hat R K} (hx : x.IsFiniteAdele) (hy : y.IsFiniteAdele) :
    (x + y).IsFiniteAdele := by
  rw [IsFiniteAdele, Filter.eventually_cofinite] at hx hy ⊢
  

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v : HeightOneSpectrum R
x y : K_hat R K
hx : Set.Finite {x_1 | x x_1 ∉ adicCompletionIntegers K x_1}
hy : Set.Finite {x | y x ∉ adicCompletionIntegers K x}
⊢ Set.Finite {x_1 | (x + y) x_1 ∉ adicCompletionIntegers K x_1}

Next tactic:
have h_subset :
    {v : HeightOneSpectrum R | ¬(x + y) v ∈ v.adicCompletionIntegers K} ⊆
      {v : HeightOneSpectrum R | ¬x v ∈ v.adicCompletionIntegers K} ∪
        {v : HeightOneSpectrum R | ¬y v ∈ v.adicCompletionIntegers K} := by
    intro v hv
    rw [mem_union, mem_setOf, mem_setOf]
    rw [mem_setOf] at hv
    contrapose! hv
    rw [mem_adicCompletionIntegers, mem_adicCompletionIntegers, ← max_le_iff] at hv
    rw [mem_adicCompletionIntegers, Pi.add_apply]
    exact le_trans (Valued.v.map_add_le_max' (x v) (y v)) hv
/-- The sum of two finite adèles is a finite adèle. -/
theorem add {x y : K_hat R K} (hx : x.IsFiniteAdele) (hy : y.IsFiniteAdele) :
    (x + y).IsFiniteAdele := by
  rw [IsFiniteAdele, Filter.eventually_cofinite] at hx hy ⊢
  have h_subset :
    {v : HeightOneSpectrum R | ¬(x + y) v ∈ v.adicCompletionIntegers K} ⊆
      {v : HeightOneSpectrum R | ¬x v ∈ v.adicCompletionIntegers K} ∪
        {v : HeightOneSpectrum R | ¬y v ∈ v.adicCompletionIntegers K} := by
    

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v : HeightOneSpectrum R
x y : K_hat R K
hx : Set.Finite {x_1 | x x_1 ∉ adicCompletionIntegers K x_1}
hy : Set.Finite {x | y x ∉ adicCompletionIntegers K x}
⊢ {v | (x + y) v ∉ adicCompletionIntegers K v} ⊆
    {v | x v ∉ adicCompletionIntegers K v} ∪ {v | y v ∉ adicCompletionIntegers K v}

Next tactic:
intro v hv
/-- The sum of two finite adèles is a finite adèle. -/
theorem add {x y : K_hat R K} (hx : x.IsFiniteAdele) (hy : y.IsFiniteAdele) :
    (x + y).IsFiniteAdele := by
  rw [IsFiniteAdele, Filter.eventually_cofinite] at hx hy ⊢
  have h_subset :
    {v : HeightOneSpectrum R | ¬(x + y) v ∈ v.adicCompletionIntegers K} ⊆
      {v : HeightOneSpectrum R | ¬x v ∈ v.adicCompletionIntegers K} ∪
        {v : HeightOneSpectrum R | ¬y v ∈ v.adicCompletionIntegers K} := by
    intro v hv
    

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v✝ : HeightOneSpectrum R
x y : K_hat R K
hx : Set.Finite {x_1 | x x_1 ∉ adicCompletionIntegers K x_1}
hy : Set.Finite {x | y x ∉ adicCompletionIntegers K x}
v : HeightOneSpectrum R
hv : v ∈ {v | (x + y) v ∉ adicCompletionIntegers K v}
⊢ v ∈ {v | x v ∉ adicCompletionIntegers K v} ∪ {v | y v ∉ adicCompletionIntegers K v}

Next tactic:
rw [mem_union, mem_setOf, mem_setOf]
/-- The sum of two finite adèles is a finite adèle. -/
theorem add {x y : K_hat R K} (hx : x.IsFiniteAdele) (hy : y.IsFiniteAdele) :
    (x + y).IsFiniteAdele := by
  rw [IsFiniteAdele, Filter.eventually_cofinite] at hx hy ⊢
  have h_subset :
    {v : HeightOneSpectrum R | ¬(x + y) v ∈ v.adicCompletionIntegers K} ⊆
      {v : HeightOneSpectrum R | ¬x v ∈ v.adicCompletionIntegers K} ∪
        {v : HeightOneSpectrum R | ¬y v ∈ v.adicCompletionIntegers K} := by
    intro v hv
    rw [mem_union, mem_setOf, mem_setOf]
    

Proof state:
R : Type u_1
K : Type u_2
inst✝⁵ : CommRing R
inst✝⁴ : IsDomain R
inst✝³ : IsDedekindDomain R
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
v✝ : HeightOneSpectrum R
x y : K_hat R K
hx : Set.Finite {x_1 | x x_1 ∉ adicCompletionIntegers K x_1}
hy : Set.Finite {x | y x ∉ adicCompletionIntegers K x}
v : HeightOneSpectrum R
hv : v ∈ {v | (x + y) v ∉ adicCompletionIntegers K v}
⊢ x v ∉ adicCompletionIntegers K v ∨ y v ∉ adicCompletionIntegers K v

Next tactic:
rw [mem_setOf] at hv