This PR introduces the following features to the WIP `grind` tactic: - `Expr` internalization. - Congruence theorem cache. - Procedure for adding new facts - New tracing options - New preprocessing steps: fold projections and eliminate dangling `Expr.mdata`
31 lines
713 B
Text
31 lines
713 B
Text
import Lean.Meta.Tactic.Grind
|
||
import Lean.Elab.Tactic
|
||
|
||
structure A (α : Type u) where
|
||
x : α
|
||
y : α
|
||
f : α → α
|
||
|
||
structure B (α : Type u) extends A α where
|
||
z : α
|
||
b : Bool
|
||
|
||
open Lean Meta Elab Tactic
|
||
elab "fold_projs" : tactic => liftMetaTactic1 fun mvarId => do
|
||
mvarId.replaceTargetDefEq (← Grind.foldProjs (← mvarId.getType))
|
||
|
||
example (a : Nat × Bool) : a.fst = 10 := by
|
||
unfold Prod.fst
|
||
fail_if_success guard_target =ₛ a.fst = 10
|
||
fold_projs
|
||
guard_target =ₛ a.fst = 10
|
||
sorry
|
||
|
||
example (b : B (List Nat)) : b.y = [] := by
|
||
unfold B.toA
|
||
unfold A.y
|
||
fail_if_success unfold A.y
|
||
fail_if_success guard_target =ₛ b.y = []
|
||
fold_projs
|
||
guard_target =ₛ b.y = []
|
||
sorry
|