End EqTheory.
Arguments supportP {aT rT y D g}.
Notation pfamily y D F := (pfamily_mem y (mem D) (fun_of_simpl (fmem F))).
Notation pffun_on y D R := (pffun_on_mem y (mem D) (mem R)).
Definition finfun_choiceMixin aT (rT : choiceType) :=
[choiceMixin of finfun_type aT rT by <:].
Canonical finfun_choiceType aT rT :=
Eval hnf in ChoiceType _ (finfun_choiceMixin aT rT).
Canonical finfun_of_choiceType (aT : finType) (rT : choiceType) :=
Eval hnf in [choiceType of {ffun aT -> rT}].
Definition finfun_countMixin aT (rT : countType) :=
[countMixin of finfun_type aT rT by <:].
Canonical finfun_countType aT (rT : countType) :=
Eval hnf in CountType _ (finfun_countMixin aT rT).
Canonical finfun_of_countType (aT : finType) (rT : countType) :=
Eval hnf in [countType of {ffun aT -> rT}].
Canonical finfun_subCountType aT (rT : countType) :=
Eval hnf in [subCountType of finfun_type aT rT].
Canonical finfun_of_subCountType (aT : finType) (rT : countType) :=
Eval hnf in [subCountType of {ffun aT -> rT}].
(*****************************************************************************)
Section FinTheory.
Variables aT rT : finType.
Notation fT := {ffun aT -> rT}.
Notation ffT := (finfun_type aT rT).
Implicit Types (D : pred aT) (R : pred rT) (F : aT -> pred rT).
Definition finfun_finMixin := [finMixin of ffT by <:].
Canonical finfun_finType := Eval hnf in FinType ffT finfun_finMixin.
Canonical finfun_subFinType := Eval hnf in [subFinType of ffT].
Canonical finfun_of_finType := Eval hnf in [finType of fT for finfun_finType].
Canonical finfun_of_subFinType := Eval hnf in [subFinType of fT].

(* Specifications: *)
Lemma card_pfamily y0 D F :
#|pfamily y0 D F| = foldr muln 1 [seq #|F x| | x in D].
Lemma card_family F : #|family F| = foldr muln 1 [seq #|F x| | x : aT].
Lemma card_pffun_on y0 D R : #|pffun_on y0 D R| = #|R| ^ #|D|.
Lemma card_ffun_on R : #|ffun_on R| = #|R| ^ #|aT|.
Lemma card_ffun : #|fT| = #|rT| ^ #|aT|.