Skip to content

Commit 8185da8

Browse files
authored
Merge pull request #487 from kvanvels/KEV_line_limit
Chore: Fixed a few lines that were over 100 characters. Proof of Concept.
2 parents f363ed4 + a22aebc commit 8185da8

3 files changed

Lines changed: 34 additions & 33 deletions

File tree

Analysis/Appendix_A_1.lean

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ An introduction to mathematical statements. Showcases some basic tactics and Le
88
-/
99

1010

11-
-- Example A.1.1. What the textbook calls "statements" are objects of type `Prop` in Lean. Also, in Lean we tend to assign "junk" values to expressions that might normally be considered undefined, so discussions regarding undefined terms in the textbook should be adjusted accordingly.
12-
11+
/- Example A.1.1. What the textbook calls "statements" are objects of type `Prop` in Lean. Also,
12+
in Lean we tend to assign "junk" values to expressions that might normally be considered
13+
undefined, so discussions regarding undefined terms in the textbook should be adjusted
14+
accordingly. -/
1315
#check 2+2=4
1416
#check 2+2=5
1517

@@ -186,7 +188,8 @@ example {X Y Z:Prop} (hXY: X ↔ Y) (hXZ: X ↔ Z) : [X,Y,Z].TFAE := by
186188
tfae_have 13 := by exact hXZ -- This line is optional
187189
tfae_finish
188190

189-
/-- Note for the {name (full := List.TFAE.out)}`out` method that one indexes starting from 0, in contrast to the {tactic}`tfae_have` tactic. -/
191+
/-- Note for the {name (full := List.TFAE.out)}`out` method that one indexes starting from 0, in
192+
contrast to the {tactic}`tfae_have` tactic. -/
190193
example {X Y Z:Prop} (h: [X,Y,Z].TFAE) : X ↔ Y := by
191194
exact h.out 0 1
192195

@@ -198,7 +201,8 @@ example {X Y:Prop} : ¬ (X ↔ Y) ↔ sorry := by sorry
198201

199202
/-- Exercise A.1.3. -/
200203
def Exercise_A_1_3 : Decidable (∀ (X Y: Prop), (X → Y) → (¬X → ¬ Y) → (X ↔ Y)) := by
201-
-- the first line of this construction should be either `apply isTrue` or `apply isFalse`, depending on whether you believe the given statement to be true or false.
204+
--the first line of this construction should be either `apply isTrue` or `apply isFalse`,
205+
--depending on whether you believe the given statement to be true or false.
202206
sorry
203207

204208
/-- Exercise A.1.4. -/

Analysis/Section_2_1.lean

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ so.
1414
1515
Main constructions and results of this section:
1616
17-
- Definition of the "Chapter 2" natural numbers, `Chapter2.Nat`, abbreviated as {name}`Nat` within the
18-
Chapter2 namespace. (In the book, the natural numbers are treated in a purely axiomatic
17+
- Definition of the "Chapter 2" natural numbers, `Chapter2.Nat`,abbreviated as {name}`Nat` within
18+
the Chapter2 namespace. (In the book, the natural numbers are treated in a purely axiomatic
1919
fashion, as a type that obeys the Peano axioms; but here we take advantage of Lean's native
20-
inductive types to explicitly construct a version of the natural numbers that obey those
21-
axioms. One could also proceed more axiomatically, as is done in Section 3 for set theory:
22-
see the epilogue to this chapter.)
20+
inductive types to explicitly construct a version of the natural numbers that obey those axioms.
21+
One could also proceed more axiomatically, as is done in Section 3 for set theory: see the
22+
epilogue to this chapter.)
2323
- Establishment of the Peano axioms for `Chapter2.Nat`.
2424
- Recursive definitions for `Chapter2.Nat`.
2525
@@ -50,11 +50,9 @@ postfix:100 "++" => Nat.succ
5050
#check (fun n ↦ n++)
5151

5252

53-
/--
54-
Definition 2.1.3 (Definition of the numerals 0, 1, 2, etc.). Note: to avoid ambiguity, one may
55-
need to use explicit casts such as {lean}`(0:Nat)`, {lean}`(1:Nat)`, etc. to refer to this chapter's version
56-
of the natural numbers.
57-
-/
53+
/-- Definition 2.1.3 (Definition of the numerals 0, 1, 2, etc.). Note: to avoid ambiguity, one may
54+
need to use explicit casts such as {lean}`(0:Nat)`, {lean}`(1:Nat)`, etc. to refer to this
55+
chapter's version of the natural numbers. -/
5856
instance Nat.instOfNat {n:_root_.Nat} : OfNat Nat n where
5957
ofNat := _root_.Nat.rec 0 (fun _ n ↦ n++) n
6058

@@ -115,10 +113,8 @@ theorem Nat.six_ne_two : (6:Nat) ≠ 2 := by
115113
theorem Nat.six_ne_two' : (6:Nat) ≠ 2 := by
116114
decide
117115

118-
/--
119-
Axiom 2.5 (Principle of mathematical induction). The {tactic}`induction` (or {tactic}`induction'`) tactic in
120-
Mathlib serves as a substitute for this axiom.
121-
-/
116+
/-- Axiom 2.5 (Principle of mathematical induction). The {tactic}`induction` (or
117+
{tactic}`induction'`) tactic in Mathlib serves as a substitute for this axiom. -/
122118
theorem Nat.induction (P : Nat → Prop) (hbase : P 0) (hind : ∀ n, P n → P (n++)) :
123119
∀ n, P n := by
124120
intro n

Analysis/Section_2_2.lean

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ standard Mathlib class {name}`_root_.Nat`, or {lean}`ℕ`. However, we will dev
2424
2525
## Tips from past users
2626
27-
Users of the companion who have completed the exercises in this section are welcome to send their tips for future users in this section as PRs.
27+
Users of the companion who have completed the exercises in this section are welcome to send their
28+
tips for future users in this section as PRs.
2829
2930
- (Add tip here)
3031
@@ -36,9 +37,9 @@ namespace Chapter2
3637
Compare with Mathlib's {name}`Nat.add` -/
3738
abbrev Nat.add (n m : Nat) : Nat := Nat.recurse (fun _ sum ↦ sum++) m n
3839

39-
/-- This instance allows for the {kw (of := «term_+_»)}`+` notation to be used for natural number addition. -/
40-
instance Nat.instAdd : Add Nat where
41-
add := add
40+
/-- This instance allows for the {kw (of := «term_+_»)}`+` notation to be used for natural number
41+
addition.-/
42+
instance Nat.instAdd : Add Nat where add := add
4243

4344
/-- Compare with Mathlib's {name}`Nat.zero_add`. -/
4445
@[simp]
@@ -113,7 +114,7 @@ theorem Nat.add_left_cancel (a b c:Nat) (habc: a + b = a + c) : b = c := by
113114

114115

115116
/-- (Not from textbook) {name}`Nat` can be given the structure of a commutative additive monoid.
116-
This permits tactics such as {tactic}`abel` to apply to the Chapter 2 natural numbers. -/
117+
This permits tactics such as {tactic}`abel` to apply to the Chapter 2 natural numbers. -/
117118
instance Nat.addCommMonoid : AddCommMonoid Nat where
118119
add_assoc := add_assoc
119120
add_comm := add_comm
@@ -143,8 +144,8 @@ theorem Nat.add_pos_left {a:Nat} (b:Nat) (ha: a.IsPos) : (a + b).IsPos := by
143144

144145
/-- Compare with Mathlib's {name}`Nat.add_pos_right`.
145146
146-
This theorem is a consequence of the previous theorem and {name}`add_comm`, and {tactic}`grind` can automatically discover such proofs.
147-
-/
147+
This theorem is a consequence of the previous theorem and {name}`add_comm`, and {tactic}`grind` can
148+
automatically discover such proofs. -/
148149
theorem Nat.add_pos_right {a:Nat} (b:Nat) (ha: a.IsPos) : (b + a).IsPos := by
149150
grind [add_comm, add_pos_left]
150151

@@ -320,10 +321,10 @@ theorem Nat.trichotomous (a b:Nat) : a < b ∨ a = b ∨ a > b := by
320321
tauto
321322

322323
/--
323-
(Not from textbook) Establish the decidability of this order computably. The portion of the
324-
proof involving decidability has been provided; the remaining sorries involve claims about the
325-
natural numbers. One could also have established this result by the {tactic}`classical` tactic
326-
followed by {syntax tactic}`exact Classical.decRel _`, but this would make this definition (as well as some
324+
(Not from textbook) Establish the decidability of this order computably. The portion of the proof
325+
involving decidability has been provided; the remaining sorries involve claims about the natural
326+
numbers. One could also have established this result by the {tactic}`classical` tactic followed
327+
by {syntax tactic}`exact Classical.decRel _`, but this would make this definition (as well as some
327328
instances below) noncomputable.
328329
329330
Compare with Mathlib's {name}`Nat.decLe`.
@@ -376,7 +377,8 @@ instance Nat.instLinearOrder : LinearOrder Nat where
376377
example (a b c d:Nat) (hab: a ≤ b) (hbc: b ≤ c) (hcd: c ≤ d)
377378
(hda: d ≤ a) : a = c := by order
378379

379-
/-- An illustration of the {tactic}`calc` tactic with {kw (of := «term_≤_»)}`≤`/{kw (of := «term_<_»)}`<`. -/
380+
/-- An illustration of the {tactic}`calc` tactic with {kw (of := «term_≤_»)}`≤`/
381+
{kw (of :=«term_<_»)}`<`. -/
380382
example (a b c d e:Nat) (hab: a ≤ b) (hbc: b < c) (hcd: c ≤ d)
381383
(hde: d ≤ e) : a + 0 < e := by
382384
calc
@@ -387,7 +389,7 @@ example (a b c d e:Nat) (hab: a ≤ b) (hbc: b < c) (hcd: c ≤ d)
387389
_ ≤ e := hde
388390

389391
/-- (Not from textbook) {name}`Nat` has the structure of an ordered monoid. This allows for tactics
390-
such as {tactic}`gcongr` to be applicable to the Chapter 2 natural numbers. -/
392+
such as {tactic}`gcongr` to be applicable to the Chapter 2 natural numbers. -/
391393
instance Nat.isOrderedAddMonoid : IsOrderedAddMonoid Nat where
392394
add_le_add_left a b hab c := (Nat.add_le_add_right a b c).mp hab
393395

@@ -419,6 +421,5 @@ theorem Nat.induction_from {n:Nat} {P: Nat → Prop} (hind: ∀ m, P m → P (m+
419421
P n → ∀ m, m ≥ n → P m := by
420422
sorry
421423

422-
423-
424424
end Chapter2
425+

0 commit comments

Comments
 (0)