Skip to content

Commit c7fabcc

Browse files
committed
wip
1 parent 138a5d3 commit c7fabcc

File tree

3 files changed

+103
-14
lines changed

3 files changed

+103
-14
lines changed

02-ml-normalization.mm1

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,19 +183,29 @@ theorem forall_framing {x: EVar} (phi1 phi2: Pattern x)
183183
$ (forall x phi1) -> forall x phi2 $ =
184184
'(con3 @ exists_framing @ con3 h);
185185

186-
theorem or_exists_disjoint {x: EVar} (phi1: Pattern) (phi2: Pattern x):
186+
theorem disjoint_forall: $ phi -> forall x phi $ = '(con2 @ exists_generalization_disjoint id);
187+
188+
theorem or_exists_fresh {x: EVar} (phi1 phi2: Pattern x) (freshness_phi1: $ _eFresh x phi1 $):
187189
$ (phi1 \/ exists x phi2) <-> exists x (phi1 \/ phi2) $ =
188190
'(ibii
189191
(eori
190192
(syl exists_intro_same_var orl)
191193
(exists_generalization eFresh_exists_same_var @ syl exists_intro_same_var orr))
192-
(exists_generalization (eFresh_or eFresh_disjoint eFresh_exists_same_var) @ eori orl @ orrd exists_intro_same_var));
194+
(exists_generalization (eFresh_or freshness_phi1 eFresh_exists_same_var) @ eori orl @ orrd exists_intro_same_var));
193195

194-
theorem imp_exists_disjoint {x: EVar} (phi1: Pattern) (phi2: Pattern x):
196+
theorem or_exists_disjoint {x: EVar} (phi1: Pattern) (phi2: Pattern x):
197+
$ (phi1 \/ exists x phi2) <-> exists x (phi1 \/ phi2) $ =
198+
'(or_exists_fresh eFresh_disjoint);
199+
200+
theorem imp_exists_fresh {x: EVar} (phi1 phi2: Pattern x) (freshness_phi1: $ _eFresh x phi1 $):
195201
$ (phi1 -> exists x phi2) <-> exists x (phi1 -> phi2) $ =
196202
'(ibii
197-
(rsyl (imim1 dne) @ rsyl (anl or_exists_disjoint) @ exists_framing @ imim1 notnot1)
198-
(rsyl (exists_framing @ imim1 dne) @ rsyl (anr or_exists_disjoint) @ imim1 notnot1));
203+
(rsyl (imim1 dne) @ rsyl (anl @ or_exists_fresh @ eFresh_not freshness_phi1) @ exists_framing @ imim1 notnot1)
204+
(rsyl (exists_framing @ imim1 dne) @ rsyl (anr @ or_exists_fresh @ eFresh_not freshness_phi1) @ imim1 notnot1));
205+
206+
theorem imp_exists_disjoint {x: EVar} (phi1: Pattern) (phi2: Pattern x):
207+
$ (phi1 -> exists x phi2) <-> exists x (phi1 -> phi2) $ =
208+
'(imp_exists_fresh eFresh_disjoint);
199209

200210
theorem and_exists {x: EVar} (phi1 phi2: Pattern x):
201211
$ (exists x (phi1 /\ phi2)) -> ((exists x phi1) /\ (exists x phi2)) $ =
@@ -212,14 +222,23 @@ theorem or_exists_bi {x: EVar} (phi1 phi2: Pattern x):
212222
$ (exists x (phi1 \/ phi2)) <-> ((exists x phi1) \/ (exists x phi2)) $ =
213223
'(ibii or_exists_forwards or_exists_reverse);
214224

215-
theorem and_exists_disjoint_forwards {x: EVar} (phi1: Pattern) (phi2: Pattern x):
225+
theorem and_exists_fresh_forwards {x: EVar} (phi1 phi2: Pattern x) (freshness_phi1: $ _eFresh x phi1 $):
216226
$ (exists x (phi1 /\ phi2)) -> (phi1 /\ exists x phi2) $ =
217227
'(iand
218-
(rsyl (exists_framing anl) (exists_generalization_disjoint id))
228+
(rsyl (exists_framing anl) (exists_generalization freshness_phi1 id))
219229
(exists_framing anr));
230+
theorem and_exists_disjoint_forwards {x: EVar} (phi1: Pattern) (phi2: Pattern x):
231+
$ (exists x (phi1 /\ phi2)) -> (phi1 /\ exists x phi2) $ =
232+
'(and_exists_fresh_forwards eFresh_disjoint);
233+
theorem and_exists_fresh_reverse {x: EVar} (phi1 phi2: Pattern x) (freshness_phi1: $ _eFresh x phi1 $):
234+
$ (phi1 /\ exists x phi2) -> (exists x (phi1 /\ phi2)) $ =
235+
'(impcom @ syl (anr @ imp_exists_fresh freshness_phi1) (exists_framing ian2));
220236
theorem and_exists_disjoint_reverse {x: EVar} (phi1: Pattern) (phi2: Pattern x):
221237
$ (phi1 /\ exists x phi2) -> (exists x (phi1 /\ phi2)) $ =
222-
'(impcom @ syl (anr imp_exists_disjoint) (exists_framing ian2));
238+
'(and_exists_fresh_reverse eFresh_disjoint);
239+
theorem and_exists_fresh {x: EVar} (phi1 phi2: Pattern x) (freshness_phi1: $ _eFresh x phi1 $):
240+
$ (exists x (phi1 /\ phi2)) <-> (phi1 /\ exists x phi2) $ =
241+
'(ibii (and_exists_fresh_forwards freshness_phi1) (and_exists_fresh_reverse freshness_phi1));
223242
theorem and_exists_disjoint {x: EVar} (phi1: Pattern) (phi2: Pattern x):
224243
$ (exists x (phi1 /\ phi2)) <-> (phi1 /\ exists x phi2) $ =
225244
'(ibii and_exists_disjoint_forwards and_exists_disjoint_reverse);

12-proof-system-p.mm1

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ theorem eFresh_mem {x y: EVar} (phi: Pattern x y)
2121
theorem eFresh_ctximp_same_var {box: SVar} (ctx phi: Pattern box):
2222
$ _eFresh x (ctximp_app box ctx phi) $ =
2323
'(eFresh_exists_same_var);
24+
theorem eFresh_subset {x: EVar} (phi psi: Pattern x)
25+
(h1: $ _eFresh x phi $)
26+
(h2: $ _eFresh x psi $):
27+
$ _eFresh x (phi C= psi) $ =
28+
'(eFresh_not @ eFresh_ceil @ eFresh_not @ eFresh_imp h1 h2);
2429

2530
theorem sFresh_ceil {X: SVar} (phi: Pattern X)
2631
(h: $ _sFresh X phi $):
@@ -246,6 +251,12 @@ theorem var_subst {x y: EVar} (phi: Pattern x y):
246251
theorem var_subst_same_var {x: EVar} (phi: Pattern x):
247252
$ (forall x phi) -> phi $ = '(con1 exists_intro_same_var);
248253

254+
255+
theorem imp_forall_fresh {x: EVar} (phi1 phi2: Pattern x) (freshness_phi1: $ _eFresh x phi1 $):
256+
$ (phi1 -> forall x phi2) <-> forall x (phi1 -> phi2) $ =
257+
'(con2b @ bitr (cong_of_equiv_exists @ con3b @ imeq2i notnot) @ and_exists_fresh freshness_phi1);
258+
259+
249260
theorem lemma_46 (phi: Pattern) {box: SVar} (ctx: Pattern box)
250261
(p : $ phi $):
251262
$ ~ (app[ (~ phi) / box ] ctx) $ = '(syl propag_bot @ framing @ notnot1 p);
@@ -555,7 +566,7 @@ theorem lemma_14 {box: SVar} (ctx psi phi1 phi2: Pattern box)
555566
(imim2 @ norm (norm_imp_l @ norm_trans appCtxNested_disjoint @ norm_ctxApp_pt norm_refl defNorm) (! lemma_56 box2))
556567
);
557568

558-
theorem appCtx_pointwise {box: SVar} (ctx: Pattern box) (phi: Pattern):
569+
theorem appCtx_pointwise {box: SVar} {x: EVar} (ctx: Pattern box) (phi: Pattern):
559570
$ app[ phi / box ] ctx <-> exists x ((app[ eVar x / box ] ctx) /\ x in phi) $ =
560571
'(bitr (cong_of_equiv_appCtx (bicom lemma_62)) @
561572
bitr exists_appCtx @
@@ -1208,4 +1219,19 @@ theorem pointwise_decomposition_imp {box: SVar} {x: EVar} (ctx: Pattern box) (ph
12081219

12091220
do {
12101221
(def (pointwise_decomposition_imp_subst subst) '(norm (norm_imp (norm_forall @ norm_imp_r @ norm_subset ,subst norm_refl) @ norm_subset ,subst norm_refl) pointwise_decomposition_imp))
1211-
};
1222+
};
1223+
1224+
theorem subset_mem_disjoint_lemma {x: EVar} (phi: Pattern) (psi: Pattern x)
1225+
(freshness_psi: $ _eFresh x psi $):
1226+
$ (phi C= psi) -> forall x ((x in phi) -> x in psi) $ =
1227+
'(anr (imp_forall_fresh @ eFresh_subset eFresh_disjoint freshness_psi) @ univ_gene @ com12 @ rsyl eVar_in_subset_forward @ rsyl subset_trans @ imim2 eVar_in_subset_reverse);
1228+
1229+
theorem in_exists_lemma {x: EVar} (phi: Pattern x): $ (x in exists x (eVar x /\ phi)) -> x in phi $ = '();
1230+
1231+
theorem in_exists_to_forall_domain {x: EVar} (pred: Pattern x) (phi: Pattern):
1232+
$ (phi C= exists x (eVar x /\ pred)) -> forall x (x in phi -> x in pred)$ =
1233+
'(rsyl (subset_mem_disjoint_lemma eFresh_exists_same_var) @ forall_framing @ imim2 in_exists_lemma);
1234+
1235+
theorem eq_pred_pointwise {box1 box2: SVar} {x: EVar} (phi: Pattern x box1 box2) (ctx1 ctx2: Pattern x box1 box2):
1236+
$ (phi C= exists x (eVar x /\ ((app[ eVar x / box1 ] ctx1) == (app[ eVar x / box2 ] ctx2)))) ->
1237+
((app[ phi / box1 ] ctx1) == (app[ phi / box2 ] ctx2)) $ = '();

nominal/lambda.mm1

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,56 @@ axiom subst_lam {a b: EVar} (plug phi: Pattern a b):
201201

202202

203203

204-
theorem subst_induction {a b: EVar} (phi1 phi2 phi3: Pattern):
204+
theorem subst_induction {a b: EVar} (phi1 plug1 plug2: Pattern):
205205
$ (is_var (eVar a)) ->
206206
(is_var (eVar b)) ->
207207
(is_exp phi1) ->
208-
(is_exp phi2) ->
209-
(is_exp phi3) ->
208+
(is_exp plug1) ->
209+
(is_exp plug2) ->
210210
(fresh_for a phi3) ->
211-
((subst b (subst a phi1 phi2) phi3) == (subst a (subst b phi1 phi3) (subst b phi2 phi3))) $ =
211+
((subst b (subst a phi1 plug1) plug2) == (subst a (subst b phi1 plug2) (subst b plug1 plug2))) $ =
212212
'();
213+
214+
215+
216+
term reduce_sym: Symbol;
217+
def reduce (phi: Pattern): Pattern = $ (sym reduce_sym) @@ phi $;
218+
219+
-- axiom reduce_subst {a: EVar} (phi1 phi2: Pattern a):
220+
-- $
221+
-- (reduce (lc_app (lc_lam_a a phi1) phi2)) == () $;
222+
223+
224+
225+
226+
-- term red_sym: Symbol;
227+
-- def red (phi: Pattern) : Pattern = $ (sym red_sym) @@ phi $;
228+
229+
-- axiom red_app (phi rho: Pattern)
230+
-- (phi_sorting: $ is_of_sort phi Exp $)
231+
-- (rho_sorting: $ is_of_sort rho Exp $):
232+
-- $ (red (app phi rho)) == (app (red phi) rho) \/ (app phi (red rho)) \/ (s_exists )$;
233+
234+
235+
-- def double (phi: Pattern) = exists x (a(a(x)) /\ a(x) in phi)
236+
237+
238+
239+
240+
--- term Type_sym: Symbol;
241+
--- def Type: Pattern = $ sym Type_sym $;
242+
--- def Types: Pattern = $ dom Type $;
243+
---
244+
--- term fn_type_sym: Symbol;
245+
--- def fn_type (phi rho: Pattern): Pattern = $ (sym fn_type_sym) @@ phi @@ rho $;
246+
--- axiom function_fn_type: $ ,(is_function '(sym fn_type_symfn_type_sym) '[Type] 'Type) $;
247+
---
248+
---
249+
--- def is_typing_context (phi: Pattern): Pattern = $ ,(is_function '(phi) '[Var] 'Type) $;
250+
---
251+
--- def wf (c t: Pattern) {a u t1 t2: EVar} {X: SVar}: Pattern =
252+
--- $ mu X (
253+
--- (s_exists Var a ((lc_var a) /\ t == (c @@ a)))
254+
--- \/ (s_exists Type u (lc_app () ()))
255+
--- \/ ()
256+
--- ) $;

0 commit comments

Comments
 (0)