{"attempts":[{"claim":{"id":2,"notes":"Fermat little via key lemma (a+1)^p = a^p + 1 + p*t: add_pow, split off k=0 and k=p with sum_range_succ/sum_range_succ', middle terms divisible by Nat.Prime.dvd_choose_self; then induction on a with Nat.add_mul_mod_self_left and Nat.add_mod.","report":null,"status":"verified"},"entry":{"id":2,"kind":"result","title":"Network best: theorems proved 2"},"finished":1791830405,"name":"rgbrgb","node":2,"outcome":"verified: theorems proved 2 (network best), cleared the threshold","started":1791830048,"status":"done","task":4,"unit":1}],"challenge":{"imports":["Mathlib.Data.Nat.Choose.Sum","Mathlib.Data.Nat.Choose.Dvd"],"name":"Lemma.fermat_little","note":"Fermat's little theorem without groups, ZMod or finite fields. The binomial theorem and p ∣ (p choose k) are available: induction on a works.","statement":"∀ p a : ℕ, p.Prime → a ^ p % p = a % p"},"chat":[{"created":1791830406,"id":4,"name":"rgbrgb","node":2,"program":"lean-ablations","tags":[],"text":"Lemma.fermat_little proved (checker: 2 theorems). Key lemma $(a+1)^p = a^p+1+pt$ via add_pow, sum_range_succ + sum_range_succ' (after writing $p=m+1$), Finset.dvd_sum with Nat.Prime.dvd_choose_self; need `simp only [Nat.cast_id]` after add_pow. Then induction on $a$ with Nat.add_mul_mod_self_left, Nat.add_mod."},{"created":1792098084,"id":149,"name":"rgbrgb","node":2,"program":"lean-ablations","tags":[],"text":"U171: grind-free four_squares rebuilt (288 lines, 7/7). Macro: simp only [sq, two_mul, mul_two, 4a=a+a+a+a, add_mul, mul_add, sub_mul, mul_sub, neg_mul, mul_neg, mul_one, mul_assoc, mul_comm, mul_left_comm, ...] <;> omega. The ZMod steps use sub_add_cancel and sub_right_inj. Audit: 0 direct Lean.Grind consts but 573 transitive ones, from library lemmas proved by grind (fermat_little has 454 without calling grind). So [142]'s \"0 Grind\" holds only for direct use."}],"disproof":null,"program":{"checked_by":"nodes","id":"lean-ablations","lean":"v4.34.1","mathlib":"v4.34.1","project":null,"title":"Classic theorems without their usual tools"},"proof":"import Mathlib.Data.Nat.Choose.Sum\nimport Mathlib.Data.Nat.Choose.Dvd\n\ntheorem Lemma.fermat_little_key (p a : ℕ) (hp : p.Prime) :\n    ∃ t, (a + 1) ^ p = a ^ p + 1 + p * t := by\n  obtain ⟨m, rfl⟩ : ∃ m, p = m + 1 := ⟨p - 1, by have := hp.two_le; omega⟩\n  rw [add_pow, Finset.sum_range_succ, Finset.sum_range_succ']\n  simp only [Nat.cast_id]\n  have hd : (m + 1) ∣ ∑ k ∈ Finset.range m,\n      a ^ (k + 1) * 1 ^ (m + 1 - (k + 1)) * (m + 1).choose (k + 1) := by\n    apply Finset.dvd_sum\n    intro k hk\n    rw [Finset.mem_range] at hk\n    exact Dvd.dvd.mul_left (hp.dvd_choose_self (by omega) (by omega)) _\n  obtain ⟨t, ht⟩ := hd\n  refine ⟨t, ?_⟩\n  rw [ht]\n  simp only [pow_zero, one_pow, mul_one, one_mul, Nat.choose_zero_right, Nat.choose_self,\n    Nat.sub_self]\n  generalize a ^ (m + 1) = x\n  generalize (m + 1) * t = y\n  omega\n\ntheorem Lemma.fermat_little :\n    ∀ p a : ℕ, p.Prime → a ^ p % p = a % p := by\n  intro p a hp\n  induction a with\n  | zero =>\n    rw [zero_pow hp.ne_zero]\n  | succ n ih =>\n    obtain ⟨t, ht⟩ := Lemma.fermat_little_key p n hp\n    rw [ht, Nat.add_mul_mod_self_left, Nat.add_mod, ih, ← Nat.add_mod]\n","proposals":[],"row":{"attempts":1,"blocker":null,"either":false,"last":1791830405,"name":"Lemma.fermat_little","statement":null,"status":"proved"}}