l3lab/ntp-mathlib huggingface dataset:
theorem map_injective_of_isIntegral [IsIntegral X] {U V : Opens X.carrier} (i : U ⟶ V)
    [H : Nonempty U] : Function.Injective (X.presheaf.map i.op) := by
  rw [injective_iff_map_eq_zero]
  intro x hx
  rw [← basicOpen_eq_bot_iff] at hx ⊢
  rw [Scheme.basicOpen_res] at hx
  revert hx
  contrapose!
  simp_rw [Ne.def, ← Opens.not_nonempty_iff_eq_bot, Classical.not_not]
  

Proof state:
X : Scheme
inst✝ : IsIntegral X
U V : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
H : Nonempty ↥U
x : (forget CommRingCat).obj (X.presheaf.obj (op V))
⊢ Set.Nonempty ↑(X.basicOpen x) → Set.Nonempty ↑(U ⊓ X.basicOpen x)

Next tactic:
apply nonempty_preirreducible_inter U.isOpen (RingedSpace.basicOpen _ _).isOpen
theorem map_injective_of_isIntegral [IsIntegral X] {U V : Opens X.carrier} (i : U ⟶ V)
    [H : Nonempty U] : Function.Injective (X.presheaf.map i.op) := by
  rw [injective_iff_map_eq_zero]
  intro x hx
  rw [← basicOpen_eq_bot_iff] at hx ⊢
  rw [Scheme.basicOpen_res] at hx
  revert hx
  contrapose!
  simp_rw [Ne.def, ← Opens.not_nonempty_iff_eq_bot, Classical.not_not]
  apply nonempty_preirreducible_inter U.isOpen (RingedSpace.basicOpen _ _).isOpen
  

Proof state:
X : Scheme
inst✝ : IsIntegral X
U V : Opens ↑↑X.toPresheafedSpace
i : U ⟶ V
H : Nonempty ↥U
x : (forget CommRingCat).obj (X.presheaf.obj (op V))
⊢ Set.Nonempty ↑U

Next tactic:
simpa using H
instance instLinearOrderTropical : LinearOrder (Tropical R) :=
  { instPartialOrderTropical with
    le_total := fun a b => le_total (untrop a) (untrop b)
    decidableLE := Tropical.decidableLE
    max := fun a b => trop (max (untrop a) (untrop b))
    max_def := fun a b => untrop_injective (by simp [max_def]; split_ifs <;> simp)
    min := (· + ·)
    min_def := fun a b => untrop_injective (by 

Proof state:
R : Type u
inst✝ : LinearOrder R
src✝ : PartialOrder (Tropical R) := instPartialOrderTropical
a b : Tropical R
⊢ untrop (min a b) = untrop (if a ≤ b then a else b)

Next tactic:
simp [min_def]
instance instLinearOrderTropical : LinearOrder (Tropical R) :=
  { instPartialOrderTropical with
    le_total := fun a b => le_total (untrop a) (untrop b)
    decidableLE := Tropical.decidableLE
    max := fun a b => trop (max (untrop a) (untrop b))
    max_def := fun a b => untrop_injective (by simp [max_def]; split_ifs <;> simp)
    min := (· + ·)
    min_def := fun a b => untrop_injective (by simp [min_def]; 

Proof state:
R : Type u
inst✝ : LinearOrder R
src✝ : PartialOrder (Tropical R) := instPartialOrderTropical
a b : Tropical R
⊢ (if a ≤ b then untrop a else untrop b) = untrop (if a ≤ b then a else b)

Next tactic:
split_ifs
instance instLinearOrderTropical : LinearOrder (Tropical R) :=
  { instPartialOrderTropical with
    le_total := fun a b => le_total (untrop a) (untrop b)
    decidableLE := Tropical.decidableLE
    max := fun a b => trop (max (untrop a) (untrop b))
    max_def := fun a b => untrop_injective (by simp [max_def]; split_ifs <;> simp)
    min := (· + ·)
    min_def := fun a b => untrop_injective (by simp [min_def]; split_ifs <;> 

Proof state:
case pos
R : Type u
inst✝ : LinearOrder R
src✝ : PartialOrder (Tropical R) := instPartialOrderTropical
a b : Tropical R
h✝ : a ≤ b
⊢ untrop a = untrop a

Next tactic:
simp
instance instLinearOrderTropical : LinearOrder (Tropical R) :=
  { instPartialOrderTropical with
    le_total := fun a b => le_total (untrop a) (untrop b)
    decidableLE := Tropical.decidableLE
    max := fun a b => trop (max (untrop a) (untrop b))
    max_def := fun a b => untrop_injective (by simp [max_def]; split_ifs <;> simp)
    min := (· + ·)
    min_def := fun a b => untrop_injective (by simp [min_def]; split_ifs <;> 

Proof state:
case neg
R : Type u
inst✝ : LinearOrder R
src✝ : PartialOrder (Tropical R) := instPartialOrderTropical
a b : Tropical R
h✝ : ¬a ≤ b
⊢ untrop b = untrop b

Next tactic:
simp
instance instLinearOrderTropical : LinearOrder (Tropical R) :=
  { instPartialOrderTropical with
    le_total := fun a b => le_total (untrop a) (untrop b)
    decidableLE := Tropical.decidableLE
    max := fun a b => trop (max (untrop a) (untrop b))
    max_def := fun a b => untrop_injective (by 

Proof state:
R : Type u
inst✝ : LinearOrder R
src✝ : PartialOrder (Tropical R) := instPartialOrderTropical
a b : Tropical R
⊢ untrop (max a b) = untrop (if a ≤ b then b else a)

Next tactic:
simp [max_def]
instance instLinearOrderTropical : LinearOrder (Tropical R) :=
  { instPartialOrderTropical with
    le_total := fun a b => le_total (untrop a) (untrop b)
    decidableLE := Tropical.decidableLE
    max := fun a b => trop (max (untrop a) (untrop b))
    max_def := fun a b => untrop_injective (by simp [max_def]; 

Proof state:
R : Type u
inst✝ : LinearOrder R
src✝ : PartialOrder (Tropical R) := instPartialOrderTropical
a b : Tropical R
⊢ (if a ≤ b then untrop b else untrop a) = untrop (if a ≤ b then b else a)

Next tactic:
split_ifs
instance instLinearOrderTropical : LinearOrder (Tropical R) :=
  { instPartialOrderTropical with
    le_total := fun a b => le_total (untrop a) (untrop b)
    decidableLE := Tropical.decidableLE
    max := fun a b => trop (max (untrop a) (untrop b))
    max_def := fun a b => untrop_injective (by simp [max_def]; split_ifs <;> 

Proof state:
case pos
R : Type u
inst✝ : LinearOrder R
src✝ : PartialOrder (Tropical R) := instPartialOrderTropical
a b : Tropical R
h✝ : a ≤ b
⊢ untrop b = untrop b

Next tactic:
simp
instance instLinearOrderTropical : LinearOrder (Tropical R) :=
  { instPartialOrderTropical with
    le_total := fun a b => le_total (untrop a) (untrop b)
    decidableLE := Tropical.decidableLE
    max := fun a b => trop (max (untrop a) (untrop b))
    max_def := fun a b => untrop_injective (by simp [max_def]; split_ifs <;> 

Proof state:
case neg
R : Type u
inst✝ : LinearOrder R
src✝ : PartialOrder (Tropical R) := instPartialOrderTropical
a b : Tropical R
h✝ : ¬a ≤ b
⊢ untrop a = untrop a

Next tactic:
simp
@[simp]
theorem add_eq_left ⦃x y : Tropical R⦄ (h : x ≤ y) : x + y = x :=
  untrop_injective (by 

Proof state:
R : Type u
inst✝ : LinearOrder R
x y : Tropical R
h : x ≤ y
⊢ untrop (x + y) = untrop x

Next tactic:
simpa using h
@[simp]
theorem add_eq_right ⦃x y : Tropical R⦄ (h : y ≤ x) : x + y = y :=
  untrop_injective (by 

Proof state:
R : Type u
inst✝ : LinearOrder R
x y : Tropical R
h : y ≤ x
⊢ untrop (x + y) = untrop y

Next tactic:
simpa using h
theorem add_eq_left_iff {x y : Tropical R} : x + y = x ↔ x ≤ y := by
  

Proof state:
R : Type u
inst✝ : LinearOrder R
x y : Tropical R
⊢ x + y = x ↔ x ≤ y

Next tactic:
rw [trop_add_def, trop_eq_iff_eq_untrop, ← untrop_le_iff, min_eq_left_iff]
theorem add_eq_right_iff {x y : Tropical R} : x + y = y ↔ y ≤ x := by
  

Proof state:
R : Type u
inst✝ : LinearOrder R
x y : Tropical R
⊢ x + y = y ↔ y ≤ x

Next tactic:
rw [trop_add_def, trop_eq_iff_eq_untrop, ← untrop_le_iff, min_eq_right_iff]
theorem add_eq_iff {x y z : Tropical R} : x + y = z ↔ x = z ∧ x ≤ y ∨ y = z ∧ y ≤ x := by
  

Proof state:
R : Type u
inst✝ : LinearOrder R
x y z : Tropical R
⊢ x + y = z ↔ x = z ∧ x ≤ y ∨ y = z ∧ y ≤ x

Next tactic:
rw [trop_add_def, trop_eq_iff_eq_untrop]
theorem add_eq_iff {x y z : Tropical R} : x + y = z ↔ x = z ∧ x ≤ y ∨ y = z ∧ y ≤ x := by
  rw [trop_add_def, trop_eq_iff_eq_untrop]
  

Proof state:
R : Type u
inst✝ : LinearOrder R
x y z : Tropical R
⊢ min (untrop x) (untrop y) = untrop z ↔ x = z ∧ x ≤ y ∨ y = z ∧ y ≤ x

Next tactic:
simp [min_eq_iff]
@[simp]
theorem add_eq_zero_iff {a b : Tropical (WithTop R)} : a + b = 0 ↔ a = 0 ∧ b = 0 := by
  

Proof state:
R : Type u
inst✝ : LinearOrder R
a b : Tropical (WithTop R)
⊢ a + b = 0 ↔ a = 0 ∧ b = 0

Next tactic:
rw [add_eq_iff]
@[simp]
theorem add_eq_zero_iff {a b : Tropical (WithTop R)} : a + b = 0 ↔ a = 0 ∧ b = 0 := by
  rw [add_eq_iff]
  

Proof state:
R : Type u
inst✝ : LinearOrder R
a b : Tropical (WithTop R)
⊢ a = 0 ∧ a ≤ b ∨ b = 0 ∧ b ≤ a ↔ a = 0 ∧ b = 0

Next tactic:
constructor
@[simp]
theorem add_eq_zero_iff {a b : Tropical (WithTop R)} : a + b = 0 ↔ a = 0 ∧ b = 0 := by
  rw [add_eq_iff]
  constructor
  · 

Proof state:
case mp
R : Type u
inst✝ : LinearOrder R
a b : Tropical (WithTop R)
⊢ a = 0 ∧ a ≤ b ∨ b = 0 ∧ b ≤ a → a = 0 ∧ b = 0

Next tactic:
rintro (⟨rfl, h⟩ | ⟨rfl, h⟩)
@[simp]
theorem add_eq_zero_iff {a b : Tropical (WithTop R)} : a + b = 0 ↔ a = 0 ∧ b = 0 := by
  rw [add_eq_iff]
  constructor
  · rintro (⟨rfl, h⟩ | ⟨rfl, h⟩)
    · 

Proof state:
case mp.inl.intro
R : Type u
inst✝ : LinearOrder R
b : Tropical (WithTop R)
h : 0 ≤ b
⊢ 0 = 0 ∧ b = 0

Next tactic:
exact ⟨rfl, le_antisymm (le_zero _) h⟩
@[simp]
theorem add_eq_zero_iff {a b : Tropical (WithTop R)} : a + b = 0 ↔ a = 0 ∧ b = 0 := by
  rw [add_eq_iff]
  constructor
  · rintro (⟨rfl, h⟩ | ⟨rfl, h⟩)
    · exact ⟨rfl, le_antisymm (le_zero _) h⟩
    · 

Proof state:
case mp.inr.intro
R : Type u
inst✝ : LinearOrder R
a : Tropical (WithTop R)
h : 0 ≤ a
⊢ a = 0 ∧ 0 = 0

Next tactic:
exact ⟨le_antisymm (le_zero _) h, rfl⟩
@[simp]
theorem add_eq_zero_iff {a b : Tropical (WithTop R)} : a + b = 0 ↔ a = 0 ∧ b = 0 := by
  rw [add_eq_iff]
  constructor
  · rintro (⟨rfl, h⟩ | ⟨rfl, h⟩)
    · exact ⟨rfl, le_antisymm (le_zero _) h⟩
    · exact ⟨le_antisymm (le_zero _) h, rfl⟩
  · 

Proof state:
case mpr
R : Type u
inst✝ : LinearOrder R
a b : Tropical (WithTop R)
⊢ a = 0 ∧ b = 0 → a = 0 ∧ a ≤ b ∨ b = 0 ∧ b ≤ a

Next tactic:
rintro ⟨rfl, rfl⟩
@[simp]
theorem add_eq_zero_iff {a b : Tropical (WithTop R)} : a + b = 0 ↔ a = 0 ∧ b = 0 := by
  rw [add_eq_iff]
  constructor
  · rintro (⟨rfl, h⟩ | ⟨rfl, h⟩)
    · exact ⟨rfl, le_antisymm (le_zero _) h⟩
    · exact ⟨le_antisymm (le_zero _) h, rfl⟩
  · rintro ⟨rfl, rfl⟩
    

Proof state:
case mpr.intro
R : Type u
inst✝ : LinearOrder R
⊢ 0 = 0 ∧ 0 ≤ 0 ∨ 0 = 0 ∧ 0 ≤ 0

Next tactic:
simp
instance instAddMonoidWithOneTropical [LinearOrder R] [OrderTop R] [Zero R] :
    AddMonoidWithOne (Tropical R) :=
  { instOneTropical, instAddCommMonoidTropical with
    natCast := fun n => if n = 0 then 0 else 1
    natCast_zero := rfl
    natCast_succ := fun n => (untrop_inj_iff _ _).1 (by 

Proof state:
R : Type u
inst✝² : LinearOrder R
inst✝¹ : OrderTop R
inst✝ : Zero R
src✝¹ : One (Tropical R) := instOneTropical
src✝ : AddCommMonoid (Tropical R) := instAddCommMonoidTropical
n : ℕ
⊢ untrop (NatCast.natCast (n + 1)) = untrop (NatCast.natCast n + 1)

Next tactic:
cases n
instance instAddMonoidWithOneTropical [LinearOrder R] [OrderTop R] [Zero R] :
    AddMonoidWithOne (Tropical R) :=
  { instOneTropical, instAddCommMonoidTropical with
    natCast := fun n => if n = 0 then 0 else 1
    natCast_zero := rfl
    natCast_succ := fun n => (untrop_inj_iff _ _).1 (by cases n <;> 

Proof state:
case zero
R : Type u
inst✝² : LinearOrder R
inst✝¹ : OrderTop R
inst✝ : Zero R
src✝¹ : One (Tropical R) := instOneTropical
src✝ : AddCommMonoid (Tropical R) := instAddCommMonoidTropical
⊢ untrop (NatCast.natCast (Nat.zero + 1)) = untrop (NatCast.natCast Nat.zero + 1)

Next tactic:
simp [Nat.cast]
instance instAddMonoidWithOneTropical [LinearOrder R] [OrderTop R] [Zero R] :
    AddMonoidWithOne (Tropical R) :=
  { instOneTropical, instAddCommMonoidTropical with
    natCast := fun n => if n = 0 then 0 else 1
    natCast_zero := rfl
    natCast_succ := fun n => (untrop_inj_iff _ _).1 (by cases n <;> 

Proof state:
case succ
R : Type u
inst✝² : LinearOrder R
inst✝¹ : OrderTop R
inst✝ : Zero R
src✝¹ : One (Tropical R) := instOneTropical
src✝ : AddCommMonoid (Tropical R) := instAddCommMonoidTropical
n✝ : ℕ
⊢ untrop (NatCast.natCast (Nat.succ n✝ + 1)) = untrop (NatCast.natCast (Nat.succ n✝) + 1)

Next tactic:
simp [Nat.cast]
instance instMonoidTropical [AddMonoid R] : Monoid (Tropical R) :=
  { instMulOneClassTropical, instSemigroupTropical with
    npow := fun n x => x ^ n
    npow_zero := fun _ => untrop_injective <| by 

Proof state:
R : Type u
inst✝ : AddMonoid R
src✝¹ : MulOneClass (Tropical R) := instMulOneClassTropical
src✝ : Semigroup (Tropical R) := instSemigroupTropical
x✝ : Tropical R
⊢ untrop ((fun n x => x ^ n) 0 x✝) = untrop 1

Next tactic:
simp
instance instGroupTropical [AddGroup R] : Group (Tropical R) :=
  { instMonoidTropical with
    inv := Inv.inv
    div_eq_mul_inv := fun _ _ => untrop_injective <| by 

Proof state:
R : Type u
inst✝ : AddGroup R
src✝ : Monoid (Tropical R) := instMonoidTropical
x✝¹ x✝ : Tropical R
⊢ untrop (x✝¹ / x✝) = untrop (x✝¹ * x✝⁻¹)

Next tactic:
simp [sub_eq_add_neg]
instance covariant_add [LinearOrder R] : CovariantClass (Tropical R) (Tropical R) (· + ·) (· ≤ ·) :=
  ⟨fun x y z h => by
    

Proof state:
R : Type u
inst✝ : LinearOrder R
x y z : Tropical R
h : y ≤ z
⊢ x + y ≤ x + z

Next tactic:
rcases le_total x y with hx | hy
instance covariant_add [LinearOrder R] : CovariantClass (Tropical R) (Tropical R) (· + ·) (· ≤ ·) :=
  ⟨fun x y z h => by
    rcases le_total x y with hx | hy
    · 

Proof state:
case inl
R : Type u
inst✝ : LinearOrder R
x y z : Tropical R
h : y ≤ z
hx : x ≤ y
⊢ x + y ≤ x + z

Next tactic:
rw [add_eq_left hx, add_eq_left (hx.trans h)]
instance covariant_add [LinearOrder R] : CovariantClass (Tropical R) (Tropical R) (· + ·) (· ≤ ·) :=
  ⟨fun x y z h => by
    rcases le_total x y with hx | hy
    · rw [add_eq_left hx, add_eq_left (hx.trans h)]
    · 

Proof state:
case inr
R : Type u
inst✝ : LinearOrder R
x y z : Tropical R
h : y ≤ z
hy : y ≤ x
⊢ x + y ≤ x + z

Next tactic:
rw [add_eq_right hy]
instance covariant_add [LinearOrder R] : CovariantClass (Tropical R) (Tropical R) (· + ·) (· ≤ ·) :=
  ⟨fun x y z h => by
    rcases le_total x y with hx | hy
    · rw [add_eq_left hx, add_eq_left (hx.trans h)]
    · rw [add_eq_right hy]
      

Proof state:
case inr
R : Type u
inst✝ : LinearOrder R
x y z : Tropical R
h : y ≤ z
hy : y ≤ x
⊢ y ≤ x + z

Next tactic:
rcases le_total x z with hx | hx
instance covariant_add [LinearOrder R] : CovariantClass (Tropical R) (Tropical R) (· + ·) (· ≤ ·) :=
  ⟨fun x y z h => by
    rcases le_total x y with hx | hy
    · rw [add_eq_left hx, add_eq_left (hx.trans h)]
    · rw [add_eq_right hy]
      rcases le_total x z with hx | hx
      · 

Proof state:
case inr.inl
R : Type u
inst✝ : LinearOrder R
x y z : Tropical R
h : y ≤ z
hy : y ≤ x
hx : x ≤ z
⊢ y ≤ x + z

Next tactic:
rwa [add_eq_left hx]
instance covariant_add [LinearOrder R] : CovariantClass (Tropical R) (Tropical R) (· + ·) (· ≤ ·) :=
  ⟨fun x y z h => by
    rcases le_total x y with hx | hy
    · rw [add_eq_left hx, add_eq_left (hx.trans h)]
    · rw [add_eq_right hy]
      rcases le_total x z with hx | hx
      · rwa [add_eq_left hx]
      · 

Proof state:
case inr.inr
R : Type u
inst✝ : LinearOrder R
x y z : Tropical R
h : y ≤ z
hy : y ≤ x
hx : z ≤ x
⊢ y ≤ x + z

Next tactic:
rwa [add_eq_right hx]
@[simp]
theorem add_pow [LinearOrder R] [AddMonoid R] [CovariantClass R R (· + ·) (· ≤ ·)]
    [CovariantClass R R (Function.swap (· + ·)) (· ≤ ·)] (x y : Tropical R) (n : ℕ) :
    (x + y) ^ n = x ^ n + y ^ n := by
  

Proof state:
R : Type u
inst✝³ : LinearOrder R
inst✝² : AddMonoid R
inst✝¹ : CovariantClass R R (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝ : CovariantClass R R (Function.swap fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
x y : Tropical R
n : ℕ
⊢ (x + y) ^ n = x ^ n + y ^ n

Next tactic:
rcases le_total x y with h | h
@[simp]
theorem add_pow [LinearOrder R] [AddMonoid R] [CovariantClass R R (· + ·) (· ≤ ·)]
    [CovariantClass R R (Function.swap (· + ·)) (· ≤ ·)] (x y : Tropical R) (n : ℕ) :
    (x + y) ^ n = x ^ n + y ^ n := by
  rcases le_total x y with h | h
  · 

Proof state:
case inl
R : Type u
inst✝³ : LinearOrder R
inst✝² : AddMonoid R
inst✝¹ : CovariantClass R R (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝ : CovariantClass R R (Function.swap fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
x y : Tropical R
n : ℕ
h : x ≤ y
⊢ (x + y) ^ n = x ^ n + y ^ n

Next tactic:
rw [add_eq_left h, add_eq_left (pow_le_pow_left' h _)]
@[simp]
theorem add_pow [LinearOrder R] [AddMonoid R] [CovariantClass R R (· + ·) (· ≤ ·)]
    [CovariantClass R R (Function.swap (· + ·)) (· ≤ ·)] (x y : Tropical R) (n : ℕ) :
    (x + y) ^ n = x ^ n + y ^ n := by
  rcases le_total x y with h | h
  · rw [add_eq_left h, add_eq_left (pow_le_pow_left' h _)]
  · 

Proof state:
case inr
R : Type u
inst✝³ : LinearOrder R
inst✝² : AddMonoid R
inst✝¹ : CovariantClass R R (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝ : CovariantClass R R (Function.swap fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
x y : Tropical R
n : ℕ
h : y ≤ x
⊢ (x + y) ^ n = x ^ n + y ^ n

Next tactic:
rw [add_eq_right h, add_eq_right (pow_le_pow_left' h _)]
instance : CommSemiring (Tropical R) :=
  { instAddMonoidWithOneTropical,
    instDistribTropical,
    instAddCommMonoidTropical,
    instCommMonoidTropical with
    zero_mul := fun _ => untrop_injective (by 

Proof state:
R : Type u
inst✝ : LinearOrderedAddCommMonoidWithTop R
src✝³ : AddMonoidWithOne (Tropical R) := instAddMonoidWithOneTropical
src✝² : Distrib (Tropical R) := instDistribTropical
src✝¹ : AddCommMonoid (Tropical R) := instAddCommMonoidTropical
src✝ : CommMonoid (Tropical R) := instCommMonoidTropical
x✝ : Tropical R
⊢ untrop (0 * x✝) = untrop 0

Next tactic:
simp [top_add]
instance : CommSemiring (Tropical R) :=
  { instAddMonoidWithOneTropical,
    instDistribTropical,
    instAddCommMonoidTropical,
    instCommMonoidTropical with
    zero_mul := fun _ => untrop_injective (by simp [top_add])
    mul_zero := fun _ => untrop_injective (by 

Proof state:
R : Type u
inst✝ : LinearOrderedAddCommMonoidWithTop R
src✝³ : AddMonoidWithOne (Tropical R) := instAddMonoidWithOneTropical
src✝² : Distrib (Tropical R) := instDistribTropical
src✝¹ : AddCommMonoid (Tropical R) := instAddCommMonoidTropical
src✝ : CommMonoid (Tropical R) := instCommMonoidTropical
x✝ : Tropical R
⊢ untrop (x✝ * 0) = untrop 0

Next tactic:
simp [add_top]
@[simp]
theorem succ_nsmul {R} [LinearOrder R] [OrderTop R] (x : Tropical R) (n : ℕ) : (n + 1) • x = x := by
  

Proof state:
R✝ : Type u
inst✝² : LinearOrderedAddCommMonoidWithTop R✝
R : Type u_1
inst✝¹ : LinearOrder R
inst✝ : OrderTop R
x : Tropical R
n : ℕ
⊢ (n + 1) • x = x

Next tactic:
induction' n with n IH
@[simp]
theorem succ_nsmul {R} [LinearOrder R] [OrderTop R] (x : Tropical R) (n : ℕ) : (n + 1) • x = x := by
  induction' n with n IH
  · 

Proof state:
case zero
R✝ : Type u
inst✝² : LinearOrderedAddCommMonoidWithTop R✝
R : Type u_1
inst✝¹ : LinearOrder R
inst✝ : OrderTop R
x : Tropical R
⊢ (Nat.zero + 1) • x = x

Next tactic:
simp
@[simp]
theorem succ_nsmul {R} [LinearOrder R] [OrderTop R] (x : Tropical R) (n : ℕ) : (n + 1) • x = x := by
  induction' n with n IH
  · simp
  · 

Proof state:
case succ
R✝ : Type u
inst✝² : LinearOrderedAddCommMonoidWithTop R✝
R : Type u_1
inst✝¹ : LinearOrder R
inst✝ : OrderTop R
x : Tropical R
n : ℕ
IH : (n + 1) • x = x
⊢ (Nat.succ n + 1) • x = x

Next tactic:
rw [add_nsmul, IH, one_nsmul, add_self]
theorem mul_eq_zero_iff {R : Type*} [LinearOrderedAddCommMonoid R] {a b : Tropical (WithTop R)} :
    a * b = 0 ↔ a = 0 ∨ b = 0 := by 

Proof state:
R✝ : Type u
inst✝¹ : LinearOrderedAddCommMonoidWithTop R✝
R : Type u_1
inst✝ : LinearOrderedAddCommMonoid R
a b : Tropical (WithTop R)
⊢ a * b = 0 ↔ a = 0 ∨ b = 0

Next tactic:
simp [← untrop_inj_iff, WithTop.add_eq_top]
theorem unbot'_eq_iff {d y : α} {x : WithBot α} : unbot' d x = y ↔ x = y ∨ x = ⊥ ∧ y = d := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b d y : α
x : WithBot α
⊢ unbot' d x = y ↔ x = ↑y ∨ x = ⊥ ∧ y = d

Next tactic:
induction x using recBotCoe
theorem unbot'_eq_iff {d y : α} {x : WithBot α} : unbot' d x = y ↔ x = y ∨ x = ⊥ ∧ y = d := by
  induction x using recBotCoe <;> 

Proof state:
case bot
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b d y : α
⊢ unbot' d ⊥ = y ↔ ⊥ = ↑y ∨ ⊥ = ⊥ ∧ y = d

Next tactic:
simp [@eq_comm _ d]
theorem unbot'_eq_iff {d y : α} {x : WithBot α} : unbot' d x = y ↔ x = y ∨ x = ⊥ ∧ y = d := by
  induction x using recBotCoe <;> 

Proof state:
case coe
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b d y a✝ : α
⊢ unbot' d ↑a✝ = y ↔ ↑a✝ = ↑y ∨ ↑a✝ = ⊥ ∧ y = d

Next tactic:
simp [@eq_comm _ d]
@[simp] theorem unbot'_eq_self_iff {d : α} {x : WithBot α} : unbot' d x = d ↔ x = d ∨ x = ⊥ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b d : α
x : WithBot α
⊢ unbot' d x = d ↔ x = ↑d ∨ x = ⊥

Next tactic:
simp [unbot'_eq_iff]
theorem unbot'_eq_unbot'_iff {d : α} {x y : WithBot α} :
    unbot' d x = unbot' d y ↔ x = y ∨ x = d ∧ y = ⊥ ∨ x = ⊥ ∧ y = d := by
 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b d : α
x y : WithBot α
⊢ unbot' d x = unbot' d y ↔ x = y ∨ x = ↑d ∧ y = ⊥ ∨ x = ⊥ ∧ y = ↑d

Next tactic:
induction y using recBotCoe
theorem unbot'_eq_unbot'_iff {d : α} {x y : WithBot α} :
    unbot' d x = unbot' d y ↔ x = y ∨ x = d ∧ y = ⊥ ∨ x = ⊥ ∧ y = d := by
 induction y using recBotCoe <;> 

Proof state:
case bot
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b d : α
x : WithBot α
⊢ unbot' d x = unbot' d ⊥ ↔ x = ⊥ ∨ x = ↑d ∧ ⊥ = ⊥ ∨ x = ⊥ ∧ ⊥ = ↑d

Next tactic:
simp [unbot'_eq_iff, or_comm]
theorem unbot'_eq_unbot'_iff {d : α} {x y : WithBot α} :
    unbot' d x = unbot' d y ↔ x = y ∨ x = d ∧ y = ⊥ ∨ x = ⊥ ∧ y = d := by
 induction y using recBotCoe <;> 

Proof state:
case coe
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b d : α
x : WithBot α
a✝ : α
⊢ unbot' d x = unbot' d ↑a✝ ↔ x = ↑a✝ ∨ x = ↑d ∧ ↑a✝ = ⊥ ∨ x = ⊥ ∧ ↑a✝ = ↑d

Next tactic:
simp [unbot'_eq_iff, or_comm]
@[simp]
theorem coe_unbot (x : WithBot α) (h : x ≠ ⊥) : (x.unbot h : WithBot α) = x := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b : α
x : WithBot α
h : x ≠ ⊥
⊢ ↑(unbot x h) = x

Next tactic:
cases x
@[simp]
theorem coe_unbot (x : WithBot α) (h : x ≠ ⊥) : (x.unbot h : WithBot α) = x := by
  cases x
  

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b : α
h : none ≠ ⊥
⊢ ↑(unbot none h) = none
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b val✝ : α
h : Option.some val✝ ≠ ⊥
⊢ ↑(unbot (Option.some val✝) h) = Option.some val✝

Next tactic:
exact (h rfl).elim
@[simp]
theorem coe_unbot (x : WithBot α) (h : x ≠ ⊥) : (x.unbot h : WithBot α) = x := by
  cases x
  exact (h rfl).elim
  

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b val✝ : α
h : Option.some val✝ ≠ ⊥
⊢ ↑(unbot (Option.some val✝) h) = Option.some val✝

Next tactic:
rfl
@[simp]
theorem some_le_some : @LE.le (WithBot α) _ (Option.some a) (Option.some b) ↔ a ≤ b := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b : α
inst✝ : LE α
⊢ Option.some a ≤ Option.some b ↔ a ≤ b

Next tactic:
simp [LE.le]
instance orderTop [OrderTop α] : OrderTop (WithBot α) where
  top := some ⊤
  le_top o a ha := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a✝ b : α
inst✝¹ : LE α
inst✝ : OrderTop α
o : WithBot α
a : α
ha : a ∈ o
⊢ ∃ b, b ∈ ⊤ ∧ a ≤ b

Next tactic:
cases ha
instance orderTop [OrderTop α] : OrderTop (WithBot α) where
  top := some ⊤
  le_top o a ha := by cases ha; 

Proof state:
case refl
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a✝ b : α
inst✝¹ : LE α
inst✝ : OrderTop α
a : α
⊢ ∃ b, b ∈ ⊤ ∧ a ≤ b

Next tactic:
exact ⟨_, rfl, le_top⟩
/-- There is a general version `le_bot_iff`, but this lemma does not require a `PartialOrder`. -/
@[simp]
protected theorem le_bot_iff : ∀ {a : WithBot α}, a ≤ ⊥ ↔ a = ⊥
  | (a : α) => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a✝ b : α
inst✝ : LE α
a : α
⊢ ↑a ≤ ⊥ ↔ ↑a = ⊥

Next tactic:
simp [not_coe_le_bot _]
/-- There is a general version `le_bot_iff`, but this lemma does not require a `PartialOrder`. -/
@[simp]
protected theorem le_bot_iff : ∀ {a : WithBot α}, a ≤ ⊥ ↔ a = ⊥
  | (a : α) => by simp [not_coe_le_bot _]
  | ⊥ => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b : α
inst✝ : LE α
⊢ ⊥ ≤ ⊥ ↔ ⊥ = ⊥

Next tactic:
simp
theorem coe_le_iff : ∀ {x : WithBot α}, (a : WithBot α) ≤ x ↔ ∃ b : α, x = b ∧ a ≤ b
  | Option.some x => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
a b : α
inst✝ : LE α
x : α
⊢ ↑a ≤ Option.some x ↔ ∃ b, Option.some x = ↑b ∧ a ≤ b

Next tactic:
simp [some_eq_coe]