chore: add approxDefEq and more tracing
This commit is contained in:
parent
f7d63c0453
commit
a1f0e7d8e6
2 changed files with 8 additions and 1 deletions
|
|
@ -63,6 +63,7 @@ abbrev LocalInstances := Array LocalInstance
|
|||
|
||||
structure Config :=
|
||||
(opts : Options := {})
|
||||
-- TODO: merge all *Approx flags.
|
||||
(foApprox : Bool := false)
|
||||
(ctxApprox : Bool := false)
|
||||
(quasiPatternApprox : Bool := false)
|
||||
|
|
@ -603,5 +604,10 @@ do mvarId ← mkFreshId;
|
|||
def whnfUsingDefault : Expr → MetaM Expr :=
|
||||
fun e => usingTransparency TransparencyMode.default $ whnf e
|
||||
|
||||
/-- Execute `x` using approximate unification. -/
|
||||
@[inline] def approxDefEq {α} (x : MetaM α) : MetaM α :=
|
||||
adaptReader (fun (ctx : Context) => { config := { foApprox := true, ctxApprox := true, quasiPatternApprox := true, .. ctx.config }, .. ctx })
|
||||
x
|
||||
|
||||
end Meta
|
||||
end Lean
|
||||
|
|
|
|||
|
|
@ -605,7 +605,8 @@ else
|
|||
def ITactic := Tactic Unit
|
||||
-/
|
||||
private partial def processAssignmentFOApprox (mvar : Expr) (args : Array Expr) : Expr → MetaM Bool
|
||||
| v =>
|
||||
| v => do
|
||||
trace! `Meta.isDefEq.foApprox (mvar ++ " " ++ args ++ " := " ++ v);
|
||||
condM (try $ processAssignmentFOApproxAux mvar args v)
|
||||
(pure true)
|
||||
(unfoldDefinitionAux v (pure false) processAssignmentFOApprox)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue