@@ -102,15 +102,23 @@ Proof.
102102 - simpl. apply ConstraintSet.union_spec. right; eauto.
103103Qed .
104104
105+ Lemma satisfies_subset φ φ' val :
106+ ConstraintSet.Subset φ φ' ->
107+ satisfies val φ' ->
108+ satisfies val φ.
109+ Proof .
110+ intros sub sat ? isin.
111+ apply sat, sub; auto.
112+ Qed .
113+
105114Lemma leq_universe_subset {cf:checker_flags} ctrs ctrs' t u
106115 : ConstraintSet.Subset ctrs ctrs'
107116 -> leq_universe ctrs t u -> leq_universe ctrs' t u.
108117Proof .
109118 intros Hctrs H. unfold leq_universe in *.
110119 destruct check_univs; [|trivial].
111120 intros v Hv. apply H.
112- intros ctr Hc. apply Hv.
113- apply Hctrs; eauto.
121+ eapply satisfies_subset; eauto.
114122Qed .
115123
116124Lemma eq_universe_subset {cf:checker_flags} ctrs ctrs' t u
@@ -120,8 +128,7 @@ Proof.
120128 intros Hctrs H. unfold eq_universe in *.
121129 destruct check_univs; [|trivial].
122130 intros v Hv. apply H.
123- intros ctr Hc. apply Hv.
124- apply Hctrs; eauto.
131+ eapply satisfies_subset; eauto.
125132Qed .
126133
127134
@@ -204,6 +211,22 @@ Proof.
204211 - econstructor 3; eauto. eapply weakening_env_red1; eauto. exists Σ''; eauto.
205212Qed .
206213
214+ Lemma weakening_env_is_allowed_elimination `{CF:checker_flags} Σ Σ' φ u allowed :
215+ wf Σ' -> extends Σ Σ' ->
216+ is_allowed_elimination (global_ext_constraints (Σ, φ)) u allowed ->
217+ is_allowed_elimination (global_ext_constraints (Σ', φ)) u allowed.
218+ Proof .
219+ intros wfΣ [Σ'' ->] al.
220+ unfold is_allowed_elimination in *.
221+ destruct check_univs; auto.
222+ intros val sat.
223+ unshelve epose proof (al val _) as al.
224+ { eapply satisfies_subset; eauto.
225+ apply global_ext_constraints_app. }
226+ destruct allowed; auto; cbn in *; destruct ?; auto.
227+ Qed .
228+ Hint Resolve weakening_env_is_allowed_elimination : extends.
229+
207230Lemma weakening_env_declared_constant `{CF:checker_flags}:
208231 forall (Σ : global_env) cst (decl : constant_body),
209232 declared_constant Σ cst decl ->
@@ -436,8 +459,10 @@ Proof.
436459 intros decl cs []. unshelve econstructor; eauto.
437460 red in on_ctype |- *. eauto.
438461 clear on_cindices cstr_eq cstr_args_length cstr_concl_head.
439- induction (cshape_args cs); simpl in *; auto.
440- ** eapply (extends_wf_universe (Σ:=(Σ,φ)) Σ'); auto.
462+ revert on_cargs.
463+ generalize (cshape_sorts cs).
464+ induction (cshape_args cs); destruct l; simpl in *; auto.
465+ ** destruct a as [na [b|] ty]; simpl in *; intuition eauto.
441466 ** destruct a as [na [b|] ty]; simpl in *; intuition eauto.
442467 ** clear on_ctype on_cargs.
443468 revert on_cindices.
@@ -448,32 +473,34 @@ Proof.
448473 simpl in *. move: on_ctype_variance.
449474 unfold cstr_respects_variance. destruct variance_universes as [[[univs u] u']|]; auto.
450475 intros [args idxs]. split.
451- eapply (All2_local_env_impl args); intros.
476+ eapply (context_relation_impl args); intros.
477+ inversion X; constructor; auto.
478+ eapply weakening_env_cumul; eauto.
479+ eapply weakening_env_conv; eauto.
452480 eapply weakening_env_cumul; eauto.
453481 eapply (All2_impl idxs); intros.
454482 eapply weakening_env_conv; eauto.
455- -- unfold check_ind_sorts in *. destruct universe_family; auto.
456- --- split; [apply fst in ind_sorts|apply snd in ind_sorts].
457- eapply Forall_impl; tea; cbn.
458- intros. eapply leq_universe_subset; tea.
459- apply weakening_env_global_ext_constraints; tea.
460- destruct indices_matter; [|trivial]. clear -ind_sorts HPΣ wfΣ' Hext.
461- induction ind_indices; simpl in *; auto.
462- ** eapply (extends_wf_universe (Σ:=(Σ,φ)) Σ'); auto.
463- ** destruct a as [na [b|] ty]; simpl in *; intuition eauto.
464- --- split; [apply fst in ind_sorts|apply snd in ind_sorts].
465- eapply Forall_impl; tea; cbn.
466- intros. eapply leq_universe_subset; tea.
467- apply weakening_env_global_ext_constraints; tea.
468- destruct indices_matter; [|trivial]. clear -ind_sorts HPΣ wfΣ' Hext.
469- induction ind_indices; simpl in *; auto.
470- ** eapply (extends_wf_universe (Σ:=(Σ,φ)) Σ'); auto.
471- ** destruct a as [na [b|] ty]; simpl in *; intuition eauto.
483+ -- unfold check_ind_sorts in *.
484+ destruct Universe.is_prop; auto.
485+ destruct Universe.is_sprop; auto.
486+ split; [apply fst in ind_sorts|apply snd in ind_sorts].
487+ eapply Forall_impl; tea; cbn.
488+ intros. eapply Forall_impl; eauto; simpl.
489+ intros; eapply leq_universe_subset; tea.
490+ apply weakening_env_global_ext_constraints; tea.
491+ destruct indices_matter; [|trivial]. clear -ind_sorts HPΣ wfΣ' Hext.
492+ induction ind_indices; simpl in *; auto.
493+ ** eapply (extends_wf_universe (Σ:=(Σ,φ)) Σ'); auto.
494+ ** destruct a as [na [b|] ty]; simpl in *; intuition eauto.
472495 -- intros v onv.
473496 move: (onIndices v onv). unfold ind_respects_variance.
474497 destruct variance_universes as [[[univs u] u']|] => //.
475- intros idx; eapply (All2_local_env_impl idx); simpl.
476- intros par par' t t'. eapply weakening_env_cumul; eauto.
498+ intros idx; eapply (context_relation_impl idx); simpl.
499+ intros par par' t t'.
500+ intros d. inv d; constructor; auto.
501+ eapply weakening_env_cumul; eauto.
502+ eapply weakening_env_conv; eauto.
503+ eapply weakening_env_cumul; eauto.
477504 - red in onP |- *. eapply All_local_env_impl; eauto.
478505Qed .
479506
0 commit comments