Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing theorems and solutions to C02 S01 #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions MIL/C02_Basics/S01_Calculating.lean
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,44 @@ example (a b : ℝ) : (a + b) * (a - b) = a ^ 2 - b ^ 2 := by
#check mul_sub a b c
#check add_mul a b c
#check add_sub a b c
#check sub_add a b c
#check sub_self a
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are unnecessary, it would be nice to still get the second half merged (with the edits that prove they're unnecessary :)

#check sub_sub a b c
#check add_zero a
-- QUOTE.

end

-- SOLUTIONS:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my guess at the syntax, so pls don't merge without testing that I didn't bork the page


section
variable (a b c d : ℝ)

example : (a + b) * (c + d) = a * c + a * d + b * c + b * d := by
rw [mul_add]
rw [add_mul, add_mul, ← add_assoc]
rw [add_assoc (a * c)]
rw [add_assoc (a * c) (a * d), add_comm (a * d)]

example : (a + b) * (c + d) = a * c + a * d + b * c + b * d :=
calc
(a + b) * (c + d) = (a + b) * c + (a + b) * d := by
rw [mul_add]
_ = a * c + b * c + a * d + b * d := by
rw [add_mul, add_mul, ← add_assoc]
_ = a * c + (b * c + a * d) + b * d := by
rw [add_assoc (a * c)]
_ = a * c + a * d + b * c + b * d := by
rw [add_assoc (a * c) (a * d), add_comm (a * d)]

example (a b : ℝ) : (a + b) * (a - b) = a ^ 2 - b ^ 2 := by
rw [pow_two, pow_two]
rw [add_mul, mul_sub, mul_sub, add_sub]
rw [mul_comm b]
rw [sub_add, sub_self, sub_sub, add_comm, add_zero]

end

/- TEXT:
.. index:: rw, tactics ; rw and rewrite

Expand Down