GithubHelp home page GithubHelp logo

hrmacbeth / math2001 Goto Github PK

View Code? Open in Web Editor NEW
159.0 159.0 65.0 5.51 MB

Lecture notes for a course on writing proofs, on paper and in the Lean proof assistant

Lean 9.22% HTML 88.11% CSS 0.82% JavaScript 1.79% Dockerfile 0.07%
lean4

math2001's People

Contributors

hrmacbeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

math2001's Issues

possible copy/paste errors in 07_Euclidean_Algorithm.lean

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,

Unable to run locally

$ lake build
error: 'Math2001': no such file or directory (error code: 2)
  file: ./././Math2001.lean

Possible bug in `cancel` tactic?

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

Homework 4 problem 2 typo

Screenshot 2024-04-26 at 19 46 22

The problem as stated in the Lean homework file is:

theorem problem2 {t : ℤ} (h : t ≡ 2 [ZMOD 4]) :
    3 * (t ^ 2 + t - 8) ≡ 3 * (2 ^ 2 + 2 - 8) [ZMOD 4] := by

so, 2 substituted for t in all places on the right side.

further reading on transitioning from `extra` to `positivity` tactic

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.

https://leanprover.zulipchat.com/#narrow/stream/113489-new-members/topic/example.20of.20.60positivity.60.20tactic


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

A couple of typos

  1. The solution of Example 2.4.2 starts with "We have that p^2 \le 8 = 3^2".
    image
  2. Problem 3 of Exercises 3.1.10 says "Prove that if the integers m and m are even, then m + n is odd". It should be "if m is odd and n is even ...".
    image

exercises 1.3.11 (10) and (15) not possible using given tactics?

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?

9.2.6 example

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.

typeclass instance problem is stuck, it is often due to metavariables

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
$c &lt; 3 \wedge c &gt; -3$.

The error turns up here:

image

when I try to use the following theorem:

image

having these hypotheses:
image

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!

Question: How is Lean automatically graded?

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.

first use of `le_or_gt`

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.