src/HOL/Dense_Linear_Order.thy
author haftmann
Tue, 10 Jul 2007 17:30:50 +0200
changeset 23709 fd31da8f752a
parent 23470 e28b41e8b7d4
child 23902 c69069242a51
permissions -rw-r--r--
moved lfp_induct2 here
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"
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents: 23453
diff changeset
    13
  "Tools/Qelim/ferrante_rackoff_data.ML"
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents: 23453
diff changeset
    14
  ("Tools/Qelim/ferrante_rackoff.ML")
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    15
begin
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    16
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    17
setup Ferrante_Rackoff_Data.setup
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    18
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    19
context Linorder
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    20
begin
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    21
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    22
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
    23
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
    24
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
    25
  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
    26
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    27
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
    28
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
    29
  by (auto simp add: less_le not_less not_le)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    30
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
    31
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
    32
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
    33
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    34
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
    35
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
    36
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
    37
  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
    38
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    39
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
    40
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
    41
  by (auto simp add: less_le not_less not_le)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    42
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
    43
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
    44
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
    45
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    46
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
    47
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
    48
  by (auto simp add: le_less)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    49
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
    50
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
    51
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
    52
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
    53
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
    54
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
    55
  \<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
    56
  \<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
    57
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
    58
  \<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
    59
  \<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
    60
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    61
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
    62
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
    63
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
    64
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
    65
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
    66
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
    67
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
    68
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
    69
  \<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
    70
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
    71
  \<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
    72
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    73
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
    74
proof(clarsimp)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    75
  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
    76
    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
    77
  from tU noU ly yu have tny: "t\<noteq>y" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    78
  {assume H: "t \<sqsubset> y"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    79
    from less_trans[OF lx px] less_trans[OF H yu]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    80
    have "l \<sqsubset> t \<and> t \<sqsubset> u"  by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    81
    with tU noU have "False" by auto}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    82
  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
    83
  thus "y \<sqsubset> t" using tny by (simp add: less_le)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    84
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    85
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    86
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
    87
proof(clarsimp)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    88
  fix x l u y
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    89
  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
    90
  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
    91
  from tU noU ly yu have tny: "t\<noteq>y" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    92
  {assume H: "y\<sqsubset> t"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    93
    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
    94
    with tU noU have "False" by auto}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    95
  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
    96
  thus "t \<sqsubset> y" using tny by (simp add:less_le)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    97
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    98
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
    99
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
   100
proof(clarsimp)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   101
  fix x l u y
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   102
  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
   103
  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
   104
  from tU noU ly yu have tny: "t\<noteq>y" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   105
  {assume H: "t \<sqsubset> y"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   106
    from less_le_trans[OF lx px] less_trans[OF H yu]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   107
    have "l \<sqsubset> t \<and> t \<sqsubset> u" by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   108
    with tU noU have "False" by auto}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   109
  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
   110
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   111
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   112
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
   113
proof(clarsimp)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   114
  fix x l u y
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   115
  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
   116
  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
   117
  from tU noU ly yu have tny: "t\<noteq>y" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   118
  {assume H: "y\<sqsubset> t"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   119
    from less_trans[OF ly H] le_less_trans[OF px xu]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   120
    have "l \<sqsubset> t \<and> t \<sqsubset> u" by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   121
    with tU noU have "False" by auto}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   122
  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
   123
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   124
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
   125
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
   126
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
   127
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   128
lemma lin_dense_conj:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   129
  "\<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
   130
  \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> P1 y) ;
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   131
  \<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
   132
  \<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
   133
  \<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
   134
  \<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
   135
  by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   136
lemma lin_dense_disj:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   137
  "\<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
   138
  \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> P1 y) ;
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   139
  \<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
   140
  \<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
   141
  \<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
   142
  \<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
   143
  by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   144
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   145
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
   146
  \<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
   147
by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   148
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   149
lemma finite_set_intervals:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   150
  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
   151
  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
   152
  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
   153
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   154
  let ?Mx = "{y. y\<in> S \<and> y \<sqsubseteq> x}"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   155
  let ?xM = "{y. y\<in> S \<and> x \<sqsubseteq> y}"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   156
  let ?a = "Max ?Mx"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   157
  let ?b = "Min ?xM"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   158
  have MxS: "?Mx \<subseteq> S" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   159
  hence fMx: "finite ?Mx" using fS finite_subset by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   160
  from lx linS have linMx: "l \<in> ?Mx" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   161
  hence Mxne: "?Mx \<noteq> {}" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   162
  have xMS: "?xM \<subseteq> S" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   163
  hence fxM: "finite ?xM" using fS finite_subset by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   164
  from xu uinS have linxM: "u \<in> ?xM" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   165
  hence xMne: "?xM \<noteq> {}" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   166
  have ax:"?a \<sqsubseteq> x" using Mxne fMx by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   167
  have xb:"x \<sqsubseteq> ?b" using xMne fxM by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   168
  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
   169
  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
   170
  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
   171
  proof(clarsimp)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   172
    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
   173
    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
   174
    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
   175
    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
   176
    ultimately show "False" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   177
  qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   178
  from ainS binS noy ax xb px show ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   179
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   180
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   181
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   182
lemma finite_set_intervals2:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   183
  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
   184
  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
   185
  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
   186
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   187
  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
   188
  obtain a and b where
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   189
    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
   190
    and axb: "a \<sqsubseteq> x \<and> x \<sqsubseteq> b \<and> P x"  by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   191
  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
   192
  thus ?thesis using px as bs noS 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
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   195
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   196
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   197
text {* Linear order without upper bounds *}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   198
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   199
locale linorder_no_ub = Linorder + assumes gt_ex: "\<forall>x. \<exists>y. x \<sqsubset> y"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   200
begin
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   201
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   202
lemma ge_ex: "\<forall>x. \<exists>y. x \<sqsubseteq> y" using gt_ex by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   203
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   204
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
   205
lemma pinf_conj:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   206
  assumes ex1: "\<exists>z1. \<forall>x. z1 \<sqsubset> x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   207
  and ex2: "\<exists>z2. \<forall>x. z2 \<sqsubset> x \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   208
  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
   209
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   210
  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
   211
     and z2: "\<forall>x. z2 \<sqsubset> x \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   212
  from gt_ex obtain z where z:"max z1 z2 \<sqsubset> z" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   213
  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
   214
  {fix x assume H: "z \<sqsubset> x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   215
    from less_trans[OF zz1 H] less_trans[OF zz2 H]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   216
    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
   217
  }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   218
  thus ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   219
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   220
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   221
lemma pinf_disj:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   222
  assumes ex1: "\<exists>z1. \<forall>x. z1 \<sqsubset> x \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   223
  and ex2: "\<exists>z2. \<forall>x. z2 \<sqsubset> x \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   224
  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
   225
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   226
  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
   227
     and z2: "\<forall>x. z2 \<sqsubset> x \<longrightarrow> (P2 x \<longleftrightarrow> P2')" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   228
  from gt_ex obtain z where z:"max z1 z2 \<sqsubset> z" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   229
  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
   230
  {fix x assume H: "z \<sqsubset> x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   231
    from less_trans[OF zz1 H] less_trans[OF zz2 H]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   232
    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
   233
  }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   234
  thus ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   235
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   236
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   237
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
   238
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   239
  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
   240
  from gt_ex obtain x where x: "z \<sqsubset> x" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   241
  from z x p1 show ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   242
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   243
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   244
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   245
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   246
text {* Linear order without upper bounds *}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   247
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   248
locale linorder_no_lb = Linorder + assumes lt_ex: "\<forall>x. \<exists>y. y \<sqsubset> x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   249
begin
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   250
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   251
lemma le_ex: "\<forall>x. \<exists>y. y \<sqsubseteq> x" using lt_ex by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   252
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   253
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   254
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
   255
lemma minf_conj:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   256
  assumes ex1: "\<exists>z1. \<forall>x. x \<sqsubset> z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   257
  and ex2: "\<exists>z2. \<forall>x. x \<sqsubset> z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   258
  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
   259
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   260
  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
   261
  from lt_ex obtain z where z:"z \<sqsubset> min z1 z2" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   262
  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
   263
  {fix x assume H: "x \<sqsubset> z"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   264
    from less_trans[OF H zz1] less_trans[OF H zz2]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   265
    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
   266
  }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   267
  thus ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   268
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   269
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   270
lemma minf_disj:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   271
  assumes ex1: "\<exists>z1. \<forall>x. x \<sqsubset> z1 \<longrightarrow> (P1 x \<longleftrightarrow> P1')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   272
  and ex2: "\<exists>z2. \<forall>x. x \<sqsubset> z2 \<longrightarrow> (P2 x \<longleftrightarrow> P2')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   273
  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
   274
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   275
  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
   276
  from lt_ex obtain z where z:"z \<sqsubset> min z1 z2" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   277
  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
   278
  {fix x assume H: "x \<sqsubset> z"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   279
    from less_trans[OF H zz1] less_trans[OF H zz2]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   280
    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
   281
  }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   282
  thus ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   283
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   284
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   285
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
   286
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   287
  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
   288
  from lt_ex obtain x where x: "x \<sqsubset> z" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   289
  from z x p1 show ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   290
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   291
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   292
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   293
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   294
locale dense_linear_order = linorder_no_lb + linorder_no_ub +
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   295
  fixes between
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   296
  assumes between_less: "\<forall>x y. x \<sqsubset> y \<longrightarrow> x \<sqsubset> between x y \<and> between x y \<sqsubset> y"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   297
     and  between_same: "\<forall>x. between x x = x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   298
begin
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   299
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   300
lemma rinf_U:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   301
  assumes fU: "finite U"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   302
  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
   303
  \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> P y )"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   304
  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
   305
  and nmi: "\<not> MP"  and npi: "\<not> PP"  and ex: "\<exists> x.  P x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   306
  shows "\<exists> u\<in> U. \<exists> u' \<in> U. P (between u u')"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   307
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   308
  from ex obtain x where px: "P x" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   309
  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
   310
  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
   311
  from uU have Une: "U \<noteq> {}" by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   312
  let ?l = "Min U"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   313
  let ?u = "Max U"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   314
  have linM: "?l \<in> U" using fU Une by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   315
  have uinM: "?u \<in> U" using fU Une by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   316
  have lM: "\<forall> t\<in> U. ?l \<sqsubseteq> t" using Une fU by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   317
  have Mu: "\<forall> t\<in> U. t \<sqsubseteq> ?u" using Une fU by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   318
  have th:"?l \<sqsubseteq> u" using uU Une lM by auto
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   319
  from order_trans[OF th ux] have lx: "?l \<sqsubseteq> x" .
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   320
  have th: "u' \<sqsubseteq> ?u" using uU' Une Mu by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   321
  from order_trans[OF xu' th] have xu: "x \<sqsubseteq> ?u" .
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   322
  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
   323
  have "(\<exists> s\<in> U. P s) \<or>
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   324
      (\<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
   325
  moreover { fix u assume um: "u\<in>U" and pu: "P u"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   326
    have "between u u = u" by (simp add: between_same)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   327
    with um pu have "P (between u u)" by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   328
    with um have ?thesis by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   329
  moreover{
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   330
    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
   331
      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
   332
        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
   333
        by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   334
      from less_trans[OF t1x xt2] have t1t2: "t1 \<sqsubset> t2" .
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   335
      let ?u = "between t1 t2"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   336
      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
   337
      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
   338
      with t1M t2M have ?thesis by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   339
    ultimately show ?thesis by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   340
  qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   341
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   342
theorem fr_eq:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   343
  assumes fU: "finite U"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   344
  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
   345
   \<longrightarrow> (\<forall> y. l \<sqsubset> y \<and> y \<sqsubset> u \<longrightarrow> P y )"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   346
  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
   347
  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
   348
  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
   349
  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
   350
  (is "_ \<equiv> (_ \<or> _ \<or> ?F)" is "?E \<equiv> ?D")
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   351
proof-
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   352
 {
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   353
   assume px: "\<exists> x. P x"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   354
   have "MP \<or> PP \<or> (\<not> MP \<and> \<not> PP)" by blast
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   355
   moreover {assume "MP \<or> PP" hence "?D" by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   356
   moreover {assume nmi: "\<not> MP" and npi: "\<not> PP"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   357
     from npmibnd[OF nmibnd npibnd]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   358
     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
   359
     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
   360
   ultimately have "?D" by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   361
 moreover
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   362
 { assume "?D"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   363
   moreover {assume m:"MP" from minf_ex[OF mi m] have "?E" .}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   364
   moreover {assume p: "PP" from pinf_ex[OF pi p] have "?E" . }
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   365
   moreover {assume f:"?F" hence "?E" by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   366
   ultimately have "?E" by blast}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   367
 ultimately have "?E = ?D" by blast thus "?E \<equiv> ?D" by simp
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   368
qed
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   369
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   370
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
   371
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
   372
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   373
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
   374
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
   375
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
   376
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   377
lemma ferrack_axiom: "dense_linear_order less_eq less between" by fact
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   378
lemma atoms: includes meta_term_syntax
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   379
  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
   380
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   381
declare ferrack_axiom [dlo minf: minf_thms pinf: pinf_thms
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   382
    nmi: nmi_thms npi: npi_thms lindense:
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   383
    lin_dense_thms qe: fr_eq atoms: atoms]
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   384
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   385
declaration {*
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   386
let
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   387
fun generic_whatis phi =
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   388
 let
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   389
  val [lt, le] = map (Morphism.term phi)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   390
   (ProofContext.read_term_pats @{typ "dummy"} @{context} ["op \<sqsubset>", "op \<sqsubseteq>"]) (* FIXME avoid read? *)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   391
  val le = Morphism.term phi @{term "op \<sqsubseteq>"}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   392
  fun h x t =
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   393
   case term_of t of
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   394
     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
   395
                            else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   396
   | @{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
   397
                            else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   398
   | b$y$z => if Term.could_unify (b, lt) then
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   399
                 if term_of x aconv y then Ferrante_Rackoff_Data.Lt
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   400
                 else if term_of x aconv z then Ferrante_Rackoff_Data.Gt
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   401
                 else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   402
             else if Term.could_unify (b, le) then
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   403
                 if term_of x aconv y then Ferrante_Rackoff_Data.Le
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   404
                 else if term_of x aconv z then Ferrante_Rackoff_Data.Ge
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   405
                 else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   406
             else Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   407
   | _ => Ferrante_Rackoff_Data.Nox
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   408
 in h end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   409
 val ss = K (HOL_ss addsimps [@{thm "not_less"}, @{thm "not_le"}])
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   410
in
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   411
 Ferrante_Rackoff_Data.funs  @{thm "ferrack_axiom"}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   412
  {isolate_conv = K (K (K Thm.reflexive)), whatis = generic_whatis, simpset = ss}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   413
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   414
*}
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   415
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   416
end
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   417
23466
886655a150f6 moved quantifier elimination tools to Tools/Qelim/;
wenzelm
parents: 23453
diff changeset
   418
use "Tools/Qelim/ferrante_rackoff.ML"
23453
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   419
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   420
method_setup dlo = {*
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   421
  Method.ctxt_args (Method.SIMPLE_METHOD' o FerranteRackoff.dlo_tac)
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   422
*} "Ferrante and Rackoff's algorithm for quantifier elimination in dense linear orders"
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   423
bf46f5cbdd64 Dense linear order witout endpoints
wenzelm
parents:
diff changeset
   424
end