2016-06-18 12 views
1

我无法理解如何触发精益类型类的使用。这里是一个小例子,企图:不能让类型类在精益中工作

section the_section 
structure toto [class] (A : Type) := (rel : A → A → Prop) (Hall : ∀ a, rel a a) 

definition P A := exists (a : A), forall x, x = a 
parameter A : Type 
variable HA : P A 

lemma T [instance] {B : Type} [HPB : P B] : toto B := toto.mk (λ x y, x = y) (λ x, rfl) 

include HA 
example : toto A := _ 
-- this gives the error: don't know how to infer placeholder toto A 

end the_section 

关键是我想精益看到,它可以使用HA来推断从引理T. TOTO一个我缺少什么?

回答

1

再次,我不得不张贴问题找到答案。希望这有助于其他人。

P需要是一个类,所以我们确实需要改变

definition P A := exists (a : A), forall x, x = a 

definition P [class] A := exists (a : A), forall x, x = a