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 |
|---|---|---|---|---|---|---|
uniq_min_sizes1 s2 :
uniq s1 -> {subset s1 <= s2} -> size s2 <= size s1 ->
(size s1 = size s2) * (s1 =i s2).
Proof.
move=> Us1 ss12 le_s21; have Us2: uniq s2 := leq_size_uniq Us1 ss12 le_s21.
suffices: s1 =i s2 by split; first by apply/eqP; rewrite -uniq_size_uniq.
move=> x; apply/idP/idP=> [/ss12// | s2x]; apply: contraLR le_s21 => not_s1x.
rewrite -ltnNge (@uniq_leq_size (x :: s1)) /= ?not_s1x //.
by apply/allP; rewrite /= s2x; apply/allP.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | uniq_min_size | |
eq_uniqs1 s2 : size s1 = size s2 -> s1 =i s2 -> uniq s1 = uniq s2.
Proof.
move=> eq_sz12 eq_s12.
by apply/idP/idP=> Us; rewrite (uniq_size_uniq Us) ?eq_sz12 ?eqxx.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | eq_uniq | |
perm_uniqs1 s2 : perm_eq s1 s2 -> uniq s1 = uniq s2.
Proof. by move=> eq_s12; apply/eq_uniq; [apply/perm_size | apply/perm_mem]. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | perm_uniq | |
uniq_perms1 s2 : uniq s1 -> uniq s2 -> s1 =i s2 -> perm_eq s1 s2.
Proof.
move=> Us1 Us2 eq12; apply/allP=> x _; apply/eqP.
by rewrite !count_uniq_mem ?eq12.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | uniq_perm | |
perm_undups1 s2 : s1 =i s2 -> perm_eq (undup s1) (undup s2).
Proof.
by move=> Es12; rewrite uniq_perm ?undup_uniq // => s; rewrite !mem_undup.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | perm_undup | |
count_mem_uniqs : (forall x, count_mem x s = (x \in s)) -> uniq s.
Proof.
move=> count1_s; have Uus := undup_uniq s.
suffices: perm_eq s (undup s) by move/perm_uniq->.
by apply/allP=> x _; apply/eqP; rewrite (count_uniq_mem x Uus) mem_undup.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | count_mem_uniq | |
eq_count_undupa s1 s2 :
{in a, s1 =i s2} -> count a (undup s1) = count a (undup s2).
Proof.
move=> s1_eq_s2; rewrite -!size_filter !filter_undup.
apply/perm_size/perm_undup => x.
by rewrite !mem_filter; case: (boolP (a x)) => //= /s1_eq_s2.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | eq_count_undup | |
catCA_perm_indP :
(forall s1 s2 s3, P (s1 ++ s2 ++ s3) -> P (s2 ++ s1 ++ s3)) ->
(forall s1 s2, perm_eq s1 s2 -> P s1 -> P s2).
Proof.
move=> PcatCA s1 s2 eq_s12; rewrite -[s1]cats0 -[s2]cats0.
elim: s2 nil => [|x s2 IHs] s3 in s1 eq_s12 *.
by case: s1 {eq_s12}(perm_size eq_s12).
have /rot_to[i s' def_s1]: x \in s1 by rewrite (perm_mem eq_s12) mem_head.
rewrite -(cat_take_drop i s1) -catA => /PcatCA.
rewrite catA -/(rot i s1) def_s1 /= -cat1s => /PcatCA/IHs/PcatCA; apply.
by rewrite -(perm_cons x) -def_s1 perm_rot.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | catCA_perm_ind | |
catCA_perm_substR F :
(forall s1 s2 s3, F (s1 ++ s2 ++ s3) = F (s2 ++ s1 ++ s3) :> R) ->
(forall s1 s2, perm_eq s1 s2 -> F s1 = F s2).
Proof.
move=> FcatCA s1 s2 /catCA_perm_ind => ind_s12.
by apply: (ind_s12 (eq _ \o F)) => //= *; rewrite FcatCA.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | catCA_perm_subst | |
perm_eqls1 s2 := (perm_eq s1 =1 perm_eq s2). | Notation | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | perm_eql | |
perm_eqrs1 s2 := (perm_eq^~ s1 =1 perm_eq^~ s2).
Arguments permP {T s1 s2}.
Arguments permPl {T s1 s2}.
Arguments permPr {T s1 s2}.
Prenex Implicits perm_eq.
#[global] Hint Resolve perm_refl : core. | Notation | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | perm_eqr | |
size_rotrs : size (rotr n0 s) = size s.
Proof. by rewrite size_rot. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_rotr | |
mem_rotr(s : seq T') : rotr n0 s =i s.
Proof. by move=> x; rewrite mem_rot. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mem_rotr | |
rotr_size_cats1 s2 : rotr (size s2) (s1 ++ s2) = s2 ++ s1.
Proof. by rewrite /rotr size_cat addnK rot_size_cat. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rotr_size_cat | |
rotr1_rconsx s : rotr 1 (rcons s x) = x :: s.
Proof. by rewrite -rot1_cons rotK. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rotr1_rcons | |
has_rotra s : has a (rotr n0 s) = has a s.
Proof. by rewrite has_rot. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | has_rotr | |
rotr_uniq(s : seq T') : uniq (rotr n0 s) = uniq s.
Proof. by rewrite rot_uniq. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rotr_uniq | |
rotrK: cancel (@rotr T n0) (rot n0).
Proof.
move=> s; have [lt_n0s | ge_n0s] := ltnP n0 (size s).
by rewrite -{1}(subKn (ltnW lt_n0s)) -{1}[size s]size_rotr; apply: rotK.
by rewrite -[in RHS](rot_oversize ge_n0s) /rotr (eqnP ge_n0s) rot0.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rotrK | |
rotr_inj: injective (@rotr T n0).
Proof. exact (can_inj rotrK). Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rotr_inj | |
take_revs : take n0 (rev s) = rev (drop (size s - n0) s).
Proof.
set m := _ - n0; rewrite -[s in LHS](cat_take_drop m) rev_cat take_cat.
rewrite size_rev size_drop -minnE minnC leq_min ltnn /m.
by have [_|/eqnP->] := ltnP; rewrite ?subnn take0 cats0.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | take_rev | |
rev_takes : rev (take n0 s) = drop (size s - n0) (rev s).
Proof. by rewrite -[s in take _ s]revK take_rev revK size_rev. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rev_take | |
drop_revs : drop n0 (rev s) = rev (take (size s - n0) s).
Proof.
set m := _ - n0; rewrite -[s in LHS](cat_take_drop m) rev_cat drop_cat.
rewrite size_rev size_drop -minnE minnC leq_min ltnn /m.
by have [_|/eqnP->] := ltnP; rewrite ?take0 // subnn drop0.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | drop_rev | |
rev_drops : rev (drop n0 s) = take (size s - n0) (rev s).
Proof. by rewrite -[s in drop _ s]revK drop_rev revK size_rev. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rev_drop | |
rev_rotrs : rev (rotr n0 s) = rot n0 (rev s).
Proof. by rewrite rev_cat -take_rev -drop_rev. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rev_rotr | |
rev_rots : rev (rot n0 s) = rotr n0 (rev s).
Proof. by apply: canLR revK _; rewrite rev_rotr revK. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rev_rot | |
rotDm n s : m + n <= size s -> rot (m + n) s = rot m (rot n s).
Proof.
move=> sz_s; rewrite [LHS]/rot -[take _ s](cat_take_drop n).
rewrite 5!(catA, =^~ rot_size_cat) !cat_take_drop.
by rewrite size_drop !size_takel ?leq_addl ?addnK.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rotD | |
rotSn s : n < size s -> rot n.+1 s = rot 1 (rot n s).
Proof. exact: (@rotD 1). Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rotS | |
rot_add_modm n s : n <= size s -> m <= size s ->
rot m (rot n s) = rot (if m + n <= size s then m + n else m + n - size s) s.
Proof.
move=> Hn Hm; case: leqP => [/rotD // | /ltnW Hmn]; symmetry.
by rewrite -{2}(rotK n s) /rotr -rotD size_rot addnBA ?subnK ?addnK.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rot_add_mod | |
rot_minnn s : rot n s = rot (minn n (size s)) s.
Proof.
by case: (leqP n (size s)) => // /leqW ?; rewrite rot_size rot_oversize.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rot_minn | |
rot_adds n m (k := size s) (p := minn m k + minn n k) :=
locked (if p <= k then p else p - k). | Definition | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rot_add | |
leq_rot_addn m s : rot_add s n m <= size s.
Proof.
by unlock rot_add; case: ifP; rewrite // leq_subLR leq_add // geq_minr.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | leq_rot_add | |
rot_addCn m s : rot_add s n m = rot_add s m n.
Proof. by unlock rot_add; rewrite ![minn n _ + _]addnC. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rot_addC | |
rot_rot_addn m s : rot m (rot n s) = rot (rot_add s n m) s.
Proof.
unlock rot_add.
by rewrite (rot_minn n) (rot_minn m) rot_add_mod ?size_rot ?geq_minr.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rot_rot_add | |
rot_rotm n s : rot m (rot n s) = rot n (rot m s).
Proof. by rewrite rot_rot_add rot_addC -rot_rot_add. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rot_rot | |
rot_rotrm n s : rot m (rotr n s) = rotr n (rot m s).
Proof. by rewrite [RHS]/rotr size_rot rot_rot. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rot_rotr | |
rotr_rotrm n s : rotr m (rotr n s) = rotr n (rotr m s).
Proof. by rewrite /rotr !size_rot rot_rot. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rotr_rotr | |
maskm s {struct m} :=
match m, s with
| b :: m', x :: s' => if b then x :: mask m' s' else mask m' s'
| _, _ => [::]
end. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mask | |
mask_falses n : mask (nseq n false) s = [::].
Proof. by elim: s n => [|x s IHs] [|n] /=. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mask_false | |
mask_trues n : size s <= n -> mask (nseq n true) s = s.
Proof. by elim: s n => [|x s IHs] [|n] //= Hn; congr (_ :: _); apply: IHs. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mask_true | |
mask0m : mask m [::] = [::].
Proof. by case: m. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mask0 | |
mask0ss : mask [::] s = [::]. Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mask0s | |
mask1b x : mask [:: b] [:: x] = nseq b x.
Proof. by case: b. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mask1 | |
mask_consb m x s : mask (b :: m) (x :: s) = nseq b x ++ mask m s.
Proof. by case: b. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mask_cons | |
size_maskm s : size m = size s -> size (mask m s) = count id m.
Proof. by move: m s; apply: seq_ind2 => // -[] x m s /= _ ->. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_mask | |
mask_catm1 m2 s1 s2 :
size m1 = size s1 -> mask (m1 ++ m2) (s1 ++ s2) = mask m1 s1 ++ mask m2 s2.
Proof. by move: m1 s1; apply: seq_ind2 => // -[] m1 x1 s1 /= _ ->. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mask_cat | |
mask_rconsb m x s : size m = size s ->
mask (rcons m b) (rcons s x) = mask m s ++ nseq b x.
Proof. by move=> ms; rewrite -!cats1 mask_cat//; case: b. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mask_rcons | |
all_maska m s : all a s -> all a (mask m s).
Proof. by elim: s m => [|x s IHs] [|[] m]//= /andP[ax /IHs->]; rewrite ?ax. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | all_mask | |
has_mask_consa b m x s :
has a (mask (b :: m) (x :: s)) = b && a x || has a (mask m s).
Proof. by case: b. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | has_mask_cons | |
has_maska m s : has a (mask m s) -> has a s.
Proof. by apply/contraTT; rewrite -!all_predC; apply: all_mask. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | has_mask | |
rev_maskm s : size m = size s -> rev (mask m s) = mask (rev m) (rev s).
Proof.
move: m s; apply: seq_ind2 => //= b x m s eq_size_sm IH.
by case: b; rewrite !rev_cons mask_rcons ?IH ?size_rev// (cats1, cats0).
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rev_mask | |
mask_rotm s : size m = size s ->
mask (rot n0 m) (rot n0 s) = rot (count id (take n0 m)) (mask m s).
Proof.
move=> Ems; rewrite mask_cat ?size_drop ?Ems // -rot_size_cat.
by rewrite size_mask -?mask_cat ?size_take ?Ems // !cat_take_drop.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mask_rot | |
resize_maskm s : {m1 | size m1 = size s & mask m s = mask m1 s}.
Proof.
exists (take (size s) m ++ nseq (size s - size m) false).
by elim: s m => [|x s IHs] [|b m] //=; rewrite (size_nseq, IHs).
by elim: s m => [|x s IHs] [|b m] //=; rewrite (mask_false, IHs).
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | resize_mask | |
takeEmaski s : take i s = mask (nseq i true) s.
Proof. by elim: i s => [s|i IHi []// ? ?]; rewrite ?take0 //= IHi. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | takeEmask | |
dropEmaski s :
drop i s = mask (nseq i false ++ nseq (size s - i) true) s.
Proof. by elim: i s => [s|? ? []//]; rewrite drop0/= mask_true// subn0. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | dropEmask | |
mem_mask_consx b m y s :
(x \in mask (b :: m) (y :: s)) = b && (x == y) || (x \in mask m s).
Proof. by case: b. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mem_mask_cons | |
mem_maskx m s : x \in mask m s -> x \in s.
Proof. by rewrite -!has_pred1 => /has_mask. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mem_mask | |
in_maskx m s :
uniq s -> x \in mask m s = (x \in s) && nth false m (index x s).
Proof.
elim: s m => [|y s IHs] [|[] m]//= /andP[yNs ?]; rewrite ?in_cons ?IHs //=;
by have [->|neq_xy] //= := eqVneq; rewrite ?andbF // (negPf yNs).
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | in_mask | |
mask_uniqs : uniq s -> forall m, uniq (mask m s).
Proof.
elim: s => [|x s IHs] Uxs [|b m] //=.
case: b Uxs => //= /andP[s'x Us]; rewrite {}IHs // andbT.
by apply: contra s'x; apply: mem_mask.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mask_uniq | |
mem_mask_rotm s :
size m = size s -> mask (rot n0 m) (rot n0 s) =i mask m s.
Proof. by move=> Ems x; rewrite mask_rot // mem_rot. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mem_mask_rot | |
subseqs1 s2 :=
if s2 is y :: s2' then
if s1 is x :: s1' then subseq (if x == y then s1' else s1) s2' else true
else s1 == [::]. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | subseq | |
sub0seqs : subseq [::] s. Proof. by case: s. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | sub0seq | |
subseq0s : subseq s [::] = (s == [::]). Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | subseq0 | |
subseq_refls : subseq s s.
Proof. by elim: s => //= x s IHs; rewrite eqxx. Qed.
Hint Resolve subseq_refl : core. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | subseq_refl | |
subseqPs1 s2 :
reflect (exists2 m, size m = size s2 & s1 = mask m s2) (subseq s1 s2).
Proof.
elim: s2 s1 => [|y s2 IHs2] [|x s1].
- by left; exists [::].
- by right=> -[m /eqP/nilP->].
- by left; exists (nseq (size s2).+1 false); rewrite ?size_nseq //= mask_false.
apply: {IHs2}(iffP (IHs2 _)) => [] [m sz_m def_s1].
by exists ((x == y) :: m); rewrite /= ?sz_m // -def_s1; case: eqP => // ->.
case: eqP => [_ | ne_xy]; last first.
by case: m def_s1 sz_m => [|[] m] //; [case | move=> -> [<-]; exists m].
pose i := index true m; have def_m_i: take i m = nseq (size (take i m)) false.
apply/all_pred1P; apply/(all_nthP true) => j.
rewrite size_take ltnNge geq_min negb_or -ltnNge => /andP[lt_j_i _].
rewrite nth_take //= -negb_add addbF -addbT -negb_eqb.
by rewrite [_ == _](before_find _ lt_j_i).
have lt_i_m: i < size m.
rewrite ltnNge; apply/negP=> le_m_i; rewrite take_oversize // in def_m_i.
by rewrite def_m_i mask_false in def_s1.
rewrite size_take lt_i_m in def_m_i.
exists (take i m ++ drop i.+1 m).
rewrite size_cat size_take size_drop lt_i_m.
by rewrite sz_m in lt_i_m *; rewrite subnKC.
rewrite {s1 def_s1}[s1](congr1 behead def_s1).
rewrite -[s2](cat_take_drop i) -[m in LHS](cat_take_drop i) {}def_m_i -cat_cons.
have sz_i_s2: size (take i s2) = i by apply: size_takel; rewrite sz_m in lt_i_m.
rewrite lastI cat_rcons !mask_cat ?size_nseq ?size_belast ?mask_false //=.
by rewrite (drop_nth true) // nth_index -?index_mem.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | subseqP | |
mask_subseqm s : subseq (mask m s) s.
Proof. by apply/subseqP; have [m1] := resize_mask m s; exists m1. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mask_subseq | |
subseq_trans: transitive subseq.
Proof.
move=> _ _ s /subseqP[m2 _ ->] /subseqP[m1 _ ->].
elim: s => [|x s IHs] in m2 m1 *; first by rewrite !mask0.
case: m1 => [|[] m1]; first by rewrite mask0.
case: m2 => [|[] m2] //; first by rewrite /= eqxx IHs.
case/subseqP: (IHs m2 m1) => m sz_m def_s; apply/subseqP.
by exists (false :: m); rewrite //= sz_m.
case/subseqP: (IHs m2 m1) => m sz_m def_s; apply/subseqP.
by exists (false :: m); rewrite //= sz_m.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | subseq_trans | |
cat_subseqs1 s2 s3 s4 :
subseq s1 s3 -> subseq s2 s4 -> subseq (s1 ++ s2) (s3 ++ s4).
Proof.
case/subseqP=> m1 sz_m1 -> /subseqP [m2 sz_m2 ->]; apply/subseqP.
by exists (m1 ++ m2); rewrite ?size_cat ?mask_cat ?sz_m1 ?sz_m2.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | cat_subseq | |
prefix_subseqs1 s2 : subseq s1 (s1 ++ s2).
Proof. by rewrite -[s1 in subseq s1]cats0 cat_subseq ?sub0seq. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | prefix_subseq | |
suffix_subseqs1 s2 : subseq s2 (s1 ++ s2).
Proof. exact: cat_subseq (sub0seq s1) _. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | suffix_subseq | |
take_subseqs i : subseq (take i s) s.
Proof. by rewrite -[s in X in subseq _ X](cat_take_drop i) prefix_subseq. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | take_subseq | |
drop_subseqs i : subseq (drop i s) s.
Proof. by rewrite -[s in X in subseq _ X](cat_take_drop i) suffix_subseq. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | drop_subseq | |
mem_subseqs1 s2 : subseq s1 s2 -> {subset s1 <= s2}.
Proof. by case/subseqP=> m _ -> x; apply: mem_mask. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mem_subseq | |
sub1seqx s : subseq [:: x] s = (x \in s).
Proof. by elim: s => //= y s /[1!inE]; case: ifP; rewrite ?sub0seq. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | sub1seq | |
size_subseqs1 s2 : subseq s1 s2 -> size s1 <= size s2.
Proof. by case/subseqP=> m sz_m ->; rewrite size_mask -sz_m ?count_size. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_subseq | |
size_subseq_leqifs1 s2 :
subseq s1 s2 -> size s1 <= size s2 ?= iff (s1 == s2).
Proof.
move=> sub12; split; first exact: size_subseq.
apply/idP/eqP=> [|-> //]; case/subseqP: sub12 => m sz_m ->{s1}.
rewrite size_mask -sz_m // -all_count -(eq_all eqb_id).
by move/(@all_pred1P _ true)->; rewrite sz_m mask_true.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_subseq_leqif | |
subseq_anti: antisymmetric subseq.
Proof.
move=> s1 s2 /andP[] /size_subseq_leqif /leqifP.
by case: eqP => [//|_] + /size_subseq; rewrite ltnNge => /negP.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | subseq_anti | |
subseq_conss x : subseq s (x :: s).
Proof. exact: suffix_subseq [:: x] s. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | subseq_cons | |
cons_subseqs1 s2 x : subseq (x :: s1) s2 -> subseq s1 s2.
Proof. exact/subseq_trans/subseq_cons. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | cons_subseq | |
subseq_rconss x : subseq s (rcons s x).
Proof. by rewrite -cats1 prefix_subseq. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | subseq_rcons | |
subseq_uniqs1 s2 : subseq s1 s2 -> uniq s2 -> uniq s1.
Proof. by case/subseqP=> m _ -> Us2; apply: mask_uniq. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | subseq_uniq | |
take_uniqs n : uniq s -> uniq (take n s).
Proof. exact/subseq_uniq/take_subseq. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | take_uniq | |
drop_uniqs n : uniq s -> uniq (drop n s).
Proof. exact/subseq_uniq/drop_subseq. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | drop_uniq | |
undup_subseqs : subseq (undup s) s.
Proof.
elim: s => //= x s; case: (_ \in _); last by rewrite eqxx.
by case: (undup s) => //= y u; case: (_ == _) => //=; apply: cons_subseq.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | undup_subseq | |
subseq_revs1 s2 : subseq (rev s1) (rev s2) = subseq s1 s2.
Proof.
wlog suff W : s1 s2 / subseq s1 s2 -> subseq (rev s1) (rev s2).
by apply/idP/idP => /W //; rewrite !revK.
by case/subseqP => m size_m ->; rewrite rev_mask // mask_subseq.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | subseq_rev | |
subseq_cat2ls s1 s2 : subseq (s ++ s1) (s ++ s2) = subseq s1 s2.
Proof. by elim: s => // x s IHs; rewrite !cat_cons /= eqxx. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | subseq_cat2l | |
subseq_cat2rs s1 s2 : subseq (s1 ++ s) (s2 ++ s) = subseq s1 s2.
Proof. by rewrite -subseq_rev !rev_cat subseq_cat2l subseq_rev. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | subseq_cat2r | |
subseq_rotp s n :
subseq p s -> exists2 k, k <= n & subseq (rot k p) (rot n s).
Proof.
move=> /subseqP[m size_m ->].
exists (count id (take n m)); last by rewrite -mask_rot // mask_subseq.
by rewrite (leq_trans (count_size _ _))// size_take_min geq_minl.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | subseq_rot | |
rems := if s is y :: t then (if y == x then t else y :: rem t) else s. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rem | |
rem_consy s : rem (y :: s) = if y == x then s else y :: rem s.
Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rem_cons | |
remEs : rem s = take (index x s) s ++ drop (index x s).+1 s.
Proof. by elim: s => //= y s ->; case: eqVneq; rewrite ?drop0. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | remE | |
rem_ids : x \notin s -> rem s = s.
Proof. by elim: s => //= y s IHs /norP[neq_yx /IHs->]; case: eqVneq neq_yx. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rem_id | |
perm_to_rems : x \in s -> perm_eq s (x :: rem s).
Proof.
move=> xs; rewrite remE -[X in perm_eq X](cat_take_drop (index x s)).
by rewrite drop_index// -cat1s perm_catCA cat1s.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | perm_to_rem | |
size_rems : x \in s -> size (rem s) = (size s).-1.
Proof. by move/perm_to_rem/perm_size->. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_rem | |
rem_subseqs : subseq (rem s) s.
Proof.
elim: s => //= y s IHs; rewrite eq_sym.
by case: ifP => _; [apply: subseq_cons | rewrite eqxx].
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rem_subseq | |
rem_uniqs : uniq s -> uniq (rem s).
Proof. by apply: subseq_uniq; apply: rem_subseq. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rem_uniq | |
mem_rems : {subset rem s <= s}.
Proof. exact: mem_subseq (rem_subseq s). Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mem_rem | |
rem_memy s : y != x -> y \in s -> y \in rem s.
Proof.
move=> yx; elim: s => [//|z s IHs] /=.
rewrite inE => /orP[/eqP<-|ys]; first by rewrite (negbTE yx) inE eqxx.
by case: ifP => _ //; rewrite inE IHs ?orbT.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rem_mem | |
rem_filters : uniq s -> rem s = filter (predC1 x) s.
Proof.
elim: s => //= y s IHs /andP[not_s_y /IHs->].
by case: eqP => //= <-; apply/esym/all_filterP; rewrite all_predC has_pred1.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rem_filter | |
mem_rem_uniqs : uniq s -> rem s =i [predD1 s & x].
Proof. by move/rem_filter=> -> y; rewrite mem_filter. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mem_rem_uniq | |
mem_rem_uniqFs : uniq s -> x \in rem s = false.
Proof. by move/mem_rem_uniq->; rewrite inE eqxx. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | mem_rem_uniqF |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.