Skip to content

Commit c7d6986

Browse files
authored
Merge pull request #739 from PrincetonUniversity/SC_tac
Adjusted SC_tac, adjusted change_compspecs warning message, store_tac
2 parents a095fd1 + 36ab0fc commit c7d6986

File tree

3 files changed

+54
-9
lines changed

3 files changed

+54
-9
lines changed

floyd/VSU.v

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,13 +888,52 @@ Ltac SC_tac :=
888888
lazymatch goal with
889889
| |- Funspecs_must_match ?i _ _ =>
890890
try solve [constructor; unfold abbreviate;
891-
try simple apply eq_refl;
891+
repeat f_equal
892+
(*occasionally leaves a subgoal, typically because a
893+
change_compspecs needs to be inserted that could not
894+
be identified automatically*)]
895+
| |- Identifier_not_found ?i ?fds2 =>
896+
fail "identifer" i "not found in funspecs" fds2
897+
| |- True => trivial
898+
end.
899+
(*Alternatives:
900+
Ltac SC_tac1 :=
901+
match goal with |- SC_test ?ids _ _ =>
902+
let a := eval compute in ids in change ids with a
903+
end;
904+
simpl SC_test;
905+
repeat (apply conj);
906+
lazymatch goal with
907+
| |- Funspecs_must_match ?i _ _ =>
908+
try solve [constructor; unfold abbreviate;
909+
(*leads sometimes to nontermination: try simple apply eq_refl;*)
892910
repeat f_equal]
893911
| |- Identifier_not_found ?i ?fds2 =>
894912
fail "identifer" i "not found in funspecs" fds2
895913
| |- True => trivial
896914
end.
897915
916+
Ltac SC_tac2 :=
917+
match goal with |- SC_test ?ids _ _ =>
918+
let a := eval compute in ids in change ids with a
919+
end;
920+
simpl SC_test;
921+
repeat (apply conj);
922+
lazymatch goal with
923+
| |- Funspecs_must_match ?i _ _ =>
924+
constructor;
925+
apply mk_funspec_congr;
926+
[ try reflexivity
927+
| try reflexivity
928+
| try reflexivity
929+
| (*too aggressive here: try (apply eq_JMeq; trivial)*)
930+
| (*too aggressive here: try (apply eq_JMeq; trivial)*)]
931+
| |- Identifier_not_found ?i ?fds2 =>
932+
fail "identifer" i "not found in funspecs" fds2
933+
| |- True => trivial
934+
end.
935+
*)
936+
898937
Ltac HImports_tac := simpl;
899938
let i := fresh "i" in
900939
intros i ? ? H1 H2;

floyd/forward.v

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,10 @@ a "versus" b ")"
712712
else fail
713713
end.
714714

715+
Ltac change_compspecs_warning A cs cs' :=
716+
idtac "Remark: change_compspecs on user-defined mpred:" A cs cs'
717+
"(to disable this message, Ltac change_compspecs_warning A cs cs' ::= idtac".
718+
715719
Ltac change_compspecs' cs cs' :=
716720
lazymatch goal with
717721
| |- context [@data_at cs' ?sh ?t ?v1] => erewrite (@data_at_change_composite cs' cs _ sh t); [| apply JMeq_refl | prove_cs_preserve_type]
@@ -721,22 +725,22 @@ Ltac change_compspecs' cs cs' :=
721725
| |- _ =>
722726
match goal with
723727
| |- context [?A cs'] =>
724-
idtac "Warning: attempting change_compspecs on user-defined mpred:" A;
728+
change_compspecs_warning A cs cs';
725729
change (A cs') with (A cs)
726730
| |- context [?A cs' ?B] =>
727-
idtac "Warning: attempting change_compspecs on user-defined mpred:" A;
731+
change_compspecs_warning A cs cs';
728732
change (A cs' B) with (A cs B)
729733
| |- context [?A cs' ?B ?C] =>
730-
idtac "Warning: attempting change_compspecs on user-defined mpred:" A;
734+
change_compspecs_warning A cs cs';
731735
change (A cs' B C) with (A cs B C)
732736
| |- context [?A cs' ?B ?C ?D] =>
733-
idtac "Warning: attempting change_compspecs on user-defined mpred:" A;
737+
change_compspecs_warning A cs cs';
734738
change (A cs' B C D) with (A cs B C D)
735739
| |- context [?A cs' ?B ?C ?D ?E] =>
736-
idtac "Warning: attempting change_compspecs on user-defined mpred:" A;
740+
change_compspecs_warning A cs cs';
737741
change (A cs' B C D E) with (A cs B C D E)
738742
| |- context [?A cs' ?B ?C ?D ?E ?F] =>
739-
idtac "Warning: attempting change_compspecs on user-defined mpred:" A;
743+
change_compspecs_warning A cs cs';
740744
change (A cs' B C D E F) with (A cs B C D E F)
741745
end
742746
end.

floyd/simpl_reptype.v

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,17 @@ Ltac subst_indexes gfs :=
335335
end.
336336

337337
Ltac solve_store_rule_evaluation :=
338-
match goal with |- upd_reptype ?t ?gfs ?v0 ?v1 = ?B =>
338+
match goal with |- @upd_reptype ?cs ?t ?gfs ?v0 ?v1 = ?B =>
339339
let rhs := fresh "rhs" in set (rhs := B);
340340
match type of rhs with ?A =>
341341
let a := fresh "a" in set (a:=A) in rhs;
342342
lazy beta zeta iota delta [reptype reptype_gen] in a;
343343
cbn in a; subst a
344344
end;
345345
let h0 := fresh "h0" in let h1 := fresh "h1" in
346-
set (h0:=v0); set (h1:=v1); change (upd_reptype t gfs h0 h1 = rhs);
346+
set (h0:=v0 : @reptype cs t);
347+
set (h1:=v1 : @reptype cs (@nested_field_type cs t gfs));
348+
change (upd_reptype t gfs h0 h1 = rhs);
347349
remember_indexes gfs;
348350
let j := fresh "j" in match type of h0 with ?J => set (j := J) in h0 end;
349351
lazy beta zeta iota delta in j; subst j;

0 commit comments

Comments
 (0)