Universe Set_u.
Universe Set_V.
Constraint Set_u < Set_V.
Create HintDb aczel_hints.
Inductive Tree : Type@{Set_V} :=
| mkNode (cs : Type@{Set_u}) (ts : forall c : cs, Tree) : Tree.
Fixpoint eqTree (lhs : Tree) (rhs : Tree) : Prop :=
match lhs, rhs with
| mkNode cs1 ts1, mkNode cs2 ts2 => (forall c1 : cs1, exists c2 : cs2, eqTree (ts1 c1) (ts2 c2)) /\ (forall c2 : cs2, exists c1 : cs1, eqTree (ts1 c1) (ts2 c2))
end.
#[global]
Instance eqTree_Reflexive
: Reflexive eqTree.
#[global] Hint Resolve member_intro : aczel_hints.
Definition isSubsetOf x y : Prop :=
forall z, z \in x -> z \in y.
#[local] Infix "\subseteq" := isSubsetOf : type_scope.
#[global] Hint Unfold isSubsetOf : aczel_hints.
#[global]
Instance isSubsetOf_PreOrder
: PreOrder isSubsetOf.
#[global]
Instance isSubsetOf_PartialOrder
: PartialOrder eqProp isSubsetOf.
#[global]
Add Parametric Morphism
: isSubsetOf with signature (eqProp ==> eqProp ==> iff)
as isSubsetOf_compatWith_eqProp.
Proof with eauto with *.
intros x1 y1 EQ1 x2 y2 EQ2. transitivity (x1 \subseteq y2); unfold "\subseteq"; split; intros SUBSET z H_in.
- rewrite <- EQ2...
- rewrite -> EQ2...
- rewrite <- EQ1 in H_in...
- rewrite -> EQ1 in H_in...
Qed.
(** Section SET_CONSTRUCTIONS. *)
#[local] Opaque eqProp.
Definition filterc (x : Tree) (P : children x -> Prop) : Tree :=
mkNode (@sig (children x) P) (fun c => childnodes x (proj1_sig c)).

Theorem filterc_spec x P
: forall z, z \in filterc x P <-> (exists cx : children x, z == childnodes x cx /\ P cx).