src/HOL/Hyperreal/StarClasses.thy
author haftmann
Tue Nov 06 08:47:30 2007 +0100 (2007-11-06)
changeset 25304 7491c00f0915
parent 25230 022029099a83
child 25571 c9e39eafc7a0
permissions -rw-r--r--
removed subclass edge ordered_ring < lordered_ring
huffman@17296
     1
(*  Title       : HOL/Hyperreal/StarClasses.thy
huffman@17296
     2
    ID          : $Id$
huffman@17296
     3
    Author      : Brian Huffman
huffman@17296
     4
*)
huffman@17296
     5
huffman@17296
     6
header {* Class Instances *}
huffman@17296
     7
huffman@17296
     8
theory StarClasses
huffman@17429
     9
imports StarDef
huffman@17296
    10
begin
huffman@17296
    11
huffman@17332
    12
subsection {* Syntactic classes *}
huffman@17332
    13
haftmann@22316
    14
instance star :: (zero) zero
haftmann@22316
    15
  star_zero_def:    "0 \<equiv> star_of 0" ..
haftmann@22316
    16
haftmann@22316
    17
instance star :: (one) one
haftmann@22316
    18
  star_one_def:     "1 \<equiv> star_of 1" ..
haftmann@22316
    19
haftmann@22316
    20
instance star :: (plus) plus
haftmann@22316
    21
  star_add_def:     "(op +) \<equiv> *f2* (op +)" ..
haftmann@22316
    22
haftmann@22316
    23
instance star :: (times) times
haftmann@22316
    24
  star_mult_def:    "(op *) \<equiv> *f2* (op *)" ..
huffman@17332
    25
haftmann@22316
    26
instance star :: (minus) minus
huffman@17429
    27
  star_minus_def:   "uminus \<equiv> *f* uminus"
haftmann@23879
    28
  star_diff_def:    "(op -) \<equiv> *f2* (op -)" ..
haftmann@23879
    29
haftmann@23879
    30
instance star :: (abs) abs
haftmann@22316
    31
  star_abs_def:     "abs \<equiv> *f* abs" ..
haftmann@22316
    32
nipkow@24506
    33
instance star :: (sgn) sgn
nipkow@24506
    34
  star_sgn_def:     "sgn \<equiv> *f* sgn" ..
nipkow@24506
    35
haftmann@22316
    36
instance star :: (inverse) inverse
huffman@17429
    37
  star_divide_def:  "(op /) \<equiv> *f2* (op /)"
haftmann@22316
    38
  star_inverse_def: "inverse \<equiv> *f* inverse" ..
haftmann@22316
    39
haftmann@22316
    40
instance star :: (number) number
haftmann@22316
    41
  star_number_def:  "number_of b \<equiv> star_of (number_of b)" ..
haftmann@22316
    42
haftmann@22993
    43
instance star :: (Divides.div) Divides.div
huffman@17429
    44
  star_div_def:     "(op div) \<equiv> *f2* (op div)"
haftmann@22316
    45
  star_mod_def:     "(op mod) \<equiv> *f2* (op mod)" ..
haftmann@22316
    46
haftmann@22316
    47
instance star :: (power) power
haftmann@22316
    48
  star_power_def:   "(op ^) \<equiv> \<lambda>x n. ( *f* (\<lambda>x. x ^ n)) x" ..
huffman@17332
    49
haftmann@22452
    50
instance star :: (ord) ord
haftmann@22452
    51
  star_le_def:      "(op \<le>) \<equiv> *p2* (op \<le>)"
haftmann@22452
    52
  star_less_def:    "(op <) \<equiv> *p2* (op <)" ..
haftmann@22452
    53
huffman@17332
    54
lemmas star_class_defs [transfer_unfold] =
huffman@17332
    55
  star_zero_def     star_one_def      star_number_def
huffman@17332
    56
  star_add_def      star_diff_def     star_minus_def
huffman@17332
    57
  star_mult_def     star_divide_def   star_inverse_def
nipkow@24506
    58
  star_le_def       star_less_def     star_abs_def       star_sgn_def
huffman@17332
    59
  star_div_def      star_mod_def      star_power_def
huffman@17332
    60
huffman@20719
    61
text {* Class operations preserve standard elements *}
huffman@20719
    62
huffman@20719
    63
lemma Standard_zero: "0 \<in> Standard"
huffman@20719
    64
by (simp add: star_zero_def)
huffman@20719
    65
huffman@20719
    66
lemma Standard_one: "1 \<in> Standard"
huffman@20719
    67
by (simp add: star_one_def)
huffman@20719
    68
huffman@20719
    69
lemma Standard_number_of: "number_of b \<in> Standard"
huffman@20719
    70
by (simp add: star_number_def)
huffman@20719
    71
huffman@20719
    72
lemma Standard_add: "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> x + y \<in> Standard"
huffman@20719
    73
by (simp add: star_add_def)
huffman@20719
    74
huffman@20719
    75
lemma Standard_diff: "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> x - y \<in> Standard"
huffman@20719
    76
by (simp add: star_diff_def)
huffman@20719
    77
huffman@20719
    78
lemma Standard_minus: "x \<in> Standard \<Longrightarrow> - x \<in> Standard"
huffman@20719
    79
by (simp add: star_minus_def)
huffman@20719
    80
huffman@20719
    81
lemma Standard_mult: "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> x * y \<in> Standard"
huffman@20719
    82
by (simp add: star_mult_def)
huffman@20719
    83
huffman@20719
    84
lemma Standard_divide: "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> x / y \<in> Standard"
huffman@20719
    85
by (simp add: star_divide_def)
huffman@20719
    86
huffman@20719
    87
lemma Standard_inverse: "x \<in> Standard \<Longrightarrow> inverse x \<in> Standard"
huffman@20719
    88
by (simp add: star_inverse_def)
huffman@20719
    89
huffman@20719
    90
lemma Standard_abs: "x \<in> Standard \<Longrightarrow> abs x \<in> Standard"
huffman@20719
    91
by (simp add: star_abs_def)
huffman@20719
    92
huffman@20719
    93
lemma Standard_div: "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> x div y \<in> Standard"
huffman@20719
    94
by (simp add: star_div_def)
huffman@20719
    95
huffman@20719
    96
lemma Standard_mod: "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> x mod y \<in> Standard"
huffman@20719
    97
by (simp add: star_mod_def)
huffman@20719
    98
huffman@20719
    99
lemma Standard_power: "x \<in> Standard \<Longrightarrow> x ^ n \<in> Standard"
huffman@20719
   100
by (simp add: star_power_def)
huffman@20719
   101
huffman@20719
   102
lemmas Standard_simps [simp] =
huffman@20719
   103
  Standard_zero  Standard_one  Standard_number_of
huffman@20719
   104
  Standard_add  Standard_diff  Standard_minus
huffman@20719
   105
  Standard_mult  Standard_divide  Standard_inverse
huffman@20719
   106
  Standard_abs  Standard_div  Standard_mod
huffman@20719
   107
  Standard_power
huffman@20719
   108
huffman@17332
   109
text {* @{term star_of} preserves class operations *}
huffman@17332
   110
huffman@17332
   111
lemma star_of_add: "star_of (x + y) = star_of x + star_of y"
huffman@17332
   112
by transfer (rule refl)
huffman@17332
   113
huffman@17332
   114
lemma star_of_diff: "star_of (x - y) = star_of x - star_of y"
huffman@17332
   115
by transfer (rule refl)
huffman@17332
   116
huffman@17332
   117
lemma star_of_minus: "star_of (-x) = - star_of x"
huffman@17332
   118
by transfer (rule refl)
huffman@17332
   119
huffman@17332
   120
lemma star_of_mult: "star_of (x * y) = star_of x * star_of y"
huffman@17332
   121
by transfer (rule refl)
huffman@17332
   122
huffman@17332
   123
lemma star_of_divide: "star_of (x / y) = star_of x / star_of y"
huffman@17332
   124
by transfer (rule refl)
huffman@17332
   125
huffman@17332
   126
lemma star_of_inverse: "star_of (inverse x) = inverse (star_of x)"
huffman@17332
   127
by transfer (rule refl)
huffman@17332
   128
huffman@17332
   129
lemma star_of_div: "star_of (x div y) = star_of x div star_of y"
huffman@17332
   130
by transfer (rule refl)
huffman@17332
   131
huffman@17332
   132
lemma star_of_mod: "star_of (x mod y) = star_of x mod star_of y"
huffman@17332
   133
by transfer (rule refl)
huffman@17332
   134
huffman@17332
   135
lemma star_of_power: "star_of (x ^ n) = star_of x ^ n"
huffman@17332
   136
by transfer (rule refl)
huffman@17332
   137
huffman@17332
   138
lemma star_of_abs: "star_of (abs x) = abs (star_of x)"
huffman@17332
   139
by transfer (rule refl)
huffman@17332
   140
huffman@17332
   141
text {* @{term star_of} preserves numerals *}
huffman@17332
   142
huffman@17332
   143
lemma star_of_zero: "star_of 0 = 0"
huffman@17332
   144
by transfer (rule refl)
huffman@17332
   145
huffman@17332
   146
lemma star_of_one: "star_of 1 = 1"
huffman@17332
   147
by transfer (rule refl)
huffman@17332
   148
huffman@17332
   149
lemma star_of_number_of: "star_of (number_of x) = number_of x"
huffman@17332
   150
by transfer (rule refl)
huffman@17332
   151
huffman@17332
   152
text {* @{term star_of} preserves orderings *}
huffman@17332
   153
huffman@17332
   154
lemma star_of_less: "(star_of x < star_of y) = (x < y)"
huffman@17332
   155
by transfer (rule refl)
huffman@17332
   156
huffman@17332
   157
lemma star_of_le: "(star_of x \<le> star_of y) = (x \<le> y)"
huffman@17332
   158
by transfer (rule refl)
huffman@17332
   159
huffman@17332
   160
lemma star_of_eq: "(star_of x = star_of y) = (x = y)"
huffman@17332
   161
by transfer (rule refl)
huffman@17332
   162
huffman@17332
   163
text{*As above, for 0*}
huffman@17332
   164
huffman@17332
   165
lemmas star_of_0_less = star_of_less [of 0, simplified star_of_zero]
huffman@17332
   166
lemmas star_of_0_le   = star_of_le   [of 0, simplified star_of_zero]
huffman@17332
   167
lemmas star_of_0_eq   = star_of_eq   [of 0, simplified star_of_zero]
huffman@17332
   168
huffman@17332
   169
lemmas star_of_less_0 = star_of_less [of _ 0, simplified star_of_zero]
huffman@17332
   170
lemmas star_of_le_0   = star_of_le   [of _ 0, simplified star_of_zero]
huffman@17332
   171
lemmas star_of_eq_0   = star_of_eq   [of _ 0, simplified star_of_zero]
huffman@17332
   172
huffman@17332
   173
text{*As above, for 1*}
huffman@17332
   174
huffman@17332
   175
lemmas star_of_1_less = star_of_less [of 1, simplified star_of_one]
huffman@17332
   176
lemmas star_of_1_le   = star_of_le   [of 1, simplified star_of_one]
huffman@17332
   177
lemmas star_of_1_eq   = star_of_eq   [of 1, simplified star_of_one]
huffman@17332
   178
huffman@17332
   179
lemmas star_of_less_1 = star_of_less [of _ 1, simplified star_of_one]
huffman@17332
   180
lemmas star_of_le_1   = star_of_le   [of _ 1, simplified star_of_one]
huffman@17332
   181
lemmas star_of_eq_1   = star_of_eq   [of _ 1, simplified star_of_one]
huffman@17332
   182
huffman@17332
   183
text{*As above, for numerals*}
huffman@17332
   184
huffman@17332
   185
lemmas star_of_number_less =
huffman@17332
   186
  star_of_less [of "number_of w", standard, simplified star_of_number_of]
huffman@17332
   187
lemmas star_of_number_le   =
huffman@17332
   188
  star_of_le   [of "number_of w", standard, simplified star_of_number_of]
huffman@17332
   189
lemmas star_of_number_eq   =
huffman@17332
   190
  star_of_eq   [of "number_of w", standard, simplified star_of_number_of]
huffman@17332
   191
huffman@17332
   192
lemmas star_of_less_number =
huffman@17332
   193
  star_of_less [of _ "number_of w", standard, simplified star_of_number_of]
huffman@17332
   194
lemmas star_of_le_number   =
huffman@17332
   195
  star_of_le   [of _ "number_of w", standard, simplified star_of_number_of]
huffman@17332
   196
lemmas star_of_eq_number   =
huffman@17332
   197
  star_of_eq   [of _ "number_of w", standard, simplified star_of_number_of]
huffman@17332
   198
huffman@17332
   199
lemmas star_of_simps [simp] =
huffman@17332
   200
  star_of_add     star_of_diff    star_of_minus
huffman@17332
   201
  star_of_mult    star_of_divide  star_of_inverse
huffman@17332
   202
  star_of_div     star_of_mod
huffman@17332
   203
  star_of_power   star_of_abs
huffman@17332
   204
  star_of_zero    star_of_one     star_of_number_of
huffman@17332
   205
  star_of_less    star_of_le      star_of_eq
huffman@17332
   206
  star_of_0_less  star_of_0_le    star_of_0_eq
huffman@17332
   207
  star_of_less_0  star_of_le_0    star_of_eq_0
huffman@17332
   208
  star_of_1_less  star_of_1_le    star_of_1_eq
huffman@17332
   209
  star_of_less_1  star_of_le_1    star_of_eq_1
huffman@17332
   210
  star_of_number_less star_of_number_le star_of_number_eq
huffman@17332
   211
  star_of_less_number star_of_le_number star_of_eq_number
huffman@17332
   212
haftmann@22452
   213
subsection {* Ordering and lattice classes *}
huffman@17296
   214
huffman@17296
   215
instance star :: (order) order
huffman@17296
   216
apply (intro_classes)
haftmann@22316
   217
apply (transfer, rule order_less_le)
huffman@17296
   218
apply (transfer, rule order_refl)
huffman@17296
   219
apply (transfer, erule (1) order_trans)
huffman@17296
   220
apply (transfer, erule (1) order_antisym)
huffman@17296
   221
done
huffman@17296
   222
haftmann@22452
   223
instance star :: (lower_semilattice) lower_semilattice
haftmann@22452
   224
  star_inf_def [transfer_unfold]: "inf \<equiv> *f2* inf"
haftmann@22452
   225
  by default (transfer star_inf_def, auto)+
haftmann@22452
   226
haftmann@22452
   227
instance star :: (upper_semilattice) upper_semilattice
haftmann@22452
   228
  star_sup_def [transfer_unfold]: "sup \<equiv> *f2* sup"
haftmann@22452
   229
  by default (transfer star_sup_def, auto)+
haftmann@22452
   230
haftmann@22452
   231
instance star :: (lattice) lattice ..
haftmann@22452
   232
haftmann@22452
   233
instance star :: (distrib_lattice) distrib_lattice
haftmann@22452
   234
  by default (transfer, auto simp add: sup_inf_distrib1)
haftmann@22452
   235
haftmann@22452
   236
lemma Standard_inf [simp]:
haftmann@22452
   237
  "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> inf x y \<in> Standard"
haftmann@22452
   238
by (simp add: star_inf_def)
haftmann@22452
   239
haftmann@22452
   240
lemma Standard_sup [simp]:
haftmann@22452
   241
  "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> sup x y \<in> Standard"
haftmann@22452
   242
by (simp add: star_sup_def)
haftmann@22452
   243
haftmann@22452
   244
lemma star_of_inf [simp]: "star_of (inf x y) = inf (star_of x) (star_of y)"
haftmann@22452
   245
by transfer (rule refl)
haftmann@22452
   246
haftmann@22452
   247
lemma star_of_sup [simp]: "star_of (sup x y) = sup (star_of x) (star_of y)"
haftmann@22452
   248
by transfer (rule refl)
haftmann@22452
   249
huffman@17296
   250
instance star :: (linorder) linorder
huffman@17296
   251
by (intro_classes, transfer, rule linorder_linear)
huffman@17296
   252
huffman@20720
   253
lemma star_max_def [transfer_unfold]: "max = *f2* max"
huffman@20720
   254
apply (rule ext, rule ext)
huffman@20720
   255
apply (unfold max_def, transfer, fold max_def)
huffman@20720
   256
apply (rule refl)
huffman@20720
   257
done
huffman@20720
   258
huffman@20720
   259
lemma star_min_def [transfer_unfold]: "min = *f2* min"
huffman@20720
   260
apply (rule ext, rule ext)
huffman@20720
   261
apply (unfold min_def, transfer, fold min_def)
huffman@20720
   262
apply (rule refl)
huffman@20720
   263
done
huffman@20720
   264
huffman@20720
   265
lemma Standard_max [simp]:
huffman@20720
   266
  "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> max x y \<in> Standard"
huffman@20720
   267
by (simp add: star_max_def)
huffman@20720
   268
huffman@20720
   269
lemma Standard_min [simp]:
huffman@20720
   270
  "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> min x y \<in> Standard"
huffman@20720
   271
by (simp add: star_min_def)
huffman@20720
   272
huffman@20720
   273
lemma star_of_max [simp]: "star_of (max x y) = max (star_of x) (star_of y)"
huffman@20720
   274
by transfer (rule refl)
huffman@20720
   275
huffman@20720
   276
lemma star_of_min [simp]: "star_of (min x y) = min (star_of x) (star_of y)"
huffman@20720
   277
by transfer (rule refl)
huffman@20720
   278
huffman@17296
   279
huffman@17332
   280
subsection {* Ordered group classes *}
huffman@17296
   281
huffman@17296
   282
instance star :: (semigroup_add) semigroup_add
huffman@17296
   283
by (intro_classes, transfer, rule add_assoc)
huffman@17296
   284
huffman@17296
   285
instance star :: (ab_semigroup_add) ab_semigroup_add
huffman@17296
   286
by (intro_classes, transfer, rule add_commute)
huffman@17296
   287
huffman@17296
   288
instance star :: (semigroup_mult) semigroup_mult
huffman@17296
   289
by (intro_classes, transfer, rule mult_assoc)
huffman@17296
   290
huffman@17296
   291
instance star :: (ab_semigroup_mult) ab_semigroup_mult
huffman@17296
   292
by (intro_classes, transfer, rule mult_commute)
huffman@17296
   293
huffman@17296
   294
instance star :: (comm_monoid_add) comm_monoid_add
haftmann@22384
   295
by (intro_classes, transfer, rule comm_monoid_add_class.zero_plus.add_0)
huffman@17296
   296
huffman@17296
   297
instance star :: (monoid_mult) monoid_mult
huffman@17296
   298
apply (intro_classes)
huffman@17296
   299
apply (transfer, rule mult_1_left)
huffman@17296
   300
apply (transfer, rule mult_1_right)
huffman@17296
   301
done
huffman@17296
   302
huffman@17296
   303
instance star :: (comm_monoid_mult) comm_monoid_mult
huffman@17296
   304
by (intro_classes, transfer, rule mult_1)
huffman@17296
   305
huffman@17296
   306
instance star :: (cancel_semigroup_add) cancel_semigroup_add
huffman@17296
   307
apply (intro_classes)
huffman@17296
   308
apply (transfer, erule add_left_imp_eq)
huffman@17296
   309
apply (transfer, erule add_right_imp_eq)
huffman@17296
   310
done
huffman@17296
   311
huffman@17296
   312
instance star :: (cancel_ab_semigroup_add) cancel_ab_semigroup_add
huffman@17296
   313
by (intro_classes, transfer, rule add_imp_eq)
huffman@17296
   314
huffman@17296
   315
instance star :: (ab_group_add) ab_group_add
huffman@17296
   316
apply (intro_classes)
huffman@17296
   317
apply (transfer, rule left_minus)
huffman@17296
   318
apply (transfer, rule diff_minus)
huffman@17296
   319
done
huffman@17296
   320
huffman@17296
   321
instance star :: (pordered_ab_semigroup_add) pordered_ab_semigroup_add
huffman@17296
   322
by (intro_classes, transfer, rule add_left_mono)
huffman@17296
   323
huffman@17296
   324
instance star :: (pordered_cancel_ab_semigroup_add) pordered_cancel_ab_semigroup_add ..
huffman@17296
   325
huffman@17296
   326
instance star :: (pordered_ab_semigroup_add_imp_le) pordered_ab_semigroup_add_imp_le
huffman@17296
   327
by (intro_classes, transfer, rule add_le_imp_le_left)
huffman@17296
   328
haftmann@25304
   329
instance star :: (pordered_comm_monoid_add) pordered_comm_monoid_add ..
huffman@17296
   330
instance star :: (pordered_ab_group_add) pordered_ab_group_add ..
haftmann@25304
   331
haftmann@25304
   332
instance star :: (pordered_ab_group_add_abs) pordered_ab_group_add_abs 
haftmann@25304
   333
  by intro_classes (transfer,
haftmann@25304
   334
    simp add: abs_ge_self abs_leI abs_triangle_ineq)+
haftmann@25304
   335
huffman@17296
   336
instance star :: (ordered_cancel_ab_semigroup_add) ordered_cancel_ab_semigroup_add ..
haftmann@25304
   337
instance star :: (lordered_ab_group_add_meet) lordered_ab_group_add_meet ..
haftmann@25304
   338
instance star :: (lordered_ab_group_add_meet) lordered_ab_group_add_meet ..
haftmann@25304
   339
instance star :: (lordered_ab_group_add) lordered_ab_group_add ..
huffman@17296
   340
haftmann@25304
   341
instance star :: (lordered_ab_group_add_abs) lordered_ab_group_add_abs
huffman@17332
   342
by (intro_classes, transfer, rule abs_lattice)
huffman@17296
   343
huffman@17429
   344
subsection {* Ring and field classes *}
huffman@17296
   345
huffman@17296
   346
instance star :: (semiring) semiring
huffman@17296
   347
apply (intro_classes)
huffman@17296
   348
apply (transfer, rule left_distrib)
huffman@17296
   349
apply (transfer, rule right_distrib)
huffman@17296
   350
done
huffman@17296
   351
krauss@21199
   352
instance star :: (semiring_0) semiring_0 
krauss@21199
   353
by intro_classes (transfer, simp)+
krauss@21199
   354
huffman@17296
   355
instance star :: (semiring_0_cancel) semiring_0_cancel ..
huffman@17296
   356
paulson@24742
   357
instance star :: (comm_semiring) comm_semiring 
paulson@24742
   358
by (intro_classes, transfer, rule left_distrib)
huffman@17296
   359
huffman@17296
   360
instance star :: (comm_semiring_0) comm_semiring_0 ..
huffman@17296
   361
instance star :: (comm_semiring_0_cancel) comm_semiring_0_cancel ..
huffman@17296
   362
wenzelm@20633
   363
instance star :: (zero_neq_one) zero_neq_one
huffman@17296
   364
by (intro_classes, transfer, rule zero_neq_one)
huffman@17296
   365
huffman@17296
   366
instance star :: (semiring_1) semiring_1 ..
huffman@17296
   367
instance star :: (comm_semiring_1) comm_semiring_1 ..
huffman@17296
   368
wenzelm@20633
   369
instance star :: (no_zero_divisors) no_zero_divisors
huffman@17296
   370
by (intro_classes, transfer, rule no_zero_divisors)
huffman@17296
   371
huffman@17296
   372
instance star :: (semiring_1_cancel) semiring_1_cancel ..
huffman@17296
   373
instance star :: (comm_semiring_1_cancel) comm_semiring_1_cancel ..
huffman@17296
   374
instance star :: (ring) ring ..
huffman@17296
   375
instance star :: (comm_ring) comm_ring ..
huffman@17296
   376
instance star :: (ring_1) ring_1 ..
huffman@17296
   377
instance star :: (comm_ring_1) comm_ring_1 ..
huffman@22992
   378
instance star :: (ring_no_zero_divisors) ring_no_zero_divisors ..
wenzelm@23551
   379
instance star :: (ring_1_no_zero_divisors) ring_1_no_zero_divisors ..
huffman@17296
   380
instance star :: (idom) idom .. 
huffman@17296
   381
huffman@20540
   382
instance star :: (division_ring) division_ring
huffman@20540
   383
apply (intro_classes)
huffman@20540
   384
apply (transfer, erule left_inverse)
huffman@20540
   385
apply (transfer, erule right_inverse)
huffman@20540
   386
done
huffman@20540
   387
huffman@17296
   388
instance star :: (field) field
huffman@17296
   389
apply (intro_classes)
huffman@17296
   390
apply (transfer, erule left_inverse)
huffman@17296
   391
apply (transfer, rule divide_inverse)
huffman@17296
   392
done
huffman@17296
   393
huffman@17296
   394
instance star :: (division_by_zero) division_by_zero
huffman@17296
   395
by (intro_classes, transfer, rule inverse_zero)
huffman@17296
   396
huffman@17296
   397
instance star :: (pordered_semiring) pordered_semiring
huffman@17296
   398
apply (intro_classes)
huffman@17296
   399
apply (transfer, erule (1) mult_left_mono)
huffman@17296
   400
apply (transfer, erule (1) mult_right_mono)
huffman@17296
   401
done
huffman@17296
   402
huffman@17296
   403
instance star :: (pordered_cancel_semiring) pordered_cancel_semiring ..
huffman@17296
   404
huffman@17296
   405
instance star :: (ordered_semiring_strict) ordered_semiring_strict
huffman@17296
   406
apply (intro_classes)
huffman@17296
   407
apply (transfer, erule (1) mult_strict_left_mono)
huffman@17296
   408
apply (transfer, erule (1) mult_strict_right_mono)
huffman@17296
   409
done
huffman@17296
   410
huffman@17296
   411
instance star :: (pordered_comm_semiring) pordered_comm_semiring
haftmann@25230
   412
by (intro_classes, transfer, rule mult_mono1_class.times_zero_less_eq_less.mult_mono1)
huffman@17296
   413
huffman@17296
   414
instance star :: (pordered_cancel_comm_semiring) pordered_cancel_comm_semiring ..
huffman@17296
   415
huffman@17296
   416
instance star :: (ordered_comm_semiring_strict) ordered_comm_semiring_strict
haftmann@25208
   417
by (intro_classes, transfer, rule ordered_comm_semiring_strict_class.plus_times_zero_less_eq_less.mult_strict_mono)
huffman@17296
   418
huffman@17296
   419
instance star :: (pordered_ring) pordered_ring ..
haftmann@25304
   420
instance star :: (pordered_ring_abs) pordered_ring_abs
haftmann@25304
   421
  by intro_classes  (transfer, rule abs_eq_mult)
huffman@17296
   422
instance star :: (lordered_ring) lordered_ring ..
huffman@17296
   423
wenzelm@20633
   424
instance star :: (abs_if) abs_if
huffman@17296
   425
by (intro_classes, transfer, rule abs_if)
huffman@17296
   426
nipkow@24506
   427
instance star :: (sgn_if) sgn_if
nipkow@24506
   428
by (intro_classes, transfer, rule sgn_if)
nipkow@24506
   429
huffman@17296
   430
instance star :: (ordered_ring_strict) ordered_ring_strict ..
huffman@17296
   431
instance star :: (pordered_comm_ring) pordered_comm_ring ..
huffman@17296
   432
huffman@17296
   433
instance star :: (ordered_semidom) ordered_semidom
huffman@17296
   434
by (intro_classes, transfer, rule zero_less_one)
huffman@17296
   435
huffman@17296
   436
instance star :: (ordered_idom) ordered_idom ..
huffman@17296
   437
instance star :: (ordered_field) ordered_field ..
huffman@17296
   438
huffman@17332
   439
subsection {* Power classes *}
huffman@17296
   440
huffman@17296
   441
text {*
huffman@17296
   442
  Proving the class axiom @{thm [source] power_Suc} for type
huffman@17296
   443
  @{typ "'a star"} is a little tricky, because it quantifies
huffman@17296
   444
  over values of type @{typ nat}. The transfer principle does
huffman@17296
   445
  not handle quantification over non-star types in general,
huffman@17296
   446
  but we can work around this by fixing an arbitrary @{typ nat}
huffman@17296
   447
  value, and then applying the transfer principle.
huffman@17296
   448
*}
huffman@17296
   449
huffman@17296
   450
instance star :: (recpower) recpower
huffman@17296
   451
proof
huffman@17296
   452
  show "\<And>a::'a star. a ^ 0 = 1"
huffman@17296
   453
    by transfer (rule power_0)
huffman@17296
   454
next
huffman@17296
   455
  fix n show "\<And>a::'a star. a ^ Suc n = a * a ^ n"
huffman@17296
   456
    by transfer (rule power_Suc)
huffman@17296
   457
qed
huffman@17296
   458
huffman@17332
   459
subsection {* Number classes *}
huffman@17296
   460
huffman@20720
   461
lemma star_of_nat_def [transfer_unfold]: "of_nat n = star_of (of_nat n)"
haftmann@25230
   462
by (induct n, simp_all)
huffman@20720
   463
huffman@20720
   464
lemma Standard_of_nat [simp]: "of_nat n \<in> Standard"
huffman@20720
   465
by (simp add: star_of_nat_def)
huffman@17296
   466
huffman@17332
   467
lemma star_of_of_nat [simp]: "star_of (of_nat n) = of_nat n"
huffman@17332
   468
by transfer (rule refl)
huffman@17332
   469
huffman@20720
   470
lemma star_of_int_def [transfer_unfold]: "of_int z = star_of (of_int z)"
huffman@20720
   471
by (rule_tac z=z in int_diff_cases, simp)
huffman@20720
   472
huffman@20720
   473
lemma Standard_of_int [simp]: "of_int z \<in> Standard"
huffman@20720
   474
by (simp add: star_of_int_def)
huffman@17332
   475
huffman@17332
   476
lemma star_of_of_int [simp]: "star_of (of_int z) = of_int z"
huffman@17332
   477
by transfer (rule refl)
huffman@17296
   478
huffman@23282
   479
instance star :: (semiring_char_0) semiring_char_0
haftmann@24195
   480
by intro_classes (simp only: star_of_nat_def star_of_eq of_nat_eq_iff)
huffman@23282
   481
huffman@23282
   482
instance star :: (ring_char_0) ring_char_0 ..
huffman@22911
   483
huffman@17296
   484
instance star :: (number_ring) number_ring
huffman@17296
   485
by (intro_classes, simp only: star_number_def star_of_int_def number_of_eq)
huffman@17296
   486
huffman@17429
   487
subsection {* Finite class *}
huffman@17429
   488
huffman@17429
   489
lemma starset_finite: "finite A \<Longrightarrow> *s* A = star_of ` A"
huffman@17429
   490
by (erule finite_induct, simp_all)
huffman@17429
   491
huffman@17429
   492
instance star :: (finite) finite
huffman@17429
   493
apply (intro_classes)
huffman@17429
   494
apply (subst starset_UNIV [symmetric])
huffman@17429
   495
apply (subst starset_finite [OF finite])
huffman@17429
   496
apply (rule finite_imageI [OF finite])
huffman@17429
   497
done
huffman@17429
   498
huffman@17296
   499
end