Definition tree_eqMixin (T : eqType) := PcanEqMixin (GenTree.codeK T).Canonical tree_eqType (T : eqType) := EqType (GenTree.tree T) (tree_eqMixin T).Record mixin_of T := Mixin {
  find : pred T -> nat -> option T;
  _ : forall P n x, find P n = Some x -> P x;
  _ : forall P : pred T, (exists x, P x) -> exists n, find P n;
  _ : forall P Q : pred T, P =1 Q -> find P =1 find Q
}.Record mixin_of T := Mixin {
  find : pred T -> nat -> option T;
  _ : forall P n x, find P n = Some x -> P x;
  _ : forall P : pred T, (exists x, P x) -> exists n, find P n;
  _ : forall P Q : pred T, P =1 Q -> find P =1 find Q
}.Record mixin_of T := Mixin {
  find : pred T -> nat -> option T;
  _ : forall P n x, find P n = Some x -> P x;
  _ : forall P : pred T, (exists x, P x) -> exists n, find P n;
  _ : forall P Q : pred T, P =1 Q -> find P =1 find Q
}.Record class_of T := Class {base : Equality.class_of T; mixin : mixin_of T}.Record class_of T := Class {base : Equality.class_of T; mixin : mixin_of T}.Record class_of T := Class {base : Equality.class_of T; mixin : mixin_of T}.Record class_of T := Class {base : Equality.class_of T; mixin : mixin_of T}.Structure type := Pack {sort; _ : class_of sort}.Structure type := Pack {sort; _ : class_of sort}.Structure type := Pack {sort; _ : class_of sort}.Definition clone c of phant_id class c := @Pack T c.Notation xclass := (class : class_of xT).(* Inheritance *)
Definition eqType := @Equality.Pack cT xclass.Notation choiceType := type.Notation choiceMixin := mixin_of.Notation ChoiceType T m := (@pack T m _ _ id).(* This assumes that T has both countType and subType structures. *)
Notation "[ 'subCountType' 'of' T ]" :=
    (@pack_subCountType _ _ T _ _ id _ _ id)
  (at level 0, format "[ 'subCountType'  'of'  T ]") : form_scope.(* Inner choice function. *)
Definition find T := find (mixin (class T)).Implicit Types P Q : pred T.

Lemma extensional P Q : P =1 Q -> find P =1 find Q.