You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Analysis/Section_4_2.lean
+11-23Lines changed: 11 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -31,43 +31,31 @@ theorem PreRat.eq (a b c d:ℤ) (hb: b ≠ 0) (hd: d ≠ 0): (⟨ a,b,hb ⟩: Pr
31
31
abbrevRat := Quotient PreRat.instSetoid
32
32
33
33
/-- We give division a "junk" value of 0//1 if the denominator is zero -/
34
-
abbrevRat.formalDiv (a b:ℤ) : Int := Quotient.mk PreInt.instSetoid if h:b ≠ 0then ⟨ a,b,h ⟩ else ⟨ 0, 1, by decide ⟩
34
+
abbrevRat.formalDiv (a b:ℤ) : Rat := Quotient.mk PreRat.instSetoid (if h:b ≠ 0then ⟨ a,b,h ⟩ else ⟨ 0, 1, by decide ⟩)
35
35
36
-
infix:70" // " => Rat.formalDiv
36
+
infix:100" // " => Rat.formalDiv
37
37
38
38
/-- Definition 4.2.1 (Rationals) -/
39
39
theoremRat.eq (a c:ℤ) {b d:ℤ} (hb: b ≠ 0) (hd: d ≠ 0): a // b = c // d ↔ a * d = c * b := by
40
-
simp [hb, hd]
41
-
constructor
42
-
. exact Quotient.exact
43
-
intro h; exact Quotient.sound h
40
+
simp [hb, hd, Setoid.r]
44
41
45
42
/-- Definition 4.2.1 (Rationals) -/
46
43
theoremRat.eq_diff (n:Rat) : ∃ a b, b ≠ 0 ∧ n = a // b := by
47
44
apply Quot.ind _ n; intro ⟨ a, b, h ⟩
48
45
use a, b; refine ⟨ h, ?_ ⟩
49
46
simp [Rat.formalDiv, h]
50
-
51
-
/-- Lemma 4.2.3 (Addition well-defined) -/
52
-
theoremRat.add_congr_left (a b a' b' c d : ℤ) (hb: b ≠ 0) (hb': b' ≠ 0) (hd: d ≠ 0) (h: a // b = a' // b') : (a*d+b*c) // (b*d) = (a'*d+b'*c) // (b'*d) := by
53
-
have hbd: b*d ≠ 0 := bysorry
54
-
have hb'd: b'*d ≠ 0 := bysorry
55
-
simp only [Rat.eq _ _ hb hb', Rat.eq _ _ hbd hb'd] at h ⊢
56
-
calc
57
-
_ = (a*b')*d*d + b*b'*c*d := by ring
58
-
_ = (a'*b)*d*d + b*b'*c*d := by rw [h]
59
-
_ = _ := by ring
60
-
61
-
theoremRat.add_congr_right (a b c d c' d' : ℤ) (hb: b ≠ 0) (hd: d ≠ 0) (hd': d' ≠ 0) (h: c // d = c' // d') : (a*d+b*c) // (b*d) = (a*d'+b*c') // (b*d') := bysorry
62
-
63
-
theoremRat.add_congr (a b c d a' b' c' d' : ℤ) (hb: b ≠ 0) (hb': b' ≠ 0) (hd: d ≠ 0) (hd': d' ≠ 0) (h: a // b = a' // b') : (a*d+b*c) // (b*d) = (a*d'+b*c') // (b*d') := bysorry
0 commit comments