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

Failed to generate equality theorems #2237

Open
1 task done
rami3l opened this issue May 27, 2023 · 0 comments
Open
1 task done

Failed to generate equality theorems #2237

rami3l opened this issue May 27, 2023 · 0 comments

Comments

@rami3l
Copy link

rami3l commented May 27, 2023

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.

Description

Pasted from Zulip:

inductive Ty where
| star: Ty
notation "" => Ty.star

abbrev Context : Type := List Ty

inductive Lookup : Context → Ty → Type where
| z : Lookup (t :: Γ) t

inductive Term : Context → Ty → Type where
| var : Lookup Γ a → Term Γ a
| lam : Term (✶ :: Γ) ✶ → Term Γ ✶
| ap : Term Γ ✶ → Term Γ ✶ → Term Γ ✶

abbrev plus : Term Γ a → Term Γ a
| .var i => .var i
| .lam n => .lam (plus n)
| .ap (.lam _) m => plus m -- This case takes precedence over the next one.
| .ap l m => (plus l).ap (plus m)

-- I with to be able to prove the following "by definition":
example : plus (.ap l m) = (plus l).ap (plus m) := by
  unfold plus
--^^ failed to generate equality theorems for `match` expression `plus.match_1`

Expected behavior: The plus definition gets unfolded. IIRC since it's recursive, it should be unfolded only once.

Actual behavior: The last line generates the following error message:

failed to generate equality theorems for `match` expression `plus.match_1`
Γ : Context
a : Ty
motive : Term Γ a → Sort u_1
n : Term ( ✶ :: Γ) ✶
h_1 : (i : Lookup Γ a) → motive (Term.var i)
h_2 : (n : Term ( ✶ :: Γ) ✶ ) → motive (Term.lam n)
h_3 : (a : Term ( ✶ :: Γ) ✶ ) → (m : Term Γ ✶ ) → motive (Term.ap (Term.lam a) m)
h_4 : (l m : Term Γ ✶ ) → motive (Term.ap l m)
⊢ Eq.rec (fun x motive h_1 h_2 h_3 h_4 h => (_ : Term.lam n = x) ▸ h_2 n) (_ : ✶ = a) (Term.lam n) motive h_1 h_2 h_3 h_4
      (_ : HEq (Term.lam n) (Term.lam n)) =
    h_2 n

Reproduces how often: 100%

Versions

lean-toolchain: leanprover/lean4:nightly-2023-05-16
OS: macOS Ventura 13.4 22F66 arm64

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

1 participant