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
rev_nilps : nilp (rev s) = nilp s. Proof. by rewrite /nilp size_rev. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
rev_nilp
rev_cats t : rev (s ++ t) = rev t ++ rev s. Proof. by rewrite -catrev_catr -catrev_catl. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
rev_cat
rev_rconss x : rev (rcons s x) = x :: rev s. Proof. by rewrite -cats1 rev_cat. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
rev_rcons
revK: involutive rev. Proof. by elim=> //= x s IHs; rewrite rev_cons rev_rcons IHs. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
revK
nth_revn s : n < size s -> nth (rev s) n = nth s (size s - n.+1). Proof. elim/last_ind: s => // s x IHs in n *. rewrite rev_rcons size_rcons ltnS subSS -cats1 nth_cat /=. case: n => [|n] lt_n_s; first by rewrite subn0 ltnn subnn. by rewrite subnSK //= leq_subr IHs. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
nth_rev
filter_reva s : filter a (rev s) = rev (filter a s). Proof. by elim: s => //= x s IH; rewrite fun_if !rev_cons filter_rcons IH. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
filter_rev
count_reva s : count a (rev s) = count a s. Proof. by rewrite -!size_filter filter_rev size_rev. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
count_rev
has_reva s : has a (rev s) = has a s. Proof. by rewrite !has_count count_rev. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
has_rev
all_reva s : all a (rev s) = all a s. Proof. by rewrite !all_count count_rev size_rev. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
all_rev
rev_nseqn x : rev (nseq n x) = nseq n x. Proof. by elim: n => // n IHn; rewrite -[in LHS]addn1 nseqD rev_cat IHn. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
rev_nseq
count_memx := (count (pred_of_simpl (pred1 x))). Infix "++" := cat : seq_scope.
Notation
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
count_mem
seq_ind2{S T} (P : seq S -> seq T -> Type) : P [::] [::] -> (forall x y s t, size s = size t -> P s t -> P (x :: s) (y :: t)) -> forall s t, size s = size t -> P s t. Proof. by move=> Pnil Pcons; elim=> [|x s IHs] [|y t] //= [eq_sz]; apply/Pcons/IHs. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
seq_ind2
all_iff_and(P Q : Prop) : Prop := AllIffConj of P & Q.
Inductive
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
all_iff_and
all_iff(P0 : Prop) (Ps : seq Prop) : Prop := let fix loop (P : Prop) (Qs : seq Prop) : Prop := if Qs is Q :: Qs then all_iff_and (P -> Q) (loop Q Qs) else P -> P0 in loop P0 Ps.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
all_iff
all_iffLRP0 Ps : all_iff P0 Ps -> forall m n, nth P0 (P0 :: Ps) m -> nth P0 (P0 :: Ps) n. Proof. move=> iffPs; have PsS n: nth P0 Ps n -> nth P0 Ps n.+1. elim: n P0 Ps iffPs => [|n IHn] P0 [|P [|Q Ps]] //= [iP0P] //; first by case. by rewrite nth_nil. by case=> iPQ iffPs; apply: IHn; split=> // /iP0P. have{PsS} lePs: {homo nth P0 Ps : m n / m <= n >-> (m -> n)}. by move=> m n /subnK<-; elim: {n}(n - m) => // n IHn /IHn; apply: PsS. move=> m n P_m; have{m P_m} hP0: P0. case: m P_m => //= m /(lePs m _ (leq_maxl m (size Ps))). by rewrite nth_default ?leq_maxr. case: n =>// n; apply: lePs 0 n (leq0n n) _. by case: Ps iffPs hP0 => // P Ps []. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
all_iffLR
all_iffPP0 Ps : all_iff P0 Ps -> forall m n, nth P0 (P0 :: Ps) m <-> nth P0 (P0 :: Ps) n. Proof. by move=> /all_iffLR-iffPs m n; split => /iffPs. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
all_iffP
all_iffP: all_iff >-> Funclass.
Coercion
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
all_iffP
tfae:= do !apply: AllIffConj.
Ltac
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
tfae
find_spec: bool -> nat -> Type := | NotFound of ~~ has a s : find_spec false (size s) | Found (i : nat) of i < size s & (forall x0, a (nth x0 s i)) & (forall x0 j, j < i -> a (nth x0 s j) = false) : find_spec true i.
Variant
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
find_spec
findP: find_spec (has a s) (find a s). Proof. have [a_s|aNs] := boolP (has a s); last by rewrite hasNfind//; constructor. by constructor=> [|x0|x0]; rewrite -?has_find ?nth_find//; apply: before_find. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
findP
rot1_consx s : rot 1 (x :: s) = rcons s x. Proof. by rewrite /rot /= take0 drop0 -cats1. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
rot1_cons
rcons_injs1 s2 x1 x2 : rcons s1 x1 = rcons s2 x2 :> seq T -> (s1, x1) = (s2, x2). Proof. by rewrite -!rot1_cons => /rot_inj[-> ->]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
rcons_inj
rcons_injlx : injective (rcons^~ x). Proof. by move=> s1 s2 /rcons_inj[]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
rcons_injl
rcons_injrs : injective (rcons s). Proof. by move=> x1 x2 /rcons_inj[]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
rcons_injr
eqseqs1 s2 {struct s2} := match s1, s2 with | [::], [::] => true | x1 :: s1', x2 :: s2' => (x1 == x2) && eqseq s1' s2' | _, _ => false end.
Fixpoint
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
eqseq
eqseqP: Equality.axiom eqseq. Proof. move; elim=> [|x1 s1 IHs] [|x2 s2]; do [by constructor | simpl]. have [<-|neqx] := x1 =P x2; last by right; case. by apply: (iffP (IHs s2)) => [<-|[]]. Qed. HB.instance Definition _ := hasDecEq.Build (seq T) eqseqP.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
eqseqP
eqseqE: eqseq = eq_op. Proof. by []. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
eqseqE
eqseq_consx1 x2 s1 s2 : (x1 :: s1 == x2 :: s2) = (x1 == x2) && (s1 == s2). Proof. by []. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
eqseq_cons
eqseq_cats1 s2 s3 s4 : size s1 = size s2 -> (s1 ++ s3 == s2 ++ s4) = (s1 == s2) && (s3 == s4). Proof. elim: s1 s2 => [|x1 s1 IHs] [|x2 s2] //= [sz12]. by rewrite !eqseq_cons -andbA IHs. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
eqseq_cat
eqseq_rconss1 s2 x1 x2 : (rcons s1 x1 == rcons s2 x2) = (s1 == s2) && (x1 == x2). Proof. by rewrite -(can_eq revK) !rev_rcons eqseq_cons andbC (can_eq revK). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
eqseq_rcons
size_eq0s : (size s == 0) = (s == [::]). Proof. exact: (sameP nilP eqP). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
size_eq0
nilpEs : nilp s = (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
nilpE
has_filtera s : has a s = (filter a s != [::]). Proof. by rewrite -size_eq0 size_filter has_count lt0n. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
has_filter
mem_seq(s : seq T) := if s is y :: s' then xpredU1 y (mem_seq s') else xpred0.
Fixpoint
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_seq
seq_eqclass:= seq T. Identity Coercion seq_of_eqclass : seq_eqclass >-> seq.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
seq_eqclass
pred_of_seq(s : seq_eqclass) : {pred T} := mem_seq s.
Coercion
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
pred_of_seq
seq_predType:= PredType (pred_of_seq : seq T -> pred T).
Canonical
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
seq_predType
mem_seq_predType:= PredType mem_seq.
Canonical
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_seq_predType
in_consy s x : (x \in y :: s) = (x == y) || (x \in s). Proof. by []. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
in_cons
in_nilx : (x \in [::]) = false. Proof. by []. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
in_nil
mem_seq1x y : (x \in [:: y]) = (x == y). Proof. by rewrite in_cons orbF. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_seq1
forall_cons{P : T -> Prop} {a s} : {in a::s, forall x, P x} <-> P a /\ {in s, forall x, P x}. Proof. split=> [A|[A B]]; last by move => x /predU1P [-> //|]; apply: B. by split=> [|b Hb]; apply: A; rewrite !inE ?eqxx ?Hb ?orbT. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
forall_cons
exists_cons{P : T -> Prop} {a s} : (exists2 x, x \in a::s & P x) <-> P a \/ exists2 x, x \in s & P x. Proof. split=> [[x /predU1P[->|x_s] Px]|]; [by left| by right; exists x|]. by move=> [?|[x x_s ?]]; [exists a|exists x]; rewrite ?inE ?eqxx ?x_s ?orbT. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
exists_cons
mem_seq2x y z : (x \in [:: y; z]) = xpred2 y z x. Proof. by rewrite !inE. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_seq2
mem_seq3x y z t : (x \in [:: y; z; t]) = xpred3 y z t x. Proof. by rewrite !inE. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_seq3
mem_seq4x y z t u : (x \in [:: y; z; t; u]) = xpred4 y z t u x. Proof. by rewrite !inE. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_seq4
mem_catx s1 s2 : (x \in s1 ++ s2) = (x \in s1) || (x \in s2). Proof. by elim: s1 => //= y s1 IHs; rewrite !inE /= -orbA -IHs. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_cat
mem_rconss y : rcons s y =i y :: s. Proof. by move=> x; rewrite -cats1 /= mem_cat mem_seq1 orbC in_cons. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_rcons
mem_headx s : x \in x :: s. Proof. exact: predU1l. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_head
mem_lastx s : last x s \in x :: s. Proof. by rewrite lastI mem_rcons mem_head. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_last
mem_beheads : {subset behead s <= s}. Proof. by case: s => // y s x; apply: predU1r. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_behead
mem_belasts y : {subset belast y s <= y :: s}. Proof. by move=> x ys'x; rewrite lastI mem_rcons mem_behead. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_belast
mem_nths n : n < size s -> nth s n \in s. Proof. by elim: s n => // x s IHs [_|n sz_s]; rewrite ?mem_head // mem_behead ?IHs. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_nth
mem_takes x : x \in take n0 s -> x \in s. Proof. by move=> s0x; rewrite -(cat_take_drop n0 s) mem_cat /= s0x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_take
mem_drops x : x \in drop n0 s -> x \in s. Proof. by move=> s0'x; rewrite -(cat_take_drop n0 s) mem_cat /= s0'x orbT. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_drop
last_eqs z x y : x != y -> z != y -> (last x s == y) = (last z s == y). Proof. by move=> /negPf xz /negPf yz; case: s => [|t s]//; rewrite xz yz. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
last_eq
hasP{a s} : reflect (exists2 x, x \in s & a x) (has a s). Proof. elim: s => [|y s IHs] /=; first by right; case. exact: equivP (orPP idP IHs) (iff_sym exists_cons). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
hasP
allP{a s} : reflect {in s, forall x, a x} (all a s). Proof. elim: s => [|/= y s IHs]; first by left. exact: equivP (andPP idP IHs) (iff_sym forall_cons). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
allP
hasPna s : reflect {in s, forall x, ~~ a x} (~~ has a s). Proof. by rewrite -all_predC; apply: allP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
hasPn
allPna s : reflect (exists2 x, x \in s & ~~ a x) (~~ all a s). Proof. by rewrite -has_predC; apply: hasP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
allPn
allsss : all [in s] s. Proof. exact/allP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
allss
mem_filtera x s : (x \in filter a s) = a x && (x \in s). Proof. rewrite andbC; elim: s => //= y s IHs. rewrite (fun_if (fun s' : seq T => x \in s')) !in_cons {}IHs. by case: eqP => [->|_]; case (a y); rewrite /= ?andbF. Qed. Variables (a : pred T) (s : seq T) (A : T -> Prop). Hypothesis aP : forall x, reflect (A x) (a x).
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_filter
hasPP: reflect (exists2 x, x \in s & A x) (has a s). Proof. by apply: (iffP hasP) => -[x ? /aP]; exists x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
hasPP
allPP: reflect {in s, forall x, A x} (all a s). Proof. by apply: (iffP allP) => a_s x /a_s/aP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
allPP
eq_in_filters : {in s, a1 =1 a2} -> filter a1 s = filter a2 s. Proof. by elim: s => //= x s IHs /forall_cons [-> /IHs ->]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
eq_in_filter
eq_in_finds : {in s, a1 =1 a2} -> find a1 s = find a2 s. Proof. by elim: s => //= x s IHs /forall_cons [-> /IHs ->]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
eq_in_find
eq_in_counts : {in s, a1 =1 a2} -> count a1 s = count a2 s. Proof. by move/eq_in_filter=> eq_a12; rewrite -!size_filter eq_a12. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
eq_in_count
eq_in_alls : {in s, a1 =1 a2} -> all a1 s = all a2 s. Proof. by move=> eq_a12; rewrite !all_count eq_in_count. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
eq_in_all
eq_in_hass : {in s, a1 =1 a2} -> has a1 s = has a2 s. Proof. by move/eq_in_filter=> eq_a12; rewrite !has_filter eq_a12. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
eq_in_has
eq_has_rs1 s2 : s1 =i s2 -> has^~ s1 =1 has^~ s2. Proof. by move=> Es a; apply/hasP/hasP=> -[x sx ax]; exists x; rewrite ?Es in sx *. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
eq_has_r
eq_all_rs1 s2 : s1 =i s2 -> all^~ s1 =1 all^~ s2. Proof. by move=> Es a; apply/negb_inj; rewrite -!has_predC (eq_has_r Es). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
eq_all_r
has_syms1 s2 : has [in s1] s2 = has [in s2] s1. Proof. by apply/hasP/hasP=> -[x]; exists x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
has_sym
has_pred1x s : has (pred1 x) s = (x \in s). Proof. by rewrite -(eq_has (mem_seq1^~ x)) (has_sym [:: x]) /= orbF. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
has_pred1
mem_revs : rev s =i s. Proof. by move=> a; rewrite -!has_pred1 has_rev. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_rev
constants := if s is x :: s' then all (pred1 x) s' else true.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
constant
all_pred1Px s : reflect (s = nseq (size s) x) (all (pred1 x) s). Proof. elim: s => [|y s IHs] /=; first by left. case: eqP => [->{y} | ne_xy]; last by right=> [] [? _]; case ne_xy. by apply: (iffP IHs) => [<- //| []]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
all_pred1P
all_pred1_constantx s : all (pred1 x) s -> constant s. Proof. by case: s => //= y s /andP[/eqP->]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
all_pred1_constant
all_pred1_nseqx n : all (pred1 x) (nseq n x). Proof. by rewrite all_nseq /= eqxx orbT. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
all_pred1_nseq
mem_nseqn x y : (y \in nseq n x) = (0 < n) && (y == x). Proof. by rewrite -has_pred1 has_nseq eq_sym. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_nseq
nseqPn x y : reflect (y = x /\ n > 0) (y \in nseq n x). Proof. by rewrite mem_nseq andbC; apply: (iffP andP) => -[/eqP]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
nseqP
constant_nseqn x : constant (nseq n x). Proof. exact: all_pred1_constant (all_pred1_nseq x n). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
constant_nseq
constantPs : reflect (exists x, s = nseq (size s) x) (constant s). Proof. apply: (iffP idP) => [| [x ->]]; last exact: constant_nseq. case: s => [|x s] /=; first by exists x0. by move/all_pred1P=> def_s; exists x; rewrite -def_s. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
constantP
uniqs := if s is x :: s' then (x \notin s') && uniq s' else true.
Fixpoint
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
uniq
cons_uniqx s : uniq (x :: s) = (x \notin s) && uniq s. Proof. by []. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
cons_uniq
cat_uniqs1 s2 : uniq (s1 ++ s2) = [&& uniq s1, ~~ has [in s1] s2 & uniq s2]. Proof. elim: s1 => [|x s1 IHs]; first by rewrite /= has_pred0. by rewrite has_sym /= mem_cat !negb_or has_sym IHs -!andbA; do !bool_congr. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
cat_uniq
uniq_catCs1 s2 : uniq (s1 ++ s2) = uniq (s2 ++ s1). Proof. by rewrite !cat_uniq has_sym andbCA andbA andbC. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
uniq_catC
uniq_catCAs1 s2 s3 : uniq (s1 ++ s2 ++ s3) = uniq (s2 ++ s1 ++ s3). Proof. by rewrite !catA -!(uniq_catC s3) !(cat_uniq s3) uniq_catC !has_cat orbC. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
uniq_catCA
rcons_uniqs x : uniq (rcons s x) = (x \notin s) && uniq s. Proof. by rewrite -cats1 uniq_catC. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
rcons_uniq
filter_uniqs a : uniq s -> uniq (filter a s). Proof. elim: s => //= x s IHs /andP[s'x]; case: ifP => //= a_x /IHs->. by rewrite mem_filter a_x s'x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
filter_uniq
rot_uniqs : uniq (rot n0 s) = uniq s. Proof. by rewrite /rot uniq_catC cat_take_drop. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
rot_uniq
rev_uniqs : uniq (rev s) = uniq s. Proof. elim: s => // x s IHs. by rewrite rev_cons -cats1 cat_uniq /= andbT andbC mem_rev orbF IHs. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
rev_uniq
count_memPnx s : reflect (count_mem x s = 0) (x \notin s). Proof. by rewrite -has_pred1 has_count -eqn0Ngt; apply: eqP. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
count_memPn
count_uniq_mems x : uniq s -> count_mem x s = (x \in s). Proof. elim: s => //= y s IHs /andP[/negbTE s'y /IHs-> {IHs}]. by rewrite in_cons; case: (eqVneq y x) => // <-; rewrite s'y. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
count_uniq_mem
leq_uniq_countPx s1 s2 : uniq s1 -> reflect (x \in s1 -> x \in s2) (count_mem x s1 <= count_mem x s2). Proof. move/count_uniq_mem->; case: (boolP (_ \in _)) => //= _; last by constructor. by rewrite -has_pred1 has_count; apply: (iffP idP) => //; apply. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
leq_uniq_countP
leq_uniq_counts1 s2 : uniq s1 -> {subset s1 <= s2} -> (forall x, count_mem x s1 <= count_mem x s2). Proof. by move=> s1_uniq s1_s2 x; apply/leq_uniq_countP/s1_s2. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
leq_uniq_count
filter_pred1_uniqs x : uniq s -> x \in s -> filter (pred1 x) s = [:: x]. Proof. move=> uniq_s s_x; rewrite (all_pred1P _ _ (filter_all _ _)). by rewrite size_filter count_uniq_mem ?s_x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
filter_pred1_uniq
undups := if s is x :: s' then if x \in s' then undup s' else x :: undup s' else [::].
Fixpoint
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
undup
size_undups : size (undup s) <= size s. Proof. by elim: s => //= x s IHs; case: (x \in s) => //=; apply: ltnW. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
size_undup
mem_undups : undup s =i s. Proof. move=> x; elim: s => //= y s IHs. by case s_y: (y \in s); rewrite !inE IHs //; case: eqP => [->|]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_undup
undup_uniqs : uniq (undup s). Proof. by elim: s => //= x s IHs; case s_x: (x \in s); rewrite //= mem_undup s_x. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
undup_uniq