author | haftmann |
Thu, 19 Jun 2025 17:15:40 +0200 | |
changeset 82734 | 89347c0cc6a3 |
parent 82248 | e8c96013ea8a |
permissions | -rw-r--r-- |
62479 | 1 |
(* Title: HOL/Nonstandard_Analysis/StarDef.thy |
2 |
Author: Jacques D. Fleuriot and Brian Huffman |
|
27468 | 3 |
*) |
4 |
||
61975 | 5 |
section \<open>Construction of Star Types Using Ultrafilters\<close> |
27468 | 6 |
|
7 |
theory StarDef |
|
64435 | 8 |
imports Free_Ultrafilter |
27468 | 9 |
begin |
10 |
||
61975 | 11 |
subsection \<open>A Free Ultrafilter over the Naturals\<close> |
27468 | 12 |
|
69597 | 13 |
definition FreeUltrafilterNat :: "nat filter" (\<open>\<U>\<close>) |
64435 | 14 |
where "\<U> = (SOME U. freeultrafilter U)" |
27468 | 15 |
|
16 |
lemma freeultrafilter_FreeUltrafilterNat: "freeultrafilter \<U>" |
|
70219 | 17 |
unfolding FreeUltrafilterNat_def |
18 |
by (simp add: freeultrafilter_Ex someI_ex) |
|
27468 | 19 |
|
64438 | 20 |
interpretation FreeUltrafilterNat: freeultrafilter \<U> |
64435 | 21 |
by (rule freeultrafilter_FreeUltrafilterNat) |
22 |
||
27468 | 23 |
|
61975 | 24 |
subsection \<open>Definition of \<open>star\<close> type constructor\<close> |
27468 | 25 |
|
64435 | 26 |
definition starrel :: "((nat \<Rightarrow> 'a) \<times> (nat \<Rightarrow> 'a)) set" |
27 |
where "starrel = {(X, Y). eventually (\<lambda>n. X n = Y n) \<U>}" |
|
27468 | 28 |
|
45694
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
45605
diff
changeset
|
29 |
definition "star = (UNIV :: (nat \<Rightarrow> 'a) set) // starrel" |
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
45605
diff
changeset
|
30 |
|
49834 | 31 |
typedef 'a star = "star :: (nat \<Rightarrow> 'a) set set" |
64435 | 32 |
by (auto simp: star_def intro: quotientI) |
27468 | 33 |
|
64435 | 34 |
definition star_n :: "(nat \<Rightarrow> 'a) \<Rightarrow> 'a star" |
35 |
where "star_n X = Abs_star (starrel `` {X})" |
|
27468 | 36 |
|
37 |
theorem star_cases [case_names star_n, cases type: star]: |
|
64435 | 38 |
obtains X where "x = star_n X" |
39 |
by (cases x) (auto simp: star_n_def star_def elim: quotientE) |
|
27468 | 40 |
|
64435 | 41 |
lemma all_star_eq: "(\<forall>x. P x) \<longleftrightarrow> (\<forall>X. P (star_n X))" |
70219 | 42 |
by (metis star_cases) |
27468 | 43 |
|
64435 | 44 |
lemma ex_star_eq: "(\<exists>x. P x) \<longleftrightarrow> (\<exists>X. P (star_n X))" |
70219 | 45 |
by (metis star_cases) |
27468 | 46 |
|
69597 | 47 |
text \<open>Proving that \<^term>\<open>starrel\<close> is an equivalence relation.\<close> |
27468 | 48 |
|
64435 | 49 |
lemma starrel_iff [iff]: "(X, Y) \<in> starrel \<longleftrightarrow> eventually (\<lambda>n. X n = Y n) \<U>" |
50 |
by (simp add: starrel_def) |
|
27468 | 51 |
|
52 |
lemma equiv_starrel: "equiv UNIV starrel" |
|
40815 | 53 |
proof (rule equivI) |
82248 | 54 |
show "starrel \<subseteq> UNIV \<times> UNIV" by simp |
30198 | 55 |
show "refl starrel" by (simp add: refl_on_def) |
27468 | 56 |
show "sym starrel" by (simp add: sym_def eq_commute) |
60041 | 57 |
show "trans starrel" by (intro transI) (auto elim: eventually_elim2) |
27468 | 58 |
qed |
59 |
||
64435 | 60 |
lemmas equiv_starrel_iff = eq_equiv_class_iff [OF equiv_starrel UNIV_I UNIV_I] |
27468 | 61 |
|
62 |
lemma starrel_in_star: "starrel``{x} \<in> star" |
|
64435 | 63 |
by (simp add: star_def quotientI) |
27468 | 64 |
|
64435 | 65 |
lemma star_n_eq_iff: "star_n X = star_n Y \<longleftrightarrow> eventually (\<lambda>n. X n = Y n) \<U>" |
66 |
by (simp add: star_n_def Abs_star_inject starrel_in_star equiv_starrel_iff) |
|
27468 | 67 |
|
68 |
||
61975 | 69 |
subsection \<open>Transfer principle\<close> |
27468 | 70 |
|
61975 | 71 |
text \<open>This introduction rule starts each transfer proof.\<close> |
64435 | 72 |
lemma transfer_start: "P \<equiv> eventually (\<lambda>n. Q) \<U> \<Longrightarrow> Trueprop P \<equiv> Trueprop Q" |
60041 | 73 |
by (simp add: FreeUltrafilterNat.proper) |
27468 | 74 |
|
64270
bf474d719011
Modified transfer principle in HOL/NSA to cause less ho-unficiation
Simon Wimmer <wimmers@in.tum.de>
parents:
64242
diff
changeset
|
75 |
text \<open>Standard principles that play a central role in the transfer tactic.\<close> |
81142 | 76 |
definition Ifun :: "('a \<Rightarrow> 'b) star \<Rightarrow> 'a star \<Rightarrow> 'b star" |
77 |
(\<open>(\<open>notation=\<open>infix \<star>\<close>\<close>_ \<star>/ _)\<close> [300, 301] 300) |
|
64435 | 78 |
where "Ifun f \<equiv> |
79 |
\<lambda>x. Abs_star (\<Union>F\<in>Rep_star f. \<Union>X\<in>Rep_star x. starrel``{\<lambda>n. F n (X n)})" |
|
64270
bf474d719011
Modified transfer principle in HOL/NSA to cause less ho-unficiation
Simon Wimmer <wimmers@in.tum.de>
parents:
64242
diff
changeset
|
80 |
|
64435 | 81 |
lemma Ifun_congruent2: "congruent2 starrel starrel (\<lambda>F X. starrel``{\<lambda>n. F n (X n)})" |
82 |
by (auto simp add: congruent2_def equiv_starrel_iff elim!: eventually_rev_mp) |
|
64270
bf474d719011
Modified transfer principle in HOL/NSA to cause less ho-unficiation
Simon Wimmer <wimmers@in.tum.de>
parents:
64242
diff
changeset
|
83 |
|
bf474d719011
Modified transfer principle in HOL/NSA to cause less ho-unficiation
Simon Wimmer <wimmers@in.tum.de>
parents:
64242
diff
changeset
|
84 |
lemma Ifun_star_n: "star_n F \<star> star_n X = star_n (\<lambda>n. F n (X n))" |
64435 | 85 |
by (simp add: Ifun_def star_n_def Abs_star_inverse starrel_in_star |
86 |
UN_equiv_class2 [OF equiv_starrel equiv_starrel Ifun_congruent2]) |
|
64270
bf474d719011
Modified transfer principle in HOL/NSA to cause less ho-unficiation
Simon Wimmer <wimmers@in.tum.de>
parents:
64242
diff
changeset
|
87 |
|
64435 | 88 |
lemma transfer_Ifun: "f \<equiv> star_n F \<Longrightarrow> x \<equiv> star_n X \<Longrightarrow> f \<star> x \<equiv> star_n (\<lambda>n. F n (X n))" |
89 |
by (simp only: Ifun_star_n) |
|
64270
bf474d719011
Modified transfer principle in HOL/NSA to cause less ho-unficiation
Simon Wimmer <wimmers@in.tum.de>
parents:
64242
diff
changeset
|
90 |
|
64435 | 91 |
definition star_of :: "'a \<Rightarrow> 'a star" |
92 |
where "star_of x \<equiv> star_n (\<lambda>n. x)" |
|
64270
bf474d719011
Modified transfer principle in HOL/NSA to cause less ho-unficiation
Simon Wimmer <wimmers@in.tum.de>
parents:
64242
diff
changeset
|
93 |
|
61975 | 94 |
text \<open>Initialize transfer tactic.\<close> |
69605 | 95 |
ML_file \<open>transfer_principle.ML\<close> |
27468 | 96 |
|
64435 | 97 |
method_setup transfer = |
98 |
\<open>Attrib.thms >> (fn ths => fn ctxt => SIMPLE_METHOD' (Transfer_Principle.transfer_tac ctxt ths))\<close> |
|
99 |
"transfer principle" |
|
47432 | 100 |
|
101 |
||
61975 | 102 |
text \<open>Transfer introduction rules.\<close> |
27468 | 103 |
|
104 |
lemma transfer_ex [transfer_intro]: |
|
64435 | 105 |
"(\<And>X. p (star_n X) \<equiv> eventually (\<lambda>n. P n (X n)) \<U>) \<Longrightarrow> |
106 |
\<exists>x::'a star. p x \<equiv> eventually (\<lambda>n. \<exists>x. P n x) \<U>" |
|
107 |
by (simp only: ex_star_eq eventually_ex) |
|
27468 | 108 |
|
109 |
lemma transfer_all [transfer_intro]: |
|
64435 | 110 |
"(\<And>X. p (star_n X) \<equiv> eventually (\<lambda>n. P n (X n)) \<U>) \<Longrightarrow> |
111 |
\<forall>x::'a star. p x \<equiv> eventually (\<lambda>n. \<forall>x. P n x) \<U>" |
|
112 |
by (simp only: all_star_eq FreeUltrafilterNat.eventually_all_iff) |
|
27468 | 113 |
|
64435 | 114 |
lemma transfer_not [transfer_intro]: "p \<equiv> eventually P \<U> \<Longrightarrow> \<not> p \<equiv> eventually (\<lambda>n. \<not> P n) \<U>" |
115 |
by (simp only: FreeUltrafilterNat.eventually_not_iff) |
|
27468 | 116 |
|
117 |
lemma transfer_conj [transfer_intro]: |
|
64435 | 118 |
"p \<equiv> eventually P \<U> \<Longrightarrow> q \<equiv> eventually Q \<U> \<Longrightarrow> p \<and> q \<equiv> eventually (\<lambda>n. P n \<and> Q n) \<U>" |
119 |
by (simp only: eventually_conj_iff) |
|
27468 | 120 |
|
121 |
lemma transfer_disj [transfer_intro]: |
|
64435 | 122 |
"p \<equiv> eventually P \<U> \<Longrightarrow> q \<equiv> eventually Q \<U> \<Longrightarrow> p \<or> q \<equiv> eventually (\<lambda>n. P n \<or> Q n) \<U>" |
123 |
by (simp only: FreeUltrafilterNat.eventually_disj_iff) |
|
27468 | 124 |
|
125 |
lemma transfer_imp [transfer_intro]: |
|
64435 | 126 |
"p \<equiv> eventually P \<U> \<Longrightarrow> q \<equiv> eventually Q \<U> \<Longrightarrow> p \<longrightarrow> q \<equiv> eventually (\<lambda>n. P n \<longrightarrow> Q n) \<U>" |
127 |
by (simp only: FreeUltrafilterNat.eventually_imp_iff) |
|
27468 | 128 |
|
129 |
lemma transfer_iff [transfer_intro]: |
|
64435 | 130 |
"p \<equiv> eventually P \<U> \<Longrightarrow> q \<equiv> eventually Q \<U> \<Longrightarrow> p = q \<equiv> eventually (\<lambda>n. P n = Q n) \<U>" |
131 |
by (simp only: FreeUltrafilterNat.eventually_iff_iff) |
|
27468 | 132 |
|
133 |
lemma transfer_if_bool [transfer_intro]: |
|
64435 | 134 |
"p \<equiv> eventually P \<U> \<Longrightarrow> x \<equiv> eventually X \<U> \<Longrightarrow> y \<equiv> eventually Y \<U> \<Longrightarrow> |
135 |
(if p then x else y) \<equiv> eventually (\<lambda>n. if P n then X n else Y n) \<U>" |
|
136 |
by (simp only: if_bool_eq_conj transfer_conj transfer_imp transfer_not) |
|
27468 | 137 |
|
138 |
lemma transfer_eq [transfer_intro]: |
|
64435 | 139 |
"x \<equiv> star_n X \<Longrightarrow> y \<equiv> star_n Y \<Longrightarrow> x = y \<equiv> eventually (\<lambda>n. X n = Y n) \<U>" |
140 |
by (simp only: star_n_eq_iff) |
|
27468 | 141 |
|
142 |
lemma transfer_if [transfer_intro]: |
|
64435 | 143 |
"p \<equiv> eventually (\<lambda>n. P n) \<U> \<Longrightarrow> x \<equiv> star_n X \<Longrightarrow> y \<equiv> star_n Y \<Longrightarrow> |
144 |
(if p then x else y) \<equiv> star_n (\<lambda>n. if P n then X n else Y n)" |
|
145 |
by (rule eq_reflection) (auto simp: star_n_eq_iff transfer_not elim!: eventually_mono) |
|
27468 | 146 |
|
147 |
lemma transfer_fun_eq [transfer_intro]: |
|
64435 | 148 |
"(\<And>X. f (star_n X) = g (star_n X) \<equiv> eventually (\<lambda>n. F n (X n) = G n (X n)) \<U>) \<Longrightarrow> |
149 |
f = g \<equiv> eventually (\<lambda>n. F n = G n) \<U>" |
|
150 |
by (simp only: fun_eq_iff transfer_all) |
|
27468 | 151 |
|
152 |
lemma transfer_star_n [transfer_intro]: "star_n X \<equiv> star_n (\<lambda>n. X n)" |
|
64435 | 153 |
by (rule reflexive) |
27468 | 154 |
|
60041 | 155 |
lemma transfer_bool [transfer_intro]: "p \<equiv> eventually (\<lambda>n. p) \<U>" |
64435 | 156 |
by (simp add: FreeUltrafilterNat.proper) |
27468 | 157 |
|
158 |
||
61975 | 159 |
subsection \<open>Standard elements\<close> |
27468 | 160 |
|
64435 | 161 |
definition Standard :: "'a star set" |
162 |
where "Standard = range star_of" |
|
27468 | 163 |
|
69597 | 164 |
text \<open>Transfer tactic should remove occurrences of \<^term>\<open>star_of\<close>.\<close> |
165 |
setup \<open>Transfer_Principle.add_const \<^const_name>\<open>star_of\<close>\<close> |
|
27468 | 166 |
|
64435 | 167 |
lemma star_of_inject: "star_of x = star_of y \<longleftrightarrow> x = y" |
168 |
by transfer (rule refl) |
|
27468 | 169 |
|
170 |
lemma Standard_star_of [simp]: "star_of x \<in> Standard" |
|
64435 | 171 |
by (simp add: Standard_def) |
172 |
||
27468 | 173 |
|
61975 | 174 |
subsection \<open>Internal functions\<close> |
27468 | 175 |
|
69597 | 176 |
text \<open>Transfer tactic should remove occurrences of \<^term>\<open>Ifun\<close>.\<close> |
177 |
setup \<open>Transfer_Principle.add_const \<^const_name>\<open>Ifun\<close>\<close> |
|
27468 | 178 |
|
179 |
lemma Ifun_star_of [simp]: "star_of f \<star> star_of x = star_of (f x)" |
|
64435 | 180 |
by transfer (rule refl) |
27468 | 181 |
|
64435 | 182 |
lemma Standard_Ifun [simp]: "f \<in> Standard \<Longrightarrow> x \<in> Standard \<Longrightarrow> f \<star> x \<in> Standard" |
183 |
by (auto simp add: Standard_def) |
|
27468 | 184 |
|
185 |
||
64435 | 186 |
text \<open>Nonstandard extensions of functions.\<close> |
27468 | 187 |
|
81142 | 188 |
definition starfun :: "('a \<Rightarrow> 'b) \<Rightarrow> 'a star \<Rightarrow> 'b star" |
189 |
(\<open>(\<open>open_block notation=\<open>prefix starfun\<close>\<close>*f* _)\<close> [80] 80) |
|
64435 | 190 |
where "starfun f \<equiv> \<lambda>x. star_of f \<star> x" |
191 |
||
81142 | 192 |
definition starfun2 :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> 'a star \<Rightarrow> 'b star \<Rightarrow> 'c star" |
193 |
(\<open>(\<open>open_block notation=\<open>prefix starfun2\<close>\<close>*f2* _)\<close> [80] 80) |
|
64435 | 194 |
where "starfun2 f \<equiv> \<lambda>x y. star_of f \<star> x \<star> y" |
27468 | 195 |
|
196 |
declare starfun_def [transfer_unfold] |
|
197 |
declare starfun2_def [transfer_unfold] |
|
198 |
||
199 |
lemma starfun_star_n: "( *f* f) (star_n X) = star_n (\<lambda>n. f (X n))" |
|
64435 | 200 |
by (simp only: starfun_def star_of_def Ifun_star_n) |
27468 | 201 |
|
64435 | 202 |
lemma starfun2_star_n: "( *f2* f) (star_n X) (star_n Y) = star_n (\<lambda>n. f (X n) (Y n))" |
203 |
by (simp only: starfun2_def star_of_def Ifun_star_n) |
|
27468 | 204 |
|
205 |
lemma starfun_star_of [simp]: "( *f* f) (star_of x) = star_of (f x)" |
|
64435 | 206 |
by transfer (rule refl) |
27468 | 207 |
|
208 |
lemma starfun2_star_of [simp]: "( *f2* f) (star_of x) = *f* f x" |
|
64435 | 209 |
by transfer (rule refl) |
27468 | 210 |
|
211 |
lemma Standard_starfun [simp]: "x \<in> Standard \<Longrightarrow> starfun f x \<in> Standard" |
|
64435 | 212 |
by (simp add: starfun_def) |
27468 | 213 |
|
64435 | 214 |
lemma Standard_starfun2 [simp]: "x \<in> Standard \<Longrightarrow> y \<in> Standard \<Longrightarrow> starfun2 f x y \<in> Standard" |
215 |
by (simp add: starfun2_def) |
|
27468 | 216 |
|
217 |
lemma Standard_starfun_iff: |
|
218 |
assumes inj: "\<And>x y. f x = f y \<Longrightarrow> x = y" |
|
64435 | 219 |
shows "starfun f x \<in> Standard \<longleftrightarrow> x \<in> Standard" |
27468 | 220 |
proof |
221 |
assume "x \<in> Standard" |
|
64435 | 222 |
then show "starfun f x \<in> Standard" by simp |
27468 | 223 |
next |
64435 | 224 |
from inj have inj': "\<And>x y. starfun f x = starfun f y \<Longrightarrow> x = y" |
225 |
by transfer |
|
27468 | 226 |
assume "starfun f x \<in> Standard" |
227 |
then obtain b where b: "starfun f x = star_of b" |
|
228 |
unfolding Standard_def .. |
|
64435 | 229 |
then have "\<exists>x. starfun f x = star_of b" .. |
230 |
then have "\<exists>a. f a = b" by transfer |
|
27468 | 231 |
then obtain a where "f a = b" .. |
64435 | 232 |
then have "starfun f (star_of a) = star_of b" by transfer |
27468 | 233 |
with b have "starfun f x = starfun f (star_of a)" by simp |
64435 | 234 |
then have "x = star_of a" by (rule inj') |
235 |
then show "x \<in> Standard" by (simp add: Standard_def) |
|
27468 | 236 |
qed |
237 |
||
238 |
lemma Standard_starfun2_iff: |
|
239 |
assumes inj: "\<And>a b a' b'. f a b = f a' b' \<Longrightarrow> a = a' \<and> b = b'" |
|
64435 | 240 |
shows "starfun2 f x y \<in> Standard \<longleftrightarrow> x \<in> Standard \<and> y \<in> Standard" |
27468 | 241 |
proof |
242 |
assume "x \<in> Standard \<and> y \<in> Standard" |
|
64435 | 243 |
then show "starfun2 f x y \<in> Standard" by simp |
27468 | 244 |
next |
245 |
have inj': "\<And>x y z w. starfun2 f x y = starfun2 f z w \<Longrightarrow> x = z \<and> y = w" |
|
246 |
using inj by transfer |
|
247 |
assume "starfun2 f x y \<in> Standard" |
|
248 |
then obtain c where c: "starfun2 f x y = star_of c" |
|
249 |
unfolding Standard_def .. |
|
64435 | 250 |
then have "\<exists>x y. starfun2 f x y = star_of c" by auto |
251 |
then have "\<exists>a b. f a b = c" by transfer |
|
27468 | 252 |
then obtain a b where "f a b = c" by auto |
64435 | 253 |
then have "starfun2 f (star_of a) (star_of b) = star_of c" by transfer |
254 |
with c have "starfun2 f x y = starfun2 f (star_of a) (star_of b)" by simp |
|
255 |
then have "x = star_of a \<and> y = star_of b" by (rule inj') |
|
256 |
then show "x \<in> Standard \<and> y \<in> Standard" by (simp add: Standard_def) |
|
27468 | 257 |
qed |
258 |
||
259 |
||
61975 | 260 |
subsection \<open>Internal predicates\<close> |
27468 | 261 |
|
64435 | 262 |
definition unstar :: "bool star \<Rightarrow> bool" |
263 |
where "unstar b \<longleftrightarrow> b = star_of True" |
|
27468 | 264 |
|
64435 | 265 |
lemma unstar_star_n: "unstar (star_n P) \<longleftrightarrow> eventually P \<U>" |
266 |
by (simp add: unstar_def star_of_def star_n_eq_iff) |
|
27468 | 267 |
|
268 |
lemma unstar_star_of [simp]: "unstar (star_of p) = p" |
|
64435 | 269 |
by (simp add: unstar_def star_of_inject) |
27468 | 270 |
|
69597 | 271 |
text \<open>Transfer tactic should remove occurrences of \<^term>\<open>unstar\<close>.\<close> |
272 |
setup \<open>Transfer_Principle.add_const \<^const_name>\<open>unstar\<close>\<close> |
|
27468 | 273 |
|
64435 | 274 |
lemma transfer_unstar [transfer_intro]: "p \<equiv> star_n P \<Longrightarrow> unstar p \<equiv> eventually P \<U>" |
275 |
by (simp only: unstar_star_n) |
|
27468 | 276 |
|
81142 | 277 |
definition starP :: "('a \<Rightarrow> bool) \<Rightarrow> 'a star \<Rightarrow> bool" |
278 |
(\<open>(\<open>open_block notation=\<open>prefix starP\<close>\<close>*p* _)\<close> [80] 80) |
|
64435 | 279 |
where "*p* P = (\<lambda>x. unstar (star_of P \<star> x))" |
27468 | 280 |
|
81142 | 281 |
definition starP2 :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a star \<Rightarrow> 'b star \<Rightarrow> bool" |
282 |
(\<open>(\<open>open_block notation=\<open>prefix starP2\<close>\<close>*p2* _)\<close> [80] 80) |
|
64435 | 283 |
where "*p2* P = (\<lambda>x y. unstar (star_of P \<star> x \<star> y))" |
27468 | 284 |
|
285 |
declare starP_def [transfer_unfold] |
|
286 |
declare starP2_def [transfer_unfold] |
|
287 |
||
64435 | 288 |
lemma starP_star_n: "( *p* P) (star_n X) = eventually (\<lambda>n. P (X n)) \<U>" |
289 |
by (simp only: starP_def star_of_def Ifun_star_n unstar_star_n) |
|
27468 | 290 |
|
64435 | 291 |
lemma starP2_star_n: "( *p2* P) (star_n X) (star_n Y) = (eventually (\<lambda>n. P (X n) (Y n)) \<U>)" |
292 |
by (simp only: starP2_def star_of_def Ifun_star_n unstar_star_n) |
|
27468 | 293 |
|
294 |
lemma starP_star_of [simp]: "( *p* P) (star_of x) = P x" |
|
64435 | 295 |
by transfer (rule refl) |
27468 | 296 |
|
297 |
lemma starP2_star_of [simp]: "( *p2* P) (star_of x) = *p* P x" |
|
64435 | 298 |
by transfer (rule refl) |
27468 | 299 |
|
300 |
||
61975 | 301 |
subsection \<open>Internal sets\<close> |
27468 | 302 |
|
64435 | 303 |
definition Iset :: "'a set star \<Rightarrow> 'a star set" |
67399 | 304 |
where "Iset A = {x. ( *p2* (\<in>)) x A}" |
27468 | 305 |
|
64435 | 306 |
lemma Iset_star_n: "(star_n X \<in> Iset (star_n A)) = (eventually (\<lambda>n. X n \<in> A n) \<U>)" |
307 |
by (simp add: Iset_def starP2_star_n) |
|
27468 | 308 |
|
69597 | 309 |
text \<open>Transfer tactic should remove occurrences of \<^term>\<open>Iset\<close>.\<close> |
310 |
setup \<open>Transfer_Principle.add_const \<^const_name>\<open>Iset\<close>\<close> |
|
27468 | 311 |
|
312 |
lemma transfer_mem [transfer_intro]: |
|
64435 | 313 |
"x \<equiv> star_n X \<Longrightarrow> a \<equiv> Iset (star_n A) \<Longrightarrow> x \<in> a \<equiv> eventually (\<lambda>n. X n \<in> A n) \<U>" |
314 |
by (simp only: Iset_star_n) |
|
27468 | 315 |
|
316 |
lemma transfer_Collect [transfer_intro]: |
|
64435 | 317 |
"(\<And>X. p (star_n X) \<equiv> eventually (\<lambda>n. P n (X n)) \<U>) \<Longrightarrow> |
318 |
Collect p \<equiv> Iset (star_n (\<lambda>n. Collect (P n)))" |
|
319 |
by (simp add: atomize_eq set_eq_iff all_star_eq Iset_star_n) |
|
27468 | 320 |
|
321 |
lemma transfer_set_eq [transfer_intro]: |
|
64435 | 322 |
"a \<equiv> Iset (star_n A) \<Longrightarrow> b \<equiv> Iset (star_n B) \<Longrightarrow> a = b \<equiv> eventually (\<lambda>n. A n = B n) \<U>" |
323 |
by (simp only: set_eq_iff transfer_all transfer_iff transfer_mem) |
|
27468 | 324 |
|
325 |
lemma transfer_ball [transfer_intro]: |
|
64435 | 326 |
"a \<equiv> Iset (star_n A) \<Longrightarrow> (\<And>X. p (star_n X) \<equiv> eventually (\<lambda>n. P n (X n)) \<U>) \<Longrightarrow> |
327 |
\<forall>x\<in>a. p x \<equiv> eventually (\<lambda>n. \<forall>x\<in>A n. P n x) \<U>" |
|
328 |
by (simp only: Ball_def transfer_all transfer_imp transfer_mem) |
|
27468 | 329 |
|
330 |
lemma transfer_bex [transfer_intro]: |
|
64435 | 331 |
"a \<equiv> Iset (star_n A) \<Longrightarrow> (\<And>X. p (star_n X) \<equiv> eventually (\<lambda>n. P n (X n)) \<U>) \<Longrightarrow> |
332 |
\<exists>x\<in>a. p x \<equiv> eventually (\<lambda>n. \<exists>x\<in>A n. P n x) \<U>" |
|
333 |
by (simp only: Bex_def transfer_ex transfer_conj transfer_mem) |
|
27468 | 334 |
|
64435 | 335 |
lemma transfer_Iset [transfer_intro]: "a \<equiv> star_n A \<Longrightarrow> Iset a \<equiv> Iset (star_n (\<lambda>n. A n))" |
336 |
by simp |
|
337 |
||
27468 | 338 |
|
61975 | 339 |
text \<open>Nonstandard extensions of sets.\<close> |
27468 | 340 |
|
81142 | 341 |
definition starset :: "'a set \<Rightarrow> 'a star set" |
342 |
(\<open>(\<open>open_block notation=\<open>prefix starset\<close>\<close>*s* _)\<close> [80] 80) |
|
64435 | 343 |
where "starset A = Iset (star_of A)" |
27468 | 344 |
|
345 |
declare starset_def [transfer_unfold] |
|
346 |
||
64435 | 347 |
lemma starset_mem: "star_of x \<in> *s* A \<longleftrightarrow> x \<in> A" |
348 |
by transfer (rule refl) |
|
27468 | 349 |
|
350 |
lemma starset_UNIV: "*s* (UNIV::'a set) = (UNIV::'a star set)" |
|
64435 | 351 |
by (transfer UNIV_def) (rule refl) |
27468 | 352 |
|
353 |
lemma starset_empty: "*s* {} = {}" |
|
64435 | 354 |
by (transfer empty_def) (rule refl) |
27468 | 355 |
|
356 |
lemma starset_insert: "*s* (insert x A) = insert (star_of x) ( *s* A)" |
|
64435 | 357 |
by (transfer insert_def Un_def) (rule refl) |
27468 | 358 |
|
359 |
lemma starset_Un: "*s* (A \<union> B) = *s* A \<union> *s* B" |
|
64435 | 360 |
by (transfer Un_def) (rule refl) |
27468 | 361 |
|
362 |
lemma starset_Int: "*s* (A \<inter> B) = *s* A \<inter> *s* B" |
|
64435 | 363 |
by (transfer Int_def) (rule refl) |
27468 | 364 |
|
365 |
lemma starset_Compl: "*s* -A = -( *s* A)" |
|
64435 | 366 |
by (transfer Compl_eq) (rule refl) |
27468 | 367 |
|
368 |
lemma starset_diff: "*s* (A - B) = *s* A - *s* B" |
|
64435 | 369 |
by (transfer set_diff_eq) (rule refl) |
27468 | 370 |
|
371 |
lemma starset_image: "*s* (f ` A) = ( *f* f) ` ( *s* A)" |
|
64435 | 372 |
by (transfer image_def) (rule refl) |
27468 | 373 |
|
374 |
lemma starset_vimage: "*s* (f -` A) = ( *f* f) -` ( *s* A)" |
|
64435 | 375 |
by (transfer vimage_def) (rule refl) |
27468 | 376 |
|
64435 | 377 |
lemma starset_subset: "( *s* A \<subseteq> *s* B) \<longleftrightarrow> A \<subseteq> B" |
378 |
by (transfer subset_eq) (rule refl) |
|
27468 | 379 |
|
64435 | 380 |
lemma starset_eq: "( *s* A = *s* B) \<longleftrightarrow> A = B" |
381 |
by transfer (rule refl) |
|
27468 | 382 |
|
383 |
lemmas starset_simps [simp] = |
|
384 |
starset_mem starset_UNIV |
|
385 |
starset_empty starset_insert |
|
386 |
starset_Un starset_Int |
|
387 |
starset_Compl starset_diff |
|
388 |
starset_image starset_vimage |
|
389 |
starset_subset starset_eq |
|
390 |
||
391 |
||
61975 | 392 |
subsection \<open>Syntactic classes\<close> |
27468 | 393 |
|
394 |
instantiation star :: (zero) zero |
|
395 |
begin |
|
64435 | 396 |
definition star_zero_def: "0 \<equiv> star_of 0" |
397 |
instance .. |
|
27468 | 398 |
end |
399 |
||
400 |
instantiation star :: (one) one |
|
401 |
begin |
|
64435 | 402 |
definition star_one_def: "1 \<equiv> star_of 1" |
403 |
instance .. |
|
27468 | 404 |
end |
405 |
||
406 |
instantiation star :: (plus) plus |
|
407 |
begin |
|
67399 | 408 |
definition star_add_def: "(+) \<equiv> *f2* (+)" |
64435 | 409 |
instance .. |
27468 | 410 |
end |
411 |
||
412 |
instantiation star :: (times) times |
|
413 |
begin |
|
69064
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents:
67635
diff
changeset
|
414 |
definition star_mult_def: "((*)) \<equiv> *f2* ((*))" |
64435 | 415 |
instance .. |
27468 | 416 |
end |
417 |
||
418 |
instantiation star :: (uminus) uminus |
|
419 |
begin |
|
64435 | 420 |
definition star_minus_def: "uminus \<equiv> *f* uminus" |
421 |
instance .. |
|
27468 | 422 |
end |
423 |
||
424 |
instantiation star :: (minus) minus |
|
425 |
begin |
|
67399 | 426 |
definition star_diff_def: "(-) \<equiv> *f2* (-)" |
64435 | 427 |
instance .. |
27468 | 428 |
end |
429 |
||
430 |
instantiation star :: (abs) abs |
|
431 |
begin |
|
64435 | 432 |
definition star_abs_def: "abs \<equiv> *f* abs" |
433 |
instance .. |
|
27468 | 434 |
end |
435 |
||
436 |
instantiation star :: (sgn) sgn |
|
437 |
begin |
|
64435 | 438 |
definition star_sgn_def: "sgn \<equiv> *f* sgn" |
439 |
instance .. |
|
27468 | 440 |
end |
441 |
||
60352
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
60041
diff
changeset
|
442 |
instantiation star :: (divide) divide |
27468 | 443 |
begin |
64435 | 444 |
definition star_divide_def: "divide \<equiv> *f2* divide" |
445 |
instance .. |
|
60352
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
60041
diff
changeset
|
446 |
end |
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
60041
diff
changeset
|
447 |
|
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
60041
diff
changeset
|
448 |
instantiation star :: (inverse) inverse |
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
60041
diff
changeset
|
449 |
begin |
64435 | 450 |
definition star_inverse_def: "inverse \<equiv> *f* inverse" |
451 |
instance .. |
|
27468 | 452 |
end |
453 |
||
35050
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents:
35043
diff
changeset
|
454 |
instance star :: (Rings.dvd) Rings.dvd .. |
27651
16a26996c30e
moved op dvd to theory Ring_and_Field; generalized a couple of lemmas
haftmann
parents:
27468
diff
changeset
|
455 |
|
63950
cdc1e59aa513
syntactic type class for operation mod named after mod;
haftmann
parents:
63456
diff
changeset
|
456 |
instantiation star :: (modulo) modulo |
27468 | 457 |
begin |
67399 | 458 |
definition star_mod_def: "(mod) \<equiv> *f2* (mod)" |
64435 | 459 |
instance .. |
27468 | 460 |
end |
461 |
||
462 |
instantiation star :: (ord) ord |
|
463 |
begin |
|
67399 | 464 |
definition star_le_def: "(\<le>) \<equiv> *p2* (\<le>)" |
465 |
definition star_less_def: "(<) \<equiv> *p2* (<)" |
|
64435 | 466 |
instance .. |
27468 | 467 |
end |
468 |
||
469 |
lemmas star_class_defs [transfer_unfold] = |
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
470 |
star_zero_def star_one_def |
27468 | 471 |
star_add_def star_diff_def star_minus_def |
472 |
star_mult_def star_divide_def star_inverse_def |
|
473 |
star_le_def star_less_def star_abs_def star_sgn_def |
|
60352
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
60041
diff
changeset
|
474 |
star_mod_def |
27468 | 475 |
|
64435 | 476 |
|
477 |
text \<open>Class operations preserve standard elements.\<close> |
|
27468 | 478 |
|
479 |
lemma Standard_zero: "0 \<in> Standard" |
|
64435 | 480 |
by (simp add: star_zero_def) |
27468 | 481 |
|
482 |
lemma Standard_one: "1 \<in> Standard" |
|
64435 | 483 |
by (simp add: star_one_def) |
27468 | 484 |
|
64435 | 485 |
lemma Standard_add: "x \<in> Standard \<Longrightarrow> y \<in> Standard \<Longrightarrow> x + y \<in> Standard" |
486 |
by (simp add: star_add_def) |
|
27468 | 487 |
|
64435 | 488 |
lemma Standard_diff: "x \<in> Standard \<Longrightarrow> y \<in> Standard \<Longrightarrow> x - y \<in> Standard" |
489 |
by (simp add: star_diff_def) |
|
27468 | 490 |
|
491 |
lemma Standard_minus: "x \<in> Standard \<Longrightarrow> - x \<in> Standard" |
|
64435 | 492 |
by (simp add: star_minus_def) |
27468 | 493 |
|
64435 | 494 |
lemma Standard_mult: "x \<in> Standard \<Longrightarrow> y \<in> Standard \<Longrightarrow> x * y \<in> Standard" |
495 |
by (simp add: star_mult_def) |
|
27468 | 496 |
|
64435 | 497 |
lemma Standard_divide: "x \<in> Standard \<Longrightarrow> y \<in> Standard \<Longrightarrow> x / y \<in> Standard" |
498 |
by (simp add: star_divide_def) |
|
27468 | 499 |
|
500 |
lemma Standard_inverse: "x \<in> Standard \<Longrightarrow> inverse x \<in> Standard" |
|
64435 | 501 |
by (simp add: star_inverse_def) |
27468 | 502 |
|
61945 | 503 |
lemma Standard_abs: "x \<in> Standard \<Longrightarrow> \<bar>x\<bar> \<in> Standard" |
64435 | 504 |
by (simp add: star_abs_def) |
27468 | 505 |
|
64435 | 506 |
lemma Standard_mod: "x \<in> Standard \<Longrightarrow> y \<in> Standard \<Longrightarrow> x mod y \<in> Standard" |
507 |
by (simp add: star_mod_def) |
|
27468 | 508 |
|
509 |
lemmas Standard_simps [simp] = |
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
510 |
Standard_zero Standard_one |
60352
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
60041
diff
changeset
|
511 |
Standard_add Standard_diff Standard_minus |
27468 | 512 |
Standard_mult Standard_divide Standard_inverse |
60352
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
60041
diff
changeset
|
513 |
Standard_abs Standard_mod |
27468 | 514 |
|
64435 | 515 |
|
69597 | 516 |
text \<open>\<^term>\<open>star_of\<close> preserves class operations.\<close> |
27468 | 517 |
|
518 |
lemma star_of_add: "star_of (x + y) = star_of x + star_of y" |
|
64435 | 519 |
by transfer (rule refl) |
27468 | 520 |
|
521 |
lemma star_of_diff: "star_of (x - y) = star_of x - star_of y" |
|
64435 | 522 |
by transfer (rule refl) |
27468 | 523 |
|
524 |
lemma star_of_minus: "star_of (-x) = - star_of x" |
|
64435 | 525 |
by transfer (rule refl) |
27468 | 526 |
|
527 |
lemma star_of_mult: "star_of (x * y) = star_of x * star_of y" |
|
64435 | 528 |
by transfer (rule refl) |
27468 | 529 |
|
530 |
lemma star_of_divide: "star_of (x / y) = star_of x / star_of y" |
|
64435 | 531 |
by transfer (rule refl) |
27468 | 532 |
|
533 |
lemma star_of_inverse: "star_of (inverse x) = inverse (star_of x)" |
|
64435 | 534 |
by transfer (rule refl) |
27468 | 535 |
|
536 |
lemma star_of_mod: "star_of (x mod y) = star_of x mod star_of y" |
|
64435 | 537 |
by transfer (rule refl) |
27468 | 538 |
|
61945 | 539 |
lemma star_of_abs: "star_of \<bar>x\<bar> = \<bar>star_of x\<bar>" |
64435 | 540 |
by transfer (rule refl) |
27468 | 541 |
|
64435 | 542 |
|
69597 | 543 |
text \<open>\<^term>\<open>star_of\<close> preserves numerals.\<close> |
27468 | 544 |
|
545 |
lemma star_of_zero: "star_of 0 = 0" |
|
64435 | 546 |
by transfer (rule refl) |
27468 | 547 |
|
548 |
lemma star_of_one: "star_of 1 = 1" |
|
64435 | 549 |
by transfer (rule refl) |
27468 | 550 |
|
64435 | 551 |
|
69597 | 552 |
text \<open>\<^term>\<open>star_of\<close> preserves orderings.\<close> |
27468 | 553 |
|
554 |
lemma star_of_less: "(star_of x < star_of y) = (x < y)" |
|
555 |
by transfer (rule refl) |
|
556 |
||
557 |
lemma star_of_le: "(star_of x \<le> star_of y) = (x \<le> y)" |
|
558 |
by transfer (rule refl) |
|
559 |
||
560 |
lemma star_of_eq: "(star_of x = star_of y) = (x = y)" |
|
561 |
by transfer (rule refl) |
|
562 |
||
64435 | 563 |
|
564 |
text \<open>As above, for \<open>0\<close>.\<close> |
|
27468 | 565 |
|
566 |
lemmas star_of_0_less = star_of_less [of 0, simplified star_of_zero] |
|
567 |
lemmas star_of_0_le = star_of_le [of 0, simplified star_of_zero] |
|
568 |
lemmas star_of_0_eq = star_of_eq [of 0, simplified star_of_zero] |
|
569 |
||
570 |
lemmas star_of_less_0 = star_of_less [of _ 0, simplified star_of_zero] |
|
571 |
lemmas star_of_le_0 = star_of_le [of _ 0, simplified star_of_zero] |
|
572 |
lemmas star_of_eq_0 = star_of_eq [of _ 0, simplified star_of_zero] |
|
573 |
||
64435 | 574 |
|
575 |
text \<open>As above, for \<open>1\<close>.\<close> |
|
27468 | 576 |
|
577 |
lemmas star_of_1_less = star_of_less [of 1, simplified star_of_one] |
|
578 |
lemmas star_of_1_le = star_of_le [of 1, simplified star_of_one] |
|
579 |
lemmas star_of_1_eq = star_of_eq [of 1, simplified star_of_one] |
|
580 |
||
581 |
lemmas star_of_less_1 = star_of_less [of _ 1, simplified star_of_one] |
|
582 |
lemmas star_of_le_1 = star_of_le [of _ 1, simplified star_of_one] |
|
583 |
lemmas star_of_eq_1 = star_of_eq [of _ 1, simplified star_of_one] |
|
584 |
||
585 |
lemmas star_of_simps [simp] = |
|
586 |
star_of_add star_of_diff star_of_minus |
|
587 |
star_of_mult star_of_divide star_of_inverse |
|
60352
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
60041
diff
changeset
|
588 |
star_of_mod star_of_abs |
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
589 |
star_of_zero star_of_one |
27468 | 590 |
star_of_less star_of_le star_of_eq |
591 |
star_of_0_less star_of_0_le star_of_0_eq |
|
592 |
star_of_less_0 star_of_le_0 star_of_eq_0 |
|
593 |
star_of_1_less star_of_1_le star_of_1_eq |
|
594 |
star_of_less_1 star_of_le_1 star_of_eq_1 |
|
595 |
||
64435 | 596 |
|
61975 | 597 |
subsection \<open>Ordering and lattice classes\<close> |
27468 | 598 |
|
599 |
instance star :: (order) order |
|
70219 | 600 |
proof |
601 |
show "\<And>x y::'a star. (x < y) = (x \<le> y \<and> \<not> y \<le> x)" |
|
602 |
by transfer (rule less_le_not_le) |
|
603 |
show "\<And>x::'a star. x \<le> x" |
|
604 |
by transfer (rule order_refl) |
|
605 |
show "\<And>x y z::'a star. \<lbrakk>x \<le> y; y \<le> z\<rbrakk> \<Longrightarrow> x \<le> z" |
|
606 |
by transfer (rule order_trans) |
|
607 |
show "\<And>x y::'a star. \<lbrakk>x \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> x = y" |
|
608 |
by transfer (rule order_antisym) |
|
609 |
qed |
|
27468 | 610 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
611 |
instantiation star :: (semilattice_inf) semilattice_inf |
27468 | 612 |
begin |
64435 | 613 |
definition star_inf_def [transfer_unfold]: "inf \<equiv> *f2* inf" |
614 |
instance by (standard; transfer) auto |
|
27468 | 615 |
end |
616 |
||
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
617 |
instantiation star :: (semilattice_sup) semilattice_sup |
27468 | 618 |
begin |
64435 | 619 |
definition star_sup_def [transfer_unfold]: "sup \<equiv> *f2* sup" |
620 |
instance by (standard; transfer) auto |
|
27468 | 621 |
end |
622 |
||
623 |
instance star :: (lattice) lattice .. |
|
624 |
||
625 |
instance star :: (distrib_lattice) distrib_lattice |
|
60867 | 626 |
by (standard; transfer) (auto simp add: sup_inf_distrib1) |
27468 | 627 |
|
64435 | 628 |
lemma Standard_inf [simp]: "x \<in> Standard \<Longrightarrow> y \<in> Standard \<Longrightarrow> inf x y \<in> Standard" |
629 |
by (simp add: star_inf_def) |
|
27468 | 630 |
|
64435 | 631 |
lemma Standard_sup [simp]: "x \<in> Standard \<Longrightarrow> y \<in> Standard \<Longrightarrow> sup x y \<in> Standard" |
632 |
by (simp add: star_sup_def) |
|
27468 | 633 |
|
634 |
lemma star_of_inf [simp]: "star_of (inf x y) = inf (star_of x) (star_of y)" |
|
64435 | 635 |
by transfer (rule refl) |
27468 | 636 |
|
637 |
lemma star_of_sup [simp]: "star_of (sup x y) = sup (star_of x) (star_of y)" |
|
64435 | 638 |
by transfer (rule refl) |
27468 | 639 |
|
640 |
instance star :: (linorder) linorder |
|
64435 | 641 |
by (intro_classes, transfer, rule linorder_linear) |
27468 | 642 |
|
643 |
lemma star_max_def [transfer_unfold]: "max = *f2* max" |
|
70219 | 644 |
unfolding max_def |
645 |
by (intro ext, transfer, simp) |
|
27468 | 646 |
|
647 |
lemma star_min_def [transfer_unfold]: "min = *f2* min" |
|
70219 | 648 |
unfolding min_def |
649 |
by (intro ext, transfer, simp) |
|
27468 | 650 |
|
64435 | 651 |
lemma Standard_max [simp]: "x \<in> Standard \<Longrightarrow> y \<in> Standard \<Longrightarrow> max x y \<in> Standard" |
652 |
by (simp add: star_max_def) |
|
27468 | 653 |
|
64435 | 654 |
lemma Standard_min [simp]: "x \<in> Standard \<Longrightarrow> y \<in> Standard \<Longrightarrow> min x y \<in> Standard" |
655 |
by (simp add: star_min_def) |
|
27468 | 656 |
|
657 |
lemma star_of_max [simp]: "star_of (max x y) = max (star_of x) (star_of y)" |
|
64435 | 658 |
by transfer (rule refl) |
27468 | 659 |
|
660 |
lemma star_of_min [simp]: "star_of (min x y) = min (star_of x) (star_of y)" |
|
64435 | 661 |
by transfer (rule refl) |
27468 | 662 |
|
663 |
||
61975 | 664 |
subsection \<open>Ordered group classes\<close> |
27468 | 665 |
|
666 |
instance star :: (semigroup_add) semigroup_add |
|
64435 | 667 |
by (intro_classes, transfer, rule add.assoc) |
27468 | 668 |
|
669 |
instance star :: (ab_semigroup_add) ab_semigroup_add |
|
64435 | 670 |
by (intro_classes, transfer, rule add.commute) |
27468 | 671 |
|
672 |
instance star :: (semigroup_mult) semigroup_mult |
|
64435 | 673 |
by (intro_classes, transfer, rule mult.assoc) |
27468 | 674 |
|
675 |
instance star :: (ab_semigroup_mult) ab_semigroup_mult |
|
64435 | 676 |
by (intro_classes, transfer, rule mult.commute) |
27468 | 677 |
|
678 |
instance star :: (comm_monoid_add) comm_monoid_add |
|
64435 | 679 |
by (intro_classes, transfer, rule comm_monoid_add_class.add_0) |
27468 | 680 |
|
681 |
instance star :: (monoid_mult) monoid_mult |
|
64435 | 682 |
apply intro_classes |
683 |
apply (transfer, rule mult_1_left) |
|
684 |
apply (transfer, rule mult_1_right) |
|
685 |
done |
|
27468 | 686 |
|
60867 | 687 |
instance star :: (power) power .. |
688 |
||
27468 | 689 |
instance star :: (comm_monoid_mult) comm_monoid_mult |
64435 | 690 |
by (intro_classes, transfer, rule mult_1) |
27468 | 691 |
|
692 |
instance star :: (cancel_semigroup_add) cancel_semigroup_add |
|
64435 | 693 |
apply intro_classes |
694 |
apply (transfer, erule add_left_imp_eq) |
|
695 |
apply (transfer, erule add_right_imp_eq) |
|
696 |
done |
|
27468 | 697 |
|
698 |
instance star :: (cancel_ab_semigroup_add) cancel_ab_semigroup_add |
|
64435 | 699 |
by intro_classes (transfer, simp add: diff_diff_eq)+ |
27468 | 700 |
|
29904 | 701 |
instance star :: (cancel_comm_monoid_add) cancel_comm_monoid_add .. |
702 |
||
27468 | 703 |
instance star :: (ab_group_add) ab_group_add |
64435 | 704 |
apply intro_classes |
705 |
apply (transfer, rule left_minus) |
|
706 |
apply (transfer, rule diff_conv_add_uminus) |
|
707 |
done |
|
27468 | 708 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
709 |
instance star :: (ordered_ab_semigroup_add) ordered_ab_semigroup_add |
64435 | 710 |
by (intro_classes, transfer, rule add_left_mono) |
27468 | 711 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
712 |
instance star :: (ordered_cancel_ab_semigroup_add) ordered_cancel_ab_semigroup_add .. |
27468 | 713 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
714 |
instance star :: (ordered_ab_semigroup_add_imp_le) ordered_ab_semigroup_add_imp_le |
64435 | 715 |
by (intro_classes, transfer, rule add_le_imp_le_left) |
27468 | 716 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
717 |
instance star :: (ordered_comm_monoid_add) ordered_comm_monoid_add .. |
63456
3365c8ec67bd
sharing simp rules between ordered monoids and rings
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
62479
diff
changeset
|
718 |
instance star :: (ordered_ab_semigroup_monoid_add_imp_le) ordered_ab_semigroup_monoid_add_imp_le .. |
62376
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
61975
diff
changeset
|
719 |
instance star :: (ordered_cancel_comm_monoid_add) ordered_cancel_comm_monoid_add .. |
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
720 |
instance star :: (ordered_ab_group_add) ordered_ab_group_add .. |
27468 | 721 |
|
62376
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
61975
diff
changeset
|
722 |
instance star :: (ordered_ab_group_add_abs) ordered_ab_group_add_abs |
64435 | 723 |
by intro_classes (transfer, simp add: abs_ge_self abs_leI abs_triangle_ineq)+ |
27468 | 724 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
725 |
instance star :: (linordered_cancel_ab_semigroup_add) linordered_cancel_ab_semigroup_add .. |
27468 | 726 |
|
727 |
||
61975 | 728 |
subsection \<open>Ring and field classes\<close> |
27468 | 729 |
|
730 |
instance star :: (semiring) semiring |
|
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
731 |
by (intro_classes; transfer) (fact distrib_right distrib_left)+ |
27468 | 732 |
|
62376
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
61975
diff
changeset
|
733 |
instance star :: (semiring_0) semiring_0 |
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
734 |
by (intro_classes; transfer) simp_all |
27468 | 735 |
|
736 |
instance star :: (semiring_0_cancel) semiring_0_cancel .. |
|
737 |
||
62376
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
61975
diff
changeset
|
738 |
instance star :: (comm_semiring) comm_semiring |
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
739 |
by (intro_classes; transfer) (fact distrib_right) |
27468 | 740 |
|
741 |
instance star :: (comm_semiring_0) comm_semiring_0 .. |
|
742 |
instance star :: (comm_semiring_0_cancel) comm_semiring_0_cancel .. |
|
743 |
||
744 |
instance star :: (zero_neq_one) zero_neq_one |
|
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
745 |
by (intro_classes; transfer) (fact zero_neq_one) |
27468 | 746 |
|
747 |
instance star :: (semiring_1) semiring_1 .. |
|
748 |
instance star :: (comm_semiring_1) comm_semiring_1 .. |
|
749 |
||
59680 | 750 |
declare dvd_def [transfer_refold] |
59676 | 751 |
|
60562
24af00b010cf
Amalgamation of the class comm_semiring_1_diff_distrib into comm_semiring_1_cancel. Moving axiom le_add_diff_inverse2 from semiring_numeral_div to linordered_semidom.
paulson <lp15@cam.ac.uk>
parents:
60516
diff
changeset
|
752 |
instance star :: (comm_semiring_1_cancel) comm_semiring_1_cancel |
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
753 |
by (intro_classes; transfer) (fact right_diff_distrib') |
59676 | 754 |
|
59833
ab828c2c5d67
clarified no_zero_devisors: makes only sense in a semiring;
haftmann
parents:
59816
diff
changeset
|
755 |
instance star :: (semiring_no_zero_divisors) semiring_no_zero_divisors |
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
756 |
by (intro_classes; transfer) (fact no_zero_divisors) |
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
757 |
|
60867 | 758 |
instance star :: (semiring_1_no_zero_divisors) semiring_1_no_zero_divisors .. |
62376
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
61975
diff
changeset
|
759 |
|
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
760 |
instance star :: (semiring_no_zero_divisors_cancel) semiring_no_zero_divisors_cancel |
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
761 |
by (intro_classes; transfer) simp_all |
27468 | 762 |
|
763 |
instance star :: (semiring_1_cancel) semiring_1_cancel .. |
|
764 |
instance star :: (ring) ring .. |
|
765 |
instance star :: (comm_ring) comm_ring .. |
|
766 |
instance star :: (ring_1) ring_1 .. |
|
767 |
instance star :: (comm_ring_1) comm_ring_1 .. |
|
59833
ab828c2c5d67
clarified no_zero_devisors: makes only sense in a semiring;
haftmann
parents:
59816
diff
changeset
|
768 |
instance star :: (semidom) semidom .. |
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
769 |
|
60353
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
770 |
instance star :: (semidom_divide) semidom_divide |
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
771 |
by (intro_classes; transfer) simp_all |
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
772 |
|
27468 | 773 |
instance star :: (ring_no_zero_divisors) ring_no_zero_divisors .. |
774 |
instance star :: (ring_1_no_zero_divisors) ring_1_no_zero_divisors .. |
|
62376
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
61975
diff
changeset
|
775 |
instance star :: (idom) idom .. |
60353
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
776 |
instance star :: (idom_divide) idom_divide .. |
27468 | 777 |
|
79541
4f40225936d1
common type class for trivial properties on div/mod
haftmann
parents:
70219
diff
changeset
|
778 |
instance star :: (divide_trivial) divide_trivial |
4f40225936d1
common type class for trivial properties on div/mod
haftmann
parents:
70219
diff
changeset
|
779 |
by (intro_classes; transfer) simp_all |
4f40225936d1
common type class for trivial properties on div/mod
haftmann
parents:
70219
diff
changeset
|
780 |
|
27468 | 781 |
instance star :: (division_ring) division_ring |
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
782 |
by (intro_classes; transfer) (simp_all add: divide_inverse) |
27468 | 783 |
|
784 |
instance star :: (field) field |
|
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
785 |
by (intro_classes; transfer) (simp_all add: divide_inverse) |
27468 | 786 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
787 |
instance star :: (ordered_semiring) ordered_semiring |
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
788 |
by (intro_classes; transfer) (fact mult_left_mono mult_right_mono)+ |
27468 | 789 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
790 |
instance star :: (ordered_cancel_semiring) ordered_cancel_semiring .. |
27468 | 791 |
|
35043
07dbdf60d5ad
dropped accidental duplication of "lin" prefix from cs. 108662d50512
haftmann
parents:
35035
diff
changeset
|
792 |
instance star :: (linordered_semiring_strict) linordered_semiring_strict |
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
793 |
by (intro_classes; transfer) (fact mult_strict_left_mono mult_strict_right_mono)+ |
27468 | 794 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
795 |
instance star :: (ordered_comm_semiring) ordered_comm_semiring |
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
796 |
by (intro_classes; transfer) (fact mult_left_mono) |
27468 | 797 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
798 |
instance star :: (ordered_cancel_comm_semiring) ordered_cancel_comm_semiring .. |
27468 | 799 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
800 |
instance star :: (linordered_comm_semiring_strict) linordered_comm_semiring_strict |
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
801 |
by (intro_classes; transfer) (fact mult_strict_left_mono) |
27468 | 802 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
803 |
instance star :: (ordered_ring) ordered_ring .. |
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
804 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
805 |
instance star :: (ordered_ring_abs) ordered_ring_abs |
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
806 |
by (intro_classes; transfer) (fact abs_eq_mult) |
27468 | 807 |
|
808 |
instance star :: (abs_if) abs_if |
|
60516
0826b7025d07
generalized some theorems about integral domains and moved to HOL theories
haftmann
parents:
60429
diff
changeset
|
809 |
by (intro_classes; transfer) (fact abs_if) |
27468 | 810 |
|
35043
07dbdf60d5ad
dropped accidental duplication of "lin" prefix from cs. 108662d50512
haftmann
parents:
35035
diff
changeset
|
811 |
instance star :: (linordered_ring_strict) linordered_ring_strict .. |
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
812 |
instance star :: (ordered_comm_ring) ordered_comm_ring .. |
27468 | 813 |
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
814 |
instance star :: (linordered_semidom) linordered_semidom |
64290 | 815 |
by (intro_classes; transfer) (fact zero_less_one le_add_diff_inverse2)+ |
27468 | 816 |
|
64290 | 817 |
instance star :: (linordered_idom) linordered_idom |
818 |
by (intro_classes; transfer) (fact sgn_if) |
|
819 |
||
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
31021
diff
changeset
|
820 |
instance star :: (linordered_field) linordered_field .. |
27468 | 821 |
|
66806
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
822 |
instance star :: (algebraic_semidom) algebraic_semidom .. |
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
823 |
|
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
824 |
instantiation star :: (normalization_semidom) normalization_semidom |
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
825 |
begin |
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
826 |
|
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
827 |
definition unit_factor_star :: "'a star \<Rightarrow> 'a star" |
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
828 |
where [transfer_unfold]: "unit_factor_star = *f* unit_factor" |
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
829 |
|
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
830 |
definition normalize_star :: "'a star \<Rightarrow> 'a star" |
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
831 |
where [transfer_unfold]: "normalize_star = *f* normalize" |
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
832 |
|
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
833 |
instance |
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
834 |
by standard (transfer; simp add: is_unit_unit_factor unit_factor_mult)+ |
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
835 |
|
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
836 |
end |
a4e82b58d833
abolished (semi)ring_div in favour of euclidean_(semi)ring_cancel
haftmann
parents:
64600
diff
changeset
|
837 |
|
66815 | 838 |
instance star :: (semidom_modulo) semidom_modulo |
839 |
by standard (transfer; simp) |
|
840 |
||
841 |
||
64435 | 842 |
|
61975 | 843 |
subsection \<open>Power\<close> |
30968
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
844 |
|
67399 | 845 |
lemma star_power_def [transfer_unfold]: "(^) \<equiv> \<lambda>x n. ( *f* (\<lambda>x. x ^ n)) x" |
30968
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
846 |
proof (rule eq_reflection, rule ext, rule ext) |
64435 | 847 |
show "x ^ n = ( *f* (\<lambda>x. x ^ n)) x" for n :: nat and x :: "'a star" |
848 |
proof (induct n arbitrary: x) |
|
30968
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
849 |
case 0 |
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
850 |
have "\<And>x::'a star. ( *f* (\<lambda>x. 1)) x = 1" |
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
851 |
by transfer simp |
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
852 |
then show ?case by simp |
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
853 |
next |
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
854 |
case (Suc n) |
61076 | 855 |
have "\<And>x::'a star. x * ( *f* (\<lambda>x::'a. x ^ n)) x = ( *f* (\<lambda>x::'a. x * x ^ n)) x" |
30968
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
856 |
by transfer simp |
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
857 |
with Suc show ?case by simp |
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
858 |
qed |
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
859 |
qed |
27468 | 860 |
|
30968
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
861 |
lemma Standard_power [simp]: "x \<in> Standard \<Longrightarrow> x ^ n \<in> Standard" |
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
862 |
by (simp add: star_power_def) |
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
863 |
|
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
864 |
lemma star_of_power [simp]: "star_of (x ^ n) = star_of x ^ n" |
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
865 |
by transfer (rule refl) |
10fef94f40fc
adaptions due to rearrangment of power operation
haftmann
parents:
30729
diff
changeset
|
866 |
|
27468 | 867 |
|
61975 | 868 |
subsection \<open>Number classes\<close> |
27468 | 869 |
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
870 |
instance star :: (numeral) numeral .. |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
871 |
|
64435 | 872 |
lemma star_numeral_def [transfer_unfold]: "numeral k = star_of (numeral k)" |
873 |
by (induct k) (simp_all only: numeral.simps star_of_one star_of_add) |
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
874 |
|
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
875 |
lemma Standard_numeral [simp]: "numeral k \<in> Standard" |
64435 | 876 |
by (simp add: star_numeral_def) |
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
877 |
|
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
878 |
lemma star_of_numeral [simp]: "star_of (numeral k) = numeral k" |
64435 | 879 |
by transfer (rule refl) |
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
880 |
|
27468 | 881 |
lemma star_of_nat_def [transfer_unfold]: "of_nat n = star_of (of_nat n)" |
64435 | 882 |
by (induct n) simp_all |
27468 | 883 |
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
884 |
lemmas star_of_compare_numeral [simp] = |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
885 |
star_of_less [of "numeral k", simplified star_of_numeral] |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
886 |
star_of_le [of "numeral k", simplified star_of_numeral] |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
887 |
star_of_eq [of "numeral k", simplified star_of_numeral] |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
888 |
star_of_less [of _ "numeral k", simplified star_of_numeral] |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
889 |
star_of_le [of _ "numeral k", simplified star_of_numeral] |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
890 |
star_of_eq [of _ "numeral k", simplified star_of_numeral] |
54489
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
891 |
star_of_less [of "- numeral k", simplified star_of_numeral] |
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
892 |
star_of_le [of "- numeral k", simplified star_of_numeral] |
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
893 |
star_of_eq [of "- numeral k", simplified star_of_numeral] |
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
894 |
star_of_less [of _ "- numeral k", simplified star_of_numeral] |
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
895 |
star_of_le [of _ "- numeral k", simplified star_of_numeral] |
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
896 |
star_of_eq [of _ "- numeral k", simplified star_of_numeral] for k |
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46008
diff
changeset
|
897 |
|
27468 | 898 |
lemma Standard_of_nat [simp]: "of_nat n \<in> Standard" |
64435 | 899 |
by (simp add: star_of_nat_def) |
27468 | 900 |
|
901 |
lemma star_of_of_nat [simp]: "star_of (of_nat n) = of_nat n" |
|
64435 | 902 |
by transfer (rule refl) |
27468 | 903 |
|
904 |
lemma star_of_int_def [transfer_unfold]: "of_int z = star_of (of_int z)" |
|
64435 | 905 |
by (rule int_diff_cases [of z]) simp |
27468 | 906 |
|
907 |
lemma Standard_of_int [simp]: "of_int z \<in> Standard" |
|
64435 | 908 |
by (simp add: star_of_int_def) |
27468 | 909 |
|
910 |
lemma star_of_of_int [simp]: "star_of (of_int z) = of_int z" |
|
64435 | 911 |
by transfer (rule refl) |
27468 | 912 |
|
62378
85ed00c1fe7c
generalize more theorems to support enat and ennreal
hoelzl
parents:
62376
diff
changeset
|
913 |
instance star :: (semiring_char_0) semiring_char_0 |
85ed00c1fe7c
generalize more theorems to support enat and ennreal
hoelzl
parents:
62376
diff
changeset
|
914 |
proof |
64435 | 915 |
have "inj (star_of :: 'a \<Rightarrow> 'a star)" |
916 |
by (rule injI) simp |
|
917 |
then have "inj (star_of \<circ> of_nat :: nat \<Rightarrow> 'a star)" |
|
69700
7a92cbec7030
new material about summations and powers, along with some tweaks
paulson <lp15@cam.ac.uk>
parents:
69605
diff
changeset
|
918 |
using inj_of_nat by (rule inj_compose) |
64435 | 919 |
then show "inj (of_nat :: nat \<Rightarrow> 'a star)" |
920 |
by (simp add: comp_def) |
|
38621
d6cb7e625d75
more concise characterization of of_nat operation and class semiring_char_0
haftmann
parents:
37765
diff
changeset
|
921 |
qed |
27468 | 922 |
|
923 |
instance star :: (ring_char_0) ring_char_0 .. |
|
924 |
||
925 |
||
61975 | 926 |
subsection \<open>Finite class\<close> |
27468 | 927 |
|
928 |
lemma starset_finite: "finite A \<Longrightarrow> *s* A = star_of ` A" |
|
64435 | 929 |
by (erule finite_induct) simp_all |
27468 | 930 |
|
931 |
instance star :: (finite) finite |
|
70219 | 932 |
proof intro_classes |
933 |
show "finite (UNIV::'a star set)" |
|
934 |
by (metis starset_UNIV finite finite_imageI starset_finite) |
|
935 |
qed |
|
27468 | 936 |
|
937 |
end |