@ceccec/millennium-solutions 9.2.7 → 9.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/speedup.md CHANGED
@@ -7,7 +7,7 @@ head:
7
7
 
8
8
  # The real uuidna advantage — measured, in all domains
9
9
 
10
- > Generated from the **2629** ledger entries and **59** domains, recomputed each build. The advantage is
10
+ > Generated from the **2643** ledger entries and **59** domains, recomputed each build. The advantage is
11
11
  > real and **measured**, and honestly bounded: a **verification and reuse** complexity reduction — **not**
12
12
  > faster original compute, **not** faster than light, **not** quantum.
13
13
 
@@ -33,9 +33,9 @@ theorems verify in `⌈log₂N⌉`. So one proof covers the whole [rosetta](/):
33
33
 
34
34
  ## Discovery lead — a lead, never a verdict
35
35
 
36
- Grouping the 2629 receipts by the digital root of their address, the **sparsest** region is digit
37
- **3** (265) — a candidate area to examine, not a finding. The ledger is currently held
38
- at **2629** (the captain's cap): improving a theorem's name or proof heals the record without changing the
36
+ Grouping the 2643 receipts by the digital root of their address, the **sparsest** region is digit
37
+ **3** (268) — a candidate area to examine, not a finding. The ledger is currently held
38
+ at **2643** (the captain's cap): improving a theorem's name or proof heals the record without changing the
39
39
  count; discovering a new one would require lifting the cap.
40
40
 
41
41
  A content-address proves **integrity, not truth**.
@@ -168,4 +168,40 @@ theorem two_twenty_and_two_eighty_four_are_the_smallest_amicable_pair :
168
168
  (List.range' 2 218).all (fun a => ¬ (aliquot (aliquot a) == a && ¬ (aliquot a == a))) ∧
169
169
  (List.range' 2 218).filter (fun a => aliquot a == a) = [6, 28] := by decide
170
170
 
171
+
172
+ -- ── the capped rows above, proved for every value — no bound ─────────────────────────────────────────────────
173
+ -- sumPow is Families.powSum written as a single fold, so the Faulhaber laws proved there carry
174
+ -- nicomachus_sum_of_cubes_is_the_square_of_the_triangular_number (n ≤ 40) and
175
+ -- the_sum_of_fifth_powers_has_the_closed_form_asked_for (n ≤ 20) to every n.
176
+ theorem the_two_power_sums_are_one_sum : ∀ p n : Nat, sumPow p n = powSum p n := by
177
+ intro p n
178
+ unfold sumPow powSum
179
+ rw [List.foldl_map]
180
+
181
+ theorem nicomachus_sum_of_cubes_is_the_square_of_the_triangular_number_for_every_n :
182
+ ∀ n : Nat, sumPow 3 n = tri n * tri n := by
183
+ intro n
184
+ have c := the_cubes_sum_to_their_closed_form_for_every_n n
185
+ rw [← the_two_power_sums_are_one_sum] at c
186
+ have ev : n * (n + 1) % 2 = 0 := by
187
+ rcases Nat.mod_two_eq_zero_or_one n with e | e <;> simp [Nat.mul_mod, Nat.add_mod, e]
188
+ have hd : n * (n + 1) / 2 * 2 = n * (n + 1) := Nat.div_mul_cancel (Nat.dvd_of_mod_eq_zero ev)
189
+ unfold tri
190
+ generalize n * (n + 1) / 2 = t at hd ⊢
191
+ generalize sumPow 3 n = s at c ⊢
192
+ have q : 4 * s = 4 * (t * t) := by
193
+ have hsq : (t * 2) * (t * 2) = (n * (n + 1)) * (n * (n + 1)) := by rw [hd]
194
+ clear hd ev
195
+ try simp only [Nat.mul_add, Nat.add_mul, Nat.pow_succ, Nat.pow_zero, Nat.one_mul, Nat.mul_one, Nat.reduceMul, Nat.reduceAdd] at *
196
+ try simp only [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm, Nat.reduceMul] at *
197
+ try simp only [Nat.mul_comm _ (OfNat.ofNat _), Nat.mul_left_comm _ (OfNat.ofNat _), Nat.reduceMul] at *
198
+ all_goals omega
199
+ exact Nat.eq_of_mul_eq_mul_left (by decide) q
200
+
201
+ theorem the_sum_of_fifth_powers_has_the_closed_form_for_every_n :
202
+ ∀ n : Nat, 12 * sumPow 5 n = n * n * (n + 1) * (n + 1) * (2 * n * n + 2 * n - 1) := by
203
+ intro n
204
+ rw [the_two_power_sums_are_one_sum]
205
+ exact the_fifth_powers_sum_to_their_closed_form_for_every_n n
206
+
171
207
  end Demand2
@@ -18896,5 +18896,75 @@
18896
18896
  "key": "lean_z9plus_digital_root_is_the_digit_sum_residue_for_every_n",
18897
18897
  "name": "lean z9plus.lean: digital_root_is_the_digit_sum_residue_for_every_n — ∀ n : Nat, m9 (digitSum n) = m9 n — proved by the Lean kernel for every value (by\n intro), standard axioms only — checked by lean.ts",
18898
18898
  "receipt": "694fefdf-a71b-8019-84e5-04477e7be3d8"
18899
+ },
18900
+ {
18901
+ "key": "lean_demand2_the_two_power_sums_are_one_sum",
18902
+ "name": "lean demand2.lean: the_two_power_sums_are_one_sum — ∀ p n : Nat, sumPow p n = powSum p n — proved by the Lean kernel for every value (by\n intro), standard axioms only — checked by lean.ts",
18903
+ "receipt": "6551630b-4917-8c1c-999f-4728c266cfd1"
18904
+ },
18905
+ {
18906
+ "key": "lean_demand2_nicomachus_sum_of_cubes_is_the_square_of_the_triangular_number_for_every_n",
18907
+ "name": "lean demand2.lean: nicomachus_sum_of_cubes_is_the_square_of_the_triangular_number_for_every_n — ∀ n : Nat, sumPow 3 n = tri n * tri n — proved by the Lean kernel for every value (by\n intro), standard axioms only — checked by lean.ts",
18908
+ "receipt": "7aa0bbe0-b4ae-82e8-8319-7aed7047d654"
18909
+ },
18910
+ {
18911
+ "key": "lean_demand2_the_sum_of_fifth_powers_has_the_closed_form_for_every_n",
18912
+ "name": "lean demand2.lean: the_sum_of_fifth_powers_has_the_closed_form_for_every_n — ∀ n : Nat, 12 * sumPow 5 n = n * n * (n + 1) * (n + 1) * (2 * n * n + 2 * n - 1) — proved by the Lean kernel for every value (by\n intro), standard axioms only — checked by lean.ts",
18913
+ "receipt": "6916652f-bda2-80d1-882e-009dee2d791d"
18914
+ },
18915
+ {
18916
+ "key": "lean_elementary_the_lucas_numbers_are_the_sum_of_the_neighbouring_fibonaccis_for_every_n",
18917
+ "name": "lean elementary.lean: the_lucas_numbers_are_the_sum_of_the_neighbouring_fibonaccis_for_every_n — ∀ n : Nat, lucas (n + 1) = fib n + fib (n + 2) — proved by the Lean kernel for every value (by\n have), standard axioms only — checked by lean.ts",
18918
+ "receipt": "cacb33f1-2fc1-8887-87a8-67aa352b3ac6"
18919
+ },
18920
+ {
18921
+ "key": "lean_families_cassinis_identity_for_every_m",
18922
+ "name": "lean families.lean: cassinis_identity_for_every_m — ∀ m : Nat, fib (2 * m + 1) * fib (2 * m + 3) = fib (2 * m + 2) * fib (2 * m + 2) + 1 ∧ fib (2 * m) * fib (2 * m + 2) + 1 = fib (2 * m + 1) * fib (2 * m + 1) — proved by the Lean kernel for every value (by\n intro), standard axioms only — checked by lean.ts",
18923
+ "receipt": "75a810f1-ae27-8fb7-b4d3-b257c0c917c7"
18924
+ },
18925
+ {
18926
+ "key": "lean_families_a_sum_over_one_to_n_plus_one_adds_the_last_term",
18927
+ "name": "lean families.lean: a_sum_over_one_to_n_plus_one_adds_the_last_term — ∀ (g : Nat → Nat) (n : Nat), ((List.range' 1 (n + 1)).map g).foldl (· + ·) 0 = ((List.range' 1 n).map g).foldl (· + ·) 0 + g (n + 1) — proved by the Lean kernel for every value (by\n intro), standard axioms only — checked by lean.ts",
18928
+ "receipt": "f664ca1d-8371-8bd5-a369-060e34e5baaf"
18929
+ },
18930
+ {
18931
+ "key": "lean_families_the_numbers_sum_to_their_closed_form_for_every_n",
18932
+ "name": "lean families.lean: the_numbers_sum_to_their_closed_form_for_every_n — ∀ n : Nat, 2 * powSum 1 n = n * (n + 1) — proved by the Lean kernel for every value (by\n intro), standard axioms only — checked by lean.ts",
18933
+ "receipt": "34fa9fc8-b8ed-8895-bb81-c92f4515e9fe"
18934
+ },
18935
+ {
18936
+ "key": "lean_families_the_squares_sum_to_their_closed_form_for_every_n",
18937
+ "name": "lean families.lean: the_squares_sum_to_their_closed_form_for_every_n — ∀ n : Nat, 6 * powSum 2 n = n * (n + 1) * (2 * n + 1) — proved by the Lean kernel for every value (by\n intro), standard axioms only — checked by lean.ts",
18938
+ "receipt": "0b7a0569-fb3f-8ba7-a49a-900c19bf369d"
18939
+ },
18940
+ {
18941
+ "key": "lean_families_the_cubes_sum_to_their_closed_form_for_every_n",
18942
+ "name": "lean families.lean: the_cubes_sum_to_their_closed_form_for_every_n — ∀ n : Nat, 4 * powSum 3 n = n * n * (n + 1) * (n + 1) — proved by the Lean kernel for every value (by\n intro), standard axioms only — checked by lean.ts",
18943
+ "receipt": "96b0047e-cf09-8755-be28-1cb49080d466"
18944
+ },
18945
+ {
18946
+ "key": "lean_families_the_fourth_powers_sum_to_their_closed_form_for_every_n",
18947
+ "name": "lean families.lean: the_fourth_powers_sum_to_their_closed_form_for_every_n — ∀ n : Nat, 30 * powSum 4 n = n * (n + 1) * (2 * n + 1) * (3 * n * n + 3 * n - 1) — proved by the Lean kernel for every value (by\n intro), standard axioms only — checked by lean.ts",
18948
+ "receipt": "3419aabd-970f-8738-ae26-0adbfd4cf7fb"
18949
+ },
18950
+ {
18951
+ "key": "lean_families_the_fifth_powers_sum_to_their_closed_form_for_every_n",
18952
+ "name": "lean families.lean: the_fifth_powers_sum_to_their_closed_form_for_every_n — ∀ n : Nat, 12 * powSum 5 n = n * n * (n + 1) * (n + 1) * (2 * n * n + 2 * n - 1) — proved by the Lean kernel for every value (by\n intro), standard axioms only — checked by lean.ts",
18953
+ "receipt": "790310ea-f06d-875d-89aa-2aba93d133e3"
18954
+ },
18955
+ {
18956
+ "key": "lean_families_power_sums_match_their_closed_forms_for_every_n",
18957
+ "name": "lean families.lean: power_sums_match_their_closed_forms_for_every_n — ∀ k n : Nat, 1 ≤ k → k ≤ 5 → powSum k n = faulhaber k n — proved by the Lean kernel for every value (by\n intro), standard axioms only — checked by lean.ts",
18958
+ "receipt": "04b04822-598b-8529-a44c-7881174ec382"
18959
+ },
18960
+ {
18961
+ "key": "lean_families_the_sums_of_triangular_numbers_are_the_tetrahedral_numbers_for_every_n",
18962
+ "name": "lean families.lean: the_sums_of_triangular_numbers_are_the_tetrahedral_numbers_for_every_n — ∀ n : Nat, ((List.range' 1 n).map (fun i => i * (i + 1) / 2)).foldl (· + ·) 0 = n * (n + 1) * (n + 2) / 6 — proved by the Lean kernel for every value (by\n have), standard axioms only — checked by lean.ts",
18963
+ "receipt": "43b9cdd8-7110-8f6f-887b-297d0262ae80"
18964
+ },
18965
+ {
18966
+ "key": "lean_sequences_cassinis_identity_for_every_m",
18967
+ "name": "lean sequences.lean: cassinis_identity_for_every_m — ∀ m : Nat, fib (2 * m + 1) * fib (2 * m + 3) = fib (2 * m + 2) * fib (2 * m + 2) + 1 ∧ fib (2 * m) * fib (2 * m + 2) + 1 = fib (2 * m + 1) * fib (2 * m + 1) — proved by the Lean kernel for every value (by\n intro), standard axioms only — checked by lean.ts",
18968
+ "receipt": "3b815427-42b8-8b8c-abf3-423b1e268af3"
18899
18969
  }
18900
18970
  ]
@@ -423,4 +423,24 @@ theorem eight_times_a_triangular_number_plus_one_is_an_odd_square_for_every_n :
423
423
  rw [hexp]
424
424
  omega
425
425
 
426
+
427
+ -- ── the capped row above, proved for every value — no bound ──────────────────────────────────────────────────
428
+ -- the_lucas_numbers_are_the_sum_of_the_neighbouring_fibonaccis was checked n ≤ 28; this proves it for every n.
429
+ theorem the_lucas_numbers_are_the_sum_of_the_neighbouring_fibonaccis_for_every_n :
430
+ ∀ n : Nat, lucas (n + 1) = fib n + fib (n + 2) := by
431
+ have key : ∀ n : Nat, lucas (n + 1) = fib n + fib (n + 2) ∧ lucas (n + 2) = fib (n + 1) + fib (n + 3) := by
432
+ intro n
433
+ induction n with
434
+ | zero => decide
435
+ | succ n ih =>
436
+ refine ⟨ih.2, ?_⟩
437
+ have l : lucas (n + 3) = lucas (n + 1) + lucas (n + 2) := rfl
438
+ have f4 : fib (n + 4) = fib (n + 2) + fib (n + 3) := rfl
439
+ have f2 : fib (n + 2) = fib n + fib (n + 1) := rfl
440
+ show lucas (n + 3) = fib (n + 2) + fib (n + 4)
441
+ rw [l, ih.1, ih.2, f4]
442
+ omega
443
+ intro n
444
+ exact (key n).1
445
+
426
446
  end Elementary
@@ -479,4 +479,170 @@ theorem the_first_n_odd_numbers_sum_to_n_squared_for_every_n :
479
479
  rw [square_of_successor]
480
480
  omega
481
481
 
482
+
483
+ -- ── the capped rows above, proved for every value by induction — no bound ──────────────────────────────────
484
+ -- cassinis_identity_holds_across_the_range (n ≤ 30), power_sums_match_their_closed_forms (k = 1..5, n ≤ 40),
485
+ -- the_first_three_power_sums_hold_to_two_hundred (n ≤ 200) and the_sums_of_triangular_numbers_are_the_tetrahedral_
486
+ -- numbers (n ≤ 100) were checked up to a bound; these prove them for every value. Core Lean has no ring tactic, so each
487
+ -- polynomial step is expanded, each monomial sorted, its numeral moved to the front, and omega closes what is left.
488
+ theorem cassinis_identity_for_every_m :
489
+ ∀ m : Nat, fib (2 * m + 1) * fib (2 * m + 3) = fib (2 * m + 2) * fib (2 * m + 2) + 1 ∧
490
+ fib (2 * m) * fib (2 * m + 2) + 1 = fib (2 * m + 1) * fib (2 * m + 1) := by
491
+ intro m
492
+ induction m with
493
+ | zero => decide
494
+ | succ m ih =>
495
+ have r3 : fib (2 * m + 3) = fib (2 * m + 1) + fib (2 * m + 2) := rfl
496
+ have r4 : fib (2 * m + 4) = fib (2 * m + 2) + fib (2 * m + 3) := rfl
497
+ have r5 : fib (2 * m + 5) = fib (2 * m + 3) + fib (2 * m + 4) := rfl
498
+ show fib (2 * m + 3) * fib (2 * m + 5) = fib (2 * m + 4) * fib (2 * m + 4) + 1 ∧
499
+ fib (2 * m + 2) * fib (2 * m + 4) + 1 = fib (2 * m + 3) * fib (2 * m + 3)
500
+ have h := ih.1
501
+ rw [r5, r4, r3]
502
+ rw [r3] at h
503
+ generalize fib (2 * m + 1) = a at h ⊢
504
+ generalize fib (2 * m + 2) = b at h ⊢
505
+ constructor
506
+ · try simp only [Nat.mul_add, Nat.add_mul, Nat.pow_succ, Nat.pow_zero, Nat.one_mul, Nat.mul_one, Nat.reduceMul, Nat.reduceAdd] at *
507
+ try simp only [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm, Nat.reduceMul] at *
508
+ try simp only [Nat.mul_comm _ (OfNat.ofNat _), Nat.mul_left_comm _ (OfNat.ofNat _), Nat.reduceMul] at *
509
+ all_goals omega
510
+ · try simp only [Nat.mul_add, Nat.add_mul, Nat.pow_succ, Nat.pow_zero, Nat.one_mul, Nat.mul_one, Nat.reduceMul, Nat.reduceAdd] at *
511
+ try simp only [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm, Nat.reduceMul] at *
512
+ try simp only [Nat.mul_comm _ (OfNat.ofNat _), Nat.mul_left_comm _ (OfNat.ofNat _), Nat.reduceMul] at *
513
+ all_goals omega
514
+
515
+ theorem a_sum_over_one_to_n_plus_one_adds_the_last_term :
516
+ ∀ (g : Nat → Nat) (n : Nat),
517
+ ((List.range' 1 (n + 1)).map g).foldl (· + ·) 0 = ((List.range' 1 n).map g).foldl (· + ·) 0 + g (n + 1) := by
518
+ intro g n
519
+ rw [List.range'_concat, List.map_append, List.foldl_append]
520
+ simp only [List.map, List.foldl, Nat.one_mul, Nat.add_comm 1 n]
521
+
522
+ theorem the_numbers_sum_to_their_closed_form_for_every_n : ∀ n : Nat, 2 * powSum 1 n = n * (n + 1) := by
523
+ intro n
524
+ induction n with
525
+ | zero => rfl
526
+ | succ n ih =>
527
+ unfold powSum at *
528
+ rw [a_sum_over_one_to_n_plus_one_adds_the_last_term]
529
+ generalize ((List.range' 1 n).map (fun i => i ^ 1)).foldl (· + ·) 0 = s at ih ⊢
530
+ try simp only [Nat.mul_add, Nat.add_mul, Nat.pow_succ, Nat.pow_zero, Nat.one_mul, Nat.mul_one, Nat.reduceMul, Nat.reduceAdd] at *
531
+ try simp only [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm, Nat.reduceMul] at *
532
+ try simp only [Nat.mul_comm _ (OfNat.ofNat _), Nat.mul_left_comm _ (OfNat.ofNat _), Nat.reduceMul] at *
533
+ all_goals omega
534
+
535
+ theorem the_squares_sum_to_their_closed_form_for_every_n : ∀ n : Nat, 6 * powSum 2 n = n * (n + 1) * (2 * n + 1) := by
536
+ intro n
537
+ induction n with
538
+ | zero => rfl
539
+ | succ n ih =>
540
+ unfold powSum at *
541
+ rw [a_sum_over_one_to_n_plus_one_adds_the_last_term]
542
+ generalize ((List.range' 1 n).map (fun i => i ^ 2)).foldl (· + ·) 0 = s at ih ⊢
543
+ try simp only [Nat.mul_add, Nat.add_mul, Nat.pow_succ, Nat.pow_zero, Nat.one_mul, Nat.mul_one, Nat.reduceMul, Nat.reduceAdd] at *
544
+ try simp only [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm, Nat.reduceMul] at *
545
+ try simp only [Nat.mul_comm _ (OfNat.ofNat _), Nat.mul_left_comm _ (OfNat.ofNat _), Nat.reduceMul] at *
546
+ all_goals omega
547
+
548
+ theorem the_cubes_sum_to_their_closed_form_for_every_n : ∀ n : Nat, 4 * powSum 3 n = n * n * (n + 1) * (n + 1) := by
549
+ intro n
550
+ induction n with
551
+ | zero => rfl
552
+ | succ n ih =>
553
+ unfold powSum at *
554
+ rw [a_sum_over_one_to_n_plus_one_adds_the_last_term]
555
+ generalize ((List.range' 1 n).map (fun i => i ^ 3)).foldl (· + ·) 0 = s at ih ⊢
556
+ try simp only [Nat.mul_add, Nat.add_mul, Nat.pow_succ, Nat.pow_zero, Nat.one_mul, Nat.mul_one, Nat.reduceMul, Nat.reduceAdd] at *
557
+ try simp only [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm, Nat.reduceMul] at *
558
+ try simp only [Nat.mul_comm _ (OfNat.ofNat _), Nat.mul_left_comm _ (OfNat.ofNat _), Nat.reduceMul] at *
559
+ all_goals omega
560
+
561
+ set_option maxRecDepth 200000 in
562
+ set_option maxHeartbeats 4000000 in
563
+ theorem the_fourth_powers_sum_to_their_closed_form_for_every_n :
564
+ ∀ n : Nat, 30 * powSum 4 n = n * (n + 1) * (2 * n + 1) * (3 * n * n + 3 * n - 1) := by
565
+ intro n
566
+ induction n with
567
+ | zero => rfl
568
+ | succ n ih =>
569
+ unfold powSum at *
570
+ rw [a_sum_over_one_to_n_plus_one_adds_the_last_term]
571
+ generalize ((List.range' 1 n).map (fun i => i ^ 4)).foldl (· + ·) 0 = s at ih ⊢
572
+ have e2 : 3 * (n + 1) * (n + 1) + 3 * (n + 1) - 1 = 3 * n * n + 9 * n + 5 := by
573
+ simp only [Nat.mul_add, Nat.add_mul, Nat.mul_one, Nat.one_mul]; omega
574
+ rw [e2]
575
+ cases n with
576
+ | zero => simp at ih ⊢; omega
577
+ | succ m =>
578
+ have e1 : 3 * (m + 1) * (m + 1) + 3 * (m + 1) - 1 = 3 * m * m + 9 * m + 5 := by
579
+ simp only [Nat.mul_add, Nat.add_mul, Nat.mul_one, Nat.one_mul]; omega
580
+ rw [e1] at ih
581
+ try simp only [Nat.mul_add, Nat.add_mul, Nat.pow_succ, Nat.pow_zero, Nat.one_mul, Nat.mul_one, Nat.reduceMul, Nat.reduceAdd] at *
582
+ try simp only [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm, Nat.reduceMul] at *
583
+ try simp only [Nat.mul_comm _ (OfNat.ofNat _), Nat.mul_left_comm _ (OfNat.ofNat _), Nat.reduceMul] at *
584
+ all_goals omega
585
+
586
+ set_option maxRecDepth 200000 in
587
+ set_option maxHeartbeats 4000000 in
588
+ theorem the_fifth_powers_sum_to_their_closed_form_for_every_n :
589
+ ∀ n : Nat, 12 * powSum 5 n = n * n * (n + 1) * (n + 1) * (2 * n * n + 2 * n - 1) := by
590
+ intro n
591
+ induction n with
592
+ | zero => rfl
593
+ | succ n ih =>
594
+ unfold powSum at *
595
+ rw [a_sum_over_one_to_n_plus_one_adds_the_last_term]
596
+ generalize ((List.range' 1 n).map (fun i => i ^ 5)).foldl (· + ·) 0 = s at ih ⊢
597
+ have e2 : 2 * (n + 1) * (n + 1) + 2 * (n + 1) - 1 = 2 * n * n + 6 * n + 3 := by
598
+ simp only [Nat.mul_add, Nat.add_mul, Nat.mul_one, Nat.one_mul]; omega
599
+ rw [e2]
600
+ cases n with
601
+ | zero => simp at ih ⊢; omega
602
+ | succ m =>
603
+ have e1 : 2 * (m + 1) * (m + 1) + 2 * (m + 1) - 1 = 2 * m * m + 6 * m + 3 := by
604
+ simp only [Nat.mul_add, Nat.add_mul, Nat.mul_one, Nat.one_mul]; omega
605
+ rw [e1] at ih
606
+ try simp only [Nat.mul_add, Nat.add_mul, Nat.pow_succ, Nat.pow_zero, Nat.one_mul, Nat.mul_one, Nat.reduceMul, Nat.reduceAdd] at *
607
+ try simp only [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm, Nat.reduceMul] at *
608
+ try simp only [Nat.mul_comm _ (OfNat.ofNat _), Nat.mul_left_comm _ (OfNat.ofNat _), Nat.reduceMul] at *
609
+ all_goals omega
610
+
611
+ theorem power_sums_match_their_closed_forms_for_every_n :
612
+ ∀ k n : Nat, 1 ≤ k → k ≤ 5 → powSum k n = faulhaber k n := by
613
+ intro k n h1 h5
614
+ have c : k = 1 ∨ k = 2 ∨ k = 3 ∨ k = 4 ∨ k = 5 := by omega
615
+ rcases c with rfl | rfl | rfl | rfl | rfl
616
+ · show powSum 1 n = n * (n + 1) / 2
617
+ rw [← the_numbers_sum_to_their_closed_form_for_every_n n, Nat.mul_div_cancel_left _ (by decide)]
618
+ · show powSum 2 n = n * (n + 1) * (2 * n + 1) / 6
619
+ rw [← the_squares_sum_to_their_closed_form_for_every_n n, Nat.mul_div_cancel_left _ (by decide)]
620
+ · show powSum 3 n = n * n * (n + 1) * (n + 1) / 4
621
+ rw [← the_cubes_sum_to_their_closed_form_for_every_n n, Nat.mul_div_cancel_left _ (by decide)]
622
+ · show powSum 4 n = n * (n + 1) * (2 * n + 1) * (3 * n * n + 3 * n - 1) / 30
623
+ rw [← the_fourth_powers_sum_to_their_closed_form_for_every_n n, Nat.mul_div_cancel_left _ (by decide)]
624
+ · show powSum 5 n = n * n * (n + 1) * (n + 1) * (2 * n * n + 2 * n - 1) / 12
625
+ rw [← the_fifth_powers_sum_to_their_closed_form_for_every_n n, Nat.mul_div_cancel_left _ (by decide)]
626
+
627
+ theorem the_sums_of_triangular_numbers_are_the_tetrahedral_numbers_for_every_n :
628
+ ∀ n : Nat, ((List.range' 1 n).map (fun i => i * (i + 1) / 2)).foldl (· + ·) 0 = n * (n + 1) * (n + 2) / 6 := by
629
+ have six : ∀ n : Nat, 6 * ((List.range' 1 n).map (fun i => i * (i + 1) / 2)).foldl (· + ·) 0 = n * (n + 1) * (n + 2) := by
630
+ intro n
631
+ induction n with
632
+ | zero => rfl
633
+ | succ n ih =>
634
+ rw [a_sum_over_one_to_n_plus_one_adds_the_last_term]
635
+ have ev : (n + 1) * (n + 1 + 1) % 2 = 0 := by
636
+ rcases Nat.mod_two_eq_zero_or_one n with e | e <;> simp [Nat.mul_mod, Nat.add_mod, e]
637
+ have hd : (n + 1) * (n + 1 + 1) / 2 * 2 = (n + 1) * (n + 1 + 1) := Nat.div_mul_cancel (Nat.dvd_of_mod_eq_zero ev)
638
+ generalize ((List.range' 1 n).map (fun i => i * (i + 1) / 2)).foldl (· + ·) 0 = s at ih ⊢
639
+ generalize (n + 1) * (n + 1 + 1) / 2 = t at hd ⊢
640
+ rw [Nat.mul_two] at hd
641
+ try simp only [Nat.mul_add, Nat.add_mul, Nat.pow_succ, Nat.pow_zero, Nat.one_mul, Nat.mul_one, Nat.reduceMul, Nat.reduceAdd] at *
642
+ try simp only [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm, Nat.reduceMul] at *
643
+ try simp only [Nat.mul_comm _ (OfNat.ofNat _), Nat.mul_left_comm _ (OfNat.ofNat _), Nat.reduceMul] at *
644
+ all_goals omega
645
+ intro n
646
+ rw [← six n, Nat.mul_div_cancel_left _ (by decide)]
647
+
482
648
  end Families
@@ -102,4 +102,35 @@ theorem the_sequence_takes_both_values :
102
102
  ((List.range 200).filter (fun n => tm n == 0)).length = 100
103
103
  ∧ ((List.range 200).filter (fun n => tm n == 1)).length = 100 := by decide
104
104
 
105
+
106
+ -- ── the capped rows above, proved for every value — no bound ─────────────────────────────────────────────────
107
+ -- cassini_at_even_indices, cassini_at_odd_indices and cassini_deviation_is_exactly_one were checked n ≤ 20; one law
108
+ -- carries all three: at every index the product of the neighbours is the square, plus or minus one.
109
+ theorem cassinis_identity_for_every_m :
110
+ ∀ m : Nat, fib (2 * m + 1) * fib (2 * m + 3) = fib (2 * m + 2) * fib (2 * m + 2) + 1 ∧
111
+ fib (2 * m) * fib (2 * m + 2) + 1 = fib (2 * m + 1) * fib (2 * m + 1) := by
112
+ intro m
113
+ induction m with
114
+ | zero => decide
115
+ | succ m ih =>
116
+ have r3 : fib (2 * m + 3) = fib (2 * m + 1) + fib (2 * m + 2) := rfl
117
+ have r4 : fib (2 * m + 4) = fib (2 * m + 2) + fib (2 * m + 3) := rfl
118
+ have r5 : fib (2 * m + 5) = fib (2 * m + 3) + fib (2 * m + 4) := rfl
119
+ show fib (2 * m + 3) * fib (2 * m + 5) = fib (2 * m + 4) * fib (2 * m + 4) + 1 ∧
120
+ fib (2 * m + 2) * fib (2 * m + 4) + 1 = fib (2 * m + 3) * fib (2 * m + 3)
121
+ have h := ih.1
122
+ rw [r5, r4, r3]
123
+ rw [r3] at h
124
+ generalize fib (2 * m + 1) = a at h ⊢
125
+ generalize fib (2 * m + 2) = b at h ⊢
126
+ constructor
127
+ · try simp only [Nat.mul_add, Nat.add_mul, Nat.pow_succ, Nat.pow_zero, Nat.one_mul, Nat.mul_one, Nat.reduceMul, Nat.reduceAdd] at *
128
+ try simp only [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm, Nat.reduceMul] at *
129
+ try simp only [Nat.mul_comm _ (OfNat.ofNat _), Nat.mul_left_comm _ (OfNat.ofNat _), Nat.reduceMul] at *
130
+ all_goals omega
131
+ · try simp only [Nat.mul_add, Nat.add_mul, Nat.pow_succ, Nat.pow_zero, Nat.one_mul, Nat.mul_one, Nat.reduceMul, Nat.reduceAdd] at *
132
+ try simp only [Nat.mul_assoc, Nat.mul_comm, Nat.mul_left_comm, Nat.reduceMul] at *
133
+ try simp only [Nat.mul_comm _ (OfNat.ofNat _), Nat.mul_left_comm _ (OfNat.ofNat _), Nat.reduceMul] at *
134
+ all_goals omega
135
+
105
136
  end Sequences
@@ -15772,5 +15772,89 @@
15772
15772
  "verdict": "UNVERIFIED",
15773
15773
  "ground": "no candidate in the current space — nothing to recompute",
15774
15774
  "receipt": "694fefdf-a71b-8019-84e5-04477e7be3d8"
15775
+ },
15776
+ {
15777
+ "key": "lean_demand2_the_two_power_sums_are_one_sum",
15778
+ "verdict": "UNVERIFIED",
15779
+ "ground": "no candidate in the current space — nothing to recompute",
15780
+ "receipt": "6551630b-4917-8c1c-999f-4728c266cfd1"
15781
+ },
15782
+ {
15783
+ "key": "lean_demand2_nicomachus_sum_of_cubes_is_the_square_of_the_triangular_number_for_every_n",
15784
+ "verdict": "UNVERIFIED",
15785
+ "ground": "no candidate in the current space — nothing to recompute",
15786
+ "receipt": "7aa0bbe0-b4ae-82e8-8319-7aed7047d654"
15787
+ },
15788
+ {
15789
+ "key": "lean_demand2_the_sum_of_fifth_powers_has_the_closed_form_for_every_n",
15790
+ "verdict": "UNVERIFIED",
15791
+ "ground": "no candidate in the current space — nothing to recompute",
15792
+ "receipt": "6916652f-bda2-80d1-882e-009dee2d791d"
15793
+ },
15794
+ {
15795
+ "key": "lean_elementary_the_lucas_numbers_are_the_sum_of_the_neighbouring_fibonaccis_for_every_n",
15796
+ "verdict": "UNVERIFIED",
15797
+ "ground": "no candidate in the current space — nothing to recompute",
15798
+ "receipt": "cacb33f1-2fc1-8887-87a8-67aa352b3ac6"
15799
+ },
15800
+ {
15801
+ "key": "lean_families_cassinis_identity_for_every_m",
15802
+ "verdict": "UNVERIFIED",
15803
+ "ground": "no candidate in the current space — nothing to recompute",
15804
+ "receipt": "75a810f1-ae27-8fb7-b4d3-b257c0c917c7"
15805
+ },
15806
+ {
15807
+ "key": "lean_families_a_sum_over_one_to_n_plus_one_adds_the_last_term",
15808
+ "verdict": "UNVERIFIED",
15809
+ "ground": "no candidate in the current space — nothing to recompute",
15810
+ "receipt": "f664ca1d-8371-8bd5-a369-060e34e5baaf"
15811
+ },
15812
+ {
15813
+ "key": "lean_families_the_numbers_sum_to_their_closed_form_for_every_n",
15814
+ "verdict": "UNVERIFIED",
15815
+ "ground": "no candidate in the current space — nothing to recompute",
15816
+ "receipt": "34fa9fc8-b8ed-8895-bb81-c92f4515e9fe"
15817
+ },
15818
+ {
15819
+ "key": "lean_families_the_squares_sum_to_their_closed_form_for_every_n",
15820
+ "verdict": "UNVERIFIED",
15821
+ "ground": "no candidate in the current space — nothing to recompute",
15822
+ "receipt": "0b7a0569-fb3f-8ba7-a49a-900c19bf369d"
15823
+ },
15824
+ {
15825
+ "key": "lean_families_the_cubes_sum_to_their_closed_form_for_every_n",
15826
+ "verdict": "UNVERIFIED",
15827
+ "ground": "no candidate in the current space — nothing to recompute",
15828
+ "receipt": "96b0047e-cf09-8755-be28-1cb49080d466"
15829
+ },
15830
+ {
15831
+ "key": "lean_families_the_fourth_powers_sum_to_their_closed_form_for_every_n",
15832
+ "verdict": "UNVERIFIED",
15833
+ "ground": "no candidate in the current space — nothing to recompute",
15834
+ "receipt": "3419aabd-970f-8738-ae26-0adbfd4cf7fb"
15835
+ },
15836
+ {
15837
+ "key": "lean_families_the_fifth_powers_sum_to_their_closed_form_for_every_n",
15838
+ "verdict": "UNVERIFIED",
15839
+ "ground": "no candidate in the current space — nothing to recompute",
15840
+ "receipt": "790310ea-f06d-875d-89aa-2aba93d133e3"
15841
+ },
15842
+ {
15843
+ "key": "lean_families_power_sums_match_their_closed_forms_for_every_n",
15844
+ "verdict": "UNVERIFIED",
15845
+ "ground": "no candidate in the current space — nothing to recompute",
15846
+ "receipt": "04b04822-598b-8529-a44c-7881174ec382"
15847
+ },
15848
+ {
15849
+ "key": "lean_families_the_sums_of_triangular_numbers_are_the_tetrahedral_numbers_for_every_n",
15850
+ "verdict": "UNVERIFIED",
15851
+ "ground": "no candidate in the current space — nothing to recompute",
15852
+ "receipt": "43b9cdd8-7110-8f6f-887b-297d0262ae80"
15853
+ },
15854
+ {
15855
+ "key": "lean_sequences_cassinis_identity_for_every_m",
15856
+ "verdict": "UNVERIFIED",
15857
+ "ground": "no candidate in the current space — nothing to recompute",
15858
+ "receipt": "3b815427-42b8-8b8c-abf3-423b1e268af3"
15775
15859
  }
15776
15860
  ]