Theorem: Monoid.exponent_eq_iSup_orderOf
File: Mathlib/GroupTheory/Exponent.lean

tactic: rw [iSup]
state_before: G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
⊢ exponent G = ⨆ g, orderOf g
state_after: G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
⊢ exponent G = sSup (Set.range fun g => orderOf g)

tactic: by_cases ExponentExists G
state_before: G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
⊢ exponent G = sSup (Set.range fun g => orderOf g)
state_after: case pos
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
h✝ : ExponentExists G
⊢ exponent G = sSup (Set.range fun g => orderOf g)

case neg
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
h✝ : ¬ExponentExists G
⊢ exponent G = sSup (Set.range fun g => orderOf g)

tactic: case neg he =>
  rw [← exponent_eq_zero_iff] at he
  rw [he, Set.Infinite.Nat.sSup_eq_zero <| (exponent_eq_zero_iff_range_orderOf_infinite h).1 he]
state_before: case pos
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
h✝ : ExponentExists G
⊢ exponent G = sSup (Set.range fun g => orderOf g)

case neg
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
h✝ : ¬ExponentExists G
⊢ exponent G = sSup (Set.range fun g => orderOf g)
state_after: case pos
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
h✝ : ExponentExists G
⊢ exponent G = sSup (Set.range fun g => orderOf g)

tactic: rw [← exponent_eq_zero_iff] at he
state_before: G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ¬ExponentExists G
⊢ exponent G = sSup (Set.range fun g => orderOf g)
state_after: G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : exponent G = 0
⊢ exponent G = sSup (Set.range fun g => orderOf g)

tactic: rw [he, Set.Infinite.Nat.sSup_eq_zero <| (exponent_eq_zero_iff_range_orderOf_infinite h).1 he]
state_before: G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : exponent G = 0
⊢ exponent G = sSup (Set.range fun g => orderOf g)
state_after: no goals

tactic: rw [csSup_eq_of_forall_le_of_forall_lt_exists_gt (Set.range_nonempty _)]
state_before: G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
⊢ exponent G = sSup (Set.range fun g => orderOf g)
state_after: case H
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
⊢ ∀ a ∈ Set.range fun g => orderOf g, a ≤ exponent G

case H'
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
⊢ ∀ w < exponent G, ∃ a ∈ Set.range fun g => orderOf g, w < a

tactic: intro x hx
state_before: case H'
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
⊢ ∀ w < exponent G, ∃ a ∈ Set.range fun g => orderOf g, w < a
state_after: case H'
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
x : ℕ
hx : x < exponent G
⊢ ∃ a ∈ Set.range fun g => orderOf g, x < a

tactic: obtain ⟨g, hg⟩ := exists_orderOf_eq_exponent he
state_before: case H'
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
x : ℕ
hx : x < exponent G
⊢ ∃ a ∈ Set.range fun g => orderOf g, x < a
state_after: case H'.intro
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
x : ℕ
hx : x < exponent G
g : G
hg : orderOf g = exponent G
⊢ ∃ a ∈ Set.range fun g => orderOf g, x < a

tactic: rw [← hg] at hx
state_before: case H'.intro
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
x : ℕ
hx : x < exponent G
g : G
hg : orderOf g = exponent G
⊢ ∃ a ∈ Set.range fun g => orderOf g, x < a
state_after: case H'.intro
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
x : ℕ
g : G
hx : x < orderOf g
hg : orderOf g = exponent G
⊢ ∃ a ∈ Set.range fun g => orderOf g, x < a

tactic: simp_rw [Set.mem_range, exists_exists_eq_and]
state_before: case H'.intro
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
x : ℕ
g : G
hx : x < orderOf g
hg : orderOf g = exponent G
⊢ ∃ a ∈ Set.range fun g => orderOf g, x < a
state_after: case H'.intro
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
x : ℕ
g : G
hx : x < orderOf g
hg : orderOf g = exponent G
⊢ ∃ a, x < orderOf a

tactic: exact ⟨g, hx⟩
state_before: case H'.intro
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
x : ℕ
g : G
hx : x < orderOf g
hg : orderOf g = exponent G
⊢ ∃ a, x < orderOf a
state_after: no goals

tactic: simp_rw [Set.mem_range, forall_exists_index, forall_apply_eq_imp_iff]
state_before: case H
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
⊢ ∀ a ∈ Set.range fun g => orderOf g, a ≤ exponent G
state_after: case H
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
⊢ ∀ (a : G), orderOf a ≤ exponent G

tactic: exact orderOf_le_exponent he
state_before: case H
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : ExponentExists G
⊢ ∀ (a : G), orderOf a ≤ exponent G
state_after: no goals