@@ -6,7 +6,7 @@ From MetaCoq.Template Require Import EtaExpand TemplateProgram.
66From MetaCoq.PCUIC Require PCUICAst PCUICAstUtils PCUICProgram.
77From MetaCoq.SafeChecker Require Import PCUICErrors PCUICWfEnvImpl.
88From MetaCoq.Erasure Require EAstUtils ErasureFunction ErasureCorrectness EPretty Extract .
9- From MetaCoq.Erasure Require Import EProgram.
9+ From MetaCoq.Erasure Require Import EProgram EInlining EBeta .
1010From MetaCoq.ErasurePlugin Require Import ETransform.
1111
1212Import PCUICProgram.
@@ -31,11 +31,12 @@ Import EWcbvEval.
3131Local Obligation Tactic := program_simpl.
3232
3333Record erasure_configuration := {
34- enable_cofix_to_fix : bool;
34+ enable_unsafe : bool;
3535 enable_typed_erasure : bool;
3636 enable_fast_remove_params : bool;
3737 dearging_config : dearging_config;
38- inductives_mapping : EReorderCstrs.inductives_mapping
38+ inductives_mapping : EReorderCstrs.inductives_mapping;
39+ inlining : KernameSet.t
3940 }.
4041
4142Definition default_dearging_config :=
@@ -45,19 +46,21 @@ Definition default_dearging_config :=
4546
4647(* This runs the cofix -> fix translation which is not entirely verified yet *)
4748Definition default_erasure_config :=
48- {| enable_cofix_to_fix := true;
49+ {| enable_unsafe := true;
4950 dearging_config := default_dearging_config;
5051 enable_typed_erasure := true;
5152 enable_fast_remove_params := true;
52- inductives_mapping := [] |}.
53+ inductives_mapping := [];
54+ inlining := KernameSet.empty |}.
5355
5456(* This runs only the verified phases without the typed erasure and "fast" remove params *)
5557Definition safe_erasure_config :=
56- {| enable_cofix_to_fix := false;
58+ {| enable_unsafe := false;
5759 enable_typed_erasure := false;
5860 enable_fast_remove_params := false;
5961 dearging_config := default_dearging_config;
60- inductives_mapping := [] |}.
62+ inductives_mapping := [];
63+ inlining := KernameSet.empty |}.
6164
6265Axiom assume_welltyped_template_program_expansion :
6366 forall p (wtp : ∥ wt_template_program_env p ∥),
@@ -95,15 +98,18 @@ Definition final_wcbv_flags := {|
9598Program Definition optional_unsafe_transforms econf :=
9699 let efl := EConstructorsAsBlocks.switch_cstr_as_blocks
97100 (EInlineProjections.disable_projections_env_flag (ERemoveParams.switch_no_params EWellformed.all_env_flags)) in
98- ETransform.optional_self_transform econf.(enable_cofix_to_fix )
101+ ETransform.optional_self_transform econf.(enable_unsafe )
99102 ((* Rebuild the efficient lookup table *)
100103 rebuild_wf_env_transform (efl := efl) false false ▷
101104 (* Coinductives & cofixpoints are translated to inductive types and thunked fixpoints *)
102105 coinductive_to_inductive_transformation efl
103106 (has_app := eq_refl) (has_box := eq_refl) (has_rel := eq_refl) (has_pars := eq_refl) (has_cstrblocks := eq_refl) ▷
104107 reorder_cstrs_transformation efl final_wcbv_flags econf.(inductives_mapping) ▷
105108 rebuild_wf_env_transform (efl := efl) false false ▷
106- unbox_transformation efl final_wcbv_flags).
109+ unbox_transformation efl final_wcbv_flags ▷
110+ inline_transformation efl final_wcbv_flags econf.(inlining) ▷
111+ forget_inlining_info_transformation efl final_wcbv_flags ▷
112+ betared_transformation efl final_wcbv_flags).
107113
108114Program Definition verified_lambdabox_pipeline {guard : abstract_guard_impl}
109115 (efl := EWellformed.all_env_flags)
258264
259265Next Obligation .
260266 unfold optional_unsafe_transforms. cbn.
261- unfold optional_self_transform. cbn.
262- destruct enable_cofix_to_fix => //.
267+ destruct enable_unsafe => //.
263268Qed .
264269
265270Local Obligation Tactic := intros; eauto.
@@ -358,7 +363,7 @@ Next Obligation.
358363 cbn in H. split; cbn; intuition eauto .
359364Qed .
360365Next Obligation .
361- cbn in H. unfold optional_unsafe_transforms. destruct enable_cofix_to_fix => //.
366+ cbn in H. unfold optional_unsafe_transforms. destruct enable_unsafe => //.
362367Qed .
363368Next Obligation .
364369 cbn in H. split; cbn; intuition eauto .
@@ -403,7 +408,7 @@ Program Definition run_erase_program {guard : abstract_guard_impl} econf :=
403408Next Obligation .
404409Proof .
405410 unfold optional_unsafe_transforms.
406- destruct enable_cofix_to_fix => //.
411+ destruct enable_unsafe => //.
407412Qed .
408413
409414Program Definition erase_and_print_template_program econf (p : Ast.Env.program) : string :=
@@ -418,21 +423,23 @@ Next Obligation.
418423Qed .
419424
420425Definition erasure_fast_config :=
421- {| enable_cofix_to_fix := false;
426+ {| enable_unsafe := false;
422427 dearging_config := default_dearging_config;
423428 enable_typed_erasure := false;
424429 enable_fast_remove_params := true;
425- inductives_mapping := [] |}.
430+ inductives_mapping := [];
431+ inlining := KernameSet.empty |}.
426432
427433Program Definition erase_fast_and_print_template_program (p : Ast.Env.program) : string :=
428434 erase_and_print_template_program erasure_fast_config p.
429435
430436Definition typed_erasure_config :=
431- {| enable_cofix_to_fix := false;
437+ {| enable_unsafe := false;
432438 dearging_config := default_dearging_config;
433439 enable_typed_erasure := true;
434440 enable_fast_remove_params := true;
435- inductives_mapping := [] |}.
441+ inductives_mapping := [];
442+ inlining := KernameSet.empty |}.
436443
437444(* Parameterized by a configuration for dearging, allowing to, e.g., override masks. *)
438445Program Definition typed_erase_and_print_template_program (p : Ast.Env.program)
0 commit comments