fix: transparency settings at simp TC check

fixes #790
This commit is contained in:
Leonardo de Moura 2021-11-15 18:09:31 -08:00
parent 4b2fa38cb8
commit 2a7b33089a
2 changed files with 22 additions and 2 deletions

View file

@ -33,10 +33,10 @@ where
synthesizeInstance (x type : Expr) : SimpM Bool := do
match (← trySynthInstance type) with
| LOption.some val =>
if (← isDefEq x val) then
if (← withReducibleAndInstances <| isDefEq x val) then
return true
else
trace[Meta.Tactic.simp.discharge] "{lemmaName}, failed to assign instance{indentExpr type}"
trace[Meta.Tactic.simp.discharge] "{lemmaName}, failed to assign instance{indentExpr type}\nsythesized value{indentExpr val}\nis not definitionally equal to{indentExpr x}"
return false
| _ =>
trace[Meta.Tactic.simp.discharge] "{lemmaName}, failed to synthesize instance{indentExpr type}"

20
tests/lean/run/790.lean Normal file
View file

@ -0,0 +1,20 @@
class Vec (X : Type) extends Add X, Inhabited X
class Vec' (X : Type) extends Vec X
def differential {X Y : Type} [Vec X] [Vec Y] (f : X → Y) (x dx : X) : Y := f dx
@[simp]
theorem differential_of_linear {X Y : Type} [Vec X] [Vec Y] (f : X → Y) (x dx : X)
: differential f x dx = f dx := by simp[differential]
example {X Y : Type} [Vec X] [Vec Y] (f : X → Y) (x dx : X)
: differential f x dx = f dx := by simp
instance : Vec Nat := ⟨⟩
instance : Vec' Nat := ⟨⟩
set_option trace.Meta.Tactic.simp true
example {Y : Type} [Vec Y] (f : Nat → Y) (x dx : Nat)
: @differential _ _ Vec'.toVec _ f x dx = f dx :=
by simp