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 |
|---|---|---|---|---|---|---|---|---|---|---|
foldl_rcons z s x : foldl z (rcons s x) = f (foldl z s) x. | Proof. by rewrite -cats1 foldl_cat. Qed. | Lemma | foldl_rcons | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"cats1",
"foldl",
"foldl_cat",
"rcons"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
(fA : associative f) (fC : commutative f). | Hypotheses | fA | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | ||
foldl_foldr x0 l : foldl f x0 l = foldr f x0 l. | Proof.
elim: l x0 => [//|x1 l IHl] x0 /=; rewrite {}IHl.
by elim: l x0 x1 => [//|x2 l IHl] x0 x1 /=; rewrite IHl !fA [f x2 x1]fC.
Qed. | Lemma | foldl_foldr | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"fA",
"foldl",
"foldr"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pairmap x s | := if s is y :: s' then f x y :: pairmap y s' else [::]. | Fixpoint | pairmap | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
size_pairmap x s : size (pairmap x s) = size s. | Proof. by elim: s x => //= y s IHs x; rewrite IHs. Qed. | Lemma | size_pairmap | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"pairmap",
"size"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pairmap_cat x s1 s2 :
pairmap x (s1 ++ s2) = pairmap x s1 ++ pairmap (last x s1) s2. | Proof. by elim: s1 x => //= y s1 IHs1 x; rewrite IHs1. Qed. | Lemma | pairmap_cat | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"last",
"pairmap",
"s1",
"s2"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
nth_pairmap s n : n < size s ->
forall x, nth x2 (pairmap x s) n = f (nth x1 (x :: s) n) (nth x1 s n). | Proof. by elim: s n => [|y s IHs] [|n] //= Hn x; apply: IHs. Qed. | Lemma | nth_pairmap | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"nth",
"pairmap",
"size"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
scanl x s | :=
if s is y :: s' then let x' := g x y in x' :: scanl x' s' else [::]. | Fixpoint | scanl | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
size_scanl x s : size (scanl x s) = size s. | Proof. by elim: s x => //= y s IHs x; rewrite IHs. Qed. | Lemma | size_scanl | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"scanl",
"size"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
scanl_cat x s1 s2 :
scanl x (s1 ++ s2) = scanl x s1 ++ scanl (foldl g x s1) s2. | Proof. by elim: s1 x => //= y s1 IHs1 x; rewrite IHs1. Qed. | Lemma | scanl_cat | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"foldl",
"s1",
"s2",
"scanl"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
scanl_rcons x s1 y :
scanl x (rcons s1 y) = rcons (scanl x s1) (foldl g x (rcons s1 y)). | Proof. by rewrite -!cats1 scanl_cat foldl_cat. Qed. | Lemma | scanl_rcons | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"cats1",
"foldl",
"foldl_cat",
"rcons",
"s1",
"scanl",
"scanl_cat"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
nth_cons_scanl s n : n <= size s ->
forall x, nth x1 (x :: scanl x s) n = foldl g x (take n s). | Proof. by elim: s n => [|y s IHs] [|n] Hn x //=; rewrite IHs. Qed. | Lemma | nth_cons_scanl | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"foldl",
"nth",
"scanl",
"size",
"take"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
nth_scanl s n : n < size s ->
forall x, nth x1 (scanl x s) n = foldl g x (take n.+1 s). | Proof. by move=> n_lt x; rewrite -nth_cons_scanl. Qed. | Lemma | nth_scanl | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"foldl",
"nth",
"nth_cons_scanl",
"scanl",
"size",
"take"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
scanlK :
(forall x, cancel (g x) (f x)) -> forall x, cancel (scanl x) (pairmap x). | Proof. by move=> Hfg x s; elim: s x => //= y s IHs x; rewrite Hfg IHs. Qed. | Lemma | scanlK | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"pairmap",
"scanl"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
pairmapK :
(forall x, cancel (f x) (g x)) -> forall x, cancel (pairmap x) (scanl x). | Proof. by move=> Hgf x s; elim: s x => //= y s IHs x; rewrite Hgf IHs. Qed. | Lemma | pairmapK | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"pairmap",
"scanl"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
zip (s : seq S) (t : seq T) {struct t} | :=
match s, t with
| x :: s', y :: t' => (x, y) :: zip s' t'
| _, _ => [::]
end. | Fixpoint | zip | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"seq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
unzip1 | := map (@fst S T). | Definition | unzip1 | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"map"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
unzip2 | := map (@snd S T). | Definition | unzip2 | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"map"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
all2 s t | :=
match s, t with
| [::], [::] => true
| x :: s, y :: t => r x y && all2 s t
| _, _ => false
end. | Fixpoint | all2 | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
zip_unzip s : zip (unzip1 s) (unzip2 s) = s. | Proof. by elim: s => [|[x y] s /= ->]. Qed. | Lemma | zip_unzip | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"unzip1",
"unzip2",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
unzip1_zip s t : size s <= size t -> unzip1 (zip s t) = s. | Proof. by elim: s t => [|x s IHs] [|y t] //= le_s_t; rewrite IHs. Qed. | Lemma | unzip1_zip | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"size",
"unzip1",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
unzip2_zip s t : size t <= size s -> unzip2 (zip s t) = t. | Proof. by elim: s t => [|x s IHs] [|y t] //= le_t_s; rewrite IHs. Qed. | Lemma | unzip2_zip | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"size",
"unzip2",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
size1_zip s t : size s <= size t -> size (zip s t) = size s. | Proof. by elim: s t => [|x s IHs] [|y t] //= Hs; rewrite IHs. Qed. | Lemma | size1_zip | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"size",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
size2_zip s t : size t <= size s -> size (zip s t) = size t. | Proof. by elim: s t => [|x s IHs] [|y t] //= Hs; rewrite IHs. Qed. | Lemma | size2_zip | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"size",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
size_zip s t : size (zip s t) = minn (size s) (size t). | Proof. by elim: s t => [|x s IHs] [|t2 t] //=; rewrite IHs minnSS. Qed. | Lemma | size_zip | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"minn",
"minnSS",
"size",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
zip_cat s1 s2 t1 t2 :
size s1 = size t1 -> zip (s1 ++ s2) (t1 ++ t2) = zip s1 t1 ++ zip s2 t2. | Proof. by move: s1 t1; apply: seq_ind2 => //= x y s1 t1 _ ->. Qed. | Lemma | zip_cat | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"s1",
"s2",
"seq_ind2",
"size",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
nth_zip x y s t i :
size s = size t -> nth (x, y) (zip s t) i = (nth x s i, nth y t i). | Proof. by elim: i s t => [|i IHi] [|y1 s1] [|y2 t] //= [/IHi->]. Qed. | Lemma | nth_zip | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"nth",
"s1",
"size",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
nth_zip_cond p s t i :
nth p (zip s t) i
= (if i < size (zip s t) then (nth p.1 s i, nth p.2 t i) else p). | Proof.
rewrite size_zip ltnNge geq_min.
by elim: s t i => [|x s IHs] [|y t] [|i] //=; rewrite ?orbT -?IHs.
Qed. | Lemma | nth_zip_cond | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"geq_min",
"ltnNge",
"nth",
"size",
"size_zip",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
zip_rcons s t x y :
size s = size t -> zip (rcons s x) (rcons t y) = rcons (zip s t) (x, y). | Proof. by move=> eq_sz; rewrite -!cats1 zip_cat //= eq_sz. Qed. | Lemma | zip_rcons | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"cats1",
"rcons",
"size",
"zip",
"zip_cat"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
rev_zip s t : size s = size t -> rev (zip s t) = zip (rev s) (rev t). | Proof.
move: s t; apply: seq_ind2 => //= x y s t eq_sz IHs.
by rewrite !rev_cons IHs zip_rcons ?size_rev.
Qed. | Lemma | rev_zip | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"rev",
"rev_cons",
"seq_ind2",
"size",
"size_rev",
"zip",
"zip_rcons"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
all2E s t :
all2 s t = (size s == size t) && all [pred xy | r xy.1 xy.2] (zip s t). | Proof. by elim: s t => [|x s IHs] [|y t] //=; rewrite IHs andbCA. Qed. | Lemma | all2E | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"all",
"all2",
"size",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
zip_map I f g (s : seq I) :
zip (map f s) (map g s) = [seq (f i, g i) | i <- s]. | Proof. by elim: s => //= i s ->. Qed. | Lemma | zip_map | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"map",
"seq",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
unzip1_map_nth_zip x y s t l :
size s = size t ->
unzip1 [seq nth (x, y) (zip s t) i | i <- l] = [seq nth x s i | i <- l]. | Proof. by move=> st; elim: l => [//=|n l IH /=]; rewrite nth_zip ?IH ?st. Qed. | Lemma | unzip1_map_nth_zip | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"nth",
"nth_zip",
"seq",
"size",
"unzip1",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
unzip2_map_nth_zip x y s t l :
size s = size t ->
unzip2 [seq nth (x, y) (zip s t) i | i <- l] = [seq nth y t i | i <- l]. | Proof. by move=> st; elim: l => [//=|n l IH /=]; rewrite nth_zip ?IH ?st. Qed. | Lemma | unzip2_map_nth_zip | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"nth",
"nth_zip",
"seq",
"size",
"unzip2",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
zip_uniql (S T : eqType) (s : seq S) (t : seq T) :
uniq s -> uniq (zip s t). | Proof.
case: s t => [|s0 s] [|t0 t] //; apply: contraTT => /(uniqPn (s0, t0)) [i [j]].
case=> o z; rewrite !nth_zip_cond !ifT ?js ?(ltn_trans o)// => -[n _].
by apply/(uniqPn s0); exists i, j; rewrite o n (leq_trans z) ?size_zip?geq_minl.
Qed. | Lemma | zip_uniql | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"geq_minl",
"leq_trans",
"ltn_trans",
"nth_zip_cond",
"s0",
"seq",
"size_zip",
"uniq",
"uniqPn",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
zip_uniqr (S T : eqType) (s : seq S) (t : seq T) :
uniq t -> uniq (zip s t). | Proof.
case: s t => [|s0 s] [|t0 t] //; apply: contraTT => /(uniqPn (s0, t0)) [i [j]].
case=> o z; rewrite !nth_zip_cond !ifT ?js ?(ltn_trans o)// => -[_ n].
by apply/(uniqPn t0); exists i, j; rewrite o n (leq_trans z) ?size_zip?geq_minr.
Qed. | Lemma | zip_uniqr | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"geq_minr",
"leq_trans",
"ltn_trans",
"nth_zip_cond",
"s0",
"seq",
"size_zip",
"uniq",
"uniqPn",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
perm_zip_sym (S T : eqType) (s1 s2 : seq S) (t1 t2 : seq T) :
perm_eq (zip s1 t1) (zip s2 t2) -> perm_eq (zip t1 s1) (zip t2 s2). | Proof.
have swap t s : zip t s = map (fun u => (u.2, u.1)) (zip s t).
by elim: s t => [|x s +] [|y t]//= => ->.
by rewrite [zip t1 s1]swap [zip t2 s2]swap; apply: perm_map.
Qed. | Lemma | perm_zip_sym | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"map",
"perm_eq",
"perm_map",
"s1",
"s2",
"seq",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
perm_zip1 {S T : eqType} (t1 t2 : seq T) (s1 s2 : seq S):
size s1 = size t1 -> size s2 = size t2 ->
perm_eq (zip s1 t1) (zip s2 t2) -> perm_eq s1 s2. | Proof.
wlog [x y] : s1 s2 t1 t2 / (S * T)%type => [hwlog|].
case: s2 t2 => [|x s2] [|y t2] //; last exact: hwlog.
by case: s1 t1 => [|u s1] [|v t1]//= _ _ /perm_nilP.
move=> eq1 eq2 /(perm_iotaP (x, y))[ns nsP /(congr1 (@unzip1 _ _))].
rewrite unzip1_zip ?unzip1_map_nth_zip -?eq1// => ->.
by apply/(perm_iotaP x); e... | Lemma | perm_zip1 | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"last",
"minnn",
"perm_eq",
"perm_iotaP",
"perm_nilP",
"s1",
"s2",
"seq",
"size",
"size_zip",
"type",
"unzip1",
"unzip1_map_nth_zip",
"unzip1_zip",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
perm_zip2 {S T : eqType} (s1 s2 : seq S) (t1 t2 : seq T) :
size s1 = size t1 -> size s2 = size t2 ->
perm_eq (zip s1 t1) (zip s2 t2) -> perm_eq t1 t2. | Proof. by move=> ? ? ?; rewrite (@perm_zip1 _ _ s1 s2) 1?perm_zip_sym. Qed. | Lemma | perm_zip2 | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"perm_eq",
"perm_zip1",
"perm_zip_sym",
"s1",
"s2",
"seq",
"size",
"zip"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
eqseq_all (T : eqType) (s t : seq T) : (s == t) = all2 eq_op s t. | Proof. by elim: s t => [|x s +] [|y t]//= => <-. Qed. | Lemma | eqseq_all | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"all2",
"seq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
eq_map_all I (T : eqType) (f g : I -> T) (s : seq I) :
(map f s == map g s) = all [pred xy | xy.1 == xy.2] [seq (f i, g i) | i <- s]. | Proof. by rewrite eqseq_all all2E !size_map eqxx zip_map. Qed. | Lemma | eq_map_all | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"all",
"all2E",
"eqseq_all",
"eqxx",
"map",
"seq",
"size_map",
"zip_map"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
flatten | := foldr cat (Nil T). | Definition | flatten | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"Nil",
"cat",
"foldr"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
shape | := map (@size T). | Definition | shape | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"map",
"size"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
reshape sh s | :=
if sh is n :: sh' then take n s :: reshape sh' (drop n s) else [::]. | Fixpoint | reshape | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"drop",
"sh",
"take"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
flatten_index sh r c | := sumn (take r sh) + c. | Definition | flatten_index | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"sh",
"sumn",
"take"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
reshape_index sh i | := find (pred1 0) (scanl subn i.+1 sh). | Definition | reshape_index | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"find",
"pred1",
"scanl",
"sh",
"subn"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
reshape_offset sh i | := i - sumn (take (reshape_index sh i) sh). | Definition | reshape_offset | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"reshape_index",
"sh",
"sumn",
"take"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
size_flatten ss : size (flatten ss) = sumn (shape ss). | Proof. by elim: ss => //= s ss <-; rewrite size_cat. Qed. | Lemma | size_flatten | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"flatten",
"shape",
"size",
"size_cat",
"sumn"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
flatten_cat ss1 ss2 : flatten (ss1 ++ ss2) = flatten ss1 ++ flatten ss2. | Proof. by elim: ss1 => //= s ss1 ->; rewrite catA. Qed. | Lemma | flatten_cat | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"catA",
"flatten"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
size_reshape sh s : size (reshape sh s) = size sh. | Proof. by elim: sh s => //= s0 sh IHsh s; rewrite IHsh. Qed. | Lemma | size_reshape | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"reshape",
"s0",
"sh",
"size"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
nth_reshape (sh : seq nat) l n :
nth [::] (reshape sh l) n = take (nth 0 sh n) (drop (sumn (take n sh)) l). | Proof.
elim: n sh l => [| n IHn] [| sh0 sh] l; rewrite ?take0 ?drop0 //=.
by rewrite addnC -drop_drop; apply: IHn.
Qed. | Lemma | nth_reshape | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"addnC",
"apply",
"drop",
"drop0",
"drop_drop",
"nat",
"nth",
"reshape",
"seq",
"sh",
"sumn",
"take",
"take0"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
flattenK ss : reshape (shape ss) (flatten ss) = ss. | Proof.
by elim: ss => //= s ss IHss; rewrite take_size_cat ?drop_size_cat ?IHss.
Qed. | Lemma | flattenK | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"drop_size_cat",
"flatten",
"reshape",
"shape",
"take_size_cat"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
reshapeKr sh s : size s <= sumn sh -> flatten (reshape sh s) = s. | Proof.
elim: sh s => [[]|n sh IHsh] //= s sz_s; rewrite IHsh ?cat_take_drop //.
by rewrite size_drop leq_subLR.
Qed. | Lemma | reshapeKr | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"cat_take_drop",
"flatten",
"leq_subLR",
"reshape",
"sh",
"size",
"size_drop",
"sumn"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
reshapeKl sh s : size s >= sumn sh -> shape (reshape sh s) = sh. | Proof.
elim: sh s => [[]|n sh IHsh] //= s sz_s.
rewrite size_takel; first exact: leq_trans (leq_addr _ _) sz_s.
by rewrite IHsh // -(leq_add2l n) size_drop -maxnE leq_max sz_s orbT.
Qed. | Lemma | reshapeKl | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"leq_add2l",
"leq_addr",
"leq_max",
"leq_trans",
"maxnE",
"reshape",
"sh",
"shape",
"size",
"size_drop",
"size_takel",
"sumn"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
flatten_rcons ss s : flatten (rcons ss s) = flatten ss ++ s. | Proof. by rewrite -cats1 flatten_cat /= cats0. Qed. | Lemma | flatten_rcons | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"cats0",
"cats1",
"flatten",
"flatten_cat",
"rcons"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
flatten_seq1 s : flatten [seq [:: x] | x <- s] = s. | Proof. by elim: s => //= s0 s ->. Qed. | Lemma | flatten_seq1 | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"flatten",
"s0",
"seq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
count_flatten ss P :
count P (flatten ss) = sumn [seq count P x | x <- ss]. | Proof. by elim: ss => //= s ss IHss; rewrite count_cat IHss. Qed. | Lemma | count_flatten | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"count",
"count_cat",
"flatten",
"seq",
"sumn"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
filter_flatten ss (P : pred T) :
filter P (flatten ss) = flatten [seq filter P i | i <- ss]. | Proof. by elim: ss => // s ss /= <-; apply: filter_cat. Qed. | Lemma | filter_flatten | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"filter",
"filter_cat",
"flatten",
"seq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
rev_flatten ss :
rev (flatten ss) = flatten (rev (map rev ss)). | Proof.
by elim: ss => //= s ss IHss; rewrite rev_cons flatten_rcons -IHss rev_cat.
Qed. | Lemma | rev_flatten | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"flatten",
"flatten_rcons",
"map",
"rev",
"rev_cat",
"rev_cons"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
nth_shape ss i : nth 0 (shape ss) i = size (nth [::] ss i). | Proof.
rewrite /shape; case: (ltnP i (size ss)) => Hi; first exact: nth_map.
by rewrite !nth_default // size_map.
Qed. | Lemma | nth_shape | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"ltnP",
"nth",
"nth_default",
"nth_map",
"shape",
"size",
"size_map"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
shape_rev ss : shape (rev ss) = rev (shape ss). | Proof. exact: map_rev. Qed. | Lemma | shape_rev | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"map_rev",
"rev",
"shape"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
eq_from_flatten_shape ss1 ss2 :
flatten ss1 = flatten ss2 -> shape ss1 = shape ss2 -> ss1 = ss2. | Proof. by move=> Eflat Esh; rewrite -[LHS]flattenK Eflat Esh flattenK. Qed. | Lemma | eq_from_flatten_shape | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"flatten",
"flattenK",
"shape"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
rev_reshape sh s :
size s = sumn sh -> rev (reshape sh s) = map rev (reshape (rev sh) (rev s)). | Proof.
move=> sz_s; apply/(canLR revK)/eq_from_flatten_shape.
rewrite reshapeKr ?sz_s // -rev_flatten reshapeKr ?revK //.
by rewrite size_rev sumn_rev sz_s.
transitivity (rev (shape (reshape (rev sh) (rev s)))).
by rewrite !reshapeKl ?revK ?size_rev ?sz_s ?sumn_rev.
rewrite shape_rev; congr (rev _); rewrite -[RHS... | Lemma | rev_reshape | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"eq_from_flatten_shape",
"eq_map",
"map",
"map_comp",
"reshape",
"reshapeKl",
"reshapeKr",
"rev",
"revK",
"rev_flatten",
"sh",
"shape",
"shape_rev",
"size",
"size_rev",
"sumn",
"sumn_rev"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
reshape_rcons s sh n (m := sumn sh) :
m + n = size s ->
reshape (rcons sh n) s = rcons (reshape sh (take m s)) (drop m s). | Proof.
move=> Dmn; apply/(can_inj revK); rewrite rev_reshape ?rev_rcons ?sumn_rcons //.
rewrite /= take_rev drop_rev -Dmn addnK revK -rev_reshape //.
by rewrite size_takel // -Dmn leq_addr.
Qed. | Lemma | reshape_rcons | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"addnK",
"apply",
"drop",
"drop_rev",
"leq_addr",
"rcons",
"reshape",
"revK",
"rev_rcons",
"rev_reshape",
"sh",
"size",
"size_takel",
"sumn",
"sumn_rcons",
"take",
"take_rev"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
flatten_indexP sh r c :
c < nth 0 sh r -> flatten_index sh r c < sumn sh. | Proof.
move=> lt_c_sh; rewrite -[sh in sumn sh](cat_take_drop r) sumn_cat ltn_add2l.
suffices lt_r_sh: r < size sh by rewrite (drop_nth 0 lt_r_sh) ltn_addr.
by case: ltnP => // le_sh_r; rewrite nth_default in lt_c_sh.
Qed. | Lemma | flatten_indexP | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"cat_take_drop",
"drop_nth",
"flatten_index",
"ltnP",
"ltn_add2l",
"ltn_addr",
"nth",
"nth_default",
"sh",
"size",
"sumn",
"sumn_cat"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
reshape_indexP sh i : i < sumn sh -> reshape_index sh i < size sh. | Proof.
rewrite /reshape_index; elim: sh => //= n sh IHsh in i *; rewrite subn_eq0.
by have [// | le_n_i] := ltnP i n; rewrite -leq_subLR subSn // => /IHsh.
Qed. | Lemma | reshape_indexP | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"leq_subLR",
"ltnP",
"reshape_index",
"sh",
"size",
"subSn",
"subn_eq0",
"sumn"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
reshape_offsetP sh i :
i < sumn sh -> reshape_offset sh i < nth 0 sh (reshape_index sh i). | Proof.
rewrite /reshape_offset /reshape_index; elim: sh => //= n sh IHsh in i *.
rewrite subn_eq0; have [| le_n_i] := ltnP i n; first by rewrite subn0.
by rewrite -leq_subLR /= subnDA subSn // => /IHsh.
Qed. | Lemma | reshape_offsetP | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"leq_subLR",
"ltnP",
"nth",
"reshape_index",
"reshape_offset",
"sh",
"subSn",
"subn0",
"subnDA",
"subn_eq0",
"sumn"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
reshape_indexK sh i :
flatten_index sh (reshape_index sh i) (reshape_offset sh i) = i. | Proof.
rewrite /reshape_offset /reshape_index /flatten_index -subSKn.
elim: sh => //= n sh IHsh in i *; rewrite subn_eq0; have [//|le_n_i] := ltnP.
by rewrite /= subnDA subSn // -addnA IHsh subnKC.
Qed. | Lemma | reshape_indexK | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"addnA",
"flatten_index",
"ltnP",
"reshape_index",
"reshape_offset",
"sh",
"subSKn",
"subSn",
"subnDA",
"subnKC",
"subn_eq0"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
flatten_indexKl sh r c :
c < nth 0 sh r -> reshape_index sh (flatten_index sh r c) = r. | Proof.
rewrite /reshape_index /flatten_index.
elim: sh r => [|n sh IHsh] [|r] //= lt_c_sh; first by rewrite ifT.
by rewrite -addnA -addnS addKn IHsh.
Qed. | Lemma | flatten_indexKl | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"addKn",
"addnA",
"addnS",
"flatten_index",
"nth",
"reshape_index",
"sh"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
flatten_indexKr sh r c :
c < nth 0 sh r -> reshape_offset sh (flatten_index sh r c) = c. | Proof.
rewrite /reshape_offset /reshape_index /flatten_index.
elim: sh r => [|n sh IHsh] [|r] //= lt_c_sh; first by rewrite ifT ?subn0.
by rewrite -addnA -addnS addKn /= subnDl IHsh.
Qed. | Lemma | flatten_indexKr | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"addKn",
"addnA",
"addnS",
"flatten_index",
"nth",
"reshape_index",
"reshape_offset",
"sh",
"subn0",
"subnDl"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
nth_flatten x0 ss i (r := reshape_index (shape ss) i) :
nth x0 (flatten ss) i = nth x0 (nth [::] ss r) (reshape_offset (shape ss) i). | Proof.
rewrite /reshape_offset -subSKn {}/r /reshape_index.
elim: ss => //= s ss IHss in i *; rewrite subn_eq0 nth_cat.
by have [//|le_s_i] := ltnP; rewrite subnDA subSn /=.
Qed. | Lemma | nth_flatten | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"flatten",
"ltnP",
"nth",
"nth_cat",
"reshape_index",
"reshape_offset",
"shape",
"subSKn",
"subSn",
"subnDA",
"subn_eq0"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
reshape_leq sh i1 i2
(r1 := reshape_index sh i1) (c1 := reshape_offset sh i1)
(r2 := reshape_index sh i2) (c2 := reshape_offset sh i2) :
(i1 <= i2) = ((r1 < r2) || ((r1 == r2) && (c1 <= c2))). | Proof.
rewrite {}/r1 {}/c1 {}/r2 {}/c2 /reshape_offset /reshape_index.
elim: sh => [|s0 s IHs] /= in i1 i2 *; rewrite ?subn0 ?subn_eq0 //.
have [[] i1s0 [] i2s0] := (ltnP i1 s0, ltnP i2 s0); first by rewrite !subn0.
- by apply: leq_trans i2s0; apply/ltnW.
- by apply/negP => /(leq_trans i1s0); rewrite leqNgt i2s0.
by re... | Lemma | reshape_leq | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"c1",
"c2",
"eqSS",
"leqNgt",
"leq_subLR",
"leq_trans",
"ltnP",
"ltnS",
"ltnW",
"r1",
"r2",
"reshape_index",
"reshape_offset",
"s0",
"sh",
"subSn",
"subn0",
"subnDA",
"subnKC",
"subn_eq0"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
map_flatten S T (f : T -> S) ss :
map f (flatten ss) = flatten (map (map f) ss). | Proof. by elim: ss => // s ss /= <-; apply: map_cat. Qed. | Lemma | map_flatten | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"flatten",
"map",
"map_cat"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
flatten_map1 (S T : Type) (f : S -> T) s :
flatten [seq [:: f x] | x <- s] = map f s. | Proof. by elim: s => //= s0 s ->. Qed. | Lemma | flatten_map1 | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"flatten",
"map",
"s0",
"seq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
undup_flatten_nseq n (T : eqType) (s : seq T) : 0 < n ->
undup (flatten (nseq n s)) = undup s. | Proof.
elim: n => [|[|n]/= IHn]//= _; rewrite ?cats0// undup_cat {}IHn//.
rewrite (@eq_in_filter _ _ pred0) ?filter_pred0// => x.
by rewrite mem_undup mem_cat => ->.
Qed. | Lemma | undup_flatten_nseq | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"cats0",
"eq_in_filter",
"filter_pred0",
"flatten",
"mem_cat",
"mem_undup",
"nseq",
"seq",
"undup",
"undup_cat"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
sumn_flatten (ss : seq (seq nat)) :
sumn (flatten ss) = sumn (map sumn ss). | Proof. by elim: ss => // s ss /= <-; apply: sumn_cat. Qed. | Lemma | sumn_flatten | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"flatten",
"map",
"nat",
"seq",
"sumn",
"sumn_cat"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
map_reshape T S (f : T -> S) sh s :
map (map f) (reshape sh s) = reshape sh (map f s). | Proof. by elim: sh s => //= sh0 sh IHsh s; rewrite map_take IHsh map_drop. Qed. | Lemma | map_reshape | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"map",
"map_drop",
"map_take",
"reshape",
"sh"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
flattenP (A : seq (seq T)) x :
reflect (exists2 s, s \in A & x \in s) (x \in flatten A). | Proof.
elim: A => /= [|s A IH_A]; [by right; case | rewrite mem_cat].
by apply: equivP (iff_sym exists_cons); apply: (orPP idP IH_A).
Qed. | Lemma | flattenP | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"exists_cons",
"flatten",
"mem_cat",
"seq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
flatten_mapP (A : S -> seq T) s y :
reflect (exists2 x, x \in s & y \in A x) (y \in flatten (map A s)). | Proof.
apply: (iffP flattenP) => [[_ /mapP[x sx ->]] | [x sx]] Axy; first by exists x.
by exists (A x); rewrite ?map_f.
Qed. | Lemma | flatten_mapP | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"flatten",
"flattenP",
"map",
"mapP",
"map_f",
"seq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
perm_flatten (ss1 ss2 : seq (seq T)) :
perm_eq ss1 ss2 -> perm_eq (flatten ss1) (flatten ss2). | Proof.
move=> eq_ss; apply/permP=> a; apply/catCA_perm_subst: ss1 ss2 eq_ss.
by move=> ss1 ss2 ss3; rewrite !flatten_cat !count_cat addnCA.
Qed. | Lemma | perm_flatten | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"addnCA",
"apply",
"catCA_perm_subst",
"count_cat",
"flatten",
"flatten_cat",
"permP",
"perm_eq",
"seq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
"[ 'seq' E | x <- s , y <- t ]" | :=
(flatten [seq [seq E | y <- t] | x <- s])
(x binder, y binder,
format "[ '[hv' 'seq' E '/ ' | x <- s , '/ ' y <- t ] ']'")
: seq_scope. | Notation | [ 'seq' E | x <- s , y <- t ] | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"flatten",
"seq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
"[ 'seq' E : R | x <- s , y <- t ]" | :=
(flatten [seq [seq E : R | y <- t] | x <- s])
(x binder, y binder, only parsing) : seq_scope. | Notation | [ 'seq' E : R | x <- s , y <- t ] | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"flatten",
"seq"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prefix s1 s2 {struct s2} | :=
if s1 isn't x :: s1' then true else
if s2 isn't y :: s2' then false else
(x == y) && prefix s1' s2'. | Fixpoint | prefix | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"s1",
"s2"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prefixE s1 s2 : prefix s1 s2 = (take (size s1) s2 == s1). | Proof. by elim: s2 s1 => [|y s2 +] [|x s1]//= => ->; rewrite eq_sym. Qed. | Lemma | prefixE | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"eq_sym",
"prefix",
"s1",
"s2",
"size",
"take"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prefix_refl s : prefix s s. | Proof. by rewrite prefixE take_size. Qed. | Lemma | prefix_refl | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"prefix",
"prefixE",
"take_size"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prefixs0 s : prefix s [::] = (s == [::]). | Proof. by case: s. Qed. | Lemma | prefixs0 | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"prefix"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prefix0s s : prefix [::] s. | Proof. by case: s. Qed. | Lemma | prefix0s | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"prefix"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prefix_cons s1 s2 x y :
prefix (x :: s1) (y :: s2) = (x == y) && prefix s1 s2. | Proof. by []. Qed. | Lemma | prefix_cons | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"prefix",
"s1",
"s2"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prefix_catr s1 s2 s1' s3 : size s1 = size s1' ->
prefix (s1 ++ s2) (s1' ++ s3) = (s1 == s1') && prefix s2 s3. | Proof.
elim: s1 s1' => [|x s1 IHs1] [|y s1']//= [eqs1].
by rewrite IHs1// eqseq_cons andbA.
Qed. | Lemma | prefix_catr | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"eqseq_cons",
"prefix",
"s1",
"s2",
"s3",
"size"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prefix_prefix s1 s2 : prefix s1 (s1 ++ s2). | Proof. by rewrite prefixE take_cat ltnn subnn take0 cats0. Qed. | Lemma | prefix_prefix | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"cats0",
"ltnn",
"prefix",
"prefixE",
"s1",
"s2",
"subnn",
"take0",
"take_cat"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prefixP {s1 s2} :
reflect (exists s2' : seq T, s2 = s1 ++ s2') (prefix s1 s2). | Proof.
apply: (iffP idP) => [|[{}s2 ->]]; last exact: prefix_prefix.
by rewrite prefixE => /eqP<-; exists (drop (size s1) s2); rewrite cat_take_drop.
Qed. | Lemma | prefixP | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"apply",
"cat_take_drop",
"drop",
"last",
"prefix",
"prefixE",
"prefix_prefix",
"s1",
"s2",
"seq",
"size"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prefix_trans : transitive prefix. | Proof. by move=> _ s2 _ /prefixP[s1 ->] /prefixP[s3 ->]; rewrite -catA. Qed. | Lemma | prefix_trans | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"catA",
"prefix",
"prefixP",
"s1",
"s2",
"s3"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prefixs1 s x : prefix s [:: x] = (s == [::]) || (s == [:: x]). | Proof. by case: s => //= y s; rewrite prefixs0 eqseq_cons. Qed. | Lemma | prefixs1 | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"eqseq_cons",
"prefix",
"prefixs0"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
catl_prefix s1 s2 s3 : prefix (s1 ++ s3) s2 -> prefix s1 s2. | Proof. by move=> /prefixP [s2'] ->; rewrite -catA. Qed. | Lemma | catl_prefix | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"catA",
"prefix",
"prefixP",
"s1",
"s2",
"s3"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prefix_catl s1 s2 s3 : prefix s1 s2 -> prefix s1 (s2 ++ s3). | Proof. by move=> /prefixP [s2'] ->; rewrite -catA. Qed. | Lemma | prefix_catl | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"catA",
"prefix",
"prefixP",
"s1",
"s2",
"s3"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
prefix_rcons s x : prefix s (rcons s x). | Proof. by rewrite -cats1 prefix_prefix. Qed. | Lemma | prefix_rcons | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"cats1",
"prefix",
"prefix_prefix",
"rcons"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
suffix s1 s2 | := prefix (rev s1) (rev s2). | Definition | suffix | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"prefix",
"rev",
"s1",
"s2"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
suffixE s1 s2 : suffix s1 s2 = (drop (size s2 - size s1) s2 == s1). | Proof. by rewrite /suffix prefixE take_rev (can_eq revK) size_rev. Qed. | Lemma | suffixE | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"can_eq",
"drop",
"prefixE",
"revK",
"s1",
"s2",
"size",
"size_rev",
"suffix",
"take_rev"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
suffix_refl s : suffix s s. | Proof. exact: prefix_refl. Qed. | Lemma | suffix_refl | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"prefix_refl",
"suffix"
] | https://github.com/math-comp/math-comp | 91d97df9cf3204b4dab84f4e24bc633e84b6473d | |
suffixs0 s : suffix s [::] = (s == [::]). | Proof. by rewrite /suffix prefixs0 -!nilpE rev_nilp. Qed. | Lemma | suffixs0 | boot | boot/seq.v | [
"HB",
"structures",
"mathcomp",
"ssreflect",
"ssrfun",
"ssrbool",
"eqtype",
"ssrnat"
] | [
"nilpE",
"prefixs0",
"rev_nilp",
"suffix"
] | 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.