fixed dependencies : Theory Dense_Linear_Order moved to Library
authorchaieb
Fri Feb 06 00:13:15 2009 +0000 (2009-02-06)
changeset 298133ccd86c214bf
parent 29812 a521a6fab39b
child 29817 a5ce1372523d
child 29818 762c2c63fc95
fixed dependencies : Theory Dense_Linear_Order moved to Library
src/HOL/Dense_Linear_Order.thy
src/HOL/IsaMakefile
     1.1 --- a/src/HOL/Dense_Linear_Order.thy	Fri Feb 06 00:10:58 2009 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,879 +0,0 @@
     1.4 -(*  Title       : HOL/Dense_Linear_Order.thy
     1.5 -    Author      : Amine Chaieb, TU Muenchen
     1.6 -*)
     1.7 -
     1.8 -header {* Dense linear order without endpoints
     1.9 -  and a quantifier elimination procedure in Ferrante and Rackoff style *}
    1.10 -
    1.11 -theory Dense_Linear_Order
    1.12 -imports Plain Groebner_Basis Main
    1.13 -uses
    1.14 -  "~~/src/HOL/Tools/Qelim/langford_data.ML"
    1.15 -  "~~/src/HOL/Tools/Qelim/ferrante_rackoff_data.ML"
    1.16 -  ("~~/src/HOL/Tools/Qelim/langford.ML")
    1.17 -  ("~~/src/HOL/Tools/Qelim/ferrante_rackoff.ML")
    1.18 -begin
    1.19 -
    1.20 -setup {* Langford_Data.setup #> Ferrante_Rackoff_Data.setup *}
    1.21 -
    1.22 -context linorder
    1.23 -begin
    1.24 -
    1.25 -lemma less_not_permute: "\<not> (x < y \<and> y < x)" by (simp add: not_less linear)
    1.26 -
    1.27 -lemma gather_simps: 
    1.28 -  shows 
    1.29 -  "(\<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)"
    1.30 -  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)"
    1.31 -  "(\<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))"
    1.32 -  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
    1.33 -
    1.34 -lemma 
    1.35 -  gather_start: "(\<exists>x. P x) \<equiv> (\<exists>x. (\<forall>y \<in> {}. y < x) \<and> (\<forall>y\<in> {}. x < y) \<and> P x)" 
    1.36 -  by simp
    1.37 -
    1.38 -text{* Theorems for @{text "\<exists>z. \<forall>x. x < z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>-\<infinity>\<^esub>)"}*}
    1.39 -lemma minf_lt:  "\<exists>z . \<forall>x. x < z \<longrightarrow> (x < t \<longleftrightarrow> True)" by auto
    1.40 -lemma minf_gt: "\<exists>z . \<forall>x. x < z \<longrightarrow>  (t < x \<longleftrightarrow>  False)"
    1.41 -  by (simp add: not_less) (rule exI[where x="t"], auto simp add: less_le)
    1.42 -
    1.43 -lemma minf_le: "\<exists>z. \<forall>x. x < z \<longrightarrow> (x \<le> t \<longleftrightarrow> True)" by (auto simp add: less_le)
    1.44 -lemma minf_ge: "\<exists>z. \<forall>x. x < z \<longrightarrow> (t \<le> x \<longleftrightarrow> False)"
    1.45 -  by (auto simp add: less_le not_less not_le)
    1.46 -lemma minf_eq: "\<exists>z. \<forall>x. x < z \<longrightarrow> (x = t \<longleftrightarrow> False)" by auto
    1.47 -lemma minf_neq: "\<exists>z. \<forall>x. x < z \<longrightarrow> (x \<noteq> t \<longleftrightarrow> True)" by auto
    1.48 -lemma minf_P: "\<exists>z. \<forall>x. x < z \<longrightarrow> (P \<longleftrightarrow> P)" by blast
    1.49 -
    1.50 -text{* Theorems for @{text "\<exists>z. \<forall>x. x < z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>+\<infinity>\<^esub>)"}*}
    1.51 -lemma pinf_gt:  "\<exists>z . \<forall>x. z < x \<longrightarrow> (t < x \<longleftrightarrow> True)" by auto
    1.52 -lemma pinf_lt: "\<exists>z . \<forall>x. z < x \<longrightarrow>  (x < t \<longleftrightarrow>  False)"
    1.53 -  by (simp add: not_less) (rule exI[where x="t"], auto simp add: less_le)
    1.54 -
    1.55 -lemma pinf_ge: "\<exists>z. \<forall>x. z < x \<longrightarrow> (t \<le> x \<longleftrightarrow> True)" by (auto simp add: less_le)
    1.56 -lemma pinf_le: "\<exists>z. \<forall>x. z < x \<longrightarrow> (x \<le> t \<longleftrightarrow> False)"
    1.57 -  by (auto simp add: less_le not_less not_le)
    1.58 -lemma pinf_eq: "\<exists>z. \<forall>x. z < x \<longrightarrow> (x = t \<longleftrightarrow> False)" by auto
    1.59 -lemma pinf_neq: "\<exists>z. \<forall>x. z < x \<longrightarrow> (x \<noteq> t \<longleftrightarrow> True)" by auto
    1.60 -lemma pinf_P: "\<exists>z. \<forall>x. z < x \<longrightarrow> (P \<longleftrightarrow> P)" by blast
    1.61 -
    1.62 -lemma nmi_lt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> x < t \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
    1.63 -lemma nmi_gt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and> t < x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)"
    1.64 -  by (auto simp add: le_less)
    1.65 -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
    1.66 -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
    1.67 -lemma  nmi_eq: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x = t \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
    1.68 -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
    1.69 -lemma  nmi_P: "\<forall> x. ~P \<and> P \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
    1.70 -lemma  nmi_conj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x) ;
    1.71 -  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)\<rbrakk> \<Longrightarrow>
    1.72 -  \<forall>x. \<not>(P1' \<and> P2') \<and> (P1 x \<and> P2 x) \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
    1.73 -lemma  nmi_disj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x) ;
    1.74 -  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)\<rbrakk> \<Longrightarrow>
    1.75 -  \<forall>x. \<not>(P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
    1.76 -
    1.77 -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)
    1.78 -lemma  npi_gt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> t < x \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
    1.79 -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
    1.80 -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
    1.81 -lemma  npi_eq: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x = t \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
    1.82 -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
    1.83 -lemma  npi_P: "\<forall> x. ~P \<and> P \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
    1.84 -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>
    1.85 -  \<Longrightarrow>  \<forall>x. \<not>(P1' \<and> P2') \<and> (P1 x \<and> P2 x) \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
    1.86 -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>
    1.87 -  \<Longrightarrow> \<forall>x. \<not>(P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
    1.88 -
    1.89 -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)"
    1.90 -proof(clarsimp)
    1.91 -  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"
    1.92 -    and xu: "x<u"  and px: "x < t" and ly: "l<y" and yu:"y < u"
    1.93 -  from tU noU ly yu have tny: "t\<noteq>y" by auto
    1.94 -  {assume H: "t < y"
    1.95 -    from less_trans[OF lx px] less_trans[OF H yu]
    1.96 -    have "l < t \<and> t < u"  by simp
    1.97 -    with tU noU have "False" by auto}
    1.98 -  hence "\<not> t < y"  by auto hence "y \<le> t" by (simp add: not_less)
    1.99 -  thus "y < t" using tny by (simp add: less_le)
   1.100 -qed
   1.101 -
   1.102 -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)"
   1.103 -proof(clarsimp)
   1.104 -  fix x l u y
   1.105 -  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"
   1.106 -  and px: "t < x" and ly: "l<y" and yu:"y < u"
   1.107 -  from tU noU ly yu have tny: "t\<noteq>y" by auto
   1.108 -  {assume H: "y< t"
   1.109 -    from less_trans[OF ly H] less_trans[OF px xu] have "l < t \<and> t < u" by simp
   1.110 -    with tU noU have "False" by auto}
   1.111 -  hence "\<not> y<t"  by auto hence "t \<le> y" by (auto simp add: not_less)
   1.112 -  thus "t < y" using tny by (simp add:less_le)
   1.113 -qed
   1.114 -
   1.115 -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)"
   1.116 -proof(clarsimp)
   1.117 -  fix x l u y
   1.118 -  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"
   1.119 -  and px: "x \<le> t" and ly: "l<y" and yu:"y < u"
   1.120 -  from tU noU ly yu have tny: "t\<noteq>y" by auto
   1.121 -  {assume H: "t < y"
   1.122 -    from less_le_trans[OF lx px] less_trans[OF H yu]
   1.123 -    have "l < t \<and> t < u" by simp
   1.124 -    with tU noU have "False" by auto}
   1.125 -  hence "\<not> t < y"  by auto thus "y \<le> t" by (simp add: not_less)
   1.126 -qed
   1.127 -
   1.128 -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)"
   1.129 -proof(clarsimp)
   1.130 -  fix x l u y
   1.131 -  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"
   1.132 -  and px: "t \<le> x" and ly: "l<y" and yu:"y < u"
   1.133 -  from tU noU ly yu have tny: "t\<noteq>y" by auto
   1.134 -  {assume H: "y< t"
   1.135 -    from less_trans[OF ly H] le_less_trans[OF px xu]
   1.136 -    have "l < t \<and> t < u" by simp
   1.137 -    with tU noU have "False" by auto}
   1.138 -  hence "\<not> y<t"  by auto thus "t \<le> y" by (simp add: not_less)
   1.139 -qed
   1.140 -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
   1.141 -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
   1.142 -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
   1.143 -
   1.144 -lemma lin_dense_conj:
   1.145 -  "\<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
   1.146 -  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P1 y) ;
   1.147 -  \<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> P2 x
   1.148 -  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P2 y)\<rbrakk> \<Longrightarrow>
   1.149 -  \<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)
   1.150 -  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> (P1 y \<and> P2 y))"
   1.151 -  by blast
   1.152 -lemma lin_dense_disj:
   1.153 -  "\<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
   1.154 -  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P1 y) ;
   1.155 -  \<forall>x l u. (\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> U) \<and> l< x \<and> x < u \<and> P2 x
   1.156 -  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P2 y)\<rbrakk> \<Longrightarrow>
   1.157 -  \<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)
   1.158 -  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> (P1 y \<or> P2 y))"
   1.159 -  by blast
   1.160 -
   1.161 -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>
   1.162 -  \<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')"
   1.163 -by auto
   1.164 -
   1.165 -lemma finite_set_intervals:
   1.166 -  assumes px: "P x" and lx: "l \<le> x" and xu: "x \<le> u" and linS: "l\<in> S"
   1.167 -  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"
   1.168 -  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"
   1.169 -proof-
   1.170 -  let ?Mx = "{y. y\<in> S \<and> y \<le> x}"
   1.171 -  let ?xM = "{y. y\<in> S \<and> x \<le> y}"
   1.172 -  let ?a = "Max ?Mx"
   1.173 -  let ?b = "Min ?xM"
   1.174 -  have MxS: "?Mx \<subseteq> S" by blast
   1.175 -  hence fMx: "finite ?Mx" using fS finite_subset by auto
   1.176 -  from lx linS have linMx: "l \<in> ?Mx" by blast
   1.177 -  hence Mxne: "?Mx \<noteq> {}" by blast
   1.178 -  have xMS: "?xM \<subseteq> S" by blast
   1.179 -  hence fxM: "finite ?xM" using fS finite_subset by auto
   1.180 -  from xu uinS have linxM: "u \<in> ?xM" by blast
   1.181 -  hence xMne: "?xM \<noteq> {}" by blast
   1.182 -  have ax:"?a \<le> x" using Mxne fMx by auto
   1.183 -  have xb:"x \<le> ?b" using xMne fxM by auto
   1.184 -  have "?a \<in> ?Mx" using Max_in[OF fMx Mxne] by simp hence ainS: "?a \<in> S" using MxS by blast
   1.185 -  have "?b \<in> ?xM" using Min_in[OF fxM xMne] by simp hence binS: "?b \<in> S" using xMS by blast
   1.186 -  have noy:"\<forall> y. ?a < y \<and> y < ?b \<longrightarrow> y \<notin> S"
   1.187 -  proof(clarsimp)
   1.188 -    fix y   assume ay: "?a < y" and yb: "y < ?b" and yS: "y \<in> S"
   1.189 -    from yS have "y\<in> ?Mx \<or> y\<in> ?xM" by (auto simp add: linear)
   1.190 -    moreover {assume "y \<in> ?Mx" hence "y \<le> ?a" using Mxne fMx by auto with ay have "False" by (simp add: not_le[symmetric])}
   1.191 -    moreover {assume "y \<in> ?xM" hence "?b \<le> y" using xMne fxM by auto with yb have "False" by (simp add: not_le[symmetric])}
   1.192 -    ultimately show "False" by blast
   1.193 -  qed
   1.194 -  from ainS binS noy ax xb px show ?thesis by blast
   1.195 -qed
   1.196 -
   1.197 -lemma finite_set_intervals2:
   1.198 -  assumes px: "P x" and lx: "l \<le> x" and xu: "x \<le> u" and linS: "l\<in> S"
   1.199 -  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"
   1.200 -  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)"
   1.201 -proof-
   1.202 -  from finite_set_intervals[where P="P", OF px lx xu linS uinS fS lS Su]
   1.203 -  obtain a and b where
   1.204 -    as: "a\<in> S" and bs: "b\<in> S" and noS:"\<forall>y. a < y \<and> y < b \<longrightarrow> y \<notin> S"
   1.205 -    and axb: "a \<le> x \<and> x \<le> b \<and> P x"  by auto
   1.206 -  from axb have "x= a \<or> x= b \<or> (a < x \<and> x < b)" by (auto simp add: le_less)
   1.207 -  thus ?thesis using px as bs noS by blast
   1.208 -qed
   1.209 -
   1.210 -end
   1.211 -
   1.212 -section {* The classical QE after Langford for dense linear orders *}
   1.213 -
   1.214 -context dense_linear_order
   1.215 -begin
   1.216 -
   1.217 -lemma interval_empty_iff:
   1.218 -  "{y. x < y \<and> y < z} = {} \<longleftrightarrow> \<not> x < z"
   1.219 -  by (auto dest: dense)
   1.220 -
   1.221 -lemma dlo_qe_bnds: 
   1.222 -  assumes ne: "L \<noteq> {}" and neU: "U \<noteq> {}" and fL: "finite L" and fU: "finite U"
   1.223 -  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)"
   1.224 -proof (simp only: atomize_eq, rule iffI)
   1.225 -  assume H: "\<exists>x. (\<forall>y\<in>L. y < x) \<and> (\<forall>y\<in>U. x < y)"
   1.226 -  then obtain x where xL: "\<forall>y\<in>L. y < x" and xU: "\<forall>y\<in>U. x < y" by blast
   1.227 -  {fix l u assume l: "l \<in> L" and u: "u \<in> U"
   1.228 -    have "l < x" using xL l by blast
   1.229 -    also have "x < u" using xU u by blast
   1.230 -    finally (less_trans) have "l < u" .}
   1.231 -  thus "\<forall>l\<in>L. \<forall>u\<in>U. l < u" by blast
   1.232 -next
   1.233 -  assume H: "\<forall>l\<in>L. \<forall>u\<in>U. l < u"
   1.234 -  let ?ML = "Max L"
   1.235 -  let ?MU = "Min U"  
   1.236 -  from fL ne have th1: "?ML \<in> L" and th1': "\<forall>l\<in>L. l \<le> ?ML" by auto
   1.237 -  from fU neU have th2: "?MU \<in> U" and th2': "\<forall>u\<in>U. ?MU \<le> u" by auto
   1.238 -  from th1 th2 H have "?ML < ?MU" by auto
   1.239 -  with dense obtain w where th3: "?ML < w" and th4: "w < ?MU" by blast
   1.240 -  from th3 th1' have "\<forall>l \<in> L. l < w" by auto
   1.241 -  moreover from th4 th2' have "\<forall>u \<in> U. w < u" by auto
   1.242 -  ultimately show "\<exists>x. (\<forall>y\<in>L. y < x) \<and> (\<forall>y\<in>U. x < y)" by auto
   1.243 -qed
   1.244 -
   1.245 -lemma dlo_qe_noub: 
   1.246 -  assumes ne: "L \<noteq> {}" and fL: "finite L"
   1.247 -  shows "(\<exists>x. (\<forall>y \<in> L. y < x) \<and> (\<forall>y \<in> {}. x < y)) \<equiv> True"
   1.248 -proof(simp add: atomize_eq)
   1.249 -  from gt_ex[of "Max L"] obtain M where M: "Max L < M" by blast
   1.250 -  from ne fL have "\<forall>x \<in> L. x \<le> Max L" by simp
   1.251 -  with M have "\<forall>x\<in>L. x < M" by (auto intro: le_less_trans)
   1.252 -  thus "\<exists>x. \<forall>y\<in>L. y < x" by blast
   1.253 -qed
   1.254 -
   1.255 -lemma dlo_qe_nolb: 
   1.256 -  assumes ne: "U \<noteq> {}" and fU: "finite U"
   1.257 -  shows "(\<exists>x. (\<forall>y \<in> {}. y < x) \<and> (\<forall>y \<in> U. x < y)) \<equiv> True"
   1.258 -proof(simp add: atomize_eq)
   1.259 -  from lt_ex[of "Min U"] obtain M where M: "M < Min U" by blast
   1.260 -  from ne fU have "\<forall>x \<in> U. Min U \<le> x" by simp
   1.261 -  with M have "\<forall>x\<in>U. M < x" by (auto intro: less_le_trans)
   1.262 -  thus "\<exists>x. \<forall>y\<in>U. x < y" by blast
   1.263 -qed
   1.264 -
   1.265 -lemma exists_neq: "\<exists>(x::'a). x \<noteq> t" "\<exists>(x::'a). t \<noteq> x" 
   1.266 -  using gt_ex[of t] by auto
   1.267 -
   1.268 -lemmas dlo_simps = order_refl less_irrefl not_less not_le exists_neq 
   1.269 -  le_less neq_iff linear less_not_permute
   1.270 -
   1.271 -lemma axiom: "dense_linear_order (op \<le>) (op <)" by (rule dense_linear_order_axioms)
   1.272 -lemma atoms:
   1.273 -  shows "TERM (less :: 'a \<Rightarrow> _)"
   1.274 -    and "TERM (less_eq :: 'a \<Rightarrow> _)"
   1.275 -    and "TERM (op = :: 'a \<Rightarrow> _)" .
   1.276 -
   1.277 -declare axiom[langford qe: dlo_qe_bnds dlo_qe_nolb dlo_qe_noub gather: gather_start gather_simps atoms: atoms]
   1.278 -declare dlo_simps[langfordsimp]
   1.279 -
   1.280 -end
   1.281 -
   1.282 -(* FIXME: Move to HOL -- together with the conj_aci_rule in langford.ML *)
   1.283 -lemma dnf:
   1.284 -  "(P & (Q | R)) = ((P&Q) | (P&R))" 
   1.285 -  "((Q | R) & P) = ((Q&P) | (R&P))"
   1.286 -  by blast+
   1.287 -
   1.288 -lemmas weak_dnf_simps = simp_thms dnf
   1.289 -
   1.290 -lemma nnf_simps:
   1.291 -    "(\<not>(P \<and> Q)) = (\<not>P \<or> \<not>Q)" "(\<not>(P \<or> Q)) = (\<not>P \<and> \<not>Q)" "(P \<longrightarrow> Q) = (\<not>P \<or> Q)"
   1.292 -    "(P = Q) = ((P \<and> Q) \<or> (\<not>P \<and> \<not> Q))" "(\<not> \<not>(P)) = P"
   1.293 -  by blast+
   1.294 -
   1.295 -lemma ex_distrib: "(\<exists>x. P x \<or> Q x) \<longleftrightarrow> ((\<exists>x. P x) \<or> (\<exists>x. Q x))" by blast
   1.296 -
   1.297 -lemmas dnf_simps = weak_dnf_simps nnf_simps ex_distrib
   1.298 -
   1.299 -use "~~/src/HOL/Tools/Qelim/langford.ML"
   1.300 -method_setup dlo = {*
   1.301 -  Method.ctxt_args (Method.SIMPLE_METHOD' o LangfordQE.dlo_tac)
   1.302 -*} "Langford's algorithm for quantifier elimination in dense linear orders"
   1.303 -
   1.304 -
   1.305 -section {* Contructive dense linear orders yield QE for linear arithmetic over ordered Fields -- see @{text "Arith_Tools.thy"} *}
   1.306 -
   1.307 -text {* Linear order without upper bounds *}
   1.308 -
   1.309 -locale linorder_stupid_syntax = linorder
   1.310 -begin
   1.311 -notation
   1.312 -  less_eq  ("op \<sqsubseteq>") and
   1.313 -  less_eq  ("(_/ \<sqsubseteq> _)" [51, 51] 50) and
   1.314 -  less  ("op \<sqsubset>") and
   1.315 -  less  ("(_/ \<sqsubset> _)"  [51, 51] 50)
   1.316 -
   1.317 -end
   1.318 -
   1.319 -locale linorder_no_ub = linorder_stupid_syntax +
   1.320 -  assumes gt_ex: "\<exists>y. less x y"
   1.321 -begin
   1.322 -lemma ge_ex: "\<exists>y. x \<sqsubseteq> y" using gt_ex by auto
   1.323 -
   1.324 -text {* Theorems for @{text "\<exists>z. \<forall>x. z \<sqsubset> x \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>+\<infinity>\<^esub>)"} *}
   1.325 -lemma pinf_conj:
   1.326 -  assumes ex1: "\<exists>z1. \<forall>x. z1 \<sqsubset> x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   1.327 -  and ex2: "\<exists>z2. \<forall>x. z2 \<sqsubset> x \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
   1.328 -  shows "\<exists>z. \<forall>x. z \<sqsubset>  x \<longrightarrow> ((P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2'))"
   1.329 -proof-
   1.330 -  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. z1 \<sqsubset> x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   1.331 -     and z2: "\<forall>x. z2 \<sqsubset> x \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
   1.332 -  from gt_ex obtain z where z:"ord.max less_eq z1 z2 \<sqsubset> z" by blast
   1.333 -  from z have zz1: "z1 \<sqsubset> z" and zz2: "z2 \<sqsubset> z" by simp_all
   1.334 -  {fix x assume H: "z \<sqsubset> x"
   1.335 -    from less_trans[OF zz1 H] less_trans[OF zz2 H]
   1.336 -    have "(P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2')"  using z1 zz1 z2 zz2 by auto
   1.337 -  }
   1.338 -  thus ?thesis by blast
   1.339 -qed
   1.340 -
   1.341 -lemma pinf_disj:
   1.342 -  assumes ex1: "\<exists>z1. \<forall>x. z1 \<sqsubset> x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   1.343 -  and ex2: "\<exists>z2. \<forall>x. z2 \<sqsubset> x \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
   1.344 -  shows "\<exists>z. \<forall>x. z \<sqsubset>  x \<longrightarrow> ((P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2'))"
   1.345 -proof-
   1.346 -  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. z1 \<sqsubset> x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   1.347 -     and z2: "\<forall>x. z2 \<sqsubset> x \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
   1.348 -  from gt_ex obtain z where z:"ord.max less_eq z1 z2 \<sqsubset> z" by blast
   1.349 -  from z have zz1: "z1 \<sqsubset> z" and zz2: "z2 \<sqsubset> z" by simp_all
   1.350 -  {fix x assume H: "z \<sqsubset> x"
   1.351 -    from less_trans[OF zz1 H] less_trans[OF zz2 H]
   1.352 -    have "(P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2')"  using z1 zz1 z2 zz2 by auto
   1.353 -  }
   1.354 -  thus ?thesis by blast
   1.355 -qed
   1.356 -
   1.357 -lemma pinf_ex: assumes ex:"\<exists>z. \<forall>x. z \<sqsubset> x \<longrightarrow> (P x \<longleftrightarrow> P1)" and p1: P1 shows "\<exists> x. P x"
   1.358 -proof-
   1.359 -  from ex obtain z where z: "\<forall>x. z \<sqsubset> x \<longrightarrow> (P x \<longleftrightarrow> P1)" by blast
   1.360 -  from gt_ex obtain x where x: "z \<sqsubset> x" by blast
   1.361 -  from z x p1 show ?thesis by blast
   1.362 -qed
   1.363 -
   1.364 -end
   1.365 -
   1.366 -text {* Linear order without upper bounds *}
   1.367 -
   1.368 -locale linorder_no_lb = linorder_stupid_syntax +
   1.369 -  assumes lt_ex: "\<exists>y. less y x"
   1.370 -begin
   1.371 -lemma le_ex: "\<exists>y. y \<sqsubseteq> x" using lt_ex by auto
   1.372 -
   1.373 -
   1.374 -text {* Theorems for @{text "\<exists>z. \<forall>x. x \<sqsubset> z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>-\<infinity>\<^esub>)"} *}
   1.375 -lemma minf_conj:
   1.376 -  assumes ex1: "\<exists>z1. \<forall>x. x \<sqsubset> z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   1.377 -  and ex2: "\<exists>z2. \<forall>x. x \<sqsubset> z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
   1.378 -  shows "\<exists>z. \<forall>x. x \<sqsubset>  z \<longrightarrow> ((P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2'))"
   1.379 -proof-
   1.380 -  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. x \<sqsubset> z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"and z2: "\<forall>x. x \<sqsubset> z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
   1.381 -  from lt_ex obtain z where z:"z \<sqsubset> ord.min less_eq z1 z2" by blast
   1.382 -  from z have zz1: "z \<sqsubset> z1" and zz2: "z \<sqsubset> z2" by simp_all
   1.383 -  {fix x assume H: "x \<sqsubset> z"
   1.384 -    from less_trans[OF H zz1] less_trans[OF H zz2]
   1.385 -    have "(P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2')"  using z1 zz1 z2 zz2 by auto
   1.386 -  }
   1.387 -  thus ?thesis by blast
   1.388 -qed
   1.389 -
   1.390 -lemma minf_disj:
   1.391 -  assumes ex1: "\<exists>z1. \<forall>x. x \<sqsubset> z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
   1.392 -  and ex2: "\<exists>z2. \<forall>x. x \<sqsubset> z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
   1.393 -  shows "\<exists>z. \<forall>x. x \<sqsubset>  z \<longrightarrow> ((P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2'))"
   1.394 -proof-
   1.395 -  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. x \<sqsubset> z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"and z2: "\<forall>x. x \<sqsubset> z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
   1.396 -  from lt_ex obtain z where z:"z \<sqsubset> ord.min less_eq z1 z2" by blast
   1.397 -  from z have zz1: "z \<sqsubset> z1" and zz2: "z \<sqsubset> z2" by simp_all
   1.398 -  {fix x assume H: "x \<sqsubset> z"
   1.399 -    from less_trans[OF H zz1] less_trans[OF H zz2]
   1.400 -    have "(P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2')"  using z1 zz1 z2 zz2 by auto
   1.401 -  }
   1.402 -  thus ?thesis by blast
   1.403 -qed
   1.404 -
   1.405 -lemma minf_ex: assumes ex:"\<exists>z. \<forall>x. x \<sqsubset> z \<longrightarrow> (P x \<longleftrightarrow> P1)" and p1: P1 shows "\<exists> x. P x"
   1.406 -proof-
   1.407 -  from ex obtain z where z: "\<forall>x. x \<sqsubset> z \<longrightarrow> (P x \<longleftrightarrow> P1)" by blast
   1.408 -  from lt_ex obtain x where x: "x \<sqsubset> z" by blast
   1.409 -  from z x p1 show ?thesis by blast
   1.410 -qed
   1.411 -
   1.412 -end
   1.413 -
   1.414 -
   1.415 -locale constr_dense_linear_order = linorder_no_lb + linorder_no_ub +
   1.416 -  fixes between
   1.417 -  assumes between_less: "less x y \<Longrightarrow> less x (between x y) \<and> less (between x y) y"
   1.418 -     and  between_same: "between x x = x"
   1.419 -
   1.420 -sublocale  constr_dense_linear_order < dense_linear_order 
   1.421 -  apply unfold_locales
   1.422 -  using gt_ex lt_ex between_less
   1.423 -    by (auto, rule_tac x="between x y" in exI, simp)
   1.424 -
   1.425 -context  constr_dense_linear_order
   1.426 -begin
   1.427 -
   1.428 -lemma rinf_U:
   1.429 -  assumes fU: "finite U"
   1.430 -  and lin_dense: "\<forall>x l u. (\<forall> t. l \<sqsubset> t \<and> t\<sqsubset> u \<longrightarrow> t \<notin> U) \<and> l\<sqsubset> x \<and> x \<sqsubset> u \<and> P x
   1.431 -  \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> P y )"
   1.432 -  and nmpiU: "\<forall>x. \<not> MP \<and> \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. \<exists> u' \<in> U. u \<sqsubseteq> x \<and> x \<sqsubseteq> u')"
   1.433 -  and nmi: "\<not> MP"  and npi: "\<not> PP"  and ex: "\<exists> x.  P x"
   1.434 -  shows "\<exists> u\<in> U. \<exists> u' \<in> U. P (between u u')"
   1.435 -proof-
   1.436 -  from ex obtain x where px: "P x" by blast
   1.437 -  from px nmi npi nmpiU have "\<exists> u\<in> U. \<exists> u' \<in> U. u \<sqsubseteq> x \<and> x \<sqsubseteq> u'" by auto
   1.438 -  then obtain u and u' where uU:"u\<in> U" and uU': "u' \<in> U" and ux:"u \<sqsubseteq> x" and xu':"x \<sqsubseteq> u'" by auto
   1.439 -  from uU have Une: "U \<noteq> {}" by auto
   1.440 -  term "linorder.Min less_eq"
   1.441 -  let ?l = "linorder.Min less_eq U"
   1.442 -  let ?u = "linorder.Max less_eq U"
   1.443 -  have linM: "?l \<in> U" using fU Une by simp
   1.444 -  have uinM: "?u \<in> U" using fU Une by simp
   1.445 -  have lM: "\<forall> t\<in> U. ?l \<sqsubseteq> t" using Une fU by auto
   1.446 -  have Mu: "\<forall> t\<in> U. t \<sqsubseteq> ?u" using Une fU by auto
   1.447 -  have th:"?l \<sqsubseteq> u" using uU Une lM by auto
   1.448 -  from order_trans[OF th ux] have lx: "?l \<sqsubseteq> x" .
   1.449 -  have th: "u' \<sqsubseteq> ?u" using uU' Une Mu by simp
   1.450 -  from order_trans[OF xu' th] have xu: "x \<sqsubseteq> ?u" .
   1.451 -  from finite_set_intervals2[where P="P",OF px lx xu linM uinM fU lM Mu]
   1.452 -  have "(\<exists> s\<in> U. P s) \<or>
   1.453 -      (\<exists> t1\<in> U. \<exists> t2 \<in> U. (\<forall> y. t1 \<sqsubset> y \<and> y \<sqsubset> t2 \<longrightarrow> y \<notin> U) \<and> t1 \<sqsubset> x \<and> x \<sqsubset> t2 \<and> P x)" .
   1.454 -  moreover { fix u assume um: "u\<in>U" and pu: "P u"
   1.455 -    have "between u u = u" by (simp add: between_same)
   1.456 -    with um pu have "P (between u u)" by simp
   1.457 -    with um have ?thesis by blast}
   1.458 -  moreover{
   1.459 -    assume "\<exists> t1\<in> U. \<exists> t2 \<in> U. (\<forall> y. t1 \<sqsubset> y \<and> y \<sqsubset> t2 \<longrightarrow> y \<notin> U) \<and> t1 \<sqsubset> x \<and> x \<sqsubset> t2 \<and> P x"
   1.460 -      then obtain t1 and t2 where t1M: "t1 \<in> U" and t2M: "t2\<in> U"
   1.461 -        and noM: "\<forall> y. t1 \<sqsubset> y \<and> y \<sqsubset> t2 \<longrightarrow> y \<notin> U" and t1x: "t1 \<sqsubset> x" and xt2: "x \<sqsubset> t2" and px: "P x"
   1.462 -        by blast
   1.463 -      from less_trans[OF t1x xt2] have t1t2: "t1 \<sqsubset> t2" .
   1.464 -      let ?u = "between t1 t2"
   1.465 -      from between_less t1t2 have t1lu: "t1 \<sqsubset> ?u" and ut2: "?u \<sqsubset> t2" by auto
   1.466 -      from lin_dense noM t1x xt2 px t1lu ut2 have "P ?u" by blast
   1.467 -      with t1M t2M have ?thesis by blast}
   1.468 -    ultimately show ?thesis by blast
   1.469 -  qed
   1.470 -
   1.471 -theorem fr_eq:
   1.472 -  assumes fU: "finite U"
   1.473 -  and lin_dense: "\<forall>x l u. (\<forall> t. l \<sqsubset> t \<and> t\<sqsubset> u \<longrightarrow> t \<notin> U) \<and> l\<sqsubset> x \<and> x \<sqsubset> u \<and> P x
   1.474 -   \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> P y )"
   1.475 -  and nmibnd: "\<forall>x. \<not> MP \<and> P x \<longrightarrow> (\<exists> u\<in> U. u \<sqsubseteq> x)"
   1.476 -  and npibnd: "\<forall>x. \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. x \<sqsubseteq> u)"
   1.477 -  and mi: "\<exists>z. \<forall>x. x \<sqsubset> z \<longrightarrow> (P x = MP)"  and pi: "\<exists>z. \<forall>x. z \<sqsubset> x \<longrightarrow> (P x = PP)"
   1.478 -  shows "(\<exists> x. P x) \<equiv> (MP \<or> PP \<or> (\<exists> u \<in> U. \<exists> u'\<in> U. P (between u u')))"
   1.479 -  (is "_ \<equiv> (_ \<or> _ \<or> ?F)" is "?E \<equiv> ?D")
   1.480 -proof-
   1.481 - {
   1.482 -   assume px: "\<exists> x. P x"
   1.483 -   have "MP \<or> PP \<or> (\<not> MP \<and> \<not> PP)" by blast
   1.484 -   moreover {assume "MP \<or> PP" hence "?D" by blast}
   1.485 -   moreover {assume nmi: "\<not> MP" and npi: "\<not> PP"
   1.486 -     from npmibnd[OF nmibnd npibnd]
   1.487 -     have nmpiU: "\<forall>x. \<not> MP \<and> \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. \<exists> u' \<in> U. u \<sqsubseteq> x \<and> x \<sqsubseteq> u')" .
   1.488 -     from rinf_U[OF fU lin_dense nmpiU nmi npi px] have "?D" by blast}
   1.489 -   ultimately have "?D" by blast}
   1.490 - moreover
   1.491 - { assume "?D"
   1.492 -   moreover {assume m:"MP" from minf_ex[OF mi m] have "?E" .}
   1.493 -   moreover {assume p: "PP" from pinf_ex[OF pi p] have "?E" . }
   1.494 -   moreover {assume f:"?F" hence "?E" by blast}
   1.495 -   ultimately have "?E" by blast}
   1.496 - ultimately have "?E = ?D" by blast thus "?E \<equiv> ?D" by simp
   1.497 -qed
   1.498 -
   1.499 -lemmas minf_thms = minf_conj minf_disj minf_eq minf_neq minf_lt minf_le minf_gt minf_ge minf_P
   1.500 -lemmas pinf_thms = pinf_conj pinf_disj pinf_eq pinf_neq pinf_lt pinf_le pinf_gt pinf_ge pinf_P
   1.501 -
   1.502 -lemmas nmi_thms = nmi_conj nmi_disj nmi_eq nmi_neq nmi_lt nmi_le nmi_gt nmi_ge nmi_P
   1.503 -lemmas npi_thms = npi_conj npi_disj npi_eq npi_neq npi_lt npi_le npi_gt npi_ge npi_P
   1.504 -lemmas lin_dense_thms = lin_dense_conj lin_dense_disj lin_dense_eq lin_dense_neq lin_dense_lt lin_dense_le lin_dense_gt lin_dense_ge lin_dense_P
   1.505 -
   1.506 -lemma ferrack_axiom: "constr_dense_linear_order less_eq less between"
   1.507 -  by (rule constr_dense_linear_order_axioms)
   1.508 -lemma atoms:
   1.509 -  shows "TERM (less :: 'a \<Rightarrow> _)"
   1.510 -    and "TERM (less_eq :: 'a \<Rightarrow> _)"
   1.511 -    and "TERM (op = :: 'a \<Rightarrow> _)" .
   1.512 -
   1.513 -declare ferrack_axiom [ferrack minf: minf_thms pinf: pinf_thms
   1.514 -    nmi: nmi_thms npi: npi_thms lindense:
   1.515 -    lin_dense_thms qe: fr_eq atoms: atoms]
   1.516 -
   1.517 -declaration {*
   1.518 -let
   1.519 -fun simps phi = map (Morphism.thm phi) [@{thm "not_less"}, @{thm "not_le"}]
   1.520 -fun generic_whatis phi =
   1.521 - let
   1.522 -  val [lt, le] = map (Morphism.term phi) [@{term "op \<sqsubset>"}, @{term "op \<sqsubseteq>"}]
   1.523 -  fun h x t =
   1.524 -   case term_of t of
   1.525 -     Const("op =", _)$y$z => if term_of x aconv y then Ferrante_Rackoff_Data.Eq
   1.526 -                            else Ferrante_Rackoff_Data.Nox
   1.527 -   | @{term "Not"}$(Const("op =", _)$y$z) => if term_of x aconv y then Ferrante_Rackoff_Data.NEq
   1.528 -                            else Ferrante_Rackoff_Data.Nox
   1.529 -   | b$y$z => if Term.could_unify (b, lt) then
   1.530 -                 if term_of x aconv y then Ferrante_Rackoff_Data.Lt
   1.531 -                 else if term_of x aconv z then Ferrante_Rackoff_Data.Gt
   1.532 -                 else Ferrante_Rackoff_Data.Nox
   1.533 -             else if Term.could_unify (b, le) then
   1.534 -                 if term_of x aconv y then Ferrante_Rackoff_Data.Le
   1.535 -                 else if term_of x aconv z then Ferrante_Rackoff_Data.Ge
   1.536 -                 else Ferrante_Rackoff_Data.Nox
   1.537 -             else Ferrante_Rackoff_Data.Nox
   1.538 -   | _ => Ferrante_Rackoff_Data.Nox
   1.539 - in h end
   1.540 - fun ss phi = HOL_ss addsimps (simps phi)
   1.541 -in
   1.542 - Ferrante_Rackoff_Data.funs  @{thm "ferrack_axiom"}
   1.543 -  {isolate_conv = K (K (K Thm.reflexive)), whatis = generic_whatis, simpset = ss}
   1.544 -end
   1.545 -*}
   1.546 -
   1.547 -end
   1.548 -
   1.549 -use "~~/src/HOL/Tools/Qelim/ferrante_rackoff.ML"
   1.550 -
   1.551 -method_setup ferrack = {*
   1.552 -  Method.ctxt_args (Method.SIMPLE_METHOD' o FerranteRackoff.dlo_tac)
   1.553 -*} "Ferrante and Rackoff's algorithm for quantifier elimination in dense linear orders"
   1.554 -
   1.555 -subsection {* Ferrante and Rackoff algorithm over ordered fields *}
   1.556 -
   1.557 -lemma neg_prod_lt:"(c\<Colon>'a\<Colon>ordered_field) < 0 \<Longrightarrow> ((c*x < 0) == (x > 0))"
   1.558 -proof-
   1.559 -  assume H: "c < 0"
   1.560 -  have "c*x < 0 = (0/c < x)" by (simp only: neg_divide_less_eq[OF H] algebra_simps)
   1.561 -  also have "\<dots> = (0 < x)" by simp
   1.562 -  finally show  "(c*x < 0) == (x > 0)" by simp
   1.563 -qed
   1.564 -
   1.565 -lemma pos_prod_lt:"(c\<Colon>'a\<Colon>ordered_field) > 0 \<Longrightarrow> ((c*x < 0) == (x < 0))"
   1.566 -proof-
   1.567 -  assume H: "c > 0"
   1.568 -  hence "c*x < 0 = (0/c > x)" by (simp only: pos_less_divide_eq[OF H] algebra_simps)
   1.569 -  also have "\<dots> = (0 > x)" by simp
   1.570 -  finally show  "(c*x < 0) == (x < 0)" by simp
   1.571 -qed
   1.572 -
   1.573 -lemma neg_prod_sum_lt: "(c\<Colon>'a\<Colon>ordered_field) < 0 \<Longrightarrow> ((c*x + t< 0) == (x > (- 1/c)*t))"
   1.574 -proof-
   1.575 -  assume H: "c < 0"
   1.576 -  have "c*x + t< 0 = (c*x < -t)" by (subst less_iff_diff_less_0 [of "c*x" "-t"], simp)
   1.577 -  also have "\<dots> = (-t/c < x)" by (simp only: neg_divide_less_eq[OF H] algebra_simps)
   1.578 -  also have "\<dots> = ((- 1/c)*t < x)" by simp
   1.579 -  finally show  "(c*x + t < 0) == (x > (- 1/c)*t)" by simp
   1.580 -qed
   1.581 -
   1.582 -lemma pos_prod_sum_lt:"(c\<Colon>'a\<Colon>ordered_field) > 0 \<Longrightarrow> ((c*x + t < 0) == (x < (- 1/c)*t))"
   1.583 -proof-
   1.584 -  assume H: "c > 0"
   1.585 -  have "c*x + t< 0 = (c*x < -t)"  by (subst less_iff_diff_less_0 [of "c*x" "-t"], simp)
   1.586 -  also have "\<dots> = (-t/c > x)" by (simp only: pos_less_divide_eq[OF H] algebra_simps)
   1.587 -  also have "\<dots> = ((- 1/c)*t > x)" by simp
   1.588 -  finally show  "(c*x + t < 0) == (x < (- 1/c)*t)" by simp
   1.589 -qed
   1.590 -
   1.591 -lemma sum_lt:"((x::'a::pordered_ab_group_add) + t < 0) == (x < - t)"
   1.592 -  using less_diff_eq[where a= x and b=t and c=0] by simp
   1.593 -
   1.594 -lemma neg_prod_le:"(c\<Colon>'a\<Colon>ordered_field) < 0 \<Longrightarrow> ((c*x <= 0) == (x >= 0))"
   1.595 -proof-
   1.596 -  assume H: "c < 0"
   1.597 -  have "c*x <= 0 = (0/c <= x)" by (simp only: neg_divide_le_eq[OF H] algebra_simps)
   1.598 -  also have "\<dots> = (0 <= x)" by simp
   1.599 -  finally show  "(c*x <= 0) == (x >= 0)" by simp
   1.600 -qed
   1.601 -
   1.602 -lemma pos_prod_le:"(c\<Colon>'a\<Colon>ordered_field) > 0 \<Longrightarrow> ((c*x <= 0) == (x <= 0))"
   1.603 -proof-
   1.604 -  assume H: "c > 0"
   1.605 -  hence "c*x <= 0 = (0/c >= x)" by (simp only: pos_le_divide_eq[OF H] algebra_simps)
   1.606 -  also have "\<dots> = (0 >= x)" by simp
   1.607 -  finally show  "(c*x <= 0) == (x <= 0)" by simp
   1.608 -qed
   1.609 -
   1.610 -lemma neg_prod_sum_le: "(c\<Colon>'a\<Colon>ordered_field) < 0 \<Longrightarrow> ((c*x + t <= 0) == (x >= (- 1/c)*t))"
   1.611 -proof-
   1.612 -  assume H: "c < 0"
   1.613 -  have "c*x + t <= 0 = (c*x <= -t)"  by (subst le_iff_diff_le_0 [of "c*x" "-t"], simp)
   1.614 -  also have "\<dots> = (-t/c <= x)" by (simp only: neg_divide_le_eq[OF H] algebra_simps)
   1.615 -  also have "\<dots> = ((- 1/c)*t <= x)" by simp
   1.616 -  finally show  "(c*x + t <= 0) == (x >= (- 1/c)*t)" by simp
   1.617 -qed
   1.618 -
   1.619 -lemma pos_prod_sum_le:"(c\<Colon>'a\<Colon>ordered_field) > 0 \<Longrightarrow> ((c*x + t <= 0) == (x <= (- 1/c)*t))"
   1.620 -proof-
   1.621 -  assume H: "c > 0"
   1.622 -  have "c*x + t <= 0 = (c*x <= -t)" by (subst le_iff_diff_le_0 [of "c*x" "-t"], simp)
   1.623 -  also have "\<dots> = (-t/c >= x)" by (simp only: pos_le_divide_eq[OF H] algebra_simps)
   1.624 -  also have "\<dots> = ((- 1/c)*t >= x)" by simp
   1.625 -  finally show  "(c*x + t <= 0) == (x <= (- 1/c)*t)" by simp
   1.626 -qed
   1.627 -
   1.628 -lemma sum_le:"((x::'a::pordered_ab_group_add) + t <= 0) == (x <= - t)"
   1.629 -  using le_diff_eq[where a= x and b=t and c=0] by simp
   1.630 -
   1.631 -lemma nz_prod_eq:"(c\<Colon>'a\<Colon>ordered_field) \<noteq> 0 \<Longrightarrow> ((c*x = 0) == (x = 0))" by simp
   1.632 -lemma nz_prod_sum_eq: "(c\<Colon>'a\<Colon>ordered_field) \<noteq> 0 \<Longrightarrow> ((c*x + t = 0) == (x = (- 1/c)*t))"
   1.633 -proof-
   1.634 -  assume H: "c \<noteq> 0"
   1.635 -  have "c*x + t = 0 = (c*x = -t)" by (subst eq_iff_diff_eq_0 [of "c*x" "-t"], simp)
   1.636 -  also have "\<dots> = (x = -t/c)" by (simp only: nonzero_eq_divide_eq[OF H] algebra_simps)
   1.637 -  finally show  "(c*x + t = 0) == (x = (- 1/c)*t)" by simp
   1.638 -qed
   1.639 -lemma sum_eq:"((x::'a::pordered_ab_group_add) + t = 0) == (x = - t)"
   1.640 -  using eq_diff_eq[where a= x and b=t and c=0] by simp
   1.641 -
   1.642 -
   1.643 -interpretation class_ordered_field_dense_linear_order!: constr_dense_linear_order
   1.644 - "op <=" "op <"
   1.645 -   "\<lambda> x y. 1/2 * ((x::'a::{ordered_field,recpower,number_ring}) + y)"
   1.646 -proof (unfold_locales, dlo, dlo, auto)
   1.647 -  fix x y::'a assume lt: "x < y"
   1.648 -  from  less_half_sum[OF lt] show "x < (x + y) /2" by simp
   1.649 -next
   1.650 -  fix x y::'a assume lt: "x < y"
   1.651 -  from  gt_half_sum[OF lt] show "(x + y) /2 < y" by simp
   1.652 -qed
   1.653 -
   1.654 -declaration{*
   1.655 -let
   1.656 -fun earlier [] x y = false
   1.657 -        | earlier (h::t) x y =
   1.658 -    if h aconvc y then false else if h aconvc x then true else earlier t x y;
   1.659 -
   1.660 -fun dest_frac ct = case term_of ct of
   1.661 -   Const (@{const_name "HOL.divide"},_) $ a $ b=>
   1.662 -    Rat.rat_of_quotient (snd (HOLogic.dest_number a), snd (HOLogic.dest_number b))
   1.663 - | t => Rat.rat_of_int (snd (HOLogic.dest_number t))
   1.664 -
   1.665 -fun mk_frac phi cT x =
   1.666 - let val (a, b) = Rat.quotient_of_rat x
   1.667 - in if b = 1 then Numeral.mk_cnumber cT a
   1.668 -    else Thm.capply
   1.669 -         (Thm.capply (Drule.cterm_rule (instantiate' [SOME cT] []) @{cpat "op /"})
   1.670 -                     (Numeral.mk_cnumber cT a))
   1.671 -         (Numeral.mk_cnumber cT b)
   1.672 - end
   1.673 -
   1.674 -fun whatis x ct = case term_of ct of
   1.675 -  Const(@{const_name "HOL.plus"}, _)$(Const(@{const_name "HOL.times"},_)$_$y)$_ =>
   1.676 -     if y aconv term_of x then ("c*x+t",[(funpow 2 Thm.dest_arg1) ct, Thm.dest_arg ct])
   1.677 -     else ("Nox",[])
   1.678 -| Const(@{const_name "HOL.plus"}, _)$y$_ =>
   1.679 -     if y aconv term_of x then ("x+t",[Thm.dest_arg ct])
   1.680 -     else ("Nox",[])
   1.681 -| Const(@{const_name "HOL.times"}, _)$_$y =>
   1.682 -     if y aconv term_of x then ("c*x",[Thm.dest_arg1 ct])
   1.683 -     else ("Nox",[])
   1.684 -| t => if t aconv term_of x then ("x",[]) else ("Nox",[]);
   1.685 -
   1.686 -fun xnormalize_conv ctxt [] ct = reflexive ct
   1.687 -| xnormalize_conv ctxt (vs as (x::_)) ct =
   1.688 -   case term_of ct of
   1.689 -   Const(@{const_name HOL.less},_)$_$Const(@{const_name "HOL.zero"},_) =>
   1.690 -    (case whatis x (Thm.dest_arg1 ct) of
   1.691 -    ("c*x+t",[c,t]) =>
   1.692 -       let
   1.693 -        val cr = dest_frac c
   1.694 -        val clt = Thm.dest_fun2 ct
   1.695 -        val cz = Thm.dest_arg ct
   1.696 -        val neg = cr </ Rat.zero
   1.697 -        val cthp = Simplifier.rewrite (local_simpset_of ctxt)
   1.698 -               (Thm.capply @{cterm "Trueprop"}
   1.699 -                  (if neg then Thm.capply (Thm.capply clt c) cz
   1.700 -                    else Thm.capply (Thm.capply clt cz) c))
   1.701 -        val cth = equal_elim (symmetric cthp) TrueI
   1.702 -        val th = implies_elim (instantiate' [SOME (ctyp_of_term x)] (map SOME [c,x,t])
   1.703 -             (if neg then @{thm neg_prod_sum_lt} else @{thm pos_prod_sum_lt})) cth
   1.704 -        val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   1.705 -                   (Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   1.706 -      in rth end
   1.707 -    | ("x+t",[t]) =>
   1.708 -       let
   1.709 -        val T = ctyp_of_term x
   1.710 -        val th = instantiate' [SOME T] [SOME x, SOME t] @{thm "sum_lt"}
   1.711 -        val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   1.712 -              (Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   1.713 -       in  rth end
   1.714 -    | ("c*x",[c]) =>
   1.715 -       let
   1.716 -        val cr = dest_frac c
   1.717 -        val clt = Thm.dest_fun2 ct
   1.718 -        val cz = Thm.dest_arg ct
   1.719 -        val neg = cr </ Rat.zero
   1.720 -        val cthp = Simplifier.rewrite (local_simpset_of ctxt)
   1.721 -               (Thm.capply @{cterm "Trueprop"}
   1.722 -                  (if neg then Thm.capply (Thm.capply clt c) cz
   1.723 -                    else Thm.capply (Thm.capply clt cz) c))
   1.724 -        val cth = equal_elim (symmetric cthp) TrueI
   1.725 -        val th = implies_elim (instantiate' [SOME (ctyp_of_term x)] (map SOME [c,x])
   1.726 -             (if neg then @{thm neg_prod_lt} else @{thm pos_prod_lt})) cth
   1.727 -        val rth = th
   1.728 -      in rth end
   1.729 -    | _ => reflexive ct)
   1.730 -
   1.731 -
   1.732 -|  Const(@{const_name HOL.less_eq},_)$_$Const(@{const_name "HOL.zero"},_) =>
   1.733 -   (case whatis x (Thm.dest_arg1 ct) of
   1.734 -    ("c*x+t",[c,t]) =>
   1.735 -       let
   1.736 -        val T = ctyp_of_term x
   1.737 -        val cr = dest_frac c
   1.738 -        val clt = Drule.cterm_rule (instantiate' [SOME T] []) @{cpat "op <"}
   1.739 -        val cz = Thm.dest_arg ct
   1.740 -        val neg = cr </ Rat.zero
   1.741 -        val cthp = Simplifier.rewrite (local_simpset_of ctxt)
   1.742 -               (Thm.capply @{cterm "Trueprop"}
   1.743 -                  (if neg then Thm.capply (Thm.capply clt c) cz
   1.744 -                    else Thm.capply (Thm.capply clt cz) c))
   1.745 -        val cth = equal_elim (symmetric cthp) TrueI
   1.746 -        val th = implies_elim (instantiate' [SOME T] (map SOME [c,x,t])
   1.747 -             (if neg then @{thm neg_prod_sum_le} else @{thm pos_prod_sum_le})) cth
   1.748 -        val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   1.749 -                   (Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   1.750 -      in rth end
   1.751 -    | ("x+t",[t]) =>
   1.752 -       let
   1.753 -        val T = ctyp_of_term x
   1.754 -        val th = instantiate' [SOME T] [SOME x, SOME t] @{thm "sum_le"}
   1.755 -        val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   1.756 -              (Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   1.757 -       in  rth end
   1.758 -    | ("c*x",[c]) =>
   1.759 -       let
   1.760 -        val T = ctyp_of_term x
   1.761 -        val cr = dest_frac c
   1.762 -        val clt = Drule.cterm_rule (instantiate' [SOME T] []) @{cpat "op <"}
   1.763 -        val cz = Thm.dest_arg ct
   1.764 -        val neg = cr </ Rat.zero
   1.765 -        val cthp = Simplifier.rewrite (local_simpset_of ctxt)
   1.766 -               (Thm.capply @{cterm "Trueprop"}
   1.767 -                  (if neg then Thm.capply (Thm.capply clt c) cz
   1.768 -                    else Thm.capply (Thm.capply clt cz) c))
   1.769 -        val cth = equal_elim (symmetric cthp) TrueI
   1.770 -        val th = implies_elim (instantiate' [SOME (ctyp_of_term x)] (map SOME [c,x])
   1.771 -             (if neg then @{thm neg_prod_le} else @{thm pos_prod_le})) cth
   1.772 -        val rth = th
   1.773 -      in rth end
   1.774 -    | _ => reflexive ct)
   1.775 -
   1.776 -|  Const("op =",_)$_$Const(@{const_name "HOL.zero"},_) =>
   1.777 -   (case whatis x (Thm.dest_arg1 ct) of
   1.778 -    ("c*x+t",[c,t]) =>
   1.779 -       let
   1.780 -        val T = ctyp_of_term x
   1.781 -        val cr = dest_frac c
   1.782 -        val ceq = Thm.dest_fun2 ct
   1.783 -        val cz = Thm.dest_arg ct
   1.784 -        val cthp = Simplifier.rewrite (local_simpset_of ctxt)
   1.785 -            (Thm.capply @{cterm "Trueprop"}
   1.786 -             (Thm.capply @{cterm "Not"} (Thm.capply (Thm.capply ceq c) cz)))
   1.787 -        val cth = equal_elim (symmetric cthp) TrueI
   1.788 -        val th = implies_elim
   1.789 -                 (instantiate' [SOME T] (map SOME [c,x,t]) @{thm nz_prod_sum_eq}) cth
   1.790 -        val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   1.791 -                   (Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   1.792 -      in rth end
   1.793 -    | ("x+t",[t]) =>
   1.794 -       let
   1.795 -        val T = ctyp_of_term x
   1.796 -        val th = instantiate' [SOME T] [SOME x, SOME t] @{thm "sum_eq"}
   1.797 -        val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   1.798 -              (Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   1.799 -       in  rth end
   1.800 -    | ("c*x",[c]) =>
   1.801 -       let
   1.802 -        val T = ctyp_of_term x
   1.803 -        val cr = dest_frac c
   1.804 -        val ceq = Thm.dest_fun2 ct
   1.805 -        val cz = Thm.dest_arg ct
   1.806 -        val cthp = Simplifier.rewrite (local_simpset_of ctxt)
   1.807 -            (Thm.capply @{cterm "Trueprop"}
   1.808 -             (Thm.capply @{cterm "Not"} (Thm.capply (Thm.capply ceq c) cz)))
   1.809 -        val cth = equal_elim (symmetric cthp) TrueI
   1.810 -        val rth = implies_elim
   1.811 -                 (instantiate' [SOME T] (map SOME [c,x]) @{thm nz_prod_eq}) cth
   1.812 -      in rth end
   1.813 -    | _ => reflexive ct);
   1.814 -
   1.815 -local
   1.816 -  val less_iff_diff_less_0 = mk_meta_eq @{thm "less_iff_diff_less_0"}
   1.817 -  val le_iff_diff_le_0 = mk_meta_eq @{thm "le_iff_diff_le_0"}
   1.818 -  val eq_iff_diff_eq_0 = mk_meta_eq @{thm "eq_iff_diff_eq_0"}
   1.819 -in
   1.820 -fun field_isolate_conv phi ctxt vs ct = case term_of ct of
   1.821 -  Const(@{const_name HOL.less},_)$a$b =>
   1.822 -   let val (ca,cb) = Thm.dest_binop ct
   1.823 -       val T = ctyp_of_term ca
   1.824 -       val th = instantiate' [SOME T] [SOME ca, SOME cb] less_iff_diff_less_0
   1.825 -       val nth = Conv.fconv_rule
   1.826 -         (Conv.arg_conv (Conv.arg1_conv
   1.827 -              (Normalizer.semiring_normalize_ord_conv @{context} (earlier vs)))) th
   1.828 -       val rth = transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   1.829 -   in rth end
   1.830 -| Const(@{const_name HOL.less_eq},_)$a$b =>
   1.831 -   let val (ca,cb) = Thm.dest_binop ct
   1.832 -       val T = ctyp_of_term ca
   1.833 -       val th = instantiate' [SOME T] [SOME ca, SOME cb] le_iff_diff_le_0
   1.834 -       val nth = Conv.fconv_rule
   1.835 -         (Conv.arg_conv (Conv.arg1_conv
   1.836 -              (Normalizer.semiring_normalize_ord_conv @{context} (earlier vs)))) th
   1.837 -       val rth = transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   1.838 -   in rth end
   1.839 -
   1.840 -| Const("op =",_)$a$b =>
   1.841 -   let val (ca,cb) = Thm.dest_binop ct
   1.842 -       val T = ctyp_of_term ca
   1.843 -       val th = instantiate' [SOME T] [SOME ca, SOME cb] eq_iff_diff_eq_0
   1.844 -       val nth = Conv.fconv_rule
   1.845 -         (Conv.arg_conv (Conv.arg1_conv
   1.846 -              (Normalizer.semiring_normalize_ord_conv @{context} (earlier vs)))) th
   1.847 -       val rth = transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   1.848 -   in rth end
   1.849 -| @{term "Not"} $(Const("op =",_)$a$b) => Conv.arg_conv (field_isolate_conv phi ctxt vs) ct
   1.850 -| _ => reflexive ct
   1.851 -end;
   1.852 -
   1.853 -fun classfield_whatis phi =
   1.854 - let
   1.855 -  fun h x t =
   1.856 -   case term_of t of
   1.857 -     Const("op =", _)$y$z => if term_of x aconv y then Ferrante_Rackoff_Data.Eq
   1.858 -                            else Ferrante_Rackoff_Data.Nox
   1.859 -   | @{term "Not"}$(Const("op =", _)$y$z) => if term_of x aconv y then Ferrante_Rackoff_Data.NEq
   1.860 -                            else Ferrante_Rackoff_Data.Nox
   1.861 -   | Const(@{const_name HOL.less},_)$y$z =>
   1.862 -       if term_of x aconv y then Ferrante_Rackoff_Data.Lt
   1.863 -        else if term_of x aconv z then Ferrante_Rackoff_Data.Gt
   1.864 -        else Ferrante_Rackoff_Data.Nox
   1.865 -   | Const (@{const_name HOL.less_eq},_)$y$z =>
   1.866 -         if term_of x aconv y then Ferrante_Rackoff_Data.Le
   1.867 -         else if term_of x aconv z then Ferrante_Rackoff_Data.Ge
   1.868 -         else Ferrante_Rackoff_Data.Nox
   1.869 -   | _ => Ferrante_Rackoff_Data.Nox
   1.870 - in h end;
   1.871 -fun class_field_ss phi =
   1.872 -   HOL_basic_ss addsimps ([@{thm "linorder_not_less"}, @{thm "linorder_not_le"}])
   1.873 -   addsplits [@{thm "abs_split"},@{thm "split_max"}, @{thm "split_min"}]
   1.874 -
   1.875 -in
   1.876 -Ferrante_Rackoff_Data.funs @{thm "class_ordered_field_dense_linear_order.ferrack_axiom"}
   1.877 -  {isolate_conv = field_isolate_conv, whatis = classfield_whatis, simpset = class_field_ss}
   1.878 -end
   1.879 -*}
   1.880 -
   1.881 -
   1.882 -end 
     2.1 --- a/src/HOL/IsaMakefile	Fri Feb 06 00:10:58 2009 +0000
     2.2 +++ b/src/HOL/IsaMakefile	Fri Feb 06 00:13:15 2009 +0000
     2.3 @@ -284,7 +284,6 @@
     2.4    Series.thy \
     2.5    Taylor.thy \
     2.6    Transcendental.thy \
     2.7 -  Dense_Linear_Order.thy \
     2.8    GCD.thy \
     2.9    Order_Relation.thy \
    2.10    Parity.thy \
    2.11 @@ -316,7 +315,7 @@
    2.12    Library/Abstract_Rat.thy \
    2.13    Library/BigO.thy Library/ContNotDenum.thy Library/Efficient_Nat.thy	\
    2.14    Library/Executable_Set.thy Library/Infinite_Set.thy			\
    2.15 -  Library/FuncSet.thy			\
    2.16 +  Library/FuncSet.thy Library/Dense_Linear_Order.thy 	\
    2.17    Library/Library.thy Library/List_Prefix.thy Library/State_Monad.thy	\
    2.18    Library/Multiset.thy Library/Permutation.thy	\
    2.19    Library/Primes.thy Library/Pocklington.thy Library/Quotient.thy	\