Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[saw-core-coq] Fix weird universe constraints generated in SAWCorePreludeExtra #1481

Merged
merged 2 commits into from
Oct 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions saw-core-coq/coq/_CoqProject
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ handwritten/CryptolToCoq/SAWCorePrelude_proofs.v
handwritten/CryptolToCoq/SAWCorePreludeExtra.v
handwritten/CryptolToCoq/SAWCoreScaffolding.v
handwritten/CryptolToCoq/SAWCoreVectorsAsCoqVectors.v

handwritten/CryptolToCoq/Everything.v
17 changes: 17 additions & 0 deletions saw-core-coq/coq/handwritten/CryptolToCoq/Everything.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(* This file imports everything together in order to make sure
that there are no universe inconsistencies *)

(* generated *)
From CryptolToCoq Require Import CryptolPrimitivesForSAWCore.
From CryptolToCoq Require Import SAWCorePrelude.

(* handwritten *)
From CryptolToCoq Require Import CompM.
From CryptolToCoq Require Import CompMExtra.
From CryptolToCoq Require Import CoqVectorsExtra.
From CryptolToCoq Require Import CryptolPrimitivesForSAWCoreExtra.
From CryptolToCoq Require Import SAWCoreBitvectors.
From CryptolToCoq Require Import SAWCorePrelude_proofs.
From CryptolToCoq Require Import SAWCorePreludeExtra.
From CryptolToCoq Require Import SAWCoreScaffolding.
From CryptolToCoq Require Import SAWCoreVectorsAsCoqVectors.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ Qed.

Theorem unfold_fold_IRT As Ds D : forall u, unfoldIRT As Ds D (foldIRT As Ds D u) = u.
Proof.
revert Ds; induction D; try destruct u; simpl; f_equal; try easy.
revert Ds; induction D; intros; try destruct u; simpl(*; f_equal; try easy*).
(* For some reason using `f_equal` above generates universe constraints like
`prod.u0 < eq.u0` which cause problems later on when it is assumed that
`eq.u0 = Coq.Relations.Relation_Definitions.1 <= prod.u0` by
`returnM_injective`. The easiest solution is just to not use `f_equal`
here, and rewrite by the relevant induction hypotheses instead. *)
all: try rewrite IHD; try rewrite IHD1; try rewrite IHD2; try rewrite H; try easy.
(* All that remains is the IRT_BVVec case, which requires functional extensionality
and the fact that genBVVec and atBVVec define an isomorphism *)
intros; rewrite <- (gen_at_BVVec _ _ _ u).
Expand Down