The main issue is nontermination for problems that do not have solution. When using dependent coercions, we keep creating goals of the form `CoeSort ... (coe (coe (coe ...))) ...`. Same for `CoeFun`. I am considering simplifying it even further, and making sure `CoeDep` can be used at most once in a sequence of coercions `CoeTC`. Another option is to use a very small amount of fuel to guarantee termination when solving coercion TC problems. cc @Kha @dselsam
29 lines
701 B
Text
29 lines
701 B
Text
structure ConstantFunction (α β : Type) :=
|
||
(f : α → β)
|
||
(h : ∀ a₁ a₂, f a₁ = f a₂)
|
||
|
||
instance constFunCoe {α β : Type} : CoeFun (ConstantFunction α β) (fun _ => α → β) :=
|
||
{ coe := fun c => c.f }
|
||
|
||
def myFun {α : Type} : ConstantFunction α (Option α) :=
|
||
{ f := fun a => none,
|
||
h := fun a₁ a₂ => rfl }
|
||
|
||
def myFun' (α : Type) : ConstantFunction α (Option α) :=
|
||
{ f := fun a => none,
|
||
h := fun a₁ a₂ => rfl }
|
||
|
||
new_frontend
|
||
|
||
set_option pp.all true
|
||
|
||
#check myFun 3 -- works
|
||
#check @myFun Nat 3 -- works
|
||
|
||
#check myFun' _ 3 -- works
|
||
#check myFun' Nat 3 -- works
|
||
|
||
variable (c : ConstantFunction Nat Nat)
|
||
#check c 3 -- works
|
||
|
||
#check (fun c => c 3) myFun -- works
|