LF Student source diff
LF/Automation.lean
11921192 --
11931193 -- ∀ l, l = l.reverse → Pal l
11941194
1195--- Source revision: 2ca0e09, committed 2026-10-23 15:44 UTC
1195+-- Source revision: a06e066, committed 2026-10-27 16:51 UTC
LF/Basics.lean
13161316 -- Similarly, for each of the three branches of the definition of `even`,
13171317 -- we need one simplification rule:
13181318
1319-theorem even_zero : even zero = true := rfl
1320-theorem even_one : even (succ zero) = false := rfl
1321-theorem even_succ_succ (n : Nat) : even (succ (succ n)) = even n := rfl
1319+theorem even_zero : even zero = true := by rfl
1320+theorem even_one : even (succ zero) = false := by rfl
1321+theorem even_succ_succ (n : Nat) : even (succ (succ n)) = even n := by rfl
13221322
13231323 attribute [irreducible] even odd
13241324
21082108 end Airport
21092109 end NatPlayground
21102110
2111--- Source revision: 2ca0e09, committed 2026-10-23 15:44 UTC
2111+-- Source revision: a06e066, committed 2026-10-27 16:51 UTC
LF/IndProp.lean
15681568 Repeats l₁ := by
15691569 sorry
15701570
1571--- Source revision: 2ca0e09, committed 2026-10-23 15:44 UTC
1571+-- Source revision: a06e066, committed 2026-10-27 16:51 UTC
LF/Induction.lean
941941 end NatToBin
942942 end NatPlayground.Nat
943943
944--- Source revision: 2ca0e09, committed 2026-10-23 15:44 UTC
944+-- Source revision: a06e066, committed 2026-10-27 16:51 UTC
LF/Lists.lean
491491 sorry
492492
493493 example : count 1 [1] = 1 := by
494- rw [count_cons_same _ _ _ rfl]
495- rw [count_nil]
494+ rw [count_cons_same] -- This generates a subgoal for `h`, which will be closed by `rfl`
495+ · rw [count_nil]
496+ · rfl
496497
497498 example : count 2 [2, 2] = 2 := sorry
498499
528529 sorry
529530
530531 example : member 1 [1] = true := by
531- rw [member_cons_same _ _ _ rfl]
532+ rw [member_cons_same _ _ _ (by rfl)]
532533
533534 example : member 2 [1] = false := sorry
534535
560561 sorry
561562
562563 example : removeOne 5 [1, 5, 4] = [1, 4] := by
563- rw [removeOne_cons_diff _ _ _ rfl]
564- rw [removeOne_cons_same _ _ _ rfl]
564+ rw [removeOne_cons_diff _ _ _ (by rfl)]
565+ rw [removeOne_cons_same _ _ _ (by rfl)]
565566
566567 example : count 5 (removeOne 5 [1, 5, 4]) = 0 := sorry
567568
586587 sorry
587588
588589 example : count 5 (removeAll 5 [5, 1]) = 0 := by
589- rw [removeAll_cons_same _ _ _ rfl]
590- rw [removeAll_cons_diff _ _ _ rfl]
590+ rw [removeAll_cons_same _ _ _ (by rfl)]
591+ rw [removeAll_cons_diff _ _ _ (by rfl)]
591592 rw [removeAll_nil]
592- rw [count_cons_diff _ _ _ rfl]
593+ rw [count_cons_diff _ _ _ (by rfl)]
593594 rw [count_nil]
594595
595596 example : count 5 (removeAll 5 [5, 5]) = 0 := sorry
619620 example : included [1] [2, 1] = true := by
620621 rw [included_cons_member]
621622 · exact included_nil _
622- · rw [member_cons_diff _ _ _ rfl]
623- rw [member_cons_same _ _ _ rfl]
623+ · rw [member_cons_diff _ _ _ (by rfl)]
624+ rw [member_cons_same _ _ _ (by rfl)]
624625
625626 example : included [1, 1] [2, 1, 4, 1] = true := sorry
626627
12321233
12331234 end Lists
12341235
1235--- Source revision: 2ca0e09, committed 2026-10-23 15:44 UTC
1236+-- Source revision: a06e066, committed 2026-10-27 16:51 UTC
LF/Logic.lean
271271 · rfl /- 2 * 2 = 4 -/
272272
273273 -- Rather than applying the constructor, we can explicitly provide the
274--- arguments to the constructor as an `exact` proof.
274+-- arguments to the constructor as an `exact` proof. In particular, we can
275+-- write each argument as a *subproof* using the `by` keyword (the same
276+-- keyword that begins a proof- not a coincidence!). For example, since
277+-- each subproof of `And.intro` in the example below is closed by `rfl`,
278+-- we can close these proofs by passing `(by rfl)` as an argument to
279+-- `And.intro`.
275280
276281 example : 3 + 4 = 7 ∧ 2 * 2 = 4 := by
277- exact And.intro rfl rfl
282+ exact And.intro (by rfl) (by rfl)
278283
279284 -- Lean can figure out which constructor to use just from the goal's type,
280285 -- so we don't have to name it ourselves. This is what the tactic
282287 -- builds a value of the goal's type, leaving one subgoal per argument of
283288 -- that constructor. Since `And` has just one constructor, `constructor`
284289 -- always picks it here.
290+--
291+-- The constructor tactic is *very* useful for proofs involving types with
292+-- many constructors, which we will see in the IndProp chapter.
285293
286294 example : 3 + 4 = 7 ∧ 2 * 2 = 4 := by
287295 constructor
292300 -- which works on constructors for proofs as well.
293301
294302 example : 3 + 4 = 7 ∧ 2 * 2 = 4 := by
295- exact ⟨rfl, rfl⟩
303+ exact ⟨(by rfl), (by rfl)⟩
296304
297305 -- ### Exercise (2 stars): add_is_zero ⭐⭐
298306
20252033 theorem peirce_cm : Peirce → ConsequentiaMirabilis := by
20262034 sorry
20272035
2028--- Source revision: 2ca0e09, committed 2026-10-23 15:44 UTC
2036+-- Source revision: a06e066, committed 2026-10-27 16:51 UTC
LF/Poly.lean
119119 -- Some simple facts about `replicate`:
120120
121121 theorem replicate_zero (α : Type) (a : α) :
122- replicate α a 0 = MyList.nil := rfl
122+ replicate α a 0 = MyList.nil := by rfl
123123
124124 theorem replicate_succ (α : Type) (a : α) (count : Nat) :
125- replicate α a (count + 1) = MyList.cons a (replicate α a count) := rfl
125+ replicate α a (count + 1) = MyList.cons a (replicate α a count) := by rfl
126126
127127 -- We can use `replicate` by applying it first to a type and then to an
128128 -- element of this type (and a number):
12791279
12801280 end Church
12811281
1282--- Source revision: 2ca0e09, committed 2026-10-23 15:44 UTC
1282+-- Source revision: a06e066, committed 2026-10-27 16:51 UTC
LF/Postscript.lean
6363 -- Lean](https://leanprover-community.github.io/mathematics_in_lean/)
6464 -- develops formalized mathematics using Lean and Mathlib.
6565
66--- Source revision: 2ca0e09, committed 2026-10-23 15:44 UTC
66+-- Source revision: a06e066, committed 2026-10-27 16:51 UTC
LF/Preface.lean
407407 -- was supported, in part, by the National Science Foundation under the
408408 -- NSF Expeditions grant 1521523, *The Science of Deep Specification*.
409409
410--- Source revision: 2ca0e09, committed 2026-10-23 15:44 UTC
410+-- Source revision: a06e066, committed 2026-10-27 16:51 UTC
LF/Tactics.lean
12851285 anyTrue test l = anyTrue' test l := by
12861286 sorry
12871287
1288--- Source revision: 2ca0e09, committed 2026-10-23 15:44 UTC
1288+-- Source revision: a06e066, committed 2026-10-27 16:51 UTC
LF/Typeclasses.lean
15811581
15821582 end Reflection
15831583
1584--- Source revision: 2ca0e09, committed 2026-10-23 15:44 UTC
1584+-- Source revision: a06e066, committed 2026-10-27 16:51 UTC
LF/UsingLean.lean
414414
415415 def Nat.odd (n : Nat) := !(even n)
416416
417-theorem Nat.odd_def (n : Nat) : n.odd = !(n.even) := rfl
417+theorem Nat.odd_def (n : Nat) : n.odd = !(n.even) := by rfl
418418
419419 def Nat.minusTwo (n : Nat) : Nat :=
420420 match n with
509509 -- With these tools in hand, we can begin to prove properties about more
510510 -- sophisticated forms of data, beginning with `Lists`.
511511
512--- Source revision: 2ca0e09, committed 2026-10-23 15:44 UTC
512+-- Source revision: a06e066, committed 2026-10-27 16:51 UTC
LF.lean
1111 import LF.Typeclasses
1212 import LF.Postscript
1313
14--- Source revision: 2ca0e09, committed 2026-10-23 15:44 UTC
14+-- Source revision: a06e066, committed 2026-10-27 16:51 UTC
SFLCompat/Experiment.lean
146146 Example:
147147 ```lean
148148 sf_expect_failure_in
149- example : 1 = 2 := rfl
149+ example : 1 = 2 := by rfl
150150 ```
151151 -/
152152 def expectFailureTk := leading_parser
SFLCompat/Recall/Check.lean
460460
461461 def twice (f : Nat → Nat) (n : Nat) : Nat := f (f n)
462462
463-theorem twice_id : twice id 3 = 3 := rfl
463+theorem twice_id : twice id 3 = 3 := by rfl
464464
465465 sf_recall
466466 inductive Palette where
490490
491491 -- The statement form counts universe parameters: a placeholder universe
492492 -- becomes a parameter and matches, and a fixed universe is rejected.
493-theorem poly_refl.{u} : ∀ {α : Sort u} (a : α), a = a := fun _ => rfl
493+theorem poly_refl.{u} : ∀ {α : Sort u} (a : α), a = a := fun _ => by rfl
494494
495495 sf_recall statement poly_refl : ∀ {α : Sort _} (a : α), a = a
496496
SFLCompat/Recall/Source.lean
6363
6464 def twice (f : Nat → Nat) (n : Nat) : Nat := f (f n)
6565
66-theorem twice_id : twice id 3 = 3 := rfl
66+theorem twice_id : twice id 3 = 3 := by rfl
6767
6868 sf_recall_source
6969 inductive Palette where