Dataset Viewer
Auto-converted to Parquet Duplicate
fact
stringlengths
15
40.2k
statement
stringlengths
1
5.3k
proof
stringlengths
0
34.8k
type
stringclasses
23 values
symbolic_name
stringlengths
0
166
library
stringclasses
14 values
filename
stringclasses
268 values
imports
listlengths
0
57
deps
listlengths
0
63
docstring
stringclasses
641 values
line_start
int64
1
5.25k
line_end
int64
1
5.47k
has_proof
bool
2 classes
source_url
stringclasses
1 value
commit
stringclasses
1 value
Lemma Z__range_add a0 a a1 (Ha: a0 <= a < a1) b0 b b1 (Hb : b0 <= b < b1) : a0+b0 <= a+b < a1 + b1 - 1. Proof. Lia.nia. Qed.
Z__range_add a0 a a1 (Ha: a0 <= a < a1) b0 b b1 (Hb : b0 <= b < b1) : a0+b0 <= a+b < a1 + b1 - 1.
Proof. Lia.nia. Qed.
Lemma
Z__range_add
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "a0" ]
Bounds propagation
9
11
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma Z__range_sub a0 a a1 (Ha: a0 <= a < a1) b0 b b1 (Hb : b0 <= b < b1) : a0-b1+1 <= a-b < a1 - b0. Proof. Lia.nia. Qed.
Z__range_sub a0 a a1 (Ha: a0 <= a < a1) b0 b b1 (Hb : b0 <= b < b1) : a0-b1+1 <= a-b < a1 - b0.
Proof. Lia.nia. Qed.
Lemma
Z__range_sub
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "a0" ]
null
13
15
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma Z__range_div_pos_const_r n0 n n1 (Hn : n0 <= n < n1) d (Hd : 0 < d) : n0/d <= n/d < n1/d + 1. Proof. Z.div_mod_to_equations. Lia.nia. Qed.
Z__range_div_pos_const_r n0 n n1 (Hn : n0 <= n < n1) d (Hd : 0 < d) : n0/d <= n/d < n1/d + 1.
Proof. Z.div_mod_to_equations. Lia.nia. Qed.
Lemma
Z__range_div_pos_const_r
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Z", "n1" ]
null
16
18
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma Z__range_mul_nonneg a0 a a1 (Ha: a0 <= a < a1) b0 b b1 (Hb : b0 <= b < b1) (Ha0 : 0 <= a0) (Hb0 : 0 <= b0) : a0*b0 <= a*b < (a1-1)*(b1-1) + 1. Proof. Lia.nia. Qed.
Z__range_mul_nonneg a0 a a1 (Ha: a0 <= a < a1) b0 b b1 (Hb : b0 <= b < b1) (Ha0 : 0 <= a0) (Hb0 : 0 <= b0) : a0*b0 <= a*b < (a1-1)*(b1-1) + 1.
Proof. Lia.nia. Qed.
Lemma
Z__range_mul_nonneg
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "a0" ]
null
19
21
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma boundscheck {x0 x x1} (H: x0 <= x < x1) {X0 X1} (Hcheck : andb (X0 <=? x0) (x1 <=? X1) = true) : X0 <= x < X1. Proof. eapply andb_prop in Hcheck; case Hcheck; intros H1 H2; eapply Z.leb_le in H1; eapply Z.leb_le in H2. blia. Qed.
boundscheck {x0 x x1} (H: x0 <= x < x1) {X0 X1} (Hcheck : andb (X0 <=? x0) (x1 <=? X1) = true) : X0 <= x < X1.
Proof. eapply andb_prop in Hcheck; case Hcheck; intros H1 H2; eapply Z.leb_le in H1; eapply Z.leb_le in H2. blia. Qed.
Lemma
boundscheck
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Z", "x1" ]
null
22
23
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma boundscheck_lt {x0 x x1} (H: x0 <= x < x1) {X1} (Hcheck: Z.ltb x1 X1 = true) : x < X1. Proof. eapply Z.ltb_lt in Hcheck. blia. Qed.
boundscheck_lt {x0 x x1} (H: x0 <= x < x1) {X1} (Hcheck: Z.ltb x1 X1 = true) : x < X1.
Proof. eapply Z.ltb_lt in Hcheck. blia. Qed.
Lemma
boundscheck_lt
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Z", "x1" ]
null
24
25
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma bounded_constant c : c <= c < c+1. Proof. blia. Qed.
bounded_constant c : c <= c < c+1.
Proof. blia. Qed.
Lemma
bounded_constant
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[]
null
26
26
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Ltac named_pose_proof pf := let H := fresh in let __ := match constr:(Set) with _ => pose proof pf as H end in H.
named_pose_proof pf
:= let H := fresh in let __ := match constr:(Set) with _ => pose proof pf as H end in H.
Ltac
named_pose_proof
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Set" ]
null
28
31
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Ltac named_pose pf := let H := fresh in let __ := match constr:(Set) with _ => pose pf as H end in H.
named_pose pf
:= let H := fresh in let __ := match constr:(Set) with _ => pose pf as H end in H.
Ltac
named_pose
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Set" ]
null
32
35
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Ltac named_pose_asfresh pf x := let H := fresh x in let __ := match constr:(Set) with _ => pose pf as H end in H.
named_pose_asfresh pf x
:= let H := fresh x in let __ := match constr:(Set) with _ => pose pf as H end in H.
Ltac
named_pose_asfresh
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Set" ]
null
36
39
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Ltac named_pose_asfresh_or_id x n := let y := match constr:(Set) with _ => named_pose_asfresh x n | _ => x end in y.
named_pose_asfresh_or_id x n
:= let y := match constr:(Set) with _ => named_pose_asfresh x n | _ => x end in y.
Ltac
named_pose_asfresh_or_id
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Set", "named_pose_asfresh" ]
null
41
43
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Ltac requireZcst z := lazymatch Coq.setoid_ring.InitialRing.isZcst z with | true => idtac end.
requireZcst z
:= lazymatch Coq.setoid_ring.InitialRing.isZcst z with | true => idtac end.
Ltac
requireZcst
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[]
null
45
48
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Ltac requireZcstExpr e := match e with | Z.pred ?x => requireZcstExpr x | Z.succ ?x => requireZcstExpr x | Z.ones ?x => requireZcstExpr x | Z.opp ?x => requireZcstExpr x | Z.lnot ?x => requireZcstExpr x | Z.log2 ?x => requireZcstExpr x | Z.log2_up ?x => requireZcstExpr x | Z.add ?x ?y => requireZcstEx...
requireZcstExpr e
:= match e with | Z.pred ?x => requireZcstExpr x | Z.succ ?x => requireZcstExpr x | Z.ones ?x => requireZcstExpr x | Z.opp ?x => requireZcstExpr x | Z.lnot ?x => requireZcstExpr x | Z.log2 ?x => requireZcstExpr x | Z.log2_up ?x => requireZcstExpr x | Z.add ?x ?y => requireZcstExpr x; requireZcstExpr y...
Ltac
requireZcstExpr
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Z", "requireZcst" ]
null
49
79
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Ltac zsimp x := match constr:(Set) with | _ => let __ := requireZcstExpr x in let y := eval cbv in x in y | _ => x end.
zsimp x
:= match constr:(Set) with | _ => let __ := requireZcstExpr x in let y := eval cbv in x in y | _ => x end.
Ltac
zsimp
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Set", "eval", "requireZcstExpr" ]
null
81
85
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Local Notation "zbsimp! H" := (ltac:( lazymatch type of H with ?L <= ?X < ?R => let L := zsimp L in let R := zsimp R in exact ((H : L <= X < R)) end )) (at level 10, only parsing).
"zbsimp! H"
:= (ltac:( lazymatch type of H with ?L <= ?X < ?R => let L := zsimp L in let R := zsimp R in exact ((H : L <= X < R)) end )) (at level 10, only parsing).
Notation
zbsimp! H
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Notation", "R", "zsimp" ]
null
87
95
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Ltac rbounded e := let re := rdelta e in match goal with | H : _ <= e < _ |- _ => H | _ => match re with | word.unsigned ?a => named_pose_proof (zbsimp! (Properties.word.unsigned_range a : _ <= e < _)) | Z.div ?a ?b => (* TODO: non-constant denominator? *) let __ := match constr:(Set) w...
rbounded e
:= let re := rdelta e in match goal with | H : _ <= e < _ |- _ => H | _ => match re with | word.unsigned ?a => named_pose_proof (zbsimp! (Properties.word.unsigned_range a : _ <= e < _)) | Z.div ?a ?b => (* TODO: non-constant denominator? *) let __ := match constr:(Set) with _ => require...
Ltac
rbounded
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Set", "TODO", "Z", "Z__range_add", "Z__range_div_pos_const_r", "Z__range_mul_nonneg", "Z__range_sub", "a0", "bounded_constant", "goal", "named_pose_proof", "requireZcstExpr", "word" ]
null
97
130
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition absint_eq {T} := @eq T.
absint_eq {T}
:= @eq T.
Definition
absint_eq
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[]
Abstract interpretation
134
134
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition absint_eq_refl {T} v := ((@eq_refl T v) : @absint_eq T v v).
absint_eq_refl {T} v
:= ((@eq_refl T v) : @absint_eq T v v).
Definition
absint_eq_refl
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "absint_eq" ]
null
135
135
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Local Notation "absint_lemma! pf" := (ltac:( cbv [absint_eq] in *; etransitivity; [ eapply pf | ]; cycle -1; [unshelve (repeat match goal with | |- _ => progress unfold word.wrap in * | |-context [Z.shiftr ?x (word.unsigned ?y)] => assert_fails(is_evar x||is_evar y); ...
"absint_lemma! pf"
:= (ltac:( cbv [absint_eq] in *; etransitivity; [ eapply pf | ]; cycle -1; [unshelve (repeat match goal with | |- _ => progress unfold word.wrap in * | |-context [Z.shiftr ?x (word.unsigned ?y)] => assert_fails(is_evar x||is_evar y); setoid_rewrite (Z.shiftr_div_pow2 ...
Notation
absint_lemma! pf
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Notation", "P", "Z", "absint_eq", "goal", "word" ]
null
141
161
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition absint_add (x y : word.rep) ux Hx uy Hy Hbounds : _ =~> _ := absint_lemma! (word.unsigned_add x y).
absint_add (x y : word.rep) ux Hx uy Hy Hbounds : _ =~> _
:= absint_lemma! (word.unsigned_add x y).
Definition
absint_add
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "word" ]
null
163
164
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition absint_sub (x y : word.rep) ux Hx uy Hy Hbounds : word.unsigned _ =~> _ := absint_lemma! (word.unsigned_sub x y).
absint_sub (x y : word.rep) ux Hx uy Hy Hbounds : word.unsigned _ =~> _
:= absint_lemma! (word.unsigned_sub x y).
Definition
absint_sub
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "word" ]
null
165
166
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition absint_mul (x y : word.rep) ux Hx uy Hy Hbounds : word.unsigned _ =~> _ := absint_lemma! (word.unsigned_mul x y).
absint_mul (x y : word.rep) ux Hx uy Hy Hbounds : word.unsigned _ =~> _
:= absint_lemma! (word.unsigned_mul x y).
Definition
absint_mul
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "word" ]
null
167
168
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition absint_and (x y : word.rep) ux Hx uy Hy : word.unsigned _ =~> _ := absint_lemma! (Properties.word.unsigned_and_nowrap x y).
absint_and (x y : word.rep) ux Hx uy Hy : word.unsigned _ =~> _
:= absint_lemma! (Properties.word.unsigned_and_nowrap x y).
Definition
absint_and
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "word" ]
null
169
170
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition absint_or (x y : word.rep) ux Hx uy Hy : word.unsigned _ =~> _ := absint_lemma! (Properties.word.unsigned_or_nowrap x y).
absint_or (x y : word.rep) ux Hx uy Hy : word.unsigned _ =~> _
:= absint_lemma! (Properties.word.unsigned_or_nowrap x y).
Definition
absint_or
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "word" ]
null
171
172
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition absint_xor (x y : word.rep) ux Hx uy Hy : word.unsigned _ =~> _ := absint_lemma! (Properties.word.unsigned_xor_nowrap x y).
absint_xor (x y : word.rep) ux Hx uy Hy : word.unsigned _ =~> _
:= absint_lemma! (Properties.word.unsigned_xor_nowrap x y).
Definition
absint_xor
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "word" ]
null
173
174
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition absint_ndn (x y : word.rep) ux Hx uy Hy : word.unsigned _ =~> _ := absint_lemma! (Properties.word.unsigned_ndn_nowrap x y).
absint_ndn (x y : word.rep) ux Hx uy Hy : word.unsigned _ =~> _
:= absint_lemma! (Properties.word.unsigned_ndn_nowrap x y).
Definition
absint_ndn
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "word" ]
null
175
176
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition absint_sru (x y : word.rep) ux Hx uy Hy Hshift : word.unsigned _ =~> _ := absint_lemma! (Properties.word.unsigned_sru_nowrap x y).
absint_sru (x y : word.rep) ux Hx uy Hy Hshift : word.unsigned _ =~> _
:= absint_lemma! (Properties.word.unsigned_sru_nowrap x y).
Definition
absint_sru
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "word" ]
null
177
178
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition absint_slu (x y : word.rep) ux Hx uy Hy Hrange Hshift : word.unsigned _ =~> _ := absint_lemma! (word.unsigned_slu x y).
absint_slu (x y : word.rep) ux Hx uy Hy Hrange Hshift : word.unsigned _ =~> _
:= absint_lemma! (word.unsigned_slu x y).
Definition
absint_slu
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "word" ]
null
179
180
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition absint_divu (x y : word.rep) ux Hx uy Hy Hnz : word.unsigned _ =~> _ := absint_lemma! (Properties.word.unsigned_divu_nowrap x y).
absint_divu (x y : word.rep) ux Hx uy Hy Hnz : word.unsigned _ =~> _
:= absint_lemma! (Properties.word.unsigned_divu_nowrap x y).
Definition
absint_divu
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "word" ]
null
181
182
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition absint_modu (x y : word.rep) ux Hx uy Hy Hnz : word.unsigned _ =~> _ := absint_lemma! (Properties.word.unsigned_modu_nowrap x y).
absint_modu (x y : word.rep) ux Hx uy Hy Hnz : word.unsigned _ =~> _
:= absint_lemma! (Properties.word.unsigned_modu_nowrap x y).
Definition
absint_modu
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "word" ]
null
183
184
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma absint_opp x (ux: Z) (Hx: word.unsigned x = ux) (Hnz: ux <> 0): word.unsigned (word.opp x) =~> 2^width - ux. Proof. rewrite word.unsigned_opp. cbv [word.wrap]. rewrite Z_mod_nz_opp_full. - rewrite Z.mod_small; [rewrite Hx; reflexivity|]. apply word.unsigned_range. - rewrite Z.mod...
absint_opp x (ux: Z) (Hx: word.unsigned x = ux) (Hnz: ux <> 0): word.unsigned (word.opp x) =~> 2^width - ux.
Proof. rewrite word.unsigned_opp. cbv [word.wrap]. rewrite Z_mod_nz_opp_full. - rewrite Z.mod_small; [rewrite Hx; reflexivity|]. apply word.unsigned_range. - rewrite Z.mod_small; [rewrite Hx; apply Hnz|]. apply word.unsigned_range. Qed.
Lemma
absint_opp
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Z", "width", "word" ]
TODO use it
187
194
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma absint_mask_r x y ux (Hx : word.unsigned x = ux) uy (Hy : word.unsigned y = uy) (Huy : uy = Z.ones (Z.log2 uy+1)): word.unsigned (word.and x y) =~> Z.modulo ux (uy+1). Proof. etransitivity; [eapply absint_and; eauto|]. rewrite Huy. rewrite Z.land_ones, Z.ones_equiv; repeat (eapply f_e...
absint_mask_r x y ux (Hx : word.unsigned x = ux) uy (Hy : word.unsigned y = uy) (Huy : uy = Z.ones (Z.log2 uy+1)): word.unsigned (word.and x y) =~> Z.modulo ux (uy+1).
Proof. etransitivity; [eapply absint_and; eauto|]. rewrite Huy. rewrite Z.land_ones, Z.ones_equiv; repeat (eapply f_equal2 || blia). enough (Z.log2 0 <= Z.log2 uy) by (change (Z.log2 0) with 0 in *; blia). eapply Z.log2_le_mono; subst uy; eapply word.unsigned_range. Qed.
Lemma
absint_mask_r
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Z", "absint_and", "f_equal2", "word" ]
null
196
204
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma absint_mask_l y x uy (Hy : word.unsigned y = uy) ux (Hx : word.unsigned x = ux) (Huy : uy = Z.ones (Z.log2 uy+1)): word.unsigned (word.and y x) =~> Z.modulo ux (uy+1). Proof. etransitivity; [eapply absint_and; eauto|]. rewrite Z.land_comm. rewrite Huy. rewrite Z.land_ones, Z.one...
absint_mask_l y x uy (Hy : word.unsigned y = uy) ux (Hx : word.unsigned x = ux) (Huy : uy = Z.ones (Z.log2 uy+1)): word.unsigned (word.and y x) =~> Z.modulo ux (uy+1).
Proof. etransitivity; [eapply absint_and; eauto|]. rewrite Z.land_comm. rewrite Huy. rewrite Z.land_ones, Z.ones_equiv; repeat (eapply f_equal2 || blia). enough (Z.log2 0 <= Z.log2 uy) by (change (Z.log2 0) with 0 in *; blia). eapply Z.log2_le_mono; subst uy; eapply word.unsigned_ran...
Lemma
absint_mask_l
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "Z", "absint_and", "f_equal2", "word" ]
null
205
214
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Ltac zify_expr e := let re := rdelta e in lazymatch type of e with | @word.rep ?width ?word_parameters => match re with | _ => match goal with H: word.unsigned e =~> _ |- _ => H end | word.of_Z ?a => let Ba := rbounded a in named_pose_proof (word.unsigned_of_Z_nowrap a (bou...
zify_expr e
:= let re := rdelta e in lazymatch type of e with | @word.rep ?width ?word_parameters => match re with | _ => match goal with H: word.unsigned e =~> _ |- _ => H end | word.of_Z ?a => let Ba := rbounded a in named_pose_proof (word.unsigned_of_Z_nowrap a (boundscheck (X0:=0) ...
Ltac
zify_expr
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "TODO", "Z", "absint_add", "absint_and", "absint_eq", "absint_eq_refl", "absint_mask_l", "absint_mask_r", "absint_mul", "absint_ndn", "absint_or", "absint_slu", "absint_sru", "absint_sub", "absint_xor", "boundscheck", "boundscheck_lt", "goal", "named_pose_asfresh_or_id", "named...
null
217
289
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Fixpoint goal (x : word32) (n : nat) : Prop := match n with | O => True | S n' => let x := word.add x x in goal x n' end.
goal (x : word32) (n : nat) : Prop
:= match n with | O => True | S n' => let x := word.add x x in goal x n' end.
Fixpoint
goal
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "Z.Lia", "Word.Naive" ]
[ "word" ]
null
295
299
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition anyval{word mem T: Type}(p: T -> word -> mem -> Prop)(a: word): mem -> Prop := ex1 (fun v => p v a).
anyval{word mem T: Type}(p: T -> word -> mem -> Prop)(a: word): mem -> Prop
:= ex1 (fun v => p v a).
Definition
anyval
bedrock2.src.bedrock2
bedrock2/src/bedrock2/anyval.v
[ "Lift1Prop" ]
[ "Type", "ex1", "mem", "word" ]
null
3
4
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Notation "p ? a" := (anyval p a) (at level 20, a at level 9).
"p ? a"
:= (anyval p a) (at level 20, a at level 9).
Notation
p ? a
bedrock2.src.bedrock2
bedrock2/src/bedrock2/anyval.v
[ "Lift1Prop" ]
[ "Notation", "anyval" ]
makes __ a keyword, so "let __ := uselessvalue in blah" in Ltac doesn't parse any more! Notation "p '__' a" := (anyval p a) (at level 20, a at level 9). Infix "__" := anyval (at level 20).
12
12
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Fixpoint array (start : word) (xs : list T) := match xs with | nil => emp True | cons x xs => sep (element start x) (array (word.add start size) xs) end.
array (start : word) (xs : list T)
:= match xs with | nil => emp True | cons x xs => sep (element start x) (array (word.add start size) xs) end.
Fixpoint
array
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "start", "word" ]
null
15
19
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma array_cons x xs start: iff1 (array start (x :: xs)) (sep (element start x) (array (word.add start size) xs)). Proof. reflexivity. Qed.
array_cons x xs start: iff1 (array start (x :: xs)) (sep (element start x) (array (word.add start size) xs)).
Proof. reflexivity. Qed.
Lemma
array_cons
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "array", "start", "word" ]
null
23
25
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma array_nil start: iff1 (array start nil) (emp True). Proof. reflexivity. Qed.
array_nil start: iff1 (array start nil) (emp True).
Proof. reflexivity. Qed.
Lemma
array_nil
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "array", "start" ]
null
27
29
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma array_append xs ys start: iff1 (array start (xs ++ ys)) (array start xs * array (word.add start (word.of_Z (word.unsigned size * Z.of_nat (length xs)))) ys).
array_append xs ys start: iff1 (array start (xs ++ ys)) (array start xs * array (word.add start (word.of_Z (word.unsigned size * Z.of_nat (length xs)))) ys).
Lemma
array_append
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "array", "start", "word" ]
null
31
33
false
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma array_append' xs ys start: iff1 (array start (xs ++ ys)) (array start xs * array (word.add start (word.mul size (word.of_Z (Z.of_nat (length xs))))) ys). Proof. etransitivity; [eapply array_append|]. repeat Morphisms.f_equiv. eapply word.unsign...
array_append' xs ys start: iff1 (array start (xs ++ ys)) (array start xs * array (word.add start (word.mul size (word.of_Z (Z.of_nat (length xs))))) ys).
Proof. etransitivity; [eapply array_append|]. repeat Morphisms.f_equiv. eapply word.unsigned_inj. repeat (rewrite ?word.unsigned_of_Z, ?word.unsigned_mul, ?Zdiv.Zmult_mod_idemp_r || unfold word.wrap). reflexivity. Qed.
Lemma
array_append'
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "array", "array_append", "start", "word" ]
null
58
68
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma list__tl_skipn {A} n (xs : list A) : tl (skipn n xs) = skipn (S n) xs. Proof. revert xs; induction n, xs; auto; []; eapply IHn. Qed.
list__tl_skipn {A} n (xs : list A) : tl (skipn n xs) = skipn (S n) xs.
Proof. revert xs; induction n, xs; auto; []; eapply IHn. Qed.
Lemma
list__tl_skipn
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[]
null
70
71
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma array_index_nat xs start n : iff1 (array start xs) ( array start (firstn n xs) * ( match hd_error (skipn n xs) with Some x => element (word.add start (word.of_Z (word.unsigned size*Z.of_nat n))) x | None => emp True end * array (word.add (word.add start (word.of_Z (word.unsigned size*Z.o...
array_index_nat xs start n : iff1 (array start xs) ( array start (firstn n xs) * ( match hd_error (skipn n xs) with Some x => element (word.add start (word.of_Z (word.unsigned size*Z.of_nat n))) x | None => emp True end * array (word.add (word.add start (word.of_Z (word.unsigned size*Z.of_nat ...
Proof. pose proof (firstn_skipn n xs) as H. rewrite <-!list__tl_skipn. remember (firstn n xs) as A in *; remember (skipn n xs) as B in *; rewrite <-H. etransitivity; [eapply array_append|]; eapply iff1_sep_cancel. destruct B; cbn [array hd_error tl]; [solve[cancel]|]. subst A; destruct (Compare_...
Lemma
array_index_nat
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "array", "array_append", "list__tl_skipn", "start", "word" ]
null
73
87
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma array_index_nat_inbounds xs start n (H : (n < length xs)%nat) : iff1 (array start xs) (array start (firstn n xs) * (element (word.add start (word.of_Z (word.unsigned size * Z.of_nat n))) (hd default (skipn n xs)) * array (word.add (word.add start (word.of_Z (word.unsigned size * Z.of_nat ...
array_index_nat_inbounds xs start n (H : (n < length xs)%nat) : iff1 (array start xs) (array start (firstn n xs) * (element (word.add start (word.of_Z (word.unsigned size * Z.of_nat n))) (hd default (skipn n xs)) * array (word.add (word.add start (word.of_Z (word.unsigned size * Z.of_nat n))) s...
Lemma
array_index_nat_inbounds
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "array", "start", "word" ]
null
90
94
false
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma array_address_inbounds xs start a (Hlen : word.unsigned (word.sub a start) < Z.mul (word.unsigned size) (Z.of_nat (length xs))) (Hmod : word.unsigned (word.sub a start) mod (word.unsigned size) = 0) n (Hn : n = Z.to_nat (word.unsigned (word.sub a start) / word.unsigned size)) : iff1 (array start x...
array_address_inbounds xs start a (Hlen : word.unsigned (word.sub a start) < Z.mul (word.unsigned size) (Z.of_nat (length xs))) (Hmod : word.unsigned (word.sub a start) mod (word.unsigned size) = 0) n (Hn : n = Z.to_nat (word.unsigned (word.sub a start) / word.unsigned size)) : iff1 (array start xs) ...
Proof. pose proof word.unsigned_range a. pose proof word.unsigned_range size. pose proof word.unsigned_range (word.sub a start). destruct (Z.eq_dec (word.unsigned size) 0) as [Hz|Hnz]. { rewrite Hz in *. blia. } replace a with (word.add start (word.mul (word.of_Z (Z.of_nat n)) size)); cycle 1. ...
Lemma
array_address_inbounds
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "array", "array_index_nat_inbounds", "start", "word" ]
null
103
135
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Local Coercion Z.of_nat : nat >-> Z.
Z.of_nat : nat >-> Z.
Coercion
Z
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[]
null
142
142
false
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Local Notation "xs $@ a" := (map.of_list_word_at a xs) (at level 10, format "xs $@ a").
"xs $@ a"
:= (map.of_list_word_at a xs) (at level 10, format "xs $@ a").
Notation
xs $@ a
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Notation" ]
null
144
144
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma sep_eq_of_list_word_at_app (a : word) (xs ys : list value) lxs (Hlxs : Z.of_nat (length xs) = lxs) (Htotal : length xs + length ys <= 2^width) : Lift1Prop.iff1 ((xs ++ ys)$@a) (sep (xs$@a) (ys$@(word.add a (word.of_Z lxs)))). Proof. etransitivity. 2: eapply sep_comm. etransitivity. 2: ea...
sep_eq_of_list_word_at_app (a : word) (xs ys : list value) lxs (Hlxs : Z.of_nat (length xs) = lxs) (Htotal : length xs + length ys <= 2^width) : Lift1Prop.iff1 ((xs ++ ys)$@a) (sep (xs$@a) (ys$@(word.add a (word.of_Z lxs)))).
Proof. etransitivity. 2: eapply sep_comm. etransitivity. 2: eapply sep_eq_putmany, map.adjacent_arrays_disjoint_n; trivial. erewrite map.of_list_word_at_app_n by eauto; reflexivity. Qed.
Lemma
sep_eq_of_list_word_at_app
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "sep_eq_putmany", "width", "word" ]
null
149
158
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma list_word_at_app_of_adjacent_eq (a b : word) (xs ys : list value) (Hl: word.unsigned (word.sub b a) = Z.of_nat (length xs)) (Htotal : length xs + length ys <= 2^width) : Lift1Prop.iff1 (xs$@a*ys$@b) ((xs++ys)$@a). Proof. etransitivity. 2:symmetry; eapply sep_eq_of_list_word_at_app; trivial. ...
list_word_at_app_of_adjacent_eq (a b : word) (xs ys : list value) (Hl: word.unsigned (word.sub b a) = Z.of_nat (length xs)) (Htotal : length xs + length ys <= 2^width) : Lift1Prop.iff1 (xs$@a*ys$@b) ((xs++ys)$@a).
Proof. etransitivity. 2:symmetry; eapply sep_eq_of_list_word_at_app; trivial. do 3 Morphisms.f_equiv. rewrite <-Hl, word.of_Z_unsigned. ring. Qed.
Lemma
list_word_at_app_of_adjacent_eq
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "sep_eq_of_list_word_at_app", "width", "word" ]
null
160
168
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma list_word_at_firstn_skipn (p : word) (l : list value) (n : nat) : (length l >= n)%nat -> (length l <= 2^width) -> iff1 (l $@ p) ((firstn n l)$@p * (skipn n l)$@(word.add p (word.of_Z n))). Proof. intros. transitivity ((firstn n l ++ skipn n l) $@ p). { rewrite (firstn_skipn n l). exact (...
list_word_at_firstn_skipn (p : word) (l : list value) (n : nat) : (length l >= n)%nat -> (length l <= 2^width) -> iff1 (l $@ p) ((firstn n l)$@p * (skipn n l)$@(word.add p (word.of_Z n))).
Proof. intros. transitivity ((firstn n l ++ skipn n l) $@ p). { rewrite (firstn_skipn n l). exact (iff1_refl _). } rewrite (map.of_list_word_at_app_n _ _ _ n) by (rewrite ?length_firstn, ?length_skipn; lia). unshelve (epose proof (map.adjacent_arrays_disjoint_n p (firstn n l) (skipn n l) n _ _) as H...
Lemma
list_word_at_firstn_skipn
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "sep_eq_putmany", "width", "word" ]
null
170
183
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma length_array_ptsto_1_le (default : value) bs (a : word) (m : map) (Hm : array ptsto (word.of_Z 1) a bs m) : Z.of_nat (length bs) <= 2 ^ width. Proof. pose proof word.width_pos. destruct (Z.leb_spec (Z.of_nat (length bs)) (2^width)); trivial; exfalso. case (@nth_split _ (Z.to_nat (2^width)) bs defaul...
length_array_ptsto_1_le (default : value) bs (a : word) (m : map) (Hm : array ptsto (word.of_Z 1) a bs m) : Z.of_nat (length bs) <= 2 ^ width.
Proof. pose proof word.width_pos. destruct (Z.leb_spec (Z.of_nat (length bs)) (2^width)); trivial; exfalso. case (@nth_split _ (Z.to_nat (2^width)) bs default ltac:(lia)) as (xs&ys&E&L). rewrite E in Hm;seprewrite_in @array_append Hm. case xs in *; [simpl length in *; lia|]. rewrite word.unsigne...
Lemma
length_array_ptsto_1_le
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "add_0_r", "array", "array_append", "ecancel_assumption", "exfalso", "width", "word" ]
null
185
195
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma array1_iff_eq_of_list_word_at (a : word) (bs : list value) (H : length bs <= 2 ^ width) : iff1 (array ptsto (word.of_Z 1) a bs) (bs$@a).
array1_iff_eq_of_list_word_at (a : word) (bs : list value) (H : length bs <= 2 ^ width) : iff1 (array ptsto (word.of_Z 1) a bs) (bs$@a).
Lemma
array1_iff_eq_of_list_word_at
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "array", "width", "word" ]
null
197
198
false
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma impl1_array : forall T (P Q: word->T->mem->Prop) p a l, (forall a e, impl1 (P a e) (Q a e)) -> impl1 (array P p a l) (array Q p a l). Proof. intros. generalize dependent a; revert p. induction l; cbn [array]; eauto; intros; [reflexivity|]. eapply Proper_sep_impl1; eauto. Qed.
impl1_array : forall T (P Q: word->T->mem->Prop) p a l, (forall a e, impl1 (P a e) (Q a e)) -> impl1 (array P p a l) (array Q p a l).
Proof. intros. generalize dependent a; revert p. induction l; cbn [array]; eauto; intros; [reflexivity|]. eapply Proper_sep_impl1; eauto. Qed.
Lemma
impl1_array
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "P", "Q", "array", "mem", "word" ]
null
229
236
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma impl1_array_with_offset : forall T (P Q: word->T->mem->Prop) sz l a, (forall i e, List.nth_error l i = Some e -> let a' := (word.add a (word.of_Z (Z.of_nat i * sz))) in impl1 (P a' e) (Q a' e)) -> impl1 (array P (word.of_Z sz) a l) (array Q (word.of_Z sz) a l). ...
impl1_array_with_offset : forall T (P Q: word->T->mem->Prop) sz l a, (forall i e, List.nth_error l i = Some e -> let a' := (word.add a (word.of_Z (Z.of_nat i * sz))) in impl1 (P a' e) (Q a' e)) -> impl1 (array P (word.of_Z sz) a l) (array Q (word.of_Z sz) a l).
Proof. induction l; cbn [array]; intros; [reflexivity|]. rename a0 into addr. eapply Proper_sep_impl1. - specialize (H O). cbn in H. specialize (H _ eq_refl). rewrite word.add_0_r in H. exact H. - eapply IHl. cbv zeta. intros. specialize (H (S i)). cbn -[Z.of_nat] in H. specialize (H _ H...
Lemma
impl1_array_with_offset
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "P", "Q", "Z", "a0", "add_0_r", "addr", "array", "mem", "rename", "sz", "word" ]
null
238
255
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma array_map{T U: Type}(elem: word -> T -> mem -> Prop)(f: U -> T) addr vs sz: impl1 (array (fun a x => elem a (f x)) sz addr vs) (array elem sz addr (List.map f vs)). Proof. unfold impl1. revert addr. induction vs; intros. - simpl in *. assumption. - simpl in *. destruct H as (...
array_map{T U: Type}(elem: word -> T -> mem -> Prop)(f: U -> T) addr vs sz: impl1 (array (fun a x => elem a (f x)) sz addr vs) (array elem sz addr (List.map f vs)).
Proof. unfold impl1. revert addr. induction vs; intros. - simpl in *. assumption. - simpl in *. destruct H as (m1 & m2 & D & Hm1 & Hm2). exists m1, m2. eauto. Qed.
Lemma
array_map
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Type", "addr", "array", "mem", "sz", "word" ]
null
257
266
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Local Notation array := (array (mem:=mem) ptsto (word.of_Z 1)).
array
:= (array (mem:=mem) ptsto (word.of_Z 1)).
Notation
array
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Notation", "mem", "word" ]
null
272
272
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma length_bytearray_le bs (a : word) m (Hm : array a bs m) : Z.of_nat (length bs) <= 2 ^ width. Proof. eauto using length_array_ptsto_1_le, Byte.x00. Qed.
length_bytearray_le bs (a : word) m (Hm : array a bs m) : Z.of_nat (length bs) <= 2 ^ width.
Proof. eauto using length_array_ptsto_1_le, Byte.x00. Qed.
Lemma
length_bytearray_le
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "array", "length_array_ptsto_1_le", "width", "word" ]
null
275
276
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma bytearray_iff_bytes (a : word) (bs : list byte) : iff1 (array a bs) ((bs$@a) * emp (Z.of_nat (length bs) <= 2 ^ width)). Proof. split; intros; extract_ex1_and_emp_in_hyps; extract_ex1_and_emp_in_goal; ssplit; try eapply array1_iff_eq_of_list_word_at; eauto using length_bytearray_le. Qed.
bytearray_iff_bytes (a : word) (bs : list byte) : iff1 (array a bs) ((bs$@a) * emp (Z.of_nat (length bs) <= 2 ^ width)).
Proof. split; intros; extract_ex1_and_emp_in_hyps; extract_ex1_and_emp_in_goal; ssplit; try eapply array1_iff_eq_of_list_word_at; eauto using length_bytearray_le. Qed.
Lemma
bytearray_iff_bytes
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "array", "array1_iff_eq_of_list_word_at", "length_bytearray_le", "split", "width", "word" ]
null
278
283
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma bytearray_address_inbounds xs (start : word) a (Hlen : word.unsigned (word.sub a start) < Z.of_nat (length xs)) (i := Z.to_nat (word.unsigned (word.sub a start))) : iff1 (array start xs) (array start (firstn i xs) * ( ptsto a (hd (byte.of_Z 0) (skipn i xs)) * array (word.add a (w...
bytearray_address_inbounds xs (start : word) a (Hlen : word.unsigned (word.sub a start) < Z.of_nat (length xs)) (i := Z.to_nat (word.unsigned (word.sub a start))) : iff1 (array start xs) (array start (firstn i xs) * ( ptsto a (hd (byte.of_Z 0) (skipn i xs)) * array (word.add a (word.of...
Proof. eapply array_address_inbounds; rewrite ?word.unsigned_of_Z_1, ?Z.mul_1_l, ?Z.mod_1_r, ?Z.div_1_r; auto. Qed.
Lemma
bytearray_address_inbounds
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "array", "array_address_inbounds", "start", "word" ]
null
285
295
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma bytearray_index_inbounds xs (start iw : word) (Hlen : word.unsigned iw < Z.of_nat (length xs)) (i := Z.to_nat (word.unsigned iw)) : iff1 (array start xs) (array start (firstn i xs) * ( ptsto (word.add start iw) (hd (byte.of_Z 0) (skipn i xs)) * array (word.add (word.add start iw)...
bytearray_index_inbounds xs (start iw : word) (Hlen : word.unsigned iw < Z.of_nat (length xs)) (i := Z.to_nat (word.unsigned iw)) : iff1 (array start xs) (array start (firstn i xs) * ( ptsto (word.add start iw) (hd (byte.of_Z 0) (skipn i xs)) * array (word.add (word.add start iw) (word...
Proof. rewrite (bytearray_address_inbounds xs start (word.add start iw)); replace (word.sub (word.add start iw) start) with iw; try (reflexivity || assumption). all : rewrite word.word_sub_add_l_same_l; trivial. Qed.
Lemma
bytearray_index_inbounds
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "all", "array", "bytearray_address_inbounds", "start", "word" ]
null
297
308
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma bytearray_append xs ys start : iff1 (array start (xs ++ ys)) (array start xs * array (word.add start (word.of_Z (Z.of_nat (length xs)))) ys). Proof. replace (Z.of_nat (length xs)) with (Z.mul (word.unsigned (word.of_Z 1 : word)) (Z.of_nat (length xs))); auto using array_append; [];...
bytearray_append xs ys start : iff1 (array start (xs ++ ys)) (array start xs * array (word.add start (word.of_Z (Z.of_nat (length xs)))) ys).
Proof. replace (Z.of_nat (length xs)) with (Z.mul (word.unsigned (word.of_Z 1 : word)) (Z.of_nat (length xs))); auto using array_append; []; rewrite word.unsigned_of_Z_1; blia. Qed.
Lemma
bytearray_append
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "array", "array_append", "start", "word" ]
null
310
317
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma bytearray_index_merge xs ys (start i : word) (H : word.unsigned i = (Z.of_nat (length xs))) : iff1 (array start xs * array (word.add start i) ys) (array start (xs ++ ys)). Proof. pose proof word.of_Z_unsigned i as HH; rewrite H in HH. subst i; symmetry; apply bytearray_append. Q...
bytearray_index_merge xs ys (start i : word) (H : word.unsigned i = (Z.of_nat (length xs))) : iff1 (array start xs * array (word.add start i) ys) (array start (xs ++ ys)).
Proof. pose proof word.of_Z_unsigned i as HH; rewrite H in HH. subst i; symmetry; apply bytearray_append. Qed.
Lemma
bytearray_index_merge
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "array", "bytearray_append", "start", "word" ]
null
319
326
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma array_1_to_anybytes bs m (a: word) : array a bs m -> bedrock2.Memory.anybytes a (Z.of_nat (List.length bs)) m. Proof. intros H; pose proof length_bytearray_le bs _ m H as Hl. cbv [bedrock2.Memory.anybytes]; intros; exists bs; ssplit; try lia. 1:eapply array1_iff_eq_of_list_word_at in H; eauto. ...
array_1_to_anybytes bs m (a: word) : array a bs m -> bedrock2.Memory.anybytes a (Z.of_nat (List.length bs)) m.
Proof. intros H; pose proof length_bytearray_le bs _ m H as Hl. cbv [bedrock2.Memory.anybytes]; intros; exists bs; ssplit; try lia. 1:eapply array1_iff_eq_of_list_word_at in H; eauto. Qed.
Lemma
array_1_to_anybytes
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "anybytes", "array", "array1_iff_eq_of_list_word_at", "length_bytearray_le", "word" ]
null
332
338
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma anybytes_to_array_1 m (addr : word) n : bedrock2.Memory.anybytes addr n m -> exists bs, array addr bs m /\ List.length bs = Z.to_nat n. Proof. intros [bs (?&?&?)]; subst m; subst n; exists bs; split; [|lia]. apply array1_iff_eq_of_list_word_at; eauto. reflexivity. Qed.
anybytes_to_array_1 m (addr : word) n : bedrock2.Memory.anybytes addr n m -> exists bs, array addr bs m /\ List.length bs = Z.to_nat n.
Proof. intros [bs (?&?&?)]; subst m; subst n; exists bs; split; [|lia]. apply array1_iff_eq_of_list_word_at; eauto. reflexivity. Qed.
Lemma
anybytes_to_array_1
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "Map.Interface", "Map.Memory", "Map.Separation", "Map.SeparationMemory", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Z.Lia", "Byte", "Tactics.eplace", "Tactics.Tactics",...
[ "Z", "addr", "anybytes", "array", "array1_iff_eq_of_list_word_at", "split", "word" ]
null
340
346
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma bytes_per_range sz: 0 < Z.of_nat (Memory.bytes_per (width := width) sz) < 2 ^ width. Proof using BW. (* Cop out by depending on BW; the previous proof was too bad: *) clear -BW. destruct sz; simpl. all: try (destruct width_cases as [-> | ->]; split; reflexivity). Qed.
bytes_per_range sz: 0 < Z.of_nat (Memory.bytes_per (width := width) sz) < 2 ^ width.
Proof using BW. (* Cop out by depending on BW; the previous proof was too bad: *) clear -BW. destruct sz; simpl. all: try (destruct width_cases as [-> | ->]; split; reflexivity). Qed.
Lemma
bytes_per_range
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z", "all", "bytes_per", "split", "sz", "width", "width_cases" ]
null
19
24
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma testbit_byte_unsigned_ge b n: 8 <= n -> Z.testbit (byte.unsigned b) n = false. Proof. intros; erewrite prove_Zeq_bitwise.testbit_above; eauto using byte.unsigned_range; lia. Qed.
testbit_byte_unsigned_ge b n: 8 <= n -> Z.testbit (byte.unsigned b) n = false.
Proof. intros; erewrite prove_Zeq_bitwise.testbit_above; eauto using byte.unsigned_range; lia. Qed.
Lemma
testbit_byte_unsigned_ge
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z" ]
null
26
34
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma byte_unsigned_land (b1 b2: byte) : byte.unsigned (byte.and b1 b2) = Z.land (byte.unsigned b1) (byte.unsigned b2). Proof. unfold byte.and; rewrite byte.unsigned_of_Z. unfold byte.wrap; rewrite <- Z.land_ones. 1: bitblast.Z.bitblast. 1: rewrite testbit_byte_unsigned_ge. all: lia. Qed...
byte_unsigned_land (b1 b2: byte) : byte.unsigned (byte.and b1 b2) = Z.land (byte.unsigned b1) (byte.unsigned b2).
Proof. unfold byte.and; rewrite byte.unsigned_of_Z. unfold byte.wrap; rewrite <- Z.land_ones. 1: bitblast.Z.bitblast. 1: rewrite testbit_byte_unsigned_ge. all: lia. Qed.
Lemma
byte_unsigned_land
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z", "all", "testbit_byte_unsigned_ge" ]
null
36
45
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma byte_unsigned_xor (b1 b2: byte) : byte.unsigned (byte.xor b1 b2) = Z.lxor (byte.unsigned b1) (byte.unsigned b2). Proof. unfold byte.xor; rewrite byte.unsigned_of_Z. unfold byte.wrap; rewrite <- Z.land_ones. 1: bitblast.Z.bitblast. 1: rewrite !testbit_byte_unsigned_ge. all: reflexiv...
byte_unsigned_xor (b1 b2: byte) : byte.unsigned (byte.xor b1 b2) = Z.lxor (byte.unsigned b1) (byte.unsigned b2).
Proof. unfold byte.xor; rewrite byte.unsigned_of_Z. unfold byte.wrap; rewrite <- Z.land_ones. 1: bitblast.Z.bitblast. 1: rewrite !testbit_byte_unsigned_ge. all: reflexivity || lia. Qed.
Lemma
byte_unsigned_xor
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z", "all", "testbit_byte_unsigned_ge" ]
null
47
56
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma byte_xor_comm b1 b2: byte.xor b1 b2 = byte.xor b2 b1. Proof. unfold byte.xor; rewrite Z.lxor_comm; reflexivity. Qed.
byte_xor_comm b1 b2: byte.xor b1 b2 = byte.xor b2 b1.
Proof. unfold byte.xor; rewrite Z.lxor_comm; reflexivity. Qed.
Lemma
byte_xor_comm
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z" ]
null
58
60
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma Z_land_le_combine bs1 : forall bs2, Z.land (le_combine bs1) (le_combine bs2) = le_combine (List.map (fun '(x, y) => byte.and x y) (combine bs1 bs2)). Proof. induction bs1. - reflexivity. - destruct bs2; [ apply Z.land_0_r | ]; cbn -[Z.shiftl] in *. rewrite <- IHbs1, !byte_unsigned_...
Z_land_le_combine bs1 : forall bs2, Z.land (le_combine bs1) (le_combine bs2) = le_combine (List.map (fun '(x, y) => byte.and x y) (combine bs1 bs2)).
Proof. induction bs1. - reflexivity. - destruct bs2; [ apply Z.land_0_r | ]; cbn -[Z.shiftl] in *. rewrite <- IHbs1, !byte_unsigned_land, !Z.shiftl_land. bitblast.Z.bitblast. assert (l < 0 \/ 8 <= i) as [Hlt | Hge] by lia. + rewrite !(Z.testbit_neg_r _ l) by assumption. rewri...
Lemma
Z_land_le_combine
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z", "assert", "byte_unsigned_land", "testbit_byte_unsigned_ge" ]
null
62
76
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition in_bounds n x := 0 <= x < 2 ^ n.
in_bounds n x
:= 0 <= x < 2 ^ n.
Definition
in_bounds
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[]
null
78
79
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma forall_in_bounds l n: 0 <= n -> (Forall (in_bounds n) l) <-> (forall i, in_bounds n (nth i l 0)). Proof. intros; pose proof Z.pow_pos_nonneg 2 n. rewrite List.Forall_nth_default' with (d := 0); unfold in_bounds; reflexivity || lia. Qed.
forall_in_bounds l n: 0 <= n -> (Forall (in_bounds n) l) <-> (forall i, in_bounds n (nth i l 0)).
Proof. intros; pose proof Z.pow_pos_nonneg 2 n. rewrite List.Forall_nth_default' with (d := 0); unfold in_bounds; reflexivity || lia. Qed.
Lemma
forall_in_bounds
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z", "in_bounds", "nth" ]
null
81
88
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma le_combine_in_bounds bs n: (length bs <= n)%nat -> in_bounds (8 * Z.of_nat n) (le_combine bs). Proof. unfold in_bounds; intros. pose proof le_combine_bound bs. pose proof Zpow_facts.Zpower_le_monotone 2 (8 * Z.of_nat (length bs)) (8 * Z.of_nat n) ltac:(lia) ltac:(lia); lia. Qed.
le_combine_in_bounds bs n: (length bs <= n)%nat -> in_bounds (8 * Z.of_nat n) (le_combine bs).
Proof. unfold in_bounds; intros. pose proof le_combine_bound bs. pose proof Zpow_facts.Zpower_le_monotone 2 (8 * Z.of_nat (length bs)) (8 * Z.of_nat n) ltac:(lia) ltac:(lia); lia. Qed.
Lemma
le_combine_in_bounds
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z", "in_bounds" ]
null
90
98
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma Forall_le_combine_in_bounds n zs: (0 < n)%nat -> Forall (in_bounds (8 * Z.of_nat n)) (List.map le_combine (List.chunk n zs)). Proof. intros; eapply Forall_map, Forall_impl. - intros a; apply le_combine_in_bounds. - eapply Forall_impl; [ | apply List.Forall_chunk_length_le ]; simpl; i...
Forall_le_combine_in_bounds n zs: (0 < n)%nat -> Forall (in_bounds (8 * Z.of_nat n)) (List.map le_combine (List.chunk n zs)).
Proof. intros; eapply Forall_map, Forall_impl. - intros a; apply le_combine_in_bounds. - eapply Forall_impl; [ | apply List.Forall_chunk_length_le ]; simpl; intros; lia. Qed.
Lemma
Forall_le_combine_in_bounds
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z", "in_bounds", "le_combine_in_bounds" ]
null
100
108
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma le_split_0_l z: le_split 0 z = nil. Proof. reflexivity. Qed.
le_split_0_l z: le_split 0 z = nil.
Proof. reflexivity. Qed.
Lemma
le_split_0_l
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[]
null
110
112
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma le_split_0_r n: le_split n 0 = repeat Byte.x00 n. Proof. induction n. - reflexivity. - unfold le_split; fold le_split. rewrite Z.shiftr_0_l, IHn; reflexivity. Qed.
le_split_0_r n: le_split n 0 = repeat Byte.x00 n.
Proof. induction n. - reflexivity. - unfold le_split; fold le_split. rewrite Z.shiftr_0_l, IHn; reflexivity. Qed.
Lemma
le_split_0_r
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z" ]
null
114
121
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma le_split_zeroes : forall m n z, 0 <= z < 2 ^ (8 * Z.of_nat n) -> le_split (n + m) z = le_split n z ++ le_split m 0. Proof. induction n; cbn -[Z.pow Z.of_nat Z.shiftr]; intros * (Hle & Hlt). - replace z with 0 by lia; reflexivity. - rewrite IHn, !le_split_0_r; try reflexivity; []. r...
le_split_zeroes : forall m n z, 0 <= z < 2 ^ (8 * Z.of_nat n) -> le_split (n + m) z = le_split n z ++ le_split m 0.
Proof. induction n; cbn -[Z.pow Z.of_nat Z.shiftr]; intros * (Hle & Hlt). - replace z with 0 by lia; reflexivity. - rewrite IHn, !le_split_0_r; try reflexivity; []. rewrite Z.shiftr_div_pow2 by lia; split. + apply Z.div_pos; lia. + replace (8 * Z.of_nat (S n))%Z with (8 + 8 * Z.of_nat n)%Z...
Lemma
le_split_zeroes
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z", "le_split_0_r", "split" ]
null
125
137
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma flat_map_le_split_combine_chunk: forall bs n, (0 < n)%nat -> (length bs mod n)%nat = 0%nat -> flat_map (le_split n) (List.map le_combine (List.chunk n bs)) = bs. Proof. intros. rewrite flat_map_concat_map, map_map, List.map_ext_id, List.concat_chunk; [reflexivity|]. intros * Hi...
flat_map_le_split_combine_chunk: forall bs n, (0 < n)%nat -> (length bs mod n)%nat = 0%nat -> flat_map (le_split n) (List.map le_combine (List.chunk n bs)) = bs.
Proof. intros. rewrite flat_map_concat_map, map_map, List.map_ext_id, List.concat_chunk; [reflexivity|]. intros * Hin; pose proof (List.Forall_In (@List.Forall_chunk_length_mod _ n ltac:(lia) _) Hin); pose proof (List.Forall_In (@List.Forall_chunk_length_le _ n ltac:(lia) _) Hin); cbv beta...
Lemma
flat_map_le_split_combine_chunk
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[]
null
139
152
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma map_le_combine_chunk_split: forall zs n, (0 < n)%nat -> List.map le_combine (List.chunk n (flat_map (le_split n) zs)) = List.map (fun z => z mod 2 ^ (Z.of_nat n * 8)) zs. Proof. induction zs; simpl; intros. - reflexivity. - rewrite List.chunk_app by (rewrite ?length_le_split, ?...
map_le_combine_chunk_split: forall zs n, (0 < n)%nat -> List.map le_combine (List.chunk n (flat_map (le_split n) zs)) = List.map (fun z => z mod 2 ^ (Z.of_nat n * 8)) zs.
Proof. induction zs; simpl; intros. - reflexivity. - rewrite List.chunk_app by (rewrite ?length_le_split, ?Nat.Div0.mod_same; lia). rewrite map_app, IHzs by lia. rewrite le_combine_chunk_split by lia; reflexivity. Qed.
Lemma
map_le_combine_chunk_split
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z" ]
null
154
165
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma map_le_combine_chunk_split_le: forall zs n, (0 < n)%nat -> Forall (in_bounds (8 * Z.of_nat n)) zs -> List.map le_combine (List.chunk n (flat_map (le_split n) zs)) = zs. Proof. intros * Hlt Hle; rewrite map_le_combine_chunk_split by lia. apply List.map_ext_id. intros * Hin%(List...
map_le_combine_chunk_split_le: forall zs n, (0 < n)%nat -> Forall (in_bounds (8 * Z.of_nat n)) zs -> List.map le_combine (List.chunk n (flat_map (le_split n) zs)) = zs.
Proof. intros * Hlt Hle; rewrite map_le_combine_chunk_split by lia. apply List.map_ext_id. intros * Hin%(List.Forall_In Hle). apply Z.mod_small. rewrite Z.mul_comm; assumption. Qed.
Lemma
map_le_combine_chunk_split_le
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z", "in_bounds", "map_le_combine_chunk_split" ]
null
167
178
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma map_unsigned_of_Z_le_combine bs: let k := Z.to_nat (bytes_per_word width) in List.map (fun z : Z => word.unsigned (word := word) (word.of_Z z)) (List.map le_combine (List.chunk k bs)) = List.map le_combine (List.chunk k bs). Proof. cbv zeta. rewrite List.map_ext_id; [ reflexivity | ...
map_unsigned_of_Z_le_combine bs: let k := Z.to_nat (bytes_per_word width) in List.map (fun z : Z => word.unsigned (word := word) (word.of_Z z)) (List.map le_combine (List.chunk k bs)) = List.map le_combine (List.chunk k bs).
Proof. cbv zeta. rewrite List.map_ext_id; [ reflexivity | ]. intros * Hin. apply word.unsigned_of_Z_nowrap. pose proof word.width_pos. eapply List.Forall_In in Hin. 2: eapply Forall_le_combine_in_bounds. 1: unfold in_bounds in Hin. all: unfold bytes_per_word in *. 2: PreOmega.Z.to_eu...
Lemma
map_unsigned_of_Z_le_combine
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Forall_le_combine_in_bounds", "Z", "all", "bytes_per_word", "in_bounds", "split", "width", "width_cases", "word" ]
null
180
200
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma le_combine_nth_chunk n (bs: list byte) idx dd: n <> 0%nat -> (idx < List.Nat.div_up (Datatypes.length bs) n)%nat -> le_combine (nth idx (List.chunk n bs) dd) = le_combine (List.map (fun idx => nth idx bs Byte.x00) (seq (idx * n) n)). Proof. intros. rewrite List.nth_chunk by assumption. ...
le_combine_nth_chunk n (bs: list byte) idx dd: n <> 0%nat -> (idx < List.Nat.div_up (Datatypes.length bs) n)%nat -> le_combine (nth idx (List.chunk n bs) dd) = le_combine (List.map (fun idx => nth idx bs Byte.x00) (seq (idx * n) n)).
Proof. intros. rewrite List.nth_chunk by assumption. rewrite List.map_seq_nth_slice, le_combine_app_0. reflexivity. Qed.
Lemma
le_combine_nth_chunk
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "nth" ]
null
202
212
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma In_map_combine_in_bounds n (Hn: n <> 0%nat) bs a: In a (List.map le_combine (List.chunk n bs)) -> 0 <= a < 2 ^ (8 * Z.of_nat n). Proof. intros; eapply (List.Forall_In (Forall_le_combine_in_bounds n bs ltac:(lia))); eassumption. Qed.
In_map_combine_in_bounds n (Hn: n <> 0%nat) bs a: In a (List.map le_combine (List.chunk n bs)) -> 0 <= a < 2 ^ (8 * Z.of_nat n).
Proof. intros; eapply (List.Forall_In (Forall_le_combine_in_bounds n bs ltac:(lia))); eassumption. Qed.
Lemma
In_map_combine_in_bounds
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Forall_le_combine_in_bounds", "Z" ]
null
214
220
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition bs2zs n (bs: list byte) : list Z := List.map le_combine (List.chunk n bs).
bs2zs n (bs: list byte) : list Z
:= List.map le_combine (List.chunk n bs).
Definition
bs2zs
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z" ]
null
222
223
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition zs2bs n (zs: list Z): list byte := List.flat_map (le_split n) zs.
zs2bs n (zs: list Z): list byte
:= List.flat_map (le_split n) zs.
Definition
zs2bs
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z" ]
null
224
225
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma bs2zs2bs n bs: (0 < n)%nat -> (List.length bs mod n = 0)%nat -> zs2bs n (bs2zs n bs) = bs. Proof. apply flat_map_le_split_combine_chunk. Qed.
bs2zs2bs n bs: (0 < n)%nat -> (List.length bs mod n = 0)%nat -> zs2bs n (bs2zs n bs) = bs.
Proof. apply flat_map_le_split_combine_chunk. Qed.
Lemma
bs2zs2bs
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "bs2zs", "flat_map_le_split_combine_chunk", "zs2bs" ]
null
227
231
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma zs2bs2zs n zs: (0 < n)%nat -> bs2zs n (zs2bs n zs) = List.map (fun z => z mod 2 ^ (Z.of_nat n * 8)) zs. Proof. apply map_le_combine_chunk_split. Qed.
zs2bs2zs n zs: (0 < n)%nat -> bs2zs n (zs2bs n zs) = List.map (fun z => z mod 2 ^ (Z.of_nat n * 8)) zs.
Proof. apply map_le_combine_chunk_split. Qed.
Lemma
zs2bs2zs
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z", "bs2zs", "map_le_combine_chunk_split", "zs2bs" ]
null
233
237
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma zs2bs2zs_le n zs: (0 < n)%nat -> Forall (in_bounds (8 * Z.of_nat n)) zs -> bs2zs n (zs2bs n zs) = zs. Proof. apply map_le_combine_chunk_split_le. Qed.
zs2bs2zs_le n zs: (0 < n)%nat -> Forall (in_bounds (8 * Z.of_nat n)) zs -> bs2zs n (zs2bs n zs) = zs.
Proof. apply map_le_combine_chunk_split_le. Qed.
Lemma
zs2bs2zs_le
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "Z", "bs2zs", "in_bounds", "map_le_combine_chunk_split_le", "zs2bs" ]
null
239
243
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition zs2ws := List.map (word.of_Z (word := word)).
zs2ws
:= List.map (word.of_Z (word := word)).
Definition
zs2ws
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "word" ]
null
245
245
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition ws2zs := List.map (word.unsigned (word := word)).
ws2zs
:= List.map (word.unsigned (word := word)).
Definition
ws2zs
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "word" ]
null
246
246
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma ws2zs2ws ws: zs2ws (ws2zs ws) = ws. Proof. unfold zs2ws, ws2zs; rewrite map_map; apply List.map_ext_id. intros; apply word.of_Z_unsigned. Qed.
ws2zs2ws ws: zs2ws (ws2zs ws) = ws.
Proof. unfold zs2ws, ws2zs; rewrite map_map; apply List.map_ext_id. intros; apply word.of_Z_unsigned. Qed.
Lemma
ws2zs2ws
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "word", "ws2zs", "zs2ws" ]
null
248
253
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma zs2ws2zs zs: ws2zs (zs2ws zs) = List.map word.wrap zs. Proof. unfold zs2ws, ws2zs; rewrite map_map; apply map_ext. intros; apply word.unsigned_of_Z. Qed.
zs2ws2zs zs: ws2zs (zs2ws zs) = List.map word.wrap zs.
Proof. unfold zs2ws, ws2zs; rewrite map_map; apply map_ext. intros; apply word.unsigned_of_Z. Qed.
Lemma
zs2ws2zs
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "word", "ws2zs", "zs2ws" ]
null
255
261
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma zs2ws2zs_le zs: Forall (in_bounds width) zs -> ws2zs (zs2ws zs) = zs. Proof. unfold zs2ws, ws2zs; intros Hzs. rewrite map_map; apply List.map_ext_id; intros z Hin%(List.Forall_In Hzs). apply word.unsigned_of_Z_nowrap; assumption. Qed.
zs2ws2zs_le zs: Forall (in_bounds width) zs -> ws2zs (zs2ws zs) = zs.
Proof. unfold zs2ws, ws2zs; intros Hzs. rewrite map_map; apply List.map_ext_id; intros z Hin%(List.Forall_In Hzs). apply word.unsigned_of_Z_nowrap; assumption. Qed.
Lemma
zs2ws2zs_le
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "in_bounds", "width", "word", "ws2zs", "zs2ws" ]
null
263
270
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition bs2ws n (bs: list byte) : list word := zs2ws (bs2zs n bs).
bs2ws n (bs: list byte) : list word
:= zs2ws (bs2zs n bs).
Definition
bs2ws
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "bs2zs", "word", "zs2ws" ]
null
272
273
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Definition ws2bs n (ws: list word): list byte := zs2bs n (ws2zs ws).
ws2bs n (ws: list word): list byte
:= zs2bs n (ws2zs ws).
Definition
ws2bs
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "word", "ws2zs", "zs2bs" ]
null
274
275
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma zs2ws_length zs : length (zs2ws zs) = length zs. Proof. apply map_length. Qed.
zs2ws_length zs : length (zs2ws zs) = length zs.
Proof. apply map_length. Qed.
Lemma
zs2ws_length
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "zs2ws" ]
null
280
282
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma bs2zs_length' n bs : n <> 0 -> length (bs2zs n bs) = List.Nat.div_up (length bs) n. Proof. unfold bs2zs; intros. rewrite map_length, List.length_chunk, List.Nat.div_up_eqn. all: auto. Qed.
bs2zs_length' n bs : n <> 0 -> length (bs2zs n bs) = List.Nat.div_up (length bs) n.
Proof. unfold bs2zs; intros. rewrite map_length, List.length_chunk, List.Nat.div_up_eqn. all: auto. Qed.
Lemma
bs2zs_length'
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "all", "bs2zs" ]
null
284
291
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma div_up_mod_eq a b: b <> 0 -> a mod b = 0 -> List.Nat.div_up a b = a / b. Proof. intros H0 Hm; rewrite List.Nat.div_up_eqn, Hm; auto. Qed.
div_up_mod_eq a b: b <> 0 -> a mod b = 0 -> List.Nat.div_up a b = a / b.
Proof. intros H0 Hm; rewrite List.Nat.div_up_eqn, Hm; auto. Qed.
Lemma
div_up_mod_eq
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[]
null
293
297
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Lemma bs2zs_length n bs : (n <> 0)%nat -> (length bs mod n = 0)%nat -> length (bs2zs n bs) = (length bs / n)%nat. Proof. intros; rewrite bs2zs_length', div_up_mod_eq by assumption; reflexivity. Qed.
bs2zs_length n bs : (n <> 0)%nat -> (length bs mod n = 0)%nat -> length (bs2zs n bs) = (length bs / n)%nat.
Proof. intros; rewrite bs2zs_length', div_up_mod_eq by assumption; reflexivity. Qed.
Lemma
bs2zs_length
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "Map.Interface", "Map.Separation", "Map.SeparationLogic", "Lift1Prop", "Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "Word.Interface", "Word.Properties", "Word.Bitwidth", "Z.Lia", "Coq.micromega.Lia", "Byte", "Coq.Arith.PeanoNat", "Word.LittleEndianList", "Array", "Scalars", "Zn...
[ "bs2zs", "bs2zs_length'", "div_up_mod_eq" ]
null
299
305
true
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
End of preview. Expand in Data Studio

Coq-Bedrock

A work-in-progress language and compiler for verified low-level programming targeting RISC-V.

Source

Schema

Column Type Description
fact string Complete verbatim declaration (keyword, signature, and body/proof)
statement string Signature with the leading keyword removed (verbatim slice)
proof string Verbatim proof/body, empty if none
type string Declaration keyword
symbolic_name string Declaration identifier
library string Sub-library
filename string Repository-relative source path
imports list[string] File-level Require/Import modules
deps list[string] Intra-corpus identifiers referenced
docstring string Preceding documentation comment, null if absent
line_start int First source line
line_end int Last source line
has_proof bool Whether a proof block was captured
source_url string Upstream repository
commit string Upstream commit extracted

Statistics

  • Entries: 6,033
  • With proof: 5,838 (96.8%)
  • With docstring: 769 (12.7%)
  • Libraries: 14

By type

Type Count
Lemma 1,858
Definition 1,551
Ltac 894
Notation 822
Instance 325
Fixpoint 149
Ltac2 141
Inductive 83
Hypothesis 50
Record 40
Let 33
Axiom 22
Class 18
Coercion 13
Parameter 7
Example 6
Remark 6
Scheme 5
Theorem 4
Hypotheses 3
Variant 1
Parameters 1
Fact 1

Example

Lemma Z__range_add a0 a a1 (Ha: a0 <= a < a1) b0 b b1 (Hb : b0 <= b < b1)
      : a0+b0 <= a+b < a1 + b1 - 1.
Proof. Lia.nia. Qed.
  • type: Lemma | symbolic_name: Z__range_add | bedrock2/src/bedrock2/AbsintWordToZ.v:9

Use

Statement and proof are available both joined (fact) and split (statement, proof) for proof-term modeling, autoformalization, retrieval, and dependency analysis via deps.

Citation

@misc{coq_bedrock_dataset,
  title  = {Coq-Bedrock},
  author = {Norton, Charles},
  year   = {2026},
  note   = {Extracted from https://github.com/mit-plv/bedrock2, commit c25e0e99557a},
  url    = {https://huggingface.co/datasets/phanerozoic/Coq-Bedrock}
}
Downloads last month
46

Collection including phanerozoic/Coq-Bedrock