declaration stringlengths 27 11.3k | file stringlengths 52 114 | context dict | tactic_states listlengths 1 1.24k |
|---|---|---|---|
theorem Nat.Prime.sq_add_sq' {p : ℕ} [h : Fact p.Prime] (hp : p % 4 = 1) :
∃ a b : ℕ, a ^ 2 + b ^ 2 = p := by
rw [← div_add_mod p 4] at h ⊢
rw [hp] at h ⊢
let k := p / 4
apply sq_add_sq_of_nonempty_fixedPoints
have key := (Equiv.Perm.card_fixedPoints_modEq (p := 2) (n := 1) (obvInvo_sq k)).symm.trans
(Equiv.Perm.card_fixedPoints_modEq (p := 2) (n := 1) (complexInvo_sq k))
contrapose key
rw [Set.not_nonempty_iff_eq_empty] at key
simp_rw [k, key, Fintype.card_eq_zero, card_fixedPoints_eq_one]
decide | /root/DuelModelResearch/mathlib4/Archive/ZagierTwoSquares.lean | {
"open": [
"Set",
"Function",
"Zagier"
],
"variables": [
"(k : ℕ) [hk : Fact (4 * k + 1).Prime]",
"(k : ℕ)",
"[hk : Fact (4 * k + 1).Prime]"
]
} | [
{
"line": "rw [← div_add_mod p 4] at h ⊢",
"before_state": "p : ℕ\nh : Fact (Prime p)\nhp : p % 4 = 1\n⊢ ∃ a b, a ^ 2 + b ^ 2 = p",
"after_state": "p : ℕ\nh : Fact (Prime (4 * (p / 4) + p % 4))\nhp : p % 4 = 1\n⊢ ∃ a b, a ^ 2 + b ^ 2 = 4 * (p / 4) + p % 4"
},
{
"line": "rewrite [← div_add_mod p ... |
example : ¬ LucasLehmerTest 2 := by norm_num
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ ¬LucasLehmerTest 2",
"after_state": "No Goals!"
}
] |
example : (mersenne 2).Prime := by decide
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "decide",
"before_state": "⊢ Nat.Prime (mersenne 2)",
"after_state": "No Goals!"
}
] |
example : (mersenne 3).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 3",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 3",
"after_state": "No Goals!"
}
] |
example : (mersenne 5).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 5",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 5",
"after_state": "No Goals!"
}
] |
example : (mersenne 7).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 7",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 7",
"after_state": "No Goals!"
}
] |
example : (mersenne 13).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 13",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 13",
"after_state": "No Goals!"
}
] |
example : (mersenne 17).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 17",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 17",
"after_state": "No Goals!"
}
] |
example : (mersenne 19).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 19",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 19",
"after_state": "No Goals!"
}
] |
example : (mersenne 31).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 31",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 31",
"after_state": "No Goals!"
}
] |
example : (mersenne 61).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 61",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 61",
"after_state": "No Goals!"
}
] |
example : (mersenne 89).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 89",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 89",
"after_state": "No Goals!"
}
] |
example : (mersenne 107).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 107",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 107",
"after_state": "No Goals!"
}
] |
example : (mersenne 127).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 127",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 127",
"after_state": "No Goals!"
}
] |
example : (mersenne 521).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 521",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 521",
"after_state": "No Goals!"
}
] |
example : (mersenne 607).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 607",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 607",
"after_state": "No Goals!"
}
] |
example : (mersenne 1279).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 1279",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 1279",
"after_state": "No Goals!"
}
] |
example : (mersenne 2203).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 2203",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 2203",
"after_state": "No Goals!"
}
] |
example : (mersenne 2281).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 2281",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 2281",
"after_state": "No Goals!"
}
] |
example : (mersenne 3217).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 3217",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 3217",
"after_state": "No Goals!"
}
] |
example : (mersenne 4253).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 4253",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 4253",
"after_state": "No Goals!"
}
] |
example : (mersenne 4423).Prime :=
lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
| /root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean | {
"open": [],
"variables": []
} | [
{
"line": "norm_num",
"before_state": "⊢ 1 < 4423",
"after_state": "No Goals!"
},
{
"line": "norm_num",
"before_state": "⊢ LucasLehmerTest 4423",
"after_state": "No Goals!"
}
] |
theorem calculation (n k : ℕ) (h1 : k ∣ 21 * n + 4) (h2 : k ∣ 14 * n + 3) : k ∣ 1 :=
have h3 : k ∣ 2 * (21 * n + 4) := h1.mul_left 2
have h4 : k ∣ 3 * (14 * n + 3) := h2.mul_left 3
have h5 : 3 * (14 * n + 3) = 2 * (21 * n + 4) + 1 := by ring
(Nat.dvd_add_right h3).mp (h5 ▸ h4)
| /root/DuelModelResearch/mathlib4/Archive/Imo/Imo1959Q1.lean | {
"open": [
"Nat"
],
"variables": []
} | [
{
"line": "ring",
"before_state": "n k : ℕ\nh1 : k ∣ 21 * n + 4\nh2 : k ∣ 14 * n + 3\nh3 : k ∣ 2 * (21 * n + 4)\nh4 : k ∣ 3 * (14 * n + 3)\n⊢ 3 * (14 * n + 3) = 2 * (21 * n + 4) + 1",
"after_state": "No Goals!"
},
{
"line": "first\n| ring1\n|\n try_this ring_nf\"\\n\\nThe `ring` tactic failed t... |
theorem Imo1961Q3 {n : ℕ} {x : ℝ} (h₀ : n ≠ 0) :
(cos x) ^ n - (sin x) ^ n = 1 ↔
(∃ k : ℤ, k * π = x) ∧ Even n ∨ (∃ k : ℤ, k * (2 * π) = x) ∧ Odd n ∨
(∃ k : ℤ, -(π / 2) + k * (2 * π) = x) ∧ Odd n := by
constructor
· intro h
rcases eq_or_ne (sin x) 0 with hsinx | hsinx
· rw [hsinx, zero_pow h₀, sub_zero, pow_eq_one_iff_of_ne_zero h₀, cos_eq_one_iff,
cos_eq_neg_one_iff] at h
rcases h with ⟨k, rfl⟩ | ⟨⟨k, rfl⟩, hn⟩
· cases n.even_or_odd with
| inl hn => refine .inl ⟨⟨k * 2, ?_⟩, hn⟩; simp [mul_assoc]
| inr hn => exact .inr <| .inl ⟨⟨_, rfl⟩, hn⟩
· exact .inl ⟨⟨2 * k + 1, by push_cast; ring⟩, hn⟩
· rcases eq_or_ne (cos x) 0 with hcosx | hcosx
· right; right
rw [hcosx] at h
rw [zero_pow h₀] at h
rw [zero_sub] at h
rw [← neg_inj] at h
rw [neg_neg] at h
rw [pow_eq_neg_one_iff] at h
rw [sin_eq_neg_one_iff] at h
simpa only [eq_comm] using h
· have hcos1 : |cos x| < 1 := by
rw [abs_cos_eq_sqrt_one_sub_sin_sq]
rw [sqrt_lt' one_pos]
simp [sq_pos_of_ne_zero hsinx]
have hsin1 : |sin x| < 1 := by
rw [abs_sin_eq_sqrt_one_sub_cos_sq]
rw [sqrt_lt' one_pos]
simp [sq_pos_of_ne_zero hcosx]
match n with
| 1 =>
rw [pow_one] at h
rw [pow_one] at h
rw [sub_eq_iff_eq_add] at h
have : 2 * sin x * cos x = 0 := by
simpa [h, add_sq, add_assoc, ← two_mul, mul_add, mul_assoc, ← sq]
using cos_sq_add_sin_sq x
simp [hsinx, hcosx] at this
| 2 =>
rw [← cos_sq_add_sin_sq x] at h
rw [sub_eq_add_neg] at h
rw [add_right_inj] at h
rw [neg_eq_self ℝ] at h
exact absurd (pow_eq_zero h) hsinx
| (n + 1 + 2) =>
set m := n + 1
refine absurd ?_ h.not_lt
calc
(cos x) ^ (m + 2) - (sin x) ^ (m + 2) ≤ |cos x| ^ (m + 2) + |sin x| ^ (m + 2) := by
simp only [← abs_pow]
simp only [sub_eq_add_neg]
gcongr
exacts [le_abs_self _, neg_le_abs _]
_ = |cos x| ^ m * cos x ^ 2 + |sin x| ^ m * sin x ^ 2 := by simp [pow_add]
_ < 1 ^ m * cos x ^ 2 + 1 ^ m * sin x ^ 2 := by gcongr
_ = 1 := by simp
· rintro (⟨⟨k, rfl⟩, hn⟩ | ⟨⟨k, rfl⟩, -⟩ | ⟨⟨k, rfl⟩, hn⟩)
· rw [sin_int_mul_pi, zero_pow h₀, sub_zero, ← hn.pow_abs, abs_cos_int_mul_pi, one_pow]
· have : sin (k * (2 * π)) = 0 := by simpa [mul_assoc] using sin_int_mul_pi (k * 2)
simp [h₀, this]
· simp [hn.neg_pow, h₀] | /root/DuelModelResearch/mathlib4/Archive/Imo/Imo1961Q3.lean | {
"open": [
"Real"
],
"variables": []
} | [
{
"line": "constructor",
"before_state": "n : ℕ\nx : ℝ\nh₀ : n ≠ 0\n⊢ cos x ^ n - sin x ^ n = 1 ↔\n (∃ k, ↑k * π = x) ∧ Even n ∨ (∃ k, ↑k * (2 * π) = x) ∧ Odd n ∨ (∃ k, -(π / 2) + ↑k * (2 * π) = x) ∧ Odd n",
"after_state": "case mp\nn : ℕ\nx : ℝ\nh₀ : n ≠ 0\n⊢ cos x ^ n - sin x ^ n = 1 →\n (∃ k, ↑... |
theorem solve_cos2_half {x : ℝ} : cos x ^ 2 = 1 / 2 ↔ ∃ k : ℤ, x = (2 * ↑k + 1) * π / 4 := by
rw [cos_sq]
simp only [add_eq_left]
simp only [div_eq_zero_iff]
norm_num
rw [cos_eq_zero_iff]
constructor <;>
· rintro ⟨k, h⟩
use k
linarith
| /root/DuelModelResearch/mathlib4/Archive/Imo/Imo1962Q4.lean | {
"open": [
"Real",
"scoped Real"
],
"variables": []
} | [
{
"line": "rw [cos_sq]",
"before_state": "x : ℝ\n⊢ cos x ^ 2 = 1 / 2 ↔ ∃ k, x = (2 * ↑k + 1) * π / 4",
"after_state": "x : ℝ\n⊢ 1 / 2 + cos (2 * x) / 2 = 1 / 2 ↔ ∃ k, x = (2 * ↑k + 1) * π / 4"
},
{
"line": "rewrite [cos_sq]",
"before_state": "x : ℝ\n⊢ cos x ^ 2 = 1 / 2 ↔ ∃ k, x = (2 * ↑k + 1... |
theorem solve_cos3x_0 {x : ℝ} : cos (3 * x) = 0 ↔ ∃ k : ℤ, x = (2 * ↑k + 1) * π / 6 := by
rw [cos_eq_zero_iff]
refine exists_congr fun k => ?_
constructor <;> intro <;> linarith
| /root/DuelModelResearch/mathlib4/Archive/Imo/Imo1962Q4.lean | {
"open": [
"Real",
"scoped Real"
],
"variables": []
} | [
{
"line": "rw [cos_eq_zero_iff]",
"before_state": "x : ℝ\n⊢ cos (3 * x) = 0 ↔ ∃ k, x = (2 * ↑k + 1) * π / 6",
"after_state": "x : ℝ\n⊢ (∃ k, 3 * x = (2 * ↑k + 1) * π / 2) ↔ ∃ k, x = (2 * ↑k + 1) * π / 6"
},
{
"line": "rewrite [cos_eq_zero_iff]",
"before_state": "x : ℝ\n⊢ cos (3 * x) = 0 ↔ ∃ ... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 14