2014-09-20 16:00:10 +00:00
|
|
|
import data.nat
|
|
|
|
open nat
|
|
|
|
|
|
|
|
inductive functor (A B : Type) :=
|
|
|
|
mk : (A → B) → functor A B
|
|
|
|
|
|
|
|
definition functor.to_fun [coercion] {A B : Type} (f : functor A B) : A → B :=
|
|
|
|
functor.rec (λ f, f) f
|
|
|
|
|
|
|
|
inductive struct :=
|
|
|
|
mk : Π (A : Type), (A → A → Prop) → struct
|
|
|
|
|
|
|
|
definition struct.to_sort [coercion] (s : struct) : Type :=
|
|
|
|
struct.rec (λA r, A) s
|
|
|
|
|
|
|
|
definition g (f : nat → nat) (a : nat) := f a
|
|
|
|
|
2014-10-02 23:20:52 +00:00
|
|
|
constant f : functor nat nat
|
2014-09-20 16:00:10 +00:00
|
|
|
|
|
|
|
check g (functor.to_fun f) 0
|
|
|
|
|
|
|
|
check g f 0
|
|
|
|
|
|
|
|
|
2014-10-02 23:20:52 +00:00
|
|
|
constant S : struct
|
|
|
|
constant a : S
|
2014-09-20 16:00:10 +00:00
|
|
|
|
2015-11-21 00:46:10 +00:00
|
|
|
check @id (struct.to_sort S) a
|
|
|
|
check @id S a
|