statement
stringlengths
1
4.15k
proof
stringlengths
0
26.3k
type
stringclasses
26 values
symbolic_name
stringlengths
1
75
library
stringclasses
44 values
filename
stringclasses
463 values
imports
listlengths
0
23
deps
listlengths
0
64
docstring
stringlengths
0
2.4k
source_url
stringclasses
1 value
commit
stringclasses
1 value
square_spec n : square n = n * n.
Proof. reflexivity. Qed.
Lemma
square_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "square" ]
** Square
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Even n
:= exists m, n = 2*m.
Definition
Even
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[]
** Parity
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Odd n
:= exists m, n = 2*m+1.
Definition
Odd
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Even_0 : Even 0.
Proof. exists 0; reflexivity. Qed.
Lemma
Even_0
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Even" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Even_1 : ~ Even 1.
Proof. intros ([|], H); try discriminate. simpl in H. now rewrite <- plus_n_Sm in H. Qed.
Lemma
Even_1
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Even" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Even_2 n : Even n <-> Even (S (S n)).
Proof. split; intros (m,H). - exists (S m). rewrite H; simpl. now rewrite plus_n_Sm. - destruct m as [|m]; try discriminate. exists m. simpl in H; rewrite <- plus_n_Sm in H. now inversion H. Qed.
Lemma
Even_2
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Even", "split" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Odd_0 : ~ Odd 0.
Proof. now intros ([|], H). Qed.
Lemma
Odd_0
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Odd" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Odd_1 : Odd 1.
Proof. exists 0; reflexivity. Qed.
Lemma
Odd_1
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Odd" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Odd_2 n : Odd n <-> Odd (S (S n)).
Proof. split; intros (m,H). - exists (S m). rewrite H. simpl. now rewrite <- (plus_n_Sm m). - destruct m as [|m]; try discriminate. exists m. simpl in H; rewrite <- plus_n_Sm in H. inversion H; simpl. now rewrite <- !plus_n_Sm, <- !plus_n_O. Qed.
Lemma
Odd_2
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Odd", "split" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
even_spec : forall n, even n = true <-> Even n.
Proof. fix even_spec 1. intro n; destruct n as [|[|n]]; simpl. - split; [ intros; apply Even_0 | trivial ]. - split; [ discriminate | intro H; elim (Even_1 H) ]. - rewrite even_spec. apply Even_2. Qed.
Lemma
even_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Even", "Even_0", "Even_1", "Even_2", "even", "split" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
odd_spec : forall n, odd n = true <-> Odd n.
Proof. unfold odd. fix odd_spec 1. intro n; destruct n as [|[|n]]; simpl. - split; [ discriminate | intro H; elim (Odd_0 H) ]. - split; [ intros; apply Odd_1 | trivial ]. - rewrite odd_spec. apply Odd_2. Qed.
Lemma
odd_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Odd", "Odd_0", "Odd_1", "Odd_2", "odd", "split" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
divmod_spec : forall x y q u, u <= y -> let (q',u') := divmod x y q u in x + (S y)*q + (y-u) = (S y)*q' + (y-u') /\ u' <= y.
Proof. intro x; induction x as [|x IHx]. - simpl; intuition. - intros y q u H. destruct u as [|u]; simpl divmod. + generalize (IHx y (S q) y (le_n y)). destruct divmod as (q',u'). intros (EQ,LE); split; trivial. rewrite <- EQ, sub_0_r, sub_diag, add_0_r. now rewrite !add_succ_l, <-...
Lemma
divmod_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_0_r", "add_assoc", "add_succ_l", "add_succ_r", "induction", "le_trans", "mul_succ_r", "split", "sub_0_r", "sub_diag", "sub_succ_l" ]
** Division
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
div_mod_eq x y : x = y*(x/y) + x mod y.
Proof. destruct y as [|y]; [reflexivity | ]. unfold div, modulo. generalize (divmod_spec x y 0 y (le_n y)). destruct divmod as (q,u). intros (U,V). simpl in *. now rewrite mul_0_r, sub_diag, !add_0_r in U. Qed.
Lemma
div_mod_eq
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_0_r", "div", "divmod_spec", "mod", "modulo", "mul_0_r", "sub_diag" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
div_mod x y : y <> 0 -> x = y*(x/y) + x mod y.
Proof. intros _; apply div_mod_eq. Qed.
Lemma
div_mod
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "div_mod_eq", "mod" ]
The [y <> 0] hypothesis is needed to fit in [NAxiomsSig].
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
mod_bound_pos x y : 0<=x -> 0<y -> 0 <= x mod y < y.
Proof. intros Hx Hy. split. - apply le_0_l. - destruct y; [ now elim Hy | clear Hy ]. unfold modulo. apply lt_succ_r, le_sub_l. Qed.
Lemma
mod_bound_pos
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "le_0_l", "le_sub_l", "lt_succ_r", "mod", "modulo", "split" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
sqrt_iter_spec : forall k p q r, q = p+p -> r<=q -> let s := sqrt_iter k p q r in s*s <= k + p*p + (q - r) < (S s)*(S s).
Proof. intro k; induction k as [|k IHk]. - (* k = 0 *) simpl; intros p q r Hq Hr. split. + apply le_add_r. + apply lt_succ_r. rewrite mul_succ_r, add_assoc, (add_comm p), <- add_assoc. apply add_le_mono_l. rewrite <- Hq. apply le_sub_l. - (* k = S k' *) intros p q r; de...
Lemma
sqrt_iter_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_0_r", "add_assoc", "add_comm", "add_le_mono_l", "add_succ_r", "induction", "le_add_r", "le_sub_l", "le_trans", "lt_succ_r", "mul_succ_r", "replace", "split", "sub_0_r", "sub_diag", "sub_succ_l" ]
** Square root
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
sqrt_specif n : (sqrt n)*(sqrt n) <= n < S (sqrt n) * S (sqrt n).
Proof. set (s:=sqrt n). replace n with (n + 0*0 + (0-0)). - apply sqrt_iter_spec; auto. - simpl. now rewrite !add_0_r. Qed.
Lemma
sqrt_specif
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_0_r", "replace", "set", "sqrt", "sqrt_iter_spec" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
sqrt_spec a (Ha:0<=a)
:= sqrt_specif a.
Definition
sqrt_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "sqrt_specif" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
sqrt_neg a : a<0 -> sqrt a = 0.
Proof. inversion 1. Qed.
Lemma
sqrt_neg
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "sqrt" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
log2_iter_spec : forall k p q r, 2^(S p) = q + S r -> r < 2^p -> let s := log2_iter k p q r in 2^s <= k + q < 2^(S s).
Proof. intro k; induction k as [|k IHk]. - (* k = 0 *) intros p q r EQ LT. simpl log2_iter; cbv zeta. split. + rewrite add_0_l, (add_le_mono_l _ _ (2^p)). simpl pow in EQ. rewrite add_0_r in EQ; rewrite EQ, add_comm. apply add_le_mono_r, LT. + rewrite EQ, add_comm. apply ...
Lemma
log2_iter_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_0_l", "add_0_r", "add_comm", "add_le_mono_l", "add_le_mono_r", "add_lt_mono_l", "add_succ_l", "add_succ_r", "induction", "le_0_l", "le_lt_trans", "lt_succ_r", "pow", "split" ]
** Logarithm
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
log2_spec n : 0<n -> 2^(log2 n) <= n < 2^(S (log2 n)).
Proof. intros. set (s:=log2 n). replace n with (pred n + 1). - apply log2_iter_spec; auto. - rewrite add_1_r. apply succ_pred. now apply neq_sym, lt_neq. Qed.
Lemma
log2_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_1_r", "log2", "log2_iter_spec", "lt_neq", "neq_sym", "pred", "replace", "set", "succ_pred" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
log2_nonpos n : n<=0 -> log2 n = 0.
Proof. inversion 1; now subst. Qed.
Lemma
log2_nonpos
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "log2" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
iter_swap_gen A B (f:A -> B) (g:A -> A) (h:B -> B) : (forall a, f (g a) = h (f a)) -> forall n a, f (iter n g a) = iter n h (f a).
Proof. intros H n a. induction n as [|n Hn]. - reflexivity. - simpl. rewrite H, Hn. reflexivity. Qed.
Lemma
iter_swap_gen
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "induction", "iter" ]
** Properties of [iter]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
iter_swap : forall n (A:Type) (f:A -> A) (x:A), iter n f (f x) = f (iter n f x).
Proof. intros. symmetry. now apply iter_swap_gen. Qed.
Lemma
iter_swap
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "iter", "iter_swap_gen" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
iter_succ : forall n (A:Type) (f:A -> A) (x:A), iter (S n) f x = f (iter n f x).
Proof. reflexivity. Qed.
Lemma
iter_succ
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "iter" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
iter_succ_r : forall n (A:Type) (f:A -> A) (x:A), iter (S n) f x = iter n f (f x).
Proof. intros; now rewrite iter_succ, iter_swap. Qed.
Lemma
iter_succ_r
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "iter", "iter_succ", "iter_swap" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
iter_add : forall p q (A:Type) (f:A -> A) (x:A), iter (p+q) f x = iter p f (iter q f x).
Proof. intro p. induction p as [|p IHp]. - reflexivity. - intros q A f x. simpl. now rewrite IHp. Qed.
Lemma
iter_add
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "induction", "iter" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
iter_ind (A:Type) (f:A -> A) (a:A) (P:nat -> A -> Prop) : P 0 a -> (forall n a', P n a' -> P (S n) (f a')) -> forall n, P n (iter n f a).
Proof. intros H0 HS n. induction n as [|n Hn]. - exact H0. - apply HS. exact Hn. Qed.
Lemma
iter_ind
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "induction", "iter" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
iter_rect (A:Type) (f:A -> A) (a:A) (P:nat -> A -> Type) : P 0 a -> (forall n a', P n a' -> P (S n) (f a')) -> forall n, P n (iter n f a).
Proof. intros H0 HS n. induction n as [|n Hn]. - exact H0. - apply HS. exact Hn. Defined.
Lemma
iter_rect
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "induction", "iter" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
iter_invariant : forall (n:nat) (A:Type) (f:A -> A) (Inv:A -> Prop), (forall x:A, Inv x -> Inv (f x)) -> forall x:A, Inv x -> Inv (iter n f x).
Proof. intros; apply iter_ind; trivial. Qed.
Lemma
iter_invariant
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "iter", "iter_ind" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
divide x y
:= exists z, y=z*x.
Definition
divide
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[]
** Gcd
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
"( x | y )"
:= (divide x y) (at level 0) : nat_scope.
Notation
( x | y )
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "divide" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
gcd_divide : forall a b, (gcd a b | a) /\ (gcd a b | b).
Proof. fix gcd_divide 1. intros [|a] b; simpl. - split. + now exists 0. + exists 1; simpl. now rewrite <- plus_n_O. - fold (b mod (S a)). destruct (gcd_divide (b mod (S a)) (S a)) as (H,H'). set (a':=S a) in *. split; auto. rewrite (div_mod_eq b a') at 2. ...
Lemma
gcd_divide
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "div_mod_eq", "fold", "gcd", "mod", "mul_add_distr_r", "mul_assoc", "mul_comm", "set", "split" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
gcd_divide_l : forall a b, (gcd a b | a).
Proof. apply gcd_divide. Qed.
Lemma
gcd_divide_l
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "gcd", "gcd_divide" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
gcd_divide_r : forall a b, (gcd a b | b).
Proof. apply gcd_divide. Qed.
Lemma
gcd_divide_r
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "gcd", "gcd_divide" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
gcd_greatest : forall a b c, (c|a) -> (c|b) -> (c|gcd a b).
Proof. fix gcd_greatest 1. intros [|a] b; simpl; auto. fold (b mod (S a)). intros c H H'. apply gcd_greatest; auto. set (a':=S a) in *. rewrite (div_mod_eq b a') in H'. destruct H as (u,Hu), H' as (v,Hv). exists (v - (b/a')*u). rewrite mul_comm in Hv. rewrite mul_sub_distr_r, <...
Lemma
gcd_greatest
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_comm", "add_sub", "div_mod_eq", "fold", "gcd", "mod", "mul_assoc", "mul_comm", "mul_sub_distr_r", "set" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
gcd_nonneg a b : 0<=gcd a b.
Proof. apply le_0_l. Qed.
Lemma
gcd_nonneg
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "gcd", "le_0_l" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
double_S : forall n, double (S n) = S (S (double n))
:= fun n => add_succ_r (S n) n.
Definition
double_S
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_succ_r", "double" ]
** Bitwise operations
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
double_add : forall n m, double (n + m) = double n + double m
:= fun n m => add_shuffle1 n m n m.
Definition
double_add
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_shuffle1", "double" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
double_twice : forall n, double n = 2*n.
Proof. simpl; intros; now rewrite add_0_r. Qed.
Lemma
double_twice
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_0_r", "double" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_odd_0 : forall a : nat, testbit (add (mul 2 a) 1) 0 = true.
Parameter
testbit_odd_0
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add", "mul", "testbit" ]
needed to implement Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_even_0 : forall a : nat, testbit (mul 2 a) 0 = false.
Parameter
testbit_even_0
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "mul", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_odd_succ : forall a n : nat, le 0 n -> testbit (add (mul 2 a) 1) (succ n) = testbit a n.
Parameter
testbit_odd_succ
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add", "le", "mul", "succ", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_even_succ : forall a n : nat, le 0 n -> testbit (mul 2 a) (succ n) = testbit a n.
Parameter
testbit_even_succ
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "le", "mul", "succ", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_neg_r : forall a n : nat, lt n 0 -> testbit a n = false.
Parameter
testbit_neg_r
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "lt", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
shiftr_spec : forall a n m : nat, le 0 m -> testbit (shiftr a n) m = testbit a (add m n).
Parameter
shiftr_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add", "le", "shiftr", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
shiftl_spec_high : forall a n m : nat, le 0 m -> le n m -> testbit (shiftl a n) m = testbit a (sub m n).
Parameter
shiftl_spec_high
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "le", "shiftl", "sub", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
shiftl_spec_low : forall a n m : nat, lt m n -> testbit (shiftl a n) m = false.
Parameter
shiftl_spec_low
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "lt", "shiftl", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
land_spec : forall a b n : nat, testbit (land a b) n = testbit a n && testbit b n.
Parameter
land_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "land", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
lor_spec : forall a b n : nat, testbit (lor a b) n = testbit a n || testbit b n.
Parameter
lor_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "lor", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
ldiff_spec : forall a b n : nat, testbit (ldiff a b) n = testbit a n && negb (testbit b n).
Parameter
ldiff_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "ldiff", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
lxor_spec : forall a b n : nat, testbit (lxor a b) n = xorb (testbit a n) (testbit b n).
Parameter
lxor_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "lxor", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
div2_spec : forall a : nat, eq (div2 a) (shiftr a 1).
Parameter
div2_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "div2", "eq", "shiftr" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
div2_double : forall n, div2 (2*n) = n.
Parameter
div2_double
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "div2" ]
not yet generalized to Numbers.Natural.Abstract
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
div2_succ_double : forall n, div2 (S (2*n)) = n.
Parameter
div2_succ_double
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "div2" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
div2_bitwise : forall op n a b, div2 (bitwise op (S n) a b) = bitwise op n (div2 a) (div2 b).
Parameter
div2_bitwise
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "bitwise", "div2" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
odd_bitwise : forall op n a b, odd (bitwise op (S n) a b) = op (odd a) (odd b).
Parameter
odd_bitwise
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "bitwise", "odd" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_bitwise_1 : forall op, (forall b, op false b = false) -> forall n m a b, a<=n -> testbit (bitwise op n a b) m = op (testbit a m) (testbit b m).
Parameter
testbit_bitwise_1
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "bitwise", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_bitwise_2 : forall op, op false false = false -> forall n m a b, a<=n -> b<=n -> testbit (bitwise op n a b) m = op (testbit a m) (testbit b m).
Parameter
testbit_bitwise_2
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "bitwise", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
div2_double n : div2 (2*n) = n.
Proof. induction n; trivial. simpl mul. rewrite add_succ_r; simpl. now f_equal. Qed.
Lemma
div2_double
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_succ_r", "div2", "induction", "mul" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
div2_succ_double n : div2 (S (2*n)) = n.
Proof. induction n; trivial. simpl; f_equal. now rewrite add_succ_r. Qed.
Lemma
div2_succ_double
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_succ_r", "div2", "induction" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
le_div2 n : div2 (S n) <= n.
Proof. revert n. fix le_div2 1. intro n; destruct n as [|n]; simpl; trivial. apply lt_succ_r. destruct n; [simpl|]; trivial. now constructor. Qed.
Lemma
le_div2
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "div2", "lt_succ_r" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
lt_div2 n : 0 < n -> div2 n < n.
Proof. destruct n. - inversion 1. - intros _; apply lt_succ_r, le_div2. Qed.
Lemma
lt_div2
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "div2", "le_div2", "lt_succ_r" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
div2_decr a n : a <= S n -> div2 a <= n.
Proof. destruct a as [|a]; intros H. - simpl; apply le_0_l. - apply succ_le_mono in H. apply le_trans with a; [ apply le_div2 | trivial ]. Qed.
Lemma
div2_decr
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "div2", "le_0_l", "le_div2", "le_trans", "succ_le_mono" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_0_l : forall n, testbit 0 n = false.
Proof. now intro n; induction n. Qed.
Lemma
testbit_0_l
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "induction", "testbit" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_odd_0 a : testbit (2*a+1) 0 = true.
Proof. unfold testbit; rewrite odd_spec; now exists a. Qed.
Lemma
testbit_odd_0
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "odd_spec", "testbit" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_even_0 a : testbit (2*a) 0 = false.
Proof. unfold testbit, odd. rewrite (proj2 (even_spec _)); trivial. now exists a. Qed.
Lemma
testbit_even_0
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "even_spec", "odd", "testbit" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_odd_succ' a n : testbit (2*a+1) (S n) = testbit a n.
Proof. unfold testbit; fold testbit. rewrite add_1_r; f_equal. apply div2_succ_double. Qed.
Lemma
testbit_odd_succ'
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_1_r", "div2_succ_double", "fold", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_even_succ' a n : testbit (2*a) (S n) = testbit a n.
Proof. unfold testbit; fold testbit; f_equal; apply div2_double. Qed.
Lemma
testbit_even_succ'
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "div2_double", "fold", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
shiftr_specif : forall a n m, testbit (shiftr a n) m = testbit a (m+n).
Proof. intros a n; induction n as [|n IHn]; intros m. - now rewrite add_0_r. - now rewrite add_succ_r, <- add_succ_l, <- IHn. Qed.
Lemma
shiftr_specif
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_0_r", "add_succ_l", "add_succ_r", "induction", "shiftr", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
shiftl_specif_high : forall a n m, n<=m -> testbit (shiftl a n) m = testbit a (m-n).
Proof. intros a n; induction n as [|n IHn]; intros m H; [ trivial | ]. - now rewrite sub_0_r. - destruct m; [ inversion H | ]. simpl; apply succ_le_mono in H. change (shiftl a (S n)) with (double (shiftl a n)). rewrite double_twice, div2_double. now apply IHn. Qed.
Lemma
shiftl_specif_high
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "div2_double", "double", "double_twice", "induction", "shiftl", "sub_0_r", "succ_le_mono", "testbit" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
shiftl_spec_low : forall a n m, m<n -> testbit (shiftl a n) m = false.
Proof. intros a n; induction n as [|n IHn]; intros m H; [ inversion H | ]. change (shiftl a (S n)) with (double (shiftl a n)). destruct m; simpl. - unfold odd; apply negb_false_iff. apply even_spec. exists (shiftl a n). apply double_twice. - rewrite double_twice, div2_double. apply IHn. no...
Lemma
shiftl_spec_low
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "div2_double", "double", "double_twice", "even_spec", "induction", "negb_false_iff", "odd", "shiftl", "succ_le_mono", "testbit" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
div2_bitwise : forall op n a b, div2 (bitwise op (S n) a b) = bitwise op n (div2 a) (div2 b).
Proof. intros op n a b; unfold bitwise; fold bitwise. destruct (op (odd a) (odd b)). - now rewrite div2_succ_double. - now rewrite add_0_l, div2_double. Qed.
Lemma
div2_bitwise
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_0_l", "bitwise", "div2", "div2_double", "div2_succ_double", "fold", "odd" ]
not yet generalized, part of the interface at this point
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
odd_bitwise : forall op n a b, odd (bitwise op (S n) a b) = op (odd a) (odd b).
Proof. intros op n a b; unfold bitwise; fold bitwise. destruct (op (odd a) (odd b)). - apply odd_spec. rewrite add_comm; eexists; eauto. - unfold odd; apply negb_false_iff. apply even_spec. rewrite add_0_l; eexists; eauto. Qed.
Lemma
odd_bitwise
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_0_l", "add_comm", "bitwise", "even_spec", "fold", "negb_false_iff", "odd", "odd_spec" ]
not yet generalized, part of the interface at this point
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_bitwise_1 : forall op, (forall b, op false b = false) -> forall n m a b, a<=n -> testbit (bitwise op n a b) m = op (testbit a m) (testbit b m).
Proof. intros op Hop. intro n; induction n as [|n IHn]; intros m a b Ha. - simpl; inversion Ha; subst. now rewrite testbit_0_l. - destruct m. + apply odd_bitwise. + unfold testbit; fold testbit; rewrite div2_bitwise. apply IHn; now apply div2_decr. Qed.
Lemma
testbit_bitwise_1
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "bitwise", "div2_bitwise", "div2_decr", "fold", "induction", "odd_bitwise", "testbit", "testbit_0_l" ]
not yet generalized, part of the interface at this point
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_bitwise_2 : forall op, op false false = false -> forall n m a b, a<=n -> b<=n -> testbit (bitwise op n a b) m = op (testbit a m) (testbit b m).
Proof. intros op Hop. intro n; induction n as [|n IHn]; intros m a b Ha Hb. - simpl; inversion Ha; inversion Hb; subst. now rewrite testbit_0_l. - destruct m. + apply odd_bitwise. + unfold testbit; fold testbit; rewrite div2_bitwise. apply IHn; now apply div2_decr. Qed.
Lemma
testbit_bitwise_2
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "bitwise", "div2_bitwise", "div2_decr", "fold", "induction", "odd_bitwise", "testbit", "testbit_0_l" ]
not yet generalized, part of the interface at this point
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
land_spec a b n : testbit (land a b) n = testbit a n && testbit b n.
Proof. unfold land; apply testbit_bitwise_1; trivial. Qed.
Lemma
land_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "land", "testbit", "testbit_bitwise_1" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
ldiff_spec a b n : testbit (ldiff a b) n = testbit a n && negb (testbit b n).
Proof. unfold ldiff; apply testbit_bitwise_1; trivial. Qed.
Lemma
ldiff_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "ldiff", "testbit", "testbit_bitwise_1" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
lor_spec a b n : testbit (lor a b) n = testbit a n || testbit b n.
Proof. unfold lor; apply testbit_bitwise_2. - trivial. - destruct (compare_spec a b) as [H|H|H]. + rewrite max_l; subst; trivial. + now apply lt_le_incl in H; rewrite max_r. + now apply lt_le_incl in H; rewrite max_l. - destruct (compare_spec a b) as [H|H|H]. + rewrite max_r; subst; trivial. ...
Lemma
lor_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "compare_spec", "lor", "lt_le_incl", "max_l", "max_r", "testbit", "testbit_bitwise_2" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
lxor_spec a b n : testbit (lxor a b) n = xorb (testbit a n) (testbit b n).
Proof. unfold lxor; apply testbit_bitwise_2. - trivial. - destruct (compare_spec a b) as [H|H|H]. + rewrite max_l; subst; trivial. + now apply lt_le_incl in H; rewrite max_r. + now apply lt_le_incl in H; rewrite max_l. - destruct (compare_spec a b) as [H|H|H]. + rewrite max_r; subst; trivial. ...
Lemma
lxor_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "compare_spec", "lt_le_incl", "lxor", "max_l", "max_r", "testbit", "testbit_bitwise_2" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
div2_spec a : div2 a = shiftr a 1.
Proof. reflexivity. Qed.
Lemma
div2_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "div2", "shiftr" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_odd_succ a n (_:0<=n)
:= testbit_odd_succ' a n.
Definition
testbit_odd_succ
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "testbit_odd_succ'" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_even_succ a n (_:0<=n)
:= testbit_even_succ' a n.
Definition
testbit_even_succ
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "testbit_even_succ'" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
testbit_neg_r a n (H:n<0) : testbit a n = false.
Proof. inversion H. Qed.
Lemma
testbit_neg_r
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "testbit" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
shiftl_spec_high a n m (_:0<=m)
:= shiftl_specif_high a n m.
Definition
shiftl_spec_high
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "shiftl_specif_high" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
shiftr_spec a n m (_:0<=m)
:= shiftr_specif a n m.
Definition
shiftr_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "shiftr_specif" ]
needed to implement Stdlib.Numbers.NatInt.NZBitsSpec
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
div_0_r a : a / 0 = 0.
Proof. reflexivity. Qed.
Lemma
div_0_r
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
mod_0_r a : a mod 0 = a.
Proof. reflexivity. Qed.
Lemma
mod_0_r
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "mod" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
binary_induction (A : nat -> Prop) : A 0 -> (forall n, A n -> A (2 * n)) -> (forall n, A n -> A (2 * n + 1)) -> forall n, A n.
Proof. apply Private_binary_induction; intros x y ->; reflexivity. Qed.
Lemma
binary_induction
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Private_binary_induction" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
tail_add_spec n m : tail_add n m = n + m.
Proof. revert m; induction n as [|n IH]; simpl; trivial; intros. now rewrite IH, add_succ_r. Qed.
Lemma
tail_add_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_succ_r", "induction" ]
Properties of tail-recursive addition and multiplication
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
tail_addmul_spec r n m : tail_addmul r n m = r + n * m.
Proof. revert m r; induction n as [| n IH]; simpl; trivial; intros. rewrite IH, tail_add_spec. rewrite add_assoc. f_equal; apply add_comm. Qed.
Lemma
tail_addmul_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "add_assoc", "add_comm", "induction", "tail_add_spec" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
tail_mul_spec n m : tail_mul n m = n * m.
Proof. unfold tail_mul; now rewrite tail_addmul_spec. Qed.
Lemma
tail_mul_spec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "tail_addmul_spec" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Even_Odd_dec n : {Even n} + {Odd n}.
Proof. induction n as [|n IHn]. - left; apply Even_0. - elim IHn; intros. + right; apply Even_succ, Even_succ_succ; assumption. + left; apply Odd_succ, Odd_succ_succ; assumption. Defined.
Definition
Even_Odd_dec
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Even", "Even_0", "Even_succ", "Even_succ_succ", "Odd", "Odd_succ", "Odd_succ_succ", "induction", "left", "right" ]
Additional results about [Even] and [Odd]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Even_add_split n m : Even (n + m) -> Even n /\ Even m \/ Odd n /\ Odd m.
Proof. rewrite <- ? even_spec, <- ? odd_spec, even_add; unfold odd; do 2 destruct even; auto. Qed.
Lemma
Even_add_split
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Even", "Odd", "even", "even_add", "even_spec", "odd", "odd_spec" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Odd_add_split n m : Odd (n + m) -> Odd n /\ Even m \/ Even n /\ Odd m.
Proof. rewrite <- ? even_spec, <- ? odd_spec, odd_add; unfold odd; do 2 destruct even; auto. Qed.
Lemma
Odd_add_split
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Even", "Odd", "even", "even_spec", "odd", "odd_add", "odd_spec" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Even_Even_add n m: Even n -> Even m -> Even (n + m).
Proof. rewrite <- ? even_spec, even_add; do 2 destruct even; auto. Qed.
Lemma
Even_Even_add
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Even", "even", "even_add", "even_spec" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Odd_add_l n m : Odd n -> Even m -> Odd (n + m).
Proof. rewrite <- ? even_spec, <- ? odd_spec, odd_add; unfold odd; do 2 destruct even; auto. Qed.
Lemma
Odd_add_l
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Even", "Odd", "even", "even_spec", "odd", "odd_add", "odd_spec" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Odd_add_r n m : Even n -> Odd m -> Odd (n + m).
Proof. rewrite <- ? even_spec, <- ? odd_spec, odd_add; unfold odd; do 2 destruct even; auto. Qed.
Lemma
Odd_add_r
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Even", "Odd", "even", "even_spec", "odd", "odd_add", "odd_spec" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Odd_Odd_add n m : Odd n -> Odd m -> Even (n + m).
Proof. rewrite <- ? even_spec, <- ? odd_spec, even_add; unfold odd; do 2 destruct even; auto. Qed.
Lemma
Odd_Odd_add
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Even", "Odd", "even", "even_add", "even_spec", "odd", "odd_spec" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36
Even_add_aux n m : (Odd (n + m) <-> Odd n /\ Even m \/ Even n /\ Odd m) /\ (Even (n + m) <-> Even n /\ Even m \/ Odd n /\ Odd m).
Proof. split; split. - apply Odd_add_split. - intros [[HO HE]|[HE HO]]; [ apply Odd_add_l | apply Odd_add_r ]; assumption. - apply Even_add_split. - intros [[HO HE]|[HE HO]]; [ apply Even_Even_add | apply Odd_Odd_add ]; assumption. Qed.
Lemma
Even_add_aux
Arith
theories/Arith/PeanoNat.v
[ "Stdlib", "NAxioms", "NProperties", "OrdersFacts", "DecidableClass", "Private_Parity" ]
[ "Even", "Even_Even_add", "Even_add_split", "Odd", "Odd_Odd_add", "Odd_add_l", "Odd_add_r", "Odd_add_split", "split" ]
https://github.com/rocq-prover/stdlib
f76a666b0b2c28c671d4fdf6dd25bcab865b9c36