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

aesop ignores @[eliminator] #59

Open
semorrison opened this issue Jun 14, 2023 · 1 comment
Open

aesop ignores @[eliminator] #59

semorrison opened this issue Jun 14, 2023 · 1 comment

Comments

@semorrison
Copy link
Collaborator

It would be lovely if aesops cases rules used the @[eliminator] attributes, like induction and cases do:

import Aesop

structure Opposite (α : Type _) :=
  /-- The canonical map `αᵒᵖ → α`. -/
  unop : α

namespace Opposite

def op (x : α) : Opposite α := ⟨x⟩

@[eliminator]
protected def rec' {F : Opposite α → Sort v} (h : ∀ X, F (op X)) : ∀ X, F X := fun X => h (unop X)

example (x : Opposite α) : x = x := by
  induction x with
  | _ X => 
    guard_target = op X = op X
    rfl

attribute [aesop safe cases] Opposite

theorem bar (x y : Opposite α) : x = y := by
  aesop (options := { warnOnNonterminal := false })
  -- Oops, used Opposite.casesOn, not Opposite.rec
  sorry

#print bar 
bors bot pushed a commit to leanprover-community/mathlib4 that referenced this issue Jun 14, 2023
Closes #4551.

Essentially `op_induction` is not necessary, now that `Opposite.rec'` is labelled with `@[eliminator]`. It would be nice if we could use this from inside `aesop`, see leanprover-community/aesop#59.



Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>
@JLimperg
Copy link
Collaborator

This would indeed be nice. Problem: the MetaM cases tactic, which cases rules use, doesn't support custom eliminators (and it would be nontrivial to add this support). Possible solution: use the ElabM cases tactic. This would have to be lowered to MetaM, but maybe that's not an issue in practice. It might also resolve some issues with the tactic script generation functionality, where the discrepancy between MetaM cases and ElabM cases can lead to bugs.

alexkeizer pushed a commit to leanprover-community/mathlib4 that referenced this issue Jun 22, 2023
Closes #4551.

Essentially `op_induction` is not necessary, now that `Opposite.rec'` is labelled with `@[eliminator]`. It would be nice if we could use this from inside `aesop`, see leanprover-community/aesop#59.



Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>
semorrison added a commit to leanprover-community/mathlib4 that referenced this issue Jun 25, 2023
Closes #4551.

Essentially `op_induction` is not necessary, now that `Opposite.rec'` is labelled with `@[eliminator]`. It would be nice if we could use this from inside `aesop`, see leanprover-community/aesop#59.



Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>
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

2 participants