feat: unfold tactic tries to reduce match after unfolding
This commit is contained in:
parent
ecbc59c8d8
commit
4875224bd4
3 changed files with 11 additions and 1 deletions
|
|
@ -25,7 +25,9 @@ where
|
|||
pre (unfoldThm : Name) (e : Expr) : SimpM Simp.Step := do
|
||||
match (← withReducible <| Simp.tryTheorem? e { proof := mkConst unfoldThm, name? := some unfoldThm, rfl := (← isRflTheorem unfoldThm) } (fun _ => return none)) with
|
||||
| none => pure ()
|
||||
| some r => return Simp.Step.done r
|
||||
| some r => match (← reduceMatcher? r.expr) with
|
||||
| .reduced e' => return Simp.Step.done { r with expr := e' }
|
||||
| _ => return Simp.Step.done r
|
||||
return Simp.Step.visit { expr := e }
|
||||
|
||||
def unfoldTarget (mvarId : MVarId) (declName : Name) : MetaM MVarId := withMVarContext mvarId do
|
||||
|
|
|
|||
5
tests/lean/unfoldReduceMatch.lean
Normal file
5
tests/lean/unfoldReduceMatch.lean
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
open Nat
|
||||
example : Nat.add zero (succ n) = succ n := by
|
||||
unfold Nat.add
|
||||
trace_state
|
||||
sorry
|
||||
3
tests/lean/unfoldReduceMatch.lean.expected.out
Normal file
3
tests/lean/unfoldReduceMatch.lean.expected.out
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
unfoldReduceMatch.lean:5:2-5:7: warning: declaration uses 'sorry'
|
||||
n : Nat
|
||||
⊢ Nat.succ (Nat.add Nat.zero n) = Nat.succ n
|
||||
Loading…
Add table
Reference in a new issue