hrmacbeth / math2001 Goto Github PK
View Code? Open in Web Editor NEWLecture notes for a course on writing proofs, on paper and in the Lean proof assistant
Lecture notes for a course on writing proofs, on paper and in the Lean proof assistant
The markup appears to be malformed, minor detail :)
There is a theorem gcd_dvd starting about line 60 of this file. It's not clear if the reader should resolve the 8 sorries or not. I think not since gcd_dvd_right & left come next.
In any case: Following the split_ifs with h1 h2 . . ., and preceding each "sorry", is the comment "prove that gcd a b | b" (or | a).
In no case does the comment reflect the current goal. For example, the first goal is gcd b (fmod a b) ∣ b, the next is gcd b (fmod a b) ∣ a, etc,
$ lake build
error: 'Math2001': no such file or directory (error code: 2)
file: ./././Math2001.lean
Given the ways that we see cancel
being used in the book, and given some discussions in the Zulip lean community, I think maybe there is a bug in the cancel
tactic.
Would the following not have allowed us to arrive at the goal x = y
?
example {x y : ℝ} (hx: 0 ≤ x) (hy: 0 ≤ y) (hs: x^2 = y^2) : x = y := by
cancel 2 at hs
The original context where I ran into this was when trying to do the following:
example {x : ℚ} (h1 : x ^ 2 = 4) (h2 : 1 < x) : x = 2 := by
have h3 :=
calc
x^2 = 4 := by rw [h1]
_ = 2^2 := by numbers
cancel 2 at h3
I'm aware that some of the tactics in this course are specifically created by you to aid learning - thank you!
I'm trying to create a small task and proof which uses the idea of a squared number being positive, and trying to create an educational example using vanilla lean4/mathlib. I think that means using the positivity
tactic.
I'm not succeeding and I can't seem to find examples / guides online despite trying hard. I can't even find a good example of positivity
, the examples in the lean3 docs are too small ( https://leanprover-community.github.io/mathlib_docs/tactics.html#positivity ).
Can you point us to some notes / guidance on how to use positivity?
The lean zulip chat hasn't been helpful on this matter, except to point out that in a calc
proof a line must have the form 0 < x
which adds an extra challenge.
Here is the example I'm trying to develop - essentially to say that if c^2 = a^2 + b^2 then c^2 >= a^2.
import Mathlib.Tactic
example {a b : ℤ} (h1 : a^2 + b^2 = c^2) : 0 ≤ c^2 - a^2 :=
calc
0 = c^2 - a^2 - b^2 := by linarith [h1]
_ ≤ c^2 - a^2 := by positivity
I am working through the course and have completed all the exercises in 1.3.11 except (10) and (15).
I don't believe these are possible using the two tactics that have been given to the reader at this point in the course (rw and ring).
None of the given examples or hint/tips/tricks seem to apply.
It is entirely possible I am missing the solution, but after 2 days of trying I suspect the solutions require tactics not yet given to the reader.
Let's consider (10)
example {p : ℝ} (h1 : 5 * p - 3 = 3 * p + 1) : p = 2 :=
sorry
No amount of substitution (rw) seems to isolate p
.
Let's consider (15)
example {x y : ℝ} (h1 : x + 3 = 5) (h2 : 2 * x - y * x = 0) : y = 2 :=
sorry
The pen and paper solution requires a recognition that (2-y)*x = 0 means either x = 0 or 2-y = 0, or both. But the other hypothesis tells us that x is not 0, and so y must equal 2.
However none of the given tactics, "rw" and "ring" enable this structure of proof at this point in the course.
Am I wrong?
The blue box states a different problem than the example. In the blue box, you have {n:Z s.t. n = 1 zmod 5} intersected with {n:N s.t. n = 1 zmod 5} is empty.
I think mixing types N and Z is not valid.
In any case, you then prove {n:Z s.t. n = 1 zmod 5} intersect {n:Z s.t. n = 2 zmod 5} is empty in the worked out lean code.
Hello
Thank you very much for the awesome book!
When filling out the proof of example 4.4.5
, I am getting an error, which I having trouble debugging.
I am trying to apply the theorem abs_lt_of_sq_lt_sq'
in order to show
The error turns up here:
when I try to use the following theorem:
Using my hypotheses h2
and h3c
should allow me to conclude the result of the theorem.
However, it seems as if some of the types are making it throw an error.
Could anyone guide me on how to resolve this?
Thank you very much!
Nice to meet you.I am learning Lean by reading this material. Thank you for creating nice book!
I have a question about Lean's automated grading.
I am thinking of using Lean to organise private maths competitions. However, I'm faced with the problem of how to automate grading.
The Note for instructors in this material states that Gradescope is used for automatic grading. Could you tell me how to grade Lean code using Gradescope?
Alternatively, please let me know if you know anything about automatic grading of lean codes, not just Gradescope.
Thank you for reading.
Lemma le_or_gt
is used in example 2.5.2 without comment. Only further down in exercise 6, a short explanation is provided:
As in Example 2.5.2, I used the lemma le_or_gt, which says that if and are real numbers then either or ; it can be a useful case division
This should be moved to the place of first use.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.