Dataset Viewer
Auto-converted to Parquet Duplicate
statement
stringlengths
1
5.3k
proof
stringlengths
0
38.1k
type
stringclasses
23 values
symbolic_name
stringlengths
1
166
library
stringclasses
14 values
filename
stringclasses
268 values
imports
listlengths
0
57
deps
listlengths
0
64
docstring
stringclasses
635 values
source_url
stringclasses
1 value
commit
stringclasses
1 value
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "Ha", "a0" ]
Bounds propagation
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "Ha", "a0" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "n1" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "Ha", "a0" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "x1" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "x1" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "Set" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "Set" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "Set" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "Set", "named_pose_asfresh" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "requireZcst" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "Set", "eval", "requireZcstExpr" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
"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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "zsimp" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "Ha", "Set", "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" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
absint_eq {T}
:= @eq T.
Definition
absint_eq
bedrock2.src.bedrock2
bedrock2/src/bedrock2/AbsintWordToZ.v
[ "Coq.Strings.String", "Coq.ZArith.ZArith", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[]
Abstract interpretation
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "absint_eq" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
"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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "absint_eq", "goal", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "width", "word" ]
TODO use it
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "absint_and", "f_equal2", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "absint_and", "f_equal2", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "Ha", "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_pose_pro...
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil", "Word.Interface", "Word.Properties", "Tactics.rdelta", "Z.div_mod_to_equations", "coqutil.Z.Lia", "coqutil.Word.Naive", "Word.Naive" ]
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "bedrock2.Lift1Prop" ]
[ "Type", "ex1", "mem", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
"p ? a"
:= (anyval p a) (at level 20, a at level 9).
Notation
p ? a
bedrock2.src.bedrock2
bedrock2/src/bedrock2/anyval.v
[ "bedrock2.Lift1Prop" ]
[ "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).
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "start", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "array", "start", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "array", "start" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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).
Proof. revert ys start. induction xs; intros ys start. - simpl. match goal with | |- iff1 _ (sep _ (array ?mid _)) => replace mid with start; cycle 1 end. { eapply word.unsigned_inj. repeat (rewrite ?word.unsigned_add, ?word.unsigned_of_Z, ?Z.mul_0_r, ?Z.mod_0_l, ?Z.add_0_r, ?wor...
Lemma
array_append
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "add_0_r", "array", "array_cons", "goal", "start", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "array", "array_append", "start", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "array", "array_append", "list__tl_skipn", "start", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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...
Proof. pose proof array_index_nat xs start n. rewrite <-(firstn_skipn n xs), app_length in H. destruct (skipn n xs) in *; cbn [tl hd hd_error] in *; [|assumption]. { cbn [length] in H. rewrite PeanoNat.Nat.add_0_r in H. rewrite firstn_length in H. blia. } Qed.
Lemma
array_index_nat_inbounds
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "add_0_r", "array", "array_index_nat", "start", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "array", "array_index_nat_inbounds", "start", "try", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
Z.of_nat : nat >-> Z.
Coercion
Z
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
"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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "sep_eq_putmany", "width", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "sep_eq_of_list_word_at_app", "width", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "sep_eq_putmany", "width", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "add_0_r", "array", "array_append", "ecancel_assumption", "exfalso", "width", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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).
Proof. symmetry. revert H; revert a; induction bs; cbn [array]; intros. { rewrite map.of_list_word_nil; cbv [emp iff1 sepclause_of_map]; intuition auto. } { etransitivity. 2: eapply Proper_sep_iff1. 3: eapply IHbs. 2: reflexivity. 2: cbn [length] in H; blia. change (a::bs) ...
Lemma
array1_iff_eq_of_list_word_at
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "array", "of_list_word_nil", "of_list_word_singleton", "sep_eq_putmany", "try", "width", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "array", "mem", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "a0", "add_0_r", "addr", "array", "mem", "rename", "sz", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "Type", "addr", "array", "mem", "sz", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
array
:= (array (mem:=mem) ptsto (word.of_Z 1)).
Notation
array
bedrock2.src.bedrock2
bedrock2/src/bedrock2/Array.v
[ "Coq", "ZArith", "Ring", "Lia", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "mem", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "array", "length_array_ptsto_1_le", "width", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "array", "array1_iff_eq_of_list_word_at", "length_bytearray_le", "split", "try", "width", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "array", "array_address_inbounds", "start", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "all", "array", "bytearray_address_inbounds", "start", "try", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "array", "array_append", "start", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "array", "bytearray_append", "start", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "anybytes", "array", "array1_iff_eq_of_list_word_at", "length_bytearray_le", "try", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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", "coqutil.Map.Interface", "coqutil.Map.Memory", "coqutil.Map.Separation", "coqutil.Map.SeparationMemory", "coqutil.Map.SeparationLogic", "coqutil.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.P...
[ "addr", "anybytes", "array", "array1_iff_eq_of_list_word_at", "split", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "all", "bytes_per", "split", "sz", "try", "width", "width_cases" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "all", "testbit_byte_unsigned_ge" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "all", "testbit_byte_unsigned_ge" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "assert", "byte_unsigned_land", "testbit_byte_unsigned_ge" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
in_bounds n x
:= 0 <= x < 2 ^ n.
Definition
in_bounds
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "in_bounds", "nth" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "in_bounds" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "in_bounds", "le_combine_in_bounds" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "le_split_0_r", "split", "try" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "in_bounds", "map_le_combine_chunk_split" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "Forall_le_combine_in_bounds", "all", "bytes_per_word", "in_bounds", "split", "width", "width_cases", "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "nth" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "Forall_le_combine_in_bounds" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
zs2bs n (zs: list Z): list byte
:= List.flat_map (le_split n) zs.
Definition
zs2bs
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "bs2zs", "flat_map_le_split_combine_chunk", "zs2bs" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "bs2zs", "map_le_combine_chunk_split", "zs2bs" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "bs2zs", "in_bounds", "map_le_combine_chunk_split_le", "zs2bs" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
zs2ws
:= List.map (word.of_Z (word := word)).
Definition
zs2ws
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
ws2zs
:= List.map (word.unsigned (word := word)).
Definition
ws2zs
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "word" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "word", "ws2zs", "zs2ws" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "word", "ws2zs", "zs2ws" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "in_bounds", "width", "word", "ws2zs", "zs2ws" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
bs2ws n (bs: list byte) : list word
:= zs2ws (bs2zs n bs).
Definition
bs2ws
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "bs2zs", "word", "zs2ws" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
ws2bs n (ws: list word): list byte
:= zs2bs n (ws2zs ws).
Definition
ws2bs
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "word", "ws2zs", "zs2bs" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
zs2ws_length zs : length (zs2ws zs) = length zs.
Proof. apply map_length. Qed.
Lemma
zs2ws_length
bedrock2.src.bedrock2
bedrock2/src/bedrock2/ArrayCasts.v
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "zs2ws" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "all", "bs2zs" ]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[]
https://github.com/mit-plv/bedrock2
c25e0e99557a6d71673d81c09b4fb24c048a2811
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
[ "coqutil.Map.Interface", "bedrock2.Map.Separation", "bedrock2.Map.SeparationLogic", "bedrock2.Lift1Prop", "bedrock2.Memory", "Coq.Lists.List", "Coq.ZArith.BinInt", "coqutil.Word.Interface", "coqutil.Word.Properties", "coqutil.Word.Bitwidth", "coqutil.Z.Lia", "Coq.micromega.Lia", "coqutil.Byt...
[ "bs2zs", "bs2zs_length'", "div_up_mod_eq" ]
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
statement string Declaration signature/claim with the leading keyword removed (verbatim slice); the full declaration minus its proof
proof string Verbatim proof/body, empty if the declaration has 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, empty if absent
source_url string Upstream repository
commit string Upstream commit extracted

Statistics

  • Entries: 5,651
  • With proof: 5,574 (98.6%)
  • With docstring: 700 (12.4%)
  • Libraries: 14

By type

Type Count
Lemma 1,815
Definition 1,458
Ltac 825
Notation 713
Instance 297
Ltac2 139
Fixpoint 137
Inductive 82
Hypothesis 43
Record 39
Let 31
Class 18
Axiom 14
Parameter 7
Coercion 6
Example 6
Remark 6
Scheme 5
Theorem 4
Hypotheses 3
Variant 1
Parameters 1
Fact 1

Example

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

Use

Each declaration is split into a statement (signature/claim) and a proof (body) that are disjoint and together form the complete declaration, for proof 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
28

Collection including phanerozoic/Coq-Bedrock

Free AI Image Generator No sign-up. Instant results. Open Now