src/HOL/Set.thy
changeset 20217 25b068a99d2b
parent 19870 ef037d1b32d1
child 20380 14f9f2a1caa6
equal deleted inserted replaced
20216:f30b73385060 20217:25b068a99d2b
    31   Union         :: "'a set set => 'a set"                -- "union of a set"
    31   Union         :: "'a set set => 'a set"                -- "union of a set"
    32   Inter         :: "'a set set => 'a set"                -- "intersection of a set"
    32   Inter         :: "'a set set => 'a set"                -- "intersection of a set"
    33   Pow           :: "'a set => 'a set set"                -- "powerset"
    33   Pow           :: "'a set => 'a set set"                -- "powerset"
    34   Ball          :: "'a set => ('a => bool) => bool"      -- "bounded universal quantifiers"
    34   Ball          :: "'a set => ('a => bool) => bool"      -- "bounded universal quantifiers"
    35   Bex           :: "'a set => ('a => bool) => bool"      -- "bounded existential quantifiers"
    35   Bex           :: "'a set => ('a => bool) => bool"      -- "bounded existential quantifiers"
       
    36   Bex1          :: "'a set => ('a => bool) => bool"      -- "bounded unique existential quantifiers"
    36   image         :: "('a => 'b) => 'a set => 'b set"      (infixr "`" 90)
    37   image         :: "('a => 'b) => 'a set => 'b set"      (infixr "`" 90)
    37   "op :"        :: "'a => 'a set => bool"                -- "membership"
    38   "op :"        :: "'a => 'a set => bool"                -- "membership"
    38 
    39 
    39 const_syntax
    40 const_syntax
    40   "op :"  ("op :")
    41   "op :"  ("op :")
   115   "@UNION1"     :: "pttrns => 'b set => 'b set"           ("(3UN _./ _)" 10)
   116   "@UNION1"     :: "pttrns => 'b set => 'b set"           ("(3UN _./ _)" 10)
   116   "@INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3INT _:_./ _)" 10)
   117   "@INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3INT _:_./ _)" 10)
   117   "@UNION"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3UN _:_./ _)" 10)
   118   "@UNION"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3UN _:_./ _)" 10)
   118   "_Ball"       :: "pttrn => 'a set => bool => bool"      ("(3ALL _:_./ _)" [0, 0, 10] 10)
   119   "_Ball"       :: "pttrn => 'a set => bool => bool"      ("(3ALL _:_./ _)" [0, 0, 10] 10)
   119   "_Bex"        :: "pttrn => 'a set => bool => bool"      ("(3EX _:_./ _)" [0, 0, 10] 10)
   120   "_Bex"        :: "pttrn => 'a set => bool => bool"      ("(3EX _:_./ _)" [0, 0, 10] 10)
       
   121   "_Bex1"       :: "pttrn => 'a set => bool => bool"      ("(3EX! _:_./ _)" [0, 0, 10] 10)
   120   "_Bleast"       :: "id => 'a set => bool => 'a"      ("(3LEAST _:_./ _)" [0, 0, 10] 10)
   122   "_Bleast"       :: "id => 'a set => bool => 'a"      ("(3LEAST _:_./ _)" [0, 0, 10] 10)
   121 
   123 
   122 syntax (HOL)
   124 syntax (HOL)
   123   "_Ball"       :: "pttrn => 'a set => bool => bool"      ("(3! _:_./ _)" [0, 0, 10] 10)
   125   "_Ball"       :: "pttrn => 'a set => bool => bool"      ("(3! _:_./ _)" [0, 0, 10] 10)
   124   "_Bex"        :: "pttrn => 'a set => bool => bool"      ("(3? _:_./ _)" [0, 0, 10] 10)
   126   "_Bex"        :: "pttrn => 'a set => bool => bool"      ("(3? _:_./ _)" [0, 0, 10] 10)
       
   127   "_Bex1"       :: "pttrn => 'a set => bool => bool"      ("(3?! _:_./ _)" [0, 0, 10] 10)
   125 
   128 
   126 translations
   129 translations
   127   "{x, xs}"     == "insert x {xs}"
   130   "{x, xs}"     == "insert x {xs}"
   128   "{x}"         == "insert x {}"
   131   "{x}"         == "insert x {}"
   129   "{x. P}"      == "Collect (%x. P)"
   132   "{x. P}"      == "Collect (%x. P)"
   136   "INT x. B"    == "INT x:UNIV. B"
   139   "INT x. B"    == "INT x:UNIV. B"
   137   "UN x:A. B"   == "UNION A (%x. B)"
   140   "UN x:A. B"   == "UNION A (%x. B)"
   138   "INT x:A. B"  == "INTER A (%x. B)"
   141   "INT x:A. B"  == "INTER A (%x. B)"
   139   "ALL x:A. P"  == "Ball A (%x. P)"
   142   "ALL x:A. P"  == "Ball A (%x. P)"
   140   "EX x:A. P"   == "Bex A (%x. P)"
   143   "EX x:A. P"   == "Bex A (%x. P)"
       
   144   "EX! x:A. P"  == "Bex1 A (%x. P)"
   141   "LEAST x:A. P" => "LEAST x. x:A & P"
   145   "LEAST x:A. P" => "LEAST x. x:A & P"
   142 
   146 
   143 syntax (xsymbols)
   147 syntax (xsymbols)
   144   "_Ball"       :: "pttrn => 'a set => bool => bool"      ("(3\<forall>_\<in>_./ _)" [0, 0, 10] 10)
   148   "_Ball"       :: "pttrn => 'a set => bool => bool"      ("(3\<forall>_\<in>_./ _)" [0, 0, 10] 10)
   145   "_Bex"        :: "pttrn => 'a set => bool => bool"      ("(3\<exists>_\<in>_./ _)" [0, 0, 10] 10)
   149   "_Bex"        :: "pttrn => 'a set => bool => bool"      ("(3\<exists>_\<in>_./ _)" [0, 0, 10] 10)
       
   150   "_Bex1"       :: "pttrn => 'a set => bool => bool"      ("(3\<exists>!_\<in>_./ _)" [0, 0, 10] 10)
   146   "_Bleast"     :: "id => 'a set => bool => 'a"           ("(3LEAST_\<in>_./ _)" [0, 0, 10] 10)
   151   "_Bleast"     :: "id => 'a set => bool => 'a"           ("(3LEAST_\<in>_./ _)" [0, 0, 10] 10)
   147 
   152 
   148 syntax (HTML output)
   153 syntax (HTML output)
   149   "_Ball"       :: "pttrn => 'a set => bool => bool"      ("(3\<forall>_\<in>_./ _)" [0, 0, 10] 10)
   154   "_Ball"       :: "pttrn => 'a set => bool => bool"      ("(3\<forall>_\<in>_./ _)" [0, 0, 10] 10)
   150   "_Bex"        :: "pttrn => 'a set => bool => bool"      ("(3\<exists>_\<in>_./ _)" [0, 0, 10] 10)
   155   "_Bex"        :: "pttrn => 'a set => bool => bool"      ("(3\<exists>_\<in>_./ _)" [0, 0, 10] 10)
       
   156   "_Bex1"       :: "pttrn => 'a set => bool => bool"      ("(3\<exists>!_\<in>_./ _)" [0, 0, 10] 10)
   151 
   157 
   152 syntax (xsymbols)
   158 syntax (xsymbols)
   153   "@Collect"    :: "idt => 'a set => bool => 'a set"      ("(1{_ \<in>/ _./ _})")
   159   "@Collect"    :: "idt => 'a set => bool => 'a set"      ("(1{_ \<in>/ _./ _})")
   154   "@UNION1"     :: "pttrns => 'b set => 'b set"           ("(3\<Union>_./ _)" 10)
   160   "@UNION1"     :: "pttrns => 'b set => 'b set"           ("(3\<Union>_./ _)" 10)
   155   "@INTER1"     :: "pttrns => 'b set => 'b set"           ("(3\<Inter>_./ _)" 10)
   161   "@INTER1"     :: "pttrns => 'b set => 'b set"           ("(3\<Inter>_./ _)" 10)
   176 syntax (output)
   182 syntax (output)
   177   "_setlessAll" :: "[idt, 'a, bool] => bool"  ("(3ALL _<_./ _)"  [0, 0, 10] 10)
   183   "_setlessAll" :: "[idt, 'a, bool] => bool"  ("(3ALL _<_./ _)"  [0, 0, 10] 10)
   178   "_setlessEx"  :: "[idt, 'a, bool] => bool"  ("(3EX _<_./ _)"  [0, 0, 10] 10)
   184   "_setlessEx"  :: "[idt, 'a, bool] => bool"  ("(3EX _<_./ _)"  [0, 0, 10] 10)
   179   "_setleAll"   :: "[idt, 'a, bool] => bool"  ("(3ALL _<=_./ _)" [0, 0, 10] 10)
   185   "_setleAll"   :: "[idt, 'a, bool] => bool"  ("(3ALL _<=_./ _)" [0, 0, 10] 10)
   180   "_setleEx"    :: "[idt, 'a, bool] => bool"  ("(3EX _<=_./ _)" [0, 0, 10] 10)
   186   "_setleEx"    :: "[idt, 'a, bool] => bool"  ("(3EX _<=_./ _)" [0, 0, 10] 10)
       
   187   "_setleEx1"   :: "[idt, 'a, bool] => bool"  ("(3EX! _<=_./ _)" [0, 0, 10] 10)
   181 
   188 
   182 syntax (xsymbols)
   189 syntax (xsymbols)
   183   "_setlessAll" :: "[idt, 'a, bool] => bool"   ("(3\<forall>_\<subset>_./ _)"  [0, 0, 10] 10)
   190   "_setlessAll" :: "[idt, 'a, bool] => bool"   ("(3\<forall>_\<subset>_./ _)"  [0, 0, 10] 10)
   184   "_setlessEx"  :: "[idt, 'a, bool] => bool"   ("(3\<exists>_\<subset>_./ _)"  [0, 0, 10] 10)
   191   "_setlessEx"  :: "[idt, 'a, bool] => bool"   ("(3\<exists>_\<subset>_./ _)"  [0, 0, 10] 10)
   185   "_setleAll"   :: "[idt, 'a, bool] => bool"   ("(3\<forall>_\<subseteq>_./ _)" [0, 0, 10] 10)
   192   "_setleAll"   :: "[idt, 'a, bool] => bool"   ("(3\<forall>_\<subseteq>_./ _)" [0, 0, 10] 10)
   186   "_setleEx"    :: "[idt, 'a, bool] => bool"   ("(3\<exists>_\<subseteq>_./ _)" [0, 0, 10] 10)
   193   "_setleEx"    :: "[idt, 'a, bool] => bool"   ("(3\<exists>_\<subseteq>_./ _)" [0, 0, 10] 10)
       
   194   "_setleEx1"   :: "[idt, 'a, bool] => bool"   ("(3\<exists>!_\<subseteq>_./ _)" [0, 0, 10] 10)
   187 
   195 
   188 syntax (HOL output)
   196 syntax (HOL output)
   189   "_setlessAll" :: "[idt, 'a, bool] => bool"   ("(3! _<_./ _)"  [0, 0, 10] 10)
   197   "_setlessAll" :: "[idt, 'a, bool] => bool"   ("(3! _<_./ _)"  [0, 0, 10] 10)
   190   "_setlessEx"  :: "[idt, 'a, bool] => bool"   ("(3? _<_./ _)"  [0, 0, 10] 10)
   198   "_setlessEx"  :: "[idt, 'a, bool] => bool"   ("(3? _<_./ _)"  [0, 0, 10] 10)
   191   "_setleAll"   :: "[idt, 'a, bool] => bool"   ("(3! _<=_./ _)" [0, 0, 10] 10)
   199   "_setleAll"   :: "[idt, 'a, bool] => bool"   ("(3! _<=_./ _)" [0, 0, 10] 10)
   192   "_setleEx"    :: "[idt, 'a, bool] => bool"   ("(3? _<=_./ _)" [0, 0, 10] 10)
   200   "_setleEx"    :: "[idt, 'a, bool] => bool"   ("(3? _<=_./ _)" [0, 0, 10] 10)
       
   201   "_setleEx1"   :: "[idt, 'a, bool] => bool"   ("(3?! _<=_./ _)" [0, 0, 10] 10)
   193 
   202 
   194 syntax (HTML output)
   203 syntax (HTML output)
   195   "_setlessAll" :: "[idt, 'a, bool] => bool"   ("(3\<forall>_\<subset>_./ _)"  [0, 0, 10] 10)
   204   "_setlessAll" :: "[idt, 'a, bool] => bool"   ("(3\<forall>_\<subset>_./ _)"  [0, 0, 10] 10)
   196   "_setlessEx"  :: "[idt, 'a, bool] => bool"   ("(3\<exists>_\<subset>_./ _)"  [0, 0, 10] 10)
   205   "_setlessEx"  :: "[idt, 'a, bool] => bool"   ("(3\<exists>_\<subset>_./ _)"  [0, 0, 10] 10)
   197   "_setleAll"   :: "[idt, 'a, bool] => bool"   ("(3\<forall>_\<subseteq>_./ _)" [0, 0, 10] 10)
   206   "_setleAll"   :: "[idt, 'a, bool] => bool"   ("(3\<forall>_\<subseteq>_./ _)" [0, 0, 10] 10)
   198   "_setleEx"    :: "[idt, 'a, bool] => bool"   ("(3\<exists>_\<subseteq>_./ _)" [0, 0, 10] 10)
   207   "_setleEx"    :: "[idt, 'a, bool] => bool"   ("(3\<exists>_\<subseteq>_./ _)" [0, 0, 10] 10)
       
   208   "_setleEx1"   :: "[idt, 'a, bool] => bool"   ("(3\<exists>!_\<subseteq>_./ _)" [0, 0, 10] 10)
   199 
   209 
   200 translations
   210 translations
   201  "\<forall>A\<subset>B. P"   =>  "ALL A. A \<subset> B --> P"
   211  "\<forall>A\<subset>B. P"   =>  "ALL A. A \<subset> B --> P"
   202  "\<exists>A\<subset>B. P"    =>  "EX A. A \<subset> B & P"
   212  "\<exists>A\<subset>B. P"   =>  "EX A. A \<subset> B & P"
   203  "\<forall>A\<subseteq>B. P"  =>  "ALL A. A \<subseteq> B --> P"
   213  "\<forall>A\<subseteq>B. P"   =>  "ALL A. A \<subseteq> B --> P"
   204  "\<exists>A\<subseteq>B. P"   =>  "EX A. A \<subseteq> B & P"
   214  "\<exists>A\<subseteq>B. P"   =>  "EX A. A \<subseteq> B & P"
       
   215  "\<exists>!A\<subseteq>B. P"  =>  "EX! A. A \<subseteq> B & P"
   205 
   216 
   206 print_translation {*
   217 print_translation {*
   207 let
   218 let
   208   fun
   219   fun
   209     all_tr' [Const ("_bound",_) $ Free (v,Type(T,_)), 
   220     all_tr' [Const ("_bound",_) $ Free (v,Type(T,_)), 
   314   "op :"
   325   "op :"
   315 
   326 
   316 defs
   327 defs
   317   Ball_def:     "Ball A P       == ALL x. x:A --> P(x)"
   328   Ball_def:     "Ball A P       == ALL x. x:A --> P(x)"
   318   Bex_def:      "Bex A P        == EX x. x:A & P(x)"
   329   Bex_def:      "Bex A P        == EX x. x:A & P(x)"
       
   330   Bex1_def:     "Bex1 A P       == EX! x. x:A & P(x)"
   319 
   331 
   320 defs (overloaded)
   332 defs (overloaded)
   321   subset_def:   "A <= B         == ALL x:A. x:B"
   333   subset_def:   "A <= B         == ALL x:A. x:B"
   322   psubset_def:  "A < B          == (A::'a set) <= B & ~ A=B"
   334   psubset_def:  "A < B          == (A::'a set) <= B & ~ A=B"
   323   Compl_def:    "- A            == {x. ~x:A}"
   335   Compl_def:    "- A            == {x. ~x:A}"