number_theory.lucas_lehmer
⟷
Mathlib.NumberTheory.LucasLehmer
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -191,7 +191,7 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
· -- We want to use that fact that `0 ≤ s_mod p (p-2) < 2^p - 1`
-- and `lucas_lehmer_residue p = 0 → 2^p - 1 ∣ s_mod p (p-2)`.
intro h
- simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
+ simp [ZMod.intCast_zmod_eq_zero_iff_dvd] at h
apply Int.eq_zero_of_dvd_of_nonneg_of_lt _ _ h <;> clear h
apply s_mod_nonneg _ (Nat.lt_of_succ_lt w)
exact s_mod_lt _ (Nat.lt_of_succ_lt w) (p - 2)
@@ -510,7 +510,7 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
by
dsimp [lucas_lehmer_residue] at h
rw [s_zmod_eq_s p'] at h
- simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
+ simp [ZMod.intCast_zmod_eq_zero_iff_dvd] at h
cases' h with k h
use k
replace h := congr_arg (fun n : ℤ => (n : X (q (p' + 2)))) h
@@ -533,7 +533,7 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
/-- `q` is the minimum factor of `mersenne p`, so `M p = 0` in `X q`. -/
theorem mersenne_coe_X (p : ℕ) : (mersenne p : X (q p)) = 0 :=
by
- ext <;> simp [mersenne, q, ZMod.nat_cast_zmod_eq_zero_iff_dvd, -pow_pos]
+ ext <;> simp [mersenne, q, ZMod.natCast_zmod_eq_zero_iff_dvd, -pow_pos]
apply Nat.minFac_dvd
#align lucas_lehmer.mersenne_coe_X LucasLehmer.mersenne_coe_X
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -395,10 +395,10 @@ theorem coe_mul (n m : ℤ) : ((n * m : ℤ) : X q) = (n : X q) * (m : X q) := b
#align lucas_lehmer.X.coe_mul LucasLehmer.X.coe_mul
-/
-#print LucasLehmer.X.coe_nat /-
+#print LucasLehmer.X.coe_natCast /-
@[norm_cast]
-theorem coe_nat (n : ℕ) : ((n : ℤ) : X q) = (n : X q) := by ext <;> simp
-#align lucas_lehmer.X.coe_nat LucasLehmer.X.coe_nat
+theorem coe_natCast (n : ℕ) : ((n : ℤ) : X q) = (n : X q) := by ext <;> simp
+#align lucas_lehmer.X.coe_nat LucasLehmer.X.coe_natCast
-/
#print LucasLehmer.X.card_eq /-
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -4,8 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Scott Morrison, Ainsley Pahljina
-/
import Data.Nat.Parity
-import Data.Pnat.Interval
-import Data.Zmod.Basic
+import Data.PNat.Interval
+import Data.ZMod.Basic
import GroupTheory.OrderOfElement
import RingTheory.Fintype
import Tactic.IntervalCases
@@ -465,8 +465,8 @@ theorem closed_form (i : ℕ) : (s i : X q) = (ω : X q) ^ 2 ^ i + (ωb : X q) ^
_ = (ω ^ 2 ^ i + ωb ^ 2 ^ i) ^ 2 - 2 := by rw [ih]
_ = (ω ^ 2 ^ i) ^ 2 + (ωb ^ 2 ^ i) ^ 2 + 2 * (ωb ^ 2 ^ i * ω ^ 2 ^ i) - 2 := by ring
_ = (ω ^ 2 ^ i) ^ 2 + (ωb ^ 2 ^ i) ^ 2 := by
- rw [← mul_pow ωb ω, ωb_mul_ω, one_pow, mul_one, add_sub_cancel]
- _ = ω ^ 2 ^ (i + 1) + ωb ^ 2 ^ (i + 1) := by rw [← pow_mul, ← pow_mul, pow_succ']
+ rw [← mul_pow ωb ω, ωb_mul_ω, one_pow, mul_one, add_sub_cancel_right]
+ _ = ω ^ 2 ^ (i + 1) + ωb ^ 2 ^ (i + 1) := by rw [← pow_mul, ← pow_mul, pow_succ]
#align lucas_lehmer.X.closed_form LucasLehmer.X.closed_form
-/
@@ -497,7 +497,7 @@ theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
_ = 2 := Nat.pred_inj (Nat.one_le_two_pow _) (by decide) h')
· -- If q = 2, we get a contradiction from 2 ∣ 2^p - 1
dsimp [q] at h; injection h with h'; clear h
- rw [mersenne, PNat.one_coe, Nat.minFac_eq_two_iff, pow_succ] at h'
+ rw [mersenne, PNat.one_coe, Nat.minFac_eq_two_iff, pow_succ'] at h'
exact Nat.two_not_dvd_two_mul_sub_one (Nat.one_le_two_pow _) h'
#align lucas_lehmer.two_lt_q LucasLehmer.two_lt_q
-/
@@ -552,7 +552,7 @@ theorem ω_pow_eq_neg_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
theorem ω_pow_eq_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 2) = 1 :=
calc
- (ω : X (q (p' + 2))) ^ 2 ^ (p' + 2) = (ω ^ 2 ^ (p' + 1)) ^ 2 := by rw [← pow_mul, ← pow_succ']
+ (ω : X (q (p' + 2))) ^ 2 ^ (p' + 2) = (ω ^ 2 ^ (p' + 1)) ^ 2 := by rw [← pow_mul, ← pow_succ]
_ = (-1) ^ 2 := by rw [ω_pow_eq_neg_one p' h]
_ = 1 := by simp
#align lucas_lehmer.ω_pow_eq_one LucasLehmer.ω_pow_eq_one
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -191,7 +191,7 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
· -- We want to use that fact that `0 ≤ s_mod p (p-2) < 2^p - 1`
-- and `lucas_lehmer_residue p = 0 → 2^p - 1 ∣ s_mod p (p-2)`.
intro h
- simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
+ simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
apply Int.eq_zero_of_dvd_of_nonneg_of_lt _ _ h <;> clear h
apply s_mod_nonneg _ (Nat.lt_of_succ_lt w)
exact s_mod_lt _ (Nat.lt_of_succ_lt w) (p - 2)
@@ -484,11 +484,11 @@ Here and below, we introduce `p' = p - 2`, in order to avoid using subtraction i
theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
by
by_contra H
- simp at H
+ simp at H
interval_cases; clear H
· -- If q = 1, we get a contradiction from 2^p = 2
- dsimp [q] at h ; injection h with h'; clear h
- simp [mersenne] at h'
+ dsimp [q] at h; injection h with h'; clear h
+ simp [mersenne] at h'
exact
lt_irrefl 2
(calc
@@ -496,8 +496,8 @@ theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
_ < 2 ^ (p' + 2) := (Nat.lt_two_pow _)
_ = 2 := Nat.pred_inj (Nat.one_le_two_pow _) (by decide) h')
· -- If q = 2, we get a contradiction from 2 ∣ 2^p - 1
- dsimp [q] at h ; injection h with h'; clear h
- rw [mersenne, PNat.one_coe, Nat.minFac_eq_two_iff, pow_succ] at h'
+ dsimp [q] at h; injection h with h'; clear h
+ rw [mersenne, PNat.one_coe, Nat.minFac_eq_two_iff, pow_succ] at h'
exact Nat.two_not_dvd_two_mul_sub_one (Nat.one_le_two_pow _) h'
#align lucas_lehmer.two_lt_q LucasLehmer.two_lt_q
-/
@@ -508,21 +508,21 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 1) =
k * mersenne (p' + 2) * (ω : X (q (p' + 2))) ^ 2 ^ p' - 1 :=
by
- dsimp [lucas_lehmer_residue] at h
- rw [s_zmod_eq_s p'] at h
- simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
+ dsimp [lucas_lehmer_residue] at h
+ rw [s_zmod_eq_s p'] at h
+ simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
cases' h with k h
use k
replace h := congr_arg (fun n : ℤ => (n : X (q (p' + 2)))) h
-- coercion from ℤ to X q
- dsimp at h
- rw [closed_form] at h
+ dsimp at h
+ rw [closed_form] at h
replace h := congr_arg (fun x => ω ^ 2 ^ p' * x) h
- dsimp at h
+ dsimp at h
have t : 2 ^ p' + 2 ^ p' = 2 ^ (p' + 1) := by ring
- rw [mul_add, ← pow_add ω, t, ← mul_pow ω ωb (2 ^ p'), ω_mul_ωb, one_pow] at h
- rw [mul_comm, coe_mul] at h
- rw [mul_comm _ (k : X (q (p' + 2)))] at h
+ rw [mul_add, ← pow_add ω, t, ← mul_pow ω ωb (2 ^ p'), ω_mul_ωb, one_pow] at h
+ rw [mul_comm, coe_mul] at h
+ rw [mul_comm _ (k : X (q (p' + 2)))] at h
replace h := eq_sub_of_add_eq h
have : 1 ≤ 2 ^ (p' + 2) := Nat.one_le_pow _ _ (by decide)
exact_mod_cast h
@@ -543,7 +543,7 @@ theorem ω_pow_eq_neg_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 1) = -1 :=
by
cases' ω_pow_formula p' h with k w
- rw [mersenne_coe_X] at w
+ rw [mersenne_coe_X] at w
simpa using w
#align lucas_lehmer.ω_pow_eq_neg_one LucasLehmer.ω_pow_eq_neg_one
-/
@@ -587,7 +587,7 @@ theorem order_ω (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
have ω_pow := orderOf_dvd_iff_pow_eq_one.1 o
replace ω_pow :=
congr_arg (Units.coeHom (X (q (p' + 2))) : Units (X (q (p' + 2))) → X (q (p' + 2))) ω_pow
- simp at ω_pow
+ simp at ω_pow
have h : (1 : ZMod (q (p' + 2))) = -1 :=
congr_arg Prod.fst (ω_pow.symm.trans (ω_pow_eq_neg_one p' h))
haveI : Fact (2 < (q (p' + 2) : ℕ)) := ⟨two_lt_q _⟩
@@ -623,8 +623,8 @@ theorem lucas_lehmer_sufficiency (p : ℕ) (w : 1 < p) : LucasLehmerTest p → (
have w : 1 < p' + 2 := Nat.lt_of_sub_eq_succ rfl
contrapose
intro a t
- rw [z] at a
- rw [z] at t
+ rw [z] at a
+ rw [z] at t
have h₁ := order_ineq p' t
have h₂ := Nat.minFac_sq_le_self (mersenne_pos (Nat.lt_of_succ_lt w)) a
have h := lt_of_lt_of_le h₁ h₂
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -57,7 +57,7 @@ theorem mersenne_pos {p : ℕ} (h : 0 < p) : 0 < mersenne p :=
dsimp [mersenne]
calc
0 < 2 ^ 1 - 1 := by norm_num
- _ ≤ 2 ^ p - 1 := Nat.pred_le_pred (Nat.pow_le_pow_of_le_right (Nat.succ_pos 1) h)
+ _ ≤ 2 ^ p - 1 := Nat.pred_le_pred (Nat.pow_le_pow_right (Nat.succ_pos 1) h)
#align mersenne_pos mersenne_pos
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,13 +3,13 @@ Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Scott Morrison, Ainsley Pahljina
-/
-import Mathbin.Data.Nat.Parity
-import Mathbin.Data.Pnat.Interval
-import Mathbin.Data.Zmod.Basic
-import Mathbin.GroupTheory.OrderOfElement
-import Mathbin.RingTheory.Fintype
-import Mathbin.Tactic.IntervalCases
-import Mathbin.Tactic.RingExp
+import Data.Nat.Parity
+import Data.Pnat.Interval
+import Data.Zmod.Basic
+import GroupTheory.OrderOfElement
+import RingTheory.Fintype
+import Tactic.IntervalCases
+import Tactic.RingExp
#align_import number_theory.lucas_lehmer from "leanprover-community/mathlib"@"ce38d86c0b2d427ce208c3cee3159cb421d2b3c4"
@@ -646,9 +646,9 @@ theorem sMod_succ {p a i b c} (h1 : (2 ^ p - 1 : ℤ) = a) (h2 : sMod p i = b)
rw [h1, h2, sq, h3]
#align lucas_lehmer.s_mod_succ LucasLehmer.sMod_succ
-/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:337:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:337:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:337:4: warning: unsupported (TODO): `[tacs] -/
/-- Given a goal of the form `lucas_lehmer_test p`,
attempt to do the calculation using `norm_num` to certify each step.
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/32a7e535287f9c73f2e4d2aef306a39190f0b504
@@ -718,7 +718,7 @@ theorem modEq_mersenne (n k : ℕ) : k ≡ k / 2 ^ n + k % 2 ^ n [MOD 2 ^ n - 1]
skip
skip
rw [← one_mul (k / 2 ^ n)]
- exact (Nat.modEq_sub <| Nat.succ_le_of_lt <| pow_pos zero_lt_two _).mul_right _
+ exact (Nat.modEq_sub <| Nat.succ_le_of_lt <| pow_pos zero_lt_two _).hMul_right _
#align modeq_mersenne modEq_mersenne
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,11 +2,6 @@
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Scott Morrison, Ainsley Pahljina
-
-! This file was ported from Lean 3 source module number_theory.lucas_lehmer
-! leanprover-community/mathlib commit ce38d86c0b2d427ce208c3cee3159cb421d2b3c4
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Nat.Parity
import Mathbin.Data.Pnat.Interval
@@ -16,6 +11,8 @@ import Mathbin.RingTheory.Fintype
import Mathbin.Tactic.IntervalCases
import Mathbin.Tactic.RingExp
+#align_import number_theory.lucas_lehmer from "leanprover-community/mathlib"@"ce38d86c0b2d427ce208c3cee3159cb421d2b3c4"
+
/-!
# The Lucas-Lehmer test for Mersenne primes.
mathlib commit https://github.com/leanprover-community/mathlib/commit/728ef9dbb281241906f25cbeb30f90d83e0bb451
@@ -644,12 +644,10 @@ namespace LucasLehmer
open Tactic
-#print LucasLehmer.sMod_succ /-
theorem sMod_succ {p a i b c} (h1 : (2 ^ p - 1 : ℤ) = a) (h2 : sMod p i = b)
(h3 : (b * b - 2) % a = c) : sMod p (i + 1) = c := by dsimp [s_mod, mersenne];
rw [h1, h2, sq, h3]
#align lucas_lehmer.s_mod_succ LucasLehmer.sMod_succ
--/
/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -113,11 +113,13 @@ def sMod (p : ℕ) : ℕ → ℤ
#align lucas_lehmer.s_mod LucasLehmer.sMod
-/
+#print LucasLehmer.mersenne_int_ne_zero /-
theorem mersenne_int_ne_zero (p : ℕ) (w : 0 < p) : (2 ^ p - 1 : ℤ) ≠ 0 :=
by
apply ne_of_gt; simp only [gt_iff_lt, sub_pos]
exact_mod_cast Nat.one_lt_two_pow p w
#align lucas_lehmer.mersenne_int_ne_zero LucasLehmer.mersenne_int_ne_zero
+-/
#print LucasLehmer.sMod_nonneg /-
theorem sMod_nonneg (p : ℕ) (w : 0 < p) (i : ℕ) : 0 ≤ sMod p i :=
@@ -128,9 +130,12 @@ theorem sMod_nonneg (p : ℕ) (w : 0 < p) (i : ℕ) : 0 ≤ sMod p i :=
#align lucas_lehmer.s_mod_nonneg LucasLehmer.sMod_nonneg
-/
+#print LucasLehmer.sMod_mod /-
theorem sMod_mod (p i : ℕ) : sMod p i % (2 ^ p - 1) = sMod p i := by cases i <;> simp [s_mod]
#align lucas_lehmer.s_mod_mod LucasLehmer.sMod_mod
+-/
+#print LucasLehmer.sMod_lt /-
theorem sMod_lt (p : ℕ) (w : 0 < p) (i : ℕ) : sMod p i < 2 ^ p - 1 :=
by
rw [← s_mod_mod]
@@ -140,28 +145,37 @@ theorem sMod_lt (p : ℕ) (w : 0 < p) (i : ℕ) : sMod p i < 2 ^ p - 1 :=
exact_mod_cast Nat.one_le_two_pow p
· exact mersenne_int_ne_zero p w
#align lucas_lehmer.s_mod_lt LucasLehmer.sMod_lt
+-/
+#print LucasLehmer.sZMod_eq_s /-
theorem sZMod_eq_s (p' : ℕ) (i : ℕ) : sZMod (p' + 2) i = (s i : ZMod (2 ^ (p' + 2) - 1)) :=
by
induction' i with i ih
· dsimp [s, s_zmod]; norm_num
· push_cast [s, s_zmod, ih]
#align lucas_lehmer.s_zmod_eq_s LucasLehmer.sZMod_eq_s
+-/
+#print LucasLehmer.Int.coe_nat_pow_pred /-
-- These next two don't make good `norm_cast` lemmas.
theorem Int.coe_nat_pow_pred (b p : ℕ) (w : 0 < b) : ((b ^ p - 1 : ℕ) : ℤ) = (b ^ p - 1 : ℤ) :=
by
have : 1 ≤ b ^ p := Nat.one_le_pow p b w
norm_cast
#align lucas_lehmer.int.coe_nat_pow_pred LucasLehmer.Int.coe_nat_pow_pred
+-/
+#print LucasLehmer.Int.coe_nat_two_pow_pred /-
theorem Int.coe_nat_two_pow_pred (p : ℕ) : ((2 ^ p - 1 : ℕ) : ℤ) = (2 ^ p - 1 : ℤ) :=
Int.coe_nat_pow_pred 2 p (by decide)
#align lucas_lehmer.int.coe_nat_two_pow_pred LucasLehmer.Int.coe_nat_two_pow_pred
+-/
+#print LucasLehmer.sZMod_eq_sMod /-
theorem sZMod_eq_sMod (p : ℕ) (i : ℕ) : sZMod p i = (sMod p i : ZMod (2 ^ p - 1)) := by
induction i <;> push_cast [← int.coe_nat_two_pow_pred p, s_mod, s_zmod, *]
#align lucas_lehmer.s_zmod_eq_s_mod LucasLehmer.sZMod_eq_sMod
+-/
#print LucasLehmer.lucasLehmerResidue /-
/-- The Lucas-Lehmer residue is `s p (p-2)` in `zmod (2^p - 1)`. -/
@@ -170,6 +184,7 @@ def lucasLehmerResidue (p : ℕ) : ZMod (2 ^ p - 1) :=
#align lucas_lehmer.lucas_lehmer_residue LucasLehmer.lucasLehmerResidue
-/
+#print LucasLehmer.residue_eq_zero_iff_sMod_eq_zero /-
theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
lucasLehmerResidue p = 0 ↔ sMod p (p - 2) = 0 :=
by
@@ -185,6 +200,7 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
exact s_mod_lt _ (Nat.lt_of_succ_lt w) (p - 2)
· intro h; rw [h]; simp
#align lucas_lehmer.residue_eq_zero_iff_s_mod_eq_zero LucasLehmer.residue_eq_zero_iff_sMod_eq_zero
+-/
#print LucasLehmer.LucasLehmerTest /-
/-- A Mersenne number `2^p-1` is prime if and only if
@@ -229,49 +245,65 @@ theorem ext {x y : X q} (h₁ : x.1 = y.1) (h₂ : x.2 = y.2) : x = y :=
#align lucas_lehmer.X.ext LucasLehmer.X.ext
-/
+#print LucasLehmer.X.add_fst /-
@[simp]
theorem add_fst (x y : X q) : (x + y).1 = x.1 + y.1 :=
rfl
#align lucas_lehmer.X.add_fst LucasLehmer.X.add_fst
+-/
+#print LucasLehmer.X.add_snd /-
@[simp]
theorem add_snd (x y : X q) : (x + y).2 = x.2 + y.2 :=
rfl
#align lucas_lehmer.X.add_snd LucasLehmer.X.add_snd
+-/
+#print LucasLehmer.X.neg_fst /-
@[simp]
theorem neg_fst (x : X q) : (-x).1 = -x.1 :=
rfl
#align lucas_lehmer.X.neg_fst LucasLehmer.X.neg_fst
+-/
+#print LucasLehmer.X.neg_snd /-
@[simp]
theorem neg_snd (x : X q) : (-x).2 = -x.2 :=
rfl
#align lucas_lehmer.X.neg_snd LucasLehmer.X.neg_snd
+-/
instance : Mul (X q) where mul x y := (x.1 * y.1 + 3 * x.2 * y.2, x.1 * y.2 + x.2 * y.1)
+#print LucasLehmer.X.mul_fst /-
@[simp]
theorem mul_fst (x y : X q) : (x * y).1 = x.1 * y.1 + 3 * x.2 * y.2 :=
rfl
#align lucas_lehmer.X.mul_fst LucasLehmer.X.mul_fst
+-/
+#print LucasLehmer.X.mul_snd /-
@[simp]
theorem mul_snd (x y : X q) : (x * y).2 = x.1 * y.2 + x.2 * y.1 :=
rfl
#align lucas_lehmer.X.mul_snd LucasLehmer.X.mul_snd
+-/
instance : One (X q) where one := ⟨1, 0⟩
+#print LucasLehmer.X.one_fst /-
@[simp]
theorem one_fst : (1 : X q).1 = 1 :=
rfl
#align lucas_lehmer.X.one_fst LucasLehmer.X.one_fst
+-/
+#print LucasLehmer.X.one_snd /-
@[simp]
theorem one_snd : (1 : X q).2 = 0 :=
rfl
#align lucas_lehmer.X.one_snd LucasLehmer.X.one_snd
+-/
@[simp]
theorem bit0_fst (x : X q) : (bit0 x).1 = bit0 x.1 :=
@@ -310,11 +342,15 @@ instance : AddGroupWithOne (X q) :=
intCast_ofNat := fun n => by simp <;> rfl
intCast_negSucc := fun n => by ext <;> simp <;> rfl }
+#print LucasLehmer.X.left_distrib /-
theorem left_distrib (x y z : X q) : x * (y + z) = x * y + x * z := by ext <;> · dsimp; ring
#align lucas_lehmer.X.left_distrib LucasLehmer.X.left_distrib
+-/
+#print LucasLehmer.X.right_distrib /-
theorem right_distrib (x y z : X q) : (x + y) * z = x * z + y * z := by ext <;> · dsimp; ring
#align lucas_lehmer.X.right_distrib LucasLehmer.X.right_distrib
+-/
instance : Ring (X q) :=
{ X.addGroupWithOne, (inferInstance : AddCommGroup (X q)),
@@ -328,33 +364,45 @@ instance : CommRing (X q) :=
instance [Fact (1 < (q : ℕ))] : Nontrivial (X q) :=
⟨⟨0, 1, fun h => by injection h with h1 _; exact zero_ne_one h1⟩⟩
+#print LucasLehmer.X.nat_coe_fst /-
@[simp]
theorem nat_coe_fst (n : ℕ) : (n : X q).fst = (n : ZMod q) :=
rfl
#align lucas_lehmer.X.nat_coe_fst LucasLehmer.X.nat_coe_fst
+-/
+#print LucasLehmer.X.nat_coe_snd /-
@[simp]
theorem nat_coe_snd (n : ℕ) : (n : X q).snd = (0 : ZMod q) :=
rfl
#align lucas_lehmer.X.nat_coe_snd LucasLehmer.X.nat_coe_snd
+-/
+#print LucasLehmer.X.int_coe_fst /-
@[simp]
theorem int_coe_fst (n : ℤ) : (n : X q).fst = (n : ZMod q) :=
rfl
#align lucas_lehmer.X.int_coe_fst LucasLehmer.X.int_coe_fst
+-/
+#print LucasLehmer.X.int_coe_snd /-
@[simp]
theorem int_coe_snd (n : ℤ) : (n : X q).snd = (0 : ZMod q) :=
rfl
#align lucas_lehmer.X.int_coe_snd LucasLehmer.X.int_coe_snd
+-/
+#print LucasLehmer.X.coe_mul /-
@[norm_cast]
theorem coe_mul (n m : ℤ) : ((n * m : ℤ) : X q) = (n : X q) * (m : X q) := by ext <;> simp <;> ring
#align lucas_lehmer.X.coe_mul LucasLehmer.X.coe_mul
+-/
+#print LucasLehmer.X.coe_nat /-
@[norm_cast]
theorem coe_nat (n : ℕ) : ((n : ℤ) : X q) = (n : X q) := by ext <;> simp
#align lucas_lehmer.X.coe_nat LucasLehmer.X.coe_nat
+-/
#print LucasLehmer.X.card_eq /-
/-- The cardinality of `X` is `q^2`. -/
@@ -366,6 +414,7 @@ theorem card_eq : Fintype.card (X q) = q ^ 2 :=
#align lucas_lehmer.X.X_card LucasLehmer.X.card_eq
-/
+#print LucasLehmer.X.card_units_lt /-
/-- There are strictly fewer than `q^2` units, since `0` is not a unit. -/
theorem card_units_lt (w : 1 < q) : Fintype.card (X q)ˣ < q ^ 2 :=
by
@@ -373,6 +422,7 @@ theorem card_units_lt (w : 1 < q) : Fintype.card (X q)ˣ < q ^ 2 :=
convert card_units_lt (X q)
rw [X_card]
#align lucas_lehmer.X.units_card LucasLehmer.X.card_units_lt
+-/
#print LucasLehmer.X.ω /-
/-- We define `ω = 2 + √3`. -/
@@ -388,18 +438,23 @@ def ωb : X q :=
#align lucas_lehmer.X.ωb LucasLehmer.X.ωb
-/
+#print LucasLehmer.X.ω_mul_ωb /-
theorem ω_mul_ωb (q : ℕ+) : (ω : X q) * ωb = 1 :=
by
dsimp [ω, ωb]
ext <;> simp <;> ring
#align lucas_lehmer.X.ω_mul_ωb LucasLehmer.X.ω_mul_ωb
+-/
+#print LucasLehmer.X.ωb_mul_ω /-
theorem ωb_mul_ω (q : ℕ+) : (ωb : X q) * ω = 1 :=
by
dsimp [ω, ωb]
ext <;> simp <;> ring
#align lucas_lehmer.X.ωb_mul_ω LucasLehmer.X.ωb_mul_ω
+-/
+#print LucasLehmer.X.closed_form /-
/-- A closed form for the recurrence relation. -/
theorem closed_form (i : ℕ) : (s i : X q) = (ω : X q) ^ 2 ^ i + (ωb : X q) ^ 2 ^ i :=
by
@@ -416,6 +471,7 @@ theorem closed_form (i : ℕ) : (s i : X q) = (ω : X q) ^ 2 ^ i + (ωb : X q) ^
rw [← mul_pow ωb ω, ωb_mul_ω, one_pow, mul_one, add_sub_cancel]
_ = ω ^ 2 ^ (i + 1) + ωb ^ 2 ^ (i + 1) := by rw [← pow_mul, ← pow_mul, pow_succ']
#align lucas_lehmer.X.closed_form LucasLehmer.X.closed_form
+-/
end X
@@ -426,6 +482,7 @@ Here and below, we introduce `p' = p - 2`, in order to avoid using subtraction i
-/
+#print LucasLehmer.two_lt_q /-
/-- If `1 < p`, then `q p`, the smallest prime factor of `mersenne p`, is more than 2. -/
theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
by
@@ -446,7 +503,9 @@ theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
rw [mersenne, PNat.one_coe, Nat.minFac_eq_two_iff, pow_succ] at h'
exact Nat.two_not_dvd_two_mul_sub_one (Nat.one_le_two_pow _) h'
#align lucas_lehmer.two_lt_q LucasLehmer.two_lt_q
+-/
+#print LucasLehmer.ω_pow_formula /-
theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
∃ k : ℤ,
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 1) =
@@ -471,14 +530,18 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
have : 1 ≤ 2 ^ (p' + 2) := Nat.one_le_pow _ _ (by decide)
exact_mod_cast h
#align lucas_lehmer.ω_pow_formula LucasLehmer.ω_pow_formula
+-/
+#print LucasLehmer.mersenne_coe_X /-
/-- `q` is the minimum factor of `mersenne p`, so `M p = 0` in `X q`. -/
theorem mersenne_coe_X (p : ℕ) : (mersenne p : X (q p)) = 0 :=
by
ext <;> simp [mersenne, q, ZMod.nat_cast_zmod_eq_zero_iff_dvd, -pow_pos]
apply Nat.minFac_dvd
#align lucas_lehmer.mersenne_coe_X LucasLehmer.mersenne_coe_X
+-/
+#print LucasLehmer.ω_pow_eq_neg_one /-
theorem ω_pow_eq_neg_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 1) = -1 :=
by
@@ -486,7 +549,9 @@ theorem ω_pow_eq_neg_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
rw [mersenne_coe_X] at w
simpa using w
#align lucas_lehmer.ω_pow_eq_neg_one LucasLehmer.ω_pow_eq_neg_one
+-/
+#print LucasLehmer.ω_pow_eq_one /-
theorem ω_pow_eq_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 2) = 1 :=
calc
@@ -494,7 +559,9 @@ theorem ω_pow_eq_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
_ = (-1) ^ 2 := by rw [ω_pow_eq_neg_one p' h]
_ = 1 := by simp
#align lucas_lehmer.ω_pow_eq_one LucasLehmer.ω_pow_eq_one
+-/
+#print LucasLehmer.ωUnit /-
/-- `ω` as an element of the group of units. -/
def ωUnit (p : ℕ) : Units (X (q p)) where
val := ω
@@ -502,6 +569,7 @@ def ωUnit (p : ℕ) : Units (X (q p)) where
val_inv := by simp [ω_mul_ωb]
inv_val := by simp [ωb_mul_ω]
#align lucas_lehmer.ω_unit LucasLehmer.ωUnit
+-/
#print LucasLehmer.ωUnit_coe /-
@[simp]
@@ -510,6 +578,7 @@ theorem ωUnit_coe (p : ℕ) : (ωUnit p : X (q p)) = ω :=
#align lucas_lehmer.ω_unit_coe LucasLehmer.ωUnit_coe
-/
+#print LucasLehmer.order_ω /-
/-- The order of `ω` in the unit group is exactly `2^p`. -/
theorem order_ω (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
orderOf (ωUnit (p' + 2)) = 2 ^ (p' + 2) :=
@@ -531,7 +600,9 @@ theorem order_ω (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
push_cast
exact ω_pow_eq_one p' h
#align lucas_lehmer.order_ω LucasLehmer.order_ω
+-/
+#print LucasLehmer.order_ineq /-
theorem order_ineq (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
2 ^ (p' + 2) < (q (p' + 2) : ℕ) ^ 2 :=
calc
@@ -539,6 +610,7 @@ theorem order_ineq (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
_ ≤ Fintype.card (X _)ˣ := orderOf_le_card_univ
_ < (q (p' + 2) : ℕ) ^ 2 := card_units_lt (Nat.lt_of_succ_lt (two_lt_q _))
#align lucas_lehmer.order_ineq LucasLehmer.order_ineq
+-/
end LucasLehmer
@@ -572,10 +644,12 @@ namespace LucasLehmer
open Tactic
+#print LucasLehmer.sMod_succ /-
theorem sMod_succ {p a i b c} (h1 : (2 ^ p - 1 : ℤ) = a) (h2 : sMod p i = b)
(h3 : (b * b - 2) % a = c) : sMod p (i + 1) = c := by dsimp [s_mod, mersenne];
rw [h1, h2, sq, h3]
#align lucas_lehmer.s_mod_succ LucasLehmer.sMod_succ
+-/
/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -61,7 +61,6 @@ theorem mersenne_pos {p : ℕ} (h : 0 < p) : 0 < mersenne p :=
calc
0 < 2 ^ 1 - 1 := by norm_num
_ ≤ 2 ^ p - 1 := Nat.pred_le_pred (Nat.pow_le_pow_of_le_right (Nat.succ_pos 1) h)
-
#align mersenne_pos mersenne_pos
-/
@@ -416,7 +415,6 @@ theorem closed_form (i : ℕ) : (s i : X q) = (ω : X q) ^ 2 ^ i + (ωb : X q) ^
_ = (ω ^ 2 ^ i) ^ 2 + (ωb ^ 2 ^ i) ^ 2 := by
rw [← mul_pow ωb ω, ωb_mul_ω, one_pow, mul_one, add_sub_cancel]
_ = ω ^ 2 ^ (i + 1) + ωb ^ 2 ^ (i + 1) := by rw [← pow_mul, ← pow_mul, pow_succ']
-
#align lucas_lehmer.X.closed_form LucasLehmer.X.closed_form
end X
@@ -442,8 +440,7 @@ theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
(calc
2 ≤ p' + 2 := Nat.le_add_left _ _
_ < 2 ^ (p' + 2) := (Nat.lt_two_pow _)
- _ = 2 := Nat.pred_inj (Nat.one_le_two_pow _) (by decide) h'
- )
+ _ = 2 := Nat.pred_inj (Nat.one_le_two_pow _) (by decide) h')
· -- If q = 2, we get a contradiction from 2 ∣ 2^p - 1
dsimp [q] at h ; injection h with h'; clear h
rw [mersenne, PNat.one_coe, Nat.minFac_eq_two_iff, pow_succ] at h'
@@ -496,7 +493,6 @@ theorem ω_pow_eq_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 2) = (ω ^ 2 ^ (p' + 1)) ^ 2 := by rw [← pow_mul, ← pow_succ']
_ = (-1) ^ 2 := by rw [ω_pow_eq_neg_one p' h]
_ = 1 := by simp
-
#align lucas_lehmer.ω_pow_eq_one LucasLehmer.ω_pow_eq_one
/-- `ω` as an element of the group of units. -/
@@ -542,7 +538,6 @@ theorem order_ineq (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
2 ^ (p' + 2) = orderOf (ωUnit (p' + 2)) := (order_ω p' h).symm
_ ≤ Fintype.card (X _)ˣ := orderOf_le_card_univ
_ < (q (p' + 2) : ℕ) ^ 2 := card_units_lt (Nat.lt_of_succ_lt (two_lt_q _))
-
#align lucas_lehmer.order_ineq LucasLehmer.order_ineq
end LucasLehmer
@@ -582,9 +577,9 @@ theorem sMod_succ {p a i b c} (h1 : (2 ^ p - 1 : ℤ) = a) (h2 : sMod p i = b)
rw [h1, h2, sq, h3]
#align lucas_lehmer.s_mod_succ LucasLehmer.sMod_succ
-/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
/-- Given a goal of the form `lucas_lehmer_test p`,
attempt to do the calculation using `norm_num` to certify each step.
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -180,7 +180,7 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
· -- We want to use that fact that `0 ≤ s_mod p (p-2) < 2^p - 1`
-- and `lucas_lehmer_residue p = 0 → 2^p - 1 ∣ s_mod p (p-2)`.
intro h
- simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
+ simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
apply Int.eq_zero_of_dvd_of_nonneg_of_lt _ _ h <;> clear h
apply s_mod_nonneg _ (Nat.lt_of_succ_lt w)
exact s_mod_lt _ (Nat.lt_of_succ_lt w) (p - 2)
@@ -192,7 +192,8 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
the Lucas-Lehmer residue `s p (p-2) % (2^p - 1)` is zero.
-/
def LucasLehmerTest (p : ℕ) : Prop :=
- lucasLehmerResidue p = 0deriving DecidablePred
+ lucasLehmerResidue p = 0
+deriving DecidablePred
#align lucas_lehmer.lucas_lehmer_test LucasLehmer.LucasLehmerTest
-/
@@ -211,7 +212,8 @@ def q (p : ℕ) : ℕ+ :=
-- cardinality calculations would be somewhat more involved, too.
/-- We construct the ring `X q` as ℤ/qℤ + √3 ℤ/qℤ. -/
def X (q : ℕ+) : Type :=
- ZMod q × ZMod q deriving AddCommGroup, DecidableEq, Fintype, Inhabited
+ ZMod q × ZMod q
+deriving AddCommGroup, DecidableEq, Fintype, Inhabited
#align lucas_lehmer.X LucasLehmer.X
-/
@@ -430,11 +432,11 @@ Here and below, we introduce `p' = p - 2`, in order to avoid using subtraction i
theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
by
by_contra H
- simp at H
+ simp at H
interval_cases; clear H
· -- If q = 1, we get a contradiction from 2^p = 2
- dsimp [q] at h; injection h with h'; clear h
- simp [mersenne] at h'
+ dsimp [q] at h ; injection h with h'; clear h
+ simp [mersenne] at h'
exact
lt_irrefl 2
(calc
@@ -443,8 +445,8 @@ theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
_ = 2 := Nat.pred_inj (Nat.one_le_two_pow _) (by decide) h'
)
· -- If q = 2, we get a contradiction from 2 ∣ 2^p - 1
- dsimp [q] at h; injection h with h'; clear h
- rw [mersenne, PNat.one_coe, Nat.minFac_eq_two_iff, pow_succ] at h'
+ dsimp [q] at h ; injection h with h'; clear h
+ rw [mersenne, PNat.one_coe, Nat.minFac_eq_two_iff, pow_succ] at h'
exact Nat.two_not_dvd_two_mul_sub_one (Nat.one_le_two_pow _) h'
#align lucas_lehmer.two_lt_q LucasLehmer.two_lt_q
@@ -453,21 +455,21 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 1) =
k * mersenne (p' + 2) * (ω : X (q (p' + 2))) ^ 2 ^ p' - 1 :=
by
- dsimp [lucas_lehmer_residue] at h
- rw [s_zmod_eq_s p'] at h
- simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
+ dsimp [lucas_lehmer_residue] at h
+ rw [s_zmod_eq_s p'] at h
+ simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
cases' h with k h
use k
replace h := congr_arg (fun n : ℤ => (n : X (q (p' + 2)))) h
-- coercion from ℤ to X q
- dsimp at h
- rw [closed_form] at h
+ dsimp at h
+ rw [closed_form] at h
replace h := congr_arg (fun x => ω ^ 2 ^ p' * x) h
- dsimp at h
+ dsimp at h
have t : 2 ^ p' + 2 ^ p' = 2 ^ (p' + 1) := by ring
- rw [mul_add, ← pow_add ω, t, ← mul_pow ω ωb (2 ^ p'), ω_mul_ωb, one_pow] at h
- rw [mul_comm, coe_mul] at h
- rw [mul_comm _ (k : X (q (p' + 2)))] at h
+ rw [mul_add, ← pow_add ω, t, ← mul_pow ω ωb (2 ^ p'), ω_mul_ωb, one_pow] at h
+ rw [mul_comm, coe_mul] at h
+ rw [mul_comm _ (k : X (q (p' + 2)))] at h
replace h := eq_sub_of_add_eq h
have : 1 ≤ 2 ^ (p' + 2) := Nat.one_le_pow _ _ (by decide)
exact_mod_cast h
@@ -484,7 +486,7 @@ theorem ω_pow_eq_neg_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 1) = -1 :=
by
cases' ω_pow_formula p' h with k w
- rw [mersenne_coe_X] at w
+ rw [mersenne_coe_X] at w
simpa using w
#align lucas_lehmer.ω_pow_eq_neg_one LucasLehmer.ω_pow_eq_neg_one
@@ -523,7 +525,7 @@ theorem order_ω (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
have ω_pow := orderOf_dvd_iff_pow_eq_one.1 o
replace ω_pow :=
congr_arg (Units.coeHom (X (q (p' + 2))) : Units (X (q (p' + 2))) → X (q (p' + 2))) ω_pow
- simp at ω_pow
+ simp at ω_pow
have h : (1 : ZMod (q (p' + 2))) = -1 :=
congr_arg Prod.fst (ω_pow.symm.trans (ω_pow_eq_neg_one p' h))
haveI : Fact (2 < (q (p' + 2) : ℕ)) := ⟨two_lt_q _⟩
@@ -557,8 +559,8 @@ theorem lucas_lehmer_sufficiency (p : ℕ) (w : 1 < p) : LucasLehmerTest p → (
have w : 1 < p' + 2 := Nat.lt_of_sub_eq_succ rfl
contrapose
intro a t
- rw [z] at a
- rw [z] at t
+ rw [z] at a
+ rw [z] at t
have h₁ := order_ineq p' t
have h₂ := Nat.minFac_sq_le_self (mersenne_pos (Nat.lt_of_succ_lt w)) a
have h := lt_of_lt_of_le h₁ h₂
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -272,32 +272,24 @@ theorem one_snd : (1 : X q).2 = 0 :=
rfl
#align lucas_lehmer.X.one_snd LucasLehmer.X.one_snd
-/- warning: lucas_lehmer.X.bit0_fst clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.bit0_fst [anonymous]ₓ'. -/
@[simp]
-theorem [anonymous] (x : X q) : (bit0 x).1 = bit0 x.1 :=
+theorem bit0_fst (x : X q) : (bit0 x).1 = bit0 x.1 :=
rfl
-#align lucas_lehmer.X.bit0_fst [anonymous]
+#align lucas_lehmer.X.bit0_fst LucasLehmer.X.bit0_fst
-/- warning: lucas_lehmer.X.bit0_snd clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.bit0_snd [anonymous]ₓ'. -/
@[simp]
-theorem [anonymous] (x : X q) : (bit0 x).2 = bit0 x.2 :=
+theorem bit0_snd (x : X q) : (bit0 x).2 = bit0 x.2 :=
rfl
-#align lucas_lehmer.X.bit0_snd [anonymous]
+#align lucas_lehmer.X.bit0_snd LucasLehmer.X.bit0_snd
-/- warning: lucas_lehmer.X.bit1_fst clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.bit1_fst [anonymous]ₓ'. -/
@[simp]
-theorem [anonymous] (x : X q) : (bit1 x).1 = bit1 x.1 :=
+theorem bit1_fst (x : X q) : (bit1 x).1 = bit1 x.1 :=
rfl
-#align lucas_lehmer.X.bit1_fst [anonymous]
+#align lucas_lehmer.X.bit1_fst LucasLehmer.X.bit1_fst
-/- warning: lucas_lehmer.X.bit1_snd clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.bit1_snd [anonymous]ₓ'. -/
@[simp]
-theorem [anonymous] (x : X q) : (bit1 x).2 = bit0 x.2 := by dsimp [bit1]; simp
-#align lucas_lehmer.X.bit1_snd [anonymous]
+theorem bit1_snd (x : X q) : (bit1 x).2 = bit0 x.2 := by dsimp [bit1]; simp
+#align lucas_lehmer.X.bit1_snd LucasLehmer.X.bit1_snd
instance : Monoid (X q) :=
{
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -114,12 +114,6 @@ def sMod (p : ℕ) : ℕ → ℤ
#align lucas_lehmer.s_mod LucasLehmer.sMod
-/
-/- warning: lucas_lehmer.mersenne_int_ne_zero -> LucasLehmer.mersenne_int_ne_zero is a dubious translation:
-lean 3 declaration is
- forall (p : Nat), (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) p) -> (Ne.{1} Int (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.monoid)) (OfNat.ofNat.{0} Int 2 (OfNat.mk.{0} Int 2 (bit0.{0} Int Int.hasAdd (One.one.{0} Int Int.hasOne)))) p) (OfNat.ofNat.{0} Int 1 (OfNat.mk.{0} Int 1 (One.one.{0} Int Int.hasOne)))) (OfNat.ofNat.{0} Int 0 (OfNat.mk.{0} Int 0 (Zero.zero.{0} Int Int.hasZero))))
-but is expected to have type
- forall (p : Nat), (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) p) -> (Ne.{1} Int (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.instMonoidInt)) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2)) p) (OfNat.ofNat.{0} Int 1 (instOfNatInt 1))) (OfNat.ofNat.{0} Int 0 (instOfNatInt 0)))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.mersenne_int_ne_zero LucasLehmer.mersenne_int_ne_zeroₓ'. -/
theorem mersenne_int_ne_zero (p : ℕ) (w : 0 < p) : (2 ^ p - 1 : ℤ) ≠ 0 :=
by
apply ne_of_gt; simp only [gt_iff_lt, sub_pos]
@@ -135,21 +129,9 @@ theorem sMod_nonneg (p : ℕ) (w : 0 < p) (i : ℕ) : 0 ≤ sMod p i :=
#align lucas_lehmer.s_mod_nonneg LucasLehmer.sMod_nonneg
-/
-/- warning: lucas_lehmer.s_mod_mod -> LucasLehmer.sMod_mod is a dubious translation:
-lean 3 declaration is
- forall (p : Nat) (i : Nat), Eq.{1} Int (HMod.hMod.{0, 0, 0} Int Int Int (instHMod.{0} Int Int.hasMod) (LucasLehmer.sMod p i) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.monoid)) (OfNat.ofNat.{0} Int 2 (OfNat.mk.{0} Int 2 (bit0.{0} Int Int.hasAdd (One.one.{0} Int Int.hasOne)))) p) (OfNat.ofNat.{0} Int 1 (OfNat.mk.{0} Int 1 (One.one.{0} Int Int.hasOne))))) (LucasLehmer.sMod p i)
-but is expected to have type
- forall (p : Nat) (i : Nat), Eq.{1} Int (HMod.hMod.{0, 0, 0} Int Int Int (instHMod.{0} Int Int.instModInt_1) (LucasLehmer.sMod p i) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.instMonoidInt)) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2)) p) (OfNat.ofNat.{0} Int 1 (instOfNatInt 1)))) (LucasLehmer.sMod p i)
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.s_mod_mod LucasLehmer.sMod_modₓ'. -/
theorem sMod_mod (p i : ℕ) : sMod p i % (2 ^ p - 1) = sMod p i := by cases i <;> simp [s_mod]
#align lucas_lehmer.s_mod_mod LucasLehmer.sMod_mod
-/- warning: lucas_lehmer.s_mod_lt -> LucasLehmer.sMod_lt is a dubious translation:
-lean 3 declaration is
- forall (p : Nat), (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) p) -> (forall (i : Nat), LT.lt.{0} Int Int.hasLt (LucasLehmer.sMod p i) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.monoid)) (OfNat.ofNat.{0} Int 2 (OfNat.mk.{0} Int 2 (bit0.{0} Int Int.hasAdd (One.one.{0} Int Int.hasOne)))) p) (OfNat.ofNat.{0} Int 1 (OfNat.mk.{0} Int 1 (One.one.{0} Int Int.hasOne)))))
-but is expected to have type
- forall (p : Nat), (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) p) -> (forall (i : Nat), LT.lt.{0} Int Int.instLTInt (LucasLehmer.sMod p i) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.instMonoidInt)) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2)) p) (OfNat.ofNat.{0} Int 1 (instOfNatInt 1))))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.s_mod_lt LucasLehmer.sMod_ltₓ'. -/
theorem sMod_lt (p : ℕ) (w : 0 < p) (i : ℕ) : sMod p i < 2 ^ p - 1 :=
by
rw [← s_mod_mod]
@@ -160,12 +142,6 @@ theorem sMod_lt (p : ℕ) (w : 0 < p) (i : ℕ) : sMod p i < 2 ^ p - 1 :=
· exact mersenne_int_ne_zero p w
#align lucas_lehmer.s_mod_lt LucasLehmer.sMod_lt
-/- warning: lucas_lehmer.s_zmod_eq_s -> LucasLehmer.sZMod_eq_s is a dubious translation:
-lean 3 declaration is
- forall (p' : Nat) (i : Nat), Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.sZMod (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) i) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (HasLiftT.mk.{1, 1} Int (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (CoeTCₓ.coe.{1, 1} Int (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (Int.castCoe.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (AddGroupWithOne.toHasIntCast.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (Ring.toAddCommGroupWithOne.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))))))))))) (LucasLehmer.s i))
-but is expected to have type
- forall (p' : Nat) (i : Nat), Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.sZMod (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))) i) (Int.cast.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (Ring.toIntCast.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))) (LucasLehmer.s i))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.s_zmod_eq_s LucasLehmer.sZMod_eq_sₓ'. -/
theorem sZMod_eq_s (p' : ℕ) (i : ℕ) : sZMod (p' + 2) i = (s i : ZMod (2 ^ (p' + 2) - 1)) :=
by
induction' i with i ih
@@ -173,12 +149,6 @@ theorem sZMod_eq_s (p' : ℕ) (i : ℕ) : sZMod (p' + 2) i = (s i : ZMod (2 ^ (p
· push_cast [s, s_zmod, ih]
#align lucas_lehmer.s_zmod_eq_s LucasLehmer.sZMod_eq_s
-/- warning: lucas_lehmer.int.coe_nat_pow_pred -> LucasLehmer.Int.coe_nat_pow_pred is a dubious translation:
-lean 3 declaration is
- forall (b : Nat) (p : Nat), (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) b) -> (Eq.{1} Int ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) b p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) b) p) (OfNat.ofNat.{0} Int 1 (OfNat.mk.{0} Int 1 (One.one.{0} Int Int.hasOne)))))
-but is expected to have type
- forall (b : Nat) (p : Nat), (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) b) -> (Eq.{1} Int (Nat.cast.{0} Int instNatCastInt (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) b p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HPow.hPow.{0, 0, 0} Int Nat Int Int.instHPowIntNat (Nat.cast.{0} Int instNatCastInt b) p) (OfNat.ofNat.{0} Int 1 (instOfNatInt 1))))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.int.coe_nat_pow_pred LucasLehmer.Int.coe_nat_pow_predₓ'. -/
-- These next two don't make good `norm_cast` lemmas.
theorem Int.coe_nat_pow_pred (b p : ℕ) (w : 0 < b) : ((b ^ p - 1 : ℕ) : ℤ) = (b ^ p - 1 : ℤ) :=
by
@@ -186,22 +156,10 @@ theorem Int.coe_nat_pow_pred (b p : ℕ) (w : 0 < b) : ((b ^ p - 1 : ℕ) : ℤ)
norm_cast
#align lucas_lehmer.int.coe_nat_pow_pred LucasLehmer.Int.coe_nat_pow_pred
-/- warning: lucas_lehmer.int.coe_nat_two_pow_pred -> LucasLehmer.Int.coe_nat_two_pow_pred is a dubious translation:
-lean 3 declaration is
- forall (p : Nat), Eq.{1} Int ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.monoid)) (OfNat.ofNat.{0} Int 2 (OfNat.mk.{0} Int 2 (bit0.{0} Int Int.hasAdd (One.one.{0} Int Int.hasOne)))) p) (OfNat.ofNat.{0} Int 1 (OfNat.mk.{0} Int 1 (One.one.{0} Int Int.hasOne))))
-but is expected to have type
- forall (p : Nat), Eq.{1} Int (Nat.cast.{0} Int instNatCastInt (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.instMonoidInt)) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2)) p) (OfNat.ofNat.{0} Int 1 (instOfNatInt 1)))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.int.coe_nat_two_pow_pred LucasLehmer.Int.coe_nat_two_pow_predₓ'. -/
theorem Int.coe_nat_two_pow_pred (p : ℕ) : ((2 ^ p - 1 : ℕ) : ℤ) = (2 ^ p - 1 : ℤ) :=
Int.coe_nat_pow_pred 2 p (by decide)
#align lucas_lehmer.int.coe_nat_two_pow_pred LucasLehmer.Int.coe_nat_two_pow_pred
-/- warning: lucas_lehmer.s_zmod_eq_s_mod -> LucasLehmer.sZMod_eq_sMod is a dubious translation:
-lean 3 declaration is
- forall (p : Nat) (i : Nat), Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.sZMod p i) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (HasLiftT.mk.{1, 1} Int (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (CoeTCₓ.coe.{1, 1} Int (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (Int.castCoe.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (AddGroupWithOne.toHasIntCast.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (Ring.toAddCommGroupWithOne.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))))))))))) (LucasLehmer.sMod p i))
-but is expected to have type
- forall (p : Nat) (i : Nat), Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.sZMod p i) (Int.cast.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (Ring.toIntCast.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))) (LucasLehmer.sMod p i))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.s_zmod_eq_s_mod LucasLehmer.sZMod_eq_sModₓ'. -/
theorem sZMod_eq_sMod (p : ℕ) (i : ℕ) : sZMod p i = (sMod p i : ZMod (2 ^ p - 1)) := by
induction i <;> push_cast [← int.coe_nat_two_pow_pred p, s_mod, s_zmod, *]
#align lucas_lehmer.s_zmod_eq_s_mod LucasLehmer.sZMod_eq_sMod
@@ -213,12 +171,6 @@ def lucasLehmerResidue (p : ℕ) : ZMod (2 ^ p - 1) :=
#align lucas_lehmer.lucas_lehmer_residue LucasLehmer.lucasLehmerResidue
-/
-/- warning: lucas_lehmer.residue_eq_zero_iff_s_mod_eq_zero -> LucasLehmer.residue_eq_zero_iff_sMod_eq_zero is a dubious translation:
-lean 3 declaration is
- forall (p : Nat), (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))) p) -> (Iff (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.lucasLehmerResidue p) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) 0 (OfNat.mk.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) 0 (Zero.zero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (MulZeroClass.toHasZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (Ring.toNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))))))))))))) (Eq.{1} Int (LucasLehmer.sMod p (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) p (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Int 0 (OfNat.mk.{0} Int 0 (Zero.zero.{0} Int Int.hasZero)))))
-but is expected to have type
- forall (p : Nat), (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)) p) -> (Iff (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.lucasLehmerResidue p) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) 0 (Zero.toOfNat0.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommMonoidWithZero.toZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toCommSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))))))) (Eq.{1} Int (LucasLehmer.sMod p (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) p (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Int 0 (instOfNatInt 0))))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.residue_eq_zero_iff_s_mod_eq_zero LucasLehmer.residue_eq_zero_iff_sMod_eq_zeroₓ'. -/
theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
lucasLehmerResidue p = 0 ↔ sMod p (p - 2) = 0 :=
by
@@ -276,45 +228,21 @@ theorem ext {x y : X q} (h₁ : x.1 = y.1) (h₂ : x.2 = y.2) : x = y :=
#align lucas_lehmer.X.ext LucasLehmer.X.ext
-/
-/- warning: lucas_lehmer.X.add_fst -> LucasLehmer.X.add_fst is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q))))))) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y))
-but is expected to have type
- forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddCommGroupX q))))))) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHAdd.{0} (ZMod (PNat.val q)) (Distrib.toAdd.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocSemiring.toDistrib.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))))) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.add_fst LucasLehmer.X.add_fstₓ'. -/
@[simp]
theorem add_fst (x y : X q) : (x + y).1 = x.1 + y.1 :=
rfl
#align lucas_lehmer.X.add_fst LucasLehmer.X.add_fst
-/- warning: lucas_lehmer.X.add_snd -> LucasLehmer.X.add_snd is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q))))))) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y))
-but is expected to have type
- forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddCommGroupX q))))))) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHAdd.{0} (ZMod (PNat.val q)) (Distrib.toAdd.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocSemiring.toDistrib.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))))) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.add_snd LucasLehmer.X.add_sndₓ'. -/
@[simp]
theorem add_snd (x y : X q) : (x + y).2 = x.2 + y.2 :=
rfl
#align lucas_lehmer.X.add_snd LucasLehmer.X.add_snd
-/- warning: lucas_lehmer.X.neg_fst -> LucasLehmer.X.neg_fst is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Neg.neg.{0} (LucasLehmer.X q) (SubNegMonoid.toHasNeg.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q)))) x)) (Neg.neg.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (SubNegMonoid.toHasNeg.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroup.toSubNegMonoid.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddGroup.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))))) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x))
-but is expected to have type
- forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Neg.neg.{0} (LucasLehmer.X q) (NegZeroClass.toNeg.{0} (LucasLehmer.X q) (SubNegZeroMonoid.toNegZeroClass.{0} (LucasLehmer.X q) (SubtractionMonoid.toSubNegZeroMonoid.{0} (LucasLehmer.X q) (SubtractionCommMonoid.toSubtractionMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toDivisionAddCommMonoid.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddCommGroupX q)))))) x)) (Neg.neg.{0} (ZMod (PNat.val q)) (Ring.toNeg.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.neg_fst LucasLehmer.X.neg_fstₓ'. -/
@[simp]
theorem neg_fst (x : X q) : (-x).1 = -x.1 :=
rfl
#align lucas_lehmer.X.neg_fst LucasLehmer.X.neg_fst
-/- warning: lucas_lehmer.X.neg_snd -> LucasLehmer.X.neg_snd is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Neg.neg.{0} (LucasLehmer.X q) (SubNegMonoid.toHasNeg.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q)))) x)) (Neg.neg.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (SubNegMonoid.toHasNeg.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroup.toSubNegMonoid.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddGroup.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))))) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x))
-but is expected to have type
- forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Neg.neg.{0} (LucasLehmer.X q) (NegZeroClass.toNeg.{0} (LucasLehmer.X q) (SubNegZeroMonoid.toNegZeroClass.{0} (LucasLehmer.X q) (SubtractionMonoid.toSubNegZeroMonoid.{0} (LucasLehmer.X q) (SubtractionCommMonoid.toSubtractionMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toDivisionAddCommMonoid.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddCommGroupX q)))))) x)) (Neg.neg.{0} (ZMod (PNat.val q)) (Ring.toNeg.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.neg_snd LucasLehmer.X.neg_sndₓ'. -/
@[simp]
theorem neg_snd (x : X q) : (-x).2 = -x.2 :=
rfl
@@ -322,20 +250,11 @@ theorem neg_snd (x : X q) : (-x).2 = -x.2 :=
instance : Mul (X q) where mul x y := (x.1 * y.1 + 3 * x.2 * y.2, x.1 * y.2 + x.2 * y.1)
-/- warning: lucas_lehmer.X.mul_fst -> LucasLehmer.X.mul_fst is a dubious translation:
-<too large>
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.mul_fst LucasLehmer.X.mul_fstₓ'. -/
@[simp]
theorem mul_fst (x y : X q) : (x * y).1 = x.1 * y.1 + 3 * x.2 * y.2 :=
rfl
#align lucas_lehmer.X.mul_fst LucasLehmer.X.mul_fst
-/- warning: lucas_lehmer.X.mul_snd -> LucasLehmer.X.mul_snd is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (HMul.hMul.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y)) (HMul.hMul.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y)))
-but is expected to have type
- forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHAdd.{0} (ZMod (PNat.val q)) (Distrib.toAdd.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocSemiring.toDistrib.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))))) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y)) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y)))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.mul_snd LucasLehmer.X.mul_sndₓ'. -/
@[simp]
theorem mul_snd (x y : X q) : (x * y).2 = x.1 * y.2 + x.2 * y.1 :=
rfl
@@ -343,34 +262,17 @@ theorem mul_snd (x y : X q) : (x * y).2 = x.1 * y.2 + x.2 * y.1 :=
instance : One (X q) where one := ⟨1, 0⟩
-/- warning: lucas_lehmer.X.one_fst -> LucasLehmer.X.one_fst is a dubious translation:
-lean 3 declaration is
- forall {q : PNat}, Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (OfNat.mk.{0} (LucasLehmer.X q) 1 (One.one.{0} (LucasLehmer.X q) (LucasLehmer.X.hasOne q))))) (OfNat.ofNat.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 1 (OfNat.mk.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 1 (One.one.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))))))))
-but is expected to have type
- forall {q : PNat}, Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (One.toOfNat1.{0} (LucasLehmer.X q) (LucasLehmer.X.instOneX q)))) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 1 (One.toOfNat1.{0} (ZMod (PNat.val q)) (Semiring.toOne.{0} (ZMod (PNat.val q)) (CommSemiring.toSemiring.{0} (ZMod (PNat.val q)) (CommRing.toCommSemiring.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))))))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.one_fst LucasLehmer.X.one_fstₓ'. -/
@[simp]
theorem one_fst : (1 : X q).1 = 1 :=
rfl
#align lucas_lehmer.X.one_fst LucasLehmer.X.one_fst
-/- warning: lucas_lehmer.X.one_snd -> LucasLehmer.X.one_snd is a dubious translation:
-lean 3 declaration is
- forall {q : PNat}, Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (OfNat.mk.{0} (LucasLehmer.X q) 1 (One.one.{0} (LucasLehmer.X q) (LucasLehmer.X.hasOne q))))) (OfNat.ofNat.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 0 (OfNat.mk.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 0 (Zero.zero.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (MulZeroClass.toHasZero.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toNonAssocRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))))))))
-but is expected to have type
- forall {q : PNat}, Eq.{1} (ZMod (PNat.val q)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (One.toOfNat1.{0} (LucasLehmer.X q) (LucasLehmer.X.instOneX q)))) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 0 (Zero.toOfNat0.{0} (ZMod (PNat.val q)) (CommMonoidWithZero.toZero.{0} (ZMod (PNat.val q)) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (PNat.val q)) (CommRing.toCommSemiring.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))))))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.one_snd LucasLehmer.X.one_sndₓ'. -/
@[simp]
theorem one_snd : (1 : X q).2 = 0 :=
rfl
#align lucas_lehmer.X.one_snd LucasLehmer.X.one_snd
/- warning: lucas_lehmer.X.bit0_fst clashes with [anonymous] -> [anonymous]
-warning: lucas_lehmer.X.bit0_fst -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (bit0.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q)))))) x)) (bit0.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x))
-but is expected to have type
- forall {q : Type.{u}} {x : Type.{v}}, (Nat -> q -> x) -> Nat -> (List.{u} q) -> (List.{v} x)
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.bit0_fst [anonymous]ₓ'. -/
@[simp]
theorem [anonymous] (x : X q) : (bit0 x).1 = bit0 x.1 :=
@@ -378,11 +280,6 @@ theorem [anonymous] (x : X q) : (bit0 x).1 = bit0 x.1 :=
#align lucas_lehmer.X.bit0_fst [anonymous]
/- warning: lucas_lehmer.X.bit0_snd clashes with [anonymous] -> [anonymous]
-warning: lucas_lehmer.X.bit0_snd -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (bit0.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q)))))) x)) (bit0.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x))
-but is expected to have type
- forall {q : Type.{u}} {x : Type.{v}}, (Nat -> q -> x) -> Nat -> (List.{u} q) -> (List.{v} x)
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.bit0_snd [anonymous]ₓ'. -/
@[simp]
theorem [anonymous] (x : X q) : (bit0 x).2 = bit0 x.2 :=
@@ -390,11 +287,6 @@ theorem [anonymous] (x : X q) : (bit0 x).2 = bit0 x.2 :=
#align lucas_lehmer.X.bit0_snd [anonymous]
/- warning: lucas_lehmer.X.bit1_fst clashes with [anonymous] -> [anonymous]
-warning: lucas_lehmer.X.bit1_fst -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (bit1.{0} (LucasLehmer.X q) (LucasLehmer.X.hasOne q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q)))))) x)) (bit1.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))))) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x))
-but is expected to have type
- forall {q : Type.{u}} {x : Type.{v}}, (Nat -> q -> x) -> Nat -> (List.{u} q) -> (List.{v} x)
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.bit1_fst [anonymous]ₓ'. -/
@[simp]
theorem [anonymous] (x : X q) : (bit1 x).1 = bit1 x.1 :=
@@ -402,11 +294,6 @@ theorem [anonymous] (x : X q) : (bit1 x).1 = bit1 x.1 :=
#align lucas_lehmer.X.bit1_fst [anonymous]
/- warning: lucas_lehmer.X.bit1_snd clashes with [anonymous] -> [anonymous]
-warning: lucas_lehmer.X.bit1_snd -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (bit1.{0} (LucasLehmer.X q) (LucasLehmer.X.hasOne q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q)))))) x)) (bit0.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x))
-but is expected to have type
- forall {q : Type.{u}} {x : Type.{v}}, (Nat -> q -> x) -> Nat -> (List.{u} q) -> (List.{v} x)
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.bit1_snd [anonymous]ₓ'. -/
@[simp]
theorem [anonymous] (x : X q) : (bit1 x).2 = bit0 x.2 := by dsimp [bit1]; simp
@@ -430,21 +317,9 @@ instance : AddGroupWithOne (X q) :=
intCast_ofNat := fun n => by simp <;> rfl
intCast_negSucc := fun n => by ext <;> simp <;> rfl }
-/- warning: lucas_lehmer.X.left_distrib -> LucasLehmer.X.left_distrib is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q) (z : LucasLehmer.X q), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) x (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) y z)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) x y) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) x z))
-but is expected to have type
- forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q) (z : LucasLehmer.X q), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddGroupWithOneX q)))))) y z)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddGroupWithOneX q)))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x y) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x z))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.left_distrib LucasLehmer.X.left_distribₓ'. -/
theorem left_distrib (x y z : X q) : x * (y + z) = x * y + x * z := by ext <;> · dsimp; ring
#align lucas_lehmer.X.left_distrib LucasLehmer.X.left_distrib
-/- warning: lucas_lehmer.X.right_distrib -> LucasLehmer.X.right_distrib is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q) (z : LucasLehmer.X q), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) x y) z) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) x z) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) y z))
-but is expected to have type
- forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q) (z : LucasLehmer.X q), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddGroupWithOneX q)))))) x y) z) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddGroupWithOneX q)))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x z) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) y z))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.right_distrib LucasLehmer.X.right_distribₓ'. -/
theorem right_distrib (x y z : X q) : (x + y) * z = x * z + y * z := by ext <;> · dsimp; ring
#align lucas_lehmer.X.right_distrib LucasLehmer.X.right_distrib
@@ -460,66 +335,30 @@ instance : CommRing (X q) :=
instance [Fact (1 < (q : ℕ))] : Nontrivial (X q) :=
⟨⟨0, 1, fun h => by injection h with h1 _; exact zero_ne_one h1⟩⟩
-/- warning: lucas_lehmer.X.nat_coe_fst -> LucasLehmer.X.nat_coe_fst is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (n : Nat), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Nat (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Nat (LucasLehmer.X q) (Nat.castCoe.{0} (LucasLehmer.X q) (AddMonoidWithOne.toNatCast.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) n)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HasLiftT.mk.{1, 1} Nat (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CoeTCₓ.coe.{1, 1} Nat (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Nat.castCoe.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toNatCast.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))))))) n)
-but is expected to have type
- forall {q : PNat} (n : Nat), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Nat.cast.{0} (LucasLehmer.X q) (LucasLehmer.X.instNatCastX q) n)) (Nat.cast.{0} (ZMod (PNat.val q)) (Semiring.toNatCast.{0} (ZMod (PNat.val q)) (CommSemiring.toSemiring.{0} (ZMod (PNat.val q)) (CommRing.toCommSemiring.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))) n)
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.nat_coe_fst LucasLehmer.X.nat_coe_fstₓ'. -/
@[simp]
theorem nat_coe_fst (n : ℕ) : (n : X q).fst = (n : ZMod q) :=
rfl
#align lucas_lehmer.X.nat_coe_fst LucasLehmer.X.nat_coe_fst
-/- warning: lucas_lehmer.X.nat_coe_snd -> LucasLehmer.X.nat_coe_snd is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (n : Nat), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Nat (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Nat (LucasLehmer.X q) (Nat.castCoe.{0} (LucasLehmer.X q) (AddMonoidWithOne.toNatCast.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) n)) (OfNat.ofNat.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 0 (OfNat.mk.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 0 (Zero.zero.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (MulZeroClass.toHasZero.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toNonAssocRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))))))))
-but is expected to have type
- forall {q : PNat} (n : Nat), Eq.{1} (ZMod (PNat.val q)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Nat.cast.{0} (LucasLehmer.X q) (LucasLehmer.X.instNatCastX q) n)) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 0 (Zero.toOfNat0.{0} (ZMod (PNat.val q)) (CommMonoidWithZero.toZero.{0} (ZMod (PNat.val q)) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (PNat.val q)) (CommRing.toCommSemiring.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))))))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.nat_coe_snd LucasLehmer.X.nat_coe_sndₓ'. -/
@[simp]
theorem nat_coe_snd (n : ℕ) : (n : X q).snd = (0 : ZMod q) :=
rfl
#align lucas_lehmer.X.nat_coe_snd LucasLehmer.X.nat_coe_snd
-/- warning: lucas_lehmer.X.int_coe_fst -> LucasLehmer.X.int_coe_fst is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (n : Int), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) n)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HasLiftT.mk.{1, 1} Int (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CoeTCₓ.coe.{1, 1} Int (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Int.castCoe.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toHasIntCast.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))))))) n)
-but is expected to have type
- forall {q : PNat} (n : Int), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) n)) (Int.cast.{0} (ZMod (PNat.val q)) (Ring.toIntCast.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))) n)
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.int_coe_fst LucasLehmer.X.int_coe_fstₓ'. -/
@[simp]
theorem int_coe_fst (n : ℤ) : (n : X q).fst = (n : ZMod q) :=
rfl
#align lucas_lehmer.X.int_coe_fst LucasLehmer.X.int_coe_fst
-/- warning: lucas_lehmer.X.int_coe_snd -> LucasLehmer.X.int_coe_snd is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (n : Int), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) n)) (OfNat.ofNat.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 0 (OfNat.mk.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 0 (Zero.zero.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (MulZeroClass.toHasZero.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toNonAssocRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))))))))
-but is expected to have type
- forall {q : PNat} (n : Int), Eq.{1} (ZMod (PNat.val q)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) n)) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 0 (Zero.toOfNat0.{0} (ZMod (PNat.val q)) (CommMonoidWithZero.toZero.{0} (ZMod (PNat.val q)) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (PNat.val q)) (CommRing.toCommSemiring.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))))))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.int_coe_snd LucasLehmer.X.int_coe_sndₓ'. -/
@[simp]
theorem int_coe_snd (n : ℤ) : (n : X q).snd = (0 : ZMod q) :=
rfl
#align lucas_lehmer.X.int_coe_snd LucasLehmer.X.int_coe_snd
-/- warning: lucas_lehmer.X.coe_mul -> LucasLehmer.X.coe_mul is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (n : Int) (m : Int), Eq.{1} (LucasLehmer.X q) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.hasMul) n m)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) n) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) m))
-but is expected to have type
- forall {q : PNat} (n : Int) (m : Int), Eq.{1} (LucasLehmer.X q) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.instMulInt) n m)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) n) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) m))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.coe_mul LucasLehmer.X.coe_mulₓ'. -/
@[norm_cast]
theorem coe_mul (n m : ℤ) : ((n * m : ℤ) : X q) = (n : X q) * (m : X q) := by ext <;> simp <;> ring
#align lucas_lehmer.X.coe_mul LucasLehmer.X.coe_mul
-/- warning: lucas_lehmer.X.coe_nat -> LucasLehmer.X.coe_nat is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (n : Nat), Eq.{1} (LucasLehmer.X q) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) n)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Nat (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Nat (LucasLehmer.X q) (Nat.castCoe.{0} (LucasLehmer.X q) (AddMonoidWithOne.toNatCast.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) n)
-but is expected to have type
- forall {q : PNat} (n : Nat), Eq.{1} (LucasLehmer.X q) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) (Nat.cast.{0} Int instNatCastInt n)) (Nat.cast.{0} (LucasLehmer.X q) (LucasLehmer.X.instNatCastX q) n)
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.coe_nat LucasLehmer.X.coe_natₓ'. -/
@[norm_cast]
theorem coe_nat (n : ℕ) : ((n : ℤ) : X q) = (n : X q) := by ext <;> simp
#align lucas_lehmer.X.coe_nat LucasLehmer.X.coe_nat
@@ -534,12 +373,6 @@ theorem card_eq : Fintype.card (X q) = q ^ 2 :=
#align lucas_lehmer.X.X_card LucasLehmer.X.card_eq
-/
-/- warning: lucas_lehmer.X.units_card -> LucasLehmer.X.card_units_lt is a dubious translation:
-lean 3 declaration is
- forall {q : PNat}, (LT.lt.{0} PNat (Preorder.toHasLt.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 1 (OfNat.mk.{0} PNat 1 (One.one.{0} PNat PNat.hasOne))) q) -> (LT.lt.{0} Nat Nat.hasLt (Fintype.card.{0} (Units.{0} (LucasLehmer.X q) (LucasLehmer.X.monoid q)) (Units.fintype.{0} (LucasLehmer.X q) (LucasLehmer.X.monoid q) (LucasLehmer.X.fintype q) (fun (a : LucasLehmer.X q) (b : LucasLehmer.X q) => LucasLehmer.X.decidableEq q a b))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))
-but is expected to have type
- forall {q : PNat}, (LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 1 (instOfNatPNatHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)))) q) -> (LT.lt.{0} Nat instLTNat (Fintype.card.{0} (Units.{0} (LucasLehmer.X q) (LucasLehmer.X.instMonoidX q)) (instFintypeUnits.{0} (LucasLehmer.X q) (LucasLehmer.X.instMonoidX q) (LucasLehmer.X.instFintypeX q) (fun (a : LucasLehmer.X q) (b : LucasLehmer.X q) => LucasLehmer.X.instDecidableEqX q a b))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (PNat.val q) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.units_card LucasLehmer.X.card_units_ltₓ'. -/
/-- There are strictly fewer than `q^2` units, since `0` is not a unit. -/
theorem card_units_lt (w : 1 < q) : Fintype.card (X q)ˣ < q ^ 2 :=
by
@@ -562,36 +395,18 @@ def ωb : X q :=
#align lucas_lehmer.X.ωb LucasLehmer.X.ωb
-/
-/- warning: lucas_lehmer.X.ω_mul_ωb -> LucasLehmer.X.ω_mul_ωb is a dubious translation:
-lean 3 declaration is
- forall (q : PNat), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) (LucasLehmer.X.ω q) (LucasLehmer.X.ωb q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (OfNat.mk.{0} (LucasLehmer.X q) 1 (One.one.{0} (LucasLehmer.X q) (LucasLehmer.X.hasOne q))))
-but is expected to have type
- forall (q : PNat), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) (LucasLehmer.X.ω q) (LucasLehmer.X.ωb q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (One.toOfNat1.{0} (LucasLehmer.X q) (LucasLehmer.X.instOneX q)))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.ω_mul_ωb LucasLehmer.X.ω_mul_ωbₓ'. -/
theorem ω_mul_ωb (q : ℕ+) : (ω : X q) * ωb = 1 :=
by
dsimp [ω, ωb]
ext <;> simp <;> ring
#align lucas_lehmer.X.ω_mul_ωb LucasLehmer.X.ω_mul_ωb
-/- warning: lucas_lehmer.X.ωb_mul_ω -> LucasLehmer.X.ωb_mul_ω is a dubious translation:
-lean 3 declaration is
- forall (q : PNat), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) (LucasLehmer.X.ωb q) (LucasLehmer.X.ω q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (OfNat.mk.{0} (LucasLehmer.X q) 1 (One.one.{0} (LucasLehmer.X q) (LucasLehmer.X.hasOne q))))
-but is expected to have type
- forall (q : PNat), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) (LucasLehmer.X.ωb q) (LucasLehmer.X.ω q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (One.toOfNat1.{0} (LucasLehmer.X q) (LucasLehmer.X.instOneX q)))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.ωb_mul_ω LucasLehmer.X.ωb_mul_ωₓ'. -/
theorem ωb_mul_ω (q : ℕ+) : (ωb : X q) * ω = 1 :=
by
dsimp [ω, ωb]
ext <;> simp <;> ring
#align lucas_lehmer.X.ωb_mul_ω LucasLehmer.X.ωb_mul_ω
-/- warning: lucas_lehmer.X.closed_form -> LucasLehmer.X.closed_form is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (i : Nat), Eq.{1} (LucasLehmer.X q) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) (LucasLehmer.s i)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (Distrib.toHasAdd.{0} (LucasLehmer.X q) (Ring.toDistrib.{0} (LucasLehmer.X q) (LucasLehmer.X.ring q)))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X q) Nat (LucasLehmer.X q) (instHPow.{0, 0} (LucasLehmer.X q) Nat (Monoid.Pow.{0} (LucasLehmer.X q) (LucasLehmer.X.monoid q))) (LucasLehmer.X.ω q) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) i)) (HPow.hPow.{0, 0, 0} (LucasLehmer.X q) Nat (LucasLehmer.X q) (instHPow.{0, 0} (LucasLehmer.X q) Nat (Monoid.Pow.{0} (LucasLehmer.X q) (LucasLehmer.X.monoid q))) (LucasLehmer.X.ωb q) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) i)))
-but is expected to have type
- forall {q : PNat} (i : Nat), Eq.{1} (LucasLehmer.X q) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) (LucasLehmer.s i)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (Distrib.toAdd.{0} (LucasLehmer.X q) (NonUnitalNonAssocSemiring.toDistrib.{0} (LucasLehmer.X q) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (LucasLehmer.X q) (NonAssocRing.toNonUnitalNonAssocRing.{0} (LucasLehmer.X q) (Ring.toNonAssocRing.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q))))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X q) Nat (LucasLehmer.X q) (instHPow.{0, 0} (LucasLehmer.X q) Nat (Monoid.Pow.{0} (LucasLehmer.X q) (LucasLehmer.X.instMonoidX q))) (LucasLehmer.X.ω q) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) i)) (HPow.hPow.{0, 0, 0} (LucasLehmer.X q) Nat (LucasLehmer.X q) (instHPow.{0, 0} (LucasLehmer.X q) Nat (Monoid.Pow.{0} (LucasLehmer.X q) (LucasLehmer.X.instMonoidX q))) (LucasLehmer.X.ωb q) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) i)))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.closed_form LucasLehmer.X.closed_formₓ'. -/
/-- A closed form for the recurrence relation. -/
theorem closed_form (i : ℕ) : (s i : X q) = (ω : X q) ^ 2 ^ i + (ωb : X q) ^ 2 ^ i :=
by
@@ -619,12 +434,6 @@ Here and below, we introduce `p' = p - 2`, in order to avoid using subtraction i
-/
-/- warning: lucas_lehmer.two_lt_q -> LucasLehmer.two_lt_q is a dubious translation:
-lean 3 declaration is
- forall (p' : Nat), LT.lt.{0} PNat (Preorder.toHasLt.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 2 (OfNat.mk.{0} PNat 2 (bit0.{0} PNat PNat.hasAdd (One.one.{0} PNat PNat.hasOne)))) (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))
-but is expected to have type
- forall (p' : Nat), LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 2 (instOfNatPNatHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.two_lt_q LucasLehmer.two_lt_qₓ'. -/
/-- If `1 < p`, then `q p`, the smallest prime factor of `mersenne p`, is more than 2. -/
theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
by
@@ -647,9 +456,6 @@ theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
exact Nat.two_not_dvd_two_mul_sub_one (Nat.one_le_two_pow _) h'
#align lucas_lehmer.two_lt_q LucasLehmer.two_lt_q
-/- warning: lucas_lehmer.ω_pow_formula -> LucasLehmer.ω_pow_formula is a dubious translation:
-<too large>
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.ω_pow_formula LucasLehmer.ω_pow_formulaₓ'. -/
theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
∃ k : ℤ,
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 1) =
@@ -675,12 +481,6 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
exact_mod_cast h
#align lucas_lehmer.ω_pow_formula LucasLehmer.ω_pow_formula
-/- warning: lucas_lehmer.mersenne_coe_X -> LucasLehmer.mersenne_coe_X is a dubious translation:
-lean 3 declaration is
- forall (p : Nat), Eq.{1} (LucasLehmer.X (LucasLehmer.q p)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (LucasLehmer.X (LucasLehmer.q p)) (HasLiftT.mk.{1, 1} Nat (LucasLehmer.X (LucasLehmer.q p)) (CoeTCₓ.coe.{1, 1} Nat (LucasLehmer.X (LucasLehmer.q p)) (Nat.castCoe.{0} (LucasLehmer.X (LucasLehmer.q p)) (AddMonoidWithOne.toNatCast.{0} (LucasLehmer.X (LucasLehmer.q p)) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X (LucasLehmer.q p)) (LucasLehmer.X.addGroupWithOne (LucasLehmer.q p))))))) (mersenne p)) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q p)) 0 (OfNat.mk.{0} (LucasLehmer.X (LucasLehmer.q p)) 0 (Zero.zero.{0} (LucasLehmer.X (LucasLehmer.q p)) (MulZeroClass.toHasZero.{0} (LucasLehmer.X (LucasLehmer.q p)) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (LucasLehmer.X (LucasLehmer.q p)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (LucasLehmer.X (LucasLehmer.q p)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (LucasLehmer.X (LucasLehmer.q p)) (Ring.toNonAssocRing.{0} (LucasLehmer.X (LucasLehmer.q p)) (LucasLehmer.X.ring (LucasLehmer.q p))))))))))
-but is expected to have type
- forall (p : Nat), Eq.{1} (LucasLehmer.X (LucasLehmer.q p)) (Nat.cast.{0} (LucasLehmer.X (LucasLehmer.q p)) (LucasLehmer.X.instNatCastX (LucasLehmer.q p)) (mersenne p)) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q p)) 0 (Zero.toOfNat0.{0} (LucasLehmer.X (LucasLehmer.q p)) (CommMonoidWithZero.toZero.{0} (LucasLehmer.X (LucasLehmer.q p)) (CommSemiring.toCommMonoidWithZero.{0} (LucasLehmer.X (LucasLehmer.q p)) (CommRing.toCommSemiring.{0} (LucasLehmer.X (LucasLehmer.q p)) (LucasLehmer.X.instCommRingX (LucasLehmer.q p)))))))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.mersenne_coe_X LucasLehmer.mersenne_coe_Xₓ'. -/
/-- `q` is the minimum factor of `mersenne p`, so `M p = 0` in `X q`. -/
theorem mersenne_coe_X (p : ℕ) : (mersenne p : X (q p)) = 0 :=
by
@@ -688,9 +488,6 @@ theorem mersenne_coe_X (p : ℕ) : (mersenne p : X (q p)) = 0 :=
apply Nat.minFac_dvd
#align lucas_lehmer.mersenne_coe_X LucasLehmer.mersenne_coe_X
-/- warning: lucas_lehmer.ω_pow_eq_neg_one -> LucasLehmer.ω_pow_eq_neg_one is a dubious translation:
-<too large>
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.ω_pow_eq_neg_one LucasLehmer.ω_pow_eq_neg_oneₓ'. -/
theorem ω_pow_eq_neg_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 1) = -1 :=
by
@@ -699,9 +496,6 @@ theorem ω_pow_eq_neg_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
simpa using w
#align lucas_lehmer.ω_pow_eq_neg_one LucasLehmer.ω_pow_eq_neg_one
-/- warning: lucas_lehmer.ω_pow_eq_one -> LucasLehmer.ω_pow_eq_one is a dubious translation:
-<too large>
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.ω_pow_eq_one LucasLehmer.ω_pow_eq_oneₓ'. -/
theorem ω_pow_eq_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 2) = 1 :=
calc
@@ -711,12 +505,6 @@ theorem ω_pow_eq_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
#align lucas_lehmer.ω_pow_eq_one LucasLehmer.ω_pow_eq_one
-/- warning: lucas_lehmer.ω_unit -> LucasLehmer.ωUnit is a dubious translation:
-lean 3 declaration is
- forall (p : Nat), Units.{0} (LucasLehmer.X (LucasLehmer.q p)) (LucasLehmer.X.monoid (LucasLehmer.q p))
-but is expected to have type
- forall (p : Nat), Units.{0} (LucasLehmer.X (LucasLehmer.q p)) (LucasLehmer.X.instMonoidX (LucasLehmer.q p))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.ω_unit LucasLehmer.ωUnitₓ'. -/
/-- `ω` as an element of the group of units. -/
def ωUnit (p : ℕ) : Units (X (q p)) where
val := ω
@@ -732,9 +520,6 @@ theorem ωUnit_coe (p : ℕ) : (ωUnit p : X (q p)) = ω :=
#align lucas_lehmer.ω_unit_coe LucasLehmer.ωUnit_coe
-/
-/- warning: lucas_lehmer.order_ω -> LucasLehmer.order_ω is a dubious translation:
-<too large>
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.order_ω LucasLehmer.order_ωₓ'. -/
/-- The order of `ω` in the unit group is exactly `2^p`. -/
theorem order_ω (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
orderOf (ωUnit (p' + 2)) = 2 ^ (p' + 2) :=
@@ -757,12 +542,6 @@ theorem order_ω (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
exact ω_pow_eq_one p' h
#align lucas_lehmer.order_ω LucasLehmer.order_ω
-/- warning: lucas_lehmer.order_ineq -> LucasLehmer.order_ineq is a dubious translation:
-lean 3 declaration is
- forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (OfNat.mk.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (Zero.zero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (MulZeroClass.toHasZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (Ring.toNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))))))))))))) -> (LT.lt.{0} Nat Nat.hasLt (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))
-but is expected to have type
- forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) 0 (Zero.toOfNat0.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommMonoidWithZero.toZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toCommSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))))))) -> (LT.lt.{0} Nat instLTNat (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (PNat.val (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.order_ineq LucasLehmer.order_ineqₓ'. -/
theorem order_ineq (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
2 ^ (p' + 2) < (q (p' + 2) : ℕ) ^ 2 :=
calc
@@ -804,12 +583,6 @@ namespace LucasLehmer
open Tactic
-/- warning: lucas_lehmer.s_mod_succ -> LucasLehmer.sMod_succ is a dubious translation:
-lean 3 declaration is
- forall {p : Nat} {a : Int} {i : Nat} {b : Int} {c : Int}, (Eq.{1} Int (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.monoid)) (OfNat.ofNat.{0} Int 2 (OfNat.mk.{0} Int 2 (bit0.{0} Int Int.hasAdd (One.one.{0} Int Int.hasOne)))) p) (OfNat.ofNat.{0} Int 1 (OfNat.mk.{0} Int 1 (One.one.{0} Int Int.hasOne)))) a) -> (Eq.{1} Int (LucasLehmer.sMod p i) b) -> (Eq.{1} Int (HMod.hMod.{0, 0, 0} Int Int Int (instHMod.{0} Int Int.hasMod) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.hasMul) b b) (OfNat.ofNat.{0} Int 2 (OfNat.mk.{0} Int 2 (bit0.{0} Int Int.hasAdd (One.one.{0} Int Int.hasOne))))) a) c) -> (Eq.{1} Int (LucasLehmer.sMod p (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) i (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) c)
-but is expected to have type
- forall {p : Nat} {a : Int} {i : Nat} {b : Int} {c : Int}, (Eq.{1} Int (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.instMonoidInt)) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2)) p) (OfNat.ofNat.{0} Int 1 (instOfNatInt 1))) a) -> (Eq.{1} Int (LucasLehmer.sMod p i) b) -> (Eq.{1} Int (HMod.hMod.{0, 0, 0} Int Int Int (instHMod.{0} Int Int.instModInt_1) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.instMulInt) b b) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2))) a) c) -> (Eq.{1} Int (LucasLehmer.sMod p (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) i (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) c)
-Case conversion may be inaccurate. Consider using '#align lucas_lehmer.s_mod_succ LucasLehmer.sMod_succₓ'. -/
theorem sMod_succ {p a i b c} (h1 : (2 ^ p - 1 : ℤ) = a) (h2 : sMod p i = b)
(h3 : (b * b - 2) % a = c) : sMod p (i + 1) = c := by dsimp [s_mod, mersenne];
rw [h1, h2, sq, h3]
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -131,8 +131,7 @@ theorem sMod_nonneg (p : ℕ) (w : 0 < p) (i : ℕ) : 0 ≤ sMod p i :=
by
cases i <;> dsimp [s_mod]
· exact sup_eq_right.mp rfl
- · apply Int.emod_nonneg
- exact mersenne_int_ne_zero p w
+ · apply Int.emod_nonneg; exact mersenne_int_ne_zero p w
#align lucas_lehmer.s_mod_nonneg LucasLehmer.sMod_nonneg
-/
@@ -170,8 +169,7 @@ Case conversion may be inaccurate. Consider using '#align lucas_lehmer.s_zmod_eq
theorem sZMod_eq_s (p' : ℕ) (i : ℕ) : sZMod (p' + 2) i = (s i : ZMod (2 ^ (p' + 2) - 1)) :=
by
induction' i with i ih
- · dsimp [s, s_zmod]
- norm_num
+ · dsimp [s, s_zmod]; norm_num
· push_cast [s, s_zmod, ih]
#align lucas_lehmer.s_zmod_eq_s LucasLehmer.sZMod_eq_s
@@ -234,9 +232,7 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
apply Int.eq_zero_of_dvd_of_nonneg_of_lt _ _ h <;> clear h
apply s_mod_nonneg _ (Nat.lt_of_succ_lt w)
exact s_mod_lt _ (Nat.lt_of_succ_lt w) (p - 2)
- · intro h
- rw [h]
- simp
+ · intro h; rw [h]; simp
#align lucas_lehmer.residue_eq_zero_iff_s_mod_eq_zero LucasLehmer.residue_eq_zero_iff_sMod_eq_zero
#print LucasLehmer.LucasLehmerTest /-
@@ -413,22 +409,14 @@ but is expected to have type
forall {q : Type.{u}} {x : Type.{v}}, (Nat -> q -> x) -> Nat -> (List.{u} q) -> (List.{v} x)
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.bit1_snd [anonymous]ₓ'. -/
@[simp]
-theorem [anonymous] (x : X q) : (bit1 x).2 = bit0 x.2 :=
- by
- dsimp [bit1]
- simp
+theorem [anonymous] (x : X q) : (bit1 x).2 = bit0 x.2 := by dsimp [bit1]; simp
#align lucas_lehmer.X.bit1_snd [anonymous]
instance : Monoid (X q) :=
{
(inferInstance :
- Mul
- (X
- q)) with
- mul_assoc := fun x y z => by
- ext <;>
- · dsimp
- ring
+ Mul (X q)) with
+ mul_assoc := fun x y z => by ext <;> · dsimp; ring
one := ⟨1, 0⟩
one_mul := fun x => by ext <;> simp
mul_one := fun x => by ext <;> simp }
@@ -448,10 +436,7 @@ lean 3 declaration is
but is expected to have type
forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q) (z : LucasLehmer.X q), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddGroupWithOneX q)))))) y z)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddGroupWithOneX q)))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x y) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x z))
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.left_distrib LucasLehmer.X.left_distribₓ'. -/
-theorem left_distrib (x y z : X q) : x * (y + z) = x * y + x * z := by
- ext <;>
- · dsimp
- ring
+theorem left_distrib (x y z : X q) : x * (y + z) = x * y + x * z := by ext <;> · dsimp; ring
#align lucas_lehmer.X.left_distrib LucasLehmer.X.left_distrib
/- warning: lucas_lehmer.X.right_distrib -> LucasLehmer.X.right_distrib is a dubious translation:
@@ -460,10 +445,7 @@ lean 3 declaration is
but is expected to have type
forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q) (z : LucasLehmer.X q), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddGroupWithOneX q)))))) x y) z) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddGroupWithOneX q)))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x z) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) y z))
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.right_distrib LucasLehmer.X.right_distribₓ'. -/
-theorem right_distrib (x y z : X q) : (x + y) * z = x * z + y * z := by
- ext <;>
- · dsimp
- ring
+theorem right_distrib (x y z : X q) : (x + y) * z = x * z + y * z := by ext <;> · dsimp; ring
#align lucas_lehmer.X.right_distrib LucasLehmer.X.right_distrib
instance : Ring (X q) :=
@@ -473,16 +455,10 @@ instance : Ring (X q) :=
right_distrib := right_distrib }
instance : CommRing (X q) :=
- { (inferInstance : Ring (X q)) with
- mul_comm := fun x y => by
- ext <;>
- · dsimp
- ring }
+ { (inferInstance : Ring (X q)) with mul_comm := fun x y => by ext <;> · dsimp; ring }
instance [Fact (1 < (q : ℕ))] : Nontrivial (X q) :=
- ⟨⟨0, 1, fun h => by
- injection h with h1 _
- exact zero_ne_one h1⟩⟩
+ ⟨⟨0, 1, fun h => by injection h with h1 _; exact zero_ne_one h1⟩⟩
/- warning: lucas_lehmer.X.nat_coe_fst -> LucasLehmer.X.nat_coe_fst is a dubious translation:
lean 3 declaration is
@@ -656,9 +632,7 @@ theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
simp at H
interval_cases; clear H
· -- If q = 1, we get a contradiction from 2^p = 2
- dsimp [q] at h
- injection h with h'
- clear h
+ dsimp [q] at h; injection h with h'; clear h
simp [mersenne] at h'
exact
lt_irrefl 2
@@ -668,9 +642,7 @@ theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
_ = 2 := Nat.pred_inj (Nat.one_le_two_pow _) (by decide) h'
)
· -- If q = 2, we get a contradiction from 2 ∣ 2^p - 1
- dsimp [q] at h
- injection h with h'
- clear h
+ dsimp [q] at h; injection h with h'; clear h
rw [mersenne, PNat.one_coe, Nat.minFac_eq_two_iff, pow_succ] at h'
exact Nat.two_not_dvd_two_mul_sub_one (Nat.one_le_two_pow _) h'
#align lucas_lehmer.two_lt_q LucasLehmer.two_lt_q
@@ -839,9 +811,7 @@ but is expected to have type
forall {p : Nat} {a : Int} {i : Nat} {b : Int} {c : Int}, (Eq.{1} Int (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.instMonoidInt)) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2)) p) (OfNat.ofNat.{0} Int 1 (instOfNatInt 1))) a) -> (Eq.{1} Int (LucasLehmer.sMod p i) b) -> (Eq.{1} Int (HMod.hMod.{0, 0, 0} Int Int Int (instHMod.{0} Int Int.instModInt_1) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.instMulInt) b b) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2))) a) c) -> (Eq.{1} Int (LucasLehmer.sMod p (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) i (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) c)
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.s_mod_succ LucasLehmer.sMod_succₓ'. -/
theorem sMod_succ {p a i b c} (h1 : (2 ^ p - 1 : ℤ) = a) (h2 : sMod p i = b)
- (h3 : (b * b - 2) % a = c) : sMod p (i + 1) = c :=
- by
- dsimp [s_mod, mersenne]
+ (h3 : (b * b - 2) % a = c) : sMod p (i + 1) = c := by dsimp [s_mod, mersenne];
rw [h1, h2, sq, h3]
#align lucas_lehmer.s_mod_succ LucasLehmer.sMod_succ
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -327,10 +327,7 @@ theorem neg_snd (x : X q) : (-x).2 = -x.2 :=
instance : Mul (X q) where mul x y := (x.1 * y.1 + 3 * x.2 * y.2, x.1 * y.2 + x.2 * y.1)
/- warning: lucas_lehmer.X.mul_fst -> LucasLehmer.X.mul_fst is a dubious translation:
-lean 3 declaration is
- forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (HMul.hMul.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y)) (HMul.hMul.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (HMul.hMul.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (OfNat.ofNat.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 3 (OfNat.mk.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 3 (bit1.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))))) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))) (One.one.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))))))))) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y)))
-but is expected to have type
- forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHAdd.{0} (ZMod (PNat.val q)) (Distrib.toAdd.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocSemiring.toDistrib.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))))) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y)) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 3 (instOfNat.{0} (ZMod (PNat.val q)) 3 (Semiring.toNatCast.{0} (ZMod (PNat.val q)) (CommSemiring.toSemiring.{0} (ZMod (PNat.val q)) (CommRing.toCommSemiring.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))) (instAtLeastTwoHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y)))
+<too large>
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.mul_fst LucasLehmer.X.mul_fstₓ'. -/
@[simp]
theorem mul_fst (x y : X q) : (x * y).1 = x.1 * y.1 + 3 * x.2 * y.2 :=
@@ -679,10 +676,7 @@ theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
#align lucas_lehmer.two_lt_q LucasLehmer.two_lt_q
/- warning: lucas_lehmer.ω_pow_formula -> LucasLehmer.ω_pow_formula is a dubious translation:
-lean 3 declaration is
- forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (OfNat.mk.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (Zero.zero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (MulZeroClass.toHasZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (Ring.toNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))))))))))))) -> (Exists.{1} Int (fun (k : Int) => Eq.{1} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))))) (HSub.hSub.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHSub.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (SubNegMonoid.toHasSub.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddGroupWithOne.toAddGroup.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.addGroupWithOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHMul.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.hasMul (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHMul.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.hasMul (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (Int.castCoe.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.addGroupWithOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))))) k) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HasLiftT.mk.{1, 1} Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (CoeTCₓ.coe.{1, 1} Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (Nat.castCoe.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddMonoidWithOne.toNatCast.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.addGroupWithOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))))))) (mersenne (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p'))) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) 1 (OfNat.mk.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) 1 (One.one.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.X.hasOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))))))
-but is expected to have type
- forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) 0 (Zero.toOfNat0.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommMonoidWithZero.toZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toCommSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))))))) -> (Exists.{1} Int (fun (k : Int) => Eq.{1} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (HSub.hSub.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHSub.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (Ring.toSub.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instRingX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHMul.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMulX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHMul.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMulX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (Int.cast.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (Ring.toIntCast.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instRingX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) k) (Nat.cast.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instNatCastX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (mersenne (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p'))) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) 1 (One.toOfNat1.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instOneX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))))))
+<too large>
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.ω_pow_formula LucasLehmer.ω_pow_formulaₓ'. -/
theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
∃ k : ℤ,
@@ -723,10 +717,7 @@ theorem mersenne_coe_X (p : ℕ) : (mersenne p : X (q p)) = 0 :=
#align lucas_lehmer.mersenne_coe_X LucasLehmer.mersenne_coe_X
/- warning: lucas_lehmer.ω_pow_eq_neg_one -> LucasLehmer.ω_pow_eq_neg_one is a dubious translation:
-lean 3 declaration is
- forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (OfNat.mk.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (Zero.zero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (MulZeroClass.toHasZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (Ring.toNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))))))))))))) -> (Eq.{1} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))))) (Neg.neg.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (SubNegMonoid.toHasNeg.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddGroupWithOne.toAddGroup.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.addGroupWithOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))))) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) 1 (OfNat.mk.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) 1 (One.one.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.X.hasOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))))
-but is expected to have type
- forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) 0 (Zero.toOfNat0.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommMonoidWithZero.toZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toCommSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))))))) -> (Eq.{1} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (Neg.neg.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (Ring.toNeg.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instRingX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) 1 (One.toOfNat1.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instOneX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))))))
+<too large>
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.ω_pow_eq_neg_one LucasLehmer.ω_pow_eq_neg_oneₓ'. -/
theorem ω_pow_eq_neg_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 1) = -1 :=
@@ -737,10 +728,7 @@ theorem ω_pow_eq_neg_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
#align lucas_lehmer.ω_pow_eq_neg_one LucasLehmer.ω_pow_eq_neg_one
/- warning: lucas_lehmer.ω_pow_eq_one -> LucasLehmer.ω_pow_eq_one is a dubious translation:
-lean 3 declaration is
- forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (OfNat.mk.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (Zero.zero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (MulZeroClass.toHasZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (Ring.toNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))))))))))))) -> (Eq.{1} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) 1 (OfNat.mk.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) 1 (One.one.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.X.hasOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))))
-but is expected to have type
- forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) 0 (Zero.toOfNat0.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommMonoidWithZero.toZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toCommSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))))))) -> (Eq.{1} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) 1 (One.toOfNat1.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instOneX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))))
+<too large>
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.ω_pow_eq_one LucasLehmer.ω_pow_eq_oneₓ'. -/
theorem ω_pow_eq_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 2) = 1 :=
@@ -773,10 +761,7 @@ theorem ωUnit_coe (p : ℕ) : (ωUnit p : X (q p)) = ω :=
-/
/- warning: lucas_lehmer.order_ω -> LucasLehmer.order_ω is a dubious translation:
-lean 3 declaration is
- forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (OfNat.mk.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (Zero.zero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (MulZeroClass.toHasZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (Ring.toNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))))))))))))) -> (Eq.{1} Nat (orderOf.{0} (Units.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))) (DivInvMonoid.toMonoid.{0} (Units.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))) (Group.toDivInvMonoid.{0} (Units.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))) (Units.group.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))))) (LucasLehmer.ωUnit (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))
-but is expected to have type
- forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) 0 (Zero.toOfNat0.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommMonoidWithZero.toZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toCommSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))))))) -> (Eq.{1} Nat (orderOf.{0} (Units.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (DivInvMonoid.toMonoid.{0} (Units.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (Group.toDivInvMonoid.{0} (Units.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (Units.instGroupUnits.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))))) (LucasLehmer.ωUnit (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))
+<too large>
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.order_ω LucasLehmer.order_ωₓ'. -/
/-- The order of `ω` in the unit group is exactly `2^p`. -/
theorem order_ω (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
mathlib commit https://github.com/leanprover-community/mathlib/commit/0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
@@ -563,7 +563,7 @@ theorem card_eq : Fintype.card (X q) = q ^ 2 :=
/- warning: lucas_lehmer.X.units_card -> LucasLehmer.X.card_units_lt is a dubious translation:
lean 3 declaration is
- forall {q : PNat}, (LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 1 (OfNat.mk.{0} PNat 1 (One.one.{0} PNat PNat.hasOne))) q) -> (LT.lt.{0} Nat Nat.hasLt (Fintype.card.{0} (Units.{0} (LucasLehmer.X q) (LucasLehmer.X.monoid q)) (Units.fintype.{0} (LucasLehmer.X q) (LucasLehmer.X.monoid q) (LucasLehmer.X.fintype q) (fun (a : LucasLehmer.X q) (b : LucasLehmer.X q) => LucasLehmer.X.decidableEq q a b))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))
+ forall {q : PNat}, (LT.lt.{0} PNat (Preorder.toHasLt.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 1 (OfNat.mk.{0} PNat 1 (One.one.{0} PNat PNat.hasOne))) q) -> (LT.lt.{0} Nat Nat.hasLt (Fintype.card.{0} (Units.{0} (LucasLehmer.X q) (LucasLehmer.X.monoid q)) (Units.fintype.{0} (LucasLehmer.X q) (LucasLehmer.X.monoid q) (LucasLehmer.X.fintype q) (fun (a : LucasLehmer.X q) (b : LucasLehmer.X q) => LucasLehmer.X.decidableEq q a b))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))
but is expected to have type
forall {q : PNat}, (LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 1 (instOfNatPNatHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)))) q) -> (LT.lt.{0} Nat instLTNat (Fintype.card.{0} (Units.{0} (LucasLehmer.X q) (LucasLehmer.X.instMonoidX q)) (instFintypeUnits.{0} (LucasLehmer.X q) (LucasLehmer.X.instMonoidX q) (LucasLehmer.X.instFintypeX q) (fun (a : LucasLehmer.X q) (b : LucasLehmer.X q) => LucasLehmer.X.instDecidableEqX q a b))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (PNat.val q) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.units_card LucasLehmer.X.card_units_ltₓ'. -/
@@ -648,7 +648,7 @@ Here and below, we introduce `p' = p - 2`, in order to avoid using subtraction i
/- warning: lucas_lehmer.two_lt_q -> LucasLehmer.two_lt_q is a dubious translation:
lean 3 declaration is
- forall (p' : Nat), LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 2 (OfNat.mk.{0} PNat 2 (bit0.{0} PNat PNat.hasAdd (One.one.{0} PNat PNat.hasOne)))) (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))
+ forall (p' : Nat), LT.lt.{0} PNat (Preorder.toHasLt.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 2 (OfNat.mk.{0} PNat 2 (bit0.{0} PNat PNat.hasAdd (One.one.{0} PNat PNat.hasOne)))) (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))
but is expected to have type
forall (p' : Nat), LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 2 (instOfNatPNatHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.two_lt_q LucasLehmer.two_lt_qₓ'. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/08e1d8d4d989df3a6df86f385e9053ec8a372cc1
@@ -330,7 +330,7 @@ instance : Mul (X q) where mul x y := (x.1 * y.1 + 3 * x.2 * y.2, x.1 * y.2 + x.
lean 3 declaration is
forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (HMul.hMul.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y)) (HMul.hMul.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (HMul.hMul.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (OfNat.ofNat.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 3 (OfNat.mk.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 3 (bit1.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))))) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))) (One.one.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))))))))) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y)))
but is expected to have type
- forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHAdd.{0} (ZMod (PNat.val q)) (Distrib.toAdd.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocSemiring.toDistrib.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))))) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y)) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 3 (instOfNat.{0} (ZMod (PNat.val q)) 3 (NonAssocRing.toNatCast.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))) (instAtLeastTwoHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y)))
+ forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHAdd.{0} (ZMod (PNat.val q)) (Distrib.toAdd.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocSemiring.toDistrib.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))))) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y)) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 3 (instOfNat.{0} (ZMod (PNat.val q)) 3 (Semiring.toNatCast.{0} (ZMod (PNat.val q)) (CommSemiring.toSemiring.{0} (ZMod (PNat.val q)) (CommRing.toCommSemiring.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))) (instAtLeastTwoHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y)))
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.mul_fst LucasLehmer.X.mul_fstₓ'. -/
@[simp]
theorem mul_fst (x y : X q) : (x * y).1 = x.1 * y.1 + 3 * x.2 * y.2 :=
@@ -354,7 +354,7 @@ instance : One (X q) where one := ⟨1, 0⟩
lean 3 declaration is
forall {q : PNat}, Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (OfNat.mk.{0} (LucasLehmer.X q) 1 (One.one.{0} (LucasLehmer.X q) (LucasLehmer.X.hasOne q))))) (OfNat.ofNat.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 1 (OfNat.mk.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 1 (One.one.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))))))))
but is expected to have type
- forall {q : PNat}, Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (One.toOfNat1.{0} (LucasLehmer.X q) (LucasLehmer.X.instOneX q)))) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 1 (One.toOfNat1.{0} (ZMod (PNat.val q)) (NonAssocRing.toOne.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))))))
+ forall {q : PNat}, Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (One.toOfNat1.{0} (LucasLehmer.X q) (LucasLehmer.X.instOneX q)))) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 1 (One.toOfNat1.{0} (ZMod (PNat.val q)) (Semiring.toOne.{0} (ZMod (PNat.val q)) (CommSemiring.toSemiring.{0} (ZMod (PNat.val q)) (CommRing.toCommSemiring.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))))))
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.one_fst LucasLehmer.X.one_fstₓ'. -/
@[simp]
theorem one_fst : (1 : X q).1 = 1 :=
@@ -491,7 +491,7 @@ instance [Fact (1 < (q : ℕ))] : Nontrivial (X q) :=
lean 3 declaration is
forall {q : PNat} (n : Nat), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Nat (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Nat (LucasLehmer.X q) (Nat.castCoe.{0} (LucasLehmer.X q) (AddMonoidWithOne.toNatCast.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) n)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HasLiftT.mk.{1, 1} Nat (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CoeTCₓ.coe.{1, 1} Nat (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Nat.castCoe.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toNatCast.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))))))) n)
but is expected to have type
- forall {q : PNat} (n : Nat), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Nat.cast.{0} (LucasLehmer.X q) (LucasLehmer.X.instNatCastX q) n)) (Nat.cast.{0} (ZMod (PNat.val q)) (NonAssocRing.toNatCast.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))) n)
+ forall {q : PNat} (n : Nat), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Nat.cast.{0} (LucasLehmer.X q) (LucasLehmer.X.instNatCastX q) n)) (Nat.cast.{0} (ZMod (PNat.val q)) (Semiring.toNatCast.{0} (ZMod (PNat.val q)) (CommSemiring.toSemiring.{0} (ZMod (PNat.val q)) (CommRing.toCommSemiring.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))) n)
Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.nat_coe_fst LucasLehmer.X.nat_coe_fstₓ'. -/
@[simp]
theorem nat_coe_fst (n : ℕ) : (n : X q).fst = (n : ZMod q) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/cd8fafa2fac98e1a67097e8a91ad9901cfde48af
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Scott Morrison, Ainsley Pahljina
! This file was ported from Lean 3 source module number_theory.lucas_lehmer
-! leanprover-community/mathlib commit 10b4e499f43088dd3bb7b5796184ad5216648ab1
+! leanprover-community/mathlib commit ce38d86c0b2d427ce208c3cee3159cb421d2b3c4
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -19,6 +19,9 @@ import Mathbin.Tactic.RingExp
/-!
# The Lucas-Lehmer test for Mersenne primes.
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
We define `lucas_lehmer_residue : Π p : ℕ, zmod (2^p - 1)`, and
prove `lucas_lehmer_residue p = 0 → prime (mersenne p)`.
mathlib commit https://github.com/leanprover-community/mathlib/commit/0e2aab2b0d521f060f62a14d2cf2e2c54e8491d6
@@ -44,11 +44,14 @@ The tactic for certified computation of Lucas-Lehmer residues was provided by Ma
-/
+#print mersenne /-
/-- The Mersenne numbers, 2^p - 1. -/
def mersenne (p : ℕ) : ℕ :=
2 ^ p - 1
#align mersenne mersenne
+-/
+#print mersenne_pos /-
theorem mersenne_pos {p : ℕ} (h : 0 < p) : 0 < mersenne p :=
by
dsimp [mersenne]
@@ -57,13 +60,16 @@ theorem mersenne_pos {p : ℕ} (h : 0 < p) : 0 < mersenne p :=
_ ≤ 2 ^ p - 1 := Nat.pred_le_pred (Nat.pow_le_pow_of_le_right (Nat.succ_pos 1) h)
#align mersenne_pos mersenne_pos
+-/
+#print succ_mersenne /-
@[simp]
theorem succ_mersenne (k : ℕ) : mersenne k + 1 = 2 ^ k :=
by
rw [mersenne, tsub_add_cancel_of_le]
exact one_le_pow_of_one_le (by norm_num) k
#align succ_mersenne succ_mersenne
+-/
namespace LucasLehmer
@@ -81,30 +87,43 @@ so we take a moment setting up the lemmas relating them.
-/
+#print LucasLehmer.s /-
/-- The recurrence `s (i+1) = (s i)^2 - 2` in `ℤ`. -/
def s : ℕ → ℤ
| 0 => 4
| i + 1 => s i ^ 2 - 2
#align lucas_lehmer.s LucasLehmer.s
+-/
+#print LucasLehmer.sZMod /-
/-- The recurrence `s (i+1) = (s i)^2 - 2` in `zmod (2^p - 1)`. -/
-def sZmod (p : ℕ) : ℕ → ZMod (2 ^ p - 1)
+def sZMod (p : ℕ) : ℕ → ZMod (2 ^ p - 1)
| 0 => 4
| i + 1 => s_zmod i ^ 2 - 2
-#align lucas_lehmer.s_zmod LucasLehmer.sZmod
+#align lucas_lehmer.s_zmod LucasLehmer.sZMod
+-/
+#print LucasLehmer.sMod /-
/-- The recurrence `s (i+1) = ((s i)^2 - 2) % (2^p - 1)` in `ℤ`. -/
def sMod (p : ℕ) : ℕ → ℤ
| 0 => 4 % (2 ^ p - 1)
| i + 1 => (s_mod i ^ 2 - 2) % (2 ^ p - 1)
#align lucas_lehmer.s_mod LucasLehmer.sMod
+-/
+/- warning: lucas_lehmer.mersenne_int_ne_zero -> LucasLehmer.mersenne_int_ne_zero is a dubious translation:
+lean 3 declaration is
+ forall (p : Nat), (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) p) -> (Ne.{1} Int (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.monoid)) (OfNat.ofNat.{0} Int 2 (OfNat.mk.{0} Int 2 (bit0.{0} Int Int.hasAdd (One.one.{0} Int Int.hasOne)))) p) (OfNat.ofNat.{0} Int 1 (OfNat.mk.{0} Int 1 (One.one.{0} Int Int.hasOne)))) (OfNat.ofNat.{0} Int 0 (OfNat.mk.{0} Int 0 (Zero.zero.{0} Int Int.hasZero))))
+but is expected to have type
+ forall (p : Nat), (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) p) -> (Ne.{1} Int (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.instMonoidInt)) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2)) p) (OfNat.ofNat.{0} Int 1 (instOfNatInt 1))) (OfNat.ofNat.{0} Int 0 (instOfNatInt 0)))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.mersenne_int_ne_zero LucasLehmer.mersenne_int_ne_zeroₓ'. -/
theorem mersenne_int_ne_zero (p : ℕ) (w : 0 < p) : (2 ^ p - 1 : ℤ) ≠ 0 :=
by
apply ne_of_gt; simp only [gt_iff_lt, sub_pos]
exact_mod_cast Nat.one_lt_two_pow p w
#align lucas_lehmer.mersenne_int_ne_zero LucasLehmer.mersenne_int_ne_zero
+#print LucasLehmer.sMod_nonneg /-
theorem sMod_nonneg (p : ℕ) (w : 0 < p) (i : ℕ) : 0 ≤ sMod p i :=
by
cases i <;> dsimp [s_mod]
@@ -112,10 +131,23 @@ theorem sMod_nonneg (p : ℕ) (w : 0 < p) (i : ℕ) : 0 ≤ sMod p i :=
· apply Int.emod_nonneg
exact mersenne_int_ne_zero p w
#align lucas_lehmer.s_mod_nonneg LucasLehmer.sMod_nonneg
+-/
+/- warning: lucas_lehmer.s_mod_mod -> LucasLehmer.sMod_mod is a dubious translation:
+lean 3 declaration is
+ forall (p : Nat) (i : Nat), Eq.{1} Int (HMod.hMod.{0, 0, 0} Int Int Int (instHMod.{0} Int Int.hasMod) (LucasLehmer.sMod p i) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.monoid)) (OfNat.ofNat.{0} Int 2 (OfNat.mk.{0} Int 2 (bit0.{0} Int Int.hasAdd (One.one.{0} Int Int.hasOne)))) p) (OfNat.ofNat.{0} Int 1 (OfNat.mk.{0} Int 1 (One.one.{0} Int Int.hasOne))))) (LucasLehmer.sMod p i)
+but is expected to have type
+ forall (p : Nat) (i : Nat), Eq.{1} Int (HMod.hMod.{0, 0, 0} Int Int Int (instHMod.{0} Int Int.instModInt_1) (LucasLehmer.sMod p i) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.instMonoidInt)) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2)) p) (OfNat.ofNat.{0} Int 1 (instOfNatInt 1)))) (LucasLehmer.sMod p i)
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.s_mod_mod LucasLehmer.sMod_modₓ'. -/
theorem sMod_mod (p i : ℕ) : sMod p i % (2 ^ p - 1) = sMod p i := by cases i <;> simp [s_mod]
#align lucas_lehmer.s_mod_mod LucasLehmer.sMod_mod
+/- warning: lucas_lehmer.s_mod_lt -> LucasLehmer.sMod_lt is a dubious translation:
+lean 3 declaration is
+ forall (p : Nat), (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) p) -> (forall (i : Nat), LT.lt.{0} Int Int.hasLt (LucasLehmer.sMod p i) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.monoid)) (OfNat.ofNat.{0} Int 2 (OfNat.mk.{0} Int 2 (bit0.{0} Int Int.hasAdd (One.one.{0} Int Int.hasOne)))) p) (OfNat.ofNat.{0} Int 1 (OfNat.mk.{0} Int 1 (One.one.{0} Int Int.hasOne)))))
+but is expected to have type
+ forall (p : Nat), (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) p) -> (forall (i : Nat), LT.lt.{0} Int Int.instLTInt (LucasLehmer.sMod p i) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.instMonoidInt)) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2)) p) (OfNat.ofNat.{0} Int 1 (instOfNatInt 1))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.s_mod_lt LucasLehmer.sMod_ltₓ'. -/
theorem sMod_lt (p : ℕ) (w : 0 < p) (i : ℕ) : sMod p i < 2 ^ p - 1 :=
by
rw [← s_mod_mod]
@@ -126,14 +158,26 @@ theorem sMod_lt (p : ℕ) (w : 0 < p) (i : ℕ) : sMod p i < 2 ^ p - 1 :=
· exact mersenne_int_ne_zero p w
#align lucas_lehmer.s_mod_lt LucasLehmer.sMod_lt
-theorem sZmod_eq_s (p' : ℕ) (i : ℕ) : sZmod (p' + 2) i = (s i : ZMod (2 ^ (p' + 2) - 1)) :=
+/- warning: lucas_lehmer.s_zmod_eq_s -> LucasLehmer.sZMod_eq_s is a dubious translation:
+lean 3 declaration is
+ forall (p' : Nat) (i : Nat), Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.sZMod (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) i) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (HasLiftT.mk.{1, 1} Int (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (CoeTCₓ.coe.{1, 1} Int (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (Int.castCoe.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (AddGroupWithOne.toHasIntCast.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (Ring.toAddCommGroupWithOne.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))))))))))) (LucasLehmer.s i))
+but is expected to have type
+ forall (p' : Nat) (i : Nat), Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.sZMod (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))) i) (Int.cast.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (Ring.toIntCast.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))) (LucasLehmer.s i))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.s_zmod_eq_s LucasLehmer.sZMod_eq_sₓ'. -/
+theorem sZMod_eq_s (p' : ℕ) (i : ℕ) : sZMod (p' + 2) i = (s i : ZMod (2 ^ (p' + 2) - 1)) :=
by
induction' i with i ih
· dsimp [s, s_zmod]
norm_num
· push_cast [s, s_zmod, ih]
-#align lucas_lehmer.s_zmod_eq_s LucasLehmer.sZmod_eq_s
-
+#align lucas_lehmer.s_zmod_eq_s LucasLehmer.sZMod_eq_s
+
+/- warning: lucas_lehmer.int.coe_nat_pow_pred -> LucasLehmer.Int.coe_nat_pow_pred is a dubious translation:
+lean 3 declaration is
+ forall (b : Nat) (p : Nat), (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) b) -> (Eq.{1} Int ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) b p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) b) p) (OfNat.ofNat.{0} Int 1 (OfNat.mk.{0} Int 1 (One.one.{0} Int Int.hasOne)))))
+but is expected to have type
+ forall (b : Nat) (p : Nat), (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) b) -> (Eq.{1} Int (Nat.cast.{0} Int instNatCastInt (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) b p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HPow.hPow.{0, 0, 0} Int Nat Int Int.instHPowIntNat (Nat.cast.{0} Int instNatCastInt b) p) (OfNat.ofNat.{0} Int 1 (instOfNatInt 1))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.int.coe_nat_pow_pred LucasLehmer.Int.coe_nat_pow_predₓ'. -/
-- These next two don't make good `norm_cast` lemmas.
theorem Int.coe_nat_pow_pred (b p : ℕ) (w : 0 < b) : ((b ^ p - 1 : ℕ) : ℤ) = (b ^ p - 1 : ℤ) :=
by
@@ -141,19 +185,39 @@ theorem Int.coe_nat_pow_pred (b p : ℕ) (w : 0 < b) : ((b ^ p - 1 : ℕ) : ℤ)
norm_cast
#align lucas_lehmer.int.coe_nat_pow_pred LucasLehmer.Int.coe_nat_pow_pred
+/- warning: lucas_lehmer.int.coe_nat_two_pow_pred -> LucasLehmer.Int.coe_nat_two_pow_pred is a dubious translation:
+lean 3 declaration is
+ forall (p : Nat), Eq.{1} Int ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.monoid)) (OfNat.ofNat.{0} Int 2 (OfNat.mk.{0} Int 2 (bit0.{0} Int Int.hasAdd (One.one.{0} Int Int.hasOne)))) p) (OfNat.ofNat.{0} Int 1 (OfNat.mk.{0} Int 1 (One.one.{0} Int Int.hasOne))))
+but is expected to have type
+ forall (p : Nat), Eq.{1} Int (Nat.cast.{0} Int instNatCastInt (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.instMonoidInt)) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2)) p) (OfNat.ofNat.{0} Int 1 (instOfNatInt 1)))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.int.coe_nat_two_pow_pred LucasLehmer.Int.coe_nat_two_pow_predₓ'. -/
theorem Int.coe_nat_two_pow_pred (p : ℕ) : ((2 ^ p - 1 : ℕ) : ℤ) = (2 ^ p - 1 : ℤ) :=
Int.coe_nat_pow_pred 2 p (by decide)
#align lucas_lehmer.int.coe_nat_two_pow_pred LucasLehmer.Int.coe_nat_two_pow_pred
-theorem sZmod_eq_sMod (p : ℕ) (i : ℕ) : sZmod p i = (sMod p i : ZMod (2 ^ p - 1)) := by
+/- warning: lucas_lehmer.s_zmod_eq_s_mod -> LucasLehmer.sZMod_eq_sMod is a dubious translation:
+lean 3 declaration is
+ forall (p : Nat) (i : Nat), Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.sZMod p i) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (HasLiftT.mk.{1, 1} Int (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (CoeTCₓ.coe.{1, 1} Int (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (Int.castCoe.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (AddGroupWithOne.toHasIntCast.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (Ring.toAddCommGroupWithOne.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))))))))))) (LucasLehmer.sMod p i))
+but is expected to have type
+ forall (p : Nat) (i : Nat), Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.sZMod p i) (Int.cast.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (Ring.toIntCast.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))) (LucasLehmer.sMod p i))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.s_zmod_eq_s_mod LucasLehmer.sZMod_eq_sModₓ'. -/
+theorem sZMod_eq_sMod (p : ℕ) (i : ℕ) : sZMod p i = (sMod p i : ZMod (2 ^ p - 1)) := by
induction i <;> push_cast [← int.coe_nat_two_pow_pred p, s_mod, s_zmod, *]
-#align lucas_lehmer.s_zmod_eq_s_mod LucasLehmer.sZmod_eq_sMod
+#align lucas_lehmer.s_zmod_eq_s_mod LucasLehmer.sZMod_eq_sMod
+#print LucasLehmer.lucasLehmerResidue /-
/-- The Lucas-Lehmer residue is `s p (p-2)` in `zmod (2^p - 1)`. -/
def lucasLehmerResidue (p : ℕ) : ZMod (2 ^ p - 1) :=
- sZmod p (p - 2)
+ sZMod p (p - 2)
#align lucas_lehmer.lucas_lehmer_residue LucasLehmer.lucasLehmerResidue
+-/
+/- warning: lucas_lehmer.residue_eq_zero_iff_s_mod_eq_zero -> LucasLehmer.residue_eq_zero_iff_sMod_eq_zero is a dubious translation:
+lean 3 declaration is
+ forall (p : Nat), (LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))) p) -> (Iff (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.lucasLehmerResidue p) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) 0 (OfNat.mk.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) 0 (Zero.zero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (MulZeroClass.toHasZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (Ring.toNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) p) (One.one.{0} Nat Nat.hasOne))))))))))))) (Eq.{1} Int (LucasLehmer.sMod p (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) p (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Int 0 (OfNat.mk.{0} Int 0 (Zero.zero.{0} Int Int.hasZero)))))
+but is expected to have type
+ forall (p : Nat), (LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)) p) -> (Iff (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.lucasLehmerResidue p) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) 0 (Zero.toOfNat0.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommMonoidWithZero.toZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toCommSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))))))) (Eq.{1} Int (LucasLehmer.sMod p (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) p (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Int 0 (instOfNatInt 0))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.residue_eq_zero_iff_s_mod_eq_zero LucasLehmer.residue_eq_zero_iff_sMod_eq_zeroₓ'. -/
theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
lucasLehmerResidue p = 0 ↔ sMod p (p - 2) = 0 :=
by
@@ -172,18 +236,23 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
simp
#align lucas_lehmer.residue_eq_zero_iff_s_mod_eq_zero LucasLehmer.residue_eq_zero_iff_sMod_eq_zero
+#print LucasLehmer.LucasLehmerTest /-
/-- A Mersenne number `2^p-1` is prime if and only if
the Lucas-Lehmer residue `s p (p-2) % (2^p - 1)` is zero.
-/
def LucasLehmerTest (p : ℕ) : Prop :=
lucasLehmerResidue p = 0deriving DecidablePred
#align lucas_lehmer.lucas_lehmer_test LucasLehmer.LucasLehmerTest
+-/
+#print LucasLehmer.q /-
/-- `q` is defined as the minimum factor of `mersenne p`, bundled as an `ℕ+`. -/
def q (p : ℕ) : ℕ+ :=
⟨Nat.minFac (mersenne p), Nat.minFac_pos (mersenne p)⟩
#align lucas_lehmer.q LucasLehmer.q
+-/
+#print LucasLehmer.X /-
-- It would be nice to define this as (ℤ/qℤ)[x] / (x^2 - 3),
-- obtaining the ring structure for free,
-- but that seems to be more trouble than it's worth;
@@ -193,33 +262,60 @@ def q (p : ℕ) : ℕ+ :=
def X (q : ℕ+) : Type :=
ZMod q × ZMod q deriving AddCommGroup, DecidableEq, Fintype, Inhabited
#align lucas_lehmer.X LucasLehmer.X
+-/
namespace X
variable {q : ℕ+}
+#print LucasLehmer.X.ext /-
@[ext]
theorem ext {x y : X q} (h₁ : x.1 = y.1) (h₂ : x.2 = y.2) : x = y :=
by
cases x; cases y
congr <;> assumption
#align lucas_lehmer.X.ext LucasLehmer.X.ext
+-/
+/- warning: lucas_lehmer.X.add_fst -> LucasLehmer.X.add_fst is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q))))))) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y))
+but is expected to have type
+ forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddCommGroupX q))))))) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHAdd.{0} (ZMod (PNat.val q)) (Distrib.toAdd.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocSemiring.toDistrib.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))))) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.add_fst LucasLehmer.X.add_fstₓ'. -/
@[simp]
theorem add_fst (x y : X q) : (x + y).1 = x.1 + y.1 :=
rfl
#align lucas_lehmer.X.add_fst LucasLehmer.X.add_fst
+/- warning: lucas_lehmer.X.add_snd -> LucasLehmer.X.add_snd is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q))))))) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y))
+but is expected to have type
+ forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddCommGroupX q))))))) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHAdd.{0} (ZMod (PNat.val q)) (Distrib.toAdd.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocSemiring.toDistrib.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))))) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.add_snd LucasLehmer.X.add_sndₓ'. -/
@[simp]
theorem add_snd (x y : X q) : (x + y).2 = x.2 + y.2 :=
rfl
#align lucas_lehmer.X.add_snd LucasLehmer.X.add_snd
+/- warning: lucas_lehmer.X.neg_fst -> LucasLehmer.X.neg_fst is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Neg.neg.{0} (LucasLehmer.X q) (SubNegMonoid.toHasNeg.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q)))) x)) (Neg.neg.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (SubNegMonoid.toHasNeg.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroup.toSubNegMonoid.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddGroup.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))))) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x))
+but is expected to have type
+ forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Neg.neg.{0} (LucasLehmer.X q) (NegZeroClass.toNeg.{0} (LucasLehmer.X q) (SubNegZeroMonoid.toNegZeroClass.{0} (LucasLehmer.X q) (SubtractionMonoid.toSubNegZeroMonoid.{0} (LucasLehmer.X q) (SubtractionCommMonoid.toSubtractionMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toDivisionAddCommMonoid.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddCommGroupX q)))))) x)) (Neg.neg.{0} (ZMod (PNat.val q)) (Ring.toNeg.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.neg_fst LucasLehmer.X.neg_fstₓ'. -/
@[simp]
theorem neg_fst (x : X q) : (-x).1 = -x.1 :=
rfl
#align lucas_lehmer.X.neg_fst LucasLehmer.X.neg_fst
+/- warning: lucas_lehmer.X.neg_snd -> LucasLehmer.X.neg_snd is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Neg.neg.{0} (LucasLehmer.X q) (SubNegMonoid.toHasNeg.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q)))) x)) (Neg.neg.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (SubNegMonoid.toHasNeg.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroup.toSubNegMonoid.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddGroup.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))))) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x))
+but is expected to have type
+ forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Neg.neg.{0} (LucasLehmer.X q) (NegZeroClass.toNeg.{0} (LucasLehmer.X q) (SubNegZeroMonoid.toNegZeroClass.{0} (LucasLehmer.X q) (SubtractionMonoid.toSubNegZeroMonoid.{0} (LucasLehmer.X q) (SubtractionCommMonoid.toSubtractionMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toDivisionAddCommMonoid.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddCommGroupX q)))))) x)) (Neg.neg.{0} (ZMod (PNat.val q)) (Ring.toNeg.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.neg_snd LucasLehmer.X.neg_sndₓ'. -/
@[simp]
theorem neg_snd (x : X q) : (-x).2 = -x.2 :=
rfl
@@ -227,11 +323,23 @@ theorem neg_snd (x : X q) : (-x).2 = -x.2 :=
instance : Mul (X q) where mul x y := (x.1 * y.1 + 3 * x.2 * y.2, x.1 * y.2 + x.2 * y.1)
+/- warning: lucas_lehmer.X.mul_fst -> LucasLehmer.X.mul_fst is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (HMul.hMul.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y)) (HMul.hMul.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (HMul.hMul.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (OfNat.ofNat.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 3 (OfNat.mk.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 3 (bit1.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))))) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))) (One.one.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))))))))) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y)))
+but is expected to have type
+ forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHAdd.{0} (ZMod (PNat.val q)) (Distrib.toAdd.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocSemiring.toDistrib.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))))) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y)) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 3 (instOfNat.{0} (ZMod (PNat.val q)) 3 (NonAssocRing.toNatCast.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))) (instAtLeastTwoHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y)))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.mul_fst LucasLehmer.X.mul_fstₓ'. -/
@[simp]
theorem mul_fst (x y : X q) : (x * y).1 = x.1 * y.1 + 3 * x.2 * y.2 :=
rfl
#align lucas_lehmer.X.mul_fst LucasLehmer.X.mul_fst
+/- warning: lucas_lehmer.X.mul_snd -> LucasLehmer.X.mul_snd is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (HMul.hMul.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y)) (HMul.hMul.{0, 0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (instHMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasMul.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) y)))
+but is expected to have type
+ forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q), Eq.{1} (ZMod (PNat.val q)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x y)) (HAdd.hAdd.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHAdd.{0} (ZMod (PNat.val q)) (Distrib.toAdd.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocSemiring.toDistrib.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))))) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y)) (HMul.hMul.{0, 0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (ZMod (PNat.val q)) (instHMul.{0} (ZMod (PNat.val q)) (NonUnitalNonAssocRing.toMul.{0} (ZMod (PNat.val q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))))) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) x) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) y)))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.mul_snd LucasLehmer.X.mul_sndₓ'. -/
@[simp]
theorem mul_snd (x y : X q) : (x * y).2 = x.1 * y.2 + x.2 * y.1 :=
rfl
@@ -239,37 +347,77 @@ theorem mul_snd (x y : X q) : (x * y).2 = x.1 * y.2 + x.2 * y.1 :=
instance : One (X q) where one := ⟨1, 0⟩
+/- warning: lucas_lehmer.X.one_fst -> LucasLehmer.X.one_fst is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat}, Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (OfNat.mk.{0} (LucasLehmer.X q) 1 (One.one.{0} (LucasLehmer.X q) (LucasLehmer.X.hasOne q))))) (OfNat.ofNat.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 1 (OfNat.mk.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 1 (One.one.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))))))))
+but is expected to have type
+ forall {q : PNat}, Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (One.toOfNat1.{0} (LucasLehmer.X q) (LucasLehmer.X.instOneX q)))) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 1 (One.toOfNat1.{0} (ZMod (PNat.val q)) (NonAssocRing.toOne.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.one_fst LucasLehmer.X.one_fstₓ'. -/
@[simp]
theorem one_fst : (1 : X q).1 = 1 :=
rfl
#align lucas_lehmer.X.one_fst LucasLehmer.X.one_fst
+/- warning: lucas_lehmer.X.one_snd -> LucasLehmer.X.one_snd is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat}, Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (OfNat.mk.{0} (LucasLehmer.X q) 1 (One.one.{0} (LucasLehmer.X q) (LucasLehmer.X.hasOne q))))) (OfNat.ofNat.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 0 (OfNat.mk.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 0 (Zero.zero.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (MulZeroClass.toHasZero.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toNonAssocRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))))))))
+but is expected to have type
+ forall {q : PNat}, Eq.{1} (ZMod (PNat.val q)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (One.toOfNat1.{0} (LucasLehmer.X q) (LucasLehmer.X.instOneX q)))) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 0 (Zero.toOfNat0.{0} (ZMod (PNat.val q)) (CommMonoidWithZero.toZero.{0} (ZMod (PNat.val q)) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (PNat.val q)) (CommRing.toCommSemiring.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.one_snd LucasLehmer.X.one_sndₓ'. -/
@[simp]
theorem one_snd : (1 : X q).2 = 0 :=
rfl
#align lucas_lehmer.X.one_snd LucasLehmer.X.one_snd
+/- warning: lucas_lehmer.X.bit0_fst clashes with [anonymous] -> [anonymous]
+warning: lucas_lehmer.X.bit0_fst -> [anonymous] is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (bit0.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q)))))) x)) (bit0.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x))
+but is expected to have type
+ forall {q : Type.{u}} {x : Type.{v}}, (Nat -> q -> x) -> Nat -> (List.{u} q) -> (List.{v} x)
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.bit0_fst [anonymous]ₓ'. -/
@[simp]
-theorem bit0_fst (x : X q) : (bit0 x).1 = bit0 x.1 :=
+theorem [anonymous] (x : X q) : (bit0 x).1 = bit0 x.1 :=
rfl
-#align lucas_lehmer.X.bit0_fst LucasLehmer.X.bit0_fst
-
+#align lucas_lehmer.X.bit0_fst [anonymous]
+
+/- warning: lucas_lehmer.X.bit0_snd clashes with [anonymous] -> [anonymous]
+warning: lucas_lehmer.X.bit0_snd -> [anonymous] is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (bit0.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q)))))) x)) (bit0.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x))
+but is expected to have type
+ forall {q : Type.{u}} {x : Type.{v}}, (Nat -> q -> x) -> Nat -> (List.{u} q) -> (List.{v} x)
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.bit0_snd [anonymous]ₓ'. -/
@[simp]
-theorem bit0_snd (x : X q) : (bit0 x).2 = bit0 x.2 :=
+theorem [anonymous] (x : X q) : (bit0 x).2 = bit0 x.2 :=
rfl
-#align lucas_lehmer.X.bit0_snd LucasLehmer.X.bit0_snd
-
+#align lucas_lehmer.X.bit0_snd [anonymous]
+
+/- warning: lucas_lehmer.X.bit1_fst clashes with [anonymous] -> [anonymous]
+warning: lucas_lehmer.X.bit1_fst -> [anonymous] is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (bit1.{0} (LucasLehmer.X q) (LucasLehmer.X.hasOne q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q)))))) x)) (bit1.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))))) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x))
+but is expected to have type
+ forall {q : Type.{u}} {x : Type.{v}}, (Nat -> q -> x) -> Nat -> (List.{u} q) -> (List.{v} x)
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.bit1_fst [anonymous]ₓ'. -/
@[simp]
-theorem bit1_fst (x : X q) : (bit1 x).1 = bit1 x.1 :=
+theorem [anonymous] (x : X q) : (bit1 x).1 = bit1 x.1 :=
rfl
-#align lucas_lehmer.X.bit1_fst LucasLehmer.X.bit1_fst
-
+#align lucas_lehmer.X.bit1_fst [anonymous]
+
+/- warning: lucas_lehmer.X.bit1_snd clashes with [anonymous] -> [anonymous]
+warning: lucas_lehmer.X.bit1_snd -> [anonymous] is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (x : LucasLehmer.X q), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (bit1.{0} (LucasLehmer.X q) (LucasLehmer.X.hasOne q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (SubNegMonoid.toAddMonoid.{0} (LucasLehmer.X q) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X q) (AddCommGroup.toAddGroup.{0} (LucasLehmer.X q) (LucasLehmer.X.addCommGroup q)))))) x)) (bit0.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Distrib.toHasAdd.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toDistrib.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) x))
+but is expected to have type
+ forall {q : Type.{u}} {x : Type.{v}}, (Nat -> q -> x) -> Nat -> (List.{u} q) -> (List.{v} x)
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.bit1_snd [anonymous]ₓ'. -/
@[simp]
-theorem bit1_snd (x : X q) : (bit1 x).2 = bit0 x.2 :=
+theorem [anonymous] (x : X q) : (bit1 x).2 = bit0 x.2 :=
by
dsimp [bit1]
simp
-#align lucas_lehmer.X.bit1_snd LucasLehmer.X.bit1_snd
+#align lucas_lehmer.X.bit1_snd [anonymous]
instance : Monoid (X q) :=
{
@@ -294,12 +442,24 @@ instance : AddGroupWithOne (X q) :=
intCast_ofNat := fun n => by simp <;> rfl
intCast_negSucc := fun n => by ext <;> simp <;> rfl }
+/- warning: lucas_lehmer.X.left_distrib -> LucasLehmer.X.left_distrib is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q) (z : LucasLehmer.X q), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) x (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) y z)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) x y) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) x z))
+but is expected to have type
+ forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q) (z : LucasLehmer.X q), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddGroupWithOneX q)))))) y z)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddGroupWithOneX q)))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x y) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x z))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.left_distrib LucasLehmer.X.left_distribₓ'. -/
theorem left_distrib (x y z : X q) : x * (y + z) = x * y + x * z := by
ext <;>
· dsimp
ring
#align lucas_lehmer.X.left_distrib LucasLehmer.X.left_distrib
+/- warning: lucas_lehmer.X.right_distrib -> LucasLehmer.X.right_distrib is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q) (z : LucasLehmer.X q), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) x y) z) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toHasAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) x z) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) y z))
+but is expected to have type
+ forall {q : PNat} (x : LucasLehmer.X q) (y : LucasLehmer.X q) (z : LucasLehmer.X q), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddGroupWithOneX q)))))) x y) z) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (AddZeroClass.toAdd.{0} (LucasLehmer.X q) (AddMonoid.toAddZeroClass.{0} (LucasLehmer.X q) (AddMonoidWithOne.toAddMonoid.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.instAddGroupWithOneX q)))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) x z) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) y z))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.right_distrib LucasLehmer.X.right_distribₓ'. -/
theorem right_distrib (x y z : X q) : (x + y) * z = x * z + y * z := by
ext <;>
· dsimp
@@ -324,72 +484,138 @@ instance [Fact (1 < (q : ℕ))] : Nontrivial (X q) :=
injection h with h1 _
exact zero_ne_one h1⟩⟩
+/- warning: lucas_lehmer.X.nat_coe_fst -> LucasLehmer.X.nat_coe_fst is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (n : Nat), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Nat (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Nat (LucasLehmer.X q) (Nat.castCoe.{0} (LucasLehmer.X q) (AddMonoidWithOne.toNatCast.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) n)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HasLiftT.mk.{1, 1} Nat (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CoeTCₓ.coe.{1, 1} Nat (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Nat.castCoe.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddMonoidWithOne.toNatCast.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toAddMonoidWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))))))) n)
+but is expected to have type
+ forall {q : PNat} (n : Nat), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Nat.cast.{0} (LucasLehmer.X q) (LucasLehmer.X.instNatCastX q) n)) (Nat.cast.{0} (ZMod (PNat.val q)) (NonAssocRing.toNatCast.{0} (ZMod (PNat.val q)) (Ring.toNonAssocRing.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q))))) n)
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.nat_coe_fst LucasLehmer.X.nat_coe_fstₓ'. -/
@[simp]
theorem nat_coe_fst (n : ℕ) : (n : X q).fst = (n : ZMod q) :=
rfl
#align lucas_lehmer.X.nat_coe_fst LucasLehmer.X.nat_coe_fst
+/- warning: lucas_lehmer.X.nat_coe_snd -> LucasLehmer.X.nat_coe_snd is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (n : Nat), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Nat (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Nat (LucasLehmer.X q) (Nat.castCoe.{0} (LucasLehmer.X q) (AddMonoidWithOne.toNatCast.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) n)) (OfNat.ofNat.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 0 (OfNat.mk.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 0 (Zero.zero.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (MulZeroClass.toHasZero.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toNonAssocRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))))))))
+but is expected to have type
+ forall {q : PNat} (n : Nat), Eq.{1} (ZMod (PNat.val q)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Nat.cast.{0} (LucasLehmer.X q) (LucasLehmer.X.instNatCastX q) n)) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 0 (Zero.toOfNat0.{0} (ZMod (PNat.val q)) (CommMonoidWithZero.toZero.{0} (ZMod (PNat.val q)) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (PNat.val q)) (CommRing.toCommSemiring.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.nat_coe_snd LucasLehmer.X.nat_coe_sndₓ'. -/
@[simp]
theorem nat_coe_snd (n : ℕ) : (n : X q).snd = (0 : ZMod q) :=
rfl
#align lucas_lehmer.X.nat_coe_snd LucasLehmer.X.nat_coe_snd
+/- warning: lucas_lehmer.X.int_coe_fst -> LucasLehmer.X.int_coe_fst is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (n : Int), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.fst.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) n)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (HasLiftT.mk.{1, 1} Int (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CoeTCₓ.coe.{1, 1} Int (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Int.castCoe.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddGroupWithOne.toHasIntCast.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (AddCommGroupWithOne.toAddGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toAddCommGroupWithOne.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q))))))))) n)
+but is expected to have type
+ forall {q : PNat} (n : Int), Eq.{1} (ZMod (PNat.val q)) (Prod.fst.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) n)) (Int.cast.{0} (ZMod (PNat.val q)) (Ring.toIntCast.{0} (ZMod (PNat.val q)) (CommRing.toRing.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))) n)
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.int_coe_fst LucasLehmer.X.int_coe_fstₓ'. -/
@[simp]
theorem int_coe_fst (n : ℤ) : (n : X q).fst = (n : ZMod q) :=
rfl
#align lucas_lehmer.X.int_coe_fst LucasLehmer.X.int_coe_fst
+/- warning: lucas_lehmer.X.int_coe_snd -> LucasLehmer.X.int_coe_snd is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (n : Int), Eq.{1} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Prod.snd.{0, 0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) n)) (OfNat.ofNat.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 0 (OfNat.mk.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) 0 (Zero.zero.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (MulZeroClass.toHasZero.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (Ring.toNonAssocRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (CommRing.toRing.{0} (ZMod ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)) (ZMod.commRing ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q)))))))))))
+but is expected to have type
+ forall {q : PNat} (n : Int), Eq.{1} (ZMod (PNat.val q)) (Prod.snd.{0, 0} (ZMod (PNat.val q)) (ZMod (PNat.val q)) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) n)) (OfNat.ofNat.{0} (ZMod (PNat.val q)) 0 (Zero.toOfNat0.{0} (ZMod (PNat.val q)) (CommMonoidWithZero.toZero.{0} (ZMod (PNat.val q)) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (PNat.val q)) (CommRing.toCommSemiring.{0} (ZMod (PNat.val q)) (ZMod.commRing (PNat.val q)))))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.int_coe_snd LucasLehmer.X.int_coe_sndₓ'. -/
@[simp]
theorem int_coe_snd (n : ℤ) : (n : X q).snd = (0 : ZMod q) :=
rfl
#align lucas_lehmer.X.int_coe_snd LucasLehmer.X.int_coe_snd
+/- warning: lucas_lehmer.X.coe_mul -> LucasLehmer.X.coe_mul is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (n : Int) (m : Int), Eq.{1} (LucasLehmer.X q) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.hasMul) n m)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) n) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) m))
+but is expected to have type
+ forall {q : PNat} (n : Int) (m : Int), Eq.{1} (LucasLehmer.X q) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.instMulInt) n m)) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) n) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) m))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.coe_mul LucasLehmer.X.coe_mulₓ'. -/
@[norm_cast]
theorem coe_mul (n m : ℤ) : ((n * m : ℤ) : X q) = (n : X q) * (m : X q) := by ext <;> simp <;> ring
#align lucas_lehmer.X.coe_mul LucasLehmer.X.coe_mul
+/- warning: lucas_lehmer.X.coe_nat -> LucasLehmer.X.coe_nat is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (n : Nat), Eq.{1} (LucasLehmer.X q) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) n)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Nat (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Nat (LucasLehmer.X q) (Nat.castCoe.{0} (LucasLehmer.X q) (AddMonoidWithOne.toNatCast.{0} (LucasLehmer.X q) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q)))))) n)
+but is expected to have type
+ forall {q : PNat} (n : Nat), Eq.{1} (LucasLehmer.X q) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) (Nat.cast.{0} Int instNatCastInt n)) (Nat.cast.{0} (LucasLehmer.X q) (LucasLehmer.X.instNatCastX q) n)
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.coe_nat LucasLehmer.X.coe_natₓ'. -/
@[norm_cast]
theorem coe_nat (n : ℕ) : ((n : ℤ) : X q) = (n : X q) := by ext <;> simp
#align lucas_lehmer.X.coe_nat LucasLehmer.X.coe_nat
+#print LucasLehmer.X.card_eq /-
/-- The cardinality of `X` is `q^2`. -/
-theorem x_card : Fintype.card (X q) = q ^ 2 :=
+theorem card_eq : Fintype.card (X q) = q ^ 2 :=
by
dsimp [X]
rw [Fintype.card_prod, ZMod.card q]
ring
-#align lucas_lehmer.X.X_card LucasLehmer.X.x_card
+#align lucas_lehmer.X.X_card LucasLehmer.X.card_eq
+-/
+/- warning: lucas_lehmer.X.units_card -> LucasLehmer.X.card_units_lt is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat}, (LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 1 (OfNat.mk.{0} PNat 1 (One.one.{0} PNat PNat.hasOne))) q) -> (LT.lt.{0} Nat Nat.hasLt (Fintype.card.{0} (Units.{0} (LucasLehmer.X q) (LucasLehmer.X.monoid q)) (Units.fintype.{0} (LucasLehmer.X q) (LucasLehmer.X.monoid q) (LucasLehmer.X.fintype q) (fun (a : LucasLehmer.X q) (b : LucasLehmer.X q) => LucasLehmer.X.decidableEq q a b))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) q) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))
+but is expected to have type
+ forall {q : PNat}, (LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 1 (instOfNatPNatHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)))) q) -> (LT.lt.{0} Nat instLTNat (Fintype.card.{0} (Units.{0} (LucasLehmer.X q) (LucasLehmer.X.instMonoidX q)) (instFintypeUnits.{0} (LucasLehmer.X q) (LucasLehmer.X.instMonoidX q) (LucasLehmer.X.instFintypeX q) (fun (a : LucasLehmer.X q) (b : LucasLehmer.X q) => LucasLehmer.X.instDecidableEqX q a b))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (PNat.val q) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.units_card LucasLehmer.X.card_units_ltₓ'. -/
/-- There are strictly fewer than `q^2` units, since `0` is not a unit. -/
-theorem units_card (w : 1 < q) : Fintype.card (X q)ˣ < q ^ 2 :=
+theorem card_units_lt (w : 1 < q) : Fintype.card (X q)ˣ < q ^ 2 :=
by
haveI : Fact (1 < (q : ℕ)) := ⟨w⟩
convert card_units_lt (X q)
rw [X_card]
-#align lucas_lehmer.X.units_card LucasLehmer.X.units_card
+#align lucas_lehmer.X.units_card LucasLehmer.X.card_units_lt
+#print LucasLehmer.X.ω /-
/-- We define `ω = 2 + √3`. -/
def ω : X q :=
(2, 1)
#align lucas_lehmer.X.ω LucasLehmer.X.ω
+-/
+#print LucasLehmer.X.ωb /-
/-- We define `ωb = 2 - √3`, which is the inverse of `ω`. -/
def ωb : X q :=
(2, -1)
#align lucas_lehmer.X.ωb LucasLehmer.X.ωb
+-/
+/- warning: lucas_lehmer.X.ω_mul_ωb -> LucasLehmer.X.ω_mul_ωb is a dubious translation:
+lean 3 declaration is
+ forall (q : PNat), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) (LucasLehmer.X.ω q) (LucasLehmer.X.ωb q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (OfNat.mk.{0} (LucasLehmer.X q) 1 (One.one.{0} (LucasLehmer.X q) (LucasLehmer.X.hasOne q))))
+but is expected to have type
+ forall (q : PNat), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) (LucasLehmer.X.ω q) (LucasLehmer.X.ωb q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (One.toOfNat1.{0} (LucasLehmer.X q) (LucasLehmer.X.instOneX q)))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.ω_mul_ωb LucasLehmer.X.ω_mul_ωbₓ'. -/
theorem ω_mul_ωb (q : ℕ+) : (ω : X q) * ωb = 1 :=
by
dsimp [ω, ωb]
ext <;> simp <;> ring
#align lucas_lehmer.X.ω_mul_ωb LucasLehmer.X.ω_mul_ωb
+/- warning: lucas_lehmer.X.ωb_mul_ω -> LucasLehmer.X.ωb_mul_ω is a dubious translation:
+lean 3 declaration is
+ forall (q : PNat), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.hasMul q)) (LucasLehmer.X.ωb q) (LucasLehmer.X.ω q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (OfNat.mk.{0} (LucasLehmer.X q) 1 (One.one.{0} (LucasLehmer.X q) (LucasLehmer.X.hasOne q))))
+but is expected to have type
+ forall (q : PNat), Eq.{1} (LucasLehmer.X q) (HMul.hMul.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHMul.{0} (LucasLehmer.X q) (LucasLehmer.X.instMulX q)) (LucasLehmer.X.ωb q) (LucasLehmer.X.ω q)) (OfNat.ofNat.{0} (LucasLehmer.X q) 1 (One.toOfNat1.{0} (LucasLehmer.X q) (LucasLehmer.X.instOneX q)))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.ωb_mul_ω LucasLehmer.X.ωb_mul_ωₓ'. -/
theorem ωb_mul_ω (q : ℕ+) : (ωb : X q) * ω = 1 :=
by
dsimp [ω, ωb]
ext <;> simp <;> ring
#align lucas_lehmer.X.ωb_mul_ω LucasLehmer.X.ωb_mul_ω
+/- warning: lucas_lehmer.X.closed_form -> LucasLehmer.X.closed_form is a dubious translation:
+lean 3 declaration is
+ forall {q : PNat} (i : Nat), Eq.{1} (LucasLehmer.X q) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X q) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X q) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X q) (Int.castCoe.{0} (LucasLehmer.X q) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.addGroupWithOne q))))) (LucasLehmer.s i)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (Distrib.toHasAdd.{0} (LucasLehmer.X q) (Ring.toDistrib.{0} (LucasLehmer.X q) (LucasLehmer.X.ring q)))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X q) Nat (LucasLehmer.X q) (instHPow.{0, 0} (LucasLehmer.X q) Nat (Monoid.Pow.{0} (LucasLehmer.X q) (LucasLehmer.X.monoid q))) (LucasLehmer.X.ω q) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) i)) (HPow.hPow.{0, 0, 0} (LucasLehmer.X q) Nat (LucasLehmer.X q) (instHPow.{0, 0} (LucasLehmer.X q) Nat (Monoid.Pow.{0} (LucasLehmer.X q) (LucasLehmer.X.monoid q))) (LucasLehmer.X.ωb q) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) i)))
+but is expected to have type
+ forall {q : PNat} (i : Nat), Eq.{1} (LucasLehmer.X q) (Int.cast.{0} (LucasLehmer.X q) (Ring.toIntCast.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q)) (LucasLehmer.s i)) (HAdd.hAdd.{0, 0, 0} (LucasLehmer.X q) (LucasLehmer.X q) (LucasLehmer.X q) (instHAdd.{0} (LucasLehmer.X q) (Distrib.toAdd.{0} (LucasLehmer.X q) (NonUnitalNonAssocSemiring.toDistrib.{0} (LucasLehmer.X q) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (LucasLehmer.X q) (NonAssocRing.toNonUnitalNonAssocRing.{0} (LucasLehmer.X q) (Ring.toNonAssocRing.{0} (LucasLehmer.X q) (LucasLehmer.X.instRingX q))))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X q) Nat (LucasLehmer.X q) (instHPow.{0, 0} (LucasLehmer.X q) Nat (Monoid.Pow.{0} (LucasLehmer.X q) (LucasLehmer.X.instMonoidX q))) (LucasLehmer.X.ω q) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) i)) (HPow.hPow.{0, 0, 0} (LucasLehmer.X q) Nat (LucasLehmer.X q) (instHPow.{0, 0} (LucasLehmer.X q) Nat (Monoid.Pow.{0} (LucasLehmer.X q) (LucasLehmer.X.instMonoidX q))) (LucasLehmer.X.ωb q) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) i)))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.X.closed_form LucasLehmer.X.closed_formₓ'. -/
/-- A closed form for the recurrence relation. -/
theorem closed_form (i : ℕ) : (s i : X q) = (ω : X q) ^ 2 ^ i + (ωb : X q) ^ 2 ^ i :=
by
@@ -417,6 +643,12 @@ Here and below, we introduce `p' = p - 2`, in order to avoid using subtraction i
-/
+/- warning: lucas_lehmer.two_lt_q -> LucasLehmer.two_lt_q is a dubious translation:
+lean 3 declaration is
+ forall (p' : Nat), LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 2 (OfNat.mk.{0} PNat 2 (bit0.{0} PNat PNat.hasAdd (One.one.{0} PNat PNat.hasOne)))) (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))
+but is expected to have type
+ forall (p' : Nat), LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 2 (instOfNatPNatHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.two_lt_q LucasLehmer.two_lt_qₓ'. -/
/-- If `1 < p`, then `q p`, the smallest prime factor of `mersenne p`, is more than 2. -/
theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
by
@@ -443,6 +675,12 @@ theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
exact Nat.two_not_dvd_two_mul_sub_one (Nat.one_le_two_pow _) h'
#align lucas_lehmer.two_lt_q LucasLehmer.two_lt_q
+/- warning: lucas_lehmer.ω_pow_formula -> LucasLehmer.ω_pow_formula is a dubious translation:
+lean 3 declaration is
+ forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (OfNat.mk.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (Zero.zero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (MulZeroClass.toHasZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (Ring.toNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))))))))))))) -> (Exists.{1} Int (fun (k : Int) => Eq.{1} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))))) (HSub.hSub.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHSub.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (SubNegMonoid.toHasSub.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddGroupWithOne.toAddGroup.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.addGroupWithOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHMul.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.hasMul (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHMul.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.hasMul (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HasLiftT.mk.{1, 1} Int (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (CoeTCₓ.coe.{1, 1} Int (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (Int.castCoe.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddGroupWithOne.toHasIntCast.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.addGroupWithOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))))) k) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HasLiftT.mk.{1, 1} Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (CoeTCₓ.coe.{1, 1} Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (Nat.castCoe.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddMonoidWithOne.toNatCast.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.addGroupWithOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))))))) (mersenne (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) p'))) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) 1 (OfNat.mk.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) 1 (One.one.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.X.hasOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))))))
+but is expected to have type
+ forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) 0 (Zero.toOfNat0.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommMonoidWithZero.toZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toCommSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))))))) -> (Exists.{1} Int (fun (k : Int) => Eq.{1} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (HSub.hSub.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHSub.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (Ring.toSub.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instRingX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHMul.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMulX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (HMul.hMul.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHMul.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMulX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (Int.cast.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (Ring.toIntCast.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instRingX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) k) (Nat.cast.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instNatCastX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (mersenne (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) p'))) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) 1 (One.toOfNat1.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instOneX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.ω_pow_formula LucasLehmer.ω_pow_formulaₓ'. -/
theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
∃ k : ℤ,
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 1) =
@@ -468,13 +706,25 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
exact_mod_cast h
#align lucas_lehmer.ω_pow_formula LucasLehmer.ω_pow_formula
+/- warning: lucas_lehmer.mersenne_coe_X -> LucasLehmer.mersenne_coe_X is a dubious translation:
+lean 3 declaration is
+ forall (p : Nat), Eq.{1} (LucasLehmer.X (LucasLehmer.q p)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat (LucasLehmer.X (LucasLehmer.q p)) (HasLiftT.mk.{1, 1} Nat (LucasLehmer.X (LucasLehmer.q p)) (CoeTCₓ.coe.{1, 1} Nat (LucasLehmer.X (LucasLehmer.q p)) (Nat.castCoe.{0} (LucasLehmer.X (LucasLehmer.q p)) (AddMonoidWithOne.toNatCast.{0} (LucasLehmer.X (LucasLehmer.q p)) (AddGroupWithOne.toAddMonoidWithOne.{0} (LucasLehmer.X (LucasLehmer.q p)) (LucasLehmer.X.addGroupWithOne (LucasLehmer.q p))))))) (mersenne p)) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q p)) 0 (OfNat.mk.{0} (LucasLehmer.X (LucasLehmer.q p)) 0 (Zero.zero.{0} (LucasLehmer.X (LucasLehmer.q p)) (MulZeroClass.toHasZero.{0} (LucasLehmer.X (LucasLehmer.q p)) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (LucasLehmer.X (LucasLehmer.q p)) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (LucasLehmer.X (LucasLehmer.q p)) (NonAssocRing.toNonUnitalNonAssocRing.{0} (LucasLehmer.X (LucasLehmer.q p)) (Ring.toNonAssocRing.{0} (LucasLehmer.X (LucasLehmer.q p)) (LucasLehmer.X.ring (LucasLehmer.q p))))))))))
+but is expected to have type
+ forall (p : Nat), Eq.{1} (LucasLehmer.X (LucasLehmer.q p)) (Nat.cast.{0} (LucasLehmer.X (LucasLehmer.q p)) (LucasLehmer.X.instNatCastX (LucasLehmer.q p)) (mersenne p)) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q p)) 0 (Zero.toOfNat0.{0} (LucasLehmer.X (LucasLehmer.q p)) (CommMonoidWithZero.toZero.{0} (LucasLehmer.X (LucasLehmer.q p)) (CommSemiring.toCommMonoidWithZero.{0} (LucasLehmer.X (LucasLehmer.q p)) (CommRing.toCommSemiring.{0} (LucasLehmer.X (LucasLehmer.q p)) (LucasLehmer.X.instCommRingX (LucasLehmer.q p)))))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.mersenne_coe_X LucasLehmer.mersenne_coe_Xₓ'. -/
/-- `q` is the minimum factor of `mersenne p`, so `M p = 0` in `X q`. -/
-theorem mersenne_coe_x (p : ℕ) : (mersenne p : X (q p)) = 0 :=
+theorem mersenne_coe_X (p : ℕ) : (mersenne p : X (q p)) = 0 :=
by
ext <;> simp [mersenne, q, ZMod.nat_cast_zmod_eq_zero_iff_dvd, -pow_pos]
apply Nat.minFac_dvd
-#align lucas_lehmer.mersenne_coe_X LucasLehmer.mersenne_coe_x
-
+#align lucas_lehmer.mersenne_coe_X LucasLehmer.mersenne_coe_X
+
+/- warning: lucas_lehmer.ω_pow_eq_neg_one -> LucasLehmer.ω_pow_eq_neg_one is a dubious translation:
+lean 3 declaration is
+ forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (OfNat.mk.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (Zero.zero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (MulZeroClass.toHasZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (Ring.toNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))))))))))))) -> (Eq.{1} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))))) (Neg.neg.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (SubNegMonoid.toHasNeg.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddGroup.toSubNegMonoid.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (AddGroupWithOne.toAddGroup.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.addGroupWithOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))))) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) 1 (OfNat.mk.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) 1 (One.one.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.X.hasOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))))
+but is expected to have type
+ forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) 0 (Zero.toOfNat0.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommMonoidWithZero.toZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toCommSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))))))) -> (Eq.{1} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (Neg.neg.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (Ring.toNeg.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instRingX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) 1 (One.toOfNat1.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instOneX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.ω_pow_eq_neg_one LucasLehmer.ω_pow_eq_neg_oneₓ'. -/
theorem ω_pow_eq_neg_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 1) = -1 :=
by
@@ -483,6 +733,12 @@ theorem ω_pow_eq_neg_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
simpa using w
#align lucas_lehmer.ω_pow_eq_neg_one LucasLehmer.ω_pow_eq_neg_one
+/- warning: lucas_lehmer.ω_pow_eq_one -> LucasLehmer.ω_pow_eq_one is a dubious translation:
+lean 3 declaration is
+ forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (OfNat.mk.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (Zero.zero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (MulZeroClass.toHasZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (Ring.toNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))))))))))))) -> (Eq.{1} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) 1 (OfNat.mk.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) 1 (One.one.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.X.hasOne (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))))
+but is expected to have type
+ forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) 0 (Zero.toOfNat0.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommMonoidWithZero.toZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toCommSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))))))) -> (Eq.{1} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (instHPow.{0, 0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) Nat (Monoid.Pow.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))) (LucasLehmer.X.ω (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (OfNat.ofNat.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) 1 (One.toOfNat1.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instOneX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.ω_pow_eq_one LucasLehmer.ω_pow_eq_oneₓ'. -/
theorem ω_pow_eq_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 2) = 1 :=
calc
@@ -492,6 +748,12 @@ theorem ω_pow_eq_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
#align lucas_lehmer.ω_pow_eq_one LucasLehmer.ω_pow_eq_one
+/- warning: lucas_lehmer.ω_unit -> LucasLehmer.ωUnit is a dubious translation:
+lean 3 declaration is
+ forall (p : Nat), Units.{0} (LucasLehmer.X (LucasLehmer.q p)) (LucasLehmer.X.monoid (LucasLehmer.q p))
+but is expected to have type
+ forall (p : Nat), Units.{0} (LucasLehmer.X (LucasLehmer.q p)) (LucasLehmer.X.instMonoidX (LucasLehmer.q p))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.ω_unit LucasLehmer.ωUnitₓ'. -/
/-- `ω` as an element of the group of units. -/
def ωUnit (p : ℕ) : Units (X (q p)) where
val := ω
@@ -500,11 +762,19 @@ def ωUnit (p : ℕ) : Units (X (q p)) where
inv_val := by simp [ωb_mul_ω]
#align lucas_lehmer.ω_unit LucasLehmer.ωUnit
+#print LucasLehmer.ωUnit_coe /-
@[simp]
theorem ωUnit_coe (p : ℕ) : (ωUnit p : X (q p)) = ω :=
rfl
#align lucas_lehmer.ω_unit_coe LucasLehmer.ωUnit_coe
+-/
+/- warning: lucas_lehmer.order_ω -> LucasLehmer.order_ω is a dubious translation:
+lean 3 declaration is
+ forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (OfNat.mk.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (Zero.zero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (MulZeroClass.toHasZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (Ring.toNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))))))))))))) -> (Eq.{1} Nat (orderOf.{0} (Units.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))) (DivInvMonoid.toMonoid.{0} (Units.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))) (Group.toDivInvMonoid.{0} (Units.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))) (Units.group.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (LucasLehmer.X.monoid (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))))) (LucasLehmer.ωUnit (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))))
+but is expected to have type
+ forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) 0 (Zero.toOfNat0.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommMonoidWithZero.toZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toCommSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))))))) -> (Eq.{1} Nat (orderOf.{0} (Units.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (DivInvMonoid.toMonoid.{0} (Units.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (Group.toDivInvMonoid.{0} (Units.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))) (Units.instGroupUnits.{0} (LucasLehmer.X (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (LucasLehmer.X.instMonoidX (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))))) (LucasLehmer.ωUnit (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.order_ω LucasLehmer.order_ωₓ'. -/
/-- The order of `ω` in the unit group is exactly `2^p`. -/
theorem order_ω (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
orderOf (ωUnit (p' + 2)) = 2 ^ (p' + 2) :=
@@ -527,12 +797,18 @@ theorem order_ω (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
exact ω_pow_eq_one p' h
#align lucas_lehmer.order_ω LucasLehmer.order_ω
+/- warning: lucas_lehmer.order_ineq -> LucasLehmer.order_ineq is a dubious translation:
+lean 3 declaration is
+ forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (OfNat.mk.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) 0 (Zero.zero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (MulZeroClass.toHasZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocSemiring.toMulZeroClass.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (NonAssocRing.toNonUnitalNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (Ring.toNonAssocRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (CommRing.toRing.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (One.one.{0} Nat Nat.hasOne))))))))))))) -> (LT.lt.{0} Nat Nat.hasLt (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PNat Nat (HasLiftT.mk.{1, 1} PNat Nat (CoeTCₓ.coe.{1, 1} PNat Nat (coeBase.{1, 1} PNat Nat coePNatNat))) (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p' (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))))
+but is expected to have type
+ forall (p' : Nat), (Eq.{1} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (LucasLehmer.lucasLehmerResidue (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) 0 (Zero.toOfNat0.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommMonoidWithZero.toZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommSemiring.toCommMonoidWithZero.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (CommRing.toCommSemiring.{0} (ZMod (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (ZMod.commRing (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))))))) -> (LT.lt.{0} Nat instLTNat (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (PNat.val (LucasLehmer.q (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p' (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))))
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.order_ineq LucasLehmer.order_ineqₓ'. -/
theorem order_ineq (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
2 ^ (p' + 2) < (q (p' + 2) : ℕ) ^ 2 :=
calc
2 ^ (p' + 2) = orderOf (ωUnit (p' + 2)) := (order_ω p' h).symm
_ ≤ Fintype.card (X _)ˣ := orderOf_le_card_univ
- _ < (q (p' + 2) : ℕ) ^ 2 := units_card (Nat.lt_of_succ_lt (two_lt_q _))
+ _ < (q (p' + 2) : ℕ) ^ 2 := card_units_lt (Nat.lt_of_succ_lt (two_lt_q _))
#align lucas_lehmer.order_ineq LucasLehmer.order_ineq
@@ -542,6 +818,7 @@ export LucasLehmer (LucasLehmerTest lucasLehmerResidue)
open LucasLehmer
+#print lucas_lehmer_sufficiency /-
theorem lucas_lehmer_sufficiency (p : ℕ) (w : 1 < p) : LucasLehmerTest p → (mersenne p).Prime :=
by
let p' := p - 2
@@ -556,6 +833,7 @@ theorem lucas_lehmer_sufficiency (p : ℕ) (w : 1 < p) : LucasLehmerTest p → (
have h := lt_of_lt_of_le h₁ h₂
exact not_lt_of_ge (Nat.sub_le _ _) h
#align lucas_lehmer_sufficiency lucas_lehmer_sufficiency
+-/
-- Here we calculate the residue, very inefficiently, using `dec_trivial`. We can do much better.
example : (mersenne 5).Prime :=
@@ -566,6 +844,12 @@ namespace LucasLehmer
open Tactic
+/- warning: lucas_lehmer.s_mod_succ -> LucasLehmer.sMod_succ is a dubious translation:
+lean 3 declaration is
+ forall {p : Nat} {a : Int} {i : Nat} {b : Int} {c : Int}, (Eq.{1} Int (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.monoid)) (OfNat.ofNat.{0} Int 2 (OfNat.mk.{0} Int 2 (bit0.{0} Int Int.hasAdd (One.one.{0} Int Int.hasOne)))) p) (OfNat.ofNat.{0} Int 1 (OfNat.mk.{0} Int 1 (One.one.{0} Int Int.hasOne)))) a) -> (Eq.{1} Int (LucasLehmer.sMod p i) b) -> (Eq.{1} Int (HMod.hMod.{0, 0, 0} Int Int Int (instHMod.{0} Int Int.hasMod) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.hasSub) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.hasMul) b b) (OfNat.ofNat.{0} Int 2 (OfNat.mk.{0} Int 2 (bit0.{0} Int Int.hasAdd (One.one.{0} Int Int.hasOne))))) a) c) -> (Eq.{1} Int (LucasLehmer.sMod p (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) i (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) c)
+but is expected to have type
+ forall {p : Nat} {a : Int} {i : Nat} {b : Int} {c : Int}, (Eq.{1} Int (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HPow.hPow.{0, 0, 0} Int Nat Int (instHPow.{0, 0} Int Nat (Monoid.Pow.{0} Int Int.instMonoidInt)) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2)) p) (OfNat.ofNat.{0} Int 1 (instOfNatInt 1))) a) -> (Eq.{1} Int (LucasLehmer.sMod p i) b) -> (Eq.{1} Int (HMod.hMod.{0, 0, 0} Int Int Int (instHMod.{0} Int Int.instModInt_1) (HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSubInt) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.instMulInt) b b) (OfNat.ofNat.{0} Int 2 (instOfNatInt 2))) a) c) -> (Eq.{1} Int (LucasLehmer.sMod p (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) i (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) c)
+Case conversion may be inaccurate. Consider using '#align lucas_lehmer.s_mod_succ LucasLehmer.sMod_succₓ'. -/
theorem sMod_succ {p a i b c} (h1 : (2 ^ p - 1 : ℤ) = a) (h2 : sMod p i = b)
(h3 : (b * b - 2) % a = c) : sMod p (i + 1) = c :=
by
@@ -634,6 +918,7 @@ Someone should do this, too!
-/
+#print modEq_mersenne /-
theorem modEq_mersenne (n k : ℕ) : k ≡ k / 2 ^ n + k % 2 ^ n [MOD 2 ^ n - 1] :=
by
-- See https://leanprover.zulipchat.com/#narrow/stream/113489-new-members/topic/help.20finding.20a.20lemma/near/177698446
@@ -646,6 +931,7 @@ theorem modEq_mersenne (n k : ℕ) : k ≡ k / 2 ^ n + k % 2 ^ n [MOD 2 ^ n - 1]
rw [← one_mul (k / 2 ^ n)]
exact (Nat.modEq_sub <| Nat.succ_le_of_lt <| pow_pos zero_lt_two _).mul_right _
#align modeq_mersenne modEq_mersenne
+-/
-- It's hard to know what the limiting factor for large Mersenne primes would be.
-- In the purely computational world, I think it's the squaring operation in `s`.
mathlib commit https://github.com/leanprover-community/mathlib/commit/02ba8949f486ebecf93fe7460f1ed0564b5e442c
@@ -163,7 +163,7 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
· -- We want to use that fact that `0 ≤ s_mod p (p-2) < 2^p - 1`
-- and `lucas_lehmer_residue p = 0 → 2^p - 1 ∣ s_mod p (p-2)`.
intro h
- simp [ZMod.int_coe_zMod_eq_zero_iff_dvd] at h
+ simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
apply Int.eq_zero_of_dvd_of_nonneg_of_lt _ _ h <;> clear h
apply s_mod_nonneg _ (Nat.lt_of_succ_lt w)
exact s_mod_lt _ (Nat.lt_of_succ_lt w) (p - 2)
@@ -450,7 +450,7 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
by
dsimp [lucas_lehmer_residue] at h
rw [s_zmod_eq_s p'] at h
- simp [ZMod.int_coe_zMod_eq_zero_iff_dvd] at h
+ simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
cases' h with k h
use k
replace h := congr_arg (fun n : ℤ => (n : X (q (p' + 2)))) h
@@ -471,7 +471,7 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
/-- `q` is the minimum factor of `mersenne p`, so `M p = 0` in `X q`. -/
theorem mersenne_coe_x (p : ℕ) : (mersenne p : X (q p)) = 0 :=
by
- ext <;> simp [mersenne, q, ZMod.nat_coe_zMod_eq_zero_iff_dvd, -pow_pos]
+ ext <;> simp [mersenne, q, ZMod.nat_cast_zmod_eq_zero_iff_dvd, -pow_pos]
apply Nat.minFac_dvd
#align lucas_lehmer.mersenne_coe_X LucasLehmer.mersenne_coe_x
mathlib commit https://github.com/leanprover-community/mathlib/commit/4c586d291f189eecb9d00581aeb3dd998ac34442
@@ -432,7 +432,7 @@ theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) :=
lt_irrefl 2
(calc
2 ≤ p' + 2 := Nat.le_add_left _ _
- _ < 2 ^ (p' + 2) := Nat.lt_two_pow _
+ _ < 2 ^ (p' + 2) := (Nat.lt_two_pow _)
_ = 2 := Nat.pred_inj (Nat.one_le_two_pow _) (by decide) h'
)
· -- If q = 2, we get a contradiction from 2 ∣ 2^p - 1
@@ -573,9 +573,9 @@ theorem sMod_succ {p a i b c} (h1 : (2 ^ p - 1 : ℤ) = a) (h2 : sMod p i = b)
rw [h1, h2, sq, h3]
#align lucas_lehmer.s_mod_succ LucasLehmer.sMod_succ
-/- ./././Mathport/Syntax/Translate/Expr.lean:334:4: warning: unsupported (TODO): `[tacs] -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:334:4: warning: unsupported (TODO): `[tacs] -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:334:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
/-- Given a goal of the form `lucas_lehmer_test p`,
attempt to do the calculation using `norm_num` to certify each step.
-/
@@ -607,7 +607,7 @@ unsafe def run_test : tactic Unit := do
end LucasLehmer
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic lucas_lehmer.run_test -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic lucas_lehmer.run_test -/
/-- We verify that the tactic works to prove `127.prime`. -/
example : (mersenne 7).Prime :=
lucas_lehmer_sufficiency _ (by norm_num)
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
nat_cast
/int_cast
/rat_cast
to natCast
/intCast
/ratCast
(#11486)
Now that I am defining NNRat.cast
, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast
/intCast
/ratCast
over nat_cast
/int_cast
/rat_cast
, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.
@@ -151,8 +151,8 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
· -- We want to use that fact that `0 ≤ s_mod p (p-2) < 2^p - 1`
-- and `lucas_lehmer_residue p = 0 → 2^p - 1 ∣ s_mod p (p-2)`.
intro h
- simp? [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h says
- simp only [ZMod.int_cast_zmod_eq_zero_iff_dvd, gt_iff_lt, ofNat_pos, pow_pos, cast_pred,
+ simp? [ZMod.intCast_zmod_eq_zero_iff_dvd] at h says
+ simp only [ZMod.intCast_zmod_eq_zero_iff_dvd, gt_iff_lt, ofNat_pos, pow_pos, cast_pred,
cast_pow, cast_ofNat] at h
apply Int.eq_zero_of_dvd_of_nonneg_of_lt _ _ h <;> clear h
· exact sMod_nonneg _ (by positivity) _
@@ -427,8 +427,8 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
k * mersenne (p' + 2) * (ω : X (q (p' + 2))) ^ 2 ^ p' - 1 := by
dsimp [lucasLehmerResidue] at h
rw [sZMod_eq_s p'] at h
- simp? [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h says
- simp only [add_tsub_cancel_right, ZMod.int_cast_zmod_eq_zero_iff_dvd, gt_iff_lt, ofNat_pos,
+ simp? [ZMod.intCast_zmod_eq_zero_iff_dvd] at h says
+ simp only [add_tsub_cancel_right, ZMod.intCast_zmod_eq_zero_iff_dvd, gt_iff_lt, ofNat_pos,
pow_pos, cast_pred, cast_pow, cast_ofNat] at h
cases' h with k h
use k
@@ -449,7 +449,7 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
/-- `q` is the minimum factor of `mersenne p`, so `M p = 0` in `X q`. -/
theorem mersenne_coe_X (p : ℕ) : (mersenne p : X (q p)) = 0 := by
- ext <;> simp [mersenne, q, ZMod.nat_cast_zmod_eq_zero_iff_dvd, -pow_pos]
+ ext <;> simp [mersenne, q, ZMod.natCast_zmod_eq_zero_iff_dvd, -pow_pos]
apply Nat.minFac_dvd
set_option linter.uppercaseLean3 false in
#align lucas_lehmer.mersenne_coe_X LucasLehmer.mersenne_coe_X
@@ -346,9 +346,12 @@ set_option linter.uppercaseLean3 false in
#align lucas_lehmer.X.coe_mul LucasLehmer.X.coe_mul
@[norm_cast]
-theorem coe_nat (n : ℕ) : ((n : ℤ) : X q) = (n : X q) := by ext <;> simp
+theorem coe_natCast (n : ℕ) : ((n : ℤ) : X q) = (n : X q) := by ext <;> simp
set_option linter.uppercaseLean3 false in
-#align lucas_lehmer.X.coe_nat LucasLehmer.X.coe_nat
+#align lucas_lehmer.X.coe_nat LucasLehmer.X.coe_natCast
+
+-- 2024-04-05
+@[deprecated] alias coe_nat := coe_natCast
/-- The cardinality of `X` is `q^2`. -/
theorem card_eq : Fintype.card (X q) = q ^ 2 := by
@@ -414,7 +414,7 @@ Here and below, we introduce `p' = p - 2`, in order to avoid using subtraction i
theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) := by
refine (minFac_prime (one_lt_mersenne ?_).ne').two_le.lt_of_ne' ?_
· exact le_add_left _ _
- · rw [Ne.def, minFac_eq_two_iff, mersenne, Nat.pow_succ']
+ · rw [Ne, minFac_eq_two_iff, mersenne, Nat.pow_succ']
exact Nat.two_not_dvd_two_mul_sub_one Nat.one_le_two_pow
#align lucas_lehmer.two_lt_q LucasLehmer.two_lt_q
We change the following field in the definition of an additive commutative monoid:
nsmul_succ : ∀ (n : ℕ) (x : G),
- AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+ AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x
where the latter is more natural
We adjust the definitions of ^
in monoids, groups, etc.
Originally there was a warning comment about why this natural order was preferred
use
x * npowRec n x
and notnpowRec n x * x
in the definition to make sure that definitional unfolding ofnpowRec
is blocked, to avoid deep recursion issues.
but it seems to no longer apply.
Remarks on the PR :
pow_succ
and pow_succ'
have switched their meanings.Ideal.IsPrime.mul_mem_pow
which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul
.@@ -398,7 +398,7 @@ theorem closed_form (i : ℕ) : (s i : X q) = (ω : X q) ^ 2 ^ i + (ωb : X q) ^
_ = (ω ^ 2 ^ i) ^ 2 + (ωb ^ 2 ^ i) ^ 2 + 2 * (ωb ^ 2 ^ i * ω ^ 2 ^ i) - 2 := by ring
_ = (ω ^ 2 ^ i) ^ 2 + (ωb ^ 2 ^ i) ^ 2 := by
rw [← mul_pow ωb ω, ωb_mul_ω, one_pow, mul_one, add_sub_cancel_right]
- _ = ω ^ 2 ^ (i + 1) + ωb ^ 2 ^ (i + 1) := by rw [← pow_mul, ← pow_mul, _root_.pow_succ']
+ _ = ω ^ 2 ^ (i + 1) + ωb ^ 2 ^ (i + 1) := by rw [← pow_mul, ← pow_mul, _root_.pow_succ]
set_option linter.uppercaseLean3 false in
#align lucas_lehmer.X.closed_form LucasLehmer.X.closed_form
mul
-div
cancellation lemmas (#11530)
Lemma names around cancellation of multiplication and division are a mess.
This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the GroupWithZero
lemma name, the Group
lemma, the AddGroup
lemma name).
| Statement | New name | Old name | |
@@ -397,7 +397,7 @@ theorem closed_form (i : ℕ) : (s i : X q) = (ω : X q) ^ 2 ^ i + (ωb : X q) ^
_ = (ω ^ 2 ^ i + ωb ^ 2 ^ i) ^ 2 - 2 := by rw [ih]
_ = (ω ^ 2 ^ i) ^ 2 + (ωb ^ 2 ^ i) ^ 2 + 2 * (ωb ^ 2 ^ i * ω ^ 2 ^ i) - 2 := by ring
_ = (ω ^ 2 ^ i) ^ 2 + (ωb ^ 2 ^ i) ^ 2 := by
- rw [← mul_pow ωb ω, ωb_mul_ω, one_pow, mul_one, add_sub_cancel]
+ rw [← mul_pow ωb ω, ωb_mul_ω, one_pow, mul_one, add_sub_cancel_right]
_ = ω ^ 2 ^ (i + 1) + ωb ^ 2 ^ (i + 1) := by rw [← pow_mul, ← pow_mul, _root_.pow_succ']
set_option linter.uppercaseLean3 false in
#align lucas_lehmer.X.closed_form LucasLehmer.X.closed_form
I ran tryAtEachStep on all files under Mathlib
to find all locations where omega
succeeds. For each that was a linarith
without an only
, I tried replacing it with omega
, and I verified that elaboration time got smaller. (In almost all cases, there was a noticeable speedup.) I also replaced some slow aesop
s along the way.
@@ -557,7 +557,7 @@ theorem sMod'_eq_sMod (p k : ℕ) (hp : 2 ≤ p) : (sMod' (2 ^ p - 1) k : ℤ) =
have h1 := calc
4 = 2 ^ 2 := by norm_num
_ ≤ 2 ^ p := Nat.pow_le_pow_of_le_right (by norm_num) hp
- have h2 : 1 ≤ 2 ^ p := by linarith
+ have h2 : 1 ≤ 2 ^ p := by omega
induction k with
| zero =>
rw [sMod', sMod, Int.ofNat_emod]
I loogled for every occurrence of "cast", Nat
and "natCast"
and where the casted nat was n
, and made sure there were corresponding @[simp]
lemmas for 0
, 1
, and OfNat.ofNat n
. This is necessary in general for simp confluence. Example:
import Mathlib
variable {α : Type*} [LinearOrderedRing α] (m n : ℕ) [m.AtLeastTwo] [n.AtLeastTwo]
example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by
simp only [Nat.cast_le] -- this `@[simp]` lemma can apply
example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) := by
simp only [Nat.cast_ofNat] -- and so can this one
example : (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by
simp -- fails! `simp` doesn't have a lemma to bridge their results. confluence issue.
As far as I know, the only file this PR leaves with ofNat
gaps is PartENat.lean
. #8002 is addressing that file in parallel.
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -152,7 +152,7 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
-- and `lucas_lehmer_residue p = 0 → 2^p - 1 ∣ s_mod p (p-2)`.
intro h
simp? [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h says
- simp only [ZMod.int_cast_zmod_eq_zero_iff_dvd, gt_iff_lt, zero_lt_two, pow_pos, cast_pred,
+ simp only [ZMod.int_cast_zmod_eq_zero_iff_dvd, gt_iff_lt, ofNat_pos, pow_pos, cast_pred,
cast_pow, cast_ofNat] at h
apply Int.eq_zero_of_dvd_of_nonneg_of_lt _ _ h <;> clear h
· exact sMod_nonneg _ (by positivity) _
@@ -425,7 +425,7 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
dsimp [lucasLehmerResidue] at h
rw [sZMod_eq_s p'] at h
simp? [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h says
- simp only [add_tsub_cancel_right, ZMod.int_cast_zmod_eq_zero_iff_dvd, gt_iff_lt, zero_lt_two,
+ simp only [add_tsub_cancel_right, ZMod.int_cast_zmod_eq_zero_iff_dvd, gt_iff_lt, ofNat_pos,
pow_pos, cast_pred, cast_pow, cast_ofNat] at h
cases' h with k h
use k
@@ -95,7 +95,7 @@ def sMod (p : ℕ) : ℕ → ℤ
#align lucas_lehmer.s_mod LucasLehmer.sMod
theorem mersenne_int_pos {p : ℕ} (hp : p ≠ 0) : (0 : ℤ) < 2 ^ p - 1 :=
- sub_pos.2 <| mod_cast Nat.one_lt_two_pow p hp
+ sub_pos.2 <| mod_cast Nat.one_lt_two_pow hp
theorem mersenne_int_ne_zero (p : ℕ) (hp : p ≠ 0) : (2 ^ p - 1 : ℤ) ≠ 0 :=
(mersenne_int_pos hp).ne'
@@ -415,7 +415,7 @@ theorem two_lt_q (p' : ℕ) : 2 < q (p' + 2) := by
refine (minFac_prime (one_lt_mersenne ?_).ne').two_le.lt_of_ne' ?_
· exact le_add_left _ _
· rw [Ne.def, minFac_eq_two_iff, mersenne, Nat.pow_succ']
- exact Nat.two_not_dvd_two_mul_sub_one (Nat.one_le_two_pow _)
+ exact Nat.two_not_dvd_two_mul_sub_one Nat.one_le_two_pow
#align lucas_lehmer.two_lt_q LucasLehmer.two_lt_q
theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
@@ -4,7 +4,6 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Scott Morrison, Ainsley Pahljina
-/
import Mathlib.Data.Nat.Parity
-import Mathlib.Data.PNat.Interval
import Mathlib.Data.ZMod.Basic
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.RingTheory.Fintype
@@ -9,6 +9,7 @@ import Mathlib.Data.ZMod.Basic
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.RingTheory.Fintype
import Mathlib.Tactic.IntervalCases
+import Mathlib.Algebra.GroupPower.Order
#align_import number_theory.lucas_lehmer from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
bump/v4.5.0
branch. (#9188)
This PR:
v4.5.0-rc1
v4.5.0-rc1
bump/v4.5.0
branch
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -152,8 +152,8 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
-- and `lucas_lehmer_residue p = 0 → 2^p - 1 ∣ s_mod p (p-2)`.
intro h
simp? [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h says
- simp only [ge_iff_le, ZMod.int_cast_zmod_eq_zero_iff_dvd, gt_iff_lt, zero_lt_two, pow_pos,
- cast_pred, cast_pow, cast_ofNat] at h
+ simp only [ZMod.int_cast_zmod_eq_zero_iff_dvd, gt_iff_lt, zero_lt_two, pow_pos, cast_pred,
+ cast_pow, cast_ofNat] at h
apply Int.eq_zero_of_dvd_of_nonneg_of_lt _ _ h <;> clear h
· exact sMod_nonneg _ (by positivity) _
· exact sMod_lt _ (by positivity) _
@@ -425,9 +425,8 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
dsimp [lucasLehmerResidue] at h
rw [sZMod_eq_s p'] at h
simp? [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h says
- simp only [ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, add_tsub_cancel_right,
- ZMod.int_cast_zmod_eq_zero_iff_dvd, gt_iff_lt, zero_lt_two, pow_pos, cast_pred, cast_pow,
- cast_ofNat] at h
+ simp only [add_tsub_cancel_right, ZMod.int_cast_zmod_eq_zero_iff_dvd, gt_iff_lt, zero_lt_two,
+ pow_pos, cast_pred, cast_pow, cast_ofNat] at h
cases' h with k h
use k
replace h := congr_arg (fun n : ℤ => (n : X (q (p' + 2)))) h
The names for lemmas about monotonicity of (a ^ ·)
and (· ^ n)
were a mess. This PR tidies up everything related by following the naming convention for (a * ·)
and (· * b)
. Namely, (a ^ ·)
is pow_right
and (· ^ n)
is pow_left
in lemma names. All lemma renames follow the corresponding multiplication lemma names closely.
Algebra.GroupPower.Order
pow_mono
→ pow_right_mono
pow_le_pow
→ pow_le_pow_right
pow_le_pow_of_le_left
→ pow_le_pow_left
pow_lt_pow_of_lt_left
→ pow_lt_pow_left
strictMonoOn_pow
→ pow_left_strictMonoOn
pow_strictMono_right
→ pow_right_strictMono
pow_lt_pow
→ pow_lt_pow_right
pow_lt_pow_iff
→ pow_lt_pow_iff_right
pow_le_pow_iff
→ pow_le_pow_iff_right
self_lt_pow
→ lt_self_pow
strictAnti_pow
→ pow_right_strictAnti
pow_lt_pow_iff_of_lt_one
→ pow_lt_pow_iff_right_of_lt_one
pow_lt_pow_of_lt_one
→ pow_lt_pow_right_of_lt_one
lt_of_pow_lt_pow
→ lt_of_pow_lt_pow_left
le_of_pow_le_pow
→ le_of_pow_le_pow_left
pow_lt_pow₀
→ pow_lt_pow_right₀
Algebra.GroupPower.CovariantClass
pow_le_pow_of_le_left'
→ pow_le_pow_left'
nsmul_le_nsmul_of_le_right
→ nsmul_le_nsmul_right
pow_lt_pow'
→ pow_lt_pow_right'
nsmul_lt_nsmul
→ nsmul_lt_nsmul_left
pow_strictMono_left
→ pow_right_strictMono'
nsmul_strictMono_right
→ nsmul_left_strictMono
StrictMono.pow_right'
→ StrictMono.pow_const
StrictMono.nsmul_left
→ StrictMono.const_nsmul
pow_strictMono_right'
→ pow_left_strictMono
nsmul_strictMono_left
→ nsmul_right_strictMono
Monotone.pow_right
→ Monotone.pow_const
Monotone.nsmul_left
→ Monotone.const_nsmul
lt_of_pow_lt_pow'
→ lt_of_pow_lt_pow_left'
lt_of_nsmul_lt_nsmul
→ lt_of_nsmul_lt_nsmul_right
pow_le_pow'
→ pow_le_pow_right'
nsmul_le_nsmul
→ nsmul_le_nsmul_left
pow_le_pow_of_le_one'
→ pow_le_pow_right_of_le_one'
nsmul_le_nsmul_of_nonpos
→ nsmul_le_nsmul_left_of_nonpos
le_of_pow_le_pow'
→ le_of_pow_le_pow_left'
le_of_nsmul_le_nsmul'
→ le_of_nsmul_le_nsmul_right'
pow_le_pow_iff'
→ pow_le_pow_iff_right'
nsmul_le_nsmul_iff
→ nsmul_le_nsmul_iff_left
pow_lt_pow_iff'
→ pow_lt_pow_iff_right'
nsmul_lt_nsmul_iff
→ nsmul_lt_nsmul_iff_left
Data.Nat.Pow
Nat.pow_lt_pow_of_lt_left
→ Nat.pow_lt_pow_left
Nat.pow_le_iff_le_left
→ Nat.pow_le_pow_iff_left
Nat.pow_lt_iff_lt_left
→ Nat.pow_lt_pow_iff_left
pow_le_pow_iff_left
pow_lt_pow_iff_left
pow_right_injective
pow_right_inj
Nat.pow_le_pow_left
to have the correct name since Nat.pow_le_pow_of_le_left
is in Std.Nat.pow_le_pow_right
to have the correct name since Nat.pow_le_pow_of_le_right
is in Std.self_le_pow
was a duplicate of le_self_pow
.Nat.pow_lt_pow_of_lt_right
is defeq to pow_lt_pow_right
.Nat.pow_right_strictMono
is defeq to pow_right_strictMono
.Nat.pow_le_iff_le_right
is defeq to pow_le_pow_iff_right
.Nat.pow_lt_iff_lt_right
is defeq to pow_lt_pow_iff_right
.0 < n
or 1 ≤ n
to n ≠ 0
.Nat
lemmas have been protected
.@@ -53,7 +53,7 @@ theorem mersenne_pos {p : ℕ} (h : 0 < p) : 0 < mersenne p := by
theorem one_lt_mersenne {p : ℕ} (hp : 1 < p) : 1 < mersenne p :=
lt_tsub_iff_right.2 <|
calc 1 + 1 = 2 ^ 1 := by rw [one_add_one_eq_two, pow_one]
- _ < 2 ^ p := Nat.pow_lt_pow_of_lt_right one_lt_two hp
+ _ < 2 ^ p := pow_lt_pow_right one_lt_two hp
@[simp]
theorem succ_mersenne (k : ℕ) : mersenne k + 1 = 2 ^ k := by
@@ -94,27 +94,27 @@ def sMod (p : ℕ) : ℕ → ℤ
| i + 1 => (sMod p i ^ 2 - 2) % (2 ^ p - 1)
#align lucas_lehmer.s_mod LucasLehmer.sMod
-theorem mersenne_int_pos {p : ℕ} (hp : 0 < p) : (0 : ℤ) < 2 ^ p - 1 :=
+theorem mersenne_int_pos {p : ℕ} (hp : p ≠ 0) : (0 : ℤ) < 2 ^ p - 1 :=
sub_pos.2 <| mod_cast Nat.one_lt_two_pow p hp
-theorem mersenne_int_ne_zero (p : ℕ) (w : 0 < p) : (2 ^ p - 1 : ℤ) ≠ 0 :=
- (mersenne_int_pos w).ne'
+theorem mersenne_int_ne_zero (p : ℕ) (hp : p ≠ 0) : (2 ^ p - 1 : ℤ) ≠ 0 :=
+ (mersenne_int_pos hp).ne'
#align lucas_lehmer.mersenne_int_ne_zero LucasLehmer.mersenne_int_ne_zero
-theorem sMod_nonneg (p : ℕ) (w : 0 < p) (i : ℕ) : 0 ≤ sMod p i := by
+theorem sMod_nonneg (p : ℕ) (hp : p ≠ 0) (i : ℕ) : 0 ≤ sMod p i := by
cases i <;> dsimp [sMod]
· exact sup_eq_right.mp rfl
· apply Int.emod_nonneg
- exact mersenne_int_ne_zero p w
+ exact mersenne_int_ne_zero p hp
#align lucas_lehmer.s_mod_nonneg LucasLehmer.sMod_nonneg
theorem sMod_mod (p i : ℕ) : sMod p i % (2 ^ p - 1) = sMod p i := by cases i <;> simp [sMod]
#align lucas_lehmer.s_mod_mod LucasLehmer.sMod_mod
-theorem sMod_lt (p : ℕ) (w : 0 < p) (i : ℕ) : sMod p i < 2 ^ p - 1 := by
+theorem sMod_lt (p : ℕ) (hp : p ≠ 0) (i : ℕ) : sMod p i < 2 ^ p - 1 := by
rw [← sMod_mod]
- refine (Int.emod_lt _ (mersenne_int_ne_zero p w)).trans_eq ?_
- exact abs_of_nonneg (mersenne_int_pos w).le
+ refine (Int.emod_lt _ (mersenne_int_ne_zero p hp)).trans_eq ?_
+ exact abs_of_nonneg (mersenne_int_pos hp).le
#align lucas_lehmer.s_mod_lt LucasLehmer.sMod_lt
theorem sZMod_eq_s (p' : ℕ) (i : ℕ) : sZMod (p' + 2) i = (s i : ZMod (2 ^ (p' + 2) - 1)) := by
@@ -155,8 +155,8 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
simp only [ge_iff_le, ZMod.int_cast_zmod_eq_zero_iff_dvd, gt_iff_lt, zero_lt_two, pow_pos,
cast_pred, cast_pow, cast_ofNat] at h
apply Int.eq_zero_of_dvd_of_nonneg_of_lt _ _ h <;> clear h
- · apply sMod_nonneg _ (Nat.lt_of_succ_lt w)
- · exact sMod_lt _ (Nat.lt_of_succ_lt w) (p - 2)
+ · exact sMod_nonneg _ (by positivity) _
+ · exact sMod_lt _ (by positivity) _
· intro h
rw [h]
simp
@@ -151,7 +151,9 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
· -- We want to use that fact that `0 ≤ s_mod p (p-2) < 2^p - 1`
-- and `lucas_lehmer_residue p = 0 → 2^p - 1 ∣ s_mod p (p-2)`.
intro h
- simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
+ simp? [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h says
+ simp only [ge_iff_le, ZMod.int_cast_zmod_eq_zero_iff_dvd, gt_iff_lt, zero_lt_two, pow_pos,
+ cast_pred, cast_pow, cast_ofNat] at h
apply Int.eq_zero_of_dvd_of_nonneg_of_lt _ _ h <;> clear h
· apply sMod_nonneg _ (Nat.lt_of_succ_lt w)
· exact sMod_lt _ (Nat.lt_of_succ_lt w) (p - 2)
@@ -422,7 +424,10 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
k * mersenne (p' + 2) * (ω : X (q (p' + 2))) ^ 2 ^ p' - 1 := by
dsimp [lucasLehmerResidue] at h
rw [sZMod_eq_s p'] at h
- simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
+ simp? [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h says
+ simp only [ge_iff_le, add_le_iff_nonpos_left, nonpos_iff_eq_zero, add_tsub_cancel_right,
+ ZMod.int_cast_zmod_eq_zero_iff_dvd, gt_iff_lt, zero_lt_two, pow_pos, cast_pred, cast_pow,
+ cast_ofNat] at h
cases' h with k h
use k
replace h := congr_arg (fun n : ℤ => (n : X (q (p' + 2)))) h
@@ -486,7 +491,7 @@ theorem order_ω (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
have ω_pow := orderOf_dvd_iff_pow_eq_one.1 o
replace ω_pow :=
congr_arg (Units.coeHom (X (q (p' + 2))) : Units (X (q (p' + 2))) → X (q (p' + 2))) ω_pow
- simp at ω_pow
+ simp? at ω_pow says simp only [map_pow, Units.coeHom_apply, ωUnit_coe, map_one] at ω_pow
have h : (1 : ZMod (q (p' + 2))) = -1 :=
congr_arg Prod.fst (ω_pow.symm.trans (ω_pow_eq_neg_one p' h))
haveI : Fact (2 < (q (p' + 2) : ℕ)) := ⟨two_lt_q _⟩
@@ -160,7 +160,7 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
simp
#align lucas_lehmer.residue_eq_zero_iff_s_mod_eq_zero LucasLehmer.residue_eq_zero_iff_sMod_eq_zero
-/-- A Mersenne number `2^p-1` is prime if and only if
+/-- **Lucas-Lehmer Test**: a Mersenne number `2^p-1` is prime if and only if
the Lucas-Lehmer residue `s p (p-2) % (2^p - 1)` is zero.
-/
def LucasLehmerTest (p : ℕ) : Prop :=
exact_mod_cast
tactic with mod_cast
elaborator where possible (#8404)
We still have the exact_mod_cast
tactic, used in a few places, which somehow (?) works a little bit harder to prevent the expected type influencing the elaboration of the term. I would like to get to the bottom of this, and it will be easier once the only usages of exact_mod_cast
are the ones that don't work using the term elaborator by itself.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -95,7 +95,7 @@ def sMod (p : ℕ) : ℕ → ℤ
#align lucas_lehmer.s_mod LucasLehmer.sMod
theorem mersenne_int_pos {p : ℕ} (hp : 0 < p) : (0 : ℤ) < 2 ^ p - 1 :=
- sub_pos.2 <| by exact_mod_cast Nat.one_lt_two_pow p hp
+ sub_pos.2 <| mod_cast Nat.one_lt_two_pow p hp
theorem mersenne_int_ne_zero (p : ℕ) (w : 0 < p) : (2 ^ p - 1 : ℤ) ≠ 0 :=
(mersenne_int_pos w).ne'
@@ -437,7 +437,7 @@ theorem ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
rw [mul_comm _ (k : X (q (p' + 2)))] at h
replace h := eq_sub_of_add_eq h
have : 1 ≤ 2 ^ (p' + 2) := Nat.one_le_pow _ _ (by decide)
- exact_mod_cast h
+ exact mod_cast h
#align lucas_lehmer.ω_pow_formula LucasLehmer.ω_pow_formula
/-- `q` is the minimum factor of `mersenne p`, so `M p = 0` in `X q`. -/
@@ -282,10 +282,12 @@ set_option linter.uppercaseLean3 false in
set_option linter.uppercaseLean3 false in
#align lucas_lehmer.X.nat_coe_snd LucasLehmer.X.nat_coe_snd
+-- See note [no_index around OfNat.ofNat]
@[simp] theorem ofNat_fst (n : ℕ) [n.AtLeastTwo] :
(no_index (OfNat.ofNat n) : X q).fst = OfNat.ofNat n :=
rfl
+-- See note [no_index around OfNat.ofNat]
@[simp] theorem ofNat_snd (n : ℕ) [n.AtLeastTwo] :
(no_index (OfNat.ofNat n) : X q).snd = 0 :=
rfl
@@ -2,11 +2,6 @@
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Scott Morrison, Ainsley Pahljina
-
-! This file was ported from Lean 3 source module number_theory.lucas_lehmer
-! leanprover-community/mathlib commit 10b4e499f43088dd3bb7b5796184ad5216648ab1
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Nat.Parity
import Mathlib.Data.PNat.Interval
@@ -15,6 +10,8 @@ import Mathlib.GroupTheory.OrderOfElement
import Mathlib.RingTheory.Fintype
import Mathlib.Tactic.IntervalCases
+#align_import number_theory.lucas_lehmer from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
+
/-!
# The Lucas-Lehmer test for Mersenne primes.
@@ -596,8 +596,7 @@ theorem isNat_not_lucasLehmerTest : {p np : ℕ} →
@[norm_num LucasLehmer.LucasLehmerTest (_ : ℕ)]
def evalLucasLehmerTest : NormNumExt where eval {u α} e := do
let .app _ (p : Q(ℕ)) ← Meta.whnfR e | failure
- let sℕ : Q(AddMonoidWithOne ℕ) := q(instAddMonoidWithOneNat)
- let ⟨ep, hp⟩ ← deriveNat p
+ let ⟨ep, hp⟩ ← deriveNat p _
let np := ep.natLit!
unless 1 < np do
failure
This update removes the infamous "incompatible metavariable" error.
@@ -601,14 +601,14 @@ def evalLucasLehmerTest : NormNumExt where eval {u α} e := do
let np := ep.natLit!
unless 1 < np do
failure
- have h1ltp : Q(Nat.blt 1 $ep) := (q(Eq.refl true) : Expr)
+ haveI' h1ltp : Nat.blt 1 $ep =Q true := ⟨⟩
if sMod' (2 ^ np - 1) (np - 2) = 0 then
- have hs : Q(sMod' (2 ^ $ep - 1) ($ep - 2) = 0) := (q(Eq.refl 0) : Expr)
+ haveI' hs : sMod' (2 ^ $ep - 1) ($ep - 2) =Q 0 := ⟨⟩
have pf : Q(LucasLehmerTest $ep) := q(testTrueHelper $ep $h1ltp $hs)
have pf' : Q(LucasLehmerTest $p) := q(isNat_lucasLehmerTest $hp $pf)
return .isTrue pf'
else
- have hs : Q(Nat.ble 1 (sMod' (2 ^ $ep - 1) ($ep - 2)) = true) := (q(Eq.refl true) : Expr)
+ haveI' hs : Nat.ble 1 (sMod' (2 ^ $ep - 1) ($ep - 2)) =Q true := ⟨⟩
have pf : Q(¬ LucasLehmerTest $ep) := q(testFalseHelper $ep $h1ltp $hs)
have pf' : Q(¬ LucasLehmerTest $p) := q(isNat_not_lucasLehmerTest $hp $pf)
return .isFalse pf'
Co-authored-by: Komyyy <pol_tta@outlook.jp> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@@ -285,8 +285,13 @@ set_option linter.uppercaseLean3 false in
set_option linter.uppercaseLean3 false in
#align lucas_lehmer.X.nat_coe_snd LucasLehmer.X.nat_coe_snd
-@[simp] theorem ofNat_fst (n : ℕ) [n.AtLeastTwo] : (OfNat.ofNat n : X q).fst = OfNat.ofNat n := rfl
-@[simp] theorem ofNat_snd (n : ℕ) [n.AtLeastTwo] : (OfNat.ofNat n : X q).snd = 0 := rfl
+@[simp] theorem ofNat_fst (n : ℕ) [n.AtLeastTwo] :
+ (no_index (OfNat.ofNat n) : X q).fst = OfNat.ofNat n :=
+ rfl
+
+@[simp] theorem ofNat_snd (n : ℕ) [n.AtLeastTwo] :
+ (no_index (OfNat.ofNat n) : X q).snd = 0 :=
+ rfl
instance : AddGroupWithOne (X q) :=
{ inferInstanceAs (Monoid (X q)), inferInstanceAs (AddCommGroup (X q)),
@@ -21,10 +21,8 @@ import Mathlib.Tactic.IntervalCases
We define `lucasLehmerResidue : Π p : ℕ, ZMod (2^p - 1)`, and
prove `lucasLehmerResidue p = 0 → Prime (mersenne p)`.
-Porting note: the tactics have not been ported yet.
-
-We construct a tactic `LucasLehmer.run_test`, which iteratively certifies the arithmetic
-required to calculate the residue, and enables us to prove
+We construct a `norm_num` extension to calculate this residue to certify primality of Mersenne
+primes using `lucas_lehmer_sufficiency`.
## TODO
@@ -38,6 +36,8 @@ required to calculate the residue, and enables us to prove
This development began as a student project by Ainsley Pahljina,
and was then cleaned up for mathlib by Scott Morrison.
The tactic for certified computation of Lucas-Lehmer residues was provided by Mario Carneiro.
+This tactic was ported by Thomas Murrills to Lean 4, and then it was converted to a `norm_num`
+extension and made to use kernel reductions by Kyle Miller.
-/
@@ -170,8 +170,12 @@ def LucasLehmerTest (p : ℕ) : Prop :=
lucasLehmerResidue p = 0
#align lucas_lehmer.lucas_lehmer_test LucasLehmer.LucasLehmerTest
+-- Porting note: We have a fast `norm_num` extension, and we would rather use that than accidentally
+-- have `simp` use `decide`!
+/-
instance : DecidablePred LucasLehmerTest :=
inferInstanceAs (DecidablePred (lucasLehmerResidue · = 0))
+-/
/-- `q` is defined as the minimum factor of `mersenne p`, bundled as an `ℕ+`. -/
def q (p : ℕ) : ℕ+ :=
@@ -517,71 +521,105 @@ theorem lucas_lehmer_sufficiency (p : ℕ) (w : 1 < p) : LucasLehmerTest p → (
exact not_lt_of_ge (Nat.sub_le _ _) h
#align lucas_lehmer_sufficiency lucas_lehmer_sufficiency
--- Here we calculate the residue, very inefficiently, using `dec_trivial`. We can do much better.
-example : (mersenne 5).Prime :=
- lucas_lehmer_sufficiency 5 (by norm_num) (by decide)
-
--- Next we use `norm_num` to calculate each `s p i`.
namespace LucasLehmer
-open Tactic
+/-!
+### `norm_num` extension
+
+Next we define a `norm_num` extension that calculates `LucasLehmerTest p` for `1 < p`.
+It makes use of a version of `sMod` that is specifically written to be reducible by the
+Lean 4 kernel, which has the capability of efficiently reducing natural number expressions.
+With this reduction in hand, it's a simple matter of applying the lemma
+`LucasLehmer.residue_eq_zero_iff_sMod_eq_zero`.
+
+See [Archive/Examples/MersennePrimes.lean] for certifications of all Mersenne primes
+up through `mersenne 4423`.
+-/
-theorem sMod_succ {p a i b c} (h1 : (2 ^ p - 1 : ℤ) = a) (h2 : sMod p i = b)
- (h3 : (b * b - 2) % a = c) : sMod p (i + 1) = c := by
- substs a b c
- rw [← sq]
+namespace norm_num_ext
+open Qq Lean Elab.Tactic Mathlib.Meta.NormNum
+
+/-- Version of `sMod` that is `ℕ`-valued. One should have `q = 2 ^ p - 1`.
+This can be reduced by the kernel. -/
+def sMod' (q : ℕ) : ℕ → ℕ
+ | 0 => 4 % q
+ | i + 1 => (sMod' q i ^ 2 + (q - 2)) % q
+
+theorem sMod'_eq_sMod (p k : ℕ) (hp : 2 ≤ p) : (sMod' (2 ^ p - 1) k : ℤ) = sMod p k := by
+ have h1 := calc
+ 4 = 2 ^ 2 := by norm_num
+ _ ≤ 2 ^ p := Nat.pow_le_pow_of_le_right (by norm_num) hp
+ have h2 : 1 ≤ 2 ^ p := by linarith
+ induction k with
+ | zero =>
+ rw [sMod', sMod, Int.ofNat_emod]
+ simp [h2]
+ | succ k ih =>
+ rw [sMod', sMod, ← ih]
+ have h3 : 2 ≤ 2 ^ p - 1 := by
+ zify [h2]
+ calc
+ (2 : Int) ≤ 4 - 1 := by norm_num
+ _ ≤ 2 ^ p - 1 := by zify at h1; exact Int.sub_le_sub_right h1 _
+ zify [h2, h3]
+ rw [← add_sub_assoc, sub_eq_add_neg, add_assoc, add_comm _ (-2), ← add_assoc,
+ Int.add_emod_self, ← sub_eq_add_neg]
+
+lemma testTrueHelper (p : ℕ) (hp : Nat.blt 1 p = true) (h : sMod' (2 ^ p - 1) (p - 2) = 0) :
+ LucasLehmerTest p := by
+ rw [Nat.blt_eq] at hp
+ rw [LucasLehmerTest, LucasLehmer.residue_eq_zero_iff_sMod_eq_zero p hp, ← sMod'_eq_sMod p _ hp, h]
rfl
-#align lucas_lehmer.s_mod_succ LucasLehmer.sMod_succ
-
--- /- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
--- /- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
--- /- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
--- /-- Given a goal of the form `lucas_lehmer_test p`,
--- attempt to do the calculation using `norm_num` to certify each step.
--- -/
--- unsafe def run_test : tactic Unit := do
--- let q(LucasLehmerTest $(p)) ← target
--- sorry
--- sorry
--- let p ← eval_expr ℕ p
--- let-- Calculate the candidate Mersenne prime
--- M : ℤ := 2 ^ p - 1
--- let t ← to_expr ``(2 ^ $(q(p)) - 1 = $(q(M)))
--- let v ← to_expr ``((by norm_num : 2 ^ $(q(p)) - 1 = $(q(M))))
--- let w ← assertv `w t v
--- let t
--- ←-- base case
--- to_expr
--- ``(sMod $(q(p)) 0 = 4)
--- let v ← to_expr ``((by norm_num [LucasLehmer.sMod] : sMod $(q(p)) 0 = 4))
--- let h ← assertv `h t v
--- -- step case, repeated p-2 times
--- iterate_exactly
--- (p - 2) sorry
--- let h
--- ←-- now close the goal
--- get_local
--- `h
--- exact h
--- #align lucas_lehmer.run_test lucas_lehmer.run_test
-end LucasLehmer
+lemma testFalseHelper (p : ℕ) (hp : Nat.blt 1 p = true)
+ (h : Nat.ble 1 (sMod' (2 ^ p - 1) (p - 2))) : ¬ LucasLehmerTest p := by
+ rw [Nat.blt_eq] at hp
+ rw [Nat.ble_eq, Nat.succ_le, Nat.pos_iff_ne_zero] at h
+ rw [LucasLehmerTest, LucasLehmer.residue_eq_zero_iff_sMod_eq_zero p hp, ← sMod'_eq_sMod p _ hp]
+ simpa using h
+
+theorem isNat_lucasLehmerTest : {p np : ℕ} →
+ IsNat p np → LucasLehmerTest np → LucasLehmerTest p
+ | _, _, ⟨rfl⟩, h => h
+
+theorem isNat_not_lucasLehmerTest : {p np : ℕ} →
+ IsNat p np → ¬ LucasLehmerTest np → ¬ LucasLehmerTest p
+ | _, _, ⟨rfl⟩, h => h
+
+/-- Calculate `LucasLehmer.LucasLehmerTest p` for `2 ≤ p` by using kernel reduction for the
+`sMod'` function. -/
+@[norm_num LucasLehmer.LucasLehmerTest (_ : ℕ)]
+def evalLucasLehmerTest : NormNumExt where eval {u α} e := do
+ let .app _ (p : Q(ℕ)) ← Meta.whnfR e | failure
+ let sℕ : Q(AddMonoidWithOne ℕ) := q(instAddMonoidWithOneNat)
+ let ⟨ep, hp⟩ ← deriveNat p
+ let np := ep.natLit!
+ unless 1 < np do
+ failure
+ have h1ltp : Q(Nat.blt 1 $ep) := (q(Eq.refl true) : Expr)
+ if sMod' (2 ^ np - 1) (np - 2) = 0 then
+ have hs : Q(sMod' (2 ^ $ep - 1) ($ep - 2) = 0) := (q(Eq.refl 0) : Expr)
+ have pf : Q(LucasLehmerTest $ep) := q(testTrueHelper $ep $h1ltp $hs)
+ have pf' : Q(LucasLehmerTest $p) := q(isNat_lucasLehmerTest $hp $pf)
+ return .isTrue pf'
+ else
+ have hs : Q(Nat.ble 1 (sMod' (2 ^ $ep - 1) ($ep - 2)) = true) := (q(Eq.refl true) : Expr)
+ have pf : Q(¬ LucasLehmerTest $ep) := q(testFalseHelper $ep $h1ltp $hs)
+ have pf' : Q(¬ LucasLehmerTest $p) := q(isNat_not_lucasLehmerTest $hp $pf)
+ return .isFalse pf'
+
+end norm_num_ext
--- /-- We verify that the tactic works to prove `127.prime`. -/
--- example : (mersenne 7).Prime :=
--- lucas_lehmer_sufficiency _ (by norm_num)
--- (by
--- run_tac
--- lucas_lehmer.run_test)
+end LucasLehmer
/-!
-This implementation works successfully to prove `(2^127 - 1).prime`,
-and all the Mersenne primes up to this point appear in [archive/examples/mersenne_primes.lean].
+This implementation works successfully to prove `(2^4423 - 1).Prime`,
+and all the Mersenne primes up to this point appear in [Archive/Examples/MersennePrimes.lean].
+These can be calculated nearly instantly, and `(2^9689 - 1).Prime` only fails due to deep
+recursion.
-`(2^127 - 1).prime` takes about 5 minutes to run (depending on your CPU!),
-and unfortunately the next Mersenne prime `(2^521 - 1)`,
-which was the first "computer era" prime,
-is out of reach with the current implementation.
+(Note by kmill: the following notes were for the Lean 3 version. They seem like they could still
+be useful, so I'm leaving them here.)
There's still low hanging fruit available to do faster computations
based on the formula
fix-comments.py
on all files.@@ -18,7 +18,7 @@ import Mathlib.Tactic.IntervalCases
/-!
# The Lucas-Lehmer test for Mersenne primes.
-We define `lucasLehmerResidue : Π p : ℕ, zmod (2^p - 1)`, and
+We define `lucasLehmerResidue : Π p : ℕ, ZMod (2^p - 1)`, and
prove `lucasLehmerResidue p = 0 → Prime (mersenne p)`.
Porting note: the tactics have not been ported yet.
@@ -85,7 +85,7 @@ def s : ℕ → ℤ
| i + 1 => s i ^ 2 - 2
#align lucas_lehmer.s LucasLehmer.s
-/-- The recurrence `s (i+1) = (s i)^2 - 2` in `zmod (2^p - 1)`. -/
+/-- The recurrence `s (i+1) = (s i)^2 - 2` in `ZMod (2^p - 1)`. -/
def sZMod (p : ℕ) : ℕ → ZMod (2 ^ p - 1)
| 0 => 4
| i + 1 => sZMod p i ^ 2 - 2
@@ -19,7 +19,7 @@ import Mathlib.Tactic.IntervalCases
# The Lucas-Lehmer test for Mersenne primes.
We define `lucasLehmerResidue : Π p : ℕ, zmod (2^p - 1)`, and
-prove `lucasLehmerResidue p = 0 → prime (mersenne p)`.
+prove `lucasLehmerResidue p = 0 → Prime (mersenne p)`.
Porting note: the tactics have not been ported yet.
@@ -72,7 +72,7 @@ open Nat
We now define three(!) different versions of the recurrence
`s (i+1) = (s i)^2 - 2`.
-These versions take values either in `ℤ`, in `zmod (2^p - 1)`, or
+These versions take values either in `ℤ`, in `ZMod (2^p - 1)`, or
in `ℤ` but applying `% (2^p - 1)` at each step.
They are each useful at different points in the proof,
@@ -141,7 +141,7 @@ theorem sZMod_eq_sMod (p : ℕ) (i : ℕ) : sZMod p i = (sMod p i : ZMod (2 ^ p
induction i <;> push_cast [← Int.coe_nat_two_pow_pred p, sMod, sZMod, *] <;> rfl
#align lucas_lehmer.s_zmod_eq_s_mod LucasLehmer.sZMod_eq_sMod
-/-- The Lucas-Lehmer residue is `s p (p-2)` in `zmod (2^p - 1)`. -/
+/-- The Lucas-Lehmer residue is `s p (p-2)` in `ZMod (2^p - 1)`. -/
def lucasLehmerResidue (p : ℕ) : ZMod (2 ^ p - 1) :=
sZMod p (p - 2)
#align lucas_lehmer.lucas_lehmer_residue LucasLehmer.lucasLehmerResidue
@@ -156,8 +156,8 @@ theorem residue_eq_zero_iff_sMod_eq_zero (p : ℕ) (w : 1 < p) :
intro h
simp [ZMod.int_cast_zmod_eq_zero_iff_dvd] at h
apply Int.eq_zero_of_dvd_of_nonneg_of_lt _ _ h <;> clear h
- apply sMod_nonneg _ (Nat.lt_of_succ_lt w)
- exact sMod_lt _ (Nat.lt_of_succ_lt w) (p - 2)
+ · apply sMod_nonneg _ (Nat.lt_of_succ_lt w)
+ · exact sMod_lt _ (Nat.lt_of_succ_lt w) (p - 2)
· intro h
rw [h]
simp
@@ -286,7 +286,7 @@ set_option linter.uppercaseLean3 false in
instance : AddGroupWithOne (X q) :=
{ inferInstanceAs (Monoid (X q)), inferInstanceAs (AddCommGroup (X q)),
- inferInstanceAs (NatCast (X q))with
+ inferInstanceAs (NatCast (X q)) with
natCast_zero := by ext <;> simp
natCast_succ := fun _ ↦ by ext <;> simp
intCast := fun n => ⟨n, 0⟩
The unported dependencies are