lean4-htt/tests/lean/run/foldProjs.lean
Leonardo de Moura 7b81fb7050
feat: grind preprocessing and Expr internalization (#6413)
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`
2024-12-19 00:16:48 +00:00

31 lines
713 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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