l3lab/ntp-mathlib huggingface dataset:
theorem monotone_iff_map_nonneg : Monotone (f : α → β) ↔ ∀ a, 0 ≤ a → 0 ≤ f a :=
  ⟨fun h a => by
    rw [← map_zero f]
    apply h, fun h a b hl => by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝² : OrderedAddCommGroup α
inst✝¹ : OrderedAddCommMonoid β
inst✝ : AddMonoidHomClass F α β
f : F
h : ∀ (a : α), 0 ≤ a → 0 ≤ f a
a b : α
hl : a ≤ b
⊢ f a ≤ f b

Next tactic:
rw [← sub_add_cancel b a, map_add f]
theorem monotone_iff_map_nonneg : Monotone (f : α → β) ↔ ∀ a, 0 ≤ a → 0 ≤ f a :=
  ⟨fun h a => by
    rw [← map_zero f]
    apply h, fun h a b hl => by
    rw [← sub_add_cancel b a, map_add f]
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝² : OrderedAddCommGroup α
inst✝¹ : OrderedAddCommMonoid β
inst✝ : AddMonoidHomClass F α β
f : F
h : ∀ (a : α), 0 ≤ a → 0 ≤ f a
a b : α
hl : a ≤ b
⊢ f a ≤ f (b - a) + f a

Next tactic:
exact le_add_of_nonneg_left (h _ <| sub_nonneg.2 hl)
theorem strictMono_iff_map_pos : StrictMono (f : α → β) ↔ ∀ a, 0 < a → 0 < f a := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : OrderedAddCommGroup α
inst✝² : OrderedAddCommMonoid β
inst✝¹ : AddMonoidHomClass F α β
f : F
inst✝ : CovariantClass β β (fun x x_1 => x + x_1) fun x x_1 => x < x_1
⊢ StrictMono ⇑f ↔ ∀ (a : α), 0 < a → 0 < f a

Next tactic:
refine ⟨fun h a => ?_, fun h a b hl => ?_⟩
theorem strictMono_iff_map_pos : StrictMono (f : α → β) ↔ ∀ a, 0 < a → 0 < f a := by
  refine ⟨fun h a => ?_, fun h a b hl => ?_⟩
  · 

Proof state:
case refine_1
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : OrderedAddCommGroup α
inst✝² : OrderedAddCommMonoid β
inst✝¹ : AddMonoidHomClass F α β
f : F
inst✝ : CovariantClass β β (fun x x_1 => x + x_1) fun x x_1 => x < x_1
h : StrictMono ⇑f
a : α
⊢ 0 < a → 0 < f a

Next tactic:
rw [← map_zero f]
theorem strictMono_iff_map_pos : StrictMono (f : α → β) ↔ ∀ a, 0 < a → 0 < f a := by
  refine ⟨fun h a => ?_, fun h a b hl => ?_⟩
  · rw [← map_zero f]
    

Proof state:
case refine_1
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : OrderedAddCommGroup α
inst✝² : OrderedAddCommMonoid β
inst✝¹ : AddMonoidHomClass F α β
f : F
inst✝ : CovariantClass β β (fun x x_1 => x + x_1) fun x x_1 => x < x_1
h : StrictMono ⇑f
a : α
⊢ 0 < a → f 0 < f a

Next tactic:
apply h
theorem strictMono_iff_map_pos : StrictMono (f : α → β) ↔ ∀ a, 0 < a → 0 < f a := by
  refine ⟨fun h a => ?_, fun h a b hl => ?_⟩
  · rw [← map_zero f]
    apply h
  · 

Proof state:
case refine_2
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : OrderedAddCommGroup α
inst✝² : OrderedAddCommMonoid β
inst✝¹ : AddMonoidHomClass F α β
f : F
inst✝ : CovariantClass β β (fun x x_1 => x + x_1) fun x x_1 => x < x_1
h : ∀ (a : α), 0 < a → 0 < f a
a b : α
hl : a < b
⊢ f a < f b

Next tactic:
rw [← sub_add_cancel b a, map_add f]
theorem strictMono_iff_map_pos : StrictMono (f : α → β) ↔ ∀ a, 0 < a → 0 < f a := by
  refine ⟨fun h a => ?_, fun h a b hl => ?_⟩
  · rw [← map_zero f]
    apply h
  · rw [← sub_add_cancel b a, map_add f]
    

Proof state:
case refine_2
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : OrderedAddCommGroup α
inst✝² : OrderedAddCommMonoid β
inst✝¹ : AddMonoidHomClass F α β
f : F
inst✝ : CovariantClass β β (fun x x_1 => x + x_1) fun x x_1 => x < x_1
h : ∀ (a : α), 0 < a → 0 < f a
a b : α
hl : a < b
⊢ f a < f (b - a) + f a

Next tactic:
exact lt_add_of_pos_left _ (h _ <| sub_pos.2 hl)
@[to_additive]
 instance : OrderMonoidHomClass (α →*o β) α β where
  coe f := f.toFun
  coe_injective' f g h := by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulOneClass α
inst✝² : MulOneClass β
inst✝¹ : MulOneClass γ
inst✝ : MulOneClass δ
f✝ g✝ f g : α →*o β
h : (fun f => f.toFun) f = (fun f => f.toFun) g
⊢ f = g

Next tactic:
obtain ⟨⟨⟨_, _⟩⟩, _⟩ := f
@[to_additive]
 instance : OrderMonoidHomClass (α →*o β) α β where
  coe f := f.toFun
  coe_injective' f g h := by
    obtain ⟨⟨⟨_, _⟩⟩, _⟩ := f
    

Proof state:
case mk.mk.mk
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulOneClass α
inst✝² : MulOneClass β
inst✝¹ : MulOneClass γ
inst✝ : MulOneClass δ
f g✝ g : α →*o β
toFun✝ : α → β
map_one'✝ : toFun✝ 1 = 1
map_mul'✝ :
  ∀ (x y : α),
    OneHom.toFun { toFun := toFun✝, map_one' := map_one'✝ } (x * y) =
      OneHom.toFun { toFun := toFun✝, map_one' := map_one'✝ } x *
        OneHom.toFun { toFun := toFun✝, map_one' := map_one'✝ } y
monotone'✝ : Monotone (↑{ toOneHom := { toFun := toFun✝, map_one' := map_one'✝ }, map_mul' := map_mul'✝ }).toFun
h :
  (fun f => f.toFun)
      { toMonoidHom := { toOneHom := { toFun := toFun✝, map_one' := map_one'✝ }, map_mul' := map_mul'✝ },
        monotone' := monotone'✝ } =
    (fun f => f.toFun) g
⊢ { toMonoidHom := { toOneHom := { toFun := toFun✝, map_one' := map_one'✝ }, map_mul' := map_mul'✝ },
      monotone' := monotone'✝ } =
    g

Next tactic:
obtain ⟨⟨⟨_, _⟩⟩, _⟩ := g
@[to_additive]
 instance : OrderMonoidHomClass (α →*o β) α β where
  coe f := f.toFun
  coe_injective' f g h := by
    obtain ⟨⟨⟨_, _⟩⟩, _⟩ := f
    obtain ⟨⟨⟨_, _⟩⟩, _⟩ := g
    

Proof state:
case mk.mk.mk.mk.mk.mk
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulOneClass α
inst✝² : MulOneClass β
inst✝¹ : MulOneClass γ
inst✝ : MulOneClass δ
f g : α →*o β
toFun✝¹ : α → β
map_one'✝¹ : toFun✝¹ 1 = 1
map_mul'✝¹ :
  ∀ (x y : α),
    OneHom.toFun { toFun := toFun✝¹, map_one' := map_one'✝¹ } (x * y) =
      OneHom.toFun { toFun := toFun✝¹, map_one' := map_one'✝¹ } x *
        OneHom.toFun { toFun := toFun✝¹, map_one' := map_one'✝¹ } y
monotone'✝¹ : Monotone (↑{ toOneHom := { toFun := toFun✝¹, map_one' := map_one'✝¹ }, map_mul' := map_mul'✝¹ }).toFun
toFun✝ : α → β
map_one'✝ : toFun✝ 1 = 1
map_mul'✝ :
  ∀ (x y : α),
    OneHom.toFun { toFun := toFun✝, map_one' := map_one'✝ } (x * y) =
      OneHom.toFun { toFun := toFun✝, map_one' := map_one'✝ } x *
        OneHom.toFun { toFun := toFun✝, map_one' := map_one'✝ } y
monotone'✝ : Monotone (↑{ toOneHom := { toFun := toFun✝, map_one' := map_one'✝ }, map_mul' := map_mul'✝ }).toFun
h :
  (fun f => f.toFun)
      { toMonoidHom := { toOneHom := { toFun := toFun✝¹, map_one' := map_one'✝¹ }, map_mul' := map_mul'✝¹ },
        monotone' := monotone'✝¹ } =
    (fun f => f.toFun)
      { toMonoidHom := { toOneHom := { toFun := toFun✝, map_one' := map_one'✝ }, map_mul' := map_mul'✝ },
        monotone' := monotone'✝ }
⊢ { toMonoidHom := { toOneHom := { toFun := toFun✝¹, map_one' := map_one'✝¹ }, map_mul' := map_mul'✝¹ },
      monotone' := monotone'✝¹ } =
    { toMonoidHom := { toOneHom := { toFun := toFun✝, map_one' := map_one'✝ }, map_mul' := map_mul'✝ },
      monotone' := monotone'✝ }

Next tactic:
congr
@[to_additive (attr := simp)]
theorem mk_coe (f : α →*o β) (h) : OrderMonoidHom.mk (f : α →* β) h = f := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulOneClass α
inst✝² : MulOneClass β
inst✝¹ : MulOneClass γ
inst✝ : MulOneClass δ
f✝ g f : α →*o β
h : Monotone (↑↑f).toFun
⊢ { toMonoidHom := ↑f, monotone' := h } = f

Next tactic:
ext
@[to_additive (attr := simp)]
theorem mk_coe (f : α →*o β) (h) : OrderMonoidHom.mk (f : α →* β) h = f := by
  ext
  

Proof state:
case h
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulOneClass α
inst✝² : MulOneClass β
inst✝¹ : MulOneClass γ
inst✝ : MulOneClass δ
f✝ g f : α →*o β
h : Monotone (↑↑f).toFun
a✝ : α
⊢ { toMonoidHom := ↑f, monotone' := h } a✝ = f a✝

Next tactic:
rfl
@[to_additive]
theorem toMonoidHom_injective : Injective (toMonoidHom : _ → α →* β) := fun f g h =>
  ext <| by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulOneClass α
inst✝² : MulOneClass β
inst✝¹ : MulOneClass γ
inst✝ : MulOneClass δ
f✝ g✝ f g : α →*o β
h : f.toMonoidHom = g.toMonoidHom
⊢ ∀ (a : α), f a = g a

Next tactic:
convert FunLike.ext_iff.1 h using 0
@[to_additive]
theorem toOrderHom_injective : Injective (toOrderHom : _ → α →o β) := fun f g h =>
  ext <| by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulOneClass α
inst✝² : MulOneClass β
inst✝¹ : MulOneClass γ
inst✝ : MulOneClass δ
f✝ g✝ f g : α →*o β
h : toOrderHom f = toOrderHom g
⊢ ∀ (a : α), f a = g a

Next tactic:
convert FunLike.ext_iff.1 h using 0
@[to_additive (attr := simp)]
theorem cancel_right {g₁ g₂ : β →*o γ} {f : α →*o β} (hf : Function.Surjective f) :
    g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
  ⟨fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun _ => by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulOneClass α
inst✝² : MulOneClass β
inst✝¹ : MulOneClass γ
inst✝ : MulOneClass δ
f✝ g : α →*o β
g₁ g₂ : β →*o γ
f : α →*o β
hf : Surjective ⇑f
x✝ : g₁ = g₂
⊢ comp g₁ f = comp g₂ f

Next tactic:
congr
@[to_additive (attr := simp)]
theorem cancel_left {g : β →*o γ} {f₁ f₂ : α →*o β} (hg : Function.Injective g) :
    g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
  ⟨fun h => ext fun a => hg <| by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulOneClass α
inst✝² : MulOneClass β
inst✝¹ : MulOneClass γ
inst✝ : MulOneClass δ
f g✝ : α →*o β
g : β →*o γ
f₁ f₂ : α →*o β
hg : Injective ⇑g
h : comp g f₁ = comp g f₂
a : α
⊢ g (f₁ a) = g (f₂ a)

Next tactic:
rw [← comp_apply, h, comp_apply]
instance : OrderMonoidWithZeroHomClass (α →*₀o β) α β where
  coe f := f.toFun
  coe_injective' f g h := by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulZeroOneClass α
inst✝² : MulZeroOneClass β
inst✝¹ : MulZeroOneClass γ
inst✝ : MulZeroOneClass δ
f✝ g✝ f g : α →*₀o β
h : (fun f => f.toFun) f = (fun f => f.toFun) g
⊢ f = g

Next tactic:
obtain ⟨⟨⟨_, _⟩⟩, _⟩ := f
instance : OrderMonoidWithZeroHomClass (α →*₀o β) α β where
  coe f := f.toFun
  coe_injective' f g h := by
    obtain ⟨⟨⟨_, _⟩⟩, _⟩ := f
    

Proof state:
case mk.mk.mk
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulZeroOneClass α
inst✝² : MulZeroOneClass β
inst✝¹ : MulZeroOneClass γ
inst✝ : MulZeroOneClass δ
f g✝ g : α →*₀o β
toFun✝ : α → β
map_zero'✝ : toFun✝ 0 = 0
map_one'✝ : ZeroHom.toFun { toFun := toFun✝, map_zero' := map_zero'✝ } 1 = 1
map_mul'✝ :
  ∀ (x y : α),
    ZeroHom.toFun { toFun := toFun✝, map_zero' := map_zero'✝ } (x * y) =
      ZeroHom.toFun { toFun := toFun✝, map_zero' := map_zero'✝ } x *
        ZeroHom.toFun { toFun := toFun✝, map_zero' := map_zero'✝ } y
monotone'✝ :
  Monotone
    (↑{ toZeroHom := { toFun := toFun✝, map_zero' := map_zero'✝ }, map_one' := map_one'✝, map_mul' := map_mul'✝ }).toFun
h :
  (fun f => f.toFun)
      {
        toMonoidWithZeroHom :=
          { toZeroHom := { toFun := toFun✝, map_zero' := map_zero'✝ }, map_one' := map_one'✝, map_mul' := map_mul'✝ },
        monotone' := monotone'✝ } =
    (fun f => f.toFun) g
⊢ {
      toMonoidWithZeroHom :=
        { toZeroHom := { toFun := toFun✝, map_zero' := map_zero'✝ }, map_one' := map_one'✝, map_mul' := map_mul'✝ },
      monotone' := monotone'✝ } =
    g

Next tactic:
obtain ⟨⟨⟨_, _⟩⟩, _⟩ := g
instance : OrderMonoidWithZeroHomClass (α →*₀o β) α β where
  coe f := f.toFun
  coe_injective' f g h := by
    obtain ⟨⟨⟨_, _⟩⟩, _⟩ := f
    obtain ⟨⟨⟨_, _⟩⟩, _⟩ := g
    

Proof state:
case mk.mk.mk.mk.mk.mk
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulZeroOneClass α
inst✝² : MulZeroOneClass β
inst✝¹ : MulZeroOneClass γ
inst✝ : MulZeroOneClass δ
f g : α →*₀o β
toFun✝¹ : α → β
map_zero'✝¹ : toFun✝¹ 0 = 0
map_one'✝¹ : ZeroHom.toFun { toFun := toFun✝¹, map_zero' := map_zero'✝¹ } 1 = 1
map_mul'✝¹ :
  ∀ (x y : α),
    ZeroHom.toFun { toFun := toFun✝¹, map_zero' := map_zero'✝¹ } (x * y) =
      ZeroHom.toFun { toFun := toFun✝¹, map_zero' := map_zero'✝¹ } x *
        ZeroHom.toFun { toFun := toFun✝¹, map_zero' := map_zero'✝¹ } y
monotone'✝¹ :
  Monotone
    (↑{ toZeroHom := { toFun := toFun✝¹, map_zero' := map_zero'✝¹ }, map_one' := map_one'✝¹,
          map_mul' := map_mul'✝¹ }).toFun
toFun✝ : α → β
map_zero'✝ : toFun✝ 0 = 0
map_one'✝ : ZeroHom.toFun { toFun := toFun✝, map_zero' := map_zero'✝ } 1 = 1
map_mul'✝ :
  ∀ (x y : α),
    ZeroHom.toFun { toFun := toFun✝, map_zero' := map_zero'✝ } (x * y) =
      ZeroHom.toFun { toFun := toFun✝, map_zero' := map_zero'✝ } x *
        ZeroHom.toFun { toFun := toFun✝, map_zero' := map_zero'✝ } y
monotone'✝ :
  Monotone
    (↑{ toZeroHom := { toFun := toFun✝, map_zero' := map_zero'✝ }, map_one' := map_one'✝, map_mul' := map_mul'✝ }).toFun
h :
  (fun f => f.toFun)
      {
        toMonoidWithZeroHom :=
          { toZeroHom := { toFun := toFun✝¹, map_zero' := map_zero'✝¹ }, map_one' := map_one'✝¹,
            map_mul' := map_mul'✝¹ },
        monotone' := monotone'✝¹ } =
    (fun f => f.toFun)
      {
        toMonoidWithZeroHom :=
          { toZeroHom := { toFun := toFun✝, map_zero' := map_zero'✝ }, map_one' := map_one'✝, map_mul' := map_mul'✝ },
        monotone' := monotone'✝ }
⊢ {
      toMonoidWithZeroHom :=
        { toZeroHom := { toFun := toFun✝¹, map_zero' := map_zero'✝¹ }, map_one' := map_one'✝¹, map_mul' := map_mul'✝¹ },
      monotone' := monotone'✝¹ } =
    {
      toMonoidWithZeroHom :=
        { toZeroHom := { toFun := toFun✝, map_zero' := map_zero'✝ }, map_one' := map_one'✝, map_mul' := map_mul'✝ },
      monotone' := monotone'✝ }

Next tactic:
congr
theorem toOrderMonoidHom_injective : Injective (toOrderMonoidHom : _ → α →*o β) := fun f g h =>
  ext <| by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulZeroOneClass α
inst✝² : MulZeroOneClass β
inst✝¹ : MulZeroOneClass γ
inst✝ : MulZeroOneClass δ
f✝ g✝ f g : α →*₀o β
h : toOrderMonoidHom f = toOrderMonoidHom g
⊢ ∀ (a : α), f a = g a

Next tactic:
convert FunLike.ext_iff.1 h using 0
theorem toMonoidWithZeroHom_injective : Injective (toMonoidWithZeroHom : _ → α →*₀ β) :=
  fun f g h => ext <| by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulZeroOneClass α
inst✝² : MulZeroOneClass β
inst✝¹ : MulZeroOneClass γ
inst✝ : MulZeroOneClass δ
f✝ g✝ f g : α →*₀o β
h : f.toMonoidWithZeroHom = g.toMonoidWithZeroHom
⊢ ∀ (a : α), f a = g a

Next tactic:
convert FunLike.ext_iff.1 h using 0
@[simp]
theorem cancel_right {g₁ g₂ : β →*₀o γ} {f : α →*₀o β} (hf : Function.Surjective f) :
    g₁.comp f = g₂.comp f ↔ g₁ = g₂ :=
  ⟨fun h => ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun _ => by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulZeroOneClass α
inst✝² : MulZeroOneClass β
inst✝¹ : MulZeroOneClass γ
inst✝ : MulZeroOneClass δ
f✝ g : α →*₀o β
g₁ g₂ : β →*₀o γ
f : α →*₀o β
hf : Surjective ⇑f
x✝ : g₁ = g₂
⊢ comp g₁ f = comp g₂ f

Next tactic:
congr
@[simp]
theorem cancel_left {g : β →*₀o γ} {f₁ f₂ : α →*₀o β} (hg : Function.Injective g) :
    g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ :=
  ⟨fun h => ext fun a => hg <| by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝⁷ : Preorder α
inst✝⁶ : Preorder β
inst✝⁵ : Preorder γ
inst✝⁴ : Preorder δ
inst✝³ : MulZeroOneClass α
inst✝² : MulZeroOneClass β
inst✝¹ : MulZeroOneClass γ
inst✝ : MulZeroOneClass δ
f g✝ : α →*₀o β
g : β →*₀o γ
f₁ f₂ : α →*₀o β
hg : Injective ⇑g
h : comp g f₁ = comp g f₂
a : α
⊢ g (f₁ a) = g (f₂ a)

Next tactic:
rw [← comp_apply, h, comp_apply]
@[simp]
theorem toMonoidWithZeroHom_eq_coe (f : α →*₀o β) : f.toMonoidWithZeroHom = f := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
hα : Preorder α
hα' : MulZeroOneClass α
hβ : Preorder β
hβ' : MulZeroOneClass β
f : α →*₀o β
⊢ f.toMonoidWithZeroHom = ↑f

Next tactic:
rfl
/-- Create a finitely supported function from a total function by taking the default value to
zero. -/
def applyFinsupp (tf : TotalFunction α β) : α →₀ β where
  support := zeroDefaultSupp tf
  toFun := tf.zeroDefault.apply
  mem_support_toFun := by
    

Proof state:
α : Type u
β : Type v
γ : Sort w
inst✝² : Zero β
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
tf : TotalFunction α β
⊢ ∀ (a : α), a ∈ zeroDefaultSupp tf ↔ apply (zeroDefault tf) a ≠ 0

Next tactic:
intro a
/-- Create a finitely supported function from a total function by taking the default value to
zero. -/
def applyFinsupp (tf : TotalFunction α β) : α →₀ β where
  support := zeroDefaultSupp tf
  toFun := tf.zeroDefault.apply
  mem_support_toFun := by
    intro a
    

Proof state:
α : Type u
β : Type v
γ : Sort w
inst✝² : Zero β
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
tf : TotalFunction α β
a : α
⊢ a ∈ zeroDefaultSupp tf ↔ apply (zeroDefault tf) a ≠ 0

Next tactic:
rcases tf with ⟨A, y⟩
/-- Create a finitely supported function from a total function by taking the default value to
zero. -/
def applyFinsupp (tf : TotalFunction α β) : α →₀ β where
  support := zeroDefaultSupp tf
  toFun := tf.zeroDefault.apply
  mem_support_toFun := by
    intro a
    rcases tf with ⟨A, y⟩
    

Proof state:
case withDefault
α : Type u
β : Type v
γ : Sort w
inst✝² : Zero β
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
A : List ((_ : α) × β)
y : β
⊢ a ∈ zeroDefaultSupp (withDefault A y) ↔ apply (zeroDefault (withDefault A y)) a ≠ 0

Next tactic:
simp only [apply, zeroDefaultSupp, List.mem_map, List.mem_filter, exists_and_right,
      List.mem_toFinset, exists_eq_right, Sigma.exists, Ne.def, zeroDefault]
/-- Create a finitely supported function from a total function by taking the default value to
zero. -/
def applyFinsupp (tf : TotalFunction α β) : α →₀ β where
  support := zeroDefaultSupp tf
  toFun := tf.zeroDefault.apply
  mem_support_toFun := by
    intro a
    rcases tf with ⟨A, y⟩
    simp only [apply, zeroDefaultSupp, List.mem_map, List.mem_filter, exists_and_right,
      List.mem_toFinset, exists_eq_right, Sigma.exists, Ne.def, zeroDefault]
    

Proof state:
case withDefault
α : Type u
β : Type v
γ : Sort w
inst✝² : Zero β
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
A : List ((_ : α) × β)
y : β
⊢ (∃ x, { fst := a, snd := x } ∈ List.dedupKeys A ∧ (decide ¬x = 0) = true) ↔ ¬Option.getD (List.dlookup a A) 0 = 0

Next tactic:
constructor
/-- Create a finitely supported function from a total function by taking the default value to
zero. -/
def applyFinsupp (tf : TotalFunction α β) : α →₀ β where
  support := zeroDefaultSupp tf
  toFun := tf.zeroDefault.apply
  mem_support_toFun := by
    intro a
    rcases tf with ⟨A, y⟩
    simp only [apply, zeroDefaultSupp, List.mem_map, List.mem_filter, exists_and_right,
      List.mem_toFinset, exists_eq_right, Sigma.exists, Ne.def, zeroDefault]
    constructor
    · 

Proof state:
case withDefault.mp
α : Type u
β : Type v
γ : Sort w
inst✝² : Zero β
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
A : List ((_ : α) × β)
y : β
⊢ (∃ x, { fst := a, snd := x } ∈ List.dedupKeys A ∧ (decide ¬x = 0) = true) → ¬Option.getD (List.dlookup a A) 0 = 0

Next tactic:
rintro ⟨od, hval, hod⟩
/-- Create a finitely supported function from a total function by taking the default value to
zero. -/
def applyFinsupp (tf : TotalFunction α β) : α →₀ β where
  support := zeroDefaultSupp tf
  toFun := tf.zeroDefault.apply
  mem_support_toFun := by
    intro a
    rcases tf with ⟨A, y⟩
    simp only [apply, zeroDefaultSupp, List.mem_map, List.mem_filter, exists_and_right,
      List.mem_toFinset, exists_eq_right, Sigma.exists, Ne.def, zeroDefault]
    constructor
    · rintro ⟨od, hval, hod⟩
      

Proof state:
case withDefault.mp.intro.intro
α : Type u
β : Type v
γ : Sort w
inst✝² : Zero β
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
A : List ((_ : α) × β)
y od : β
hval : { fst := a, snd := od } ∈ List.dedupKeys A
hod : (decide ¬od = 0) = true
⊢ ¬Option.getD (List.dlookup a A) 0 = 0

Next tactic:
have := List.mem_dlookup (List.nodupKeys_dedupKeys A) hval
/-- Create a finitely supported function from a total function by taking the default value to
zero. -/
def applyFinsupp (tf : TotalFunction α β) : α →₀ β where
  support := zeroDefaultSupp tf
  toFun := tf.zeroDefault.apply
  mem_support_toFun := by
    intro a
    rcases tf with ⟨A, y⟩
    simp only [apply, zeroDefaultSupp, List.mem_map, List.mem_filter, exists_and_right,
      List.mem_toFinset, exists_eq_right, Sigma.exists, Ne.def, zeroDefault]
    constructor
    · rintro ⟨od, hval, hod⟩
      have := List.mem_dlookup (List.nodupKeys_dedupKeys A) hval
      

Proof state:
case withDefault.mp.intro.intro
α : Type u
β : Type v
γ : Sort w
inst✝² : Zero β
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
A : List ((_ : α) × β)
y od : β
hval : { fst := a, snd := od } ∈ List.dedupKeys A
hod : (decide ¬od = 0) = true
this : od ∈ List.dlookup a (List.dedupKeys A)
⊢ ¬Option.getD (List.dlookup a A) 0 = 0

Next tactic:
rw [(_ : List.dlookup a A = od)]
/-- Create a finitely supported function from a total function by taking the default value to
zero. -/
def applyFinsupp (tf : TotalFunction α β) : α →₀ β where
  support := zeroDefaultSupp tf
  toFun := tf.zeroDefault.apply
  mem_support_toFun := by
    intro a
    rcases tf with ⟨A, y⟩
    simp only [apply, zeroDefaultSupp, List.mem_map, List.mem_filter, exists_and_right,
      List.mem_toFinset, exists_eq_right, Sigma.exists, Ne.def, zeroDefault]
    constructor
    · rintro ⟨od, hval, hod⟩
      have := List.mem_dlookup (List.nodupKeys_dedupKeys A) hval
      rw [(_ : List.dlookup a A = od)]
      · 

Proof state:
case withDefault.mp.intro.intro
α : Type u
β : Type v
γ : Sort w
inst✝² : Zero β
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
A : List ((_ : α) × β)
y od : β
hval : { fst := a, snd := od } ∈ List.dedupKeys A
hod : (decide ¬od = 0) = true
this : od ∈ List.dlookup a (List.dedupKeys A)
⊢ ¬Option.getD (some od) 0 = 0

Next tactic:
simpa using hod
/-- Create a finitely supported function from a total function by taking the default value to
zero. -/
def applyFinsupp (tf : TotalFunction α β) : α →₀ β where
  support := zeroDefaultSupp tf
  toFun := tf.zeroDefault.apply
  mem_support_toFun := by
    intro a
    rcases tf with ⟨A, y⟩
    simp only [apply, zeroDefaultSupp, List.mem_map, List.mem_filter, exists_and_right,
      List.mem_toFinset, exists_eq_right, Sigma.exists, Ne.def, zeroDefault]
    constructor
    · rintro ⟨od, hval, hod⟩
      have := List.mem_dlookup (List.nodupKeys_dedupKeys A) hval
      rw [(_ : List.dlookup a A = od)]
      · simpa using hod
      · 

Proof state:
α : Type u
β : Type v
γ : Sort w
inst✝² : Zero β
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
a : α
A : List ((_ : α) × β)
y od : β
hval : { fst := a, snd := od } ∈ List.dedupKeys A
hod : (decide ¬od = 0) = true
this : od ∈ List.dlookup a (List.dedupKeys A)
⊢ List.dlookup a A = some od

Next tactic:
simpa [List.dlookup_dedupKeys, WithTop.some_eq_coe]