(* Instances that strip the mem cast; the first one has "pred_of_mem" as its  *)
(* projection head value, while the second has "pred_of_simpl". The latter    *)
(* has the side benefit of preempting accidental misdeclarations.             *)
(* Note: pred_of_mem is the registered mem >-> pred_class coercion, while     *)
(* simpl_of_mem; pred_of_simpl is the mem >-> pred >=> Funclass coercion. We  *)
(* must write down the coercions explicitly as the Canonical head constant    *)
(* computation does not strip casts !!                                        *)
Canonical keyed_mem :=
  @PackKeyedPred k (pred_of_mem (mem k_p)) keyed_predE.Canonical keyed_mem_simpl :=
  @PackKeyedPred k (pred_of_simpl (mem k_p)) keyed_predE.Structure keyed_qualifier (k : pred_key q) :=
  PackKeyedQualifier {unkey_qualifier; _ : unkey_qualifier = q}.Structure keyed_qualifier (k : pred_key q) :=
  PackKeyedQualifier {unkey_qualifier; _ : unkey_qualifier = q}.Structure keyed_qualifier (k : pred_key q) :=
  PackKeyedQualifier {unkey_qualifier; _ : unkey_qualifier = q}.Definition KeyedQualifier k := PackKeyedQualifier k (erefl q).Fact keyed_qualifier_suproof : unkey_qualifier k_q =i q.Canonical keyed_qualifier_keyed := PackKeyedPred k keyed_qualifier_suproof.Canonical default_keyed_pred T p := KeyedPred (@DefaultPredKey T p).Canonical default_keyed_qualifier T n (q : qualifier n T) :=
  KeyedQualifier (DefaultPredKey q).

Lemma all_sig_cond_dep I T (C : pred I) P : (forall x, T x) -> (forall x, C x -> {y : T x | P x y}) -> {f : forall x, T x | forall x, C x -> P x (f x)}.