2017-08-03 12:27:43 +02:00
|
|
|
|
Require Import HoTT.
|
2017-08-08 19:56:39 +02:00
|
|
|
|
Require Import disjunction lattice notation.
|
2017-08-03 12:27:43 +02:00
|
|
|
|
|
|
|
|
|
Section subobjects.
|
|
|
|
|
Variable A : Type.
|
|
|
|
|
|
|
|
|
|
Definition Sub := A -> hProp.
|
2017-08-03 15:07:53 +02:00
|
|
|
|
|
2017-08-08 19:56:39 +02:00
|
|
|
|
Global Instance sub_empty : hasEmpty Sub := fun _ => False_hp.
|
|
|
|
|
Global Instance sub_union : hasUnion Sub := max_fun.
|
|
|
|
|
Global Instance sub_intersection : hasIntersection Sub := min_fun.
|
|
|
|
|
Global Instance sub_singleton : hasSingleton Sub A
|
|
|
|
|
:= fun a b => BuildhProp (Trunc (-1) (b = a)).
|
|
|
|
|
Global Instance sub_membership : hasMembership Sub A := fun a X => X a.
|
|
|
|
|
Global Instance sub_comprehension : hasComprehension Sub A
|
|
|
|
|
:= fun ϕ X a => BuildhProp (X a * (ϕ a = true)).
|
|
|
|
|
Global Instance sub_subset `{Univalence} : hasSubset Sub
|
|
|
|
|
:= fun X Y => BuildhProp (forall a, X a -> Y a).
|
2017-08-03 15:07:53 +02:00
|
|
|
|
|
2017-08-03 12:27:43 +02:00
|
|
|
|
End subobjects.
|
|
|
|
|
|
2017-08-03 15:07:53 +02:00
|
|
|
|
Section sub_classes.
|
|
|
|
|
Context {A : Type}.
|
2017-08-03 12:27:43 +02:00
|
|
|
|
Variable C : (A -> hProp) -> hProp.
|
|
|
|
|
Context `{Univalence}.
|
|
|
|
|
|
|
|
|
|
Instance blah : Lattice (Sub A).
|
|
|
|
|
Proof.
|
|
|
|
|
unfold Sub.
|
|
|
|
|
apply _.
|
|
|
|
|
Defined.
|
|
|
|
|
|
2017-08-08 19:56:39 +02:00
|
|
|
|
Definition closedUnion := forall X Y, C X -> C Y -> C (X ∪ Y).
|
|
|
|
|
Definition closedIntersection := forall X Y, C X -> C Y -> C (X ∩ Y).
|
|
|
|
|
Definition closedEmpty := C ∅.
|
|
|
|
|
Definition closedSingleton := forall a, C {|a|}.
|
|
|
|
|
Definition hasDecidableEmpty := forall X, C X -> hor (X = ∅) (hexists (fun a => a ∈ X)).
|
2017-08-03 15:07:53 +02:00
|
|
|
|
End sub_classes.
|
|
|
|
|
|
|
|
|
|
Section isIn.
|
|
|
|
|
Variable A : Type.
|
|
|
|
|
Variable C : (A -> hProp) -> hProp.
|
|
|
|
|
|
|
|
|
|
Context `{Univalence}.
|
2017-08-08 17:44:27 +02:00
|
|
|
|
Context {HS : closedSingleton C} {HIn : forall X, C X -> forall a, Decidable (X a)}.
|
2017-08-03 15:07:53 +02:00
|
|
|
|
|
|
|
|
|
Theorem decidable_A_isIn : forall a b : A, Decidable (Trunc (-1) (b = a)).
|
|
|
|
|
Proof.
|
|
|
|
|
intros.
|
2017-08-08 17:44:27 +02:00
|
|
|
|
unfold Decidable, closedSingleton in *.
|
2017-08-08 19:56:39 +02:00
|
|
|
|
pose (HIn {|a|} (HS a) b).
|
2017-08-03 15:07:53 +02:00
|
|
|
|
destruct s.
|
|
|
|
|
- unfold singleton in t.
|
|
|
|
|
left.
|
|
|
|
|
apply t.
|
|
|
|
|
- right.
|
|
|
|
|
intro p.
|
|
|
|
|
unfold singleton in n.
|
|
|
|
|
strip_truncations.
|
|
|
|
|
contradiction (n (tr p)).
|
|
|
|
|
Defined.
|
|
|
|
|
|
|
|
|
|
End isIn.
|
|
|
|
|
|
|
|
|
|
Section intersect.
|
|
|
|
|
Variable A : Type.
|
|
|
|
|
Variable C : (Sub A) -> hProp.
|
|
|
|
|
Context `{Univalence}.
|
2017-08-03 15:10:01 +02:00
|
|
|
|
|
2017-08-03 23:01:57 +02:00
|
|
|
|
Global Instance hprop_lem : forall (T : Type) (Ttrunc : IsHProp T), IsHProp (T + ~T).
|
2017-08-03 15:10:01 +02:00
|
|
|
|
Proof.
|
|
|
|
|
intros.
|
|
|
|
|
apply (equiv_hprop_allpath _)^-1.
|
|
|
|
|
intros [x | nx] [y | ny] ; try f_ap ; try (apply Ttrunc) ; try contradiction.
|
|
|
|
|
- apply equiv_hprop_allpath. apply _.
|
|
|
|
|
Defined.
|
|
|
|
|
|
2017-08-03 15:07:53 +02:00
|
|
|
|
Context
|
2017-08-08 17:44:27 +02:00
|
|
|
|
{HI : closedIntersection C} {HE : closedEmpty C}
|
|
|
|
|
{HS : closedSingleton C} {HDE : hasDecidableEmpty C}.
|
2017-08-03 15:07:53 +02:00
|
|
|
|
|
|
|
|
|
Theorem decidable_A_intersect : forall a b : A, Decidable (Trunc (-1) (b = a)).
|
|
|
|
|
Proof.
|
|
|
|
|
intros.
|
2017-08-08 17:44:27 +02:00
|
|
|
|
unfold Decidable, closedEmpty, closedIntersection, closedSingleton, hasDecidableEmpty in *.
|
2017-08-08 19:56:39 +02:00
|
|
|
|
pose (HI {|a|} {|b|} (HS a) (HS b)) as IntAB.
|
|
|
|
|
pose (HDE ({|a|} ∪ {|b|}) IntAB) as IntE.
|
2017-08-03 15:07:53 +02:00
|
|
|
|
refine (@Trunc_rec _ _ _ _ _ IntE) ; intros [p | p] ; unfold min_fun, singleton in p.
|
|
|
|
|
- right.
|
|
|
|
|
intro q.
|
2017-08-08 19:56:39 +02:00
|
|
|
|
strip_truncations.
|
|
|
|
|
rewrite q in p.
|
|
|
|
|
enough (a ∈ ∅) as X.
|
|
|
|
|
{ apply X. }
|
|
|
|
|
rewrite <- p.
|
|
|
|
|
cbn.
|
|
|
|
|
split ; apply (tr idpath).
|
2017-08-03 15:07:53 +02:00
|
|
|
|
- strip_truncations.
|
|
|
|
|
destruct p as [a0 [t1 t2]].
|
|
|
|
|
strip_truncations.
|
|
|
|
|
apply (inl (tr (t2^ @ t1))).
|
|
|
|
|
Defined.
|
2017-08-03 15:10:01 +02:00
|
|
|
|
End intersect.
|