Skip to content

Commit 0979921

Browse files
committed
definition of subst
1 parent a58bbc6 commit 0979921

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

nominal/lambda.mm1

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ axiom function_lc_app: $ ,(is_function '(sym lc_var_app) '[Exp Exp] 'Exp) $;
2222

2323
term lc_lam_sym: Symbol;
2424
def lc_lam (phi: Pattern): Pattern = $ (sym lc_lam_sym) @@ phi $;
25+
def lc_lam_a {a: EVar} (p: Pattern a): Pattern a = $ lc_lam (abstraction (eVar a) p) $;
2526
axiom function_lc_lam: $ ,(is_function '(sym lc_lam_sym) '[(sort_abstraction Var Exp)] 'Exp) $;
2627
axiom EV_lc_lam {a b: EVar} (phi: Pattern a b):
2728
$ (is_of_sort phi (sort_abstraction Var Exp)) ->
@@ -56,7 +57,7 @@ theorem abstraction_sorting (phi rho: Pattern):
5657
theorem EV_lc_lam_abstraction {a b: EVar} (phi: Pattern a b):
5758
$ is_exp phi ->
5859
((is_var (eVar a)) /\ (is_var (eVar b))) ->
59-
((swap a b (lc_lam (abstraction (eVar a) phi))) == lc_lam (abstraction (eVar b) (swap a b phi))) $ =
60+
((swap a b (lc_lam_a a phi)) == lc_lam_a b (swap a b phi)) $ =
6061
(named '(exp @
6162
sylc eq_trans (
6263
rsyl (anr anass) @
@@ -98,7 +99,7 @@ theorem lc_lemma_1 {x: EVar} (exp_pred exp_suff_fresh: Pattern)
9899
(exp_suff_fresh_sorting: $ is_var exp_suff_fresh $)
99100
(exp_suff_fresh_nonempty: $ |^ exp_suff_fresh ^| $)
100101
(h_abs: $ (lc_lam (abstraction exp_suff_fresh exp_pred)) C= exp_pred $):
101-
$ s_exists Var x ((lc_lam (abstraction (eVar x) exp_pred)) C= exp_pred) $ =
102+
$ s_exists Var x ((lc_lam_a x exp_pred) C= exp_pred) $ =
102103
(named '(exists_framing (rsyl (anl eVar_in_subset) @ iand
103104
(com12 subset_trans exp_suff_fresh_sorting)
104105
(rsyl (syl
@@ -110,7 +111,7 @@ theorem lc_lemma_1 {x: EVar} (exp_pred exp_suff_fresh: Pattern)
110111
theorem lc_lemma_2 {x y: EVar} (exp_pred: Pattern)
111112
(exp_pred_sorting: $ is_exp exp_pred $)
112113
(exp_pred_ev: $ EV_pattern Var 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) $ =
114+
$ (((is_var (eVar x)) /\ (is_var (eVar y))) /\ ((lc_lam_a y exp_pred) C= exp_pred)) -> ((lc_lam_a x exp_pred) C= exp_pred) $ =
114115
(named '(
115116
rsyl (anim2 ,(subset_imp_subset_framing_subst 'appCtxRVar)) @
116117
rsyl (iand anl @
@@ -129,7 +130,7 @@ theorem lc_lemma_3 {y: EVar} (exp_pred: Pattern)
129130
(exp_suff_fresh_nonempty: $ |^ exp_suff_fresh ^| $)
130131
(exp_pred_ev: $ EV_pattern Var exp_pred $)
131132
(h_abs: $ (lc_lam (abstraction exp_suff_fresh exp_pred)) C= exp_pred $):
132-
$ is_var (eVar y) -> ((lc_lam (abstraction (eVar y) exp_pred)) C= exp_pred) $ =
133+
$ is_var (eVar y) -> ((lc_lam_a y exp_pred) C= exp_pred) $ =
133134
(named '(
134135
rsyl (ian2 @ lc_lemma_1 exp_suff_fresh_sorting exp_suff_fresh_nonempty h_abs) @
135136
rsyl and_exists_disjoint_reverse @
@@ -168,3 +169,31 @@ theorem induction_principle (exp_pred exp_suff_fresh: Pattern)
168169
(corollary_57_floor h_app))
169170
@ corollary_57_floor @ freshness_irrelevance exp_pred_sorting exp_suff_fresh_sorting exp_suff_fresh_nonempty exp_pred_ev h_abs
170171
) exp_pred_sorting));
172+
173+
174+
term subst_sym: Symbol;
175+
def subst (phi1 phi2 phi3: Pattern): Pattern = $ (sym subst_sym) @@ phi1 @@ phi2 @@ phi3 $;
176+
177+
axiom function_subst: $ ,(is_function '(sym subst_sym) '[Exp Var Exp] 'Exp) $;
178+
axiom subst_same_var {a: EVar} (plug: Pattern a):
179+
$ (is_var (eVar a)) ->
180+
(is_exp plug) ->
181+
((subst (lc_var (eVar a)) (eVar a) plug) == plug) $;
182+
axiom subst_diff_var {a b: EVar} (plug: Pattern a b):
183+
$ (is_var (eVar a)) ->
184+
(is_var (eVar b)) ->
185+
(is_exp plug) ->
186+
((subst (lc_var (eVar a)) (eVar b) plug) == (lc_var (eVar a))) $;
187+
axiom subst_app {a: EVar} (plug phi1 phi2: Pattern a):
188+
$ (is_var (eVar a)) ->
189+
(is_exp plug) ->
190+
(is_exp phi1) ->
191+
(is_exp phi2) ->
192+
((subst (lc_app phi1 phi2) (eVar a) plug) == (lc_app (subst phi1 (eVar a) plug) (subst phi2 (eVar a) plug))) $;
193+
axiom subst_lam {a b: EVar} (plug phi: Pattern a b):
194+
$ (is_var (eVar a)) ->
195+
(is_var (eVar b)) ->
196+
(is_exp plug) ->
197+
(is_exp phi) ->
198+
(plug C= freshness a) ->
199+
((subst (lc_lam_a a phi) (eVar b) plug) == (lc_lam_a a (subst phi (eVar b) plug))) $;

0 commit comments

Comments
 (0)