Skip to content

Commit a58bbc6

Browse files
committed
refactor
1 parent 22a72a6 commit a58bbc6

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

nominal/lambda.mm1

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import "core.mm1";
33
term Var_sym: Symbol;
44
def Var: Pattern = $ sym Var_sym $;
55
def Vars: Pattern = $ dom Var $;
6+
def is_var (p: Pattern): Pattern = $ is_of_sort p Var $;
67
axiom Var_atom: $ is_atom_sort Var $;
78

89
term Exp_sym: Symbol;
910
def Exp: Pattern = $ sym Exp_sym $;
1011
def Exps: Pattern = $ dom Exp $;
12+
def is_exp (p: Pattern): Pattern = $ is_of_sort p Exp $;
1113
axiom Exp_sort: $ is_nominal_sort Exp $;
1214

1315
term lc_var_sym: Symbol;
@@ -44,16 +46,16 @@ theorem abstraction_sorting_lemma:
4446
function_abstraction Var_atom Exp_sort));
4547

4648
theorem abstraction_sorting (phi rho: Pattern):
47-
$ is_of_sort phi Var -> is_of_sort rho Exp -> is_of_sort (abstraction phi rho) (sort_abstraction Var Exp) $ =
49+
$ is_var phi -> is_exp rho -> is_of_sort (abstraction phi rho) (sort_abstraction Var Exp) $ =
4850
(named '(
4951
rsyl ,(framing_imp_subst 'appCtxLRVar) @
5052
rsyl subset_trans @
5153
imim ,(framing_imp_subst 'appCtxRVar) @
5254
com12 subset_trans abstraction_sorting_lemma));
5355

5456
theorem EV_lc_lam_abstraction {a b: EVar} (phi: Pattern a b):
55-
$ is_of_sort phi Exp ->
56-
((is_of_sort (eVar a) Var) /\ (is_of_sort (eVar b) Var)) ->
57+
$ is_exp phi ->
58+
((is_var (eVar a)) /\ (is_var (eVar b))) ->
5759
((swap a b (lc_lam (abstraction (eVar a) phi))) == lc_lam (abstraction (eVar b) (swap a b phi))) $ =
5860
(named '(exp @
5961
sylc eq_trans (
@@ -89,11 +91,11 @@ theorem EV_lc_lam_abstraction {a b: EVar} (phi: Pattern a b):
8991

9092
theorem exp_pred_ev_unquantified {x y: EVar} (exp_pred: Pattern)
9193
(exp_pred_ev: $ EV_pattern Var exp_pred $):
92-
$ (is_of_sort (eVar x) Var) /\ (is_of_sort (eVar y) Var) -> ((swap x y exp_pred) == exp_pred) $ =
94+
$ (is_var (eVar x)) /\ (is_var (eVar y)) -> ((swap x y exp_pred) == exp_pred) $ =
9395
'(curry @ syl var_subst_same_var @ var_subst_same_var exp_pred_ev);
9496

9597
theorem lc_lemma_1 {x: EVar} (exp_pred exp_suff_fresh: Pattern)
96-
(exp_suff_fresh_sorting: $ is_of_sort exp_suff_fresh Var $)
98+
(exp_suff_fresh_sorting: $ is_var exp_suff_fresh $)
9799
(exp_suff_fresh_nonempty: $ |^ exp_suff_fresh ^| $)
98100
(h_abs: $ (lc_lam (abstraction exp_suff_fresh exp_pred)) C= exp_pred $):
99101
$ s_exists Var x ((lc_lam (abstraction (eVar x) exp_pred)) C= exp_pred) $ =
@@ -106,9 +108,9 @@ theorem lc_lemma_1 {x: EVar} (exp_pred exp_suff_fresh: Pattern)
106108
@ anl lemma_ceil_exists_membership exp_suff_fresh_nonempty));
107109

108110
theorem lc_lemma_2 {x y: EVar} (exp_pred: Pattern)
109-
(exp_pred_sorting: $ is_of_sort exp_pred Exp $)
111+
(exp_pred_sorting: $ is_exp exp_pred $)
110112
(exp_pred_ev: $ EV_pattern Var exp_pred $):
111-
$ (((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) $ =
113+
$ (((is_var (eVar x)) /\ (is_var (eVar y))) /\ ((lc_lam (abstraction (eVar y) exp_pred)) C= exp_pred)) -> ((lc_lam (abstraction (eVar x) exp_pred)) C= exp_pred) $ =
112114
(named '(
113115
rsyl (anim2 ,(subset_imp_subset_framing_subst 'appCtxRVar)) @
114116
rsyl (iand anl @
@@ -122,12 +124,12 @@ theorem lc_lemma_2 {x y: EVar} (exp_pred: Pattern)
122124
syl anl ,(func_subst_explicit_helper 'hole $(_ @@ (_ @@ (eVar hole))) C= (eVar hole)$)));
123125

124126
theorem lc_lemma_3 {y: EVar} (exp_pred: Pattern)
125-
(exp_pred_sorting: $ is_of_sort exp_pred Exp $)
126-
(exp_suff_fresh_sorting: $ is_of_sort exp_suff_fresh Var $)
127+
(exp_pred_sorting: $ is_exp exp_pred $)
128+
(exp_suff_fresh_sorting: $ is_var exp_suff_fresh $)
127129
(exp_suff_fresh_nonempty: $ |^ exp_suff_fresh ^| $)
128130
(exp_pred_ev: $ EV_pattern Var exp_pred $)
129131
(h_abs: $ (lc_lam (abstraction exp_suff_fresh exp_pred)) C= exp_pred $):
130-
$ is_of_sort (eVar y) Var -> ((lc_lam (abstraction (eVar y) exp_pred)) C= exp_pred) $ =
132+
$ is_var (eVar y) -> ((lc_lam (abstraction (eVar y) exp_pred)) C= exp_pred) $ =
131133
(named '(
132134
rsyl (ian2 @ lc_lemma_1 exp_suff_fresh_sorting exp_suff_fresh_nonempty h_abs) @
133135
rsyl and_exists_disjoint_reverse @
@@ -136,8 +138,8 @@ theorem lc_lemma_3 {y: EVar} (exp_pred: Pattern)
136138
lc_lemma_2 exp_pred_sorting exp_pred_ev));
137139

138140
theorem freshness_irrelevance (exp_pred exp_suff_fresh: Pattern)
139-
(exp_pred_sorting: $ is_of_sort exp_pred Exp $)
140-
(exp_suff_fresh_sorting: $ is_of_sort exp_suff_fresh Var $)
141+
(exp_pred_sorting: $ is_exp exp_pred $)
142+
(exp_suff_fresh_sorting: $ is_var exp_suff_fresh $)
141143
(exp_suff_fresh_nonempty: $ |^ exp_suff_fresh ^| $)
142144
(exp_pred_ev: $ EV_pattern Var exp_pred $)
143145
(h_abs: $ (lc_lam (abstraction exp_suff_fresh exp_pred)) C= exp_pred $):
@@ -149,9 +151,9 @@ theorem freshness_irrelevance (exp_pred exp_suff_fresh: Pattern)
149151
lc_lemma_3 exp_pred_sorting exp_suff_fresh_sorting exp_suff_fresh_nonempty exp_pred_ev h_abs));
150152

151153
theorem induction_principle (exp_pred exp_suff_fresh: Pattern)
152-
(exp_suff_fresh_sorting: $ is_of_sort exp_suff_fresh Var $)
154+
(exp_suff_fresh_sorting: $ is_var exp_suff_fresh $)
153155
(exp_suff_fresh_nonempty: $ |^ exp_suff_fresh ^| $)
154-
(exp_pred_sorting: $ is_of_sort exp_pred Exp $)
156+
(exp_pred_sorting: $ is_exp exp_pred $)
155157
(exp_pred_ev: $ EV_pattern Var exp_pred $)
156158
(h_var: $ (lc_var Vars) C= exp_pred $)
157159
(h_app: $ (lc_app exp_pred exp_pred) C= exp_pred $)

0 commit comments

Comments
 (0)