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
intro_closeda : (forall x y, e x y -> x \in a -> y \in a) -> closed e a. Proof. move=> cl_a x y e_xy; apply/idP/idP=> [|a_y]; first exact: cl_a. have{x e_xy} /connectP[p e_p ->]: connect e y x by rewrite sym_e connect1. by elim: p y a_y e_p => //= y p IHp x a_x /andP[/cl_a/(_ a_x)]; apply: IHp. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
intro_closed
closed_connecta : closed e a -> forall x y, connect e x y -> (x \in a) = (y \in a). Proof. move=> cl_a x _ /connectP[p e_p ->]. by elim: p x e_p => //= y p IHp x /andP[/cl_a->]; apply: IHp. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
closed_connect
connect_closedx : closed e (connect e x). Proof. by move=> y z /connect1/same_connect_r; apply. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
connect_closed
predC_closeda : closed e a -> closed e [predC a]. Proof. by move=> cl_a x y /cl_a /[!inE] ->. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
predC_closed
closure_closeda : closed e (closure e a). Proof. apply: intro_closed => x y /connect1 e_xy; congr (~~ _). by apply: eq_disjoint; 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
closure_closed
mem_closurea : {subset a <= closure e a}. Proof. by move=> x a_x; apply/existsP; exists x; rewrite !inE connect0. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
mem_closure
subset_closurea : a \subset closure e a. Proof. by apply/subsetP; apply: mem_closure. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
subset_closure
n_comp_closure2x y : n_comp e (closure e (pred2 x y)) = (~~ connect e x y).+1. Proof. rewrite -(root_connect sym_e) -card2; apply: eq_card => z. apply/idP/idP=> [/andP[/eqP {2}<- /pred0Pn[t /andP[/= ezt exyt]]] |]. by case/pred2P: exyt => <-; rewrite (rootP sym_e ezt) !inE eqxx ?orbT. by case/pred2P=> ->; rewrite !inE roots_root //; apply/existsP; [exists x | exists y]; rewrite !inE eqxx ?orbT 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
n_comp_closure2
n_comp_connectx : n_comp e (connect e x) = 1. Proof. rewrite -(card1 (root e x)); apply: eq_card => y. apply/andP/eqP => [[/eqP r_y /rootP-> //] | ->] /=. by rewrite inE connect_root roots_root. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
n_comp_connect
orderx := #|fconnect f x|.
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
order
orbitx := traject f x (order x).
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
orbit
findexx y := index y (orbit x).
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
findex
finvx := iter (order x).-1 f x.
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
finv
fconnect_itern x : fconnect f x (iter n f x). Proof. apply/connectP. by exists (traject f (f x) n); [apply: fpath_traject | rewrite last_traject]. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fconnect_iter
fconnect1x : fconnect f x (f x). Proof. exact: (fconnect_iter 1). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fconnect1
fconnect_finvx : fconnect f x (finv x). Proof. exact: fconnect_iter. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fconnect_finv
orderSpredx : (order x).-1.+1 = order x. Proof. by rewrite /order (cardD1 x) [_ x _]connect0. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
orderSpred
size_orbitx : size (orbit x) = order x. Proof. exact: size_traject. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
size_orbit
looping_orderx : looping f x (order x). Proof. apply: contraFT (ltnn (order x)); rewrite -looping_uniq => /card_uniqP. rewrite size_traject => <-; apply: subset_leq_card. by apply/subsetP=> _ /trajectP[i _ ->]; apply: fconnect_iter. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
looping_order
fconnect_orbitx y : fconnect f x y = (y \in orbit x). Proof. apply/idP/idP=> [/connectP[_ /fpathP[m ->] ->] | /trajectP[i _ ->]]. by rewrite last_traject; apply/loopingP/looping_order. exact: fconnect_iter. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fconnect_orbit
in_orbitx : x \in orbit x. Proof. by rewrite -fconnect_orbit. Qed. Hint Resolve in_orbit : core.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
in_orbit
order_gt0x : order x > 0. Proof. by rewrite -orderSpred. Qed. Hint Resolve order_gt0 : core.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
order_gt0
orbit_uniqx : uniq (orbit x). Proof. rewrite /orbit -orderSpred looping_uniq; set n := (order x).-1. apply: contraFN (ltnn n) => /trajectP[i lt_i_n eq_fnx_fix]. rewrite orderSpred -(size_traject f x n). apply: (leq_trans (subset_leq_card _) (card_size _)); apply/subsetP=> z. rewrite inE fconnect_orbit => /trajectP[j le_jn ->{z}]. rewrite -orderSpred -/n ltnS leq_eqVlt in le_jn. by apply/trajectP; case/predU1P: le_jn => [->|]; [exists i | exists j]. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
orbit_uniq
findex_maxx y : fconnect f x y -> findex x y < order x. Proof. by rewrite [_ y]fconnect_orbit -index_mem size_orbit. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
findex_max
findex_iterx i : i < order x -> findex x (iter i f x) = i. Proof. move=> lt_ix; rewrite -(nth_traject f lt_ix) /findex index_uniq ?orbit_uniq //. by rewrite size_orbit. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
findex_iter
iter_findexx y : fconnect f x y -> iter (findex x y) f x = y. Proof. rewrite [_ y]fconnect_orbit => fxy; pose i := index y (orbit x). have lt_ix: i < order x by rewrite -size_orbit index_mem. by rewrite -(nth_traject f lt_ix) nth_index. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
iter_findex
findex0x : findex x x = 0. Proof. by rewrite /findex /orbit -orderSpred /= eqxx. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
findex0
findex_eq0x y : (findex x y == 0) = (x == y). Proof. by rewrite /findex /orbit -orderSpred /=; case: (x == y). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
findex_eq0
fconnect_invariant(T' : eqType) (k : T -> T') : invariant f k =1 xpredT -> forall x y, fconnect f x y -> k x = k y. Proof. move=> eq_k_f x y /iter_findex <-; elim: {y}(findex x y) => //= n ->. by rewrite (eqP (eq_k_f _)). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fconnect_invariant
mem_orbitx : {homo f : y / y \in orbit x}. Proof. by move=> y; rewrite -!fconnect_orbit => /connect_trans->//; apply: fconnect1. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
mem_orbit
image_orbitx : {subset image f (orbit x) <= orbit x}. Proof. by move=> _ /mapP[y yin ->]; apply: mem_orbit; rewrite ?mem_enum in yin. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
image_orbit
finv_in: {homo finv : x / x \in S}. Proof. by move=> x xS; rewrite iter_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
finv_in
f_finv_in: {in S, cancel finv f}. Proof. move=> x xS; move: (looping_order x) (orbit_uniq x). rewrite /looping /orbit -orderSpred looping_uniq /= /looping; set n := _.-1. case/predU1P=> // /trajectP[i lt_i_n]; rewrite -iterSr. by move=> /injf ->; rewrite ?(iter_in _ f_in) //; case/trajectP; exists i. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
f_finv_in
finv_f_in: {in S, cancel f finv}. Proof. by move=> x xS; apply/injf; rewrite ?iter_in ?f_finv_in ?f_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
finv_f_in
finv_inj_in: {in S &, injective finv}. Proof. by move=> x y xS yS q; rewrite -(f_finv_in xS) q f_finv_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
finv_inj_in
fconnect_sym_in: {in S &, forall x y, fconnect f x y = fconnect f y x}. Proof. suff Sf : {in S &, forall x y, fconnect f x y -> fconnect f y x}. by move=> *; apply/idP/idP=> /Sf->. move=> x _ xS _ /connectP [p f_p ->]; elim: p => //= y p IHp in x xS f_p *. case/andP: f_p => /eqP <- /(IHp _ (f_in xS)) /connect_trans -> //. by apply: (connect_trans (fconnect_finv _)); rewrite finv_f_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fconnect_sym_in
iter_order_in: {in S, forall x, iter (order x) f x = x}. Proof. by move=> x xS; rewrite -orderSpred iterS; apply: f_finv_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
iter_order_in
iter_finv_inn : {in S, forall x, n <= order x -> iter n finv x = iter (order x - n) f x}. Proof. move=> x xS; rewrite -[x in LHS]iter_order_in => // /subnKC {1}<-. move: (_ - n) => m; rewrite iterD; elim: n => // n {2}<-. by rewrite iterSr /= finv_f_in // -iterD iter_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
iter_finv_in
cycle_orbit_in: {in S, forall x, (fcycle f) (orbit x)}. Proof. move=> x xS; rewrite /orbit -orderSpred (cycle_path x) /= last_traject. by rewrite -/(finv x) fpath_traject f_finv_in ?eqxx. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
cycle_orbit_in
fpath_finv_inp x : (x \in S) && (fpath finv x p) = (last x p \in S) && (fpath f (last x p) (rev (belast x p))). Proof. elim: p x => //= y p IHp x; rewrite rev_cons rcons_path. transitivity [&& y \in S, f y == x & fpath finv y p]. apply/and3P/and3P => -[xS /eqP<- fxp]; split; by rewrite ?f_finv_in ?finv_f_in ?finv_in ?f_in. rewrite andbCA {}IHp !andbA [RHS]andbC -andbA; congr [&& _, _ & _]. by case: p => //= z p; rewrite 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
fpath_finv_in
fpath_finv_f_inp : {in S, forall x, fpath finv x p -> fpath f (last x p) (rev (belast x p))}. Proof. by move=> x xS /(conj xS)/andP; rewrite fpath_finv_in => /andP[]. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fpath_finv_f_in
fpath_f_finv_inp x : last x p \in S -> fpath f (last x p) (rev (belast x p)) -> fpath finv x p. Proof. by move=> lS /(conj lS)/andP; rewrite -fpath_finv_in => /andP[]. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fpath_f_finv_in
injectivePcyclex : reflect {in orbit x &, injective f} (fcycle f (orbit x)). Proof. apply: (iffP idP) => [/inj_cycle//|/cycle_orbit_in]. by apply; [apply: mem_orbit|apply: in_orbit]. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
injectivePcycle
f_finv: cancel finv f. Proof. exact: (in1T (f_finv_in _ (in2W _))). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
f_finv
finv_f: cancel f finv. Proof. exact: (in1T (finv_f_in _ (in2W _))). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
finv_f
finv_bij: bijective finv. Proof. by exists f; [apply: f_finv|apply: finv_f]. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
finv_bij
finv_inj: injective finv. Proof. exact: (can_inj f_finv). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
finv_inj
fconnect_symx y : fconnect f x y = fconnect f y x. Proof. exact: (in2T (fconnect_sym_in _ (in2W _))). Qed. Let symf := fconnect_sym.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fconnect_sym
iter_orderx : iter (order x) f x = x. Proof. exact: (in1T (iter_order_in _ (in2W _))). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
iter_order
iter_finvn x : n <= order x -> iter n finv x = iter (order x - n) f x. Proof. exact: (in1T (@iter_finv_in _ _ (in2W _) _)). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
iter_finv
cycle_orbitx : fcycle f (orbit x). Proof. exact: (in1T (cycle_orbit_in _ (in2W _))). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
cycle_orbit
fpath_finvx p : fpath finv x p = fpath f (last x p) (rev (belast x p)). Proof. exact: (@fpath_finv_in T _ (in2W _)). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fpath_finv
same_fconnect_finv: fconnect finv =2 fconnect f. Proof. move=> x y; rewrite (same_connect_rev symf); apply: {x y}eq_connect => x y /=. by rewrite (canF_eq finv_f) eq_sym. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
same_fconnect_finv
fcard_finv: fcard_mem finv =1 fcard_mem f. Proof. exact: eq_n_comp same_fconnect_finv. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fcard_finv
order_setn : pred T := [pred x | order x == n].
Definition
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
order_set
fcard_order_setn (a : {pred T}) : a \subset order_set n -> fclosed f a -> fcard f a * n = #|a|. Proof. move=> a_n cl_a; rewrite /n_comp_mem; set b := [predI froots f & a]. suff <-: #|preim (froot f) b| = #|b| * n. apply: eq_card => x; rewrite !inE (roots_root fconnect_sym). exact/esym/(closed_connect cl_a)/connect_root. have{cl_a a_n} (x): b x -> froot f x = x /\ order x = n. by case/andP=> /eqP-> /(subsetP a_n)/eqnP->. elim: {a b}#|b| {1 3 4}b (eqxx #|b|) => [|m IHm] b def_m f_b. by rewrite eq_card0 // => x; apply: (pred0P def_m). have [x b_x | b0] := pickP b; last by rewrite (eq_card0 b0) in def_m. have [r_x ox_n] := f_b x b_x; rewrite (cardD1 x) [x \in b]b_x eqSS in def_m. rewrite mulSn -{1}ox_n -(IHm _ def_m) => [|_ /andP[_ /f_b //]]. rewrite -(cardID (fconnect f x)); congr (_ + _); apply: eq_card => y. by apply: andb_idl => /= fxy; rewrite !inE -(rootP symf fxy) r_x. by congr (~~ _ && _); rewrite /= /in_mem /= symf -(root_connect symf) r_x. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fcard_order_set
fclosed1(a : {pred T}) : fclosed f a -> forall x, (x \in a) = (f x \in a). Proof. by move=> cl_a x; apply: cl_a (eqxx _). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fclosed1
same_fconnect1x : fconnect f x =1 fconnect f (f x). Proof. by apply: same_connect1 => /=. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
same_fconnect1
same_fconnect1_rx y : fconnect f x y = fconnect f x (f y). Proof. by apply: same_connect1r x => /=. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
same_fconnect1_r
fcard_gt0P(a : {pred T}) : fclosed f a -> reflect (exists x, x \in a) (0 < fcard f a). Proof. move=> clfA; apply: (iffP card_gt0P) => [[x /andP[]]|[x xA]]; first by exists x. exists (froot f x); rewrite inE roots_root /=; last exact: fconnect_sym. by rewrite -(closed_connect clfA (connect_root _ x)). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fcard_gt0P
fcard_gt1P(A : {pred T}) : fclosed f A -> reflect (exists2 x, x \in A & exists2 y, y \in A & ~~ fconnect f x y) (1 < fcard f A). Proof. move=> clAf; apply: (iffP card_gt1P) => [|[x xA [y yA not_xfy]]]. move=> [x [y [/andP [/= rfx xA] /andP[/= rfy yA] xDy]]]. by exists x; try exists y; rewrite // -root_connect // (eqP rfx) (eqP rfy). exists (froot f x), (froot f y); rewrite !inE !roots_root ?root_connect //=. by split => //; rewrite -(closed_connect clAf (connect_root _ _)). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fcard_gt1P
fconnect_cycley : fconnect f x y = (y \in p). Proof. have [i q def_p] := rot_to p_x; rewrite -(mem_rot i p) def_p. have{i def_p} /andP[/eqP q_x f_q]: (f (last x q) == x) && fpath f x q. by have:= f_p; rewrite -(rot_cycle i) def_p (cycle_path x). apply/idP/idP=> [/connectP[_ /fpathP[j ->] ->] | ]; last exact: path_connect. case/fpathP: f_q q_x => n ->; rewrite !last_traject -iterS => def_x. by apply: (@loopingP _ f x n.+1); rewrite /looping def_x /= mem_head. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fconnect_cycle
order_le_cycle: order x <= size p. Proof. apply: leq_trans (card_size _); apply/subset_leq_card/subsetP=> y. by rewrite !(fconnect_cycle, inE) ?eqxx. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
order_le_cycle
order_cycle: order x = size p. Proof. by rewrite -(card_uniqP Up); apply: (eq_card fconnect_cycle). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
order_cycle
orbitE: orbit x = rot (index x p) p. Proof. set i := index _ _; rewrite /orbit order_cycle -(size_rot i) rot_index// -/i. set q := _ ++ _; suffices /fpathP[j ->]: fpath f x q by rewrite /= size_traject. by move: f_p; rewrite -(rot_cycle i) rot_index// (cycle_path x); case/andP. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
orbitE
orbit_rot_cycle: {i : nat | orbit x = rot i p}. Proof. by rewrite orbitE; exists (index x p). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
orbit_rot_cycle
finv_cycle: {homo finv : x / x \in p}. Proof. exact: finv_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
finv_cycle
f_finv_cycle: {in p, cancel finv f}. Proof. exact: f_finv_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
f_finv_cycle
finv_f_cycle: {in p, cancel f finv}. Proof. exact: finv_f_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
finv_f_cycle
finv_inj_cycle: {in p &, injective finv}. Proof. exact: finv_inj_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
finv_inj_cycle
iter_finv_cyclen : {in p, forall x, n <= order x -> iter n finv x = iter (order x - n) f x}. Proof. exact: iter_finv_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
iter_finv_cycle
cycle_orbit_cycle: {in p, forall x, fcycle f (orbit x)}. Proof. exact: cycle_orbit_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
cycle_orbit_cycle
fpath_finv_cycleq x : (x \in p) && (fpath finv x q) = (last x q \in p) && fpath f (last x q) (rev (belast x q)). Proof. exact: fpath_finv_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fpath_finv_cycle
fpath_finv_f_cycleq : {in p, forall x, fpath finv x q -> fpath f (last x q) (rev (belast x q))}. Proof. exact: fpath_finv_f_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fpath_finv_f_cycle
fpath_f_finv_cycleq x : last x q \in p -> fpath f (last x q) (rev (belast x q)) -> fpath finv x q. Proof. exact: fpath_f_finv_in. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fpath_f_finv_cycle
prevEx : x \in p -> prev p x = finv x. Proof. move=> x_p; have /eqP/(congr1 finv) := prev_cycle f_p x_p. by rewrite finv_f_cycle// mem_prev. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
prevE
fcycle_rconsE: rcons (x :: p) x = traject f x (size p).+2. Proof. by rewrite rcons_cons; have /fpathE-> := f_p; rewrite size_rcons. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fcycle_rconsE
fcycle_consE: x :: p = traject f x (size p).+1. Proof. by have := fcycle_rconsE; rewrite trajectSr => /rcons_inj[/= <-]. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fcycle_consE
fcycle_consEflatten: exists k, x :: p = flatten (nseq k.+1 (orbit x)). Proof. move: f_p; rewrite fcycle_consE; elim/ltn_ind: (size p) => n IHn t_cycle. have := order_le_cycle t_cycle (mem_head _ _); rewrite size_traject. case: ltngtP => [||<-] //; last by exists 0; rewrite /= cats0. rewrite ltnS => n_ge _; have := t_cycle. rewrite -(subnKC n_ge) -addnS trajectD. rewrite (iter_order_in (mem_fcycle f_p) (inj_cycle f_p)) ?mem_head//. set m := (_ - _) => cycle_cat. have [||k->] := IHn m; last by exists k.+1. by rewrite ltn_subrL (leq_trans _ n_ge) ?order_gt0. move: cycle_cat; rewrite -orderSpred/= rcons_cat rcons_cons -cat_rcons. by rewrite cat_path last_rcons => /andP[]. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fcycle_consEflatten
undup_cycle_cons: undup (x :: p) = orbit x. Proof. by have [n {1}->] := fcycle_consEflatten; rewrite undup_flatten_nseq ?undup_id. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
undup_cycle_cons
fcycleEflatten: exists k, p = flatten (nseq k (undup p)). Proof. case: p f_p => [//|x q] f_q; first by exists 0. have [k {1}->] := @fcycle_consEflatten x q f_q. by exists k.+1; rewrite undup_cycle_cons. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fcycleEflatten
fcycle_undup: fcycle f (undup p). Proof. case: p f_p => [//|x q] f_q; rewrite undup_cycle_cons//. by rewrite (cycle_orbit_in (mem_fcycle f_q) (inj_cycle f_q)) ?mem_head. Qed. Let p_undup_uniq := undup_uniq p. Let f_inj := inj_cycle f_p. Let homo_f := mem_fcycle f_p.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fcycle_undup
in_orbit_cycle: {in p &, forall x, orbit x =i p}. Proof. by move=> x y xp yp; rewrite (orbitE fcycle_undup)// ?mem_rot ?mem_undup. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
in_orbit_cycle
eq_order_cycle: {in p &, forall x y, order y = order x}. Proof. by move=> x y xp yp; rewrite !(order_cycle fcycle_undup) ?mem_undup. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
eq_order_cycle
iter_order_cycle: {in p &, forall x y, iter (order x) f y = y}. Proof. by move=> x y xp yp; rewrite (eq_order_cycle yp) ?(iter_order_in homo_f f_inj). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
iter_order_cycle
fconnect_eqVfx y : fconnect f x y = (x == y) || fconnect f (f x) y. Proof. apply/idP/idP => [/iter_findex <-|/predU1P [<-|] //]; last first. exact/connect_trans/fconnect1. by case: findex => [|i]; rewrite ?eqxx// iterSr fconnect_iter orbT. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fconnect_eqVf
orbitPcycle{x} : [<->
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
orbitPcycle
order_id_cyclex : fcycle f (orbit x) -> order (f x) = order x. Proof. by move/(orbitPcycle 0 1). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
order_id_cycle
order_spec_cyclex : bool -> Type := | OrderStepCycle of fcycle f (orbit x) & order x = order (f x) : order_spec_cycle x true | OrderStepNoCycle of ~~ fcycle f (orbit x) & order x = (order (f x)).+1 : order_spec_cycle x false.
Inductive
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
order_spec_cycle
orderPcyclex : order_spec_cycle x (fcycle f (orbit x)). Proof. have [xcycle|Ncycle] := boolP (fcycle f (orbit x)); constructor => //. by rewrite order_id_cycle. rewrite /order (eq_card (_ : _ =1 [predU1 x & fconnect f (f x)])). by rewrite cardU1 inE (contraNN (all_iffLR orbitPcycle 2 0)). by move=> y; rewrite !inE fconnect_eqVf eq_sym. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
orderPcycle
fconnect_fx : fconnect f (f x) x = fcycle f (orbit x). Proof. by apply/idP/idP => /(orbitPcycle 0 2). Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fconnect_f
fconnect_findexx y : fconnect f x y -> y != x -> findex x y = (findex (f x) y).+1. Proof. rewrite /findex fconnect_orbit /orbit -orderSpred /= inE => /orP [-> //|]. rewrite eq_sym; move=> yin /negPf->; have [_ eq_o|_ ->//] := orderPcycle x. by rewrite -(orderSpred (f x)) trajectSr -cats1 index_cat -eq_o yin. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fconnect_findex
fconnect_id(x : T) : fconnect id x =1 xpred1 x. Proof. by move=> y; rewrite (@fconnect_cycle _ _ [:: x]) //= ?inE ?eqxx. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fconnect_id
order_id(x : T) : order id x = 1. Proof. by rewrite /order (eq_card (fconnect_id x)) card1. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
order_id
orbit_id(x : T) : orbit id x = [:: x]. Proof. by rewrite /orbit order_id. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
orbit_id
froots_id(x : T) : froots id x. Proof. by rewrite /roots -fconnect_id connect_root. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
froots_id
froot_id(x : T) : froot id x = x. Proof. by apply/eqP; apply: froots_id. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
froot_id
fcard_id(a : {pred T}) : fcard id a = #|a|. Proof. by apply: eq_card => x; rewrite inE froots_id. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
fcard_id
finv_eq_can: cancel f f' -> finv f =1 f'. Proof. move=> fK; have inj_f := can_inj fK. by apply: bij_can_eq fK; [apply: injF_bij | apply: finv_f]. Qed. Hypothesis eq_f : f =1 f'. Let eq_rf := eq_frel eq_f.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
finv_eq_can
eq_fconnect: fconnect f =2 fconnect f'. Proof. exact: eq_connect eq_rf. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat", "From mathcomp Require Import seq path fintype" ]
boot/fingraph.v
eq_fconnect