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 |
|---|---|---|---|---|---|---|
divisors_idn : 0 < n -> n \in divisors n.
Proof. by move/dvdn_divisors <-. Qed. | Lemma | boot | [
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import choice fintype div bigop"
] | boot/prime.v | divisors_id | |
dvdn_sumd I r (K : pred I) F :
(forall i, K i -> d %| F i) -> d %| \sum_(i <- r | K i) F i.
Proof. by move=> dF; elim/big_ind: _ => //; apply: dvdn_add. Qed. | Lemma | boot | [
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import choice fintype div bigop"
] | boot/prime.v | dvdn_sum | |
dvdn_partPn m : 0 < n ->
reflect (forall p, p \in \pi(n) -> n`_p %| m) (n %| m).
Proof.
move=> n_gt0; apply: (iffP idP) => n_dvd_m => [p _|].
by apply: dvdn_trans n_dvd_m; apply: dvdn_part.
have [-> // | m_gt0] := posnP m.
rewrite -(partnT n_gt0) -(partnT m_gt0).
rewrite !(@widen_partn (m + n)) ?leq_addl ?leq_addr // /in_mem /=.
elim/big_ind2: _ => // [* | q _]; first exact: dvdn_mul.
have [-> // | ] := posnP (logn q n); rewrite logn_gt0 => q_n.
have pr_q: prime q by move: q_n; rewrite mem_primes; case/andP.
by have:= n_dvd_m q q_n; rewrite p_part !pfactor_dvdn // pfactorK.
Qed. | Lemma | boot | [
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import choice fintype div bigop"
] | boot/prime.v | dvdn_partP | |
modn_partPn a b : 0 < n ->
reflect (forall p : nat, p \in \pi(n) -> a = b %[mod n`_p]) (a == b %[mod n]).
Proof.
move=> n_gt0; wlog le_b_a: a b / b <= a.
move=> IH; case: (leqP b a) => [|/ltnW] /IH {IH}// IH.
by rewrite eq_sym; apply: (iffP IH) => eqab p /eqab.
rewrite eqn_mod_dvd //; apply: (iffP (dvdn_partP _ n_gt0)) => eqab p /eqab;
by rewrite -eqn_mod_dvd // => /eqP.
Qed. | Lemma | boot | [
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import choice fintype div bigop"
] | boot/prime.v | modn_partP | |
totientEn :
n > 0 -> totient n = \prod_(p <- primes n) (p.-1 * p ^ (logn p n).-1).
Proof.
move=> n_gt0; rewrite /totient n_gt0 prime_decompE unlock.
by elim: (primes n) => //= [p pr ->]; rewrite !natTrecE.
Qed. | Lemma | boot | [
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import choice fintype div bigop"
] | boot/prime.v | totientE | |
totient_gt0n : (0 < totient n) = (0 < n).
Proof.
case: n => // n; rewrite totientE // big_seq_cond prodn_cond_gt0 // => p.
by rewrite mem_primes muln_gt0 expn_gt0; case: p => [|[|]].
Qed. | Lemma | boot | [
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import choice fintype div bigop"
] | boot/prime.v | totient_gt0 | |
totient_pfactorp e :
prime p -> e > 0 -> totient (p ^ e) = p.-1 * p ^ e.-1.
Proof.
move=> p_pr e_gt0; rewrite totientE ?expn_gt0 ?prime_gt0 //.
by rewrite primesX // primes_prime // unlock /= muln1 pfactorK.
Qed. | Lemma | boot | [
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import choice fintype div bigop"
] | boot/prime.v | totient_pfactor | |
totient_primep : prime p -> totient p = p.-1.
Proof. by move=> p_prime; rewrite -{1}[p]expn1 totient_pfactor // muln1. Qed. | Lemma | boot | [
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import choice fintype div bigop"
] | boot/prime.v | totient_prime | |
totient_coprimem n :
coprime m n -> totient (m * n) = totient m * totient n.
Proof.
move=> co_mn; have [-> //| m_gt0] := posnP m.
have [->|n_gt0] := posnP n; first by rewrite !muln0.
rewrite !totientE ?muln_gt0 ?m_gt0 //.
have /(perm_big _)->: perm_eq (primes (m * n)) (primes m ++ primes n).
apply: uniq_perm => [||p]; first exact: primes_uniq.
by rewrite cat_uniq !primes_uniq -coprime_has_primes // co_mn.
by rewrite mem_cat primesM.
rewrite big_cat /= !big_seq.
congr (_ * _); apply: eq_bigr => p; rewrite mem_primes => /and3P[_ _ dvp].
rewrite (mulnC m) logn_Gauss //; move: co_mn.
by rewrite -(divnK dvp) coprimeMl => /andP[].
rewrite logn_Gauss //; move: co_mn.
by rewrite coprime_sym -(divnK dvp) coprimeMl => /andP[].
Qed. | Lemma | boot | [
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import choice fintype div bigop"
] | boot/prime.v | totient_coprime | |
totient_count_coprimen : totient n = \sum_(0 <= d < n) coprime n d.
Proof.
elim/ltn_ind: n => // n IHn.
case: (leqP n 1) => [|lt1n]; first by rewrite unlock; case: (n) => [|[]].
pose p := pdiv n; have p_pr: prime p by apply: pdiv_prime.
have p1 := prime_gt1 p_pr; have p0 := ltnW p1.
pose np := n`_p; pose np' := n`_p^'.
have co_npp': coprime np np' by rewrite coprime_partC.
have [n0 np0 np'0]: [/\ n > 0, np > 0 & np' > 0] by rewrite ltnW ?part_gt0.
have def_n: n = np * np' by rewrite partnC.
have lnp0: 0 < logn p n by rewrite lognE p_pr n0 pdiv_dvd.
pose in_mod k (k0 : k > 0) d := Ordinal (ltn_pmod d k0).
rewrite {1}def_n totient_coprime // {IHn}(IHn np') ?big_mkord; last first.
by rewrite def_n ltn_Pmull // /np p_part -(expn0 p) ltn_exp2l.
have ->: totient np = #|[pred d : 'I_np | coprime np d]|.
rewrite [np in LHS]p_part totient_pfactor //=; set q := p ^ _.
apply: (@addnI (1 * q)); rewrite -mulnDl [1 + _]prednK // mul1n.
have def_np: np = p * q by rewrite -expnS prednK // -p_part.
pose mulp := [fun d : 'I_q => in_mod _ np0 (p * d)].
rewrite -def_np -{1}[np]card_ord -(cardC [in codom mulp]).
rewrite card_in_image => [|[d1 ltd1] [d2 ltd2] /= _ _ []]; last first.
move/eqP; rewrite def_np -!muln_modr ?modn_small //.
by rewrite eqn_pmul2l // => eq_op12; apply/eqP.
rewrite card_ord; congr (q + _); apply: eq_card => d /=.
rewrite !inE [np in coprime np _]p_part coprime_pexpl ?prime_coprime //.
congr (~~ _); apply/codomP/idP=> [[d' -> /=] | /dvdnP[r def_d]].
by rewrite de
... | Lemma | boot | [
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import choice fintype div bigop"
] | boot/prime.v | totient_count_coprime | |
totient_gt1n : (totient n > 1) = (n > 2).
Proof.
case: n => [|[|[|[|n']]]]//=; set n := n'.+4; rewrite [RHS]isT.
wlog [q] : / exists k, k.+3 \in primes n; last first.
rewrite mem_primes => /and3P[qp ngt0 qn].
have [[|k]// cqk ->] := pfactor_coprime qp ngt0.
rewrite totient_coprime 1?coprime_sym ?coprimeXl//.
rewrite totient_pfactor// -?pfactor_dvdn// mulnCA/= (@leq_trans q.+2)//.
by rewrite leq_pmulr// muln_gt0 totient_gt0 expn_gt0.
have := @prod_prime_decomp n isT; rewrite prime_decompE big_map/=.
case: (primes n) (all_prime_primes n) (sorted_primes n) =>
[|[|[|p']]// [|[|[|[|q']]] r]]//=; first by rewrite big_nil.
case: p' => [_ _|p' _ _ _]; last by apply; exists p'; rewrite ?mem_head.
rewrite big_seq1; case: logn => [|[|k]]//= ->.
by rewrite totient_pfactor//= mul1n (@leq_pexp2l 2 1)//.
by move=> _ _ _; apply; exists q'=> //; rewrite !in_cons eqxx orbT.
Qed. | Lemma | boot | [
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq path",
"From mathcomp Require Import choice fintype div bigop"
] | boot/prime.v | totient_gt1 | |
seq:= list.
Bind Scope seq_scope with list.
Arguments cons {T%_type} x s%_SEQ : rename.
Arguments nil {T%_type} : rename. | Notation | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | seq | |
ConsT := (@cons T) (only parsing). | Notation | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | Cons | |
NilT := (@nil T) (only parsing). | Notation | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | Nil | |
sizes := if s is _ :: s' then (size s').+1 else 0. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size | |
size0nils : size s = 0 -> 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 | size0nil | |
nilps := size s == 0. | Definition | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nilp | |
nilPs : reflect (s = [::]) (nilp s).
Proof. by case: s => [|x s]; constructor. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nilP | |
oheads := if s is x :: _ then Some x else None. | Definition | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | ohead | |
heads := if s is x :: _ then x else x0. | Definition | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | head | |
beheads := if s is _ :: s' then s' else [::]. | Definition | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | behead | |
size_beheads : size (behead s) = (size s).-1.
Proof. by case: s. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_behead | |
nconsn x := iter n (cons x). | Definition | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | ncons | |
nseqn x := ncons n x [::]. | Definition | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nseq | |
size_nconsn x s : size (ncons n x s) = n + size s.
Proof. by elim: n => //= n ->. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_ncons | |
size_nseqn x : size (nseq n x) = n.
Proof. by rewrite size_ncons addn0. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_nseq | |
seqn_typen := if n is n'.+1 then T -> seqn_type n' else seq T. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | seqn_type | |
seqn_recf n : seqn_type n :=
if n is n'.+1 return seqn_type n then
fun x => seqn_rec (fun s => f (x :: s)) n'
else f [::]. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | seqn_rec | |
seqn:= seqn_rec id. | Definition | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | seqn | |
cats1 s2 := if s1 is x :: s1' then x :: s1' ++ s2 else s2
where "s1 ++ s2" := (cat s1 s2) : seq_scope. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | cat | |
cat0ss : [::] ++ s = s. Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | cat0s | |
cat1sx s : [:: x] ++ s = x :: s. Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | cat1s | |
cat_consx s1 s2 : (x :: s1) ++ s2 = x :: s1 ++ s2. Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | cat_cons | |
cat_nseqn x s : nseq n x ++ s = ncons n x s.
Proof. by elim: n => //= n ->. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | cat_nseq | |
nseqDn1 n2 x : nseq (n1 + n2) x = nseq n1 x ++ nseq n2 x.
Proof. by rewrite cat_nseq /nseq /ncons iterD. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nseqD | |
cats0s : s ++ [::] = s.
Proof. by elim: s => //= x s ->. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | cats0 | |
catAs1 s2 s3 : s1 ++ s2 ++ s3 = (s1 ++ s2) ++ s3.
Proof. by elim: s1 => //= x s1 ->. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | catA | |
size_cats1 s2 : size (s1 ++ s2) = size s1 + size s2.
Proof. by elim: s1 => //= x s1 ->. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_cat | |
cat_nilps1 s2 : nilp (s1 ++ s2) = nilp s1 && nilp s2.
Proof. by case: s1. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | cat_nilp | |
rconss z := if s is x :: s' then x :: rcons s' z else [:: z]. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rcons | |
rcons_consx s z : rcons (x :: s) z = x :: rcons s z.
Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rcons_cons | |
cats1s z : s ++ [:: z] = rcons s z.
Proof. by elim: s => //= x s ->. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | cats1 | |
lastx s := if s is x' :: s' then last x' s' else x. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | last | |
belastx s := if s is x' :: s' then x :: (belast x' s') else [::]. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | belast | |
lastIx s : x :: s = rcons (belast x s) (last x s).
Proof. by elim: s x => [|y s IHs] x //=; rewrite IHs. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | lastI | |
last_consx y s : last x (y :: s) = last y s.
Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | last_cons | |
size_rconss x : size (rcons s x) = (size s).+1.
Proof. by rewrite -cats1 size_cat addnC. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_rcons | |
size_belastx s : size (belast x s) = size s.
Proof. by elim: s x => [|y s IHs] x //=; rewrite IHs. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_belast | |
last_catx s1 s2 : last x (s1 ++ s2) = last (last x s1) s2.
Proof. by elim: s1 x => [|y s1 IHs] x //=; rewrite IHs. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | last_cat | |
last_rconsx s z : last x (rcons s z) = z.
Proof. by rewrite -cats1 last_cat. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | last_rcons | |
belast_catx s1 s2 :
belast x (s1 ++ s2) = belast x s1 ++ belast (last x s1) s2.
Proof. by elim: s1 x => [|y s1 IHs] x //=; rewrite IHs. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | belast_cat | |
belast_rconsx s z : belast x (rcons s z) = x :: s.
Proof. by rewrite lastI -!cats1 belast_cat. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | belast_rcons | |
cat_rconsx s1 s2 : rcons s1 x ++ s2 = s1 ++ x :: s2.
Proof. by rewrite -cats1 -catA. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | cat_rcons | |
rcons_catx s1 s2 : rcons (s1 ++ s2) x = s1 ++ rcons s2 x.
Proof. by rewrite -!cats1 catA. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | rcons_cat | |
last_spec: seq T -> Type :=
| LastNil : last_spec [::]
| LastRcons s x : last_spec (rcons s x). | Variant | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | last_spec | |
lastPs : last_spec s.
Proof. case: s => [|x s]; [left | rewrite lastI; right]. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | lastP | |
last_indP :
P [::] -> (forall s x, P s -> P (rcons s x)) -> forall s, P s.
Proof.
move=> Hnil Hlast s; rewrite -(cat0s s).
elim: s [::] Hnil => [|x s2 IHs] s1 Hs1; first by rewrite cats0.
by rewrite -cat_rcons; apply/IHs/Hlast.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | last_ind | |
nths n {struct n} :=
if s is x :: s' then if n is n'.+1 then @nth s' n' else x else x0. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nth | |
set_nths n y {struct n} :=
if s is x :: s' then if n is n'.+1 then x :: @set_nth s' n' y else y :: s'
else ncons n x0 [:: y]. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | set_nth | |
nth0s : nth s 0 = head s. Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nth0 | |
nth_defaults n : size s <= n -> nth s n = x0.
Proof. by elim: s n => [|x s IHs] []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nth_default | |
if_nths b n : b || (size s <= n) ->
(if b then nth s n else x0) = nth s n.
Proof. by case: leqP; case: ifP => //= *; rewrite nth_default. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | if_nth | |
nth_niln : nth [::] n = x0.
Proof. by case: n. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nth_nil | |
nth_seq1n x : nth [:: x] n = if n == 0 then x else x0.
Proof. by case: n => [|[]]. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nth_seq1 | |
last_nthx s : last x s = nth (x :: s) (size s).
Proof. by elim: s x => [|y s IHs] x /=. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | last_nth | |
nth_lasts : nth s (size s).-1 = last x0 s.
Proof. by case: s => //= x s; rewrite last_nth. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nth_last | |
nth_beheads n : nth (behead s) n = nth s n.+1.
Proof. by case: s n => [|x s] [|n]. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nth_behead | |
nth_cats1 s2 n :
nth (s1 ++ s2) n = if n < size s1 then nth s1 n else nth s2 (n - size s1).
Proof. by elim: s1 n => [|x s1 IHs] []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nth_cat | |
nth_rconss x n :
nth (rcons s x) n =
if n < size s then nth s n else if n == size s then x else x0.
Proof. by elim: s n => [|y s IHs] [] //=; apply: nth_nil. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nth_rcons | |
nth_rcons_defaults i : nth (rcons s x0) i = nth s i.
Proof.
by rewrite nth_rcons; case: ltngtP => //[/ltnW ?|->]; rewrite nth_default.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nth_rcons_default | |
nth_nconsm x s n :
nth (ncons m x s) n = if n < m then x else nth s (n - m).
Proof. by elim: m n => [|m IHm] []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nth_ncons | |
nth_nseqm x n : nth (nseq m x) n = (if n < m then x else x0).
Proof. by elim: m n => [|m IHm] []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nth_nseq | |
eq_from_nths1 s2 :
size s1 = size s2 -> (forall i, i < size s1 -> nth s1 i = nth s2 i) ->
s1 = s2.
Proof.
elim: s1 s2 => [|x1 s1 IHs1] [|x2 s2] //= [eq_sz] eq_s12.
by rewrite [x1](eq_s12 0) // (IHs1 s2) // => i; apply: (eq_s12 i.+1).
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | eq_from_nth | |
size_set_nths n y : size (set_nth s n y) = maxn n.+1 (size s).
Proof.
rewrite maxnC; elim: s n => [|x s IHs] [|n] //=.
- by rewrite size_ncons addn1.
- by rewrite IHs maxnSS.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_set_nth | |
set_nth_niln y : set_nth [::] n y = ncons n x0 [:: y].
Proof. by case: n. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | set_nth_nil | |
nth_set_nths n y : nth (set_nth s n y) =1 [eta nth s with n |-> y].
Proof.
elim: s n => [|x s IHs] [|n] [|m] //=; rewrite ?nth_nil ?IHs // nth_ncons eqSS.
case: ltngtP => // [lt_nm | ->]; last by rewrite subnn.
by rewrite nth_default // subn_gt0.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | nth_set_nth | |
set_set_nths n1 y1 n2 y2 (s2 := set_nth s n2 y2) :
set_nth (set_nth s n1 y1) n2 y2 = if n1 == n2 then s2 else set_nth s2 n1 y1.
Proof.
have [-> | ne_n12] := eqVneq.
apply: eq_from_nth => [|i _]; first by rewrite !size_set_nth maxnA maxnn.
by do 2!rewrite !nth_set_nth /=; case: eqP.
apply: eq_from_nth => [|i _]; first by rewrite !size_set_nth maxnCA.
by do 2!rewrite !nth_set_nth /=; case: eqP => // ->; case: eqVneq ne_n12.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | set_set_nth | |
finds := if s is x :: s' then if a x then 0 else (find s').+1 else 0. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | find | |
filters :=
if s is x :: s' then if a x then x :: filter s' else filter s' else [::]. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | filter | |
counts := if s is x :: s' then a x + count s' else 0. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | count | |
hass := if s is x :: s' then a x || has s' else false. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | has | |
alls := if s is x :: s' then a x && all s' else true. | Fixpoint | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | all | |
size_filters : size (filter s) = count s.
Proof. by elim: s => //= x s <-; case (a x). Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_filter | |
has_counts : has s = (0 < count s).
Proof. by elim: s => //= x s ->; case (a x). Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | has_count | |
size_filter_gt0s : (size (filter s) > 0) = (has s).
Proof. by rewrite size_filter -has_count. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | size_filter_gt0 | |
count_sizes : count s <= size s.
Proof. by elim: s => //= x s; case: (a x); last apply: leqW. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | count_size | |
all_counts : all s = (count s == size s).
Proof.
elim: s => //= x s; case: (a x) => _ //=.
by rewrite add0n eqn_leq andbC ltnNge count_size.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | all_count | |
filter_alls : all (filter s).
Proof. by elim: s => //= x s IHs; case: ifP => //= ->. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | filter_all | |
all_filterPs : reflect (filter s = s) (all s).
Proof.
apply: (iffP idP) => [| <-]; last exact: filter_all.
by elim: s => //= x s IHs /andP[-> Hs]; rewrite IHs.
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | all_filterP | |
filter_ids : filter (filter s) = filter s.
Proof. by apply/all_filterP; apply: filter_all. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | filter_id | |
has_finds : has s = (find s < size s).
Proof. by elim: s => //= x s IHs; case (a x); rewrite ?leqnn. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | has_find | |
find_sizes : find s <= size s.
Proof. by elim: s => //= x s IHs; case (a x). Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | find_size | |
find_cats1 s2 :
find (s1 ++ s2) = if has s1 then find s1 else size s1 + find s2.
Proof.
by elim: s1 => //= x s1 IHs; case: (a x) => //; rewrite IHs (fun_if succn).
Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | find_cat | |
has_nil: has [::] = false. Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | has_nil | |
has_seq1x : has [:: x] = a x.
Proof. exact: orbF. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | has_seq1 | |
has_nseqn x : has (nseq n x) = (0 < n) && a x.
Proof. by elim: n => //= n ->; apply: andKb. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | has_nseq | |
has_seqb(b : bool) x : has (nseq b x) = b && a x.
Proof. by rewrite has_nseq lt0b. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | has_seqb | |
all_nil: all [::] = true. Proof. by []. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | all_nil | |
all_seq1x : all [:: x] = a x.
Proof. exact: andbT. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | all_seq1 | |
all_nseqn x : all (nseq n x) = (n == 0) || a x.
Proof. by elim: n => //= n ->; apply: orKb. Qed. | Lemma | boot | [
"From HB Require Import structures",
"From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat"
] | boot/seq.v | all_nseq |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.