@@ -190,20 +190,40 @@ axiom subst_diff_var {a b: EVar} (plug: Pattern a b):
190
190
((eVar a) != (eVar b)) ->
191
191
(is_exp plug) ->
192
192
((subst (eVar b) (lc_var (eVar a)) plug) == (lc_var (eVar a))) $;
193
+ axiom subst_var {a b: EVar} (plug: Pattern a b):
194
+ $ (is_var (eVar a)) ->
195
+ (is_var (eVar b)) ->
196
+ ((eVar a) == (eVar b)) ->
197
+ (is_exp plug) ->
198
+ ((subst (eVar b) (lc_var (eVar a)) plug) == plug) $;
193
199
axiom subst_app (a phi1 phi2 plug: Pattern):
194
200
$ (is_sorted_func Var a) ->
195
201
(is_exp plug) ->
196
202
(is_exp phi1) ->
197
203
(is_exp phi2) ->
198
204
((subst a (lc_app phi1 phi2) plug) == (lc_app (subst a phi1 plug) (subst a phi2 plug))) $;
205
+ axiom subst_lam_same_var {a: EVar} (plug phi: Pattern a):
206
+ $ (is_var (eVar a)) ->
207
+ (is_exp plug) ->
208
+ (is_exp phi) ->
209
+ (fresh_for (eVar a) plug) ->
210
+ ((subst (eVar a) (lc_lam_a a phi) plug) == (lc_lam_a a phi)) $;
211
+ axiom subst_lam_diff_var (a b plug phi: Pattern):
212
+ $ (a != b) ->
213
+ (fresh_for a plug) ->
214
+ (is_sorted_func Var a) ->
215
+ (is_sorted_func Var b) ->
216
+ (is_exp plug) ->
217
+ (is_exp phi) ->
218
+ ((subst b (lc_lam (abstraction a phi)) plug) == (lc_lam (abstraction a (subst b phi plug)))) $;
199
219
axiom subst_lam {a b: EVar} (plug phi: Pattern a b):
200
- $ ((eVar a) ! = (eVar b)) ->
220
+ $ ((eVar a) = = (eVar b)) ->
201
221
(is_var (eVar a)) ->
202
222
(is_var (eVar b)) ->
203
223
(is_exp plug) ->
204
224
(is_exp phi) ->
205
225
(fresh_for (eVar a) plug) ->
206
- ((subst (eVar b) (lc_lam_a a phi) plug) == (lc_lam_a a (subst (eVar b) phi plug) )) $;
226
+ ((subst (eVar b) (lc_lam_a a phi) plug) == (lc_lam_a a phi)) $;
207
227
208
228
209
229
-- induction proof
@@ -277,7 +297,49 @@ theorem subst_induction_app (a b plug1 plug2: Pattern)
277
297
rsyl (anim2 @ anim1 lemma) @
278
298
rsyl (anim2 @ ancom) @
279
299
rsyl (anim1 @ curry @ mp ,(inst_foralls 2) function_lc_app) @
280
- curry ,(func_subst_alt_thm_sorted 'x $(eVar x) /\ ((app (app _ (app (app _ (eVar x)) _)) _) == (app (app _ (app (app _ (eVar x)) _)) _))$)));
300
+ curry ,(func_subst_alt_thm_sorted 'x $(eVar x) /\ ((app (app _ (app (app _ (eVar x)) _)) _) == (app (app _ (app (app _ (eVar x)) _)) _))$)
301
+ ));
302
+
303
+ -- (lam c phi)[a / plug1][b / plug2] == lam
304
+
305
+ theorem subst_induction_lam_lemma (a b c plug1 plug2: Pattern)
306
+ (diff_atoms_ab: $ a != b $)
307
+ (diff_atoms_bc: $ b != c $)
308
+ (diff_atoms_ca: $ c != a $)
309
+ (a_var: $ is_sorted_func Var a $)
310
+ (b_var: $ is_sorted_func Var b $)
311
+ (c_var: $ is_sorted_func Var c $)
312
+ (c_fresh_in_plug1: $ fresh_for c plug1 $)
313
+ (phi_exp: $ is_exp phi $)
314
+ (plug1_exp: $ is_exp plug1 $)
315
+ (plug2_exp: $ is_exp plug2 $)
316
+ (a_fresh: $ fresh_for a plug2 $):
317
+ $ is_exp (eVar x) /\ subst_induction_pred a b (eVar x) plug1 plug2 -> subst_induction_pred a b (lc_lam (abstraction c (eVar x))) plug1 plug2 $ =
318
+ '(rsyl (anim1 @ iand id id) @
319
+ rsyl (anl anass) @
320
+ rsyl (anim2 @ anim1 @ syl (subst_lam_diff_var diff_atoms_ca c_fresh_in_plug1 c_var a_var plug1_exp) @ rsyl (mp ,(function_sorting 2 '(function_abstraction Var_atom Exp_sort)) (domain_func_sorting c_var)) ,(function_sorting 1 'function_lc_lam)) @
321
+ rsyl (anim2 @ _)
322
+ _);
323
+
324
+ theorem subst_induction_lam (a b c plug1 plug2: Pattern)
325
+ (c_sorting: $ is_sorted_func Var c $)
326
+ (lemma: $ is_exp (eVar x) /\ subst_induction_pred a b (eVar x) plug1 plug2 -> subst_induction_pred a b (lc_lam (abstraction c (eVar x))) plug1 plug2 $):
327
+ $ (lc_lam (abstraction c (satisfying_exps a b plug1 plug2))) C= (satisfying_exps a b plug1 plug2) $ =
328
+ (named '(imp_to_subset @
329
+ rsyl (anl ,(ex_appCtx_subst @ appCtx_constructor '[1 1])) @
330
+ exists_generalization_disjoint @
331
+ rsyl ,(appCtx_floor_commute_b_subst @ appCtx_constructor '[1 1]) @
332
+ rsyl (anim2 ,(appCtx_floor_commute_subst @ appCtx_constructor '[1 1])) @
333
+ rsyl (anim1 @ iand id id) @
334
+ rsyl (anl anass) @
335
+ rsyl (anim2 @ rsyl (anl anlass) @ anim2 lemma) @
336
+ rsyl (anim1 @ rsyl (mp ,(inst_foralls 1) (swap_sorted_forall @ function_abstraction Var_atom Exp_sort))
337
+ (rsyl (con1 @ anr imp_exists_disjoint (exists_framing (syl con3 @ syl anl ,(func_subst_explicit_helper 'x $((eVar x) C= _) -> exists _ (_ /\ (_ == (_ @@ (eVar x) @@ _)))$)) (exists_framing anr c_sorting))) @ rsyl (mpcom @ domain_func_sorting c_sorting) @
338
+ exists_generalization_disjoint @ rsyl (anim1 @ var_subst_same_var function_lc_lam) @ impcom @ syl anl ,(func_subst_explicit_helper 'x $exists _ (_ /\ (_ == (_ @@ (eVar x))))$))
339
+ ) @
340
+ curry ,(func_subst_alt_thm_sorted 'x $(eVar x) /\ ((app (app _ (app (app _ (eVar x)) _)) _) == (app (app _ (app (app _ (eVar x)) _)) _))$)
341
+ ));
342
+
281
343
282
344
theorem subst_induction_lemma (a b phi plug1 plug2: Pattern)
283
345
(diff_atoms: $ a != b $)
@@ -310,47 +372,3 @@ theorem subst_induction (a b phi plug1 plug2: Pattern)
310
372
(eq_trans @ equiv_to_eq ,(appCtx_pointwise_subst @ appCtx_constructor '[0 1 0 1])) @
311
373
com12 eq_trans @ eq_sym @ equiv_to_eq ,(appCtx_pointwise_subst @ appCtx_constructor '[0 1 0 1])) @
312
374
framing_floor @ eq_to_exists_bi_fresh eFresh_forall_same_var @ syl corollary_57_floor @ rsyl var_subst_same_var imp_eq_to_conj_in_eq) phi_exp));
313
-
314
-
315
-
316
- term reduce_sym: Symbol;
317
- def reduce (phi: Pattern): Pattern = $ (sym reduce_sym) @@ phi $;
318
-
319
- -- axiom reduce_subst {a: EVar} (phi1 phi2: Pattern a):
320
- -- $
321
- -- (reduce (lc_app (lc_lam_a a phi1) phi2)) == () $;
322
-
323
-
324
-
325
-
326
- -- term red_sym: Symbol;
327
- -- def red (phi: Pattern) : Pattern = $ (sym red_sym) @@ phi $;
328
-
329
- -- axiom red_app (phi rho: Pattern)
330
- -- (phi_sorting: $ is_of_sort phi Exp $)
331
- -- (rho_sorting: $ is_of_sort rho Exp $):
332
- -- $ (red (app phi rho)) == (app (red phi) rho) \/ (app phi (red rho)) \/ (s_exists )$;
333
-
334
-
335
- -- def double (phi: Pattern) = exists x (a(a(x)) /\ a(x) in phi)
336
-
337
-
338
-
339
-
340
- --- term Type_sym: Symbol;
341
- --- def Type: Pattern = $ sym Type_sym $;
342
- --- def Types: Pattern = $ dom Type $;
343
- ---
344
- --- term fn_type_sym: Symbol;
345
- --- def fn_type (phi rho: Pattern): Pattern = $ (sym fn_type_sym) @@ phi @@ rho $;
346
- --- axiom function_fn_type: $ ,(is_function '(sym fn_type_symfn_type_sym) '[Type] 'Type) $;
347
- ---
348
- ---
349
- --- def is_typing_context (phi: Pattern): Pattern = $ ,(is_function '(phi) '[Var] 'Type) $;
350
- ---
351
- --- def wf (c t: Pattern) {a u t1 t2: EVar} {X: SVar}: Pattern =
352
- --- $ mu X (
353
- --- (s_exists Var a ((lc_var a) /\ t == (c @@ a)))
354
- --- \/ (s_exists Type u (lc_app () ()))
355
- --- \/ ()
356
- --- ) $;
0 commit comments