statement stringlengths 1 4.33k | proof stringlengths 0 37.9k | type stringclasses 25
values | symbolic_name stringlengths 1 67 | library stringclasses 10
values | filename stringclasses 112
values | imports listlengths 2 138 | deps listlengths 0 64 | docstring stringclasses 798
values | source_url stringclasses 1
value | commit stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|
merge_map s1 s2 :
merge leT (map f s1) (map f s2) = map f (merge (relpre f leT) s1 s2). | Proof. exact/esym/map_merge. Qed. | Lemma | merge_map | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"map",
"map_merge",
"merge",
"s1",
"s2"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sort_map s : sort leT (map f s) = map f (sort (relpre f leT) s). | Proof. exact/esym/map_sort. Qed. | Lemma | sort_map | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"map",
"map_sort",
"sort"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sorted_sort_in T (P : {pred T}) (leT : rel T) :
{in P & &, transitive leT} ->
forall s : seq T, all P s -> sorted leT s -> sort leT s = s. | Proof.
move=> /in3_sig ? _ /all_sigP[s ->].
by rewrite sort_map sorted_map => /sorted_sort->.
Qed. | Lemma | sorted_sort_in | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"all",
"all_sigP",
"rel",
"seq",
"sort",
"sort_map",
"sorted",
"sorted_map",
"sorted_sort"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
perm_merge s1 s2 : perm_eql (merge leT s1 s2) (s1 ++ s2). | Proof. by apply/permPl/permP => ?; rewrite count_merge. Qed. | Lemma | perm_merge | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"count_merge",
"merge",
"permP",
"permPl",
"perm_eql",
"s1",
"s2"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
mem_merge s1 s2 : merge leT s1 s2 =i s1 ++ s2. | Proof. by apply: perm_mem; rewrite perm_merge. Qed. | Lemma | mem_merge | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"merge",
"perm_mem",
"perm_merge",
"s1",
"s2"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
merge_uniq s1 s2 : uniq (merge leT s1 s2) = uniq (s1 ++ s2). | Proof. by apply: perm_uniq; rewrite perm_merge. Qed. | Lemma | merge_uniq | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"merge",
"perm_merge",
"perm_uniq",
"s1",
"s2",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
perm_sort s : perm_eql (sort leT s) s. | Proof. by apply/permPl/permP => ?; rewrite count_sort. Qed. | Lemma | perm_sort | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"count_sort",
"permP",
"permPl",
"perm_eql",
"sort"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
mem_sort s : sort leT s =i s. | Proof. exact/perm_mem/permPl/perm_sort. Qed. | Lemma | mem_sort | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"permPl",
"perm_mem",
"perm_sort",
"sort"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sort_uniq s : uniq (sort leT s) = uniq s. | Proof. exact/perm_uniq/permPl/perm_sort. Qed. | Lemma | sort_uniq | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"permPl",
"perm_sort",
"perm_uniq",
"sort",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
eq_count_merge (p : pred T) s1 s1' s2 s2' :
count p s1 = count p s1' -> count p s2 = count p s2' ->
count p (merge leT s1 s2) = count p (merge leT s1' s2'). | Proof. by rewrite !count_merge !count_cat => -> ->. Qed. | Lemma | eq_count_merge | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"count",
"count_cat",
"count_merge",
"merge",
"s1",
"s2"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
perm_iota_sort (T : Type) (leT : rel T) x0 s :
{i_s : seq nat | perm_eq i_s (iota 0 (size s)) &
sort leT s = map (nth x0 s) i_s}. | Proof.
exists (sort (relpre (nth x0 s) leT) (iota 0 (size s))).
by rewrite perm_sort.
by rewrite -[s in LHS](mkseq_nth x0) sort_map.
Qed. | Lemma | perm_iota_sort | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"iota",
"map",
"mkseq_nth",
"nat",
"nth",
"perm_eq",
"perm_sort",
"rel",
"seq",
"size",
"sort",
"sort_map"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
all_merge (T : Type) (P : {pred T}) (leT : rel T) s1 s2 :
all P (merge leT s1 s2) = all P s1 && all P s2. | Proof.
elim: s1 s2 => //= x s1 IHs1; elim=> [|y s2 IHs2]; rewrite ?andbT //=.
by case: ifP => _; rewrite /= ?IHs1 ?IHs2 //=; bool_congr.
Qed. | Lemma | all_merge | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"all",
"merge",
"rel",
"s1",
"s2"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
all_sort (T : Type) (P : {pred T}) (leT : rel T) s :
all P (sort leT s) = all P s. | Proof.
case: s => // x s; move: (x :: s) => {}s.
by rewrite -(mkseq_nth x s) sort_map !all_map; apply/perm_all/permPl/perm_sort.
Qed. | Lemma | all_sort | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"all",
"all_map",
"apply",
"mkseq_nth",
"permPl",
"perm_all",
"perm_sort",
"rel",
"sort",
"sort_map"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
size_sort (T : Type) (leT : rel T) s : size (sort leT s) = size s. | Proof. exact: (count_sort _ predT). Qed. | Lemma | size_sort | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"count_sort",
"rel",
"size",
"sort"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
ltn_sorted_uniq_leq s : sorted ltn s = uniq s && sorted leq s. | Proof.
rewrite (sorted_pairwise leq_trans) (sorted_pairwise ltn_trans) uniq_pairwise.
by rewrite -pairwise_relI; apply/eq_pairwise => ? ?; rewrite ltn_neqAle.
Qed. | Lemma | ltn_sorted_uniq_leq | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"eq_pairwise",
"leq",
"leq_trans",
"ltn",
"ltn_neqAle",
"ltn_trans",
"pairwise_relI",
"sorted",
"sorted_pairwise",
"uniq",
"uniq_pairwise"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
gtn_sorted_uniq_geq s : sorted gtn s = uniq s && sorted geq s. | Proof. by rewrite -rev_sorted ltn_sorted_uniq_leq rev_sorted rev_uniq. Qed. | Lemma | gtn_sorted_uniq_geq | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"geq",
"gtn",
"ltn_sorted_uniq_leq",
"rev_sorted",
"rev_uniq",
"sorted",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
iota_sorted i n : sorted leq (iota i n). | Proof. by elim: n i => // [[|n] //= IHn] i; rewrite IHn leqW. Qed. | Lemma | iota_sorted | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"iota",
"leq",
"leqW",
"sorted"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
iota_ltn_sorted i n : sorted ltn (iota i n). | Proof. by rewrite ltn_sorted_uniq_leq iota_sorted iota_uniq. Qed. | Lemma | iota_ltn_sorted | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"iota",
"iota_sorted",
"iota_uniq",
"ltn",
"ltn_sorted_uniq_leq",
"sorted"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
lt_lex | := [rel n m | leN n m && (leN m n ==> (n < m))]. | Let | lt_lex | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"rel"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
Fixpoint push_invariant (ss : seq (seq nat)) | :=
if ss is s :: ss' then
[&& sorted lt_lex s, allrel gtn s (flatten ss') & push_invariant ss']
else
true. | Let | Fixpoint | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"allrel",
"flatten",
"gtn",
"lt_lex",
"nat",
"seq",
"sorted"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
push_stable s1 ss :
push_invariant (s1 :: ss) -> push_invariant (merge_sort_push leN s1 ss). | Proof.
elim: ss s1 => [] // [] //= m s2 ss ihss s1; rewrite -cat_cons allrel_catr.
move=> /and5P[sorted_s1 /andP[s1s2 s1ss] sorted_s2 s2ss hss]; apply: ihss.
rewrite /= hss andbT merge_stable_sorted //=; first by rewrite allrelC.
by apply/allrelP => ? ?; rewrite mem_merge mem_cat => /orP[]; apply/allrelP.
Qed. | Let | push_stable | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"allrelC",
"allrelP",
"allrel_catr",
"apply",
"cat_cons",
"mem_cat",
"mem_merge",
"merge_sort_push",
"merge_stable_sorted",
"s1",
"s2"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pop_stable s1 ss :
push_invariant (s1 :: ss) -> sorted lt_lex (merge_sort_pop leN s1 ss). | Proof.
elim: ss s1 => [s1 /and3P[]|s2 ss ihss s1] //=; rewrite allrel_catr.
move=> /and5P[sorted_s1 /andP[s1s2 s1ss] sorted_s2 s2ss hss]; apply: ihss.
rewrite /= hss andbT merge_stable_sorted //=; first by rewrite allrelC.
by apply/allrelP => ? ?; rewrite mem_merge mem_cat => /orP[]; apply/allrelP.
Qed. | Let | pop_stable | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"allrelC",
"allrelP",
"allrel_catr",
"apply",
"lt_lex",
"mem_cat",
"mem_merge",
"merge_sort_pop",
"merge_stable_sorted",
"s1",
"s2",
"sorted"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sort_iota_stable n : sorted lt_lex (sort leN (iota 0 n)). | Proof.
rewrite sortE.
have/andP[]: all (gtn 0) (flatten [::]) && push_invariant [::] by [].
elim: n 0 [::] => [|n ihn] m ss hss1 hss2; first exact: pop_stable.
apply/ihn/push_stable; last by rewrite /= allrel1l hss1.
have: all (gtn m.+1) (flatten ([:: m] :: ss)).
by rewrite /= leqnn; apply: sub_all hss1 => ? /leqW.
e... | Lemma | sort_iota_stable | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"all",
"all_cat",
"all_merge",
"allrel1l",
"apply",
"flatten",
"gtn",
"iota",
"last",
"leqW",
"leqnn",
"lt_lex",
"pop_stable",
"push_stable",
"sort",
"sortE",
"sorted",
"sub_all"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sort_pairwise_stable T (leT leT' : rel T) :
total leT -> forall s : seq T, pairwise leT' s ->
sorted [rel x y | leT x y && (leT y x ==> leT' x y)] (sort leT s). | Proof.
move=> leT_total s pairwise_s; case Ds: s => // [x s1].
rewrite -{s1}Ds -(mkseq_nth x s) sort_map.
apply/homo_sorted_in/sort_iota_stable/(fun _ _ => leT_total _ _)/allss => y z.
rewrite !mem_sort !mem_iota !leq0n add0n /= => ys zs /andP [->] /=.
by case: (leT _ _); first apply: pairwiseP.
Qed. | Lemma | sort_pairwise_stable | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"add0n",
"allss",
"apply",
"homo_sorted_in",
"leT_total",
"leq0n",
"mem_iota",
"mem_sort",
"mkseq_nth",
"pairwise",
"pairwiseP",
"rel",
"s1",
"seq",
"sort",
"sort_iota_stable",
"sort_map",
"sorted",
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sort_stable T (leT leT' : rel T) :
total leT -> transitive leT' -> forall s : seq T, sorted leT' s ->
sorted [rel x y | leT x y && (leT y x ==> leT' x y)] (sort leT s). | Proof.
move=> leT_total leT'_tr s; rewrite sorted_pairwise //.
exact: sort_pairwise_stable.
Qed. | Lemma | sort_stable | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"leT_total",
"rel",
"seq",
"sort",
"sort_pairwise_stable",
"sorted",
"sorted_pairwise",
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sort_stable_in T (P : {pred T}) (leT leT' : rel T) :
{in P &, total leT} -> {in P & &, transitive leT'} ->
forall s : seq T, all P s -> sorted leT' s ->
sorted [rel x y | leT x y && (leT y x ==> leT' x y)] (sort leT s). | Proof.
move=> /in2_sig leT_total /in3_sig leT_tr _ /all_sigP[s ->].
by rewrite sort_map !sorted_map; apply: sort_stable.
Qed. | Lemma | sort_stable_in | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"all",
"all_sigP",
"apply",
"leT_total",
"leT_tr",
"rel",
"seq",
"sort",
"sort_map",
"sort_stable",
"sorted",
"sorted_map",
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
filter_sort T (leT : rel T) :
total leT -> transitive leT ->
forall p s, filter p (sort leT s) = sort leT (filter p s). | Proof.
move=> leT_total leT_tr p s; case Ds: s => // [x s1].
pose leN := relpre (nth x s) leT.
pose lt_lex := [rel n m | leN n m && (leN m n ==> (n < m))].
have lt_lex_tr: transitive lt_lex.
rewrite /lt_lex /leN => ? ? ? /= /andP [xy xy'] /andP [yz yz'].
rewrite (leT_tr _ _ _ xy yz); apply/implyP => zx; move: xy' y... | Lemma | filter_sort | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"filter",
"filter_map",
"iota_ltn_sorted",
"irr_sorted_eq",
"leT_total",
"leT_tr",
"lt_lex",
"ltn_trans",
"ltnn",
"map",
"mem_filter",
"mem_sort",
"mkseq_nth",
"nth",
"rel",
"s1",
"sort",
"sort_iota_stable",
"sort_map",
"sort_stable",
"sorted_filter",
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
filter_sort_in T (P : {pred T}) (leT : rel T) :
{in P &, total leT} -> {in P & &, transitive leT} ->
forall p s, all P s -> filter p (sort leT s) = sort leT (filter p s). | Proof.
move=> /in2_sig leT_total /in3_sig leT_tr p _ /all_sigP[s ->].
by rewrite !(sort_map, filter_map) filter_sort.
Qed. | Lemma | filter_sort_in | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"all",
"all_sigP",
"filter",
"filter_map",
"filter_sort",
"leT_total",
"leT_tr",
"rel",
"sort",
"sort_map",
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
mask_sort s m :
{m_s : bitseq | mask m_s (sort leT s) = sort leT (mask m s)}. | Proof.
case Ds: {-}s => [|x s1]; [by rewrite Ds; case: m; exists [::] | clear s1 Ds].
rewrite -(mkseq_nth x s) -map_mask !sort_map.
exists [seq i \in mask m (iota 0 (size s)) |
i <- sort (xrelpre (nth x s) leT) (iota 0 (size s))].
rewrite -map_mask -filter_mask [in RHS]mask_filter ?iota_uniq ?filter_sort //... | Lemma | mask_sort | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"bitseq",
"filter_mask",
"filter_sort",
"iota",
"iota_uniq",
"leT_tr",
"map_mask",
"mask",
"mask_filter",
"mkseq_nth",
"nth",
"s1",
"seq",
"size",
"sort",
"sort_map"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sorted_mask_sort s m :
sorted leT (mask m s) -> {m_s | mask m_s (sort leT s) = mask m s}. | Proof. by move/(sorted_sort leT_tr) <-; exact: mask_sort. Qed. | Lemma | sorted_mask_sort | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"leT_tr",
"mask",
"mask_sort",
"sort",
"sorted",
"sorted_sort"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
leT_total : {in P &, total leT}. | Hypothesis | leT_total | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | ||
le_sT | := relpre (val : sig P -> _) leT. | Let | le_sT | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"sig",
"val"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
le_sT_total : total le_sT | := in2_sig leT_total. | Let | le_sT_total | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"leT_total",
"le_sT",
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
le_sT_tr : transitive le_sT | := in3_sig leT_tr. | Let | le_sT_tr | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"leT_tr",
"le_sT"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
mask_sort_in s m :
all P s -> {m_s : bitseq | mask m_s (sort leT s) = sort leT (mask m s)}. | Proof.
move=> /all_sigP [{}s ->]; case: (mask_sort (leT := le_sT) _ _ s m) => //.
by move=> m' m'E; exists m'; rewrite -map_mask !sort_map -map_mask m'E.
Qed. | Lemma | mask_sort_in | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"all",
"all_sigP",
"bitseq",
"le_sT",
"map_mask",
"mask",
"mask_sort",
"sort",
"sort_map"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sorted_mask_sort_in s m :
all P s -> sorted leT (mask m s) -> {m_s | mask m_s (sort leT s) = mask m s}. | Proof.
move=> ? /(sorted_sort_in leT_tr _) <-; [exact: all_mask | exact: mask_sort_in].
Qed. | Lemma | sorted_mask_sort_in | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"all",
"all_mask",
"leT_tr",
"mask",
"mask_sort_in",
"sort",
"sorted",
"sorted_sort_in"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
subseq_sort : {homo sort leT : t s / subseq t s}. | Proof.
move=> _ s /subseqP [m _ ->]; have [m' <-] := mask_sort leT_total leT_tr s m.
exact: mask_subseq.
Qed. | Lemma | subseq_sort | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"leT_total",
"leT_tr",
"mask_sort",
"mask_subseq",
"sort",
"subseq",
"subseqP"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sorted_subseq_sort t s :
subseq t s -> sorted leT t -> subseq t (sort leT s). | Proof. by move=> subseq_ts /(sorted_sort leT_tr) <-; exact: subseq_sort. Qed. | Lemma | sorted_subseq_sort | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"leT_tr",
"sort",
"sorted",
"sorted_sort",
"subseq",
"subseq_sort"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
mem2_sort s x y : leT x y -> mem2 s x y -> mem2 (sort leT s) x y. | Proof.
move=> lexy /[!mem2E] /subseq_sort.
by case: eqP => // _; rewrite {1}/sort /= lexy /=.
Qed. | Lemma | mem2_sort | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"mem2",
"mem2E",
"sort",
"subseq_sort"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
subseq_sort_in t s :
{in s &, total leT} -> {in s & &, transitive leT} ->
subseq t s -> subseq (sort leT t) (sort leT s). | Proof.
move=> leT_total leT_tr /subseqP [m _ ->].
have [m' <-] := mask_sort_in leT_total leT_tr m (allss _).
exact: mask_subseq.
Qed. | Lemma | subseq_sort_in | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"allss",
"leT_total",
"leT_tr",
"mask_sort_in",
"mask_subseq",
"sort",
"subseq",
"subseqP",
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sorted_subseq_sort_in t s :
{in s &, total leT} -> {in s & &, transitive leT} ->
subseq t s -> sorted leT t -> subseq t (sort leT s). | Proof.
move=> ? leT_tr ? /(sorted_sort_in leT_tr) <-; first exact/allP/mem_subseq.
exact: subseq_sort_in.
Qed. | Lemma | sorted_subseq_sort_in | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"allP",
"leT_tr",
"mem_subseq",
"sort",
"sorted",
"sorted_sort_in",
"subseq",
"subseq_sort_in",
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
mem2_sort_in s :
{in s &, total leT} -> {in s & &, transitive leT} ->
forall x y, leT x y -> mem2 s x y -> mem2 (sort leT s) x y. | Proof.
move=> leT_total leT_tr x y lexy; rewrite !mem2E.
by move/subseq_sort_in; case: (_ == _); rewrite /sort /= ?lexy; apply.
Qed. | Lemma | mem2_sort_in | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"leT_total",
"leT_tr",
"mem2",
"mem2E",
"sort",
"subseq_sort_in",
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sort_sorted T (leT : rel T) :
total leT -> forall s, sorted leT (sort leT s). | Proof.
move=> leT_total s; apply/sub_sorted/sort_stable => //= [? ? /andP[] //|].
by case: s => // x s; elim: s x => /=.
Qed. | Lemma | sort_sorted | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"leT_total",
"rel",
"sort",
"sort_stable",
"sorted",
"sub_sorted",
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sort_sorted_in T (P : {pred T}) (leT : rel T) :
{in P &, total leT} -> forall s : seq T, all P s -> sorted leT (sort leT s). | Proof.
by move=> /in2_sig ? _ /all_sigP[s ->]; rewrite sort_map sorted_map sort_sorted.
Qed. | Lemma | sort_sorted_in | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"all",
"all_sigP",
"rel",
"seq",
"sort",
"sort_map",
"sort_sorted",
"sorted",
"sorted_map",
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
perm_sortP (T : eqType) (leT : rel T) :
total leT -> transitive leT -> antisymmetric leT ->
forall s1 s2, reflect (sort leT s1 = sort leT s2) (perm_eq s1 s2). | Proof.
move=> leT_total leT_tr leT_asym s1 s2.
apply: (iffP idP) => eq12; last by rewrite -(perm_sort leT) eq12 perm_sort.
apply: (sorted_eq leT_tr leT_asym); rewrite ?sort_sorted //.
by rewrite perm_sort (permPl eq12) -(perm_sort leT).
Qed. | Lemma | perm_sortP | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"last",
"leT_total",
"leT_tr",
"permPl",
"perm_eq",
"perm_sort",
"rel",
"s1",
"s2",
"sort",
"sort_sorted",
"sorted_eq",
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
perm_sort_inP (T : eqType) (leT : rel T) (s1 s2 : seq T) :
{in s1 &, total leT} -> {in s1 & &, transitive leT} ->
{in s1 &, antisymmetric leT} ->
reflect (sort leT s1 = sort leT s2) (perm_eq s1 s2). | Proof.
move=> /in2_sig leT_total /in3_sig leT_tr /in2_sig/(_ _ _ _)/val_inj leT_asym.
apply: (iffP idP) => s1s2; last by rewrite -(perm_sort leT) s1s2 perm_sort.
move: (s1s2); have /all_sigP[s1' ->] := allss s1.
have /all_sigP[{s1s2}s2 ->] : all [in s1] s2 by rewrite -(perm_all _ s1s2).
by rewrite !sort_map => /(perm_m... | Lemma | perm_sort_inP | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"all",
"all_sigP",
"allss",
"apply",
"last",
"leT_total",
"leT_tr",
"perm_all",
"perm_eq",
"perm_map_inj",
"perm_sort",
"perm_sortP",
"rel",
"s1",
"s2",
"seq",
"sort",
"sort_map",
"total",
"val_inj"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
homo_sort_map (T : Type) (T' : eqType) (f : T -> T') leT leT' :
antisymmetric (relpre f leT') -> transitive (relpre f leT') -> total leT ->
{homo f : x y / leT x y >-> leT' x y} ->
forall s : seq T, sort leT' (map f s) = map f (sort leT s). | Proof.
move=> leT'_asym leT'_trans leT_total f_homo s; case Ds: s => // [x s'].
rewrite -{}Ds -(mkseq_nth x s) [in RHS]sort_map -!map_comp /comp.
apply: (@sorted_eq_in _ leT') => [? ? ?|? ?|||]; rewrite ?mem_sort.
- by move=> /mapP[? _ ->] /mapP[? _ ->] /mapP[? _ ->]; apply/leT'_trans.
- by move=> /mapP[? _ ->] /mapP[?... | Lemma | homo_sort_map | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"T'",
"allss",
"apply",
"comp",
"homo_sorted",
"leT_total",
"map",
"mapP",
"map_comp",
"mem_sort",
"mkseq_nth",
"nth",
"perm_map",
"perm_sort",
"perm_sym",
"seq",
"sort",
"sort_map",
"sort_sorted",
"sort_sorted_in",
"sorted_eq_in",
"total"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
homo_sort_map_in
(T : Type) (T' : eqType) (P : {pred T}) (f : T -> T') leT leT' :
{in P &, antisymmetric (relpre f leT')} ->
{in P & &, transitive (relpre f leT')} -> {in P &, total leT} ->
{in P &, {homo f : x y / leT x y >-> leT' x y}} ->
forall s : seq T, all P s ->
sort leT' [seq f x | x <- s]... | Proof.
move=> /in2_sig leT'_asym /in3_sig leT'_trans /in2_sig leT_total.
move=> /in2_sig f_homo _ /all_sigP[s ->].
rewrite [in RHS]sort_map -!map_comp /comp.
by apply: homo_sort_map => // ? ? /leT'_asym /val_inj.
Qed. | Lemma | homo_sort_map_in | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"T'",
"all",
"all_sigP",
"apply",
"comp",
"homo_sort_map",
"leT_total",
"map_comp",
"seq",
"sort",
"sort_map",
"total",
"val_inj"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
fpath f | := (path (coerced_frel f)). | Notation | fpath | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"coerced_frel",
"path"
] | Function trajectories. | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d |
fcycle f | := (cycle (coerced_frel f)). | Notation | fcycle | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"coerced_frel",
"cycle"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
ufcycle f | := (ucycle (coerced_frel f)). | Notation | ufcycle | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"coerced_frel",
"ucycle"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
traject x n | := if n is n'.+1 then x :: traject (f x) n' else [::]. | Fixpoint | traject | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"n'"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
trajectS x n : traject x n.+1 = x :: traject (f x) n. | Proof. by []. Qed. | Lemma | trajectS | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"traject"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
trajectSr x n : traject x n.+1 = rcons (traject x n) (iter n f x). | Proof. by elim: n x => //= n IHn x; rewrite IHn -iterSr. Qed. | Lemma | trajectSr | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"iter",
"iterSr",
"rcons",
"traject"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
last_traject x n : last x (traject (f x) n) = iter n f x. | Proof. by case: n => // n; rewrite iterSr trajectSr last_rcons. Qed. | Lemma | last_traject | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"iter",
"iterSr",
"last",
"last_rcons",
"traject",
"trajectSr"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
traject_iteri x n :
traject x n = iteri n (fun i => rcons^~ (iter i f x)) [::]. | Proof. by elim: n => //= n <-; rewrite -trajectSr. Qed. | Lemma | traject_iteri | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"iter",
"iteri",
"rcons",
"traject",
"trajectSr"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
size_traject x n : size (traject x n) = n. | Proof. by elim: n x => //= n IHn x //=; rewrite IHn. Qed. | Lemma | size_traject | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"size",
"traject"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
nth_traject i n : i < n -> forall x, nth x (traject x n) i = iter i f x. | Proof.
elim: n => // n IHn; rewrite ltnS => le_i_n x.
rewrite trajectSr nth_rcons size_traject.
by case: ltngtP le_i_n => [? _||->] //; apply: IHn.
Qed. | Lemma | nth_traject | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"iter",
"ltnS",
"ltngtP",
"nth",
"nth_rcons",
"size_traject",
"traject",
"trajectSr"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
trajectD m n x :
traject x (m + n) = traject x m ++ traject (iter m f x) n. | Proof. by elim: m => //m IHm in x *; rewrite addSn !trajectS IHm -iterSr. Qed. | Lemma | trajectD | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"addSn",
"iter",
"iterSr",
"traject",
"trajectS"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
take_traject n k x : k <= n -> take k (traject x n) = traject x k. | Proof. by move=> /subnKC<-; rewrite trajectD take_size_cat ?size_traject. Qed. | Lemma | take_traject | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"size_traject",
"subnKC",
"take",
"take_size_cat",
"traject",
"trajectD"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
eq_fpath f' : f =1 f' -> fpath f =2 fpath f'. | Proof. by move/eq_frel/eq_path. Qed. | Lemma | eq_fpath | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"eq_frel",
"eq_path",
"fpath"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
eq_fcycle f' : f =1 f' -> fcycle f =1 fcycle f'. | Proof. by move/eq_frel/eq_cycle. Qed. | Lemma | eq_fcycle | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"eq_cycle",
"eq_frel",
"fcycle"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
fpathE x p : fpath f x p -> p = traject f (f x) (size p). | Proof. by elim: p => //= y p IHp in x * => /andP[/eqP{y}<- /IHp<-]. Qed. | Lemma | fpathE | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"fpath",
"size",
"traject"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
fpathP x p : reflect (exists n, p = traject f (f x) n) (fpath f x p). | Proof.
apply: (iffP idP) => [/fpathE->|[n->]]; first by exists (size p).
by elim: n => //= n IHn in x *; rewrite eqxx IHn.
Qed. | Lemma | fpathP | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"eqxx",
"fpath",
"fpathE",
"size",
"traject"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
fpath_traject x n : fpath f x (traject f (f x) n). | Proof. by apply/(fpathP x); exists n. Qed. | Lemma | fpath_traject | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"fpath",
"fpathP",
"traject"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
looping x n | := iter n f x \in traject f x n. | Definition | looping | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"iter",
"traject"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
loopingP x n :
reflect (forall m, iter m f x \in traject f x n) (looping x n). | Proof.
apply: (iffP idP) => loop_n; last exact: loop_n.
case: n => // n in loop_n *; elim=> [|m /= IHm]; first exact: mem_head.
move: (fpath_traject x n) loop_n; rewrite /looping !iterS -last_traject /=.
move: (iter m f x) IHm => y /splitPl[p1 p2 def_y].
rewrite cat_path last_cat def_y; case: p2 => // z p2 /and3P[_ /eq... | Lemma | loopingP | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"cat_path",
"fpath_traject",
"inE",
"iter",
"iterS",
"last",
"last_cat",
"last_traject",
"looping",
"mem_cat",
"mem_head",
"splitPl",
"traject"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
trajectP x n y :
reflect (exists2 i, i < n & y = iter i f x) (y \in traject f x n). | Proof.
elim: n x => [|n IHn] x /=; first by right; case.
rewrite inE; have [-> | /= neq_xy] := eqP; first by left; exists 0.
apply: {IHn}(iffP (IHn _)) => [[i] | [[|i]]] // lt_i_n ->.
by exists i.+1; rewrite ?iterSr.
by exists i; rewrite ?iterSr.
Qed. | Lemma | trajectP | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"inE",
"iter",
"iterSr",
"traject"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
looping_uniq x n : uniq (traject f x n.+1) = ~~ looping x n. | Proof.
rewrite /looping; elim: n x => [|n IHn] x //.
rewrite [n.+1 in LHS]lock [iter]lock /= -!lock {}IHn -iterSr -negb_or inE.
congr (~~ _); apply: orb_id2r => /trajectP no_loop.
apply/idP/eqP => [/trajectP[m le_m_n def_x] | {1}<-]; last first.
by rewrite iterSr -last_traject mem_last.
have loop_m: looping x m.+1 by... | Lemma | looping_uniq | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"inE",
"iter",
"iterSr",
"last",
"last_traject",
"leq_trans",
"looping",
"loopingP",
"ltnS",
"mem_head",
"mem_last",
"traject",
"trajectP",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
nextE (x : T) (p_x : x \in p) : next p x = f x. | Proof. exact/esym/eqP/(next_cycle f_p). Qed. | Lemma | nextE | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"next",
"next_cycle"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
mem_fcycle : {homo f : x / x \in p}. | Proof. by move=> x xp; rewrite -nextE// mem_next. Qed. | Lemma | mem_fcycle | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"mem_next",
"nextE"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
inj_cycle : {in p &, injective f}. | Proof.
apply: can_in_inj (iter (size p).-1 f) _ => x /rot_to[i q rip].
have /fpathE qxE : fcycle f (x :: q) by rewrite -rip rot_cycle.
have -> : size p = size (rcons q x) by rewrite size_rcons -(size_rot i) rip.
by rewrite -iterSr -last_traject prednK -?qxE ?size_rcons// last_rcons.
Qed. | Lemma | inj_cycle | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"fcycle",
"fpathE",
"iter",
"iterSr",
"last_rcons",
"last_traject",
"prednK",
"rcons",
"rot_cycle",
"rot_to",
"size",
"size_rcons",
"size_rot"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
Up : uniq p. | Hypothesis | Up | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | ||
prev_next : cancel (next p) (prev p). | Proof.
move=> x; rewrite prev_nth mem_next next_nth; case p_x: (x \in p) => //.
case Dp: p Up p_x => // [y q]; rewrite [uniq _]/= -Dp => /andP[q'y Uq] p_x.
rewrite -[RHS](nth_index y p_x); congr (nth y _ _); set i := index x p.
have: i <= size q by rewrite -index_mem -/i Dp in p_x.
case: ltngtP => // [lt_i_q|->] _; fir... | Lemma | prev_next | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"Up",
"apply",
"eqn_leq",
"index",
"index_mem",
"index_size",
"index_uniq",
"leqNgt",
"ltngtP",
"mem_next",
"next",
"next_nth",
"nth",
"nth_default",
"nth_index",
"prev",
"prev_nth",
"size",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
next_prev : cancel (prev p) (next p). | Proof.
move=> x; rewrite next_nth mem_prev prev_nth; case p_x: (x \in p) => //.
case def_p: p p_x => // [y q]; rewrite -def_p => p_x.
rewrite index_uniq //; first by rewrite def_p ltnS index_size.
case q_x: (x \in q); first exact: nth_index.
rewrite nth_default; first by rewrite leqNgt index_mem q_x.
by apply/eqP; rewr... | Lemma | next_prev | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"def_p",
"eq_sym",
"inE",
"index_mem",
"index_size",
"index_uniq",
"leqNgt",
"ltnS",
"mem_prev",
"next",
"next_nth",
"nth_default",
"nth_index",
"prev",
"prev_nth"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
cycle_next : fcycle (next p) p. | Proof.
case def_p: p Up => [|x q] Uq //; rewrite -[in next _]def_p.
apply/(pathP x)=> i; rewrite size_rcons => le_i_q.
rewrite -cats1 -cat_cons nth_cat le_i_q /= next_nth {}def_p mem_nth //.
rewrite index_uniq // nth_cat /= ltn_neqAle andbC -ltnS le_i_q.
by case: (i =P _) => //= ->; rewrite subnn nth_default.
Qed. | Lemma | cycle_next | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"Up",
"apply",
"cat_cons",
"cats1",
"def_p",
"fcycle",
"index_uniq",
"ltnS",
"ltn_neqAle",
"mem_nth",
"next",
"next_nth",
"nth_cat",
"nth_default",
"pathP",
"size_rcons",
"subnn"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
cycle_prev : cycle (fun x y => x == prev p y) p. | Proof.
apply: etrans cycle_next; symmetry; case def_p: p => [|x q] //.
by apply: eq_path; rewrite -def_p; apply: (can2_eq prev_next next_prev).
Qed. | Lemma | cycle_prev | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"can2_eq",
"cycle",
"cycle_next",
"def_p",
"eq_path",
"next_prev",
"prev",
"prev_next"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
cycle_from_next : (forall x, x \in p -> e x (next p x)) -> cycle e p. | Proof.
case: p (next p) cycle_next => //= [x q] n; rewrite -(belast_rcons x q x).
move: {q}(rcons q x) => q n_q /allP.
by elim: q x n_q => //= _ q IHq x /andP[/eqP <- n_q] /andP[-> /IHq->].
Qed. | Lemma | cycle_from_next | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"allP",
"belast_rcons",
"cycle",
"cycle_next",
"next",
"rcons"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
cycle_from_prev : (forall x, x \in p -> e (prev p x) x) -> cycle e p. | Proof.
move=> e_p; apply: cycle_from_next => x.
by rewrite -mem_next => /e_p; rewrite prev_next.
Qed. | Lemma | cycle_from_prev | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"apply",
"cycle",
"cycle_from_next",
"mem_next",
"prev",
"prev_next"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
next_rot : next (rot n0 p) =1 next p. | Proof.
move=> x; have n_p := cycle_next; rewrite -(rot_cycle n0) in n_p.
case p_x: (x \in p); last by rewrite !next_nth mem_rot p_x.
by rewrite (eqP (next_cycle n_p _)) ?mem_rot.
Qed. | Lemma | next_rot | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"cycle_next",
"last",
"mem_rot",
"next",
"next_cycle",
"next_nth",
"rot",
"rot_cycle"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prev_rot : prev (rot n0 p) =1 prev p. | Proof.
move=> x; have p_p := cycle_prev; rewrite -(rot_cycle n0) in p_p.
case p_x: (x \in p); last by rewrite !prev_nth mem_rot p_x.
by rewrite (eqP (prev_cycle p_p _)) ?mem_rot.
Qed. | Lemma | prev_rot | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"cycle_prev",
"last",
"mem_rot",
"prev",
"prev_cycle",
"prev_nth",
"rot",
"rot_cycle"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
next_rotr : next (rotr n0 p) =1 next p. | Proof. exact: next_rot. Qed. | Lemma | next_rotr | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"next",
"next_rot",
"rotr"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prev_rotr : prev (rotr n0 p) =1 prev p. | Proof. exact: prev_rot. Qed. | Lemma | prev_rotr | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"prev",
"prev_rot",
"rotr"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prev_rev p : uniq p -> prev (rev p) =1 next p. | Proof.
move=> Up x; case p_x: (x \in p); last first.
by rewrite next_nth prev_nth mem_rev p_x.
case/rot_to: p_x (Up) => [i q def_p] Urp; rewrite -rev_uniq in Urp.
rewrite -(prev_rotr i Urp); do 2 rewrite -(prev_rotr 1) ?rotr_uniq //.
rewrite -rev_rot -(next_rot i Up) {i p Up Urp}def_p.
by case: q => // y q; rewrite !... | Lemma | prev_rev | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"Up",
"def_p",
"eqxx",
"last",
"mem_rev",
"next",
"next_nth",
"next_rot",
"prev",
"prev_nth",
"prev_rotr",
"rcons_cons",
"rev",
"rev_cons",
"rev_rot",
"rev_uniq",
"rot_to",
"rotr1_rcons",
"rotr_uniq",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
next_rev p : uniq p -> next (rev p) =1 prev p. | Proof. by move=> Up x; rewrite -[p in RHS]revK prev_rev // rev_uniq. Qed. | Lemma | next_rev | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"Up",
"next",
"prev",
"prev_rev",
"rev",
"revK",
"rev_uniq",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
rel_base (b : pred T) | :=
forall x' y', ~~ b (h x') -> e (h x') (h y') = e' x' y'. | Definition | rel_base | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"e'"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
map_path b x' p' (Bb : rel_base b) :
~~ has (preim h b) (belast x' p') ->
path e (h x') (map h p') = path e' x' p'. | Proof. by elim: p' x' => [|y' p' IHp'] x' //= /norP[/Bb-> /IHp'->]. Qed. | Lemma | map_path | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"belast",
"e'",
"has",
"map",
"path",
"rel_base"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
Ih : injective h. | Hypothesis | Ih | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | ||
mem2_map x' y' p' : mem2 (map h p') (h x') (h y') = mem2 p' x' y'. | Proof. by rewrite [LHS]/mem2 (index_map Ih) -map_drop mem_map. Qed. | Lemma | mem2_map | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"Ih",
"index_map",
"map",
"map_drop",
"mem2",
"mem_map"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
next_map p : uniq p -> forall x, next (map h p) (h x) = h (next p x). | Proof.
move=> Up x; case p_x: (x \in p); last by rewrite !next_nth (mem_map Ih) p_x.
case/rot_to: p_x => i p' def_p.
rewrite -(next_rot i Up); rewrite -(map_inj_uniq Ih) in Up.
rewrite -(next_rot i Up) -map_rot {i p Up}def_p /=.
by case: p' => [|y p''] //=; rewrite !eqxx.
Qed. | Lemma | next_map | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"Ih",
"Up",
"def_p",
"eqxx",
"last",
"map",
"map_inj_uniq",
"map_rot",
"mem_map",
"next",
"next_nth",
"next_rot",
"rot_to",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prev_map p : uniq p -> forall x, prev (map h p) (h x) = h (prev p x). | Proof.
move=> Up x; rewrite -[x in LHS](next_prev Up) -(next_map Up).
by rewrite prev_next ?map_inj_uniq.
Qed. | Lemma | prev_map | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"Up",
"map",
"map_inj_uniq",
"next_map",
"next_prev",
"prev",
"prev_next",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
fun_base (T T' : eqType) (h : T' -> T) f f' | :=
rel_base h (frel f) (frel f'). | Definition | fun_base | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"T'",
"frel",
"rel_base"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
arc p x y | := let px := rot (index x p) p in take (index y px) px. | Definition | arc | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"index",
"rot",
"take"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
arc_rot i p : uniq p -> {in p, arc (rot i p) =2 arc p}. | Proof.
move=> Up x p_x y; congr (fun q => take (index y q) q); move: Up p_x {y}.
rewrite -{1 2 5 6}(cat_take_drop i p) /rot cat_uniq => /and3P[_ Up12 _].
rewrite !drop_cat !take_cat !index_cat mem_cat orbC.
case p2x: (x \in drop i p) => /= => [_ | p1x].
rewrite index_mem p2x [x \in _](negbTE (hasPn Up12 _ p2x)) /= ad... | Lemma | arc_rot | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"Up",
"addKn",
"arc",
"catA",
"cat_take_drop",
"cat_uniq",
"drop",
"drop_cat",
"hasPn",
"index",
"index_cat",
"index_mem",
"leq_addr",
"ltnNge",
"mem_cat",
"rot",
"take",
"take_cat",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
left_arc x y p1 p2 (p := x :: p1 ++ y :: p2) :
uniq p -> arc p x y = x :: p1. | Proof.
rewrite /arc /p [index x _]/= eqxx rot0 -cat_cons cat_uniq index_cat.
move: (x :: p1) => xp1 /and3P[_ /norP[/= /negbTE-> _] _].
by rewrite eqxx addn0 take_size_cat.
Qed. | Lemma | left_arc | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"addn0",
"arc",
"cat_cons",
"cat_uniq",
"eqxx",
"index",
"index_cat",
"rot0",
"take_size_cat",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
right_arc x y p1 p2 (p := x :: p1 ++ y :: p2) :
uniq p -> arc p y x = y :: p2. | Proof.
rewrite -[p]cat_cons -rot_size_cat rot_uniq => Up.
by rewrite arc_rot ?left_arc ?mem_head.
Qed. | Lemma | right_arc | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"Up",
"arc",
"arc_rot",
"cat_cons",
"left_arc",
"mem_head",
"rot_size_cat",
"rot_uniq",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
rot_to_arc_spec p x y | :=
RotToArcSpec i p1 p2 of x :: p1 = arc p x y
& y :: p2 = arc p y x
& rot i p = x :: p1 ++ y :: p2 :
rot_to_arc_spec p x y. | Variant | rot_to_arc_spec | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"arc",
"rot"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
rot_to_arc p x y :
uniq p -> x \in p -> y \in p -> x != y -> rot_to_arc_spec p x y. | Proof.
move=> Up p_x p_y ne_xy; case: (rot_to p_x) (p_y) (Up) => [i q def_p] q_y.
rewrite -(mem_rot i) def_p inE eq_sym (negbTE ne_xy) in q_y.
rewrite -(rot_uniq i) def_p.
case/splitPr: q / q_y def_p => q1 q2 def_p Uq12; exists i q1 q2 => //.
by rewrite -(arc_rot i Up p_x) def_p left_arc.
by rewrite -(arc_rot i Up p_... | Lemma | rot_to_arc | boot | boot/path.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq"
] | [
"Up",
"arc_rot",
"def_p",
"eq_sym",
"inE",
"left_arc",
"mem_rot",
"right_arc",
"rot_to",
"rot_to_arc_spec",
"rot_uniq",
"splitPr",
"uniq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
edivn2 q r | := if r is r'.+2 then edivn2 q.+1 r' else (q, r). | Fixpoint | edivn2 | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [] | We start with faster mod-2 and 2-valuation functions. | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d |
edivn2P n : edivn_spec n 2 (edivn2 0 n). | Proof.
rewrite -[n]odd_double_half addnC -{1}[n./2]addn0 -{1}mul2n mulnC.
elim: n./2 {1 4}0 => [|r IHr] q; first by case (odd n) => /=.
by rewrite addSnnS; apply: IHr.
Qed. | Lemma | edivn2P | boot | boot/prime.v | [
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat",
"seq",
"path",
"choice",
"fintype",
"div",
"bigop",
"NatTrec"
] | [
"addSnnS",
"addn0",
"addnC",
"apply",
"edivn2",
"edivn_spec",
"mul2n",
"mulnC",
"odd",
"odd_double_half"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.