# HG changeset patch # User haftmann # Date 1535044179 0 # Node ID 9ca183045102454c1a239e2dbf9cf8978d5be6a0 # Parent 210b687cdbbe2e6248aea542dad1ddf9a5c9bb25 simplified syntax setup for big operators under image, retaining input abbreviations for backward compatibility diff -r 210b687cdbbe -r 9ca183045102 NEWS --- a/NEWS Thu Aug 23 17:09:37 2018 +0000 +++ b/NEWS Thu Aug 23 17:09:39 2018 +0000 @@ -14,6 +14,15 @@ specified in seconds; a negative value means it is disabled (default). +*** HOL *** + +* Simplified syntax setup for big operators under image. In rare +situations, type conversions are not inserted implicitly any longer +and need to be given explicitly. Auxiliary abbreviations INFIMUM, +SUPREMUM, UNION, INTER should now rarely occur in output and are just +retained as migration auxiliary. INCOMPATIBILITY. + + New in Isabelle2018 (August 2018) --------------------------------- diff -r 210b687cdbbe -r 9ca183045102 src/HOL/Analysis/Starlike.thy --- a/src/HOL/Analysis/Starlike.thy Thu Aug 23 17:09:37 2018 +0000 +++ b/src/HOL/Analysis/Starlike.thy Thu Aug 23 17:09:39 2018 +0000 @@ -1355,7 +1355,7 @@ proof safe fix i :: 'a assume i: "i \ Basis" - have "norm (x - y) < MINIMUM Basis ((\) x)" + have "norm (x - y) < Min (((\) x) ` Basis)" using y by (auto simp: dist_norm less_eq_real_def) also have "... \ x\i" using i by auto diff -r 210b687cdbbe -r 9ca183045102 src/HOL/Complete_Lattices.thy --- a/src/HOL/Complete_Lattices.thy Thu Aug 23 17:09:37 2018 +0000 +++ b/src/HOL/Complete_Lattices.thy Thu Aug 23 17:09:39 2018 +0000 @@ -18,7 +18,7 @@ fixes Inf :: "'a set \ 'a" ("\_" [900] 900) begin -abbreviation INFIMUM :: "'b set \ ('b \ 'a) \ 'a" +abbreviation (input) INFIMUM :: "'b set \ ('b \ 'a) \ 'a" \ \legacy\ where "INFIMUM A f \ \(f ` A)" lemma INF_image [simp]: "INFIMUM (f ` A) g = INFIMUM A (g \ f)" @@ -43,7 +43,7 @@ fixes Sup :: "'a set \ 'a" ("\_" [900] 900) begin -abbreviation SUPREMUM :: "'b set \ ('b \ 'a) \ 'a" +abbreviation (input) SUPREMUM :: "'b set \ ('b \ 'a) \ 'a" \ \legacy\ where "SUPREMUM A f \ \(f ` A)" lemma SUP_image [simp]: "SUPREMUM (f ` A) g = SUPREMUM A (g \ f)" @@ -64,12 +64,6 @@ end -text \ - Note: must use names @{const INFIMUM} and @{const SUPREMUM} here instead of - \INF\ and \SUP\ to allow the following syntax coexist - with the plain constant names. -\ - syntax (ASCII) "_INF1" :: "pttrns \ 'b \ 'b" ("(3INF _./ _)" [0, 10] 10) "_INF" :: "pttrn \ 'a set \ 'b \ 'b" ("(3INF _:_./ _)" [0, 0, 10] 10) @@ -89,17 +83,12 @@ "_SUP" :: "pttrn \ 'a set \ 'b \ 'b" ("(3\_\_./ _)" [0, 0, 10] 10) translations - "\x y. B" \ "\x. \y. B" - "\x. B" \ "\x \ CONST UNIV. B" - "\x\A. B" \ "CONST INFIMUM A (\x. B)" - "\x y. B" \ "\x. \y. B" - "\x. B" \ "\x \ CONST UNIV. B" - "\x\A. B" \ "CONST SUPREMUM A (\x. B)" - -print_translation \ - [Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax INFIMUM} @{syntax_const "_INF"}, - Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax SUPREMUM} @{syntax_const "_SUP"}] -\ \ \to avoid eta-contraction of body\ + "\x y. f" \ "\x. \y. f" + "\x. f" \ "\CONST range (\x. f)" + "\x\A. f" \ "CONST Inf ((\x. f) ` A)" + "\x y. f" \ "\x. \y. f" + "\x. f" \ "\CONST range (\x. f)" + "\x\A. f" \ "CONST Sup ((\x. f) ` A)" subsection \Abstract complete lattices\ @@ -852,14 +841,9 @@ subsubsection \Intersections of families\ -abbreviation INTER :: "'a set \ ('a \ 'b set) \ 'b set" +abbreviation (input) INTER :: "'a set \ ('a \ 'b set) \ 'b set" \ \legacy\ where "INTER \ INFIMUM" -text \ - Note: must use name @{const INTER} here instead of \INT\ - to allow the following syntax coexist with the plain constant name. -\ - syntax (ASCII) "_INTER1" :: "pttrns \ 'b set \ 'b set" ("(3INT _./ _)" [0, 10] 10) "_INTER" :: "pttrn \ 'a set \ 'b set \ 'b set" ("(3INT _:_./ _)" [0, 0, 10] 10) @@ -873,13 +857,9 @@ "_INTER" :: "pttrn \ 'a set \ 'b set \ 'b set" ("(3\_\_./ _)" [0, 0, 10] 10) translations - "\x y. B" \ "\x. \y. B" - "\x. B" \ "\x \ CONST UNIV. B" - "\x\A. B" \ "CONST INTER A (\x. B)" - -print_translation \ - [Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax INTER} @{syntax_const "_INTER"}] -\ \ \to avoid eta-contraction of body\ + "\x y. f" \ "\x. \y. f" + "\x. f" \ "\CONST range (\x. f)" + "\x\A. f" \ "CONST Inter ((\x. f) ` A)" lemma INTER_eq: "(\x\A. B x) = {y. \x\A. y \ B x}" by (auto intro!: INF_eqI) @@ -1021,14 +1001,9 @@ subsubsection \Unions of families\ -abbreviation UNION :: "'a set \ ('a \ 'b set) \ 'b set" +abbreviation (input) UNION :: "'a set \ ('a \ 'b set) \ 'b set" \ \legacy\ where "UNION \ SUPREMUM" -text \ - Note: must use name @{const UNION} here instead of \UN\ - to allow the following syntax coexist with the plain constant name. -\ - syntax (ASCII) "_UNION1" :: "pttrns => 'b set => 'b set" ("(3UN _./ _)" [0, 10] 10) "_UNION" :: "pttrn => 'a set => 'b set => 'b set" ("(3UN _:_./ _)" [0, 0, 10] 10) @@ -1042,9 +1017,9 @@ "_UNION" :: "pttrn => 'a set => 'b set => 'b set" ("(3\_\_./ _)" [0, 0, 10] 10) translations - "\x y. B" \ "\x. \y. B" - "\x. B" \ "\x \ CONST UNIV. B" - "\x\A. B" \ "CONST UNION A (\x. B)" + "\x y. f" \ "\x. \y. f" + "\x. f" \ "\CONST range (\x. f)" + "\x\A. f" \ "CONST Union ((\x. f) ` A)" text \ Note the difference between ordinary syntax of indexed @@ -1052,10 +1027,6 @@ and their \LaTeX\ rendition: @{term"\a\<^sub>1\A\<^sub>1. B"}. \ -print_translation \ - [Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax UNION} @{syntax_const "_UNION"}] -\ \ \to avoid eta-contraction of body\ - lemma disjoint_UN_iff: "disjnt A (\i\I. B i) \ (\i\I. disjnt A (B i))" by (auto simp: disjnt_def) diff -r 210b687cdbbe -r 9ca183045102 src/HOL/GCD.thy --- a/src/HOL/GCD.thy Thu Aug 23 17:09:37 2018 +0000 +++ b/src/HOL/GCD.thy Thu Aug 23 17:09:39 2018 +0000 @@ -146,15 +146,6 @@ class Gcd = gcd + fixes Gcd :: "'a set \ 'a" and Lcm :: "'a set \ 'a" -begin - -abbreviation GREATEST_COMMON_DIVISOR :: "'b set \ ('b \ 'a) \ 'a" - where "GREATEST_COMMON_DIVISOR A f \ Gcd (f ` A)" - -abbreviation LEAST_COMMON_MULTIPLE :: "'b set \ ('b \ 'a) \ 'a" - where "LEAST_COMMON_MULTIPLE A f \ Lcm (f ` A)" - -end syntax "_GCD1" :: "pttrns \ 'b \ 'b" ("(3GCD _./ _)" [0, 10] 10) @@ -163,17 +154,12 @@ "_LCM" :: "pttrn \ 'a set \ 'b \ 'b" ("(3LCM _\_./ _)" [0, 0, 10] 10) translations - "GCD x y. B" \ "GCD x. GCD y. B" - "GCD x. B" \ "GCD x \ CONST UNIV. B" - "GCD x\A. B" \ "CONST GREATEST_COMMON_DIVISOR A (\x. B)" - "LCM x y. B" \ "LCM x. LCM y. B" - "LCM x. B" \ "LCM x \ CONST UNIV. B" - "LCM x\A. B" \ "CONST LEAST_COMMON_MULTIPLE A (\x. B)" - -print_translation \ - [Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax GREATEST_COMMON_DIVISOR} @{syntax_const "_GCD"}, - Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax LEAST_COMMON_MULTIPLE} @{syntax_const "_LCM"}] -\ \ \to avoid eta-contraction of body\ + "GCD x y. f" \ "GCD x. GCD y. f" + "GCD x. f" \ "CONST Gcd (CONST range (\x. f))" + "GCD x\A. f" \ "CONST Gcd ((\x. f) ` A)" + "LCM x y. f" \ "LCM x. LCM y. f" + "LCM x. f" \ "CONST Lcm (CONST range (\x. f))" + "LCM x\A. f" \ "CONST Lcm ((\x. f) ` A)" class semiring_gcd = normalization_semidom + gcd + assumes gcd_dvd1 [iff]: "gcd a b dvd a" diff -r 210b687cdbbe -r 9ca183045102 src/HOL/Lattices_Big.thy --- a/src/HOL/Lattices_Big.thy Thu Aug 23 17:09:37 2018 +0000 +++ b/src/HOL/Lattices_Big.thy Thu Aug 23 17:09:39 2018 +0000 @@ -462,14 +462,8 @@ defines Min = Min.F and Max = Max.F .. -abbreviation MINIMUM :: "'b set \ ('b \ 'a) \ 'a" - where "MINIMUM A f \ Min(f ` A)" -abbreviation MAXIMUM :: "'b set \ ('b \ 'a) \ 'a" - where "MAXIMUM A f \ Max(f ` A)" - end - syntax (ASCII) "_MIN1" :: "pttrns \ 'b \ 'b" ("(3MIN _./ _)" [0, 10] 10) "_MIN" :: "pttrn \ 'a set \ 'b \ 'b" ("(3MIN _:_./ _)" [0, 0, 10] 10) @@ -489,17 +483,12 @@ "_MAX" :: "pttrn \ 'a set \ 'b \ 'b" ("(3MAX _\_./ _)" [0, 0, 10] 10) translations - "MIN x y. B" \ "MIN x. MIN y. B" - "MIN x. B" \ "MIN x \ CONST UNIV. B" - "MIN x\A. B" \ "CONST MINIMUM A (\x. B)" - "MAX x y. B" \ "MAX x. MAX y. B" - "MAX x. B" \ "MAX x \ CONST UNIV. B" - "MAX x\A. B" \ "CONST MAXIMUM A (\x. B)" - -print_translation \ - [Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax MINIMUM} @{syntax_const "_MIN"}, - Syntax_Trans.preserve_binder_abs2_tr' @{const_syntax MAXIMUM} @{syntax_const "_MAX"}] -\ \ \to avoid eta-contraction of body\ + "MIN x y. f" \ "MIN x. MIN y. f" + "MIN x. f" \ "CONST Min (CONST range (\x. f))" + "MIN x\A. f" \ "CONST Min ((\x. f) ` A)" + "MAX x y. f" \ "MAX x. MAX y. f" + "MAX x. f" \ "CONST Max (CONST range (\x. f))" + "MAX x\A. f" \ "CONST Max ((\x. f) ` A)" text \An aside: @{const Min}/@{const Max} on linear orders as special case of @{const Inf_fin}/@{const Sup_fin}\