feat(mpz_swap): Proved correctness of mpz_swap. Proved some previously admitted lemmas.

This commit is contained in:
xiaoh105
2025-06-22 21:00:50 +08:00
parent 77ccdd3e50
commit ff1fd68eb1
6 changed files with 795 additions and 20 deletions

View File

@ -692,7 +692,7 @@ Proof.
entailer!.
rewrite H20.
entailer!.
apply store_uint_array_rec_def2undef.
apply store_uint_array_rec_def2undef; try lia.
assert (Zlength l' = n_pre) by lia.
rewrite <- H7.
tauto.
@ -1261,7 +1261,7 @@ Proof.
entailer!.
rewrite H10.
entailer!.
apply store_uint_array_rec_def2undef.
apply store_uint_array_rec_def2undef; try lia.
rewrite <- H29.
assert (val_a_prefix = val_a). {
rewrite <-H18 in H7.
@ -1722,3 +1722,74 @@ Proof.
Exists ptr cap size.
entailer!.
Qed.
Lemma proof_of_mpz_swap_return_wit_1_1 : mpz_swap_return_wit_1_1.
Proof.
pre_process.
unfold store_Z.
Exists ptr2 cap2 size2.
Exists ptr1 cap1 size1.
Right; Right.
entailer!.
Qed.
Lemma proof_of_mpz_swap_return_wit_1_2 : mpz_swap_return_wit_1_2.
Proof.
pre_process.
subst.
unfold store_Z.
Exists ptr2 cap2 size2.
Exists ptr1 cap1 size1.
Right; Left.
entailer!.
Qed.
Lemma proof_of_mpz_swap_return_wit_1_3 : mpz_swap_return_wit_1_3.
Proof.
pre_process.
unfold store_Z.
Exists ptr2 cap2 size2.
Exists ptr1 cap1 size1.
Left; Right.
entailer!.
Qed.
Lemma proof_of_mpz_swap_return_wit_1_4 : mpz_swap_return_wit_1_4.
Proof.
pre_process.
unfold store_Z.
Exists ptr2 cap2 size2.
Exists ptr1 cap1 size1.
Left; Left.
entailer!.
Qed.
Lemma proof_of_mpz_swap_which_implies_wit_1 : mpz_swap_which_implies_wit_1.
Proof.
pre_process.
unfold store_Z.
Intros ptr cap size.
rewrite orp_sepcon_left.
Split.
+ Right.
Exists ptr cap size.
entailer!.
+ Left.
Exists ptr cap size.
entailer!.
Qed.
Lemma proof_of_mpz_swap_which_implies_wit_2 : mpz_swap_which_implies_wit_2.
Proof.
pre_process.
unfold store_Z.
Intros ptr cap size.
rewrite orp_sepcon_left.
Split.
+ Right.
Exists ptr cap size.
entailer!.
+ Left.
Exists ptr cap size.
entailer!.
Qed.