fact
stringlengths
8
1.54k
type
stringclasses
19 values
library
stringclasses
8 values
imports
listlengths
1
10
filename
stringclasses
98 values
symbolic_name
stringlengths
1
42
docstring
stringclasses
1 value
val_insubdu0 x : val (insubd u0 x) = if P x then x else val u0. Proof. by rewrite /insubd; case: insubP => [u -> | /negPf->]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
val_insubd
insubdKu0 : {in P, cancel (insubd u0) val}. Proof. by move=> x Px; rewrite val_insubd [P x]Px. Qed. Let insub_eq_aux x isPx : P x = isPx -> option sT := if isPx as b return _ = b -> _ then fun Px => Some (Sub x Px) else fun=> None.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
insubdK
insub_eqx := insub_eq_aux (erefl (P x)).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
insub_eq
insub_eqE: insub_eq =1 insub. Proof. rewrite /insub_eq => x; set b := P x; rewrite [in LHS]/b in (Db := erefl b) *. by case: b in Db *; [rewrite insubT | rewrite insubF]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
insub_eqE
NewMixinT U v c Urec sk := let Urec' P IH := Urec P (fun x : T => IH x isT : P _) in @isSub.phant_Build _ _ U v (fun x _ => c x) Urec' sk.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
NewMixin
innewT nT x := @Sub T predT nT x (erefl true). Arguments innew {T nT}.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
innew
innew_valT nT : cancel val (@innew T nT). Proof. by move=> u; apply: val_inj; apply: SubK. Qed. HB.instance Definition _ T (P : pred T) := [isSub of sig P for sval].
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
innew_val
insigdT (A : mem_pred T) x (Ax : in_mem x A) := insubd (exist [eta A] x Ax).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
insigd
inj_typeof injective f : Type := T.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
inj_type
pcan_typeg of pcancel f g : Type := T.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
pcan_type
can_typeg of cancel f g : Type := T.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
can_type
inj_eqAxiom: injective f -> Equality.axiom (fun x y => f x == f y). Proof. by move=> f_inj x y; apply: (iffP eqP) => [|-> //]; apply: f_inj. Qed. HB.instance Definition _ f_inj := hasDecEq.Build (inj_type f_inj) (inj_eqAxiom f_inj). HB.instance Definition _ g (fK : pcancel f g) := Equality.copy (pcan_type fK) (inj_type (pcan_inj fK)). HB.instance Definition _ g (fK : cancel f g) := Equality.copy (can_type fK) (inj_type (can_inj fK)).
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
inj_eqAxiom
deprecated_InjEqMixinf_inj := hasDecEq.Build T (inj_eqAxiom f_inj).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
deprecated_InjEqMixin
deprecated_PcanEqMixing (fK : pcancel f g) := deprecated_InjEqMixin (pcan_inj fK).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
deprecated_PcanEqMixin
deprecated_CanEqMixing (fK : cancel f g) := deprecated_InjEqMixin (can_inj fK).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
deprecated_CanEqMixin
sub_typeT (P : pred T) (sT : subType P) : Type := sT. HB.instance Definition _ T (P : pred T) (sT : subType P) := SubType.on (sub_type sT).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
sub_type
val_eqP: ev_ax sT val. Proof. exact: inj_eqAxiom val_inj. Qed. #[hnf] HB.instance Definition _ := Equality.copy (sub_type sT) (pcan_type valK).
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
val_eqP
val_eqE(T : eqType) (P : pred T) (sT : subEqType P) (u v : sT) : (val u == val v) = (u == v). Proof. exact/val_eqP/eqP. Qed. Arguments val_eqP {T P sT x y}.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
val_eqE
Definition_ := Equality.copy void (pcan_type (of_voidK unit)). HB.instance Definition _ (T : eqType) (P : pred T) := [Equality of {x | P x} by <:].
HB.instance
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
Definition
pair_eq: rel (T1 * T2) := fun u v => (u.1 == v.1) && (u.2 == v.2).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
pair_eq
pair_eqP: Equality.axiom pair_eq. Proof. move=> [x1 x2] [y1 y2] /=; apply: (iffP andP) => [[]|[<- <-]] //=. by do 2!move/eqP->. Qed. HB.instance Definition _ := hasDecEq.Build (T1 * T2)%type pair_eqP.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
pair_eqP
pair_eqE: pair_eq = eq_op :> rel _. Proof. by []. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
pair_eqE
xpair_eqE(x1 y1 : T1) (x2 y2 : T2) : ((x1, x2) == (y1, y2)) = ((x1 == y1) && (x2 == y2)). Proof. by []. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
xpair_eqE
pair_eq1(u v : T1 * T2) : u == v -> u.1 == v.1. Proof. by case/andP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
pair_eq1
pair_eq2(u v : T1 * T2) : u == v -> u.2 == v.2. Proof. by case/andP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
pair_eq2
predXT1 T2 (p1 : pred T1) (p2 : pred T2) := [pred z | p1 z.1 & p2 z.2].
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
predX
opt_eq(u v : option T) : bool := oapp (fun x => oapp (eq_op x) false v) (~~ v) u.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
opt_eq
opt_eqP: Equality.axiom opt_eq. Proof. case=> [x|] [y|] /=; by [constructor | apply: (iffP eqP) => [|[]] ->]. Qed. HB.instance Definition _ := hasDecEq.Build (option T) opt_eqP.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
opt_eqP
tagged_asu v := if tag u =P tag v is ReflectT eq_uv then eq_rect_r T_ (tagged v) eq_uv else tagged u.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
tagged_as
tagged_asEu x : tagged_as u (Tagged T_ x) = x. Proof. by rewrite /tagged_as /=; case: eqP => // eq_uu; rewrite [eq_uu]eq_axiomK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
tagged_asE
etaggedi u (p : tag u = i) := ecast i (T_ i) p (tagged u). Implicit Types (i j : I) (u v : T).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
etagged
eq_from_Taggedi (t s : T_ i) : Tagged T_ t = Tagged T_ s -> t = s. Proof. by move=> /(congr1 (tagged_as (Tagged T_ t))); rewrite !tagged_asE. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
eq_from_Tagged
etaggedKi u (p : tag u = i) : Tagged T_ (etagged p) = u. Proof. by case: _ / p; apply: taggedK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
etaggedK
tagged_withi : pred {i : I & T_ i} := [pred j | tag j == i].
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
tagged_with
untag_withi (x : {x in tagged_with i}) : T_ i := etagged (eqP (valP x)).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
untag_with
tag_withi (t : T_ i) : {x in tagged_with i} := exist _ (Tagged T_ t) (eq_refl i).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
tag_with
untag_withKi : cancel (@untag_with i) (@tag_with i). Proof. by case=> -[j /= x eq_ji]; apply/val_inj=> /=; rewrite etaggedK. Qed. #[local] Hint Resolve untag_withK : core.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
untag_withK
tag_withKi : cancel (@tag_with i) (@untag_with i). Proof. by move=> x; rewrite /untag_with/= eq_axiomK. Qed. #[local] Hint Resolve tag_withK : core.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
tag_withK
tag_with_biji : bijective (@tag_with i). Proof. by exists (@untag_with i). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
tag_with_bij
untag_with_biji : bijective (@untag_with i). Proof. by exists (@tag_with i). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
untag_with_bij
untag(R : Type) (idx : R) (i : I) (F : T_ i -> R) u := if tag u =P i is ReflectT e then F (etagged e) else idx.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
untag
untagE(R : Type) (idx : R) (i : I) (F : T_ i -> R) u (e : tag u = i): untag idx F u = F (etagged e). Proof. by rewrite /untag; case: eqP => // p; rewrite (eq_irrelevance p e). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
untagE
untag_dflt(R : Type) (idx : R) (i : I) (F : T_ i -> R) u : tag u != i -> untag idx F u = idx. Proof. by rewrite /untag; case: eqP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
untag_dflt
untag_cst(R : Type) (idx : R) (i : I) u : untag idx (fun _ : T_ i => idx) u = idx. Proof. by rewrite /untag; case: eqP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
untag_cst
tag_equ v := (tag u == tag v) && (tagged u == tagged_as u v).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
tag_eq
tag_eqP: Equality.axiom tag_eq. Proof. rewrite /tag_eq => [] [i x] [j] /=. case: eqP => [<-|Hij] y; last by right; case. by apply: (iffP eqP) => [->|<-]; rewrite tagged_asE. Qed. HB.instance Definition _ := hasDecEq.Build {i : I & T_ i} tag_eqP.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
tag_eqP
tag_eqE: tag_eq = eq_op. Proof. by []. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
tag_eqE
eq_tagu v : u == v -> tag u = tag v. Proof. by move/eqP->. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
eq_tag
eq_Taggedu x :(u == Tagged _ x) = (tagged u == x). Proof. by rewrite -tag_eqE /tag_eq eqxx tagged_asE. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
eq_Tagged
sum_equ v := match u, v with | inl x, inl y | inr x, inr y => x == y | _, _ => false end.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
sum_eq
sum_eqP: Equality.axiom sum_eq. Proof. case=> x [] y /=; by [right | apply: (iffP eqP) => [->|[->]]]. Qed. HB.instance Definition _ := hasDecEq.Build (T1 + T2)%type sum_eqP.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
sum_eqP
sum_eqE: sum_eq = eq_op. Proof. by []. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
sum_eqE
homoW_in: {in D & D', {homo f : x y / aR' x y >-> rR' x y}} -> {in D & D', {homo f : x y / aR x y >-> rR x y}}. Proof. by move=> mf x y xD yD /[!aRE]/orP[/eqP->|/mf]; rewrite rRE ?eqxx// orbC => ->. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
homoW_in
inj_homo_in: {in D & D', injective f} -> {in D & D', {homo f : x y / aR x y >-> rR x y}} -> {in D & D', {homo f : x y / aR' x y >-> rR' x y}}. Proof. move=> fI mf x y xD yD /[!(aR'E, rR'E)] /andP[neq_xy xy]. by rewrite mf ?andbT//; apply: contra_neq neq_xy; apply: fI. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
inj_homo_in
mono_inj_in: {in D &, {mono f : x y / aR x y >-> rR x y}} -> {in D &, injective f}. Proof. by move=> mf x y ?? eqf; apply/aR_anti; rewrite -!mf// eqf rR_refl. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
mono_inj_in
anti_mono_in: {in D &, {mono f : x y / aR x y >-> rR x y}} -> {in D &, {mono f : x y / aR' x y >-> rR' x y}}. Proof. move=> mf x y ??; rewrite rR'E aR'E mf// (@inj_in_eq _ _ D)//. exact: mono_inj_in. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
anti_mono_in
total_homo_mono_in: total aR -> {in D &, {homo f : x y / aR' x y >-> rR' x y}} -> {in D &, {mono f : x y / aR x y >-> rR x y}}. Proof. move=> aR_tot mf x y xD yD. have [->|neq_xy] := eqVneq x y; first by rewrite ?eqxx ?aR_refl ?rR_refl. have [xy|] := (boolP (aR x y)); first by rewrite rRE mf ?orbT// aR'E neq_xy. have /orP [->//|] := aR_tot x y. rewrite aRE eq_sym (negPf neq_xy) /= => /mf -/(_ yD xD). rewrite rR'E => /andP[Nfxfy fyfx] _; apply: contra_neqF Nfxfy => fxfy. by apply/rR_anti; rewrite fyfx fxfy. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
total_homo_mono_in
homoW: {homo f : x y / aR' x y >-> rR' x y} -> {homo f : x y / aR x y >-> rR x y}. Proof. by move=> mf ???; apply: (@homoW_in D D) => // ????; apply: mf. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
homoW
inj_homo: injective f -> {homo f : x y / aR x y >-> rR x y} -> {homo f : x y / aR' x y >-> rR' x y}. Proof. by move=> fI mf ???; apply: (@inj_homo_in D D) => //????; [apply: fI|apply: mf]. Qed. Hypothesis aR_anti : antisymmetric aR. Hypothesis rR_anti : antisymmetric rR.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
inj_homo
mono_inj: {mono f : x y / aR x y >-> rR x y} -> injective f. Proof. by move=> mf x y eqf; apply/aR_anti; rewrite -!mf eqf rR_refl. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
mono_inj
anti_mono: {mono f : x y / aR x y >-> rR x y} -> {mono f : x y / aR' x y >-> rR' x y}. Proof. by move=> mf x y; rewrite rR'E aR'E mf inj_eq //; apply: mono_inj. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
anti_mono
total_homo_mono: total aR -> {homo f : x y / aR' x y >-> rR' x y} -> {mono f : x y / aR x y >-> rR x y}. Proof. move=> /(@total_homo_mono_in D rR_anti) hmf hf => x y. by apply: hmf => // ?? _ _; apply: hf. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool" ]
boot/eqtype.v
total_homo_mono
finfun_on: seq aT -> Type := | finfun_nil : finfun_on [::] | finfun_cons x s of rT x & finfun_on s : finfun_on (x :: s). Local Fixpoint finfun_rec (g : forall x, rT x) s : finfun_on s := if s is x1 :: s1 then finfun_cons (g x1) (finfun_rec g s1) else finfun_nil. Local Fixpoint fun_of_fin_rec x s (f_s : finfun_on s) : x \in s -> rT x := if f_s is finfun_cons x1 s1 y1 f_s1 then if eqP is ReflectT Dx in reflect _ Dxb return Dxb || (x \in s1) -> rT x then fun=> ecast x (rT x) (esym Dx) y1 else fun_of_fin_rec f_s1 else fun isF => False_rect (rT x) (notF isF).
Inductive
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
finfun_on
finfun_of(ph : phant (forall x, rT x)) : predArgType := FinfunOf of finfun_on (enum aT).
Variant
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
finfun_of
dfinfun_ofph := finfun_of ph.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
dfinfun_of
fun_of_finph (f : finfun_of ph) x := let: FinfunOf f_aT := f in fun_of_fin_rec f_aT (mem_enum aT x).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
fun_of_fin
fun_of_fin: finfun_of >-> Funclass. Identity Coercion unfold_dfinfun_of : dfinfun_of >-> finfun_of. Arguments fun_of_fin {aT rT ph} f x.
Coercion
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
fun_of_fin
exp_finIndexTypen : finType := 'I_n.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
exp_finIndexType
finfun_unlock:= Unlockable finfun.unlock. Arguments finfun {aT rT} g.
Canonical
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
finfun_unlock
tree:= node n of tree ^ n.
Inductive
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
tree
sizet := let: node n f := t in sumn (codom (size \o f)) + 1. Example tree_step (K : tree -> Type) := forall n st (t := node st) & forall i : 'I_n, K (st i), K t. Example tree_rect K (Kstep : tree_step K) : forall t, K t. Proof. by fix IHt 1 => -[n st]; apply/Kstep=> i; apply: IHt. Defined.
Fixpoint
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
size
tri_treen := tri_row of {ffun forall i : 'I_n, tri_tree i}.
Inductive
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
tri_tree
tri_sizen (t : tri_tree n) := let: tri_row f := t in sumn [seq tri_size (f i) | i : 'I_n] + 1. Example tri_tree_step (K : forall n, tri_tree n -> Type) := forall n st (t := tri_row st) & forall i : 'I_n, K i (st i), K n t. Example tri_tree_rect K (Kstep : tri_tree_step K) : forall n t, K n t. Proof. by fix IHt 2 => n [st]; apply/Kstep=> i; apply: IHt. Defined. Set Elimination Schemes.
Fixpoint
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
tri_size
fT:= {ffun finPi aT rT}. Implicit Type f : fT. Fact ffun0 (aT0 : #|aT| = 0) : fT. Proof. by apply/finfun=> x; have:= card0_eq aT0 x. Qed.
Notation
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
fT
ffunEg x : (finfun g : fT) x = g x. Proof. rewrite unlock /=; set s := enum aT; set s_x : mem_seq s x := mem_enum _ _. by elim: s s_x => //= x1 s IHs; case: eqP => [|_]; [case: x1 / | apply: IHs]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
ffunE
ffunP(f1 f2 : fT) : (forall x, f1 x = f2 x) <-> f1 = f2. Proof. suffices ffunK f g: (forall x, f x = g x) -> f = finfun g. by split=> [/ffunK|] -> //; apply/esym/ffunK. case: f => f Dg; rewrite unlock; congr FinfunOf. have{} Dg x (aTx : mem_seq (enum aT) x): g x = fun_of_fin_rec f aTx. by rewrite -Dg /= (bool_irrelevance (mem_enum _ _) aTx). elim: (enum aT) / f (enum_uniq aT) => //= x1 s y f IHf /andP[s'x1 Us] in Dg *. rewrite Dg ?eqxx //=; case: eqP => // /eq_axiomK-> /= _. rewrite {}IHf // => x s_x; rewrite Dg ?s_x ?orbT //. by case: eqP (memPn s'x1 x s_x) => // _ _ /(bool_irrelevance s_x) <-. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
ffunP
ffunK: @cancel (finPi aT rT) fT fun_of_fin finfun. Proof. by move=> f; apply/ffunP=> x; rewrite ffunE. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
ffunK
eq_dffun(g1 g2 : forall x, rT x) : (forall x, g1 x = g2 x) -> finfun g1 = finfun g2. Proof. by move=> eq_g; apply/ffunP => x; rewrite !ffunE eq_g. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
eq_dffun
total_fung x := Tagged rT (g x : rT x).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
total_fun
tfgraphf := codom_tuple (total_fun f).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
tfgraph
codom_tffunf : codom (total_fun f) = tfgraph f. Proof. by []. Qed. Local Definition tfgraph_inv (G : #|aT|.-tuple {x : aT & rT x}) : option fT := if eqfunP isn't ReflectT Dtg then None else Some [ffun x => ecast x (rT x) (Dtg x) (tagged (tnth G (enum_rank x)))]. Local Lemma tfgraphK : pcancel tfgraph tfgraph_inv. Proof. move=> f; have Dg x: tnth (tfgraph f) (enum_rank x) = total_fun f x. by rewrite tnth_map -[tnth _ _]enum_val_nth enum_rankK. rewrite /tfgraph_inv; case: eqfunP => /= [Dtg | [] x]; last by rewrite Dg. congr (Some _); apply/ffunP=> x; rewrite ffunE. by rewrite Dg in (Dx := Dtg x) *; rewrite eq_axiomK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
codom_tffun
tfgraph_inj: injective tfgraph. Proof. exact: pcan_inj tfgraphK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
tfgraph_inj
family_memmF := [pred f : fT | [forall x, in_mem (f x) (mF x)]]. Variables (pT : forall x, predType (rT x)) (F : forall x, pT x).
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
family_mem
familyPf : reflect (forall x, f x \in F x) (f \in family_mem (fmem F)). Proof. exact: forallP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
familyP
familyF := (family_mem (fmem F)).
Notation
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
family
dffun_aTrT rS := {dffun forall x : aT, rT x : rS}. #[hnf] HB.instance Definition _ rT := Equality.copy (dffun_aT rT eqType) (pcan_type tfgraphK). #[hnf] HB.instance Definition _ (rT : eqType) := Equality.copy {ffun aT -> rT} {dffun forall _, rT}. #[hnf] HB.instance Definition _ rT := Choice.copy (dffun_aT rT choiceType) (pcan_type tfgraphK). #[hnf] HB.instance Definition _ (rT : choiceType) := Choice.copy {ffun aT -> rT} {dffun forall _, rT}. #[hnf] HB.instance Definition _ rT := Countable.copy (dffun_aT rT countType) (pcan_type tfgraphK). #[hnf] HB.instance Definition _ (rT : countType) := Countable.copy {ffun aT -> rT} {dffun forall _, rT}. #[hnf] HB.instance Definition _ rT := Finite.copy (dffun_aT rT finType) (pcan_type tfgraphK). #[hnf] HB.instance Definition _ (rT : finType) := Finite.copy {ffun aT -> rT} {dffun forall _, rT}.
Notation
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
dffun_aT
tuple_of_finfun(f : T ^ n) : n.-tuple T := [tuple f i | i < n].
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
tuple_of_finfun
finfun_of_tuple(t : n.-tuple T) : (T ^ n) := [ffun i => tnth t i].
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
finfun_of_tuple
finfun_of_tupleK: cancel finfun_of_tuple tuple_of_finfun. Proof. by move=> t; apply: eq_from_tnth => i; rewrite tnth_map ffunE tnth_ord_tuple. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
finfun_of_tupleK
tuple_of_finfunK: cancel tuple_of_finfun finfun_of_tuple. Proof. by move=> f; apply/ffunP => i; rewrite ffunE tnth_map tnth_ord_tuple. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
tuple_of_finfunK
fT:= {ffun aT -> rT}. Implicit Types (f : fT) (R : pred rT).
Notation
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
fT
fgraphf := codom_tuple f.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
fgraph
Finfun(G : #|aT|.-tuple rT) := [ffun x => tnth G (enum_rank x)].
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
Finfun
tnth_fgraphf i : tnth (fgraph f) i = f (enum_val i). Proof. by rewrite tnth_map /tnth -enum_val_nth. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
tnth_fgraph
FinfunK: cancel Finfun fgraph. Proof. by move=> G; apply/eq_from_tnth=> i; rewrite tnth_fgraph ffunE enum_valK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
FinfunK
fgraphK: cancel fgraph Finfun. Proof. by move=> f; apply/ffunP=> x; rewrite ffunE tnth_fgraph enum_rankK. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
fgraphK
fgraph_ffun0aT0 : fgraph (ffun0 aT0) = nil :> seq rT. Proof. by apply/nilP/eqP; rewrite size_tuple. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
fgraph_ffun0
codom_ffunf : codom f = fgraph f. Proof. by []. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
codom_ffun
tagged_tfgraphf : @map _ rT tagged (tfgraph f) = fgraph f. Proof. by rewrite -map_comp. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
tagged_tfgraph
eq_ffun(g1 g2 : aT -> rT) : g1 =1 g2 -> finfun g1 = finfun g2. Proof. exact: eq_dffun. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq choice", "From mathcomp Require Import fintype tuple" ]
boot/finfun.v
eq_ffun