src/HOL/NSA/StarDef.thy
author hoelzl
Sun, 12 Apr 2015 11:34:16 +0200
changeset 60041 6c86d58ab0ca
parent 60036 218fcc645d22
child 60352 d46de31a50c4
permissions -rw-r--r--
replace Filters in NSA by HOL-Filters
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     1
(*  Title       : HOL/Hyperreal/StarDef.thy
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     2
    Author      : Jacques D. Fleuriot and Brian Huffman
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     3
*)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     4
58878
f962e42e324d modernized header;
wenzelm
parents: 58825
diff changeset
     5
section {* Construction of Star Types Using Ultrafilters *}
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     6
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     7
theory StarDef
60036
218fcc645d22 move filters to their own theory
hoelzl
parents: 59867
diff changeset
     8
imports Free_Ultrafilter
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     9
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    10
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    11
subsection {* A Free Ultrafilter over the Naturals *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    12
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    13
definition
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    14
  FreeUltrafilterNat :: "nat filter"  ("\<U>") where
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    15
  "\<U> = (SOME U. freeultrafilter U)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    16
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    17
lemma freeultrafilter_FreeUltrafilterNat: "freeultrafilter \<U>"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    18
apply (unfold FreeUltrafilterNat_def)
46008
c296c75f4cf4 reverted some changes for set->predicate transition, according to "hg log -u berghofe -r Isabelle2007:Isabelle2008";
wenzelm
parents: 45694
diff changeset
    19
apply (rule someI_ex)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    20
apply (rule freeultrafilter_Ex)
54580
7b9336176a1c adapt to 9733ab5c1df6
traytel
parents: 54489
diff changeset
    21
apply (rule infinite_UNIV_nat)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    22
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    23
30729
461ee3e49ad3 interpretation/interpret: prefixes are mandatory by default;
wenzelm
parents: 30198
diff changeset
    24
interpretation FreeUltrafilterNat: freeultrafilter FreeUltrafilterNat
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    25
by (rule freeultrafilter_FreeUltrafilterNat)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    26
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    27
subsection {* Definition of @{text star} type constructor *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    28
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    29
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    30
  starrel :: "((nat \<Rightarrow> 'a) \<times> (nat \<Rightarrow> 'a)) set" where
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    31
  "starrel = {(X,Y). eventually (\<lambda>n. X n = Y n) \<U>}"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    32
45694
4a8743618257 prefer typedef without extra definition and alternative name;
wenzelm
parents: 45605
diff changeset
    33
definition "star = (UNIV :: (nat \<Rightarrow> 'a) set) // starrel"
4a8743618257 prefer typedef without extra definition and alternative name;
wenzelm
parents: 45605
diff changeset
    34
49834
b27bbb021df1 discontinued obsolete typedef (open) syntax;
wenzelm
parents: 48891
diff changeset
    35
typedef 'a star = "star :: (nat \<Rightarrow> 'a) set set"
45694
4a8743618257 prefer typedef without extra definition and alternative name;
wenzelm
parents: 45605
diff changeset
    36
  unfolding star_def by (auto intro: quotientI)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    37
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    38
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    39
  star_n :: "(nat \<Rightarrow> 'a) \<Rightarrow> 'a star" where
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    40
  "star_n X = Abs_star (starrel `` {X})"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    41
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    42
theorem star_cases [case_names star_n, cases type: star]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    43
  "(\<And>X. x = star_n X \<Longrightarrow> P) \<Longrightarrow> P"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    44
by (cases x, unfold star_n_def star_def, erule quotientE, fast)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    45
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    46
lemma all_star_eq: "(\<forall>x. P x) = (\<forall>X. P (star_n X))"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    47
by (auto, rule_tac x=x in star_cases, simp)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    48
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    49
lemma ex_star_eq: "(\<exists>x. P x) = (\<exists>X. P (star_n X))"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    50
by (auto, rule_tac x=x in star_cases, auto)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    51
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    52
text {* Proving that @{term starrel} is an equivalence relation *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    53
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    54
lemma starrel_iff [iff]: "((X,Y) \<in> starrel) = (eventually (\<lambda>n. X n = Y n) \<U>)"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    55
by (simp add: starrel_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    56
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    57
lemma equiv_starrel: "equiv UNIV starrel"
40815
6e2d17cc0d1d equivI has replaced equiv.intro
haftmann
parents: 39302
diff changeset
    58
proof (rule equivI)
30198
922f944f03b2 name changes
nipkow
parents: 29904
diff changeset
    59
  show "refl starrel" by (simp add: refl_on_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    60
  show "sym starrel" by (simp add: sym_def eq_commute)
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    61
  show "trans starrel" by (intro transI) (auto elim: eventually_elim2)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    62
qed
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    63
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    64
lemmas equiv_starrel_iff =
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    65
  eq_equiv_class_iff [OF equiv_starrel UNIV_I UNIV_I]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    66
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    67
lemma starrel_in_star: "starrel``{x} \<in> star"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    68
by (simp add: star_def quotientI)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    69
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    70
lemma star_n_eq_iff: "(star_n X = star_n Y) = (eventually (\<lambda>n. X n = Y n) \<U>)"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    71
by (simp add: star_n_def Abs_star_inject starrel_in_star equiv_starrel_iff)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    72
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    73
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    74
subsection {* Transfer principle *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    75
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    76
text {* This introduction rule starts each transfer proof. *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    77
lemma transfer_start:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    78
  "P \<equiv> eventually (\<lambda>n. Q) \<U> \<Longrightarrow> Trueprop P \<equiv> Trueprop Q"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    79
  by (simp add: FreeUltrafilterNat.proper)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    80
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    81
text {*Initialize transfer tactic.*}
48891
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 47432
diff changeset
    82
ML_file "transfer.ML"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    83
47432
e1576d13e933 more standard method setup;
wenzelm
parents: 47328
diff changeset
    84
method_setup transfer = {*
e1576d13e933 more standard method setup;
wenzelm
parents: 47328
diff changeset
    85
  Attrib.thms >> (fn ths => fn ctxt =>
e1576d13e933 more standard method setup;
wenzelm
parents: 47328
diff changeset
    86
    SIMPLE_METHOD' (Transfer_Principle.transfer_tac ctxt ths))
e1576d13e933 more standard method setup;
wenzelm
parents: 47328
diff changeset
    87
*} "transfer principle"
e1576d13e933 more standard method setup;
wenzelm
parents: 47328
diff changeset
    88
e1576d13e933 more standard method setup;
wenzelm
parents: 47328
diff changeset
    89
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    90
text {* Transfer introduction rules. *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    91
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    92
lemma transfer_ex [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    93
  "\<lbrakk>\<And>X. p (star_n X) \<equiv> eventually (\<lambda>n. P n (X n)) \<U>\<rbrakk>
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    94
    \<Longrightarrow> \<exists>x::'a star. p x \<equiv> eventually (\<lambda>n. \<exists>x. P n x) \<U>"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    95
by (simp only: ex_star_eq eventually_ex)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    96
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    97
lemma transfer_all [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    98
  "\<lbrakk>\<And>X. p (star_n X) \<equiv> eventually (\<lambda>n. P n (X n)) \<U>\<rbrakk>
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    99
    \<Longrightarrow> \<forall>x::'a star. p x \<equiv> eventually (\<lambda>n. \<forall>x. P n x) \<U>"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   100
by (simp only: all_star_eq FreeUltrafilterNat.eventually_all_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   101
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   102
lemma transfer_not [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   103
  "\<lbrakk>p \<equiv> eventually P \<U>\<rbrakk> \<Longrightarrow> \<not> p \<equiv> eventually (\<lambda>n. \<not> P n) \<U>"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   104
by (simp only: FreeUltrafilterNat.eventually_not_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   105
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   106
lemma transfer_conj [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   107
  "\<lbrakk>p \<equiv> eventually P \<U>; q \<equiv> eventually Q \<U>\<rbrakk>
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   108
    \<Longrightarrow> p \<and> q \<equiv> eventually (\<lambda>n. P n \<and> Q n) \<U>"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   109
by (simp only: eventually_conj_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   110
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   111
lemma transfer_disj [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   112
  "\<lbrakk>p \<equiv> eventually P \<U>; q \<equiv> eventually Q \<U>\<rbrakk>
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   113
    \<Longrightarrow> p \<or> q \<equiv> eventually (\<lambda>n. P n \<or> Q n) \<U>"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   114
by (simp only: FreeUltrafilterNat.eventually_disj_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   115
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   116
lemma transfer_imp [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   117
  "\<lbrakk>p \<equiv> eventually P \<U>; q \<equiv> eventually Q \<U>\<rbrakk>
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   118
    \<Longrightarrow> p \<longrightarrow> q \<equiv> eventually (\<lambda>n. P n \<longrightarrow> Q n) \<U>"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   119
by (simp only: FreeUltrafilterNat.eventually_imp_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   120
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   121
lemma transfer_iff [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   122
  "\<lbrakk>p \<equiv> eventually P \<U>; q \<equiv> eventually Q \<U>\<rbrakk>
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   123
    \<Longrightarrow> p = q \<equiv> eventually (\<lambda>n. P n = Q n) \<U>"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   124
by (simp only: FreeUltrafilterNat.eventually_iff_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   125
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   126
lemma transfer_if_bool [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   127
  "\<lbrakk>p \<equiv> eventually P \<U>; x \<equiv> eventually X \<U>; y \<equiv> eventually Y \<U>\<rbrakk>
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   128
    \<Longrightarrow> (if p then x else y) \<equiv> eventually (\<lambda>n. if P n then X n else Y n) \<U>"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   129
by (simp only: if_bool_eq_conj transfer_conj transfer_imp transfer_not)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   130
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   131
lemma transfer_eq [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   132
  "\<lbrakk>x \<equiv> star_n X; y \<equiv> star_n Y\<rbrakk> \<Longrightarrow> x = y \<equiv> eventually (\<lambda>n. X n = Y n) \<U>"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   133
by (simp only: star_n_eq_iff)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   134
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   135
lemma transfer_if [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   136
  "\<lbrakk>p \<equiv> eventually (\<lambda>n. P n) \<U>; x \<equiv> star_n X; y \<equiv> star_n Y\<rbrakk>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   137
    \<Longrightarrow> (if p then x else y) \<equiv> star_n (\<lambda>n. if P n then X n else Y n)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   138
apply (rule eq_reflection)
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   139
apply (auto simp add: star_n_eq_iff transfer_not elim!: eventually_elim1)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   140
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   141
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   142
lemma transfer_fun_eq [transfer_intro]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   143
  "\<lbrakk>\<And>X. f (star_n X) = g (star_n X) 
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   144
    \<equiv> eventually (\<lambda>n. F n (X n) = G n (X n)) \<U>\<rbrakk>
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   145
      \<Longrightarrow> f = g \<equiv> eventually (\<lambda>n. F n = G n) \<U>"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   146
by (simp only: fun_eq_iff transfer_all)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   147
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   148
lemma transfer_star_n [transfer_intro]: "star_n X \<equiv> star_n (\<lambda>n. X n)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   149
by (rule reflexive)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   150
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   151
lemma transfer_bool [transfer_intro]: "p \<equiv> eventually (\<lambda>n. p) \<U>"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   152
by (simp add: FreeUltrafilterNat.proper)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   153
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   154
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   155
subsection {* Standard elements *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   156
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   157
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   158
  star_of :: "'a \<Rightarrow> 'a star" where
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   159
  "star_of x == star_n (\<lambda>n. x)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   160
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   161
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   162
  Standard :: "'a star set" where
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   163
  "Standard = range star_of"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   164
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   165
text {* Transfer tactic should remove occurrences of @{term star_of} *}
56256
1e01c159e7d9 more antiquotations;
wenzelm
parents: 55911
diff changeset
   166
setup {* Transfer_Principle.add_const @{const_name star_of} *}
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   167
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   168
declare star_of_def [transfer_intro]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   169
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   170
lemma star_of_inject: "(star_of x = star_of y) = (x = y)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   171
by (transfer, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   172
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   173
lemma Standard_star_of [simp]: "star_of x \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   174
by (simp add: Standard_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   175
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   176
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   177
subsection {* Internal functions *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   178
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   179
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   180
  Ifun :: "('a \<Rightarrow> 'b) star \<Rightarrow> 'a star \<Rightarrow> 'b star" ("_ \<star> _" [300,301] 300) where
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   181
  "Ifun f \<equiv> \<lambda>x. Abs_star
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   182
       (\<Union>F\<in>Rep_star f. \<Union>X\<in>Rep_star x. starrel``{\<lambda>n. F n (X n)})"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   183
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   184
lemma Ifun_congruent2:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   185
  "congruent2 starrel starrel (\<lambda>F X. starrel``{\<lambda>n. F n (X n)})"
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   186
by (auto simp add: congruent2_def equiv_starrel_iff elim!: eventually_rev_mp)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   187
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   188
lemma Ifun_star_n: "star_n F \<star> star_n X = star_n (\<lambda>n. F n (X n))"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   189
by (simp add: Ifun_def star_n_def Abs_star_inverse starrel_in_star
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   190
    UN_equiv_class2 [OF equiv_starrel equiv_starrel Ifun_congruent2])
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   191
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   192
text {* Transfer tactic should remove occurrences of @{term Ifun} *}
56256
1e01c159e7d9 more antiquotations;
wenzelm
parents: 55911
diff changeset
   193
setup {* Transfer_Principle.add_const @{const_name Ifun} *}
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   194
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   195
lemma transfer_Ifun [transfer_intro]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   196
  "\<lbrakk>f \<equiv> star_n F; x \<equiv> star_n X\<rbrakk> \<Longrightarrow> f \<star> x \<equiv> star_n (\<lambda>n. F n (X n))"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   197
by (simp only: Ifun_star_n)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   198
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   199
lemma Ifun_star_of [simp]: "star_of f \<star> star_of x = star_of (f x)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   200
by (transfer, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   201
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   202
lemma Standard_Ifun [simp]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   203
  "\<lbrakk>f \<in> Standard; x \<in> Standard\<rbrakk> \<Longrightarrow> f \<star> x \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   204
by (auto simp add: Standard_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   205
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   206
text {* Nonstandard extensions of functions *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   207
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   208
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   209
  starfun :: "('a \<Rightarrow> 'b) \<Rightarrow> ('a star \<Rightarrow> 'b star)"  ("*f* _" [80] 80) where
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   210
  "starfun f == \<lambda>x. star_of f \<star> x"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   211
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   212
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   213
  starfun2 :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> ('a star \<Rightarrow> 'b star \<Rightarrow> 'c star)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   214
    ("*f2* _" [80] 80) where
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   215
  "starfun2 f == \<lambda>x y. star_of f \<star> x \<star> y"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   216
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   217
declare starfun_def [transfer_unfold]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   218
declare starfun2_def [transfer_unfold]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   219
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   220
lemma starfun_star_n: "( *f* f) (star_n X) = star_n (\<lambda>n. f (X n))"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   221
by (simp only: starfun_def star_of_def Ifun_star_n)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   222
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   223
lemma starfun2_star_n:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   224
  "( *f2* f) (star_n X) (star_n Y) = star_n (\<lambda>n. f (X n) (Y n))"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   225
by (simp only: starfun2_def star_of_def Ifun_star_n)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   226
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   227
lemma starfun_star_of [simp]: "( *f* f) (star_of x) = star_of (f x)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   228
by (transfer, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   229
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   230
lemma starfun2_star_of [simp]: "( *f2* f) (star_of x) = *f* f x"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   231
by (transfer, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   232
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   233
lemma Standard_starfun [simp]: "x \<in> Standard \<Longrightarrow> starfun f x \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   234
by (simp add: starfun_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   235
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   236
lemma Standard_starfun2 [simp]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   237
  "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> starfun2 f x y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   238
by (simp add: starfun2_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   239
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   240
lemma Standard_starfun_iff:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   241
  assumes inj: "\<And>x y. f x = f y \<Longrightarrow> x = y"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   242
  shows "(starfun f x \<in> Standard) = (x \<in> Standard)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   243
proof
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   244
  assume "x \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   245
  thus "starfun f x \<in> Standard" by simp
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   246
next
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   247
  have inj': "\<And>x y. starfun f x = starfun f y \<Longrightarrow> x = y"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   248
    using inj by transfer
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   249
  assume "starfun f x \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   250
  then obtain b where b: "starfun f x = star_of b"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   251
    unfolding Standard_def ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   252
  hence "\<exists>x. starfun f x = star_of b" ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   253
  hence "\<exists>a. f a = b" by transfer
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   254
  then obtain a where "f a = b" ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   255
  hence "starfun f (star_of a) = star_of b" by transfer
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   256
  with b have "starfun f x = starfun f (star_of a)" by simp
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   257
  hence "x = star_of a" by (rule inj')
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   258
  thus "x \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   259
    unfolding Standard_def by auto
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   260
qed
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   261
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   262
lemma Standard_starfun2_iff:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   263
  assumes inj: "\<And>a b a' b'. f a b = f a' b' \<Longrightarrow> a = a' \<and> b = b'"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   264
  shows "(starfun2 f x y \<in> Standard) = (x \<in> Standard \<and> y \<in> Standard)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   265
proof
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   266
  assume "x \<in> Standard \<and> y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   267
  thus "starfun2 f x y \<in> Standard" by simp
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   268
next
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   269
  have inj': "\<And>x y z w. starfun2 f x y = starfun2 f z w \<Longrightarrow> x = z \<and> y = w"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   270
    using inj by transfer
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   271
  assume "starfun2 f x y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   272
  then obtain c where c: "starfun2 f x y = star_of c"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   273
    unfolding Standard_def ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   274
  hence "\<exists>x y. starfun2 f x y = star_of c" by auto
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   275
  hence "\<exists>a b. f a b = c" by transfer
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   276
  then obtain a b where "f a b = c" by auto
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   277
  hence "starfun2 f (star_of a) (star_of b) = star_of c"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   278
    by transfer
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   279
  with c have "starfun2 f x y = starfun2 f (star_of a) (star_of b)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   280
    by simp
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   281
  hence "x = star_of a \<and> y = star_of b"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   282
    by (rule inj')
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   283
  thus "x \<in> Standard \<and> y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   284
    unfolding Standard_def by auto
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   285
qed
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   286
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   287
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   288
subsection {* Internal predicates *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   289
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   290
definition unstar :: "bool star \<Rightarrow> bool" where
37765
26bdfb7b680b dropped superfluous [code del]s
haftmann
parents: 36414
diff changeset
   291
  "unstar b \<longleftrightarrow> b = star_of True"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   292
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   293
lemma unstar_star_n: "unstar (star_n P) = (eventually P \<U>)"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   294
by (simp add: unstar_def star_of_def star_n_eq_iff)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   295
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   296
lemma unstar_star_of [simp]: "unstar (star_of p) = p"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   297
by (simp add: unstar_def star_of_inject)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   298
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   299
text {* Transfer tactic should remove occurrences of @{term unstar} *}
56256
1e01c159e7d9 more antiquotations;
wenzelm
parents: 55911
diff changeset
   300
setup {* Transfer_Principle.add_const @{const_name unstar} *}
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   301
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   302
lemma transfer_unstar [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   303
  "p \<equiv> star_n P \<Longrightarrow> unstar p \<equiv> eventually P \<U>"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   304
by (simp only: unstar_star_n)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   305
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   306
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   307
  starP :: "('a \<Rightarrow> bool) \<Rightarrow> 'a star \<Rightarrow> bool"  ("*p* _" [80] 80) where
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   308
  "*p* P = (\<lambda>x. unstar (star_of P \<star> x))"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   309
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   310
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   311
  starP2 :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a star \<Rightarrow> 'b star \<Rightarrow> bool"  ("*p2* _" [80] 80) where
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   312
  "*p2* P = (\<lambda>x y. unstar (star_of P \<star> x \<star> y))"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   313
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   314
declare starP_def [transfer_unfold]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   315
declare starP2_def [transfer_unfold]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   316
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   317
lemma starP_star_n: "( *p* P) (star_n X) = (eventually (\<lambda>n. P (X n)) \<U>)"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   318
by (simp only: starP_def star_of_def Ifun_star_n unstar_star_n)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   319
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   320
lemma starP2_star_n:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   321
  "( *p2* P) (star_n X) (star_n Y) = (eventually (\<lambda>n. P (X n) (Y n)) \<U>)"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   322
by (simp only: starP2_def star_of_def Ifun_star_n unstar_star_n)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   323
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   324
lemma starP_star_of [simp]: "( *p* P) (star_of x) = P x"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   325
by (transfer, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   326
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   327
lemma starP2_star_of [simp]: "( *p2* P) (star_of x) = *p* P x"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   328
by (transfer, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   329
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   330
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   331
subsection {* Internal sets *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   332
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   333
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   334
  Iset :: "'a set star \<Rightarrow> 'a star set" where
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   335
  "Iset A = {x. ( *p2* op \<in>) x A}"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   336
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   337
lemma Iset_star_n:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   338
  "(star_n X \<in> Iset (star_n A)) = (eventually (\<lambda>n. X n \<in> A n) \<U>)"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   339
by (simp add: Iset_def starP2_star_n)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   340
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   341
text {* Transfer tactic should remove occurrences of @{term Iset} *}
56256
1e01c159e7d9 more antiquotations;
wenzelm
parents: 55911
diff changeset
   342
setup {* Transfer_Principle.add_const @{const_name Iset} *}
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   343
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   344
lemma transfer_mem [transfer_intro]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   345
  "\<lbrakk>x \<equiv> star_n X; a \<equiv> Iset (star_n A)\<rbrakk>
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   346
    \<Longrightarrow> x \<in> a \<equiv> eventually (\<lambda>n. X n \<in> A n) \<U>"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   347
by (simp only: Iset_star_n)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   348
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   349
lemma transfer_Collect [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   350
  "\<lbrakk>\<And>X. p (star_n X) \<equiv> eventually (\<lambda>n. P n (X n)) \<U>\<rbrakk>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   351
    \<Longrightarrow> Collect p \<equiv> Iset (star_n (\<lambda>n. Collect (P n)))"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   352
by (simp add: atomize_eq set_eq_iff all_star_eq Iset_star_n)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   353
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   354
lemma transfer_set_eq [transfer_intro]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   355
  "\<lbrakk>a \<equiv> Iset (star_n A); b \<equiv> Iset (star_n B)\<rbrakk>
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   356
    \<Longrightarrow> a = b \<equiv> eventually (\<lambda>n. A n = B n) \<U>"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   357
by (simp only: set_eq_iff transfer_all transfer_iff transfer_mem)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   358
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   359
lemma transfer_ball [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   360
  "\<lbrakk>a \<equiv> Iset (star_n A); \<And>X. p (star_n X) \<equiv> eventually (\<lambda>n. P n (X n)) \<U>\<rbrakk>
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   361
    \<Longrightarrow> \<forall>x\<in>a. p x \<equiv> eventually (\<lambda>n. \<forall>x\<in>A n. P n x) \<U>"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   362
by (simp only: Ball_def transfer_all transfer_imp transfer_mem)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   363
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   364
lemma transfer_bex [transfer_intro]:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   365
  "\<lbrakk>a \<equiv> Iset (star_n A); \<And>X. p (star_n X) \<equiv> eventually (\<lambda>n. P n (X n)) \<U>\<rbrakk>
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   366
    \<Longrightarrow> \<exists>x\<in>a. p x \<equiv> eventually (\<lambda>n. \<exists>x\<in>A n. P n x) \<U>"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   367
by (simp only: Bex_def transfer_ex transfer_conj transfer_mem)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   368
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   369
lemma transfer_Iset [transfer_intro]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   370
  "\<lbrakk>a \<equiv> star_n A\<rbrakk> \<Longrightarrow> Iset a \<equiv> Iset (star_n (\<lambda>n. A n))"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   371
by simp
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   372
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   373
text {* Nonstandard extensions of sets. *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   374
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   375
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   376
  starset :: "'a set \<Rightarrow> 'a star set" ("*s* _" [80] 80) where
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   377
  "starset A = Iset (star_of A)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   378
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   379
declare starset_def [transfer_unfold]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   380
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   381
lemma starset_mem: "(star_of x \<in> *s* A) = (x \<in> A)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   382
by (transfer, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   383
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   384
lemma starset_UNIV: "*s* (UNIV::'a set) = (UNIV::'a star set)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   385
by (transfer UNIV_def, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   386
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   387
lemma starset_empty: "*s* {} = {}"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   388
by (transfer empty_def, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   389
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   390
lemma starset_insert: "*s* (insert x A) = insert (star_of x) ( *s* A)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   391
by (transfer insert_def Un_def, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   392
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   393
lemma starset_Un: "*s* (A \<union> B) = *s* A \<union> *s* B"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   394
by (transfer Un_def, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   395
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   396
lemma starset_Int: "*s* (A \<inter> B) = *s* A \<inter> *s* B"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   397
by (transfer Int_def, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   398
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   399
lemma starset_Compl: "*s* -A = -( *s* A)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   400
by (transfer Compl_eq, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   401
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   402
lemma starset_diff: "*s* (A - B) = *s* A - *s* B"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   403
by (transfer set_diff_eq, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   404
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   405
lemma starset_image: "*s* (f ` A) = ( *f* f) ` ( *s* A)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   406
by (transfer image_def, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   407
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   408
lemma starset_vimage: "*s* (f -` A) = ( *f* f) -` ( *s* A)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   409
by (transfer vimage_def, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   410
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   411
lemma starset_subset: "( *s* A \<subseteq> *s* B) = (A \<subseteq> B)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   412
by (transfer subset_eq, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   413
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   414
lemma starset_eq: "( *s* A = *s* B) = (A = B)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   415
by (transfer, rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   416
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   417
lemmas starset_simps [simp] =
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   418
  starset_mem     starset_UNIV
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   419
  starset_empty   starset_insert
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   420
  starset_Un      starset_Int
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   421
  starset_Compl   starset_diff
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   422
  starset_image   starset_vimage
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   423
  starset_subset  starset_eq
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   424
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   425
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   426
subsection {* Syntactic classes *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   427
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   428
instantiation star :: (zero) zero
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   429
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   430
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   431
definition
37765
26bdfb7b680b dropped superfluous [code del]s
haftmann
parents: 36414
diff changeset
   432
  star_zero_def:    "0 \<equiv> star_of 0"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   433
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   434
instance ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   435
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   436
end
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   437
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   438
instantiation star :: (one) one
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   439
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   440
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   441
definition
37765
26bdfb7b680b dropped superfluous [code del]s
haftmann
parents: 36414
diff changeset
   442
  star_one_def:     "1 \<equiv> star_of 1"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   443
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   444
instance ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   445
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   446
end
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   447
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   448
instantiation star :: (plus) plus
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   449
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   450
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   451
definition
37765
26bdfb7b680b dropped superfluous [code del]s
haftmann
parents: 36414
diff changeset
   452
  star_add_def:     "(op +) \<equiv> *f2* (op +)"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   453
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   454
instance ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   455
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   456
end
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   457
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   458
instantiation star :: (times) times
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   459
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   460
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   461
definition
37765
26bdfb7b680b dropped superfluous [code del]s
haftmann
parents: 36414
diff changeset
   462
  star_mult_def:    "(op *) \<equiv> *f2* (op *)"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   463
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   464
instance ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   465
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   466
end
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   467
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   468
instantiation star :: (uminus) uminus
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   469
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   470
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   471
definition
37765
26bdfb7b680b dropped superfluous [code del]s
haftmann
parents: 36414
diff changeset
   472
  star_minus_def:   "uminus \<equiv> *f* uminus"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   473
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   474
instance ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   475
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   476
end
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   477
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   478
instantiation star :: (minus) minus
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   479
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   480
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   481
definition
37765
26bdfb7b680b dropped superfluous [code del]s
haftmann
parents: 36414
diff changeset
   482
  star_diff_def:    "(op -) \<equiv> *f2* (op -)"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   483
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   484
instance ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   485
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   486
end
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   487
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   488
instantiation star :: (abs) abs
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   489
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   490
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   491
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   492
  star_abs_def:     "abs \<equiv> *f* abs"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   493
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   494
instance ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   495
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   496
end
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   497
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   498
instantiation star :: (sgn) sgn
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   499
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   500
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   501
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   502
  star_sgn_def:     "sgn \<equiv> *f* sgn"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   503
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   504
instance ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   505
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   506
end
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   507
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   508
instantiation star :: (inverse) inverse
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   509
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   510
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   511
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   512
  star_divide_def:  "(op /) \<equiv> *f2* (op /)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   513
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   514
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   515
  star_inverse_def: "inverse \<equiv> *f* inverse"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   516
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   517
instance ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   518
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   519
end
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   520
35050
9f841f20dca6 renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents: 35043
diff changeset
   521
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
   522
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   523
instantiation star :: (Divides.div) Divides.div
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   524
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   525
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   526
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   527
  star_div_def:     "(op div) \<equiv> *f2* (op div)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   528
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   529
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   530
  star_mod_def:     "(op mod) \<equiv> *f2* (op mod)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   531
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   532
instance ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   533
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   534
end
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   535
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   536
instantiation star :: (ord) ord
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   537
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   538
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   539
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   540
  star_le_def:      "(op \<le>) \<equiv> *p2* (op \<le>)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   541
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   542
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   543
  star_less_def:    "(op <) \<equiv> *p2* (op <)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   544
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   545
instance ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   546
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   547
end
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   548
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   549
lemmas star_class_defs [transfer_unfold] =
47108
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   550
  star_zero_def     star_one_def
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   551
  star_add_def      star_diff_def     star_minus_def
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   552
  star_mult_def     star_divide_def   star_inverse_def
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   553
  star_le_def       star_less_def     star_abs_def       star_sgn_def
30968
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   554
  star_div_def      star_mod_def
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   555
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   556
text {* Class operations preserve standard elements *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   557
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   558
lemma Standard_zero: "0 \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   559
by (simp add: star_zero_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   560
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   561
lemma Standard_one: "1 \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   562
by (simp add: star_one_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   563
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   564
lemma Standard_add: "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> x + y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   565
by (simp add: star_add_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   566
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   567
lemma Standard_diff: "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> x - y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   568
by (simp add: star_diff_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   569
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   570
lemma Standard_minus: "x \<in> Standard \<Longrightarrow> - x \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   571
by (simp add: star_minus_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   572
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   573
lemma Standard_mult: "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> x * y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   574
by (simp add: star_mult_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   575
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   576
lemma Standard_divide: "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> x / y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   577
by (simp add: star_divide_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   578
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   579
lemma Standard_inverse: "x \<in> Standard \<Longrightarrow> inverse x \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   580
by (simp add: star_inverse_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   581
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   582
lemma Standard_abs: "x \<in> Standard \<Longrightarrow> abs x \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   583
by (simp add: star_abs_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   584
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   585
lemma Standard_div: "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> x div y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   586
by (simp add: star_div_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   587
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   588
lemma Standard_mod: "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> x mod y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   589
by (simp add: star_mod_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   590
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   591
lemmas Standard_simps [simp] =
47108
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   592
  Standard_zero  Standard_one
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   593
  Standard_add  Standard_diff  Standard_minus
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   594
  Standard_mult  Standard_divide  Standard_inverse
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   595
  Standard_abs  Standard_div  Standard_mod
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   596
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   597
text {* @{term star_of} preserves class operations *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   598
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   599
lemma star_of_add: "star_of (x + y) = star_of x + star_of y"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   600
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   601
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   602
lemma star_of_diff: "star_of (x - y) = star_of x - star_of y"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   603
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   604
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   605
lemma star_of_minus: "star_of (-x) = - star_of x"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   606
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   607
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   608
lemma star_of_mult: "star_of (x * y) = star_of x * star_of y"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   609
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   610
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   611
lemma star_of_divide: "star_of (x / y) = star_of x / star_of y"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   612
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   613
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   614
lemma star_of_inverse: "star_of (inverse x) = inverse (star_of x)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   615
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   616
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   617
lemma star_of_div: "star_of (x div y) = star_of x div star_of y"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   618
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   619
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   620
lemma star_of_mod: "star_of (x mod y) = star_of x mod star_of y"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   621
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   622
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   623
lemma star_of_abs: "star_of (abs x) = abs (star_of x)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   624
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   625
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   626
text {* @{term star_of} preserves numerals *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   627
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   628
lemma star_of_zero: "star_of 0 = 0"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   629
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   630
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   631
lemma star_of_one: "star_of 1 = 1"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   632
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   633
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   634
text {* @{term star_of} preserves orderings *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   635
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   636
lemma star_of_less: "(star_of x < star_of y) = (x < y)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   637
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   638
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   639
lemma star_of_le: "(star_of x \<le> star_of y) = (x \<le> y)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   640
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   641
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   642
lemma star_of_eq: "(star_of x = star_of y) = (x = y)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   643
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   644
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   645
text{*As above, for 0*}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   646
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   647
lemmas star_of_0_less = star_of_less [of 0, simplified star_of_zero]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   648
lemmas star_of_0_le   = star_of_le   [of 0, simplified star_of_zero]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   649
lemmas star_of_0_eq   = star_of_eq   [of 0, simplified star_of_zero]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   650
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   651
lemmas star_of_less_0 = star_of_less [of _ 0, simplified star_of_zero]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   652
lemmas star_of_le_0   = star_of_le   [of _ 0, simplified star_of_zero]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   653
lemmas star_of_eq_0   = star_of_eq   [of _ 0, simplified star_of_zero]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   654
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   655
text{*As above, for 1*}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   656
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   657
lemmas star_of_1_less = star_of_less [of 1, simplified star_of_one]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   658
lemmas star_of_1_le   = star_of_le   [of 1, simplified star_of_one]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   659
lemmas star_of_1_eq   = star_of_eq   [of 1, simplified star_of_one]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   660
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   661
lemmas star_of_less_1 = star_of_less [of _ 1, simplified star_of_one]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   662
lemmas star_of_le_1   = star_of_le   [of _ 1, simplified star_of_one]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   663
lemmas star_of_eq_1   = star_of_eq   [of _ 1, simplified star_of_one]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   664
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   665
lemmas star_of_simps [simp] =
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   666
  star_of_add     star_of_diff    star_of_minus
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   667
  star_of_mult    star_of_divide  star_of_inverse
30968
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   668
  star_of_div     star_of_mod     star_of_abs
47108
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   669
  star_of_zero    star_of_one
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   670
  star_of_less    star_of_le      star_of_eq
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   671
  star_of_0_less  star_of_0_le    star_of_0_eq
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   672
  star_of_less_0  star_of_le_0    star_of_eq_0
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   673
  star_of_1_less  star_of_1_le    star_of_1_eq
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   674
  star_of_less_1  star_of_le_1    star_of_eq_1
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   675
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   676
subsection {* Ordering and lattice classes *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   677
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   678
instance star :: (order) order
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   679
apply (intro_classes)
27682
25aceefd4786 added class preorder
haftmann
parents: 27651
diff changeset
   680
apply (transfer, rule less_le_not_le)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   681
apply (transfer, rule order_refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   682
apply (transfer, erule (1) order_trans)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   683
apply (transfer, erule (1) order_antisym)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   684
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   685
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   686
instantiation star :: (semilattice_inf) semilattice_inf
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   687
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   688
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   689
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   690
  star_inf_def [transfer_unfold]: "inf \<equiv> *f2* inf"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   691
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   692
instance
59816
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
   693
  by default (transfer, auto)+
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   694
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   695
end
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   696
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   697
instantiation star :: (semilattice_sup) semilattice_sup
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   698
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   699
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   700
definition
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   701
  star_sup_def [transfer_unfold]: "sup \<equiv> *f2* sup"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   702
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   703
instance
59816
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
   704
  by default (transfer, auto)+
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   705
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   706
end
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   707
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   708
instance star :: (lattice) lattice ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   709
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   710
instance star :: (distrib_lattice) distrib_lattice
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   711
  by default (transfer, auto simp add: sup_inf_distrib1)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   712
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   713
lemma Standard_inf [simp]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   714
  "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> inf x y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   715
by (simp add: star_inf_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   716
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   717
lemma Standard_sup [simp]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   718
  "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> sup x y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   719
by (simp add: star_sup_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   720
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   721
lemma star_of_inf [simp]: "star_of (inf x y) = inf (star_of x) (star_of y)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   722
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   723
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   724
lemma star_of_sup [simp]: "star_of (sup x y) = sup (star_of x) (star_of y)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   725
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   726
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   727
instance star :: (linorder) linorder
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   728
by (intro_classes, transfer, rule linorder_linear)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   729
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   730
lemma star_max_def [transfer_unfold]: "max = *f2* max"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   731
apply (rule ext, rule ext)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   732
apply (unfold max_def, transfer, fold max_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   733
apply (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   734
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   735
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   736
lemma star_min_def [transfer_unfold]: "min = *f2* min"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   737
apply (rule ext, rule ext)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   738
apply (unfold min_def, transfer, fold min_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   739
apply (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   740
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   741
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   742
lemma Standard_max [simp]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   743
  "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> max x y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   744
by (simp add: star_max_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   745
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   746
lemma Standard_min [simp]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   747
  "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> min x y \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   748
by (simp add: star_min_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   749
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   750
lemma star_of_max [simp]: "star_of (max x y) = max (star_of x) (star_of y)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   751
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   752
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   753
lemma star_of_min [simp]: "star_of (min x y) = min (star_of x) (star_of y)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   754
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   755
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   756
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   757
subsection {* Ordered group classes *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   758
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   759
instance star :: (semigroup_add) semigroup_add
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 56256
diff changeset
   760
by (intro_classes, transfer, rule add.assoc)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   761
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   762
instance star :: (ab_semigroup_add) ab_semigroup_add
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 56256
diff changeset
   763
by (intro_classes, transfer, rule add.commute)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   764
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   765
instance star :: (semigroup_mult) semigroup_mult
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 56256
diff changeset
   766
by (intro_classes, transfer, rule mult.assoc)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   767
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   768
instance star :: (ab_semigroup_mult) ab_semigroup_mult
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 56256
diff changeset
   769
by (intro_classes, transfer, rule mult.commute)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   770
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   771
instance star :: (comm_monoid_add) comm_monoid_add
28059
295a8fc92684 fixed names of class assumptions
haftmann
parents: 27682
diff changeset
   772
by (intro_classes, transfer, rule comm_monoid_add_class.add_0)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   773
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   774
instance star :: (monoid_mult) monoid_mult
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   775
apply (intro_classes)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   776
apply (transfer, rule mult_1_left)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   777
apply (transfer, rule mult_1_right)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   778
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   779
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   780
instance star :: (comm_monoid_mult) comm_monoid_mult
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   781
by (intro_classes, transfer, rule mult_1)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   782
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   783
instance star :: (cancel_semigroup_add) cancel_semigroup_add
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   784
apply (intro_classes)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   785
apply (transfer, erule add_left_imp_eq)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   786
apply (transfer, erule add_right_imp_eq)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   787
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   788
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   789
instance star :: (cancel_ab_semigroup_add) cancel_ab_semigroup_add
59815
cce82e360c2f explicit commutative additive inverse operation;
haftmann
parents: 59680
diff changeset
   790
by intro_classes (transfer, simp add: diff_diff_eq)+
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   791
29904
856f16a3b436 add class cancel_comm_monoid_add
huffman
parents: 29234
diff changeset
   792
instance star :: (cancel_comm_monoid_add) cancel_comm_monoid_add ..
856f16a3b436 add class cancel_comm_monoid_add
huffman
parents: 29234
diff changeset
   793
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   794
instance star :: (ab_group_add) ab_group_add
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   795
apply (intro_classes)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   796
apply (transfer, rule left_minus)
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 49962
diff changeset
   797
apply (transfer, rule diff_conv_add_uminus)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   798
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   799
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   800
instance star :: (ordered_ab_semigroup_add) ordered_ab_semigroup_add
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   801
by (intro_classes, transfer, rule add_left_mono)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   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_cancel_ab_semigroup_add) ordered_cancel_ab_semigroup_add ..
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
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_ab_semigroup_add_imp_le) ordered_ab_semigroup_add_imp_le
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   806
by (intro_classes, transfer, rule add_le_imp_le_left)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   807
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   808
instance star :: (ordered_comm_monoid_add) ordered_comm_monoid_add ..
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   809
instance star :: (ordered_ab_group_add) ordered_ab_group_add ..
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   810
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   811
instance star :: (ordered_ab_group_add_abs) ordered_ab_group_add_abs 
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   812
  by intro_classes (transfer,
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   813
    simp add: abs_ge_self abs_leI abs_triangle_ineq)+
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   814
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   815
instance star :: (linordered_cancel_ab_semigroup_add) linordered_cancel_ab_semigroup_add ..
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   816
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   817
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   818
subsection {* Ring and field classes *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   819
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   820
instance star :: (semiring) semiring
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   821
apply (intro_classes)
49962
a8cc904a6820 Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents: 49834
diff changeset
   822
apply (transfer, rule distrib_right)
a8cc904a6820 Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents: 49834
diff changeset
   823
apply (transfer, rule distrib_left)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   824
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   825
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   826
instance star :: (semiring_0) semiring_0 
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   827
by intro_classes (transfer, simp)+
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   828
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   829
instance star :: (semiring_0_cancel) semiring_0_cancel ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   830
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   831
instance star :: (comm_semiring) comm_semiring 
49962
a8cc904a6820 Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents: 49834
diff changeset
   832
by (intro_classes, transfer, rule distrib_right)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   833
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   834
instance star :: (comm_semiring_0) comm_semiring_0 ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   835
instance star :: (comm_semiring_0_cancel) comm_semiring_0_cancel ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   836
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   837
instance star :: (zero_neq_one) zero_neq_one
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   838
by (intro_classes, transfer, rule zero_neq_one)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   839
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   840
instance star :: (semiring_1) semiring_1 ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   841
instance star :: (comm_semiring_1) comm_semiring_1 ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   842
59680
034a4d15b52e make proofs work with 4762c690a75c
Andreas Lochbihler
parents: 59676
diff changeset
   843
declare dvd_def [transfer_refold]
59676
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
   844
59816
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
   845
instance star :: (comm_semiring_1_diff_distrib) comm_semiring_1_diff_distrib
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
   846
by intro_classes (transfer, fact right_diff_distrib')
59676
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
   847
59833
ab828c2c5d67 clarified no_zero_devisors: makes only sense in a semiring;
haftmann
parents: 59816
diff changeset
   848
instance star :: (semiring_no_zero_divisors) semiring_no_zero_divisors
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   849
by (intro_classes, transfer, rule no_zero_divisors)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   850
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   851
instance star :: (semiring_1_cancel) semiring_1_cancel ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   852
instance star :: (comm_semiring_1_cancel) comm_semiring_1_cancel ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   853
instance star :: (ring) ring ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   854
instance star :: (comm_ring) comm_ring ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   855
instance star :: (ring_1) ring_1 ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   856
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
   857
instance star :: (semidom) semidom ..
59676
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
   858
instance star :: (semiring_div) semiring_div
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
   859
apply intro_classes
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
   860
apply(transfer, rule mod_div_equality)
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
   861
apply(transfer, rule div_by_0)
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
   862
apply(transfer, rule div_0)
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
   863
apply(transfer, erule div_mult_self1)
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
   864
apply(transfer, erule div_mult_mult1)
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
   865
done
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
   866
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   867
instance star :: (ring_no_zero_divisors) ring_no_zero_divisors ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   868
instance star :: (ring_1_no_zero_divisors) ring_1_no_zero_divisors ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   869
instance star :: (idom) idom .. 
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   870
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   871
instance star :: (division_ring) division_ring
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   872
apply (intro_classes)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   873
apply (transfer, erule left_inverse)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   874
apply (transfer, erule right_inverse)
35083
3246e66b0874 division ring assumes divide_inverse
haftmann
parents: 35050
diff changeset
   875
apply (transfer, fact divide_inverse)
59867
58043346ca64 given up separate type classes demanding `inverse 0 = 0`
haftmann
parents: 59833
diff changeset
   876
apply (transfer, fact inverse_zero)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   877
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   878
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   879
instance star :: (field) field
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   880
apply (intro_classes)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   881
apply (transfer, erule left_inverse)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   882
apply (transfer, rule divide_inverse)
59867
58043346ca64 given up separate type classes demanding `inverse 0 = 0`
haftmann
parents: 59833
diff changeset
   883
apply (transfer, fact inverse_zero)
36412
9245942dcc5b instances for *_inverse_zero classes
haftmann
parents: 36349
diff changeset
   884
done
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   885
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   886
instance star :: (ordered_semiring) ordered_semiring
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   887
apply (intro_classes)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   888
apply (transfer, erule (1) mult_left_mono)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   889
apply (transfer, erule (1) mult_right_mono)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   890
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   891
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   892
instance star :: (ordered_cancel_semiring) ordered_cancel_semiring ..
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   893
35043
07dbdf60d5ad dropped accidental duplication of "lin" prefix from cs. 108662d50512
haftmann
parents: 35035
diff changeset
   894
instance star :: (linordered_semiring_strict) linordered_semiring_strict
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   895
apply (intro_classes)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   896
apply (transfer, erule (1) mult_strict_left_mono)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   897
apply (transfer, erule (1) mult_strict_right_mono)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   898
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   899
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   900
instance star :: (ordered_comm_semiring) ordered_comm_semiring
38642
8fa437809c67 dropped type classes mult_mono and mult_mono1; tuned names of technical rule duplicates
haftmann
parents: 38621
diff changeset
   901
by (intro_classes, transfer, rule mult_left_mono)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   902
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   903
instance star :: (ordered_cancel_comm_semiring) ordered_cancel_comm_semiring ..
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   904
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   905
instance star :: (linordered_comm_semiring_strict) linordered_comm_semiring_strict
38642
8fa437809c67 dropped type classes mult_mono and mult_mono1; tuned names of technical rule duplicates
haftmann
parents: 38621
diff changeset
   906
by (intro_classes, transfer, rule mult_strict_left_mono)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   907
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   908
instance star :: (ordered_ring) ordered_ring ..
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   909
instance star :: (ordered_ring_abs) ordered_ring_abs
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   910
  by intro_classes  (transfer, rule abs_eq_mult)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   911
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   912
instance star :: (abs_if) abs_if
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   913
by (intro_classes, transfer, rule abs_if)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   914
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   915
instance star :: (sgn_if) sgn_if
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   916
by (intro_classes, transfer, rule sgn_if)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   917
35043
07dbdf60d5ad dropped accidental duplication of "lin" prefix from cs. 108662d50512
haftmann
parents: 35035
diff changeset
   918
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
   919
instance star :: (ordered_comm_ring) ordered_comm_ring ..
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   920
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   921
instance star :: (linordered_semidom) linordered_semidom
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   922
by (intro_classes, transfer, rule zero_less_one)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   923
35028
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   924
instance star :: (linordered_idom) linordered_idom ..
108662d50512 more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents: 31021
diff changeset
   925
instance star :: (linordered_field) linordered_field ..
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   926
30968
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   927
subsection {* Power *}
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   928
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   929
lemma star_power_def [transfer_unfold]:
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   930
  "(op ^) \<equiv> \<lambda>x n. ( *f* (\<lambda>x. x ^ n)) x"
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   931
proof (rule eq_reflection, rule ext, rule ext)
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   932
  fix n :: nat
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   933
  show "\<And>x::'a star. x ^ n = ( *f* (\<lambda>x. x ^ n)) x" 
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   934
  proof (induct n)
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   935
    case 0
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   936
    have "\<And>x::'a star. ( *f* (\<lambda>x. 1)) x = 1"
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   937
      by transfer simp
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   938
    then show ?case by simp
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   939
  next
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   940
    case (Suc n)
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   941
    have "\<And>x::'a star. x * ( *f* (\<lambda>x\<Colon>'a. x ^ n)) x = ( *f* (\<lambda>x\<Colon>'a. x * x ^ n)) x"
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   942
      by transfer simp
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   943
    with Suc show ?case by simp
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   944
  qed
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   945
qed
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   946
30968
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   947
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
   948
  by (simp add: star_power_def)
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   949
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   950
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
   951
  by transfer (rule refl)
10fef94f40fc adaptions due to rearrangment of power operation
haftmann
parents: 30729
diff changeset
   952
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   953
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   954
subsection {* Number classes *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   955
47108
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   956
instance star :: (numeral) numeral ..
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   957
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   958
lemma star_numeral_def [transfer_unfold]:
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   959
  "numeral k = star_of (numeral k)"
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   960
by (induct k, simp_all only: numeral.simps star_of_one star_of_add)
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   961
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   962
lemma Standard_numeral [simp]: "numeral k \<in> Standard"
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   963
by (simp add: star_numeral_def)
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   964
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   965
lemma star_of_numeral [simp]: "star_of (numeral k) = numeral k"
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   966
by transfer (rule refl)
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   967
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   968
lemma star_of_nat_def [transfer_unfold]: "of_nat n = star_of (of_nat n)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   969
by (induct n, simp_all)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   970
47108
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   971
lemmas star_of_compare_numeral [simp] =
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   972
  star_of_less [of "numeral k", simplified star_of_numeral]
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   973
  star_of_le   [of "numeral k", simplified star_of_numeral]
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   974
  star_of_eq   [of "numeral k", simplified star_of_numeral]
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   975
  star_of_less [of _ "numeral k", simplified star_of_numeral]
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   976
  star_of_le   [of _ "numeral k", simplified star_of_numeral]
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 46008
diff changeset
   977
  star_of_eq   [of _ "numeral k", simplified star_of_numeral]
54489
03ff4d1e6784 eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents: 54230
diff changeset
   978
  star_of_less [of "- numeral k", simplified star_of_numeral]
03ff4d1e6784 eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents: 54230
diff changeset
   979
  star_of_le   [of "- numeral k", simplified star_of_numeral]
03ff4d1e6784 eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents: 54230
diff changeset
   980
  star_of_eq   [of "- numeral k", simplified star_of_numeral]
03ff4d1e6784 eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents: 54230
diff changeset
   981
  star_of_less [of _ "- numeral k", simplified star_of_numeral]
03ff4d1e6784 eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents: 54230
diff changeset
   982
  star_of_le   [of _ "- numeral k", simplified star_of_numeral]
03ff4d1e6784 eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents: 54230
diff changeset
   983
  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
   984
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   985
lemma Standard_of_nat [simp]: "of_nat n \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   986
by (simp add: star_of_nat_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   987
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   988
lemma star_of_of_nat [simp]: "star_of (of_nat n) = of_nat n"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   989
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   990
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   991
lemma star_of_int_def [transfer_unfold]: "of_int z = star_of (of_int z)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   992
by (rule_tac z=z in int_diff_cases, simp)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   993
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   994
lemma Standard_of_int [simp]: "of_int z \<in> Standard"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   995
by (simp add: star_of_int_def)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   996
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   997
lemma star_of_of_int [simp]: "star_of (of_int z) = of_int z"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   998
by transfer (rule refl)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   999
38621
d6cb7e625d75 more concise characterization of of_nat operation and class semiring_char_0
haftmann
parents: 37765
diff changeset
  1000
instance star :: (semiring_char_0) semiring_char_0 proof
d6cb7e625d75 more concise characterization of of_nat operation and class semiring_char_0
haftmann
parents: 37765
diff changeset
  1001
  have "inj (star_of :: 'a \<Rightarrow> 'a star)" by (rule injI) simp
d6cb7e625d75 more concise characterization of of_nat operation and class semiring_char_0
haftmann
parents: 37765
diff changeset
  1002
  then have "inj (star_of \<circ> of_nat :: nat \<Rightarrow> 'a star)" using inj_of_nat by (rule inj_comp)
d6cb7e625d75 more concise characterization of of_nat operation and class semiring_char_0
haftmann
parents: 37765
diff changeset
  1003
  then show "inj (of_nat :: nat \<Rightarrow> 'a star)" by (simp add: comp_def)
d6cb7e625d75 more concise characterization of of_nat operation and class semiring_char_0
haftmann
parents: 37765
diff changeset
  1004
qed
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1005
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1006
instance star :: (ring_char_0) ring_char_0 ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1007
59676
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1008
instance star :: (semiring_parity) semiring_parity
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1009
apply intro_classes
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1010
apply(transfer, rule odd_one)
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1011
apply(transfer, erule (1) odd_even_add)
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1012
apply(transfer, erule even_multD)
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1013
apply(transfer, erule odd_ex_decrement)
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1014
done
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1015
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1016
instance star :: (semiring_div_parity) semiring_div_parity
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1017
apply intro_classes
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1018
apply(transfer, rule parity)
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1019
apply(transfer, rule one_mod_two_eq_one)
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1020
apply(transfer, rule zero_not_eq_two)
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1021
done
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1022
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1023
instance star :: (semiring_numeral_div) semiring_numeral_div
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1024
apply intro_classes
59816
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
  1025
apply(transfer, fact semiring_numeral_div_class.le_add_diff_inverse2)
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
  1026
apply(transfer, fact semiring_numeral_div_class.div_less)
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
  1027
apply(transfer, fact semiring_numeral_div_class.mod_less)
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
  1028
apply(transfer, fact semiring_numeral_div_class.div_positive)
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
  1029
apply(transfer, fact semiring_numeral_div_class.mod_less_eq_dividend)
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
  1030
apply(transfer, fact semiring_numeral_div_class.pos_mod_bound)
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
  1031
apply(transfer, fact semiring_numeral_div_class.pos_mod_sign)
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
  1032
apply(transfer, fact semiring_numeral_div_class.mod_mult2_eq)
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
  1033
apply(transfer, fact semiring_numeral_div_class.div_mult2_eq)
034b13f4efae distributivity of partial minus establishes desired properties of dvd in semirings
haftmann
parents: 59815
diff changeset
  1034
apply(transfer, fact discrete)
59676
4762c690a75c more type class instances
Andreas Lochbihler
parents: 59557
diff changeset
  1035
done
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1036
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1037
subsection {* Finite class *}
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1038
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1039
lemma starset_finite: "finite A \<Longrightarrow> *s* A = star_of ` A"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1040
by (erule finite_induct, simp_all)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1041
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1042
instance star :: (finite) finite
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1043
apply (intro_classes)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1044
apply (subst starset_UNIV [symmetric])
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1045
apply (subst starset_finite [OF finite])
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1046
apply (rule finite_imageI [OF finite])
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1047
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1048
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
  1049
end