Skip to content

Commit ac922f1

Browse files
committed
add references to mathlib
1 parent d2e2040 commit ac922f1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

HumanEvalLean/HumanEval75.lean

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ example : isMultiplyPrime (11 * 13 * 7) = true := by native_decide
5353

5454
-- Section: Is prime
5555

56+
-- https://leanprover-community.github.io/mathlib4_docs/Mathlib/Data/Nat/Prime/Defs.html#Nat.Prime
5657
def Nat.Prime (n : Nat) : Prop :=
5758
n > 1 ∧ ∀ m, m ∣ n → m = 1 ∨ m = n
5859

60+
-- https://leanprover-community.github.io/mathlib4_docs/Mathlib/Algebra/Prime/Defs.html#Prime.ne_zero
5961
theorem Nat.Prime.ne_zero (hp : Prime p) : p ≠ 0 := by
6062
intro h
6163
have h2 : 2 ∣ p := by simp [h]
@@ -68,6 +70,7 @@ theorem Nat.Prime.zero_lt (hp : Prime p) : 0 < p := by match p with
6870
| p + 1 => simp
6971
| 0 => simp [Prime] at hp
7072

73+
-- https://leanprover-community.github.io/mathlib4_docs/Mathlib/Data/Nat/Prime/Defs.html#Nat.Prime.two_le
7174
theorem Nat.Prime.two_le (hp : Prime p) : 2 ≤ p := by sorry
7275

7376
-- Section: Smallest prime factor
@@ -85,6 +88,7 @@ theorem isMultipleOfKPrimes_zero (k : Nat) : isMultipleOfKPrimes 0 k = false :=
8588
def List.prod {α} [Mul α] [One α] : List α → α :=
8689
List.foldr (· * ·) 1
8790

91+
-- https://leanprover-community.github.io/mathlib4_docs/Mathlib/Algebra/BigOperators/Ring/List.html#List.prod_ne_zero
8892
theorem List.prod_ne_zero (l : List Nat) (h : ∀ x ∈ l, x ≠ 0) : l.prod ≠ 0 := by
8993
induction l with
9094
| nil => simp [List.prod]
@@ -95,12 +99,15 @@ theorem List.prod_ne_zero (l : List Nat) (h : ∀ x ∈ l, x ≠ 0) : l.prod ≠
9599
· apply h x; simp
96100
· apply ih; intro x1 hx; apply h; simp [hx]
97101

102+
-- https://leanprover-community.github.io/mathlib4_docs/Mathlib/Algebra/BigOperators/Group/List/Defs.html#List.prod_nil
98103
theorem List.prod_nil {α} [Mul α] [One α] : ([] : List α).prod = 1 :=
99104
rfl
100105

106+
-- https://leanprover-community.github.io/mathlib4_docs/Mathlib/Algebra/BigOperators/Group/List/Defs.html#List.prod_cons
101107
theorem List.prod_cons (a : α) (l : List α) [Mul α] [One α] : (a :: l).prod = a * l.prod := by
102108
simp [List.prod]
103109

110+
-- https://leanprover-community.github.io/mathlib4_docs/Mathlib/Algebra/BigOperators/Group/List/Lemmas.html#List.dvd_prod
104111
theorem List.dvd_prod {l : List Nat} {n : Nat} (h : n ∈ l) : n ∣ l.prod := by
105112
induction l with
106113
| nil => contradiction
@@ -116,6 +123,7 @@ theorem List.dvd_prod {l : List Nat} {n : Nat} (h : n ∈ l) : n ∣ l.prod := b
116123
simp
117124
exact Nat.dvd_mul_left_of_dvd (ih ht) head
118125

126+
-- https://leanprover-community.github.io/mathlib4_docs/Mathlib/Algebra/BigOperators/Group/List/Basic.html#List.prod_erase
119127
theorem List.prod_erase (l : List Nat) (p : Nat) (h : p ∈ l) (h1 : 0 < p) : (l.erase p).prod = l.prod / p := by
120128
induction l with
121129
| nil => contradiction
@@ -333,7 +341,6 @@ theorem isMultiplyPrime_correct : IsMultiplyPrimeIff isMultiplyPrime := by
333341
rw [PrimeDecomposition.length_three a]
334342
simp [isMultiplyPrime, isMultipleOfKPrimes_iff_primeDecomposition_length]
335343

336-
337344
/-!
338345
## Prompt
339346

0 commit comments

Comments
 (0)