src/HOL/Dense_Linear_Order.thy
author ballarin
Tue, 18 Sep 2007 18:52:17 +0200
changeset 24640 85a6c200ecd3
parent 24422 c0b5ff9e9e4d
child 24679 5b168969ffe0
permissions -rw-r--r--
Simplified proofs due to transitivity reasoner setup.
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
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
    25
lemma less_not_permute: "\<not> (x \<sqsubset> y \<and> y \<sqsubset> 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 
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
    29
  "(\<exists>x. (\<forall>y \<in> L. y \<sqsubset> x) \<and> (\<forall>y \<in> U. x \<sqsubset> y) \<and> x \<sqsubset> u \<and> P x) \<longleftrightarrow> (\<exists>x. (\<forall>y \<in> L. y \<sqsubset> x) \<and> (\<forall>y \<in> (insert u U). x \<sqsubset> y) \<and> P x)"
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
    30
  and "(\<exists>x. (\<forall>y \<in> L. y \<sqsubset> x) \<and> (\<forall>y \<in> U. x \<sqsubset> y) \<and> l \<sqsubset> x \<and> P x) \<longleftrightarrow> (\<exists>x. (\<forall>y \<in> (insert l L). y \<sqsubset> x) \<and> (\<forall>y \<in> U. x \<sqsubset> y) \<and> P x)"
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
    31
  "(\<exists>x. (\<forall>y \<in> L. y \<sqsubset> x) \<and> (\<forall>y \<in> U. x \<sqsubset> y) \<and> x \<sqsubset> u) \<longleftrightarrow> (\<exists>x. (\<forall>y \<in> L. y \<sqsubset> x) \<and> (\<forall>y \<in> (insert u U). x \<sqsubset> y))"
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
    32
  and "(\<exists>x. (\<forall>y \<in> L. y \<sqsubset> x) \<and> (\<forall>y \<in> U. x \<sqsubset> y) \<and> l \<sqsubset> x) \<longleftrightarrow> (\<exists>x. (\<forall>y \<in> (insert l L). y \<sqsubset> x) \<and> (\<forall>y \<in> U. x \<sqsubset> y))"  by auto
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 
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
    35
  gather_start: "(\<exists>x. P x) \<equiv> (\<exists>x. (\<forall>y \<in> {}. y \<^loc>< x) \<and> (\<forall>y\<in> {}. x \<sqsubset> y) \<and> P x)" 
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
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    38
text{* Theorems for @{text "\<exists>z. \<forall>x. x \<sqsubset> z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>-\<infinity>\<^esub>)"}*}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    39
lemma minf_lt:  "\<exists>z . \<forall>x. x \<sqsubset> z \<longrightarrow> (x \<sqsubset> t \<longleftrightarrow> True)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    40
lemma minf_gt: "\<exists>z . \<forall>x. x \<sqsubset> z \<longrightarrow>  (t \<sqsubset> x \<longleftrightarrow>  False)"
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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    43
lemma minf_le: "\<exists>z. \<forall>x. x \<sqsubset> z \<longrightarrow> (x \<sqsubseteq> t \<longleftrightarrow> True)" by (auto simp add: less_le)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    44
lemma minf_ge: "\<exists>z. \<forall>x. x \<sqsubset> z \<longrightarrow> (t \<sqsubseteq> x \<longleftrightarrow> False)"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    45
  by (auto simp add: less_le not_less not_le)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    46
lemma minf_eq: "\<exists>z. \<forall>x. x \<sqsubset> z \<longrightarrow> (x = t \<longleftrightarrow> False)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    47
lemma minf_neq: "\<exists>z. \<forall>x. x \<sqsubset> z \<longrightarrow> (x \<noteq> t \<longleftrightarrow> True)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    48
lemma minf_P: "\<exists>z. \<forall>x. x \<sqsubset> z \<longrightarrow> (P \<longleftrightarrow> P)" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    49
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    50
text{* Theorems for @{text "\<exists>z. \<forall>x. x \<sqsubset> z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>+\<infinity>\<^esub>)"}*}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    51
lemma pinf_gt:  "\<exists>z . \<forall>x. z \<sqsubset> x \<longrightarrow> (t \<sqsubset> x \<longleftrightarrow> True)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    52
lemma pinf_lt: "\<exists>z . \<forall>x. z \<sqsubset> x \<longrightarrow>  (x \<sqsubset> t \<longleftrightarrow>  False)"
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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    55
lemma pinf_ge: "\<exists>z. \<forall>x. z \<sqsubset> x \<longrightarrow> (t \<sqsubseteq> x \<longleftrightarrow> True)" by (auto simp add: less_le)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    56
lemma pinf_le: "\<exists>z. \<forall>x. z \<sqsubset> x \<longrightarrow> (x \<sqsubseteq> t \<longleftrightarrow> False)"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    57
  by (auto simp add: less_le not_less not_le)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    58
lemma pinf_eq: "\<exists>z. \<forall>x. z \<sqsubset> x \<longrightarrow> (x = t \<longleftrightarrow> False)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    59
lemma pinf_neq: "\<exists>z. \<forall>x. z \<sqsubset> x \<longrightarrow> (x \<noteq> t \<longleftrightarrow> True)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    60
lemma pinf_P: "\<exists>z. \<forall>x. z \<sqsubset> x \<longrightarrow> (P \<longleftrightarrow> P)" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    61
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    62
lemma nmi_lt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> x \<sqsubset> t \<longrightarrow>  (\<exists> u\<in> U. u \<sqsubseteq> x)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    63
lemma nmi_gt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and> t \<sqsubset> x \<longrightarrow>  (\<exists> u\<in> U. u \<sqsubseteq> x)"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    64
  by (auto simp add: le_less)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    65
lemma  nmi_le: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> x\<sqsubseteq> t \<longrightarrow>  (\<exists> u\<in> U. u \<sqsubseteq> x)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    66
lemma  nmi_ge: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and> t\<sqsubseteq> x \<longrightarrow>  (\<exists> u\<in> U. u \<sqsubseteq> x)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    67
lemma  nmi_eq: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x = t \<longrightarrow>  (\<exists> u\<in> U. u \<sqsubseteq> x)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    68
lemma  nmi_neq: "t \<in> U \<Longrightarrow>\<forall>x. \<not>True \<and> x \<noteq> t \<longrightarrow>  (\<exists> u\<in> U. u \<sqsubseteq> x)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    69
lemma  nmi_P: "\<forall> x. ~P \<and> P \<longrightarrow>  (\<exists> u\<in> U. u \<sqsubseteq> x)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    70
lemma  nmi_conj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. u \<sqsubseteq> x) ;
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    71
  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. u \<sqsubseteq> x)\<rbrakk> \<Longrightarrow>
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    72
  \<forall>x. \<not>(P1' \<and> P2') \<and> (P1 x \<and> P2 x) \<longrightarrow>  (\<exists> u\<in> U. u \<sqsubseteq> x)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    73
lemma  nmi_disj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. u \<sqsubseteq> x) ;
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    74
  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. u \<sqsubseteq> x)\<rbrakk> \<Longrightarrow>
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    75
  \<forall>x. \<not>(P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow>  (\<exists> u\<in> U. u \<sqsubseteq> x)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    76
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    77
lemma  npi_lt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x \<sqsubset> t \<longrightarrow>  (\<exists> u\<in> U. x \<sqsubseteq> u)" by (auto simp add: le_less)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    78
lemma  npi_gt: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> t \<sqsubset> x \<longrightarrow>  (\<exists> u\<in> U. x \<sqsubseteq> u)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    79
lemma  npi_le: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x \<sqsubseteq> t \<longrightarrow>  (\<exists> u\<in> U. x \<sqsubseteq> u)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    80
lemma  npi_ge: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> t \<sqsubseteq> x \<longrightarrow>  (\<exists> u\<in> U. x \<sqsubseteq> u)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    81
lemma  npi_eq: "t \<in> U \<Longrightarrow> \<forall>x. \<not>False \<and>  x = t \<longrightarrow>  (\<exists> u\<in> U. x \<sqsubseteq> u)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    82
lemma  npi_neq: "t \<in> U \<Longrightarrow> \<forall>x. \<not>True \<and> x \<noteq> t \<longrightarrow>  (\<exists> u\<in> U. x \<sqsubseteq> u )" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    83
lemma  npi_P: "\<forall> x. ~P \<and> P \<longrightarrow>  (\<exists> u\<in> U. x \<sqsubseteq> u)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    84
lemma  npi_conj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. x \<sqsubseteq> u) ;  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. x \<sqsubseteq> u)\<rbrakk>
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    85
  \<Longrightarrow>  \<forall>x. \<not>(P1' \<and> P2') \<and> (P1 x \<and> P2 x) \<longrightarrow>  (\<exists> u\<in> U. x \<sqsubseteq> u)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    86
lemma  npi_disj: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists> u\<in> U. x \<sqsubseteq> u) ; \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists> u\<in> U. x \<sqsubseteq> u)\<rbrakk>
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    87
  \<Longrightarrow> \<forall>x. \<not>(P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow>  (\<exists> u\<in> U. x \<sqsubseteq> u)" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    88
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    89
lemma lin_dense_lt: "t \<in> U \<Longrightarrow> \<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> x \<sqsubset> t \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> y \<sqsubset> t)"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    90
proof(clarsimp)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    91
  fix x l u y  assume tU: "t \<in> U" and noU: "\<forall>t. l \<sqsubset> t \<and> t \<sqsubset> u \<longrightarrow> t \<notin> U" and lx: "l \<sqsubset> x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    92
    and xu: "x\<sqsubset>u"  and px: "x \<sqsubset> t" and ly: "l\<sqsubset>y" and yu:"y \<sqsubset> u"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    93
  from tU noU ly yu have tny: "t\<noteq>y" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    94
  {assume H: "t \<sqsubset> y"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    95
    from less_trans[OF lx px] less_trans[OF H yu]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    96
    have "l \<sqsubset> t \<and> t \<sqsubset> u"  by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    97
    with tU noU have "False" by auto}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    98
  hence "\<not> t \<sqsubset> y"  by auto hence "y \<sqsubseteq> t" by (simp add: not_less)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    99
  thus "y \<sqsubset> t" using tny by (simp add: less_le)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   100
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   101
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   102
lemma lin_dense_gt: "t \<in> U \<Longrightarrow> \<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> t \<sqsubset> x \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> t \<sqsubset> y)"
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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   105
  assume tU: "t \<in> U" and noU: "\<forall>t. l \<sqsubset> t \<and> t \<sqsubset> u \<longrightarrow> t \<notin> U" and lx: "l \<sqsubset> x" and xu: "x\<sqsubset>u"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   106
  and px: "t \<sqsubset> x" and ly: "l\<sqsubset>y" and yu:"y \<sqsubset> u"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   107
  from tU noU ly yu have tny: "t\<noteq>y" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   108
  {assume H: "y\<sqsubset> t"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   109
    from less_trans[OF ly H] less_trans[OF px xu] have "l \<sqsubset> t \<and> t \<sqsubset> u" by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   110
    with tU noU have "False" by auto}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   111
  hence "\<not> y\<sqsubset>t"  by auto hence "t \<sqsubseteq> y" by (auto simp add: not_less)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   112
  thus "t \<sqsubset> y" using tny by (simp add:less_le)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   113
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   114
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   115
lemma lin_dense_le: "t \<in> U \<Longrightarrow> \<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> x \<sqsubseteq> t \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> y\<sqsubseteq> t)"
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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   118
  assume tU: "t \<in> U" and noU: "\<forall>t. l \<sqsubset> t \<and> t \<sqsubset> u \<longrightarrow> t \<notin> U" and lx: "l \<sqsubset> x" and xu: "x\<sqsubset>u"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   119
  and px: "x \<sqsubseteq> t" and ly: "l\<sqsubset>y" and yu:"y \<sqsubset> u"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   120
  from tU noU ly yu have tny: "t\<noteq>y" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   121
  {assume H: "t \<sqsubset> y"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   122
    from less_le_trans[OF lx px] less_trans[OF H yu]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   123
    have "l \<sqsubset> t \<and> t \<sqsubset> u" by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   124
    with tU noU have "False" by auto}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   125
  hence "\<not> t \<sqsubset> y"  by auto thus "y \<sqsubseteq> t" by (simp add: not_less)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   126
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   127
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   128
lemma lin_dense_ge: "t \<in> U \<Longrightarrow> \<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> t \<sqsubseteq> x \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> t \<sqsubseteq> y)"
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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   131
  assume tU: "t \<in> U" and noU: "\<forall>t. l \<sqsubset> t \<and> t \<sqsubset> u \<longrightarrow> t \<notin> U" and lx: "l \<sqsubset> x" and xu: "x\<sqsubset>u"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   132
  and px: "t \<sqsubseteq> x" and ly: "l\<sqsubset>y" and yu:"y \<sqsubset> u"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   133
  from tU noU ly yu have tny: "t\<noteq>y" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   134
  {assume H: "y\<sqsubset> t"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   135
    from less_trans[OF ly H] le_less_trans[OF px xu]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   136
    have "l \<sqsubset> t \<and> t \<sqsubset> u" by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   137
    with tU noU have "False" by auto}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   138
  hence "\<not> y\<sqsubset>t"  by auto thus "t \<sqsubseteq> y" by (simp add: not_less)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   139
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   140
lemma lin_dense_eq: "t \<in> U \<Longrightarrow> \<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> x = t   \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> y= t)"  by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   141
lemma lin_dense_neq: "t \<in> U \<Longrightarrow> \<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> x \<noteq> t   \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> y\<noteq> t)"  by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   142
lemma lin_dense_P: "\<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   \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> P)"  by auto
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:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   145
  "\<lbrakk>\<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> P1 x
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   146
  \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> P1 y) ;
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   147
  \<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> P2 x
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   148
  \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> P2 y)\<rbrakk> \<Longrightarrow>
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   149
  \<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> (P1 x \<and> P2 x)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   150
  \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> (P1 y \<and> P2 y))"
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:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   153
  "\<lbrakk>\<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> P1 x
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   154
  \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> P1 y) ;
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   155
  \<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> P2 x
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   156
  \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> P2 y)\<rbrakk> \<Longrightarrow>
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   157
  \<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> (P1 x \<or> P2 x)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   158
  \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> (P1 y \<or> P2 y))"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   159
  by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   160
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   161
lemma npmibnd: "\<lbrakk>\<forall>x. \<not> MP \<and> P x \<longrightarrow> (\<exists> u\<in> U. u \<sqsubseteq> x); \<forall>x. \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. x \<sqsubseteq> u)\<rbrakk>
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   162
  \<Longrightarrow> \<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')"
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:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   166
  assumes px: "P x" and lx: "l \<sqsubseteq> x" and xu: "x \<sqsubseteq> u" and linS: "l\<in> S"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   167
  and uinS: "u \<in> S" and fS:"finite S" and lS: "\<forall> x\<in> S. l \<sqsubseteq> x" and Su: "\<forall> x\<in> S. x \<sqsubseteq> u"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   168
  shows "\<exists> a \<in> S. \<exists> b \<in> S. (\<forall> y. a \<sqsubset> y \<and> y \<sqsubset> b \<longrightarrow> y \<notin> S) \<and> a \<sqsubseteq> x \<and> x \<sqsubseteq> b \<and> P x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   169
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   170
  let ?Mx = "{y. y\<in> S \<and> y \<sqsubseteq> x}"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   171
  let ?xM = "{y. y\<in> S \<and> x \<sqsubseteq> y}"
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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   182
  have ax:"?a \<sqsubseteq> x" using Mxne fMx by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   183
  have xb:"x \<sqsubseteq> ?b" using xMne fxM by auto
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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   186
  have noy:"\<forall> y. ?a \<sqsubset> y \<and> y \<sqsubset> ?b \<longrightarrow> y \<notin> S"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   187
  proof(clarsimp)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   188
    fix y   assume ay: "?a \<sqsubset> y" and yb: "y \<sqsubset> ?b" and yS: "y \<in> S"
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)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   190
    moreover {assume "y \<in> ?Mx" hence "y \<sqsubseteq> ?a" using Mxne fMx by auto with ay have "False" by (simp add: not_le[symmetric])}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   191
    moreover {assume "y \<in> ?xM" hence "?b \<sqsubseteq> y" using xMne fxM by auto with yb have "False" by (simp add: not_le[symmetric])}
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:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   198
  assumes px: "P x" and lx: "l \<sqsubseteq> x" and xu: "x \<sqsubseteq> u" and linS: "l\<in> S"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   199
  and uinS: "u \<in> S" and fS:"finite S" and lS: "\<forall> x\<in> S. l \<sqsubseteq> x" and Su: "\<forall> x\<in> S. x \<sqsubseteq> u"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   200
  shows "(\<exists> s\<in> S. P s) \<or> (\<exists> a \<in> S. \<exists> b \<in> S. (\<forall> y. a \<sqsubset> y \<and> y \<sqsubset> b \<longrightarrow> y \<notin> S) \<and> a \<sqsubset> x \<and> x \<sqsubset> b \<and> P x)"
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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   204
    as: "a\<in> S" and bs: "b\<in> S" and noS:"\<forall>y. a \<sqsubset> y \<and> y \<sqsubset> b \<longrightarrow> y \<notin> S"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   205
    and axb: "a \<sqsubseteq> x \<and> x \<sqsubseteq> b \<and> P x"  by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   206
  from axb have "x= a \<or> x= b \<or> (a \<sqsubset> x \<and> x \<sqsubset> b)" by (auto simp add: le_less)
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"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   219
  shows "(\<exists>x. (\<forall>y \<in> L. y \<sqsubset> x) \<and> (\<forall>y \<in> U. x \<sqsubset> y)) \<equiv> (\<forall> l \<in> L. \<forall>u \<in> U. l \<sqsubset> u)"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   220
proof (simp only: atomize_eq, rule iffI)
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   221
  assume H: "\<exists>x. (\<forall>y\<in>L. y \<^loc>< x) \<and> (\<forall>y\<in>U. x \<^loc>< y)"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   222
  then obtain x where xL: "\<forall>y\<in>L. y \<^loc>< x" and xU: "\<forall>y\<in>U. x \<^loc>< y" by blast
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]]
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   225
    have "l \<sqsubset> u" .}
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   226
  thus "\<forall>l\<in>L. \<forall>u\<in>U. l \<^loc>< u" by blast
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   227
next
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   228
  assume H: "\<forall>l\<in>L. \<forall>u\<in>U. l \<^loc>< u"
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"  
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   231
  from fL ne have th1: "?ML \<in> L" and th1': "\<forall>l\<in>L. l \<sqsubseteq> ?ML" by auto
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   232
  from fU neU have th2: "?MU \<in> U" and th2': "\<forall>u\<in>U. ?MU \<sqsubseteq> u" by auto
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   233
  from th1 th2 H have "?ML \<sqsubset> ?MU" by auto
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   234
  with dense obtain w where th3: "?ML \<sqsubset> w" and th4: "w \<sqsubset> ?MU" by blast
24640
85a6c200ecd3 Simplified proofs due to transitivity reasoner setup.
ballarin
parents: 24422
diff changeset
   235
  from th3 th1' have "\<forall>l \<in> L. l \<sqsubset> w" by auto
85a6c200ecd3 Simplified proofs due to transitivity reasoner setup.
ballarin
parents: 24422
diff changeset
   236
  moreover from th4 th2' have "\<forall>u \<in> U. w \<sqsubset> u" by auto
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   237
  ultimately show "\<exists>x. (\<forall>y\<in>L. y \<^loc>< x) \<and> (\<forall>y\<in>U. x \<^loc>< y)" by auto
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"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   242
  shows "(\<exists>x. (\<forall>y \<in> L. y \<sqsubset> x) \<and> (\<forall>y \<in> {}. x \<sqsubset> y)) \<equiv> True"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   243
proof(simp add: atomize_eq)
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   244
  from gt_ex[rule_format, of "Max L"] obtain M where M: "Max L \<sqsubset> M" by blast
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   245
  from ne fL have "\<forall>x \<in> L. x \<sqsubseteq> Max L" by simp
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   246
  with M have "\<forall>x\<in>L. x \<sqsubset> M" by (auto intro: le_less_trans)
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   247
  thus "\<exists>x. \<forall>y\<in>L. y \<^loc>< x" by blast
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"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   252
  shows "(\<exists>x. (\<forall>y \<in> {}. y \<sqsubset> x) \<and> (\<forall>y \<in> U. x \<sqsubset> y)) \<equiv> True"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   253
proof(simp add: atomize_eq)
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   254
  from lt_ex[rule_format, of "Min U"] obtain M where M: "M \<sqsubset> Min U" by blast
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   255
  from ne fU have "\<forall>x \<in> U. Min U \<sqsubseteq> x" by simp
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   256
  with M have "\<forall>x\<in>U. M \<sqsubset> x" by (auto intro: less_le_trans)
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   257
  thus "\<exists>x. \<forall>y\<in>U. x \<^loc>< y" by blast
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
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   266
lemma axiom: "dense_linear_order (op \<sqsubseteq>) (op \<sqsubset>)" .
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   267
lemma atoms: includes meta_term_syntax
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   268
  shows "TERM (op \<sqsubset> :: 'a \<Rightarrow> _)" and "TERM (op \<sqsubseteq>)" and "TERM (op = :: 'a \<Rightarrow> _)" .
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   269
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   270
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
   271
declare dlo_simps[langfordsimp]
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   272
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   273
end
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   274
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   275
(* FIXME: Move to HOL -- together with the conj_aci_rule in langford.ML *)
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   276
lemma dnf:
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   277
  "(P & (Q | R)) = ((P&Q) | (P&R))" 
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   278
  "((Q | R) & P) = ((Q&P) | (R&P))"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   279
  by blast+
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   280
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   281
lemmas weak_dnf_simps = simp_thms dnf
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   282
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   283
lemma nnf_simps:
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   284
    "(\<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
   285
    "(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
   286
  by blast+
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   287
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   288
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
   289
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   290
lemmas dnf_simps = weak_dnf_simps nnf_simps ex_distrib
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   291
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   292
use "Tools/Qelim/langford.ML"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   293
method_setup dlo = {*
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   294
  Method.ctxt_args (Method.SIMPLE_METHOD' o LangfordQE.dlo_tac)
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   295
*} "Langford's algorithm for quantifier elimination in dense linear orders"
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   296
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   297
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   298
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
   299
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   300
text {* Linear order without upper bounds *}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   301
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   302
class linorder_no_ub = linorder +
24398
8d83b1e7c3dd Axioms for class no longer use object-universal quantifiers
chaieb
parents: 24344
diff changeset
   303
  assumes gt_ex: "\<exists>y. x \<sqsubset> y"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   304
begin
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   305
24398
8d83b1e7c3dd Axioms for class no longer use object-universal quantifiers
chaieb
parents: 24344
diff changeset
   306
lemma ge_ex: "\<exists>y. x \<sqsubseteq> y" using gt_ex by auto
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   307
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   308
text {* Theorems for @{text "\<exists>z. \<forall>x. z \<sqsubset> x \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>+\<infinity>\<^esub>)"} *}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   309
lemma pinf_conj:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   310
  assumes ex1: "\<exists>z1. \<forall>x. z1 \<sqsubset> x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   311
  and ex2: "\<exists>z2. \<forall>x. z2 \<sqsubset> x \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   312
  shows "\<exists>z. \<forall>x. z \<sqsubset>  x \<longrightarrow> ((P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2'))"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   313
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   314
  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. z1 \<sqsubset> x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   315
     and z2: "\<forall>x. z2 \<sqsubset> x \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   316
  from gt_ex obtain z where z:"max z1 z2 \<sqsubset> z" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   317
  from z have zz1: "z1 \<sqsubset> z" and zz2: "z2 \<sqsubset> z" by simp_all
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   318
  {fix x assume H: "z \<sqsubset> x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   319
    from less_trans[OF zz1 H] less_trans[OF zz2 H]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   320
    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
   321
  }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   322
  thus ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   323
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   324
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   325
lemma pinf_disj:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   326
  assumes ex1: "\<exists>z1. \<forall>x. z1 \<sqsubset> x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   327
  and ex2: "\<exists>z2. \<forall>x. z2 \<sqsubset> x \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   328
  shows "\<exists>z. \<forall>x. z \<sqsubset>  x \<longrightarrow> ((P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2'))"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   329
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   330
  from ex1 ex2 obtain z1 and z2 where z1: "\<forall>x. z1 \<sqsubset> x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   331
     and z2: "\<forall>x. z2 \<sqsubset> x \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   332
  from gt_ex obtain z where z:"max z1 z2 \<sqsubset> z" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   333
  from z have zz1: "z1 \<sqsubset> z" and zz2: "z2 \<sqsubset> z" by simp_all
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   334
  {fix x assume H: "z \<sqsubset> x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   335
    from less_trans[OF zz1 H] less_trans[OF zz2 H]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   336
    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
   337
  }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   338
  thus ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   339
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   340
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   341
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"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   342
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   343
  from ex obtain z where z: "\<forall>x. z \<sqsubset> x \<longrightarrow> (P x \<longleftrightarrow> P1)" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   344
  from gt_ex obtain x where x: "z \<sqsubset> x" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   345
  from z x p1 show ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   346
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   347
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   348
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   349
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   350
text {* Linear order without upper bounds *}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   351
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   352
class linorder_no_lb = linorder +
24398
8d83b1e7c3dd Axioms for class no longer use object-universal quantifiers
chaieb
parents: 24344
diff changeset
   353
  assumes lt_ex: "\<exists>y. y \<sqsubset> x"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   354
begin
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   355
24398
8d83b1e7c3dd Axioms for class no longer use object-universal quantifiers
chaieb
parents: 24344
diff changeset
   356
lemma le_ex: "\<exists>y. y \<sqsubseteq> x" using lt_ex by auto
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   357
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   358
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   359
text {* Theorems for @{text "\<exists>z. \<forall>x. x \<sqsubset> z \<longrightarrow> (P x \<longleftrightarrow> P\<^bsub>-\<infinity>\<^esub>)"} *}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   360
lemma minf_conj:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   361
  assumes ex1: "\<exists>z1. \<forall>x. x \<sqsubset> z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   362
  and ex2: "\<exists>z2. \<forall>x. x \<sqsubset> z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   363
  shows "\<exists>z. \<forall>x. x \<sqsubset>  z \<longrightarrow> ((P1 x \<and> P2 x) \<longleftrightarrow> (P1' \<and> P2'))"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   364
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   365
  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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   366
  from lt_ex obtain z where z:"z \<sqsubset> min z1 z2" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   367
  from z have zz1: "z \<sqsubset> z1" and zz2: "z \<sqsubset> z2" by simp_all
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   368
  {fix x assume H: "x \<sqsubset> z"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   369
    from less_trans[OF H zz1] less_trans[OF H zz2]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   370
    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
   371
  }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   372
  thus ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   373
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   374
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   375
lemma minf_disj:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   376
  assumes ex1: "\<exists>z1. \<forall>x. x \<sqsubset> z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   377
  and ex2: "\<exists>z2. \<forall>x. x \<sqsubset> z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   378
  shows "\<exists>z. \<forall>x. x \<sqsubset>  z \<longrightarrow> ((P1 x \<or> P2 x) \<longleftrightarrow> (P1' \<or> P2'))"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   379
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   381
  from lt_ex obtain z where z:"z \<sqsubset> min z1 z2" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   382
  from z have zz1: "z \<sqsubset> z1" and zz2: "z \<sqsubset> z2" by simp_all
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   383
  {fix x assume H: "x \<sqsubset> z"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   384
    from less_trans[OF H zz1] less_trans[OF H zz2]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   385
    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
   386
  }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   387
  thus ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   388
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   389
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   390
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"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   391
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   392
  from ex obtain z where z: "\<forall>x. x \<sqsubset> z \<longrightarrow> (P x \<longleftrightarrow> P1)" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   393
  from lt_ex obtain x where x: "x \<sqsubset> z" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   394
  from z x p1 show ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   395
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   396
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   397
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   398
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   399
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   400
class constr_dense_linear_order = linorder_no_lb + linorder_no_ub +
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   401
  fixes between
24398
8d83b1e7c3dd Axioms for class no longer use object-universal quantifiers
chaieb
parents: 24344
diff changeset
   402
  assumes between_less: "x \<sqsubset> y \<Longrightarrow> x \<sqsubset> between x y \<and> between x y \<sqsubset> y"
8d83b1e7c3dd Axioms for class no longer use object-universal quantifiers
chaieb
parents: 24344
diff changeset
   403
     and  between_same: "between x x = 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
   404
24344
a0fd8c2db293 turned locales intro classes
haftmann
parents: 24270
diff changeset
   405
instance advanced constr_dense_linear_order < 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
   406
  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
   407
  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
   408
    by (auto, rule_tac x="between x y" in exI, simp)
24422
c0b5ff9e9e4d moved class dense_linear_order to Orderings.thy
haftmann
parents: 24398
diff changeset
   409
(*FIXME*)
c0b5ff9e9e4d moved class dense_linear_order to Orderings.thy
haftmann
parents: 24398
diff changeset
   410
lemmas gt_ex = dense_linear_order_class.less_eq_less.gt_ex
c0b5ff9e9e4d moved class dense_linear_order to Orderings.thy
haftmann
parents: 24398
diff changeset
   411
lemmas lt_ex = dense_linear_order_class.less_eq_less.lt_ex
c0b5ff9e9e4d moved class dense_linear_order to Orderings.thy
haftmann
parents: 24398
diff changeset
   412
lemmas dense = dense_linear_order_class.less_eq_less.dense
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
   413
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
   414
context constr_dense_linear_order
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   415
begin
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   416
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   417
lemma rinf_U:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   418
  assumes fU: "finite U"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   419
  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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   420
  \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> P y )"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   421
  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')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   422
  and nmi: "\<not> MP"  and npi: "\<not> PP"  and ex: "\<exists> x.  P x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   423
  shows "\<exists> u\<in> U. \<exists> u' \<in> U. P (between u u')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   424
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   425
  from ex obtain x where px: "P x" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   426
  from px nmi npi nmpiU have "\<exists> u\<in> U. \<exists> u' \<in> U. u \<sqsubseteq> x \<and> x \<sqsubseteq> u'" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   427
  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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   428
  from uU have Une: "U \<noteq> {}" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   429
  let ?l = "Min U"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   430
  let ?u = "Max U"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   431
  have linM: "?l \<in> U" using fU Une by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   432
  have uinM: "?u \<in> U" using fU Une by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   433
  have lM: "\<forall> t\<in> U. ?l \<sqsubseteq> t" using Une fU by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   434
  have Mu: "\<forall> t\<in> U. t \<sqsubseteq> ?u" using Une fU by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   435
  have th:"?l \<sqsubseteq> u" using uU Une lM by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   436
  from order_trans[OF th ux] have lx: "?l \<sqsubseteq> x" .
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   437
  have th: "u' \<sqsubseteq> ?u" using uU' Une Mu by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   438
  from order_trans[OF xu' th] have xu: "x \<sqsubseteq> ?u" .
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   439
  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
   440
  have "(\<exists> s\<in> U. P s) \<or>
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   441
      (\<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)" .
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   442
  moreover { fix u assume um: "u\<in>U" and pu: "P u"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   443
    have "between u u = u" by (simp add: between_same)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   444
    with um pu have "P (between u u)" by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   445
    with um have ?thesis by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   446
  moreover{
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   447
    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"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   448
      then obtain t1 and t2 where t1M: "t1 \<in> U" and t2M: "t2\<in> U"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   449
        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"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   450
        by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   451
      from less_trans[OF t1x xt2] have t1t2: "t1 \<sqsubset> t2" .
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   452
      let ?u = "between t1 t2"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   453
      from between_less t1t2 have t1lu: "t1 \<sqsubset> ?u" and ut2: "?u \<sqsubset> t2" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   454
      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
   455
      with t1M t2M have ?thesis by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   456
    ultimately show ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   457
  qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   458
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   459
theorem fr_eq:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   460
  assumes fU: "finite U"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   461
  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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   462
   \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> P y )"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   463
  and nmibnd: "\<forall>x. \<not> MP \<and> P x \<longrightarrow> (\<exists> u\<in> U. u \<sqsubseteq> x)"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   464
  and npibnd: "\<forall>x. \<not>PP \<and> P x \<longrightarrow> (\<exists> u\<in> U. x \<sqsubseteq> u)"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   465
  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)"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   466
  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
   467
  (is "_ \<equiv> (_ \<or> _ \<or> ?F)" is "?E \<equiv> ?D")
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   468
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   469
 {
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   470
   assume px: "\<exists> x. P x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   471
   have "MP \<or> PP \<or> (\<not> MP \<and> \<not> PP)" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   472
   moreover {assume "MP \<or> PP" hence "?D" by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   473
   moreover {assume nmi: "\<not> MP" and npi: "\<not> PP"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   474
     from npmibnd[OF nmibnd npibnd]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   475
     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')" .
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   476
     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
   477
   ultimately have "?D" by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   478
 moreover
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   479
 { assume "?D"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   480
   moreover {assume m:"MP" from minf_ex[OF mi m] have "?E" .}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   481
   moreover {assume p: "PP" from pinf_ex[OF pi p] have "?E" . }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   482
   moreover {assume f:"?F" hence "?E" by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   483
   ultimately have "?E" by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   484
 ultimately have "?E = ?D" by blast thus "?E \<equiv> ?D" by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   485
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   486
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   487
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
   488
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
   489
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   490
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
   491
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
   492
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
   493
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
   494
lemma ferrack_axiom: "constr_dense_linear_order less_eq less between" by fact
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   495
lemma atoms: includes meta_term_syntax
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   496
  shows "TERM (op \<sqsubset> :: 'a \<Rightarrow> _)" and "TERM (op \<sqsubseteq>)" and "TERM (op = :: 'a \<Rightarrow> _)" .
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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   507
  val [lt, le] = map (Morphism.term phi)
24270
f53b7dab4426 fixed dummyT (used as constraint);
wenzelm
parents: 24081
diff changeset
   508
   (ProofContext.read_term_pats dummyT @{context} ["op \<sqsubset>", "op \<sqsubseteq>"]) (* FIXME avoid read? *)
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   509
  fun h x t =
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   510
   case term_of t of
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   511
     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
   512
                            else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   513
   | @{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
   514
                            else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   515
   | b$y$z => if Term.could_unify (b, lt) then
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   516
                 if term_of x aconv y then Ferrante_Rackoff_Data.Lt
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   517
                 else if term_of x aconv z then Ferrante_Rackoff_Data.Gt
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   518
                 else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   519
             else if Term.could_unify (b, le) then
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   520
                 if term_of x aconv y then Ferrante_Rackoff_Data.Le
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   521
                 else if term_of x aconv z then Ferrante_Rackoff_Data.Ge
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
             else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   524
   | _ => Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   525
 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
   526
 fun ss phi = HOL_ss addsimps (simps phi)
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   527
in
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   528
 Ferrante_Rackoff_Data.funs  @{thm "ferrack_axiom"}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   529
  {isolate_conv = K (K (K Thm.reflexive)), whatis = generic_whatis, simpset = ss}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   530
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   531
*}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   532
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   533
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   534
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents: 23453
diff changeset
   535
use "Tools/Qelim/ferrante_rackoff.ML"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   536
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
   537
method_setup ferrack = {*
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   538
  Method.ctxt_args (Method.SIMPLE_METHOD' o FerranteRackoff.dlo_tac)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   539
*} "Ferrante and Rackoff's algorithm for quantifier elimination in dense linear orders"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   540
24081
84a5a6267d60 Tuned document
chaieb
parents: 23915
diff changeset
   541
end