Skip to content

Commit 0f2c6b7

Browse files
authored
Merge pull request #761 from MetaCoq/port-globenv-changes-8.15
Port globenv changes 8.15
2 parents 7acb6d7 + 02763e7 commit 0f2c6b7

27 files changed

+274
-305
lines changed

erasure/theories/EDeps.v

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,11 @@ Proof.
473473
apply PCUICWeakeningEnv.lookup_env_Some_fresh in H as not_fresh.
474474
econstructor.
475475
- unfold PCUICAst.declared_constant in *; cbn.
476-
inversion wfΣ; subst.
476+
inversion wfΣ; subst. destruct X0.
477477
destruct (eqb_spec kn0 kn) as [<-|]; [congruence|].
478478
eassumption.
479479
- unfold EGlobalEnv.declared_constant in *. cbn -[ReflectEq.eqb].
480-
inversion wfΣ; subst.
480+
inversion wfΣ; subst. destruct X0.
481481
destruct (ReflectEq.eqb_spec kn0 kn); [congruence|].
482482
eassumption.
483483
- unfold erases_constant_body in *.
@@ -486,10 +486,10 @@ Proof.
486486
assert (PCUICAst.declared_constant (add_global_decl Σ (kn, decl)) kn0 cb).
487487
{ unfold PCUICAst.declared_constant.
488488
cbn.
489-
inversion wfΣ; subst.
489+
inversion wfΣ; subst. destruct X0.
490490
destruct (eqb_spec kn0 kn) as [<-|]; [congruence|].
491491
easy. }
492-
inversion wfΣ; subst.
492+
inversion wfΣ; subst. destruct X0.
493493
eapply declared_constant_inv in H4; eauto.
494494
2:eapply weaken_env_prop_typing.
495495
red in H4.
@@ -512,35 +512,35 @@ Proof.
512512
invs wfΣ.
513513
destruct H0. split. 2: eauto.
514514
destruct d. split; eauto.
515-
red. cbn. cbn in *.
515+
red. cbn. cbn in *. destruct X0.
516516
destruct (eqb_spec (inductive_mind ind) kn). cbn in *.
517517
subst.
518-
eapply PCUICWeakeningEnv.lookup_env_Some_fresh in H5. eauto. eapply H. exact H0.
518+
eapply PCUICWeakeningEnv.lookup_env_Some_fresh in kn_fresh. eauto. eapply H. exact H0.
519519
- econstructor; eauto.
520520
destruct H as [H H'].
521521
split; eauto. red in H |- *.
522-
inv wfΣ.
522+
inv wfΣ. destruct X0.
523523
unfold PCUICEnvironment.lookup_env.
524524
simpl. destruct (eqb_spec (inductive_mind p.1) kn); auto. subst.
525525
eapply PCUICWeakeningEnv.lookup_env_Some_fresh in H; eauto. contradiction.
526526
destruct H0 as [H0 H0'].
527527
split; eauto. red in H0 |- *.
528-
inv wfΣ. cbn. change (eq_kername (inductive_mind p.1) kn) with (ReflectEq.eqb (inductive_mind p.1) kn).
528+
inv wfΣ. destruct X0. cbn. change (eq_kername (inductive_mind p.1) kn) with (ReflectEq.eqb (inductive_mind p.1) kn).
529529
destruct (ReflectEq.eqb_spec (inductive_mind p.1) kn); auto. subst.
530530
destruct H as [H _].
531531
eapply PCUICWeakeningEnv.lookup_env_Some_fresh in H. eauto. contradiction.
532532
- econstructor; eauto.
533533
destruct H as [[[declm decli] declc] [declp hp]].
534534
repeat split; eauto.
535-
inv wfΣ. unfold PCUICAst.declared_minductive in *.
535+
inv wfΣ. destruct X0. unfold PCUICAst.declared_minductive in *.
536536
unfold PCUICEnvironment.lookup_env.
537537
simpl in *.
538538
destruct (ReflectEq.eqb_spec (inductive_mind p.(proj_ind)) kn). subst.
539539
eapply PCUICWeakeningEnv.lookup_env_Some_fresh in declm; eauto. contradiction.
540540
apply declm.
541541
destruct H0 as [[[]]]. destruct a.
542542
repeat split; eauto.
543-
inv wfΣ. simpl. unfold declared_minductive. cbn.
543+
inv wfΣ. destruct X0. simpl. unfold declared_minductive. cbn.
544544
destruct (ReflectEq.eqb_spec (inductive_mind p.(proj_ind)) kn); auto. subst.
545545
destruct H as [[[]]].
546546
eapply PCUICWeakeningEnv.lookup_env_Some_fresh in H. eauto. contradiction.
@@ -703,10 +703,10 @@ Proof.
703703
* unfold erases_constant_body, on_constant_decl in *.
704704
destruct ?; [|easy].
705705
destruct ?; [|easy].
706-
depelim wf. depelim o0. cbn in *.
706+
depelim wf. depelim o0. destruct o1. cbn in *.
707707
eapply (erases_extends ({| universes := univs; declarations := Σ |}, cst_universes cst')); eauto.
708708
cbn. 4:{ split; eauto; cbn; try reflexivity. eexists [_]; cbn; reflexivity. }
709-
constructor; auto. cbn. red in o2. rewrite E in o2. exact o2.
709+
constructor; auto. cbn. red in on_global_decl_d. rewrite E in on_global_decl_d. exact on_global_decl_d.
710710
split; auto.
711711
* intros.
712712
eapply (erases_deps_cons {| universes := univs; declarations := Σ |} _ kn (PCUICEnvironment.ConstantDecl cst')); auto.
@@ -716,9 +716,9 @@ Proof.
716716
unfold on_constant_decl in *.
717717
cbn in *.
718718
eapply (erases_deps_single (_, _)). 3:eauto.
719-
depelim wf. depelim o0.
719+
depelim wf. depelim o0. destruct o1.
720720
now split; cbn; eauto.
721-
depelim wf. depelim o0. do 2 red in o2. now rewrite E in o2.
721+
depelim wf. depelim o0. destruct o1. do 2 red in on_global_decl_d. now rewrite E in on_global_decl_d.
722722
apply IH; eauto. depelim wf. now depelim o0.
723723
+ set (Σu := {| universes := univs; declarations := Σ; retroknowledge := retro |}).
724724
assert (wfΣu : PCUICTyping.wf Σu).
@@ -767,17 +767,17 @@ Proof.
767767
unfold PCUICAst.declared_minductive in decli.
768768
unfold PCUICEnvironment.lookup_env in decli.
769769
simpl in decli. rewrite eq_kername_refl in decli. intuition discriminate.
770-
* inv wf. inv X.
770+
* inv wf. inv X. destruct X1.
771771
specialize (IH _ (H0, X0) erg).
772772
destruct decli as [decli ?].
773773
simpl in decli |- *.
774774
unfold PCUICAst.declared_minductive, PCUICEnvironment.lookup_env in decli.
775775
simpl in decli.
776776
destruct (eqb_specT (inductive_mind k) kn). simpl in *. subst. noconf decli.
777-
destruct (Forall2_nth_error_left (proj1 H) _ _ H3); eauto.
777+
destruct (Forall2_nth_error_left (proj1 H) _ _ H1); eauto.
778778
eexists _, _; intuition eauto. split; eauto. red.
779779
simpl. rewrite eqb_refl. congruence.
780-
destruct (proj2 IH _ _ _ (conj decli H3)) as [m' [i' [decli' ei]]].
780+
destruct (proj2 IH _ _ _ (conj decli H1)) as [m' [i' [decli' ei]]].
781781
eexists _, _; intuition eauto.
782782
destruct decli'; red; split; eauto.
783783
red in d |- *. simpl.

erasure/theories/ETransform.v

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Program Definition erase_pcuic_program {guard : abstract_guard_impl} (p : pcuic_
2525
(wt : ∥ ∑ T, PCUICTyping.typing (H := config.extraction_checker_flags) p.1 [] p.2 T ∥) : eprogram_env :=
2626
let wfe := build_wf_env_from_env p.1.1 (map_squash (PCUICTyping.wf_ext_wf _) wfΣ) in
2727
let wfext := optim_make_wf_env_ext (guard:=guard) wfe p.1.2 _ in
28-
let t := ErasureFunction.erase (nor:=PCUICSN.extraction_normalizing) optimized_abstract_env_ext_impl wfext nil p.2
28+
let t := ErasureFunction.erase (nor:=PCUICSN.extraction_normalizing) optimized_abstract_env_impl wfext nil p.2
2929
(fun Σ wfΣ => let '(sq (T; ty)) := wt in PCUICTyping.iswelltyped ty) in
3030
let Σ' := ErasureFunction.erase_global_fast optimized_abstract_env_impl
3131
(EAstUtils.term_global_deps t) wfe (p.1.(PCUICAst.PCUICEnvironment.declarations)) _ in
@@ -39,7 +39,7 @@ Qed.
3939
Obligation Tactic := idtac.
4040

4141
Import Extract.
42-
42+
4343
Definition erase_program {guard : abstract_guard_impl} (p : pcuic_program)
4444
(wtp : ∥ wt_pcuic_program (cf:=config.extraction_checker_flags) p ∥) : eprogram_env :=
4545
erase_pcuic_program (guard := guard) p (map_squash fst wtp) (map_squash snd wtp).
@@ -52,8 +52,8 @@ Proof.
5252
intros [etaenv etat]. split;
5353
unfold erase_program, erase_pcuic_program; cbn.
5454
eapply ErasureFunction.expanded_erase_global_fast, etaenv; reflexivity.
55-
eapply (ErasureFunction.expanded_erase_fast (X_type:=optimized_abstract_env_impl)).
56-
reflexivity. eapply etat.
55+
apply: (ErasureFunction.expanded_erase_fast (X_type:=optimized_abstract_env_impl)).
56+
reflexivity. exact etat.
5757
Qed.
5858

5959
Lemma expanded_eprogram_env_expanded_eprogram_cstrs p :
@@ -83,7 +83,7 @@ Next Obligation.
8383
- unfold erase_program, erase_pcuic_program in e. simpl. cbn in e. injection e. intros <- <-.
8484
split.
8585
eapply ErasureFunction.erase_global_fast_wf_glob.
86-
eapply (ErasureFunction.erase_wellformed_fast (X_type:=optimized_abstract_env_impl)).
86+
apply: (ErasureFunction.erase_wellformed_fast (X_type:=optimized_abstract_env_impl)).
8787
- rewrite -e. cbn.
8888
now eapply expanded_erase_program.
8989
Qed.

erasure/theories/ErasureCorrectness.v

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,10 +1136,10 @@ Proof.
11361136
induction er; intros wf.
11371137
- constructor.
11381138
- cbn. destruct cb' as [[]].
1139-
cbn in *. depelim wf.
1139+
cbn in *. depelim wf. destruct o.
11401140
rewrite [forallb _ _](IHer wf) andb_true_r.
11411141
red in H. destruct cb as [ty []]; cbn in *.
1142-
unshelve eapply PCUICClosedTyp.subject_closed in o0. cbn. split; auto.
1142+
unshelve eapply PCUICClosedTyp.subject_closed in on_global_decl_d. cbn. split; auto.
11431143
eapply erases_closed in H; tea. elim H.
11441144
cbn. apply IHer. now depelim wf.
11451145
- depelim wf.
@@ -1194,11 +1194,11 @@ Proof.
11941194
move: wf. red in er; cbn in er.
11951195
induction er; intros wf.
11961196
- constructor.
1197-
- cbn. depelim wf.
1197+
- cbn. depelim wf. destruct o.
11981198
constructor; eauto.
11991199
2:eapply erases_global_decls_fresh; tea.
12001200
cbn. red in H.
1201-
do 2 red in o0.
1201+
do 2 red in on_global_decl_d.
12021202
destruct (cst_body cb).
12031203
destruct (E.cst_body cb') => //. cbn.
12041204
set (Σ'' := ({| universes := _ |}, _)) in *.
@@ -1209,7 +1209,7 @@ Proof.
12091209
specialize (H0 H Σ'). eapply H0.
12101210
eapply erases_global_all_deps; tea. split => //.
12111211
destruct (E.cst_body cb') => //.
1212-
- depelim wf.
1212+
- depelim wf. destruct o.
12131213
constructor; eauto.
12141214
now eapply erases_mutual_inductive_body_wf.
12151215
now eapply erases_global_decls_fresh; tea.

0 commit comments

Comments
 (0)