author | berghofe |
Fri, 28 Apr 2006 17:56:20 +0200 | |
changeset 19499 | 1a082c1257d7 |
parent 19363 | 667b5ea637dd |
child 20503 | 503ac4c5ef91 |
permissions | -rw-r--r-- |
5261 | 1 |
(* Title: HOL/Lambda/ListBeta.thy |
2 |
ID: $Id$ |
|
3 |
Author: Tobias Nipkow |
|
4 |
Copyright 1998 TU Muenchen |
|
5 |
*) |
|
6 |
||
9811
39ffdb8cab03
HOL/Lambda: converted into new-style theory and document;
wenzelm
parents:
9771
diff
changeset
|
7 |
header {* Lifting beta-reduction to lists *} |
39ffdb8cab03
HOL/Lambda: converted into new-style theory and document;
wenzelm
parents:
9771
diff
changeset
|
8 |
|
16417 | 9 |
theory ListBeta imports ListApplication ListOrder begin |
9762 | 10 |
|
9811
39ffdb8cab03
HOL/Lambda: converted into new-style theory and document;
wenzelm
parents:
9771
diff
changeset
|
11 |
text {* |
39ffdb8cab03
HOL/Lambda: converted into new-style theory and document;
wenzelm
parents:
9771
diff
changeset
|
12 |
Lifting beta-reduction to lists of terms, reducing exactly one element. |
39ffdb8cab03
HOL/Lambda: converted into new-style theory and document;
wenzelm
parents:
9771
diff
changeset
|
13 |
*} |
39ffdb8cab03
HOL/Lambda: converted into new-style theory and document;
wenzelm
parents:
9771
diff
changeset
|
14 |
|
19363 | 15 |
abbreviation |
19086 | 16 |
list_beta :: "dB list => dB list => bool" (infixl "=>" 50) |
19363 | 17 |
"rs => ss == (rs, ss) : step1 beta" |
9762 | 18 |
|
18513 | 19 |
lemma head_Var_reduction: |
20 |
"Var n \<degree>\<degree> rs -> v \<Longrightarrow> \<exists>ss. rs => ss \<and> v = Var n \<degree>\<degree> ss" |
|
21 |
apply (induct u == "Var n \<degree>\<degree> rs" v fixing: rs set: beta) |
|
9762 | 22 |
apply simp |
23 |
apply (rule_tac xs = rs in rev_exhaust) |
|
24 |
apply simp |
|
18513 | 25 |
apply (atomize, force intro: append_step1I) |
9762 | 26 |
apply (rule_tac xs = rs in rev_exhaust) |
27 |
apply simp |
|
9771 | 28 |
apply (auto 0 3 intro: disjI2 [THEN append_step1I]) |
9762 | 29 |
done |
30 |
||
18513 | 31 |
lemma apps_betasE [elim!]: |
32 |
assumes major: "r \<degree>\<degree> rs -> s" |
|
33 |
and cases: "!!r'. [| r -> r'; s = r' \<degree>\<degree> rs |] ==> R" |
|
34 |
"!!rs'. [| rs => rs'; s = r \<degree>\<degree> rs' |] ==> R" |
|
35 |
"!!t u us. [| r = Abs t; rs = u # us; s = t[u/0] \<degree>\<degree> us |] ==> R" |
|
36 |
shows R |
|
37 |
proof - |
|
38 |
from major have |
|
39 |
"(\<exists>r'. r -> r' \<and> s = r' \<degree>\<degree> rs) \<or> |
|
40 |
(\<exists>rs'. rs => rs' \<and> s = r \<degree>\<degree> rs') \<or> |
|
41 |
(\<exists>t u us. r = Abs t \<and> rs = u # us \<and> s = t[u/0] \<degree>\<degree> us)" |
|
42 |
apply (induct u == "r \<degree>\<degree> rs" s fixing: r rs set: beta) |
|
43 |
apply (case_tac r) |
|
44 |
apply simp |
|
45 |
apply (simp add: App_eq_foldl_conv) |
|
46 |
apply (split split_if_asm) |
|
47 |
apply simp |
|
48 |
apply blast |
|
49 |
apply simp |
|
50 |
apply (simp add: App_eq_foldl_conv) |
|
51 |
apply (split split_if_asm) |
|
52 |
apply simp |
|
9762 | 53 |
apply simp |
18513 | 54 |
apply (drule App_eq_foldl_conv [THEN iffD1]) |
10653 | 55 |
apply (split split_if_asm) |
9762 | 56 |
apply simp |
57 |
apply blast |
|
18513 | 58 |
apply (force intro!: disjI1 [THEN append_step1I]) |
59 |
apply (drule App_eq_foldl_conv [THEN iffD1]) |
|
10653 | 60 |
apply (split split_if_asm) |
9762 | 61 |
apply simp |
18513 | 62 |
apply blast |
63 |
apply (clarify, auto 0 3 intro!: exI intro: append_step1I) |
|
64 |
done |
|
65 |
with cases show ?thesis by blast |
|
66 |
qed |
|
9762 | 67 |
|
68 |
lemma apps_preserves_beta [simp]: |
|
12011 | 69 |
"r -> s ==> r \<degree>\<degree> ss -> s \<degree>\<degree> ss" |
18241 | 70 |
by (induct ss rule: rev_induct) auto |
9762 | 71 |
|
72 |
lemma apps_preserves_beta2 [simp]: |
|
12011 | 73 |
"r ->> s ==> r \<degree>\<degree> ss ->> s \<degree>\<degree> ss" |
18241 | 74 |
apply (induct set: rtrancl) |
9762 | 75 |
apply blast |
76 |
apply (blast intro: apps_preserves_beta rtrancl_into_rtrancl) |
|
77 |
done |
|
78 |
||
18241 | 79 |
lemma apps_preserves_betas [simp]: |
80 |
"rs => ss \<Longrightarrow> r \<degree>\<degree> rs -> r \<degree>\<degree> ss" |
|
81 |
apply (induct rs fixing: ss rule: rev_induct) |
|
9762 | 82 |
apply simp |
83 |
apply simp |
|
84 |
apply (rule_tac xs = ss in rev_exhaust) |
|
85 |
apply simp |
|
86 |
apply simp |
|
87 |
apply (drule Snoc_step1_SnocD) |
|
88 |
apply blast |
|
89 |
done |
|
5261 | 90 |
|
11639 | 91 |
end |