diff --git a/graphs/dependency.dot b/graphs/dependency.dot index f75a20f..80a62a0 100644 --- a/graphs/dependency.dot +++ b/graphs/dependency.dot @@ -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; diff --git a/graphs/dependency.png b/graphs/dependency.png index e52f959..f66b2a0 100644 Binary files a/graphs/dependency.png and b/graphs/dependency.png differ diff --git a/graphs/dependency.svg b/graphs/dependency.svg index aa208d0..bee9854 100644 --- a/graphs/dependency.svg +++ b/graphs/dependency.svg @@ -4,19 +4,19 @@ - - + + theorem_deps - -Milner's Lambda-Calculus with Partial Substitutions - theorem dependency (M4) -proved -    -stated -    -planned -    -blocked + +Milner's Lambda-Calculus with Partial Substitutions - theorem dependency (M4) +proved +    +stated +    +planned +    +blocked fvs_lift @@ -138,8 +138,8 @@ open_rec_occurs_false - -open_rec_occurs_false + +open_rec_occurs_false @@ -155,8 +155,8 @@ open_rec_occurs_false->open_rec_zplug_lift - - + + @@ -170,38 +170,38 @@ open_rec_occurs_false->full_comp_aux - - + + - + subst_notin - + subst_notin - + open_rec_occurs_false->subst_notin - - + + - + full_comp_aux_sub - + full_comp_aux_sub - + open_rec_occurs_false->full_comp_aux_sub - - + + @@ -213,7 +213,7 @@ - + close_rec_notin->subst_notin @@ -264,16 +264,16 @@ - + subst_lc_self - + subst_lc_self - + subst_fvar_self->subst_lc_self @@ -288,16 +288,16 @@ - + subst_other - + subst_other - + subst_fvar_other->subst_other @@ -330,16 +330,16 @@ - + star_red_sub_full_comp - + star_red_sub_full_comp - + Plus_to_Star->star_red_sub_full_comp @@ -693,7 +693,7 @@ - + occurs_count_zero->full_comp_aux_sub @@ -726,22 +726,22 @@ occurs_lift_self - -occurs_lift_self + +occurs_lift_self occurs_lift_self->occurs_count_zfill_plug - - + + occurs_lift_self->open_rec_zplug_lift - - + + @@ -759,7 +759,7 @@ - + zdecs_nonempty->full_comp_aux_sub @@ -771,7 +771,7 @@ - + occurs_count_zfill_plug->full_comp_aux_sub @@ -783,7 +783,7 @@ - + open_rec_zplug_lift->full_comp_aux_sub @@ -876,31 +876,31 @@ - + gen_fv_preserved - + gen_fv_preserved - + lemma_2_1_fv_preserved->gen_fv_preserved - + corpus_fv_preserved - + corpus_fv_preserved - + lemma_2_1_fv_preserved->corpus_fv_preserved @@ -995,101 +995,194 @@ - + +in_filter_neq + + +in_filter_neq + + + + + +nplug_fv_mono + + +nplug_fv_mono + + + + + +in_filter_neq->nplug_fv_mono + + + + + +nplug_fv_upper + + +nplug_fv_upper + + + + + +in_filter_neq->nplug_fv_upper + + + + + +nred_core_fv + + +nred_core_fv + + + + + +in_filter_neq->nred_core_fv + + + + + +filter_neq_in + + +filter_neq_in + + + + + +filter_neq_in->nplug_fv_mono + + + + + +filter_neq_in->nplug_fv_upper + + + + + +filter_neq_in->nred_core_fv + + + + + +nplug_fv_mono->nred_core_fv + + + + + +nplug_fv_upper->nred_core_fv + + + + + par_red1_iff - - -par_red1_iff + + +par_red1_iff - + par_to_red1_or_eq - - -par_to_red1_or_eq + + +par_to_red1_or_eq - + par_red1_iff->par_to_red1_or_eq - - + + - + red1_or_eq_to_par - - -red1_or_eq_to_par + + +red1_or_eq_to_par - + par_red1_iff->red1_or_eq_to_par - - + + - + red1_in_par - - -red1_in_par + + +red1_in_par - + par_context - - -par_context + + +par_context - + par_reflexive - - -par_reflexive + + +par_reflexive - + gen_list_length - - -gen_list_length + + +gen_list_length - + check_term_true - + check_term_true - + check_all_true - + check_all_true - + check_term_true->check_all_true @@ -1101,27 +1194,27 @@ - + gen_sound - + gen_sound - + gen_complete - + gen_complete - + zdecs_sound - + zdecs_sound @@ -1134,91 +1227,91 @@ - + root_steps_sound - + root_steps_sound - + zdecs_sound->root_steps_sound - + zdecs_sound->full_comp_aux_sub - + zdecs_complete - + zdecs_complete - + root_steps_complete - + root_steps_complete - + zdecs_complete->root_steps_complete - + positions_at - + positions_at - + steps_sound - + steps_sound - + positions_at->steps_sound - + root_steps_sound->steps_sound - + steps_complete - + steps_complete - + root_steps_complete->steps_complete @@ -1230,160 +1323,160 @@ - + steps_sound->gen_sound - + steps_sound_red1 - + steps_sound_red1 - + steps_sound->steps_sound_red1 - + has_red_spec - + has_red_spec - + steps_sound->has_red_spec - + corpus_sound - + corpus_sound - + steps_sound->corpus_sound - + steps_sound_red1->check_term_true - + steps_sound_red1->gen_fv_preserved - + nf_iff_steps_nil - + nf_iff_steps_nil - + steps_sound_red1->nf_iff_steps_nil - + steps_sound_red1->corpus_fv_preserved - + positions_hole - + positions_hole - + root_steps_in_steps - + root_steps_in_steps - + positions_hole->root_steps_in_steps - + root_steps_in_steps->steps_complete - + plug_comp - + plug_comp - + plug_comp->steps_complete - + positions_comp - + positions_comp - + positions_comp->steps_complete - + at_ctx_comp - + at_ctx_comp - + at_ctx_comp->steps_complete @@ -1395,415 +1488,415 @@ - + steps_complete->gen_complete - + steps_complete->has_red_spec - + steps_complete->nf_iff_steps_nil - + corpus_complete - + corpus_complete - + steps_complete->corpus_complete - + has_red_f - + has_red_f - + has_red_f->has_red_spec - + has_red_spec->check_term_true - + red1_dec - + red1_dec - + has_red_spec->red1_dec - + corpus_decides - + corpus_decides - + has_red_spec->corpus_decides - + normal_form_iff_nf - + normal_form_iff_nf - + nf_iff_steps_nil->normal_form_iff_nf - + nf_dec - + nf_dec - + nf_iff_steps_nil->nf_dec - + open_rec_app - - -open_rec_app + + +open_rec_app - + open_rec_lam - - -open_rec_lam + + +open_rec_lam - + open_rec_esub - - -open_rec_esub + + +open_rec_esub - + close_rec_app - - -close_rec_app + + +close_rec_app - + close_rec_lam - - -close_rec_lam + + +close_rec_lam - + close_rec_esub - - -close_rec_esub + + +close_rec_esub - + subst_app - - -subst_app + + +subst_app - + subst_lam - - -subst_lam + + +subst_lam - + subst_esub - - -subst_esub + + +subst_esub - + open_rec_lc_atom - - -open_rec_lc_atom + + +open_rec_lc_atom - + open_rec_lc - - -open_rec_lc + + +open_rec_lc - + open_rec_lc_atom->open_rec_lc - - + + - + red_sub_root_to_red1 - - -red_sub_root_to_red1 + + +red_sub_root_to_red1 - + red_sub_to_red1 - - -red_sub_to_red1 + + +red_sub_to_red1 - + red_sub_root_to_red1->red_sub_to_red1 - - + + - + red_sub_context - - -red_sub_context + + +red_sub_context - + Star_red_sub_context - - -Star_red_sub_context + + +Star_red_sub_context - + red_sub_context->Star_red_sub_context - - + + - + red_sub_gc - + red_sub_gc - + red_sub_gc->full_comp_aux_sub - + red_gc_to_red_sub - + red_gc_to_red_sub - + red_sub_gc->red_gc_to_red_sub - + red_sub_r - + red_sub_r - + red_sub_r->full_comp_aux_sub - + occurs_zfill - - -occurs_zfill + + +occurs_zfill - + zfill_occurs0 - - -zfill_occurs0 + + +zfill_occurs0 - + occurs_zfill->zfill_occurs0 - - + + - + R_Gc_disjoint - - -R_Gc_disjoint + + +R_Gc_disjoint - + zfill_occurs0->R_Gc_disjoint - - + + - + plus_red_sub_full_comp - + plus_red_sub_full_comp - + full_comp_aux_sub->plus_red_sub_full_comp - + plus_red_sub_full_comp->star_red_sub_full_comp - + es_count_plug_mono - - -es_count_plug_mono + + +es_count_plug_mono - + red_gc_measure - - -red_gc_measure + + +red_gc_measure - + es_count_plug_mono->red_gc_measure - - + + - + red_gc_terminates - - -red_gc_terminates + + +red_gc_terminates - + red_gc_measure->red_gc_terminates - - + + diff --git a/graphs/theorems.json b/graphs/theorems.json index 672b9e8..7536fca 100644 --- a/graphs/theorems.json +++ b/graphs/theorems.json @@ -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", diff --git a/theory/NamedMeta.v b/theory/NamedMeta.v index a267974..c9ada7e 100644 --- a/theory/NamedMeta.v +++ b/theory/NamedMeta.v @@ -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.