fix: unfold constants at simp
This commit is contained in:
parent
3e65f586cc
commit
5f80659b45
3 changed files with 9 additions and 3 deletions
|
|
@ -12,7 +12,7 @@ namespace Simp
|
|||
builtin_initialize congrHypothesisExceptionId : InternalExceptionId ←
|
||||
registerInternalExceptionId `congrHypothesisFailed
|
||||
|
||||
def throwCongrHypothesisFailed {α} : MetaM α :=
|
||||
def throwCongrHypothesisFailed : MetaM α :=
|
||||
throw <| Exception.internal congrHypothesisExceptionId
|
||||
|
||||
def Result.getProof (r : Result) : MetaM Expr := do
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ def rewriteUsingDecide? (e : Expr) : MetaM (Option Result) := withReducibleAndIn
|
|||
x
|
||||
|
||||
@[inline] def tryUnfold (e : Expr) (x : SimpM Step) : SimpM Step := do
|
||||
if e.isApp && e.getAppFn.isConst && (← read).toUnfold.contains e.getAppFn.constName! then
|
||||
if e.getAppFn.isConst && (← read).toUnfold.contains e.getAppFn.constName! then
|
||||
-- TODO: try simp lemmas
|
||||
match (← withDefault <| unfoldDefinition? e) with
|
||||
| some eNew => return Step.visit { expr := eNew }
|
||||
|
|
|
|||
|
|
@ -29,5 +29,11 @@ def head [Inhabited α] : List α → α
|
|||
| [] => arbitrary
|
||||
| a::_ => a
|
||||
|
||||
theorem ex [Inhabited α] (a : α) (as : List α) : head (a::as) = a :=
|
||||
theorem ex4 [Inhabited α] (a : α) (as : List α) : head (a::as) = a :=
|
||||
by simp [head]
|
||||
|
||||
def foo := 10
|
||||
|
||||
theorem ex5 (x : Nat) : foo + x = 10 + x := by
|
||||
simp [foo]
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue