Skip to content

Commit 1b3782b

Browse files
committed
wip
1 parent 1338869 commit 1b3782b

File tree

7 files changed

+107
-302
lines changed

7 files changed

+107
-302
lines changed

12-proof-system-p.mm1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ theorem appCtxRVar {box: SVar} (phi1 phi2: Pattern):
167167
theorem appCtxLRVar {box: SVar} (phi1 phi2 phi3: Pattern):
168168
$ Norm (app[ phi1 / box ] (app (app phi3 (sVar box)) phi2)) (app (app phi3 phi1) phi2) $ =
169169
'(norm_trans appCtxL_disjoint @ norm_app appCtxRVar norm_refl);
170+
theorem appCtxRLRVar {box: SVar} (phi1 phi2 phi3 phi4: Pattern):
171+
$ Norm (app[ phi1 / box ] (app phi4 (app (app phi3 (sVar box)) phi2))) (app phi4 (app (app phi3 phi1) phi2)) $ =
172+
'(norm_trans appCtxR_disjoint @ norm_app norm_refl appCtxLRVar);
170173

171174
theorem app_framing_l (h: $phi1 -> phi2$): $(app phi1 psi) -> (app phi2 psi)$ =
172175
'(norm (norm_imp appCtxLVar appCtxLVar) (! framing box _ _ _ h));
@@ -1119,3 +1122,11 @@ theorem ceil_idempotency_for_pred (phi: Pattern): $ ((phi == bot) \/ (phi == top
11191122
(mp ,(func_subst_imp_to_var 'x $eVar x == |^ eVar x ^| $) @ lemma_46_floor @ ibii absurdum @ norm (norm_imp_l defNorm) propag_bot)
11201123
(mp ,(func_subst_imp_to_var 'x $eVar x == |^ eVar x ^| $) @ lemma_46_floor @ bicom @ taut_equiv_top @ framing_def imp_top definedness))
11211124
(mp ,(func_subst_imp_to_var 'x $(eVar x == bot) \/ (eVar x == top)$) ceil_is_pred)));
1125+
1126+
theorem pointwise_decomposition {box: SVar} {x: EVar} (ctx: Pattern box) (phi psi: Pattern)
1127+
(hyp: $ (x in phi) -> (app[ eVar x / box ] ctx C= psi) $):
1128+
$ app[ phi / box ] ctx C= psi $ =
1129+
'(imp_to_subset @ rsyl (anl appCtx_pointwise) @
1130+
exists_generalization_disjoint @
1131+
impcom @
1132+
rsyl hyp subset_to_imp);

nominal/core.mm1

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ def is_atom {a: EVar} (alpha: Pattern): Pattern a = $ is_of_sort (eVar a) alpha
2222

2323
term swap_sym: Symbol;
2424
def swap {a b: EVar} (phi: Pattern a b): Pattern a b = $ (sym swap_sym) @@ eVar a @@ eVar b @@ phi $;
25+
def moot_swap {a: EVar} (phi: Pattern a): Pattern a = $ (sym swap_sym) @@ eVar a @@ eVar a @@ phi $;
2526
term abstraction_sym: Symbol;
2627
def abstraction (phi rho: Pattern): Pattern = $ (sym abstraction_sym) @@ phi @@ rho $;
2728
term freshness_sym: Symbol;
28-
def freshness {a: EVar} (phi: Pattern a): Pattern a = $ (sym freshness_sym) @@ eVar a @@ phi $;
29-
def fresh_in_all {a: EVar} (phi: Pattern a) {.x: EVar}: Pattern a = $ forall x (freshness a (eVar x /\ phi)) $;
29+
def freshness {a: EVar}: Pattern a = $ (sym freshness_sym) @@ eVar a $;
30+
31+
def EV_pattern {.a .b: EVar} (alpha phi: Pattern): Pattern =
32+
$ s_forall alpha a (s_forall alpha b ((swap a b phi) == phi)) $;
3033

3134
axiom function_swap:
3235
$ is_atom_sort alpha $ >
@@ -39,33 +42,20 @@ axiom function_abstraction:
3942
axiom pred_freshness:
4043
$ is_atom_sort alpha $ >
4144
$ is_nominal_sort tau $ >
42-
$ ,(is_rel '(sym freshness_sym) '[alpha tau]) $;
45+
$ ,(is_multi_function '(sym freshness_sym) '[alpha] 'tau) $;
46+
4347

44-
-- Axioms of Nominal Logic
45-
axiom EV_app (alpha tau: Pattern) {a b: EVar} (phi rho: Pattern a b):
48+
49+
axiom EV_pred (alpha tau: Pattern):
4650
$ is_atom_sort alpha $ >
4751
$ is_nominal_sort tau $ >
48-
$ is_atom a alpha $ >
49-
$ is_atom b alpha $ >
50-
$ is_of_sort phi tau $ >
51-
$ is_of_sort rho tau $ >
52-
$ (swap a b (app phi rho)) == (app (swap a b phi) (swap a b rho)) $;
53-
axiom EV_sym (alpha: Pattern) {a b: EVar} (s: Symbol):
54-
$ is_atom_sort alpha $ >
55-
$ is_atom a alpha $ >
56-
$ is_atom b alpha $ >
57-
$ (swap a b (sym s)) == sym s $;
58-
axiom EV_pred (alpha: Pattern) {a b: EVar}:
59-
$ is_atom_sort alpha $ >
60-
$ is_atom a alpha $ >
61-
$ is_atom b alpha $ >
62-
$ (swap a b (dom pred)) == dom pred $;
52+
$ EV_pattern alpha (dom tau) $;
6353
axiom S1 (alpha tau: Pattern) {a: EVar} (phi: Pattern a):
6454
$ is_atom_sort alpha $ >
6555
$ is_nominal_sort tau $ >
6656
$ is_atom a alpha $ >
6757
$ is_of_sort phi tau $ >
68-
$ (swap a a phi) == phi $;
58+
$ (moot_swap a phi) == phi $;
6959
axiom S2 (alpha tau: Pattern) {a b: EVar} (phi: Pattern a b):
7060
$ is_atom_sort alpha $ >
7161
$ is_nominal_sort tau $ >
@@ -84,24 +74,24 @@ axiom F1 (alpha tau: Pattern) {a b: EVar} (phi: Pattern a b):
8474
$ is_atom a alpha $ >
8575
$ is_atom b alpha $ >
8676
$ is_of_sort phi tau $ >
87-
$ (freshness a phi) /\ (freshness b phi) -> ((swap a b phi) == phi) $;
77+
$ (phi C= freshness a) /\ (phi C= freshness b) -> ((swap a b phi) == phi) $;
8878
axiom F2 (alpha: Pattern) {a b: EVar}:
8979
$ is_atom_sort alpha $ >
9080
$ is_atom a alpha $ >
9181
$ is_atom b alpha $ >
92-
$ (freshness a (eVar b)) <-> (eVar a != eVar b) $;
82+
$ (b in freshness a) <-> (eVar a != eVar b) $;
9383
axiom F3 (alpha1 alpha2: Pattern) {a b: EVar}:
9484
$ is_atom_sort alpha1 $ >
9585
$ is_atom_sort alpha2 $ >
9686
$ is_atom a alpha1 $ >
9787
$ is_atom b alpha2 $ >
9888
$ alpha1 != alpha2 $ >
99-
$ freshness a (eVar b) $;
89+
$ b in freshness a $;
10090
axiom F4 (alpha tau phi: Pattern) {a: EVar}:
10191
$ is_atom_sort alpha $ >
10292
$ is_nominal_sort tau $ >
10393
$ is_of_sort phi tau $ >
104-
$ s_exists alpha a (fresh_in_all a phi) $;
94+
$ s_exists alpha a (phi C= freshness a) $;
10595
axiom A1 (alpha tau: Pattern) {a b: EVar} (phi rho: Pattern a b):
10696
$ is_atom_sort alpha $ >
10797
$ is_nominal_sort tau $ >
@@ -111,7 +101,7 @@ axiom A1 (alpha tau: Pattern) {a b: EVar} (phi rho: Pattern a b):
111101
$ is_of_sort rho tau $ >
112102
$ ((abstraction (eVar a) phi) == (abstraction (eVar b) rho)) <->
113103
((eVar a == eVar b) /\ (phi == rho)) \/
114-
((freshness a rho) /\ ((swap a b phi) == rho)) $;
104+
((rho C= freshness a) /\ ((swap a b phi) == rho)) $;
115105
axiom A2 (alpha tau: Pattern) {x a y: EVar}:
116106
$ is_atom_sort alpha $ >
117107
$ is_nominal_sort tau $ >

nominal/lambda.mm1

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import "core.mm1";
22

33
term Var_sym: Symbol;
44
def Var: Pattern = $ sym Var_sym $;
5+
def Vars: Pattern = $ dom Var $;
56
axiom Var_atom: $ is_atom_sort Var $;
67

78
term Exp_sym: Symbol;
89
def Exp: Pattern = $ sym Exp_sym $;
10+
def Exps: Pattern = $ dom Exp $;
911
axiom Exp_sort: $ is_nominal_sort Exp $;
1012

1113
term lc_var_sym: Symbol;
@@ -19,15 +21,79 @@ axiom function_lc_app: $ ,(is_function '(sym lc_var_app) '[Exp Exp] 'Exp) $;
1921
term lc_lam_sym: Symbol;
2022
def lc_lam (phi: Pattern): Pattern = $ (sym lc_lam_sym) @@ phi $;
2123
axiom function_lc_lam: $ ,(is_function '(sym lc_lam_sym) '[(sort_abstraction Var Exp)] 'Exp) $;
24+
axiom EV_lc_lam (phi: Pattern) {a b: EVar}:
25+
$ s_forall Var a (s_forall Var b ((swap a b (lc_lam phi)) == lc_lam (swap a b phi))) $;
2226

2327
axiom no_junk {X: SVar}:
24-
$ (dom Exp) == mu X ( (lc_var (dom Var))
25-
\/ (lc_app (sVar X) (sVar X))
26-
\/ (lc_lam (abstraction (dom Var) (sVar X)))) $;
28+
$ Exps == mu X ( (lc_var Vars)
29+
\/ (lc_app (sVar X) (sVar X))
30+
\/ (lc_lam (abstraction Vars (sVar X)))) $;
2731

2832
--- no_confusion
2933

3034

35+
theorem exp_pred_ev_unquantified {x y: EVar} (exp_pred: Pattern)
36+
(exp_pred_ev: $ EV_pattern Var exp_pred $):
37+
$ (is_of_sort (eVar x) Var) /\ (is_of_sort (eVar y) Var) -> ((swap x y exp_pred) == exp_pred) $ =
38+
'(curry @ syl var_subst_same_var @ var_subst_same_var exp_pred_ev);
39+
40+
theorem lc_lemma_1 {x: EVar} (exp_pred exp_suff_fresh: Pattern)
41+
(exp_suff_fresh_sorting: $ is_of_sort exp_suff_fresh Var $)
42+
(exp_suff_fresh_nonempty: $ |^ exp_suff_fresh ^| $)
43+
(h_abs: $ (lc_lam (abstraction exp_suff_fresh exp_pred)) C= exp_pred $):
44+
$ s_exists Var x ((lc_lam (abstraction (eVar x) exp_pred)) C= exp_pred) $ =
45+
(named '(exists_framing (rsyl (anl eVar_in_subset) @ iand
46+
(com12 subset_trans exp_suff_fresh_sorting)
47+
(rsyl (syl
48+
,(subset_imp_subset_framing_subst 'appCtxRVar)
49+
,(subset_imp_subset_framing_subst 'appCtxLRVar)
50+
) @ com12 subset_trans h_abs))
51+
@ anl lemma_ceil_exists_membership exp_suff_fresh_nonempty));
52+
53+
theorem lc_lemma_2 {x y: EVar} (exp_pred: Pattern)
54+
(ev_unquant: $ (is_of_sort (eVar x) Var) /\ (is_of_sort (eVar y) Var) -> ((swap x y exp_pred) == exp_pred) $):
55+
$ (((is_of_sort (eVar x) Var) /\ (is_of_sort (eVar y) Var)) /\ ((lc_lam (abstraction (eVar y) exp_pred)) C= exp_pred)) -> ((lc_lam (abstraction (eVar x) exp_pred)) C= exp_pred) $ =
56+
'();
57+
58+
theorem lc_lemma_3 {y: EVar} (exp_pred: Pattern)
59+
(exp_suff_fresh_sorting: $ is_of_sort exp_suff_fresh Var $)
60+
(exp_suff_fresh_nonempty: $ |^ exp_suff_fresh ^| $)
61+
(exp_pred_ev: $ EV_pattern Var exp_pred $)
62+
(h_abs: $ (lc_lam (abstraction exp_suff_fresh exp_pred)) C= exp_pred $):
63+
$ is_of_sort (eVar y) Var -> ((lc_lam (abstraction (eVar y) exp_pred)) C= exp_pred) $ =
64+
(named '(
65+
rsyl (ian2 @ lc_lemma_1 exp_suff_fresh_sorting exp_suff_fresh_nonempty h_abs) @
66+
rsyl and_exists_disjoint_reverse @
67+
exists_generalization_disjoint @
68+
rsyl (anr anass) @
69+
lc_lemma_2 @ exp_pred_ev_unquantified exp_pred_ev));
70+
71+
72+
theorem freshness_irrelevance (exp_pred exp_suff_fresh: Pattern)
73+
(exp_suff_fresh_sorting: $ is_of_sort exp_suff_fresh Var $)
74+
(exp_suff_fresh_nonempty: $ |^ exp_suff_fresh ^| $)
75+
(exp_pred_ev: $ EV_pattern Var exp_pred $)
76+
(h_abs: $ (lc_lam (abstraction exp_suff_fresh exp_pred)) C= exp_pred $):
77+
$ (lc_lam (abstraction Vars exp_pred)) C= exp_pred $ = (named
78+
'(norm (norm_subset appCtxRLRVar norm_refl) @
79+
pointwise_decomposition @
80+
norm (norm_sym @ norm_imp_r @ norm_subset appCtxRLRVar norm_refl) @
81+
rsyl (anl eVar_in_subset) @
82+
lc_lemma_3 exp_suff_fresh_sorting exp_suff_fresh_nonempty exp_pred_ev h_abs));
83+
84+
85+
86+
87+
theorem prototype_induction_principle (exp_pred exp_suff_fresh: Pattern)
88+
(exp_suff_fresh_sorting: $ is_of_sort exp_suff_fresh Var $)
89+
(exp_suff_fresh_nonempty: $ |^ exp_suff_fresh ^| $)
90+
(exp_pred_sorting: $ is_of_sort exp_pred Exp $)
91+
(exp_pred_ev: $ EV_pattern Var exp_pred $)
92+
(h_var: $ (lc_var Vars) C= exp_pred $)
93+
(h_app: $ (lc_app exp_pred exp_pred) C= exp_pred $)
94+
(h_abs: $ (lc_lam (abstraction exp_suff_fresh exp_pred)) C= exp_pred $):
95+
$ Exps == exp_pred $ = '();
96+
3197

3298

3399
do {
@@ -160,6 +226,7 @@ theorem induction_lemma_abs (pred freshness_arg: Pattern)
160226
-- @ rsyl (anim2 @ anim1 @ curry @ syl (rsyl (exists_framing imancom) (anr imp_exists_disjoint)) @ anr imp_exists_disjoint @ exists_framing imancom @ exists_framing (iand id @ curry (com23 @ syl var_subst_same_var @ var_subst_same_var h_abs)) (F4 Var_atom Exp_sort freshness_arg_Exp))
161227
-- @ rsyl (anim2 @ anim1 @ exists_framing @ anim1 anl)
162228
-- @ syl (curry @ syl anr ,(func_subst_explicit_helper 'z $(eVar z C= dom Exp) /\ (eVar z /\ (pred @@ eVar z @@ freshness_arg))$))
229+
163230
_);
164231

165232
theorem induction_principle (pred freshness_arg: Pattern)

nominal/lemmas.mm1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "core.mm1";

0 commit comments

Comments
 (0)