global class syntax
authorhaftmann
Tue Oct 16 23:12:45 2007 +0200 (2007-10-16)
changeset 25062af5ef0d4d655
parent 25061 250e1da3204b
child 25063 8e702c7adc34
global class syntax
NEWS
src/HOL/Dense_Linear_Order.thy
src/HOL/Divides.thy
src/HOL/Finite_Set.thy
src/HOL/HOL.thy
src/HOL/Hyperreal/HDeriv.thy
src/HOL/Hyperreal/HLim.thy
src/HOL/Hyperreal/NSA.thy
src/HOL/Hyperreal/Transcendental.thy
src/HOL/Lattices.thy
src/HOL/Library/Kleene_Algebras.thy
src/HOL/Library/Quicksort.thy
src/HOL/Library/Quotient.thy
src/HOL/List.thy
src/HOL/Nat.thy
src/HOL/OrderedGroup.thy
src/HOL/Orderings.thy
src/HOL/Power.thy
src/HOL/Real/RealVector.thy
src/HOL/Ring_and_Field.thy
src/HOL/SetInterval.thy
src/HOL/Wellfounded_Relations.thy
src/HOL/ex/Classpackage.thy
src/Pure/Isar/class.ML
     1.1 --- a/NEWS	Tue Oct 16 23:12:38 2007 +0200
     1.2 +++ b/NEWS	Tue Oct 16 23:12:45 2007 +0200
     1.3 @@ -109,6 +109,24 @@
     1.4  
     1.5  *** Pure ***
     1.6  
     1.7 +* Class-context aware syntax for class target ("user space type system"):
     1.8 +Local operations in class context (fixes, definitions, axiomatizations,
     1.9 +abbreviations) are identified with their global counterparts during reading and
    1.10 +printing of terms.  Practically, this allows to use the same syntax for
    1.11 +both local *and* global operations.  Syntax declarations referring directly to
    1.12 +local fixes, definitions, axiomatizations and abbreviations are applied to their
    1.13 +global counterparts instead (but explicit notation declarations still are local);
    1.14 +the special treatment of \<^loc> in local syntax declarations has been abandoned.
    1.15 +INCOMPATIBILITY.  Most affected theories shall work after the following
    1.16 +purgatory:
    1.17 +
    1.18 +    perl -i -pe 's/\\<\^loc>//g;' THYFILENAME1 THYFILENAME2 ...
    1.19 +
    1.20 +Current limitations:
    1.21 +- printing of local abbreviations sometimes yields unexpected results.
    1.22 +- some facilities (e.g. attribute of, legacy tac-methods) still do not use
    1.23 +canonical interfaces for printing and reading terms.
    1.24 +
    1.25  * Code generator: consts in 'consts_code' Isar commands are now
    1.26  referred to by usual term syntax (including optional type
    1.27  annotations).
    1.28 @@ -116,7 +134,7 @@
    1.29  * Code generator: basic definitions (from 'definition', 'constdefs',
    1.30  or primitive 'instance' definitions) are added automatically to the
    1.31  table of defining equations.  Primitive defs are not used as defining
    1.32 -equations by default any longer.  defining equations are now definitly
    1.33 +equations by default any longer.  Defining equations are now definitly
    1.34  restricted to meta "==" and object equality "=".
    1.35  
    1.36  * The 'class' package offers a combination of axclass and locale to
     2.1 --- a/src/HOL/Dense_Linear_Order.thy	Tue Oct 16 23:12:38 2007 +0200
     2.2 +++ b/src/HOL/Dense_Linear_Order.thy	Tue Oct 16 23:12:45 2007 +0200
     2.3 @@ -22,153 +22,153 @@
     2.4  context linorder
     2.5  begin
     2.6  
     2.7 -lemma less_not_permute: "\<not> (x \<^loc>< y \<and> y \<^loc>< x)" by (simp add: not_less linear)
     2.8 +lemma less_not_permute: "\<not> (x < y \<and> y < x)" by (simp add: not_less linear)
     2.9  
    2.10  lemma gather_simps: 
    2.11    shows 
    2.12 -  "(\<exists>x. (\<forall>y \<in> L. y \<^loc>< x) \<and> (\<forall>y \<in> U. x \<^loc>< y) \<and> x \<^loc>< u \<and> P x) \<longleftrightarrow> (\<exists>x. (\<forall>y \<in> L. y \<^loc>< x) \<and> (\<forall>y \<in> (insert u U). x \<^loc>< y) \<and> P x)"
    2.13 -  and "(\<exists>x. (\<forall>y \<in> L. y \<^loc>< x) \<and> (\<forall>y \<in> U. x \<^loc>< y) \<and> l \<^loc>< x \<and> P x) \<longleftrightarrow> (\<exists>x. (\<forall>y \<in> (insert l L). y \<^loc>< x) \<and> (\<forall>y \<in> U. x \<^loc>< y) \<and> P x)"
    2.14 -  "(\<exists>x. (\<forall>y \<in> L. y \<^loc>< x) \<and> (\<forall>y \<in> U. x \<^loc>< y) \<and> x \<^loc>< u) \<longleftrightarrow> (\<exists>x. (\<forall>y \<in> L. y \<^loc>< x) \<and> (\<forall>y \<in> (insert u U). x \<^loc>< y))"
    2.15 -  and "(\<exists>x. (\<forall>y \<in> L. y \<^loc>< x) \<and> (\<forall>y \<in> U. x \<^loc>< y) \<and> l \<^loc>< x) \<longleftrightarrow> (\<exists>x. (\<forall>y \<in> (insert l L). y \<^loc>< x) \<and> (\<forall>y \<in> U. x \<^loc>< y))"  by auto
    2.16 +  "(\<exists>x. (\<forall>y \<in> L. y < x) \<and> (\<forall>y \<in> U. x < y) \<and> x < u \<and> P x) \<longleftrightarrow> (\<exists>x. (\<forall>y \<in> L. y < x) \<and> (\<forall>y \<in> (insert u U). x < y) \<and> P x)"
    2.17 +  and "(\<exists>x. (\<forall>y \<in> L. y < x) \<and> (\<forall>y \<in> U. x < y) \<and> l < x \<and> P x) \<longleftrightarrow> (\<exists>x. (\<forall>y \<in> (insert l L). y < x) \<and> (\<forall>y \<in> U. x < y) \<and> P x)"
    2.18 +  "(\<exists>x. (\<forall>y \<in> L. y < x) \<and> (\<forall>y \<in> U. x < y) \<and> x < u) \<longleftrightarrow> (\<exists>x. (\<forall>y \<in> L. y < x) \<and> (\<forall>y \<in> (insert u U). x < y))"
    2.19 +  and "(\<exists>x. (\<forall>y \<in> L. y < x) \<and> (\<forall>y \<in> U. x < y) \<and> l < x) \<longleftrightarrow> (\<exists>x. (\<forall>y \<in> (insert l L). y < x) \<and> (\<forall>y \<in> U. x < y))"  by auto
    2.20  
    2.21  lemma 
    2.22 -  gather_start: "(\<exists>x. P x) \<equiv> (\<exists>x. (\<forall>y \<in> {}. y \<^loc>< x) \<and> (\<forall>y\<in> {}. x \<^loc>< y) \<and> P x)" 
    2.23 +  gather_start: "(\<exists>x. P x) \<equiv> (\<exists>x. (\<forall>y \<in> {}. y < x) \<and> (\<forall>y\<in> {}. x < y) \<and> P x)" 
    2.24    by simp
    2.25  
    2.26 -text{* Theorems for @{text "\<exists>z. \<forall>x. x \<^loc>< z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>-\<infinity>\<^esub>)"}*}
    2.27 -lemma minf_lt:  "\<exists>z . \<forall>x. x \<^loc>< z \<longrightarrow> (x \<^loc>< t \<longleftrightarrow> True)" by auto
    2.28 -lemma minf_gt: "\<exists>z . \<forall>x. x \<^loc>< z \<longrightarrow>  (t \<^loc>< x \<longleftrightarrow>  False)"
    2.29 +text{* Theorems for @{text "\<exists>z. \<forall>x. x < z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>-\<infinity>\<^esub>)"}*}
    2.30 +lemma minf_lt:  "\<exists>z . \<forall>x. x < z \<longrightarrow> (x < t \<longleftrightarrow> True)" by auto
    2.31 +lemma minf_gt: "\<exists>z . \<forall>x. x < z \<longrightarrow>  (t < x \<longleftrightarrow>  False)"
    2.32    by (simp add: not_less) (rule exI[where x="t"], auto simp add: less_le)
    2.33  
    2.34 -lemma minf_le: "\<exists>z. \<forall>x. x \<^loc>< z \<longrightarrow> (x \<^loc>\<le> t \<longleftrightarrow> True)" by (auto simp add: less_le)
    2.35 -lemma minf_ge: "\<exists>z. \<forall>x. x \<^loc>< z \<longrightarrow> (t \<^loc>\<le> x \<longleftrightarrow> False)"
    2.36 +lemma minf_le: "\<exists>z. \<forall>x. x < z \<longrightarrow> (x \<le> t \<longleftrightarrow> True)" by (auto simp add: less_le)
    2.37 +lemma minf_ge: "\<exists>z. \<forall>x. x < z \<longrightarrow> (t \<le> x \<longleftrightarrow> False)"
    2.38    by (auto simp add: less_le not_less not_le)
    2.39 -lemma minf_eq: "\<exists>z. \<forall>x. x \<^loc>< z \<longrightarrow> (x = t \<longleftrightarrow> False)" by auto
    2.40 -lemma minf_neq: "\<exists>z. \<forall>x. x \<^loc>< z \<longrightarrow> (x \<noteq> t \<longleftrightarrow> True)" by auto
    2.41 -lemma minf_P: "\<exists>z. \<forall>x. x \<^loc>< z \<longrightarrow> (P \<longleftrightarrow> P)" by blast
    2.42 +lemma minf_eq: "\<exists>z. \<forall>x. x < z \<longrightarrow> (x = t \<longleftrightarrow> False)" by auto
    2.43 +lemma minf_neq: "\<exists>z. \<forall>x. x < z \<longrightarrow> (x \<noteq> t \<longleftrightarrow> True)" by auto
    2.44 +lemma minf_P: "\<exists>z. \<forall>x. x < z \<longrightarrow> (P \<longleftrightarrow> P)" by blast
    2.45  
    2.46 -text{* Theorems for @{text "\<exists>z. \<forall>x. x \<^loc>< z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>+\<infinity>\<^esub>)"}*}
    2.47 -lemma pinf_gt:  "\<exists>z . \<forall>x. z \<^loc>< x \<longrightarrow> (t \<^loc>< x \<longleftrightarrow> True)" by auto
    2.48 -lemma pinf_lt: "\<exists>z . \<forall>x. z \<^loc>< x \<longrightarrow>  (x \<^loc>< t \<longleftrightarrow>  False)"
    2.49 +text{* Theorems for @{text "\<exists>z. \<forall>x. x < z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>+\<infinity>\<^esub>)"}*}
    2.50 +lemma pinf_gt:  "\<exists>z . \<forall>x. z < x \<longrightarrow> (t < x \<longleftrightarrow> True)" by auto
    2.51 +lemma pinf_lt: "\<exists>z . \<forall>x. z < x \<longrightarrow>  (x < t \<longleftrightarrow>  False)"
    2.52    by (simp add: not_less) (rule exI[where x="t"], auto simp add: less_le)
    2.53  
    2.54 -lemma pinf_ge: "\<exists>z. \<forall>x. z \<^loc>< x \<longrightarrow> (t \<^loc>\<le> x \<longleftrightarrow> True)" by (auto simp add: less_le)
    2.55 -lemma pinf_le: "\<exists>z. \<forall>x. z \<^loc>< x \<longrightarrow> (x \<^loc>\<le> t \<longleftrightarrow> False)"
    2.56 +lemma pinf_ge: "\<exists>z. \<forall>x. z < x \<longrightarrow> (t \<le> x \<longleftrightarrow> True)" by (auto simp add: less_le)
    2.57 +lemma pinf_le: "\<exists>z. \<forall>x. z < x \<longrightarrow> (x \<le> t \<longleftrightarrow> False)"
    2.58    by (auto simp add: less_le not_less not_le)
    2.59 -lemma pinf_eq: "\<exists>z. \<forall>x. z \<^loc>< x \<longrightarrow> (x = t \<longleftrightarrow> False)" by auto
    2.60 -lemma pinf_neq: "\<exists>z. \<forall>x. z \<^loc>< x \<longrightarrow> (x \<noteq> t \<longleftrightarrow> True)" by auto
    2.61 -lemma pinf_P: "\<exists>z. \<forall>x. z \<^loc>< x \<longrightarrow> (P \<longleftrightarrow> P)" by blast
    2.62 +lemma pinf_eq: "\<exists>z. \<forall>x. z < x \<longrightarrow> (x = t \<longleftrightarrow> False)" by auto
    2.63 +lemma pinf_neq: "\<exists>z. \<forall>x. z < x \<longrightarrow> (x \<noteq> t \<longleftrightarrow> True)" by auto
    2.64 +lemma pinf_P: "\<exists>z. \<forall>x. z < x \<longrightarrow> (P \<longleftrightarrow> P)" by blast
    2.65  
    2.66 -lemma nmi_lt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> x \<^loc>< t \<longrightarrow>  (\<exists> u\<in> U. u \<^loc>\<le> x)" by auto
    2.67 -lemma nmi_gt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and> t \<^loc>< x \<longrightarrow>  (\<exists> u\<in> U. u \<^loc>\<le> x)"
    2.68 +lemma nmi_lt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> x < t \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
    2.69 +lemma nmi_gt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and> t < x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)"
    2.70    by (auto simp add: le_less)
    2.71 -lemma  nmi_le: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> x\<^loc>\<le> t \<longrightarrow>  (\<exists> u\<in> U. u \<^loc>\<le> x)" by auto
    2.72 -lemma  nmi_ge: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and> t\<^loc>\<le> x \<longrightarrow>  (\<exists> u\<in> U. u \<^loc>\<le> x)" by auto
    2.73 -lemma  nmi_eq: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x = t \<longrightarrow>  (\<exists> u\<in> U. u \<^loc>\<le> x)" by auto
    2.74 -lemma  nmi_neq: "t \<in> U \<Longrightarrow>\<forall>x. \<not>True \<and> x \<noteq> t \<longrightarrow>  (\<exists> u\<in> U. u \<^loc>\<le> x)" by auto
    2.75 -lemma  nmi_P: "\<forall> x. ~P \<and> P \<longrightarrow>  (\<exists> u\<in> U. u \<^loc>\<le> x)" by auto
    2.76 -lemma  nmi_conj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. u \<^loc>\<le> x) ;
    2.77 -  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. u \<^loc>\<le> x)\<rbrakk> \<Longrightarrow>
    2.78 -  \<forall>x. \<not>(P1' \<and> P2') \<and> (P1 x \<and> P2 x) \<longrightarrow>  (\<exists> u\<in> U. u \<^loc>\<le> x)" by auto
    2.79 -lemma  nmi_disj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. u \<^loc>\<le> x) ;
    2.80 -  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. u \<^loc>\<le> x)\<rbrakk> \<Longrightarrow>
    2.81 -  \<forall>x. \<not>(P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow>  (\<exists> u\<in> U. u \<^loc>\<le> x)" by auto
    2.82 +lemma  nmi_le: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> x\<le> t \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
    2.83 +lemma  nmi_ge: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and> t\<le> x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
    2.84 +lemma  nmi_eq: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x = t \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
    2.85 +lemma  nmi_neq: "t \<in> U \<Longrightarrow>\<forall>x. \<not>True \<and> x \<noteq> t \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
    2.86 +lemma  nmi_P: "\<forall> x. ~P \<and> P \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
    2.87 +lemma  nmi_conj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x) ;
    2.88 +  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)\<rbrakk> \<Longrightarrow>
    2.89 +  \<forall>x. \<not>(P1' \<and> P2') \<and> (P1 x \<and> P2 x) \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
    2.90 +lemma  nmi_disj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x) ;
    2.91 +  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)\<rbrakk> \<Longrightarrow>
    2.92 +  \<forall>x. \<not>(P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
    2.93  
    2.94 -lemma  npi_lt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x \<^loc>< t \<longrightarrow>  (\<exists> u\<in> U. x \<^loc>\<le> u)" by (auto simp add: le_less)
    2.95 -lemma  npi_gt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> t \<^loc>< x \<longrightarrow>  (\<exists> u\<in> U. x \<^loc>\<le> u)" by auto
    2.96 -lemma  npi_le: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x \<^loc>\<le> t \<longrightarrow>  (\<exists> u\<in> U. x \<^loc>\<le> u)" by auto
    2.97 -lemma  npi_ge: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> t \<^loc>\<le> x \<longrightarrow>  (\<exists> u\<in> U. x \<^loc>\<le> u)" by auto
    2.98 -lemma  npi_eq: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x = t \<longrightarrow>  (\<exists> u\<in> U. x \<^loc>\<le> u)" by auto
    2.99 -lemma  npi_neq: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> x \<noteq> t \<longrightarrow>  (\<exists> u\<in> U. x \<^loc>\<le> u )" by auto
   2.100 -lemma  npi_P: "\<forall> x. ~P \<and> P \<longrightarrow>  (\<exists> u\<in> U. x \<^loc>\<le> u)" by auto
   2.101 -lemma  npi_conj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. x \<^loc>\<le> u) ;  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. x \<^loc>\<le> u)\<rbrakk>
   2.102 -  \<Longrightarrow>  \<forall>x. \<not>(P1' \<and> P2') \<and> (P1 x \<and> P2 x) \<longrightarrow>  (\<exists> u\<in> U. x \<^loc>\<le> u)" by auto
   2.103 -lemma  npi_disj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. x \<^loc>\<le> u) ; \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. x \<^loc>\<le> u)\<rbrakk>
   2.104 -  \<Longrightarrow> \<forall>x. \<not>(P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow>  (\<exists> u\<in> U. x \<^loc>\<le> u)" by auto
   2.105 +lemma  npi_lt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x < t \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by (auto simp add: le_less)
   2.106 +lemma  npi_gt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> t < x \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
   2.107 +lemma  npi_le: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x \<le> t \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
   2.108 +lemma  npi_ge: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> t \<le> x \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
   2.109 +lemma  npi_eq: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x = t \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
   2.110 +lemma  npi_neq: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> x \<noteq> t \<longrightarrow>  (\<exists> u\<in> U. x \<le> u )" by auto
   2.111 +lemma  npi_P: "\<forall> x. ~P \<and> P \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
   2.112 +lemma  npi_conj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. x \<le> u) ;  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)\<rbrakk>
   2.113 +  \<Longrightarrow>  \<forall>x. \<not>(P1' \<and> P2') \<and> (P1 x \<and> P2 x) \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
   2.114 +lemma  npi_disj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. x \<le> u) ; \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)\<rbrakk>
   2.115 +  \<Longrightarrow> \<forall>x. \<not>(P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
   2.116  
   2.117 -lemma lin_dense_lt: "t \<in> U \<Longrightarrow> \<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t \<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> x \<^loc>< t \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> y \<^loc>< t)"
   2.118 +lemma lin_dense_lt: "t \<in> U \<Longrightarrow> \<forall>x l u. (\<forall> t. l < t \<and> t < u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> x < t \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> y < t)"
   2.119  proof(clarsimp)
   2.120 -  fix x l u y  assume tU: "t \<in> U" and noU: "\<forall>t. l \<^loc>< t \<and> t \<^loc>< u \<longrightarrow> t \<notin> U" and lx: "l \<^loc>< x"
   2.121 -    and xu: "x\<^loc><u"  and px: "x \<^loc>< t" and ly: "l\<^loc><y" and yu:"y \<^loc>< u"
   2.122 +  fix x l u y  assume tU: "t \<in> U" and noU: "\<forall>t. l < t \<and> t < u \<longrightarrow> t \<notin> U" and lx: "l < x"
   2.123 +    and xu: "x<u"  and px: "x < t" and ly: "l<y" and yu:"y < u"
   2.124    from tU noU ly yu have tny: "t\<noteq>y" by auto
   2.125 -  {assume H: "t \<^loc>< y"
   2.126 +  {assume H: "t < y"
   2.127      from less_trans[OF lx px] less_trans[OF H yu]
   2.128 -    have "l \<^loc>< t \<and> t \<^loc>< u"  by simp
   2.129 +    have "l < t \<and> t < u"  by simp
   2.130      with tU noU have "False" by auto}
   2.131 -  hence "\<not> t \<^loc>< y"  by auto hence "y \<^loc>\<le> t" by (simp add: not_less)
   2.132 -  thus "y \<^loc>< t" using tny by (simp add: less_le)
   2.133 +  hence "\<not> t < y"  by auto hence "y \<le> t" by (simp add: not_less)
   2.134 +  thus "y < t" using tny by (simp add: less_le)
   2.135  qed
   2.136  
   2.137 -lemma lin_dense_gt: "t \<in> U \<Longrightarrow> \<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l \<^loc>< x \<and> x \<^loc>< u \<and> t \<^loc>< x \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> t \<^loc>< y)"
   2.138 +lemma lin_dense_gt: "t \<in> U \<Longrightarrow> \<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l < x \<and> x < u \<and> t < x \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> t < y)"
   2.139  proof(clarsimp)
   2.140    fix x l u y
   2.141 -  assume tU: "t \<in> U" and noU: "\<forall>t. l \<^loc>< t \<and> t \<^loc>< u \<longrightarrow> t \<notin> U" and lx: "l \<^loc>< x" and xu: "x\<^loc><u"
   2.142 -  and px: "t \<^loc>< x" and ly: "l\<^loc><y" and yu:"y \<^loc>< u"
   2.143 +  assume tU: "t \<in> U" and noU: "\<forall>t. l < t \<and> t < u \<longrightarrow> t \<notin> U" and lx: "l < x" and xu: "x<u"
   2.144 +  and px: "t < x" and ly: "l<y" and yu:"y < u"
   2.145    from tU noU ly yu have tny: "t\<noteq>y" by auto
   2.146 -  {assume H: "y\<^loc>< t"
   2.147 -    from less_trans[OF ly H] less_trans[OF px xu] have "l \<^loc>< t \<and> t \<^loc>< u" by simp
   2.148 +  {assume H: "y< t"
   2.149 +    from less_trans[OF ly H] less_trans[OF px xu] have "l < t \<and> t < u" by simp
   2.150      with tU noU have "False" by auto}
   2.151 -  hence "\<not> y\<^loc><t"  by auto hence "t \<^loc>\<le> y" by (auto simp add: not_less)
   2.152 -  thus "t \<^loc>< y" using tny by (simp add:less_le)
   2.153 +  hence "\<not> y<t"  by auto hence "t \<le> y" by (auto simp add: not_less)
   2.154 +  thus "t < y" using tny by (simp add:less_le)
   2.155  qed
   2.156  
   2.157 -lemma lin_dense_le: "t \<in> U \<Longrightarrow> \<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> x \<^loc>\<le> t \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> y\<^loc>\<le> t)"
   2.158 +lemma lin_dense_le: "t \<in> U \<Longrightarrow> \<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> x \<le> t \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> y\<le> t)"
   2.159  proof(clarsimp)
   2.160    fix x l u y
   2.161 -  assume tU: "t \<in> U" and noU: "\<forall>t. l \<^loc>< t \<and> t \<^loc>< u \<longrightarrow> t \<notin> U" and lx: "l \<^loc>< x" and xu: "x\<^loc><u"
   2.162 -  and px: "x \<^loc>\<le> t" and ly: "l\<^loc><y" and yu:"y \<^loc>< u"
   2.163 +  assume tU: "t \<in> U" and noU: "\<forall>t. l < t \<and> t < u \<longrightarrow> t \<notin> U" and lx: "l < x" and xu: "x<u"
   2.164 +  and px: "x \<le> t" and ly: "l<y" and yu:"y < u"
   2.165    from tU noU ly yu have tny: "t\<noteq>y" by auto
   2.166 -  {assume H: "t \<^loc>< y"
   2.167 +  {assume H: "t < y"
   2.168      from less_le_trans[OF lx px] less_trans[OF H yu]
   2.169 -    have "l \<^loc>< t \<and> t \<^loc>< u" by simp
   2.170 +    have "l < t \<and> t < u" by simp
   2.171      with tU noU have "False" by auto}
   2.172 -  hence "\<not> t \<^loc>< y"  by auto thus "y \<^loc>\<le> t" by (simp add: not_less)
   2.173 +  hence "\<not> t < y"  by auto thus "y \<le> t" by (simp add: not_less)
   2.174  qed
   2.175  
   2.176 -lemma lin_dense_ge: "t \<in> U \<Longrightarrow> \<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> t \<^loc>\<le> x \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> t \<^loc>\<le> y)"
   2.177 +lemma lin_dense_ge: "t \<in> U \<Longrightarrow> \<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> t \<le> x \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> t \<le> y)"
   2.178  proof(clarsimp)
   2.179    fix x l u y
   2.180 -  assume tU: "t \<in> U" and noU: "\<forall>t. l \<^loc>< t \<and> t \<^loc>< u \<longrightarrow> t \<notin> U" and lx: "l \<^loc>< x" and xu: "x\<^loc><u"
   2.181 -  and px: "t \<^loc>\<le> x" and ly: "l\<^loc><y" and yu:"y \<^loc>< u"
   2.182 +  assume tU: "t \<in> U" and noU: "\<forall>t. l < t \<and> t < u \<longrightarrow> t \<notin> U" and lx: "l < x" and xu: "x<u"
   2.183 +  and px: "t \<le> x" and ly: "l<y" and yu:"y < u"
   2.184    from tU noU ly yu have tny: "t\<noteq>y" by auto
   2.185 -  {assume H: "y\<^loc>< t"
   2.186 +  {assume H: "y< t"
   2.187      from less_trans[OF ly H] le_less_trans[OF px xu]
   2.188 -    have "l \<^loc>< t \<and> t \<^loc>< u" by simp
   2.189 +    have "l < t \<and> t < u" by simp
   2.190      with tU noU have "False" by auto}
   2.191 -  hence "\<not> y\<^loc><t"  by auto thus "t \<^loc>\<le> y" by (simp add: not_less)
   2.192 +  hence "\<not> y<t"  by auto thus "t \<le> y" by (simp add: not_less)
   2.193  qed
   2.194 -lemma lin_dense_eq: "t \<in> U \<Longrightarrow> \<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> x = t   \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> y= t)"  by auto
   2.195 -lemma lin_dense_neq: "t \<in> U \<Longrightarrow> \<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> x \<noteq> t   \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> y\<noteq> t)"  by auto
   2.196 -lemma lin_dense_P: "\<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> P   \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> P)"  by auto
   2.197 +lemma lin_dense_eq: "t \<in> U \<Longrightarrow> \<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> x = t   \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> y= t)"  by auto
   2.198 +lemma lin_dense_neq: "t \<in> U \<Longrightarrow> \<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> x \<noteq> t   \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> y\<noteq> t)"  by auto
   2.199 +lemma lin_dense_P: "\<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> P   \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P)"  by auto
   2.200  
   2.201  lemma lin_dense_conj:
   2.202 -  "\<lbrakk>\<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> P1 x
   2.203 -  \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> P1 y) ;
   2.204 -  \<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> P2 x
   2.205 -  \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> P2 y)\<rbrakk> \<Longrightarrow>
   2.206 -  \<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> (P1 x \<and> P2 x)
   2.207 -  \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> (P1 y \<and> P2 y))"
   2.208 +  "\<lbrakk>\<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> P1 x
   2.209 +  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P1 y) ;
   2.210 +  \<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> P2 x
   2.211 +  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P2 y)\<rbrakk> \<Longrightarrow>
   2.212 +  \<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> (P1 x \<and> P2 x)
   2.213 +  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> (P1 y \<and> P2 y))"
   2.214    by blast
   2.215  lemma lin_dense_disj:
   2.216 -  "\<lbrakk>\<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> P1 x
   2.217 -  \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> P1 y) ;
   2.218 -  \<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> P2 x
   2.219 -  \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> P2 y)\<rbrakk> \<Longrightarrow>
   2.220 -  \<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> (P1 x \<or> P2 x)
   2.221 -  \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> (P1 y \<or> P2 y))"
   2.222 +  "\<lbrakk>\<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> P1 x
   2.223 +  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P1 y) ;
   2.224 +  \<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> P2 x
   2.225 +  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P2 y)\<rbrakk> \<Longrightarrow>
   2.226 +  \<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> (P1 x \<or> P2 x)
   2.227 +  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> (P1 y \<or> P2 y))"
   2.228    by blast
   2.229  
   2.230 -lemma npmibnd: "\<lbrakk>\<forall>x. \<not> MP \<and> P x \<longrightarrow> (\<exists> u\<in> U. u \<^loc>\<le> x); \<forall>x. \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. x \<^loc>\<le> u)\<rbrakk>
   2.231 -  \<Longrightarrow> \<forall>x. \<not> MP \<and> \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. \<exists> u' \<in> U. u \<^loc>\<le> x \<and> x \<^loc>\<le> u')"
   2.232 +lemma npmibnd: "\<lbrakk>\<forall>x. \<not> MP \<and> P x \<longrightarrow> (\<exists> u\<in> U. u \<le> x); \<forall>x. \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. x \<le> u)\<rbrakk>
   2.233 +  \<Longrightarrow> \<forall>x. \<not> MP \<and> \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. \<exists> u' \<in> U. u \<le> x \<and> x \<le> u')"
   2.234  by auto
   2.235  
   2.236  lemma finite_set_intervals:
   2.237 -  assumes px: "P x" and lx: "l \<^loc>\<le> x" and xu: "x \<^loc>\<le> u" and linS: "l\<in> S"
   2.238 -  and uinS: "u \<in> S" and fS:"finite S" and lS: "\<forall> x\<in> S. l \<^loc>\<le> x" and Su: "\<forall> x\<in> S. x \<^loc>\<le> u"
   2.239 -  shows "\<exists> a \<in> S. \<exists> b \<in> S. (\<forall> y. a \<^loc>< y \<and> y \<^loc>< b \<longrightarrow> y \<notin> S) \<and> a \<^loc>\<le> x \<and> x \<^loc>\<le> b \<and> P x"
   2.240 +  assumes px: "P x" and lx: "l \<le> x" and xu: "x \<le> u" and linS: "l\<in> S"
   2.241 +  and uinS: "u \<in> S" and fS:"finite S" and lS: "\<forall> x\<in> S. l \<le> x" and Su: "\<forall> x\<in> S. x \<le> u"
   2.242 +  shows "\<exists> a \<in> S. \<exists> b \<in> S. (\<forall> y. a < y \<and> y < b \<longrightarrow> y \<notin> S) \<and> a \<le> x \<and> x \<le> b \<and> P x"
   2.243  proof-
   2.244 -  let ?Mx = "{y. y\<in> S \<and> y \<^loc>\<le> x}"
   2.245 -  let ?xM = "{y. y\<in> S \<and> x \<^loc>\<le> y}"
   2.246 +  let ?Mx = "{y. y\<in> S \<and> y \<le> x}"
   2.247 +  let ?xM = "{y. y\<in> S \<and> x \<le> y}"
   2.248    let ?a = "Max ?Mx"
   2.249    let ?b = "Min ?xM"
   2.250    have MxS: "?Mx \<subseteq> S" by blast
   2.251 @@ -179,31 +179,31 @@
   2.252    hence fxM: "finite ?xM" using fS finite_subset by auto
   2.253    from xu uinS have linxM: "u \<in> ?xM" by blast
   2.254    hence xMne: "?xM \<noteq> {}" by blast
   2.255 -  have ax:"?a \<^loc>\<le> x" using Mxne fMx by auto
   2.256 -  have xb:"x \<^loc>\<le> ?b" using xMne fxM by auto
   2.257 +  have ax:"?a \<le> x" using Mxne fMx by auto
   2.258 +  have xb:"x \<le> ?b" using xMne fxM by auto
   2.259    have "?a \<in> ?Mx" using Max_in[OF fMx Mxne] by simp hence ainS: "?a \<in> S" using MxS by blast
   2.260    have "?b \<in> ?xM" using Min_in[OF fxM xMne] by simp hence binS: "?b \<in> S" using xMS by blast
   2.261 -  have noy:"\<forall> y. ?a \<^loc>< y \<and> y \<^loc>< ?b \<longrightarrow> y \<notin> S"
   2.262 +  have noy:"\<forall> y. ?a < y \<and> y < ?b \<longrightarrow> y \<notin> S"
   2.263    proof(clarsimp)
   2.264 -    fix y   assume ay: "?a \<^loc>< y" and yb: "y \<^loc>< ?b" and yS: "y \<in> S"
   2.265 +    fix y   assume ay: "?a < y" and yb: "y < ?b" and yS: "y \<in> S"
   2.266      from yS have "y\<in> ?Mx \<or> y\<in> ?xM" by (auto simp add: linear)
   2.267 -    moreover {assume "y \<in> ?Mx" hence "y \<^loc>\<le> ?a" using Mxne fMx by auto with ay have "False" by (simp add: not_le[symmetric])}
   2.268 -    moreover {assume "y \<in> ?xM" hence "?b \<^loc>\<le> y" using xMne fxM by auto with yb have "False" by (simp add: not_le[symmetric])}
   2.269 +    moreover {assume "y \<in> ?Mx" hence "y \<le> ?a" using Mxne fMx by auto with ay have "False" by (simp add: not_le[symmetric])}
   2.270 +    moreover {assume "y \<in> ?xM" hence "?b \<le> y" using xMne fxM by auto with yb have "False" by (simp add: not_le[symmetric])}
   2.271      ultimately show "False" by blast
   2.272    qed
   2.273    from ainS binS noy ax xb px show ?thesis by blast
   2.274  qed
   2.275  
   2.276  lemma finite_set_intervals2:
   2.277 -  assumes px: "P x" and lx: "l \<^loc>\<le> x" and xu: "x \<^loc>\<le> u" and linS: "l\<in> S"
   2.278 -  and uinS: "u \<in> S" and fS:"finite S" and lS: "\<forall> x\<in> S. l \<^loc>\<le> x" and Su: "\<forall> x\<in> S. x \<^loc>\<le> u"
   2.279 -  shows "(\<exists> s\<in> S. P s) \<or> (\<exists> a \<in> S. \<exists> b \<in> S. (\<forall> y. a \<^loc>< y \<and> y \<^loc>< b \<longrightarrow> y \<notin> S) \<and> a \<^loc>< x \<and> x \<^loc>< b \<and> P x)"
   2.280 +  assumes px: "P x" and lx: "l \<le> x" and xu: "x \<le> u" and linS: "l\<in> S"
   2.281 +  and uinS: "u \<in> S" and fS:"finite S" and lS: "\<forall> x\<in> S. l \<le> x" and Su: "\<forall> x\<in> S. x \<le> u"
   2.282 +  shows "(\<exists> s\<in> S. P s) \<or> (\<exists> a \<in> S. \<exists> b \<in> S. (\<forall> y. a < y \<and> y < b \<longrightarrow> y \<notin> S) \<and> a < x \<and> x < b \<and> P x)"
   2.283  proof-
   2.284    from finite_set_intervals[where P="P", OF px lx xu linS uinS fS lS Su]
   2.285    obtain a and b where
   2.286 -    as: "a\<in> S" and bs: "b\<in> S" and noS:"\<forall>y. a \<^loc>< y \<and> y \<^loc>< b \<longrightarrow> y \<notin> S"
   2.287 -    and axb: "a \<^loc>\<le> x \<and> x \<^loc>\<le> b \<and> P x"  by auto
   2.288 -  from axb have "x= a \<or> x= b \<or> (a \<^loc>< x \<and> x \<^loc>< b)" by (auto simp add: le_less)
   2.289 +    as: "a\<in> S" and bs: "b\<in> S" and noS:"\<forall>y. a < y \<and> y < b \<longrightarrow> y \<notin> S"
   2.290 +    and axb: "a \<le> x \<and> x \<le> b \<and> P x"  by auto
   2.291 +  from axb have "x= a \<or> x= b \<or> (a < x \<and> x < b)" by (auto simp add: le_less)
   2.292    thus ?thesis using px as bs noS by blast
   2.293  qed
   2.294  
   2.295 @@ -216,45 +216,45 @@
   2.296  
   2.297  lemma dlo_qe_bnds: 
   2.298    assumes ne: "L \<noteq> {}" and neU: "U \<noteq> {}" and fL: "finite L" and fU: "finite U"
   2.299 -  shows "(\<exists>x. (\<forall>y \<in> L. y \<^loc>< x) \<and> (\<forall>y \<in> U. x \<^loc>< y)) \<equiv> (\<forall> l \<in> L. \<forall>u \<in> U. l \<^loc>< u)"
   2.300 +  shows "(\<exists>x. (\<forall>y \<in> L. y < x) \<and> (\<forall>y \<in> U. x < y)) \<equiv> (\<forall> l \<in> L. \<forall>u \<in> U. l < u)"
   2.301  proof (simp only: atomize_eq, rule iffI)
   2.302 -  assume H: "\<exists>x. (\<forall>y\<in>L. y \<^loc>< x) \<and> (\<forall>y\<in>U. x \<^loc>< y)"
   2.303 -  then obtain x where xL: "\<forall>y\<in>L. y \<^loc>< x" and xU: "\<forall>y\<in>U. x \<^loc>< y" by blast
   2.304 +  assume H: "\<exists>x. (\<forall>y\<in>L. y < x) \<and> (\<forall>y\<in>U. x < y)"
   2.305 +  then obtain x where xL: "\<forall>y\<in>L. y < x" and xU: "\<forall>y\<in>U. x < y" by blast
   2.306    {fix l u assume l: "l \<in> L" and u: "u \<in> U"
   2.307      from less_trans[OF xL[rule_format, OF l] xU[rule_format, OF u]]
   2.308 -    have "l \<^loc>< u" .}
   2.309 -  thus "\<forall>l\<in>L. \<forall>u\<in>U. l \<^loc>< u" by blast
   2.310 +    have "l < u" .}
   2.311 +  thus "\<forall>l\<in>L. \<forall>u\<in>U. l < u" by blast
   2.312  next
   2.313 -  assume H: "\<forall>l\<in>L. \<forall>u\<in>U. l \<^loc>< u"
   2.314 +  assume H: "\<forall>l\<in>L. \<forall>u\<in>U. l < u"
   2.315    let ?ML = "Max L"
   2.316    let ?MU = "Min U"  
   2.317 -  from fL ne have th1: "?ML \<in> L" and th1': "\<forall>l\<in>L. l \<^loc>\<le> ?ML" by auto
   2.318 -  from fU neU have th2: "?MU \<in> U" and th2': "\<forall>u\<in>U. ?MU \<^loc>\<le> u" by auto
   2.319 -  from th1 th2 H have "?ML \<^loc>< ?MU" by auto
   2.320 -  with dense obtain w where th3: "?ML \<^loc>< w" and th4: "w \<^loc>< ?MU" by blast
   2.321 -  from th3 th1' have "\<forall>l \<in> L. l \<^loc>< w" by auto
   2.322 -  moreover from th4 th2' have "\<forall>u \<in> U. w \<^loc>< u" by auto
   2.323 -  ultimately show "\<exists>x. (\<forall>y\<in>L. y \<^loc>< x) \<and> (\<forall>y\<in>U. x \<^loc>< y)" by auto
   2.324 +  from fL ne have th1: "?ML \<in> L" and th1': "\<forall>l\<in>L. l \<le> ?ML" by auto
   2.325 +  from fU neU have th2: "?MU \<in> U" and th2': "\<forall>u\<in>U. ?MU \<le> u" by auto
   2.326 +  from th1 th2 H have "?ML < ?MU" by auto
   2.327 +  with dense obtain w where th3: "?ML < w" and th4: "w < ?MU" by blast
   2.328 +  from th3 th1' have "\<forall>l \<in> L. l < w" by auto
   2.329 +  moreover from th4 th2' have "\<forall>u \<in> U. w < u" by auto
   2.330 +  ultimately show "\<exists>x. (\<forall>y\<in>L. y < x) \<and> (\<forall>y\<in>U. x < y)" by auto
   2.331  qed
   2.332  
   2.333  lemma dlo_qe_noub: 
   2.334    assumes ne: "L \<noteq> {}" and fL: "finite L"
   2.335 -  shows "(\<exists>x. (\<forall>y \<in> L. y \<^loc>< x) \<and> (\<forall>y \<in> {}. x \<^loc>< y)) \<equiv> True"
   2.336 +  shows "(\<exists>x. (\<forall>y \<in> L. y < x) \<and> (\<forall>y \<in> {}. x < y)) \<equiv> True"
   2.337  proof(simp add: atomize_eq)
   2.338 -  from gt_ex[rule_format, of "Max L"] obtain M where M: "Max L \<^loc>< M" by blast
   2.339 -  from ne fL have "\<forall>x \<in> L. x \<^loc>\<le> Max L" by simp
   2.340 -  with M have "\<forall>x\<in>L. x \<^loc>< M" by (auto intro: le_less_trans)
   2.341 -  thus "\<exists>x. \<forall>y\<in>L. y \<^loc>< x" by blast
   2.342 +  from gt_ex[rule_format, of "Max L"] obtain M where M: "Max L < M" by blast
   2.343 +  from ne fL have "\<forall>x \<in> L. x \<le> Max L" by simp
   2.344 +  with M have "\<forall>x\<in>L. x < M" by (auto intro: le_less_trans)
   2.345 +  thus "\<exists>x. \<forall>y\<in>L. y < x" by blast
   2.346  qed
   2.347  
   2.348  lemma dlo_qe_nolb: 
   2.349    assumes ne: "U \<noteq> {}" and fU: "finite U"
   2.350 -  shows "(\<exists>x. (\<forall>y \<in> {}. y \<^loc>< x) \<and> (\<forall>y \<in> U. x \<^loc>< y)) \<equiv> True"
   2.351 +  shows "(\<exists>x. (\<forall>y \<in> {}. y < x) \<and> (\<forall>y \<in> U. x < y)) \<equiv> True"
   2.352  proof(simp add: atomize_eq)
   2.353 -  from lt_ex[rule_format, of "Min U"] obtain M where M: "M \<^loc>< Min U" by blast
   2.354 -  from ne fU have "\<forall>x \<in> U. Min U \<^loc>\<le> x" by simp
   2.355 -  with M have "\<forall>x\<in>U. M \<^loc>< x" by (auto intro: less_le_trans)
   2.356 -  thus "\<exists>x. \<forall>y\<in>U. x \<^loc>< y" by blast
   2.357 +  from lt_ex[rule_format, of "Min U"] obtain M where M: "M < Min U" by blast
   2.358 +  from ne fU have "\<forall>x \<in> U. Min U \<le> x" by simp
   2.359 +  with M have "\<forall>x\<in>U. M < x" by (auto intro: less_le_trans)
   2.360 +  thus "\<exists>x. \<forall>y\<in>U. x < y" by blast
   2.361  qed
   2.362  
   2.363  lemma exists_neq: "\<exists>(x::'a). x \<noteq> t" "\<exists>(x::'a). t \<noteq> x" 
   2.364 @@ -263,7 +263,7 @@
   2.365  lemmas dlo_simps = order_refl less_irrefl not_less not_le exists_neq 
   2.366    le_less neq_iff linear less_not_permute
   2.367  
   2.368 -lemma axiom: "dense_linear_order (op \<^loc>\<le>) (op \<^loc><)" .
   2.369 +lemma axiom: "dense_linear_order (op \<le>) (op <)" .
   2.370  lemma atoms:
   2.371    includes meta_term_syntax
   2.372    shows "TERM (less :: 'a \<Rightarrow> _)"
   2.373 @@ -303,22 +303,22 @@
   2.374  text {* Linear order without upper bounds *}
   2.375  
   2.376  class linorder_no_ub = linorder +
   2.377 -  assumes gt_ex: "\<exists>y. x \<^loc>< y"
   2.378 +  assumes gt_ex: "\<exists>y. x < y"
   2.379  begin
   2.380  
   2.381 -lemma ge_ex: "\<exists>y. x \<^loc>\<le> y" using gt_ex by auto
   2.382 +lemma ge_ex: "\<exists>y. x \<le> y" using gt_ex by auto
   2.383  
   2.384 -text {* Theorems for @{text "\<exists>z. \<forall>x. z \<^loc>< x \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>+\<infinity>\<^esub>)"} *}
   2.385 +text {* Theorems for @{text "\<exists>z. \<forall>x. z < x \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>+\<infinity>\<^esub>)"} *}
   2.386  lemma pinf_conj:
   2.387 -  assumes ex1: "\<exists>z1. \<forall>x. z1 \<^loc>< x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   2.388 -  and ex2: "\<exists>z2. \<forall>x. z2 \<^loc>< x \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
   2.389 -  shows "\<exists>z. \<forall>x. z \<^loc><  x \<longrightarrow> ((P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2'))"
   2.390 +  assumes ex1: "\<exists>z1. \<forall>x. z1 < x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   2.391 +  and ex2: "\<exists>z2. \<forall>x. z2 < x \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
   2.392 +  shows "\<exists>z. \<forall>x. z <  x \<longrightarrow> ((P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2'))"
   2.393  proof-
   2.394 -  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. z1 \<^loc>< x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   2.395 -     and z2: "\<forall>x. z2 \<^loc>< x \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
   2.396 -  from gt_ex obtain z where z:"max z1 z2 \<^loc>< z" by blast
   2.397 -  from z have zz1: "z1 \<^loc>< z" and zz2: "z2 \<^loc>< z" by simp_all
   2.398 -  {fix x assume H: "z \<^loc>< x"
   2.399 +  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. z1 < x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   2.400 +     and z2: "\<forall>x. z2 < x \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
   2.401 +  from gt_ex obtain z where z:"max z1 z2 < z" by blast
   2.402 +  from z have zz1: "z1 < z" and zz2: "z2 < z" by simp_all
   2.403 +  {fix x assume H: "z < x"
   2.404      from less_trans[OF zz1 H] less_trans[OF zz2 H]
   2.405      have "(P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2')"  using z1 zz1 z2 zz2 by auto
   2.406    }
   2.407 @@ -326,25 +326,25 @@
   2.408  qed
   2.409  
   2.410  lemma pinf_disj:
   2.411 -  assumes ex1: "\<exists>z1. \<forall>x. z1 \<^loc>< x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   2.412 -  and ex2: "\<exists>z2. \<forall>x. z2 \<^loc>< x \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
   2.413 -  shows "\<exists>z. \<forall>x. z \<^loc><  x \<longrightarrow> ((P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2'))"
   2.414 +  assumes ex1: "\<exists>z1. \<forall>x. z1 < x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   2.415 +  and ex2: "\<exists>z2. \<forall>x. z2 < x \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
   2.416 +  shows "\<exists>z. \<forall>x. z <  x \<longrightarrow> ((P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2'))"
   2.417  proof-
   2.418 -  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. z1 \<^loc>< x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   2.419 -     and z2: "\<forall>x. z2 \<^loc>< x \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
   2.420 -  from gt_ex obtain z where z:"max z1 z2 \<^loc>< z" by blast
   2.421 -  from z have zz1: "z1 \<^loc>< z" and zz2: "z2 \<^loc>< z" by simp_all
   2.422 -  {fix x assume H: "z \<^loc>< x"
   2.423 +  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. z1 < x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   2.424 +     and z2: "\<forall>x. z2 < x \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
   2.425 +  from gt_ex obtain z where z:"max z1 z2 < z" by blast
   2.426 +  from z have zz1: "z1 < z" and zz2: "z2 < z" by simp_all
   2.427 +  {fix x assume H: "z < x"
   2.428      from less_trans[OF zz1 H] less_trans[OF zz2 H]
   2.429      have "(P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2')"  using z1 zz1 z2 zz2 by auto
   2.430    }
   2.431    thus ?thesis by blast
   2.432  qed
   2.433  
   2.434 -lemma pinf_ex: assumes ex:"\<exists>z. \<forall>x. z \<^loc>< x \<longrightarrow> (P x \<longleftrightarrow> P1)" and p1: P1 shows "\<exists> x. P x"
   2.435 +lemma pinf_ex: assumes ex:"\<exists>z. \<forall>x. z < x \<longrightarrow> (P x \<longleftrightarrow> P1)" and p1: P1 shows "\<exists> x. P x"
   2.436  proof-
   2.437 -  from ex obtain z where z: "\<forall>x. z \<^loc>< x \<longrightarrow> (P x \<longleftrightarrow> P1)" by blast
   2.438 -  from gt_ex obtain x where x: "z \<^loc>< x" by blast
   2.439 +  from ex obtain z where z: "\<forall>x. z < x \<longrightarrow> (P x \<longleftrightarrow> P1)" by blast
   2.440 +  from gt_ex obtain x where x: "z < x" by blast
   2.441    from z x p1 show ?thesis by blast
   2.442  qed
   2.443  
   2.444 @@ -353,22 +353,22 @@
   2.445  text {* Linear order without upper bounds *}
   2.446  
   2.447  class linorder_no_lb = linorder +
   2.448 -  assumes lt_ex: "\<exists>y. y \<^loc>< x"
   2.449 +  assumes lt_ex: "\<exists>y. y < x"
   2.450  begin
   2.451  
   2.452 -lemma le_ex: "\<exists>y. y \<^loc>\<le> x" using lt_ex by auto
   2.453 +lemma le_ex: "\<exists>y. y \<le> x" using lt_ex by auto
   2.454  
   2.455  
   2.456 -text {* Theorems for @{text "\<exists>z. \<forall>x. x \<^loc>< z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>-\<infinity>\<^esub>)"} *}
   2.457 +text {* Theorems for @{text "\<exists>z. \<forall>x. x < z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>-\<infinity>\<^esub>)"} *}
   2.458  lemma minf_conj:
   2.459 -  assumes ex1: "\<exists>z1. \<forall>x. x \<^loc>< z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   2.460 -  and ex2: "\<exists>z2. \<forall>x. x \<^loc>< z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
   2.461 -  shows "\<exists>z. \<forall>x. x \<^loc><  z \<longrightarrow> ((P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2'))"
   2.462 +  assumes ex1: "\<exists>z1. \<forall>x. x < z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   2.463 +  and ex2: "\<exists>z2. \<forall>x. x < z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
   2.464 +  shows "\<exists>z. \<forall>x. x <  z \<longrightarrow> ((P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2'))"
   2.465  proof-
   2.466 -  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. x \<^loc>< z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"and z2: "\<forall>x. x \<^loc>< z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
   2.467 -  from lt_ex obtain z where z:"z \<^loc>< min z1 z2" by blast
   2.468 -  from z have zz1: "z \<^loc>< z1" and zz2: "z \<^loc>< z2" by simp_all
   2.469 -  {fix x assume H: "x \<^loc>< z"
   2.470 +  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. x < z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"and z2: "\<forall>x. x < z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
   2.471 +  from lt_ex obtain z where z:"z < min z1 z2" by blast
   2.472 +  from z have zz1: "z < z1" and zz2: "z < z2" by simp_all
   2.473 +  {fix x assume H: "x < z"
   2.474      from less_trans[OF H zz1] less_trans[OF H zz2]
   2.475      have "(P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2')"  using z1 zz1 z2 zz2 by auto
   2.476    }
   2.477 @@ -376,24 +376,24 @@
   2.478  qed
   2.479  
   2.480  lemma minf_disj:
   2.481 -  assumes ex1: "\<exists>z1. \<forall>x. x \<^loc>< z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   2.482 -  and ex2: "\<exists>z2. \<forall>x. x \<^loc>< z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
   2.483 -  shows "\<exists>z. \<forall>x. x \<^loc><  z \<longrightarrow> ((P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2'))"
   2.484 +  assumes ex1: "\<exists>z1. \<forall>x. x < z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   2.485 +  and ex2: "\<exists>z2. \<forall>x. x < z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
   2.486 +  shows "\<exists>z. \<forall>x. x <  z \<longrightarrow> ((P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2'))"
   2.487  proof-
   2.488 -  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. x \<^loc>< z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"and z2: "\<forall>x. x \<^loc>< z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
   2.489 -  from lt_ex obtain z where z:"z \<^loc>< min z1 z2" by blast
   2.490 -  from z have zz1: "z \<^loc>< z1" and zz2: "z \<^loc>< z2" by simp_all
   2.491 -  {fix x assume H: "x \<^loc>< z"
   2.492 +  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. x < z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"and z2: "\<forall>x. x < z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
   2.493 +  from lt_ex obtain z where z:"z < min z1 z2" by blast
   2.494 +  from z have zz1: "z < z1" and zz2: "z < z2" by simp_all
   2.495 +  {fix x assume H: "x < z"
   2.496      from less_trans[OF H zz1] less_trans[OF H zz2]
   2.497      have "(P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2')"  using z1 zz1 z2 zz2 by auto
   2.498    }
   2.499    thus ?thesis by blast
   2.500  qed
   2.501  
   2.502 -lemma minf_ex: assumes ex:"\<exists>z. \<forall>x. x \<^loc>< z \<longrightarrow> (P x \<longleftrightarrow> P1)" and p1: P1 shows "\<exists> x. P x"
   2.503 +lemma minf_ex: assumes ex:"\<exists>z. \<forall>x. x < z \<longrightarrow> (P x \<longleftrightarrow> P1)" and p1: P1 shows "\<exists> x. P x"
   2.504  proof-
   2.505 -  from ex obtain z where z: "\<forall>x. x \<^loc>< z \<longrightarrow> (P x \<longleftrightarrow> P1)" by blast
   2.506 -  from lt_ex obtain x where x: "x \<^loc>< z" by blast
   2.507 +  from ex obtain z where z: "\<forall>x. x < z \<longrightarrow> (P x \<longleftrightarrow> P1)" by blast
   2.508 +  from lt_ex obtain x where x: "x < z" by blast
   2.509    from z x p1 show ?thesis by blast
   2.510  qed
   2.511  
   2.512 @@ -402,7 +402,7 @@
   2.513  
   2.514  class constr_dense_linear_order = linorder_no_lb + linorder_no_ub +
   2.515    fixes between
   2.516 -  assumes between_less: "x \<^loc>< y \<Longrightarrow> x \<^loc>< between x y \<and> between x y \<^loc>< y"
   2.517 +  assumes between_less: "x < y \<Longrightarrow> x < between x y \<and> between x y < y"
   2.518       and  between_same: "between x x = x"
   2.519  begin
   2.520  
   2.521 @@ -413,41 +413,41 @@
   2.522  
   2.523  lemma rinf_U:
   2.524    assumes fU: "finite U"
   2.525 -  and lin_dense: "\<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> P x
   2.526 -  \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> P y )"
   2.527 -  and nmpiU: "\<forall>x. \<not> MP \<and> \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. \<exists> u' \<in> U. u \<^loc>\<le> x \<and> x \<^loc>\<le> u')"
   2.528 +  and lin_dense: "\<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> P x
   2.529 +  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P y )"
   2.530 +  and nmpiU: "\<forall>x. \<not> MP \<and> \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. \<exists> u' \<in> U. u \<le> x \<and> x \<le> u')"
   2.531    and nmi: "\<not> MP"  and npi: "\<not> PP"  and ex: "\<exists> x.  P x"
   2.532    shows "\<exists> u\<in> U. \<exists> u' \<in> U. P (between u u')"
   2.533  proof-
   2.534    from ex obtain x where px: "P x" by blast
   2.535 -  from px nmi npi nmpiU have "\<exists> u\<in> U. \<exists> u' \<in> U. u \<^loc>\<le> x \<and> x \<^loc>\<le> u'" by auto
   2.536 -  then obtain u and u' where uU:"u\<in> U" and uU': "u' \<in> U" and ux:"u \<^loc>\<le> x" and xu':"x \<^loc>\<le> u'" by auto
   2.537 +  from px nmi npi nmpiU have "\<exists> u\<in> U. \<exists> u' \<in> U. u \<le> x \<and> x \<le> u'" by auto
   2.538 +  then obtain u and u' where uU:"u\<in> U" and uU': "u' \<in> U" and ux:"u \<le> x" and xu':"x \<le> u'" by auto
   2.539    from uU have Une: "U \<noteq> {}" by auto
   2.540    let ?l = "Min U"
   2.541    let ?u = "Max U"
   2.542    have linM: "?l \<in> U" using fU Une by simp
   2.543    have uinM: "?u \<in> U" using fU Une by simp
   2.544 -  have lM: "\<forall> t\<in> U. ?l \<^loc>\<le> t" using Une fU by auto
   2.545 -  have Mu: "\<forall> t\<in> U. t \<^loc>\<le> ?u" using Une fU by auto
   2.546 -  have th:"?l \<^loc>\<le> u" using uU Une lM by auto
   2.547 -  from order_trans[OF th ux] have lx: "?l \<^loc>\<le> x" .
   2.548 -  have th: "u' \<^loc>\<le> ?u" using uU' Une Mu by simp
   2.549 -  from order_trans[OF xu' th] have xu: "x \<^loc>\<le> ?u" .
   2.550 +  have lM: "\<forall> t\<in> U. ?l \<le> t" using Une fU by auto
   2.551 +  have Mu: "\<forall> t\<in> U. t \<le> ?u" using Une fU by auto
   2.552 +  have th:"?l \<le> u" using uU Une lM by auto
   2.553 +  from order_trans[OF th ux] have lx: "?l \<le> x" .
   2.554 +  have th: "u' \<le> ?u" using uU' Une Mu by simp
   2.555 +  from order_trans[OF xu' th] have xu: "x \<le> ?u" .
   2.556    from finite_set_intervals2[where P="P",OF px lx xu linM uinM fU lM Mu]
   2.557    have "(\<exists> s\<in> U. P s) \<or>
   2.558 -      (\<exists> t1\<in> U. \<exists> t2 \<in> U. (\<forall> y. t1 \<^loc>< y \<and> y \<^loc>< t2 \<longrightarrow> y \<notin> U) \<and> t1 \<^loc>< x \<and> x \<^loc>< t2 \<and> P x)" .
   2.559 +      (\<exists> t1\<in> U. \<exists> t2 \<in> U. (\<forall> y. t1 < y \<and> y < t2 \<longrightarrow> y \<notin> U) \<and> t1 < x \<and> x < t2 \<and> P x)" .
   2.560    moreover { fix u assume um: "u\<in>U" and pu: "P u"
   2.561      have "between u u = u" by (simp add: between_same)
   2.562      with um pu have "P (between u u)" by simp
   2.563      with um have ?thesis by blast}
   2.564    moreover{
   2.565 -    assume "\<exists> t1\<in> U. \<exists> t2 \<in> U. (\<forall> y. t1 \<^loc>< y \<and> y \<^loc>< t2 \<longrightarrow> y \<notin> U) \<and> t1 \<^loc>< x \<and> x \<^loc>< t2 \<and> P x"
   2.566 +    assume "\<exists> t1\<in> U. \<exists> t2 \<in> U. (\<forall> y. t1 < y \<and> y < t2 \<longrightarrow> y \<notin> U) \<and> t1 < x \<and> x < t2 \<and> P x"
   2.567        then obtain t1 and t2 where t1M: "t1 \<in> U" and t2M: "t2\<in> U"
   2.568 -        and noM: "\<forall> y. t1 \<^loc>< y \<and> y \<^loc>< t2 \<longrightarrow> y \<notin> U" and t1x: "t1 \<^loc>< x" and xt2: "x \<^loc>< t2" and px: "P x"
   2.569 +        and noM: "\<forall> y. t1 < y \<and> y < t2 \<longrightarrow> y \<notin> U" and t1x: "t1 < x" and xt2: "x < t2" and px: "P x"
   2.570          by blast
   2.571 -      from less_trans[OF t1x xt2] have t1t2: "t1 \<^loc>< t2" .
   2.572 +      from less_trans[OF t1x xt2] have t1t2: "t1 < t2" .
   2.573        let ?u = "between t1 t2"
   2.574 -      from between_less t1t2 have t1lu: "t1 \<^loc>< ?u" and ut2: "?u \<^loc>< t2" by auto
   2.575 +      from between_less t1t2 have t1lu: "t1 < ?u" and ut2: "?u < t2" by auto
   2.576        from lin_dense[rule_format, OF] noM t1x xt2 px t1lu ut2 have "P ?u" by blast
   2.577        with t1M t2M have ?thesis by blast}
   2.578      ultimately show ?thesis by blast
   2.579 @@ -455,11 +455,11 @@
   2.580  
   2.581  theorem fr_eq:
   2.582    assumes fU: "finite U"
   2.583 -  and lin_dense: "\<forall>x l u. (\<forall> t. l \<^loc>< t \<and> t\<^loc>< u \<longrightarrow> t \<notin> U) \<and> l\<^loc>< x \<and> x \<^loc>< u \<and> P x
   2.584 -   \<longrightarrow> (\<forall> y. l \<^loc>< y \<and> y \<^loc>< u \<longrightarrow> P y )"
   2.585 -  and nmibnd: "\<forall>x. \<not> MP \<and> P x \<longrightarrow> (\<exists> u\<in> U. u \<^loc>\<le> x)"
   2.586 -  and npibnd: "\<forall>x. \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. x \<^loc>\<le> u)"
   2.587 -  and mi: "\<exists>z. \<forall>x. x \<^loc>< z \<longrightarrow> (P x = MP)"  and pi: "\<exists>z. \<forall>x. z \<^loc>< x \<longrightarrow> (P x = PP)"
   2.588 +  and lin_dense: "\<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> P x
   2.589 +   \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P y )"
   2.590 +  and nmibnd: "\<forall>x. \<not> MP \<and> P x \<longrightarrow> (\<exists> u\<in> U. u \<le> x)"
   2.591 +  and npibnd: "\<forall>x. \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. x \<le> u)"
   2.592 +  and mi: "\<exists>z. \<forall>x. x < z \<longrightarrow> (P x = MP)"  and pi: "\<exists>z. \<forall>x. z < x \<longrightarrow> (P x = PP)"
   2.593    shows "(\<exists> x. P x) \<equiv> (MP \<or> PP \<or> (\<exists> u \<in> U. \<exists> u'\<in> U. P (between u u')))"
   2.594    (is "_ \<equiv> (_ \<or> _ \<or> ?F)" is "?E \<equiv> ?D")
   2.595  proof-
   2.596 @@ -469,7 +469,7 @@
   2.597     moreover {assume "MP \<or> PP" hence "?D" by blast}
   2.598     moreover {assume nmi: "\<not> MP" and npi: "\<not> PP"
   2.599       from npmibnd[OF nmibnd npibnd]
   2.600 -     have nmpiU: "\<forall>x. \<not> MP \<and> \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. \<exists> u' \<in> U. u \<^loc>\<le> x \<and> x \<^loc>\<le> u')" .
   2.601 +     have nmpiU: "\<forall>x. \<not> MP \<and> \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. \<exists> u' \<in> U. u \<le> x \<and> x \<le> u')" .
   2.602       from rinf_U[OF fU lin_dense nmpiU nmi npi px] have "?D" by blast}
   2.603     ultimately have "?D" by blast}
   2.604   moreover
   2.605 @@ -504,7 +504,7 @@
   2.606  fun simps phi = map (Morphism.thm phi) [@{thm "not_less"}, @{thm "not_le"}]
   2.607  fun generic_whatis phi =
   2.608   let
   2.609 -  val [lt, le] = map (Morphism.term phi) [@{term "op \<^loc><"}, @{term "op \<^loc>\<le>"}]
   2.610 +  val [lt, le] = map (Morphism.term phi) [@{term "op <"}, @{term "op \<le>"}]
   2.611    fun h x t =
   2.612     case term_of t of
   2.613       Const("op =", _)$y$z => if term_of x aconv y then Ferrante_Rackoff_Data.Eq
     3.1 --- a/src/HOL/Divides.thy	Tue Oct 16 23:12:38 2007 +0200
     3.2 +++ b/src/HOL/Divides.thy	Tue Oct 16 23:12:45 2007 +0200
     3.3 @@ -12,8 +12,8 @@
     3.4  begin
     3.5  
     3.6  class div = times +
     3.7 -  fixes div :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<^loc>div" 70)
     3.8 -  fixes mod :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<^loc>mod" 70)
     3.9 +  fixes div :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "div" 70)
    3.10 +  fixes mod :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "mod" 70)
    3.11  
    3.12  instance nat :: Divides.div
    3.13    div_def: "m div n == wfrec (pred_nat^+)
    3.14 @@ -22,12 +22,12 @@
    3.15                            (%f j. if j<n | n=0 then j else f (j-n)) m" ..
    3.16  
    3.17  definition (in div)
    3.18 -  dvd  :: "'a \<Rightarrow> 'a \<Rightarrow> bool" (infixl "\<^loc>dvd" 50)
    3.19 +  dvd  :: "'a \<Rightarrow> 'a \<Rightarrow> bool" (infixl "dvd" 50)
    3.20  where
    3.21 -  [code func del]: "m \<^loc>dvd n \<longleftrightarrow> (\<exists>k. n = m \<^loc>* k)"
    3.22 +  [code func del]: "m dvd n \<longleftrightarrow> (\<exists>k. n = m * k)"
    3.23  
    3.24  class dvd_mod = div + zero + -- {* for code generation *}
    3.25 -  assumes dvd_def_mod [code func]: "x \<^loc>dvd y \<longleftrightarrow> y \<^loc>mod x = \<^loc>0"
    3.26 +  assumes dvd_def_mod [code func]: "x dvd y \<longleftrightarrow> y mod x = 0"
    3.27  
    3.28  definition
    3.29    quorem :: "(nat*nat) * (nat*nat) => bool" where
     4.1 --- a/src/HOL/Finite_Set.thy	Tue Oct 16 23:12:38 2007 +0200
     4.2 +++ b/src/HOL/Finite_Set.thy	Tue Oct 16 23:12:45 2007 +0200
     4.3 @@ -2026,6 +2026,20 @@
     4.4    and strict_below_def: "less x y \<longleftrightarrow> less_eq x y \<and> x \<noteq> y"
     4.5  begin
     4.6  
     4.7 +notation
     4.8 +  less_eq  ("op \<^loc><=") and
     4.9 +  less_eq  ("(_/ \<^loc><= _)" [51, 51] 50) and
    4.10 +  less  ("op \<^loc><") and
    4.11 +  less  ("(_/ \<^loc>< _)"  [51, 51] 50)
    4.12 +  
    4.13 +notation (xsymbols)
    4.14 +  less_eq  ("op \<^loc>\<le>") and
    4.15 +  less_eq  ("(_/ \<^loc>\<le> _)"  [51, 51] 50)
    4.16 +
    4.17 +notation (HTML output)
    4.18 +  less_eq  ("op \<^loc>\<le>") and
    4.19 +  less_eq  ("(_/ \<^loc>\<le> _)"  [51, 51] 50)
    4.20 +
    4.21  lemma below_refl [simp]: "x \<^loc>\<le> x"
    4.22    by (simp add: below_def idem)
    4.23  
    4.24 @@ -2242,27 +2256,27 @@
    4.25    over (non-empty) sets by means of @{text fold1}.
    4.26  *}
    4.27  
    4.28 -lemma (in lower_semilattice) ACf_inf: "ACf (op \<sqinter>)"
    4.29 +lemma (in lower_semilattice) ACf_inf: "ACf inf"
    4.30    by (blast intro: ACf.intro inf_commute inf_assoc)
    4.31  
    4.32 -lemma (in upper_semilattice) ACf_sup: "ACf (op \<squnion>)"
    4.33 +lemma (in upper_semilattice) ACf_sup: "ACf sup"
    4.34    by (blast intro: ACf.intro sup_commute sup_assoc)
    4.35  
    4.36 -lemma (in lower_semilattice) ACIf_inf: "ACIf (op \<sqinter>)"
    4.37 +lemma (in lower_semilattice) ACIf_inf: "ACIf inf"
    4.38  apply(rule ACIf.intro)
    4.39  apply(rule ACf_inf)
    4.40  apply(rule ACIf_axioms.intro)
    4.41  apply(rule inf_idem)
    4.42  done
    4.43  
    4.44 -lemma (in upper_semilattice) ACIf_sup: "ACIf (op \<squnion>)"
    4.45 +lemma (in upper_semilattice) ACIf_sup: "ACIf sup"
    4.46  apply(rule ACIf.intro)
    4.47  apply(rule ACf_sup)
    4.48  apply(rule ACIf_axioms.intro)
    4.49  apply(rule sup_idem)
    4.50  done
    4.51  
    4.52 -lemma (in lower_semilattice) ACIfSL_inf: "ACIfSL (op \<^loc>\<le>) (op \<^loc><) (op \<sqinter>)"
    4.53 +lemma (in lower_semilattice) ACIfSL_inf: "ACIfSL (op \<le>) (op <) inf"
    4.54  apply(rule ACIfSL.intro)
    4.55  apply(rule ACIf.intro)
    4.56  apply(rule ACf_inf)
    4.57 @@ -2275,7 +2289,7 @@
    4.58  apply(rule less_le)
    4.59  done
    4.60  
    4.61 -lemma (in upper_semilattice) ACIfSL_sup: "ACIfSL (%x y. y \<^loc>\<le> x) (%x y. y \<^loc>< x) (op \<squnion>)"
    4.62 +lemma (in upper_semilattice) ACIfSL_sup: "ACIfSL (%x y. y \<le> x) (%x y. y < x) sup"
    4.63  apply(rule ACIfSL.intro)
    4.64  apply(rule ACIf.intro)
    4.65  apply(rule ACf_sup)
    4.66 @@ -2294,14 +2308,14 @@
    4.67  definition
    4.68    Inf_fin :: "'a set \<Rightarrow> 'a" ("\<Sqinter>\<^bsub>fin\<^esub>_" [900] 900)
    4.69  where
    4.70 -  "Inf_fin = fold1 (op \<sqinter>)"
    4.71 +  "Inf_fin = fold1 inf"
    4.72  
    4.73  definition
    4.74    Sup_fin :: "'a set \<Rightarrow> 'a" ("\<Squnion>\<^bsub>fin\<^esub>_" [900] 900)
    4.75  where
    4.76 -  "Sup_fin = fold1 (op \<squnion>)"
    4.77 -
    4.78 -lemma Inf_le_Sup [simp]: "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> \<Sqinter>\<^bsub>fin\<^esub>A \<^loc>\<le> \<Squnion>\<^bsub>fin\<^esub>A"
    4.79 +  "Sup_fin = fold1 sup"
    4.80 +
    4.81 +lemma Inf_le_Sup [simp]: "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> \<Sqinter>\<^bsub>fin\<^esub>A \<le> \<Squnion>\<^bsub>fin\<^esub>A"
    4.82  apply(unfold Sup_fin_def Inf_fin_def)
    4.83  apply(subgoal_tac "EX a. a:A")
    4.84  prefer 2 apply blast
    4.85 @@ -2312,13 +2326,13 @@
    4.86  done
    4.87  
    4.88  lemma sup_Inf_absorb [simp]:
    4.89 -  "\<lbrakk> finite A; A \<noteq> {}; a \<in> A \<rbrakk> \<Longrightarrow> (a \<squnion> \<Sqinter>\<^bsub>fin\<^esub>A) = a"
    4.90 +  "\<lbrakk> finite A; A \<noteq> {}; a \<in> A \<rbrakk> \<Longrightarrow> (sup a (\<Sqinter>\<^bsub>fin\<^esub>A)) = a"
    4.91  apply(subst sup_commute)
    4.92  apply(simp add: Inf_fin_def sup_absorb2 ACIfSL.fold1_belowI [OF ACIfSL_inf])
    4.93  done
    4.94  
    4.95  lemma inf_Sup_absorb [simp]:
    4.96 -  "\<lbrakk> finite A; A \<noteq> {}; a \<in> A \<rbrakk> \<Longrightarrow> (a \<sqinter> \<Squnion>\<^bsub>fin\<^esub>A) = a"
    4.97 +  "\<lbrakk> finite A; A \<noteq> {}; a \<in> A \<rbrakk> \<Longrightarrow> (inf a (\<Squnion>\<^bsub>fin\<^esub>A)) = a"
    4.98  by(simp add: Sup_fin_def inf_absorb1 ACIfSL.fold1_belowI [OF ACIfSL_sup])
    4.99  
   4.100  end
   4.101 @@ -2327,7 +2341,7 @@
   4.102  begin
   4.103  
   4.104  lemma sup_Inf1_distrib:
   4.105 - "finite A \<Longrightarrow> A \<noteq> {} \<Longrightarrow> (x \<squnion> \<Sqinter>\<^bsub>fin\<^esub>A) = \<Sqinter>\<^bsub>fin\<^esub>{x \<squnion> a|a. a \<in> A}"
   4.106 +  "finite A \<Longrightarrow> A \<noteq> {} \<Longrightarrow> sup x (\<Sqinter>\<^bsub>fin\<^esub>A) = \<Sqinter>\<^bsub>fin\<^esub>{sup x a|a. a \<in> A}"
   4.107  apply(simp add: Inf_fin_def image_def
   4.108    ACIf.hom_fold1_commute[OF ACIf_inf, where h="sup x", OF sup_inf_distrib1])
   4.109  apply(rule arg_cong, blast)
   4.110 @@ -2335,38 +2349,38 @@
   4.111  
   4.112  lemma sup_Inf2_distrib:
   4.113    assumes A: "finite A" "A \<noteq> {}" and B: "finite B" "B \<noteq> {}"
   4.114 -  shows "(\<Sqinter>\<^bsub>fin\<^esub>A \<squnion> \<Sqinter>\<^bsub>fin\<^esub>B) = \<Sqinter>\<^bsub>fin\<^esub>{a \<squnion> b|a b. a \<in> A \<and> b \<in> B}"
   4.115 +  shows "sup (\<Sqinter>\<^bsub>fin\<^esub>A) (\<Sqinter>\<^bsub>fin\<^esub>B) = \<Sqinter>\<^bsub>fin\<^esub>{sup a b|a b. a \<in> A \<and> b \<in> B}"
   4.116  using A proof (induct rule: finite_ne_induct)
   4.117    case singleton thus ?case
   4.118      by (simp add: sup_Inf1_distrib [OF B] fold1_singleton_def [OF Inf_fin_def])
   4.119  next
   4.120    case (insert x A)
   4.121 -  have finB: "finite {x \<squnion> b |b. b \<in> B}"
   4.122 -    by(rule finite_surj[where f = "%b. x \<squnion> b", OF B(1)], auto)
   4.123 -  have finAB: "finite {a \<squnion> b |a b. a \<in> A \<and> b \<in> B}"
   4.124 +  have finB: "finite {sup x b |b. b \<in> B}"
   4.125 +    by(rule finite_surj[where f = "sup x", OF B(1)], auto)
   4.126 +  have finAB: "finite {sup a b |a b. a \<in> A \<and> b \<in> B}"
   4.127    proof -
   4.128 -    have "{a \<squnion> b |a b. a \<in> A \<and> b \<in> B} = (UN a:A. UN b:B. {a \<squnion> b})"
   4.129 +    have "{sup a b |a b. a \<in> A \<and> b \<in> B} = (UN a:A. UN b:B. {sup a b})"
   4.130        by blast
   4.131      thus ?thesis by(simp add: insert(1) B(1))
   4.132    qed
   4.133 -  have ne: "{a \<squnion> b |a b. a \<in> A \<and> b \<in> B} \<noteq> {}" using insert B by blast
   4.134 -  have "\<Sqinter>\<^bsub>fin\<^esub>(insert x A) \<squnion> \<Sqinter>\<^bsub>fin\<^esub>B = (x \<sqinter> \<Sqinter>\<^bsub>fin\<^esub>A) \<squnion> \<Sqinter>\<^bsub>fin\<^esub>B"
   4.135 +  have ne: "{sup a b |a b. a \<in> A \<and> b \<in> B} \<noteq> {}" using insert B by blast
   4.136 +  have "sup (\<Sqinter>\<^bsub>fin\<^esub>(insert x A)) (\<Sqinter>\<^bsub>fin\<^esub>B) = sup (inf x (\<Sqinter>\<^bsub>fin\<^esub>A)) (\<Sqinter>\<^bsub>fin\<^esub>B)"
   4.137      using insert
   4.138   by(simp add:ACIf.fold1_insert_idem_def[OF ACIf_inf Inf_fin_def])
   4.139 -  also have "\<dots> = (x \<squnion> \<Sqinter>\<^bsub>fin\<^esub>B) \<sqinter> (\<Sqinter>\<^bsub>fin\<^esub>A \<squnion> \<Sqinter>\<^bsub>fin\<^esub>B)" by(rule sup_inf_distrib2)
   4.140 -  also have "\<dots> = \<Sqinter>\<^bsub>fin\<^esub>{x \<squnion> b|b. b \<in> B} \<sqinter> \<Sqinter>\<^bsub>fin\<^esub>{a \<squnion> b|a b. a \<in> A \<and> b \<in> B}"
   4.141 +  also have "\<dots> = inf (sup x (\<Sqinter>\<^bsub>fin\<^esub>B)) (sup (\<Sqinter>\<^bsub>fin\<^esub>A) (\<Sqinter>\<^bsub>fin\<^esub>B))" by(rule sup_inf_distrib2)
   4.142 +  also have "\<dots> = inf (\<Sqinter>\<^bsub>fin\<^esub>{sup x b|b. b \<in> B}) (\<Sqinter>\<^bsub>fin\<^esub>{sup a b|a b. a \<in> A \<and> b \<in> B})"
   4.143      using insert by(simp add:sup_Inf1_distrib[OF B])
   4.144 -  also have "\<dots> = \<Sqinter>\<^bsub>fin\<^esub>({x\<squnion>b |b. b \<in> B} \<union> {a\<squnion>b |a b. a \<in> A \<and> b \<in> B})"
   4.145 +  also have "\<dots> = \<Sqinter>\<^bsub>fin\<^esub>({sup x b |b. b \<in> B} \<union> {sup a b |a b. a \<in> A \<and> b \<in> B})"
   4.146      (is "_ = \<Sqinter>\<^bsub>fin\<^esub>?M")
   4.147      using B insert
   4.148      by (simp add: Inf_fin_def ACIf.fold1_Un2[OF ACIf_inf finB _ finAB ne])
   4.149 -  also have "?M = {a \<squnion> b |a b. a \<in> insert x A \<and> b \<in> B}"
   4.150 +  also have "?M = {sup a b |a b. a \<in> insert x A \<and> b \<in> B}"
   4.151      by blast
   4.152    finally show ?case .
   4.153  qed
   4.154  
   4.155  lemma inf_Sup1_distrib:
   4.156 - "finite A \<Longrightarrow> A \<noteq> {} \<Longrightarrow> (x \<sqinter> \<Squnion>\<^bsub>fin\<^esub>A) = \<Squnion>\<^bsub>fin\<^esub>{x \<sqinter> a|a. a \<in> A}"
   4.157 +  "finite A \<Longrightarrow> A \<noteq> {} \<Longrightarrow> inf x (\<Squnion>\<^bsub>fin\<^esub>A) = \<Squnion>\<^bsub>fin\<^esub>{inf x a|a. a \<in> A}"
   4.158  apply (simp add: Sup_fin_def image_def
   4.159    ACIf.hom_fold1_commute[OF ACIf_sup, where h="inf x", OF inf_sup_distrib1])
   4.160  apply (rule arg_cong, blast)
   4.161 @@ -2374,31 +2388,31 @@
   4.162  
   4.163  lemma inf_Sup2_distrib:
   4.164    assumes A: "finite A" "A \<noteq> {}" and B: "finite B" "B \<noteq> {}"
   4.165 -  shows "(\<Squnion>\<^bsub>fin\<^esub>A \<sqinter> \<Squnion>\<^bsub>fin\<^esub>B) = \<Squnion>\<^bsub>fin\<^esub>{a \<sqinter> b|a b. a \<in> A \<and> b \<in> B}"
   4.166 +  shows "inf (\<Squnion>\<^bsub>fin\<^esub>A) (\<Squnion>\<^bsub>fin\<^esub>B) = \<Squnion>\<^bsub>fin\<^esub>{inf a b|a b. a \<in> A \<and> b \<in> B}"
   4.167  using A proof (induct rule: finite_ne_induct)
   4.168    case singleton thus ?case
   4.169      by(simp add: inf_Sup1_distrib [OF B] fold1_singleton_def [OF Sup_fin_def])
   4.170  next
   4.171    case (insert x A)
   4.172 -  have finB: "finite {x \<sqinter> b |b. b \<in> B}"
   4.173 -    by(rule finite_surj[where f = "%b. x \<sqinter> b", OF B(1)], auto)
   4.174 -  have finAB: "finite {a \<sqinter> b |a b. a \<in> A \<and> b \<in> B}"
   4.175 +  have finB: "finite {inf x b |b. b \<in> B}"
   4.176 +    by(rule finite_surj[where f = "%b. inf x b", OF B(1)], auto)
   4.177 +  have finAB: "finite {inf a b |a b. a \<in> A \<and> b \<in> B}"
   4.178    proof -
   4.179 -    have "{a \<sqinter> b |a b. a \<in> A \<and> b \<in> B} = (UN a:A. UN b:B. {a \<sqinter> b})"
   4.180 +    have "{inf a b |a b. a \<in> A \<and> b \<in> B} = (UN a:A. UN b:B. {inf a b})"
   4.181        by blast
   4.182      thus ?thesis by(simp add: insert(1) B(1))
   4.183    qed
   4.184 -  have ne: "{a \<sqinter> b |a b. a \<in> A \<and> b \<in> B} \<noteq> {}" using insert B by blast
   4.185 -  have "\<Squnion>\<^bsub>fin\<^esub>(insert x A) \<sqinter> \<Squnion>\<^bsub>fin\<^esub>B = (x \<squnion> \<Squnion>\<^bsub>fin\<^esub>A) \<sqinter> \<Squnion>\<^bsub>fin\<^esub>B"
   4.186 +  have ne: "{inf a b |a b. a \<in> A \<and> b \<in> B} \<noteq> {}" using insert B by blast
   4.187 +  have "inf (\<Squnion>\<^bsub>fin\<^esub>(insert x A)) (\<Squnion>\<^bsub>fin\<^esub>B) = inf (sup x (\<Squnion>\<^bsub>fin\<^esub>A)) (\<Squnion>\<^bsub>fin\<^esub>B)"
   4.188      using insert by (simp add: ACIf.fold1_insert_idem_def [OF ACIf_sup Sup_fin_def])
   4.189 -  also have "\<dots> = (x \<sqinter> \<Squnion>\<^bsub>fin\<^esub>B) \<squnion> (\<Squnion>\<^bsub>fin\<^esub>A \<sqinter> \<Squnion>\<^bsub>fin\<^esub>B)" by(rule inf_sup_distrib2)
   4.190 -  also have "\<dots> = \<Squnion>\<^bsub>fin\<^esub>{x \<sqinter> b|b. b \<in> B} \<squnion> \<Squnion>\<^bsub>fin\<^esub>{a \<sqinter> b|a b. a \<in> A \<and> b \<in> B}"
   4.191 +  also have "\<dots> = sup (inf x (\<Squnion>\<^bsub>fin\<^esub>B)) (inf (\<Squnion>\<^bsub>fin\<^esub>A) (\<Squnion>\<^bsub>fin\<^esub>B))" by(rule inf_sup_distrib2)
   4.192 +  also have "\<dots> = sup (\<Squnion>\<^bsub>fin\<^esub>{inf x b|b. b \<in> B}) (\<Squnion>\<^bsub>fin\<^esub>{inf a b|a b. a \<in> A \<and> b \<in> B})"
   4.193      using insert by(simp add:inf_Sup1_distrib[OF B])
   4.194 -  also have "\<dots> = \<Squnion>\<^bsub>fin\<^esub>({x\<sqinter>b |b. b \<in> B} \<union> {a\<sqinter>b |a b. a \<in> A \<and> b \<in> B})"
   4.195 +  also have "\<dots> = \<Squnion>\<^bsub>fin\<^esub>({inf x b |b. b \<in> B} \<union> {inf a b |a b. a \<in> A \<and> b \<in> B})"
   4.196      (is "_ = \<Squnion>\<^bsub>fin\<^esub>?M")
   4.197      using B insert
   4.198      by (simp add: Sup_fin_def ACIf.fold1_Un2[OF ACIf_sup finB _ finAB ne])
   4.199 -  also have "?M = {a \<sqinter> b |a b. a \<in> insert x A \<and> b \<in> B}"
   4.200 +  also have "?M = {inf a b |a b. a \<in> insert x A \<and> b \<in> B}"
   4.201      by blast
   4.202    finally show ?case .
   4.203  qed
   4.204 @@ -2413,12 +2427,12 @@
   4.205  *}
   4.206  
   4.207  lemma Inf_fin_Inf:
   4.208 -  "finite A \<Longrightarrow>  A \<noteq> {} \<Longrightarrow> \<Sqinter>\<^bsub>fin\<^esub>A = \<Sqinter>A"
   4.209 +  "finite A \<Longrightarrow> A \<noteq> {} \<Longrightarrow> \<Sqinter>\<^bsub>fin\<^esub>A = Inf A"
   4.210  unfolding Inf_fin_def by (induct A set: finite)
   4.211     (simp_all add: Inf_insert_simp ACIf.fold1_insert_idem [OF ACIf_inf])
   4.212  
   4.213  lemma Sup_fin_Sup:
   4.214 -  "finite A \<Longrightarrow> A \<noteq> {} \<Longrightarrow> \<Squnion>\<^bsub>fin\<^esub>A = \<Squnion>A"
   4.215 +  "finite A \<Longrightarrow> A \<noteq> {} \<Longrightarrow> \<Squnion>\<^bsub>fin\<^esub>A = Sup A"
   4.216  unfolding Sup_fin_def by (induct A set: finite)
   4.217     (simp_all add: Sup_insert_simp ACIf.fold1_insert_idem [OF ACIf_sup])
   4.218  
   4.219 @@ -2462,13 +2476,13 @@
   4.220      rule distrib_lattice.axioms,
   4.221      rule distrib_lattice_min_max)
   4.222  
   4.223 -lemma ACIfSL_min: "ACIfSL (op \<^loc>\<le>) (op \<^loc><) min"
   4.224 +lemma ACIfSL_min: "ACIfSL (op \<le>) (op <) min"
   4.225    by (rule lower_semilattice.ACIfSL_inf,
   4.226      rule lattice.axioms,
   4.227      rule distrib_lattice.axioms,
   4.228      rule distrib_lattice_min_max)
   4.229  
   4.230 -lemma ACIfSLlin_min: "ACIfSLlin (op \<^loc>\<le>) (op \<^loc><) min"
   4.231 +lemma ACIfSLlin_min: "ACIfSLlin (op \<le>) (op <) min"
   4.232    by (rule ACIfSLlin.intro,
   4.233      rule lower_semilattice.ACIfSL_inf,
   4.234      rule lattice.axioms,
   4.235 @@ -2488,13 +2502,13 @@
   4.236      rule distrib_lattice.axioms,
   4.237      rule distrib_lattice_min_max)
   4.238  
   4.239 -lemma ACIfSL_max: "ACIfSL (\<lambda>x y. y \<^loc>\<le> x) (\<lambda>x y. y \<^loc>< x) max"
   4.240 +lemma ACIfSL_max: "ACIfSL (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x) max"
   4.241    by (rule upper_semilattice.ACIfSL_sup,
   4.242      rule lattice.axioms,
   4.243      rule distrib_lattice.axioms,
   4.244      rule distrib_lattice_min_max)
   4.245  
   4.246 -lemma ACIfSLlin_max: "ACIfSLlin (\<lambda>x y. y \<^loc>\<le> x) (\<lambda>x y. y \<^loc>< x) max"
   4.247 +lemma ACIfSLlin_max: "ACIfSLlin (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x) max"
   4.248    by (rule ACIfSLlin.intro,
   4.249      rule upper_semilattice.ACIfSL_sup,
   4.250      rule lattice.axioms,
   4.251 @@ -2517,48 +2531,48 @@
   4.252    using ACf.fold1_in [OF ACf_max]
   4.253    by (fastsimp simp: Max_def max_def)
   4.254  
   4.255 -lemma Min_antimono: "\<lbrakk> M \<subseteq> N; M \<noteq> {}; finite N \<rbrakk> \<Longrightarrow> Min N \<^loc>\<le> Min M"
   4.256 +lemma Min_antimono: "\<lbrakk> M \<subseteq> N; M \<noteq> {}; finite N \<rbrakk> \<Longrightarrow> Min N \<le> Min M"
   4.257    by (simp add: Min_def ACIfSLlin.fold1_antimono [OF ACIfSLlin_min])
   4.258  
   4.259 -lemma Max_mono: "\<lbrakk> M \<subseteq> N; M \<noteq> {}; finite N \<rbrakk> \<Longrightarrow> Max M \<^loc>\<le> Max N"
   4.260 +lemma Max_mono: "\<lbrakk> M \<subseteq> N; M \<noteq> {}; finite N \<rbrakk> \<Longrightarrow> Max M \<le> Max N"
   4.261    by (simp add: Max_def ACIfSLlin.fold1_antimono [OF ACIfSLlin_max])
   4.262  
   4.263 -lemma Min_le [simp]: "\<lbrakk> finite A; A \<noteq> {}; x \<in> A \<rbrakk> \<Longrightarrow> Min A \<^loc>\<le> x"
   4.264 +lemma Min_le [simp]: "\<lbrakk> finite A; A \<noteq> {}; x \<in> A \<rbrakk> \<Longrightarrow> Min A \<le> x"
   4.265    by (simp add: Min_def ACIfSL.fold1_belowI [OF ACIfSL_min])
   4.266  
   4.267 -lemma Max_ge [simp]: "\<lbrakk> finite A; A \<noteq> {}; x \<in> A \<rbrakk> \<Longrightarrow> x \<^loc>\<le> Max A"
   4.268 +lemma Max_ge [simp]: "\<lbrakk> finite A; A \<noteq> {}; x \<in> A \<rbrakk> \<Longrightarrow> x \<le> Max A"
   4.269    by (simp add: Max_def ACIfSL.fold1_belowI [OF ACIfSL_max])
   4.270  
   4.271  lemma Min_ge_iff [simp,noatp]:
   4.272 -  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> x \<^loc>\<le> Min A \<longleftrightarrow> (\<forall>a\<in>A. x \<^loc>\<le> a)"
   4.273 +  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> x \<le> Min A \<longleftrightarrow> (\<forall>a\<in>A. x \<le> a)"
   4.274    by (simp add: Min_def ACIfSL.below_fold1_iff [OF ACIfSL_min])
   4.275  
   4.276  lemma Max_le_iff [simp,noatp]:
   4.277 -  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> Max A \<^loc>\<le> x \<longleftrightarrow> (\<forall>a\<in>A. a \<^loc>\<le> x)"
   4.278 +  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> Max A \<le> x \<longleftrightarrow> (\<forall>a\<in>A. a \<le> x)"
   4.279    by (simp add: Max_def ACIfSL.below_fold1_iff [OF ACIfSL_max])
   4.280  
   4.281  lemma Min_gr_iff [simp,noatp]:
   4.282 -  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> x \<^loc>< Min A \<longleftrightarrow> (\<forall>a\<in>A. x \<^loc>< a)"
   4.283 +  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> x < Min A \<longleftrightarrow> (\<forall>a\<in>A. x < a)"
   4.284    by (simp add: Min_def ACIfSLlin.strict_below_fold1_iff [OF ACIfSLlin_min])
   4.285  
   4.286  lemma Max_less_iff [simp,noatp]:
   4.287 -  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> Max A \<^loc>< x \<longleftrightarrow> (\<forall>a\<in>A. a \<^loc>< x)"
   4.288 +  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> Max A < x \<longleftrightarrow> (\<forall>a\<in>A. a < x)"
   4.289    by (simp add: Max_def ACIfSLlin.strict_below_fold1_iff [OF ACIfSLlin_max])
   4.290  
   4.291  lemma Min_le_iff [noatp]:
   4.292 -  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> Min A \<^loc>\<le> x \<longleftrightarrow> (\<exists>a\<in>A. a \<^loc>\<le> x)"
   4.293 +  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> Min A \<le> x \<longleftrightarrow> (\<exists>a\<in>A. a \<le> x)"
   4.294    by (simp add: Min_def ACIfSLlin.fold1_below_iff [OF ACIfSLlin_min])
   4.295  
   4.296  lemma Max_ge_iff [noatp]:
   4.297 -  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> x \<^loc>\<le> Max A \<longleftrightarrow> (\<exists>a\<in>A. x \<^loc>\<le> a)"
   4.298 +  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> x \<le> Max A \<longleftrightarrow> (\<exists>a\<in>A. x \<le> a)"
   4.299    by (simp add: Max_def ACIfSLlin.fold1_below_iff [OF ACIfSLlin_max])
   4.300  
   4.301  lemma Min_less_iff [noatp]:
   4.302 -  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> Min A \<^loc>< x \<longleftrightarrow> (\<exists>a\<in>A. a \<^loc>< x)"
   4.303 +  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> Min A < x \<longleftrightarrow> (\<exists>a\<in>A. a < x)"
   4.304    by (simp add: Min_def ACIfSLlin.fold1_strict_below_iff [OF ACIfSLlin_min])
   4.305  
   4.306  lemma Max_gr_iff [noatp]:
   4.307 -  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> x \<^loc>< Max A \<longleftrightarrow> (\<exists>a\<in>A. x \<^loc>< a)"
   4.308 +  "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> x < Max A \<longleftrightarrow> (\<exists>a\<in>A. x < a)"
   4.309    by (simp add: Max_def ACIfSLlin.fold1_strict_below_iff [OF ACIfSLlin_max])
   4.310  
   4.311  lemma Min_Un: "\<lbrakk>finite A; A \<noteq> {}; finite B; B \<noteq> {}\<rbrakk>
   4.312 @@ -2586,23 +2600,29 @@
   4.313  
   4.314  lemma add_Min_commute:
   4.315    fixes k
   4.316 -  shows "finite N \<Longrightarrow> N \<noteq> {} \<Longrightarrow> k \<^loc>+ Min N = Min {k \<^loc>+ m | m. m \<in> N}"
   4.317 -  apply (subgoal_tac "\<And>x y. k \<^loc>+ min x y = min (k \<^loc>+ x) (k \<^loc>+ y)")
   4.318 -  using hom_Min_commute [of "(op \<^loc>+) k" N]
   4.319 -  apply simp apply (rule arg_cong [where f = Min]) apply blast
   4.320 -  apply (simp add: min_def not_le)
   4.321 -  apply (blast intro: antisym less_imp_le add_left_mono)
   4.322 -  done
   4.323 +  assumes "finite N" and "N \<noteq> {}"
   4.324 +  shows "k + Min N = Min {k + m | m. m \<in> N}"
   4.325 +proof -
   4.326 +  have "\<And>x y. k + min x y = min (k + x) (k + y)"
   4.327 +    by (simp add: min_def not_le)
   4.328 +      (blast intro: antisym less_imp_le add_left_mono)
   4.329 +  with assms show ?thesis
   4.330 +    using hom_Min_commute [of "plus k" N]
   4.331 +    by simp (blast intro: arg_cong [where f = Min])
   4.332 +qed
   4.333  
   4.334  lemma add_Max_commute:
   4.335    fixes k
   4.336 -  shows "finite N \<Longrightarrow> N \<noteq> {} \<Longrightarrow> k \<^loc>+ Max N = Max {k \<^loc>+ m | m. m \<in> N}"
   4.337 -  apply (subgoal_tac "\<And>x y. k \<^loc>+ max x y = max (k \<^loc>+ x) (k \<^loc>+ y)")
   4.338 -  using hom_Max_commute [of "(op \<^loc>+) k" N]
   4.339 -  apply simp apply (rule arg_cong [where f = Max]) apply blast
   4.340 -  apply (simp add: max_def not_le)
   4.341 -  apply (blast intro: antisym less_imp_le add_left_mono)
   4.342 -  done
   4.343 +  assumes "finite N" and "N \<noteq> {}"
   4.344 +  shows "k + Max N = Max {k + m | m. m \<in> N}"
   4.345 +proof -
   4.346 +  have "\<And>x y. k + max x y = max (k + x) (k + y)"
   4.347 +    by (simp add: max_def not_le)
   4.348 +      (blast intro: antisym less_imp_le add_left_mono)
   4.349 +  with assms show ?thesis
   4.350 +    using hom_Max_commute [of "plus k" N]
   4.351 +    by simp (blast intro: arg_cong [where f = Max])
   4.352 +qed
   4.353  
   4.354  end
   4.355  
     5.1 --- a/src/HOL/HOL.thy	Tue Oct 16 23:12:38 2007 +0200
     5.2 +++ b/src/HOL/HOL.thy	Tue Oct 16 23:12:45 2007 +0200
     5.3 @@ -208,75 +208,55 @@
     5.4    fixes default :: 'a
     5.5  
     5.6  class zero = type + 
     5.7 -  fixes zero :: 'a  ("\<^loc>0")
     5.8 +  fixes zero :: 'a  ("0")
     5.9  
    5.10  class one = type +
    5.11 -  fixes one  :: 'a  ("\<^loc>1")
    5.12 +  fixes one  :: 'a  ("1")
    5.13  
    5.14  hide (open) const zero one
    5.15  
    5.16  class plus = type +
    5.17 -  fixes plus :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"  (infixl "\<^loc>+" 65)
    5.18 +  fixes plus :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"  (infixl "+" 65)
    5.19  
    5.20  class minus = type +
    5.21 -  fixes uminus :: "'a \<Rightarrow> 'a" 
    5.22 -    and minus :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"  (infixl "\<^loc>-" 65)
    5.23 +  fixes uminus :: "'a \<Rightarrow> 'a"  ("- _" [81] 80)
    5.24 +    and minus :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"  (infixl "-" 65)
    5.25  
    5.26  class times = type +
    5.27 -  fixes times :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"  (infixl "\<^loc>*" 70)
    5.28 +  fixes times :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"  (infixl "*" 70)
    5.29  
    5.30  class inverse = type +
    5.31    fixes inverse :: "'a \<Rightarrow> 'a"
    5.32 -    and divide :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"  (infixl "\<^loc>'/" 70)
    5.33 +    and divide :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"  (infixl "'/" 70)
    5.34  
    5.35  class abs = type +
    5.36    fixes abs :: "'a \<Rightarrow> 'a"
    5.37  
    5.38 -class sgn = type +
    5.39 -  fixes sgn :: "'a \<Rightarrow> 'a"
    5.40 -
    5.41 -notation
    5.42 -  uminus  ("- _" [81] 80)
    5.43 -
    5.44  notation (xsymbols)
    5.45    abs  ("\<bar>_\<bar>")
    5.46  notation (HTML output)
    5.47    abs  ("\<bar>_\<bar>")
    5.48  
    5.49 +class sgn = type +
    5.50 +  fixes sgn :: "'a \<Rightarrow> 'a"
    5.51 +
    5.52  class ord = type +
    5.53    fixes less_eq :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
    5.54      and less :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
    5.55  begin
    5.56  
    5.57 -notation
    5.58 -  less_eq  ("op \<^loc><=") and
    5.59 -  less_eq  ("(_/ \<^loc><= _)" [51, 51] 50) and
    5.60 -  less  ("op \<^loc><") and
    5.61 -  less  ("(_/ \<^loc>< _)"  [51, 51] 50)
    5.62 -  
    5.63 -notation (xsymbols)
    5.64 -  less_eq  ("op \<^loc>\<le>") and
    5.65 -  less_eq  ("(_/ \<^loc>\<le> _)"  [51, 51] 50)
    5.66 -
    5.67 -notation (HTML output)
    5.68 -  less_eq  ("op \<^loc>\<le>") and
    5.69 -  less_eq  ("(_/ \<^loc>\<le> _)"  [51, 51] 50)
    5.70 +abbreviation (input)
    5.71 +  greater_eq  (infix ">=" 50) where
    5.72 +  "x >= y \<equiv> less_eq y x"
    5.73  
    5.74  abbreviation (input)
    5.75 -  greater_eq  (infix "\<^loc>>=" 50) where
    5.76 -  "x \<^loc>>= y \<equiv> y \<^loc><= x"
    5.77 -
    5.78 -notation (input)
    5.79 -  greater_eq  (infix "\<^loc>\<ge>" 50)
    5.80 -
    5.81 -abbreviation (input)
    5.82 -  greater  (infix "\<^loc>>" 50) where
    5.83 -  "x \<^loc>> y \<equiv> y \<^loc>< x"
    5.84 +  greater  (infix ">" 50) where
    5.85 +  "x > y \<equiv> less y x"
    5.86  
    5.87  definition
    5.88 -  Least :: "('a \<Rightarrow> bool) \<Rightarrow> 'a" (binder "\<^loc>LEAST " 10)
    5.89 +  Least :: "('a \<Rightarrow> bool) \<Rightarrow> 'a" (binder "LEAST " 10)
    5.90  where
    5.91 -  "Least P == (THE x. P x \<and> (\<forall>y. P y \<longrightarrow> x \<^loc>\<le> y))"
    5.92 +  "Least P == (THE x. P x \<and> (\<forall>y. P y \<longrightarrow> less_eq x y))"
    5.93  
    5.94  end
    5.95  
     6.1 --- a/src/HOL/Hyperreal/HDeriv.thy	Tue Oct 16 23:12:38 2007 +0200
     6.2 +++ b/src/HOL/Hyperreal/HDeriv.thy	Tue Oct 16 23:12:45 2007 +0200
     6.3 @@ -369,7 +369,7 @@
     6.4  
     6.5  subsubsection {* Equivalence of NS and Standard definitions *}
     6.6  
     6.7 -lemma divideR_eq_divide: "x /# y = x / y"
     6.8 +lemma divideR_eq_divide: "x /\<^sub>R y = x / y"
     6.9  by (simp add: real_scaleR_def divide_inverse mult_commute)
    6.10  
    6.11  text{*Now equivalence between NSDERIV and DERIV*}
     7.1 --- a/src/HOL/Hyperreal/HLim.thy	Tue Oct 16 23:12:38 2007 +0200
     7.2 +++ b/src/HOL/Hyperreal/HLim.thy	Tue Oct 16 23:12:45 2007 +0200
     7.3 @@ -52,12 +52,12 @@
     7.4  by (auto simp add: NSLIM_def intro!: approx_mult_HFinite)
     7.5  
     7.6  lemma starfun_scaleR [simp]:
     7.7 -  "starfun (\<lambda>x. f x *# g x) = (\<lambda>x. scaleHR (starfun f x) (starfun g x))"
     7.8 +  "starfun (\<lambda>x. f x *\<^sub>R g x) = (\<lambda>x. scaleHR (starfun f x) (starfun g x))"
     7.9  by transfer (rule refl)
    7.10  
    7.11  lemma NSLIM_scaleR:
    7.12    "[| f -- x --NS> l; g -- x --NS> m |]
    7.13 -      ==> (%x. f(x) *# g(x)) -- x --NS> (l *# m)"
    7.14 +      ==> (%x. f(x) *\<^sub>R g(x)) -- x --NS> (l *\<^sub>R m)"
    7.15  by (auto simp add: NSLIM_def intro!: approx_scaleR_HFinite)
    7.16  
    7.17  lemma NSLIM_add:
     8.1 --- a/src/HOL/Hyperreal/NSA.thy	Tue Oct 16 23:12:38 2007 +0200
     8.2 +++ b/src/HOL/Hyperreal/NSA.thy	Tue Oct 16 23:12:45 2007 +0200
     8.3 @@ -87,7 +87,7 @@
     8.4  
     8.5  lemma hnorm_scaleR:
     8.6    "\<And>x::'a::real_normed_vector star.
     8.7 -   hnorm (a *# x) = \<bar>star_of a\<bar> * hnorm x"
     8.8 +   hnorm (a *\<^sub>R x) = \<bar>star_of a\<bar> * hnorm x"
     8.9  by transfer (rule norm_scaleR)
    8.10  
    8.11  lemma hnorm_scaleHR:
    8.12 @@ -429,7 +429,7 @@
    8.13  done
    8.14  
    8.15  lemma Infinitesimal_scaleR2:
    8.16 -  "x \<in> Infinitesimal ==> a *# x \<in> Infinitesimal"
    8.17 +  "x \<in> Infinitesimal ==> a *\<^sub>R x \<in> Infinitesimal"
    8.18  apply (case_tac "a = 0", simp)
    8.19  apply (rule InfinitesimalI)
    8.20  apply (drule InfinitesimalD)
    8.21 @@ -853,7 +853,7 @@
    8.22  by transfer (rule scaleR_left_diff_distrib)
    8.23  
    8.24  lemma approx_scaleR1:
    8.25 -  "[| a @= star_of b; c: HFinite|] ==> scaleHR a c @= b *# c"
    8.26 +  "[| a @= star_of b; c: HFinite|] ==> scaleHR a c @= b *\<^sub>R c"
    8.27  apply (unfold approx_def)
    8.28  apply (drule (1) Infinitesimal_HFinite_scaleHR)
    8.29  apply (simp only: scaleHR_left_diff_distrib)
    8.30 @@ -861,12 +861,12 @@
    8.31  done
    8.32  
    8.33  lemma approx_scaleR2:
    8.34 -  "a @= b ==> c *# a @= c *# b"
    8.35 +  "a @= b ==> c *\<^sub>R a @= c *\<^sub>R b"
    8.36  by (simp add: approx_def Infinitesimal_scaleR2
    8.37                scaleR_right_diff_distrib [symmetric])
    8.38  
    8.39  lemma approx_scaleR_HFinite:
    8.40 -  "[|a @= star_of b; c @= d; d: HFinite|] ==> scaleHR a c @= b *# d"
    8.41 +  "[|a @= star_of b; c @= d; d: HFinite|] ==> scaleHR a c @= b *\<^sub>R d"
    8.42  apply (rule approx_trans)
    8.43  apply (rule_tac [2] approx_scaleR2)
    8.44  apply (rule approx_scaleR1)
     9.1 --- a/src/HOL/Hyperreal/Transcendental.thy	Tue Oct 16 23:12:38 2007 +0200
     9.2 +++ b/src/HOL/Hyperreal/Transcendental.thy	Tue Oct 16 23:12:45 2007 +0200
     9.3 @@ -437,7 +437,7 @@
     9.4  
     9.5  definition
     9.6    exp :: "'a \<Rightarrow> 'a::{recpower,real_normed_field,banach}" where
     9.7 -  "exp x = (\<Sum>n. x ^ n /# real (fact n))"
     9.8 +  "exp x = (\<Sum>n. x ^ n /\<^sub>R real (fact n))"
     9.9  
    9.10  definition
    9.11    sin :: "real => real" where
    9.12 @@ -451,10 +451,10 @@
    9.13  
    9.14  lemma summable_exp_generic:
    9.15    fixes x :: "'a::{real_normed_algebra_1,recpower,banach}"
    9.16 -  defines S_def: "S \<equiv> \<lambda>n. x ^ n /# real (fact n)"
    9.17 +  defines S_def: "S \<equiv> \<lambda>n. x ^ n /\<^sub>R real (fact n)"
    9.18    shows "summable S"
    9.19  proof -
    9.20 -  have S_Suc: "\<And>n. S (Suc n) = (x * S n) /# real (Suc n)"
    9.21 +  have S_Suc: "\<And>n. S (Suc n) = (x * S n) /\<^sub>R real (Suc n)"
    9.22      unfolding S_def by (simp add: power_Suc del: mult_Suc)
    9.23    obtain r :: real where r0: "0 < r" and r1: "r < 1"
    9.24      using dense [OF zero_less_one] by fast
    9.25 @@ -481,12 +481,12 @@
    9.26  
    9.27  lemma summable_norm_exp:
    9.28    fixes x :: "'a::{real_normed_algebra_1,recpower,banach}"
    9.29 -  shows "summable (\<lambda>n. norm (x ^ n /# real (fact n)))"
    9.30 +  shows "summable (\<lambda>n. norm (x ^ n /\<^sub>R real (fact n)))"
    9.31  proof (rule summable_norm_comparison_test [OF exI, rule_format])
    9.32 -  show "summable (\<lambda>n. norm x ^ n /# real (fact n))"
    9.33 +  show "summable (\<lambda>n. norm x ^ n /\<^sub>R real (fact n))"
    9.34      by (rule summable_exp_generic)
    9.35  next
    9.36 -  fix n show "norm (x ^ n /# real (fact n)) \<le> norm x ^ n /# real (fact n)"
    9.37 +  fix n show "norm (x ^ n /\<^sub>R real (fact n)) \<le> norm x ^ n /\<^sub>R real (fact n)"
    9.38      by (simp add: norm_scaleR norm_power_ineq)
    9.39  qed
    9.40  
    9.41 @@ -536,7 +536,7 @@
    9.42  apply (case_tac [2] "n", auto)
    9.43  done
    9.44  
    9.45 -lemma exp_converges: "(\<lambda>n. x ^ n /# real (fact n)) sums exp x"
    9.46 +lemma exp_converges: "(\<lambda>n. x ^ n /\<^sub>R real (fact n)) sums exp x"
    9.47  unfolding exp_def by (rule summable_exp_generic [THEN summable_sums])
    9.48  
    9.49  lemma sin_converges: 
    9.50 @@ -604,7 +604,7 @@
    9.51                    else -1 ^ ((n - Suc 0) div 2)/(real (fact n))) * x ^ n))"
    9.52  by (auto intro!: sums_unique sums_minus sin_converges)
    9.53  
    9.54 -lemma lemma_exp_ext: "exp = (\<lambda>x. \<Sum>n. x ^ n /# real (fact n))"
    9.55 +lemma lemma_exp_ext: "exp = (\<lambda>x. \<Sum>n. x ^ n /\<^sub>R real (fact n))"
    9.56  by (auto intro!: ext simp add: exp_def)
    9.57  
    9.58  lemma DERIV_exp [simp]: "DERIV exp x :> exp(x)"
    9.59 @@ -680,7 +680,7 @@
    9.60  
    9.61  lemma exp_series_add:
    9.62    fixes x y :: "'a::{real_field,recpower}"
    9.63 -  defines S_def: "S \<equiv> \<lambda>x n. x ^ n /# real (fact n)"
    9.64 +  defines S_def: "S \<equiv> \<lambda>x n. x ^ n /\<^sub>R real (fact n)"
    9.65    shows "S (x + y) n = (\<Sum>i=0..n. S x i * S y (n - i))"
    9.66  proof (induct n)
    9.67    case 0
    9.68 @@ -688,12 +688,12 @@
    9.69      unfolding S_def by simp
    9.70  next
    9.71    case (Suc n)
    9.72 -  have S_Suc: "\<And>x n. S x (Suc n) = (x * S x n) /# real (Suc n)"
    9.73 +  have S_Suc: "\<And>x n. S x (Suc n) = (x * S x n) /\<^sub>R real (Suc n)"
    9.74      unfolding S_def by (simp add: power_Suc del: mult_Suc)
    9.75 -  hence times_S: "\<And>x n. x * S x n = real (Suc n) *# S x (Suc n)"
    9.76 +  hence times_S: "\<And>x n. x * S x n = real (Suc n) *\<^sub>R S x (Suc n)"
    9.77      by simp
    9.78  
    9.79 -  have "real (Suc n) *# S (x + y) (Suc n) = (x + y) * S (x + y) n"
    9.80 +  have "real (Suc n) *\<^sub>R S (x + y) (Suc n) = (x + y) * S (x + y) n"
    9.81      by (simp only: times_S)
    9.82    also have "\<dots> = (x + y) * (\<Sum>i=0..n. S x i * S y (n-i))"
    9.83      by (simp only: Suc)
    9.84 @@ -703,21 +703,21 @@
    9.85    also have "\<dots> = (\<Sum>i=0..n. (x * S x i) * S y (n-i))
    9.86                  + (\<Sum>i=0..n. S x i * (y * S y (n-i)))"
    9.87      by (simp only: setsum_right_distrib mult_ac)
    9.88 -  also have "\<dots> = (\<Sum>i=0..n. real (Suc i) *# (S x (Suc i) * S y (n-i)))
    9.89 -                + (\<Sum>i=0..n. real (Suc n-i) *# (S x i * S y (Suc n-i)))"
    9.90 +  also have "\<dots> = (\<Sum>i=0..n. real (Suc i) *\<^sub>R (S x (Suc i) * S y (n-i)))
    9.91 +                + (\<Sum>i=0..n. real (Suc n-i) *\<^sub>R (S x i * S y (Suc n-i)))"
    9.92      by (simp add: times_S Suc_diff_le)
    9.93 -  also have "(\<Sum>i=0..n. real (Suc i) *# (S x (Suc i) * S y (n-i))) =
    9.94 -             (\<Sum>i=0..Suc n. real i *# (S x i * S y (Suc n-i)))"
    9.95 +  also have "(\<Sum>i=0..n. real (Suc i) *\<^sub>R (S x (Suc i) * S y (n-i))) =
    9.96 +             (\<Sum>i=0..Suc n. real i *\<^sub>R (S x i * S y (Suc n-i)))"
    9.97      by (subst setsum_cl_ivl_Suc2, simp)
    9.98 -  also have "(\<Sum>i=0..n. real (Suc n-i) *# (S x i * S y (Suc n-i))) =
    9.99 -             (\<Sum>i=0..Suc n. real (Suc n-i) *# (S x i * S y (Suc n-i)))"
   9.100 +  also have "(\<Sum>i=0..n. real (Suc n-i) *\<^sub>R (S x i * S y (Suc n-i))) =
   9.101 +             (\<Sum>i=0..Suc n. real (Suc n-i) *\<^sub>R (S x i * S y (Suc n-i)))"
   9.102      by (subst setsum_cl_ivl_Suc, simp)
   9.103 -  also have "(\<Sum>i=0..Suc n. real i *# (S x i * S y (Suc n-i))) +
   9.104 -             (\<Sum>i=0..Suc n. real (Suc n-i) *# (S x i * S y (Suc n-i))) =
   9.105 -             (\<Sum>i=0..Suc n. real (Suc n) *# (S x i * S y (Suc n-i)))"
   9.106 +  also have "(\<Sum>i=0..Suc n. real i *\<^sub>R (S x i * S y (Suc n-i))) +
   9.107 +             (\<Sum>i=0..Suc n. real (Suc n-i) *\<^sub>R (S x i * S y (Suc n-i))) =
   9.108 +             (\<Sum>i=0..Suc n. real (Suc n) *\<^sub>R (S x i * S y (Suc n-i)))"
   9.109      by (simp only: setsum_addf [symmetric] scaleR_left_distrib [symmetric]
   9.110                real_of_nat_add [symmetric], simp)
   9.111 -  also have "\<dots> = real (Suc n) *# (\<Sum>i=0..Suc n. S x i * S y (Suc n-i))"
   9.112 +  also have "\<dots> = real (Suc n) *\<^sub>R (\<Sum>i=0..Suc n. S x i * S y (Suc n-i))"
   9.113      by (simp only: scaleR_right.setsum)
   9.114    finally show
   9.115      "S (x + y) (Suc n) = (\<Sum>i=0..Suc n. S x i * S y (Suc n - i))"
    10.1 --- a/src/HOL/Lattices.thy	Tue Oct 16 23:12:38 2007 +0200
    10.2 +++ b/src/HOL/Lattices.thy	Tue Oct 16 23:12:45 2007 +0200
    10.3 @@ -33,18 +33,20 @@
    10.4  lemmas antisym_intro [intro!] = antisym
    10.5  lemmas (in -) [rule del] = antisym_intro
    10.6  
    10.7 -lemma le_infI1[intro]: "a \<sqsubseteq> x \<Longrightarrow> a \<sqinter> b \<sqsubseteq> x"
    10.8 -apply(subgoal_tac "a \<sqinter> b \<sqsubseteq> a")
    10.9 - apply(blast intro: order_trans)
   10.10 -apply simp
   10.11 -done
   10.12 +lemma le_infI1[intro]:
   10.13 +  assumes "a \<sqsubseteq> x"
   10.14 +  shows "a \<sqinter> b \<sqsubseteq> x"
   10.15 +proof (rule order_trans)
   10.16 +  show "a \<sqinter> b \<sqsubseteq> a" and "a \<sqsubseteq> x" using assms by simp
   10.17 +qed
   10.18  lemmas (in -) [rule del] = le_infI1
   10.19  
   10.20 -lemma le_infI2[intro]: "b \<sqsubseteq> x \<Longrightarrow> a \<sqinter> b \<sqsubseteq> x"
   10.21 -apply(subgoal_tac "a \<sqinter> b \<sqsubseteq> b")
   10.22 - apply(blast intro: order_trans)
   10.23 -apply simp
   10.24 -done
   10.25 +lemma le_infI2[intro]:
   10.26 +  assumes "b \<sqsubseteq> x"
   10.27 +  shows "a \<sqinter> b \<sqsubseteq> x"
   10.28 +proof (rule order_trans)
   10.29 +  show "a \<sqinter> b \<sqsubseteq> b" and "b \<sqsubseteq> x" using assms by simp
   10.30 +qed
   10.31  lemmas (in -) [rule del] = le_infI2
   10.32  
   10.33  lemma le_infI[intro!]: "x \<sqsubseteq> a \<Longrightarrow> x \<sqsubseteq> b \<Longrightarrow> x \<sqsubseteq> a \<sqinter> b"
   10.34 @@ -75,17 +77,11 @@
   10.35  lemmas (in -) [rule del] = antisym_intro
   10.36  
   10.37  lemma le_supI1[intro]: "x \<sqsubseteq> a \<Longrightarrow> x \<sqsubseteq> a \<squnion> b"
   10.38 -apply(subgoal_tac "a \<sqsubseteq> a \<squnion> b")
   10.39 - apply(blast intro: order_trans)
   10.40 -apply simp
   10.41 -done
   10.42 +  by (rule order_trans) auto
   10.43  lemmas (in -) [rule del] = le_supI1
   10.44  
   10.45  lemma le_supI2[intro]: "x \<sqsubseteq> b \<Longrightarrow> x \<sqsubseteq> a \<squnion> b"
   10.46 -apply(subgoal_tac "b \<sqsubseteq> a \<squnion> b")
   10.47 - apply(blast intro: order_trans)
   10.48 -apply simp
   10.49 -done
   10.50 +  by (rule order_trans) auto 
   10.51  lemmas (in -) [rule del] = le_supI2
   10.52  
   10.53  lemma le_supI[intro!]: "a \<sqsubseteq> x \<Longrightarrow> b \<sqsubseteq> x \<Longrightarrow> a \<squnion> b \<sqsubseteq> x"
   10.54 @@ -255,26 +251,26 @@
   10.55  
   10.56  lemma (in lower_semilattice) inf_unique:
   10.57    fixes f (infixl "\<triangle>" 70)
   10.58 -  assumes le1: "\<And>x y. x \<triangle> y \<^loc>\<le> x" and le2: "\<And>x y. x \<triangle> y \<^loc>\<le> y"
   10.59 -  and greatest: "\<And>x y z. x \<^loc>\<le> y \<Longrightarrow> x \<^loc>\<le> z \<Longrightarrow> x \<^loc>\<le> y \<triangle> z"
   10.60 +  assumes le1: "\<And>x y. x \<triangle> y \<le> x" and le2: "\<And>x y. x \<triangle> y \<le> y"
   10.61 +  and greatest: "\<And>x y z. x \<le> y \<Longrightarrow> x \<le> z \<Longrightarrow> x \<le> y \<triangle> z"
   10.62    shows "x \<sqinter> y = x \<triangle> y"
   10.63  proof (rule antisym)
   10.64 -  show "x \<triangle> y \<^loc>\<le> x \<sqinter> y" by (rule le_infI) (rule le1, rule le2)
   10.65 +  show "x \<triangle> y \<le> x \<sqinter> y" by (rule le_infI) (rule le1, rule le2)
   10.66  next
   10.67 -  have leI: "\<And>x y z. x \<^loc>\<le> y \<Longrightarrow> x \<^loc>\<le> z \<Longrightarrow> x \<^loc>\<le> y \<triangle> z" by (blast intro: greatest)
   10.68 -  show "x \<sqinter> y \<^loc>\<le> x \<triangle> y" by (rule leI) simp_all
   10.69 +  have leI: "\<And>x y z. x \<le> y \<Longrightarrow> x \<le> z \<Longrightarrow> x \<le> y \<triangle> z" by (blast intro: greatest)
   10.70 +  show "x \<sqinter> y \<le> x \<triangle> y" by (rule leI) simp_all
   10.71  qed
   10.72  
   10.73  lemma (in upper_semilattice) sup_unique:
   10.74    fixes f (infixl "\<nabla>" 70)
   10.75 -  assumes ge1 [simp]: "\<And>x y. x \<^loc>\<le> x \<nabla> y" and ge2: "\<And>x y. y \<^loc>\<le> x \<nabla> y"
   10.76 -  and least: "\<And>x y z. y \<^loc>\<le> x \<Longrightarrow> z \<^loc>\<le> x \<Longrightarrow> y \<nabla> z \<^loc>\<le> x"
   10.77 +  assumes ge1 [simp]: "\<And>x y. x \<le> x \<nabla> y" and ge2: "\<And>x y. y \<le> x \<nabla> y"
   10.78 +  and least: "\<And>x y z. y \<le> x \<Longrightarrow> z \<le> x \<Longrightarrow> y \<nabla> z \<le> x"
   10.79    shows "x \<squnion> y = x \<nabla> y"
   10.80  proof (rule antisym)
   10.81 -  show "x \<squnion> y \<^loc>\<le> x \<nabla> y" by (rule le_supI) (rule ge1, rule ge2)
   10.82 +  show "x \<squnion> y \<le> x \<nabla> y" by (rule le_supI) (rule ge1, rule ge2)
   10.83  next
   10.84 -  have leI: "\<And>x y z. x \<^loc>\<le> z \<Longrightarrow> y \<^loc>\<le> z \<Longrightarrow> x \<nabla> y \<^loc>\<le> z" by (blast intro: least)
   10.85 -  show "x \<nabla> y \<^loc>\<le> x \<squnion> y" by (rule leI) simp_all
   10.86 +  have leI: "\<And>x y z. x \<le> z \<Longrightarrow> y \<le> z \<Longrightarrow> x \<nabla> y \<le> z" by (blast intro: least)
   10.87 +  show "x \<nabla> y \<le> x \<squnion> y" by (rule leI) simp_all
   10.88  qed
   10.89    
   10.90  
   10.91 @@ -282,9 +278,9 @@
   10.92    special case of @{const inf}/@{const sup} *}
   10.93  
   10.94  lemma (in linorder) distrib_lattice_min_max:
   10.95 -  "distrib_lattice (op \<^loc>\<le>) (op \<^loc><) min max"
   10.96 +  "distrib_lattice (op \<le>) (op <) min max"
   10.97  proof unfold_locales
   10.98 -  have aux: "\<And>x y \<Colon> 'a. x \<^loc>< y \<Longrightarrow> y \<^loc>\<le> x \<Longrightarrow> x = y"
   10.99 +  have aux: "\<And>x y \<Colon> 'a. x < y \<Longrightarrow> y \<le> x \<Longrightarrow> x = y"
  10.100      by (auto simp add: less_le antisym)
  10.101    fix x y z
  10.102    show "max x (min y z) = min (max x y) (max x z)"
  10.103 @@ -333,10 +329,10 @@
  10.104       and Sup_least: "(\<And>x. x \<in> A \<Longrightarrow> x \<sqsubseteq> z) \<Longrightarrow> \<Squnion>A \<sqsubseteq> z"
  10.105  begin
  10.106  
  10.107 -lemma Inf_Sup: "\<Sqinter>A = \<Squnion>{b. \<forall>a \<in> A. b \<^loc>\<le> a}"
  10.108 +lemma Inf_Sup: "\<Sqinter>A = \<Squnion>{b. \<forall>a \<in> A. b \<le> a}"
  10.109    by (auto intro: Inf_lower Inf_greatest Sup_upper Sup_least)
  10.110  
  10.111 -lemma Sup_Inf:  "\<Squnion>A = \<Sqinter>{b. \<forall>a \<in> A. a \<^loc>\<le> b}"
  10.112 +lemma Sup_Inf:  "\<Squnion>A = \<Sqinter>{b. \<forall>a \<in> A. a \<le> b}"
  10.113    by (auto intro: Inf_lower Inf_greatest Sup_upper Sup_least)
  10.114  
  10.115  lemma Inf_Univ: "\<Sqinter>UNIV = \<Squnion>{}"
  10.116 @@ -411,10 +407,10 @@
  10.117  where
  10.118    "bot = Sup {}"
  10.119  
  10.120 -lemma top_greatest [simp]: "x \<^loc>\<le> top"
  10.121 +lemma top_greatest [simp]: "x \<le> top"
  10.122    by (unfold top_def, rule Inf_greatest, simp)
  10.123  
  10.124 -lemma bot_least [simp]: "bot \<^loc>\<le> x"
  10.125 +lemma bot_least [simp]: "bot \<le> x"
  10.126    by (unfold bot_def, rule Sup_least, simp)
  10.127  
  10.128  definition
  10.129 @@ -584,4 +580,16 @@
  10.130  lemmas inf_aci = inf_ACI
  10.131  lemmas sup_aci = sup_ACI
  10.132  
  10.133 +no_notation
  10.134 +  inf (infixl "\<sqinter>" 70)
  10.135 +
  10.136 +no_notation
  10.137 +  sup (infixl "\<squnion>" 65)
  10.138 +
  10.139 +no_notation
  10.140 +  Inf ("\<Sqinter>_" [900] 900)
  10.141 +
  10.142 +no_notation
  10.143 +  Sup ("\<Squnion>_" [900] 900)
  10.144 +
  10.145  end
    11.1 --- a/src/HOL/Library/Kleene_Algebras.thy	Tue Oct 16 23:12:38 2007 +0200
    11.2 +++ b/src/HOL/Library/Kleene_Algebras.thy	Tue Oct 16 23:12:45 2007 +0200
    11.3 @@ -15,15 +15,15 @@
    11.4    fixes star :: "'a \<Rightarrow> 'a"
    11.5  
    11.6  class idem_add = ab_semigroup_add +
    11.7 -  assumes add_idem [simp]: "x \<^loc>+ x = x"
    11.8 +  assumes add_idem [simp]: "x + x = x"
    11.9  
   11.10  lemma add_idem2[simp]: "(x::'a::idem_add) + (x + y) = x + y"
   11.11    unfolding add_assoc[symmetric]
   11.12    by simp
   11.13  
   11.14  class order_by_add = idem_add + ord +
   11.15 -  assumes order_def: "a \<^loc>\<le> b \<longleftrightarrow> a \<^loc>+ b = b"
   11.16 -  assumes strict_order_def: "a \<^loc>< b \<longleftrightarrow> a \<^loc>\<le> b \<and> a \<noteq> b"
   11.17 +  assumes order_def: "a \<le> b \<longleftrightarrow> a + b = b"
   11.18 +  assumes strict_order_def: "a < b \<longleftrightarrow> a \<le> b \<and> a \<noteq> b"
   11.19  
   11.20  lemma ord_simp1[simp]: "(x::'a::order_by_add) \<le> y \<Longrightarrow> x + y = y"
   11.21    unfolding order_def .
   11.22 @@ -82,14 +82,14 @@
   11.23  qed
   11.24  
   11.25  class kleene = pre_kleene + star +
   11.26 -  assumes star1: "\<^loc>1 \<^loc>+ a \<^loc>* star a \<^loc>\<le> star a"
   11.27 -  and star2: "\<^loc>1 \<^loc>+ star a \<^loc>* a \<^loc>\<le> star a"
   11.28 -  and star3: "a \<^loc>* x \<^loc>\<le> x \<Longrightarrow> star a \<^loc>* x \<^loc>\<le> x"
   11.29 -  and star4: "x \<^loc>* a \<^loc>\<le> x \<Longrightarrow> x \<^loc>* star a \<^loc>\<le> x"
   11.30 +  assumes star1: "1 + a * star a \<le> star a"
   11.31 +  and star2: "1 + star a * a \<le> star a"
   11.32 +  and star3: "a * x \<le> x \<Longrightarrow> star a * x \<le> x"
   11.33 +  and star4: "x * a \<le> x \<Longrightarrow> x * star a \<le> x"
   11.34  
   11.35  class kleene_by_complete_lattice = pre_kleene
   11.36    + complete_lattice + recpower + star +
   11.37 -  assumes star_cont: "a \<^loc>* star b \<^loc>* c = SUPR UNIV (\<lambda>n. a \<^loc>* b \<^loc>^ n \<^loc>* c)"
   11.38 +  assumes star_cont: "a * star b * c = SUPR UNIV (\<lambda>n. a * b ^ n * c)"
   11.39  
   11.40  lemma plus_leI: 
   11.41    fixes x :: "'a :: order_by_add"
    12.1 --- a/src/HOL/Library/Quicksort.thy	Tue Oct 16 23:12:38 2007 +0200
    12.2 +++ b/src/HOL/Library/Quicksort.thy	Tue Oct 16 23:12:45 2007 +0200
    12.3 @@ -14,7 +14,7 @@
    12.4  
    12.5  function quicksort :: "'a list \<Rightarrow> 'a list" where
    12.6  "quicksort []     = []" |
    12.7 -"quicksort (x#xs) = quicksort([y\<leftarrow>xs. ~ x\<^loc>\<le>y]) @ [x] @ quicksort([y\<leftarrow>xs. x\<^loc>\<le>y])"
    12.8 +"quicksort (x#xs) = quicksort([y\<leftarrow>xs. ~ x\<le>y]) @ [x] @ quicksort([y\<leftarrow>xs. x\<le>y])"
    12.9  by pat_completeness auto
   12.10  
   12.11  termination
    13.1 --- a/src/HOL/Library/Quotient.thy	Tue Oct 16 23:12:38 2007 +0200
    13.2 +++ b/src/HOL/Library/Quotient.thy	Tue Oct 16 23:12:45 2007 +0200
    13.3 @@ -22,12 +22,12 @@
    13.4  *}
    13.5  
    13.6  class eqv = type +
    13.7 -  fixes eqv :: "'a \<Rightarrow> 'a \<Rightarrow> bool"    (infixl "\<^loc>\<sim>" 50)
    13.8 +  fixes eqv :: "'a \<Rightarrow> 'a \<Rightarrow> bool"    (infixl "\<sim>" 50)
    13.9  
   13.10  class equiv = eqv +
   13.11 -  assumes equiv_refl [intro]: "x \<^loc>\<sim> x"
   13.12 -  assumes equiv_trans [trans]: "x \<^loc>\<sim> y \<Longrightarrow> y \<^loc>\<sim> z \<Longrightarrow> x \<^loc>\<sim> z"
   13.13 -  assumes equiv_sym [sym]: "x \<^loc>\<sim> y \<Longrightarrow> y \<^loc>\<sim> x"
   13.14 +  assumes equiv_refl [intro]: "x \<sim> x"
   13.15 +  assumes equiv_trans [trans]: "x \<sim> y \<Longrightarrow> y \<sim> z \<Longrightarrow> x \<sim> z"
   13.16 +  assumes equiv_sym [sym]: "x \<sim> y \<Longrightarrow> y \<sim> x"
   13.17  
   13.18  lemma equiv_not_sym [sym]: "\<not> (x \<sim> y) ==> \<not> (y \<sim> (x::'a::equiv))"
   13.19  proof -
    14.1 --- a/src/HOL/List.thy	Tue Oct 16 23:12:38 2007 +0200
    14.2 +++ b/src/HOL/List.thy	Tue Oct 16 23:12:45 2007 +0200
    14.3 @@ -218,11 +218,11 @@
    14.4  fun (in linorder) sorted :: "'a list \<Rightarrow> bool" where
    14.5  "sorted [] \<longleftrightarrow> True" |
    14.6  "sorted [x] \<longleftrightarrow> True" |
    14.7 -"sorted (x#y#zs) \<longleftrightarrow> x \<^loc><= y \<and> sorted (y#zs)"
    14.8 +"sorted (x#y#zs) \<longleftrightarrow> x <= y \<and> sorted (y#zs)"
    14.9  
   14.10  fun (in linorder) insort :: "'a \<Rightarrow> 'a list \<Rightarrow> 'a list" where
   14.11  "insort x [] = [x]" |
   14.12 -"insort x (y#ys) = (if x \<^loc><= y then (x#y#ys) else y#(insort x ys))"
   14.13 +"insort x (y#ys) = (if x <= y then (x#y#ys) else y#(insort x ys))"
   14.14  
   14.15  fun (in linorder) sort :: "'a list \<Rightarrow> 'a list" where
   14.16  "sort [] = []" |
   14.17 @@ -1816,11 +1816,11 @@
   14.18  by (induct k arbitrary: a b l) simp_all
   14.19  
   14.20  lemma (in semigroup_add) foldl_assoc:
   14.21 -shows "foldl op\<^loc>+ (x\<^loc>+y) zs = x \<^loc>+ (foldl op\<^loc>+ y zs)"
   14.22 +shows "foldl op+ (x+y) zs = x + (foldl op+ y zs)"
   14.23  by (induct zs arbitrary: y) (simp_all add:add_assoc)
   14.24  
   14.25  lemma (in monoid_add) foldl_absorb0:
   14.26 -shows "x \<^loc>+ (foldl op\<^loc>+ \<^loc>0 zs) = foldl op\<^loc>+ x zs"
   14.27 +shows "x + (foldl op+ 0 zs) = foldl op+ x zs"
   14.28  by (induct zs) (simp_all add:foldl_assoc)
   14.29  
   14.30  
   14.31 @@ -1843,7 +1843,7 @@
   14.32  lemma foldl_foldr: "foldl f a xs = foldr (%x y. f y x) (rev xs) a"
   14.33  by (simp add: foldr_foldl [of "%x y. f y x" "rev xs"])
   14.34  
   14.35 -lemma (in ab_semigroup_add) foldr_conv_foldl: "foldr op \<^loc>+ xs a = foldl op \<^loc>+ a xs"
   14.36 +lemma (in ab_semigroup_add) foldr_conv_foldl: "foldr op + xs a = foldl op + a xs"
   14.37    by (induct xs, auto simp add: foldl_assoc add_commute)
   14.38  
   14.39  text {*
   14.40 @@ -2526,12 +2526,12 @@
   14.41  context linorder
   14.42  begin
   14.43  
   14.44 -lemma sorted_Cons: "sorted (x#xs) = (sorted xs & (ALL y:set xs. x \<^loc><= y))"
   14.45 +lemma sorted_Cons: "sorted (x#xs) = (sorted xs & (ALL y:set xs. x <= y))"
   14.46  apply(induct xs arbitrary: x) apply simp
   14.47  by simp (blast intro: order_trans)
   14.48  
   14.49  lemma sorted_append:
   14.50 -  "sorted (xs@ys) = (sorted xs & sorted ys & (\<forall>x \<in> set xs. \<forall>y \<in> set ys. x\<^loc>\<le>y))"
   14.51 +  "sorted (xs@ys) = (sorted xs & sorted ys & (\<forall>x \<in> set xs. \<forall>y \<in> set ys. x\<le>y))"
   14.52  by (induct xs) (auto simp add:sorted_Cons)
   14.53  
   14.54  lemma set_insort: "set(insort x xs) = insert x (set xs)"
   14.55 @@ -2583,32 +2583,32 @@
   14.56  
   14.57  class finite_intvl_succ = linorder +
   14.58  fixes successor :: "'a \<Rightarrow> 'a"
   14.59 -assumes finite_intvl: "finite(ord.atLeastAtMost (op \<^loc>\<le>) a b)" (* FIXME should be finite({a..b}) *)
   14.60 -and successor_incr: "a \<^loc>< successor a"
   14.61 -and ord_discrete: "\<not>(\<exists>x. a \<^loc>< x & x \<^loc>< successor a)"
   14.62 +assumes finite_intvl: "finite(ord.atLeastAtMost (op \<le>) a b)" (* FIXME should be finite({a..b}) *)
   14.63 +and successor_incr: "a < successor a"
   14.64 +and ord_discrete: "\<not>(\<exists>x. a < x & x < successor a)"
   14.65  
   14.66  context finite_intvl_succ
   14.67  begin
   14.68  
   14.69  definition
   14.70 - upto :: "'a \<Rightarrow> 'a \<Rightarrow> 'a list" ("(1\<^loc>[_../_])") where
   14.71 -"upto i j == THE is. set is = \<^loc>{i..j} & sorted is & distinct is"
   14.72 -
   14.73 -lemma set_upto[simp]: "set\<^loc>[a..b] = \<^loc>{a..b}"
   14.74 + upto :: "'a \<Rightarrow> 'a \<Rightarrow> 'a list" ("(1[_../_])") where
   14.75 +"upto i j == THE is. set is = {i..j} & sorted is & distinct is"
   14.76 +
   14.77 +lemma set_upto[simp]: "set[a..b] = {a..b}"
   14.78  apply(simp add:upto_def)
   14.79  apply(rule the1I2)
   14.80  apply(simp_all add: finite_sorted_distinct_unique finite_intvl)
   14.81  done
   14.82  
   14.83 -lemma insert_intvl: "i \<^loc>\<le> j \<Longrightarrow> insert i \<^loc>{successor i..j} = \<^loc>{i..j}"
   14.84 +lemma insert_intvl: "i \<le> j \<Longrightarrow> insert i {successor i..j} = {i..j}"
   14.85  apply(insert successor_incr[of i])
   14.86  apply(auto simp: atLeastAtMost_def atLeast_def atMost_def)
   14.87  apply (metis ord_discrete less_le not_le)
   14.88  done
   14.89  
   14.90 -lemma upto_rec[code]: "\<^loc>[i..j] = (if i \<^loc>\<le> j then i # \<^loc>[successor i..j] else [])"
   14.91 +lemma upto_rec[code]: "[i..j] = (if i \<le> j then i # [successor i..j] else [])"
   14.92  proof cases
   14.93 -  assume "i \<^loc>\<le> j" thus ?thesis
   14.94 +  assume "i \<le> j" thus ?thesis
   14.95      apply(simp add:upto_def)
   14.96      apply (rule the1_equality[OF finite_sorted_distinct_unique])
   14.97       apply (simp add:finite_intvl)
   14.98 @@ -2618,7 +2618,7 @@
   14.99      apply (metis successor_incr leD less_imp_le order_trans)
  14.100      done
  14.101  next
  14.102 -  assume "~ i \<^loc>\<le> j" thus ?thesis
  14.103 +  assume "~ i \<le> j" thus ?thesis
  14.104      by(simp add:upto_def atLeastAtMost_empty cong:conj_cong)
  14.105  qed
  14.106  
    15.1 --- a/src/HOL/Nat.thy	Tue Oct 16 23:12:38 2007 +0200
    15.2 +++ b/src/HOL/Nat.thy	Tue Oct 16 23:12:45 2007 +0200
    15.3 @@ -1154,7 +1154,7 @@
    15.4  begin
    15.5  
    15.6  definition
    15.7 -  of_nat_def: "of_nat = nat_rec \<^loc>0 (\<lambda>_. (op \<^loc>+) \<^loc>1)"
    15.8 +  of_nat_def: "of_nat = nat_rec 0 (\<lambda>_. (op +) 1)"
    15.9  
   15.10  end
   15.11  
   15.12 @@ -1340,8 +1340,8 @@
   15.13  begin
   15.14  
   15.15  lemma of_nat_simps [simp, code]:
   15.16 -  shows of_nat_0:   "of_nat 0 = \<^loc>0"
   15.17 -    and of_nat_Suc: "of_nat (Suc m) = \<^loc>1 \<^loc>+ of_nat m"
   15.18 +  shows of_nat_0:   "of_nat 0 = 0"
   15.19 +    and of_nat_Suc: "of_nat (Suc m) = 1 + of_nat m"
   15.20    unfolding of_nat_def by simp_all
   15.21  
   15.22  end
   15.23 @@ -1405,7 +1405,7 @@
   15.24  
   15.25  class semiring_char_0 = semiring_1 +
   15.26    assumes of_nat_eq_iff [simp]:
   15.27 -    "(Nat.semiring_1.of_nat \<^loc>1 \<^loc>0 (op \<^loc>+) m = Nat.semiring_1.of_nat \<^loc>1 \<^loc>0 (op \<^loc>+)  n) = (m = n)"
   15.28 +    "of_nat m = of_nat n \<longleftrightarrow> m = n"
   15.29  
   15.30  text{*Every @{text ordered_semidom} has characteristic zero.*}
   15.31  instance ordered_semidom < semiring_char_0
    16.1 --- a/src/HOL/OrderedGroup.thy	Tue Oct 16 23:12:38 2007 +0200
    16.2 +++ b/src/HOL/OrderedGroup.thy	Tue Oct 16 23:12:45 2007 +0200
    16.3 @@ -27,58 +27,75 @@
    16.4  subsection {* Semigroups and Monoids *}
    16.5  
    16.6  class semigroup_add = plus +
    16.7 -  assumes add_assoc: "(a \<^loc>+ b) \<^loc>+ c = a \<^loc>+ (b \<^loc>+ c)"
    16.8 +  assumes add_assoc: "(a + b) + c = a + (b + c)"
    16.9  
   16.10  class ab_semigroup_add = semigroup_add +
   16.11 -  assumes add_commute: "a \<^loc>+ b = b \<^loc>+ a"
   16.12 +  assumes add_commute: "a + b = b + a"
   16.13 +begin
   16.14  
   16.15 -lemma add_left_commute: "a + (b + c) = b + (a + (c::'a::ab_semigroup_add))"
   16.16 -  by (rule mk_left_commute [of "op +", OF add_assoc add_commute])
   16.17 +lemma add_left_commute: "a + (b + c) = b + (a + c)"
   16.18 +  by (rule mk_left_commute [of "plus", OF add_assoc add_commute])
   16.19 +  (*FIXME term_check*)
   16.20 +
   16.21 +theorems add_ac = add_assoc add_commute add_left_commute
   16.22 +
   16.23 +end
   16.24  
   16.25  theorems add_ac = add_assoc add_commute add_left_commute
   16.26  
   16.27  class semigroup_mult = times +
   16.28 -  assumes mult_assoc: "(a \<^loc>* b) \<^loc>* c = a \<^loc>* (b \<^loc>* c)"
   16.29 +  assumes mult_assoc: "(a * b) * c = a * (b * c)"
   16.30  
   16.31  class ab_semigroup_mult = semigroup_mult +
   16.32 -  assumes mult_commute: "a \<^loc>* b = b \<^loc>* a"
   16.33 +  assumes mult_commute: "a * b = b * a"
   16.34  begin
   16.35  
   16.36 -lemma mult_left_commute: "a \<^loc>* (b \<^loc>* c) = b \<^loc>* (a \<^loc>* c)"
   16.37 -  by (rule mk_left_commute [of "op \<^loc>*", OF mult_assoc mult_commute])
   16.38 +lemma mult_left_commute: "a * (b * c) = b * (a * c)"
   16.39 +  by (rule mk_left_commute [of "times", OF mult_assoc mult_commute])
   16.40 +  (*FIXME term_check*)
   16.41 +
   16.42 +theorems mult_ac = mult_assoc mult_commute mult_left_commute
   16.43  
   16.44  end
   16.45  
   16.46  theorems mult_ac = mult_assoc mult_commute mult_left_commute
   16.47  
   16.48  class monoid_add = zero + semigroup_add +
   16.49 -  assumes add_0_left [simp]: "\<^loc>0 \<^loc>+ a = a" and add_0_right [simp]: "a \<^loc>+ \<^loc>0 = a"
   16.50 +  assumes add_0_left [simp]: "0 + a = a"
   16.51 +    and add_0_right [simp]: "a + 0 = a"
   16.52  
   16.53  class comm_monoid_add = zero + ab_semigroup_add +
   16.54 -  assumes add_0: "\<^loc>0 \<^loc>+ a = a"
   16.55 +  assumes add_0: "0 + a = a"
   16.56 +begin
   16.57  
   16.58 -instance comm_monoid_add < monoid_add
   16.59 -by intro_classes (insert comm_monoid_add_class.zero_plus.add_0, simp_all add: add_commute, auto)
   16.60 +subclass monoid_add
   16.61 +  by unfold_locales (insert add_0, simp_all add: add_commute)
   16.62 +
   16.63 +end
   16.64  
   16.65  class monoid_mult = one + semigroup_mult +
   16.66 -  assumes mult_1_left [simp]: "\<^loc>1 \<^loc>* a  = a"
   16.67 -  assumes mult_1_right [simp]: "a \<^loc>* \<^loc>1 = a"
   16.68 +  assumes mult_1_left [simp]: "1 * a  = a"
   16.69 +  assumes mult_1_right [simp]: "a * 1 = a"
   16.70  
   16.71  class comm_monoid_mult = one + ab_semigroup_mult +
   16.72 -  assumes mult_1: "\<^loc>1 \<^loc>* a = a"
   16.73 +  assumes mult_1: "1 * a = a"
   16.74 +begin
   16.75  
   16.76 -instance comm_monoid_mult \<subseteq> monoid_mult
   16.77 -  by intro_classes (insert mult_1, simp_all add: mult_commute, auto)
   16.78 +subclass monoid_mult
   16.79 +  by unfold_locales (insert mult_1, simp_all add: mult_commute) 
   16.80 +
   16.81 +end
   16.82  
   16.83  class cancel_semigroup_add = semigroup_add +
   16.84 -  assumes add_left_imp_eq: "a \<^loc>+ b = a \<^loc>+ c \<Longrightarrow> b = c"
   16.85 -  assumes add_right_imp_eq: "b \<^loc>+ a = c \<^loc>+ a \<Longrightarrow> b = c"
   16.86 +  assumes add_left_imp_eq: "a + b = a + c \<Longrightarrow> b = c"
   16.87 +  assumes add_right_imp_eq: "b + a = c + a \<Longrightarrow> b = c"
   16.88  
   16.89  class cancel_ab_semigroup_add = ab_semigroup_add +
   16.90 -  assumes add_imp_eq: "a \<^loc>+ b = a \<^loc>+ c \<Longrightarrow> b = c"
   16.91 +  assumes add_imp_eq: "a + b = a + c \<Longrightarrow> b = c"
   16.92 +begin
   16.93  
   16.94 -instance cancel_ab_semigroup_add \<subseteq> cancel_semigroup_add
   16.95 -proof intro_classes
   16.96 +subclass cancel_semigroup_add
   16.97 +proof unfold_locales
   16.98    fix a b c :: 'a
   16.99    assume "a + b = a + c" 
  16.100    then show "b = c" by (rule add_imp_eq)
  16.101 @@ -89,60 +106,50 @@
  16.102    then show "b = c" by (rule add_imp_eq)
  16.103  qed
  16.104  
  16.105 +end context cancel_ab_semigroup_add begin
  16.106 +
  16.107  lemma add_left_cancel [simp]:
  16.108 -  "a + b = a + c \<longleftrightarrow> b = (c \<Colon> 'a\<Colon>cancel_semigroup_add)"
  16.109 +  "a + b = a + c \<longleftrightarrow> b = c"
  16.110    by (blast dest: add_left_imp_eq)
  16.111  
  16.112  lemma add_right_cancel [simp]:
  16.113 -  "b + a = c + a \<longleftrightarrow> b = (c \<Colon> 'a\<Colon>cancel_semigroup_add)"
  16.114 +  "b + a = c + a \<longleftrightarrow> b = c"
  16.115    by (blast dest: add_right_imp_eq)
  16.116  
  16.117 +end
  16.118 +
  16.119  subsection {* Groups *}
  16.120  
  16.121 -class ab_group_add = minus + comm_monoid_add +
  16.122 -  assumes ab_left_minus: "uminus a \<^loc>+ a = \<^loc>0"
  16.123 -  assumes ab_diff_minus: "a \<^loc>- b = a \<^loc>+ (uminus b)"
  16.124 -
  16.125  class group_add = minus + monoid_add +
  16.126 -  assumes left_minus [simp]: "uminus a \<^loc>+ a = \<^loc>0"
  16.127 -  assumes diff_minus: "a \<^loc>- b = a \<^loc>+ (uminus b)"
  16.128 -
  16.129 -instance ab_group_add < group_add
  16.130 -by intro_classes (simp_all add: ab_left_minus ab_diff_minus)
  16.131 +  assumes left_minus [simp]: "- a + a = 0"
  16.132 +  assumes diff_minus: "a - b = a + (- b)"
  16.133 +begin
  16.134  
  16.135 -instance ab_group_add \<subseteq> cancel_ab_semigroup_add
  16.136 -proof intro_classes
  16.137 -  fix a b c :: 'a
  16.138 -  assume "a + b = a + c"
  16.139 -  then have "uminus a + a + b = uminus a + a + c" unfolding add_assoc by simp
  16.140 -  then show "b = c" by simp
  16.141 -qed
  16.142 +lemma minus_add_cancel: "- a + (a + b) = b"
  16.143 +  by (simp add: add_assoc[symmetric])
  16.144  
  16.145 -lemma minus_add_cancel: "-(a::'a::group_add) + (a+b) = b"
  16.146 -by(simp add:add_assoc[symmetric])
  16.147 -
  16.148 -lemma minus_zero[simp]: "-(0::'a::group_add) = 0"
  16.149 +lemma minus_zero [simp]: "- 0 = 0"
  16.150  proof -
  16.151 -  have "-(0::'a::group_add) = - 0 + (0+0)" by(simp only: add_0_right)
  16.152 -  also have "\<dots> = 0" by(rule minus_add_cancel)
  16.153 +  have "- 0 = - 0 + (0 + 0)" by (simp only: add_0_right)
  16.154 +  also have "\<dots> = 0" by (rule minus_add_cancel)
  16.155    finally show ?thesis .
  16.156  qed
  16.157  
  16.158 -lemma minus_minus[simp]: "- (-(a::'a::group_add)) = a"
  16.159 +lemma minus_minus [simp]: "- (- a) = a"
  16.160  proof -
  16.161 -  have "-(-a) = -(-a) + (-a + a)" by simp
  16.162 -  also have "\<dots> = a" by(rule minus_add_cancel)
  16.163 +  have "- (- a) = - (- a) + (- a + a)" by simp
  16.164 +  also have "\<dots> = a" by (rule minus_add_cancel)
  16.165    finally show ?thesis .
  16.166  qed
  16.167  
  16.168 -lemma right_minus[simp]: "a + - a = (0::'a::group_add)"
  16.169 +lemma right_minus [simp]: "a + - a = 0"
  16.170  proof -
  16.171 -  have "a + -a = -(-a) + -a" by simp
  16.172 -  also have "\<dots> = 0" thm group_add.left_minus by(rule left_minus)
  16.173 +  have "a + - a = - (- a) + - a" by simp
  16.174 +  also have "\<dots> = 0" by (rule left_minus)
  16.175    finally show ?thesis .
  16.176  qed
  16.177  
  16.178 -lemma right_minus_eq: "(a - b = 0) = (a = (b::'a::group_add))"
  16.179 +lemma right_minus_eq: "a - b = 0 \<longleftrightarrow> a = b"
  16.180  proof
  16.181    assume "a - b = 0"
  16.182    have "a = (a - b) + b" by (simp add:diff_minus add_assoc)
  16.183 @@ -152,154 +159,173 @@
  16.184    assume "a = b" thus "a - b = 0" by (simp add: diff_minus)
  16.185  qed
  16.186  
  16.187 -lemma equals_zero_I: assumes "a+b = 0" shows "-a = (b::'a::group_add)"
  16.188 +lemma equals_zero_I:
  16.189 +  assumes "a + b = 0"
  16.190 +  shows "- a = b"
  16.191  proof -
  16.192 -  have "- a = -a + (a+b)" using assms by simp
  16.193 -  also have "\<dots> = b" by(simp add:add_assoc[symmetric])
  16.194 +  have "- a = - a + (a + b)" using assms by simp
  16.195 +  also have "\<dots> = b" by (simp add: add_assoc[symmetric])
  16.196    finally show ?thesis .
  16.197  qed
  16.198  
  16.199 -lemma diff_self[simp]: "(a::'a::group_add) - a = 0"
  16.200 -by(simp add: diff_minus)
  16.201 +lemma diff_self [simp]: "a - a = 0"
  16.202 +  by (simp add: diff_minus)
  16.203  
  16.204 -lemma diff_0 [simp]: "(0::'a::group_add) - a = -a"
  16.205 -by (simp add: diff_minus)
  16.206 +lemma diff_0 [simp]: "0 - a = - a"
  16.207 +  by (simp add: diff_minus)
  16.208  
  16.209 -lemma diff_0_right [simp]: "a - (0::'a::group_add) = a" 
  16.210 -by (simp add: diff_minus)
  16.211 +lemma diff_0_right [simp]: "a - 0 = a" 
  16.212 +  by (simp add: diff_minus)
  16.213  
  16.214 -lemma diff_minus_eq_add [simp]: "a - - b = a + (b::'a::group_add)"
  16.215 -by (simp add: diff_minus)
  16.216 +lemma diff_minus_eq_add [simp]: "a - - b = a + b"
  16.217 +  by (simp add: diff_minus)
  16.218  
  16.219 -lemma uminus_add_conv_diff: "-a + b = b - (a::'a::ab_group_add)"
  16.220 -by(simp add:diff_minus add_commute)
  16.221 -
  16.222 -lemma neg_equal_iff_equal [simp]: "(-a = -b) = (a = (b::'a::group_add))" 
  16.223 +lemma neg_equal_iff_equal [simp]:
  16.224 +  "- a = - b \<longleftrightarrow> a = b" 
  16.225  proof 
  16.226    assume "- a = - b"
  16.227    hence "- (- a) = - (- b)"
  16.228      by simp
  16.229 -  thus "a=b" by simp
  16.230 +  thus "a = b" by simp
  16.231  next
  16.232 -  assume "a=b"
  16.233 -  thus "-a = -b" by simp
  16.234 +  assume "a = b"
  16.235 +  thus "- a = - b" by simp
  16.236  qed
  16.237  
  16.238 -lemma neg_equal_0_iff_equal [simp]: "(-a = 0) = (a = (0::'a::group_add))"
  16.239 -by (subst neg_equal_iff_equal [symmetric], simp)
  16.240 +lemma neg_equal_0_iff_equal [simp]:
  16.241 +  "- a = 0 \<longleftrightarrow> a = 0"
  16.242 +  by (subst neg_equal_iff_equal [symmetric], simp)
  16.243  
  16.244 -lemma neg_0_equal_iff_equal [simp]: "(0 = -a) = (0 = (a::'a::group_add))"
  16.245 -by (subst neg_equal_iff_equal [symmetric], simp)
  16.246 +lemma neg_0_equal_iff_equal [simp]:
  16.247 +  "0 = - a \<longleftrightarrow> 0 = a"
  16.248 +  by (subst neg_equal_iff_equal [symmetric], simp)
  16.249  
  16.250  text{*The next two equations can make the simplifier loop!*}
  16.251  
  16.252 -lemma equation_minus_iff: "(a = - b) = (b = - (a::'a::group_add))"
  16.253 +lemma equation_minus_iff:
  16.254 +  "a = - b \<longleftrightarrow> b = - a"
  16.255  proof -
  16.256 -  have "(- (-a) = - b) = (- a = b)" by (rule neg_equal_iff_equal)
  16.257 +  have "- (- a) = - b \<longleftrightarrow> - a = b" by (rule neg_equal_iff_equal)
  16.258 +  thus ?thesis by (simp add: eq_commute)
  16.259 +qed
  16.260 +
  16.261 +lemma minus_equation_iff:
  16.262 +  "- a = b \<longleftrightarrow> - b = a"
  16.263 +proof -
  16.264 +  have "- a = - (- b) \<longleftrightarrow> a = -b" by (rule neg_equal_iff_equal)
  16.265    thus ?thesis by (simp add: eq_commute)
  16.266  qed
  16.267  
  16.268 -lemma minus_equation_iff: "(- a = b) = (- (b::'a::group_add) = a)"
  16.269 -proof -
  16.270 -  have "(- a = - (-b)) = (a = -b)" by (rule neg_equal_iff_equal)
  16.271 -  thus ?thesis by (simp add: eq_commute)
  16.272 +end
  16.273 +
  16.274 +class ab_group_add = minus + comm_monoid_add +
  16.275 +  assumes ab_left_minus: "- a + a = 0"
  16.276 +  assumes ab_diff_minus: "a - b = a + (- b)"
  16.277 +
  16.278 +subclass (in ab_group_add) group_add
  16.279 +  by unfold_locales (simp_all add: ab_left_minus ab_diff_minus)
  16.280 +
  16.281 +subclass (in ab_group_add) cancel_semigroup_add
  16.282 +proof unfold_locales
  16.283 +  fix a b c :: 'a
  16.284 +  assume "a + b = a + c"
  16.285 +  then have "- a + a + b = - a + a + c"
  16.286 +    unfolding add_assoc by simp
  16.287 +  then show "b = c" by simp
  16.288 +next
  16.289 +  fix a b c :: 'a
  16.290 +  assume "b + a = c + a"
  16.291 +  then have "b + (a + - a) = c + (a + - a)"
  16.292 +    unfolding add_assoc [symmetric] by simp
  16.293 +  then show "b = c" by simp
  16.294  qed
  16.295  
  16.296 -lemma minus_add_distrib [simp]: "- (a + b) = -a + -(b::'a::ab_group_add)"
  16.297 -apply (rule equals_zero_I)
  16.298 -apply (simp add: add_ac)
  16.299 -done
  16.300 +subclass (in ab_group_add) cancel_ab_semigroup_add
  16.301 +proof unfold_locales
  16.302 +  fix a b c :: 'a
  16.303 +  assume "a + b = a + c"
  16.304 +  then have "- a + a + b = - a + a + c"
  16.305 +    unfolding add_assoc by simp
  16.306 +  then show "b = c" by simp
  16.307 +qed
  16.308 +
  16.309 +context ab_group_add
  16.310 +begin
  16.311  
  16.312 -lemma minus_diff_eq [simp]: "- (a - b) = b - (a::'a::ab_group_add)"
  16.313 -by (simp add: diff_minus add_commute)
  16.314 +lemma uminus_add_conv_diff:
  16.315 +  "- a + b = b - a"
  16.316 +  by (simp add:diff_minus add_commute)
  16.317 +
  16.318 +lemma minus_add_distrib [simp]:
  16.319 +  "- (a + b) = - a + - b"
  16.320 +  by (rule equals_zero_I) (simp add: add_ac)
  16.321 +
  16.322 +lemma minus_diff_eq [simp]:
  16.323 +  "- (a - b) = b - a"
  16.324 +  by (simp add: diff_minus add_commute)
  16.325 +
  16.326 +end
  16.327  
  16.328  subsection {* (Partially) Ordered Groups *} 
  16.329  
  16.330  class pordered_ab_semigroup_add = order + ab_semigroup_add +
  16.331 -  assumes add_left_mono: "a \<^loc>\<le> b \<Longrightarrow> c \<^loc>+ a \<^loc>\<le> c \<^loc>+ b"
  16.332 -
  16.333 -class pordered_cancel_ab_semigroup_add =
  16.334 -  pordered_ab_semigroup_add + cancel_ab_semigroup_add
  16.335 -
  16.336 -class pordered_ab_semigroup_add_imp_le = pordered_cancel_ab_semigroup_add +
  16.337 -  assumes add_le_imp_le_left: "c \<^loc>+ a \<^loc>\<le> c \<^loc>+ b \<Longrightarrow> a \<^loc>\<le> b"
  16.338 -
  16.339 -class pordered_ab_group_add = ab_group_add + pordered_ab_semigroup_add
  16.340 -
  16.341 -instance pordered_ab_group_add \<subseteq> pordered_ab_semigroup_add_imp_le
  16.342 -proof
  16.343 -  fix a b c :: 'a
  16.344 -  assume "c + a \<le> c + b"
  16.345 -  hence "(-c) + (c + a) \<le> (-c) + (c + b)" by (rule add_left_mono)
  16.346 -  hence "((-c) + c) + a \<le> ((-c) + c) + b" by (simp only: add_assoc)
  16.347 -  thus "a \<le> b" by simp
  16.348 -qed
  16.349 -
  16.350 -class ordered_ab_semigroup_add =
  16.351 -  linorder + pordered_ab_semigroup_add
  16.352 +  assumes add_left_mono: "a \<le> b \<Longrightarrow> c + a \<le> c + b"
  16.353 +begin
  16.354  
  16.355 -class ordered_cancel_ab_semigroup_add =
  16.356 -  linorder + pordered_cancel_ab_semigroup_add
  16.357 -
  16.358 -instance ordered_cancel_ab_semigroup_add \<subseteq> ordered_ab_semigroup_add ..
  16.359 -
  16.360 -instance ordered_cancel_ab_semigroup_add \<subseteq> pordered_ab_semigroup_add_imp_le
  16.361 -proof
  16.362 -  fix a b c :: 'a
  16.363 -  assume le: "c + a <= c + b"  
  16.364 -  show "a <= b"
  16.365 -  proof (rule ccontr)
  16.366 -    assume w: "~ a \<le> b"
  16.367 -    hence "b <= a" by (simp add: linorder_not_le)
  16.368 -    hence le2: "c+b <= c+a" by (rule add_left_mono)
  16.369 -    have "a = b" 
  16.370 -      apply (insert le)
  16.371 -      apply (insert le2)
  16.372 -      apply (drule order_antisym, simp_all)
  16.373 -      done
  16.374 -    with w  show False 
  16.375 -      by (simp add: linorder_not_le [symmetric])
  16.376 -  qed
  16.377 -qed
  16.378 -
  16.379 -lemma add_right_mono: "a \<le> (b::'a::pordered_ab_semigroup_add) ==> a + c \<le> b + c"
  16.380 +lemma add_right_mono:
  16.381 +  "a \<le> b \<Longrightarrow> a + c \<le> b + c"
  16.382    by (simp add: add_commute [of _ c] add_left_mono)
  16.383  
  16.384  text {* non-strict, in both arguments *}
  16.385  lemma add_mono:
  16.386 -     "[|a \<le> b;  c \<le> d|] ==> a + c \<le> b + (d::'a::pordered_ab_semigroup_add)"
  16.387 +  "a \<le> b \<Longrightarrow> c \<le> d \<Longrightarrow> a + c \<le> b + d"
  16.388    apply (erule add_right_mono [THEN order_trans])
  16.389    apply (simp add: add_commute add_left_mono)
  16.390    done
  16.391  
  16.392 +end
  16.393 +
  16.394 +class pordered_cancel_ab_semigroup_add =
  16.395 +  pordered_ab_semigroup_add + cancel_ab_semigroup_add
  16.396 +begin
  16.397 +
  16.398  lemma add_strict_left_mono:
  16.399 -     "a < b ==> c + a < c + (b::'a::pordered_cancel_ab_semigroup_add)"
  16.400 - by (simp add: order_less_le add_left_mono) 
  16.401 +  "a < b \<Longrightarrow> c + a < c + b"
  16.402 +  by (auto simp add: less_le add_left_mono)
  16.403  
  16.404  lemma add_strict_right_mono:
  16.405 -     "a < b ==> a + c < b + (c::'a::pordered_cancel_ab_semigroup_add)"
  16.406 - by (simp add: add_commute [of _ c] add_strict_left_mono)
  16.407 +  "a < b \<Longrightarrow> a + c < b + c"
  16.408 +  by (simp add: add_commute [of _ c] add_strict_left_mono)
  16.409  
  16.410  text{*Strict monotonicity in both arguments*}
  16.411 -lemma add_strict_mono: "[|a<b; c<d|] ==> a + c < b + (d::'a::pordered_cancel_ab_semigroup_add)"
  16.412 -apply (erule add_strict_right_mono [THEN order_less_trans])
  16.413 +lemma add_strict_mono:
  16.414 +  "a < b \<Longrightarrow> c < d \<Longrightarrow> a + c < b + d"
  16.415 +apply (erule add_strict_right_mono [THEN less_trans])
  16.416  apply (erule add_strict_left_mono)
  16.417  done
  16.418  
  16.419  lemma add_less_le_mono:
  16.420 -     "[| a<b; c\<le>d |] ==> a + c < b + (d::'a::pordered_cancel_ab_semigroup_add)"
  16.421 -apply (erule add_strict_right_mono [THEN order_less_le_trans])
  16.422 -apply (erule add_left_mono) 
  16.423 +  "a < b \<Longrightarrow> c \<le> d \<Longrightarrow> a + c < b + d"
  16.424 +apply (erule add_strict_right_mono [THEN less_le_trans])
  16.425 +apply (erule add_left_mono)
  16.426  done
  16.427  
  16.428  lemma add_le_less_mono:
  16.429 -     "[| a\<le>b; c<d |] ==> a + c < b + (d::'a::pordered_cancel_ab_semigroup_add)"
  16.430 -apply (erule add_right_mono [THEN order_le_less_trans])
  16.431 +  "a \<le> b \<Longrightarrow> c < d \<Longrightarrow> a + c < b + d"
  16.432 +apply (erule add_right_mono [THEN le_less_trans])
  16.433  apply (erule add_strict_left_mono) 
  16.434  done
  16.435  
  16.436 +end
  16.437 +
  16.438 +class pordered_ab_semigroup_add_imp_le =
  16.439 +  pordered_cancel_ab_semigroup_add +
  16.440 +  assumes add_le_imp_le_left: "c + a \<le> c + b \<Longrightarrow> a \<le> b"
  16.441 +begin
  16.442 +
  16.443  lemma add_less_imp_less_left:
  16.444 -      assumes less: "c + a < c + b"  shows "a < (b::'a::pordered_ab_semigroup_add_imp_le)"
  16.445 +   assumes less: "c + a < c + b"
  16.446 +   shows "a < b"
  16.447  proof -
  16.448    from less have le: "c + a <= c + b" by (simp add: order_le_less)
  16.449    have "a <= b" 
  16.450 @@ -317,30 +343,90 @@
  16.451  qed
  16.452  
  16.453  lemma add_less_imp_less_right:
  16.454 -      "a + c < b + c ==> a < (b::'a::pordered_ab_semigroup_add_imp_le)"
  16.455 +  "a + c < b + c \<Longrightarrow> a < b"
  16.456  apply (rule add_less_imp_less_left [of c])
  16.457  apply (simp add: add_commute)  
  16.458  done
  16.459  
  16.460  lemma add_less_cancel_left [simp]:
  16.461 -    "(c+a < c+b) = (a < (b::'a::pordered_ab_semigroup_add_imp_le))"
  16.462 -by (blast intro: add_less_imp_less_left add_strict_left_mono) 
  16.463 +  "c + a < c + b \<longleftrightarrow> a < b"
  16.464 +  by (blast intro: add_less_imp_less_left add_strict_left_mono) 
  16.465  
  16.466  lemma add_less_cancel_right [simp]:
  16.467 -    "(a+c < b+c) = (a < (b::'a::pordered_ab_semigroup_add_imp_le))"
  16.468 -by (blast intro: add_less_imp_less_right add_strict_right_mono)
  16.469 +  "a + c < b + c \<longleftrightarrow> a < b"
  16.470 +  by (blast intro: add_less_imp_less_right add_strict_right_mono)
  16.471  
  16.472  lemma add_le_cancel_left [simp]:
  16.473 -    "(c+a \<le> c+b) = (a \<le> (b::'a::pordered_ab_semigroup_add_imp_le))"
  16.474 -by (auto, drule add_le_imp_le_left, simp_all add: add_left_mono) 
  16.475 +  "c + a \<le> c + b \<longleftrightarrow> a \<le> b"
  16.476 +  by (auto, drule add_le_imp_le_left, simp_all add: add_left_mono) 
  16.477  
  16.478  lemma add_le_cancel_right [simp]:
  16.479 -    "(a+c \<le> b+c) = (a \<le> (b::'a::pordered_ab_semigroup_add_imp_le))"
  16.480 -by (simp add: add_commute[of a c] add_commute[of b c])
  16.481 +  "a + c \<le> b + c \<longleftrightarrow> a \<le> b"
  16.482 +  by (simp add: add_commute [of a c] add_commute [of b c])
  16.483  
  16.484  lemma add_le_imp_le_right:
  16.485 -      "a + c \<le> b + c ==> a \<le> (b::'a::pordered_ab_semigroup_add_imp_le)"
  16.486 -by simp
  16.487 +  "a + c \<le> b + c \<Longrightarrow> a \<le> b"
  16.488 +  by simp
  16.489 +
  16.490 +end
  16.491 +
  16.492 +class pordered_ab_group_add =
  16.493 +  ab_group_add + pordered_ab_semigroup_add
  16.494 +begin
  16.495 +
  16.496 +subclass pordered_cancel_ab_semigroup_add
  16.497 +  by unfold_locales
  16.498 +
  16.499 +subclass pordered_ab_semigroup_add_imp_le
  16.500 +proof unfold_locales
  16.501 +  fix a b c :: 'a
  16.502 +  assume "c + a \<le> c + b"
  16.503 +  hence "(-c) + (c + a) \<le> (-c) + (c + b)" by (rule add_left_mono)
  16.504 +  hence "((-c) + c) + a \<le> ((-c) + c) + b" by (simp only: add_assoc)
  16.505 +  thus "a \<le> b" by simp
  16.506 +qed
  16.507 +
  16.508 +end
  16.509 +
  16.510 +class ordered_ab_semigroup_add =
  16.511 +  linorder + pordered_ab_semigroup_add
  16.512 +
  16.513 +class ordered_cancel_ab_semigroup_add =
  16.514 +  linorder + pordered_cancel_ab_semigroup_add
  16.515 +
  16.516 +subclass (in ordered_cancel_ab_semigroup_add) ordered_ab_semigroup_add
  16.517 +  by unfold_locales
  16.518 +
  16.519 +subclass (in ordered_cancel_ab_semigroup_add) pordered_ab_semigroup_add_imp_le
  16.520 +proof unfold_locales
  16.521 +  fix a b c :: 'a
  16.522 +  assume le: "c + a <= c + b"  
  16.523 +  show "a <= b"
  16.524 +  proof (rule ccontr)
  16.525 +    assume w: "~ a \<le> b"
  16.526 +    hence "b <= a" by (simp add: linorder_not_le)
  16.527 +    hence le2: "c + b <= c + a" by (rule add_left_mono)
  16.528 +    have "a = b" 
  16.529 +      apply (insert le)
  16.530 +      apply (insert le2)
  16.531 +      apply (drule antisym, simp_all)
  16.532 +      done
  16.533 +    with w show False 
  16.534 +      by (simp add: linorder_not_le [symmetric])
  16.535 +  qed
  16.536 +qed
  16.537 +
  16.538 +-- {* FIXME continue localization here *}
  16.539 +
  16.540 +lemma max_add_distrib_left:
  16.541 +  fixes z :: "'a::pordered_ab_semigroup_add_imp_le"
  16.542 +  shows  "(max x y) + z = max (x+z) (y+z)"
  16.543 +by (rule max_of_mono [THEN sym], rule add_le_cancel_right)
  16.544 +
  16.545 +lemma min_add_distrib_left:
  16.546 +  fixes z :: "'a::pordered_ab_semigroup_add_imp_le"
  16.547 +  shows  "(min x y) + z = min (x+z) (y+z)"
  16.548 +by (rule min_of_mono [THEN sym], rule add_le_cancel_right)
  16.549  
  16.550  lemma add_increasing:
  16.551    fixes c :: "'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add}"
  16.552 @@ -362,16 +448,6 @@
  16.553    shows "[|0\<le>a; b<c|] ==> b < a + c"
  16.554  by (insert add_le_less_mono [of 0 a b c], simp)
  16.555  
  16.556 -lemma max_add_distrib_left:
  16.557 -  fixes z :: "'a::pordered_ab_semigroup_add_imp_le"
  16.558 -  shows  "(max x y) + z = max (x+z) (y+z)"
  16.559 -by (rule max_of_mono [THEN sym], rule add_le_cancel_right)
  16.560 -
  16.561 -lemma min_add_distrib_left:
  16.562 -  fixes z :: "'a::pordered_ab_semigroup_add_imp_le"
  16.563 -  shows  "(min x y) + z = min (x+z) (y+z)"
  16.564 -by (rule min_of_mono [THEN sym], rule add_le_cancel_right)
  16.565 -
  16.566  lemma max_diff_distrib_left:
  16.567    fixes z :: "'a::pordered_ab_group_add"
  16.568    shows  "(max x y) - z = max (x-z) (y-z)"
    17.1 --- a/src/HOL/Orderings.thy	Tue Oct 16 23:12:38 2007 +0200
    17.2 +++ b/src/HOL/Orderings.thy	Tue Oct 16 23:12:45 2007 +0200
    17.3 @@ -14,10 +14,10 @@
    17.4  subsection {* Partial orders *}
    17.5  
    17.6  class order = ord +
    17.7 -  assumes less_le: "x \<^loc>< y \<longleftrightarrow> x \<^loc>\<le> y \<and> x \<noteq> y"
    17.8 -  and order_refl [iff]: "x \<^loc>\<le> x"
    17.9 -  and order_trans: "x \<^loc>\<le> y \<Longrightarrow> y \<^loc>\<le> z \<Longrightarrow> x \<^loc>\<le> z"
   17.10 -  assumes antisym: "x \<^loc>\<le> y \<Longrightarrow> y \<^loc>\<le> x \<Longrightarrow> x = y"
   17.11 +  assumes less_le: "x < y \<longleftrightarrow> x \<le> y \<and> x \<noteq> y"
   17.12 +  and order_refl [iff]: "x \<le> x"
   17.13 +  and order_trans: "x \<le> y \<Longrightarrow> y \<le> z \<Longrightarrow> x \<le> z"
   17.14 +  assumes antisym: "x \<le> y \<Longrightarrow> y \<le> x \<Longrightarrow> x = y"
   17.15  
   17.16  begin
   17.17  
   17.18 @@ -28,94 +28,94 @@
   17.19  
   17.20  text {* Reflexivity. *}
   17.21  
   17.22 -lemma eq_refl: "x = y \<Longrightarrow> x \<^loc>\<le> y"
   17.23 +lemma eq_refl: "x = y \<Longrightarrow> x \<le> y"
   17.24      -- {* This form is useful with the classical reasoner. *}
   17.25  by (erule ssubst) (rule order_refl)
   17.26  
   17.27 -lemma less_irrefl [iff]: "\<not> x \<^loc>< x"
   17.28 +lemma less_irrefl [iff]: "\<not> x < x"
   17.29  by (simp add: less_le)
   17.30  
   17.31 -lemma le_less: "x \<^loc>\<le> y \<longleftrightarrow> x \<^loc>< y \<or> x = y"
   17.32 +lemma le_less: "x \<le> y \<longleftrightarrow> x < y \<or> x = y"
   17.33      -- {* NOT suitable for iff, since it can cause PROOF FAILED. *}
   17.34  by (simp add: less_le) blast
   17.35  
   17.36 -lemma le_imp_less_or_eq: "x \<^loc>\<le> y \<Longrightarrow> x \<^loc>< y \<or> x = y"
   17.37 +lemma le_imp_less_or_eq: "x \<le> y \<Longrightarrow> x < y \<or> x = y"
   17.38  unfolding less_le by blast
   17.39  
   17.40 -lemma less_imp_le: "x \<^loc>< y \<Longrightarrow> x \<^loc>\<le> y"
   17.41 +lemma less_imp_le: "x < y \<Longrightarrow> x \<le> y"
   17.42  unfolding less_le by blast
   17.43  
   17.44 -lemma less_imp_neq: "x \<^loc>< y \<Longrightarrow> x \<noteq> y"
   17.45 +lemma less_imp_neq: "x < y \<Longrightarrow> x \<noteq> y"
   17.46  by (erule contrapos_pn, erule subst, rule less_irrefl)
   17.47  
   17.48  
   17.49  text {* Useful for simplification, but too risky to include by default. *}
   17.50  
   17.51 -lemma less_imp_not_eq: "x \<^loc>< y \<Longrightarrow> (x = y) \<longleftrightarrow> False"
   17.52 +lemma less_imp_not_eq: "x < y \<Longrightarrow> (x = y) \<longleftrightarrow> False"
   17.53  by auto
   17.54  
   17.55 -lemma less_imp_not_eq2: "x \<^loc>< y \<Longrightarrow> (y = x) \<longleftrightarrow> False"
   17.56 +lemma less_imp_not_eq2: "x < y \<Longrightarrow> (y = x) \<longleftrightarrow> False"
   17.57  by auto
   17.58  
   17.59  
   17.60  text {* Transitivity rules for calculational reasoning *}
   17.61  
   17.62 -lemma neq_le_trans: "a \<noteq> b \<Longrightarrow> a \<^loc>\<le> b \<Longrightarrow> a \<^loc>< b"
   17.63 +lemma neq_le_trans: "a \<noteq> b \<Longrightarrow> a \<le> b \<Longrightarrow> a < b"
   17.64  by (simp add: less_le)
   17.65  
   17.66 -lemma le_neq_trans: "a \<^loc>\<le> b \<Longrightarrow> a \<noteq> b \<Longrightarrow> a \<^loc>< b"
   17.67 +lemma le_neq_trans: "a \<le> b \<Longrightarrow> a \<noteq> b \<Longrightarrow> a < b"
   17.68  by (simp add: less_le)
   17.69  
   17.70  
   17.71  text {* Asymmetry. *}
   17.72  
   17.73 -lemma less_not_sym: "x \<^loc>< y \<Longrightarrow> \<not> (y \<^loc>< x)"
   17.74 +lemma less_not_sym: "x < y \<Longrightarrow> \<not> (y < x)"
   17.75  by (simp add: less_le antisym)
   17.76  
   17.77 -lemma less_asym: "x \<^loc>< y \<Longrightarrow> (\<not> P \<Longrightarrow> y \<^loc>< x) \<Longrightarrow> P"
   17.78 +lemma less_asym: "x < y \<Longrightarrow> (\<not> P \<Longrightarrow> y < x) \<Longrightarrow> P"
   17.79  by (drule less_not_sym, erule contrapos_np) simp
   17.80  
   17.81 -lemma eq_iff: "x = y \<longleftrightarrow> x \<^loc>\<le> y \<and> y \<^loc>\<le> x"
   17.82 +lemma eq_iff: "x = y \<longleftrightarrow> x \<le> y \<and> y \<le> x"
   17.83  by (blast intro: antisym)
   17.84  
   17.85 -lemma antisym_conv: "y \<^loc>\<le> x \<Longrightarrow> x \<^loc>\<le> y \<longleftrightarrow> x = y"
   17.86 +lemma antisym_conv: "y \<le> x \<Longrightarrow> x \<le> y \<longleftrightarrow> x = y"
   17.87  by (blast intro: antisym)
   17.88  
   17.89 -lemma less_imp_neq: "x \<^loc>< y \<Longrightarrow> x \<noteq> y"
   17.90 +lemma less_imp_neq: "x < y \<Longrightarrow> x \<noteq> y"
   17.91  by (erule contrapos_pn, erule subst, rule less_irrefl)
   17.92  
   17.93  
   17.94  text {* Transitivity. *}
   17.95  
   17.96 -lemma less_trans: "x \<^loc>< y \<Longrightarrow> y \<^loc>< z \<Longrightarrow> x \<^loc>< z"
   17.97 +lemma less_trans: "x < y \<Longrightarrow> y < z \<Longrightarrow> x < z"
   17.98  by (simp add: less_le) (blast intro: order_trans antisym)
   17.99  
  17.100 -lemma le_less_trans: "x \<^loc>\<le> y \<Longrightarrow> y \<^loc>< z \<Longrightarrow> x \<^loc>< z"
  17.101 +lemma le_less_trans: "x \<le> y \<Longrightarrow> y < z \<Longrightarrow> x < z"
  17.102  by (simp add: less_le) (blast intro: order_trans antisym)
  17.103  
  17.104 -lemma less_le_trans: "x \<^loc>< y \<Longrightarrow> y \<^loc>\<le> z \<Longrightarrow> x \<^loc>< z"
  17.105 +lemma less_le_trans: "x < y \<Longrightarrow> y \<le> z \<Longrightarrow> x < z"
  17.106  by (simp add: less_le) (blast intro: order_trans antisym)
  17.107  
  17.108  
  17.109  text {* Useful for simplification, but too risky to include by default. *}
  17.110  
  17.111 -lemma less_imp_not_less: "x \<^loc>< y \<Longrightarrow> (\<not> y \<^loc>< x) \<longleftrightarrow> True"
  17.112 +lemma less_imp_not_less: "x < y \<Longrightarrow> (\<not> y < x) \<longleftrightarrow> True"
  17.113  by (blast elim: less_asym)
  17.114  
  17.115 -lemma less_imp_triv: "x \<^loc>< y \<Longrightarrow> (y \<^loc>< x \<longrightarrow> P) \<longleftrightarrow> True"
  17.116 +lemma less_imp_triv: "x < y \<Longrightarrow> (y < x \<longrightarrow> P) \<longleftrightarrow> True"
  17.117  by (blast elim: less_asym)
  17.118  
  17.119  
  17.120  text {* Transitivity rules for calculational reasoning *}
  17.121  
  17.122 -lemma less_asym': "a \<^loc>< b \<Longrightarrow> b \<^loc>< a \<Longrightarrow> P"
  17.123 +lemma less_asym': "a < b \<Longrightarrow> b < a \<Longrightarrow> P"
  17.124  by (rule less_asym)
  17.125  
  17.126  
  17.127  text {* Reverse order *}
  17.128  
  17.129  lemma order_reverse:
  17.130 -  "order (\<lambda>x y. y \<^loc>\<le> x) (\<lambda>x y. y \<^loc>< x)"
  17.131 +  "order (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x)"
  17.132  by unfold_locales
  17.133     (simp add: less_le, auto intro: antisym order_trans)
  17.134  
  17.135 @@ -128,67 +128,67 @@
  17.136    assumes linear: "x \<sqsubseteq> y \<or> y \<sqsubseteq> x"
  17.137  begin
  17.138  
  17.139 -lemma less_linear: "x \<^loc>< y \<or> x = y \<or> y \<^loc>< x"
  17.140 +lemma less_linear: "x < y \<or> x = y \<or> y < x"
  17.141  unfolding less_le using less_le linear by blast
  17.142  
  17.143 -lemma le_less_linear: "x \<^loc>\<le> y \<or> y \<^loc>< x"
  17.144 +lemma le_less_linear: "x \<le> y \<or> y < x"
  17.145  by (simp add: le_less less_linear)
  17.146  
  17.147  lemma le_cases [case_names le ge]:
  17.148 -  "(x \<^loc>\<le> y \<Longrightarrow> P) \<Longrightarrow> (y \<^loc>\<le> x \<Longrightarrow> P) \<Longrightarrow> P"
  17.149 +  "(x \<le> y \<Longrightarrow> P) \<Longrightarrow> (y \<le> x \<Longrightarrow> P) \<Longrightarrow> P"
  17.150  using linear by blast
  17.151  
  17.152  lemma linorder_cases [case_names less equal greater]:
  17.153 -  "(x \<^loc>< y \<Longrightarrow> P) \<Longrightarrow> (x = y \<Longrightarrow> P) \<Longrightarrow> (y \<^loc>< x \<Longrightarrow> P) \<Longrightarrow> P"
  17.154 +  "(x < y \<Longrightarrow> P) \<Longrightarrow> (x = y \<Longrightarrow> P) \<Longrightarrow> (y < x \<Longrightarrow> P) \<Longrightarrow> P"
  17.155  using less_linear by blast
  17.156  
  17.157 -lemma not_less: "\<not> x \<^loc>< y \<longleftrightarrow> y \<^loc>\<le> x"
  17.158 +lemma not_less: "\<not> x < y \<longleftrightarrow> y \<le> x"
  17.159  apply (simp add: less_le)
  17.160  using linear apply (blast intro: antisym)
  17.161  done
  17.162  
  17.163  lemma not_less_iff_gr_or_eq:
  17.164 - "\<not>(x \<^loc>< y) \<longleftrightarrow> (x \<^loc>> y | x = y)"
  17.165 + "\<not>(x < y) \<longleftrightarrow> (x > y | x = y)"
  17.166  apply(simp add:not_less le_less)
  17.167  apply blast
  17.168  done
  17.169  
  17.170 -lemma not_le: "\<not> x \<^loc>\<le> y \<longleftrightarrow> y \<^loc>< x"
  17.171 +lemma not_le: "\<not> x \<le> y \<longleftrightarrow> y < x"
  17.172  apply (simp add: less_le)
  17.173  using linear apply (blast intro: antisym)
  17.174  done
  17.175  
  17.176 -lemma neq_iff: "x \<noteq> y \<longleftrightarrow> x \<^loc>< y \<or> y \<^loc>< x"
  17.177 +lemma neq_iff: "x \<noteq> y \<longleftrightarrow> x < y \<or> y < x"
  17.178  by (cut_tac x = x and y = y in less_linear, auto)
  17.179  
  17.180 -lemma neqE: "x \<noteq> y \<Longrightarrow> (x \<^loc>< y \<Longrightarrow> R) \<Longrightarrow> (y \<^loc>< x \<Longrightarrow> R) \<Longrightarrow> R"
  17.181 +lemma neqE: "x \<noteq> y \<Longrightarrow> (x < y \<Longrightarrow> R) \<Longrightarrow> (y < x \<Longrightarrow> R) \<Longrightarrow> R"
  17.182  by (simp add: neq_iff) blast
  17.183  
  17.184 -lemma antisym_conv1: "\<not> x \<^loc>< y \<Longrightarrow> x \<^loc>\<le> y \<longleftrightarrow> x = y"
  17.185 +lemma antisym_conv1: "\<not> x < y \<Longrightarrow> x \<le> y \<longleftrightarrow> x = y"
  17.186  by (blast intro: antisym dest: not_less [THEN iffD1])
  17.187  
  17.188 -lemma antisym_conv2: "x \<^loc>\<le> y \<Longrightarrow> \<not> x \<^loc>< y \<longleftrightarrow> x = y"
  17.189 +lemma antisym_conv2: "x \<le> y \<Longrightarrow> \<not> x < y \<longleftrightarrow> x = y"
  17.190  by (blast intro: antisym dest: not_less [THEN iffD1])
  17.191  
  17.192 -lemma antisym_conv3: "\<not> y \<^loc>< x \<Longrightarrow> \<not> x \<^loc>< y \<longleftrightarrow> x = y"
  17.193 +lemma antisym_conv3: "\<not> y < x \<Longrightarrow> \<not> x < y \<longleftrightarrow> x = y"
  17.194  by (blast intro: antisym dest: not_less [THEN iffD1])
  17.195  
  17.196  text{*Replacing the old Nat.leI*}
  17.197 -lemma leI: "\<not> x \<^loc>< y \<Longrightarrow> y \<^loc>\<le> x"
  17.198 +lemma leI: "\<not> x < y \<Longrightarrow> y \<le> x"
  17.199  unfolding not_less .
  17.200  
  17.201 -lemma leD: "y \<^loc>\<le> x \<Longrightarrow> \<not> x \<^loc>< y"
  17.202 +lemma leD: "y \<le> x \<Longrightarrow> \<not> x < y"
  17.203  unfolding not_less .
  17.204  
  17.205  (*FIXME inappropriate name (or delete altogether)*)
  17.206 -lemma not_leE: "\<not> y \<^loc>\<le> x \<Longrightarrow> x \<^loc>< y"
  17.207 +lemma not_leE: "\<not> y \<le> x \<Longrightarrow> x < y"
  17.208  unfolding not_le .
  17.209  
  17.210  
  17.211  text {* Reverse order *}
  17.212  
  17.213  lemma linorder_reverse:
  17.214 -  "linorder (\<lambda>x y. y \<^loc>\<le> x) (\<lambda>x y. y \<^loc>< x)"
  17.215 +  "linorder (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x)"
  17.216  by unfold_locales
  17.217    (simp add: less_le, auto intro: antisym order_trans simp add: linear)
  17.218  
  17.219 @@ -199,42 +199,42 @@
  17.220  
  17.221  definition (in ord)
  17.222    min :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" where
  17.223 -  [code unfold, code inline del]: "min a b = (if a \<^loc>\<le> b then a else b)"
  17.224 +  [code unfold, code inline del]: "min a b = (if a \<le> b then a else b)"
  17.225  
  17.226  definition (in ord)
  17.227    max :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" where
  17.228 -  [code unfold, code inline del]: "max a b = (if a \<^loc>\<le> b then b else a)"
  17.229 +  [code unfold, code inline del]: "max a b = (if a \<le> b then b else a)"
  17.230  
  17.231  lemma min_le_iff_disj:
  17.232 -  "min x y \<^loc>\<le> z \<longleftrightarrow> x \<^loc>\<le> z \<or> y \<^loc>\<le> z"
  17.233 +  "min x y \<le> z \<longleftrightarrow> x \<le> z \<or> y \<le> z"
  17.234  unfolding min_def using linear by (auto intro: order_trans)
  17.235  
  17.236  lemma le_max_iff_disj:
  17.237 -  "z \<^loc>\<le> max x y \<longleftrightarrow> z \<^loc>\<le> x \<or> z \<^loc>\<le> y"
  17.238 +  "z \<le> max x y \<longleftrightarrow> z \<le> x \<or> z \<le> y"
  17.239  unfolding max_def using linear by (auto intro: order_trans)
  17.240  
  17.241  lemma min_less_iff_disj:
  17.242 -  "min x y \<^loc>< z \<longleftrightarrow> x \<^loc>< z \<or> y \<^loc>< z"
  17.243 +  "min x y < z \<longleftrightarrow> x < z \<or> y < z"
  17.244  unfolding min_def le_less using less_linear by (auto intro: less_trans)
  17.245  
  17.246  lemma less_max_iff_disj:
  17.247 -  "z \<^loc>< max x y \<longleftrightarrow> z \<^loc>< x \<or> z \<^loc>< y"
  17.248 +  "z < max x y \<longleftrightarrow> z < x \<or> z < y"
  17.249  unfolding max_def le_less using less_linear by (auto intro: less_trans)
  17.250  
  17.251  lemma min_less_iff_conj [simp]:
  17.252 -  "z \<^loc>< min x y \<longleftrightarrow> z \<^loc>< x \<and> z \<^loc>< y"
  17.253 +  "z < min x y \<longleftrightarrow> z < x \<and> z < y"
  17.254  unfolding min_def le_less using less_linear by (auto intro: less_trans)
  17.255  
  17.256  lemma max_less_iff_conj [simp]:
  17.257 -  "max x y \<^loc>< z \<longleftrightarrow> x \<^loc>< z \<and> y \<^loc>< z"
  17.258 +  "max x y < z \<longleftrightarrow> x < z \<and> y < z"
  17.259  unfolding max_def le_less using less_linear by (auto intro: less_trans)
  17.260  
  17.261  lemma split_min [noatp]:
  17.262 -  "P (min i j) \<longleftrightarrow> (i \<^loc>\<le> j \<longrightarrow> P i) \<and> (\<not> i \<^loc>\<le> j \<longrightarrow> P j)"
  17.263 +  "P (min i j) \<longleftrightarrow> (i \<le> j \<longrightarrow> P i) \<and> (\<not> i \<le> j \<longrightarrow> P j)"
  17.264  by (simp add: min_def)
  17.265  
  17.266  lemma split_max [noatp]:
  17.267 -  "P (max i j) \<longleftrightarrow> (i \<^loc>\<le> j \<longrightarrow> P j) \<and> (\<not> i \<^loc>\<le> j \<longrightarrow> P i)"
  17.268 +  "P (max i j) \<longleftrightarrow> (i \<le> j \<longrightarrow> P j) \<and> (\<not> i \<le> j \<longrightarrow> P i)"
  17.269  by (simp add: max_def)
  17.270  
  17.271  end
  17.272 @@ -371,109 +371,109 @@
  17.273  (* The type constraint on @{term op =} below is necessary since the operation
  17.274     is not a parameter of the locale. *)
  17.275  lemmas (in order)
  17.276 -  [order add less_reflE: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.277 +  [order add less_reflE: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.278    less_irrefl [THEN notE]
  17.279  lemmas (in order)
  17.280 -  [order add le_refl: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.281 +  [order add le_refl: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.282    order_refl
  17.283  lemmas (in order)
  17.284 -  [order add less_imp_le: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.285 +  [order add less_imp_le: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.286    less_imp_le
  17.287  lemmas (in order)
  17.288 -  [order add eqI: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.289 +  [order add eqI: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.290    antisym
  17.291  lemmas (in order)
  17.292 -  [order add eqD1: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.293 +  [order add eqD1: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.294    eq_refl
  17.295  lemmas (in order)
  17.296 -  [order add eqD2: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.297 +  [order add eqD2: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.298    sym [THEN eq_refl]
  17.299  lemmas (in order)
  17.300 -  [order add less_trans: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.301 +  [order add less_trans: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.302    less_trans
  17.303  lemmas (in order)
  17.304 -  [order add less_le_trans: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.305 +  [order add less_le_trans: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.306    less_le_trans
  17.307  lemmas (in order)
  17.308 -  [order add le_less_trans: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.309 +  [order add le_less_trans: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.310    le_less_trans
  17.311  lemmas (in order)
  17.312 -  [order add le_trans: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.313 +  [order add le_trans: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.314    order_trans
  17.315  lemmas (in order)
  17.316 -  [order add le_neq_trans: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.317 +  [order add le_neq_trans: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.318    le_neq_trans
  17.319  lemmas (in order)
  17.320 -  [order add neq_le_trans: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.321 +  [order add neq_le_trans: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.322    neq_le_trans
  17.323  lemmas (in order)
  17.324 -  [order add less_imp_neq: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.325 +  [order add less_imp_neq: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.326    less_imp_neq
  17.327  lemmas (in order)
  17.328 -  [order add eq_neq_eq_imp_neq: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.329 +  [order add eq_neq_eq_imp_neq: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.330     eq_neq_eq_imp_neq
  17.331  lemmas (in order)
  17.332 -  [order add not_sym: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.333 +  [order add not_sym: order "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.334    not_sym
  17.335  
  17.336 -lemmas (in linorder) [order del: order "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] = _
  17.337 +lemmas (in linorder) [order del: order "op = :: 'a => 'a => bool" "op <=" "op <"] = _
  17.338  
  17.339  lemmas (in linorder)
  17.340 -  [order add less_reflE: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.341 +  [order add less_reflE: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.342    less_irrefl [THEN notE]
  17.343  lemmas (in linorder)
  17.344 -  [order add le_refl: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.345 +  [order add le_refl: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.346    order_refl
  17.347  lemmas (in linorder)
  17.348 -  [order add less_imp_le: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.349 +  [order add less_imp_le: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.350    less_imp_le
  17.351  lemmas (in linorder)
  17.352 -  [order add not_lessI: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.353 +  [order add not_lessI: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.354    not_less [THEN iffD2]
  17.355  lemmas (in linorder)
  17.356 -  [order add not_leI: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.357 +  [order add not_leI: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.358    not_le [THEN iffD2]
  17.359  lemmas (in linorder)
  17.360 -  [order add not_lessD: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.361 +  [order add not_lessD: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.362    not_less [THEN iffD1]
  17.363  lemmas (in linorder)
  17.364 -  [order add not_leD: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.365 +  [order add not_leD: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.366    not_le [THEN iffD1]
  17.367  lemmas (in linorder)
  17.368 -  [order add eqI: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.369 +  [order add eqI: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.370    antisym
  17.371  lemmas (in linorder)
  17.372 -  [order add eqD1: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.373 +  [order add eqD1: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.374    eq_refl
  17.375  lemmas (in linorder)
  17.376 -  [order add eqD2: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.377 +  [order add eqD2: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.378    sym [THEN eq_refl]
  17.379  lemmas (in linorder)
  17.380 -  [order add less_trans: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.381 +  [order add less_trans: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.382    less_trans
  17.383  lemmas (in linorder)
  17.384 -  [order add less_le_trans: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.385 +  [order add less_le_trans: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.386    less_le_trans
  17.387  lemmas (in linorder)
  17.388 -  [order add le_less_trans: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.389 +  [order add le_less_trans: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.390    le_less_trans
  17.391  lemmas (in linorder)
  17.392 -  [order add le_trans: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.393 +  [order add le_trans: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.394    order_trans
  17.395  lemmas (in linorder)
  17.396 -  [order add le_neq_trans: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.397 +  [order add le_neq_trans: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.398    le_neq_trans
  17.399  lemmas (in linorder)
  17.400 -  [order add neq_le_trans: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.401 +  [order add neq_le_trans: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.402    neq_le_trans
  17.403  lemmas (in linorder)
  17.404 -  [order add less_imp_neq: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.405 +  [order add less_imp_neq: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.406    less_imp_neq
  17.407  lemmas (in linorder)
  17.408 -  [order add eq_neq_eq_imp_neq: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.409 +  [order add eq_neq_eq_imp_neq: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.410    eq_neq_eq_imp_neq
  17.411  lemmas (in linorder)
  17.412 -  [order add not_sym: linorder "op = :: 'a => 'a => bool" "op \<^loc><=" "op \<^loc><"] =
  17.413 +  [order add not_sym: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] =
  17.414    not_sym
  17.415  
  17.416  
    18.1 --- a/src/HOL/Power.thy	Tue Oct 16 23:12:38 2007 +0200
    18.2 +++ b/src/HOL/Power.thy	Tue Oct 16 23:12:45 2007 +0200
    18.3 @@ -12,13 +12,13 @@
    18.4  begin
    18.5  
    18.6  class power = type +
    18.7 -  fixes power :: "'a \<Rightarrow> nat \<Rightarrow> 'a"            (infixr "\<^loc>^" 80)
    18.8 +  fixes power :: "'a \<Rightarrow> nat \<Rightarrow> 'a"            (infixr "^" 80)
    18.9  
   18.10  subsection{*Powers for Arbitrary Monoids*}
   18.11  
   18.12  class recpower = monoid_mult + power +
   18.13 -  assumes power_0 [simp]: "a \<^loc>^ 0       = \<^loc>1"
   18.14 -  assumes power_Suc:      "a \<^loc>^ Suc n = a \<^loc>* (a \<^loc>^ n)"
   18.15 +  assumes power_0 [simp]: "a ^ 0       = 1"
   18.16 +  assumes power_Suc:      "a ^ Suc n = a * (a ^ n)"
   18.17  
   18.18  lemma power_0_Suc [simp]: "(0::'a::{recpower,semiring_0}) ^ (Suc n) = 0"
   18.19    by (simp add: power_Suc)
    19.1 --- a/src/HOL/Real/RealVector.thy	Tue Oct 16 23:12:38 2007 +0200
    19.2 +++ b/src/HOL/Real/RealVector.thy	Tue Oct 16 23:12:45 2007 +0200
    19.3 @@ -44,32 +44,28 @@
    19.4  subsection {* Real vector spaces *}
    19.5  
    19.6  class scaleR = type +
    19.7 -  fixes scaleR :: "real \<Rightarrow> 'a \<Rightarrow> 'a" (infixr "\<^loc>*#" 75)
    19.8 +  fixes scaleR :: "real \<Rightarrow> 'a \<Rightarrow> 'a" (infixr "*\<^sub>R" 75)
    19.9  begin
   19.10  
   19.11  abbreviation
   19.12 -  divideR :: "'a \<Rightarrow> real \<Rightarrow> 'a" (infixl "\<^loc>'/#" 70)
   19.13 +  divideR :: "'a \<Rightarrow> real \<Rightarrow> 'a" (infixl "'/\<^sub>R" 70)
   19.14  where
   19.15 -  "x \<^loc>/# r == scaleR (inverse r) x"
   19.16 +  "x /\<^sub>R r == scaleR (inverse r) x"
   19.17  
   19.18  end
   19.19  
   19.20 -notation (xsymbols)
   19.21 -  scaleR (infixr "*\<^sub>R" 75) and
   19.22 -  divideR (infixl "'/\<^sub>R" 70)
   19.23 -
   19.24  instance real :: scaleR
   19.25    real_scaleR_def [simp]: "scaleR a x \<equiv> a * x" ..
   19.26  
   19.27  class real_vector = scaleR + ab_group_add +
   19.28 -  assumes scaleR_right_distrib: "scaleR a (x \<^loc>+ y) = scaleR a x \<^loc>+ scaleR a y"
   19.29 -  and scaleR_left_distrib: "scaleR (a + b) x = scaleR a x \<^loc>+ scaleR b x"
   19.30 +  assumes scaleR_right_distrib: "scaleR a (x + y) = scaleR a x + scaleR a y"
   19.31 +  and scaleR_left_distrib: "scaleR (a + b) x = scaleR a x + scaleR b x"
   19.32    and scaleR_scaleR [simp]: "scaleR a (scaleR b x) = scaleR (a * b) x"
   19.33    and scaleR_one [simp]: "scaleR 1 x = x"
   19.34  
   19.35  class real_algebra = real_vector + ring +
   19.36 -  assumes mult_scaleR_left [simp]: "scaleR a x \<^loc>* y = scaleR a (x \<^loc>* y)"
   19.37 -  and mult_scaleR_right [simp]: "x \<^loc>* scaleR a y = scaleR a (x \<^loc>* y)"
   19.38 +  assumes mult_scaleR_left [simp]: "scaleR a x * y = scaleR a (x * y)"
   19.39 +  and mult_scaleR_right [simp]: "x * scaleR a y = scaleR a (x * y)"
   19.40  
   19.41  class real_algebra_1 = real_algebra + ring_1
   19.42  
   19.43 @@ -379,22 +375,22 @@
   19.44    real_norm_def [simp]: "norm r \<equiv> \<bar>r\<bar>" ..
   19.45  
   19.46  class sgn_div_norm = scaleR + norm + sgn +
   19.47 -  assumes sgn_div_norm: "sgn x = x \<^loc>/# norm x"
   19.48 +  assumes sgn_div_norm: "sgn x = x /\<^sub>R norm x"
   19.49  
   19.50  class real_normed_vector = real_vector + sgn_div_norm +
   19.51    assumes norm_ge_zero [simp]: "0 \<le> norm x"
   19.52 -  and norm_eq_zero [simp]: "norm x = 0 \<longleftrightarrow> x = \<^loc>0"
   19.53 -  and norm_triangle_ineq: "norm (x \<^loc>+ y) \<le> norm x + norm y"
   19.54 +  and norm_eq_zero [simp]: "norm x = 0 \<longleftrightarrow> x = 0"
   19.55 +  and norm_triangle_ineq: "norm (x + y) \<le> norm x + norm y"
   19.56    and norm_scaleR: "norm (scaleR a x) = \<bar>a\<bar> * norm x"
   19.57  
   19.58  class real_normed_algebra = real_algebra + real_normed_vector +
   19.59 -  assumes norm_mult_ineq: "norm (x \<^loc>* y) \<le> norm x * norm y"
   19.60 +  assumes norm_mult_ineq: "norm (x * y) \<le> norm x * norm y"
   19.61  
   19.62  class real_normed_algebra_1 = real_algebra_1 + real_normed_algebra +
   19.63 -  assumes norm_one [simp]: "norm \<^loc>1 = 1"
   19.64 +  assumes norm_one [simp]: "norm 1 = 1"
   19.65  
   19.66  class real_normed_div_algebra = real_div_algebra + real_normed_vector +
   19.67 -  assumes norm_mult: "norm (x \<^loc>* y) = norm x * norm y"
   19.68 +  assumes norm_mult: "norm (x * y) = norm x * norm y"
   19.69  
   19.70  class real_normed_field = real_field + real_normed_div_algebra
   19.71  
    20.1 --- a/src/HOL/Ring_and_Field.thy	Tue Oct 16 23:12:38 2007 +0200
    20.2 +++ b/src/HOL/Ring_and_Field.thy	Tue Oct 16 23:12:45 2007 +0200
    20.3 @@ -24,12 +24,12 @@
    20.4  *}
    20.5  
    20.6  class semiring = ab_semigroup_add + semigroup_mult +
    20.7 -  assumes left_distrib: "(a \<^loc>+ b) \<^loc>* c = a \<^loc>* c \<^loc>+ b \<^loc>* c"
    20.8 -  assumes right_distrib: "a \<^loc>* (b \<^loc>+ c) = a \<^loc>* b \<^loc>+ a \<^loc>* c"
    20.9 +  assumes left_distrib: "(a + b) * c = a * c + b * c"
   20.10 +  assumes right_distrib: "a * (b + c) = a * b + a * c"
   20.11  
   20.12  class mult_zero = times + zero +
   20.13 -  assumes mult_zero_left [simp]: "\<^loc>0 \<^loc>* a = \<^loc>0"
   20.14 -  assumes mult_zero_right [simp]: "a \<^loc>* \<^loc>0 = \<^loc>0"
   20.15 +  assumes mult_zero_left [simp]: "0 * a = 0"
   20.16 +  assumes mult_zero_right [simp]: "a * 0 = 0"
   20.17  
   20.18  class semiring_0 = semiring + comm_monoid_add + mult_zero
   20.19  
   20.20 @@ -50,7 +50,7 @@
   20.21  qed
   20.22  
   20.23  class comm_semiring = ab_semigroup_add + ab_semigroup_mult +
   20.24 -  assumes distrib: "(a \<^loc>+ b) \<^loc>* c = a \<^loc>* c \<^loc>+ b \<^loc>* c"
   20.25 +  assumes distrib: "(a + b) * c = a * c + b * c"
   20.26  
   20.27  instance comm_semiring \<subseteq> semiring
   20.28  proof
   20.29 @@ -73,7 +73,7 @@
   20.30  instance comm_semiring_0_cancel \<subseteq> comm_semiring_0 ..
   20.31  
   20.32  class zero_neq_one = zero + one +
   20.33 -  assumes zero_neq_one [simp]: "\<^loc>0 \<noteq> \<^loc>1"
   20.34 +  assumes zero_neq_one [simp]: "0 \<noteq> 1"
   20.35  
   20.36  class semiring_1 = zero_neq_one + semiring_0 + monoid_mult
   20.37  
   20.38 @@ -83,7 +83,7 @@
   20.39  instance comm_semiring_1 \<subseteq> semiring_1 ..
   20.40  
   20.41  class no_zero_divisors = zero + times +
   20.42 -  assumes no_zero_divisors: "a \<noteq> \<^loc>0 \<Longrightarrow> b \<noteq> \<^loc>0 \<Longrightarrow> a \<^loc>* b \<noteq> \<^loc>0"
   20.43 +  assumes no_zero_divisors: "a \<noteq> 0 \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> a * b \<noteq> 0"
   20.44  
   20.45  class semiring_1_cancel = semiring + comm_monoid_add + zero_neq_one
   20.46    + cancel_ab_semigroup_add + monoid_mult
   20.47 @@ -131,8 +131,8 @@
   20.48  instance idom \<subseteq> ring_1_no_zero_divisors ..
   20.49  
   20.50  class division_ring = ring_1 + inverse +
   20.51 -  assumes left_inverse [simp]:  "a \<noteq> \<^loc>0 \<Longrightarrow> inverse a \<^loc>* a = \<^loc>1"
   20.52 -  assumes right_inverse [simp]: "a \<noteq> \<^loc>0 \<Longrightarrow> a \<^loc>* inverse a = \<^loc>1"
   20.53 +  assumes left_inverse [simp]:  "a \<noteq> 0 \<Longrightarrow> inverse a * a = 1"
   20.54 +  assumes right_inverse [simp]: "a \<noteq> 0 \<Longrightarrow> a * inverse a = 1"
   20.55  
   20.56  instance division_ring \<subseteq> ring_1_no_zero_divisors
   20.57  proof
   20.58 @@ -153,8 +153,8 @@
   20.59  qed
   20.60  
   20.61  class field = comm_ring_1 + inverse +
   20.62 -  assumes field_inverse:  "a \<noteq> \<^loc>0 \<Longrightarrow> inverse a \<^loc>* a = \<^loc>1"
   20.63 -  assumes divide_inverse: "a \<^loc>/ b = a \<^loc>* inverse b"
   20.64 +  assumes field_inverse:  "a \<noteq> 0 \<Longrightarrow> inverse a * a = 1"
   20.65 +  assumes divide_inverse: "a / b = a * inverse b"
   20.66  
   20.67  instance field \<subseteq> division_ring
   20.68  proof
   20.69 @@ -167,7 +167,7 @@
   20.70  instance field \<subseteq> idom ..
   20.71  
   20.72  class division_by_zero = zero + inverse +
   20.73 -  assumes inverse_zero [simp]: "inverse \<^loc>0 = \<^loc>0"
   20.74 +  assumes inverse_zero [simp]: "inverse 0 = 0"
   20.75  
   20.76  
   20.77  subsection {* Distribution rules *}
   20.78 @@ -211,8 +211,8 @@
   20.79  lemmas ring_simps = group_simps ring_distribs
   20.80  
   20.81  class mult_mono = times + zero + ord +
   20.82 -  assumes mult_left_mono: "a \<^loc>\<le> b \<Longrightarrow> \<^loc>0 \<^loc>\<le> c \<Longrightarrow> c \<^loc>* a \<^loc>\<le> c \<^loc>* b"
   20.83 -  assumes mult_right_mono: "a \<^loc>\<le> b \<Longrightarrow> \<^loc>0 \<^loc>\<le> c \<Longrightarrow> a \<^loc>* c \<^loc>\<le> b \<^loc>* c"
   20.84 +  assumes mult_left_mono: "a \<le> b \<Longrightarrow> 0 \<le> c \<Longrightarrow> c * a \<le> c * b"
   20.85 +  assumes mult_right_mono: "a \<le> b \<Longrightarrow> 0 \<le> c \<Longrightarrow> a * c \<le> b * c"
   20.86  
   20.87  class pordered_semiring = mult_mono + semiring_0 + pordered_ab_semigroup_add 
   20.88  
   20.89 @@ -228,8 +228,8 @@
   20.90  instance ordered_semiring \<subseteq> pordered_cancel_semiring ..
   20.91  
   20.92  class ordered_semiring_strict = semiring + comm_monoid_add + ordered_cancel_ab_semigroup_add +
   20.93 -  assumes mult_strict_left_mono: "a \<^loc>< b \<Longrightarrow> \<^loc>0 \<^loc>< c \<Longrightarrow> c \<^loc>* a \<^loc>< c \<^loc>* b"
   20.94 -  assumes mult_strict_right_mono: "a \<^loc>< b \<Longrightarrow> \<^loc>0 \<^loc>< c \<Longrightarrow> a \<^loc>* c \<^loc>< b \<^loc>* c"
   20.95 +  assumes mult_strict_left_mono: "a < b \<Longrightarrow> 0 < c \<Longrightarrow> c * a < c * b"
   20.96 +  assumes mult_strict_right_mono: "a < b \<Longrightarrow> 0 < c \<Longrightarrow> a * c < b * c"
   20.97  
   20.98  instance ordered_semiring_strict \<subseteq> semiring_0_cancel ..
   20.99  
  20.100 @@ -246,7 +246,7 @@
  20.101  qed
  20.102  
  20.103  class mult_mono1 = times + zero + ord +
  20.104 -  assumes mult_mono: "a \<^loc>\<le> b \<Longrightarrow> \<^loc>0 \<^loc>\<le> c \<Longrightarrow> c \<^loc>* a \<^loc>\<le> c \<^loc>* b"
  20.105 +  assumes mult_mono: "a \<le> b \<Longrightarrow> 0 \<le> c \<Longrightarrow> c * a \<le> c * b"
  20.106  
  20.107  class pordered_comm_semiring = comm_semiring_0
  20.108    + pordered_ab_semigroup_add + mult_mono1
  20.109 @@ -257,7 +257,7 @@
  20.110  instance pordered_cancel_comm_semiring \<subseteq> pordered_comm_semiring ..
  20.111  
  20.112  class ordered_comm_semiring_strict = comm_semiring_0 + ordered_cancel_ab_semigroup_add +
  20.113 -  assumes mult_strict_mono: "a \<^loc>< b \<Longrightarrow> \<^loc>0 \<^loc>< c \<Longrightarrow> c \<^loc>* a \<^loc>< c \<^loc>* b"
  20.114 +  assumes mult_strict_mono: "a < b \<Longrightarrow> 0 < c \<Longrightarrow> c * a < c * b"
  20.115  
  20.116  instance pordered_comm_semiring \<subseteq> pordered_semiring
  20.117  proof
  20.118 @@ -297,10 +297,10 @@
  20.119  instance lordered_ring \<subseteq> lordered_ab_group_join ..
  20.120  
  20.121  class abs_if = minus + ord + zero + abs +
  20.122 -  assumes abs_if: "abs a = (if a \<^loc>< \<^loc>0 then (uminus a) else a)"
  20.123 +  assumes abs_if: "abs a = (if a < 0 then (uminus a) else a)"
  20.124  
  20.125  class sgn_if = sgn + zero + one + minus + ord +
  20.126 -  assumes sgn_if: "sgn x = (if x = \<^loc>0 then \<^loc>0 else if \<^loc>0 \<^loc>< x then \<^loc>1 else uminus \<^loc>1)"
  20.127 +  assumes sgn_if: "sgn x = (if x = 0 then 0 else if 0 < x then 1 else uminus 1)"
  20.128  
  20.129  (* The "strict" suffix can be seen as describing the combination of ordered_ring and no_zero_divisors.
  20.130     Basically, ordered_ring + no_zero_divisors = ordered_ring_strict.
  20.131 @@ -327,7 +327,7 @@
  20.132  
  20.133  class ordered_semidom = comm_semiring_1_cancel + ordered_comm_semiring_strict +
  20.134    (*previously ordered_semiring*)
  20.135 -  assumes zero_less_one [simp]: "\<^loc>0 \<^loc>< \<^loc>1"
  20.136 +  assumes zero_less_one [simp]: "0 < 1"
  20.137  
  20.138  lemma pos_add_strict:
  20.139    fixes a b c :: "'a\<Colon>ordered_semidom"
    21.1 --- a/src/HOL/SetInterval.thy	Tue Oct 16 23:12:38 2007 +0200
    21.2 +++ b/src/HOL/SetInterval.thy	Tue Oct 16 23:12:45 2007 +0200
    21.3 @@ -16,36 +16,36 @@
    21.4  context ord
    21.5  begin
    21.6  definition
    21.7 -  lessThan    :: "'a => 'a set"	("(1\<^loc>{..<_})") where
    21.8 -  "\<^loc>{..<u} == {x. x \<^loc>< u}"
    21.9 +  lessThan    :: "'a => 'a set"	("(1{..<_})") where
   21.10 +  "{..<u} == {x. x < u}"
   21.11  
   21.12  definition
   21.13 -  atMost      :: "'a => 'a set"	("(1\<^loc>{.._})") where
   21.14 -  "\<^loc>{..u} == {x. x \<^loc>\<le> u}"
   21.15 +  atMost      :: "'a => 'a set"	("(1{.._})") where
   21.16 +  "{..u} == {x. x \<le> u}"
   21.17  
   21.18  definition
   21.19 -  greaterThan :: "'a => 'a set"	("(1\<^loc>{_<..})") where
   21.20 -  "\<^loc>{l<..} == {x. l\<^loc><x}"
   21.21 +  greaterThan :: "'a => 'a set"	("(1{_<..})") where
   21.22 +  "{l<..} == {x. l<x}"
   21.23  
   21.24  definition
   21.25 -  atLeast     :: "'a => 'a set"	("(1\<^loc>{_..})") where
   21.26 -  "\<^loc>{l..} == {x. l\<^loc>\<le>x}"
   21.27 +  atLeast     :: "'a => 'a set"	("(1{_..})") where
   21.28 +  "{l..} == {x. l\<le>x}"
   21.29  
   21.30  definition
   21.31 -  greaterThanLessThan :: "'a => 'a => 'a set"  ("(1\<^loc>{_<..<_})") where
   21.32 -  "\<^loc>{l<..<u} == \<^loc>{l<..} Int \<^loc>{..<u}"
   21.33 +  greaterThanLessThan :: "'a => 'a => 'a set"  ("(1{_<..<_})") where
   21.34 +  "{l<..<u} == {l<..} Int {..<u}"
   21.35  
   21.36  definition
   21.37 -  atLeastLessThan :: "'a => 'a => 'a set"      ("(1\<^loc>{_..<_})") where
   21.38 -  "\<^loc>{l..<u} == \<^loc>{l..} Int \<^loc>{..<u}"
   21.39 +  atLeastLessThan :: "'a => 'a => 'a set"      ("(1{_..<_})") where
   21.40 +  "{l..<u} == {l..} Int {..<u}"
   21.41  
   21.42  definition
   21.43 -  greaterThanAtMost :: "'a => 'a => 'a set"    ("(1\<^loc>{_<.._})") where
   21.44 -  "\<^loc>{l<..u} == \<^loc>{l<..} Int \<^loc>{..u}"
   21.45 +  greaterThanAtMost :: "'a => 'a => 'a set"    ("(1{_<.._})") where
   21.46 +  "{l<..u} == {l<..} Int {..u}"
   21.47  
   21.48  definition
   21.49 -  atLeastAtMost :: "'a => 'a => 'a set"        ("(1\<^loc>{_.._})") where
   21.50 -  "\<^loc>{l..u} == \<^loc>{l..} Int \<^loc>{..u}"
   21.51 +  atLeastAtMost :: "'a => 'a => 'a set"        ("(1{_.._})") where
   21.52 +  "{l..u} == {l..} Int {..u}"
   21.53  
   21.54  end
   21.55  (*
   21.56 @@ -106,7 +106,7 @@
   21.57  
   21.58  subsection {* Various equivalences *}
   21.59  
   21.60 -lemma (in ord) lessThan_iff [iff]: "(i: lessThan k) = (i\<^loc><k)"
   21.61 +lemma (in ord) lessThan_iff [iff]: "(i: lessThan k) = (i<k)"
   21.62  by (simp add: lessThan_def)
   21.63  
   21.64  lemma Compl_lessThan [simp]:
   21.65 @@ -117,7 +117,7 @@
   21.66  lemma single_Diff_lessThan [simp]: "!!k:: 'a::order. {k} - lessThan k = {k}"
   21.67  by auto
   21.68  
   21.69 -lemma (in ord) greaterThan_iff [iff]: "(i: greaterThan k) = (k\<^loc><i)"
   21.70 +lemma (in ord) greaterThan_iff [iff]: "(i: greaterThan k) = (k<i)"
   21.71  by (simp add: greaterThan_def)
   21.72  
   21.73  lemma Compl_greaterThan [simp]:
   21.74 @@ -130,7 +130,7 @@
   21.75  apply (rule double_complement)
   21.76  done
   21.77  
   21.78 -lemma (in ord) atLeast_iff [iff]: "(i: atLeast k) = (k\<^loc><=i)"
   21.79 +lemma (in ord) atLeast_iff [iff]: "(i: atLeast k) = (k<=i)"
   21.80  by (simp add: atLeast_def)
   21.81  
   21.82  lemma Compl_atLeast [simp]:
   21.83 @@ -138,7 +138,7 @@
   21.84  apply (simp add: lessThan_def atLeast_def le_def, auto)
   21.85  done
   21.86  
   21.87 -lemma (in ord) atMost_iff [iff]: "(i: atMost k) = (i\<^loc><=k)"
   21.88 +lemma (in ord) atMost_iff [iff]: "(i: atMost k) = (i<=k)"
   21.89  by (simp add: atMost_def)
   21.90  
   21.91  lemma atMost_Int_atLeast: "!!n:: 'a::order. atMost n Int atLeast n = {n}"
   21.92 @@ -194,19 +194,19 @@
   21.93  begin
   21.94  
   21.95  lemma greaterThanLessThan_iff [simp,noatp]:
   21.96 -  "(i : \<^loc>{l<..<u}) = (l \<^loc>< i & i \<^loc>< u)"
   21.97 +  "(i : {l<..<u}) = (l < i & i < u)"
   21.98  by (simp add: greaterThanLessThan_def)
   21.99  
  21.100  lemma atLeastLessThan_iff [simp,noatp]:
  21.101 -  "(i : \<^loc>{l..<u}) = (l \<^loc><= i & i \<^loc>< u)"
  21.102 +  "(i : {l..<u}) = (l <= i & i < u)"
  21.103  by (simp add: atLeastLessThan_def)
  21.104  
  21.105  lemma greaterThanAtMost_iff [simp,noatp]:
  21.106 -  "(i : \<^loc>{l<..u}) = (l \<^loc>< i & i \<^loc><= u)"
  21.107 +  "(i : {l<..u}) = (l < i & i <= u)"
  21.108  by (simp add: greaterThanAtMost_def)
  21.109  
  21.110  lemma atLeastAtMost_iff [simp,noatp]:
  21.111 -  "(i : \<^loc>{l..u}) = (l \<^loc><= i & i \<^loc><= u)"
  21.112 +  "(i : {l..u}) = (l <= i & i <= u)"
  21.113  by (simp add: atLeastAtMost_def)
  21.114  
  21.115  text {* The above four lemmas could be declared as iffs.
  21.116 @@ -219,19 +219,19 @@
  21.117  context order
  21.118  begin
  21.119  
  21.120 -lemma atLeastAtMost_empty [simp]: "n \<^loc>< m ==> \<^loc>{m..n} = {}";
  21.121 +lemma atLeastAtMost_empty [simp]: "n < m ==> {m..n} = {}";
  21.122  by (auto simp add: atLeastAtMost_def atMost_def atLeast_def)
  21.123  
  21.124 -lemma atLeastLessThan_empty[simp]: "n \<^loc>\<le> m ==> \<^loc>{m..<n} = {}"
  21.125 +lemma atLeastLessThan_empty[simp]: "n \<le> m ==> {m..<n} = {}"
  21.126  by (auto simp add: atLeastLessThan_def)
  21.127  
  21.128 -lemma greaterThanAtMost_empty[simp]:"l \<^loc>\<le> k ==> \<^loc>{k<..l} = {}"
  21.129 +lemma greaterThanAtMost_empty[simp]:"l \<le> k ==> {k<..l} = {}"
  21.130  by(auto simp:greaterThanAtMost_def greaterThan_def atMost_def)
  21.131  
  21.132 -lemma greaterThanLessThan_empty[simp]:"l \<^loc>\<le> k ==> \<^loc>{k<..l} = {}"
  21.133 +lemma greaterThanLessThan_empty[simp]:"l \<le> k ==> {k<..l} = {}"
  21.134  by(auto simp:greaterThanLessThan_def greaterThan_def lessThan_def)
  21.135  
  21.136 -lemma atLeastAtMost_singleton [simp]: "\<^loc>{a..a} = {a}"
  21.137 +lemma atLeastAtMost_singleton [simp]: "{a..a} = {a}"
  21.138  by (auto simp add: atLeastAtMost_def atMost_def atLeast_def)
  21.139  
  21.140  end
    22.1 --- a/src/HOL/Wellfounded_Relations.thy	Tue Oct 16 23:12:38 2007 +0200
    22.2 +++ b/src/HOL/Wellfounded_Relations.thy	Tue Oct 16 23:12:45 2007 +0200
    22.3 @@ -113,15 +113,15 @@
    22.4  lemma (in linorder)
    22.5    finite_linorder_induct[consumes 1, case_names empty insert]:
    22.6   "finite A \<Longrightarrow> P {} \<Longrightarrow>
    22.7 -  (!!A b. finite A \<Longrightarrow> ALL a:A. a \<^loc>< b \<Longrightarrow> P A \<Longrightarrow> P(insert b A))
    22.8 +  (!!A b. finite A \<Longrightarrow> ALL a:A. a < b \<Longrightarrow> P A \<Longrightarrow> P(insert b A))
    22.9    \<Longrightarrow> P A"
   22.10  proof (induct A rule: measure_induct[where f=card])
   22.11    fix A :: "'a set"
   22.12    assume IH: "ALL B. card B < card A \<longrightarrow> finite B \<longrightarrow> P {} \<longrightarrow>
   22.13 -                 (\<forall>A b. finite A \<longrightarrow> (\<forall>a\<in>A. a\<^loc><b) \<longrightarrow> P A \<longrightarrow> P (insert b A))
   22.14 +                 (\<forall>A b. finite A \<longrightarrow> (\<forall>a\<in>A. a<b) \<longrightarrow> P A \<longrightarrow> P (insert b A))
   22.15                    \<longrightarrow> P B"
   22.16    and "finite A" and "P {}"
   22.17 -  and step: "!!A b. \<lbrakk>finite A; \<forall>a\<in>A. a \<^loc>< b; P A\<rbrakk> \<Longrightarrow> P (insert b A)"
   22.18 +  and step: "!!A b. \<lbrakk>finite A; \<forall>a\<in>A. a < b; P A\<rbrakk> \<Longrightarrow> P (insert b A)"
   22.19    show "P A"
   22.20    proof cases
   22.21      assume "A = {}" thus "P A" using `P {}` by simp
   22.22 @@ -133,7 +133,7 @@
   22.23      note card_Diff1_less[OF `finite A` `Max A : A`]
   22.24      moreover have "finite ?B" using `finite A` by simp
   22.25      ultimately have "P ?B" using `P {}` step IH by blast
   22.26 -    moreover have "\<forall>a\<in>?B. a \<^loc>< Max A"
   22.27 +    moreover have "\<forall>a\<in>?B. a < Max A"
   22.28        using Max_ge[OF `finite A` `A \<noteq> {}`] by fastsimp
   22.29      ultimately show "P A"
   22.30        using A insert_Diff_single step[OF `finite ?B`] by fastsimp
    23.1 --- a/src/HOL/ex/Classpackage.thy	Tue Oct 16 23:12:38 2007 +0200
    23.2 +++ b/src/HOL/ex/Classpackage.thy	Tue Oct 16 23:12:45 2007 +0200
    23.3 @@ -9,8 +9,8 @@
    23.4  begin
    23.5  
    23.6  class semigroup = type +
    23.7 -  fixes mult :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<^loc>\<otimes>" 70)
    23.8 -  assumes assoc: "x \<^loc>\<otimes> y \<^loc>\<otimes> z = x \<^loc>\<otimes> (y \<^loc>\<otimes> z)"
    23.9 +  fixes mult :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<otimes>" 70)
   23.10 +  assumes assoc: "x \<otimes> y \<otimes> z = x \<otimes> (y \<otimes> z)"
   23.11  
   23.12  instance nat :: semigroup
   23.13    "m \<otimes> n \<equiv> m + n"
   23.14 @@ -43,8 +43,8 @@
   23.15  qed
   23.16  
   23.17  class monoidl = semigroup +
   23.18 -  fixes one :: 'a ("\<^loc>\<one>")
   23.19 -  assumes neutl: "\<^loc>\<one> \<^loc>\<otimes> x = x"
   23.20 +  fixes one :: 'a ("\<one>")
   23.21 +  assumes neutl: "\<one> \<otimes> x = x"
   23.22  
   23.23  instance nat :: monoidl and int :: monoidl
   23.24    "\<one> \<equiv> 0"
   23.25 @@ -74,66 +74,66 @@
   23.26  qed  
   23.27  
   23.28  class monoid = monoidl +
   23.29 -  assumes neutr: "x \<^loc>\<otimes> \<^loc>\<one> = x"
   23.30 +  assumes neutr: "x \<otimes> \<one> = x"
   23.31  begin
   23.32  
   23.33  definition
   23.34    units :: "'a set" where
   23.35 -  "units = {y. \<exists>x. x \<^loc>\<otimes> y = \<^loc>\<one> \<and> y \<^loc>\<otimes> x = \<^loc>\<one>}"
   23.36 +  "units = {y. \<exists>x. x \<otimes> y = \<one> \<and> y \<otimes> x = \<one>}"
   23.37  
   23.38  lemma inv_obtain:
   23.39    assumes "x \<in> units"
   23.40 -  obtains y where "y \<^loc>\<otimes> x = \<^loc>\<one>" and "x \<^loc>\<otimes> y = \<^loc>\<one>"
   23.41 +  obtains y where "y \<otimes> x = \<one>" and "x \<otimes> y = \<one>"
   23.42  proof -
   23.43    from assms units_def obtain y
   23.44 -    where "y \<^loc>\<otimes> x = \<^loc>\<one>" and "x \<^loc>\<otimes> y = \<^loc>\<one>" by auto
   23.45 +    where "y \<otimes> x = \<one>" and "x \<otimes> y = \<one>" by auto
   23.46    thus ?thesis ..
   23.47  qed
   23.48  
   23.49  lemma inv_unique:
   23.50 -  assumes "y \<^loc>\<otimes> x = \<^loc>\<one>" "x \<^loc>\<otimes> y' = \<^loc>\<one>"
   23.51 +  assumes "y \<otimes> x = \<one>" "x \<otimes> y' = \<one>"
   23.52    shows "y = y'"
   23.53  proof -
   23.54 -  from assms neutr have "y = y \<^loc>\<otimes> (x \<^loc>\<otimes> y')" by simp
   23.55 -  also with assoc have "... = (y \<^loc>\<otimes> x) \<^loc>\<otimes> y'" by simp
   23.56 +  from assms neutr have "y = y \<otimes> (x \<otimes> y')" by simp
   23.57 +  also with assoc have "... = (y \<otimes> x) \<otimes> y'" by simp
   23.58    also with assms neutl have "... = y'" by simp
   23.59    finally show ?thesis .
   23.60  qed
   23.61  
   23.62  lemma units_inv_comm:
   23.63 -  assumes inv: "x \<^loc>\<otimes> y = \<^loc>\<one>"
   23.64 +  assumes inv: "x \<otimes> y = \<one>"
   23.65      and G: "x \<in> units"
   23.66 -  shows "y \<^loc>\<otimes> x = \<^loc>\<one>"
   23.67 +  shows "y \<otimes> x = \<one>"
   23.68  proof -
   23.69    from G inv_obtain obtain z
   23.70 -    where z_choice: "z \<^loc>\<otimes> x = \<^loc>\<one>" by blast
   23.71 -  from inv neutl neutr have "x \<^loc>\<otimes> y \<^loc>\<otimes> x = x \<^loc>\<otimes> \<^loc>\<one>" by simp
   23.72 -  with assoc have "z \<^loc>\<otimes> x \<^loc>\<otimes> y \<^loc>\<otimes> x = z \<^loc>\<otimes> x \<^loc>\<otimes> \<^loc>\<one>" by simp
   23.73 +    where z_choice: "z \<otimes> x = \<one>" by blast
   23.74 +  from inv neutl neutr have "x \<otimes> y \<otimes> x = x \<otimes> \<one>" by simp
   23.75 +  with assoc have "z \<otimes> x \<otimes> y \<otimes> x = z \<otimes> x \<otimes> \<one>" by simp
   23.76    with neutl z_choice show ?thesis by simp
   23.77  qed
   23.78  
   23.79  fun
   23.80    npow :: "nat \<Rightarrow> 'a \<Rightarrow> 'a"
   23.81  where
   23.82 -  "npow 0 x = \<^loc>\<one>"
   23.83 -  | "npow (Suc n) x = x \<^loc>\<otimes> npow n x"
   23.84 +  "npow 0 x = \<one>"
   23.85 +  | "npow (Suc n) x = x \<otimes> npow n x"
   23.86  
   23.87  abbreviation
   23.88 -  npow_syn :: "'a \<Rightarrow> nat \<Rightarrow> 'a" (infix "\<^loc>\<up>" 75) where
   23.89 -  "x \<^loc>\<up> n \<equiv> npow n x"
   23.90 +  npow_syn :: "'a \<Rightarrow> nat \<Rightarrow> 'a" (infix "\<up>" 75) where
   23.91 +  "x \<up> n \<equiv> npow n x"
   23.92  
   23.93  lemma nat_pow_one:
   23.94 -  "\<^loc>\<one> \<^loc>\<up> n = \<^loc>\<one>"
   23.95 +  "\<one> \<up> n = \<one>"
   23.96  using neutl by (induct n) simp_all
   23.97  
   23.98 -lemma nat_pow_mult: "x \<^loc>\<up> n \<^loc>\<otimes> x \<^loc>\<up> m = x \<^loc>\<up> (n + m)"
   23.99 +lemma nat_pow_mult: "x \<up> n \<otimes> x \<up> m = x \<up> (n + m)"
  23.100  proof (induct n)
  23.101    case 0 with neutl show ?case by simp
  23.102  next
  23.103    case (Suc n) with Suc.hyps assoc show ?case by simp
  23.104  qed
  23.105  
  23.106 -lemma nat_pow_pow: "(x \<^loc>\<up> m) \<^loc>\<up> n = x \<^loc>\<up> (n * m)"
  23.107 +lemma nat_pow_pow: "(x \<up> m) \<up> n = x \<up> (n * m)"
  23.108  using nat_pow_mult by (induct n) simp_all
  23.109  
  23.110  end
  23.111 @@ -153,7 +153,7 @@
  23.112  qed  
  23.113  
  23.114  class monoid_comm = monoid +
  23.115 -  assumes comm: "x \<^loc>\<otimes> y = y \<^loc>\<otimes> x"
  23.116 +  assumes comm: "x \<otimes> y = y \<otimes> x"
  23.117  
  23.118  instance nat :: monoid_comm and int :: monoid_comm
  23.119  proof
  23.120 @@ -174,30 +174,30 @@
  23.121  by default (simp_all add: split_paired_all mult_prod_def comm)
  23.122  
  23.123  class group = monoidl +
  23.124 -  fixes inv :: "'a \<Rightarrow> 'a" ("\<^loc>\<div> _" [81] 80)
  23.125 -  assumes invl: "\<^loc>\<div> x \<^loc>\<otimes> x = \<^loc>\<one>"
  23.126 +  fixes inv :: "'a \<Rightarrow> 'a" ("\<div> _" [81] 80)
  23.127 +  assumes invl: "\<div> x \<otimes> x = \<one>"
  23.128  begin
  23.129  
  23.130  lemma cancel:
  23.131 -  "(x \<^loc>\<otimes> y = x \<^loc>\<otimes> z) = (y = z)"
  23.132 +  "(x \<otimes> y = x \<otimes> z) = (y = z)"
  23.133  proof
  23.134    fix x y z :: 'a
  23.135 -  assume eq: "x \<^loc>\<otimes> y = x \<^loc>\<otimes> z"
  23.136 -  hence "\<^loc>\<div> x \<^loc>\<otimes> (x \<^loc>\<otimes> y) = \<^loc>\<div> x \<^loc>\<otimes> (x \<^loc>\<otimes> z)" by simp
  23.137 -  with assoc have "\<^loc>\<div> x \<^loc>\<otimes> x \<^loc>\<otimes> y = \<^loc>\<div> x \<^loc>\<otimes> x \<^loc>\<otimes> z" by simp
  23.138 +  assume eq: "x \<otimes> y = x \<otimes> z"
  23.139 +  hence "\<div> x \<otimes> (x \<otimes> y) = \<div> x \<otimes> (x \<otimes> z)" by simp
  23.140 +  with assoc have "\<div> x \<otimes> x \<otimes> y = \<div> x \<otimes> x \<otimes> z" by simp
  23.141    with neutl invl show "y = z" by simp
  23.142  next
  23.143    fix x y z :: 'a
  23.144    assume eq: "y = z"
  23.145 -  thus "x \<^loc>\<otimes> y = x \<^loc>\<otimes> z" by simp
  23.146 +  thus "x \<otimes> y = x \<otimes> z" by simp
  23.147  qed
  23.148  
  23.149  subclass monoid
  23.150  proof unfold_locales
  23.151    fix x
  23.152 -  from invl have "\<^loc>\<div> x \<^loc>\<otimes> x = \<^loc>\<one>" by simp
  23.153 -  with assoc [symmetric] neutl invl have "\<^loc>\<div> x \<^loc>\<otimes> (x \<^loc>\<otimes> \<^loc>\<one>) = \<^loc>\<div> x \<^loc>\<otimes> x" by simp
  23.154 -  with cancel show "x \<^loc>\<otimes> \<^loc>\<one> = x" by simp
  23.155 +  from invl have "\<div> x \<otimes> x = \<one>" by simp
  23.156 +  with assoc [symmetric] neutl invl have "\<div> x \<otimes> (x \<otimes> \<one>) = \<div> x \<otimes> x" by simp
  23.157 +  with cancel show "x \<otimes> \<one> = x" by simp
  23.158  qed
  23.159  
  23.160  end context group begin
  23.161 @@ -205,11 +205,11 @@
  23.162  find_theorems name: neut
  23.163  
  23.164  lemma invr:
  23.165 -  "x \<^loc>\<otimes> \<^loc>\<div> x = \<^loc>\<one>"
  23.166 +  "x \<otimes> \<div> x = \<one>"
  23.167  proof -
  23.168 -  from neutl invl have "\<^loc>\<div> x \<^loc>\<otimes> x \<^loc>\<otimes> \<^loc>\<div> x = \<^loc>\<div> x" by simp
  23.169 -  with neutr have "\<^loc>\<div> x \<^loc>\<otimes> x \<^loc>\<otimes> \<^loc>\<div> x = \<^loc>\<div> x \<^loc>\<otimes> \<^loc>\<one> " by simp
  23.170 -  with assoc have "\<^loc>\<div> x \<^loc>\<otimes> (x \<^loc>\<otimes> \<^loc>\<div> x) = \<^loc>\<div> x \<^loc>\<otimes> \<^loc>\<one> " by simp
  23.171 +  from neutl invl have "\<div> x \<otimes> x \<otimes> \<div> x = \<div> x" by simp
  23.172 +  with neutr have "\<div> x \<otimes> x \<otimes> \<div> x = \<div> x \<otimes> \<one> " by simp
  23.173 +  with assoc have "\<div> x \<otimes> (x \<otimes> \<div> x) = \<div> x \<otimes> \<one> " by simp
  23.174    with cancel show ?thesis ..
  23.175  qed
  23.176  
  23.177 @@ -218,72 +218,72 @@
  23.178    unfolding units_def
  23.179  proof -
  23.180    fix x :: "'a"
  23.181 -  from invl invr have "\<^loc>\<div> x \<^loc>\<otimes> x = \<^loc>\<one>" and "x \<^loc>\<otimes> \<^loc>\<div> x = \<^loc>\<one>" . 
  23.182 -  then obtain y where "y \<^loc>\<otimes> x = \<^loc>\<one>" and "x \<^loc>\<otimes> y = \<^loc>\<one>" ..
  23.183 -  hence "\<exists>y\<Colon>'a. y \<^loc>\<otimes> x = \<^loc>\<one> \<and> x \<^loc>\<otimes> y = \<^loc>\<one>" by blast
  23.184 -  thus "x \<in> {y\<Colon>'a. \<exists>x\<Colon>'a. x \<^loc>\<otimes> y = \<^loc>\<one> \<and> y \<^loc>\<otimes> x = \<^loc>\<one>}" by simp
  23.185 +  from invl invr have "\<div> x \<otimes> x = \<one>" and "x \<otimes> \<div> x = \<one>" . 
  23.186 +  then obtain y where "y \<otimes> x = \<one>" and "x \<otimes> y = \<one>" ..
  23.187 +  hence "\<exists>y\<Colon>'a. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>" by blast
  23.188 +  thus "x \<in> {y\<Colon>'a. \<exists>x\<Colon>'a. x \<otimes> y = \<one> \<and> y \<otimes> x = \<one>}" by simp
  23.189  qed
  23.190  
  23.191  lemma cancer:
  23.192 -  "(y \<^loc>\<otimes> x = z \<^loc>\<otimes> x) = (y = z)"
  23.193 +  "(y \<otimes> x = z \<otimes> x) = (y = z)"
  23.194  proof
  23.195 -  assume eq: "y \<^loc>\<otimes> x = z \<^loc>\<otimes> x"
  23.196 -  with assoc [symmetric] have "y \<^loc>\<otimes> (x \<^loc>\<otimes> \<^loc>\<div> x) = z \<^loc>\<otimes> (x \<^loc>\<otimes> \<^loc>\<div> x)" by (simp del: invr)
  23.197 +  assume eq: "y \<otimes> x = z \<otimes> x"
  23.198 +  with assoc [symmetric] have "y \<otimes> (x \<otimes> \<div> x) = z \<otimes> (x \<otimes> \<div> x)" by (simp del: invr)
  23.199    with invr neutr show "y = z" by simp
  23.200  next
  23.201    assume eq: "y = z"
  23.202 -  thus "y \<^loc>\<otimes> x = z \<^loc>\<otimes> x" by simp
  23.203 +  thus "y \<otimes> x = z \<otimes> x" by simp
  23.204  qed
  23.205  
  23.206  lemma inv_one:
  23.207 -  "\<^loc>\<div> \<^loc>\<one> = \<^loc>\<one>"
  23.208 +  "\<div> \<one> = \<one>"
  23.209  proof -
  23.210 -  from neutl have "\<^loc>\<div> \<^loc>\<one> = \<^loc>\<one> \<^loc>\<otimes> (\<^loc>\<div> \<^loc>\<one>)" ..
  23.211 -  moreover from invr have "... = \<^loc>\<one>" by simp
  23.212 +  from neutl have "\<div> \<one> = \<one> \<otimes> (\<div> \<one>)" ..
  23.213 +  moreover from invr have "... = \<one>" by simp
  23.214    finally show ?thesis .
  23.215  qed
  23.216  
  23.217  lemma inv_inv:
  23.218 -  "\<^loc>\<div> (\<^loc>\<div> x) = x"
  23.219 +  "\<div> (\<div> x) = x"
  23.220  proof -
  23.221    from invl invr neutr
  23.222 -    have "\<^loc>\<div> (\<^loc>\<div> x) \<^loc>\<otimes> \<^loc>\<div> x \<^loc>\<otimes> x = x \<^loc>\<otimes> \<^loc>\<div> x \<^loc>\<otimes> x" by simp
  23.223 +    have "\<div> (\<div> x) \<otimes> \<div> x \<otimes> x = x \<otimes> \<div> x \<otimes> x" by simp
  23.224    with assoc [symmetric]
  23.225 -    have "\<^loc>\<div> (\<^loc>\<div> x) \<^loc>\<otimes> (\<^loc>\<div> x \<^loc>\<otimes> x) = x \<^loc>\<otimes> (\<^loc>\<div> x \<^loc>\<otimes> x)" by simp
  23.226 +    have "\<div> (\<div> x) \<otimes> (\<div> x \<otimes> x) = x \<otimes> (\<div> x \<otimes> x)" by simp
  23.227    with invl neutr show ?thesis by simp
  23.228  qed
  23.229  
  23.230  lemma inv_mult_group:
  23.231 -  "\<^loc>\<div> (x \<^loc>\<otimes> y) = \<^loc>\<div> y \<^loc>\<otimes> \<^loc>\<div> x"
  23.232 +  "\<div> (x \<otimes> y) = \<div> y \<otimes> \<div> x"
  23.233  proof -
  23.234 -  from invl have "\<^loc>\<div> (x \<^loc>\<otimes> y) \<^loc>\<otimes> (x \<^loc>\<otimes> y) = \<^loc>\<one>" by simp
  23.235 -  with assoc have "\<^loc>\<div> (x \<^loc>\<otimes> y) \<^loc>\<otimes> x \<^loc>\<otimes> y = \<^loc>\<one>" by simp
  23.236 -  with neutl have "\<^loc>\<div> (x \<^loc>\<otimes> y) \<^loc>\<otimes> x \<^loc>\<otimes> y \<^loc>\<otimes> \<^loc>\<div> y \<^loc>\<otimes> \<^loc>\<div> x = \<^loc>\<div> y \<^loc>\<otimes> \<^loc>\<div> x" by simp
  23.237 -  with assoc have "\<^loc>\<div> (x \<^loc>\<otimes> y) \<^loc>\<otimes> (x \<^loc>\<otimes> (y \<^loc>\<otimes> \<^loc>\<div> y) \<^loc>\<otimes> \<^loc>\<div> x) = \<^loc>\<div> y \<^loc>\<otimes> \<^loc>\<div> x" by simp
  23.238 +  from invl have "\<div> (x \<otimes> y) \<otimes> (x \<otimes> y) = \<one>" by simp
  23.239 +  with assoc have "\<div> (x \<otimes> y) \<otimes> x \<otimes> y = \<one>" by simp
  23.240 +  with neutl have "\<div> (x \<otimes> y) \<otimes> x \<otimes> y \<otimes> \<div> y \<otimes> \<div> x = \<div> y \<otimes> \<div> x" by simp
  23.241 +  with assoc have "\<div> (x \<otimes> y) \<otimes> (x \<otimes> (y \<otimes> \<div> y) \<otimes> \<div> x) = \<div> y \<otimes> \<div> x" by simp
  23.242    with invr neutr show ?thesis by simp
  23.243  qed
  23.244  
  23.245  lemma inv_comm:
  23.246 -  "x \<^loc>\<otimes> \<^loc>\<div> x = \<^loc>\<div> x \<^loc>\<otimes> x"
  23.247 +  "x \<otimes> \<div> x = \<div> x \<otimes> x"
  23.248  using invr invl by simp
  23.249  
  23.250  definition
  23.251    pow :: "int \<Rightarrow> 'a \<Rightarrow> 'a"
  23.252  where
  23.253 -  "pow k x = (if k < 0 then \<^loc>\<div> (npow (nat (-k)) x)
  23.254 +  "pow k x = (if k < 0 then \<div> (npow (nat (-k)) x)
  23.255      else (npow (nat k) x))"
  23.256  
  23.257  abbreviation
  23.258 -  pow_syn :: "'a \<Rightarrow> int \<Rightarrow> 'a" (infix "\<^loc>\<up>\<up>" 75)
  23.259 +  pow_syn :: "'a \<Rightarrow> int \<Rightarrow> 'a" (infix "\<up>\<up>" 75)
  23.260  where
  23.261 -  "x \<^loc>\<up>\<up> k \<equiv> pow k x"
  23.262 +  "x \<up>\<up> k \<equiv> pow k x"
  23.263  
  23.264  lemma int_pow_zero:
  23.265 -  "x \<^loc>\<up>\<up> (0\<Colon>int) = \<^loc>\<one>"
  23.266 +  "x \<up>\<up> (0\<Colon>int) = \<one>"
  23.267  using pow_def by simp
  23.268  
  23.269  lemma int_pow_one:
  23.270 -  "\<^loc>\<one> \<^loc>\<up>\<up> (k\<Colon>int) = \<^loc>\<one>"
  23.271 +  "\<one> \<up>\<up> (k\<Colon>int) = \<one>"
  23.272  using pow_def nat_pow_one inv_one by simp
  23.273  
  23.274  end
    24.1 --- a/src/Pure/Isar/class.ML	Tue Oct 16 23:12:38 2007 +0200
    24.2 +++ b/src/Pure/Isar/class.ML	Tue Oct 16 23:12:45 2007 +0200
    24.3 @@ -7,7 +7,7 @@
    24.4  
    24.5  signature CLASS =
    24.6  sig
    24.7 -  val fork_mixfix: bool -> bool -> mixfix -> mixfix * mixfix
    24.8 +  val fork_mixfix: bool -> bool -> mixfix -> (mixfix * mixfix) * mixfix
    24.9  
   24.10    val axclass_cmd: bstring * xstring list
   24.11      -> ((bstring * Attrib.src list) * string list) list
   24.12 @@ -19,9 +19,9 @@
   24.13    val class_cmd: bstring -> xstring list -> Element.context Locale.element list
   24.14      -> xstring list -> theory -> string * Proof.context
   24.15    val init: class -> Proof.context -> Proof.context
   24.16 -  val add_const_in_class: string -> (string * mixfix) * (string * term)
   24.17 +  val add_const_in_class: string -> (string * mixfix) * term
   24.18      -> theory -> string * theory
   24.19 -  val add_abbrev_in_class: string -> Syntax.mode -> (string * mixfix) * (string * term)
   24.20 +  val add_abbrev_in_class: string -> Syntax.mode -> (string * mixfix) * term
   24.21      -> theory -> string * theory
   24.22    val remove_constraint: class -> string -> Proof.context -> Proof.context
   24.23    val is_class: theory -> class -> bool
   24.24 @@ -54,13 +54,15 @@
   24.25  
   24.26  (** auxiliary **)
   24.27  
   24.28 -fun fork_mixfix is_locale is_class mx =
   24.29 -  let
   24.30 -    val mx' = Syntax.unlocalize_mixfix mx;
   24.31 -    val mx_global = if not is_locale orelse (is_class andalso not (mx = mx'))
   24.32 -      then mx' else NoSyn;
   24.33 -    val mx_local = if is_locale then mx else NoSyn;
   24.34 -  in (mx_global, mx_local) end;
   24.35 +val classN = "class";
   24.36 +val introN = "intro";
   24.37 +
   24.38 +fun fork_mixfix false _ mx = ((NoSyn, NoSyn), mx)
   24.39 +  | fork_mixfix true false mx = ((NoSyn, mx), NoSyn)
   24.40 +  | fork_mixfix true true mx = ((mx, NoSyn), NoSyn);
   24.41 +      (*let
   24.42 +        val mx' = Syntax.unlocalize_mixfix mx;
   24.43 +      in if mx' = mx then ((NoSyn, mx), NoSyn) else ((mx', mx), NoSyn) end;*)
   24.44  
   24.45  fun prove_interpretation tac prfx_atts expr inst =
   24.46    Locale.interpretation_i I prfx_atts expr inst
   24.47 @@ -315,36 +317,36 @@
   24.48  datatype class_data = ClassData of {
   24.49    consts: (string * string) list
   24.50      (*locale parameter ~> constant name*),
   24.51 -  local_sort: sort,
   24.52 +  base_sort: sort,
   24.53    inst: (typ option list * term option list) * term Symtab.table
   24.54      (*canonical interpretation FIXME*),
   24.55 +  morphism: morphism,
   24.56 +    (*partial morphism of canonical interpretation*)
   24.57    intro: thm,
   24.58    defs: thm list,
   24.59 -  operations: (string * (term * (typ * int))) list
   24.60 -    (*constant name ~> (locale term, (constant constraint, instantiaton index of class typ))*),
   24.61 -  operations_rev: (string * string) list
   24.62 -    (*locale operation ~> constant name*)
   24.63 +  operations: (string * ((term * typ) * (typ * int))) list
   24.64 +    (*constant name ~> (locale term & typ,
   24.65 +        (constant constraint, instantiaton index of class typ))*)
   24.66  };
   24.67  
   24.68  fun rep_class_data (ClassData d) = d;
   24.69 -fun mk_class_data ((consts, local_sort, inst, intro),
   24.70 -    (defs, operations, operations_rev)) =
   24.71 -  ClassData { consts = consts, local_sort = local_sort, inst = inst,
   24.72 -    intro = intro, defs = defs, operations = operations,
   24.73 -    operations_rev = operations_rev };
   24.74 -fun map_class_data f (ClassData { consts, local_sort, inst, intro,
   24.75 -    defs, operations, operations_rev }) =
   24.76 -  mk_class_data (f ((consts, local_sort, inst, intro),
   24.77 -    (defs, operations, operations_rev)));
   24.78 +fun mk_class_data ((consts, base_sort, inst, morphism, intro),
   24.79 +    (defs, operations)) =
   24.80 +  ClassData { consts = consts, base_sort = base_sort, inst = inst,
   24.81 +    morphism = morphism, intro = intro, defs = defs,
   24.82 +    operations = operations };
   24.83 +fun map_class_data f (ClassData { consts, base_sort, inst, morphism, intro,
   24.84 +    defs, operations }) =
   24.85 +  mk_class_data (f ((consts, base_sort, inst, morphism, intro),
   24.86 +    (defs, operations)));
   24.87  fun merge_class_data _ (ClassData { consts = consts,
   24.88 -    local_sort = local_sort, inst = inst, intro = intro,
   24.89 -    defs = defs1, operations = operations1, operations_rev = operations_rev1 },
   24.90 -  ClassData { consts = _, local_sort = _, inst = _, intro = _,
   24.91 -    defs = defs2, operations = operations2, operations_rev = operations_rev2 }) =
   24.92 -  mk_class_data ((consts, local_sort, inst, intro),
   24.93 +    base_sort = base_sort, inst = inst, morphism = morphism, intro = intro,
   24.94 +    defs = defs1, operations = operations1 },
   24.95 +  ClassData { consts = _, base_sort = _, inst = _, morphism = _, intro = _,
   24.96 +    defs = defs2, operations = operations2 }) =
   24.97 +  mk_class_data ((consts, base_sort, inst, morphism, intro),
   24.98      (Thm.merge_thms (defs1, defs2),
   24.99 -      AList.merge (op =) (K true) (operations1, operations2),
  24.100 -      AList.merge (op =) (K true) (operations_rev1, operations_rev2)));
  24.101 +      AList.merge (op =) (K true) (operations1, operations2)));
  24.102  
  24.103  structure ClassData = TheoryDataFun
  24.104  (
  24.105 @@ -381,6 +383,8 @@
  24.106  
  24.107  fun these_defs thy = maps (these o Option.map #defs o lookup_class_data thy) o ancestry thy;
  24.108  
  24.109 +fun morphism thy = #morphism o the_class_data thy;
  24.110 +
  24.111  fun these_intros thy =
  24.112    Graph.fold (fn (_, (data, _)) => insert Thm.eq_thm ((#intro o rep_class_data) data))
  24.113      (ClassData.get thy) [];
  24.114 @@ -388,26 +392,21 @@
  24.115  fun these_operations thy =
  24.116    maps (#operations o the_class_data thy) o ancestry thy;
  24.117  
  24.118 -fun these_operations_rev thy =
  24.119 -  maps (#operations_rev o the_class_data thy) o ancestry thy;
  24.120 -
  24.121  fun local_operation thy = AList.lookup (op =) o these_operations thy;
  24.122  
  24.123 -fun global_operation thy = AList.lookup (op =) o these_operations_rev thy;
  24.124 -
  24.125 -fun sups_local_sort thy sort =
  24.126 +fun sups_base_sort thy sort =
  24.127    let
  24.128 -    val sups = filter (is_some o lookup_class_data thy) sort
  24.129 +    val sups = filter (is_class thy) sort
  24.130        |> Sign.minimize_sort thy;
  24.131 -    val local_sort = case sups
  24.132 -     of sup :: _ => #local_sort (the_class_data thy sup)
  24.133 +    val base_sort = case sups
  24.134 +     of _ :: _ => maps (#base_sort o the_class_data thy) sups
  24.135 +          |> Sign.minimize_sort thy
  24.136        | [] => sort;
  24.137 -  in (sups, local_sort) end;
  24.138 +  in (sups, base_sort) end;
  24.139  
  24.140  fun print_classes thy =
  24.141    let
  24.142      val ctxt = ProofContext.init thy;
  24.143 -
  24.144      val algebra = Sign.classes_of thy;
  24.145      val arities =
  24.146        Symtab.empty
  24.147 @@ -422,11 +421,13 @@
  24.148      fun mk_param (c, ty) = Pretty.str (Sign.extern_const thy c ^ " :: "
  24.149        ^ setmp show_sorts false (Syntax.string_of_typ ctxt o Type.strip_sorts) ty);
  24.150      fun mk_entry class = (Pretty.block o Pretty.fbreaks o map_filter I) [
  24.151 -      (SOME o Pretty.str) ("class " ^ class ^ ":"),
  24.152 +      (SOME o Pretty.str) ("class " ^ Sign.extern_class thy class ^ ":"),
  24.153        (SOME o Pretty.block) [Pretty.str "supersort: ",
  24.154          (Syntax.pretty_sort ctxt o Sign.minimize_sort thy o Sign.super_classes thy) class],
  24.155 -      if is_class thy class then (SOME o Pretty.str) ("locale: " ^ class) else NONE,
  24.156 -      ((fn [] => NONE | ps => (SOME o Pretty.block o Pretty.fbreaks) (Pretty.str "parameters:" :: ps)) o map mk_param
  24.157 +      if is_class thy class then (SOME o Pretty.str)
  24.158 +        ("locale: " ^ Locale.extern thy class) else NONE,
  24.159 +      ((fn [] => NONE | ps => (SOME o Pretty.block o Pretty.fbreaks)
  24.160 +          (Pretty.str "parameters:" :: ps)) o map mk_param
  24.161          o these o Option.map #params o try (AxClass.get_info thy)) class,
  24.162        (SOME o Pretty.block o Pretty.breaks) [
  24.163          Pretty.str "instances:",
  24.164 @@ -441,7 +442,7 @@
  24.165  
  24.166  (* updaters *)
  24.167  
  24.168 -fun add_class_data ((class, superclasses), (cs, local_sort, inst, intro)) thy =
  24.169 +fun add_class_data ((class, superclasses), (cs, base_sort, inst, phi, intro)) thy =
  24.170    let
  24.171      (*FIXME*)
  24.172      val is_empty = null (fold (fn ((_, ty), _) => fold_atyps cons ty) cs [])
  24.173 @@ -453,26 +454,50 @@
  24.174          (Locale.parameters_of_expr thy (Locale.Locale class));
  24.175      val instT = if is_empty then [] else [SOME (TFree (Name.aT, [class]))];
  24.176      val inst' = ((instT, inst_params), inst);
  24.177 -    val operations = map (fn (v_ty, (c, ty)) => (c, (Free v_ty, (ty, 0)))) cs;
  24.178 +    val operations = map (fn (v_ty as (_, ty'), (c, ty)) =>
  24.179 +      (c, ((Free v_ty, ty'), (Logic.varifyT ty, 0)))) cs;
  24.180      val cs = (map o pairself) fst cs;
  24.181      val add_class = Graph.new_node (class,
  24.182 -        mk_class_data ((cs, local_sort, inst', intro), ([], operations, [])))
  24.183 +        mk_class_data ((cs, base_sort, inst', phi, intro), ([], operations)))
  24.184        #> fold (curry Graph.add_edge class) superclasses;
  24.185    in
  24.186      ClassData.map add_class thy
  24.187    end;
  24.188  
  24.189 -fun register_operation class (entry, some_def) =
  24.190 -  (ClassData.map o Graph.map_node class o map_class_data o apsnd)
  24.191 -    (fn (defs, operations, operations_rev) =>
  24.192 -      (case some_def of NONE => defs | SOME def => def :: defs,
  24.193 -        entry :: operations, (*FIXME*)operations_rev));
  24.194 +fun register_operation class ((c, rhs), some_def) thy =
  24.195 +  let
  24.196 +    val ty = Sign.the_const_constraint thy c;
  24.197 +    val typargs = Sign.const_typargs thy (c, ty);
  24.198 +    val typidx = find_index (fn TVar ((v, _), _) => Name.aT = v | _ => false) typargs;
  24.199 +    val ty' = Term.fastype_of rhs;
  24.200 +  in
  24.201 +    thy
  24.202 +    |> (ClassData.map o Graph.map_node class o map_class_data o apsnd)
  24.203 +      (fn (defs, operations) =>
  24.204 +        (case some_def of NONE => defs | SOME def => def :: defs,
  24.205 +          (c, ((rhs, ty'), (ty, typidx))) :: operations))
  24.206 +  end;
  24.207  
  24.208  
  24.209  (** rule calculation, tactics and methods **)
  24.210  
  24.211  val class_prefix = Logic.const_of_class o Sign.base_name;
  24.212  
  24.213 +fun calculate_morphism class cs =
  24.214 +  let
  24.215 +    val subst_typ = Term.map_type_tfree (fn var as (v, sort) =>
  24.216 +      if v = Name.aT then TVar ((v, 0), [class]) else TVar ((v, 0), sort));
  24.217 +    fun subst_aterm (t as Free (v, ty)) = (case AList.lookup (op =) cs v
  24.218 +         of SOME (c, _) => Const (c, ty)
  24.219 +          | NONE => t)
  24.220 +      | subst_aterm t = t;
  24.221 +    val subst_term = map_aterms subst_aterm #> map_types subst_typ;
  24.222 +  in
  24.223 +    Morphism.identity
  24.224 +    $> Morphism.term_morphism subst_term
  24.225 +    $> Morphism.typ_morphism subst_typ
  24.226 +  end;
  24.227 +
  24.228  fun class_intro thy class sups =
  24.229    let
  24.230      fun class_elim class =
  24.231 @@ -506,8 +531,6 @@
  24.232    let
  24.233      val params = these_params thy [class];
  24.234      val { inst = ((_, inst), _), ... } = the_class_data thy class;
  24.235 -    (*val _ = tracing ("interpreting with " ^ cat_lines (map (setmp show_sorts true makestring)
  24.236 -      (map_filter I inst)));*)
  24.237      val tac = ALLGOALS (ProofContext.fact_tac facts);
  24.238      val prfx = class_prefix class;
  24.239    in
  24.240 @@ -548,82 +571,86 @@
  24.241  
  24.242  (* class context syntax *)
  24.243  
  24.244 -fun internal_remove_constraint local_sort (c, (_, (ty, typidx))) ctxt =
  24.245 +fun internal_remove_constraint base_sort (c, (_, (ty, _))) ctxt =
  24.246    let
  24.247 -    val consts = ProofContext.consts_of ctxt;
  24.248 -    val typargs = Consts.typargs consts (c, ty);
  24.249 -    val typargs' = nth_map typidx (K (TVar ((Name.aT, 0), local_sort))) typargs;
  24.250 -    val ty' = Consts.instance consts (c, typargs');
  24.251 -  in ProofContext.add_const_constraint (c, SOME ty') ctxt end;
  24.252 +    val ty' = ty
  24.253 +      |> map_atyps (fn ty as TVar ((v, 0), _) =>
  24.254 +           if v = Name.aT then TVar ((v, 0), base_sort) else ty)
  24.255 +      |> SOME;
  24.256 +  in ProofContext.add_const_constraint (c, ty') ctxt end;
  24.257  
  24.258  fun remove_constraint class c ctxt =
  24.259    let
  24.260      val thy = ProofContext.theory_of ctxt;
  24.261 +    val base_sort = (#base_sort o the_class_data thy) class;
  24.262      val SOME entry = local_operation thy [class] c;
  24.263    in
  24.264 -    internal_remove_constraint
  24.265 -      ((#local_sort o the_class_data thy) class) (c, entry) ctxt
  24.266 +    internal_remove_constraint base_sort (c, entry) ctxt
  24.267    end;
  24.268  
  24.269 -fun sort_term_check sups local_sort ts ctxt =
  24.270 +fun sort_term_check sups base_sort ts ctxt =
  24.271    let
  24.272      val thy = ProofContext.theory_of ctxt;
  24.273 -    val local_operation = local_operation thy sups;
  24.274 +    val local_operation = local_operation thy sups o fst;
  24.275 +    val typargs = Consts.typargs (ProofContext.consts_of ctxt);
  24.276      val constraints = these_operations thy sups |> (map o apsnd) (fst o snd);
  24.277 -    val consts = ProofContext.consts_of ctxt;
  24.278 -    fun check_typ (c, ty) (t', idx) = case nth (Consts.typargs consts (c, ty)) idx
  24.279 -     of TFree (v, _) => if v = Name.aT
  24.280 -          then apfst (AList.update (op =) ((c, ty), t')) else I
  24.281 -      | TVar (vi, _) => if TypeInfer.is_param vi
  24.282 -          then apfst (AList.update (op =) ((c, ty), t'))
  24.283 +    fun check_typ (c, ty) (TFree (v, _)) t = if v = Name.aT
  24.284 +          then apfst (AList.update (op =) ((c, ty), t)) else I
  24.285 +      | check_typ (c, ty) (TVar (vi, _)) t = if TypeInfer.is_param vi
  24.286 +          then apfst (AList.update (op =) ((c, ty), t))
  24.287              #> apsnd (insert (op =) vi) else I
  24.288 -      | _ => I;
  24.289 -    fun add_const (Const (c, ty)) = (case local_operation c
  24.290 -         of SOME (t', (_, idx)) => check_typ (c, ty) (t', idx)
  24.291 -          | NONE => I)
  24.292 +      | check_typ _ _ _ = I;
  24.293 +    fun check_const (c, ty) ((t, _), (_, idx)) =
  24.294 +      check_typ (c, ty) (nth (typargs (c, ty)) idx) t;
  24.295 +    fun add_const (Const c_ty) = Option.map (check_const c_ty) (local_operation c_ty)
  24.296 +          |> the_default I
  24.297        | add_const _ = I;
  24.298      val (cs, typarams) = (fold o fold_aterms) add_const ts ([], []);
  24.299 -    val ts' = map (map_aterms
  24.300 +    val subst_typ = map_type_tvar (fn var as (vi, _) =>
  24.301 +      if member (op =) typarams vi then TFree (Name.aT, base_sort) else TVar var);
  24.302 +    val subst_term = map_aterms
  24.303          (fn t as Const (c, ty) => the_default t (AList.lookup (op =) cs (c, ty)) | t => t)
  24.304 -      #> (map_types o map_type_tvar) (fn var as (vi, _) => if member (op =) typarams vi
  24.305 -           then TFree (Name.aT, local_sort) else TVar var)) ts;
  24.306 +          #> map_types subst_typ;
  24.307 +    val ts' = map subst_term ts;
  24.308      val ctxt' = fold (ProofContext.add_const_constraint o apsnd SOME) constraints ctxt;
  24.309    in if eq_list (op aconv) (ts, ts') then NONE else SOME (ts', ctxt') end;
  24.310  
  24.311 -val uncheck = ref false;
  24.312 +val uncheck = ref true;
  24.313  
  24.314  fun sort_term_uncheck sups ts ctxt =
  24.315    let
  24.316 +    (*FIXME abbreviations*)
  24.317      val thy = ProofContext.theory_of ctxt;
  24.318 -    val global_param = AList.lookup (op =) (these_params thy sups) #> Option.map fst;
  24.319 -    val global_operation = global_operation thy sups;
  24.320 -    fun globalize (t as Free (v, ty)) = (case global_param v
  24.321 -         of SOME c => Const (c, ty)
  24.322 -          | NONE => t)
  24.323 -      | globalize (t as Const (c, ty)) = (case global_operation c
  24.324 -         of SOME c => Const (c, ty)
  24.325 -          | NONE => t)
  24.326 -      | globalize t = t;
  24.327 -    val ts' = if ! uncheck then (map o map_aterms) globalize ts else ts;
  24.328 +    fun rew_app f (t1 $ t2) = rew_app f t1 $ f t2
  24.329 +      | rew_app f t = t;
  24.330 +    val rews = map (fn (c, ((t, ty), _)) => (t, Const (c, ty))) (these_operations thy sups);
  24.331 +    val rews' = (map o apfst o rew_app) (Pattern.rewrite_term thy rews []) rews;
  24.332 +    val _ = map (Thm.cterm_of thy o Logic.mk_equals) rews';
  24.333 +    val ts' = if ! uncheck
  24.334 +      then map (Pattern.rewrite_term thy rews' []) ts else ts;
  24.335    in if eq_list (op aconv) (ts, ts') then NONE else SOME (ts', ctxt) end;
  24.336  
  24.337 -fun init_class_ctxt sups local_sort ctxt =
  24.338 +fun init_class_ctxt sups base_sort ctxt =
  24.339    let
  24.340      val operations = these_operations (ProofContext.theory_of ctxt) sups;
  24.341 +    fun standard_infer_types ts ctxt =
  24.342 +      let
  24.343 +        val ts' = ProofContext.standard_infer_types ctxt ts;
  24.344 +      in if eq_list (op aconv) (ts, ts') then NONE else SOME (ts', ctxt) end;
  24.345    in
  24.346      ctxt
  24.347      |> Variable.declare_term
  24.348 -        (Logic.mk_type (TFree (Name.aT, local_sort)))
  24.349 -    |> fold (internal_remove_constraint local_sort) operations
  24.350 -    |> Context.proof_map (Syntax.add_term_check 50 "class"
  24.351 -        (sort_term_check sups local_sort)
  24.352 -        #> Syntax.add_term_uncheck 50 "class"
  24.353 -          (sort_term_uncheck sups))
  24.354 +        (Logic.mk_type (TFree (Name.aT, base_sort)))
  24.355 +    |> fold (internal_remove_constraint base_sort) operations
  24.356 +    |> Context.proof_map (Syntax.add_term_check 1 "class"
  24.357 +            (sort_term_check sups base_sort)
  24.358 +        #> Syntax.add_term_check 1 "standard" standard_infer_types
  24.359 +        #> Syntax.add_term_uncheck (~10) "class" (sort_term_uncheck sups))
  24.360    end;
  24.361  
  24.362  fun init class ctxt =
  24.363    init_class_ctxt [class]
  24.364 -    ((#local_sort o the_class_data (ProofContext.theory_of ctxt)) class) ctxt;
  24.365 +    ((#base_sort o the_class_data (ProofContext.theory_of ctxt)) class) ctxt;
  24.366  
  24.367  
  24.368  (* class definition *)
  24.369 @@ -633,7 +660,7 @@
  24.370  fun gen_class_spec prep_class prep_expr process_expr thy raw_supclasses raw_includes_elems =
  24.371    let
  24.372      val supclasses = map (prep_class thy) raw_supclasses;
  24.373 -    val (sups, local_sort) = sups_local_sort thy supclasses;
  24.374 +    val (sups, base_sort) = sups_base_sort thy supclasses;
  24.375      val supsort = Sign.minimize_sort thy supclasses;
  24.376      val suplocales = map Locale.Locale sups;
  24.377      val (raw_elems, includes) = fold_rev (fn Locale.Elem e => apfst (cons e)
  24.378 @@ -649,10 +676,10 @@
  24.379      ProofContext.init thy
  24.380      |> Locale.cert_expr supexpr [constrain]
  24.381      |> snd
  24.382 -    |> init_class_ctxt sups local_sort
  24.383 +    |> init_class_ctxt sups base_sort
  24.384      |> process_expr Locale.empty raw_elems
  24.385      |> fst
  24.386 -    |> (fn elems => ((((sups, supconsts), (supsort, local_sort, mergeexpr)),
  24.387 +    |> (fn elems => ((((sups, supconsts), (supsort, base_sort, mergeexpr)),
  24.388            (*FIXME*) if null includes then constrain :: elems else elems)))
  24.389    end;
  24.390  
  24.391 @@ -688,26 +715,26 @@
  24.392      raw_supclasses raw_includes_elems raw_other_consts thy =
  24.393    let
  24.394      val class = Sign.full_name thy bname;
  24.395 -    val (((sups, supconsts), (supsort, local_sort, mergeexpr)), elems) =
  24.396 +    val (((sups, supconsts), (supsort, base_sort, mergeexpr)), elems_syn) =
  24.397        prep_spec thy raw_supclasses raw_includes_elems;
  24.398      val other_consts = map (tap (Sign.the_const_type thy) o prep_param thy) raw_other_consts;
  24.399      fun mk_inst class param_names cs =
  24.400        Symtab.empty
  24.401        |> fold2 (fn v => fn (c, ty) => Symtab.update (v, Const
  24.402             (c, Term.map_type_tfree (fn (v, _) => TFree (v, [class])) ty))) param_names cs;
  24.403 +    fun fork_syntax (Element.Fixes xs) =
  24.404 +          fold_map (fn (c, ty, syn) => cons (c, syn) #> pair (c, ty, NoSyn)) xs
  24.405 +          #>> Element.Fixes
  24.406 +      | fork_syntax x = pair x;
  24.407 +    val (elems, global_syn) = fold_map fork_syntax elems_syn [];
  24.408 +    fun globalize (c, ty) = 
  24.409 +      ((c, Term.map_type_tfree (K (TFree (Name.aT, base_sort))) ty),
  24.410 +        (the_default NoSyn o AList.lookup (op =) global_syn) c);
  24.411      fun extract_params thy =
  24.412        let
  24.413 -        val params = Locale.parameters_of thy class;
  24.414 -        val _ = if Sign.subsort thy (supsort, local_sort) then () else error
  24.415 -          ("Sort " ^ Sign.string_of_sort thy local_sort
  24.416 -            ^ " is less general than permitted least general sort "
  24.417 -            ^ Sign.string_of_sort thy supsort);
  24.418 +        val params = map fst (Locale.parameters_of thy class);
  24.419        in
  24.420 -        (map fst params, params
  24.421 -        |> (map o apfst o apsnd o Term.map_type_tfree) (K (TFree (Name.aT, local_sort)))
  24.422 -        |> (map o apsnd) (fork_mixfix true true #> fst)
  24.423 -        |> chop (length supconsts)
  24.424 -        |> snd)
  24.425 +        (params, (map globalize o snd o chop (length supconsts)) params)
  24.426        end;
  24.427      fun extract_assumes params thy cs =
  24.428        let
  24.429 @@ -722,28 +749,26 @@
  24.430          Locale.global_asms_of thy class
  24.431          |> map prep_asm
  24.432        end;
  24.433 -    fun note_intro class_intro =
  24.434 -      PureThy.note_thmss_qualified "" (class_prefix class)
  24.435 -        [(("intro", []), [([class_intro], [])])]
  24.436 -      #> snd
  24.437    in
  24.438      thy
  24.439      |> Locale.add_locale_i (SOME "") bname mergeexpr elems
  24.440      |> snd
  24.441      |> ProofContext.theory (`extract_params
  24.442 -      #-> (fn (globals, params) =>
  24.443 +      #-> (fn (all_params, params) =>
  24.444          define_class_params (bname, supsort) params
  24.445            (extract_assumes params) other_consts
  24.446        #-> (fn (_, (consts, axioms)) =>
  24.447          `(fn thy => class_intro thy class sups)
  24.448        #-> (fn class_intro =>
  24.449 +        PureThy.note_thmss_qualified "" (NameSpace.append class classN)
  24.450 +          [((introN, []), [([class_intro], [])])]
  24.451 +      #-> (fn [(_, [class_intro])] =>
  24.452          add_class_data ((class, sups),
  24.453 -          (map fst params ~~ consts, local_sort,
  24.454 -            mk_inst class (map fst globals) (map snd supconsts @ consts),
  24.455 -              class_intro))
  24.456 -      #> note_intro class_intro
  24.457 +          (map fst params ~~ consts, base_sort,
  24.458 +            mk_inst class (map fst all_params) (map snd supconsts @ consts),
  24.459 +              calculate_morphism class (supconsts @ (map (fst o fst) params ~~ consts)), class_intro))
  24.460        #> class_interpretation class axioms []
  24.461 -      ))))
  24.462 +      )))))
  24.463      |> pair class
  24.464    end;
  24.465  
  24.466 @@ -757,56 +782,29 @@
  24.467  
  24.468  (* definition in class target *)
  24.469  
  24.470 -fun export_fixes thy class =
  24.471 +fun add_const_in_class class ((c, mx), rhs) thy =
  24.472    let
  24.473 -    val cs = these_params thy [class];
  24.474 -    fun subst_aterm (t as Free (v, ty)) = (case AList.lookup (op =) cs v
  24.475 -         of SOME (c, _) => Const (c, ty)
  24.476 -          | NONE => t)
  24.477 -      | subst_aterm t = t;
  24.478 -  in Term.map_aterms subst_aterm end;
  24.479 -
  24.480 -fun mk_operation_entry thy (c, rhs) =
  24.481 -  let
  24.482 -    val ty = Logic.unvarifyT (Sign.the_const_constraint thy c);
  24.483 -    val typargs = Sign.const_typargs thy (c, ty);
  24.484 -    val typidx = find_index (fn TFree (w, _) => Name.aT = w | _ => false) typargs;
  24.485 -  in (c, (rhs, (ty, typidx))) end;
  24.486 -
  24.487 -fun add_const_in_class class ((c, mx), (c_loc, rhs)) thy =
  24.488 -  let
  24.489 -    val _ = tracing c_loc;
  24.490      val prfx = class_prefix class;
  24.491      val thy' = thy |> Sign.add_path prfx;
  24.492 +    val phi = morphism thy' class;
  24.493  
  24.494 -    val rhs' = export_fixes thy' class rhs;
  24.495 -    val subst_typ = Term.map_type_tfree (fn var as (w, sort) =>
  24.496 -      if w = Name.aT then TFree (w, [class]) else TFree var);
  24.497 +    val c' = Sign.full_name thy' c;
  24.498 +    val ((mx', _), _) = fork_mixfix true true mx;
  24.499 +    val rhs' = (map_types Logic.unvarifyT o Morphism.term phi) rhs;
  24.500      val ty' = Term.fastype_of rhs';
  24.501 -    val ty'' = subst_typ ty';
  24.502 -    val c' = Sign.full_name thy' c;
  24.503 -    val c'' = NameSpace.full (Sign.naming_of thy' |> NameSpace.add_path prfx) c;
  24.504      val def = (c, Logic.mk_equals (Const (c', ty'), rhs'));
  24.505 -    val (mx', _) = fork_mixfix true true mx;
  24.506 -    fun interpret def thy =
  24.507 -      let
  24.508 -        val def' = symmetric def;
  24.509 -        val def_eq = (map_types Logic.unvarifyT o Thm.prop_of) def';
  24.510 -      in
  24.511 -        thy
  24.512 -        |> class_interpretation class [def'] [def_eq]
  24.513 -        |> Sign.add_const_constraint (c', SOME ty'')
  24.514 -        |> `(fn thy => mk_operation_entry thy (c', rhs))
  24.515 -        |-> (fn entry => register_operation class (entry, SOME def'))
  24.516 -      end;
  24.517 +    val c'' = NameSpace.full (Sign.naming_of thy' |> NameSpace.add_path prfx) c;
  24.518    in
  24.519      thy'
  24.520      |> Sign.hide_consts_i false [c'']
  24.521      |> Sign.declare_const [] (c, ty', mx') |> snd
  24.522      |> Sign.parent_path
  24.523      |> Sign.sticky_prefix prfx
  24.524 -    |> PureThy.add_defs_i false [(def, [])]
  24.525 -    |-> (fn [def] => interpret def)
  24.526 +    |> yield_singleton (PureThy.add_defs_i false) (def, [])
  24.527 +    |>> Thm.symmetric
  24.528 +    |-> (fn def => class_interpretation class [def]
  24.529 +                [(map_types Logic.unvarifyT o Thm.prop_of) def]
  24.530 +          #> register_operation class ((c', rhs), SOME def))
  24.531      |> Sign.restore_naming thy
  24.532      |> pair c'
  24.533    end;
  24.534 @@ -814,20 +812,20 @@
  24.535  
  24.536  (* abbreviation in class target *)
  24.537  
  24.538 -fun add_abbrev_in_class class prmode ((c, mx), (c_loc, rhs)) thy =
  24.539 +fun add_abbrev_in_class class prmode ((c, mx), rhs) thy =
  24.540    let
  24.541 -    val _ = tracing c_loc;
  24.542      val prfx = class_prefix class;
  24.543 +    val phi = morphism thy class;
  24.544 +
  24.545      val naming = Sign.naming_of thy |> NameSpace.add_path prfx |> NameSpace.add_path prfx;
  24.546        (*FIXME*)
  24.547      val c' = NameSpace.full naming c;
  24.548 -    val rhs' = export_fixes thy class rhs;
  24.549 +    val rhs' = (map_types Logic.unvarifyT o Morphism.term phi) rhs;
  24.550      val ty' = Term.fastype_of rhs';
  24.551 -    val entry = mk_operation_entry thy (c', rhs);
  24.552    in
  24.553      thy
  24.554      |> Sign.notation true prmode [(Const (c', ty'), mx)]
  24.555 -    |> register_operation class (entry, NONE)
  24.556 +    |> register_operation class ((c', rhs), NONE)
  24.557      |> pair c'
  24.558    end;
  24.559