src/HOL/Lattices_Big.thy
changeset 68796 9ca183045102
parent 68795 210b687cdbbe
child 68801 c898c2b1fd58
equal deleted inserted replaced
68795:210b687cdbbe 68796:9ca183045102
   460 sublocale Min: semilattice_order_set min less_eq less
   460 sublocale Min: semilattice_order_set min less_eq less
   461   + Max: semilattice_order_set max greater_eq greater
   461   + Max: semilattice_order_set max greater_eq greater
   462 defines
   462 defines
   463   Min = Min.F and Max = Max.F ..
   463   Min = Min.F and Max = Max.F ..
   464 
   464 
   465 abbreviation MINIMUM :: "'b set \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> 'a"
   465 end
   466   where "MINIMUM A f \<equiv> Min(f ` A)"
       
   467 abbreviation MAXIMUM :: "'b set \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> 'a"
       
   468   where "MAXIMUM A f \<equiv> Max(f ` A)"
       
   469 
       
   470 end
       
   471 
       
   472 
   466 
   473 syntax (ASCII)
   467 syntax (ASCII)
   474   "_MIN1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3MIN _./ _)" [0, 10] 10)
   468   "_MIN1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3MIN _./ _)" [0, 10] 10)
   475   "_MIN"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3MIN _:_./ _)" [0, 0, 10] 10)
   469   "_MIN"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3MIN _:_./ _)" [0, 0, 10] 10)
   476   "_MAX1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3MAX _./ _)" [0, 10] 10)
   470   "_MAX1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3MAX _./ _)" [0, 10] 10)
   487   "_MIN"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3MIN _\<in>_./ _)" [0, 0, 10] 10)
   481   "_MIN"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3MIN _\<in>_./ _)" [0, 0, 10] 10)
   488   "_MAX1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3MAX _./ _)" [0, 10] 10)
   482   "_MAX1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3MAX _./ _)" [0, 10] 10)
   489   "_MAX"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3MAX _\<in>_./ _)" [0, 0, 10] 10)
   483   "_MAX"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3MAX _\<in>_./ _)" [0, 0, 10] 10)
   490 
   484 
   491 translations
   485 translations
   492   "MIN x y. B"   \<rightleftharpoons> "MIN x. MIN y. B"
   486   "MIN x y. f"   \<rightleftharpoons> "MIN x. MIN y. f"
   493   "MIN x. B"     \<rightleftharpoons> "MIN x \<in> CONST UNIV. B"
   487   "MIN x. f"     \<rightleftharpoons> "CONST Min (CONST range (\<lambda>x. f))"
   494   "MIN x\<in>A. B"   \<rightleftharpoons> "CONST MINIMUM A (\<lambda>x. B)"
   488   "MIN x\<in>A. f"   \<rightleftharpoons> "CONST Min ((\<lambda>x. f) ` A)"
   495   "MAX x y. B"   \<rightleftharpoons> "MAX x. MAX y. B"
   489   "MAX x y. f"   \<rightleftharpoons> "MAX x. MAX y. f"
   496   "MAX x. B"     \<rightleftharpoons> "MAX x \<in> CONST UNIV. B"
   490   "MAX x. f"     \<rightleftharpoons> "CONST Max (CONST range (\<lambda>x. f))"
   497   "MAX x\<in>A. B"   \<rightleftharpoons> "CONST MAXIMUM A (\<lambda>x. B)"
   491   "MAX x\<in>A. f"   \<rightleftharpoons> "CONST Max ((\<lambda>x. f) ` A)"
   498 
       
   499 print_translation \<open>
       
   500   [Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax MINIMUM} @{syntax_const "_MIN"},
       
   501     Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax MAXIMUM} @{syntax_const "_MAX"}]
       
   502 \<close> \<comment> \<open>to avoid eta-contraction of body\<close>
       
   503 
   492 
   504 text \<open>An aside: @{const Min}/@{const Max} on linear orders as special case of @{const Inf_fin}/@{const Sup_fin}\<close>
   493 text \<open>An aside: @{const Min}/@{const Max} on linear orders as special case of @{const Inf_fin}/@{const Sup_fin}\<close>
   505 
   494 
   506 lemma Inf_fin_Min:
   495 lemma Inf_fin_Min:
   507   "Inf_fin = (Min :: 'a::{semilattice_inf, linorder} set \<Rightarrow> 'a)"
   496   "Inf_fin = (Min :: 'a::{semilattice_inf, linorder} set \<Rightarrow> 'a)"