l3lab/ntp-mathlib huggingface dataset:
theorem reesAlgebra.fg (hI : I.FG) : (reesAlgebra I).FG := by
  classical
    obtain ⟨s, hs⟩ := hI
    rw [← adjoin_monomial_eq_reesAlgebra, ← hs]
    use s.image (monomial 1)
    rw [Finset.coe_image]
    change
      _ =
        Algebra.adjoin R
          (Submodule.map (monomial 1 : R →ₗ[R] R[X]) (Submodule.span R ↑s) : Set R[X])
    

Proof state:
case h
R M : Type u
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
I : Ideal R
s : Finset R
hs : Ideal.span ↑s = I
⊢ Algebra.adjoin R (⇑(monomial 1) '' ↑s) = Algebra.adjoin R ↑(Submodule.map (monomial 1) (Submodule.span R ↑s))

Next tactic:
rw [Submodule.map_span, Algebra.adjoin_span]
theorem fst_pred_mem_erase_of_mem_right {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) :
    (m.1 - 1, m.2) ∈ b.erase m := by
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ right b
⊢ (m.1 - 1, m.2) ∈ Finset.erase b m

Next tactic:
rw [mem_right] at h
theorem fst_pred_mem_erase_of_mem_right {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) :
    (m.1 - 1, m.2) ∈ b.erase m := by
  rw [mem_right] at h
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ b ∧ (m.1 - 1, m.2) ∈ b
⊢ (m.1 - 1, m.2) ∈ Finset.erase b m

Next tactic:
apply Finset.mem_erase_of_ne_of_mem _ h.2
theorem fst_pred_mem_erase_of_mem_right {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) :
    (m.1 - 1, m.2) ∈ b.erase m := by
  rw [mem_right] at h
  apply Finset.mem_erase_of_ne_of_mem _ h.2
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ b ∧ (m.1 - 1, m.2) ∈ b
⊢ (m.1 - 1, m.2) ≠ m

Next tactic:
exact ne_of_apply_ne Prod.fst (pred_ne_self m.1)
theorem snd_pred_mem_erase_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) :
    (m.1, m.2 - 1) ∈ b.erase m := by
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ left b
⊢ (m.1, m.2 - 1) ∈ Finset.erase b m

Next tactic:
rw [mem_left] at h
theorem snd_pred_mem_erase_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) :
    (m.1, m.2 - 1) ∈ b.erase m := by
  rw [mem_left] at h
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ b ∧ (m.1, m.2 - 1) ∈ b
⊢ (m.1, m.2 - 1) ∈ Finset.erase b m

Next tactic:
apply Finset.mem_erase_of_ne_of_mem _ h.2
theorem snd_pred_mem_erase_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) :
    (m.1, m.2 - 1) ∈ b.erase m := by
  rw [mem_left] at h
  apply Finset.mem_erase_of_ne_of_mem _ h.2
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ b ∧ (m.1, m.2 - 1) ∈ b
⊢ (m.1, m.2 - 1) ≠ m

Next tactic:
exact ne_of_apply_ne Prod.snd (pred_ne_self m.2)
theorem card_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) : 2 ≤ Finset.card b := by
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ left b
⊢ 2 ≤ Finset.card b

Next tactic:
have w₁ : m ∈ b := (Finset.mem_inter.1 h).1
theorem card_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) : 2 ≤ Finset.card b := by
  have w₁ : m ∈ b := (Finset.mem_inter.1 h).1
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ left b
w₁ : m ∈ b
⊢ 2 ≤ Finset.card b

Next tactic:
have w₂ : (m.1, m.2 - 1) ∈ b.erase m := snd_pred_mem_erase_of_mem_left h
theorem card_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) : 2 ≤ Finset.card b := by
  have w₁ : m ∈ b := (Finset.mem_inter.1 h).1
  have w₂ : (m.1, m.2 - 1) ∈ b.erase m := snd_pred_mem_erase_of_mem_left h
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ left b
w₁ : m ∈ b
w₂ : (m.1, m.2 - 1) ∈ Finset.erase b m
⊢ 2 ≤ Finset.card b

Next tactic:
have i₁ := Finset.card_erase_lt_of_mem w₁
theorem card_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) : 2 ≤ Finset.card b := by
  have w₁ : m ∈ b := (Finset.mem_inter.1 h).1
  have w₂ : (m.1, m.2 - 1) ∈ b.erase m := snd_pred_mem_erase_of_mem_left h
  have i₁ := Finset.card_erase_lt_of_mem w₁
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ left b
w₁ : m ∈ b
w₂ : (m.1, m.2 - 1) ∈ Finset.erase b m
i₁ : Finset.card (Finset.erase b m) < Finset.card b
⊢ 2 ≤ Finset.card b

Next tactic:
have i₂ := Nat.lt_of_le_of_lt (Nat.zero_le _) (Finset.card_erase_lt_of_mem w₂)
theorem card_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) : 2 ≤ Finset.card b := by
  have w₁ : m ∈ b := (Finset.mem_inter.1 h).1
  have w₂ : (m.1, m.2 - 1) ∈ b.erase m := snd_pred_mem_erase_of_mem_left h
  have i₁ := Finset.card_erase_lt_of_mem w₁
  have i₂ := Nat.lt_of_le_of_lt (Nat.zero_le _) (Finset.card_erase_lt_of_mem w₂)
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ left b
w₁ : m ∈ b
w₂ : (m.1, m.2 - 1) ∈ Finset.erase b m
i₁ : Finset.card (Finset.erase b m) < Finset.card b
i₂ : 0 < Finset.card (Finset.erase b m)
⊢ 2 ≤ Finset.card b

Next tactic:
exact Nat.lt_of_le_of_lt i₂ i₁
theorem card_of_mem_right {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) : 2 ≤ Finset.card b := by
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ right b
⊢ 2 ≤ Finset.card b

Next tactic:
have w₁ : m ∈ b := (Finset.mem_inter.1 h).1
theorem card_of_mem_right {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) : 2 ≤ Finset.card b := by
  have w₁ : m ∈ b := (Finset.mem_inter.1 h).1
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ right b
w₁ : m ∈ b
⊢ 2 ≤ Finset.card b

Next tactic:
have w₂ := fst_pred_mem_erase_of_mem_right h
theorem card_of_mem_right {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) : 2 ≤ Finset.card b := by
  have w₁ : m ∈ b := (Finset.mem_inter.1 h).1
  have w₂ := fst_pred_mem_erase_of_mem_right h
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ right b
w₁ : m ∈ b
w₂ : (m.1 - 1, m.2) ∈ Finset.erase b m
⊢ 2 ≤ Finset.card b

Next tactic:
have i₁ := Finset.card_erase_lt_of_mem w₁
theorem card_of_mem_right {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) : 2 ≤ Finset.card b := by
  have w₁ : m ∈ b := (Finset.mem_inter.1 h).1
  have w₂ := fst_pred_mem_erase_of_mem_right h
  have i₁ := Finset.card_erase_lt_of_mem w₁
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ right b
w₁ : m ∈ b
w₂ : (m.1 - 1, m.2) ∈ Finset.erase b m
i₁ : Finset.card (Finset.erase b m) < Finset.card b
⊢ 2 ≤ Finset.card b

Next tactic:
have i₂ := Nat.lt_of_le_of_lt (Nat.zero_le _) (Finset.card_erase_lt_of_mem w₂)
theorem card_of_mem_right {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) : 2 ≤ Finset.card b := by
  have w₁ : m ∈ b := (Finset.mem_inter.1 h).1
  have w₂ := fst_pred_mem_erase_of_mem_right h
  have i₁ := Finset.card_erase_lt_of_mem w₁
  have i₂ := Nat.lt_of_le_of_lt (Nat.zero_le _) (Finset.card_erase_lt_of_mem w₂)
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ right b
w₁ : m ∈ b
w₂ : (m.1 - 1, m.2) ∈ Finset.erase b m
i₁ : Finset.card (Finset.erase b m) < Finset.card b
i₂ : 0 < Finset.card (Finset.erase b m)
⊢ 2 ≤ Finset.card b

Next tactic:
exact Nat.lt_of_le_of_lt i₂ i₁
theorem moveLeft_card {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) :
    Finset.card (moveLeft b m) + 2 = Finset.card b := by
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ left b
⊢ Finset.card (moveLeft b m) + 2 = Finset.card b

Next tactic:
dsimp [moveLeft]
theorem moveLeft_card {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) :
    Finset.card (moveLeft b m) + 2 = Finset.card b := by
  dsimp [moveLeft]
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ left b
⊢ Finset.card (Finset.erase (Finset.erase b m) (m.1, m.2 - 1)) + 2 = Finset.card b

Next tactic:
rw [Finset.card_erase_of_mem (snd_pred_mem_erase_of_mem_left h)]
theorem moveLeft_card {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) :
    Finset.card (moveLeft b m) + 2 = Finset.card b := by
  dsimp [moveLeft]
  rw [Finset.card_erase_of_mem (snd_pred_mem_erase_of_mem_left h)]
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ left b
⊢ Finset.card (Finset.erase b m) - 1 + 2 = Finset.card b

Next tactic:
rw [Finset.card_erase_of_mem (Finset.mem_of_mem_inter_left h)]
theorem moveLeft_card {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) :
    Finset.card (moveLeft b m) + 2 = Finset.card b := by
  dsimp [moveLeft]
  rw [Finset.card_erase_of_mem (snd_pred_mem_erase_of_mem_left h)]
  rw [Finset.card_erase_of_mem (Finset.mem_of_mem_inter_left h)]
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ left b
⊢ Finset.card b - 1 - 1 + 2 = Finset.card b

Next tactic:
exact tsub_add_cancel_of_le (card_of_mem_left h)
theorem moveRight_card {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) :
    Finset.card (moveRight b m) + 2 = Finset.card b := by
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ right b
⊢ Finset.card (moveRight b m) + 2 = Finset.card b

Next tactic:
dsimp [moveRight]
theorem moveRight_card {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) :
    Finset.card (moveRight b m) + 2 = Finset.card b := by
  dsimp [moveRight]
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ right b
⊢ Finset.card (Finset.erase (Finset.erase b m) (m.1 - 1, m.2)) + 2 = Finset.card b

Next tactic:
rw [Finset.card_erase_of_mem (fst_pred_mem_erase_of_mem_right h)]
theorem moveRight_card {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) :
    Finset.card (moveRight b m) + 2 = Finset.card b := by
  dsimp [moveRight]
  rw [Finset.card_erase_of_mem (fst_pred_mem_erase_of_mem_right h)]
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ right b
⊢ Finset.card (Finset.erase b m) - 1 + 2 = Finset.card b

Next tactic:
rw [Finset.card_erase_of_mem (Finset.mem_of_mem_inter_left h)]
theorem moveRight_card {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) :
    Finset.card (moveRight b m) + 2 = Finset.card b := by
  dsimp [moveRight]
  rw [Finset.card_erase_of_mem (fst_pred_mem_erase_of_mem_right h)]
  rw [Finset.card_erase_of_mem (Finset.mem_of_mem_inter_left h)]
  

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ right b
⊢ Finset.card b - 1 - 1 + 2 = Finset.card b

Next tactic:
exact tsub_add_cancel_of_le (card_of_mem_right h)
theorem moveLeft_smaller {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) :
    Finset.card (moveLeft b m) / 2 < Finset.card b / 2 := by 

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ left b
⊢ Finset.card (moveLeft b m) / 2 < Finset.card b / 2

Next tactic:
simp [← moveLeft_card h, lt_add_one]
theorem moveRight_smaller {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) :
    Finset.card (moveRight b m) / 2 < Finset.card b / 2 := by 

Proof state:
b : Board
m : ℤ × ℤ
h : m ∈ right b
⊢ Finset.card (moveRight b m) / 2 < Finset.card b / 2

Next tactic:
simp [← moveRight_card h, lt_add_one]
/-- The instance describing allowed moves on a Domineering board. -/
instance state : State Board where
  turnBound s := s.card / 2
  l s := (left s).image (moveLeft s)
  r s := (right s).image (moveRight s)
  left_bound m := by
    

Proof state:
s✝ t✝ : Board
m : t✝ ∈ (fun s => Finset.image (moveLeft s) (left s)) s✝
⊢ (fun s => Finset.card s / 2) t✝ < (fun s => Finset.card s / 2) s✝

Next tactic:
simp only [Finset.mem_image, Prod.exists] at m
/-- The instance describing allowed moves on a Domineering board. -/
instance state : State Board where
  turnBound s := s.card / 2
  l s := (left s).image (moveLeft s)
  r s := (right s).image (moveRight s)
  left_bound m := by
    simp only [Finset.mem_image, Prod.exists] at m
    

Proof state:
s✝ t✝ : Board
m : ∃ a b, (a, b) ∈ left s✝ ∧ moveLeft s✝ (a, b) = t✝
⊢ (fun s => Finset.card s / 2) t✝ < (fun s => Finset.card s / 2) s✝

Next tactic:
rcases m with ⟨_, _, ⟨h, rfl⟩⟩
/-- The instance describing allowed moves on a Domineering board. -/
instance state : State Board where
  turnBound s := s.card / 2
  l s := (left s).image (moveLeft s)
  r s := (right s).image (moveRight s)
  left_bound m := by
    simp only [Finset.mem_image, Prod.exists] at m
    rcases m with ⟨_, _, ⟨h, rfl⟩⟩
    

Proof state:
case intro.intro.intro
s✝ : Board
w✝¹ w✝ : ℤ
h : (w✝¹, w✝) ∈ left s✝
⊢ (fun s => Finset.card s / 2) (moveLeft s✝ (w✝¹, w✝)) < (fun s => Finset.card s / 2) s✝

Next tactic:
exact moveLeft_smaller h
/-- The instance describing allowed moves on a Domineering board. -/
instance state : State Board where
  turnBound s := s.card / 2
  l s := (left s).image (moveLeft s)
  r s := (right s).image (moveRight s)
  left_bound m := by
    simp only [Finset.mem_image, Prod.exists] at m
    rcases m with ⟨_, _, ⟨h, rfl⟩⟩
    exact moveLeft_smaller h
  right_bound m := by
    

Proof state:
s✝ t✝ : Board
m : t✝ ∈ (fun s => Finset.image (moveRight s) (right s)) s✝
⊢ (fun s => Finset.card s / 2) t✝ < (fun s => Finset.card s / 2) s✝

Next tactic:
simp only [Finset.mem_image, Prod.exists] at m
/-- The instance describing allowed moves on a Domineering board. -/
instance state : State Board where
  turnBound s := s.card / 2
  l s := (left s).image (moveLeft s)
  r s := (right s).image (moveRight s)
  left_bound m := by
    simp only [Finset.mem_image, Prod.exists] at m
    rcases m with ⟨_, _, ⟨h, rfl⟩⟩
    exact moveLeft_smaller h
  right_bound m := by
    simp only [Finset.mem_image, Prod.exists] at m
    

Proof state:
s✝ t✝ : Board
m : ∃ a b, (a, b) ∈ right s✝ ∧ moveRight s✝ (a, b) = t✝
⊢ (fun s => Finset.card s / 2) t✝ < (fun s => Finset.card s / 2) s✝

Next tactic:
rcases m with ⟨_, _, ⟨h, rfl⟩⟩
/-- The instance describing allowed moves on a Domineering board. -/
instance state : State Board where
  turnBound s := s.card / 2
  l s := (left s).image (moveLeft s)
  r s := (right s).image (moveRight s)
  left_bound m := by
    simp only [Finset.mem_image, Prod.exists] at m
    rcases m with ⟨_, _, ⟨h, rfl⟩⟩
    exact moveLeft_smaller h
  right_bound m := by
    simp only [Finset.mem_image, Prod.exists] at m
    rcases m with ⟨_, _, ⟨h, rfl⟩⟩
    

Proof state:
case intro.intro.intro
s✝ : Board
w✝¹ w✝ : ℤ
h : (w✝¹, w✝) ∈ right s✝
⊢ (fun s => Finset.card s / 2) (moveRight s✝ (w✝¹, w✝)) < (fun s => Finset.card s / 2) s✝

Next tactic:
exact moveRight_smaller h
/-- All games of Domineering are short, because each move removes two squares. -/
instance shortDomineering (b : Domineering.Board) : Short (domineering b) := by
  

Proof state:
b : Domineering.Board
⊢ Short (domineering b)

Next tactic:
dsimp [domineering]
/-- All games of Domineering are short, because each move removes two squares. -/
instance shortDomineering (b : Domineering.Board) : Short (domineering b) := by
  dsimp [domineering]
  

Proof state:
b : Domineering.Board
⊢ Short (ofState b)

Next tactic:
infer_instance
instance shortOne : Short domineering.one := by 

Proof state:
⊢ Short domineering.one

Next tactic:
dsimp [domineering.one]
instance shortOne : Short domineering.one := by dsimp [domineering.one]; 

Proof state:
⊢ Short (domineering (List.toFinset [(0, 0), (0, 1)]))

Next tactic:
infer_instance
instance shortL : Short domineering.L := by 

Proof state:
⊢ Short domineering.L

Next tactic:
dsimp [domineering.L]
instance shortL : Short domineering.L := by dsimp [domineering.L]; 

Proof state:
⊢ Short (domineering (List.toFinset [(0, 2), (0, 1), (0, 0), (1, 0)]))

Next tactic:
infer_instance
@[to_additive (attr := simp)]
theorem mem_orbit_self (a : α) : a ∈ orbit M a :=
  ⟨1, by 

Proof state:
M : Type u
inst✝¹ : Monoid M
α : Type v
inst✝ : MulAction M α
a : α
⊢ (fun m => m • a) 1 = a

Next tactic:
simp [MulAction.one_smul]
@[to_additive mem_fixedPoints_iff_card_orbit_eq_one]
theorem mem_fixedPoints_iff_card_orbit_eq_one {a : α} [Fintype (orbit M a)] :
    a ∈ fixedPoints M α ↔ Fintype.card (orbit M a) = 1 := by
  

Proof state:
M : Type u
inst✝² : Monoid M
α : Type v
inst✝¹ : MulAction M α
a : α
inst✝ : Fintype ↑(orbit M a)
⊢ a ∈ fixedPoints M α ↔ Fintype.card ↑(orbit M a) = 1

Next tactic:
rw [Fintype.card_eq_one_iff, mem_fixedPoints]
@[to_additive mem_fixedPoints_iff_card_orbit_eq_one]
theorem mem_fixedPoints_iff_card_orbit_eq_one {a : α} [Fintype (orbit M a)] :
    a ∈ fixedPoints M α ↔ Fintype.card (orbit M a) = 1 := by
  rw [Fintype.card_eq_one_iff, mem_fixedPoints]
  

Proof state:
M : Type u
inst✝² : Monoid M
α : Type v
inst✝¹ : MulAction M α
a : α
inst✝ : Fintype ↑(orbit M a)
⊢ (∀ (m : M), m • a = a) ↔ ∃ x, ∀ (y : ↑(orbit M a)), y = x

Next tactic:
constructor
@[to_additive mem_fixedPoints_iff_card_orbit_eq_one]
theorem mem_fixedPoints_iff_card_orbit_eq_one {a : α} [Fintype (orbit M a)] :
    a ∈ fixedPoints M α ↔ Fintype.card (orbit M a) = 1 := by
  rw [Fintype.card_eq_one_iff, mem_fixedPoints]
  constructor
  · 

Proof state:
case mp
M : Type u
inst✝² : Monoid M
α : Type v
inst✝¹ : MulAction M α
a : α
inst✝ : Fintype ↑(orbit M a)
⊢ (∀ (m : M), m • a = a) → ∃ x, ∀ (y : ↑(orbit M a)), y = x

Next tactic:
exact fun h => ⟨⟨a, mem_orbit_self _⟩, fun ⟨a, ⟨x, hx⟩⟩ => Subtype.eq <| by simp [h x, hx.symm]⟩
@[to_additive mem_fixedPoints_iff_card_orbit_eq_one]
theorem mem_fixedPoints_iff_card_orbit_eq_one {a : α} [Fintype (orbit M a)] :
    a ∈ fixedPoints M α ↔ Fintype.card (orbit M a) = 1 := by
  rw [Fintype.card_eq_one_iff, mem_fixedPoints]
  constructor
  · exact fun h => ⟨⟨a, mem_orbit_self _⟩, fun ⟨a, ⟨x, hx⟩⟩ => Subtype.eq <| by 

Proof state:
M : Type u
inst✝² : Monoid M
α : Type v
inst✝¹ : MulAction M α
a✝ : α
inst✝ : Fintype ↑(orbit M a✝)
h : ∀ (m : M), m • a✝ = a✝
x✝ : ↑(orbit M a✝)
a : α
x : M
hx : (fun m => m • a✝) x = a
⊢ ↑{ val := a, property := (_ : ∃ y, (fun m => m • a✝) y = a) } = ↑{ val := a✝, property := (_ : a✝ ∈ orbit M a✝) }

Next tactic:
simp [h x, hx.symm]
@[to_additive mem_fixedPoints_iff_card_orbit_eq_one]
theorem mem_fixedPoints_iff_card_orbit_eq_one {a : α} [Fintype (orbit M a)] :
    a ∈ fixedPoints M α ↔ Fintype.card (orbit M a) = 1 := by
  rw [Fintype.card_eq_one_iff, mem_fixedPoints]
  constructor
  · exact fun h => ⟨⟨a, mem_orbit_self _⟩, fun ⟨a, ⟨x, hx⟩⟩ => Subtype.eq <| by simp [h x, hx.symm]⟩
  · 

Proof state:
case mpr
M : Type u
inst✝² : Monoid M
α : Type v
inst✝¹ : MulAction M α
a : α
inst✝ : Fintype ↑(orbit M a)
⊢ (∃ x, ∀ (y : ↑(orbit M a)), y = x) → ∀ (m : M), m • a = a

Next tactic:
intro h x
@[to_additive mem_fixedPoints_iff_card_orbit_eq_one]
theorem mem_fixedPoints_iff_card_orbit_eq_one {a : α} [Fintype (orbit M a)] :
    a ∈ fixedPoints M α ↔ Fintype.card (orbit M a) = 1 := by
  rw [Fintype.card_eq_one_iff, mem_fixedPoints]
  constructor
  · exact fun h => ⟨⟨a, mem_orbit_self _⟩, fun ⟨a, ⟨x, hx⟩⟩ => Subtype.eq <| by simp [h x, hx.symm]⟩
  · intro h x
    

Proof state:
case mpr
M : Type u
inst✝² : Monoid M
α : Type v
inst✝¹ : MulAction M α
a : α
inst✝ : Fintype ↑(orbit M a)
h : ∃ x, ∀ (y : ↑(orbit M a)), y = x
x : M
⊢ x • a = a

Next tactic:
rcases h with ⟨⟨z, hz⟩, hz₁⟩
@[to_additive mem_fixedPoints_iff_card_orbit_eq_one]
theorem mem_fixedPoints_iff_card_orbit_eq_one {a : α} [Fintype (orbit M a)] :
    a ∈ fixedPoints M α ↔ Fintype.card (orbit M a) = 1 := by
  rw [Fintype.card_eq_one_iff, mem_fixedPoints]
  constructor
  · exact fun h => ⟨⟨a, mem_orbit_self _⟩, fun ⟨a, ⟨x, hx⟩⟩ => Subtype.eq <| by simp [h x, hx.symm]⟩
  · intro h x
    rcases h with ⟨⟨z, hz⟩, hz₁⟩
    

Proof state:
case mpr.intro.mk
M : Type u
inst✝² : Monoid M
α : Type v
inst✝¹ : MulAction M α
a : α
inst✝ : Fintype ↑(orbit M a)
x : M
z : α
hz : z ∈ orbit M a
hz₁ : ∀ (y : ↑(orbit M a)), y = { val := z, property := hz }
⊢ x • a = a

Next tactic:
calc
      x • a = z := Subtype.mk.inj (hz₁ ⟨x • a, mem_orbit _ _⟩)
      _ = a := (Subtype.mk.inj (hz₁ ⟨a, mem_orbit_self _⟩)).symm
/-- The stabilizer of a point `a` as a submonoid of `M`. -/
@[to_additive "The stabilizer of a point `a` as an additive submonoid of `M`."]
def stabilizerSubmonoid (a : α) : Submonoid M where
  carrier := { m | m • a = a }
  one_mem' := one_smul _ a
  mul_mem' {m m'} (ha : m • a = a) (hb : m' • a = a) :=
    show (m * m') • a = a by 

Proof state:
M : Type u
inst✝¹ : Monoid M
α : Type v
inst✝ : MulAction M α
a : α
m m' : M
ha : m • a = a
hb : m' • a = a
⊢ (m * m') • a = a

Next tactic:
rw [← smul_smul, hb, ha]
/-- `smul` by a `k : M` over a ring is injective, if `k` is not a zero divisor.
The general theory of such `k` is elaborated by `IsSMulRegular`.
The typeclass that restricts all terms of `M` to have this property is `NoZeroSMulDivisors`. -/
theorem smul_cancel_of_non_zero_divisor {M R : Type*} [Monoid M] [NonUnitalNonAssocRing R]
    [DistribMulAction M R] (k : M) (h : ∀ x : R, k • x = 0 → x = 0) {a b : R} (h' : k • a = k • b) :
    a = b := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝² : Monoid M
inst✝¹ : NonUnitalNonAssocRing R
inst✝ : DistribMulAction M R
k : M
h : ∀ (x : R), k • x = 0 → x = 0
a b : R
h' : k • a = k • b
⊢ a = b

Next tactic:
rw [← sub_eq_zero]
/-- `smul` by a `k : M` over a ring is injective, if `k` is not a zero divisor.
The general theory of such `k` is elaborated by `IsSMulRegular`.
The typeclass that restricts all terms of `M` to have this property is `NoZeroSMulDivisors`. -/
theorem smul_cancel_of_non_zero_divisor {M R : Type*} [Monoid M] [NonUnitalNonAssocRing R]
    [DistribMulAction M R] (k : M) (h : ∀ x : R, k • x = 0 → x = 0) {a b : R} (h' : k • a = k • b) :
    a = b := by
  rw [← sub_eq_zero]
  

Proof state:
M : Type u_1
R : Type u_2
inst✝² : Monoid M
inst✝¹ : NonUnitalNonAssocRing R
inst✝ : DistribMulAction M R
k : M
h : ∀ (x : R), k • x = 0 → x = 0
a b : R
h' : k • a = k • b
⊢ a - b = 0

Next tactic:
refine' h _ _
/-- `smul` by a `k : M` over a ring is injective, if `k` is not a zero divisor.
The general theory of such `k` is elaborated by `IsSMulRegular`.
The typeclass that restricts all terms of `M` to have this property is `NoZeroSMulDivisors`. -/
theorem smul_cancel_of_non_zero_divisor {M R : Type*} [Monoid M] [NonUnitalNonAssocRing R]
    [DistribMulAction M R] (k : M) (h : ∀ x : R, k • x = 0 → x = 0) {a b : R} (h' : k • a = k • b) :
    a = b := by
  rw [← sub_eq_zero]
  refine' h _ _
  

Proof state:
M : Type u_1
R : Type u_2
inst✝² : Monoid M
inst✝¹ : NonUnitalNonAssocRing R
inst✝ : DistribMulAction M R
k : M
h : ∀ (x : R), k • x = 0 → x = 0
a b : R
h' : k • a = k • b
⊢ k • (a - b) = 0

Next tactic:
rw [smul_sub, h', sub_self]
@[to_additive (attr := simp)]
theorem orbit_smul (g : G) (a : α) : orbit G (g • a) = orbit G a :=
  (orbit_smul_subset g a).antisymm <|
    calc
      orbit G a = orbit G (g⁻¹ • g • a) := by 

Proof state:
G : Type u
inst✝¹ : Group G
α : Type v
inst✝ : MulAction G α
g : G
a : α
⊢ orbit G a = orbit G (g⁻¹ • g • a)

Next tactic:
rw [inv_smul_smul]
/-- The action of a group on an orbit is transitive. -/
@[to_additive "The action of an additive group on an orbit is transitive."]
instance (a : α) : IsPretransitive G (orbit G a) :=
  ⟨by
    

Proof state:
G : Type u
inst✝¹ : Group G
α : Type v
inst✝ : MulAction G α
a : α
⊢ ∀ (x y : ↑(orbit G a)), ∃ g, g • x = y

Next tactic:
rintro ⟨_, g, rfl⟩ ⟨_, h, rfl⟩
/-- The action of a group on an orbit is transitive. -/
@[to_additive "The action of an additive group on an orbit is transitive."]
instance (a : α) : IsPretransitive G (orbit G a) :=
  ⟨by
    rintro ⟨_, g, rfl⟩ ⟨_, h, rfl⟩
    

Proof state:
case mk.intro.mk.intro
G : Type u
inst✝¹ : Group G
α : Type v
inst✝ : MulAction G α
a : α
g h : G
⊢ ∃ g_1,
    g_1 • { val := (fun m => m • a) g, property := (_ : ∃ y, (fun m => m • a) y = (fun m => m • a) g) } =
      { val := (fun m => m • a) h, property := (_ : ∃ y, (fun m => m • a) y = (fun m => m • a) h) }

Next tactic:
use h * g⁻¹
/-- The action of a group on an orbit is transitive. -/
@[to_additive "The action of an additive group on an orbit is transitive."]
instance (a : α) : IsPretransitive G (orbit G a) :=
  ⟨by
    rintro ⟨_, g, rfl⟩ ⟨_, h, rfl⟩
    use h * g⁻¹
    

Proof state:
case h
G : Type u
inst✝¹ : Group G
α : Type v
inst✝ : MulAction G α
a : α
g h : G
⊢ (h * g⁻¹) • { val := (fun m => m • a) g, property := (_ : ∃ y, (fun m => m • a) y = (fun m => m • a) g) } =
    { val := (fun m => m • a) h, property := (_ : ∃ y, (fun m => m • a) y = (fun m => m • a) h) }

Next tactic:
ext1
/-- The action of a group on an orbit is transitive. -/
@[to_additive "The action of an additive group on an orbit is transitive."]
instance (a : α) : IsPretransitive G (orbit G a) :=
  ⟨by
    rintro ⟨_, g, rfl⟩ ⟨_, h, rfl⟩
    use h * g⁻¹
    ext1
    

Proof state:
case h.a
G : Type u
inst✝¹ : Group G
α : Type v
inst✝ : MulAction G α
a : α
g h : G
⊢ ↑((h * g⁻¹) • { val := (fun m => m • a) g, property := (_ : ∃ y, (fun m => m • a) y = (fun m => m • a) g) }) =
    ↑{ val := (fun m => m • a) h, property := (_ : ∃ y, (fun m => m • a) y = (fun m => m • a) h) }

Next tactic:
simp [mul_smul]
@[to_additive]
theorem mem_orbit_smul (g : G) (a : α) : a ∈ orbit G (g • a) := by
  

Proof state:
G : Type u
inst✝¹ : Group G
α : Type v
inst✝ : MulAction G α
g : G
a : α
⊢ a ∈ orbit G (g • a)

Next tactic:
simp only [orbit_smul, mem_orbit_self]
@[to_additive]
theorem smul_mem_orbit_smul (g h : G) (a : α) : g • a ∈ orbit G (h • a) := by
  

Proof state:
G : Type u
inst✝¹ : Group G
α : Type v
inst✝ : MulAction G α
g h : G
a : α
⊢ g • a ∈ orbit G (h • a)

Next tactic:
simp only [orbit_smul, mem_orbit]