[GOAL]
α : Type u_1
inst✝¹ : Ring α
inst✝ : Nontrivial α
C : PositiveCone α
src✝¹ : Ring α := inst✝¹
src✝ : OrderedAddCommGroup α := OrderedAddCommGroup.mkOfPositiveCone C.toPositiveCone
h : 0 = 1
⊢ False
[PROOFSTEP]
simpa [← h, C.pos_iff] using C.one_pos
[GOAL]
α : Type u_1
inst✝¹ : Ring α
inst✝ : Nontrivial α
C : PositiveCone α
src✝¹ : Ring α := inst✝¹
src✝ : OrderedAddCommGroup α := OrderedAddCommGroup.mkOfPositiveCone C.toPositiveCone
⊢ 0 ≤ 1
[PROOFSTEP]
change C.nonneg (1 - 0)
[GOAL]
α : Type u_1
inst✝¹ : Ring α
inst✝ : Nontrivial α
C : PositiveCone α
src✝¹ : Ring α := inst✝¹
src✝ : OrderedAddCommGroup α := OrderedAddCommGroup.mkOfPositiveCone C.toPositiveCone
⊢ AddCommGroup.PositiveCone.nonneg C.toPositiveCone (1 - 0)
[PROOFSTEP]
convert C.one_nonneg
[GOAL]
case h.e'_4
α : Type u_1
inst✝¹ : Ring α
inst✝ : Nontrivial α
C : PositiveCone α
src✝¹ : Ring α := inst✝¹
src✝ : OrderedAddCommGroup α := OrderedAddCommGroup.mkOfPositiveCone C.toPositiveCone
⊢ 1 - 0 = 1
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝¹ : Ring α
inst✝ : Nontrivial α
C : PositiveCone α
src✝¹ : Ring α := inst✝¹
src✝ : OrderedAddCommGroup α := OrderedAddCommGroup.mkOfPositiveCone C.toPositiveCone
x y : α
xp : 0 < x
yp : 0 < y
⊢ 0 < x * y
[PROOFSTEP]
change
  C.pos
    (x * y - 0)
      -- porting note: used to be convert, but it relied on unfolding definitions
[GOAL]
α : Type u_1
inst✝¹ : Ring α
inst✝ : Nontrivial α
C : PositiveCone α
src✝¹ : Ring α := inst✝¹
src✝ : OrderedAddCommGroup α := OrderedAddCommGroup.mkOfPositiveCone C.toPositiveCone
x y : α
xp : 0 < x
yp : 0 < y
⊢ AddCommGroup.PositiveCone.pos C.toPositiveCone (x * y - 0)
[PROOFSTEP]
rw [sub_zero]
[GOAL]
α : Type u_1
inst✝¹ : Ring α
inst✝ : Nontrivial α
C : PositiveCone α
src✝¹ : Ring α := inst✝¹
src✝ : OrderedAddCommGroup α := OrderedAddCommGroup.mkOfPositiveCone C.toPositiveCone
x y : α
xp : 0 < x
yp : 0 < y
⊢ AddCommGroup.PositiveCone.pos C.toPositiveCone (x * y)
[PROOFSTEP]
exact C.mul_pos x y (by rwa [← sub_zero x]) (by rwa [← sub_zero y])
[GOAL]
α : Type u_1
inst✝¹ : Ring α
inst✝ : Nontrivial α
C : PositiveCone α
src✝¹ : Ring α := inst✝¹
src✝ : OrderedAddCommGroup α := OrderedAddCommGroup.mkOfPositiveCone C.toPositiveCone
x y : α
xp : 0 < x
yp : 0 < y
⊢ AddCommGroup.PositiveCone.pos C.toPositiveCone x
[PROOFSTEP]
rwa [← sub_zero x]
[GOAL]
α : Type u_1
inst✝¹ : Ring α
inst✝ : Nontrivial α
C : PositiveCone α
src✝¹ : Ring α := inst✝¹
src✝ : OrderedAddCommGroup α := OrderedAddCommGroup.mkOfPositiveCone C.toPositiveCone
x y : α
xp : 0 < x
yp : 0 < y
⊢ AddCommGroup.PositiveCone.pos C.toPositiveCone y
[PROOFSTEP]
rwa [← sub_zero y]


[GOAL]
e : ℤˣ
⊢ ‖↑e‖₊ = 1
[PROOFSTEP]
obtain rfl | rfl := units_eq_one_or e
[GOAL]
case inl
⊢ ‖↑1‖₊ = 1
[PROOFSTEP]
simp only [Units.coe_neg_one, Units.val_one, nnnorm_neg, nnnorm_one]
[GOAL]
case inr
⊢ ‖↑(-1)‖₊ = 1
[PROOFSTEP]
simp only [Units.coe_neg_one, Units.val_one, nnnorm_neg, nnnorm_one]
[GOAL]
e : ℤˣ
⊢ ‖↑e‖ = 1
[PROOFSTEP]
rw [← coe_nnnorm, nnnorm_coe_units, NNReal.coe_one]
[GOAL]
n : ℤ
⊢ ↑(toNat n) + ↑(toNat (-n)) = ‖n‖₊
[PROOFSTEP]
rw [← Nat.cast_add, toNat_add_toNat_neg_eq_natAbs, NNReal.coe_natAbs]
[GOAL]
n : ℤ
⊢ ↑(toNat n) + ↑(toNat (-n)) = ‖n‖
[PROOFSTEP]
simpa only [NNReal.coe_nat_cast, NNReal.coe_add] using congrArg NNReal.toReal (toNat_add_toNat_neg_eq_nnnorm n)


[GOAL]
src✝¹ : CommRing ℤ := inferInstanceAs (CommRing ℤ)
src✝ : Nontrivial ℤ := inferInstanceAs (Nontrivial ℤ)
a b : ℤ
b0 : b ≠ 0
⊢ ↑(natAbs ((fun x x_1 => x % x_1) a b)) < ↑(natAbs b)
[PROOFSTEP]
rw [Int.natAbs_of_nonneg (Int.emod_nonneg _ b0), ← Int.abs_eq_natAbs]
[GOAL]
src✝¹ : CommRing ℤ := inferInstanceAs (CommRing ℤ)
src✝ : Nontrivial ℤ := inferInstanceAs (Nontrivial ℤ)
a b : ℤ
b0 : b ≠ 0
⊢ a % b < |b|
[PROOFSTEP]
exact Int.emod_lt _ b0
[GOAL]
src✝¹ : CommRing ℤ := inferInstanceAs (CommRing ℤ)
src✝ : Nontrivial ℤ := inferInstanceAs (Nontrivial ℤ)
a b : ℤ
b0 : b ≠ 0
⊢ natAbs (a * b) ≥ natAbs a
[PROOFSTEP]
rw [← mul_one a.natAbs, Int.natAbs_mul]
[GOAL]
src✝¹ : CommRing ℤ := inferInstanceAs (CommRing ℤ)
src✝ : Nontrivial ℤ := inferInstanceAs (Nontrivial ℤ)
a b : ℤ
b0 : b ≠ 0
⊢ natAbs a * natAbs b ≥ natAbs a * 1
[PROOFSTEP]
rw [← Int.natAbs_pos] at b0
[GOAL]
src✝¹ : CommRing ℤ := inferInstanceAs (CommRing ℤ)
src✝ : Nontrivial ℤ := inferInstanceAs (Nontrivial ℤ)
a b : ℤ
b0 : 0 < natAbs b
⊢ natAbs a * natAbs b ≥ natAbs a * 1
[PROOFSTEP]
exact Nat.mul_le_mul_of_nonneg_left b0
[GOAL]
K : Type u_1
inst✝ : Field K
a b : K
⊢ b * (fun x x_1 => x / x_1) a b + (fun a b => a - a * b / b) a b = a
[PROOFSTEP]
by_cases h : b = 0
[GOAL]
case pos
K : Type u_1
inst✝ : Field K
a b : K
h : b = 0
⊢ b * (fun x x_1 => x / x_1) a b + (fun a b => a - a * b / b) a b = a
[PROOFSTEP]
simp [h, mul_div_cancel']
[GOAL]
case neg
K : Type u_1
inst✝ : Field K
a b : K
h : ¬b = 0
⊢ b * (fun x x_1 => x / x_1) a b + (fun a b => a - a * b / b) a b = a
[PROOFSTEP]
simp [h, mul_div_cancel']
[GOAL]
K : Type u_1
inst✝ : Field K
a b : K
hnb : b ≠ 0
⊢ (fun a b => a = 0 ∧ b ≠ 0) ((fun a b => a - a * b / b) a b) b
[PROOFSTEP]
simp [hnb]


[GOAL]
n : ℕ
h : n ≠ 0
⊢ filter (fun x => x ∣ n) (range (succ n)) = divisors n
[PROOFSTEP]
ext
[GOAL]
case a
n : ℕ
h : n ≠ 0
a✝ : ℕ
⊢ a✝ ∈ filter (fun x => x ∣ n) (range (succ n)) ↔ a✝ ∈ divisors n
[PROOFSTEP]
simp only [divisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
[GOAL]
case a
n : ℕ
h : n ≠ 0
a✝ : ℕ
⊢ a✝ ∣ n → a✝ < succ n → 1 ≤ a✝
[PROOFSTEP]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
[GOAL]
n : ℕ
h : n ≠ 0
⊢ filter (fun x => x ∣ n) (range n) = properDivisors n
[PROOFSTEP]
ext
[GOAL]
case a
n : ℕ
h : n ≠ 0
a✝ : ℕ
⊢ a✝ ∈ filter (fun x => x ∣ n) (range n) ↔ a✝ ∈ properDivisors n
[PROOFSTEP]
simp only [properDivisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
[GOAL]
case a
n : ℕ
h : n ≠ 0
a✝ : ℕ
⊢ a✝ ∣ n → a✝ < n → 1 ≤ a✝
[PROOFSTEP]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
[GOAL]
n : ℕ
⊢ ¬n ∈ properDivisors n
[PROOFSTEP]
simp [properDivisors]
[GOAL]
n m : ℕ
⊢ n ∈ properDivisors m ↔ n ∣ m ∧ n < m
[PROOFSTEP]
rcases eq_or_ne m 0 with (rfl | hm)
[GOAL]
case inl
n : ℕ
⊢ n ∈ properDivisors 0 ↔ n ∣ 0 ∧ n < 0
[PROOFSTEP]
simp [properDivisors]
[GOAL]
case inr
n m : ℕ
hm : m ≠ 0
⊢ n ∈ properDivisors m ↔ n ∣ m ∧ n < m
[PROOFSTEP]
simp only [and_comm, ← filter_dvd_eq_properDivisors hm, mem_filter, mem_range]
[GOAL]
n : ℕ
h : n ≠ 0
⊢ insert n (properDivisors n) = divisors n
[PROOFSTEP]
rw [divisors, properDivisors, Ico_succ_right_eq_insert_Ico (one_le_iff_ne_zero.2 h), Finset.filter_insert,
  if_pos (dvd_refl n)]
[GOAL]
n : ℕ
h : n ≠ 0
⊢ cons n (properDivisors n) (_ : ¬n ∈ properDivisors n) = divisors n
[PROOFSTEP]
rw [cons_eq_insert, insert_self_properDivisors h]
[GOAL]
n m : ℕ
⊢ n ∈ divisors m ↔ n ∣ m ∧ m ≠ 0
[PROOFSTEP]
rcases eq_or_ne m 0 with (rfl | hm)
[GOAL]
case inl
n : ℕ
⊢ n ∈ divisors 0 ↔ n ∣ 0 ∧ 0 ≠ 0
[PROOFSTEP]
simp [divisors]
[GOAL]
case inr
n m : ℕ
hm : m ≠ 0
⊢ n ∈ divisors m ↔ n ∣ m ∧ m ≠ 0
[PROOFSTEP]
simp only [hm, Ne.def, not_false_iff, and_true_iff, ← filter_dvd_eq_divisors hm, mem_filter, mem_range,
  and_iff_right_iff_imp, lt_succ_iff]
[GOAL]
case inr
n m : ℕ
hm : m ≠ 0
⊢ n ∣ m → n ≤ m
[PROOFSTEP]
exact le_of_dvd hm.bot_lt
[GOAL]
n : ℕ
⊢ 1 ∈ divisors n ↔ n ≠ 0
[PROOFSTEP]
simp
[GOAL]
n m : ℕ
h : n ∈ divisors m
⊢ n ∣ m
[PROOFSTEP]
cases m
[GOAL]
case zero
n : ℕ
h : n ∈ divisors zero
⊢ n ∣ zero
[PROOFSTEP]
apply dvd_zero
[GOAL]
case succ
n n✝ : ℕ
h : n ∈ divisors (succ n✝)
⊢ n ∣ succ n✝
[PROOFSTEP]
simp [mem_divisors.1 h]
[GOAL]
n : ℕ
x : ℕ × ℕ
⊢ x ∈ divisorsAntidiagonal n ↔ x.fst * x.snd = n ∧ n ≠ 0
[PROOFSTEP]
simp only [divisorsAntidiagonal, Finset.mem_Ico, Ne.def, Finset.mem_filter, Finset.mem_product]
[GOAL]
n : ℕ
x : ℕ × ℕ
⊢ ((1 ≤ x.fst ∧ x.fst < n + 1) ∧ 1 ≤ x.snd ∧ x.snd < n + 1) ∧ x.fst * x.snd = n ↔ x.fst * x.snd = n ∧ ¬n = 0
[PROOFSTEP]
rw [and_comm]
[GOAL]
n : ℕ
x : ℕ × ℕ
⊢ x.fst * x.snd = n ∧ (1 ≤ x.fst ∧ x.fst < n + 1) ∧ 1 ≤ x.snd ∧ x.snd < n + 1 ↔ x.fst * x.snd = n ∧ ¬n = 0
[PROOFSTEP]
apply and_congr_right
[GOAL]
case h
n : ℕ
x : ℕ × ℕ
⊢ x.fst * x.snd = n → ((1 ≤ x.fst ∧ x.fst < n + 1) ∧ 1 ≤ x.snd ∧ x.snd < n + 1 ↔ ¬n = 0)
[PROOFSTEP]
rintro rfl
[GOAL]
case h
x : ℕ × ℕ
⊢ (1 ≤ x.fst ∧ x.fst < x.fst * x.snd + 1) ∧ 1 ≤ x.snd ∧ x.snd < x.fst * x.snd + 1 ↔ ¬x.fst * x.snd = 0
[PROOFSTEP]
constructor
[GOAL]
case h.mp
x : ℕ × ℕ
⊢ (1 ≤ x.fst ∧ x.fst < x.fst * x.snd + 1) ∧ 1 ≤ x.snd ∧ x.snd < x.fst * x.snd + 1 → ¬x.fst * x.snd = 0
[PROOFSTEP]
intro h
[GOAL]
case h.mpr
x : ℕ × ℕ
⊢ ¬x.fst * x.snd = 0 → (1 ≤ x.fst ∧ x.fst < x.fst * x.snd + 1) ∧ 1 ≤ x.snd ∧ x.snd < x.fst * x.snd + 1
[PROOFSTEP]
intro h
[GOAL]
case h.mp
x : ℕ × ℕ
h : (1 ≤ x.fst ∧ x.fst < x.fst * x.snd + 1) ∧ 1 ≤ x.snd ∧ x.snd < x.fst * x.snd + 1
⊢ ¬x.fst * x.snd = 0
[PROOFSTEP]
contrapose! h
[GOAL]
case h.mp
x : ℕ × ℕ
h : x.fst * x.snd = 0
⊢ 1 ≤ x.fst ∧ x.fst < x.fst * x.snd + 1 → 1 ≤ x.snd → x.fst * x.snd + 1 ≤ x.snd
[PROOFSTEP]
simp [h]
[GOAL]
case h.mpr
x : ℕ × ℕ
h : ¬x.fst * x.snd = 0
⊢ (1 ≤ x.fst ∧ x.fst < x.fst * x.snd + 1) ∧ 1 ≤ x.snd ∧ x.snd < x.fst * x.snd + 1
[PROOFSTEP]
rw [Nat.lt_add_one_iff, Nat.lt_add_one_iff]
[GOAL]
case h.mpr
x : ℕ × ℕ
h : ¬x.fst * x.snd = 0
⊢ (1 ≤ x.fst ∧ x.fst ≤ x.fst * x.snd) ∧ 1 ≤ x.snd ∧ x.snd ≤ x.fst * x.snd
[PROOFSTEP]
rw [mul_eq_zero, not_or] at h
[GOAL]
case h.mpr
x : ℕ × ℕ
h : ¬x.fst = 0 ∧ ¬x.snd = 0
⊢ (1 ≤ x.fst ∧ x.fst ≤ x.fst * x.snd) ∧ 1 ≤ x.snd ∧ x.snd ≤ x.fst * x.snd
[PROOFSTEP]
simp only [succ_le_of_lt (Nat.pos_of_ne_zero h.1), succ_le_of_lt (Nat.pos_of_ne_zero h.2), true_and_iff]
[GOAL]
case h.mpr
x : ℕ × ℕ
h : ¬x.fst = 0 ∧ ¬x.snd = 0
⊢ x.fst ≤ x.fst * x.snd ∧ x.snd ≤ x.fst * x.snd
[PROOFSTEP]
exact ⟨le_mul_of_pos_right (Nat.pos_of_ne_zero h.2), le_mul_of_pos_left (Nat.pos_of_ne_zero h.1)⟩
[GOAL]
n m : ℕ
⊢ n ∈ divisors m → n ≤ m
[PROOFSTEP]
cases' m with m
[GOAL]
case zero
n : ℕ
⊢ n ∈ divisors zero → n ≤ zero
[PROOFSTEP]
simp
[GOAL]
case succ
n m : ℕ
⊢ n ∈ divisors (succ m) → n ≤ succ m
[PROOFSTEP]
simp only [mem_divisors, Nat.succ_ne_zero m, and_true_iff, Ne.def, not_false_iff]
[GOAL]
case succ
n m : ℕ
⊢ n ∣ succ m → n ≤ succ m
[PROOFSTEP]
exact Nat.le_of_dvd (Nat.succ_pos m)
[GOAL]
n m : ℕ
hzero : n ≠ 0
h : m ∣ n
hdiff : m ≠ n
⊢ divisors m ⊆ properDivisors n
[PROOFSTEP]
apply Finset.subset_iff.2
[GOAL]
n m : ℕ
hzero : n ≠ 0
h : m ∣ n
hdiff : m ≠ n
⊢ ∀ ⦃x : ℕ⦄, x ∈ divisors m → x ∈ properDivisors n
[PROOFSTEP]
intro x hx
[GOAL]
n m : ℕ
hzero : n ≠ 0
h : m ∣ n
hdiff : m ≠ n
x : ℕ
hx : x ∈ divisors m
⊢ x ∈ properDivisors n
[PROOFSTEP]
exact
  Nat.mem_properDivisors.2
    ⟨(Nat.mem_divisors.1 hx).1.trans h,
      lt_of_le_of_lt (divisor_le hx) (lt_of_le_of_ne (divisor_le (Nat.mem_divisors.2 ⟨h, hzero⟩)) hdiff)⟩
[GOAL]
n : ℕ
⊢ divisors 0 = ∅
[PROOFSTEP]
ext
[GOAL]
case a
n a✝ : ℕ
⊢ a✝ ∈ divisors 0 ↔ a✝ ∈ ∅
[PROOFSTEP]
simp
[GOAL]
n : ℕ
⊢ properDivisors 0 = ∅
[PROOFSTEP]
ext
[GOAL]
case a
n a✝ : ℕ
⊢ a✝ ∈ properDivisors 0 ↔ a✝ ∈ ∅
[PROOFSTEP]
simp
[GOAL]
n : ℕ
⊢ divisors 1 = {1}
[PROOFSTEP]
ext
[GOAL]
case a
n a✝ : ℕ
⊢ a✝ ∈ divisors 1 ↔ a✝ ∈ {1}
[PROOFSTEP]
simp
[GOAL]
n : ℕ
⊢ properDivisors 1 = ∅
[PROOFSTEP]
rw [properDivisors, Ico_self, filter_empty]
[GOAL]
n m : ℕ
h : m ∈ divisors n
⊢ 0 < m
[PROOFSTEP]
cases m
[GOAL]
case zero
n : ℕ
h : zero ∈ divisors n
⊢ 0 < zero
[PROOFSTEP]
rw [mem_divisors, zero_eq, zero_dvd_iff (a := n)] at h
[GOAL]
case zero
n : ℕ
h : n = 0 ∧ n ≠ 0
⊢ 0 < zero
[PROOFSTEP]
cases h.2 h.1
[GOAL]
case succ
n n✝ : ℕ
h : succ n✝ ∈ divisors n
⊢ 0 < succ n✝
[PROOFSTEP]
apply Nat.succ_pos
[GOAL]
n : ℕ
⊢ 1 ∈ properDivisors n ↔ 1 < n
[PROOFSTEP]
rw [mem_properDivisors, and_iff_right (one_dvd _)]
[GOAL]
n : ℕ
⊢ divisorsAntidiagonal 0 = ∅
[PROOFSTEP]
ext
[GOAL]
case a
n : ℕ
a✝ : ℕ × ℕ
⊢ a✝ ∈ divisorsAntidiagonal 0 ↔ a✝ ∈ ∅
[PROOFSTEP]
simp
[GOAL]
n : ℕ
⊢ divisorsAntidiagonal 1 = {(1, 1)}
[PROOFSTEP]
ext
[GOAL]
case a
n : ℕ
a✝ : ℕ × ℕ
⊢ a✝ ∈ divisorsAntidiagonal 1 ↔ a✝ ∈ {(1, 1)}
[PROOFSTEP]
simp [mul_eq_one, Prod.ext_iff]
[GOAL]
n : ℕ
x : ℕ × ℕ
⊢ Prod.swap x ∈ divisorsAntidiagonal n ↔ x ∈ divisorsAntidiagonal n
[PROOFSTEP]
rw [mem_divisorsAntidiagonal, mem_divisorsAntidiagonal, mul_comm, Prod.swap]
[GOAL]
n : ℕ
x : ℕ × ℕ
⊢ x.snd * x.fst = n ∧ ¬n = 0 ↔ x ∈ divisorsAntidiagonal n
[PROOFSTEP]
rw [mem_divisorsAntidiagonal, mul_comm]
[GOAL]
n : ℕ
x : ℕ × ℕ
h : x ∈ divisorsAntidiagonal n
⊢ x.fst ∈ divisors n
[PROOFSTEP]
rw [mem_divisorsAntidiagonal] at h
[GOAL]
n : ℕ
x : ℕ × ℕ
h : x.fst * x.snd = n ∧ n ≠ 0
⊢ x.fst ∈ divisors n
[PROOFSTEP]
simp [Dvd.intro _ h.1, h.2]
[GOAL]
n : ℕ
x : ℕ × ℕ
h : x ∈ divisorsAntidiagonal n
⊢ x.snd ∈ divisors n
[PROOFSTEP]
rw [mem_divisorsAntidiagonal] at h
[GOAL]
n : ℕ
x : ℕ × ℕ
h : x.fst * x.snd = n ∧ n ≠ 0
⊢ x.snd ∈ divisors n
[PROOFSTEP]
simp [Dvd.intro_left _ h.1, h.2]
[GOAL]
n : ℕ
⊢ map (Equiv.toEmbedding (Equiv.prodComm ℕ ℕ)) (divisorsAntidiagonal n) = divisorsAntidiagonal n
[PROOFSTEP]
rw [← coe_inj, coe_map, Equiv.coe_toEmbedding, Equiv.coe_prodComm, Set.image_swap_eq_preimage_swap]
[GOAL]
n : ℕ
⊢ Prod.swap ⁻¹' ↑(divisorsAntidiagonal n) = ↑(divisorsAntidiagonal n)
[PROOFSTEP]
ext
[GOAL]
case h
n : ℕ
x✝ : ℕ × ℕ
⊢ x✝ ∈ Prod.swap ⁻¹' ↑(divisorsAntidiagonal n) ↔ x✝ ∈ ↑(divisorsAntidiagonal n)
[PROOFSTEP]
exact swap_mem_divisorsAntidiagonal
[GOAL]
n : ℕ
⊢ image Prod.fst (divisorsAntidiagonal n) = divisors n
[PROOFSTEP]
ext
[GOAL]
case a
n a✝ : ℕ
⊢ a✝ ∈ image Prod.fst (divisorsAntidiagonal n) ↔ a✝ ∈ divisors n
[PROOFSTEP]
simp [Dvd.dvd, @eq_comm _ n (_ * _)]
[GOAL]
n : ℕ
⊢ image Prod.snd (divisorsAntidiagonal n) = divisors n
[PROOFSTEP]
rw [← map_swap_divisorsAntidiagonal, map_eq_image, image_image]
[GOAL]
n : ℕ
⊢ image (Prod.snd ∘ ↑(Equiv.toEmbedding (Equiv.prodComm ℕ ℕ))) (divisorsAntidiagonal n) = divisors n
[PROOFSTEP]
exact image_fst_divisorsAntidiagonal
[GOAL]
n : ℕ
⊢ map
      { toFun := fun d => (d, n / d),
        inj' :=
          (_ :
            ∀ (p₁ p₂ : ℕ),
              (fun d => (d, n / d)) p₁ = (fun d => (d, n / d)) p₂ →
                ((fun d => (d, n / d)) p₁).fst = ((fun d => (d, n / d)) p₂).fst) }
      (divisors n) =
    divisorsAntidiagonal n
[PROOFSTEP]
ext ⟨d, nd⟩
[GOAL]
case a.mk
n d nd : ℕ
⊢ (d, nd) ∈
      map
        { toFun := fun d => (d, n / d),
          inj' :=
            (_ :
              ∀ (p₁ p₂ : ℕ),
                (fun d => (d, n / d)) p₁ = (fun d => (d, n / d)) p₂ →
                  ((fun d => (d, n / d)) p₁).fst = ((fun d => (d, n / d)) p₂).fst) }
        (divisors n) ↔
    (d, nd) ∈ divisorsAntidiagonal n
[PROOFSTEP]
simp only [mem_map, mem_divisorsAntidiagonal, Function.Embedding.coeFn_mk, mem_divisors, Prod.ext_iff, exists_prop,
  and_left_comm, exists_eq_left]
[GOAL]
case a.mk
n d nd : ℕ
⊢ (d ∣ n ∧ n ≠ 0) ∧ n / d = nd ↔ d * nd = n ∧ n ≠ 0
[PROOFSTEP]
constructor
[GOAL]
case a.mk.mp
n d nd : ℕ
⊢ (d ∣ n ∧ n ≠ 0) ∧ n / d = nd → d * nd = n ∧ n ≠ 0
[PROOFSTEP]
rintro ⟨⟨⟨k, rfl⟩, hn⟩, rfl⟩
[GOAL]
case a.mk.mp.intro.intro.intro
d k : ℕ
hn : d * k ≠ 0
⊢ d * (d * k / d) = d * k ∧ d * k ≠ 0
[PROOFSTEP]
rw [Nat.mul_div_cancel_left _ (left_ne_zero_of_mul hn).bot_lt]
[GOAL]
case a.mk.mp.intro.intro.intro
d k : ℕ
hn : d * k ≠ 0
⊢ d * k = d * k ∧ d * k ≠ 0
[PROOFSTEP]
exact ⟨rfl, hn⟩
[GOAL]
case a.mk.mpr
n d nd : ℕ
⊢ d * nd = n ∧ n ≠ 0 → (d ∣ n ∧ n ≠ 0) ∧ n / d = nd
[PROOFSTEP]
rintro ⟨rfl, hn⟩
[GOAL]
case a.mk.mpr.intro
d nd : ℕ
hn : d * nd ≠ 0
⊢ (d ∣ d * nd ∧ d * nd ≠ 0) ∧ d * nd / d = nd
[PROOFSTEP]
exact ⟨⟨dvd_mul_right _ _, hn⟩, Nat.mul_div_cancel_left _ (left_ne_zero_of_mul hn).bot_lt⟩
[GOAL]
n : ℕ
⊢ map
      { toFun := fun d => (n / d, d),
        inj' :=
          (_ :
            ∀ (p₁ p₂ : ℕ),
              (fun d => (n / d, d)) p₁ = (fun d => (n / d, d)) p₂ →
                ((fun d => (n / d, d)) p₁).snd = ((fun d => (n / d, d)) p₂).snd) }
      (divisors n) =
    divisorsAntidiagonal n
[PROOFSTEP]
apply Finset.map_injective (Equiv.prodComm _ _).toEmbedding
[GOAL]
case a
n : ℕ
⊢ map (Equiv.toEmbedding (Equiv.prodComm ℕ ℕ))
      (map
        { toFun := fun d => (n / d, d),
          inj' :=
            (_ :
              ∀ (p₁ p₂ : ℕ),
                (fun d => (n / d, d)) p₁ = (fun d => (n / d, d)) p₂ →
                  ((fun d => (n / d, d)) p₁).snd = ((fun d => (n / d, d)) p₂).snd) }
        (divisors n)) =
    map (Equiv.toEmbedding (Equiv.prodComm ℕ ℕ)) (divisorsAntidiagonal n)
[PROOFSTEP]
rw [map_swap_divisorsAntidiagonal, ← map_div_right_divisors, Finset.map_map]
[GOAL]
case a
n : ℕ
⊢ map
      (Function.Embedding.trans
        { toFun := fun d => (n / d, d),
          inj' :=
            (_ :
              ∀ (p₁ p₂ : ℕ),
                (fun d => (n / d, d)) p₁ = (fun d => (n / d, d)) p₂ →
                  ((fun d => (n / d, d)) p₁).snd = ((fun d => (n / d, d)) p₂).snd) }
        (Equiv.toEmbedding (Equiv.prodComm ℕ ℕ)))
      (divisors n) =
    map
      { toFun := fun d => (d, n / d),
        inj' :=
          (_ :
            ∀ (p₁ p₂ : ℕ),
              (fun d => (d, n / d)) p₁ = (fun d => (d, n / d)) p₂ →
                ((fun d => (d, n / d)) p₁).fst = ((fun d => (d, n / d)) p₂).fst) }
      (divisors n)
[PROOFSTEP]
rfl
[GOAL]
n : ℕ
⊢ ∑ i in divisors n, i = ∑ i in properDivisors n, i + n
[PROOFSTEP]
rcases Decidable.eq_or_ne n 0 with (rfl | hn)
[GOAL]
case inl
⊢ ∑ i in divisors 0, i = ∑ i in properDivisors 0, i + 0
[PROOFSTEP]
simp
[GOAL]
case inr
n : ℕ
hn : n ≠ 0
⊢ ∑ i in divisors n, i = ∑ i in properDivisors n, i + n
[PROOFSTEP]
rw [← cons_self_properDivisors hn, Finset.sum_cons, add_comm]
[GOAL]
n : ℕ
h : 0 < n
⊢ Perfect n ↔ ∑ i in divisors n, i = 2 * n
[PROOFSTEP]
rw [perfect_iff_sum_properDivisors h, sum_divisors_eq_sum_properDivisors_add_self, two_mul]
[GOAL]
n : ℕ
h : 0 < n
⊢ ∑ i in properDivisors n, i = n ↔ ∑ i in properDivisors n, i + n = n + n
[PROOFSTEP]
constructor
[GOAL]
case mp
n : ℕ
h : 0 < n
⊢ ∑ i in properDivisors n, i = n → ∑ i in properDivisors n, i + n = n + n
[PROOFSTEP]
intro h
[GOAL]
case mpr
n : ℕ
h : 0 < n
⊢ ∑ i in properDivisors n, i + n = n + n → ∑ i in properDivisors n, i = n
[PROOFSTEP]
intro h
[GOAL]
case mp
n : ℕ
h✝ : 0 < n
h : ∑ i in properDivisors n, i = n
⊢ ∑ i in properDivisors n, i + n = n + n
[PROOFSTEP]
rw [h]
[GOAL]
case mpr
n : ℕ
h✝ : 0 < n
h : ∑ i in properDivisors n, i + n = n + n
⊢ ∑ i in properDivisors n, i = n
[PROOFSTEP]
apply add_right_cancel h
[GOAL]
n p : ℕ
pp : Prime p
k x : ℕ
⊢ x ∈ divisors (p ^ k) ↔ ∃ j x_1, x = p ^ j
[PROOFSTEP]
rw [mem_divisors, Nat.dvd_prime_pow pp, and_iff_left (ne_of_gt (pow_pos pp.pos k))]
[GOAL]
n p : ℕ
pp : Prime p
k x : ℕ
⊢ (∃ k_1, k_1 ≤ k ∧ x = p ^ k_1) ↔ ∃ j x_1, x = p ^ j
[PROOFSTEP]
simp
[GOAL]
n p : ℕ
pp : Prime p
⊢ Nat.divisors p = {1, p}
[PROOFSTEP]
ext
[GOAL]
case a
n p : ℕ
pp : Prime p
a✝ : ℕ
⊢ a✝ ∈ Nat.divisors p ↔ a✝ ∈ {1, p}
[PROOFSTEP]
rw [mem_divisors, dvd_prime pp, and_iff_left pp.ne_zero, Finset.mem_insert, Finset.mem_singleton]
[GOAL]
n p : ℕ
pp : Prime p
⊢ Nat.properDivisors p = {1}
[PROOFSTEP]
rw [← erase_insert properDivisors.not_self_mem, insert_self_properDivisors pp.ne_zero, pp.divisors, pair_comm,
  erase_insert fun con => pp.ne_one (mem_singleton.1 con)]
[GOAL]
n p : ℕ
pp : Prime p
k : ℕ
⊢ divisors (p ^ k) = map { toFun := Nat.pow p, inj' := (_ : Function.Injective fun n => p ^ n) } (range (k + 1))
[PROOFSTEP]
ext a
[GOAL]
case a
n p : ℕ
pp : Prime p
k a : ℕ
⊢ a ∈ divisors (p ^ k) ↔ a ∈ map { toFun := Nat.pow p, inj' := (_ : Function.Injective fun n => p ^ n) } (range (k + 1))
[PROOFSTEP]
simp only [mem_divisors, mem_map, mem_range, lt_succ_iff, Function.Embedding.coeFn_mk, Nat.pow_eq,
  mem_divisors_prime_pow pp k]
[GOAL]
case a
n p : ℕ
pp : Prime p
k a : ℕ
⊢ a ∣ p ^ k ∧ p ^ k ≠ 0 ↔ ∃ a_1, a_1 ≤ k ∧ p ^ a_1 = a
[PROOFSTEP]
have := mem_divisors_prime_pow pp k (x := a)
[GOAL]
case a
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∈ divisors (p ^ k) ↔ ∃ j x, a = p ^ j
⊢ a ∣ p ^ k ∧ p ^ k ≠ 0 ↔ ∃ a_1, a_1 ≤ k ∧ p ^ a_1 = a
[PROOFSTEP]
rw [mem_divisors] at this
[GOAL]
case a
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ p ^ k ≠ 0 ↔ ∃ j x, a = p ^ j
⊢ a ∣ p ^ k ∧ p ^ k ≠ 0 ↔ ∃ a_1, a_1 ≤ k ∧ p ^ a_1 = a
[PROOFSTEP]
rw [this]
[GOAL]
case a
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ p ^ k ≠ 0 ↔ ∃ j x, a = p ^ j
⊢ (∃ j x, a = p ^ j) ↔ ∃ a_1, a_1 ≤ k ∧ p ^ a_1 = a
[PROOFSTEP]
refine ⟨?_, ?_⟩
[GOAL]
case a.refine_1
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ p ^ k ≠ 0 ↔ ∃ j x, a = p ^ j
⊢ (∃ j x, a = p ^ j) → ∃ a_2, a_2 ≤ k ∧ p ^ a_2 = a
[PROOFSTEP]
intro h
[GOAL]
case a.refine_1
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ p ^ k ≠ 0 ↔ ∃ j x, a = p ^ j
h : ∃ j x, a = p ^ j
⊢ ∃ a_1, a_1 ≤ k ∧ p ^ a_1 = a
[PROOFSTEP]
rcases h with ⟨x, hx, hap⟩
[GOAL]
case a.refine_1.intro.intro
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ p ^ k ≠ 0 ↔ ∃ j x, a = p ^ j
x : ℕ
hx : x ≤ k
hap : a = p ^ x
⊢ ∃ a_1, a_1 ≤ k ∧ p ^ a_1 = a
[PROOFSTEP]
use x
[GOAL]
case h
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ p ^ k ≠ 0 ↔ ∃ j x, a = p ^ j
x : ℕ
hx : x ≤ k
hap : a = p ^ x
⊢ x ≤ k ∧ p ^ x = a
[PROOFSTEP]
tauto
[GOAL]
case a.refine_2
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ p ^ k ≠ 0 ↔ ∃ j x, a = p ^ j
⊢ (∃ a_1, a_1 ≤ k ∧ p ^ a_1 = a) → ∃ j x, a = p ^ j
[PROOFSTEP]
tauto
[GOAL]
n : ℕ
s : Finset ℕ
hsub : s ⊆ properDivisors n
⊢ ∑ x in s, x = ∑ x in properDivisors n, x → s = properDivisors n
[PROOFSTEP]
cases n
[GOAL]
case zero
s : Finset ℕ
hsub : s ⊆ properDivisors zero
⊢ ∑ x in s, x = ∑ x in properDivisors zero, x → s = properDivisors zero
[PROOFSTEP]
rw [properDivisors_zero, subset_empty] at hsub
[GOAL]
case zero
s : Finset ℕ
hsub : s = ∅
⊢ ∑ x in s, x = ∑ x in properDivisors zero, x → s = properDivisors zero
[PROOFSTEP]
simp [hsub]
[GOAL]
case succ
s : Finset ℕ
n✝ : ℕ
hsub : s ⊆ properDivisors (succ n✝)
⊢ ∑ x in s, x = ∑ x in properDivisors (succ n✝), x → s = properDivisors (succ n✝)
[PROOFSTEP]
classical
rw [← sum_sdiff hsub]
intro h
apply Subset.antisymm hsub
rw [← sdiff_eq_empty_iff_subset]
contrapose h
rw [← Ne.def, ← nonempty_iff_ne_empty] at h
apply ne_of_lt
rw [← zero_add (∑ x in s, x), ← add_assoc, add_zero]
apply add_lt_add_right
have hlt := sum_lt_sum_of_nonempty h fun x hx => pos_of_mem_properDivisors (sdiff_subset _ _ hx)
simp only [sum_const_zero] at hlt
apply hlt
[GOAL]
case succ
s : Finset ℕ
n✝ : ℕ
hsub : s ⊆ properDivisors (succ n✝)
⊢ ∑ x in s, x = ∑ x in properDivisors (succ n✝), x → s = properDivisors (succ n✝)
[PROOFSTEP]
rw [← sum_sdiff hsub]
[GOAL]
case succ
s : Finset ℕ
n✝ : ℕ
hsub : s ⊆ properDivisors (succ n✝)
⊢ ∑ x in s, x = ∑ x in properDivisors (succ n✝) \ s, x + ∑ x in s, x → s = properDivisors (succ n✝)
[PROOFSTEP]
intro h
[GOAL]
case succ
s : Finset ℕ
n✝ : ℕ
hsub : s ⊆ properDivisors (succ n✝)
h : ∑ x in s, x = ∑ x in properDivisors (succ n✝) \ s, x + ∑ x in s, x
⊢ s = properDivisors (succ n✝)
[PROOFSTEP]
apply Subset.antisymm hsub
[GOAL]
case succ
s : Finset ℕ
n✝ : ℕ
hsub : s ⊆ properDivisors (succ n✝)
h : ∑ x in s, x = ∑ x in properDivisors (succ n✝) \ s, x + ∑ x in s, x
⊢ properDivisors (succ n✝) ⊆ s
[PROOFSTEP]
rw [← sdiff_eq_empty_iff_subset]
[GOAL]
case succ
s : Finset ℕ
n✝ : ℕ
hsub : s ⊆ properDivisors (succ n✝)
h : ∑ x in s, x = ∑ x in properDivisors (succ n✝) \ s, x + ∑ x in s, x
⊢ properDivisors (succ n✝) \ s = ∅
[PROOFSTEP]
contrapose h
[GOAL]
case succ
s : Finset ℕ
n✝ : ℕ
hsub : s ⊆ properDivisors (succ n✝)
h : ¬properDivisors (succ n✝) \ s = ∅
⊢ ¬∑ x in s, x = ∑ x in properDivisors (succ n✝) \ s, x + ∑ x in s, x
[PROOFSTEP]
rw [← Ne.def, ← nonempty_iff_ne_empty] at h
[GOAL]
case succ
s : Finset ℕ
n✝ : ℕ
hsub : s ⊆ properDivisors (succ n✝)
h : Finset.Nonempty (properDivisors (succ n✝) \ s)
⊢ ¬∑ x in s, x = ∑ x in properDivisors (succ n✝) \ s, x + ∑ x in s, x
[PROOFSTEP]
apply ne_of_lt
[GOAL]
case succ.h
s : Finset ℕ
n✝ : ℕ
hsub : s ⊆ properDivisors (succ n✝)
h : Finset.Nonempty (properDivisors (succ n✝) \ s)
⊢ ∑ x in s, x < ∑ x in properDivisors (succ n✝) \ s, x + ∑ x in s, x
[PROOFSTEP]
rw [← zero_add (∑ x in s, x), ← add_assoc, add_zero]
[GOAL]
case succ.h
s : Finset ℕ
n✝ : ℕ
hsub : s ⊆ properDivisors (succ n✝)
h : Finset.Nonempty (properDivisors (succ n✝) \ s)
⊢ 0 + ∑ x in s, x < ∑ x in properDivisors (succ n✝) \ s, x + ∑ x in s, x
[PROOFSTEP]
apply add_lt_add_right
[GOAL]
case succ.h.bc
s : Finset ℕ
n✝ : ℕ
hsub : s ⊆ properDivisors (succ n✝)
h : Finset.Nonempty (properDivisors (succ n✝) \ s)
⊢ 0 < ∑ x in properDivisors (succ n✝) \ s, x
[PROOFSTEP]
have hlt := sum_lt_sum_of_nonempty h fun x hx => pos_of_mem_properDivisors (sdiff_subset _ _ hx)
[GOAL]
case succ.h.bc
s : Finset ℕ
n✝ : ℕ
hsub : s ⊆ properDivisors (succ n✝)
h : Finset.Nonempty (properDivisors (succ n✝) \ s)
hlt : ∑ i in properDivisors (succ n✝) \ s, 0 < ∑ i in properDivisors (succ n✝) \ s, i
⊢ 0 < ∑ x in properDivisors (succ n✝) \ s, x
[PROOFSTEP]
simp only [sum_const_zero] at hlt
[GOAL]
case succ.h.bc
s : Finset ℕ
n✝ : ℕ
hsub : s ⊆ properDivisors (succ n✝)
h : Finset.Nonempty (properDivisors (succ n✝) \ s)
hlt : 0 < ∑ i in properDivisors (succ n✝) \ s, i
⊢ 0 < ∑ x in properDivisors (succ n✝) \ s, x
[PROOFSTEP]
apply hlt
[GOAL]
n : ℕ
h : ∑ x in properDivisors n, x ∣ n
⊢ ∑ x in properDivisors n, x = 1 ∨ ∑ x in properDivisors n, x = n
[PROOFSTEP]
cases' n with n
[GOAL]
case zero
h : ∑ x in properDivisors zero, x ∣ zero
⊢ ∑ x in properDivisors zero, x = 1 ∨ ∑ x in properDivisors zero, x = zero
[PROOFSTEP]
simp
[GOAL]
case succ
n : ℕ
h : ∑ x in properDivisors (succ n), x ∣ succ n
⊢ ∑ x in properDivisors (succ n), x = 1 ∨ ∑ x in properDivisors (succ n), x = succ n
[PROOFSTEP]
cases' n with n
[GOAL]
case succ.zero
h : ∑ x in properDivisors (succ zero), x ∣ succ zero
⊢ ∑ x in properDivisors (succ zero), x = 1 ∨ ∑ x in properDivisors (succ zero), x = succ zero
[PROOFSTEP]
contrapose! h
[GOAL]
case succ.zero
h : ∑ x in properDivisors (succ zero), x ≠ 1 ∧ ∑ x in properDivisors (succ zero), x ≠ succ zero
⊢ ¬∑ x in properDivisors (succ zero), x ∣ succ zero
[PROOFSTEP]
simp
[GOAL]
case succ.succ
n : ℕ
h : ∑ x in properDivisors (succ (succ n)), x ∣ succ (succ n)
⊢ ∑ x in properDivisors (succ (succ n)), x = 1 ∨ ∑ x in properDivisors (succ (succ n)), x = succ (succ n)
[PROOFSTEP]
rw [or_iff_not_imp_right]
[GOAL]
case succ.succ
n : ℕ
h : ∑ x in properDivisors (succ (succ n)), x ∣ succ (succ n)
⊢ ¬∑ x in properDivisors (succ (succ n)), x = succ (succ n) → ∑ x in properDivisors (succ (succ n)), x = 1
[PROOFSTEP]
intro ne_n
[GOAL]
case succ.succ
n : ℕ
h : ∑ x in properDivisors (succ (succ n)), x ∣ succ (succ n)
ne_n : ¬∑ x in properDivisors (succ (succ n)), x = succ (succ n)
⊢ ∑ x in properDivisors (succ (succ n)), x = 1
[PROOFSTEP]
have hlt : ∑ x in n.succ.succ.properDivisors, x < n.succ.succ := lt_of_le_of_ne (Nat.le_of_dvd (Nat.succ_pos _) h) ne_n
[GOAL]
case succ.succ
n : ℕ
h : ∑ x in properDivisors (succ (succ n)), x ∣ succ (succ n)
ne_n : ¬∑ x in properDivisors (succ (succ n)), x = succ (succ n)
hlt : ∑ x in properDivisors (succ (succ n)), x < succ (succ n)
⊢ ∑ x in properDivisors (succ (succ n)), x = 1
[PROOFSTEP]
symm
[GOAL]
case succ.succ
n : ℕ
h : ∑ x in properDivisors (succ (succ n)), x ∣ succ (succ n)
ne_n : ¬∑ x in properDivisors (succ (succ n)), x = succ (succ n)
hlt : ∑ x in properDivisors (succ (succ n)), x < succ (succ n)
⊢ 1 = ∑ x in properDivisors (succ (succ n)), x
[PROOFSTEP]
rw [← mem_singleton,
  eq_properDivisors_of_subset_of_sum_eq_sum (singleton_subset_iff.2 (mem_properDivisors.2 ⟨h, hlt⟩)) sum_singleton,
  mem_properDivisors]
[GOAL]
case succ.succ
n : ℕ
h : ∑ x in properDivisors (succ (succ n)), x ∣ succ (succ n)
ne_n : ¬∑ x in properDivisors (succ (succ n)), x = succ (succ n)
hlt : ∑ x in properDivisors (succ (succ n)), x < succ (succ n)
⊢ 1 ∣ succ (succ n) ∧ 1 < succ (succ n)
[PROOFSTEP]
refine' ⟨one_dvd _, Nat.succ_lt_succ (Nat.succ_pos _)⟩
[GOAL]
n : ℕ
α : Type u_1
inst✝ : CommMonoid α
p : ℕ
f : ℕ → α
h : Prime p
⊢ ∏ x in Nat.properDivisors p, f x = f 1
[PROOFSTEP]
simp [h.properDivisors]
[GOAL]
n : ℕ
α : Type u_1
inst✝ : CommMonoid α
p : ℕ
f : ℕ → α
h : Prime p
⊢ ∏ x in Nat.divisors p, f x = f p * f 1
[PROOFSTEP]
rw [← cons_self_properDivisors h.ne_zero, prod_cons, h.prod_properDivisors]
[GOAL]
n : ℕ
⊢ properDivisors n = {1} ↔ Prime n
[PROOFSTEP]
refine ⟨?_, ?_⟩
[GOAL]
case refine_1
n : ℕ
⊢ properDivisors n = {1} → Prime n
[PROOFSTEP]
intro h
[GOAL]
case refine_1
n : ℕ
h : properDivisors n = {1}
⊢ Prime n
[PROOFSTEP]
refine' Nat.prime_def_lt''.mpr ⟨_, fun m hdvd => _⟩
[GOAL]
case refine_1.refine'_1
n : ℕ
h : properDivisors n = {1}
⊢ 2 ≤ n
[PROOFSTEP]
match n with
| 0 => contradiction
| 1 => contradiction
| Nat.succ (Nat.succ n) => simp [succ_le_succ]
[GOAL]
n : ℕ
h : properDivisors 0 = {1}
⊢ 2 ≤ 0
[PROOFSTEP]
contradiction
[GOAL]
n : ℕ
h : properDivisors 1 = {1}
⊢ 2 ≤ 1
[PROOFSTEP]
contradiction
[GOAL]
n✝ n : ℕ
h : properDivisors (succ (succ n)) = {1}
⊢ 2 ≤ succ (succ n)
[PROOFSTEP]
simp [succ_le_succ]
[GOAL]
case refine_1.refine'_2
n : ℕ
h : properDivisors n = {1}
m : ℕ
hdvd : m ∣ n
⊢ m = 1 ∨ m = n
[PROOFSTEP]
rw [← mem_singleton, ← h, mem_properDivisors]
[GOAL]
case refine_1.refine'_2
n : ℕ
h : properDivisors n = {1}
m : ℕ
hdvd : m ∣ n
⊢ m ∣ n ∧ m < n ∨ m = n
[PROOFSTEP]
have := Nat.le_of_dvd ?_ hdvd
[GOAL]
case refine_1.refine'_2.refine_2
n : ℕ
h : properDivisors n = {1}
m : ℕ
hdvd : m ∣ n
this : m ≤ n
⊢ m ∣ n ∧ m < n ∨ m = n
[PROOFSTEP]
simp [hdvd, this]
[GOAL]
case refine_1.refine'_2.refine_2
n : ℕ
h : properDivisors n = {1}
m : ℕ
hdvd : m ∣ n
this : m ≤ n
⊢ m < n ∨ m = n
[PROOFSTEP]
exact (le_iff_eq_or_lt.mp this).symm
[GOAL]
case refine_1.refine'_2.refine_1
n : ℕ
h : properDivisors n = {1}
m : ℕ
hdvd : m ∣ n
⊢ 0 < n
[PROOFSTEP]
by_contra'
[GOAL]
case refine_1.refine'_2.refine_1
n : ℕ
h : properDivisors n = {1}
m : ℕ
hdvd : m ∣ n
this : n ≤ 0
⊢ False
[PROOFSTEP]
simp [nonpos_iff_eq_zero.mp this, this] at h
[GOAL]
case refine_2
n : ℕ
⊢ Prime n → properDivisors n = {1}
[PROOFSTEP]
exact fun h => Prime.properDivisors h
[GOAL]
n : ℕ
⊢ ∑ x in properDivisors n, x = 1 ↔ Prime n
[PROOFSTEP]
cases' n with n
[GOAL]
case zero
⊢ ∑ x in properDivisors zero, x = 1 ↔ Prime zero
[PROOFSTEP]
simp [Nat.not_prime_zero]
[GOAL]
case succ
n : ℕ
⊢ ∑ x in properDivisors (succ n), x = 1 ↔ Prime (succ n)
[PROOFSTEP]
cases n
[GOAL]
case succ.zero
⊢ ∑ x in properDivisors (succ zero), x = 1 ↔ Prime (succ zero)
[PROOFSTEP]
simp [Nat.not_prime_one]
[GOAL]
case succ.succ
n✝ : ℕ
⊢ ∑ x in properDivisors (succ (succ n✝)), x = 1 ↔ Prime (succ (succ n✝))
[PROOFSTEP]
rw [← properDivisors_eq_singleton_one_iff_prime]
[GOAL]
case succ.succ
n✝ : ℕ
⊢ ∑ x in properDivisors (succ (succ n✝)), x = 1 ↔ properDivisors (succ (succ n✝)) = {1}
[PROOFSTEP]
refine' ⟨fun h => _, fun h => h.symm ▸ sum_singleton⟩
[GOAL]
case succ.succ
n✝ : ℕ
h : ∑ x in properDivisors (succ (succ n✝)), x = 1
⊢ properDivisors (succ (succ n✝)) = {1}
[PROOFSTEP]
rw [@eq_comm (Finset ℕ) _ _]
[GOAL]
case succ.succ
n✝ : ℕ
h : ∑ x in properDivisors (succ (succ n✝)), x = 1
⊢ {1} = properDivisors (succ (succ n✝))
[PROOFSTEP]
apply
  eq_properDivisors_of_subset_of_sum_eq_sum
    (singleton_subset_iff.2 (one_mem_properDivisors_iff_one_lt.2 (succ_lt_succ (Nat.succ_pos _))))
    (Eq.trans sum_singleton h.symm)
[GOAL]
n p : ℕ
pp : Prime p
k x : ℕ
⊢ x ∈ properDivisors (p ^ k) ↔ ∃ j x_1, x = p ^ j
[PROOFSTEP]
rw [mem_properDivisors, Nat.dvd_prime_pow pp, ← exists_and_right]
[GOAL]
n p : ℕ
pp : Prime p
k x : ℕ
⊢ (∃ x_1, (x_1 ≤ k ∧ x = p ^ x_1) ∧ x < p ^ k) ↔ ∃ j x_1, x = p ^ j
[PROOFSTEP]
simp only [exists_prop, and_assoc]
[GOAL]
n p : ℕ
pp : Prime p
k x : ℕ
⊢ (∃ x_1, x_1 ≤ k ∧ x = p ^ x_1 ∧ x < p ^ k) ↔ ∃ j, j < k ∧ x = p ^ j
[PROOFSTEP]
apply exists_congr
[GOAL]
case h
n p : ℕ
pp : Prime p
k x : ℕ
⊢ ∀ (a : ℕ), a ≤ k ∧ x = p ^ a ∧ x < p ^ k ↔ a < k ∧ x = p ^ a
[PROOFSTEP]
intro a
[GOAL]
case h
n p : ℕ
pp : Prime p
k x a : ℕ
⊢ a ≤ k ∧ x = p ^ a ∧ x < p ^ k ↔ a < k ∧ x = p ^ a
[PROOFSTEP]
constructor
[GOAL]
case h.mp
n p : ℕ
pp : Prime p
k x a : ℕ
⊢ a ≤ k ∧ x = p ^ a ∧ x < p ^ k → a < k ∧ x = p ^ a
[PROOFSTEP]
intro h
[GOAL]
case h.mpr
n p : ℕ
pp : Prime p
k x a : ℕ
⊢ a < k ∧ x = p ^ a → a ≤ k ∧ x = p ^ a ∧ x < p ^ k
[PROOFSTEP]
intro h
[GOAL]
case h.mp
n p : ℕ
pp : Prime p
k x a : ℕ
h : a ≤ k ∧ x = p ^ a ∧ x < p ^ k
⊢ a < k ∧ x = p ^ a
[PROOFSTEP]
rcases h with ⟨_h_left, rfl, h_right⟩
[GOAL]
case h.mp.intro.intro
n p : ℕ
pp : Prime p
k a : ℕ
_h_left : a ≤ k
h_right : p ^ a < p ^ k
⊢ a < k ∧ p ^ a = p ^ a
[PROOFSTEP]
rw [pow_lt_pow_iff pp.one_lt] at h_right
[GOAL]
case h.mp.intro.intro
n p : ℕ
pp : Prime p
k a : ℕ
_h_left : a ≤ k
h_right : a < k
⊢ a < k ∧ p ^ a = p ^ a
[PROOFSTEP]
exact ⟨h_right, by rfl⟩
[GOAL]
n p : ℕ
pp : Prime p
k a : ℕ
_h_left : a ≤ k
h_right : a < k
⊢ p ^ a = p ^ a
[PROOFSTEP]
rfl
[GOAL]
case h.mpr
n p : ℕ
pp : Prime p
k x a : ℕ
h : a < k ∧ x = p ^ a
⊢ a ≤ k ∧ x = p ^ a ∧ x < p ^ k
[PROOFSTEP]
rcases h with ⟨h_left, rfl⟩
[GOAL]
case h.mpr.intro
n p : ℕ
pp : Prime p
k a : ℕ
h_left : a < k
⊢ a ≤ k ∧ p ^ a = p ^ a ∧ p ^ a < p ^ k
[PROOFSTEP]
rw [pow_lt_pow_iff pp.one_lt]
[GOAL]
case h.mpr.intro
n p : ℕ
pp : Prime p
k a : ℕ
h_left : a < k
⊢ a ≤ k ∧ p ^ a = p ^ a ∧ a < k
[PROOFSTEP]
simp [h_left, le_of_lt]
[GOAL]
n p : ℕ
pp : Prime p
k : ℕ
⊢ properDivisors (p ^ k) = map { toFun := Nat.pow p, inj' := (_ : Function.Injective fun n => p ^ n) } (range k)
[PROOFSTEP]
ext a
[GOAL]
case a
n p : ℕ
pp : Prime p
k a : ℕ
⊢ a ∈ properDivisors (p ^ k) ↔ a ∈ map { toFun := Nat.pow p, inj' := (_ : Function.Injective fun n => p ^ n) } (range k)
[PROOFSTEP]
simp only [mem_properDivisors, Nat.isUnit_iff, mem_map, mem_range, Function.Embedding.coeFn_mk, pow_eq]
[GOAL]
case a
n p : ℕ
pp : Prime p
k a : ℕ
⊢ a ∣ p ^ k ∧ a < p ^ k ↔ ∃ a_1, a_1 < k ∧ p ^ a_1 = a
[PROOFSTEP]
have := mem_properDivisors_prime_pow pp k (x := a)
[GOAL]
case a
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∈ properDivisors (p ^ k) ↔ ∃ j x, a = p ^ j
⊢ a ∣ p ^ k ∧ a < p ^ k ↔ ∃ a_1, a_1 < k ∧ p ^ a_1 = a
[PROOFSTEP]
rw [mem_properDivisors] at this
[GOAL]
case a
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ a < p ^ k ↔ ∃ j x, a = p ^ j
⊢ a ∣ p ^ k ∧ a < p ^ k ↔ ∃ a_1, a_1 < k ∧ p ^ a_1 = a
[PROOFSTEP]
rw [this]
[GOAL]
case a
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ a < p ^ k ↔ ∃ j x, a = p ^ j
⊢ (∃ j x, a = p ^ j) ↔ ∃ a_1, a_1 < k ∧ p ^ a_1 = a
[PROOFSTEP]
refine ⟨?_, ?_⟩
[GOAL]
case a.refine_1
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ a < p ^ k ↔ ∃ j x, a = p ^ j
⊢ (∃ j x, a = p ^ j) → ∃ a_2, a_2 < k ∧ p ^ a_2 = a
[PROOFSTEP]
intro h
[GOAL]
case a.refine_1
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ a < p ^ k ↔ ∃ j x, a = p ^ j
h : ∃ j x, a = p ^ j
⊢ ∃ a_1, a_1 < k ∧ p ^ a_1 = a
[PROOFSTEP]
rcases h with ⟨j, hj, hap⟩
[GOAL]
case a.refine_1.intro.intro
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ a < p ^ k ↔ ∃ j x, a = p ^ j
j : ℕ
hj : j < k
hap : a = p ^ j
⊢ ∃ a_1, a_1 < k ∧ p ^ a_1 = a
[PROOFSTEP]
use j
[GOAL]
case h
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ a < p ^ k ↔ ∃ j x, a = p ^ j
j : ℕ
hj : j < k
hap : a = p ^ j
⊢ j < k ∧ p ^ j = a
[PROOFSTEP]
tauto
[GOAL]
case a.refine_2
n p : ℕ
pp : Prime p
k a : ℕ
this : a ∣ p ^ k ∧ a < p ^ k ↔ ∃ j x, a = p ^ j
⊢ (∃ a_1, a_1 < k ∧ p ^ a_1 = a) → ∃ j x, a = p ^ j
[PROOFSTEP]
tauto
[GOAL]
n : ℕ
α : Type u_1
inst✝ : CommMonoid α
k p : ℕ
f : ℕ → α
h : Prime p
⊢ ∏ x in properDivisors (p ^ k), f x = ∏ x in range k, f (p ^ x)
[PROOFSTEP]
simp [h, properDivisors_prime_pow]
[GOAL]
n : ℕ
α : Type u_1
inst✝ : CommMonoid α
k p : ℕ
f : ℕ → α
h : Prime p
⊢ ∏ x in divisors (p ^ k), f x = ∏ x in range (k + 1), f (p ^ x)
[PROOFSTEP]
simp [h, divisors_prime_pow]
[GOAL]
n✝ : ℕ
M : Type u_1
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
⊢ ∏ i in divisorsAntidiagonal n, f i.fst i.snd = ∏ i in divisors n, f i (n / i)
[PROOFSTEP]
rw [← map_div_right_divisors, Finset.prod_map]
[GOAL]
n✝ : ℕ
M : Type u_1
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
⊢ ∏ x in divisors n,
      f
        (↑{ toFun := fun d => (d, n / d),
                inj' :=
                  (_ :
                    ∀ (p₁ p₂ : ℕ),
                      (fun d => (d, n / d)) p₁ = (fun d => (d, n / d)) p₂ →
                        ((fun d => (d, n / d)) p₁).fst = ((fun d => (d, n / d)) p₂).fst) }
            x).fst
        (↑{ toFun := fun d => (d, n / d),
                inj' :=
                  (_ :
                    ∀ (p₁ p₂ : ℕ),
                      (fun d => (d, n / d)) p₁ = (fun d => (d, n / d)) p₂ →
                        ((fun d => (d, n / d)) p₁).fst = ((fun d => (d, n / d)) p₂).fst) }
            x).snd =
    ∏ i in divisors n, f i (n / i)
[PROOFSTEP]
rfl
[GOAL]
n✝ : ℕ
M : Type u_1
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
⊢ ∏ i in divisorsAntidiagonal n, f i.fst i.snd = ∏ i in divisors n, f (n / i) i
[PROOFSTEP]
rw [← map_swap_divisorsAntidiagonal, Finset.prod_map]
[GOAL]
n✝ : ℕ
M : Type u_1
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
⊢ ∏ x in divisorsAntidiagonal n,
      f (↑(Equiv.toEmbedding (Equiv.prodComm ℕ ℕ)) x).fst (↑(Equiv.toEmbedding (Equiv.prodComm ℕ ℕ)) x).snd =
    ∏ i in divisors n, f (n / i) i
[PROOFSTEP]
exact prod_divisorsAntidiagonal fun i j => f j i
[GOAL]
n✝ n : ℕ
⊢ List.toFinset (factors n) = filter Prime (divisors n)
[PROOFSTEP]
rcases n.eq_zero_or_pos with (rfl | hn)
[GOAL]
case inl
n : ℕ
⊢ List.toFinset (factors 0) = filter Prime (divisors 0)
[PROOFSTEP]
simp
[GOAL]
case inr
n✝ n : ℕ
hn : n > 0
⊢ List.toFinset (factors n) = filter Prime (divisors n)
[PROOFSTEP]
ext q
[GOAL]
case inr.a
n✝ n : ℕ
hn : n > 0
q : ℕ
⊢ q ∈ List.toFinset (factors n) ↔ q ∈ filter Prime (divisors n)
[PROOFSTEP]
simpa [hn, hn.ne', mem_factors] using and_comm
[GOAL]
n✝ n : ℕ
⊢ image (fun x => n / x) (divisors n) = divisors n
[PROOFSTEP]
by_cases hn : n = 0
[GOAL]
case pos
n✝ n : ℕ
hn : n = 0
⊢ image (fun x => n / x) (divisors n) = divisors n
[PROOFSTEP]
simp [hn]
[GOAL]
case neg
n✝ n : ℕ
hn : ¬n = 0
⊢ image (fun x => n / x) (divisors n) = divisors n
[PROOFSTEP]
ext a
[GOAL]
case neg.a
n✝ n : ℕ
hn : ¬n = 0
a : ℕ
⊢ a ∈ image (fun x => n / x) (divisors n) ↔ a ∈ divisors n
[PROOFSTEP]
constructor
[GOAL]
case neg.a.mp
n✝ n : ℕ
hn : ¬n = 0
a : ℕ
⊢ a ∈ image (fun x => n / x) (divisors n) → a ∈ divisors n
[PROOFSTEP]
rw [mem_image]
[GOAL]
case neg.a.mp
n✝ n : ℕ
hn : ¬n = 0
a : ℕ
⊢ (∃ a_1, a_1 ∈ divisors n ∧ n / a_1 = a) → a ∈ divisors n
[PROOFSTEP]
rintro ⟨x, hx1, hx2⟩
[GOAL]
case neg.a.mp.intro.intro
n✝ n : ℕ
hn : ¬n = 0
a x : ℕ
hx1 : x ∈ divisors n
hx2 : n / x = a
⊢ a ∈ divisors n
[PROOFSTEP]
rw [mem_divisors] at *
[GOAL]
case neg.a.mp.intro.intro
n✝ n : ℕ
hn : ¬n = 0
a x : ℕ
hx1 : x ∣ n ∧ n ≠ 0
hx2 : n / x = a
⊢ a ∣ n ∧ n ≠ 0
[PROOFSTEP]
refine' ⟨_, hn⟩
[GOAL]
case neg.a.mp.intro.intro
n✝ n : ℕ
hn : ¬n = 0
a x : ℕ
hx1 : x ∣ n ∧ n ≠ 0
hx2 : n / x = a
⊢ a ∣ n
[PROOFSTEP]
rw [← hx2]
[GOAL]
case neg.a.mp.intro.intro
n✝ n : ℕ
hn : ¬n = 0
a x : ℕ
hx1 : x ∣ n ∧ n ≠ 0
hx2 : n / x = a
⊢ n / x ∣ n
[PROOFSTEP]
exact div_dvd_of_dvd hx1.1
[GOAL]
case neg.a.mpr
n✝ n : ℕ
hn : ¬n = 0
a : ℕ
⊢ a ∈ divisors n → a ∈ image (fun x => n / x) (divisors n)
[PROOFSTEP]
rw [mem_divisors, mem_image]
[GOAL]
case neg.a.mpr
n✝ n : ℕ
hn : ¬n = 0
a : ℕ
⊢ a ∣ n ∧ n ≠ 0 → ∃ a_2, a_2 ∈ divisors n ∧ n / a_2 = a
[PROOFSTEP]
rintro ⟨h1, -⟩
[GOAL]
case neg.a.mpr.intro
n✝ n : ℕ
hn : ¬n = 0
a : ℕ
h1 : a ∣ n
⊢ ∃ a_1, a_1 ∈ divisors n ∧ n / a_1 = a
[PROOFSTEP]
exact ⟨n / a, mem_divisors.mpr ⟨div_dvd_of_dvd h1, hn⟩, Nat.div_div_self h1 hn⟩
[GOAL]
n✝ : ℕ
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : ℕ → α
⊢ ∏ d in divisors n, f (n / d) = Finset.prod (divisors n) f
[PROOFSTEP]
by_cases hn : n = 0
[GOAL]
case pos
n✝ : ℕ
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : ℕ → α
hn : n = 0
⊢ ∏ d in divisors n, f (n / d) = Finset.prod (divisors n) f
[PROOFSTEP]
simp [hn]
[GOAL]
case neg
n✝ : ℕ
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : ℕ → α
hn : ¬n = 0
⊢ ∏ d in divisors n, f (n / d) = Finset.prod (divisors n) f
[PROOFSTEP]
rw [← prod_image]
[GOAL]
case neg
n✝ : ℕ
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : ℕ → α
hn : ¬n = 0
⊢ ∏ x in image (fun d => n / d) (divisors n), f x = Finset.prod (divisors n) f
[PROOFSTEP]
exact prod_congr (image_div_divisors_eq_divisors n) (by simp)
[GOAL]
n✝ : ℕ
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : ℕ → α
hn : ¬n = 0
⊢ ∀ (x : ℕ), x ∈ divisors n → f x = f x
[PROOFSTEP]
simp
[GOAL]
case neg
n✝ : ℕ
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : ℕ → α
hn : ¬n = 0
⊢ ∀ (x : ℕ), x ∈ divisors n → ∀ (y : ℕ), y ∈ divisors n → n / x = n / y → x = y
[PROOFSTEP]
intro x hx y hy h
[GOAL]
case neg
n✝ : ℕ
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : ℕ → α
hn : ¬n = 0
x : ℕ
hx : x ∈ divisors n
y : ℕ
hy : y ∈ divisors n
h : n / x = n / y
⊢ x = y
[PROOFSTEP]
rw [mem_divisors] at hx hy
[GOAL]
case neg
n✝ : ℕ
α : Type u_1
inst✝ : CommMonoid α
n : ℕ
f : ℕ → α
hn : ¬n = 0
x : ℕ
hx : x ∣ n ∧ n ≠ 0
y : ℕ
hy : y ∣ n ∧ n ≠ 0
h : n / x = n / y
⊢ x = y
[PROOFSTEP]
exact (div_eq_iff_eq_of_dvd_dvd hn hx.1 hy.1).mp h


[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : NonUnitalNonAssocSemiring R
a : R
l : List R
h : ∀ (b : R), b ∈ l → Commute a b
⊢ Commute a (sum l)
[PROOFSTEP]
induction' l with x xs ih
[GOAL]
case nil
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : NonUnitalNonAssocSemiring R
a : R
l : List R
h✝ : ∀ (b : R), b ∈ l → Commute a b
h : ∀ (b : R), b ∈ [] → Commute a b
⊢ Commute a (sum [])
[PROOFSTEP]
exact Commute.zero_right _
[GOAL]
case cons
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : NonUnitalNonAssocSemiring R
a : R
l : List R
h✝ : ∀ (b : R), b ∈ l → Commute a b
x : R
xs : List R
ih : (∀ (b : R), b ∈ xs → Commute a b) → Commute a (sum xs)
h : ∀ (b : R), b ∈ x :: xs → Commute a b
⊢ Commute a (sum (x :: xs))
[PROOFSTEP]
rw [List.sum_cons]
[GOAL]
case cons
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : NonUnitalNonAssocSemiring R
a : R
l : List R
h✝ : ∀ (b : R), b ∈ l → Commute a b
x : R
xs : List R
ih : (∀ (b : R), b ∈ xs → Commute a b) → Commute a (sum xs)
h : ∀ (b : R), b ∈ x :: xs → Commute a b
⊢ Commute a (x + sum xs)
[PROOFSTEP]
exact (h _ <| mem_cons_self _ _).add_right (ih fun j hj => h _ <| mem_cons_of_mem _ hj)
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : CanonicallyOrderedMonoid M
l : List M
h : ∀ (x : M), x ∈ l → x = 1
⊢ prod l = 1
[PROOFSTEP]
rw [List.eq_replicate.2 ⟨_, h⟩, prod_replicate, one_pow]
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : CanonicallyOrderedMonoid M
l : List M
h : ∀ (x : M), x ∈ l → x = 1
⊢ ℕ
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : CanonicallyOrderedMonoid M
l : List M
h : ∀ (x : M), x ∈ l → x = 1
⊢ length l = ?m.7726
[PROOFSTEP]
exact (length l)
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : CanonicallyOrderedMonoid M
l : List M
h : ∀ (x : M), x ∈ l → x = 1
⊢ length l = length l
[PROOFSTEP]
rfl
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
l : List ℤ
h : prod l = -1
⊢ -1 ∈ l
[PROOFSTEP]
obtain ⟨x, h₁, h₂⟩ := exists_mem_ne_one_of_prod_ne_one (ne_of_eq_of_ne h (by decide))
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
l : List ℤ
h : prod l = -1
⊢ -1 ≠ 1
[PROOFSTEP]
decide
[GOAL]
case intro.intro
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
l : List ℤ
h : prod l = -1
x : ℤ
h₁ : x ∈ l
h₂ : x ≠ 1
⊢ -1 ∈ l
[PROOFSTEP]
exact
  Or.resolve_left (Int.isUnit_iff.mp (prod_isUnit_iff.mp (h.symm ▸ IsUnit.neg isUnit_one : IsUnit l.prod) x h₁)) h₂ ▸ h₁
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
L : List ℕ
h : ∀ (i : ℕ), i ∈ L → 1 ≤ i
⊢ length L ≤ sum L
[PROOFSTEP]
induction' L with j L IH h
[GOAL]
case nil
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
L : List ℕ
h✝ : ∀ (i : ℕ), i ∈ L → 1 ≤ i
h : ∀ (i : ℕ), i ∈ [] → 1 ≤ i
⊢ length [] ≤ sum []
[PROOFSTEP]
simp
[GOAL]
case cons
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
L✝ : List ℕ
h✝ : ∀ (i : ℕ), i ∈ L✝ → 1 ≤ i
j : ℕ
L : List ℕ
IH : (∀ (i : ℕ), i ∈ L → 1 ≤ i) → length L ≤ sum L
h : ∀ (i : ℕ), i ∈ j :: L → 1 ≤ i
⊢ length (j :: L) ≤ sum (j :: L)
[PROOFSTEP]
rw [sum_cons, length, add_comm]
[GOAL]
case cons
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
L✝ : List ℕ
h✝ : ∀ (i : ℕ), i ∈ L✝ → 1 ≤ i
j : ℕ
L : List ℕ
IH : (∀ (i : ℕ), i ∈ L → 1 ≤ i) → length L ≤ sum L
h : ∀ (i : ℕ), i ∈ j :: L → 1 ≤ i
⊢ 1 + length L ≤ j + sum L
[PROOFSTEP]
exact add_le_add (h _ (mem_cons_self _ _)) (IH fun i hi => h i (mem_cons.2 (Or.inr hi)))
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : CommMonoid M
a : M
l : List M
ha : a ∈ l
⊢ a ∣ prod l
[PROOFSTEP]
let ⟨s, t, h⟩ := mem_split ha
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : CommMonoid M
a : M
l : List M
ha : a ∈ l
s t : List M
h : l = s ++ a :: t
⊢ a ∣ prod l
[PROOFSTEP]
rw [h, prod_append, prod_cons, mul_left_comm]
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : CommMonoid M
a : M
l : List M
ha : a ∈ l
s t : List M
h : l = s ++ a :: t
⊢ a ∣ a * (prod s * prod t)
[PROOFSTEP]
exact dvd_mul_right _ _
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : Semiring R
a : R
l : List R
h : ∀ (x : R), x ∈ l → a ∣ x
⊢ a ∣ sum l
[PROOFSTEP]
induction' l with x l ih
[GOAL]
case nil
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : Semiring R
a : R
l : List R
h✝ : ∀ (x : R), x ∈ l → a ∣ x
h : ∀ (x : R), x ∈ [] → a ∣ x
⊢ a ∣ sum []
[PROOFSTEP]
exact dvd_zero _
[GOAL]
case cons
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : Semiring R
a : R
l✝ : List R
h✝ : ∀ (x : R), x ∈ l✝ → a ∣ x
x : R
l : List R
ih : (∀ (x : R), x ∈ l → a ∣ x) → a ∣ sum l
h : ∀ (x_1 : R), x_1 ∈ x :: l → a ∣ x_1
⊢ a ∣ sum (x :: l)
[PROOFSTEP]
rw [List.sum_cons]
[GOAL]
case cons
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : Semiring R
a : R
l✝ : List R
h✝ : ∀ (x : R), x ∈ l✝ → a ∣ x
x : R
l : List R
ih : (∀ (x : R), x ∈ l → a ∣ x) → a ∣ sum l
h : ∀ (x_1 : R), x_1 ∈ x :: l → a ∣ x_1
⊢ a ∣ x + sum l
[PROOFSTEP]
exact dvd_add (h _ (mem_cons_self _ _)) (ih fun x hx => h x (mem_cons_of_mem _ hx))
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : CommGroup α
l₂ : List α
⊢ alternatingProd ([] ++ l₂) = alternatingProd [] * alternatingProd l₂ ^ (-1) ^ length []
[PROOFSTEP]
simp
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : CommGroup α
a : α
l₁ l₂ : List α
⊢ alternatingProd (a :: l₁ ++ l₂) = alternatingProd (a :: l₁) * alternatingProd l₂ ^ (-1) ^ length (a :: l₁)
[PROOFSTEP]
simp_rw [cons_append, alternatingProd_cons, alternatingProd_append, length_cons, pow_succ, neg_mul, one_mul, zpow_neg, ←
  div_eq_mul_inv, div_div]
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : CommGroup α
⊢ alternatingProd (reverse []) = alternatingProd [] ^ (-1) ^ (length [] + 1)
[PROOFSTEP]
simp only [alternatingProd_nil, one_zpow, reverse_nil]
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : CommGroup α
a : α
l : List α
⊢ alternatingProd (reverse (a :: l)) = alternatingProd (a :: l) ^ (-1) ^ (length (a :: l) + 1)
[PROOFSTEP]
simp_rw [reverse_cons, alternatingProd_append, alternatingProd_reverse, alternatingProd_singleton, alternatingProd_cons,
  length_reverse, length, pow_succ, neg_mul, one_mul, zpow_neg, inv_inv]
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : CommGroup α
a : α
l : List α
⊢ (alternatingProd l ^ (-1) ^ length l)⁻¹ * a ^ (-1) ^ length l = (a / alternatingProd l) ^ (-1) ^ length l
[PROOFSTEP]
rw [mul_comm, ← div_eq_mul_inv, div_zpow]
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : Monoid M
⊢ ∀ (l : List M), op (prod l) = prod (reverse (map op l))
[PROOFSTEP]
intro l
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : Monoid M
l : List M
⊢ op (prod l) = prod (reverse (map op l))
[PROOFSTEP]
induction l with
| nil => rfl
| cons x xs ih => rw [List.prod_cons, List.map_cons, List.reverse_cons', List.prod_concat, op_mul, ih]
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : Monoid M
l : List M
⊢ op (prod l) = prod (reverse (map op l))
[PROOFSTEP]
induction l with
| nil => rfl
| cons x xs ih => rw [List.prod_cons, List.map_cons, List.reverse_cons', List.prod_concat, op_mul, ih]
[GOAL]
case nil
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : Monoid M
⊢ op (prod []) = prod (reverse (map op []))
[PROOFSTEP]

| nil => rfl
[GOAL]
case nil
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : Monoid M
⊢ op (prod []) = prod (reverse (map op []))
[PROOFSTEP]
rfl
[GOAL]
case cons
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : Monoid M
x : M
xs : List M
ih : op (prod xs) = prod (reverse (map op xs))
⊢ op (prod (x :: xs)) = prod (reverse (map op (x :: xs)))
[PROOFSTEP]

| cons x xs ih => rw [List.prod_cons, List.map_cons, List.reverse_cons', List.prod_concat, op_mul, ih]
[GOAL]
case cons
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : Monoid M
x : M
xs : List M
ih : op (prod xs) = prod (reverse (map op xs))
⊢ op (prod (x :: xs)) = prod (reverse (map op (x :: xs)))
[PROOFSTEP]
rw [List.prod_cons, List.map_cons, List.reverse_cons', List.prod_concat, op_mul, ih]
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝ : Monoid M
l : List Mᵐᵒᵖ
⊢ unop (prod l) = prod (reverse (map unop l))
[PROOFSTEP]
rw [← op_inj, op_unop, MulOpposite.op_list_prod, map_reverse, map_map, reverse_reverse, op_comp_unop, map_id]
[GOAL]
ι : Type u_1
α : Type u_2
M : Type u_3
N : Type u_4
P : Type u_5
M₀ : Type u_6
G : Type u_7
R : Type u_8
inst✝² : Monoid M
inst✝¹ : Monoid N
F : Type u_9
inst✝ : MonoidHomClass F M Nᵐᵒᵖ
f : F
l : List M
⊢ unop (↑f (prod l)) = prod (reverse (map (unop ∘ ↑f) l))
[PROOFSTEP]
rw [map_list_prod f l, MulOpposite.unop_list_prod, List.map_map]


[GOAL]
α : Type u_1
β : Type u_2
l✝ l : List α
p : Palindrome l
⊢ reverse l = l
[PROOFSTEP]
induction p
[GOAL]
case nil
α : Type u_1
β : Type u_2
l✝ l : List α
⊢ reverse [] = []
[PROOFSTEP]
try (exact rfl)
[GOAL]
case nil
α : Type u_1
β : Type u_2
l✝ l : List α
⊢ reverse [] = []
[PROOFSTEP]
exact rfl
[GOAL]
case singleton
α : Type u_1
β : Type u_2
l✝ l : List α
x✝ : α
⊢ reverse [x✝] = [x✝]
[PROOFSTEP]
try (exact rfl)
[GOAL]
case singleton
α : Type u_1
β : Type u_2
l✝ l : List α
x✝ : α
⊢ reverse [x✝] = [x✝]
[PROOFSTEP]
exact rfl
[GOAL]
case cons_concat
α : Type u_1
β : Type u_2
l✝¹ l : List α
x✝ : α
l✝ : List α
a✝ : Palindrome l✝
a_ih✝ : reverse l✝ = l✝
⊢ reverse (x✝ :: (l✝ ++ [x✝])) = x✝ :: (l✝ ++ [x✝])
[PROOFSTEP]
try (exact rfl)
[GOAL]
case cons_concat
α : Type u_1
β : Type u_2
l✝¹ l : List α
x✝ : α
l✝ : List α
a✝ : Palindrome l✝
a_ih✝ : reverse l✝ = l✝
⊢ reverse (x✝ :: (l✝ ++ [x✝])) = x✝ :: (l✝ ++ [x✝])
[PROOFSTEP]
exact rfl
[GOAL]
case cons_concat
α : Type u_1
β : Type u_2
l✝¹ l : List α
x✝ : α
l✝ : List α
a✝ : Palindrome l✝
a_ih✝ : reverse l✝ = l✝
⊢ reverse (x✝ :: (l✝ ++ [x✝])) = x✝ :: (l✝ ++ [x✝])
[PROOFSTEP]
simp
[GOAL]
case cons_concat
α : Type u_1
β : Type u_2
l✝¹ l : List α
x✝ : α
l✝ : List α
a✝ : Palindrome l✝
a_ih✝ : reverse l✝ = l✝
⊢ reverse l✝ = l✝
[PROOFSTEP]
assumption
[GOAL]
α : Type u_1
β : Type u_2
l✝ l : List α
⊢ reverse l = l → Palindrome l
[PROOFSTEP]
refine' bidirectionalRecOn l (fun _ => Palindrome.nil) (fun a _ => Palindrome.singleton a) _
[GOAL]
α : Type u_1
β : Type u_2
l✝ l : List α
⊢ ∀ (a : α) (l : List α) (b : α),
    (reverse l = l → Palindrome l) → reverse (a :: (l ++ [b])) = a :: (l ++ [b]) → Palindrome (a :: (l ++ [b]))
[PROOFSTEP]
intro x l y hp hr
[GOAL]
α : Type u_1
β : Type u_2
l✝¹ l✝ : List α
x : α
l : List α
y : α
hp : reverse l = l → Palindrome l
hr : reverse (x :: (l ++ [y])) = x :: (l ++ [y])
⊢ Palindrome (x :: (l ++ [y]))
[PROOFSTEP]
rw [reverse_cons, reverse_append] at hr
[GOAL]
α : Type u_1
β : Type u_2
l✝¹ l✝ : List α
x : α
l : List α
y : α
hp : reverse l = l → Palindrome l
hr : reverse [y] ++ reverse l ++ [x] = x :: (l ++ [y])
⊢ Palindrome (x :: (l ++ [y]))
[PROOFSTEP]
rw [head_eq_of_cons_eq hr]
[GOAL]
α : Type u_1
β : Type u_2
l✝¹ l✝ : List α
x : α
l : List α
y : α
hp : reverse l = l → Palindrome l
hr : reverse [y] ++ reverse l ++ [x] = x :: (l ++ [y])
⊢ Palindrome (x :: (l ++ [x]))
[PROOFSTEP]
have : Palindrome l := hp (append_inj_left' (tail_eq_of_cons_eq hr) rfl)
[GOAL]
α : Type u_1
β : Type u_2
l✝¹ l✝ : List α
x : α
l : List α
y : α
hp : reverse l = l → Palindrome l
hr : reverse [y] ++ reverse l ++ [x] = x :: (l ++ [y])
this : Palindrome l
⊢ Palindrome (x :: (l ++ [x]))
[PROOFSTEP]
exact Palindrome.cons_concat x this
[GOAL]
α : Type u_1
β : Type u_2
l✝ l : List α
⊢ Palindrome (l ++ reverse l)
[PROOFSTEP]
apply of_reverse_eq
[GOAL]
case a
α : Type u_1
β : Type u_2
l✝ l : List α
⊢ reverse (l ++ reverse l) = l ++ reverse l
[PROOFSTEP]
rw [reverse_append, reverse_reverse]
[GOAL]
α : Type u_1
β : Type u_2
l : List α
f : α → β
p : Palindrome l
⊢ reverse (map f l) = map f l
[PROOFSTEP]
rw [← map_reverse, p.reverse_eq]


[GOAL]
α : Type u
β : Type v
π : α → Type w
inst✝¹ : Countable α
inst✝ : Countable β
⊢ Countable (α ⊕ β)
[PROOFSTEP]
rcases exists_injective_nat α with ⟨f, hf⟩
[GOAL]
case intro
α : Type u
β : Type v
π : α → Type w
inst✝¹ : Countable α
inst✝ : Countable β
f : α → ℕ
hf : Injective f
⊢ Countable (α ⊕ β)
[PROOFSTEP]
rcases exists_injective_nat β with ⟨g, hg⟩
[GOAL]
case intro.intro
α : Type u
β : Type v
π : α → Type w
inst✝¹ : Countable α
inst✝ : Countable β
f : α → ℕ
hf : Injective f
g : β → ℕ
hg : Injective g
⊢ Countable (α ⊕ β)
[PROOFSTEP]
exact (Equiv.natSumNatEquivNat.injective.comp <| hf.sum_map hg).countable
[GOAL]
α : Type u
β : Type v
π : α → Type w
inst✝¹ : Countable α
inst✝ : Countable β
⊢ Countable (α × β)
[PROOFSTEP]
rcases exists_injective_nat α with ⟨f, hf⟩
[GOAL]
case intro
α : Type u
β : Type v
π : α → Type w
inst✝¹ : Countable α
inst✝ : Countable β
f : α → ℕ
hf : Injective f
⊢ Countable (α × β)
[PROOFSTEP]
rcases exists_injective_nat β with ⟨g, hg⟩
[GOAL]
case intro.intro
α : Type u
β : Type v
π : α → Type w
inst✝¹ : Countable α
inst✝ : Countable β
f : α → ℕ
hf : Injective f
g : β → ℕ
hg : Injective g
⊢ Countable (α × β)
[PROOFSTEP]
exact (Nat.pairEquiv.injective.comp <| hf.Prod_map hg).countable
[GOAL]
α : Type u
β : Type v
π : α → Type w
inst✝¹ : Countable α
inst✝ : ∀ (a : α), Countable (π a)
⊢ Countable (Sigma π)
[PROOFSTEP]
rcases exists_injective_nat α with ⟨f, hf⟩
[GOAL]
case intro
α : Type u
β : Type v
π : α → Type w
inst✝¹ : Countable α
inst✝ : ∀ (a : α), Countable (π a)
f : α → ℕ
hf : Injective f
⊢ Countable (Sigma π)
[PROOFSTEP]
choose g hg using fun a => exists_injective_nat (π a)
[GOAL]
case intro
α : Type u
β : Type v
π : α → Type w
inst✝¹ : Countable α
inst✝ : ∀ (a : α), Countable (π a)
f : α → ℕ
hf : Injective f
g : (a : α) → π a → ℕ
hg : ∀ (a : α), Injective (g a)
⊢ Countable (Sigma π)
[PROOFSTEP]
exact ((Equiv.sigmaEquivProd ℕ ℕ).injective.comp <| hf.sigma_map hg).countable
[GOAL]
α : Sort u
β : Sort v
π : α → Sort w
inst✝¹ : Finite α
inst✝ : ∀ (a : α), Countable (π a)
⊢ Countable ((a : α) → π a)
[PROOFSTEP]
have : ∀ n, Countable (Fin n → ℕ) := by
  intro n
  induction' n with n ihn
  · change Countable (Fin 0 → ℕ); infer_instance
  · haveI := ihn
    exact Countable.of_equiv (ℕ × (Fin n → ℕ)) (Equiv.piFinSucc _ _).symm
[GOAL]
α : Sort u
β : Sort v
π : α → Sort w
inst✝¹ : Finite α
inst✝ : ∀ (a : α), Countable (π a)
⊢ ∀ (n : ℕ), Countable (Fin n → ℕ)
[PROOFSTEP]
intro n
[GOAL]
α : Sort u
β : Sort v
π : α → Sort w
inst✝¹ : Finite α
inst✝ : ∀ (a : α), Countable (π a)
n : ℕ
⊢ Countable (Fin n → ℕ)
[PROOFSTEP]
induction' n with n ihn
[GOAL]
case zero
α : Sort u
β : Sort v
π : α → Sort w
inst✝¹ : Finite α
inst✝ : ∀ (a : α), Countable (π a)
⊢ Countable (Fin Nat.zero → ℕ)
[PROOFSTEP]
change Countable (Fin 0 → ℕ)
[GOAL]
case zero
α : Sort u
β : Sort v
π : α → Sort w
inst✝¹ : Finite α
inst✝ : ∀ (a : α), Countable (π a)
⊢ Countable (Fin 0 → ℕ)
[PROOFSTEP]
infer_instance
[GOAL]
case succ
α : Sort u
β : Sort v
π : α → Sort w
inst✝¹ : Finite α
inst✝ : ∀ (a : α), Countable (π a)
n : ℕ
ihn : Countable (Fin n → ℕ)
⊢ Countable (Fin (Nat.succ n) → ℕ)
[PROOFSTEP]
haveI := ihn
[GOAL]
case succ
α : Sort u
β : Sort v
π : α → Sort w
inst✝¹ : Finite α
inst✝ : ∀ (a : α), Countable (π a)
n : ℕ
ihn this : Countable (Fin n → ℕ)
⊢ Countable (Fin (Nat.succ n) → ℕ)
[PROOFSTEP]
exact Countable.of_equiv (ℕ × (Fin n → ℕ)) (Equiv.piFinSucc _ _).symm
[GOAL]
α : Sort u
β : Sort v
π : α → Sort w
inst✝¹ : Finite α
inst✝ : ∀ (a : α), Countable (π a)
this : ∀ (n : ℕ), Countable (Fin n → ℕ)
⊢ Countable ((a : α) → π a)
[PROOFSTEP]
rcases Finite.exists_equiv_fin α with ⟨n, ⟨e⟩⟩
[GOAL]
case intro.intro
α : Sort u
β : Sort v
π : α → Sort w
inst✝¹ : Finite α
inst✝ : ∀ (a : α), Countable (π a)
this : ∀ (n : ℕ), Countable (Fin n → ℕ)
n : ℕ
e : α ≃ Fin n
⊢ Countable ((a : α) → π a)
[PROOFSTEP]
have f := fun a => (nonempty_embedding_nat (π a)).some
[GOAL]
case intro.intro
α : Sort u
β : Sort v
π : α → Sort w
inst✝¹ : Finite α
inst✝ : ∀ (a : α), Countable (π a)
this : ∀ (n : ℕ), Countable (Fin n → ℕ)
n : ℕ
e : α ≃ Fin n
f : (a : α) → π a ↪ ℕ
⊢ Countable ((a : α) → π a)
[PROOFSTEP]
exact ((Embedding.piCongrRight f).trans (Equiv.piCongrLeft' _ e).toEmbedding).countable


[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Pow M ℕ
P : Prop
inst✝ : Decidable P
a : M
b c : ℕ
⊢ (a ^ if P then b else c) = if P then a ^ b else a ^ c
[PROOFSTEP]
split_ifs
[GOAL]
case pos
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Pow M ℕ
P : Prop
inst✝ : Decidable P
a : M
b c : ℕ
h✝ : P
⊢ a ^ b = a ^ b
[PROOFSTEP]
rfl
[GOAL]
case neg
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Pow M ℕ
P : Prop
inst✝ : Decidable P
a : M
b c : ℕ
h✝ : ¬P
⊢ a ^ c = a ^ c
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Pow M ℕ
P : Prop
inst✝ : Decidable P
a b : M
c : ℕ
⊢ (if P then a else b) ^ c = if P then a ^ c else b ^ c
[PROOFSTEP]
split_ifs
[GOAL]
case pos
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Pow M ℕ
P : Prop
inst✝ : Decidable P
a b : M
c : ℕ
h✝ : P
⊢ a ^ c = a ^ c
[PROOFSTEP]
rfl
[GOAL]
case neg
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Pow M ℕ
P : Prop
inst✝ : Decidable P
a b : M
c : ℕ
h✝ : ¬P
⊢ b ^ c = b ^ c
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
n : ℕ
⊢ n • 0 = 0
[PROOFSTEP]
induction' n with n ih
[GOAL]
case zero
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
⊢ Nat.zero • 0 = 0
[PROOFSTEP]
exact zero_nsmul _
[GOAL]
case succ
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
n : ℕ
ih : n • 0 = 0
⊢ Nat.succ n • 0 = 0
[PROOFSTEP]
rw [succ_nsmul, ih, add_zero]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : A
⊢ 1 • a = a
[PROOFSTEP]
rw [succ_nsmul, zero_nsmul, add_zero]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : A
m n : ℕ
⊢ (m + n) • a = m • a + n • a
[PROOFSTEP]
induction m with
| zero => rw [Nat.zero_add, zero_nsmul, zero_add]
| succ m ih => rw [Nat.succ_add, Nat.succ_eq_add_one, succ_nsmul, ih, succ_nsmul, add_assoc]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : A
m n : ℕ
⊢ (m + n) • a = m • a + n • a
[PROOFSTEP]
induction m with
| zero => rw [Nat.zero_add, zero_nsmul, zero_add]
| succ m ih => rw [Nat.succ_add, Nat.succ_eq_add_one, succ_nsmul, ih, succ_nsmul, add_assoc]
[GOAL]
case zero
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : A
n : ℕ
⊢ (Nat.zero + n) • a = Nat.zero • a + n • a
[PROOFSTEP]

| zero => rw [Nat.zero_add, zero_nsmul, zero_add]
[GOAL]
case zero
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : A
n : ℕ
⊢ (Nat.zero + n) • a = Nat.zero • a + n • a
[PROOFSTEP]
rw [Nat.zero_add, zero_nsmul, zero_add]
[GOAL]
case succ
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : A
n m : ℕ
ih : (m + n) • a = m • a + n • a
⊢ (Nat.succ m + n) • a = Nat.succ m • a + n • a
[PROOFSTEP]

| succ m ih => rw [Nat.succ_add, Nat.succ_eq_add_one, succ_nsmul, ih, succ_nsmul, add_assoc]
[GOAL]
case succ
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : A
n m : ℕ
ih : (m + n) • a = m • a + n • a
⊢ (Nat.succ m + n) • a = Nat.succ m • a + n • a
[PROOFSTEP]
rw [Nat.succ_add, Nat.succ_eq_add_one, succ_nsmul, ih, succ_nsmul, add_assoc]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
n : ℕ
⊢ 1 ^ n = 1
[PROOFSTEP]
induction' n with n ih
[GOAL]
case zero
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
⊢ 1 ^ Nat.zero = 1
[PROOFSTEP]
exact pow_zero _
[GOAL]
case succ
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
n : ℕ
ih : 1 ^ n = 1
⊢ 1 ^ Nat.succ n = 1
[PROOFSTEP]
rw [pow_succ, ih, one_mul]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
⊢ a ^ 1 = a
[PROOFSTEP]
rw [pow_succ, pow_zero, mul_one]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
⊢ a ^ 2 = a * a
[PROOFSTEP]
rw [pow_succ, pow_one]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
⊢ a ^ 3 = a * a * a
[PROOFSTEP]
rw [pow_succ', pow_two]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
⊢ a ^ 3 = a * (a * a)
[PROOFSTEP]
rw [pow_succ, pow_two]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
m n : ℕ
⊢ a ^ (m + n) = a ^ m * a ^ n
[PROOFSTEP]
induction' n with n ih
[GOAL]
case zero
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
m : ℕ
⊢ a ^ (m + Nat.zero) = a ^ m * a ^ Nat.zero
[PROOFSTEP]
rw [Nat.add_zero, pow_zero, mul_one]
[GOAL]
case succ
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
m n : ℕ
ih : a ^ (m + n) = a ^ m * a ^ n
⊢ a ^ (m + Nat.succ n) = a ^ m * a ^ Nat.succ n
[PROOFSTEP]
rw [pow_succ', ← mul_assoc, ← ih, ← pow_succ', Nat.add_assoc]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
m n : ℕ
⊢ a ^ (m * n) = (a ^ m) ^ n
[PROOFSTEP]
induction' n with n ih
[GOAL]
case zero
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
m : ℕ
⊢ a ^ (m * Nat.zero) = (a ^ m) ^ Nat.zero
[PROOFSTEP]
rw [Nat.mul_zero, pow_zero, pow_zero]
[GOAL]
case succ
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
m n : ℕ
ih : a ^ (m * n) = (a ^ m) ^ n
⊢ a ^ (m * Nat.succ n) = (a ^ m) ^ Nat.succ n
[PROOFSTEP]
rw [Nat.mul_succ, pow_add, pow_succ', ih]
  -- Porting note: we are taking the opportunity to swap the names `mul_nsmul` and `mul_nsmul'`
  -- using #align, so that in mathlib4 they will match the multiplicative ones.
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
m n : ℕ
⊢ a ^ (m * n) = (a ^ n) ^ m
[PROOFSTEP]
rw [Nat.mul_comm, pow_mul]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a b : M
h : Commute a b
n : ℕ
⊢ (a * b) ^ n = a ^ n * b ^ n
[PROOFSTEP]
induction' n with n ih
[GOAL]
case zero
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a b : M
h : Commute a b
⊢ (a * b) ^ Nat.zero = a ^ Nat.zero * b ^ Nat.zero
[PROOFSTEP]
rw [pow_zero, pow_zero, pow_zero, one_mul]
[GOAL]
case succ
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a b : M
h : Commute a b
n : ℕ
ih : (a * b) ^ n = a ^ n * b ^ n
⊢ (a * b) ^ Nat.succ n = a ^ Nat.succ n * b ^ Nat.succ n
[PROOFSTEP]
simp only [pow_succ, ih, ← mul_assoc, (h.pow_left n).right_comm]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝² : Monoid M
inst✝¹ : AddMonoid A
P : Prop
inst✝ : Decidable P
a : M
⊢ (a ^ if P then 1 else 0) = if P then a else 1
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
m n : ℕ
⊢ (a ^ m) ^ n = (a ^ n) ^ m
[PROOFSTEP]
rw [← pow_mul, Nat.mul_comm, pow_mul]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
m n : ℕ
h : m ≤ n
⊢ a ^ m * a ^ (n - m) = a ^ n
[PROOFSTEP]
rw [← pow_add, Nat.add_comm, Nat.sub_add_cancel h]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
m n : ℕ
h : m ≤ n
⊢ a ^ (n - m) * a ^ m = a ^ n
[PROOFSTEP]
rw [← pow_add, Nat.sub_add_cancel h]
[GOAL]
α : Type u_1
M✝ : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝² : Monoid M✝
inst✝¹ : AddMonoid A
M : Type u_2
inst✝ : Monoid M
x : M
m n : ℕ
h : x ^ n = 1
⊢ x ^ m = x ^ (m % n)
[PROOFSTEP]
have t : x ^ m = x ^ (n * (m / n) + m % n) :=
  congr_arg (fun a => x ^ a) ((Nat.add_comm _ _).trans (Nat.mod_add_div _ _)).symm
[GOAL]
α : Type u_1
M✝ : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝² : Monoid M✝
inst✝¹ : AddMonoid A
M : Type u_2
inst✝ : Monoid M
x : M
m n : ℕ
h : x ^ n = 1
t : x ^ m = x ^ (n * (m / n) + m % n)
⊢ x ^ m = x ^ (m % n)
[PROOFSTEP]
rw [t, pow_add, pow_mul, h, one_pow, one_mul]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
n : ℕ
⊢ a ^ bit1 n = a ^ n * a ^ n * a
[PROOFSTEP]
rw [bit1, pow_succ', pow_bit0]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
n : ℕ
⊢ a ^ bit0 n = (a * a) ^ n
[PROOFSTEP]
rw [pow_bit0, (Commute.refl a).mul_pow]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a : M
n : ℕ
⊢ a ^ bit1 n = (a * a) ^ n * a
[PROOFSTEP]
rw [bit1, pow_succ', pow_bit0']
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a b : M
n : ℕ
h : a * b = 1
⊢ a ^ n * b ^ n = 1
[PROOFSTEP]
induction' n with n hn
[GOAL]
case zero
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a b : M
h : a * b = 1
⊢ a ^ Nat.zero * b ^ Nat.zero = 1
[PROOFSTEP]
simp
[GOAL]
case succ
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a b : M
h : a * b = 1
n : ℕ
hn : a ^ n * b ^ n = 1
⊢ a ^ Nat.succ n * b ^ Nat.succ n = 1
[PROOFSTEP]
calc
  a ^ n.succ * b ^ n.succ = a ^ n * a * (b * b ^ n) := by rw [pow_succ', pow_succ]
  _ = a ^ n * (a * b) * b ^ n := by simp only [mul_assoc]
  _ = 1 := by simp [h, hn]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a b : M
h : a * b = 1
n : ℕ
hn : a ^ n * b ^ n = 1
⊢ a ^ Nat.succ n * b ^ Nat.succ n = a ^ n * a * (b * b ^ n)
[PROOFSTEP]
rw [pow_succ', pow_succ]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a b : M
h : a * b = 1
n : ℕ
hn : a ^ n * b ^ n = 1
⊢ a ^ n * a * (b * b ^ n) = a ^ n * (a * b) * b ^ n
[PROOFSTEP]
simp only [mul_assoc]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
a b : M
h : a * b = 1
n : ℕ
hn : a ^ n * b ^ n = 1
⊢ a ^ n * (a * b) * b ^ n = 1
[PROOFSTEP]
simp [h, hn]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
x y : M
hxy : x ∣ y
n : ℕ
x✝ : n + 1 ≠ 0
⊢ x ∣ y ^ (n + 1)
[PROOFSTEP]
rw [pow_succ]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝¹ : Monoid M
inst✝ : AddMonoid A
x y : M
hxy : x ∣ y
n : ℕ
x✝ : n + 1 ≠ 0
⊢ x ∣ y * y ^ n
[PROOFSTEP]
exact hxy.mul_right _
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivInvMonoid G
a : G
⊢ a ^ 1 = a
[PROOFSTEP]
convert pow_one a using 1
[GOAL]
case h.e'_2
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivInvMonoid G
a : G
⊢ a ^ 1 = a ^ 1
[PROOFSTEP]
exact zpow_ofNat a 1
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivInvMonoid G
a : G
⊢ a ^ 2 = a * a
[PROOFSTEP]
convert pow_two a using 1
[GOAL]
case h.e'_2
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivInvMonoid G
a : G
⊢ a ^ 2 = a ^ 2
[PROOFSTEP]
exact zpow_ofNat a 2
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a✝ b a : α
⊢ a⁻¹ ^ 0 = (a ^ 0)⁻¹
[PROOFSTEP]
rw [pow_zero, pow_zero, inv_one]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a✝ b a : α
n : ℕ
⊢ a⁻¹ ^ (n + 1) = (a ^ (n + 1))⁻¹
[PROOFSTEP]
rw [pow_succ', pow_succ, inv_pow _ n, mul_inv_rev]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a b : α
n : ℕ
⊢ 1 ^ ↑n = 1
[PROOFSTEP]
rw [zpow_ofNat, one_pow]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a b : α
n : ℕ
⊢ 1 ^ Int.negSucc n = 1
[PROOFSTEP]
rw [zpow_negSucc, one_pow, inv_one]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a✝ b a : α
⊢ a ^ (-0) = (a ^ 0)⁻¹
[PROOFSTEP]
change a ^ (0 : ℤ) = (a ^ (0 : ℤ))⁻¹
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a✝ b a : α
⊢ a ^ 0 = (a ^ 0)⁻¹
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a✝ b a : α
n : ℕ
⊢ a ^ (-Int.negSucc n) = (a ^ Int.negSucc n)⁻¹
[PROOFSTEP]
rw [zpow_negSucc, inv_inv, ← zpow_ofNat]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a✝ b a : α
n : ℕ
⊢ a ^ (-Int.negSucc n) = a ^ ↑(n + 1)
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a✝ b✝ a b : α
⊢ (a * b) ^ (-1) = b ^ (-1) * a ^ (-1)
[PROOFSTEP]
simp only [zpow_neg, zpow_one, mul_inv_rev]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a✝ b a : α
n : ℕ
⊢ a⁻¹ ^ ↑n = (a ^ ↑n)⁻¹
[PROOFSTEP]
rw [zpow_ofNat, zpow_ofNat, inv_pow]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a✝ b a : α
n : ℕ
⊢ a⁻¹ ^ Int.negSucc n = (a ^ Int.negSucc n)⁻¹
[PROOFSTEP]
rw [zpow_negSucc, zpow_negSucc, inv_pow]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a✝ b a : α
n : ℤ
⊢ a⁻¹ ^ n = a ^ (-n)
[PROOFSTEP]
rw [inv_zpow, zpow_neg]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a✝ b a : α
n : ℕ
⊢ (1 / a) ^ n = 1 / a ^ n
[PROOFSTEP]
simp only [one_div, inv_pow]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a✝ b a : α
n : ℤ
⊢ (1 / a) ^ n = 1 / a ^ n
[PROOFSTEP]
simp only [one_div, inv_zpow]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a b : α
h : Commute a b
n : ℕ
⊢ (a * b) ^ ↑n = a ^ ↑n * b ^ ↑n
[PROOFSTEP]
simp [zpow_ofNat, h.mul_pow n]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionMonoid α
a b : α
h : Commute a b
n : ℕ
⊢ (a * b) ^ Int.negSucc n = a ^ Int.negSucc n * b ^ Int.negSucc n
[PROOFSTEP]
simp [h.mul_pow, (h.pow_pow _ _).eq, mul_inv_rev]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionCommMonoid α
a b : α
n : ℕ
⊢ (a / b) ^ n = a ^ n / b ^ n
[PROOFSTEP]
simp only [div_eq_mul_inv, mul_pow, inv_pow]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : DivisionCommMonoid α
a b : α
n : ℤ
⊢ (a / b) ^ n = a ^ n / b ^ n
[PROOFSTEP]
simp only [div_eq_mul_inv, mul_zpow, inv_zpow]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝³ : Group G
inst✝² : Group H
inst✝¹ : AddGroup A
inst✝ : AddGroup B
a : G
m n : ℕ
h : n ≤ m
⊢ a ^ (m - n) * a ^ n = a ^ m
[PROOFSTEP]
rw [← pow_add, Nat.sub_add_cancel h]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝³ : Group G
inst✝² : Group H
inst✝¹ : AddGroup A
inst✝ : AddGroup B
a : G
m n : ℕ
h : n ≤ m
⊢ a⁻¹ ^ (m - n) = (a ^ m)⁻¹ * a ^ n
[PROOFSTEP]
rw [pow_sub a⁻¹ h, inv_pow, inv_pow, inv_inv]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : Monoid R
a : R
m n : ℕ
h : m ≤ n
⊢ a ^ n = a ^ m * a ^ (n - m)
[PROOFSTEP]
rw [← pow_add, Nat.add_comm, Nat.sub_add_cancel h]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : Group G
a x y : G
h : SemiconjBy a x y
n : ℕ
⊢ SemiconjBy a (x ^ ↑n) (y ^ ↑n)
[PROOFSTEP]
simp [zpow_ofNat, h.pow_right n]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : Group G
a x y : G
h : SemiconjBy a x y
n : ℕ
⊢ SemiconjBy a (x ^ Int.negSucc n) (y ^ Int.negSucc n)
[PROOFSTEP]
simp only [zpow_negSucc, inv_right_iff]
[GOAL]
α : Type u_1
M : Type u
N : Type v
G : Type w
H : Type x
A : Type y
B : Type z
R : Type u₁
S : Type u₂
inst✝ : Group G
a x y : G
h : SemiconjBy a x y
n : ℕ
⊢ SemiconjBy a (x ^ (n + 1)) (y ^ (n + 1))
[PROOFSTEP]
apply pow_right h


[GOAL]
m n✝ a✝ b✝ c d : ℤ
a b n : ℕ
⊢ ↑a ≡ ↑b [ZMOD ↑n] ↔ a ≡ b [MOD n]
[PROOFSTEP]
unfold ModEq Nat.ModEq
[GOAL]
m n✝ a✝ b✝ c d : ℤ
a b n : ℕ
⊢ ↑a % ↑n = ↑b % ↑n ↔ a % n = b % n
[PROOFSTEP]
rw [← Int.ofNat_inj]
[GOAL]
m n✝ a✝ b✝ c d : ℤ
a b n : ℕ
⊢ ↑a % ↑n = ↑b % ↑n ↔ ↑(a % n) = ↑(b % n)
[PROOFSTEP]
simp [coe_nat_mod]
[GOAL]
m n a b c d : ℤ
⊢ a ≡ 0 [ZMOD n] ↔ n ∣ a
[PROOFSTEP]
rw [ModEq, zero_emod, dvd_iff_emod_eq_zero]
[GOAL]
m n a b c d : ℤ
⊢ a ≡ b [ZMOD n] ↔ n ∣ b - a
[PROOFSTEP]
rw [ModEq, eq_comm]
[GOAL]
m n a b c d : ℤ
⊢ b % n = a % n ↔ n ∣ b - a
[PROOFSTEP]
simp [emod_eq_emod_iff_emod_sub_eq_zero, dvd_iff_emod_eq_zero]
[GOAL]
m n✝ a✝ b✝ c d a b n : ℤ
⊢ a ≡ b [ZMOD n] ↔ ∃ t, b = a + n * t
[PROOFSTEP]
rw [modEq_iff_dvd]
[GOAL]
m n✝ a✝ b✝ c d a b n : ℤ
⊢ n ∣ b - a ↔ ∃ t, b = a + n * t
[PROOFSTEP]
exact exists_congr fun t => sub_eq_iff_eq_add'
[GOAL]
m n a b c d : ℤ
⊢ -a ≡ -b [ZMOD n] ↔ a ≡ b [ZMOD n]
[PROOFSTEP]
simp [-sub_neg_eq_add, neg_sub_neg, modEq_iff_dvd, dvd_sub_comm]
[GOAL]
m n a b c d : ℤ
⊢ a ≡ b [ZMOD -n] ↔ a ≡ b [ZMOD n]
[PROOFSTEP]
simp [modEq_iff_dvd]
[GOAL]
m n a b c d : ℤ
h : a ≡ b [ZMOD n]
⊢ c * a ≡ c * b [ZMOD c * n]
[PROOFSTEP]
obtain hc | rfl | hc := lt_trichotomy c 0
[GOAL]
case inl
m n a b c d : ℤ
h : a ≡ b [ZMOD n]
hc : c < 0
⊢ c * a ≡ c * b [ZMOD c * n]
[PROOFSTEP]
rw [← neg_modEq_neg, ← modEq_neg, ← neg_mul, ← neg_mul, ← neg_mul]
[GOAL]
case inl
m n a b c d : ℤ
h : a ≡ b [ZMOD n]
hc : c < 0
⊢ -c * a ≡ -c * b [ZMOD -c * n]
[PROOFSTEP]
simp only [ModEq, mul_emod_mul_of_pos _ _ (neg_pos.2 hc), h.eq]
[GOAL]
case inr.inl
m n a b d : ℤ
h : a ≡ b [ZMOD n]
⊢ 0 * a ≡ 0 * b [ZMOD 0 * n]
[PROOFSTEP]
simp
[GOAL]
case inr.inr
m n a b c d : ℤ
h : a ≡ b [ZMOD n]
hc : 0 < c
⊢ c * a ≡ c * b [ZMOD c * n]
[PROOFSTEP]
simp only [ModEq, mul_emod_mul_of_pos _ _ hc, h.eq]
[GOAL]
m n a b c d : ℤ
h : a ≡ b [ZMOD n]
⊢ a * c ≡ b * c [ZMOD n * c]
[PROOFSTEP]
rw [mul_comm a, mul_comm b, mul_comm n]
[GOAL]
m n a b c d : ℤ
h : a ≡ b [ZMOD n]
⊢ c * a ≡ c * b [ZMOD c * n]
[PROOFSTEP]
exact h.mul_left'
[GOAL]
m n a b c d : ℤ
h₁ : a ≡ b [ZMOD n]
h₂ : c ≡ d [ZMOD n]
⊢ n ∣ b + d - (a + c)
[PROOFSTEP]
convert dvd_add h₁.dvd h₂.dvd using 1
[GOAL]
case h.e'_4
m n a b c d : ℤ
h₁ : a ≡ b [ZMOD n]
h₂ : c ≡ d [ZMOD n]
⊢ b + d - (a + c) = b - a + (d - c)
[PROOFSTEP]
ring
[GOAL]
m n a b c d : ℤ
h₁ : a ≡ b [ZMOD n]
h₂ : a + c ≡ b + d [ZMOD n]
⊢ d - c = b + d - (a + c) - (b - a)
[PROOFSTEP]
ring
[GOAL]
m n a b c d : ℤ
h₁ : a ≡ b [ZMOD n]
h₂ : a + c ≡ b + d [ZMOD n]
this : d - c = b + d - (a + c) - (b - a)
⊢ n ∣ d - c
[PROOFSTEP]
rw [this]
[GOAL]
m n a b c d : ℤ
h₁ : a ≡ b [ZMOD n]
h₂ : a + c ≡ b + d [ZMOD n]
this : d - c = b + d - (a + c) - (b - a)
⊢ n ∣ b + d - (a + c) - (b - a)
[PROOFSTEP]
exact dvd_sub h₂.dvd h₁.dvd
[GOAL]
m n a b c d : ℤ
h₁ : c ≡ d [ZMOD n]
h₂ : a + c ≡ b + d [ZMOD n]
⊢ a ≡ b [ZMOD n]
[PROOFSTEP]
rw [add_comm a, add_comm b] at h₂
[GOAL]
m n a b c d : ℤ
h₁ : c ≡ d [ZMOD n]
h₂ : c + a ≡ d + b [ZMOD n]
⊢ a ≡ b [ZMOD n]
[PROOFSTEP]
exact h₁.add_left_cancel h₂
[GOAL]
m n a b c d : ℤ
h : a ≡ b [ZMOD n]
⊢ a + -a ≡ b + -b [ZMOD n]
[PROOFSTEP]
simp_rw [← sub_eq_add_neg, sub_self]
[GOAL]
m n a b c d : ℤ
h : a ≡ b [ZMOD n]
⊢ 0 ≡ 0 [ZMOD n]
[PROOFSTEP]
rfl
[GOAL]
m n a b c d : ℤ
h₁ : a ≡ b [ZMOD n]
h₂ : c ≡ d [ZMOD n]
⊢ a - c ≡ b - d [ZMOD n]
[PROOFSTEP]
rw [sub_eq_add_neg, sub_eq_add_neg]
[GOAL]
m n a b c d : ℤ
h₁ : a ≡ b [ZMOD n]
h₂ : c ≡ d [ZMOD n]
⊢ a + -c ≡ b + -d [ZMOD n]
[PROOFSTEP]
exact h₁.add h₂.neg
[GOAL]
m✝ n a b c d : ℤ
m : ℕ
h : a ≡ b [ZMOD n]
⊢ a ^ m ≡ b ^ m [ZMOD n]
[PROOFSTEP]
induction' m with d hd
[GOAL]
case zero
m n a b c d : ℤ
h : a ≡ b [ZMOD n]
⊢ a ^ Nat.zero ≡ b ^ Nat.zero [ZMOD n]
[PROOFSTEP]
rfl
[GOAL]
case succ
m n a b c d✝ : ℤ
h : a ≡ b [ZMOD n]
d : ℕ
hd : a ^ d ≡ b ^ d [ZMOD n]
⊢ a ^ Nat.succ d ≡ b ^ Nat.succ d [ZMOD n]
[PROOFSTEP]
rw [pow_succ, pow_succ]
[GOAL]
case succ
m n a b c d✝ : ℤ
h : a ≡ b [ZMOD n]
d : ℕ
hd : a ^ d ≡ b ^ d [ZMOD n]
⊢ a * a ^ d ≡ b * b ^ d [ZMOD n]
[PROOFSTEP]
exact h.mul hd
[GOAL]
m✝ n a b c d m : ℤ
h : a ≡ b [ZMOD m * n]
⊢ a ≡ b [ZMOD n]
[PROOFSTEP]
rw [modEq_iff_dvd] at *
[GOAL]
m✝ n a b c d m : ℤ
h : m * n ∣ b - a
⊢ n ∣ b - a
[PROOFSTEP]
exact (dvd_mul_left n m).trans h
[GOAL]
m n a b c d : ℤ
hm : 0 < m
h : a * c ≡ b * c [ZMOD m]
⊢ a ≡ b [ZMOD m / ↑(gcd m c)]
[PROOFSTEP]
letI d := gcd m c
[GOAL]
m n a b c d✝ : ℤ
hm : 0 < m
h : a * c ≡ b * c [ZMOD m]
d : ℕ := gcd m c
⊢ a ≡ b [ZMOD m / ↑(gcd m c)]
[PROOFSTEP]
have hmd := gcd_dvd_left m c
[GOAL]
m n a b c d✝ : ℤ
hm : 0 < m
h : a * c ≡ b * c [ZMOD m]
d : ℕ := gcd m c
hmd : ↑(gcd m c) ∣ m
⊢ a ≡ b [ZMOD m / ↑(gcd m c)]
[PROOFSTEP]
have hcd := gcd_dvd_right m c
[GOAL]
m n a b c d✝ : ℤ
hm : 0 < m
h : a * c ≡ b * c [ZMOD m]
d : ℕ := gcd m c
hmd : ↑(gcd m c) ∣ m
hcd : ↑(gcd m c) ∣ c
⊢ a ≡ b [ZMOD m / ↑(gcd m c)]
[PROOFSTEP]
rw [modEq_iff_dvd] at h ⊢
  -- porting note: removed `show` due to leanprover-community/mathlib4#3305
[GOAL]
m n a b c d✝ : ℤ
hm : 0 < m
h : m ∣ b * c - a * c
d : ℕ := gcd m c
hmd : ↑(gcd m c) ∣ m
hcd : ↑(gcd m c) ∣ c
⊢ m / ↑(gcd m c) ∣ b - a
[PROOFSTEP]
refine Int.dvd_of_dvd_mul_right_of_gcd_one (?_ : m / d ∣ c / d * (b - a)) ?_
[GOAL]
case refine_1
m n a b c d✝ : ℤ
hm : 0 < m
h : m ∣ b * c - a * c
d : ℕ := gcd m c
hmd : ↑(gcd m c) ∣ m
hcd : ↑(gcd m c) ∣ c
⊢ m / ↑d ∣ c / ↑d * (b - a)
[PROOFSTEP]
rw [mul_comm, ← Int.mul_ediv_assoc (b - a) hcd, sub_mul]
[GOAL]
case refine_1
m n a b c d✝ : ℤ
hm : 0 < m
h : m ∣ b * c - a * c
d : ℕ := gcd m c
hmd : ↑(gcd m c) ∣ m
hcd : ↑(gcd m c) ∣ c
⊢ m / ↑d ∣ (b * c - a * c) / ↑(gcd m c)
[PROOFSTEP]
exact Int.ediv_dvd_ediv hmd h
[GOAL]
case refine_2
m n a b c d✝ : ℤ
hm : 0 < m
h : m ∣ b * c - a * c
d : ℕ := gcd m c
hmd : ↑(gcd m c) ∣ m
hcd : ↑(gcd m c) ∣ c
⊢ gcd (m / ↑(gcd m c)) (c / ↑d) = 1
[PROOFSTEP]
rw [gcd_div hmd hcd, natAbs_ofNat, Nat.div_self (gcd_pos_of_ne_zero_left c hm.ne')]
[GOAL]
m n a b c d : ℤ
hm : 0 < m
h : c * a ≡ c * b [ZMOD m]
⊢ a * c ≡ b * c [ZMOD m]
[PROOFSTEP]
simpa [mul_comm] using h
[GOAL]
m n a b c d : ℤ
h : a / c ≡ b / c [ZMOD m / c]
ha✝¹ : c ∣ a
ha✝ : c ∣ b
ha : c ∣ m
⊢ a ≡ b [ZMOD m]
[PROOFSTEP]
convert h.mul_left'
[GOAL]
case h.e'_1
m n a b c d : ℤ
h : a / c ≡ b / c [ZMOD m / c]
ha✝¹ : c ∣ a
ha✝ : c ∣ b
ha : c ∣ m
⊢ m = ?m.21777 * (m / c)
[PROOFSTEP]
rwa [Int.mul_ediv_cancel']
[GOAL]
case h.e'_2
m n a b c d : ℤ
h : a / c ≡ b / c [ZMOD m / c]
ha✝¹ : c ∣ a
ha✝ : c ∣ b
ha : c ∣ m
⊢ a = c * (a / c)
[PROOFSTEP]
rwa [Int.mul_ediv_cancel']
[GOAL]
case h.e'_3
m n a b c d : ℤ
h : a / c ≡ b / c [ZMOD m / c]
ha✝¹ : c ∣ a
ha✝ : c ∣ b
ha : c ∣ m
⊢ b = c * (b / c)
[PROOFSTEP]
rwa [Int.mul_ediv_cancel']
[GOAL]
m n a b c d : ℤ
⊢ a ≡ b [ZMOD 0] ↔ a = b
[PROOFSTEP]
rw [ModEq, emod_zero, emod_zero]
[GOAL]
m n a b c d : ℤ
⊢ n ∣ n + a - a
[PROOFSTEP]
simp
[GOAL]
m n a b c d : ℤ
⊢ n ∣ a + n - a
[PROOFSTEP]
simp
[GOAL]
m✝ n✝ a✝ b✝ c d a b m n : ℤ
hmn : Nat.coprime (natAbs m) (natAbs n)
h : a ≡ b [ZMOD m] ∧ a ≡ b [ZMOD n]
⊢ a ≡ b [ZMOD m * n]
[PROOFSTEP]
rw [modEq_iff_dvd, modEq_iff_dvd] at h
[GOAL]
m✝ n✝ a✝ b✝ c d a b m n : ℤ
hmn : Nat.coprime (natAbs m) (natAbs n)
h : m ∣ b - a ∧ n ∣ b - a
⊢ a ≡ b [ZMOD m * n]
[PROOFSTEP]
rw [modEq_iff_dvd, ← natAbs_dvd, ← dvd_natAbs, coe_nat_dvd, natAbs_mul]
[GOAL]
m✝ n✝ a✝ b✝ c d a b m n : ℤ
hmn : Nat.coprime (natAbs m) (natAbs n)
h : m ∣ b - a ∧ n ∣ b - a
⊢ natAbs m * natAbs n ∣ natAbs (b - a)
[PROOFSTEP]
refine' hmn.mul_dvd_of_dvd_of_dvd _ _
[GOAL]
case refine'_1
m✝ n✝ a✝ b✝ c d a b m n : ℤ
hmn : Nat.coprime (natAbs m) (natAbs n)
h : m ∣ b - a ∧ n ∣ b - a
⊢ natAbs m ∣ natAbs (b - a)
[PROOFSTEP]
rw [← coe_nat_dvd, natAbs_dvd, dvd_natAbs]
[GOAL]
case refine'_2
m✝ n✝ a✝ b✝ c d a b m n : ℤ
hmn : Nat.coprime (natAbs m) (natAbs n)
h : m ∣ b - a ∧ n ∣ b - a
⊢ natAbs n ∣ natAbs (b - a)
[PROOFSTEP]
rw [← coe_nat_dvd, natAbs_dvd, dvd_natAbs]
[GOAL]
case refine'_1
m✝ n✝ a✝ b✝ c d a b m n : ℤ
hmn : Nat.coprime (natAbs m) (natAbs n)
h : m ∣ b - a ∧ n ∣ b - a
⊢ m ∣ b - a
[PROOFSTEP]
tauto
[GOAL]
case refine'_2
m✝ n✝ a✝ b✝ c d a b m n : ℤ
hmn : Nat.coprime (natAbs m) (natAbs n)
h : m ∣ b - a ∧ n ∣ b - a
⊢ n ∣ b - a
[PROOFSTEP]
tauto
[GOAL]
m n a✝ b✝ c d : ℤ
a b : ℕ
⊢ ↑a * Nat.gcdA a b ≡ ↑(Nat.gcd a b) [ZMOD ↑b]
[PROOFSTEP]
rw [← add_zero ((a : ℤ) * _), Nat.gcd_eq_gcd_ab]
[GOAL]
m n a✝ b✝ c d : ℤ
a b : ℕ
⊢ ↑a * Nat.gcdA a b + 0 ≡ ↑a * Nat.gcdA a b + ↑b * Nat.gcdB a b [ZMOD ↑b]
[PROOFSTEP]
exact (dvd_mul_right _ _).zero_modEq_int.add_left _
[GOAL]
m n✝ a✝ b✝ c✝ d a b n c : ℤ
ha : a ≡ b [ZMOD n]
⊢ b + 0 ≡ b [ZMOD n]
[PROOFSTEP]
rw [add_zero]
[GOAL]
m n✝ a✝ b✝ c✝ d a b n c : ℤ
ha : a ≡ b [ZMOD n]
⊢ a - n * c ≡ b [ZMOD n]
[PROOFSTEP]
convert Int.modEq_add_fac (-c) ha using 1
[GOAL]
case h.e'_2
m n✝ a✝ b✝ c✝ d a b n c : ℤ
ha : a ≡ b [ZMOD n]
⊢ a - n * c = a + n * -c
[PROOFSTEP]
ring
[GOAL]
m n a✝ b✝ c d : ℤ
a b : ℕ
hab : Nat.coprime a b
hgcd : Nat.gcd a b = 1
⊢ ↑a * Nat.gcdA a b + ↑b * Nat.gcdB a b ≡ 1 [ZMOD ↑b]
[PROOFSTEP]
rw [← Nat.gcd_eq_gcd_ab, hgcd]
[GOAL]
m n a✝ b✝ c d : ℤ
a b : ℕ
hab : Nat.coprime a b
hgcd : Nat.gcd a b = 1
⊢ ↑1 ≡ 1 [ZMOD ↑b]
[PROOFSTEP]
rfl
[GOAL]
m n a✝ b✝ c d a b : ℤ
hb : 0 < b
⊢ a % b < b
[PROOFSTEP]
have : a % b < |b| := emod_lt _ (ne_of_gt hb)
[GOAL]
m n a✝ b✝ c d a b : ℤ
hb : 0 < b
this : a % b < |b|
⊢ a % b < b
[PROOFSTEP]
rwa [abs_of_pos hb] at this
[GOAL]
m n a✝ b✝ c d a b : ℤ
hb : 0 < b
⊢ a % b ≡ a [ZMOD b]
[PROOFSTEP]
simp [ModEq]
[GOAL]
m n a✝ b✝ c d a b : ℤ
hb : 0 < b
z : ℤ
hz1 : 0 ≤ z
hz2 : z < b
hz3 : z ≡ a [ZMOD b]
⊢ ↑(natAbs z) < b ∧ ↑(natAbs z) ≡ a [ZMOD b]
[PROOFSTEP]
constructor
[GOAL]
case left
m n a✝ b✝ c d a b : ℤ
hb : 0 < b
z : ℤ
hz1 : 0 ≤ z
hz2 : z < b
hz3 : z ≡ a [ZMOD b]
⊢ ↑(natAbs z) < b
[PROOFSTEP]
rw [ofNat_natAbs_eq_of_nonneg z hz1]
[GOAL]
case right
m n a✝ b✝ c d a b : ℤ
hb : 0 < b
z : ℤ
hz1 : 0 ≤ z
hz2 : z < b
hz3 : z ≡ a [ZMOD b]
⊢ ↑(natAbs z) ≡ a [ZMOD b]
[PROOFSTEP]
rw [ofNat_natAbs_eq_of_nonneg z hz1]
[GOAL]
case left
m n a✝ b✝ c d a b : ℤ
hb : 0 < b
z : ℤ
hz1 : 0 ≤ z
hz2 : z < b
hz3 : z ≡ a [ZMOD b]
⊢ z < b
[PROOFSTEP]
assumption
[GOAL]
case right
m n a✝ b✝ c d a b : ℤ
hb : 0 < b
z : ℤ
hz1 : 0 ≤ z
hz2 : z < b
hz3 : z ≡ a [ZMOD b]
⊢ z ≡ a [ZMOD b]
[PROOFSTEP]
assumption


[GOAL]
α : Type u
β : α → Type u
⊢ #(WType β) = sum fun a => #(WType β) ^ #(β a)
[PROOFSTEP]
simp only [Cardinal.power_def, ← Cardinal.mk_sigma]
[GOAL]
α : Type u
β : α → Type u
⊢ #(WType β) = #((i : α) × (β i → WType β))
[PROOFSTEP]
exact mk_congr (equivSigma β)
[GOAL]
α : Type u
β : α → Type u
κ : Cardinal.{u}
hκ : (sum fun a => κ ^ #(β a)) ≤ κ
⊢ #(WType β) ≤ κ
[PROOFSTEP]
induction' κ using Cardinal.inductionOn with γ
[GOAL]
case h
α : Type u
β : α → Type u
κ : Cardinal.{u}
hκ✝ : (sum fun a => κ ^ #(β a)) ≤ κ
γ : Type u
hκ : (sum fun a => #γ ^ #(β a)) ≤ #γ
⊢ #(WType β) ≤ #γ
[PROOFSTEP]
simp only [Cardinal.power_def, ← Cardinal.mk_sigma, Cardinal.le_def] at hκ
[GOAL]
case h
α : Type u
β : α → Type u
κ : Cardinal.{u}
hκ✝ : (sum fun a => κ ^ #(β a)) ≤ κ
γ : Type u
hκ : Nonempty ((i : α) × (β i → γ) ↪ γ)
⊢ #(WType β) ≤ #γ
[PROOFSTEP]
cases' hκ with hκ
[GOAL]
case h.intro
α : Type u
β : α → Type u
κ : Cardinal.{u}
hκ✝ : (sum fun a => κ ^ #(β a)) ≤ κ
γ : Type u
hκ : (i : α) × (β i → γ) ↪ γ
⊢ #(WType β) ≤ #γ
[PROOFSTEP]
exact Cardinal.mk_le_of_injective (elim_injective _ hκ.1 hκ.2)
[GOAL]
α : Type u
β : α → Type u
inst✝ : ∀ (a : α), Finite (β a)
⊢ IsEmpty α → #(WType β) ≤ max #α ℵ₀
[PROOFSTEP]
intro h
[GOAL]
α : Type u
β : α → Type u
inst✝ : ∀ (a : α), Finite (β a)
h : IsEmpty α
⊢ #(WType β) ≤ max #α ℵ₀
[PROOFSTEP]
rw [Cardinal.mk_eq_zero (WType β)]
[GOAL]
α : Type u
β : α → Type u
inst✝ : ∀ (a : α), Finite (β a)
h : IsEmpty α
⊢ 0 ≤ max #α ℵ₀
[PROOFSTEP]
exact zero_le _
[GOAL]
α : Type u
β : α → Type u
inst✝ : ∀ (a : α), Finite (β a)
hn : Nonempty α
m : Cardinal.{u} := max #α ℵ₀
⊢ Order.succ 0 ≤ ⨆ (a : α), m ^ #(β a)
[PROOFSTEP]
rw [succ_zero]
[GOAL]
α : Type u
β : α → Type u
inst✝ : ∀ (a : α), Finite (β a)
hn : Nonempty α
m : Cardinal.{u} := max #α ℵ₀
⊢ 1 ≤ ⨆ (a : α), m ^ #(β a)
[PROOFSTEP]
obtain ⟨a⟩ : Nonempty α := hn
[GOAL]
case intro
α : Type u
β : α → Type u
inst✝ : ∀ (a : α), Finite (β a)
m : Cardinal.{u} := max #α ℵ₀
a : α
⊢ 1 ≤ ⨆ (a : α), m ^ #(β a)
[PROOFSTEP]
refine' le_trans _ (le_ciSup (bddAbove_range.{u, u} _) a)
[GOAL]
case intro
α : Type u
β : α → Type u
inst✝ : ∀ (a : α), Finite (β a)
m : Cardinal.{u} := max #α ℵ₀
a : α
⊢ 1 ≤ m ^ #(β a)
[PROOFSTEP]
rw [← power_zero]
[GOAL]
case intro
α : Type u
β : α → Type u
inst✝ : ∀ (a : α), Finite (β a)
m : Cardinal.{u} := max #α ℵ₀
a : α
⊢ ?m.2506 ^ 0 ≤ m ^ #(β a)
α : Type u β : α → Type u inst✝ : ∀ (a : α), Finite (β a) m : Cardinal.{u} := max #α ℵ₀ a : α ⊢ Cardinal.{u}
[PROOFSTEP]
exact power_le_power_left (pos_iff_ne_zero.1 (aleph0_pos.trans_le (le_max_right _ _))) (zero_le _)