Theorem: ModularGroup.bottom_row_surj
File: Mathlib/NumberTheory/Modular.lean

tactic: rintro cd ⟨b₀, a, gcd_eqn⟩
state_before: g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
⊢ Set.SurjOn (fun g => ↑g 1) Set.univ {cd | IsCoprime (cd 0) (cd 1)}
state_after: case intro.intro
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
⊢ cd ∈ (fun g => ↑g 1) '' Set.univ

tactic: let A := of ![![a, -b₀], cd]
state_before: case intro.intro
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
⊢ cd ∈ (fun g => ↑g 1) '' Set.univ
state_after: case intro.intro
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
⊢ cd ∈ (fun g => ↑g 1) '' Set.univ

tactic: have det_A_1 : det A = 1 := by
  convert gcd_eqn
  rw [det_fin_two]
  simp [A, (by ring : a * cd 1 + b₀ * cd 0 = b₀ * cd 0 + a * cd 1)]
state_before: case intro.intro
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
⊢ cd ∈ (fun g => ↑g 1) '' Set.univ
state_after: case intro.intro
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
det_A_1 : A.det = 1
⊢ cd ∈ (fun g => ↑g 1) '' Set.univ

tactic: refine ⟨⟨A, det_A_1⟩, Set.mem_univ _, ?_⟩
state_before: case intro.intro
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
det_A_1 : A.det = 1
⊢ cd ∈ (fun g => ↑g 1) '' Set.univ
state_after: case intro.intro
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
det_A_1 : A.det = 1
⊢ (fun g => ↑g 1) ⟨A, det_A_1⟩ = cd

tactic: ext
state_before: case intro.intro
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
det_A_1 : A.det = 1
⊢ (fun g => ↑g 1) ⟨A, det_A_1⟩ = cd
state_after: case intro.intro.h
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
det_A_1 : A.det = 1
x✝ : Fin 2
⊢ (fun g => ↑g 1) ⟨A, det_A_1⟩ x✝ = cd x✝

tactic: simp [A]
state_before: case intro.intro.h
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
det_A_1 : A.det = 1
x✝ : Fin 2
⊢ (fun g => ↑g 1) ⟨A, det_A_1⟩ x✝ = cd x✝
state_after: no goals

tactic: convert gcd_eqn
state_before: g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
⊢ A.det = 1
state_after: case h.e'_2
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
⊢ A.det = b₀ * cd 0 + a * cd 1

tactic: rw [det_fin_two]
state_before: case h.e'_2
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
⊢ A.det = b₀ * cd 0 + a * cd 1
state_after: case h.e'_2
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
⊢ A 0 0 * A 1 1 - A 0 1 * A 1 0 = b₀ * cd 0 + a * cd 1

tactic: simp [A, (by ring : a * cd 1 + b₀ * cd 0 = b₀ * cd 0 + a * cd 1)]
state_before: case h.e'_2
g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
⊢ A 0 0 * A 1 1 - A 0 1 * A 1 0 = b₀ * cd 0 + a * cd 1
state_after: no goals

tactic: ring
state_before: g : SL(2, ℤ)
z : ℍ
R : Type u_1
inst✝ : CommRing R
cd : Fin 2 → R
b₀ a : R
gcd_eqn : b₀ * cd 0 + a * cd 1 = 1
A : Matrix (Fin (Nat.succ 0).succ) (Fin (Nat.succ 0).succ) R := of ![![a, -b₀], cd]
⊢ a * cd 1 + b₀ * cd 0 = b₀ * cd 0 + a * cd 1
state_after: no goals