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
fgraph_codomf : fgraph f = codom_tuple f. Proof. exact/esym/val_inj/codom_ffun. 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_codom
ffun_on_mem(mR : mem_pred rT) := family_mem (fun _ : aT => mR).
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
ffun_on_mem
ffun_onPR f : reflect (forall x, f x \in R) (f \in ffun_on_mem (mem R)). 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
ffun_onP
ffun_onR := (ffun_on_mem _ (mem R)).
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
ffun_on
nth_fgraph_ordT n (x0 : T) (i : 'I_n) f : nth x0 (fgraph f) i = f i. Proof. by rewrite -[i in RHS]enum_rankK -tnth_fgraph (tnth_nth x0) enum_rank_ord. 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
nth_fgraph_ord
support_fory (f : aT -> rT) := [pred x | f x != y].
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
support_for
supportEx y f : (x \in support_for y f) = (f x != y). 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
supportE
fT:= {ffun aT -> rT}. Implicit Types (y : rT) (D : {pred aT}) (R : {pred rT}) (f : fT).
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
supportPy D g : reflect (forall x, x \notin D -> g x = y) (y.-support g \subset D). Proof. by (apply: (iffP subsetP) => Dg x; [apply: contraNeq|apply: contraR]) => /Dg->. 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
supportP
pfamily_memy mD (mF : aT -> mem_pred rT) := family (fun i : aT => if in_mem i mD then pred_of_simpl (mF i) else pred1 y).
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
pfamily_mem
pfamilyP(pT : predType rT) y D (F : aT -> pT) f : reflect (y.-support f \subset D /\ {in D, forall x, f x \in F x}) (f \in pfamily_mem y (mem D) (fmem F)). Proof. apply: (iffP familyP) => [/= f_pfam | [/supportP f_supp f_fam] x]. split=> [|x Ax]; last by have:= f_pfam x; rewrite Ax. by apply/subsetP=> x; case: ifP (f_pfam x) => //= _ fx0 /negP[]. by case: ifPn => Ax /=; rewrite inE /= (f_fam, f_supp). 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
pfamilyP
pffun_on_memy mD mR := pfamily_mem y mD (fun _ => mR).
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
pffun_on_mem
pffun_onPy D R f : reflect (y.-support f \subset D /\ {subset image f D <= R}) (f \in pffun_on_mem y (mem D) (mem R)). Proof. apply: (iffP (pfamilyP y D (fun _ => R) f)) => [] [-> f_fam]; split=> //. by move=> _ /imageP[x Ax ->]; apply: f_fam. by move=> x Ax; apply: f_fam; apply/imageP; exists 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
pffun_onP
pfamilyy D F := (pfamily_mem y (mem D) (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
pfamily
pffun_ony D R := (pffun_on_mem y (mem D) (mem R)).
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
pffun_on
fT:= {dffun forall x : aT, rT x}.
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
card_family(F : forall x, pred (rT x)) : #|(family F : simpl_pred fT)| = foldr muln 1 [seq #|F x| | x : aT]. Proof. rewrite /image_mem; set E := enum aT in (uniqE := enum_uniq aT) *. have trivF x: x \notin E -> #|F x| = 1 by rewrite mem_enum. elim: E uniqE => /= [_ | x0 E IH_E /andP[E'x0 uniqE]] in F trivF *. have /fin_all_exists[f0 Ff0] x: exists y0, F x =i pred1 y0. have /pred0Pn[y Fy]: #|F x| != 0 by rewrite trivF. by exists y; apply/fsym/subset_cardP; rewrite ?subset_pred1 // card1 trivF. apply: eq_card1 (finfun f0 : fT) _ _ => f; apply/familyP/eqP=> [Ff | {f}-> x]. by apply/ffunP=> x; have /[!(Ff0, ffunE)]/eqP := Ff x. by rewrite ffunE Ff0 inE /=. have [y0 Fxy0 | Fx00] := pickP (F x0); last first. by rewrite !eq_card0 // => f; apply: contraFF (Fx00 (f x0))=> /familyP; apply. pose F1 x := if eqP is ReflectT Dx then xpred1 (ecast x (rT x) Dx y0) else F x. transitivity (#|[predX F x0 & family F1 : pred fT]|); last first. rewrite cardX {}IH_E {uniqE}// => [|x E'x]; last first. rewrite /F1; case: eqP => [Dx | /nesym/eqP-x0'x]; first exact: card1. by rewrite trivF // negb_or x0'x. congr (_ * foldr _ _ _); apply/eq_in_map=> x Ex. by rewrite /F1; case: eqP => // Dx0; rewrite Dx0 Ex in E'x0. pose g yf : fT := let: (y, f) := yf : rT x0 * fT in [ffun x => if eqP is ReflectT Dx then ecast x (rT x) Dx y else f x]. have gK: cancel (fun f : fT => (f x0, g (y0, f))) g. by move=> f; apply/ffunP=> x; rewrite !ffunE; case: eqP => //; case: x /. rewrite -(card_i ...
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
card_family
card_dep_ffun: #|fT| = foldr muln 1 [seq #|rT x| | x : aT]. Proof. by rewrite -card_family; apply/esym/eq_card=> f; apply/familyP. 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
card_dep_ffun
fT:= {ffun aT -> rT}. Implicit Types (D : {pred aT}) (R : {pred rT}) (F : aT -> 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
card_pfamilyy0 D F : #|pfamily y0 D F| = foldr muln 1 [seq #|F x| | x in D]. Proof. rewrite card_family !/(image _ _) /(enum D) -enumT /=. by elim: (enum aT) => //= x E ->; have [// | D'x] := ifP; rewrite card1 mul1n. 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
card_pfamily
card_pffun_ony0 D R : #|pffun_on y0 D R| = #|R| ^ #|D|. Proof. rewrite (cardE D) card_pfamily /image_mem. by elim: (enum D) => //= _ e ->; rewrite expnS. 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
card_pffun_on
card_ffun_onR : #|@ffun_on aT R| = #|R| ^ #|aT|. Proof. rewrite card_family /image_mem cardT. by elim: (enum aT) => //= _ e ->; rewrite expnS. 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
card_ffun_on
card_ffun: #|fT| = #|rT| ^ #|aT|. Proof. by rewrite -card_ffun_on; apply/esym/eq_card=> f; apply/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
card_ffun
fprod_type:= (forall i : I, T_ i) (only parsing).
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
fprod_type
fprod: predArgType := FProd { fprod_fun : {ffun I -> {i : I & T_ i}} ; fprod_prop : [forall i : I, tag (fprod_fun i) == i] }.
Record
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
fprod
tag_fprod_fun(f : fprod) i : tag (fprod_fun f i) = i. Proof. by have /'forall_eqP/(_ i) := fprod_prop f. 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
tag_fprod_fun
fun_of_fprod(f : fprod) : fprod_type := fun i => etagged ('forall_eqP (fprod_prop f) 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
fun_of_fprod
fun_of_fprod: fprod >-> Funclass. #[hnf] HB.instance Definition _ := [isSub for fprod_fun]. #[hnf] HB.instance Definition _ := [Finite of fprod by <:].
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_fprod
fprod_of_prod_type_subproof(f : fprod_type) : [forall i : I, tag ([ffun i => Tagged T_ (f i)] i) == i]. Proof. by apply/'forall_eqP => i /=; 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
fprod_of_prod_type_subproof
fprod_of_fun(f : fprod_type) : fprod := FProd (fprod_of_prod_type_subproof 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
fprod_of_fun
fprodK: cancel fun_of_fprod fprod_of_fun. Proof. rewrite /fun_of_fprod /fprod_of_fun; case=> f fP. by apply/val_inj/ffunP => i /=; rewrite !ffunE etaggedK. 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
fprodK
fprodEg i : fprod_of_fun g i = g i. Proof. rewrite /fprod_of_fun /fun_of_fprod/=. by move: ('forall_eqP _ _); rewrite ffunE/= => e; 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
fprodE
fprodP(f1 f2 : fprod) : (forall x, f1 x = f2 x) <-> f1 = f2. Proof. split=> [eq_f12|->//]; rewrite -[f1]fprodK -[f2]fprodK. by apply/val_inj/ffunP => i; rewrite !ffunE eq_f12. 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
fprodP
dffun_of_fprod(f : fprod) : {dffun forall i : I, T_ i} := [ffun x => f 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
dffun_of_fprod
fprod_of_dffun(f : {dffun forall i : I, T_ i}) : fprod := fprod_of_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
fprod_of_dffun
dffun_of_fprodK: cancel dffun_of_fprod fprod_of_dffun. Proof. by move=> f; apply/fprodP=> i; rewrite fprodE ffunE. Qed. #[local] Hint Resolve dffun_of_fprodK : core.
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
dffun_of_fprodK
fprod_of_dffunK: cancel fprod_of_dffun dffun_of_fprod. Proof. by move=> f; apply/ffunP => i; rewrite !ffunE fprodE. Qed. #[local] Hint Resolve fprod_of_dffunK : core.
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
fprod_of_dffunK
dffun_of_fprod_bij: bijective dffun_of_fprod. Proof. by exists fprod_of_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
dffun_of_fprod_bij
fprod_of_dffun_bij: bijective fprod_of_dffun. Proof. by exists dffun_of_fprod. 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
fprod_of_dffun_bij
to_family_tagged_with(f : fprod) : {x in family (tagged_with T_)} := exist _ (fprod_fun f) (fprod_prop 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
to_family_tagged_with
of_family_tagged_with(f : {x in family (tagged_with T_)}) : fprod := FProd (valP 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
of_family_tagged_with
to_family_tagged_withK: cancel to_family_tagged_with of_family_tagged_with. Proof. by case=> f fP; apply/val_inj. Qed. #[local] Hint Resolve to_family_tagged_withK : core.
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
to_family_tagged_withK
of_family_tagged_withK: cancel of_family_tagged_with to_family_tagged_with. Proof. by case=> f fP; apply/val_inj. Qed. #[local] Hint Resolve of_family_tagged_withK : core.
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
of_family_tagged_withK
to_family_tagged_with_bij: bijective to_family_tagged_with. Proof. by exists of_family_tagged_with. 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
to_family_tagged_with_bij
of_family_tagged_with_bij: bijective of_family_tagged_with. Proof. by exists to_family_tagged_with. 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
of_family_tagged_with_bij
etaggedE(a : fprod) (i : I) (e : tag (fprod_fun a i) = i) : etagged e = a i. Proof. by case: a e => //= f fP e; congr etagged; apply: eq_irrelevance. 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
etaggedE
grel(T : eqType) (g : T -> seq T) := [rel x y | y \in g x].
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
grel
dfsn v x := if x \in v then v else if n is n'.+1 then foldl (dfs n') (x :: v) (g x) else v.
Fixpoint
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
dfs
subset_dfsn v a : v \subset foldl (dfs n) v a. Proof. elim: n a v => [|n IHn]; first by elim=> //= *; rewrite if_same. elim=> //= x a IHa v; apply: subset_trans {IHa}(IHa _); case: ifP => // _. by apply: subset_trans (IHn _ _); apply/subsetP=> y; apply: predU1r. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
subset_dfs
dfs_pathv x y : Prop := DfsPath p of path (grel g) x p & y = last x p & [disjoint x :: p & v].
Inductive
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
dfs_path
dfs_pathPn x y v : #|T| <= #|v| + n -> y \notin v -> reflect (dfs_path v x y) (y \in dfs n v x). Proof. have dfs_id w z: z \notin w -> dfs_path w z z. by exists [::]; rewrite ?disjoint_has //= orbF. elim: n => [|n IHn] /= in x y v * => le_v'_n not_vy. rewrite addn0 (geq_leqif (subset_leqif_card (subset_predT _))) in le_v'_n. by rewrite predT_subset in not_vy. have [v_x | not_vx] := ifPn. by rewrite (negPf not_vy); right=> [] [p _ _]; rewrite disjoint_has /= v_x. set v1 := x :: v; set a := g x; have sub_dfs := subsetP (subset_dfs n _ _). have [-> | neq_yx] := eqVneq y x. by rewrite sub_dfs ?mem_head //; left; apply: dfs_id. apply: (@equivP (exists2 x1, x1 \in a & dfs_path v1 x1 y)); last first. split=> {IHn} [[x1 a_x1 [p g_p p_y]] | [p /shortenP[]]]. rewrite disjoint_has has_sym /= has_sym /= => /norP[_ not_pv]. by exists (x1 :: p); rewrite /= ?a_x1 // disjoint_has negb_or not_vx. case=> [_ _ _ eq_yx | x1 p1 /=]; first by case/eqP: neq_yx. case/andP=> a_x1 g_p1 /andP[not_p1x _] /subsetP p_p1 p1y not_pv. exists x1 => //; exists p1 => //. rewrite disjoint_sym disjoint_cons not_p1x disjoint_sym. by move: not_pv; rewrite disjoint_cons => /andP[_ /disjointWl->]. have{neq_yx not_vy}: y \notin v1 by apply/norP. have{le_v'_n not_vx}: #|T| <= #|v1| + n by rewrite cardU1 not_vx addSnnS. elim: {x v}a v1 => [|x a IHa] v /= le_v'_n not_vy. by rewrite (negPf not_vy); right=> [] []. set v2 := dfs n v x; have v2v: v \subset v2 := subset_dfs n v [:: x]. have [v2y | not ...
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
dfs_pathP
dfsPx y : reflect (exists2 p, path (grel g) x p & y = last x p) (y \in dfs #|T| [::] x). Proof. apply: (iffP (dfs_pathP _ _ _)); rewrite ?card0 // => [] [p]; exists p => //. by rewrite disjoint_sym disjoint0. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
dfsP
rgraphx := enum (e x).
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
rgraph
rgraphK: grel rgraph =2 e. Proof. by move=> x y; rewrite /= mem_enum. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
rgraphK
connect: rel T := [rel x y | y \in dfs rgraph #|T| [::] x].
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
connect
connect_app_predx := ApplicativePred (connect x).
Canonical
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
connect_app_pred
connectPx y : reflect (exists2 p, path e x p & y = last x p) (connect x y). Proof. apply: (equivP (dfsP _ x y)). by split=> [] [p e_p ->]; exists p => //; rewrite (eq_path rgraphK) in e_p *. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
connectP
connect_trans: transitive connect. Proof. move=> x y z /connectP[p e_p ->] /connectP[q e_q ->]; apply/connectP. by exists (p ++ q); rewrite ?cat_path ?e_p ?last_cat. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
connect_trans
connect0x : connect x x. Proof. by apply/connectP; exists [::]. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
connect0
eq_connect0x y : x = y -> connect x y. Proof. by move->; apply: connect0. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
eq_connect0
connect1x y : e x y -> connect x y. Proof. by move=> e_xy; apply/connectP; exists [:: y]; rewrite /= ?e_xy. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
connect1
path_connectx p : path e x p -> subpred [in x :: p] (connect x). Proof. move=> e_p y p_y; case/splitPl: p / p_y e_p => p q <-. by rewrite cat_path => /andP[e_p _]; apply/connectP; exists p. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
path_connect
connect_cyclep : cycle e p -> {in p &, forall x y, connect x y}. Proof. move=> e_p x y /rot_to[i q rip]; rewrite -(mem_rot i) rip => yqx. have /= : cycle e (x :: q) by rewrite -rip rot_cycle. case/splitPl: yqx => r s lxr; rewrite rcons_cat cat_path => /andP[xr _]. by apply/connectP; exists r. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
connect_cycle
rootx := odflt x (pick (connect x)).
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
root
roots: pred T := fun x => root x == x.
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
roots
roots_pred:= ApplicativePred roots.
Canonical
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
roots_pred
n_comp_mem(m_a : mem_pred T) := #|predI roots m_a|.
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
n_comp_mem
connect_rootx : connect x (root x). Proof. by rewrite /root; case: pickP; rewrite ?connect0. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
connect_root
connect_sym:= symmetric connect. Hypothesis sym_e : connect_sym.
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
connect_sym
same_connect: left_transitive connect. Proof. exact: sym_left_transitive connect_trans. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
same_connect
same_connect_r: right_transitive connect. Proof. exact: sym_right_transitive connect_trans. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
same_connect_r
same_connect1x y : e x y -> connect x =1 connect y. Proof. by move/connect1; apply: same_connect. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
same_connect1
same_connect1rx y : e x y -> connect^~ x =1 connect^~ y. Proof. by move/connect1; apply: same_connect_r. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
same_connect1r
rootPx y : reflect (root x = root y) (connect x y). Proof. apply: (iffP idP) => e_xy. by rewrite /root -(eq_pick (same_connect e_xy)); case: pickP e_xy => // ->. by apply: (connect_trans (connect_root x)); rewrite e_xy sym_e connect_root. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
rootP
root_rootx : root (root x) = root x. Proof. exact/esym/rootP/connect_root. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
root_root
roots_rootx : roots (root x). Proof. exact/eqP/root_root. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
roots_root
root_connectx y : (root x == root y) = connect x y. Proof. exact: sameP eqP (rootP x y). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
root_connect
closed_memm_a := forall x y, e x y -> in_mem x m_a = in_mem y m_a.
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
closed_mem
closure_memm_a : pred T := fun x => ~~ disjoint (mem (connect x)) m_a.
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
closure_mem
n_compe a := (n_comp_mem e (mem a)).
Notation
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
n_comp
closede a := (closed_mem e (mem a)).
Notation
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
closed
closuree a := (closure_mem e (mem a)). Prenex Implicits connect root roots. Arguments dfsP {T g x y}. Arguments connectP {T e x y}. Arguments rootP [T e] _ {x y}.
Notation
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
closure
fconnectf := (connect (coerced_frel f)).
Notation
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fconnect
frootf := (root (coerced_frel f)).
Notation
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
froot
frootsf := (roots (coerced_frel f)).
Notation
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
froots
fcard_memf := (n_comp_mem (coerced_frel f)).
Notation
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fcard_mem
fcardf a := (fcard_mem f (mem a)).
Notation
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fcard
fclosedf a := (closed (coerced_frel f) a).
Notation
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fclosed
fclosuref a := (closure (coerced_frel f) a).
Notation
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fclosure
connect_sube e' : subrel e (connect e') -> subrel (connect e) (connect e'). Proof. move=> e'e x _ /connectP[p e_p ->]; elim: p x e_p => //= y p IHp x /andP[exy]. by move/IHp; apply: connect_trans; apply: e'e. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
connect_sub
relU_syme e' : connect_sym e -> connect_sym e' -> connect_sym (relU e e'). Proof. move=> sym_e sym_e'; apply: symmetric_from_pre => x _ /connectP[p e_p ->]. elim: p x e_p => //= y p IHp x /andP[e_xy /IHp{IHp}/connect_trans]; apply. case/orP: e_xy => /connect1; rewrite (sym_e, sym_e'); by apply: connect_sub y x => x y e_xy; rewrite connect1 //= e_xy ?orbT. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
relU_sym
eq_connecte e' : e =2 e' -> connect e =2 connect e'. Proof. move=> eq_e x y; apply/connectP/connectP=> [] [p e_p ->]; by exists p; rewrite // (eq_path eq_e) in e_p *. Qed. Arguments eq_connect [e e'].
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
eq_connect
eq_n_compe e' : connect e =2 connect e' -> n_comp_mem e =1 n_comp_mem e'. Proof. move=> eq_e [a]; apply: eq_card => x /=. by rewrite !inE /= /roots /root /= (eq_pick (eq_e x)). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
eq_n_comp
eq_n_comp_r{e} a a' : a =i a' -> n_comp e a = n_comp e a'. Proof. by move=> eq_a; apply: eq_card => x; rewrite inE /= eq_a. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
eq_n_comp_r
n_compCa e : n_comp e T = n_comp e a + n_comp e [predC a]. Proof. rewrite /n_comp_mem (eq_card (fun _ => andbT _)) -(cardID a); congr (_ + _). by apply: eq_card => x; rewrite !inE andbC. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
n_compC
eq_roote e' : e =2 e' -> root e =1 root e'. Proof. by move=> eq_e x; rewrite /root (eq_pick (eq_connect eq_e x)). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
eq_root
eq_rootse e' : e =2 e' -> roots e =1 roots e'. Proof. by move=> eq_e x; rewrite /roots (eq_root eq_e). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
eq_roots
connect_reve : connect [rel x y | e y x] =2 [rel x y | connect e y x]. Proof. suff crev e': subrel (connect [rel x y | e' y x]) [rel x y | connect e' y x]. by move=> x y; apply/idP/idP; apply: crev. move=> x y /connectP[p e_p p_y]; apply/connectP. exists (rev (belast x p)); first by rewrite p_y rev_path. by rewrite -(last_cons x) -rev_rcons p_y -lastI rev_cons last_rcons. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
connect_rev
sym_connect_syme : symmetric e -> connect_sym e. Proof. by move=> sym_e x y; rewrite (eq_connect sym_e) connect_rev. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
sym_connect_sym
same_connect_rev: connect e =2 connect [rel x y | e y x]. Proof. by move=> x y; rewrite sym_e connect_rev. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
same_connect_rev