add(named): free variable preservation for the named metaterm reduction (M5 metatheory)

This commit is contained in:
sneeker committed 2026-09-22 23:38:00 +02:00
1 parent 3f0b7d3aaa
commit ba65b61b4a
5 files changed
+556 -288

No files matched your search

+13
View File
@@ -78,6 +78,11 @@ digraph theorem_deps {
Es_refl_any [label="Es_refl_any", color="#38761d", fillcolor="#d9ead3", style="filled", fontcolor="#222222", tooltip="Es_refl_any theory/NamedMeta.v https://arxiv.org/html/2312.13270v1", shape=ellipse];
Es_sym_any [label="Es_sym_any", color="#38761d", fillcolor="#d9ead3", style="filled", fontcolor="#222222", tooltip="Es_sym_any theory/NamedMeta.v https://arxiv.org/html/2312.13270v1", shape=ellipse];
Es_trans_any [label="Es_trans_any", color="#38761d", fillcolor="#d9ead3", style="filled", fontcolor="#222222", tooltip="Es_trans_any theory/NamedMeta.v https://arxiv.org/html/2312.13270v1", shape=ellipse];
in_filter_neq [label="in_filter_neq", color="#38761d", fillcolor="#d9ead3", style="filled", fontcolor="#222222", tooltip="in_filter_neq theory/NamedMeta.v https://arxiv.org/html/2312.13270v1", shape=ellipse];
filter_neq_in [label="filter_neq_in", color="#38761d", fillcolor="#d9ead3", style="filled", fontcolor="#222222", tooltip="filter_neq_in theory/NamedMeta.v https://arxiv.org/html/2312.13270v1", shape=ellipse];
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];
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];
@@ -181,6 +186,14 @@ digraph theorem_deps {
red1r_fv -> lemma_2_1_fv_preserved;
Plus_red1_context -> lemma_2_3_beta_sim;
lemma_2_2_full_comp -> lemma_2_3_beta_sim;
filter_neq_in -> nplug_fv_mono;
in_filter_neq -> nplug_fv_mono;
filter_neq_in -> nplug_fv_upper;
in_filter_neq -> nplug_fv_upper;
filter_neq_in -> nred_core_fv;
in_filter_neq -> nred_core_fv;
nplug_fv_mono -> nred_core_fv;
nplug_fv_upper -> nred_core_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: 608 KiB

After

Width:  |  Height:  |  Size: 634 KiB

+381 -288
View File
File diff suppressed because it is too large. Load diff

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 98 KiB

+61
View File
@@ -789,6 +789,67 @@
"file": "theory/NamedMeta.v",
"depends": []
},
{
"id": "in_filter_neq",
"label": "in_filter_neq",
"kind": "infra",
"status": "proved",
"milestone": "M0",
"section": "",
"file": "theory/NamedMeta.v",
"depends": []
},
{
"id": "filter_neq_in",
"label": "filter_neq_in",
"kind": "infra",
"status": "proved",
"milestone": "M0",
"section": "",
"file": "theory/NamedMeta.v",
"depends": []
},
{
"id": "nplug_fv_mono",
"label": "nplug_fv_mono",
"kind": "infra",
"status": "proved",
"milestone": "M0",
"section": "",
"file": "theory/NamedMeta.v",
"depends": [
"filter_neq_in",
"in_filter_neq"
]
},
{
"id": "nplug_fv_upper",
"label": "nplug_fv_upper",
"kind": "infra",
"status": "proved",
"milestone": "M0",
"section": "",
"file": "theory/NamedMeta.v",
"depends": [
"filter_neq_in",
"in_filter_neq"
]
},
{
"id": "nred_core_fv",
"label": "nred_core_fv",
"kind": "infra",
"status": "proved",
"milestone": "M0",
"section": "",
"file": "theory/NamedMeta.v",
"depends": [
"filter_neq_in",
"in_filter_neq",
"nplug_fv_mono",
"nplug_fv_upper"
]
},
{
"id": "par_red1_iff",
"label": "par_red1_iff",
+101
View File
@@ -139,3 +139,104 @@ Print Assumptions eqC_in_Es.
Print Assumptions Es_refl_any.
Print Assumptions Es_sym_any.
Print Assumptions Es_trans_any.
Lemma in_filter_neq : forall y x l,
In y (filter (fun z => negb (Nat.eqb z x)) l) -> In y l /\ y <> x.
Proof.
intros y x l H. apply filter_In in H. destruct H as [Hl Hp]. split; [exact Hl |].
apply Nat.eqb_neq. destruct (Nat.eqb y x) eqn:E; [| reflexivity].
simpl in Hp. discriminate Hp.
Qed.
Lemma filter_neq_in : forall y x l,
In y l -> y <> x -> In y (filter (fun z => negb (Nat.eqb z x)) l).
Proof.
intros y x l Hl Hne. apply filter_In. split; [exact Hl |].
apply Nat.eqb_neq in Hne. rewrite Hne. reflexivity.
Qed.
Lemma nplug_fv_mono : forall C t s,
incl (nfv t) (nfv s) -> incl (nfv (nplug C t)) (nfv (nplug C s)).
Proof.
induction C; intros t s Hincl; unfold incl in *; simpl in *.
- apply Hincl.
- intros y Hy. apply in_app_iff in Hy as [Hy|Hy].
+ apply in_app_iff. left. apply (IHC t s Hincl). exact Hy.
+ apply in_app_iff. right. exact Hy.
- intros y Hy. apply in_app_iff in Hy as [Hy|Hy].
+ apply in_app_iff. left. exact Hy.
+ apply in_app_iff. right. apply (IHC t s Hincl). exact Hy.
- intros y Hy. apply in_filter_neq in Hy as [Hy Hne].
apply filter_neq_in.
+ apply (IHC t s Hincl). exact Hy.
+ exact Hne.
- intros y Hy. apply in_app_iff in Hy as [Hy|Hy].
+ apply in_app_iff. left. apply in_filter_neq in Hy as [Hy Hne].
apply filter_neq_in.
* apply (IHC t s Hincl). exact Hy.
* exact Hne.
+ apply in_app_iff. right. exact Hy.
- intros y Hy. apply in_app_iff in Hy as [Hy|Hy].
+ apply in_app_iff. left. exact Hy.
+ apply in_app_iff. right. apply (IHC t s Hincl). exact Hy.
Qed.
Lemma nplug_fv_upper : forall C t s,
incl (nfv (nplug C t)) (nfv (nplug C s) ++ nfv t).
Proof.
induction C; intros t s; unfold incl in *; simpl in *.
- intros y Hy. apply in_app_iff. right. exact Hy.
- intros y Hy. apply in_app_iff in Hy as [Hy|Hy].
+ apply (IHC t s) in Hy. apply in_app_iff in Hy as [Hy|Hy].
* apply in_app_iff. left. apply in_app_iff. left. exact Hy.
* apply in_app_iff. right. exact Hy.
+ apply in_app_iff. left. apply in_app_iff. right. exact Hy.
- intros y Hy. apply in_app_iff in Hy as [Hy|Hy].
+ apply in_app_iff. left. apply in_app_iff. left. exact Hy.
+ apply (IHC t s) in Hy. apply in_app_iff in Hy as [Hy|Hy].
* apply in_app_iff. left. apply in_app_iff. right. exact Hy.
* apply in_app_iff. right. exact Hy.
- intros y Hy. apply in_filter_neq in Hy as [Hy Hne].
apply (IHC t s) 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.
- intros y Hy. apply in_app_iff in Hy as [Hy|Hy].
+ apply in_filter_neq in Hy as [Hy Hne].
apply (IHC t s) in Hy. apply in_app_iff in Hy as [Hy|Hy].
* apply in_app_iff. left. apply in_app_iff. left. apply filter_neq_in; [exact Hy | exact Hne].
* apply in_app_iff. right. exact Hy.
+ apply in_app_iff. left. apply in_app_iff. right. exact Hy.
- intros y Hy. apply in_app_iff in Hy as [Hy|Hy].
+ apply in_app_iff. left. apply in_app_iff. left. exact Hy.
+ apply (IHC t s) in Hy. apply in_app_iff in Hy as [Hy|Hy].
* apply in_app_iff. left. apply in_app_iff. right. exact Hy.
* apply in_app_iff. right. exact Hy.
Qed.
Inductive nred_core : ntrm -> ntrm -> Prop :=
| ncore_B : forall t x u, nred_core (NApp (NLam x t) u) (NESub t x u)
| ncore_Gc : forall t x u, ~ In x (nfv t) -> nred_core (NESub t x u) t
| ncore_R : forall C x u phi,
In x phi -> (forall y, In y (nfv u) -> In y phi) -> cavoid C phi = true ->
nred_core (NESub (nplug C (NVar x)) x u) (NESub (nplug C u) x u)
| ncore_ctx : forall C t t', nred_core t t' -> nred_core (nplug C t) (nplug C t').
Lemma nred_core_fv : forall t t', nred_core 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_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_core.
Qed.
Print Assumptions nplug_fv_mono.
Print Assumptions nplug_fv_upper.
Print Assumptions nred_core_fv.