@@ -105,6 +105,8 @@ set_option maxRecDepth 8000 in
105
105
example : Nat.Prime (2 ^ 25 - 39 ) := by norm_num1
106
106
example : ¬ Nat.Prime ((2 ^ 19 - 1 ) * (2 ^ 25 - 39 )) := by norm_num1
107
107
108
+ example : Nat.Prime 317 := by norm_num (config := {decide := false })
109
+
108
110
example : Nat.minFac 0 = 2 := by norm_num1
109
111
example : Nat.minFac 1 = 1 := by norm_num1
110
112
example : Nat.minFac (9 - 7 ) = 2 := by norm_num1
@@ -266,43 +268,40 @@ example : Nat.minFac 851 = 23 := by norm_num1
266
268
-- example : Nat.factors 851 = [23, 37] := by norm_num1
267
269
268
270
/-
269
- example : ¬ squarefree 0 := by norm_num
270
- example : squarefree 1 := by norm_num
271
- example : squarefree 2 := by norm_num
272
- example : squarefree 3 := by norm_num
273
- example : ¬ squarefree 4 := by norm_num
274
- example : squarefree 5 := by norm_num
275
- example : squarefree 6 := by norm_num
276
- example : squarefree 7 := by norm_num
277
- example : ¬ squarefree 8 := by norm_num
278
- example : ¬ squarefree 9 := by norm_num
279
- example : squarefree 10 := by norm_num
280
- example : squarefree (2*3* 5*17) := by norm_num
281
- example : ¬ squarefree (2*3* 5*5* 17) := by norm_num
282
- example : squarefree 251 := by norm_num
283
- example : squarefree (3 : ℤ) :=
284
- begin
271
+ example : ¬ Squarefree 0 := by norm_num1
272
+ example : Squarefree 1 := by norm_num1
273
+ example : Squarefree 2 := by norm_num1
274
+ example : Squarefree 3 := by norm_num1
275
+ example : ¬ Squarefree 4 := by norm_num1
276
+ example : Squarefree 5 := by norm_num1
277
+ example : Squarefree 6 := by norm_num1
278
+ example : Squarefree 7 := by norm_num1
279
+ example : ¬ Squarefree 8 := by norm_num1
280
+ example : ¬ Squarefree 9 := by norm_num1
281
+ example : Squarefree 10 := by norm_num1
282
+ example : Squarefree (2*3* 5*17) := by norm_num1
283
+ example : ¬ Squarefree (2*3* 5*5* 17) := by norm_num1
284
+ example : Squarefree 251 := by norm_num1
285
+ example : Squarefree (3 : ℤ) := by
285
286
-- `norm_num` should fail on this example, instead of producing an incorrect proof.
286
- success_if_fail { norm_num },
287
- exact irreducible.squarefree (prime.irreducible
288
- (Int.prime_iff_Nat_abs_prime.mpr (by norm_num)))
289
- end
290
- example : @squarefree ℕ multiplicative.monoid 1 :=
291
- begin
287
+ fail_if_success norm_num1
288
+ exact Irreducible.squarefree (Prime.irreducible
289
+ (Int.prime_iff_natAbs_prime.mpr (by norm_num)))
290
+
291
+ example : @Squarefree ℕ Multiplicative.monoid 1 := by
292
292
-- `norm_num` should fail on this example, instead of producing an incorrect proof.
293
- success_if_fail { norm_num },
293
+ -- fail_if_success norm_num1
294
294
-- the statement was deliberately wacky, let's fix it
295
- change squarefree (multiplicative.of_add 1 : multiplicative ℕ),
296
- rIntros x ⟨dx, hd⟩,
297
- revert x dx,
298
- rw multiplicative.of_add.surjective.forall₂,
299
- Intros x dx h,
300
- simp_rw [←of_add_add, multiplicative.of_add.injective.eq_iff] at h,
301
- cases x,
302
- { simp [ is_unit_one ] , exact is_unit_one },
303
- { simp only [Nat.succ_add, Nat.add_succ] at h,
304
- cases h },
305
- end
295
+ change Squarefree (Multiplicative.ofAdd 1 : Multiplicative ℕ)
296
+ rintro x ⟨dx, hd⟩
297
+ revert x dx
298
+ rw [ Multiplicative.ofAdd.surjective.forall₂ ]
299
+ intros x dx h
300
+ simp_rw [← ofAdd_add, Multiplicative.ofAdd.injective.eq_iff] at h
301
+ cases x
302
+ · simp [ isUnit_one ]
303
+ · simp only [Nat.succ_add, Nat.add_succ] at h
304
+ cases h
306
305
-/
307
306
308
307
example : Nat.fib 0 = 0 := by norm_num1
@@ -331,23 +330,22 @@ open BigOperators
331
330
332
331
-- Lists:
333
332
-- `by decide` closes the three goals below.
334
- /-
335
- example : ([1, 2, 1, 3]).sum = 7 := by norm_num only
336
- example : (List.range 10).sum = 45 := by norm_num only
337
- example : (List.finRange 10).sum = 45 := by norm_num only
338
- -/
339
- -- example : (([1, 2, 1, 3] : List ℚ).map (fun i => i^2)).sum = 15 := by norm_num [ -List.map ] --TODO
333
+ example : ([1 , 2 , 1 , 3 ]).sum = 7 := by norm_num (config := {decide := true }) only
334
+ example : (List.range 10 ).sum = 45 := by norm_num (config := {decide := true }) only
335
+ example : (List.finRange 10 ).sum = 45 := by norm_num (config := {decide := true }) only
336
+
337
+ example : (([1 , 2 , 1 , 3 ] : List ℚ).map (fun i => i^2 )).sum = 15 := by norm_num
340
338
341
339
-- Multisets:
342
340
-- `by decide` closes the three goals below.
343
- /-
344
- example : (1 ::ₘ 2 ::ₘ 1 ::ₘ 3 ::ₘ {}).sum = 7 := by norm_num only
345
- example : ((1 ::ₘ 2 ::ₘ 1 ::ₘ 3 ::ₘ {}).map (fun i => i^2)).sum = 15 := by norm_num only
346
- example : (Multiset.range 10).sum = 45 := by norm_num only
347
- example : (↑[1, 2, 1, 3] : Multiset ℕ).sum = 7 := by norm_num only
348
- -/
349
- -- example : (({1, 2, 1, 3} : Multiset ℚ).map (fun i => i^2)).sum = 15 := by -- TODO
350
- -- norm_num [ -Multiset.map_cons ]
341
+ example : ( 1 ::ₘ 2 ::ₘ 1 ::ₘ 3 ::ₘ {}).sum = 7 := by norm_num (config := {decide := true }) only
342
+ example : (( 1 ::ₘ 2 ::ₘ 1 ::ₘ 3 ::ₘ {}).map ( fun i => i^ 2 )). sum = 15 := by
343
+ norm_num (config := {decide := true }) only
344
+ example : (Multiset.range 10 ).sum = 45 := by norm_num (config := {decide := true }) only
345
+ example : (↑[1 , 2 , 1 , 3 ] : Multiset ℕ).sum = 7 := by norm_num (config := {decide := true }) only
346
+
347
+ example : (({1 , 2 , 1 , 3 } : Multiset ℚ).map (fun i => i^2 )).sum = 15 := by
348
+ norm_num
351
349
352
350
-- Finsets:
353
351
example : Finset.prod (Finset.cons 2 ∅ (Finset.not_mem_empty _)) (λ x => x) = 2 := by norm_num1
@@ -384,14 +382,12 @@ example (f : ℕ → α) : ∑ i in Finset.mk {0, 1, 2} dec_trivial, f i = f 0 +
384
382
-/
385
383
386
384
-- Combined with other `norm_num` extensions:
387
- /-
388
385
example : ∏ i in Finset.range 9 , Nat.sqrt (i + 1 ) = 96 := by norm_num1
389
- example : ∏ i in {1, 4, 9, 16}, Nat.sqrt i = 24 := by norm_num1
390
- example : ∏ i in Finset.Icc 0 8, Nat.sqrt (i + 1) = 96 := by norm_num1
386
+ -- example : ∏ i in {1, 4, 9, 16}, Nat.sqrt i = 24 := by norm_num1
387
+ -- example : ∏ i in Finset.Icc 0 8, Nat.sqrt (i + 1) = 96 := by norm_num1
391
388
392
389
-- Nested operations:
393
- example : ∑ i : Fin 2, ∑ j : Fin 2, ![![0, 1], ![2, 3]] i j = 6 := by norm_num1
394
- -/
390
+ -- example : ∑ i : Fin 2, ∑ j : Fin 2, ![![0, 1], ![2, 3]] i j = 6 := by norm_num1
395
391
396
392
end big_operators
397
393
0 commit comments