src/HOL/Dense_Linear_Order.thy
author haftmann
Tue, 16 Oct 2007 23:12:45 +0200
changeset 25062 af5ef0d4d655
parent 24914 95cda5dd58d5
child 25106 ff8fee9e752c
permissions -rw-r--r--
global class syntax
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
     1
(*
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
     3
    Author:     Amine Chaieb, TU Muenchen
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
     4
*)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
     5
23470
e28b41e8b7d4 spelling
huffman
parents: 23466
diff changeset
     6
header {* Dense linear order without endpoints
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
     7
  and a quantifier elimination procedure in Ferrante and Rackoff style *}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
     8
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
     9
theory Dense_Linear_Order
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    10
imports Finite_Set
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    11
uses
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents: 23453
diff changeset
    12
  "Tools/Qelim/qelim.ML"
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
    13
  "Tools/Qelim/langford_data.ML"
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents: 23453
diff changeset
    14
  "Tools/Qelim/ferrante_rackoff_data.ML"
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
    15
  ("Tools/Qelim/langford.ML")
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents: 23453
diff changeset
    16
  ("Tools/Qelim/ferrante_rackoff.ML")
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    17
begin
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    18
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
    19
setup Langford_Data.setup
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    20
setup Ferrante_Rackoff_Data.setup
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    21
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
    22
context linorder
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
    23
begin
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
    24
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    25
lemma less_not_permute: "\<not> (x < y \<and> y < x)" by (simp add: not_less linear)
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
    26
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
    27
lemma gather_simps: 
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
    28
  shows 
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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)"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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)"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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))"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
    33
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
    34
lemma 
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    35
  gather_start: "(\<exists>x. P x) \<equiv> (\<exists>x. (\<forall>y \<in> {}. y < x) \<and> (\<forall>y\<in> {}. x < y) \<and> P x)" 
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
    36
  by simp
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
    37
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    38
text{* Theorems for @{text "\<exists>z. \<forall>x. x < z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>-\<infinity>\<^esub>)"}*}
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    39
lemma minf_lt:  "\<exists>z . \<forall>x. x < z \<longrightarrow> (x < t \<longleftrightarrow> True)" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    40
lemma minf_gt: "\<exists>z . \<forall>x. x < z \<longrightarrow>  (t < x \<longleftrightarrow>  False)"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    41
  by (simp add: not_less) (rule exI[where x="t"], auto simp add: less_le)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    42
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    43
lemma minf_le: "\<exists>z. \<forall>x. x < z \<longrightarrow> (x \<le> t \<longleftrightarrow> True)" by (auto simp add: less_le)
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    44
lemma minf_ge: "\<exists>z. \<forall>x. x < z \<longrightarrow> (t \<le> x \<longleftrightarrow> False)"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    45
  by (auto simp add: less_le not_less not_le)
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    46
lemma minf_eq: "\<exists>z. \<forall>x. x < z \<longrightarrow> (x = t \<longleftrightarrow> False)" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    47
lemma minf_neq: "\<exists>z. \<forall>x. x < z \<longrightarrow> (x \<noteq> t \<longleftrightarrow> True)" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    48
lemma minf_P: "\<exists>z. \<forall>x. x < z \<longrightarrow> (P \<longleftrightarrow> P)" by blast
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    49
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    50
text{* Theorems for @{text "\<exists>z. \<forall>x. x < z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>+\<infinity>\<^esub>)"}*}
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    51
lemma pinf_gt:  "\<exists>z . \<forall>x. z < x \<longrightarrow> (t < x \<longleftrightarrow> True)" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    52
lemma pinf_lt: "\<exists>z . \<forall>x. z < x \<longrightarrow>  (x < t \<longleftrightarrow>  False)"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    53
  by (simp add: not_less) (rule exI[where x="t"], auto simp add: less_le)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    54
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    55
lemma pinf_ge: "\<exists>z. \<forall>x. z < x \<longrightarrow> (t \<le> x \<longleftrightarrow> True)" by (auto simp add: less_le)
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    56
lemma pinf_le: "\<exists>z. \<forall>x. z < x \<longrightarrow> (x \<le> t \<longleftrightarrow> False)"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    57
  by (auto simp add: less_le not_less not_le)
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    58
lemma pinf_eq: "\<exists>z. \<forall>x. z < x \<longrightarrow> (x = t \<longleftrightarrow> False)" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    59
lemma pinf_neq: "\<exists>z. \<forall>x. z < x \<longrightarrow> (x \<noteq> t \<longleftrightarrow> True)" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    60
lemma pinf_P: "\<exists>z. \<forall>x. z < x \<longrightarrow> (P \<longleftrightarrow> P)" by blast
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    61
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    63
lemma nmi_gt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and> t < x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    64
  by (auto simp add: le_less)
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    69
lemma  nmi_P: "\<forall> x. ~P \<and> P \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    70
lemma  nmi_conj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x) ;
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    71
  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)\<rbrakk> \<Longrightarrow>
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    72
  \<forall>x. \<not>(P1' \<and> P2') \<and> (P1 x \<and> P2 x) \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    73
lemma  nmi_disj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x) ;
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    74
  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)\<rbrakk> \<Longrightarrow>
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    75
  \<forall>x. \<not>(P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow>  (\<exists> u\<in> U. u \<le> x)" by auto
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    76
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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)
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    83
lemma  npi_P: "\<forall> x. ~P \<and> P \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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>
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    85
  \<Longrightarrow>  \<forall>x. \<not>(P1' \<and> P2') \<and> (P1 x \<and> P2 x) \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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>
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    87
  \<Longrightarrow> \<forall>x. \<not>(P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow>  (\<exists> u\<in> U. x \<le> u)" by auto
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    88
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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)"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    90
proof(clarsimp)
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    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"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    92
    and xu: "x<u"  and px: "x < t" and ly: "l<y" and yu:"y < u"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    93
  from tU noU ly yu have tny: "t\<noteq>y" by auto
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    94
  {assume H: "t < y"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    95
    from less_trans[OF lx px] less_trans[OF H yu]
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    96
    have "l < t \<and> t < u"  by simp
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    97
    with tU noU have "False" by auto}
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    98
  hence "\<not> t < y"  by auto hence "y \<le> t" by (simp add: not_less)
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
    99
  thus "y < t" using tny by (simp add: less_le)
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   100
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   101
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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)"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   103
proof(clarsimp)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   104
  fix x l u y
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   106
  and px: "t < x" and ly: "l<y" and yu:"y < u"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   107
  from tU noU ly yu have tny: "t\<noteq>y" by auto
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   108
  {assume H: "y< t"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   109
    from less_trans[OF ly H] less_trans[OF px xu] have "l < t \<and> t < u" by simp
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   110
    with tU noU have "False" by auto}
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   111
  hence "\<not> y<t"  by auto hence "t \<le> y" by (auto simp add: not_less)
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   112
  thus "t < y" using tny by (simp add:less_le)
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   113
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   114
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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)"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   116
proof(clarsimp)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   117
  fix x l u y
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   119
  and px: "x \<le> t" and ly: "l<y" and yu:"y < u"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   120
  from tU noU ly yu have tny: "t\<noteq>y" by auto
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   121
  {assume H: "t < y"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   122
    from less_le_trans[OF lx px] less_trans[OF H yu]
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   123
    have "l < t \<and> t < u" by simp
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   124
    with tU noU have "False" by auto}
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   125
  hence "\<not> t < y"  by auto thus "y \<le> t" by (simp add: not_less)
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   126
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   127
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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)"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   129
proof(clarsimp)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   130
  fix x l u y
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   132
  and px: "t \<le> x" and ly: "l<y" and yu:"y < u"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   133
  from tU noU ly yu have tny: "t\<noteq>y" by auto
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   134
  {assume H: "y< t"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   135
    from less_trans[OF ly H] le_less_trans[OF px xu]
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   136
    have "l < t \<and> t < u" by simp
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   137
    with tU noU have "False" by auto}
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   138
  hence "\<not> y<t"  by auto thus "t \<le> y" by (simp add: not_less)
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   139
qed
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   143
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   144
lemma lin_dense_conj:
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   146
  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P1 y) ;
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   148
  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P2 y)\<rbrakk> \<Longrightarrow>
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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)
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   150
  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> (P1 y \<and> P2 y))"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   151
  by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   152
lemma lin_dense_disj:
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   154
  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P1 y) ;
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   156
  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P2 y)\<rbrakk> \<Longrightarrow>
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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)
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   158
  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> (P1 y \<or> P2 y))"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   159
  by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   160
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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>
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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')"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   163
by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   164
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   165
lemma finite_set_intervals:
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   166
  assumes px: "P x" and lx: "l \<le> x" and xu: "x \<le> u" and linS: "l\<in> S"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   169
proof-
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   170
  let ?Mx = "{y. y\<in> S \<and> y \<le> x}"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   171
  let ?xM = "{y. y\<in> S \<and> x \<le> y}"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   172
  let ?a = "Max ?Mx"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   173
  let ?b = "Min ?xM"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   174
  have MxS: "?Mx \<subseteq> S" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   175
  hence fMx: "finite ?Mx" using fS finite_subset by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   176
  from lx linS have linMx: "l \<in> ?Mx" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   177
  hence Mxne: "?Mx \<noteq> {}" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   178
  have xMS: "?xM \<subseteq> S" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   179
  hence fxM: "finite ?xM" using fS finite_subset by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   180
  from xu uinS have linxM: "u \<in> ?xM" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   181
  hence xMne: "?xM \<noteq> {}" by blast
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   182
  have ax:"?a \<le> x" using Mxne fMx by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   183
  have xb:"x \<le> ?b" using xMne fxM by auto
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   184
  have "?a \<in> ?Mx" using Max_in[OF fMx Mxne] by simp hence ainS: "?a \<in> S" using MxS by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   185
  have "?b \<in> ?xM" using Min_in[OF fxM xMne] by simp hence binS: "?b \<in> S" using xMS by blast
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   186
  have noy:"\<forall> y. ?a < y \<and> y < ?b \<longrightarrow> y \<notin> S"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   187
  proof(clarsimp)
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   188
    fix y   assume ay: "?a < y" and yb: "y < ?b" and yS: "y \<in> S"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   189
    from yS have "y\<in> ?Mx \<or> y\<in> ?xM" by (auto simp add: linear)
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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])}
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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])}
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   192
    ultimately show "False" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   193
  qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   194
  from ainS binS noy ax xb px show ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   195
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   196
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   197
lemma finite_set_intervals2:
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   198
  assumes px: "P x" and lx: "l \<le> x" and xu: "x \<le> u" and linS: "l\<in> S"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   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)"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   201
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   202
  from finite_set_intervals[where P="P", OF px lx xu linS uinS fS lS Su]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   203
  obtain a and b where
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   204
    as: "a\<in> S" and bs: "b\<in> S" and noS:"\<forall>y. a < y \<and> y < b \<longrightarrow> y \<notin> S"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   205
    and axb: "a \<le> x \<and> x \<le> b \<and> P x"  by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   206
  from axb have "x= a \<or> x= b \<or> (a < x \<and> x < b)" by (auto simp add: le_less)
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   207
  thus ?thesis using px as bs noS by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   208
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   209
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   210
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   211
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   212
section {* The classical QE after Langford for dense linear orders *}
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   213
24422
c0b5ff9e9e4d moved class dense_linear_order to Orderings.thy
haftmann
parents: 24398
diff changeset
   214
context dense_linear_order
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   215
begin
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   216
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   217
lemma dlo_qe_bnds: 
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   218
  assumes ne: "L \<noteq> {}" and neU: "U \<noteq> {}" and fL: "finite L" and fU: "finite U"
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   219
  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)"
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   220
proof (simp only: atomize_eq, rule iffI)
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   221
  assume H: "\<exists>x. (\<forall>y\<in>L. y < x) \<and> (\<forall>y\<in>U. x < y)"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   222
  then obtain x where xL: "\<forall>y\<in>L. y < x" and xU: "\<forall>y\<in>U. x < y" by blast
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   223
  {fix l u assume l: "l \<in> L" and u: "u \<in> U"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   224
    from less_trans[OF xL[rule_format, OF l] xU[rule_format, OF u]]
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   225
    have "l < u" .}
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   226
  thus "\<forall>l\<in>L. \<forall>u\<in>U. l < u" by blast
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   227
next
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   228
  assume H: "\<forall>l\<in>L. \<forall>u\<in>U. l < u"
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   229
  let ?ML = "Max L"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   230
  let ?MU = "Min U"  
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   231
  from fL ne have th1: "?ML \<in> L" and th1': "\<forall>l\<in>L. l \<le> ?ML" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   232
  from fU neU have th2: "?MU \<in> U" and th2': "\<forall>u\<in>U. ?MU \<le> u" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   233
  from th1 th2 H have "?ML < ?MU" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   234
  with dense obtain w where th3: "?ML < w" and th4: "w < ?MU" by blast
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   235
  from th3 th1' have "\<forall>l \<in> L. l < w" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   236
  moreover from th4 th2' have "\<forall>u \<in> U. w < u" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   237
  ultimately show "\<exists>x. (\<forall>y\<in>L. y < x) \<and> (\<forall>y\<in>U. x < y)" by auto
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   238
qed
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   239
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   240
lemma dlo_qe_noub: 
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   241
  assumes ne: "L \<noteq> {}" and fL: "finite L"
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   242
  shows "(\<exists>x. (\<forall>y \<in> L. y < x) \<and> (\<forall>y \<in> {}. x < y)) \<equiv> True"
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   243
proof(simp add: atomize_eq)
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   244
  from gt_ex[rule_format, of "Max L"] obtain M where M: "Max L < M" by blast
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   245
  from ne fL have "\<forall>x \<in> L. x \<le> Max L" by simp
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   246
  with M have "\<forall>x\<in>L. x < M" by (auto intro: le_less_trans)
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   247
  thus "\<exists>x. \<forall>y\<in>L. y < x" by blast
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   248
qed
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   249
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   250
lemma dlo_qe_nolb: 
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   251
  assumes ne: "U \<noteq> {}" and fU: "finite U"
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   252
  shows "(\<exists>x. (\<forall>y \<in> {}. y < x) \<and> (\<forall>y \<in> U. x < y)) \<equiv> True"
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   253
proof(simp add: atomize_eq)
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   254
  from lt_ex[rule_format, of "Min U"] obtain M where M: "M < Min U" by blast
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   255
  from ne fU have "\<forall>x \<in> U. Min U \<le> x" by simp
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   256
  with M have "\<forall>x\<in>U. M < x" by (auto intro: less_le_trans)
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   257
  thus "\<exists>x. \<forall>y\<in>U. x < y" by blast
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   258
qed
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   259
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   260
lemma exists_neq: "\<exists>(x::'a). x \<noteq> t" "\<exists>(x::'a). t \<noteq> x" 
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   261
  using gt_ex[rule_format, of t] by auto
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   262
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   263
lemmas dlo_simps = order_refl less_irrefl not_less not_le exists_neq 
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   264
  le_less neq_iff linear less_not_permute
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   265
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   266
lemma axiom: "dense_linear_order (op \<le>) (op <)" .
24748
ee0a0eb6b738 proper syntax during class specification
haftmann
parents: 24679
diff changeset
   267
lemma atoms:
ee0a0eb6b738 proper syntax during class specification
haftmann
parents: 24679
diff changeset
   268
  includes meta_term_syntax
ee0a0eb6b738 proper syntax during class specification
haftmann
parents: 24679
diff changeset
   269
  shows "TERM (less :: 'a \<Rightarrow> _)"
ee0a0eb6b738 proper syntax during class specification
haftmann
parents: 24679
diff changeset
   270
    and "TERM (less_eq :: 'a \<Rightarrow> _)"
ee0a0eb6b738 proper syntax during class specification
haftmann
parents: 24679
diff changeset
   271
    and "TERM (op = :: 'a \<Rightarrow> _)" .
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   272
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   273
declare axiom[langford qe: dlo_qe_bnds dlo_qe_nolb dlo_qe_noub gather: gather_start gather_simps atoms: atoms]
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   274
declare dlo_simps[langfordsimp]
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   275
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   276
end
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   277
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   278
(* FIXME: Move to HOL -- together with the conj_aci_rule in langford.ML *)
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   279
lemma dnf:
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   280
  "(P & (Q | R)) = ((P&Q) | (P&R))" 
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   281
  "((Q | R) & P) = ((Q&P) | (R&P))"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   282
  by blast+
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   283
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   284
lemmas weak_dnf_simps = simp_thms dnf
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   285
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   286
lemma nnf_simps:
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   287
    "(\<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)"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   288
    "(P = Q) = ((P \<and> Q) \<or> (\<not>P \<and> \<not> Q))" "(\<not> \<not>(P)) = P"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   289
  by blast+
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   290
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   291
lemma ex_distrib: "(\<exists>x. P x \<or> Q x) \<longleftrightarrow> ((\<exists>x. P x) \<or> (\<exists>x. Q x))" by blast
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   292
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   293
lemmas dnf_simps = weak_dnf_simps nnf_simps ex_distrib
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   294
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   295
use "Tools/Qelim/langford.ML"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   296
method_setup dlo = {*
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   297
  Method.ctxt_args (Method.SIMPLE_METHOD' o LangfordQE.dlo_tac)
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   298
*} "Langford's algorithm for quantifier elimination in dense linear orders"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   299
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   300
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   301
section {* Contructive dense linear orders yield QE for linear arithmetic over ordered Fields -- see @{text "Arith_Tools.thy"} *}
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   302
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   303
text {* Linear order without upper bounds *}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   304
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   305
class linorder_no_ub = linorder +
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   306
  assumes gt_ex: "\<exists>y. x < y"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   307
begin
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   308
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   309
lemma ge_ex: "\<exists>y. x \<le> y" using gt_ex by auto
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   310
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   311
text {* Theorems for @{text "\<exists>z. \<forall>x. z < x \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>+\<infinity>\<^esub>)"} *}
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   312
lemma pinf_conj:
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   313
  assumes ex1: "\<exists>z1. \<forall>x. z1 < x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   314
  and ex2: "\<exists>z2. \<forall>x. z2 < x \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   315
  shows "\<exists>z. \<forall>x. z <  x \<longrightarrow> ((P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2'))"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   316
proof-
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   317
  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. z1 < x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   318
     and z2: "\<forall>x. z2 < x \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   319
  from gt_ex obtain z where z:"max z1 z2 < z" by blast
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   320
  from z have zz1: "z1 < z" and zz2: "z2 < z" by simp_all
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   321
  {fix x assume H: "z < x"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   322
    from less_trans[OF zz1 H] less_trans[OF zz2 H]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   323
    have "(P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2')"  using z1 zz1 z2 zz2 by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   324
  }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   325
  thus ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   326
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   327
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   328
lemma pinf_disj:
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   329
  assumes ex1: "\<exists>z1. \<forall>x. z1 < x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   330
  and ex2: "\<exists>z2. \<forall>x. z2 < x \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   331
  shows "\<exists>z. \<forall>x. z <  x \<longrightarrow> ((P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2'))"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   332
proof-
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   333
  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. z1 < x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   334
     and z2: "\<forall>x. z2 < x \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   335
  from gt_ex obtain z where z:"max z1 z2 < z" by blast
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   336
  from z have zz1: "z1 < z" and zz2: "z2 < z" by simp_all
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   337
  {fix x assume H: "z < x"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   338
    from less_trans[OF zz1 H] less_trans[OF zz2 H]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   339
    have "(P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2')"  using z1 zz1 z2 zz2 by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   340
  }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   341
  thus ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   342
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   343
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   344
lemma pinf_ex: assumes ex:"\<exists>z. \<forall>x. z < x \<longrightarrow> (P x \<longleftrightarrow> P1)" and p1: P1 shows "\<exists> x. P x"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   345
proof-
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   346
  from ex obtain z where z: "\<forall>x. z < x \<longrightarrow> (P x \<longleftrightarrow> P1)" by blast
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   347
  from gt_ex obtain x where x: "z < x" by blast
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   348
  from z x p1 show ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   349
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   350
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   351
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   352
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   353
text {* Linear order without upper bounds *}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   354
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   355
class linorder_no_lb = linorder +
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   356
  assumes lt_ex: "\<exists>y. y < x"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   357
begin
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   358
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   359
lemma le_ex: "\<exists>y. y \<le> x" using lt_ex by auto
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   360
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   361
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   362
text {* Theorems for @{text "\<exists>z. \<forall>x. x < z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>-\<infinity>\<^esub>)"} *}
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   363
lemma minf_conj:
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   364
  assumes ex1: "\<exists>z1. \<forall>x. x < z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   365
  and ex2: "\<exists>z2. \<forall>x. x < z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   366
  shows "\<exists>z. \<forall>x. x <  z \<longrightarrow> ((P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2'))"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   367
proof-
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   368
  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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   369
  from lt_ex obtain z where z:"z < min z1 z2" by blast
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   370
  from z have zz1: "z < z1" and zz2: "z < z2" by simp_all
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   371
  {fix x assume H: "x < z"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   372
    from less_trans[OF H zz1] less_trans[OF H zz2]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   373
    have "(P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2')"  using z1 zz1 z2 zz2 by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   374
  }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   375
  thus ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   376
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   377
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   378
lemma minf_disj:
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   379
  assumes ex1: "\<exists>z1. \<forall>x. x < z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   380
  and ex2: "\<exists>z2. \<forall>x. x < z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   381
  shows "\<exists>z. \<forall>x. x <  z \<longrightarrow> ((P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2'))"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   382
proof-
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   383
  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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   384
  from lt_ex obtain z where z:"z < min z1 z2" by blast
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   385
  from z have zz1: "z < z1" and zz2: "z < z2" by simp_all
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   386
  {fix x assume H: "x < z"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   387
    from less_trans[OF H zz1] less_trans[OF H zz2]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   388
    have "(P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2')"  using z1 zz1 z2 zz2 by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   389
  }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   390
  thus ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   391
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   392
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   393
lemma minf_ex: assumes ex:"\<exists>z. \<forall>x. x < z \<longrightarrow> (P x \<longleftrightarrow> P1)" and p1: P1 shows "\<exists> x. P x"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   394
proof-
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   395
  from ex obtain z where z: "\<forall>x. x < z \<longrightarrow> (P x \<longleftrightarrow> P1)" by blast
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   396
  from lt_ex obtain x where x: "x < z" by blast
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   397
  from z x p1 show ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   398
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   399
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   400
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   401
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   402
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   403
class constr_dense_linear_order = linorder_no_lb + linorder_no_ub +
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   404
  fixes between
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   405
  assumes between_less: "x < y \<Longrightarrow> x < between x y \<and> between x y < y"
24398
8d83b1e7c3dd Axioms for class no longer use object-universal quantifiers
chaieb
parents: 24344
diff changeset
   406
     and  between_same: "between x x = x"
24914
95cda5dd58d5 added proper subclass concept; improved class target
haftmann
parents: 24748
diff changeset
   407
begin
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
   408
24914
95cda5dd58d5 added proper subclass concept; improved class target
haftmann
parents: 24748
diff changeset
   409
subclass dense_linear_order
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
   410
  apply unfold_locales
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
   411
  using gt_ex lt_ex between_less
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
   412
    by (auto, rule_tac x="between x y" in exI, simp)
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   413
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   414
lemma rinf_U:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   415
  assumes fU: "finite U"
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   416
  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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   417
  \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P y )"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   418
  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')"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   419
  and nmi: "\<not> MP"  and npi: "\<not> PP"  and ex: "\<exists> x.  P x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   420
  shows "\<exists> u\<in> U. \<exists> u' \<in> U. P (between u u')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   421
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   422
  from ex obtain x where px: "P x" by blast
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   423
  from px nmi npi nmpiU have "\<exists> u\<in> U. \<exists> u' \<in> U. u \<le> x \<and> x \<le> u'" by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   424
  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
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   425
  from uU have Une: "U \<noteq> {}" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   426
  let ?l = "Min U"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   427
  let ?u = "Max U"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   428
  have linM: "?l \<in> U" using fU Une by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   429
  have uinM: "?u \<in> U" using fU Une by simp
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   430
  have lM: "\<forall> t\<in> U. ?l \<le> t" using Une fU by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   431
  have Mu: "\<forall> t\<in> U. t \<le> ?u" using Une fU by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   432
  have th:"?l \<le> u" using uU Une lM by auto
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   433
  from order_trans[OF th ux] have lx: "?l \<le> x" .
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   434
  have th: "u' \<le> ?u" using uU' Une Mu by simp
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   435
  from order_trans[OF xu' th] have xu: "x \<le> ?u" .
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   436
  from finite_set_intervals2[where P="P",OF px lx xu linM uinM fU lM Mu]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   437
  have "(\<exists> s\<in> U. P s) \<or>
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   438
      (\<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)" .
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   439
  moreover { fix u assume um: "u\<in>U" and pu: "P u"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   440
    have "between u u = u" by (simp add: between_same)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   441
    with um pu have "P (between u u)" by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   442
    with um have ?thesis by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   443
  moreover{
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   444
    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"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   445
      then obtain t1 and t2 where t1M: "t1 \<in> U" and t2M: "t2\<in> U"
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   446
        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"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   447
        by blast
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   448
      from less_trans[OF t1x xt2] have t1t2: "t1 < t2" .
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   449
      let ?u = "between t1 t2"
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   450
      from between_less t1t2 have t1lu: "t1 < ?u" and ut2: "?u < t2" by auto
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   451
      from lin_dense[rule_format, OF] noM t1x xt2 px t1lu ut2 have "P ?u" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   452
      with t1M t2M have ?thesis by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   453
    ultimately show ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   454
  qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   455
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   456
theorem fr_eq:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   457
  assumes fU: "finite U"
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   458
  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
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   459
   \<longrightarrow> (\<forall> y. l < y \<and> y < u \<longrightarrow> P y )"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   460
  and nmibnd: "\<forall>x. \<not> MP \<and> P x \<longrightarrow> (\<exists> u\<in> U. u \<le> x)"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   461
  and npibnd: "\<forall>x. \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. x \<le> u)"
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   462
  and mi: "\<exists>z. \<forall>x. x < z \<longrightarrow> (P x = MP)"  and pi: "\<exists>z. \<forall>x. z < x \<longrightarrow> (P x = PP)"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   463
  shows "(\<exists> x. P x) \<equiv> (MP \<or> PP \<or> (\<exists> u \<in> U. \<exists> u'\<in> U. P (between u u')))"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   464
  (is "_ \<equiv> (_ \<or> _ \<or> ?F)" is "?E \<equiv> ?D")
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   465
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   466
 {
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   467
   assume px: "\<exists> x. P x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   468
   have "MP \<or> PP \<or> (\<not> MP \<and> \<not> PP)" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   469
   moreover {assume "MP \<or> PP" hence "?D" by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   470
   moreover {assume nmi: "\<not> MP" and npi: "\<not> PP"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   471
     from npmibnd[OF nmibnd npibnd]
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   472
     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')" .
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   473
     from rinf_U[OF fU lin_dense nmpiU nmi npi px] have "?D" by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   474
   ultimately have "?D" by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   475
 moreover
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   476
 { assume "?D"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   477
   moreover {assume m:"MP" from minf_ex[OF mi m] have "?E" .}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   478
   moreover {assume p: "PP" from pinf_ex[OF pi p] have "?E" . }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   479
   moreover {assume f:"?F" hence "?E" by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   480
   ultimately have "?E" by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   481
 ultimately have "?E = ?D" by blast thus "?E \<equiv> ?D" by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   482
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   483
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   484
lemmas minf_thms = minf_conj minf_disj minf_eq minf_neq minf_lt minf_le minf_gt minf_ge minf_P
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   485
lemmas pinf_thms = pinf_conj pinf_disj pinf_eq pinf_neq pinf_lt pinf_le pinf_gt pinf_ge pinf_P
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   486
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   487
lemmas nmi_thms = nmi_conj nmi_disj nmi_eq nmi_neq nmi_lt nmi_le nmi_gt nmi_ge nmi_P
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   488
lemmas npi_thms = npi_conj npi_disj npi_eq npi_neq npi_lt npi_le npi_gt npi_ge npi_P
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   489
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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   490
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
   491
lemma ferrack_axiom: "constr_dense_linear_order less_eq less between" by fact
24748
ee0a0eb6b738 proper syntax during class specification
haftmann
parents: 24679
diff changeset
   492
lemma atoms:
ee0a0eb6b738 proper syntax during class specification
haftmann
parents: 24679
diff changeset
   493
  includes meta_term_syntax
ee0a0eb6b738 proper syntax during class specification
haftmann
parents: 24679
diff changeset
   494
  shows "TERM (less :: 'a \<Rightarrow> _)"
ee0a0eb6b738 proper syntax during class specification
haftmann
parents: 24679
diff changeset
   495
    and "TERM (less_eq :: 'a \<Rightarrow> _)"
ee0a0eb6b738 proper syntax during class specification
haftmann
parents: 24679
diff changeset
   496
    and "TERM (op = :: 'a \<Rightarrow> _)" .
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   497
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
   498
declare ferrack_axiom [ferrack minf: minf_thms pinf: pinf_thms
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   499
    nmi: nmi_thms npi: npi_thms lindense:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   500
    lin_dense_thms qe: fr_eq atoms: atoms]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   501
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   502
declaration {*
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   503
let
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
   504
fun simps phi = map (Morphism.thm phi) [@{thm "not_less"}, @{thm "not_le"}]
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   505
fun generic_whatis phi =
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   506
 let
25062
af5ef0d4d655 global class syntax
haftmann
parents: 24914
diff changeset
   507
  val [lt, le] = map (Morphism.term phi) [@{term "op <"}, @{term "op \<le>"}]
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   508
  fun h x t =
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   509
   case term_of t of
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   510
     Const("op =", _)$y$z => if term_of x aconv y then Ferrante_Rackoff_Data.Eq
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   511
                            else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   512
   | @{term "Not"}$(Const("op =", _)$y$z) => if term_of x aconv y then Ferrante_Rackoff_Data.NEq
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   513
                            else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   514
   | b$y$z => if Term.could_unify (b, lt) then
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   515
                 if term_of x aconv y then Ferrante_Rackoff_Data.Lt
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   516
                 else if term_of x aconv z then Ferrante_Rackoff_Data.Gt
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   517
                 else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   518
             else if Term.could_unify (b, le) then
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   519
                 if term_of x aconv y then Ferrante_Rackoff_Data.Le
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   520
                 else if term_of x aconv z then Ferrante_Rackoff_Data.Ge
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   521
                 else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   522
             else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   523
   | _ => Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   524
 in h end
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
   525
 fun ss phi = HOL_ss addsimps (simps phi)
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   526
in
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   527
 Ferrante_Rackoff_Data.funs  @{thm "ferrack_axiom"}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   528
  {isolate_conv = K (K (K Thm.reflexive)), whatis = generic_whatis, simpset = ss}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   529
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   530
*}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   531
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   532
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   533
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents: 23453
diff changeset
   534
use "Tools/Qelim/ferrante_rackoff.ML"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   535
23902
c69069242a51 Added quantifier elimination in dense linear orders after Langford; locale dense_linear_order renamed to constr_dense_linear_order (since it requires the beween constant). locale dense_linear_order is now the classical definition of DLO. constr_dense_linear_order is an instance of dense_linear_order; Method dlo now applies the langford QE, odl Method dlo renamed to ferrack, since it ia a QE only in interpretations where between is interpreted in a manner to vanish after substitution.
chaieb
parents: 23470
diff changeset
   536
method_setup ferrack = {*
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   537
  Method.ctxt_args (Method.SIMPLE_METHOD' o FerranteRackoff.dlo_tac)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   538
*} "Ferrante and Rackoff's algorithm for quantifier elimination in dense linear orders"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   539
24081
84a5a6267d60 Tuned document
chaieb
parents: 23915
diff changeset
   540
end