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

exact? suggests term that does not work #5407

Open
3 tasks done
TwoFX opened this issue Sep 20, 2024 · 1 comment
Open
3 tasks done

exact? suggests term that does not work #5407

TwoFX opened this issue Sep 20, 2024 · 1 comment
Labels
bug Something isn't working P-medium We may work on this issue if we find the time

Comments

@TwoFX
Copy link
Member

TwoFX commented Sep 20, 2024

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

In this code:

inductive Odd : Nat → Prop
  | one : Odd 1
  | add_two : Odd n → Odd (n + 2)

theorem odd_iff {n : Nat} : Odd n ↔ n % 2 = 1 := by
  refine ⟨fun h => by induction h <;> omega, ?_⟩
  match n with
  | 0 => simp
  | 1 => exact fun _ => Odd.one
  | n + 2 => exact fun _ => Odd.add_two (odd_iff.mpr (by omega))

example {n : Nat} : n % 2 = 1 → Odd n := by exact?

the suggestion we get from exact? is Try this: exact fun a => (fun {n} => odd_iff.mpr) a, but this does not work. Accepting the suggestion leads to the two errors

failed to infer binder type

and

don't know how to synthesize implicit argument 'n'
  (@fun {n_1} => odd_iff.mpr) (?m.2120 a) a
context:
n : Nat
a : n % 2 = 1
⊢ ?m.2119 a

Expected behavior: exact? suggests some invocation of odd_iff that works

Actual behavior: Suggestion leads to error above

Versions

4.12.0-nightly-2024-09-19 on live.lean-lang.org

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@TwoFX TwoFX added the bug Something isn't working label Sep 20, 2024
@nomeata
Copy link
Contributor

nomeata commented Sep 20, 2024

I assume the problem isn't actually with exact? but rather the pretty-printer, and would affect show_term as well?

@leanprover-bot leanprover-bot added the P-low We are not planning to work on this issue label Sep 20, 2024
@Kha Kha added P-medium We may work on this issue if we find the time and removed P-low We are not planning to work on this issue labels Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P-medium We may work on this issue if we find the time
Projects
None yet
Development

No branches or pull requests

4 participants