author | hoelzl |
Thu, 17 Jan 2013 11:59:12 +0100 | |
changeset 50936 | b28f258ebc1a |
parent 49962 | a8cc904a6820 |
child 53015 | a1119cf551e8 |
permissions | -rw-r--r-- |
31990 | 1 |
(* Title: HOL/Library/Kleene_Algebra.thy |
2 |
Author: Alexander Krauss, TU Muenchen |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
3 |
Author: Tjark Weber, University of Cambridge |
31990 | 4 |
*) |
5 |
||
37091 | 6 |
header {* Kleene Algebras *} |
31990 | 7 |
|
8 |
theory Kleene_Algebra |
|
9 |
imports Main |
|
10 |
begin |
|
11 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
12 |
text {* WARNING: This is work in progress. Expect changes in the future. *} |
31990 | 13 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
14 |
text {* Various lemmas correspond to entries in a database of theorems |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
15 |
about Kleene algebras and related structures maintained by Peter |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
16 |
H\"ofner: see |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
17 |
\url{http://www.informatik.uni-augsburg.de/~hoefnepe/kleene_db/lemmas/index.html}. *} |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
18 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
19 |
subsection {* Preliminaries *} |
31990 | 20 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
21 |
text {* A class where addition is idempotent. *} |
31990 | 22 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
23 |
class idem_add = plus + |
31990 | 24 |
assumes add_idem [simp]: "x + x = x" |
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
25 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
26 |
text {* A class of idempotent abelian semigroups (written additively). *} |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
27 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
28 |
class idem_ab_semigroup_add = ab_semigroup_add + idem_add |
31990 | 29 |
begin |
30 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
31 |
lemma add_idem2 [simp]: "x + (x + y) = x + y" |
31990 | 32 |
unfolding add_assoc[symmetric] by simp |
33 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
34 |
lemma add_idem3 [simp]: "x + (y + x) = x + y" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
35 |
by (simp add: add_commute) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
36 |
|
31990 | 37 |
end |
38 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
39 |
text {* A class where order is defined in terms of addition. *} |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
40 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
41 |
class order_by_add = plus + ord + |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
42 |
assumes order_def: "x \<le> y \<longleftrightarrow> x + y = y" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
43 |
assumes strict_order_def: "x < y \<longleftrightarrow> x \<le> y \<and> \<not> y \<le> x" |
31990 | 44 |
begin |
45 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
46 |
lemma ord_simp [simp]: "x \<le> y \<Longrightarrow> x + y = y" |
31990 | 47 |
unfolding order_def . |
48 |
||
49 |
lemma ord_intro: "x + y = y \<Longrightarrow> x \<le> y" |
|
50 |
unfolding order_def . |
|
51 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
52 |
end |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
53 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
54 |
text {* A class of idempotent abelian semigroups (written additively) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
55 |
where order is defined in terms of addition. *} |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
56 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
57 |
class ordered_idem_ab_semigroup_add = idem_ab_semigroup_add + order_by_add |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
58 |
begin |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
59 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
60 |
lemma ord_simp2 [simp]: "x \<le> y \<Longrightarrow> y + x = y" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
61 |
unfolding order_def add_commute . |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
62 |
|
31990 | 63 |
subclass order proof |
64 |
fix x y z :: 'a |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
65 |
show "x \<le> x" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
66 |
unfolding order_def by simp |
31990 | 67 |
show "x \<le> y \<Longrightarrow> y \<le> z \<Longrightarrow> x \<le> z" |
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
68 |
unfolding order_def by (metis add_assoc) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
69 |
show "x \<le> y \<Longrightarrow> y \<le> x \<Longrightarrow> x = y" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
70 |
unfolding order_def by (simp add: add_commute) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
71 |
show "x < y \<longleftrightarrow> x \<le> y \<and> \<not> y \<le> x" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
72 |
by (fact strict_order_def) |
31990 | 73 |
qed |
74 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
75 |
subclass ordered_ab_semigroup_add proof |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
76 |
fix a b c :: 'a |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
77 |
assume "a \<le> b" show "c + a \<le> c + b" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
78 |
proof (rule ord_intro) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
79 |
have "c + a + (c + b) = a + b + c" by (simp add: add_ac) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
80 |
also have "\<dots> = c + b" by (simp add: `a \<le> b` add_ac) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
81 |
finally show "c + a + (c + b) = c + b" . |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
82 |
qed |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
83 |
qed |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
84 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
85 |
lemma plus_leI [simp]: |
31990 | 86 |
"x \<le> z \<Longrightarrow> y \<le> z \<Longrightarrow> x + y \<le> z" |
87 |
unfolding order_def by (simp add: add_assoc) |
|
88 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
89 |
lemma less_add [simp]: "x \<le> x + y" "y \<le> x + y" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
90 |
unfolding order_def by (auto simp: add_ac) |
31990 | 91 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
92 |
lemma add_est1 [elim]: "x + y \<le> z \<Longrightarrow> x \<le> z" |
31990 | 93 |
using less_add(1) by (rule order_trans) |
94 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
95 |
lemma add_est2 [elim]: "x + y \<le> z \<Longrightarrow> y \<le> z" |
31990 | 96 |
using less_add(2) by (rule order_trans) |
97 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
98 |
lemma add_supremum: "(x + y \<le> z) = (x \<le> z \<and> y \<le> z)" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
99 |
by auto |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
100 |
|
31990 | 101 |
end |
102 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
103 |
text {* A class of commutative monoids (written additively) where |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
104 |
order is defined in terms of addition. *} |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
105 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
106 |
class ordered_comm_monoid_add = comm_monoid_add + order_by_add |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
107 |
begin |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
108 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
109 |
lemma zero_minimum [simp]: "0 \<le> x" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
110 |
unfolding order_def by simp |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
111 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
112 |
end |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
113 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
114 |
text {* A class of idempotent commutative monoids (written additively) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
115 |
where order is defined in terms of addition. *} |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
116 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
117 |
class ordered_idem_comm_monoid_add = ordered_comm_monoid_add + idem_add |
31990 | 118 |
begin |
119 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
120 |
subclass ordered_idem_ab_semigroup_add .. |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
121 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
122 |
lemma sum_is_zero: "(x + y = 0) = (x = 0 \<and> y = 0)" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
123 |
by (simp add: add_supremum eq_iff) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
124 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
125 |
end |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
126 |
|
37091 | 127 |
subsection {* A class of Kleene algebras *} |
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
128 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
129 |
text {* Class @{text pre_kleene} provides all operations of Kleene |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
130 |
algebras except for the Kleene star. *} |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
131 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
132 |
class pre_kleene = semiring_1 + idem_add + order_by_add |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
133 |
begin |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
134 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
135 |
subclass ordered_idem_comm_monoid_add .. |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
136 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
32238
diff
changeset
|
137 |
subclass ordered_semiring proof |
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
138 |
fix a b c :: 'a |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
139 |
assume "a \<le> b" |
31990 | 140 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
141 |
show "c * a \<le> c * b" |
31990 | 142 |
proof (rule ord_intro) |
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
143 |
from `a \<le> b` have "c * (a + b) = c * b" by simp |
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
44928
diff
changeset
|
144 |
thus "c * a + c * b = c * b" by (simp add: distrib_left) |
31990 | 145 |
qed |
146 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
147 |
show "a * c \<le> b * c" |
31990 | 148 |
proof (rule ord_intro) |
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
149 |
from `a \<le> b` have "(a + b) * c = b * c" by simp |
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
44928
diff
changeset
|
150 |
thus "a * c + b * c = b * c" by (simp add: distrib_right) |
31990 | 151 |
qed |
152 |
qed |
|
153 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
154 |
end |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
155 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
156 |
text {* A class that provides a star operator. *} |
31990 | 157 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
158 |
class star = |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
159 |
fixes star :: "'a \<Rightarrow> 'a" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
160 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
161 |
text {* Finally, a class of Kleene algebras. *} |
31990 | 162 |
|
163 |
class kleene = pre_kleene + star + |
|
164 |
assumes star1: "1 + a * star a \<le> star a" |
|
165 |
and star2: "1 + star a * a \<le> star a" |
|
166 |
and star3: "a * x \<le> x \<Longrightarrow> star a * x \<le> x" |
|
167 |
and star4: "x * a \<le> x \<Longrightarrow> x * star a \<le> x" |
|
168 |
begin |
|
169 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
170 |
lemma star3' [simp]: |
31990 | 171 |
assumes a: "b + a * x \<le> x" |
172 |
shows "star a * b \<le> x" |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
173 |
by (metis assms less_add mult_left_mono order_trans star3 zero_minimum) |
31990 | 174 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
175 |
lemma star4' [simp]: |
31990 | 176 |
assumes a: "b + x * a \<le> x" |
177 |
shows "b * star a \<le> x" |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
178 |
by (metis assms less_add mult_right_mono order_trans star4 zero_minimum) |
31990 | 179 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
180 |
lemma star_unfold_left: "1 + a * star a = star a" |
31990 | 181 |
proof (rule antisym, rule star1) |
182 |
have "1 + a * (1 + a * star a) \<le> 1 + a * star a" |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
183 |
by (metis add_left_mono mult_left_mono star1 zero_minimum) |
31990 | 184 |
with star3' have "star a * 1 \<le> 1 + a * star a" . |
185 |
thus "star a \<le> 1 + a * star a" by simp |
|
186 |
qed |
|
187 |
||
188 |
lemma star_unfold_right: "1 + star a * a = star a" |
|
189 |
proof (rule antisym, rule star2) |
|
190 |
have "1 + (1 + star a * a) * a \<le> 1 + star a * a" |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
191 |
by (metis add_left_mono mult_right_mono star2 zero_minimum) |
31990 | 192 |
with star4' have "1 * star a \<le> 1 + star a * a" . |
193 |
thus "star a \<le> 1 + star a * a" by simp |
|
194 |
qed |
|
195 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
196 |
lemma star_zero [simp]: "star 0 = 1" |
31990 | 197 |
by (fact star_unfold_left[of 0, simplified, symmetric]) |
198 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
199 |
lemma star_one [simp]: "star 1 = 1" |
31990 | 200 |
by (metis add_idem2 eq_iff mult_1_right ord_simp2 star3 star_unfold_left) |
201 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
202 |
lemma one_less_star [simp]: "1 \<le> star x" |
31990 | 203 |
by (metis less_add(1) star_unfold_left) |
204 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
205 |
lemma ka1 [simp]: "x * star x \<le> star x" |
31990 | 206 |
by (metis less_add(2) star_unfold_left) |
207 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
208 |
lemma star_mult_idem [simp]: "star x * star x = star x" |
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
44928
diff
changeset
|
209 |
by (metis add_commute add_est1 eq_iff mult_1_right distrib_left star3 star_unfold_left) |
31990 | 210 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
211 |
lemma less_star [simp]: "x \<le> star x" |
31990 | 212 |
by (metis less_add(2) mult_1_right mult_left_mono one_less_star order_trans star_unfold_left zero_minimum) |
213 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
214 |
lemma star_simulation_leq_1: |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
215 |
assumes a: "a * x \<le> x * b" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
216 |
shows "star a * x \<le> x * star b" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
217 |
proof (rule star3', rule order_trans) |
37090 | 218 |
from a have "a * x * star b \<le> x * b * star b" |
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
219 |
by (rule mult_right_mono) simp |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
220 |
thus "x + a * (x * star b) \<le> x + x * b * star b" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
221 |
using add_left_mono by (auto simp: mult_assoc) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
222 |
show "\<dots> \<le> x * star b" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
223 |
by (metis add_supremum ka1 mult.right_neutral mult_assoc mult_left_mono one_less_star zero_minimum) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
224 |
qed |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
225 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
226 |
lemma star_simulation_leq_2: |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
227 |
assumes a: "x * a \<le> b * x" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
228 |
shows "x * star a \<le> star b * x" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
229 |
proof (rule star4', rule order_trans) |
37090 | 230 |
from a have "star b * x * a \<le> star b * b * x" |
231 |
by (metis mult_assoc mult_left_mono zero_minimum) |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
232 |
thus "x + star b * x * a \<le> x + star b * b * x" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
233 |
using add_mono by auto |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
234 |
show "\<dots> \<le> star b * x" |
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
44928
diff
changeset
|
235 |
by (metis add_supremum distrib_right less_add mult.left_neutral mult_assoc mult_right_mono star_unfold_right zero_minimum) |
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
236 |
qed |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
237 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
238 |
lemma star_simulation [simp]: |
31990 | 239 |
assumes a: "a * x = x * b" |
240 |
shows "star a * x = x * star b" |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
241 |
by (metis antisym assms order_refl star_simulation_leq_1 star_simulation_leq_2) |
31990 | 242 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
243 |
lemma star_slide2 [simp]: "star x * x = x * star x" |
31990 | 244 |
by (metis star_simulation) |
245 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
246 |
lemma star_idemp [simp]: "star (star x) = star x" |
31990 | 247 |
by (metis add_idem2 eq_iff less_star mult_1_right star3' star_mult_idem star_unfold_left) |
248 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
249 |
lemma star_slide [simp]: "star (x * y) * x = x * star (y * x)" |
37179
446cf1f997d1
Got rid of a warning about duplicate rewrite rules.
webertj
parents:
37095
diff
changeset
|
250 |
by (metis mult_assoc star_simulation) |
31990 | 251 |
|
252 |
lemma star_one': |
|
253 |
assumes "p * p' = 1" "p' * p = 1" |
|
254 |
shows "p' * star a * p = star (p' * a * p)" |
|
255 |
proof - |
|
256 |
from assms |
|
257 |
have "p' * star a * p = p' * star (p * p' * a) * p" |
|
258 |
by simp |
|
259 |
also have "\<dots> = p' * p * star (p' * a * p)" |
|
260 |
by (simp add: mult_assoc) |
|
261 |
also have "\<dots> = star (p' * a * p)" |
|
262 |
by (simp add: assms) |
|
263 |
finally show ?thesis . |
|
264 |
qed |
|
265 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
266 |
lemma x_less_star [simp]: "x \<le> x * star a" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
267 |
by (metis mult.right_neutral mult_left_mono one_less_star zero_minimum) |
31990 | 268 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
269 |
lemma star_mono [simp]: "x \<le> y \<Longrightarrow> star x \<le> star y" |
31990 | 270 |
by (metis add_commute eq_iff less_star ord_simp2 order_trans star3 star4' star_idemp star_mult_idem x_less_star) |
271 |
||
272 |
lemma star_sub: "x \<le> 1 \<Longrightarrow> star x = 1" |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
273 |
by (metis add_commute ord_simp star_idemp star_mono star_mult_idem star_one star_unfold_left) |
31990 | 274 |
|
275 |
lemma star_unfold2: "star x * y = y + x * star x * y" |
|
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
44928
diff
changeset
|
276 |
by (subst star_unfold_right[symmetric]) (simp add: mult_assoc distrib_right) |
31990 | 277 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
278 |
lemma star_absorb_one [simp]: "star (x + 1) = star x" |
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
44928
diff
changeset
|
279 |
by (metis add_commute eq_iff distrib_right less_add mult_1_left mult_assoc star3 star_mono star_mult_idem star_unfold2 x_less_star) |
31990 | 280 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
281 |
lemma star_absorb_one' [simp]: "star (1 + x) = star x" |
31990 | 282 |
by (subst add_commute) (fact star_absorb_one) |
283 |
||
284 |
lemma ka16: "(y * star x) * star (y * star x) \<le> star x * star (y * star x)" |
|
285 |
by (metis ka1 less_add(1) mult_assoc order_trans star_unfold2) |
|
286 |
||
287 |
lemma ka16': "(star x * y) * star (star x * y) \<le> star (star x * y) * star x" |
|
288 |
by (metis ka1 mult_assoc order_trans star_slide x_less_star) |
|
289 |
||
290 |
lemma ka17: "(x * star x) * star (y * star x) \<le> star x * star (y * star x)" |
|
291 |
by (metis ka1 mult_assoc mult_right_mono zero_minimum) |
|
292 |
||
293 |
lemma ka18: "(x * star x) * star (y * star x) + (y * star x) * star (y * star x) |
|
294 |
\<le> star x * star (y * star x)" |
|
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
44928
diff
changeset
|
295 |
by (metis ka16 ka17 distrib_right mult_assoc plus_leI) |
31990 | 296 |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
297 |
lemma star_decomp: "star (x + y) = star x * star (y * star x)" |
32238 | 298 |
proof (rule antisym) |
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
299 |
have "1 + (x + y) * star x * star (y * star x) \<le> |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
300 |
1 + x * star x * star (y * star x) + y * star x * star (y * star x)" |
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
44928
diff
changeset
|
301 |
by (metis add_commute add_left_commute eq_iff distrib_right mult_assoc) |
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
302 |
also have "\<dots> \<le> star x * star (y * star x)" |
32238 | 303 |
by (metis add_commute add_est1 add_left_commute ka18 plus_leI star_unfold_left x_less_star) |
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
304 |
finally show "star (x + y) \<le> star x * star (y * star x)" |
32238 | 305 |
by (metis mult_1_right mult_assoc star3') |
306 |
next |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
307 |
show "star x * star (y * star x) \<le> star (x + y)" |
32238 | 308 |
by (metis add_assoc add_est1 add_est2 add_left_commute less_star mult_mono' |
309 |
star_absorb_one star_absorb_one' star_idemp star_mono star_mult_idem zero_minimum) |
|
310 |
qed |
|
31990 | 311 |
|
312 |
lemma ka22: "y * star x \<le> star x * star y \<Longrightarrow> star y * star x \<le> star x * star y" |
|
313 |
by (metis mult_assoc mult_right_mono plus_leI star3' star_mult_idem x_less_star zero_minimum) |
|
314 |
||
315 |
lemma ka23: "star y * star x \<le> star x * star y \<Longrightarrow> y * star x \<le> star x * star y" |
|
316 |
by (metis less_star mult_right_mono order_trans zero_minimum) |
|
317 |
||
318 |
lemma ka24: "star (x + y) \<le> star (star x * star y)" |
|
319 |
by (metis add_est1 add_est2 less_add(1) mult_assoc order_def plus_leI star_absorb_one star_mono star_slide2 star_unfold2 star_unfold_left x_less_star) |
|
320 |
||
321 |
lemma ka25: "star y * star x \<le> star x * star y \<Longrightarrow> star (star y * star x) \<le> star x * star y" |
|
37095
805d18dae026
used sledgehammer[isar_proof] to replace slow metis call
krauss
parents:
37092
diff
changeset
|
322 |
proof - |
805d18dae026
used sledgehammer[isar_proof] to replace slow metis call
krauss
parents:
37092
diff
changeset
|
323 |
assume "star y * star x \<le> star x * star y" |
805d18dae026
used sledgehammer[isar_proof] to replace slow metis call
krauss
parents:
37092
diff
changeset
|
324 |
hence "\<forall>x\<^isub>1. star y * (star x * x\<^isub>1) \<le> star x * (star y * x\<^isub>1)" by (metis mult_assoc mult_right_mono zero_minimum) |
805d18dae026
used sledgehammer[isar_proof] to replace slow metis call
krauss
parents:
37092
diff
changeset
|
325 |
hence "star y * (star x * star y) \<le> star x * star y" by (metis star_mult_idem) |
805d18dae026
used sledgehammer[isar_proof] to replace slow metis call
krauss
parents:
37092
diff
changeset
|
326 |
hence "\<exists>x\<^isub>1. star (star y * star x) * star x\<^isub>1 \<le> star x * star y" by (metis star_decomp star_idemp star_simulation_leq_2 star_slide) |
805d18dae026
used sledgehammer[isar_proof] to replace slow metis call
krauss
parents:
37092
diff
changeset
|
327 |
hence "\<exists>x\<^isub>1\<ge>star (star y * star x). x\<^isub>1 \<le> star x * star y" by (metis x_less_star) |
805d18dae026
used sledgehammer[isar_proof] to replace slow metis call
krauss
parents:
37092
diff
changeset
|
328 |
thus "star (star y * star x) \<le> star x * star y" by (metis order_trans) |
805d18dae026
used sledgehammer[isar_proof] to replace slow metis call
krauss
parents:
37092
diff
changeset
|
329 |
qed |
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
330 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
331 |
lemma church_rosser: |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
332 |
"star y * star x \<le> star x * star y \<Longrightarrow> star (x + y) \<le> star x * star y" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
333 |
by (metis add_commute ka24 ka25 order_trans) |
31990 | 334 |
|
335 |
lemma kleene_bubblesort: "y * x \<le> x * y \<Longrightarrow> star (x + y) \<le> star x * star y" |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
336 |
by (metis church_rosser star_simulation_leq_1 star_simulation_leq_2) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
337 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
338 |
lemma ka27: "star (x + star y) = star (x + y)" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
339 |
by (metis add_commute star_decomp star_idemp) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
340 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
341 |
lemma ka28: "star (star x + star y) = star (x + y)" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
342 |
by (metis add_commute ka27) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
343 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
344 |
lemma ka29: "(y * (1 + x) \<le> (1 + x) * star y) = (y * x \<le> (1 + x) * star y)" |
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
44928
diff
changeset
|
345 |
by (metis add_supremum distrib_right less_add(1) less_star mult.left_neutral mult.right_neutral order_trans distrib_left) |
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
346 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
347 |
lemma ka30: "star x * star y \<le> star (x + y)" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
348 |
by (metis mult_left_mono star_decomp star_mono x_less_star zero_minimum) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
349 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
350 |
lemma simple_simulation: "x * y = 0 \<Longrightarrow> star x * y = y" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
351 |
by (metis mult.right_neutral mult_zero_right star_simulation star_zero) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
352 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
353 |
lemma ka32: "star (x * y) = 1 + x * star (y * x) * y" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
354 |
by (metis mult_assoc star_slide star_unfold_left) |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
355 |
|
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
356 |
lemma ka33: "x * y + 1 \<le> y \<Longrightarrow> star x \<le> y" |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
357 |
by (metis add_commute mult.right_neutral star3') |
31990 | 358 |
|
359 |
end |
|
360 |
||
37091 | 361 |
subsection {* Complete lattices are Kleene algebras *} |
31990 | 362 |
|
44928
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
hoelzl
parents:
44918
diff
changeset
|
363 |
lemma (in complete_lattice) SUP_upper': |
31990 | 364 |
assumes "l \<le> M i" |
365 |
shows "l \<le> (SUP i. M i)" |
|
44928
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
hoelzl
parents:
44918
diff
changeset
|
366 |
using assms by (rule order_trans) (rule SUP_upper [OF UNIV_I]) |
31990 | 367 |
|
368 |
class kleene_by_complete_lattice = pre_kleene |
|
369 |
+ complete_lattice + power + star + |
|
370 |
assumes star_cont: "a * star b * c = SUPR UNIV (\<lambda>n. a * b ^ n * c)" |
|
371 |
begin |
|
372 |
||
373 |
subclass kleene |
|
374 |
proof |
|
375 |
fix a x :: 'a |
|
376 |
||
377 |
have [simp]: "1 \<le> star a" |
|
378 |
unfolding star_cont[of 1 a 1, simplified] |
|
44928
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
hoelzl
parents:
44918
diff
changeset
|
379 |
by (subst power_0[symmetric]) (rule SUP_upper [OF UNIV_I]) |
44918 | 380 |
|
381 |
have "a * star a \<le> star a" |
|
382 |
using star_cont[of a a 1] star_cont[of 1 a 1] |
|
383 |
by (auto simp add: power_Suc[symmetric] simp del: power_Suc |
|
44928
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
hoelzl
parents:
44918
diff
changeset
|
384 |
intro: SUP_least SUP_upper) |
31990 | 385 |
|
44918 | 386 |
then show "1 + a * star a \<le> star a" |
387 |
by simp |
|
388 |
||
389 |
then show "1 + star a * a \<le> star a" |
|
390 |
using star_cont[of a a 1] star_cont[of 1 a a] |
|
391 |
by (simp add: power_commutes) |
|
31990 | 392 |
|
393 |
show "a * x \<le> x \<Longrightarrow> star a * x \<le> x" |
|
394 |
proof - |
|
395 |
assume a: "a * x \<le> x" |
|
396 |
||
397 |
{ |
|
398 |
fix n |
|
399 |
have "a ^ (Suc n) * x \<le> a ^ n * x" |
|
400 |
proof (induct n) |
|
401 |
case 0 thus ?case by (simp add: a) |
|
402 |
next |
|
403 |
case (Suc n) |
|
404 |
hence "a * (a ^ Suc n * x) \<le> a * (a ^ n * x)" |
|
405 |
by (auto intro: mult_mono) |
|
406 |
thus ?case |
|
407 |
by (simp add: mult_assoc) |
|
408 |
qed |
|
409 |
} |
|
410 |
note a = this |
|
411 |
||
412 |
{ |
|
413 |
fix n have "a ^ n * x \<le> x" |
|
414 |
proof (induct n) |
|
415 |
case 0 show ?case by simp |
|
416 |
next |
|
417 |
case (Suc n) with a[of n] |
|
418 |
show ?case by simp |
|
419 |
qed |
|
420 |
} |
|
421 |
note b = this |
|
422 |
||
423 |
show "star a * x \<le> x" |
|
424 |
unfolding star_cont[of 1 a x, simplified] |
|
44928
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
hoelzl
parents:
44918
diff
changeset
|
425 |
by (rule SUP_least) (rule b) |
31990 | 426 |
qed |
427 |
||
428 |
show "x * a \<le> x \<Longrightarrow> x * star a \<le> x" (* symmetric *) |
|
429 |
proof - |
|
430 |
assume a: "x * a \<le> x" |
|
431 |
||
432 |
{ |
|
433 |
fix n |
|
434 |
have "x * a ^ (Suc n) \<le> x * a ^ n" |
|
435 |
proof (induct n) |
|
436 |
case 0 thus ?case by (simp add: a) |
|
437 |
next |
|
438 |
case (Suc n) |
|
439 |
hence "(x * a ^ Suc n) * a \<le> (x * a ^ n) * a" |
|
440 |
by (auto intro: mult_mono) |
|
441 |
thus ?case |
|
442 |
by (simp add: power_commutes mult_assoc) |
|
443 |
qed |
|
444 |
} |
|
445 |
note a = this |
|
446 |
||
447 |
{ |
|
448 |
fix n have "x * a ^ n \<le> x" |
|
449 |
proof (induct n) |
|
450 |
case 0 show ?case by simp |
|
451 |
next |
|
452 |
case (Suc n) with a[of n] |
|
453 |
show ?case by simp |
|
454 |
qed |
|
455 |
} |
|
456 |
note b = this |
|
457 |
||
458 |
show "x * star a \<le> x" |
|
459 |
unfolding star_cont[of x a 1, simplified] |
|
44928
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
hoelzl
parents:
44918
diff
changeset
|
460 |
by (rule SUP_least) (rule b) |
31990 | 461 |
qed |
462 |
qed |
|
463 |
||
464 |
end |
|
465 |
||
37091 | 466 |
subsection {* Transitive closure *} |
31990 | 467 |
|
468 |
context kleene |
|
469 |
begin |
|
470 |
||
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
471 |
definition |
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
472 |
tcl_def: "tcl x = star x * x" |
31990 | 473 |
|
474 |
lemma tcl_zero: "tcl 0 = 0" |
|
475 |
unfolding tcl_def by simp |
|
476 |
||
477 |
lemma tcl_unfold_right: "tcl a = a + tcl a * a" |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
478 |
by (metis star_slide2 star_unfold2 tcl_def) |
31990 | 479 |
|
480 |
lemma less_tcl: "a \<le> tcl a" |
|
37088
36c13099d10f
Refactoring, minor extensions (e.g., church_rosser).
webertj
parents:
35028
diff
changeset
|
481 |
by (metis star_slide2 tcl_def x_less_star) |
31990 | 482 |
|
483 |
end |
|
484 |
||
485 |
end |