fix(named): free variable preservation for the full metaterm reduction including RX (M5 metatheory)

This commit is contained in:
milner committed 2026-09-22 23:55:00 +02:00
1 parent 14d299fb22
commit 841e59d481
6 files changed
+482 -312

No files matched your search

+9
View File
@@ -83,6 +83,8 @@ digraph theorem_deps {
nplug_fv_mono [label="nplug_fv_mono", color="#38761d", fillcolor="#d9ead3", style="filled", fontcolor="#222222", tooltip="nplug_fv_mono theory/NamedMeta.v https://arxiv.org/html/2312.13270v1", shape=ellipse];
nplug_fv_upper [label="nplug_fv_upper", color="#38761d", fillcolor="#d9ead3", style="filled", fontcolor="#222222", tooltip="nplug_fv_upper theory/NamedMeta.v https://arxiv.org/html/2312.13270v1", shape=ellipse];
nred_core_fv [label="nred_core_fv", color="#38761d", fillcolor="#d9ead3", style="filled", fontcolor="#222222", tooltip="nred_core_fv theory/NamedMeta.v https://arxiv.org/html/2312.13270v1", shape=ellipse];
nplug_esub_fv [label="nplug_esub_fv", color="#38761d", fillcolor="#d9ead3", style="filled", fontcolor="#222222", tooltip="nplug_esub_fv theory/NamedMeta.v https://arxiv.org/html/2312.13270v1", shape=ellipse];
nred_fv [label="nred_fv", color="#38761d", fillcolor="#d9ead3", style="filled", fontcolor="#222222", tooltip="nred_fv theory/NamedMeta.v https://arxiv.org/html/2312.13270v1", shape=ellipse];
par_red1_iff [label="par_red1_iff", color="#38761d", fillcolor="#d9ead3", style="filled", fontcolor="#222222", tooltip="par_red1_iff theory/Parallel.v https://arxiv.org/html/2312.13270v1", shape=ellipse];
red1_in_par [label="red1_in_par", color="#38761d", fillcolor="#d9ead3", style="filled", fontcolor="#222222", tooltip="red1_in_par theory/Parallel.v https://arxiv.org/html/2312.13270v1", shape=ellipse];
par_context [label="par_context", color="#38761d", fillcolor="#d9ead3", style="filled", fontcolor="#222222", tooltip="par_context theory/Parallel.v https://arxiv.org/html/2312.13270v1", shape=ellipse];
@@ -194,6 +196,13 @@ digraph theorem_deps {
in_filter_neq -> nred_core_fv;
nplug_fv_mono -> nred_core_fv;
nplug_fv_upper -> nred_core_fv;
filter_neq_in -> nplug_esub_fv;
in_filter_neq -> nplug_esub_fv;
filter_neq_in -> nred_fv;
in_filter_neq -> nred_fv;
nplug_esub_fv -> nred_fv;
nplug_fv_mono -> nred_fv;
nplug_fv_upper -> nred_fv;
par_red1_iff -> par_to_red1_or_eq;
par_red1_iff -> red1_or_eq_to_par;
has_red_spec -> check_term_true;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 634 KiB

After

Width:  |  Height:  |  Size: 736 KiB

+372 -312
View File
File diff suppressed because it is too large. Load diff

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 102 KiB

+12
View File
@@ -1,8 +1,12 @@
status milestone kind name file
proved M0 infra Es_ctx_any theory/NamedMeta.v
proved M0 infra Es_refl_any theory/NamedMeta.v
proved M0 infra Es_sym_any theory/NamedMeta.v
proved M0 infra Es_trans_any theory/NamedMeta.v
proved M0 infra Plus_mred_of_Plus_red1 theory/Metaterm.v
proved M0 infra eqC_in_Es theory/NamedMeta.v
proved M0 infra filter_neq_in theory/NamedMeta.v
proved M0 infra in_filter_neq theory/NamedMeta.v
proved M0 infra isubst_meta_in theory/NamedMeta.v
proved M0 infra isubst_meta_notin theory/NamedMeta.v
proved M0 infra mfvs_close_m theory/Metaterm.v
@@ -10,10 +14,18 @@ proved M0 infra mfvs_lift_m theory/Metaterm.v
proved M0 infra mfvs_open_m theory/Metaterm.v
proved M0 infra mred_B_intro theory/Metaterm.v
proved M0 infra mred_context theory/Metaterm.v
proved M0 infra mred_full_comp_pure theory/Metaterm.v
proved M0 infra mred_gc_intro theory/Metaterm.v
proved M0 infra mred_of_red1 theory/Metaterm.v
proved M0 infra mred_plus_one theory/Metaterm.v
proved M0 infra mred_r_intro theory/Metaterm.v
proved M0 infra mred_term_context theory/Metaterm.v
proved M0 infra nplug_esub_fv theory/NamedMeta.v
proved M0 infra nplug_fv_mono theory/NamedMeta.v
proved M0 infra nplug_fv_upper theory/NamedMeta.v
proved M0 infra nred_R_intro theory/NamedMeta.v
proved M0 infra nred_core_fv theory/NamedMeta.v
proved M0 infra nred_fv theory/NamedMeta.v
proved M0 infra of_trm_close theory/Metaterm.v
proved M0 infra of_trm_fvs theory/Metaterm.v
proved M0 infra of_trm_injective theory/Metaterm.v
+29
View File
@@ -850,6 +850,35 @@
"nplug_fv_upper"
]
},
{
"id": "nplug_esub_fv",
"label": "nplug_esub_fv",
"kind": "infra",
"status": "proved",
"milestone": "M0",
"section": "",
"file": "theory/NamedMeta.v",
"depends": [
"filter_neq_in",
"in_filter_neq"
]
},
{
"id": "nred_fv",
"label": "nred_fv",
"kind": "infra",
"status": "proved",
"milestone": "M0",
"section": "",
"file": "theory/NamedMeta.v",
"depends": [
"filter_neq_in",
"in_filter_neq",
"nplug_esub_fv",
"nplug_fv_mono",
"nplug_fv_upper"
]
},
{
"id": "par_red1_iff",
"label": "par_red1_iff",
+60
View File
@@ -240,3 +240,63 @@ Qed.
Print Assumptions nplug_fv_mono.
Print Assumptions nplug_fv_upper.
Print Assumptions nred_core_fv.
Lemma nplug_esub_fv : forall C X d x u y,
y <> x ->
In y (nfv (nplug C (NESub (NMVar X d) x u))) ->
In y (nfv (nplug C (NMVar X d))) \/ In y (nfv u).
Proof.
induction C; intros X d x u y Hne Hy; simpl in *.
- apply in_app_iff in Hy as [Hy|Hy].
+ left. apply in_filter_neq in Hy as [Hy _]. simpl. exact Hy.
+ right. exact Hy.
- apply in_app_iff in Hy as [Hy|Hy].
+ apply (IHC X d x u y Hne) in Hy. destruct Hy as [Hy|Hy].
* left. apply in_app_iff. left. exact Hy.
* right. exact Hy.
+ left. apply in_app_iff. right. exact Hy.
- apply in_app_iff in Hy as [Hy|Hy].
+ left. apply in_app_iff. left. exact Hy.
+ apply (IHC X d x u y Hne) in Hy. destruct Hy as [Hy|Hy].
* left. apply in_app_iff. right. exact Hy.
* right. exact Hy.
- apply in_filter_neq in Hy as [Hy Hz].
apply (IHC X d x u y Hne) in Hy. destruct Hy as [Hy|Hy].
+ left. apply filter_neq_in; [exact Hy | exact Hz].
+ right. exact Hy.
- apply in_app_iff in Hy as [Hy|Hy].
+ apply in_filter_neq in Hy as [Hy Hz].
apply (IHC X d x u y Hne) in Hy. destruct Hy as [Hy|Hy].
* left. apply in_app_iff. left. apply filter_neq_in; [exact Hy | exact Hz].
* right. exact Hy.
+ left. apply in_app_iff. right. exact Hy.
- apply in_app_iff in Hy as [Hy|Hy].
+ left. apply in_app_iff. left. exact Hy.
+ apply (IHC X d x u y Hne) in Hy. destruct Hy as [Hy|Hy].
* left. apply in_app_iff. right. exact Hy.
* right. exact Hy.
Qed.
Lemma nred_fv : forall t t', nred t t' -> incl (nfv t') (nfv t).
Proof.
intros t t' H. induction H; simpl; unfold incl in *.
- intros y Hy. exact Hy.
- intros y Hy. apply in_app_iff. left.
apply filter_neq_in; [exact Hy | intro E; apply H; subst; exact Hy].
- intros y Hy. apply in_app_iff in Hy as [Hy|Hy].
+ apply in_filter_neq in Hy as [Hy Hne].
apply (nplug_esub_fv C X d x u y Hne) in Hy. destruct Hy as [Hy|Hy].
* apply in_app_iff. left. apply filter_neq_in; [exact Hy | exact Hne].
* apply in_app_iff. right. exact Hy.
+ apply in_app_iff. right. exact Hy.
- intros y Hy. apply in_app_iff in Hy as [Hy|Hy].
+ apply in_filter_neq in Hy as [Hy Hne].
apply (nplug_fv_upper C u (NVar x)) in Hy. apply in_app_iff in Hy as [Hy|Hy].
* apply in_app_iff. left. apply filter_neq_in; [exact Hy | exact Hne].
* apply in_app_iff. right. exact Hy.
+ apply in_app_iff. right. exact Hy.
- apply nplug_fv_mono. exact IHnred.
Qed.
Print Assumptions nplug_esub_fv.
Print Assumptions nred_fv.