3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
1 |
theory BetaCR
|
3085
|
2 |
imports CR
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
3 |
begin
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
4 |
|
3085
|
5 |
(* TODO1: Does not work:*)
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
6 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
7 |
(* equivariance beta_star *)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
8 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
9 |
(* proved manually below. *)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
10 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
11 |
lemma eqvt_helper: "x1 \<longrightarrow>b* x2 \<Longrightarrow> (p \<bullet> x1) \<longrightarrow>b* (p \<bullet> x2)"
|
3085
|
12 |
by (erule beta_star.induct)
|
|
13 |
(metis beta.eqvt bs2 bs1)+
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
14 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
15 |
lemma [eqvt]: "p \<bullet> (x1 \<longrightarrow>b* x2) = ((p \<bullet> x1) \<longrightarrow>b* (p \<bullet> x2))"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
16 |
apply rule
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
17 |
apply (drule permute_boolE)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
18 |
apply (erule eqvt_helper)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
19 |
apply (intro permute_boolI)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
20 |
apply (drule_tac p="-p" in eqvt_helper)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
21 |
by simp
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
22 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
23 |
definition
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
24 |
equ :: "lam \<Rightarrow> lam \<Rightarrow> bool" ("_ \<approx> _")
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
25 |
where
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
26 |
"t \<approx> s \<longleftrightarrow> (\<exists>r. t \<longrightarrow>b* r \<and> s \<longrightarrow>b* r)"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
27 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
28 |
lemma equ_refl:
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
29 |
shows "t \<approx> t"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
30 |
unfolding equ_def by auto
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
31 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
32 |
lemma equ_sym:
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
33 |
assumes "t \<approx> s"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
34 |
shows "s \<approx> t"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
35 |
using assms unfolding equ_def
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
36 |
by auto
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
37 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
38 |
lemma equ_trans:
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
39 |
assumes "A \<approx> B" "B \<approx> C"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
40 |
shows "A \<approx> C"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
41 |
using assms unfolding equ_def
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
42 |
proof (elim exE conjE)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
43 |
fix D E
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
44 |
assume a: "A \<longrightarrow>b* D" "B \<longrightarrow>b* D" "B \<longrightarrow>b* E" "C \<longrightarrow>b* E"
|
3085
|
45 |
then obtain F where "D \<longrightarrow>b* F" "E \<longrightarrow>b* F" using CR_for_Beta_star by blast
|
|
46 |
then have "A \<longrightarrow>b* F \<and> C \<longrightarrow>b* F" using a bs3 by blast
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
47 |
then show "\<exists>F. A \<longrightarrow>b* F \<and> C \<longrightarrow>b* F" by blast
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
48 |
qed
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
49 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
50 |
lemma App_beta: "A \<longrightarrow>b* B \<Longrightarrow> C \<longrightarrow>b* D \<Longrightarrow> App A C \<longrightarrow>b* App B D"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
51 |
apply (erule beta_star.induct)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
52 |
apply auto
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
53 |
apply (erule beta_star.induct)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
54 |
apply auto
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
55 |
done
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
56 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
57 |
lemma Lam_beta: "A \<longrightarrow>b* B \<Longrightarrow> Lam [x]. A \<longrightarrow>b* Lam [x]. B"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
58 |
by (erule beta_star.induct) auto
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
59 |
|
3080
|
60 |
lemma Lam_rsp: "A \<approx> B \<Longrightarrow> Lam [x]. A \<approx> Lam [x]. B"
|
|
61 |
unfolding equ_def
|
|
62 |
apply auto
|
|
63 |
apply (rule_tac x="Lam [x]. r" in exI)
|
|
64 |
apply (auto simp add: Lam_beta)
|
|
65 |
done
|
|
66 |
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
67 |
lemma [quot_respect]:
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
68 |
shows "(op = ===> equ) Var Var"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
69 |
and "(equ ===> equ ===> equ) App App"
|
3085
|
70 |
and "(op = ===> equ ===> equ) CR.Lam CR.Lam"
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
71 |
unfolding fun_rel_def equ_def
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
72 |
apply auto
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
73 |
apply (rule_tac x="App r ra" in exI)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
74 |
apply (auto simp add: App_beta)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
75 |
apply (rule_tac x="Lam [x]. r" in exI)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
76 |
apply (auto simp add: Lam_beta)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
77 |
done
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
78 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
79 |
lemma beta_subst1_pre: "B \<longrightarrow>b C \<Longrightarrow> A [x ::= B] \<longrightarrow>b* A [x ::= C]"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
80 |
by (nominal_induct A avoiding: x B C rule: lam.strong_induct)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
81 |
(auto simp add: App_beta Lam_beta)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
82 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
83 |
lemma beta_subst1: "B \<longrightarrow>b* C \<Longrightarrow> A [x ::= B] \<longrightarrow>b* A [x ::= C]"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
84 |
apply (erule beta_star.induct)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
85 |
apply auto
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
86 |
apply (subgoal_tac "A [x ::= M2] \<longrightarrow>b* A [x ::= M3]")
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
87 |
apply (rotate_tac 1)
|
3085
|
88 |
apply (erule bs3)
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
89 |
apply assumption
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
90 |
apply (simp add: beta_subst1_pre)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
91 |
done
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
92 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
93 |
lemma beta_subst2_pre:
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
94 |
assumes "A \<longrightarrow>b B" shows "A [x ::= C] \<longrightarrow>b* B [x ::= C]"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
95 |
using assms
|
3081
|
96 |
apply (nominal_induct avoiding: x C rule: beta.strong_induct)
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
97 |
apply (auto simp add: App_beta fresh_star_def fresh_Pair Lam_beta)[3]
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
98 |
apply (subst substitution_lemma)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
99 |
apply (auto simp add: fresh_star_def fresh_Pair fresh_at_base)[2]
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
100 |
apply (auto simp add: fresh_star_def fresh_Pair)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
101 |
apply (rule beta_star.intros)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
102 |
defer
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
103 |
apply (subst beta.intros)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
104 |
apply (auto simp add: fresh_fact)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
105 |
done
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
106 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
107 |
lemma beta_subst2: "A \<longrightarrow>b* B \<Longrightarrow> A [x ::= C] \<longrightarrow>b* B [x ::= C]"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
108 |
apply (erule beta_star.induct)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
109 |
apply auto
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
110 |
apply (subgoal_tac "M2[x ::= C] \<longrightarrow>b* M3[x ::= C]")
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
111 |
apply (rotate_tac 1)
|
3085
|
112 |
apply (erule bs3)
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
113 |
apply assumption
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
114 |
apply (simp add: beta_subst2_pre)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
115 |
done
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
116 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
117 |
lemma beta_subst: "A \<longrightarrow>b* B \<Longrightarrow> C \<longrightarrow>b* D \<Longrightarrow> A [x ::= C] \<longrightarrow>b* B [x ::= D]"
|
3085
|
118 |
using beta_subst1 beta_subst2 bs3 by metis
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
119 |
|
3080
|
120 |
lemma subst_rsp_pre:
|
|
121 |
"x \<approx> y \<Longrightarrow> xb \<approx> ya \<Longrightarrow> x [xa ::= xb] \<approx> y [xa ::= ya]"
|
|
122 |
unfolding equ_def
|
|
123 |
apply auto
|
|
124 |
apply (rule_tac x="r [xa ::= ra]" in exI)
|
|
125 |
apply (simp add: beta_subst)
|
|
126 |
done
|
|
127 |
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
128 |
lemma [quot_respect]:
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
129 |
shows "(equ ===> op = ===> equ ===> equ) subst subst"
|
3080
|
130 |
unfolding fun_rel_def by (auto simp add: subst_rsp_pre)
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
131 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
132 |
lemma [quot_respect]:
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
133 |
shows "(op = ===> equ ===> equ) permute permute"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
134 |
unfolding fun_rel_def equ_def
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
135 |
apply (auto intro: eqvts)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
136 |
apply (rule_tac x="x \<bullet> r" in exI)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
137 |
using eqvts(1) permute_boolI by metis
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
138 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
139 |
quotient_type qlam = lam / equ
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
140 |
by (auto intro!: equivpI reflpI sympI transpI simp add: equ_refl equ_sym)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
141 |
(erule equ_trans, assumption)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
142 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
143 |
quotient_definition "QVar::name \<Rightarrow> qlam" is Var
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
144 |
quotient_definition "QApp::qlam \<Rightarrow> qlam \<Rightarrow> qlam" is App
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
145 |
quotient_definition QLam ("QLam [_]._")
|
3085
|
146 |
where "QLam::name \<Rightarrow> qlam \<Rightarrow> qlam" is CR.Lam
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
147 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
148 |
lemmas qlam_strong_induct = lam.strong_induct[quot_lifted]
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
149 |
lemmas qlam_induct = lam.induct[quot_lifted]
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
150 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
151 |
instantiation qlam :: pt
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
152 |
begin
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
153 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
154 |
quotient_definition "permute_qlam::perm \<Rightarrow> qlam \<Rightarrow> qlam"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
155 |
is "permute::perm \<Rightarrow> lam \<Rightarrow> lam"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
156 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
157 |
instance
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
158 |
apply default
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
159 |
apply(descending)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
160 |
apply(simp)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
161 |
apply(rule equ_refl)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
162 |
apply(descending)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
163 |
apply(simp)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
164 |
apply(rule equ_refl)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
165 |
done
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
166 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
167 |
end
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
168 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
169 |
lemma qlam_perm[simp, eqvt]:
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
170 |
shows "p \<bullet> (QVar x) = QVar (p \<bullet> x)"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
171 |
and "p \<bullet> (QApp t s) = QApp (p \<bullet> t) (p \<bullet> s)"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
172 |
and "p \<bullet> (QLam [x].t) = QLam [p \<bullet> x].(p \<bullet> t)"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
173 |
by(descending, simp add: equ_refl)+
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
174 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
175 |
lemma qlam_supports:
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
176 |
shows "{atom x} supports (QVar x)"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
177 |
and "supp (t, s) supports (QApp t s)"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
178 |
and "supp (x, t) supports (QLam [x].t)"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
179 |
unfolding supports_def fresh_def[symmetric]
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
180 |
by (auto simp add: swap_fresh_fresh)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
181 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
182 |
lemma qlam_fs:
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
183 |
fixes t::"qlam"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
184 |
shows "finite (supp t)"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
185 |
apply(induct t rule: qlam_induct)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
186 |
apply(rule supports_finite)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
187 |
apply(rule qlam_supports)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
188 |
apply(simp)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
189 |
apply(rule supports_finite)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
190 |
apply(rule qlam_supports)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
191 |
apply(simp add: supp_Pair)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
192 |
apply(rule supports_finite)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
193 |
apply(rule qlam_supports)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
194 |
apply(simp add: supp_Pair finite_supp)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
195 |
done
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
196 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
197 |
instantiation qlam :: fs
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
198 |
begin
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
199 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
200 |
instance
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
201 |
apply(default)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
202 |
apply(rule qlam_fs)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
203 |
done
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
204 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
205 |
end
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
206 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
207 |
quotient_definition subst_qlam ("_[_ ::q= _]")
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
208 |
where "subst_qlam::qlam \<Rightarrow> name \<Rightarrow> qlam \<Rightarrow> qlam" is subst
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
209 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
210 |
definition
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
211 |
"Supp t = \<Inter>{supp s | s. s \<approx> t}"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
212 |
|
3080
|
213 |
lemma Supp_rsp:
|
|
214 |
"a \<approx> b \<Longrightarrow> Supp a = Supp b"
|
|
215 |
unfolding Supp_def
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
216 |
apply(rule_tac f="Inter" in arg_cong)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
217 |
apply(auto)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
218 |
apply (metis equ_trans)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
219 |
by (metis equivp_def qlam_equivp)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
220 |
|
3080
|
221 |
lemma [quot_respect]:
|
|
222 |
shows "(equ ===> op=) Supp Supp"
|
|
223 |
unfolding fun_rel_def by (auto simp add: Supp_rsp)
|
|
224 |
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
225 |
quotient_definition "supp_qlam::qlam \<Rightarrow> atom set"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
226 |
is "Supp::lam \<Rightarrow> atom set"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
227 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
228 |
lemma Supp_supp:
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
229 |
"Supp t \<subseteq> supp t"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
230 |
unfolding Supp_def
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
231 |
apply(auto)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
232 |
apply(drule_tac x="supp t" in spec)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
233 |
apply(auto simp add: equ_refl)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
234 |
done
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
235 |
|
3080
|
236 |
lemma supp_subst:
|
|
237 |
shows "supp (t[x ::= s]) \<subseteq> (supp t - {atom x}) \<union> supp s"
|
|
238 |
by (induct t x s rule: subst.induct) (auto simp add: lam.supp supp_at_base)
|
|
239 |
|
|
240 |
lemma supp_beta: "x \<longrightarrow>b r \<Longrightarrow> supp r \<subseteq> supp x"
|
|
241 |
apply (induct rule: beta.induct)
|
|
242 |
apply (simp_all add: lam.supp)
|
|
243 |
apply blast+
|
|
244 |
using supp_subst by blast
|
|
245 |
|
|
246 |
lemma supp_beta_star: "x \<longrightarrow>b* r \<Longrightarrow> supp r \<subseteq> supp x"
|
|
247 |
apply (erule beta_star.induct)
|
|
248 |
apply auto
|
|
249 |
using supp_beta by blast
|
|
250 |
|
|
251 |
lemma supp_equ: "x \<approx> y \<Longrightarrow> \<exists>z. z \<approx> x \<and> supp z \<subseteq> supp x \<inter> supp y"
|
|
252 |
unfolding equ_def
|
|
253 |
apply (simp (no_asm) only: equ_def[symmetric])
|
|
254 |
apply (elim exE)
|
|
255 |
apply (rule_tac x=r in exI)
|
|
256 |
apply rule
|
|
257 |
apply (metis bs1 equ_def)
|
|
258 |
using supp_beta_star by blast
|
|
259 |
|
|
260 |
lemma supp_psubset: "Supp x \<subset> supp x \<Longrightarrow> \<exists>t. t \<approx> x \<and> supp t \<subset> supp x"
|
|
261 |
proof -
|
|
262 |
assume "Supp x \<subset> supp x"
|
|
263 |
then obtain a where "a \<in> supp x" "a \<notin> Supp x" by blast
|
|
264 |
then obtain y where nin: "y \<approx> x" "a \<notin> supp y" unfolding Supp_def by blast
|
|
265 |
then obtain t where eq: "t \<approx> x" "supp t \<subseteq> supp x \<inter> supp y"
|
|
266 |
using supp_equ equ_sym by blast
|
|
267 |
then have "supp t \<subset> supp x" using nin
|
|
268 |
by (metis `(a\<Colon>atom) \<in> supp (x\<Colon>lam)` le_infE psubset_eq set_rev_mp)
|
|
269 |
then show "\<exists>t. t \<approx> x \<and> supp t \<subset> supp x" using eq by blast
|
|
270 |
qed
|
|
271 |
|
|
272 |
lemma Supp_exists: "\<exists>t. supp t = Supp t \<and> t \<approx> x"
|
|
273 |
proof -
|
|
274 |
have "\<And>fs x. supp x = fs \<Longrightarrow> \<exists>t. supp t = Supp t \<and> t \<approx> x"
|
|
275 |
proof -
|
|
276 |
fix fs
|
|
277 |
show "\<And>x. supp x = fs \<Longrightarrow> \<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x"
|
|
278 |
proof (cases "finite fs")
|
|
279 |
case True
|
|
280 |
assume fs: "finite fs"
|
|
281 |
then show "\<And>x. supp x = fs \<Longrightarrow> \<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x"
|
|
282 |
proof (induct fs rule: finite_psubset_induct, clarify)
|
|
283 |
fix A :: "atom set" fix x :: lam
|
|
284 |
assume IH: "\<And>B xa. \<lbrakk>B \<subset> supp x; supp xa = B\<rbrakk> \<Longrightarrow> \<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> xa"
|
|
285 |
show "\<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x"
|
|
286 |
proof (cases "supp x = Supp x")
|
|
287 |
assume "supp x = Supp x"
|
|
288 |
then show "\<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x"
|
|
289 |
by (rule_tac x="x" in exI) (simp add: equ_refl)
|
|
290 |
next
|
|
291 |
assume "supp x \<noteq> Supp x"
|
|
292 |
then have "Supp x \<subset> supp x" using Supp_supp by blast
|
|
293 |
then obtain y where a1: "supp y \<subset> supp x" "y \<approx> x"
|
|
294 |
using supp_psubset by blast
|
|
295 |
then obtain t where "supp t = Supp t \<and> t \<approx> y"
|
|
296 |
using IH[of "supp y" y] by blast
|
|
297 |
then show "\<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x" using a1 equ_trans
|
|
298 |
by blast
|
|
299 |
qed
|
|
300 |
qed
|
|
301 |
next
|
|
302 |
case False
|
|
303 |
fix x :: lam
|
|
304 |
assume "supp x = fs" "infinite fs"
|
|
305 |
then show "\<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x"
|
|
306 |
by (auto simp add: finite_supp)
|
|
307 |
qed simp
|
|
308 |
qed
|
|
309 |
then show "\<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x" by blast
|
|
310 |
qed
|
|
311 |
|
|
312 |
lemma subst3: "x \<noteq> y \<and> atom x \<notin> Supp s \<Longrightarrow> Lam [x]. t [y ::= s] \<approx> Lam [x]. (t [y ::= s])"
|
|
313 |
proof -
|
|
314 |
assume as: "x \<noteq> y \<and> atom x \<notin> Supp s"
|
|
315 |
obtain s' where s: "supp s' = Supp s'" "s' \<approx> s" using Supp_exists[of s] by blast
|
|
316 |
then have lhs: "Lam [x]. t [y ::= s] \<approx> Lam [x]. t [y ::= s']" using subst_rsp_pre equ_refl equ_sym by blast
|
|
317 |
have supp: "Supp s' = Supp s" using Supp_rsp s(2) by blast
|
|
318 |
have lhs_rhs: "Lam [x]. t [y ::= s'] = Lam [x]. (t [y ::= s'])"
|
|
319 |
by (simp add: fresh_def supp_Pair s supp as supp_at_base)
|
|
320 |
have "t [y ::= s'] \<approx> t [y ::= s]"
|
|
321 |
using subst_rsp_pre[OF equ_refl s(2)] .
|
|
322 |
with Lam_rsp have rhs: "Lam [x]. (t [y ::= s']) \<approx> Lam [x]. (t [y ::= s])" .
|
|
323 |
show ?thesis
|
|
324 |
using lhs[unfolded lhs_rhs] rhs equ_trans by blast
|
|
325 |
qed
|
|
326 |
|
|
327 |
thm subst3[quot_lifted]
|
|
328 |
|
3078
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
329 |
lemma Supp_Lam:
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
330 |
"atom a \<notin> Supp (Lam [a].t)"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
331 |
proof -
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
332 |
have "atom a \<notin> supp (Lam [a].t)" by (simp add: lam.supp)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
333 |
then show ?thesis using Supp_supp
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
334 |
by blast
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
335 |
qed
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
336 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
337 |
lemma [eqvt]: "(p \<bullet> (a \<approx> b)) = ((p \<bullet> a) \<approx> (p \<bullet> b))"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
338 |
unfolding equ_def
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
339 |
by perm_simp rule
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
340 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
341 |
lemma [eqvt]: "p \<bullet> (Supp x) = Supp (p \<bullet> x)"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
342 |
unfolding Supp_def
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
343 |
by perm_simp rule
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
344 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
345 |
lemmas s = Supp_Lam[quot_lifted]
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
346 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
347 |
lemma var_beta_pre: "s \<longrightarrow>b* r \<Longrightarrow> s = Var name \<Longrightarrow> r = Var name"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
348 |
apply (induct rule: beta_star.induct)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
349 |
apply simp
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
350 |
apply (subgoal_tac "M2 = Var name")
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
351 |
apply (thin_tac "M1 \<longrightarrow>b* M2")
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
352 |
apply (thin_tac "M1 = Var name")
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
353 |
apply (thin_tac "M1 = Var name \<Longrightarrow> M2 = Var name")
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
354 |
defer
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
355 |
apply simp
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
356 |
apply (erule_tac beta.cases)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
357 |
apply simp_all
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
358 |
done
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
359 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
360 |
lemma var_beta: "Var name \<longrightarrow>b* r \<longleftrightarrow> r = Var name"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
361 |
by (auto simp add: var_beta_pre)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
362 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
363 |
lemma qlam_eq_iff:
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
364 |
"(QVar n = QVar m) = (n = m)"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
365 |
apply descending unfolding equ_def var_beta by auto
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
366 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
367 |
lemma "supp (QVar n) = {atom n}"
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
368 |
unfolding supp_def
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
369 |
apply simp
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
370 |
unfolding qlam_eq_iff
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
371 |
apply (fold supp_def)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
372 |
apply (simp add: supp_at_base)
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
373 |
done
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
374 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
375 |
end
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
376 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
377 |
|
abf147627b4b
Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
378 |
|