src/HOL/Set.thy
changeset 21404 eb85850d3eb7
parent 21384 2b58b308300c
child 21524 7843e2fd14a9
equal deleted inserted replaced
21403:dd58f13a8eb4 21404:eb85850d3eb7
    36   Bex1          :: "'a set => ('a => bool) => bool"      -- "bounded unique existential quantifiers"
    36   Bex1          :: "'a set => ('a => bool) => bool"      -- "bounded unique existential quantifiers"
    37   image         :: "('a => 'b) => 'a set => 'b set"      (infixr "`" 90)
    37   image         :: "('a => 'b) => 'a set => 'b set"      (infixr "`" 90)
    38   "op :"        :: "'a => 'a set => bool"                -- "membership"
    38   "op :"        :: "'a => 'a set => bool"                -- "membership"
    39 
    39 
    40 notation
    40 notation
    41   "op :"  ("op :")
    41   "op :"  ("op :") and
    42   "op :"  ("(_/ : _)" [50, 51] 50)
    42   "op :"  ("(_/ : _)" [50, 51] 50)
    43 
    43 
    44 local
    44 local
    45 
    45 
    46 
    46 
    47 subsection {* Additional concrete syntax *}
    47 subsection {* Additional concrete syntax *}
    48 
    48 
    49 abbreviation
    49 abbreviation
    50   range :: "('a => 'b) => 'b set"             -- "of function"
    50   range :: "('a => 'b) => 'b set" where -- "of function"
    51   "range f == f ` UNIV"
    51   "range f == f ` UNIV"
    52 
    52 
    53 abbreviation
    53 abbreviation
    54   "not_mem x A == ~ (x : A)"                  -- "non-membership"
    54   "not_mem x A == ~ (x : A)" -- "non-membership"
    55 
    55 
    56 notation
    56 notation
    57   not_mem  ("op ~:")
    57   not_mem  ("op ~:") and
    58   not_mem  ("(_/ ~: _)" [50, 51] 50)
    58   not_mem  ("(_/ ~: _)" [50, 51] 50)
    59 
    59 
    60 notation (xsymbols)
    60 notation (xsymbols)
    61   "op Int"  (infixl "\<inter>" 70)
    61   "op Int"  (infixl "\<inter>" 70) and
    62   "op Un"  (infixl "\<union>" 65)
    62   "op Un"  (infixl "\<union>" 65) and
    63   "op :"  ("op \<in>")
    63   "op :"  ("op \<in>") and
    64   "op :"  ("(_/ \<in> _)" [50, 51] 50)
    64   "op :"  ("(_/ \<in> _)" [50, 51] 50) and
    65   not_mem  ("op \<notin>")
    65   not_mem  ("op \<notin>") and
    66   not_mem  ("(_/ \<notin> _)" [50, 51] 50)
    66   not_mem  ("(_/ \<notin> _)" [50, 51] 50) and
    67   Union  ("\<Union>_" [90] 90)
    67   Union  ("\<Union>_" [90] 90) and
    68   Inter  ("\<Inter>_" [90] 90)
    68   Inter  ("\<Inter>_" [90] 90)
    69 
    69 
    70 notation (HTML output)
    70 notation (HTML output)
    71   "op Int"  (infixl "\<inter>" 70)
    71   "op Int"  (infixl "\<inter>" 70) and
    72   "op Un"  (infixl "\<union>" 65)
    72   "op Un"  (infixl "\<union>" 65) and
    73   "op :"  ("op \<in>")
    73   "op :"  ("op \<in>") and
    74   "op :"  ("(_/ \<in> _)" [50, 51] 50)
    74   "op :"  ("(_/ \<in> _)" [50, 51] 50) and
    75   not_mem  ("op \<notin>")
    75   not_mem  ("op \<notin>") and
    76   not_mem  ("(_/ \<notin> _)" [50, 51] 50)
    76   not_mem  ("(_/ \<notin> _)" [50, 51] 50)
    77 
    77 
    78 syntax
    78 syntax
    79   "@Finset"     :: "args => 'a set"                       ("{(_)}")
    79   "@Finset"     :: "args => 'a set"                       ("{(_)}")
    80   "@Coll"       :: "pttrn => bool => 'a set"              ("(1{_./ _})")
    80   "@Coll"       :: "pttrn => bool => 'a set"              ("(1{_./ _})")
   147 instance set :: (type) ord
   147 instance set :: (type) ord
   148   subset_def:   "A <= B         == \<forall>x\<in>A. x \<in> B"
   148   subset_def:   "A <= B         == \<forall>x\<in>A. x \<in> B"
   149   psubset_def:  "A < B          == (A::'a set) <= B & ~ A=B" ..
   149   psubset_def:  "A < B          == (A::'a set) <= B & ~ A=B" ..
   150 
   150 
   151 abbreviation
   151 abbreviation
   152   subset :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool"
   152   subset :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool" where
   153   "subset == less"
   153   "subset == less"
   154   subset_eq :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool"
   154 
       
   155 abbreviation
       
   156   subset_eq :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool" where
   155   "subset_eq == less_eq"
   157   "subset_eq == less_eq"
   156 
   158 
   157 notation (output)
   159 notation (output)
   158   subset  ("op <")
   160   subset  ("op <") and
   159   subset  ("(_/ < _)" [50, 51] 50)
   161   subset  ("(_/ < _)" [50, 51] 50) and
   160   subset_eq  ("op <=")
   162   subset_eq  ("op <=") and
   161   subset_eq  ("(_/ <= _)" [50, 51] 50)
   163   subset_eq  ("(_/ <= _)" [50, 51] 50)
   162 
   164 
   163 notation (xsymbols)
   165 notation (xsymbols)
   164   subset  ("op \<subset>")
   166   subset  ("op \<subset>") and
   165   subset  ("(_/ \<subset> _)" [50, 51] 50)
   167   subset  ("(_/ \<subset> _)" [50, 51] 50) and
   166   subset_eq  ("op \<subseteq>")
   168   subset_eq  ("op \<subseteq>") and
   167   subset_eq  ("(_/ \<subseteq> _)" [50, 51] 50)
   169   subset_eq  ("(_/ \<subseteq> _)" [50, 51] 50)
   168 
   170 
   169 notation (HTML output)
   171 notation (HTML output)
   170   subset  ("op \<subset>")
   172   subset  ("op \<subset>") and
   171   subset  ("(_/ \<subset> _)" [50, 51] 50)
   173   subset  ("(_/ \<subset> _)" [50, 51] 50) and
   172   subset_eq  ("op \<subseteq>")
   174   subset_eq  ("op \<subseteq>") and
   173   subset_eq  ("(_/ \<subseteq> _)" [50, 51] 50)
   175   subset_eq  ("(_/ \<subseteq> _)" [50, 51] 50)
   174 
   176 
   175 abbreviation (input)
   177 abbreviation (input)
   176   supset :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool"    (infixl "\<supset>" 50)
   178   supset :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool"  (infixl "\<supset>" 50) where
   177   "supset == greater"
   179   "supset == greater"
   178   supset_eq :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool"  (infixl "\<supseteq>" 50)
   180 
       
   181 abbreviation (input)
       
   182   supset_eq :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool"  (infixl "\<supseteq>" 50) where
   179   "supset_eq == greater_eq"
   183   "supset_eq == greater_eq"
   180 
   184 
   181 
   185 
   182 subsubsection "Bounded quantifiers"
   186 subsubsection "Bounded quantifiers"
   183 
   187 
   214  "\<exists>A\<subset>B. P"   =>  "EX A. A \<subset> B & P"
   218  "\<exists>A\<subset>B. P"   =>  "EX A. A \<subset> B & P"
   215  "\<forall>A\<subseteq>B. P"   =>  "ALL A. A \<subseteq> B --> P"
   219  "\<forall>A\<subseteq>B. P"   =>  "ALL A. A \<subseteq> B --> P"
   216  "\<exists>A\<subseteq>B. P"   =>  "EX A. A \<subseteq> B & P"
   220  "\<exists>A\<subseteq>B. P"   =>  "EX A. A \<subseteq> B & P"
   217  "\<exists>!A\<subseteq>B. P"  =>  "EX! A. A \<subseteq> B & P"
   221  "\<exists>!A\<subseteq>B. P"  =>  "EX! A. A \<subseteq> B & P"
   218 
   222 
       
   223 (* FIXME re-use version in Orderings.thy *)
   219 print_translation {*
   224 print_translation {*
   220 let
   225 let
   221   fun
   226   fun
   222     all_tr' [Const ("_bound",_) $ Free (v,Type(T,_)), 
   227     all_tr' [Const ("_bound",_) $ Free (v,Type(T,_)), 
   223              Const("op -->",_) $ (Const ("less",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] = 
   228              Const("op -->",_) $ (Const ("less",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] =