[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n : ℤ
⊢ IsCoprime m n ↔ gcd m n = 1
[PROOFSTEP]
constructor
[GOAL]
case mp
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n : ℤ
⊢ IsCoprime m n → gcd m n = 1
[PROOFSTEP]
rintro ⟨a, b, h⟩
[GOAL]
case mp.intro.intro
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n a b : ℤ
h : a * m + b * n = 1
⊢ gcd m n = 1
[PROOFSTEP]
have : 1 = m * a + n * b := by rwa [mul_comm m, mul_comm n, eq_comm]
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n a b : ℤ
h : a * m + b * n = 1
⊢ 1 = m * a + n * b
[PROOFSTEP]
rwa [mul_comm m, mul_comm n, eq_comm]
[GOAL]
case mp.intro.intro
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n a b : ℤ
h : a * m + b * n = 1
this : 1 = m * a + n * b
⊢ gcd m n = 1
[PROOFSTEP]
exact Nat.dvd_one.mp (Int.gcd_dvd_iff.mpr ⟨a, b, this⟩)
[GOAL]
case mpr
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n : ℤ
⊢ gcd m n = 1 → IsCoprime m n
[PROOFSTEP]
rw [← Int.ofNat_inj, IsCoprime, Int.gcd_eq_gcd_ab, mul_comm m, mul_comm n, Nat.cast_one]
[GOAL]
case mpr
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n : ℤ
⊢ gcdA m n * m + gcdB m n * n = 1 → ∃ a b, a * m + b * n = 1
[PROOFSTEP]
intro h
[GOAL]
case mpr
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n : ℤ
h : gcdA m n * m + gcdB m n * n = 1
⊢ ∃ a b, a * m + b * n = 1
[PROOFSTEP]
exact ⟨_, _, h⟩
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n : ℕ
⊢ IsCoprime ↑m ↑n ↔ coprime m n
[PROOFSTEP]
rw [Int.isCoprime_iff_gcd_eq_one, Int.coe_nat_gcd]
[GOAL]
R : Type u
I : Type v
inst✝² : CommSemiring R
x y z : R
s : I → R
t : Finset I
A : Type u
inst✝¹ : CommRing A
inst✝ : Nontrivial A
a b : ℕ
h : Nat.coprime a b
⊢ IsCoprime ↑a ↑b
[PROOFSTEP]
simpa only [map_natCast] using IsCoprime.map (Nat.coprime.isCoprime h) (Int.castRingHom A)
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
b : I
t : Finset I
hbt : ¬b ∈ t
ih : (∀ (i : I), i ∈ t → IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x
H : ∀ (i : I), i ∈ insert b t → IsCoprime (s i) x
⊢ IsCoprime (∏ i in insert b t, s i) x
[PROOFSTEP]
rw [Finset.prod_insert hbt]
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
b : I
t : Finset I
hbt : ¬b ∈ t
ih : (∀ (i : I), i ∈ t → IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x
H : ∀ (i : I), i ∈ insert b t → IsCoprime (s i) x
⊢ IsCoprime (s b * ∏ x in t, s x) x
[PROOFSTEP]
rw [Finset.forall_mem_insert] at H 
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
b : I
t : Finset I
hbt : ¬b ∈ t
ih : (∀ (i : I), i ∈ t → IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x
H : IsCoprime (s b) x ∧ ∀ (x_1 : I), x_1 ∈ t → IsCoprime (s x_1) x
⊢ IsCoprime (s b * ∏ x in t, s x) x
[PROOFSTEP]
exact H.1.mul_left (ih H.2)
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
⊢ (∀ (i : I), i ∈ t → IsCoprime x (s i)) → IsCoprime x (∏ i in t, s i)
[PROOFSTEP]
simpa only [isCoprime_comm] using IsCoprime.prod_left (R := R)
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
x✝ : I
⊢ x✝ ∈ ∅ → IsCoprime (s x✝) x
[PROOFSTEP]
simp
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
b : I
t : Finset I
hbt : ¬b ∈ t
ih : IsCoprime (∏ i in t, s i) x ↔ ∀ (i : I), i ∈ t → IsCoprime (s i) x
⊢ IsCoprime (∏ i in insert b t, s i) x ↔ ∀ (i : I), i ∈ insert b t → IsCoprime (s i) x
[PROOFSTEP]
rw [Finset.prod_insert hbt, IsCoprime.mul_left_iff, ih, Finset.forall_mem_insert]
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
⊢ IsCoprime x (∏ i in t, s i) ↔ ∀ (i : I), i ∈ t → IsCoprime x (s i)
[PROOFSTEP]
simpa only [isCoprime_comm] using IsCoprime.prod_left_iff (R := R)
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
⊢ ∀ ⦃a : I⦄ {s_1 : Finset I},
    ¬a ∈ s_1 →
      (Set.Pairwise (↑s_1) (IsCoprime on s) → (∀ (i : I), i ∈ s_1 → s i ∣ z) → ∏ x in s_1, s x ∣ z) →
        Set.Pairwise (↑(insert a s_1)) (IsCoprime on s) →
          (∀ (i : I), i ∈ insert a s_1 → s i ∣ z) → ∏ x in insert a s_1, s x ∣ z
[PROOFSTEP]
intro a r har ih Hs Hs1
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
a : I
r : Finset I
har : ¬a ∈ r
ih : Set.Pairwise (↑r) (IsCoprime on s) → (∀ (i : I), i ∈ r → s i ∣ z) → ∏ x in r, s x ∣ z
Hs : Set.Pairwise (↑(insert a r)) (IsCoprime on s)
Hs1 : ∀ (i : I), i ∈ insert a r → s i ∣ z
⊢ ∏ x in insert a r, s x ∣ z
[PROOFSTEP]
rw [Finset.prod_insert har]
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
a : I
r : Finset I
har : ¬a ∈ r
ih : Set.Pairwise (↑r) (IsCoprime on s) → (∀ (i : I), i ∈ r → s i ∣ z) → ∏ x in r, s x ∣ z
Hs : Set.Pairwise (↑(insert a r)) (IsCoprime on s)
Hs1 : ∀ (i : I), i ∈ insert a r → s i ∣ z
⊢ s a * ∏ x in r, s x ∣ z
[PROOFSTEP]
have aux1 : a ∈ (↑(insert a r) : Set I) := Finset.mem_insert_self a r
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
a : I
r : Finset I
har : ¬a ∈ r
ih : Set.Pairwise (↑r) (IsCoprime on s) → (∀ (i : I), i ∈ r → s i ∣ z) → ∏ x in r, s x ∣ z
Hs : Set.Pairwise (↑(insert a r)) (IsCoprime on s)
Hs1 : ∀ (i : I), i ∈ insert a r → s i ∣ z
aux1 : a ∈ ↑(insert a r)
⊢ s a * ∏ x in r, s x ∣ z
[PROOFSTEP]
refine'
  (IsCoprime.prod_right fun i hir ↦
        Hs aux1 (Finset.mem_insert_of_mem hir) <| by
          rintro rfl
          exact har hir).mul_dvd
    (Hs1 a aux1) (ih (Hs.mono _) fun i hi ↦ Hs1 i <| Finset.mem_insert_of_mem hi)
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
a : I
r : Finset I
har : ¬a ∈ r
ih : Set.Pairwise (↑r) (IsCoprime on s) → (∀ (i : I), i ∈ r → s i ∣ z) → ∏ x in r, s x ∣ z
Hs : Set.Pairwise (↑(insert a r)) (IsCoprime on s)
Hs1 : ∀ (i : I), i ∈ insert a r → s i ∣ z
aux1 : a ∈ ↑(insert a r)
i : I
hir : i ∈ r
⊢ a ≠ i
[PROOFSTEP]
rintro rfl
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
a : I
r : Finset I
har : ¬a ∈ r
ih : Set.Pairwise (↑r) (IsCoprime on s) → (∀ (i : I), i ∈ r → s i ∣ z) → ∏ x in r, s x ∣ z
Hs : Set.Pairwise (↑(insert a r)) (IsCoprime on s)
Hs1 : ∀ (i : I), i ∈ insert a r → s i ∣ z
aux1 : a ∈ ↑(insert a r)
hir : a ∈ r
⊢ False
[PROOFSTEP]
exact har hir
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
a : I
r : Finset I
har : ¬a ∈ r
ih : Set.Pairwise (↑r) (IsCoprime on s) → (∀ (i : I), i ∈ r → s i ∣ z) → ∏ x in r, s x ∣ z
Hs : Set.Pairwise (↑(insert a r)) (IsCoprime on s)
Hs1 : ∀ (i : I), i ∈ insert a r → s i ∣ z
aux1 : a ∈ ↑(insert a r)
⊢ ↑r ⊆ ↑(insert a r)
[PROOFSTEP]
simp only [Finset.coe_insert, Set.subset_insert]
[GOAL]
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝ : DecidableEq I
h : Finset.Nonempty t
⊢ (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
[PROOFSTEP]
refine' h.cons_induction _ _
[GOAL]
case refine'_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝ : DecidableEq I
h : Finset.Nonempty t
⊢ ∀ (a : I), (∃ μ, ∑ i in {a}, μ i * ∏ j in {a} \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
[PROOFSTEP]
simp only [sum_singleton, Finset.sdiff_self, prod_empty, mul_one, exists_apply_eq, Pairwise, Ne.def, true_iff_iff]
[GOAL]
case refine'_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝ : DecidableEq I
h : Finset.Nonempty t
⊢ ∀ (a : I) ⦃i j : { x // x ∈ {a} }⦄, ¬i = j → (IsCoprime on fun i => s ↑i) i j
[PROOFSTEP]
rintro a ⟨i, hi⟩ ⟨j, hj⟩ h
[GOAL]
case refine'_1.mk.mk
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t
a i : I
hi : i ∈ {a}
j : I
hj : j ∈ {a}
h : ¬{ val := i, property := hi } = { val := j, property := hj }
⊢ (IsCoprime on fun i => s ↑i) { val := i, property := hi } { val := j, property := hj }
[PROOFSTEP]
rw [Finset.mem_singleton] at hi hj 
[GOAL]
case refine'_1.mk.mk
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t
a i : I
hi✝ : i ∈ {a}
hi : i = a
j : I
hj✝ : j ∈ {a}
hj : j = a
h : ¬{ val := i, property := hi✝ } = { val := j, property := hj✝ }
⊢ (IsCoprime on fun i => s ↑i) { val := i, property := hi✝ } { val := j, property := hj✝ }
[PROOFSTEP]
simp [hi, hj] at h 
[GOAL]
case refine'_2
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝ : DecidableEq I
h : Finset.Nonempty t
⊢ ∀ ⦃a : I⦄ (s_1 : Finset I) (h : ¬a ∈ s_1),
    Finset.Nonempty s_1 →
      ((∃ μ, ∑ i in s_1, μ i * ∏ j in s_1 \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)) →
        ((∃ μ, ∑ i in cons a s_1 h, μ i * ∏ j in cons a s_1 h \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i))
[PROOFSTEP]
intro a t hat h ih
[GOAL]
case refine'_2
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
⊢ (∃ μ, ∑ i in cons a t hat, μ i * ∏ j in cons a t hat \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
[PROOFSTEP]
rw [pairwise_cons']
[GOAL]
case refine'_2
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
⊢ (∃ μ, ∑ i in cons a t hat, μ i * ∏ j in cons a t hat \ {i}, s j = 1) ↔
    Pairwise (IsCoprime on fun a => s ↑a) ∧ ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
[PROOFSTEP]
have mem : ∀ x ∈ t, a ∈ insert a t \ { x } := fun x hx ↦
  by
  rw [mem_sdiff, mem_singleton]
  refine ⟨mem_insert_self _ _, fun ha ↦ hat (ha ▸ hx)⟩
[GOAL]
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
x : I
hx : x ∈ t
⊢ a ∈ insert a t \ {x}
[PROOFSTEP]
rw [mem_sdiff, mem_singleton]
[GOAL]
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
x : I
hx : x ∈ t
⊢ a ∈ insert a t ∧ ¬a = x
[PROOFSTEP]
refine ⟨mem_insert_self _ _, fun ha ↦ hat (ha ▸ hx)⟩
[GOAL]
case refine'_2
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
⊢ (∃ μ, ∑ i in cons a t hat, μ i * ∏ j in cons a t hat \ {i}, s j = 1) ↔
    Pairwise (IsCoprime on fun a => s ↑a) ∧ ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
[PROOFSTEP]
constructor
[GOAL]
case refine'_2.mp
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
⊢ (∃ μ, ∑ i in cons a t hat, μ i * ∏ j in cons a t hat \ {i}, s j = 1) →
    Pairwise (IsCoprime on fun a => s ↑a) ∧ ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
[PROOFSTEP]
rintro ⟨μ, hμ⟩
[GOAL]
case refine'_2.mp.intro
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ : ∑ i in cons a t hat, μ i * ∏ j in cons a t hat \ {i}, s j = 1
⊢ Pairwise (IsCoprime on fun a => s ↑a) ∧ ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
[PROOFSTEP]
rw [sum_cons, cons_eq_insert, sdiff_singleton_eq_erase, erase_insert hat] at hμ 
[GOAL]
case refine'_2.mp.intro
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ : μ a * ∏ j in t, s j + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
⊢ Pairwise (IsCoprime on fun a => s ↑a) ∧ ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
[PROOFSTEP]
refine' ⟨ih.mp ⟨Pi.single h.choose (μ a * s h.choose) + μ * fun _ ↦ s a, ?_⟩, fun b hb ↦ ?_⟩
[GOAL]
case refine'_2.mp.intro.refine'_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ : μ a * ∏ j in t, s j + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
⊢ ∑ i in t, (Pi.single (Exists.choose h) (μ a * s (Exists.choose h)) + μ * fun x => s a) i * ∏ j in t \ {i}, s j = 1
[PROOFSTEP]
rw [prod_eq_mul_prod_diff_singleton h.choose_spec, ← mul_assoc, ← @if_pos _ _ h.choose_spec R (_ * _) 0, ←
  sum_pi_single', ← sum_add_distrib] at hμ 
[GOAL]
case refine'_2.mp.intro.refine'_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝¹ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ✝ : μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
hμ :
  ∑ x in t,
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
        μ x * ∏ j in insert a t \ {x}, s j) =
    1
⊢ ∑ i in t, (Pi.single (Exists.choose h) (μ a * s (Exists.choose h)) + μ * fun x => s a) i * ∏ j in t \ {i}, s j = 1
[PROOFSTEP]
rw [← hμ, sum_congr rfl]
[GOAL]
case refine'_2.mp.intro.refine'_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝¹ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ✝ : μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
hμ :
  ∑ x in t,
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
        μ x * ∏ j in insert a t \ {x}, s j) =
    1
⊢ ∀ (x : I),
    x ∈ t →
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h)) + μ * fun x => s a) x * ∏ j in t \ {x}, s j =
        Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
          μ x * ∏ j in insert a t \ {x}, s j
[PROOFSTEP]
intro x hx
[GOAL]
case refine'_2.mp.intro.refine'_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝¹ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ✝ : μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
hμ :
  ∑ x in t,
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
        μ x * ∏ j in insert a t \ {x}, s j) =
    1
x : I
hx : x ∈ t
⊢ (Pi.single (Exists.choose h) (μ a * s (Exists.choose h)) + μ * fun x => s a) x * ∏ j in t \ {x}, s j =
    Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
      μ x * ∏ j in insert a t \ {x}, s j
[PROOFSTEP]
dsimp
  -- porting note: terms were showing as sort of `HAdd.hadd` instead of `+`
        -- this whole proof pretty much breaks and has to be rewritten from scratch
[GOAL]
case refine'_2.mp.intro.refine'_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝¹ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ✝ : μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
hμ :
  ∑ x in t,
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
        μ x * ∏ j in insert a t \ {x}, s j) =
    1
x : I
hx : x ∈ t
⊢ (Pi.single (Exists.choose h) (μ a * s (Exists.choose h)) x + μ x * s a) * ∏ j in t \ {x}, s j =
    Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
      μ x * ∏ j in insert a t \ {x}, s j
[PROOFSTEP]
rw [add_mul]
[GOAL]
case refine'_2.mp.intro.refine'_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝¹ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ✝ : μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
hμ :
  ∑ x in t,
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
        μ x * ∏ j in insert a t \ {x}, s j) =
    1
x : I
hx : x ∈ t
⊢ Pi.single (Exists.choose h) (μ a * s (Exists.choose h)) x * ∏ j in t \ {x}, s j + μ x * s a * ∏ j in t \ {x}, s j =
    Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
      μ x * ∏ j in insert a t \ {x}, s j
[PROOFSTEP]
congr 1
[GOAL]
case refine'_2.mp.intro.refine'_1.e_a
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝¹ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ✝ : μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
hμ :
  ∑ x in t,
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
        μ x * ∏ j in insert a t \ {x}, s j) =
    1
x : I
hx : x ∈ t
⊢ Pi.single (Exists.choose h) (μ a * s (Exists.choose h)) x * ∏ j in t \ {x}, s j =
    Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x
[PROOFSTEP]
by_cases hx : x = h.choose
[GOAL]
case pos
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝¹ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ✝ : μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
hμ :
  ∑ x in t,
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
        μ x * ∏ j in insert a t \ {x}, s j) =
    1
x : I
hx✝ : x ∈ t
hx : x = Exists.choose h
⊢ Pi.single (Exists.choose h) (μ a * s (Exists.choose h)) x * ∏ j in t \ {x}, s j =
    Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x
[PROOFSTEP]
rw [hx, Pi.single_eq_same, Pi.single_eq_same]
[GOAL]
case neg
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝¹ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ✝ : μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
hμ :
  ∑ x in t,
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
        μ x * ∏ j in insert a t \ {x}, s j) =
    1
x : I
hx✝ : x ∈ t
hx : ¬x = Exists.choose h
⊢ Pi.single (Exists.choose h) (μ a * s (Exists.choose h)) x * ∏ j in t \ {x}, s j =
    Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x
[PROOFSTEP]
rw [Pi.single_eq_of_ne hx, Pi.single_eq_of_ne hx, zero_mul]
[GOAL]
case refine'_2.mp.intro.refine'_1.e_a
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝¹ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ✝ : μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
hμ :
  ∑ x in t,
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
        μ x * ∏ j in insert a t \ {x}, s j) =
    1
x : I
hx : x ∈ t
⊢ μ x * s a * ∏ j in t \ {x}, s j = μ x * ∏ j in insert a t \ {x}, s j
[PROOFSTEP]
rw [mul_assoc]
[GOAL]
case refine'_2.mp.intro.refine'_1.e_a
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝¹ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ✝ : μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
hμ :
  ∑ x in t,
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
        μ x * ∏ j in insert a t \ {x}, s j) =
    1
x : I
hx : x ∈ t
⊢ μ x * (s a * ∏ j in t \ {x}, s j) = μ x * ∏ j in insert a t \ {x}, s j
[PROOFSTEP]
congr
[GOAL]
case refine'_2.mp.intro.refine'_1.e_a.e_a
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝¹ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ✝ : μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
hμ :
  ∑ x in t,
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
        μ x * ∏ j in insert a t \ {x}, s j) =
    1
x : I
hx : x ∈ t
⊢ s a * ∏ j in t \ {x}, s j = ∏ j in insert a t \ {x}, s j
[PROOFSTEP]
rw [prod_eq_prod_diff_singleton_mul (mem x hx) _, mul_comm]
[GOAL]
case refine'_2.mp.intro.refine'_1.e_a.e_a
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝¹ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ✝ : μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
hμ :
  ∑ x in t,
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
        μ x * ∏ j in insert a t \ {x}, s j) =
    1
x : I
hx : x ∈ t
⊢ (∏ j in t \ {x}, s j) * s a = (∏ x in (insert a t \ {x}) \ {a}, s x) * s a
[PROOFSTEP]
congr 2
[GOAL]
case refine'_2.mp.intro.refine'_1.e_a.e_a.e_a.e_s
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝¹ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ✝ : μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
hμ :
  ∑ x in t,
      (Pi.single (Exists.choose h) (μ a * s (Exists.choose h) * ∏ x in t \ {Exists.choose h}, s x) x +
        μ x * ∏ j in insert a t \ {x}, s j) =
    1
x : I
hx : x ∈ t
⊢ t \ {x} = (insert a t \ {x}) \ {a}
[PROOFSTEP]
rw [sdiff_sdiff_comm, sdiff_singleton_eq_erase a, erase_insert hat]
[GOAL]
case refine'_2.mp.intro.refine'_2
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ : μ a * ∏ j in t, s j + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
b : I
hb : b ∈ t
⊢ IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
[PROOFSTEP]
have : IsCoprime (s b) (s a) := ⟨μ a * ∏ i in t \ { b }, s i, ∑ i in t, μ i * ∏ j in t \ { i }, s j, ?_⟩
[GOAL]
case refine'_2.mp.intro.refine'_2.refine_2
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ : μ a * ∏ j in t, s j + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
b : I
hb : b ∈ t
this : IsCoprime (s b) (s a)
⊢ IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
[PROOFSTEP]
exact ⟨this.symm, this⟩
[GOAL]
case refine'_2.mp.intro.refine'_2.refine_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ : μ a * ∏ j in t, s j + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
b : I
hb : b ∈ t
⊢ (μ a * ∏ i in t \ {b}, s i) * s b + (∑ i in t, μ i * ∏ j in t \ {i}, s j) * s a = 1
[PROOFSTEP]
rw [mul_assoc, ← prod_eq_prod_diff_singleton_mul hb, sum_mul, ← hμ, sum_congr rfl]
[GOAL]
case refine'_2.mp.intro.refine'_2.refine_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ : μ a * ∏ j in t, s j + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
b : I
hb : b ∈ t
⊢ ∀ (x : I), x ∈ t → (μ x * ∏ j in t \ {x}, s j) * s a = μ x * ∏ j in insert a t \ {x}, s j
[PROOFSTEP]
intro x hx
[GOAL]
case refine'_2.mp.intro.refine'_2.refine_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ : μ a * ∏ j in t, s j + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
b : I
hb : b ∈ t
x : I
hx : x ∈ t
⊢ (μ x * ∏ j in t \ {x}, s j) * s a = μ x * ∏ j in insert a t \ {x}, s j
[PROOFSTEP]
rw [mul_assoc]
[GOAL]
case refine'_2.mp.intro.refine'_2.refine_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ : μ a * ∏ j in t, s j + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
b : I
hb : b ∈ t
x : I
hx : x ∈ t
⊢ μ x * ((∏ j in t \ {x}, s j) * s a) = μ x * ∏ j in insert a t \ {x}, s j
[PROOFSTEP]
congr
[GOAL]
case refine'_2.mp.intro.refine'_2.refine_1.e_a
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ : μ a * ∏ j in t, s j + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
b : I
hb : b ∈ t
x : I
hx : x ∈ t
⊢ (∏ j in t \ {x}, s j) * s a = ∏ j in insert a t \ {x}, s j
[PROOFSTEP]
rw [prod_eq_prod_diff_singleton_mul (mem x hx) _]
[GOAL]
case refine'_2.mp.intro.refine'_2.refine_1.e_a
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ : μ a * ∏ j in t, s j + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
b : I
hb : b ∈ t
x : I
hx : x ∈ t
⊢ (∏ j in t \ {x}, s j) * s a = (∏ x in (insert a t \ {x}) \ {a}, s x) * s a
[PROOFSTEP]
congr 2
[GOAL]
case refine'_2.mp.intro.refine'_2.refine_1.e_a.e_a.e_s
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
μ : I → R
hμ✝ : μ a * ∏ j in cons a t hat \ {a}, s j + ∑ x in t, μ x * ∏ j in cons a t hat \ {x}, s j = 1
hμ : μ a * ∏ j in t, s j + ∑ x in t, μ x * ∏ j in insert a t \ {x}, s j = 1
b : I
hb : b ∈ t
x : I
hx : x ∈ t
⊢ t \ {x} = (insert a t \ {x}) \ {a}
[PROOFSTEP]
rw [sdiff_sdiff_comm, sdiff_singleton_eq_erase a, erase_insert hat]
[GOAL]
case refine'_2.mpr
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
⊢ (Pairwise (IsCoprime on fun a => s ↑a) ∧ ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)) →
    ∃ μ, ∑ i in cons a t hat, μ i * ∏ j in cons a t hat \ {i}, s j = 1
[PROOFSTEP]
rintro ⟨hs, Hb⟩
[GOAL]
case refine'_2.mpr.intro
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
hs : Pairwise (IsCoprime on fun a => s ↑a)
Hb : ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
⊢ ∃ μ, ∑ i in cons a t hat, μ i * ∏ j in cons a t hat \ {i}, s j = 1
[PROOFSTEP]
obtain ⟨μ, hμ⟩ := ih.mpr hs
[GOAL]
case refine'_2.mpr.intro.intro
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
hs : Pairwise (IsCoprime on fun a => s ↑a)
Hb : ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
μ : I → R
hμ : ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1
⊢ ∃ μ, ∑ i in cons a t hat, μ i * ∏ j in cons a t hat \ {i}, s j = 1
[PROOFSTEP]
obtain ⟨u, v, huv⟩ := IsCoprime.prod_left fun b hb ↦ (Hb b hb).right
[GOAL]
case refine'_2.mpr.intro.intro.intro.intro
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
hs : Pairwise (IsCoprime on fun a => s ↑a)
Hb : ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
μ : I → R
hμ : ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1
u v : R
huv : u * ∏ i in t, s i + v * s a = 1
⊢ ∃ μ, ∑ i in cons a t hat, μ i * ∏ j in cons a t hat \ {i}, s j = 1
[PROOFSTEP]
use fun i ↦ if i = a then u else v * μ i
[GOAL]
case h
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
hs : Pairwise (IsCoprime on fun a => s ↑a)
Hb : ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
μ : I → R
hμ : ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1
u v : R
huv : u * ∏ i in t, s i + v * s a = 1
⊢ ∑ i in cons a t hat, (if i = a then u else v * μ i) * ∏ j in cons a t hat \ {i}, s j = 1
[PROOFSTEP]
have hμ' : (∑ i in t, v * ((μ i * ∏ j in t \ { i }, s j) * s a)) = v * s a := by rw [← mul_sum, ← sum_mul, hμ, one_mul]
[GOAL]
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
hs : Pairwise (IsCoprime on fun a => s ↑a)
Hb : ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
μ : I → R
hμ : ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1
u v : R
huv : u * ∏ i in t, s i + v * s a = 1
⊢ ∑ i in t, v * ((μ i * ∏ j in t \ {i}, s j) * s a) = v * s a
[PROOFSTEP]
rw [← mul_sum, ← sum_mul, hμ, one_mul]
[GOAL]
case h
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
hs : Pairwise (IsCoprime on fun a => s ↑a)
Hb : ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
μ : I → R
hμ : ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1
u v : R
huv : u * ∏ i in t, s i + v * s a = 1
hμ' : ∑ i in t, v * ((μ i * ∏ j in t \ {i}, s j) * s a) = v * s a
⊢ ∑ i in cons a t hat, (if i = a then u else v * μ i) * ∏ j in cons a t hat \ {i}, s j = 1
[PROOFSTEP]
rw [sum_cons, cons_eq_insert, sdiff_singleton_eq_erase, erase_insert hat, if_pos rfl, ← huv, ← hμ', sum_congr rfl]
[GOAL]
case h
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
hs : Pairwise (IsCoprime on fun a => s ↑a)
Hb : ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
μ : I → R
hμ : ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1
u v : R
huv : u * ∏ i in t, s i + v * s a = 1
hμ' : ∑ i in t, v * ((μ i * ∏ j in t \ {i}, s j) * s a) = v * s a
⊢ ∀ (x : I),
    x ∈ t → (if x = a then u else v * μ x) * ∏ j in insert a t \ {x}, s j = v * ((μ x * ∏ j in t \ {x}, s j) * s a)
[PROOFSTEP]
intro x hx
[GOAL]
case h
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
hs : Pairwise (IsCoprime on fun a => s ↑a)
Hb : ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
μ : I → R
hμ : ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1
u v : R
huv : u * ∏ i in t, s i + v * s a = 1
hμ' : ∑ i in t, v * ((μ i * ∏ j in t \ {i}, s j) * s a) = v * s a
x : I
hx : x ∈ t
⊢ (if x = a then u else v * μ x) * ∏ j in insert a t \ {x}, s j = v * ((μ x * ∏ j in t \ {x}, s j) * s a)
[PROOFSTEP]
rw [mul_assoc, if_neg fun ha : x = a ↦ hat (ha.casesOn hx)]
[GOAL]
case h
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
hs : Pairwise (IsCoprime on fun a => s ↑a)
Hb : ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
μ : I → R
hμ : ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1
u v : R
huv : u * ∏ i in t, s i + v * s a = 1
hμ' : ∑ i in t, v * ((μ i * ∏ j in t \ {i}, s j) * s a) = v * s a
x : I
hx : x ∈ t
⊢ v * μ x * ∏ j in insert a t \ {x}, s j = v * (μ x * ((∏ j in t \ {x}, s j) * s a))
[PROOFSTEP]
rw [mul_assoc]
[GOAL]
case h
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
hs : Pairwise (IsCoprime on fun a => s ↑a)
Hb : ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
μ : I → R
hμ : ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1
u v : R
huv : u * ∏ i in t, s i + v * s a = 1
hμ' : ∑ i in t, v * ((μ i * ∏ j in t \ {i}, s j) * s a) = v * s a
x : I
hx : x ∈ t
⊢ v * (μ x * ∏ j in insert a t \ {x}, s j) = v * (μ x * ((∏ j in t \ {x}, s j) * s a))
[PROOFSTEP]
congr
[GOAL]
case h.e_a.e_a
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
hs : Pairwise (IsCoprime on fun a => s ↑a)
Hb : ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
μ : I → R
hμ : ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1
u v : R
huv : u * ∏ i in t, s i + v * s a = 1
hμ' : ∑ i in t, v * ((μ i * ∏ j in t \ {i}, s j) * s a) = v * s a
x : I
hx : x ∈ t
⊢ ∏ j in insert a t \ {x}, s j = (∏ j in t \ {x}, s j) * s a
[PROOFSTEP]
rw [prod_eq_prod_diff_singleton_mul (mem x hx) _]
[GOAL]
case h.e_a.e_a
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
hs : Pairwise (IsCoprime on fun a => s ↑a)
Hb : ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
μ : I → R
hμ : ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1
u v : R
huv : u * ∏ i in t, s i + v * s a = 1
hμ' : ∑ i in t, v * ((μ i * ∏ j in t \ {i}, s j) * s a) = v * s a
x : I
hx : x ∈ t
⊢ (∏ x in (insert a t \ {x}) \ {a}, s x) * s a = (∏ j in t \ {x}, s j) * s a
[PROOFSTEP]
congr 2
[GOAL]
case h.e_a.e_a.e_a.e_s
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x✝ y z : R
s : I → R
t✝ : Finset I
inst✝ : DecidableEq I
h✝ : Finset.Nonempty t✝
a : I
t : Finset I
hat : ¬a ∈ t
h : Finset.Nonempty t
ih : (∃ μ, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔ Pairwise (IsCoprime on fun i => s ↑i)
mem : ∀ (x : I), x ∈ t → a ∈ insert a t \ {x}
hs : Pairwise (IsCoprime on fun a => s ↑a)
Hb : ∀ (b : I), b ∈ t → IsCoprime (s a) (s b) ∧ IsCoprime (s b) (s a)
μ : I → R
hμ : ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1
u v : R
huv : u * ∏ i in t, s i + v * s a = 1
hμ' : ∑ i in t, v * ((μ i * ∏ j in t \ {i}, s j) * s a) = v * s a
x : I
hx : x ∈ t
⊢ (insert a t \ {x}) \ {a} = t \ {x}
[PROOFSTEP]
rw [sdiff_sdiff_comm, sdiff_singleton_eq_erase a, erase_insert hat]
[GOAL]
R : Type u
I : Type v
inst✝³ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝² : Fintype I
inst✝¹ : Nonempty I
inst✝ : DecidableEq I
⊢ (∃ μ, ∑ i : I, μ i * ∏ j in {i}ᶜ, s j = 1) ↔ Pairwise (IsCoprime on s)
[PROOFSTEP]
convert exists_sum_eq_one_iff_pairwise_coprime Finset.univ_nonempty (s := s) using 1
[GOAL]
case h.e'_2.a
R : Type u
I : Type v
inst✝³ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝² : Fintype I
inst✝¹ : Nonempty I
inst✝ : DecidableEq I
⊢ Pairwise (IsCoprime on s) ↔ Pairwise (IsCoprime on fun i => s ↑i)
[PROOFSTEP]
simp only [Function.onFun, pairwise_subtype_iff_pairwise_finset', coe_univ, Set.pairwise_univ]
[GOAL]
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝ : DecidableEq I
⊢ Pairwise (IsCoprime on fun i => s ↑i) ↔ ∀ (i : I), i ∈ t → IsCoprime (s i) (∏ j in t \ {i}, s j)
[PROOFSTEP]
refine' ⟨fun hp i hi ↦ IsCoprime.prod_right_iff.mpr fun j hj ↦ ?_, fun hp ↦ ?_⟩
[GOAL]
case refine'_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝ : DecidableEq I
hp : Pairwise (IsCoprime on fun i => s ↑i)
i : I
hi : i ∈ t
j : I
hj : j ∈ t \ {i}
⊢ IsCoprime (s i) (s j)
[PROOFSTEP]
rw [Finset.mem_sdiff, Finset.mem_singleton] at hj 
[GOAL]
case refine'_1
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝ : DecidableEq I
hp : Pairwise (IsCoprime on fun i => s ↑i)
i : I
hi : i ∈ t
j : I
hj : j ∈ t ∧ ¬j = i
⊢ IsCoprime (s i) (s j)
[PROOFSTEP]
obtain ⟨hj, ji⟩ := hj
[GOAL]
case refine'_1.intro
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝ : DecidableEq I
hp : Pairwise (IsCoprime on fun i => s ↑i)
i : I
hi : i ∈ t
j : I
hj : j ∈ t
ji : ¬j = i
⊢ IsCoprime (s i) (s j)
[PROOFSTEP]
refine @hp ⟨i, hi⟩ ⟨j, hj⟩ fun h ↦ ji (congrArg Subtype.val h).symm
[GOAL]
case refine'_2
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝ : DecidableEq I
hp : ∀ (i : I), i ∈ t → IsCoprime (s i) (∏ j in t \ {i}, s j)
⊢ Pairwise (IsCoprime on fun i => s ↑i)
[PROOFSTEP]
rintro ⟨i, hi⟩ ⟨j, hj⟩ h
[GOAL]
case refine'_2.mk.mk
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝ : DecidableEq I
hp : ∀ (i : I), i ∈ t → IsCoprime (s i) (∏ j in t \ {i}, s j)
i : I
hi : i ∈ t
j : I
hj : j ∈ t
h : { val := i, property := hi } ≠ { val := j, property := hj }
⊢ (IsCoprime on fun i => s ↑i) { val := i, property := hi } { val := j, property := hj }
[PROOFSTEP]
apply IsCoprime.prod_right_iff.mp (hp i hi)
[GOAL]
case refine'_2.mk.mk.a
R : Type u
I : Type v
inst✝¹ : CommSemiring R
x y z : R
s : I → R
t : Finset I
inst✝ : DecidableEq I
hp : ∀ (i : I), i ∈ t → IsCoprime (s i) (∏ j in t \ {i}, s j)
i : I
hi : i ∈ t
j : I
hj : j ∈ t
h : { val := i, property := hi } ≠ { val := j, property := hj }
⊢ ↑{ val := j, property := hj } ∈ t \ {i}
[PROOFSTEP]
exact Finset.mem_sdiff.mpr ⟨hj, fun f ↦ h <| Subtype.ext (Finset.mem_singleton.mp f).symm⟩
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n : ℕ
H : IsCoprime x y
⊢ IsCoprime (x ^ m) y
[PROOFSTEP]
rw [← Finset.card_range m, ← Finset.prod_const]
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n : ℕ
H : IsCoprime x y
⊢ IsCoprime (∏ _x in range m, x) y
[PROOFSTEP]
exact IsCoprime.prod_left fun _ _ ↦ H
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n : ℕ
H : IsCoprime x y
⊢ IsCoprime x (y ^ n)
[PROOFSTEP]
rw [← Finset.card_range n, ← Finset.prod_const]
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n : ℕ
H : IsCoprime x y
⊢ IsCoprime x (∏ _x in range n, y)
[PROOFSTEP]
exact IsCoprime.prod_right fun _ _ ↦ H
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n : ℕ
hm : 0 < m
⊢ IsCoprime (x ^ m) y ↔ IsCoprime x y
[PROOFSTEP]
refine' ⟨fun h ↦ _, IsCoprime.pow_left⟩
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n : ℕ
hm : 0 < m
h : IsCoprime (x ^ m) y
⊢ IsCoprime x y
[PROOFSTEP]
rw [← Finset.card_range m, ← Finset.prod_const] at h 
[GOAL]
R : Type u
I : Type v
inst✝ : CommSemiring R
x y z : R
s : I → R
t : Finset I
m n : ℕ
hm : 0 < m
h : IsCoprime (∏ _x in range m, x) y
⊢ IsCoprime x y
[PROOFSTEP]
exact
  h.of_prod_left 0
    (Finset.mem_range.mpr hm)
      -- porting note: I'm not sure why `finset` didn't get corrected automatically to `Finset`
        -- by Mathport, nor whether this is an issue
