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
incr_tallybs x := if bs isn't b :: bs then [:: (x, 1)] else if x == b.1 then (x, b.2.+1) :: bs else b :: incr_tally bs x.
Fixpoint
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
incr_tally
tallys := foldl incr_tally [::] s.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
tally
wf_tally:= [qualify a bs : seq (T * nat) | uniq (unzip1 bs) && (0 \notin unzip2 bs)].
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
wf_tally
tally_seqbs := flatten [seq nseq b.2 b.1 | b <- bs]. Local Notation tseq := tally_seq.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
tally_seq
size_tally_seqbs : size (tally_seq bs) = sumn (unzip2 bs). Proof. by rewrite size_flatten /shape -map_comp; under eq_map do rewrite /= size_nseq. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
size_tally_seq
tally_seqK: {in wf_tally, cancel tally_seq tally}. Proof. move=> bs /andP[]; elim: bs => [|[x [|n]] bs IHbs] //= /andP[bs'x Ubs] bs'0. rewrite inE /tseq /tally /= -[n.+1]addn1 in bs'0 *. elim: n 1 => /= [|n IHn] m; last by rewrite eqxx IHn addnS. rewrite -{}[in RHS]IHbs {Ubs bs'0}// /tally /tally_seq add0n. elim: bs bs'x [::] => [|[y n] bs IHbs] //= /[1!inE] /norP[y'x bs'x]. by elim: n => [|n IHn] bs1 /=; [rewrite IHbs | rewrite eq_sym ifN // IHn]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
tally_seqK
incr_tallyPx : {homo incr_tally^~ x : bs / bs \in wf_tally}. Proof. move=> bs /andP[]; rewrite unfold_in. elim: bs => [|[y [|n]] bs IHbs] //= /andP[bs'y Ubs] /[1!inE] /= bs'0. have [<- | y'x] /= := eqVneq y; first by rewrite bs'y Ubs. rewrite -andbA {}IHbs {Ubs bs'0}// andbT. elim: bs bs'y => [|b bs IHbs] /=; rewrite inE ?y'x // => /norP[b'y bs'y]. by case: ifP => _; rewrite /= inE negb_or ?y'x // b'y IHbs. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
incr_tallyP
tallyPs : tally s \is a wf_tally. Proof. rewrite /tally; set bs := [::]; have: bs \in wf_tally by []. by elim: s bs => //= x s IHs bs /(incr_tallyP x)/IHs. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
tallyP
tallyKs : perm_eq (tally_seq (tally s)) s. Proof. rewrite -[s in perm_eq _ s]cats0 -[nil]/(tseq [::]) /tally. elim: s [::] => //= x s IHs bs; rewrite {IHs}(permPl (IHs _)). rewrite perm_sym -cat1s perm_catCA {s}perm_cat2l. elim: bs => //= b bs IHbs; case: eqP => [-> | _] //=. by rewrite -cat1s perm_catCA perm_cat2l. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
tallyK
tallyEls : perm_eq (unzip1 (tally s)) (undup s). Proof. have /andP[Ubs bs'0] := tallyP s; set bs := tally s in Ubs bs'0 *. rewrite uniq_perm ?undup_uniq {Ubs}// => x. rewrite mem_undup -(perm_mem (tallyK s)) -/bs. elim: bs => [|[y [|m]] bs IHbs] //= in bs'0 *. by rewrite inE IHbs // mem_cat mem_nseq. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
tallyEl
tallyEs : perm_eq (tally s) [seq (x, count_mem x s) | x <- undup s]. Proof. have /andP[Ubs _] := tallyP s; pose b := [fun s x => (x, count_mem x (tseq s))]. suffices /permPl->: perm_eq (tally s) (map (b (tally s)) (unzip1 (tally s))). congr perm_eq: (perm_map (b (tally s)) (tallyEl s)). by under eq_map do rewrite /= (permP (tallyK s)). elim: (tally s) Ubs => [|[x m] bs IH] //= /andP[bs'x /IH-IHbs {IH}]. rewrite /tseq /= -/(tseq _) count_cat count_nseq /= eqxx mul1n. rewrite (count_memPn _) ?addn0 ?perm_cons; last first. apply: contra bs'x; elim: {b IHbs}bs => //= b bs IHbs. by rewrite mem_cat mem_nseq inE andbC; case: (_ == _). congr perm_eq: IHbs; apply/eq_in_map=> y bs_y; congr (y, _). by rewrite count_cat count_nseq /= (negPf (memPnC bs'x y bs_y)). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
tallyE
perm_tallys1 s2 : perm_eq s1 s2 -> perm_eq (tally s1) (tally s2). Proof. move=> eq_s12; apply: (@perm_trans _ [seq (x, count_mem x s2) | x <- undup s1]). by congr perm_eq: (tallyE s1); under eq_map do rewrite (permP eq_s12). by rewrite (permPr (tallyE s2)); apply/perm_map/perm_undup/(perm_mem eq_s12). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
perm_tally
perm_tally_seqbs1 bs2 : perm_eq bs1 bs2 -> perm_eq (tally_seq bs1) (tally_seq bs2). Proof. by move=> Ebs12; rewrite perm_flatten ?perm_map. Qed. Local Notation perm_tseq := perm_tally_seq.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
perm_tally_seq
perm_count_undups : perm_eq (flatten [seq nseq (count_mem x s) x | x <- undup s]) s. Proof. by rewrite -(permPr (tallyK s)) (permPr (perm_tseq (tallyE s))) /tseq -map_comp. Qed. Local Fixpoint cons_perms_ perms_rec (s : seq T) bs bs2 acc := if bs isn't b :: bs1 then acc else if b isn't (x, m.+1) then cons_perms_ perms_rec s bs1 bs2 acc else let acc_xs := perms_rec (x :: s) ((x, m) :: bs1 ++ bs2) acc in cons_perms_ perms_rec s bs1 (b :: bs2) acc_xs. Local Fixpoint perms_rec n s bs acc := if n isn't n.+1 then s :: acc else cons_perms_ (perms_rec n) s bs [::] acc. Local Notation cons_perms n := (cons_perms_ (perms_rec n) [::]).
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
perm_count_undup
permutationss := perms_rec (size s) [::] (tally s) [::]. Let permsP s : exists n bs, [/\ permutations s = perms_rec n [::] bs [::], size (tseq bs) == n, perm_eq (tseq bs) s & uniq (unzip1 bs)]. Proof. have /andP[Ubs _] := tallyP s; exists (size s), (tally s). by rewrite (perm_size (tallyK s)) tallyK. Qed. Local Notation bsCA := (permEl (perm_catCA _ [:: _] _)). Let cons_permsE : forall n x bs bs1 bs2, let cp := cons_perms n bs bs2 in let perms s := perms_rec n s bs1 [::] in cp (perms [:: x]) = cp [::] ++ [seq rcons t x | t <- perms [::]]. Proof. pose is_acc f := forall acc, f acc = f [::] ++ acc. have cpE: forall f & forall s bs, is_acc (f s bs), is_acc (cons_perms_ f _ _ _). move=> s bs bs2 f fE acc; elim: bs => [|[x [|m]] bs IHbs] //= in s bs2 acc *. by rewrite fE IHbs catA -IHbs. have prE: is_acc (perms_rec _ _ _) by elim=> //= n IHn s bs; apply: cpE. pose has_suffix f := forall s : seq T, f s = [seq t ++ s | t <- f [::]]. suffices prEs n bs: has_suffix (fun s => perms_rec n s bs [::]). move=> n x bs bs1 bs2 /=; rewrite cpE // prEs. by under eq_map do rewrite cats1. elim: n bs => //= n IHn bs s; elim: bs [::] => [|[x [|m]] bs IHbs] //= bs1. rewrite cpE // IHbs IHn [in RHS]cpE // [in RHS]IHn map_cat -map_comp. by congr (_ ++ _); apply: eq_map => t /=; rewrite -catA. Qed.
Definition
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
permutations
mem_permutationss t : (t \in permutations s) = perm_eq t s. Proof. have{s} [n [bs [-> Dn /permPr<- _]]] := permsP s. elim: n => [|n IHn] /= in t bs Dn *. by rewrite inE (nilP Dn); apply/eqP/perm_nilP. rewrite -[bs in tseq bs]cats0 in Dn *; have x0 : T by case: (tseq _) Dn. rewrite -[RHS](@andb_idl (last x0 t \in tseq bs)); last first. case/lastP: t {IHn} => [|t x] Dt; first by rewrite -(perm_size Dt) in Dn. by rewrite -[bs]cats0 -(perm_mem Dt) last_rcons mem_rcons mem_head. elim: bs [::] => [|[x [|m]] bs IHbs] //= bs2 in Dn *. rewrite cons_permsE -!cat_cons !mem_cat (mem_nseq m.+1) orbC andb_orl. rewrite {}IHbs ?(perm_size (perm_tseq bsCA)) //= (permPr (perm_tseq bsCA)). congr (_ || _); apply/mapP/andP=> [[t1 Dt1 ->] | [/eqP]]. by rewrite last_rcons perm_rcons perm_cons IHn in Dt1 *. case/lastP: t => [_ /perm_size//|t y]; rewrite last_rcons perm_rcons => ->. by rewrite perm_cons; exists t; rewrite ?IHn. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
mem_permutations
permutations_uniqs : uniq (permutations s). Proof. have{s} [n [bs [-> Dn _ Ubs]]] := permsP s. elim: n => //= n IHn in bs Dn Ubs *; rewrite -[bs]cats0 /unzip1 in Dn Ubs. elim: bs [::] => [|[x [|m]] bs IHbs] //= bs2 in Dn Ubs *. by case/andP: Ubs => _ /IHbs->. rewrite /= cons_permsE cat_uniq has_sym andbCA andbC. rewrite {}IHbs; first 1 last; first by rewrite (perm_size (perm_tseq bsCA)). by rewrite (perm_uniq (perm_map _ bsCA)). rewrite (map_inj_uniq (rcons_injl x)) {}IHn {Dn}//=. have: x \notin unzip1 bs by apply: contraL Ubs; rewrite map_cat mem_cat => ->. move: {bs2 m Ubs}(perms_rec n _ _ _) (_ :: bs2) => ts. elim: bs => [|[y [|m]] bs IHbs] //= /[1!inE] bs2 /norP[x'y /IHbs//]. rewrite cons_permsE has_cat negb_or has_map => ->. by apply/hasPn=> t _; apply: contra x'y => /mapP[t1 _ /rcons_inj[_ ->]]. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
permutations_uniq
perms:= permutations.
Notation
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
perms
permutationsEs : 0 < size s -> perm_eq (perms s) [seq x :: t | x <- undup s, t <- perms (rem x s)]. Proof. move=> nt_s; apply/uniq_perm=> [||t]; first exact: permutations_uniq. apply/allpairs_uniq_dep=> [|x _|]; rewrite ?undup_uniq ?permutations_uniq //. by case=> [_ _] [x t] _ _ [-> ->]. rewrite mem_permutations; apply/idP/allpairsPdep=> [Dt | [x [t1 []]]]. rewrite -(perm_size Dt) in nt_s; case: t nt_s => // x t _ in Dt *. have s_x: x \in s by rewrite -(perm_mem Dt) mem_head. exists x, t; rewrite mem_undup mem_permutations; split=> //. by rewrite -(perm_cons x) (permPl Dt) perm_to_rem. rewrite mem_undup mem_permutations -(perm_cons x) => s_x Dt1 ->. by rewrite (permPl Dt1) perm_sym perm_to_rem. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
permutationsE
permutationsErotx s (le_x := fun t => iota 0 (index x t + 1)) : perm_eq (perms (x :: s)) [seq rot i (x :: t) | t <- perms s, i <- le_x t]. Proof. have take'x t i: i <= index x t -> i <= size t /\ x \notin take i t. move=> le_i_x; have le_i_t: i <= size t := leq_trans le_i_x (index_size x t). case: (nthP x) => // -[j lt_j_i /eqP]; rewrite size_takel // in lt_j_i. by rewrite nth_take // [_ == _](before_find x (leq_trans lt_j_i le_i_x)). pose xrot t i := rot i (x :: t); pose xrotV t := index x (rev (rot 1 t)). have xrotK t: {in le_x t, cancel (xrot t) xrotV}. move=> i; rewrite mem_iota addn1 /xrotV => /take'x[le_i_t ti'x]. rewrite -rotD ?rev_cat //= rev_cons cat_rcons index_cat mem_rev size_rev. by rewrite ifN // size_takel //= eqxx addn0. apply/uniq_perm=> [||t]; first exact: permutations_uniq. apply/allpairs_uniq_dep=> [|t _|]; rewrite ?permutations_uniq ?iota_uniq //. move=> _ _ /allpairsPdep[t [i [_ ? ->]]] /allpairsPdep[u [j [_ ? ->]]] Etu. have Eij: i = j by rewrite -(xrotK t i) // /xrot Etu xrotK. by move: Etu; rewrite Eij => /rot_inj[->]. rewrite mem_permutations; apply/esym; apply/allpairsPdep/idP=> [[u [i]] | Dt]. rewrite mem_permutations => -[Du _ /(canLR (rotK i))]; rewrite /rotr. by set j := (j in rot j _) => Dt; apply/perm_consP; exists j, u. pose r := rev (rot 1 t); pose i := index x r; pose u := rev (take i r). have r_x: x \in r by rewrite mem_rev mem_rot (perm_mem Dt) mem_head. have [v Duv]: {v | rot i (x :: u ++ v) = t}; first exists (rev (drop i.+1 r ...
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
permutationsErot
size_permutationss : uniq s -> size (permutations s) = (size s)`!. Proof. move Dn: (size s) => n Us; elim: n s => [[]|n IHn s] //= in Dn Us *. rewrite (perm_size (permutationsE _)) ?Dn // undup_id // factS -Dn. rewrite -(size_iota 0 n`!) -(size_allpairs (fun=>id)) !size_allpairs_dep. by apply/congr1/eq_in_map=> x sx; rewrite size_iota IHn ?size_rem ?Dn ?rem_uniq. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
size_permutations
permutations_all_uniqs : uniq s -> all uniq (permutations s). Proof. by move=> Us; apply/allP=> t; rewrite mem_permutations => /perm_uniq->. Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
permutations_all_uniq
perm_permutationss t : perm_eq s t -> perm_eq (permutations s) (permutations t). Proof. move=> Est; apply/uniq_perm; try exact: permutations_uniq. by move=> u; rewrite !mem_permutations (permPr Est). Qed.
Lemma
boot
[ "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat" ]
boot/seq.v
perm_permutations
change_typety ty' (x : ty) (strategy : ty = ty') : ty' := ecast ty ty strategy x.
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
change_type
simplrefl:= (ltac: (simpl; reflexivity)) (only parsing).
Notation
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
simplrefl
cbvrefl:= (ltac: (cbv; reflexivity)) (only parsing).
Notation
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
cbvrefl
vmrefl:= (ltac: (vm_compute; reflexivity)) (only parsing).
Notation
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
vmrefl
of_uint_acc(d:Decimal.uint) (acc:positive) := match d with | Decimal.Nil => acc | Decimal.D0 l => of_uint_acc l (mul ten acc) | Decimal.D1 l => of_uint_acc l (add 1 (mul ten acc)) | Decimal.D2 l => of_uint_acc l (add 1~0 (mul ten acc)) | Decimal.D3 l => of_uint_acc l (add 1~1 (mul ten acc)) | Decimal.D4 l => of_uint_acc l (add 1~0~0 (mul ten acc)) | Decimal.D5 l => of_uint_acc l (add 1~0~1 (mul ten acc)) | Decimal.D6 l => of_uint_acc l (add 1~1~0 (mul ten acc)) | Decimal.D7 l => of_uint_acc l (add 1~1~1 (mul ten acc)) | Decimal.D8 l => of_uint_acc l (add 1~0~0~0 (mul ten acc)) | Decimal.D9 l => of_uint_acc l (add 1~0~0~1 (mul ten acc)) end.
Fixpoint
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
of_uint_acc
of_uint(d:Decimal.uint) : N := match d with | Decimal.Nil => N0 | Decimal.D0 l => of_uint l | Decimal.D1 l => Npos (of_uint_acc l 1) | Decimal.D2 l => Npos (of_uint_acc l 1~0) | Decimal.D3 l => Npos (of_uint_acc l 1~1) | Decimal.D4 l => Npos (of_uint_acc l 1~0~0) | Decimal.D5 l => Npos (of_uint_acc l 1~0~1) | Decimal.D6 l => Npos (of_uint_acc l 1~1~0) | Decimal.D7 l => Npos (of_uint_acc l 1~1~1) | Decimal.D8 l => Npos (of_uint_acc l 1~0~0~0) | Decimal.D9 l => Npos (of_uint_acc l 1~0~0~1) end. Local Notation sixteen := (xO (xO (xO (xO xH)))).
Fixpoint
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
of_uint
of_hex_uint_acc(d:Hexadecimal.uint) (acc:positive) := match d with | Hexadecimal.Nil => acc | Hexadecimal.D0 l => of_hex_uint_acc l (mul sixteen acc) | Hexadecimal.D1 l => of_hex_uint_acc l (add 1 (mul sixteen acc)) | Hexadecimal.D2 l => of_hex_uint_acc l (add 1~0 (mul sixteen acc)) | Hexadecimal.D3 l => of_hex_uint_acc l (add 1~1 (mul sixteen acc)) | Hexadecimal.D4 l => of_hex_uint_acc l (add 1~0~0 (mul sixteen acc)) | Hexadecimal.D5 l => of_hex_uint_acc l (add 1~0~1 (mul sixteen acc)) | Hexadecimal.D6 l => of_hex_uint_acc l (add 1~1~0 (mul sixteen acc)) | Hexadecimal.D7 l => of_hex_uint_acc l (add 1~1~1 (mul sixteen acc)) | Hexadecimal.D8 l => of_hex_uint_acc l (add 1~0~0~0 (mul sixteen acc)) | Hexadecimal.D9 l => of_hex_uint_acc l (add 1~0~0~1 (mul sixteen acc)) | Hexadecimal.Da l => of_hex_uint_acc l (add 1~0~1~0 (mul sixteen acc)) | Hexadecimal.Db l => of_hex_uint_acc l (add 1~0~1~1 (mul sixteen acc)) | Hexadecimal.Dc l => of_hex_uint_acc l (add 1~1~0~0 (mul sixteen acc)) | Hexadecimal.Dd l => of_hex_uint_acc l (add 1~1~0~1 (mul sixteen acc)) | Hexadecimal.De l => of_hex_uint_acc l (add 1~1~1~0 (mul sixteen acc)) | Hexadecimal.Df l => of_hex_uint_acc l (add 1~1~1~1 (mul sixteen acc)) end.
Fixpoint
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
of_hex_uint_acc
of_hex_uint(d:Hexadecimal.uint) : N := match d with | Hexadecimal.Nil => N0 | Hexadecimal.D0 l => of_hex_uint l | Hexadecimal.D1 l => Npos (of_hex_uint_acc l 1) | Hexadecimal.D2 l => Npos (of_hex_uint_acc l 1~0) | Hexadecimal.D3 l => Npos (of_hex_uint_acc l 1~1) | Hexadecimal.D4 l => Npos (of_hex_uint_acc l 1~0~0) | Hexadecimal.D5 l => Npos (of_hex_uint_acc l 1~0~1) | Hexadecimal.D6 l => Npos (of_hex_uint_acc l 1~1~0) | Hexadecimal.D7 l => Npos (of_hex_uint_acc l 1~1~1) | Hexadecimal.D8 l => Npos (of_hex_uint_acc l 1~0~0~0) | Hexadecimal.D9 l => Npos (of_hex_uint_acc l 1~0~0~1) | Hexadecimal.Da l => Npos (of_hex_uint_acc l 1~0~1~0) | Hexadecimal.Db l => Npos (of_hex_uint_acc l 1~0~1~1) | Hexadecimal.Dc l => Npos (of_hex_uint_acc l 1~1~0~0) | Hexadecimal.Dd l => Npos (of_hex_uint_acc l 1~1~0~1) | Hexadecimal.De l => Npos (of_hex_uint_acc l 1~1~1~0) | Hexadecimal.Df l => Npos (of_hex_uint_acc l 1~1~1~1) end.
Fixpoint
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
of_hex_uint
of_int(d:Decimal.int) : option positive := match d with | Decimal.Pos d => match of_uint d with | N0 => None | Npos p => Some p end | Decimal.Neg _ => None end.
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
of_int
of_hex_int(d:Hexadecimal.int) : option positive := match d with | Hexadecimal.Pos d => match of_hex_uint d with | N0 => None | Npos p => Some p end | Hexadecimal.Neg _ => None end.
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
of_hex_int
of_num_int(d:Number.int) : option positive := match d with | Number.IntDecimal d => of_int d | Number.IntHexadecimal d => of_hex_int d end.
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
of_num_int
to_little_uintp := match p with | xH => Decimal.D1 Decimal.Nil | xI p => Decimal.Little.succ_double (to_little_uint p) | xO p => Decimal.Little.double (to_little_uint p) end.
Fixpoint
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
to_little_uint
to_uintp := Decimal.rev (to_little_uint p).
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
to_uint
to_num_uintp := Number.UIntDecimal (to_uint p).
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
to_num_uint
Nsuccn := match n with | N0 => Npos xH | Npos p => Npos (Pos.succ p) end.
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
Nsucc
nat_of_succ_binb : nat_of_bin (Nsucc b) = 1 + nat_of_bin b :> nat. Proof. by case: b => [//|p /=]; rewrite nat_of_succ_pos. Qed.
Lemma
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
nat_of_succ_bin
eqb_eqp q : Pos.eqb p q = true <-> p=q. Proof. by elim: p q => [p IHp|p IHp|] [q|q|] //=; split=> [/IHp->//|]; case=> /IHp. Qed.
Theorem
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
eqb_eq
Definition_ := hasDecEq.Build positive (fun _ _ => equivP idP (Pos.eqb_eq _ _)).
HB.instance
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
Definition
syntax:= Leaf of positive | Op of syntax & syntax.
Inductive
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
syntax
serial:= (fix loop (acc : seq positive) (s : syntax) := match s with | Leaf n => n :: acc | Op s s' => (loop^~ s (loop^~ s' acc)) end) [::].
Coercion
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
serial
serial_Ops1 s2 : Op s1 s2 = s1 ++ s2 :> seq _. Proof. rewrite /serial; set loop := (X in X [::]); rewrite -/loop. elim: s1 (loop [::] s2) => [n|s11 IHs1 s12 IHs2] //= l. by rewrite IHs1 [in RHS]IHs1 IHs2 catA. Qed.
Lemma
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
serial_Op
Leaf_of_natn := Leaf (Pos.sub (pos_of_nat n n) xH).
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
Leaf_of_nat
Leaf: positive >-> syntax.
Coercion
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
Leaf
Leaf_of_nat: nat >-> syntax.
Coercion
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
Leaf_of_nat
pattern(s : syntax) := ((fix loop n s := match s with | Leaf 1%positive => (Leaf n, Pos.succ n) | Leaf m => Pos.iter (fun oi => (Op oi.1 (Leaf oi.2), Pos.succ oi.2)) (Leaf n, Pos.succ n) (Pos.sub m xH) | Op s s' => let: (p, n') := loop n s in let: (p', n'') := loop n' s' in (Op p p', n'') end) 1%positive s).1.
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
pattern
env:= Empty | ENode of T & env & env.
Inductive
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
env
pos:= fix loop (e : env) p {struct e} := match e, p with | ENode t _ _, 1%positive => t | ENode t e _, (p~0)%positive => loop e p | ENode t _ e, (p~1)%positive => loop e p | _, _ => idx end.
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
pos
set_pos(f : T -> T) := fix loop e p {struct p} := match e, p with | ENode t e e', 1%positive => ENode (f t) e e' | ENode t e e', (p~0)%positive => ENode t (loop e p) e' | ENode t e e', (p~1)%positive => ENode t e (loop e' p) | Empty, 1%positive => ENode (f idx) Empty Empty | Empty, (p~0)%positive => ENode idx (loop Empty p) Empty | Empty, (p~1)%positive => ENode idx Empty (loop Empty p) end.
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
set_pos
pos_set_pos(f : T -> T) e (p p' : positive) : pos (set_pos f e p) p' = if p == p' then f (pos e p) else pos e p'. Proof. by elim: p e p' => [p IHp|p IHp|] [|???] [?|?|]//=; rewrite IHp. Qed.
Lemma
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
pos_set_pos
unzipz (e : env) : env := match z with | [::] => e | (x, inl e') :: z' => unzip z' (ENode x e' e) | (x, inr e') :: z' => unzip z' (ENode x e e') end.
Fixpoint
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
unzip
set_pos_trec(f : T -> T) := fix loop z e p {struct p} := match e, p with | ENode t e e', 1%positive => unzip z (ENode (f t) e e') | ENode t e e', (p~0)%positive => loop ((t, inr e') :: z) e p | ENode t e e', (p~1)%positive => loop ((t, inl e) :: z) e' p | Empty, 1%positive => unzip z (ENode (f idx) Empty Empty) | Empty, (p~0)%positive => loop ((idx, (inr Empty)) :: z) Empty p | Empty, (p~1)%positive => loop ((idx, (inl Empty)) :: z) Empty p end.
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
set_pos_trec
set_pos_trecEf z e p : set_pos_trec f z e p = unzip z (set_pos f e p). Proof. by elim: p e z => [p IHp|p IHp|] [|???] [|[??]?] //=; rewrite ?IHp. Qed.
Lemma
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
set_pos_trecE
eval(e : env) := fix loop (s : syntax) := match s with | Leaf n => pos e n | Op s s' => op (loop s) (loop s') end.
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
eval
content:= (fix loop (acc : env N) s := match s with | Leaf n => set_pos_trec N0 Pos.Nsucc [::] acc n | Op s s' => loop (loop acc s') s end) Empty.
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
content
count_memEx (t : syntax) : count_mem x t = nat_of_bin (pos N0 (content t) x). Proof. rewrite /content; set loop := (X in X Empty); rewrite -/loop. rewrite -[LHS]addn0. have <- : nat_of_bin (pos N0 Empty x) = 0 :> nat by elim: x. elim: t Empty => [n|s IHs s' IHs'] e //=; last first. by rewrite serial_Op count_cat -addnA IHs' IHs. rewrite ?addn0 set_pos_trecE pos_set_pos; case: (altP eqP) => [->|] //=. by rewrite Pos.nat_of_succ_bin. Qed.
Lemma
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
count_memE
cforallN T : env N -> (env T -> Type) -> Type := env_rect (@^~ Empty) (fun _ e IHe e' IHe' R => forall x, IHe (fun xe => IHe' (R \o ENode x xe))).
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
cforall
cforallPN T R : (forall e : env T, R e) -> forall (e : env N), cforall e R. Proof. move=> Re e; elim: e R Re => [|? e /= IHe e' IHe' ?? x] //=. by apply: IHe => ?; apply: IHe' => /=. Qed.
Lemma
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
cforallP
proof(p s : syntax) : content p = content s -> forall env, eval idx op env p = eval idx op env s. Proof. suff evalE env t : eval idx op env t = \big[op/idx]_(i <- t) (pos idx env i). move=> cps e; rewrite !evalE; apply: perm_big. by apply/allP => x _ /=; rewrite !count_memE cps. elim: t => //= [n|t -> t' ->]; last by rewrite serial_Op big_cat. by rewrite big_cons big_nil Monoid.mulm1. Qed.
Lemma
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
proof
directp s ps := cforallP (@proof p s ps) (content p).
Definition
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
direct
AC_check_pattern:= (ltac: (match goal with |- AC.content ?pat = AC.content ?ord => let pat' := fresh "pat" in let pat' := eval compute in pat in tryif unify pat' ord then fail 1 "AC: equality between" pat "and" ord "is trivial, cannot progress" else tryif vm_compute; reflexivity then idtac else fail 2 "AC: mismatch between shape" pat "=" pat' "and reordering" ord | |- ?G => fail 3 "AC: no pattern to check" G end)) (only parsing).
Notation
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
AC_check_pattern
opACoflaw p s := ((fun T idx op assoc lid rid comm => (change_type (@AC.direct T idx (Monoid.ComLaw.Pack (Monoid.ComLaw.Class (SemiGroup.isLaw.Axioms_ op assoc) (Monoid.isMonoidLaw.Axioms_ idx op lid rid) (SemiGroup.isCommutativeLaw.Axioms_ op comm))) p%AC s%AC AC_check_pattern) cbvrefl)) _ _ law (Monoid.mulmA _) (Monoid.mul1m _) (Monoid.mulm1 _) (Monoid.mulmC _)) (only parsing).
Notation
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
opACof
opACop p s := (opACof op (AC.pattern p%AC) s%AC) (only parsing).
Notation
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
opAC
opAClop s := (opAC op (AC.Leaf_of_nat (size (AC.serial s%AC))) s%AC) (only parsing).
Notation
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
opACl
AC_strategy:= (ltac: (cbv -[Monoid.ComLaw.sort Monoid.Law.sort]; reflexivity)) (only parsing).
Notation
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
AC_strategy
ACofp s := (change_type (@AC.direct _ _ _ p%AC s%AC AC_check_pattern) AC_strategy) (only parsing).
Notation
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
ACof
ACp s := (ACof (AC.pattern p%AC) s%AC) (only parsing).
Notation
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
AC
ACls := (AC (AC.Leaf_of_nat (size (AC.serial s%AC))) s%AC) (only parsing).
Notation
boot
[ "From HB Require Import structures", "From Corelib Require Import PosDef", "From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq bigop" ]
boot/ssrAC.v
ACl
homo_mono1[aT rT : Type] [f : aT -> rT] [g : rT -> aT] [aP : pred aT] [rP : pred rT] : cancel g f -> {homo f : x / aP x >-> rP x} -> {homo g : x / rP x >-> aP x} -> {mono g : x / rP x >-> aP x}. Proof. by move=> gK fP gP x; apply/idP/idP => [/fP|/gP//]; rewrite gK. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrfun", "From Corelib Require Export ssrbool" ]
boot/ssrbool.v
homo_mono1
if_andb1 b2 T (x y : T) : (if b1 && b2 then x else y) = (if b1 then if b2 then x else y else y). Proof. by case: b1 b2 => [] []. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrfun", "From Corelib Require Export ssrbool" ]
boot/ssrbool.v
if_and
if_orb1 b2 T (x y : T) : (if b1 || b2 then x else y) = (if b1 then x else if b2 then x else y). Proof. by case: b1 b2 => [] []. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrfun", "From Corelib Require Export ssrbool" ]
boot/ssrbool.v
if_or
if_implybb1 b2 T (x y : T) : (if b1 ==> b2 then x else y) = (if b1 then if b2 then x else y else x). Proof. by case: b1 b2 => [] []. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrfun", "From Corelib Require Export ssrbool" ]
boot/ssrbool.v
if_implyb
if_implybCb1 b2 T (x y : T) : (if b1 ==> b2 then x else y) = (if b2 then x else if b1 then y else x). Proof. by case: b1 b2 => [] []. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrfun", "From Corelib Require Export ssrbool" ]
boot/ssrbool.v
if_implybC
if_addb1 b2 T (x y : T) : (if b1 (+) b2 then x else y) = (if b1 then if b2 then y else x else if b2 then x else y). Proof. by case: b1 b2 => [] []. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrfun", "From Corelib Require Export ssrbool" ]
boot/ssrbool.v
if_add
relpre_trans{T' T : Type} {leT : rel T} {f : T' -> T} : transitive leT -> transitive (relpre f leT). Proof. by move=> + y x z; apply. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect ssrfun", "From Corelib Require Export ssrbool" ]
boot/ssrbool.v
relpre_trans
nosimplt := (nosimpl t).
Notation
boot
[ "From Corelib Require Export ssreflect" ]
boot/ssreflect.v
nosimpl
hide{T} t : T := t.
Definition
boot
[ "From Corelib Require Export ssreflect" ]
boot/ssreflect.v
hide
hideT:= (@hide (hide _)) (only parsing).
Notation
boot
[ "From Corelib Require Export ssreflect" ]
boot/ssreflect.v
hideT
injective2(rT aT1 aT2 : Type) (f : aT1 -> aT2 -> rT) := forall (x1 x2 : aT1) (y1 y2 : aT2), f x1 y1 = f x2 y2 -> (x1 = x2) * (y1 = y2). Arguments injective2 [rT aT1 aT2] f.
Definition
boot
[ "From mathcomp Require Import ssreflect", "From Corelib Require Export ssrfun", "From mathcomp Require Export ssrnotations" ]
boot/ssrfun.v
injective2
inj_omap{aT rT : Type} (f : aT -> rT) : injective f -> injective (omap f). Proof. by move=> injf [?|] [?|] //= [/injf->]. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect", "From Corelib Require Export ssrfun", "From mathcomp Require Export ssrnotations" ]
boot/ssrfun.v
inj_omap
omap_id{T : Type} (x : option T) : omap id x = x. Proof. by case: x. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect", "From Corelib Require Export ssrfun", "From mathcomp Require Export ssrnotations" ]
boot/ssrfun.v
omap_id
eq_omap{aT rT : Type} (f g : aT -> rT) : f =1 g -> omap f =1 omap g. Proof. by move=> Ef [?|] //=; rewrite Ef. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect", "From Corelib Require Export ssrfun", "From mathcomp Require Export ssrnotations" ]
boot/ssrfun.v
eq_omap
omapK{aT rT : Type} (f : aT -> rT) (g : rT -> aT) : cancel f g -> cancel (omap f) (omap g). Proof. by move=> fK [?|] //=; rewrite fK. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect", "From Corelib Require Export ssrfun", "From mathcomp Require Export ssrnotations" ]
boot/ssrfun.v
omapK
idempotent_op(S : Type) (op : S -> S -> S) := forall x, op x x = x. #[deprecated(since="mathcomp 2.3.0", note="use `idempotent_op` instead")]
Definition
boot
[ "From mathcomp Require Import ssreflect", "From Corelib Require Export ssrfun", "From mathcomp Require Export ssrnotations" ]
boot/ssrfun.v
idempotent_op
idempotent:= idempotent_op (only parsing).
Notation
boot
[ "From mathcomp Require Import ssreflect", "From Corelib Require Export ssrfun", "From mathcomp Require Export ssrnotations" ]
boot/ssrfun.v
idempotent
idempotent_fun(U : Type) (f : U -> U) := f \o f =1 f.
Definition
boot
[ "From mathcomp Require Import ssreflect", "From Corelib Require Export ssrfun", "From mathcomp Require Export ssrnotations" ]
boot/ssrfun.v
idempotent_fun
inr_inj{A B} : injective (@inr A B). Proof. by move=> ? ? []. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect", "From Corelib Require Export ssrfun", "From mathcomp Require Export ssrnotations" ]
boot/ssrfun.v
inr_inj
inl_inj{A B} : injective (@inl A B). Proof. by move=> ? ? []. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect", "From Corelib Require Export ssrfun", "From mathcomp Require Export ssrnotations" ]
boot/ssrfun.v
inl_inj
taggedK{I : Type} (T_ : I -> Type) (s : {i : I & T_ i}) : Tagged T_ (tagged s) = s. Proof. by case: s. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect", "From Corelib Require Export ssrfun", "From mathcomp Require Export ssrnotations" ]
boot/ssrfun.v
taggedK
swap_pair{T1 T2 : Type} (x : T1 * T2) := (x.2, x.1).
Definition
boot
[ "From mathcomp Require Import ssreflect", "From Corelib Require Export ssrfun", "From mathcomp Require Export ssrnotations" ]
boot/ssrfun.v
swap_pair
swap_pairK{T1 T2 : Type} : @cancel _ (T1 * T2) swap_pair swap_pair. Proof. by case. Qed.
Lemma
boot
[ "From mathcomp Require Import ssreflect", "From Corelib Require Export ssrfun", "From mathcomp Require Export ssrnotations" ]
boot/ssrfun.v
swap_pairK
succn:= Datatypes.S.
Notation
boot
[ "From Corelib Require Import PosDef", "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype" ]
boot/ssrnat.v
succn
predn:= Peano.pred.
Notation
boot
[ "From Corelib Require Import PosDef", "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype" ]
boot/ssrnat.v
predn
succnK: cancel succn predn. Proof. by []. Qed.
Lemma
boot
[ "From Corelib Require Import PosDef", "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype" ]
boot/ssrnat.v
succnK
succn_inj: injective succn. Proof. by move=> n m []. Qed.
Lemma
boot
[ "From Corelib Require Import PosDef", "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype" ]
boot/ssrnat.v
succn_inj
eqnm n {struct m} := match m, n with | 0, 0 => true | m'.+1, n'.+1 => eqn m' n' | _, _ => false end.
Fixpoint
boot
[ "From Corelib Require Import PosDef", "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype" ]
boot/ssrnat.v
eqn
eqnP: Equality.axiom eqn. Proof. move=> n m; apply: (iffP idP) => [|<-]; last by elim n. by elim: n m => [|n IHn] [|m] //= /IHn->. Qed. HB.instance Definition _ := hasDecEq.Build nat eqnP. Arguments eqn !m !n. Arguments eqnP {x y}.
Lemma
boot
[ "From Corelib Require Import PosDef", "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype" ]
boot/ssrnat.v
eqnP
eqnE: eqn = eq_op. Proof. by []. Qed.
Lemma
boot
[ "From Corelib Require Import PosDef", "From HB Require Import structures", "From mathcomp Require Import ssreflect ssrfun ssrbool eqtype" ]
boot/ssrnat.v
eqnE