Skip to content

Commit e8f8078

Browse files
authored
Merge pull request MetaRocq#1233 from thomas-lamiaux/adapt21498
Adapt to rocq-prover/rocq#21498 (changed computation uniform parameters)
2 parents 7d447a5 + 841eeb0 commit e8f8078

File tree

8 files changed

+50
-37
lines changed

8 files changed

+50
-37
lines changed

pcuic/theories/Bidirectional/BDTyping.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Inductive infering `{checker_flags} (Σ : global_env_ext) (Γ : context) : term
124124
primitive_constant Σ (prim_val_tag p) = Some prim_ty ->
125125
declared_constant Σ prim_ty cdecl ->
126126
primitive_invariants (prim_val_tag p) cdecl ->
127-
primitive_typing_hyps checking Σ Γ p ->
127+
primitive_typing_hyps (checking Σ) Σ Γ p ->
128128
Σ ;;; Γ |- tPrim p ▹ prim_type p prim_ty
129129

130130
with infering_sort `{checker_flags} (Σ : global_env_ext) (Γ : context) : term -> sort -> Type :=
@@ -467,8 +467,8 @@ Section BidirectionalInduction.
467467
primitive_constant Σ (prim_val_tag p) = Some prim_ty ->
468468
declared_constant Σ prim_ty cdecl ->
469469
primitive_invariants (prim_val_tag p) cdecl ->
470-
primitive_typing_hyps checking Σ Γ p ->
471-
primitive_typing_hyps (fun _ => Pcheck) Σ Γ p ->
470+
primitive_typing_hyps (checking Σ) Σ Γ p ->
471+
primitive_typing_hyps Pcheck Σ Γ p ->
472472
Pinfer Γ (tPrim p) (prim_type p prim_ty)) ->
473473

474474
(forall (Γ : context) (t T : term) (u : sort),

pcuic/theories/PCUICExpandLetsCorrectness.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ Section wtsub.
932932
All (fun d => wt Γ d.(dtype) × wt (Γ ,,, fix_context mfix) d.(dbody)) mfix
933933
| tEvar _ l => False
934934
| tRel i => wf_local Σ Γ
935-
| tPrim p => primitive_typing_hyps (fun Σ Γ t T => wt Γ t) Σ Γ p
935+
| tPrim p => primitive_typing_hyps (fun Γ t T => wt Γ t) Σ Γ p
936936
| _ => unit
937937
end.
938938
Import PCUICGeneration PCUICInversion.

pcuic/theories/PCUICInversion.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ Section Inversion.
341341
primitive_constant Σ (prim_val_tag p) = Some prim_ty,
342342
declared_constant Σ prim_ty cdecl,
343343
primitive_invariants (prim_val_tag p) cdecl,
344-
primitive_typing_hyps typing Σ Γ p &
344+
primitive_typing_hyps (typing Σ) Σ Γ p &
345345
Σ ;;; Γ ⊢ prim_type p prim_ty ≤ T].
346346
Proof.
347347
intros Γ p T h. depind h.

pcuic/theories/PCUICProgress.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ forall (P : global_env_ext -> context -> term -> term -> Type)
265265
primitive_constant Σ (prim_val_tag p) = Some prim_ty ->
266266
declared_constant Σ prim_ty cdecl ->
267267
primitive_invariants (prim_val_tag p) cdecl ->
268-
primitive_typing_hyps typing Σ Γ p ->
269-
primitive_typing_hyps P Σ Γ p ->
268+
primitive_typing_hyps (typing Σ) Σ Γ p ->
269+
primitive_typing_hyps (P Σ) Σ Γ p ->
270270
P Σ Γ (tPrim p) (prim_type p prim_ty)) ->
271271

272272
(forall Σ (wfΣ : wf Σ.1) (Γ : context) (wfΓ : wf_local Σ Γ) (t A B : term) s,
@@ -453,8 +453,8 @@ Lemma typing_ind_env `{cf : checker_flags} :
453453
primitive_constant Σ (prim_val_tag p) = Some prim_ty ->
454454
declared_constant Σ prim_ty cdecl ->
455455
primitive_invariants (prim_val_tag p) cdecl ->
456-
primitive_typing_hyps typing Σ Γ p ->
457-
primitive_typing_hyps P Σ Γ p ->
456+
primitive_typing_hyps (typing Σ) Σ Γ p ->
457+
primitive_typing_hyps (P Σ) Σ Γ p ->
458458
P Σ Γ (tPrim p) (prim_type p prim_ty)) ->
459459

460460

pcuic/theories/PCUICTyping.v

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -144,23 +144,23 @@ Reserved Notation "'wf_local' Σ Γ " (at level 9, Σ, Γ at next level).
144144

145145
Reserved Notation " Σ ;;; Γ |- t : T " (at level 50, Γ, t, T at next level).
146146

147-
Variant case_side_conditions `{checker_flags} wf_local_fun typing Σ Γ ci p ps mdecl idecl indices predctx :=
147+
Variant case_side_conditions `{checker_flags} wf_local_funΣ typingΣ Σ Γ ci p ps mdecl idecl indices predctx :=
148148
| case_side_info
149149
(eq_npars : mdecl.(ind_npars) = ci.(ci_npar))
150150
(wf_pred : wf_predicate mdecl idecl p)
151151
(cons : consistent_instance_ext Σ (ind_universes mdecl) p.(puinst))
152-
(wf_pctx : wf_local_fun Σ (Γ ,,, predctx))
152+
(wf_pctx : wf_local_funΣ (Γ ,,, predctx))
153153
(* The predicate context is fixed, it is only used as a cache for information from the
154154
global environment *)
155155
(conv_pctx : eq_context_upto_names p.(pcontext) (ind_predicate_context ci.(ci_ind) mdecl idecl))
156156
(allowed_elim : is_allowed_elimination Σ idecl.(ind_kelim) ps)
157157
(elim_relevance : isSortRel ps ci.(ci_relevance))
158-
(ind_inst : ctx_inst (typing Σ) Γ (p.(pparams) ++ indices)
158+
(ind_inst : ctx_inst typingΣ Γ (p.(pparams) ++ indices)
159159
(List.rev (subst_instance p.(puinst)
160160
(ind_params mdecl ,,, ind_indices idecl : context))))
161161
(not_cofinite : isCoFinite mdecl.(ind_finite) = false).
162162

163-
Variant case_branch_typing `{checker_flags} wf_local_fun typing Σ Γ (ci:case_info) p ps mdecl idecl ptm brs :=
163+
Variant case_branch_typing `{checker_flags} wf_local_funΣ typingΣ Γ (ci:case_info) p ps mdecl idecl ptm brs :=
164164
| case_branch_info
165165
(wf_brs : wf_branches idecl brs)
166166
(brs_ty :
@@ -169,23 +169,23 @@ Variant case_branch_typing `{checker_flags} wf_local_fun typing Σ Γ (ci:case_i
169169
parameters and universe instance *)
170170
eq_context_upto_names br.(bcontext) (cstr_branch_context ci mdecl cdecl) ×
171171
let brctxty := case_branch_type ci.(ci_ind) mdecl idecl p br ptm i cdecl in
172-
(wf_local_fun Σ (Γ ,,, brctxty.1) ×
173-
((typing Σ (Γ ,,, brctxty.1) br.(bbody) (brctxty.2)) ×
174-
(typing Σ (Γ ,,, brctxty.1) brctxty.2 (tSort ps)))))
172+
(wf_local_funΣ (Γ ,,, brctxty.1) ×
173+
((typingΣ (Γ ,,, brctxty.1) br.(bbody) (brctxty.2)) ×
174+
(typingΣ (Γ ,,, brctxty.1) brctxty.2 (tSort ps)))))
175175
0 idecl.(ind_ctors) brs).
176176

177177
Variant primitive_typing_hyps `{checker_flags}
178-
(typing : forall (Σ : global_env_ext) (Γ : context), term -> term -> Type)
178+
(typingΣ : forall (Γ : context), term -> term -> Type)
179179
Σ Γ : prim_val term -> Type :=
180-
| prim_int_hyps i : primitive_typing_hyps typing Σ Γ (primInt; primIntModel i)
181-
| prim_float_hyps f : primitive_typing_hyps typing Σ Γ (primFloat; primFloatModel f)
182-
| prim_string_hyps s : primitive_typing_hyps typing Σ Γ (primString; primStringModel s)
180+
| prim_int_hyps i : primitive_typing_hyps typingΣ Σ Γ (primInt; primIntModel i)
181+
| prim_float_hyps f : primitive_typing_hyps typingΣ Σ Γ (primFloat; primFloatModel f)
182+
| prim_string_hyps s : primitive_typing_hyps typingΣ Σ Γ (primString; primStringModel s)
183183
| prim_array_hyps a
184184
(wfl : wf_universe Σ (Universe.make' a.(array_level)))
185-
(hty : typing Σ Γ a.(array_type) (tSort (sType (Universe.make' a.(array_level)))))
186-
(hdef : typing Σ Γ a.(array_default) a.(array_type))
187-
(hvalue : All (fun x => typing Σ Γ x a.(array_type)) a.(array_value)) :
188-
primitive_typing_hyps typing Σ Γ (primArray; primArrayModel a).
185+
(hty : typingΣ Γ a.(array_type) (tSort (sType (Universe.make' a.(array_level)))))
186+
(hdef : typingΣ Γ a.(array_default) a.(array_type))
187+
(hvalue : All (fun x => typingΣ Γ x a.(array_type)) a.(array_value)) :
188+
primitive_typing_hyps typingΣ Σ Γ (primArray; primArrayModel a).
189189
Derive Signature for primitive_typing_hyps.
190190

191191
Equations prim_type (p : prim_val term) (cst : kername) : term :=
@@ -253,9 +253,9 @@ Inductive typing `{checker_flags} (Σ : global_env_ext) (Γ : context) : term ->
253253
declared_inductive Σ ci.(ci_ind) mdecl idecl ->
254254
Σ ;;; Γ ,,, predctx |- p.(preturn) : tSort ps ->
255255
Σ ;;; Γ |- c : mkApps (tInd ci.(ci_ind) p.(puinst)) (p.(pparams) ++ indices) ->
256-
case_side_conditions (fun Σ Γ => wf_local Σ Γ) typing Σ Γ ci p ps
256+
case_side_conditions (fun Γ => wf_local Σ Γ) (typing Σ) Σ Γ ci p ps
257257
mdecl idecl indices predctx ->
258-
case_branch_typing (fun Σ Γ => wf_local Σ Γ) typing Σ Γ ci p ps
258+
case_branch_typing (fun Γ => wf_local Σ Γ) (typing Σ) Γ ci p ps
259259
mdecl idecl ptm brs ->
260260
Σ ;;; Γ |- tCase ci p c brs : mkApps ptm (indices ++ [c])
261261

@@ -288,7 +288,7 @@ Inductive typing `{checker_flags} (Σ : global_env_ext) (Γ : context) : term ->
288288
primitive_constant Σ (prim_val_tag p) = Some prim_ty ->
289289
declared_constant Σ prim_ty cdecl ->
290290
primitive_invariants (prim_val_tag p) cdecl ->
291-
primitive_typing_hyps typing Σ Γ p ->
291+
primitive_typing_hyps (typing Σ) Σ Γ p ->
292292
Σ ;;; Γ |- tPrim p : prim_type p prim_ty
293293

294294
| type_Cumul : forall t A B s,
@@ -422,7 +422,7 @@ Section PrimitiveSize.
422422
Context {cf} (typing : global_env_ext -> context -> term -> term -> Type)
423423
(typing_size : forall {Σ Γ t T}, typing Σ Γ t T -> size).
424424

425-
Definition primitive_typing_hyps_size Σ Γ p (h : primitive_typing_hyps typing Σ Γ p) : size.
425+
Definition primitive_typing_hyps_size Σ Γ p (h : primitive_typing_hyps (typing Σ) Σ Γ p) : size.
426426
destruct h.
427427
- exact 0.
428428
- exact 0.
@@ -805,8 +805,8 @@ Lemma typing_ind_env_app_size `{cf : checker_flags} :
805805
primitive_constant Σ (prim_val_tag p) = Some prim_ty ->
806806
declared_constant Σ prim_ty cdecl ->
807807
primitive_invariants (prim_val_tag p) cdecl ->
808-
primitive_typing_hyps typing Σ Γ p ->
809-
primitive_typing_hyps P Σ Γ p ->
808+
primitive_typing_hyps (typing Σ) Σ Γ p ->
809+
primitive_typing_hyps (P Σ) Σ Γ p ->
810810
P Σ Γ (tPrim p) (prim_type p prim_ty)) ->
811811

812812
(forall Σ (wfΣ : wf Σ.1) (Γ : context) (wfΓ : wf_local Σ Γ) (t A B : term) s,
@@ -1268,8 +1268,8 @@ Lemma typing_ind_env `{cf : checker_flags} :
12681268
primitive_constant Σ (prim_val_tag p) = Some prim_ty ->
12691269
declared_constant Σ prim_ty cdecl ->
12701270
primitive_invariants (prim_val_tag p) cdecl ->
1271-
primitive_typing_hyps typing Σ Γ p ->
1272-
primitive_typing_hyps P Σ Γ p ->
1271+
primitive_typing_hyps (typing Σ) Σ Γ p ->
1272+
primitive_typing_hyps (P Σ) Σ Γ p ->
12731273
P Σ Γ (tPrim p) (prim_type p prim_ty)) ->
12741274

12751275
(forall Σ (wfΣ : wf Σ.1) (Γ : context) (wfΓ : wf_local Σ Γ) (t A B : term) s,

pcuic/theories/Typing/PCUICWeakeningConfigTyp.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Proof.
7979
=> is_var l; clear -H IH; induction H as [|???? IH']; constructor;
8080
[eapply @lift_typing_size_impl with (Psize := @typing_size _ _ _) (tu := p); unfold lift_sorting_size, on_def_body_sorting_size in *; cbn; intros|]
8181
| [ H : case_side_conditions _ _ _ _ _ _ _ _ _ _ _ |- case_side_conditions _ _ _ _ _ _ _ _ _ _ _ ] => destruct H; constructor
82-
| [ H : case_branch_typing _ _ _ _ _ _ _ _ _ _ _ |- case_branch_typing _ _ _ _ _ _ _ _ _ _ _ ] => destruct H; constructor
82+
| [ H : case_branch_typing _ _ _ _ _ _ _ _ _ _ |- case_branch_typing _ _ _ _ _ _ _ _ _ _ ] => destruct H; constructor
8383
| _ => idtac
8484
end.
8585
all: unfold wf_branches in *.

quotation/theories/ToPCUIC/PCUIC/PCUICTyping.v

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,24 @@ From MetaRocq.Quotation.ToPCUIC.QuotationOf.PCUIC Require Import PCUICAst.Instan
1515

1616
#[export] Instance quote_FixCoFix : ground_quotable FixCoFix := ltac:(destruct 1; exact _).
1717

18-
#[export] Instance quote_case_side_conditions {cf wf_local_fun typing Σ Γ ci p ps mdecl idecl indices predctx} {qwf_local_fun : quotation_of wf_local_fun} {qtyping : quotation_of typing} {quote_wf_local_fun : forall Γ, ground_quotable (@wf_local_fun Σ Γ)} {quote_typing : forall i t, ground_quotable (typing Σ Γ i t)} : ground_quotable (@case_side_conditions cf wf_local_fun typing Σ Γ ci p ps mdecl idecl indices predctx) := ltac:(destruct 1; exact _).
18+
#[export] Instance quote_case_side_conditions {cf wf_local_funΣ typingΣ Σ Γ ci p ps mdecl idecl indices predctx}
19+
{qwf_local_fun : quotation_of wf_local_funΣ} {qtyping : quotation_of typingΣ}
20+
{quote_wf_local_fun : forall Γ, ground_quotable (@wf_local_funΣ Γ)}
21+
{quote_typing : forall i t, ground_quotable (typingΣ Γ i t)} :
22+
ground_quotable (@case_side_conditions cf (wf_local_funΣ) (typingΣ) Σ Γ ci p ps mdecl idecl indices predctx) :=
23+
ltac:(destruct 1; exact _).
1924

20-
#[export] Instance quote_case_branch_typing {cf wf_local_fun typing Σ Γ ci p ps mdecl idecl ptm brs} {qwf_local_fun : quotation_of wf_local_fun} {qtyping : quotation_of typing} {quote_wf_local_fun : forall Γ, ground_quotable (@wf_local_fun Σ Γ)} {quote_typing : forall Γ i t, ground_quotable (typing Σ Γ i t)} : ground_quotable (@case_branch_typing cf wf_local_fun typing Σ Γ ci p ps mdecl idecl ptm brs)
25+
#[export] Instance quote_case_branch_typing {cf wf_local_funΣ typingΣ Γ ci p ps mdecl idecl ptm brs}
26+
{qwf_local_fun : quotation_of wf_local_funΣ}
27+
{qtyping : quotation_of typingΣ}
28+
{quote_wf_local_fun : forall Γ, ground_quotable (@wf_local_funΣ Γ)}
29+
{quote_typing : forall Γ i t, ground_quotable (typingΣ Γ i t)} :
30+
ground_quotable (@case_branch_typing cf wf_local_funΣ typingΣ Γ ci p ps mdecl idecl ptm brs)
2131
:= ltac:(destruct 1; exact _).
2232

23-
#[export] Instance quote_primitive_typing_hyps {cf typing Σ Γ p} {qtyping : quotation_of typing} {quote_typing : forall x y, ground_quotable (typing Σ Γ x y)} : ground_quotable (@primitive_typing_hyps cf typing Σ Γ p)
33+
#[export] Instance quote_primitive_typing_hyps {cf typingΣ Σ Γ p} {qtyping : quotation_of typingΣ}
34+
{quote_typing : forall x y, ground_quotable (typingΣ Γ x y)} :
35+
ground_quotable (@primitive_typing_hyps cf (typingΣ) Σ Γ p)
2436
:= ltac:(destruct 1; exact _).
2537

2638
(* So long as pcuic does axiomatic guard checking, we can't do better than axiomatizing it here *)

safechecker/theories/PCUICTypeChecker.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,8 @@ Section Typecheck.
14221422
(Γ : context) (wfΓ : forall Σ (wfΣ : abstract_env_ext_rel X Σ), ∥ wf_local Σ Γ ∥).
14231423

14241424
Local Obligation Tactic := idtac.
1425-
Equations? check_primitive_typing (p : prim_val) : typing_result_comp (forall Σ (wfΣ : abstract_env_ext_rel X Σ), ∥ primitive_typing_hyps checking Σ Γ p ∥) :=
1425+
Equations? check_primitive_typing (p : prim_val) : typing_result_comp
1426+
(forall Σ (wfΣ : abstract_env_ext_rel X Σ), ∥ primitive_typing_hyps (checking Σ) Σ Γ p ∥) :=
14261427
| (primInt; primIntModel i) := ret _
14271428
| (primFloat; primFloatModel f) := ret _
14281429
| (primString; primStringModel f) := ret _

0 commit comments

Comments
 (0)