@@ -100,19 +100,19 @@ theorem lc_lemma_1 {x: EVar} (exp_pred exp_suff_fresh: Pattern)
100
100
(exp_suff_fresh_nonempty: $ |^ exp_suff_fresh ^| $)
101
101
(h_abs: $ (lc_lam (abstraction exp_suff_fresh exp_pred)) C= exp_pred $):
102
102
$ s_exists Var x ((lc_lam_a x exp_pred) C= exp_pred) $ =
103
- (named '(exists_framing (rsyl (anl eVar_in_subset) @ iand
103
+ '(exists_framing (rsyl (anl eVar_in_subset) @ iand
104
104
(com12 subset_trans exp_suff_fresh_sorting)
105
105
(rsyl (syl
106
106
,(subset_imp_subset_framing_subst 'appCtxRVar)
107
107
,(subset_imp_subset_framing_subst 'appCtxLRVar)
108
108
) @ com12 subset_trans h_abs))
109
- @ anl lemma_ceil_exists_membership exp_suff_fresh_nonempty)) ;
109
+ @ anl lemma_ceil_exists_membership exp_suff_fresh_nonempty);
110
110
111
111
theorem lc_lemma_2 {x y: EVar} (exp_pred: Pattern)
112
112
(exp_pred_sorting: $ is_exp exp_pred $)
113
113
(exp_pred_ev: $ EV_pattern Var exp_pred $):
114
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) $ =
115
- (named '(
115
+ '(
116
116
rsyl (anim2 ,(subset_imp_subset_framing_subst 'appCtxRVar)) @
117
117
rsyl (iand anl @
118
118
rsyl (anim1 @
@@ -122,7 +122,7 @@ theorem lc_lemma_2 {x y: EVar} (exp_pred: Pattern)
122
122
curry subset_trans) @
123
123
rsyl (anim1 @ rsyl ancom @ exp_pred_ev_unquantified exp_pred_ev) @
124
124
curry @
125
- syl anl ,(func_subst_explicit_helper 'hole $(_ @@ (_ @@ (eVar hole))) C= (eVar hole)$))) ;
125
+ syl anl ,(func_subst_explicit_helper 'hole $(_ @@ (_ @@ (eVar hole))) C= (eVar hole)$));
126
126
127
127
theorem lc_lemma_3 {y: EVar} (exp_pred: Pattern)
128
128
(exp_pred_sorting: $ is_exp exp_pred $)
@@ -171,9 +171,14 @@ theorem induction_principle (exp_pred exp_suff_fresh: Pattern)
171
171
) exp_pred_sorting));
172
172
173
173
174
+
175
+ ---- Substitution
176
+
177
+ -- base term and definition
174
178
term subst_sym: Symbol;
175
179
def subst (a phi1 phi2: Pattern): Pattern = $ (sym subst_sym) @@ a @@ phi1 @@ phi2 $;
176
180
181
+ -- subst axioms
177
182
axiom function_subst: $ ,(is_function '(sym subst_sym) '[Var Exp Exp] 'Exp) $;
178
183
axiom subst_same_var {a: EVar} (plug: Pattern a):
179
184
$ (is_var (eVar a)) ->
@@ -192,31 +197,26 @@ axiom subst_app (a phi1 phi2 plug: Pattern):
192
197
(is_exp phi2) ->
193
198
((subst a (lc_app phi1 phi2) plug) == (lc_app (subst a phi1 plug) (subst a phi2 plug))) $;
194
199
axiom subst_lam {a b: EVar} (plug phi: Pattern a b):
195
- $ (is_var (eVar a)) ->
200
+ $ ((eVar a) != (eVar b)) ->
201
+ (is_var (eVar a)) ->
196
202
(is_var (eVar b)) ->
197
203
(is_exp plug) ->
198
204
(is_exp phi) ->
199
205
(fresh_for (eVar a) plug) ->
200
206
((subst (eVar b) (lc_lam_a a phi) plug) == (lc_lam_a a (subst (eVar b) phi plug))) $;
201
207
202
- -- phi[a / plug1][b / plug2] == phi[b / plug2][a / plug1[b / plug2]]
203
-
204
- -- (app x y)[a / plug1][b / plug2] == (app x y)[b / plug2][a / plug1[b / plug2]]
205
- -- (app (x[a / plug1]) (y[a / plug1]))[b / plug2] == (app (x[b / plug2]) (y[b / plug2]))[a / plug1[b / plug2]]
206
- -- app (x[a / plug1][b / plug2]) (y[a / plug1][b / plug2]) == app (x[b / plug2][a / plug1[b / plug2]]) (y[b / plug2][a / plug1[b / plug2]])
207
208
209
+ -- induction proof
208
210
def subst_induction_pred (a b phi plug1 plug2: Pattern): Pattern = $ (subst b (subst a phi plug1) plug2) == (subst a (subst b phi plug2) (subst b plug1 plug2)) $;
209
211
def satisfying_exps {.x: EVar} (a b plug1 plug2: Pattern): Pattern = $ s_exists Exp x ((eVar x) /\ subst_induction_pred a b (eVar x) plug1 plug2) $;
210
212
211
- theorem subst_induction_app_lemma {x y: EVar} (a b plug1 plug2: Pattern)
212
- (diff_atoms: $ a != b $)
213
+ theorem subst_induction_app_lemma
213
214
(a_var: $ is_sorted_func Var a $)
214
215
(b_var: $ is_sorted_func Var b $)
215
216
(plug1_exp: $ is_exp plug1 $)
216
- (plug2_exp: $ is_exp plug2 $)
217
- (a_fresh: $ fresh_for a phi3 $):
217
+ (plug2_exp: $ is_exp plug2 $):
218
218
$ (is_exp (eVar x) /\ subst_induction_pred a b (eVar x) plug1 plug2) /\ (is_exp (eVar y) /\ subst_induction_pred a b (eVar y) plug1 plug2) -> subst_induction_pred a b (lc_app (eVar x) (eVar y)) plug1 plug2 $ =
219
- '(rsyl (anl an4) @ rsyl (anim2 @
219
+ (named '(rsyl (anl an4) @ rsyl (anim2 @
220
220
syl (curry eq_trans) @
221
221
iand
222
222
(rsyl anl @ eq_equiv_to_eq_eq ,(func_subst_explicit_helper 'z $_ @@ (eVar z) @@ _$))
@@ -228,7 +228,23 @@ theorem subst_induction_app_lemma {x y: EVar} (a b plug1 plug2: Pattern)
228
228
(mp (com12 @ mp ,(function_sorting 3 'function_subst) (domain_func_sorting a_var)) plug1_exp)
229
229
(mp (com12 @ mp ,(function_sorting 3 'function_subst) (domain_func_sorting a_var)) plug1_exp)
230
230
)) @
231
- _);
231
+ rsyl (anim2 @ curry eq_trans) @
232
+ rsyl (anim1 @ iand id id) @
233
+ rsyl (anl anass) @
234
+ rsyl (anim2 @ anim1 @ syl ,(eq_imp_eq_framing_subst 'appCtxLRVar) @ curry @ subst_app a_var plug1_exp) @
235
+ rsyl (anim2 @ curry eq_trans) @
236
+ rsyl (anim1 @ iand id id) @
237
+ rsyl (anl anass) @
238
+ rsyl (anim2 @ anim1 @ syl eq_sym @ syl (curry @ subst_app a_var (mp (mp (mp ,(function_sorting 3 'function_subst) (domain_func_sorting b_var)) plug1_exp) plug2_exp)) (anim
239
+ (mp (com12 @ mp ,(function_sorting 3 'function_subst) (domain_func_sorting b_var)) plug2_exp)
240
+ (mp (com12 @ mp ,(function_sorting 3 'function_subst) (domain_func_sorting b_var)) plug2_exp)
241
+ )) @
242
+ rsyl (anim2 @ impcom eq_trans) @
243
+ rsyl (anim1 @ iand id id) @
244
+ rsyl (anl anass) @
245
+ rsyl (anim2 @ anim1 @ syl eq_sym @ syl ,(eq_imp_eq_framing_subst 'appCtxLRVar) @ curry @ subst_app b_var plug2_exp) @
246
+ rsyl (anim2 @ impcom eq_trans) @
247
+ anr));
232
248
233
249
theorem subst_induction_app (a b plug1 plug2: Pattern)
234
250
(lemma: $ (is_exp (eVar x) /\ subst_induction_pred a b (eVar x) plug1 plug2) /\ (is_exp (eVar y) /\ subst_induction_pred a b (eVar y) plug1 plug2) -> subst_induction_pred a b (lc_app (eVar x) (eVar y)) plug1 plug2 $):
@@ -263,17 +279,37 @@ theorem subst_induction_app (a b plug1 plug2: Pattern)
263
279
rsyl (anim1 @ curry @ mp ,(inst_foralls 2) function_lc_app) @
264
280
curry ,(func_subst_alt_thm_sorted 'x $(eVar x) /\ ((app (app _ (app (app _ (eVar x)) _)) _) == (app (app _ (app (app _ (eVar x)) _)) _))$)));
265
281
282
+ theorem subst_induction_lemma (a b phi plug1 plug2: Pattern)
283
+ (diff_atoms: $ a != b $)
284
+ (a_var: $ is_sorted_func Var a $)
285
+ (b_var: $ is_sorted_func Var b $)
286
+ (phi_exp: $ is_exp phi $)
287
+ (plug1_exp: $ is_exp plug1 $)
288
+ (plug2_exp: $ is_exp plug2 $)
289
+ (a_fresh: $ fresh_for a plug2 $):
290
+ $ Exps == (satisfying_exps a b plug1 plug2) $ =
291
+ '(induction_principle _ _ _ _ _ (subst_induction_app @ subst_induction_app_lemma a_var b_var plug1_exp plug2_exp) _);
266
292
267
- theorem subst_induction (a b phi1 plug1 plug2: Pattern)
293
+ theorem subst_induction (a b phi plug1 plug2: Pattern)
268
294
(diff_atoms: $ a != b $)
269
295
(a_var: $ is_sorted_func Var a $)
270
296
(b_var: $ is_sorted_func Var b $)
271
- (phi1_exp : $ is_exp phi1 $)
297
+ (phi_exp : $ is_exp phi $)
272
298
(plug1_exp: $ is_exp plug1 $)
273
299
(plug2_exp: $ is_exp plug2 $)
274
- (a_fresh: $ fresh_for a phi3 $):
275
- $ (subst b (subst a phi1 plug1) plug2) == (subst a (subst b phi1 plug2) (subst b plug1 plug2)) $ =
276
- '();
300
+ (a_fresh: $ fresh_for a plug2 $):
301
+ $ (subst b (subst a phi plug1) plug2) == (subst a (subst b phi plug2) (subst b plug1 plug2)) $ =
302
+ (named '(mp (
303
+ rsyl (com12 subset_trans @ eq_imp_subset @ subst_induction_lemma diff_atoms a_var b_var phi_exp plug1_exp plug2_exp a_fresh) @
304
+ rsyl (subset_mem_disjoint_lemma eFresh_disjoint) @
305
+ rsyl (forall_framing (rsyl
306
+ (imim2 @ rsyl membership_exists_forward @ exists_generalization_disjoint @ rsyl (anl ,(propag_mem 'x $(_ C= _) /\ ((eVar _) /\ (_ == _))$)) @ rsyl anr (curry @ syl anr ,(func_subst_explicit_helper 'x $(app (app _ (app (app _ (eVar x)) _)) _) == (app (app _ (app (app _ (eVar x)) _)) _)$)))
307
+ (rsyl (imim (anl floor_ceil_ceil) (anr ceil_floor_floor)) @ rsyl prop_43_or_def @ rsyl (anr floor_ceil_ceil) @ framing_floor @ rsyl prop_43_or_def_rev @ imim (anr floor_ceil_ceil) (anl ceil_floor_floor)))) @
308
+ rsyl (anr forall_floor) @
309
+ syl (rsyl
310
+ (eq_trans @ equiv_to_eq ,(appCtx_pointwise_subst @ appCtx_constructor '[0 1 0 1])) @
311
+ com12 eq_trans @ eq_sym @ equiv_to_eq ,(appCtx_pointwise_subst @ appCtx_constructor '[0 1 0 1])) @
312
+ 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));
277
313
278
314
279
315
0 commit comments