2014-08-24 19:58:48 -07:00
|
|
|
import logic
|
2014-07-10 14:43:55 +01:00
|
|
|
|
|
|
|
namespace setoid
|
|
|
|
inductive setoid : Type :=
|
2014-08-22 15:46:10 -07:00
|
|
|
mk_setoid: Π (A : Type'), (A → A → Prop) → setoid
|
2014-07-10 14:43:55 +01:00
|
|
|
|
|
|
|
set_option pp.universes true
|
|
|
|
|
|
|
|
check setoid
|
|
|
|
definition test : Type.{2} := setoid.{0}
|
|
|
|
|
|
|
|
definition carrier (s : setoid)
|
2014-09-04 15:03:59 -07:00
|
|
|
:= setoid.rec (λ a eq, a) s
|
2014-07-10 14:43:55 +01:00
|
|
|
|
2014-07-22 09:43:18 -07:00
|
|
|
definition eqv {s : setoid} : carrier s → carrier s → Prop
|
2014-09-04 15:03:59 -07:00
|
|
|
:= setoid.rec (λ a eqv, eqv) s
|
2014-07-10 14:43:55 +01:00
|
|
|
|
2014-10-21 15:27:45 -07:00
|
|
|
infix `≈` := eqv
|
2014-07-10 14:43:55 +01:00
|
|
|
|
2015-01-24 20:23:21 -08:00
|
|
|
attribute carrier [coercion]
|
2014-07-10 14:43:55 +01:00
|
|
|
|
|
|
|
inductive morphism (s1 s2 : setoid) : Type :=
|
2014-09-04 16:36:06 -07:00
|
|
|
mk : Π (f : s1 → s2), (∀ x y, x ≈ y → f x ≈ f y) → morphism s1 s2
|
2014-07-10 14:43:55 +01:00
|
|
|
|
2014-09-04 16:36:06 -07:00
|
|
|
check morphism.mk
|
2014-07-10 14:43:55 +01:00
|
|
|
check λ (s1 s2 : setoid), s1
|
|
|
|
check λ (s1 s2 : Type), s1
|
|
|
|
|
|
|
|
inductive morphism2 (s1 : setoid) (s2 : setoid) : Type :=
|
2014-09-04 16:36:06 -07:00
|
|
|
mk : Π (f : s1 → s2), (∀ x y, x ≈ y → f x ≈ f y) → morphism2 s1 s2
|
2014-07-10 14:43:55 +01:00
|
|
|
|
|
|
|
check morphism2
|
2014-09-04 16:36:06 -07:00
|
|
|
check morphism2.mk
|
2014-07-10 14:43:55 +01:00
|
|
|
|
|
|
|
inductive my_struct : Type :=
|
2014-08-22 15:46:10 -07:00
|
|
|
mk_foo : Π (s1 s2 : setoid) (s3 s4 : setoid), morphism2 s1 s2 → morphism2 s3 s4 → my_struct
|
2014-07-10 14:43:55 +01:00
|
|
|
|
|
|
|
check my_struct
|
2014-08-12 15:00:32 -07:00
|
|
|
definition tst2 : Type.{4} := my_struct.{1 2 1 2}
|
2014-09-04 15:03:59 -07:00
|
|
|
end setoid
|