2016-06-18 24 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