src/HOL/Hyperreal/StarClasses.thy
author huffman
Thu, 15 Sep 2005 23:46:22 +0200
changeset 17429 e8d6ed3aacfe
parent 17332 4910cf8c0cd2
child 20540 588ba06ba867
permissions -rw-r--r--
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
     1
(*  Title       : HOL/Hyperreal/StarClasses.thy
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
     2
    ID          : $Id$
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
     3
    Author      : Brian Huffman
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
     4
*)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
     5
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
     6
header {* Class Instances *}
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
     7
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
     8
theory StarClasses
17429
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
     9
imports StarDef
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
    10
begin
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
    11
17332
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    12
subsection {* Syntactic classes *}
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    13
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    14
instance star :: (ord) ord ..
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    15
instance star :: (zero) zero ..
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    16
instance star :: (one) one ..
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    17
instance star :: (plus) plus ..
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    18
instance star :: (times) times ..
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    19
instance star :: (minus) minus ..
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    20
instance star :: (inverse) inverse ..
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    21
instance star :: (number) number ..
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    22
instance star :: ("Divides.div") "Divides.div" ..
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    23
instance star :: (power) power ..
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    24
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    25
defs (overloaded)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    26
  star_zero_def:    "0 \<equiv> star_of 0"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    27
  star_one_def:     "1 \<equiv> star_of 1"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    28
  star_number_def:  "number_of b \<equiv> star_of (number_of b)"
17429
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
    29
  star_add_def:     "(op +) \<equiv> *f2* (op +)"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
    30
  star_diff_def:    "(op -) \<equiv> *f2* (op -)"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
    31
  star_minus_def:   "uminus \<equiv> *f* uminus"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
    32
  star_mult_def:    "(op *) \<equiv> *f2* (op *)"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
    33
  star_divide_def:  "(op /) \<equiv> *f2* (op /)"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
    34
  star_inverse_def: "inverse \<equiv> *f* inverse"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
    35
  star_le_def:      "(op \<le>) \<equiv> *p2* (op \<le>)"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
    36
  star_less_def:    "(op <) \<equiv> *p2* (op <)"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
    37
  star_abs_def:     "abs \<equiv> *f* abs"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
    38
  star_div_def:     "(op div) \<equiv> *f2* (op div)"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
    39
  star_mod_def:     "(op mod) \<equiv> *f2* (op mod)"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
    40
  star_power_def:   "(op ^) \<equiv> \<lambda>x n. ( *f* (\<lambda>x. x ^ n)) x"
17332
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    41
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    42
lemmas star_class_defs [transfer_unfold] =
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    43
  star_zero_def     star_one_def      star_number_def
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    44
  star_add_def      star_diff_def     star_minus_def
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    45
  star_mult_def     star_divide_def   star_inverse_def
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    46
  star_le_def       star_less_def     star_abs_def
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    47
  star_div_def      star_mod_def      star_power_def
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    48
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    49
text {* @{term star_of} preserves class operations *}
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    50
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    51
lemma star_of_add: "star_of (x + y) = star_of x + star_of y"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    52
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    53
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    54
lemma star_of_diff: "star_of (x - y) = star_of x - star_of y"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    55
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    56
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    57
lemma star_of_minus: "star_of (-x) = - star_of x"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    58
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    59
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    60
lemma star_of_mult: "star_of (x * y) = star_of x * star_of y"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    61
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    62
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    63
lemma star_of_divide: "star_of (x / y) = star_of x / star_of y"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    64
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    65
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    66
lemma star_of_inverse: "star_of (inverse x) = inverse (star_of x)"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    67
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    68
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    69
lemma star_of_div: "star_of (x div y) = star_of x div star_of y"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    70
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    71
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    72
lemma star_of_mod: "star_of (x mod y) = star_of x mod star_of y"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    73
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    74
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    75
lemma star_of_power: "star_of (x ^ n) = star_of x ^ n"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    76
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    77
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    78
lemma star_of_abs: "star_of (abs x) = abs (star_of x)"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    79
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    80
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    81
text {* @{term star_of} preserves numerals *}
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    82
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    83
lemma star_of_zero: "star_of 0 = 0"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    84
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    85
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    86
lemma star_of_one: "star_of 1 = 1"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    87
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    88
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    89
lemma star_of_number_of: "star_of (number_of x) = number_of x"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    90
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    91
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    92
text {* @{term star_of} preserves orderings *}
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    93
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    94
lemma star_of_less: "(star_of x < star_of y) = (x < y)"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    95
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    96
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    97
lemma star_of_le: "(star_of x \<le> star_of y) = (x \<le> y)"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    98
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
    99
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   100
lemma star_of_eq: "(star_of x = star_of y) = (x = y)"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   101
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   102
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   103
text{*As above, for 0*}
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   104
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   105
lemmas star_of_0_less = star_of_less [of 0, simplified star_of_zero]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   106
lemmas star_of_0_le   = star_of_le   [of 0, simplified star_of_zero]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   107
lemmas star_of_0_eq   = star_of_eq   [of 0, simplified star_of_zero]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   108
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   109
lemmas star_of_less_0 = star_of_less [of _ 0, simplified star_of_zero]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   110
lemmas star_of_le_0   = star_of_le   [of _ 0, simplified star_of_zero]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   111
lemmas star_of_eq_0   = star_of_eq   [of _ 0, simplified star_of_zero]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   112
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   113
text{*As above, for 1*}
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   114
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   115
lemmas star_of_1_less = star_of_less [of 1, simplified star_of_one]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   116
lemmas star_of_1_le   = star_of_le   [of 1, simplified star_of_one]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   117
lemmas star_of_1_eq   = star_of_eq   [of 1, simplified star_of_one]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   118
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   119
lemmas star_of_less_1 = star_of_less [of _ 1, simplified star_of_one]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   120
lemmas star_of_le_1   = star_of_le   [of _ 1, simplified star_of_one]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   121
lemmas star_of_eq_1   = star_of_eq   [of _ 1, simplified star_of_one]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   122
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   123
text{*As above, for numerals*}
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   124
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   125
lemmas star_of_number_less =
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   126
  star_of_less [of "number_of w", standard, simplified star_of_number_of]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   127
lemmas star_of_number_le   =
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   128
  star_of_le   [of "number_of w", standard, simplified star_of_number_of]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   129
lemmas star_of_number_eq   =
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   130
  star_of_eq   [of "number_of w", standard, simplified star_of_number_of]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   131
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   132
lemmas star_of_less_number =
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   133
  star_of_less [of _ "number_of w", standard, simplified star_of_number_of]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   134
lemmas star_of_le_number   =
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   135
  star_of_le   [of _ "number_of w", standard, simplified star_of_number_of]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   136
lemmas star_of_eq_number   =
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   137
  star_of_eq   [of _ "number_of w", standard, simplified star_of_number_of]
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   138
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   139
lemmas star_of_simps [simp] =
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   140
  star_of_add     star_of_diff    star_of_minus
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   141
  star_of_mult    star_of_divide  star_of_inverse
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   142
  star_of_div     star_of_mod
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   143
  star_of_power   star_of_abs
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   144
  star_of_zero    star_of_one     star_of_number_of
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   145
  star_of_less    star_of_le      star_of_eq
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   146
  star_of_0_less  star_of_0_le    star_of_0_eq
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   147
  star_of_less_0  star_of_le_0    star_of_eq_0
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   148
  star_of_1_less  star_of_1_le    star_of_1_eq
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   149
  star_of_less_1  star_of_le_1    star_of_eq_1
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   150
  star_of_number_less star_of_number_le star_of_number_eq
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   151
  star_of_less_number star_of_le_number star_of_eq_number
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   152
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   153
subsection {* Ordering classes *}
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   154
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   155
instance star :: (order) order
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   156
apply (intro_classes)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   157
apply (transfer, rule order_refl)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   158
apply (transfer, erule (1) order_trans)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   159
apply (transfer, erule (1) order_antisym)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   160
apply (transfer, rule order_less_le)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   161
done
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   162
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   163
instance star :: (linorder) linorder
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   164
by (intro_classes, transfer, rule linorder_linear)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   165
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   166
17332
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   167
subsection {* Lattice ordering classes *}
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   168
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   169
text {*
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   170
  Some extra trouble is necessary because the class axioms 
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   171
  for @{term meet} and @{term join} use quantification over
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   172
  function spaces.
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   173
*}
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   174
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   175
lemma ex_star_fun:
17429
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   176
  "\<exists>f::('a \<Rightarrow> 'b) star. P (\<lambda>x. f \<star> x)
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   177
   \<Longrightarrow> \<exists>f::'a star \<Rightarrow> 'b star. P f"
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   178
by (erule exE, erule exI)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   179
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   180
lemma ex_star_fun2:
17429
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   181
  "\<exists>f::('a \<Rightarrow> 'b \<Rightarrow> 'c) star. P (\<lambda>x y. f \<star> x \<star> y)
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   182
   \<Longrightarrow> \<exists>f::'a star \<Rightarrow> 'b star \<Rightarrow> 'c star. P f"
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   183
by (erule exE, erule exI)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   184
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   185
instance star :: (join_semilorder) join_semilorder
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   186
apply (intro_classes)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   187
apply (rule ex_star_fun2)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   188
apply (transfer is_join_def)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   189
apply (rule join_exists)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   190
done
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   191
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   192
instance star :: (meet_semilorder) meet_semilorder
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   193
apply (intro_classes)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   194
apply (rule ex_star_fun2)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   195
apply (transfer is_meet_def)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   196
apply (rule meet_exists)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   197
done
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   198
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   199
instance star :: (lorder) lorder ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   200
17429
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   201
lemma star_join_def [transfer_unfold]: "join \<equiv> *f2* join"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   202
 apply (rule is_join_unique [OF is_join_join, THEN eq_reflection])
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   203
 apply (transfer is_join_def, rule is_join_join)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   204
done
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   205
17429
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   206
lemma star_meet_def [transfer_unfold]: "meet \<equiv> *f2* meet"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   207
 apply (rule is_meet_unique [OF is_meet_meet, THEN eq_reflection])
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   208
 apply (transfer is_meet_def, rule is_meet_meet)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   209
done
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   210
17332
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   211
subsection {* Ordered group classes *}
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   212
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   213
instance star :: (semigroup_add) semigroup_add
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   214
by (intro_classes, transfer, rule add_assoc)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   215
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   216
instance star :: (ab_semigroup_add) ab_semigroup_add
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   217
by (intro_classes, transfer, rule add_commute)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   218
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   219
instance star :: (semigroup_mult) semigroup_mult
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   220
by (intro_classes, transfer, rule mult_assoc)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   221
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   222
instance star :: (ab_semigroup_mult) ab_semigroup_mult
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   223
by (intro_classes, transfer, rule mult_commute)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   224
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   225
instance star :: (comm_monoid_add) comm_monoid_add
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   226
by (intro_classes, transfer, rule comm_monoid_add_class.add_0)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   227
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   228
instance star :: (monoid_mult) monoid_mult
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   229
apply (intro_classes)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   230
apply (transfer, rule mult_1_left)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   231
apply (transfer, rule mult_1_right)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   232
done
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   233
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   234
instance star :: (comm_monoid_mult) comm_monoid_mult
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   235
by (intro_classes, transfer, rule mult_1)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   236
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   237
instance star :: (cancel_semigroup_add) cancel_semigroup_add
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   238
apply (intro_classes)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   239
apply (transfer, erule add_left_imp_eq)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   240
apply (transfer, erule add_right_imp_eq)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   241
done
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   242
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   243
instance star :: (cancel_ab_semigroup_add) cancel_ab_semigroup_add
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   244
by (intro_classes, transfer, rule add_imp_eq)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   245
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   246
instance star :: (ab_group_add) ab_group_add
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   247
apply (intro_classes)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   248
apply (transfer, rule left_minus)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   249
apply (transfer, rule diff_minus)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   250
done
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   251
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   252
instance star :: (pordered_ab_semigroup_add) pordered_ab_semigroup_add
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   253
by (intro_classes, transfer, rule add_left_mono)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   254
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   255
instance star :: (pordered_cancel_ab_semigroup_add) pordered_cancel_ab_semigroup_add ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   256
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   257
instance star :: (pordered_ab_semigroup_add_imp_le) pordered_ab_semigroup_add_imp_le
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   258
by (intro_classes, transfer, rule add_le_imp_le_left)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   259
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   260
instance star :: (pordered_ab_group_add) pordered_ab_group_add ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   261
instance star :: (ordered_cancel_ab_semigroup_add) ordered_cancel_ab_semigroup_add ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   262
instance star :: (lordered_ab_group_meet) lordered_ab_group_meet ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   263
instance star :: (lordered_ab_group_meet) lordered_ab_group_meet ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   264
instance star :: (lordered_ab_group) lordered_ab_group ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   265
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   266
instance star :: (lordered_ab_group_abs) lordered_ab_group_abs
17332
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   267
by (intro_classes, transfer, rule abs_lattice)
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   268
17429
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   269
subsection {* Ring and field classes *}
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   270
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   271
instance star :: (semiring) semiring
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   272
apply (intro_classes)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   273
apply (transfer, rule left_distrib)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   274
apply (transfer, rule right_distrib)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   275
done
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   276
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   277
instance star :: (semiring_0) semiring_0 ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   278
instance star :: (semiring_0_cancel) semiring_0_cancel ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   279
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   280
instance star :: (comm_semiring) comm_semiring
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   281
by (intro_classes, transfer, rule distrib)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   282
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   283
instance star :: (comm_semiring_0) comm_semiring_0 ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   284
instance star :: (comm_semiring_0_cancel) comm_semiring_0_cancel ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   285
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   286
instance star :: (axclass_0_neq_1) axclass_0_neq_1
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   287
by (intro_classes, transfer, rule zero_neq_one)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   288
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   289
instance star :: (semiring_1) semiring_1 ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   290
instance star :: (comm_semiring_1) comm_semiring_1 ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   291
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   292
instance star :: (axclass_no_zero_divisors) axclass_no_zero_divisors
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   293
by (intro_classes, transfer, rule no_zero_divisors)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   294
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   295
instance star :: (semiring_1_cancel) semiring_1_cancel ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   296
instance star :: (comm_semiring_1_cancel) comm_semiring_1_cancel ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   297
instance star :: (ring) ring ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   298
instance star :: (comm_ring) comm_ring ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   299
instance star :: (ring_1) ring_1 ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   300
instance star :: (comm_ring_1) comm_ring_1 ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   301
instance star :: (idom) idom .. 
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   302
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   303
instance star :: (field) field
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   304
apply (intro_classes)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   305
apply (transfer, erule left_inverse)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   306
apply (transfer, rule divide_inverse)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   307
done
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   308
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   309
instance star :: (division_by_zero) division_by_zero
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   310
by (intro_classes, transfer, rule inverse_zero)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   311
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   312
instance star :: (pordered_semiring) pordered_semiring
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   313
apply (intro_classes)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   314
apply (transfer, erule (1) mult_left_mono)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   315
apply (transfer, erule (1) mult_right_mono)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   316
done
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   317
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   318
instance star :: (pordered_cancel_semiring) pordered_cancel_semiring ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   319
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   320
instance star :: (ordered_semiring_strict) ordered_semiring_strict
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   321
apply (intro_classes)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   322
apply (transfer, erule (1) mult_strict_left_mono)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   323
apply (transfer, erule (1) mult_strict_right_mono)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   324
done
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   325
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   326
instance star :: (pordered_comm_semiring) pordered_comm_semiring
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   327
by (intro_classes, transfer, rule pordered_comm_semiring_class.mult_mono)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   328
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   329
instance star :: (pordered_cancel_comm_semiring) pordered_cancel_comm_semiring ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   330
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   331
instance star :: (ordered_comm_semiring_strict) ordered_comm_semiring_strict
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   332
by (intro_classes, transfer, rule ordered_comm_semiring_strict_class.mult_strict_mono)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   333
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   334
instance star :: (pordered_ring) pordered_ring ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   335
instance star :: (lordered_ring) lordered_ring ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   336
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   337
instance star :: (axclass_abs_if) axclass_abs_if
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   338
by (intro_classes, transfer, rule abs_if)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   339
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   340
instance star :: (ordered_ring_strict) ordered_ring_strict ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   341
instance star :: (pordered_comm_ring) pordered_comm_ring ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   342
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   343
instance star :: (ordered_semidom) ordered_semidom
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   344
by (intro_classes, transfer, rule zero_less_one)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   345
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   346
instance star :: (ordered_idom) ordered_idom ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   347
instance star :: (ordered_field) ordered_field ..
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   348
17332
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   349
subsection {* Power classes *}
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   350
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   351
text {*
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   352
  Proving the class axiom @{thm [source] power_Suc} for type
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   353
  @{typ "'a star"} is a little tricky, because it quantifies
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   354
  over values of type @{typ nat}. The transfer principle does
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   355
  not handle quantification over non-star types in general,
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   356
  but we can work around this by fixing an arbitrary @{typ nat}
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   357
  value, and then applying the transfer principle.
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   358
*}
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   359
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   360
instance star :: (recpower) recpower
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   361
proof
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   362
  show "\<And>a::'a star. a ^ 0 = 1"
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   363
    by transfer (rule power_0)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   364
next
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   365
  fix n show "\<And>a::'a star. a ^ Suc n = a * a ^ n"
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   366
    by transfer (rule power_Suc)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   367
qed
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   368
17332
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   369
subsection {* Number classes *}
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   370
17332
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   371
lemma star_of_nat_def [transfer_unfold]: "of_nat n \<equiv> star_of (of_nat n)"
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   372
by (rule eq_reflection, induct_tac n, simp_all)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   373
17332
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   374
lemma star_of_of_nat [simp]: "star_of (of_nat n) = of_nat n"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   375
by transfer (rule refl)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   376
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   377
lemma int_diff_cases:
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   378
assumes prem: "\<And>m n. z = int m - int n \<Longrightarrow> P" shows "P"
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   379
 apply (rule_tac z=z in int_cases)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   380
  apply (rule_tac m=n and n=0 in prem, simp)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   381
 apply (rule_tac m=0 and n="Suc n" in prem, simp)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   382
done -- "Belongs in Integ/IntDef.thy"
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   383
17332
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   384
lemma star_of_int_def [transfer_unfold]: "of_int z \<equiv> star_of (of_int z)"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   385
by (rule eq_reflection, rule_tac z=z in int_diff_cases, simp)
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   386
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   387
lemma star_of_of_int [simp]: "star_of (of_int z) = of_int z"
4910cf8c0cd2 added theorem attributes transfer_intro, transfer_unfold, transfer_refold; simplified some proofs; some rearranging
huffman
parents: 17296
diff changeset
   388
by transfer (rule refl)
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   389
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   390
instance star :: (number_ring) number_ring
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   391
by (intro_classes, simp only: star_number_def star_of_int_def number_of_eq)
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   392
17429
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   393
subsection {* Finite class *}
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   394
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   395
lemma starset_finite: "finite A \<Longrightarrow> *s* A = star_of ` A"
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   396
by (erule finite_induct, simp_all)
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   397
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   398
instance star :: (finite) finite
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   399
apply (intro_classes)
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   400
apply (subst starset_UNIV [symmetric])
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   401
apply (subst starset_finite [OF finite])
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   402
apply (rule finite_imageI [OF finite])
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   403
done
e8d6ed3aacfe merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents: 17332
diff changeset
   404
17296
d0e0905d548e class instances for nonstandard types
huffman
parents:
diff changeset
   405
end