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

Possible bug in cancel tactic? #17

Open
jdfm opened this issue Jun 8, 2024 · 2 comments
Open

Possible bug in cancel tactic? #17

jdfm opened this issue Jun 8, 2024 · 2 comments

Comments

@jdfm
Copy link

jdfm commented Jun 8, 2024

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
@mcol
Copy link

mcol commented Jul 13, 2024

I had the same expectation too, and the proof mentioned above failed for me with this error, which I find rather baffling:

application type mismatch
  pow_eq_zero h3
argument
  h3
has type
  x ^ 2 = 2 ^ 2 : Prop
but is expected to have type
  x ^ 2 = 0 : Prop

@rzeta0
Copy link

rzeta0 commented Sep 1, 2024

I'm interested in this too.

I have a related problem:

example {x : ℝ} (hx: x^2 = 0) : x = 0 := by
  cancel x at hx

gives the error

cancel failed, could not verify the following side condition:
x : ℝ
hx : x ^ 2 = 0
⊢ 0 < x

Section 2.4.4 says

The tactic cancel will be helpful to deduce that quantities are zero when their squares are known to be zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants