Theorem: span_gcd
File: Mathlib/RingTheory/PrincipalIdealDomain.lean

tactic: obtain ⟨d, hd⟩ := IsPrincipalIdealRing.principal (span ({x, y} : Set R))
state_before: R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y : R
⊢ Ideal.span {gcd x y} = Ideal.span {x, y}

tactic: rw [submodule_span_eq] at hd
state_before: case mk.intro
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Submodule.span R {d}
⊢ Ideal.span {gcd x y} = Ideal.span {x, y}

tactic: rw [hd]
state_before: case mk.intro
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
⊢ Ideal.span {gcd x y} = Ideal.span {x, y}

tactic: suffices Associated d (gcd x y) by
  obtain ⟨D, HD⟩ := this
  rw [← HD]
  exact span_singleton_mul_right_unit D.isUnit _
state_before: case mk.intro
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
⊢ Ideal.span {gcd x y} = Ideal.span {d}

tactic: apply associated_of_dvd_dvd
state_before: case mk.intro
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
⊢ Associated d (gcd x y)

tactic: obtain ⟨D, HD⟩ := this
state_before: R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
this : Associated d (gcd x y)
⊢ Ideal.span {gcd x y} = Ideal.span {d}

tactic: rw [← HD]
state_before: case intro
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
D : Rˣ
HD : d * ↑D = gcd x y
⊢ Ideal.span {gcd x y} = Ideal.span {d}

tactic: exact span_singleton_mul_right_unit D.isUnit _
state_before: case intro
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
D : Rˣ
HD : d * ↑D = gcd x y
⊢ Ideal.span {d * ↑D} = Ideal.span {d}

tactic: rw [dvd_gcd_iff]
state_before: case mk.intro.hab
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
⊢ d ∣ gcd x y

tactic: constructor <;> rw [← Ideal.mem_span_singleton, ← hd, Ideal.mem_span_pair]
state_before: case mk.intro.hab
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
⊢ d ∣ x ∧ d ∣ y

tactic: use 1, 0
state_before: case mk.intro.hab.left
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
⊢ ∃ a b, a * x + b * y = x

tactic: rw [one_mul, MulZeroClass.zero_mul, add_zero]
state_before: case mk.intro.hab.left
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
⊢ 1 * x + 0 * y = x

tactic: use 0, 1
state_before: case mk.intro.hab.right
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
⊢ ∃ a b, a * x + b * y = y

tactic: rw [one_mul, MulZeroClass.zero_mul, zero_add]
state_before: case mk.intro.hab.right
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
⊢ 0 * x + 1 * y = y

tactic: obtain ⟨r, s, rfl⟩ : ∃ r s, r * x + s * y = d := by
  rw [← Ideal.mem_span_pair, hd, Ideal.mem_span_singleton]
state_before: case mk.intro.hba
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
⊢ gcd x y ∣ d

tactic: apply dvd_add <;> apply dvd_mul_of_dvd_right
state_before: case mk.intro.hba.intro.intro
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y r s : R
hd : Ideal.span {x, y} = Ideal.span {r * x + s * y}
⊢ gcd x y ∣ r * x + s * y

tactic: exacts [gcd_dvd_left x y, gcd_dvd_right x y]
state_before: case mk.intro.hba.intro.intro.h₁.h
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y r s : R
hd : Ideal.span {x, y} = Ideal.span {r * x + s * y}
⊢ gcd x y ∣ x

case mk.intro.hba.intro.intro.h₂.h
R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y r s : R
hd : Ideal.span {x, y} = Ideal.span {r * x + s * y}
⊢ gcd x y ∣ y

tactic: rw [← Ideal.mem_span_pair, hd, Ideal.mem_span_singleton]
state_before: R : Type u
M : Type v
inst✝³ : CommRing R
inst✝² : IsDomain R
inst✝¹ : IsPrincipalIdealRing R
inst✝ : GCDMonoid R
x y d : R
hd : Ideal.span {x, y} = Ideal.span {d}
⊢ ∃ r s, r * x + s * y = d