fix: make iff theorem generated by @[ext] preserve inst implicits (#4710)
Previously all arguments from the ext theorem were made implicit, but now only default and strict implicits are made implicit.
This commit is contained in:
parent
0f48e926eb
commit
3c18d151a6
2 changed files with 16 additions and 1 deletions
|
|
@ -85,7 +85,12 @@ def mkExtIffType (extThmName : Name) : MetaM Expr := withLCtx {} {} do
|
|||
if fvars.fvarSet.contains fvar.fvarId! then
|
||||
throwError "argument {fvar} is depended upon, which is not supported"
|
||||
let conj := mkAndN (← toRevert.mapM (inferType ·)).toList
|
||||
withNewBinderInfos (args |>.extract 0 startIdx |>.map (·.fvarId!, .implicit)) do
|
||||
-- Make everything implicit except for inst implicits
|
||||
let mut newBis := #[]
|
||||
for fvar in args[0:startIdx] do
|
||||
if (← fvar.fvarId!.getBinderInfo) matches .default | .strictImplicit then
|
||||
newBis := newBis.push (fvar.fvarId!, .implicit)
|
||||
withNewBinderInfos newBis do
|
||||
mkForallFVars args[:startIdx] <| mkIff ty conj
|
||||
|
||||
/--
|
||||
|
|
|
|||
|
|
@ -128,3 +128,13 @@ theorem MyFun.ext {α β : Type _} (x y : MyFun α β) (h : ∀ a, x.toFun a = y
|
|||
info: MyFun.ext_iff.{u_1, u_2} {α : Type u_1} {β : Type u_2} {x y : MyFun α β} : x = y ↔ ∀ (a : α), x.toFun a = y.toFun a
|
||||
-/
|
||||
#guard_msgs in #check MyFun.ext_iff
|
||||
|
||||
|
||||
/-!
|
||||
Preserving inst implicits in ext_iff theorem
|
||||
-/
|
||||
section
|
||||
attribute [local ext] Subsingleton.elim
|
||||
/-- info: Subsingleton.elim_iff.{u} {α : Sort u} [h : Subsingleton α] {a b : α} : a = b ↔ True -/
|
||||
#guard_msgs in #check Subsingleton.elim_iff
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue