src/HOL/Metis_Examples/Sets.thy
author haftmann
Mon Jun 05 15:59:41 2017 +0200 (2017-06-05)
changeset 66010 2f7d39285a1a
parent 63167 0909deb8059b
child 67613 ce654b0e6d69
permissions -rw-r--r--
executable domain membership checks
blanchet@43197
     1
(*  Title:      HOL/Metis_Examples/Sets.thy
blanchet@43197
     2
    Author:     Lawrence C. Paulson, Cambridge University Computer Laboratory
blanchet@41144
     3
    Author:     Jasmin Blanchette, TU Muenchen
paulson@23449
     4
blanchet@43197
     5
Metis example featuring typed set theory.
paulson@23449
     6
*)
paulson@23449
     7
wenzelm@63167
     8
section \<open>Metis Example Featuring Typed Set Theory\<close>
blanchet@43197
     9
blanchet@43197
    10
theory Sets
wenzelm@33027
    11
imports Main
paulson@23449
    12
begin
paulson@23449
    13
blanchet@50705
    14
declare [[metis_new_skolem]]
blanchet@42103
    15
paulson@23449
    16
lemma "EX x X. ALL y. EX z Z. (~P(y,y) | P(x,x) | ~S(z,x)) &
paulson@23449
    17
               (S(x,y) | ~S(y,z) | Q(Z,Z))  &
blanchet@43197
    18
               (Q(X,y) | ~Q(y,Z) | S(X,X))"
paulson@23519
    19
by metis
paulson@23449
    20
paulson@23449
    21
lemma "P(n::nat) ==> ~P(0) ==> n ~= 0"
paulson@23449
    22
by metis
paulson@23449
    23
blanchet@57245
    24
sledgehammer_params [isar_proofs, compress = 1]
paulson@23449
    25
paulson@23449
    26
(*multiple versions of this example*)
blanchet@46077
    27
lemma (*equal_union: *)
blanchet@36566
    28
   "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))"
blanchet@37325
    29
proof -
wenzelm@61076
    30
  have F1: "\<forall>(x\<^sub>2::'b set) x\<^sub>1::'b set. x\<^sub>1 \<subseteq> x\<^sub>1 \<union> x\<^sub>2" by (metis Un_commute Un_upper2)
wenzelm@61076
    31
  have F2a: "\<forall>(x\<^sub>2::'b set) x\<^sub>1::'b set. x\<^sub>1 \<subseteq> x\<^sub>2 \<longrightarrow> x\<^sub>2 = x\<^sub>2 \<union> x\<^sub>1" by (metis Un_commute subset_Un_eq)
wenzelm@61076
    32
  have F2: "\<forall>(x\<^sub>2::'b set) x\<^sub>1::'b set. x\<^sub>1 \<subseteq> x\<^sub>2 \<and> x\<^sub>2 \<subseteq> x\<^sub>1 \<longrightarrow> x\<^sub>1 = x\<^sub>2" by (metis F2a subset_Un_eq)
blanchet@37325
    33
  { assume "\<not> Z \<subseteq> X"
wenzelm@61076
    34
    hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_upper2) }
blanchet@37325
    35
  moreover
blanchet@37325
    36
  { assume AA1: "Y \<union> Z \<noteq> X"
blanchet@37325
    37
    { assume "\<not> Y \<subseteq> X"
wenzelm@61076
    38
      hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis F1) }
blanchet@37325
    39
    moreover
blanchet@37325
    40
    { assume AAA1: "Y \<subseteq> X \<and> Y \<union> Z \<noteq> X"
blanchet@37325
    41
      { assume "\<not> Z \<subseteq> X"
wenzelm@61076
    42
        hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_upper2) }
blanchet@37325
    43
      moreover
blanchet@37325
    44
      { assume "(Z \<subseteq> X \<and> Y \<subseteq> X) \<and> Y \<union> Z \<noteq> X"
blanchet@37325
    45
        hence "Y \<union> Z \<subseteq> X \<and> X \<noteq> Y \<union> Z" by (metis Un_subset_iff)
blanchet@37325
    46
        hence "Y \<union> Z \<noteq> X \<and> \<not> X \<subseteq> Y \<union> Z" by (metis F2)
wenzelm@61076
    47
        hence "\<exists>x\<^sub>1::'a set. Y \<subseteq> x\<^sub>1 \<union> Z \<and> Y \<union> Z \<noteq> X \<and> \<not> X \<subseteq> x\<^sub>1 \<union> Z" by (metis F1)
wenzelm@61076
    48
        hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_upper2) }
wenzelm@61076
    49
      ultimately have "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis AAA1) }
wenzelm@61076
    50
    ultimately have "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis AA1) }
blanchet@37325
    51
  moreover
wenzelm@61076
    52
  { assume "\<exists>x\<^sub>1::'a set. (Z \<subseteq> x\<^sub>1 \<and> Y \<subseteq> x\<^sub>1) \<and> \<not> X \<subseteq> x\<^sub>1"
blanchet@37325
    53
    { assume "\<not> Y \<subseteq> X"
wenzelm@61076
    54
      hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis F1) }
blanchet@37325
    55
    moreover
blanchet@37325
    56
    { assume AAA1: "Y \<subseteq> X \<and> Y \<union> Z \<noteq> X"
blanchet@37325
    57
      { assume "\<not> Z \<subseteq> X"
wenzelm@61076
    58
        hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_upper2) }
blanchet@37325
    59
      moreover
blanchet@37325
    60
      { assume "(Z \<subseteq> X \<and> Y \<subseteq> X) \<and> Y \<union> Z \<noteq> X"
blanchet@37325
    61
        hence "Y \<union> Z \<subseteq> X \<and> X \<noteq> Y \<union> Z" by (metis Un_subset_iff)
blanchet@37325
    62
        hence "Y \<union> Z \<noteq> X \<and> \<not> X \<subseteq> Y \<union> Z" by (metis F2)
wenzelm@61076
    63
        hence "\<exists>x\<^sub>1::'a set. Y \<subseteq> x\<^sub>1 \<union> Z \<and> Y \<union> Z \<noteq> X \<and> \<not> X \<subseteq> x\<^sub>1 \<union> Z" by (metis F1)
wenzelm@61076
    64
        hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_upper2) }
wenzelm@61076
    65
      ultimately have "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis AAA1) }
wenzelm@61076
    66
    ultimately have "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by blast }
blanchet@37325
    67
  moreover
blanchet@37325
    68
  { assume "\<not> Y \<subseteq> X"
wenzelm@61076
    69
    hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis F1) }
wenzelm@61076
    70
  ultimately show "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by metis
paulson@23449
    71
qed
paulson@23449
    72
blanchet@57245
    73
sledgehammer_params [isar_proofs, compress = 2]
paulson@23449
    74
paulson@23449
    75
lemma (*equal_union: *)
blanchet@37325
    76
   "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))"
blanchet@37325
    77
proof -
wenzelm@61076
    78
  have F1: "\<forall>(x\<^sub>2::'b set) x\<^sub>1::'b set. x\<^sub>1 \<subseteq> x\<^sub>2 \<and> x\<^sub>2 \<subseteq> x\<^sub>1 \<longrightarrow> x\<^sub>1 = x\<^sub>2" by (metis Un_commute subset_Un_eq)
wenzelm@61076
    79
  { assume AA1: "\<exists>x\<^sub>1::'a set. (Z \<subseteq> x\<^sub>1 \<and> Y \<subseteq> x\<^sub>1) \<and> \<not> X \<subseteq> x\<^sub>1"
blanchet@37325
    80
    { assume AAA1: "Y \<subseteq> X \<and> Y \<union> Z \<noteq> X"
blanchet@37325
    81
      { assume "\<not> Z \<subseteq> X"
wenzelm@61076
    82
        hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_upper2) }
blanchet@37325
    83
      moreover
blanchet@37325
    84
      { assume "Y \<union> Z \<subseteq> X \<and> X \<noteq> Y \<union> Z"
wenzelm@61076
    85
        hence "\<exists>x\<^sub>1::'a set. Y \<subseteq> x\<^sub>1 \<union> Z \<and> Y \<union> Z \<noteq> X \<and> \<not> X \<subseteq> x\<^sub>1 \<union> Z" by (metis F1 Un_commute Un_upper2)
wenzelm@61076
    86
        hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_upper2) }
wenzelm@61076
    87
      ultimately have "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis AAA1 Un_subset_iff) }
blanchet@37325
    88
    moreover
blanchet@37325
    89
    { assume "\<not> Y \<subseteq> X"
wenzelm@61076
    90
      hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_commute Un_upper2) }
wenzelm@61076
    91
    ultimately have "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis AA1 Un_subset_iff) }
blanchet@37325
    92
  moreover
blanchet@37325
    93
  { assume "\<not> Z \<subseteq> X"
wenzelm@61076
    94
    hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_upper2) }
blanchet@37325
    95
  moreover
blanchet@37325
    96
  { assume "\<not> Y \<subseteq> X"
wenzelm@61076
    97
    hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_commute Un_upper2) }
blanchet@37325
    98
  moreover
blanchet@37325
    99
  { assume AA1: "Y \<subseteq> X \<and> Y \<union> Z \<noteq> X"
blanchet@37325
   100
    { assume "\<not> Z \<subseteq> X"
wenzelm@61076
   101
      hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_upper2) }
blanchet@37325
   102
    moreover
blanchet@37325
   103
    { assume "Y \<union> Z \<subseteq> X \<and> X \<noteq> Y \<union> Z"
wenzelm@61076
   104
      hence "\<exists>x\<^sub>1::'a set. Y \<subseteq> x\<^sub>1 \<union> Z \<and> Y \<union> Z \<noteq> X \<and> \<not> X \<subseteq> x\<^sub>1 \<union> Z" by (metis F1 Un_commute Un_upper2)
wenzelm@61076
   105
      hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_upper2) }
wenzelm@61076
   106
    ultimately have "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis AA1 Un_subset_iff) }
wenzelm@61076
   107
  ultimately show "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by metis
paulson@23449
   108
qed
paulson@23449
   109
blanchet@57245
   110
sledgehammer_params [isar_proofs, compress = 3]
paulson@23449
   111
paulson@23449
   112
lemma (*equal_union: *)
blanchet@37325
   113
   "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))"
blanchet@37325
   114
proof -
wenzelm@61076
   115
  have F1a: "\<forall>(x\<^sub>2::'b set) x\<^sub>1::'b set. x\<^sub>1 \<subseteq> x\<^sub>2 \<longrightarrow> x\<^sub>2 = x\<^sub>2 \<union> x\<^sub>1" by (metis Un_commute subset_Un_eq)
wenzelm@61076
   116
  have F1: "\<forall>(x\<^sub>2::'b set) x\<^sub>1::'b set. x\<^sub>1 \<subseteq> x\<^sub>2 \<and> x\<^sub>2 \<subseteq> x\<^sub>1 \<longrightarrow> x\<^sub>1 = x\<^sub>2" by (metis F1a subset_Un_eq)
blanchet@37325
   117
  { assume "(Z \<subseteq> X \<and> Y \<subseteq> X) \<and> Y \<union> Z \<noteq> X"
wenzelm@61076
   118
    hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis F1 Un_commute Un_subset_iff Un_upper2) }
blanchet@37325
   119
  moreover
wenzelm@61076
   120
  { assume AA1: "\<exists>x\<^sub>1::'a set. (Z \<subseteq> x\<^sub>1 \<and> Y \<subseteq> x\<^sub>1) \<and> \<not> X \<subseteq> x\<^sub>1"
blanchet@37325
   121
    { assume "(Z \<subseteq> X \<and> Y \<subseteq> X) \<and> Y \<union> Z \<noteq> X"
wenzelm@61076
   122
      hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis F1 Un_commute Un_subset_iff Un_upper2) }
wenzelm@61076
   123
    hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis AA1 Un_commute Un_subset_iff Un_upper2) }
wenzelm@61076
   124
  ultimately show "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_commute Un_upper2)
paulson@23449
   125
qed
paulson@23449
   126
blanchet@57245
   127
sledgehammer_params [isar_proofs, compress = 4]
paulson@23449
   128
paulson@23449
   129
lemma (*equal_union: *)
blanchet@37325
   130
   "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))"
blanchet@37325
   131
proof -
wenzelm@61076
   132
  have F1: "\<forall>(x\<^sub>2::'b set) x\<^sub>1::'b set. x\<^sub>1 \<subseteq> x\<^sub>2 \<and> x\<^sub>2 \<subseteq> x\<^sub>1 \<longrightarrow> x\<^sub>1 = x\<^sub>2" by (metis Un_commute subset_Un_eq)
blanchet@37325
   133
  { assume "\<not> Y \<subseteq> X"
wenzelm@61076
   134
    hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_commute Un_upper2) }
blanchet@37325
   135
  moreover
blanchet@37325
   136
  { assume AA1: "Y \<subseteq> X \<and> Y \<union> Z \<noteq> X"
wenzelm@61076
   137
    { assume "\<exists>x\<^sub>1::'a set. Y \<subseteq> x\<^sub>1 \<union> Z \<and> Y \<union> Z \<noteq> X \<and> \<not> X \<subseteq> x\<^sub>1 \<union> Z"
wenzelm@61076
   138
      hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_upper2) }
wenzelm@61076
   139
    hence "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis AA1 F1 Un_commute Un_subset_iff Un_upper2) }
wenzelm@61076
   140
  ultimately show "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V::'a set. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" by (metis Un_subset_iff Un_upper2)
blanchet@37325
   141
qed
paulson@23449
   142
blanchet@57245
   143
sledgehammer_params [isar_proofs, compress = 1]
blanchet@37325
   144
paulson@23449
   145
lemma (*equal_union: *)
blanchet@37325
   146
   "(X = Y \<union> Z) = (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))"
paulson@23449
   147
by (metis Un_least Un_upper1 Un_upper2 set_eq_subset)
paulson@23449
   148
blanchet@37325
   149
lemma "(X = Y \<inter> Z) = (X \<subseteq> Y \<and> X \<subseteq> Z \<and> (\<forall>V. V \<subseteq> Y \<and> V \<subseteq> Z \<longrightarrow> V \<subseteq> X))"
blanchet@37325
   150
by (metis Int_greatest Int_lower1 Int_lower2 subset_antisym)
paulson@23449
   151
blanchet@37325
   152
lemma fixedpoint: "\<exists>!x. f (g x) = x \<Longrightarrow> \<exists>!y. g (f y) = y"
paulson@23449
   153
by metis
paulson@23449
   154
blanchet@37325
   155
lemma (* fixedpoint: *) "\<exists>!x. f (g x) = x \<Longrightarrow> \<exists>!y. g (f y) = y"
blanchet@37325
   156
proof -
wenzelm@61076
   157
  assume "\<exists>!x::'a. f (g x) = x"
wenzelm@61076
   158
  thus "\<exists>!y::'b. g (f y) = y" by metis
paulson@23449
   159
qed
paulson@23449
   160
blanchet@37325
   161
lemma (* singleton_example_2: *)
paulson@23449
   162
     "\<forall>x \<in> S. \<Union>S \<subseteq> x \<Longrightarrow> \<exists>z. S \<subseteq> {z}"
paulson@23449
   163
by (metis Set.subsetI Union_upper insertCI set_eq_subset)
paulson@23449
   164
blanchet@37325
   165
lemma (* singleton_example_2: *)
paulson@23449
   166
     "\<forall>x \<in> S. \<Union>S \<subseteq> x \<Longrightarrow> \<exists>z. S \<subseteq> {z}"
haftmann@32685
   167
by (metis Set.subsetI Union_upper insert_iff set_eq_subset)
paulson@23449
   168
paulson@23449
   169
lemma singleton_example_2:
paulson@23449
   170
     "\<forall>x \<in> S. \<Union>S \<subseteq> x \<Longrightarrow> \<exists>z. S \<subseteq> {z}"
blanchet@37325
   171
proof -
blanchet@37325
   172
  assume "\<forall>x \<in> S. \<Union>S \<subseteq> x"
wenzelm@53015
   173
  hence "\<forall>x\<^sub>1. x\<^sub>1 \<subseteq> \<Union>S \<and> x\<^sub>1 \<in> S \<longrightarrow> x\<^sub>1 = \<Union>S" by (metis set_eq_subset)
wenzelm@53015
   174
  hence "\<forall>x\<^sub>1. x\<^sub>1 \<in> S \<longrightarrow> x\<^sub>1 = \<Union>S" by (metis Union_upper)
wenzelm@61076
   175
  hence "\<forall>x\<^sub>1::('a set) set. \<Union>S \<in> x\<^sub>1 \<longrightarrow> S \<subseteq> x\<^sub>1" by (metis subsetI)
wenzelm@61076
   176
  hence "\<forall>x\<^sub>1::('a set) set. S \<subseteq> insert (\<Union>S) x\<^sub>1" by (metis insert_iff)
blanchet@37325
   177
  thus "\<exists>z. S \<subseteq> {z}" by metis
paulson@23449
   178
qed
paulson@23449
   179
wenzelm@63167
   180
text \<open>
paulson@23449
   181
  From W. W. Bledsoe and Guohui Feng, SET-VAR. JAR 11 (3), 1993, pages
paulson@23449
   182
  293-314.
wenzelm@63167
   183
\<close>
paulson@23449
   184
blanchet@37325
   185
(* Notes: (1) The numbering doesn't completely agree with the paper.
blanchet@37325
   186
   (2) We must rename set variables to avoid type clashes. *)
paulson@23449
   187
lemma "\<exists>B. (\<forall>x \<in> B. x \<le> (0::int))"
paulson@23449
   188
      "D \<in> F \<Longrightarrow> \<exists>G. \<forall>A \<in> G. \<exists>B \<in> F. A \<subseteq> B"
paulson@23449
   189
      "P a \<Longrightarrow> \<exists>A. (\<forall>x \<in> A. P x) \<and> (\<exists>y. y \<in> A)"
paulson@23449
   190
      "a < b \<and> b < (c::int) \<Longrightarrow> \<exists>B. a \<notin> B \<and> b \<in> B \<and> c \<notin> B"
paulson@23449
   191
      "P (f b) \<Longrightarrow> \<exists>s A. (\<forall>x \<in> A. P x) \<and> f s \<in> A"
paulson@23449
   192
      "P (f b) \<Longrightarrow> \<exists>s A. (\<forall>x \<in> A. P x) \<and> f s \<in> A"
paulson@23449
   193
      "\<exists>A. a \<notin> A"
blanchet@36566
   194
      "(\<forall>C. (0, 0) \<in> C \<and> (\<forall>x y. (x, y) \<in> C \<longrightarrow> (Suc x, Suc y) \<in> C) \<longrightarrow> (n, m) \<in> C) \<and> Q n \<longrightarrow> Q m"
blanchet@37325
   195
       apply (metis all_not_in_conv)
blanchet@37325
   196
      apply (metis all_not_in_conv)
blanchet@46077
   197
     apply (metis mem_Collect_eq)
huffman@48050
   198
    apply (metis less_le singleton_iff)
blanchet@46077
   199
   apply (metis mem_Collect_eq)
blanchet@46077
   200
  apply (metis mem_Collect_eq)
blanchet@37325
   201
 apply (metis all_not_in_conv)
blanchet@37325
   202
by (metis pair_in_Id_conv)
paulson@23449
   203
paulson@23449
   204
end