Skip to content

Commit 12921c5

Browse files
authored
Adapt to rocq-prover/rocq#21063 (fixed apply auto-projecting from record with letin projection) (#837)
1 parent 3bfb728 commit 12921c5

File tree

2 files changed

+29
-28
lines changed

2 files changed

+29
-28
lines changed

floyd/Component.v

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -771,40 +771,41 @@ Proof.
771771
+ rewrite semax_prog.make_tycontext_g_G_None in Heqq by trivial.
772772
rewrite semax_prog.make_tycontext_g_G_None; trivial.
773773
apply find_id_None_iff. apply find_id_None_iff in Heqw. intros N; apply Heqw.
774-
rewrite map_app in *. rewrite HI1 in N. trivial. }
775-
eapply Build_Component; subst; try solve [apply c].
774+
rewrite map_app in *. rewrite HI1 in N. trivial. }
775+
(* after Rocq 9.2, "apply c" automatically tries "apply (Comp_MkInitPred c)"
776+
(before 9.2 it is supposed to try it but is bugged, cf rocq-prover/rocq#21036) *)
777+
eapply Build_Component; subst; try solve [apply c | apply (Comp_MkInitPred c)].
776778
+ rewrite HI1; apply c.
777779
+ rewrite map_app, HI1, <- map_app; apply c.
778780
+ intros. specialize (Comp_G_justified c i _ _ H H0); intros. destruct fd.
779781
- eapply InternalInfo_subsumption. apply AUX2. apply AUX1. apply Comp_ctx_LNR. apply H1.
780782
- auto.
781-
+ apply (Comp_MkInitPred c).
782783
Qed.
783784

784785
(*Together with Lemma Comp_Exports_suboption, this lemma means we can abstract or hide exports*)
785786
Lemma Comp_Exports_sub1 Exports' (HE1: map fst Exports' = map fst Exports)
786787
(HE2: Forall2 funspec_sub (map snd Exports) (map snd Exports')):
787788
@Component Espec V E Imports p Exports' GP G.
788789
Proof.
789-
eapply Build_Component; try apply c.
790+
(* after Rocq 9.2 the second apply is subsumed by the first, cf rocq-prover/rocq#21036 *)
791+
eapply Build_Component; try apply c; try apply (Comp_MkInitPred c).
790792
+ rewrite HE1; apply c.
791793
+ intros i phi Hi. rename phi into phi'.
792794
assert (X: exists phi, find_id i Exports = Some phi /\ funspec_sub phi phi').
793795
{ clear - HE1 HE2 Hi. eapply find_funspec_sub; eassumption. }
794796
destruct X as [phi [Phi PHI]].
795797
destruct (Comp_G_Exports c _ _ Phi) as [psi [Psi PSI]].
796798
exists psi; split; [ trivial | eapply funspec_sub_trans; eassumption ].
797-
+ apply (Comp_MkInitPred c).
798799
Qed.
799800

800801
Lemma Comp_Exports_sub2 Exports' (LNR: list_norepet (map fst Exports'))
801802
(HE2: forall i, sub_option (find_id i Exports') (find_id i Exports)):
802803
@Component Espec V E Imports p Exports' GP G.
803804
Proof.
804-
eapply Build_Component; try apply c; trivial.
805+
(* after Rocq 9.2 the second apply is subsumed by the first, cf rocq-prover/rocq#21036 *)
806+
eapply Build_Component; try apply c; try apply (Comp_MkInitPred c); trivial.
805807
+ intros i phi' Hi. specialize (HE2 i). rewrite Hi in HE2; simpl in HE2.
806808
apply c; trivial.
807-
+apply (Comp_MkInitPred c).
808809
Qed.
809810

810811
Definition funspecs_sqsub Exp Exp' :=
@@ -874,11 +875,11 @@ Lemma Comp_Exports_sub Exports' (LNR: list_norepet (map fst Exports'))
874875
(HE2: funspecs_sqsub Exports Exports'):
875876
@Component Espec V E Imports p Exports' GP G.
876877
Proof.
877-
eapply Build_Component; try apply c; trivial.
878+
(* after Rocq 9.2 the second apply is subsumed by the first, cf rocq-prover/rocq#21036 *)
879+
eapply Build_Component; try apply c; try apply (Comp_MkInitPred c); trivial.
878880
intros i phi' Hi. destruct (HE2 _ _ Hi) as [phi [H1 H2]].
879881
apply (Comp_G_Exports c) in H1; destruct H1 as [psi [H3 H4]].
880882
exists psi; split; trivial. eapply funspec_sub_trans; eassumption.
881-
apply (Comp_MkInitPred c).
882883
Qed.
883884

884885
End Component.

floyd/VSU.v

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,21 +1280,21 @@ Proof.
12801280
intros.
12811281
destruct v as [G c].
12821282
exists G.
1283-
apply (@Build_Component _ _ _ _ _ _ _ _ (Comp_prog_OK c)); try apply c; auto.
1284-
+ intros.
1285-
rewrite Forall_forall in H0.
1286-
apply find_id_e in E0.
1287-
apply H0 in E0.
1288-
red in E0.
1289-
simpl in E0.
1290-
destruct (find_id i Exports) eqn:?H; try contradiction.
1291-
apply (Comp_G_Exports c) in H1.
1292-
destruct H1 as [phi' [? ?]].
1293-
1294-
exists phi'.
1295-
split; auto.
1296-
eapply funspec_sub_trans; eauto.
1297-
+ intros. apply (Comp_MkInitPred c); auto.
1283+
(* after Rocq 9.2 the second apply is subsumed by the first, cf rocq-prover/rocq#21036 *)
1284+
apply (@Build_Component _ _ _ _ _ _ _ _ (Comp_prog_OK c)); try first [apply c | apply (Comp_MkInitPred c)]; auto.
1285+
intros.
1286+
rewrite Forall_forall in H0.
1287+
apply find_id_e in E0.
1288+
apply H0 in E0.
1289+
red in E0.
1290+
simpl in E0.
1291+
destruct (find_id i Exports) eqn:?H; try contradiction.
1292+
apply (Comp_G_Exports c) in H1.
1293+
destruct H1 as [phi' [? ?]].
1294+
1295+
exists phi'.
1296+
split; auto.
1297+
eapply funspec_sub_trans; eauto.
12981298
Qed.
12991299

13001300
Ltac prove_restrictExports :=
@@ -1319,13 +1319,13 @@ Proof.
13191319
intros.
13201320
destruct v as [G c].
13211321
exists G.
1322-
apply (@Build_Component _ _ _ _ _ _ _ _ (Comp_prog_OK c)); try apply c; auto.
1322+
(* after Rocq 9.2 the second apply is subsumed by the first, cf rocq-prover/rocq#21036 *)
1323+
apply (@Build_Component _ _ _ _ _ _ _ _ (Comp_prog_OK c)); try first [apply c | apply (Comp_MkInitPred c)]; auto.
13231324
+ rewrite H. apply c.
13241325
+ intros. destruct (find_funspec_sub Exports' Exports H H0 _ _ E0) as [psi [Psi PSI]].
13251326
apply (Comp_G_Exports c) in Psi.
13261327
destruct Psi as [tau [Tau TAU]].
13271328
exists tau; split; trivial. eapply funspec_sub_trans; eassumption.
1328-
+ apply (Comp_MkInitPred c).
13291329
Qed.
13301330

13311331
Ltac prove_restrictExports2 :=
@@ -1481,7 +1481,8 @@ destruct v as [G c].
14811481
assert (LNR1: list_norepet (map fst (QPvarspecs p) ++ map fst (G ++ Imports'))).
14821482
{ rewrite map_app, <- H, <- map_app. apply c. }
14831483
exists G.
1484-
apply (@Build_Component _ _ _ _ _ _ _ _ (Comp_prog_OK c)); try apply c; auto.
1484+
(* after Rocq 9.2 the second apply is subsumed by the first, cf rocq-prover/rocq#21036 *)
1485+
apply (@Build_Component _ _ _ _ _ _ _ _ (Comp_prog_OK c)); try first [apply c | apply (Comp_MkInitPred c)]; auto.
14851486
+ rewrite <- H. apply c.
14861487
+ intros.
14871488
assert (LNR2: list_norepet (map fst (QPvarspecs p) ++ map fst (Imports' ++ G))).
@@ -1510,7 +1511,6 @@ apply (@Build_Component _ _ _ _ _ _ _ _ (Comp_prog_OK c)); try apply c; auto.
15101511
rewrite Psi. eexists; split. reflexivity. apply (funspec_sub_sub_si _ _ PSI).
15111512
* apply find_id_None_iff in Heqq. rewrite H in Heqq. apply find_id_None_iff in Heqq. rewrite Heqq, Heqw.
15121513
eexists; split. reflexivity. apply funspec_sub_si_refl.
1513-
+ apply (Comp_MkInitPred c).
15141514
Qed.
15151515

15161516
Lemma replace_spec_Forall2_funspec_sub2 p phi: forall (l : funspecs)

0 commit comments

Comments
 (0)