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