# HG changeset patch # User wenzelm # Date 1331499973 -3600 # Node ID bad72cba8a92030ae308f7af689e3acfe4a382fe # Parent 9100e6aa92728ceb001bb192d54d633df5396d51# Parent 11050f8e5f8e7f8925a29f3f468a68fa2d03534a merged diff -r 9100e6aa9272 -r bad72cba8a92 src/HOL/HOLCF/Deflation.thy --- a/src/HOL/HOLCF/Deflation.thy Sun Mar 11 20:18:38 2012 +0100 +++ b/src/HOL/HOLCF/Deflation.thy Sun Mar 11 22:06:13 2012 +0100 @@ -379,9 +379,9 @@ by simp qed -locale pcpo_ep_pair = ep_pair + - constrains e :: "'a::pcpo \ 'b::pcpo" - constrains p :: "'b::pcpo \ 'a::pcpo" +locale pcpo_ep_pair = ep_pair e p + for e :: "'a::pcpo \ 'b::pcpo" + and p :: "'b::pcpo \ 'a::pcpo" begin lemma e_strict [simp]: "e\\ = \" diff -r 9100e6aa9272 -r bad72cba8a92 src/HOL/HOLCF/Universal.thy --- a/src/HOL/HOLCF/Universal.thy Sun Mar 11 20:18:38 2012 +0100 +++ b/src/HOL/HOLCF/Universal.thy Sun Mar 11 22:06:13 2012 +0100 @@ -291,8 +291,8 @@ text {* We use a locale to parameterize the construction over a chain of approx functions on the type to be embedded. *} -locale bifinite_approx_chain = approx_chain + - constrains approx :: "nat \ 'a::bifinite \ 'a" +locale bifinite_approx_chain = + approx_chain approx for approx :: "nat \ 'a::bifinite \ 'a" begin subsubsection {* Choosing a maximal element from a finite set *} diff -r 9100e6aa9272 -r bad72cba8a92 src/HOL/Hahn_Banach/Function_Norm.thy --- a/src/HOL/Hahn_Banach/Function_Norm.thy Sun Mar 11 20:18:38 2012 +0100 +++ b/src/HOL/Hahn_Banach/Function_Norm.thy Sun Mar 11 22:06:13 2012 +0100 @@ -21,7 +21,8 @@ linear forms: *} -locale continuous = var_V + norm_syntax + linearform + +locale continuous = linearform + + fixes norm :: "_ \ real" ("\_\") assumes bounded: "\c. \x \ V. \f x\ \ c * \x\" declare continuous.intro [intro?] continuous_axioms.intro [intro?] @@ -30,11 +31,11 @@ fixes norm :: "_ \ real" ("\_\") assumes "linearform V f" assumes r: "\x. x \ V \ \f x\ \ c * \x\" - shows "continuous V norm f" + shows "continuous V f norm" proof show "linearform V f" by fact from r have "\c. \x\V. \f x\ \ c * \x\" by blast - then show "continuous_axioms V norm f" .. + then show "continuous_axioms V f norm" .. qed @@ -71,7 +72,8 @@ supremum exists (otherwise it is undefined). *} -locale fn_norm = norm_syntax + +locale fn_norm = + fixes norm :: "_ \ real" ("\_\") fixes B defines "B V f \ {0} \ {\f x\ / \x\ | x. x \ 0 \ x \ V}" fixes fn_norm ("\_\\_" [0, 1000] 999) defines "\f\\V \ \(B V f)" @@ -87,10 +89,10 @@ *} lemma (in normed_vectorspace_with_fn_norm) fn_norm_works: - assumes "continuous V norm f" + assumes "continuous V f norm" shows "lub (B V f) (\f\\V)" proof - - interpret continuous V norm f by fact + interpret continuous V f norm by fact txt {* The existence of the supremum is shown using the completeness of the reals. Completeness means, that every non-empty bounded set of reals has a supremum. *} @@ -154,39 +156,39 @@ qed lemma (in normed_vectorspace_with_fn_norm) fn_norm_ub [iff?]: - assumes "continuous V norm f" + assumes "continuous V f norm" assumes b: "b \ B V f" shows "b \ \f\\V" proof - - interpret continuous V norm f by fact + interpret continuous V f norm by fact have "lub (B V f) (\f\\V)" - using `continuous V norm f` by (rule fn_norm_works) + using `continuous V f norm` by (rule fn_norm_works) from this and b show ?thesis .. qed lemma (in normed_vectorspace_with_fn_norm) fn_norm_leastB: - assumes "continuous V norm f" + assumes "continuous V f norm" assumes b: "\b. b \ B V f \ b \ y" shows "\f\\V \ y" proof - - interpret continuous V norm f by fact + interpret continuous V f norm by fact have "lub (B V f) (\f\\V)" - using `continuous V norm f` by (rule fn_norm_works) + using `continuous V f norm` by (rule fn_norm_works) from this and b show ?thesis .. qed text {* The norm of a continuous function is always @{text "\ 0"}. *} lemma (in normed_vectorspace_with_fn_norm) fn_norm_ge_zero [iff]: - assumes "continuous V norm f" + assumes "continuous V f norm" shows "0 \ \f\\V" proof - - interpret continuous V norm f by fact + interpret continuous V f norm by fact txt {* The function norm is defined as the supremum of @{text B}. So it is @{text "\ 0"} if all elements in @{text B} are @{text "\ 0"}, provided the supremum exists and @{text B} is not empty. *} have "lub (B V f) (\f\\V)" - using `continuous V norm f` by (rule fn_norm_works) + using `continuous V f norm` by (rule fn_norm_works) moreover have "0 \ B V f" .. ultimately show ?thesis .. qed @@ -199,11 +201,11 @@ *} lemma (in normed_vectorspace_with_fn_norm) fn_norm_le_cong: - assumes "continuous V norm f" "linearform V f" + assumes "continuous V f norm" "linearform V f" assumes x: "x \ V" shows "\f x\ \ \f\\V * \x\" proof - - interpret continuous V norm f by fact + interpret continuous V f norm by fact interpret linearform V f by fact show ?thesis proof cases @@ -212,7 +214,7 @@ also have "f 0 = 0" by rule unfold_locales also have "\\\ = 0" by simp also have a: "0 \ \f\\V" - using `continuous V norm f` by (rule fn_norm_ge_zero) + using `continuous V f norm` by (rule fn_norm_ge_zero) from x have "0 \ norm x" .. with a have "0 \ \f\\V * \x\" by (simp add: zero_le_mult_iff) finally show "\f x\ \ \f\\V * \x\" . @@ -225,7 +227,7 @@ from x show "0 \ \x\" .. from x and neq have "\f x\ * inverse \x\ \ B V f" by (auto simp add: B_def divide_inverse) - with `continuous V norm f` show "\f x\ * inverse \x\ \ \f\\V" + with `continuous V f norm` show "\f x\ * inverse \x\ \ \f\\V" by (rule fn_norm_ub) qed finally show ?thesis . @@ -241,11 +243,11 @@ *} lemma (in normed_vectorspace_with_fn_norm) fn_norm_least [intro?]: - assumes "continuous V norm f" + assumes "continuous V f norm" assumes ineq: "\x \ V. \f x\ \ c * \x\" and ge: "0 \ c" shows "\f\\V \ c" proof - - interpret continuous V norm f by fact + interpret continuous V f norm by fact show ?thesis proof (rule fn_norm_leastB [folded B_def fn_norm_def]) fix b assume b: "b \ B V f" @@ -272,7 +274,7 @@ qed finally show ?thesis . qed - qed (insert `continuous V norm f`, simp_all add: continuous_def) + qed (insert `continuous V f norm`, simp_all add: continuous_def) qed end diff -r 9100e6aa9272 -r bad72cba8a92 src/HOL/Hahn_Banach/Hahn_Banach.thy --- a/src/HOL/Hahn_Banach/Hahn_Banach.thy Sun Mar 11 20:18:38 2012 +0100 +++ b/src/HOL/Hahn_Banach/Hahn_Banach.thy Sun Mar 11 22:06:13 2012 +0100 @@ -356,9 +356,9 @@ fixes fn_norm ("\_\\_" [0, 1000] 999) defines "\V f. \f\\V \ \(B V f)" assumes E_norm: "normed_vectorspace E norm" and FE: "subspace F E" - and linearform: "linearform F f" and "continuous F norm f" + and linearform: "linearform F f" and "continuous F f norm" shows "\g. linearform E g - \ continuous E norm g + \ continuous E g norm \ (\x \ F. g x = f x) \ \g\\E = \f\\F" proof - @@ -367,7 +367,7 @@ by (auto simp: B_def fn_norm_def) intro_locales interpret subspace F E by fact interpret linearform F f by fact - interpret continuous F norm f by fact + interpret continuous F f norm by fact have E: "vectorspace E" by intro_locales have F: "vectorspace F" by rule intro_locales have F_norm: "normed_vectorspace F norm" @@ -375,7 +375,7 @@ have ge_zero: "0 \ \f\\F" by (rule normed_vectorspace_with_fn_norm.fn_norm_ge_zero [OF normed_vectorspace_with_fn_norm.intro, - OF F_norm `continuous F norm f` , folded B_def fn_norm_def]) + OF F_norm `continuous F f norm` , folded B_def fn_norm_def]) txt {* We define a function @{text p} on @{text E} as follows: @{text "p x = \f\ \ \x\"} *} def p \ "\x. \f\\F * \x\" @@ -422,7 +422,7 @@ have "\x \ F. \f x\ \ p x" proof fix x assume "x \ F" - with `continuous F norm f` and linearform + with `continuous F f norm` and linearform show "\f x\ \ p x" unfolding p_def by (rule normed_vectorspace_with_fn_norm.fn_norm_le_cong [OF normed_vectorspace_with_fn_norm.intro, @@ -442,7 +442,7 @@ txt {* We furthermore have to show that @{text g} is also continuous: *} - have g_cont: "continuous E norm g" using linearformE + have g_cont: "continuous E g norm" using linearformE proof fix x assume "x \ E" with b show "\g x\ \ \f\\F * \x\" @@ -500,7 +500,7 @@ show "0 \ \g\\E" using g_cont by (rule fn_norm_ge_zero [of g, folded B_def fn_norm_def]) - show "continuous F norm f" by fact + show "continuous F f norm" by fact qed qed with linearformE a g_cont show ?thesis by blast diff -r 9100e6aa9272 -r bad72cba8a92 src/HOL/Hahn_Banach/Normed_Space.thy --- a/src/HOL/Hahn_Banach/Normed_Space.thy Sun Mar 11 20:18:38 2012 +0100 +++ b/src/HOL/Hahn_Banach/Normed_Space.thy Sun Mar 11 22:06:13 2012 +0100 @@ -16,11 +16,9 @@ definite, absolute homogenous and subadditive. *} -locale norm_syntax = +locale seminorm = + fixes V :: "'a\{minus, plus, zero, uminus} set" fixes norm :: "'a \ real" ("\_\") - -locale seminorm = var_V + norm_syntax + - constrains V :: "'a\{minus, plus, zero, uminus} set" assumes ge_zero [iff?]: "x \ V \ 0 \ \x\" and abs_homogenous [iff?]: "x \ V \ \a \ x\ = \a\ * \x\" and subadditive [iff?]: "x \ V \ y \ V \ \x + y\ \ \x\ + \y\" diff -r 9100e6aa9272 -r bad72cba8a92 src/HOL/Hahn_Banach/Vector_Space.thy --- a/src/HOL/Hahn_Banach/Vector_Space.thy Sun Mar 11 20:18:38 2012 +0100 +++ b/src/HOL/Hahn_Banach/Vector_Space.thy Sun Mar 11 22:06:13 2012 +0100 @@ -38,9 +38,8 @@ the neutral element of scalar multiplication. *} -locale var_V = fixes V - -locale vectorspace = var_V + +locale vectorspace = + fixes V assumes non_empty [iff, intro?]: "V \ {}" and add_closed [iff]: "x \ V \ y \ V \ x + y \ V" and mult_closed [iff]: "x \ V \ a \ x \ V" diff -r 9100e6aa9272 -r bad72cba8a92 src/HOL/Library/Numeral_Type.thy --- a/src/HOL/Library/Numeral_Type.thy Sun Mar 11 20:18:38 2012 +0100 +++ b/src/HOL/Library/Numeral_Type.thy Sun Mar 11 22:06:13 2012 +0100 @@ -135,8 +135,8 @@ end -locale mod_ring = mod_type + - constrains n :: int +locale mod_ring = mod_type n Rep Abs + for n :: int and Rep :: "'a::{number_ring} \ int" and Abs :: "int \ 'a::{number_ring}" begin diff -r 9100e6aa9272 -r bad72cba8a92 src/HOL/RealVector.thy --- a/src/HOL/RealVector.thy Sun Mar 11 20:18:38 2012 +0100 +++ b/src/HOL/RealVector.thy Sun Mar 11 22:06:13 2012 +0100 @@ -954,8 +954,7 @@ subsection {* Bounded Linear and Bilinear Operators *} -locale bounded_linear = additive + - constrains f :: "'a::real_normed_vector \ 'b::real_normed_vector" +locale bounded_linear = additive f for f :: "'a::real_normed_vector \ 'b::real_normed_vector" + assumes scaleR: "f (scaleR r x) = scaleR r (f x)" assumes bounded: "\K. \x. norm (f x) \ norm x * K" begin diff -r 9100e6aa9272 -r bad72cba8a92 src/Pure/General/name_space.ML --- a/src/Pure/General/name_space.ML Sun Mar 11 20:18:38 2012 +0100 +++ b/src/Pure/General/name_space.ML Sun Mar 11 22:06:13 2012 +0100 @@ -14,6 +14,7 @@ type T val empty: string -> T val kind_of: T -> string + val defined_entry: T -> string -> bool val the_entry: T -> string -> {concealed: bool, group: serial option, theory_name: string, pos: Position.T, id: serial} val entry_ord: T -> string * string -> order @@ -117,6 +118,8 @@ fun kind_of (Name_Space {kind, ...}) = kind; +fun defined_entry (Name_Space {entries, ...}) = Symtab.defined entries; + fun the_entry (Name_Space {kind, entries, ...}) name = (case Symtab.lookup entries name of NONE => error ("Unknown " ^ kind ^ " " ^ quote name) diff -r 9100e6aa9272 -r bad72cba8a92 src/Pure/Isar/locale.ML --- a/src/Pure/Isar/locale.ML Sun Mar 11 20:18:38 2012 +0100 +++ b/src/Pure/Isar/locale.ML Sun Mar 11 22:06:13 2012 +0100 @@ -291,7 +291,7 @@ in (* Note that while identifiers always have the external (exported) view, activate_dep - is presented with the internal view. *) + is presented with the internal view. *) fun roundup thy activate_dep export (name, morph) (marked, input) = let @@ -488,13 +488,9 @@ else (Idents.get context, context) (* add new registrations with inherited mixins *) - |> roundup thy (add_reg thy export) export (name, morph) - |> snd + |> (snd o roundup thy (add_reg thy export) export (name, morph)) (* add mixin *) - |> - (case mixin of - NONE => I - | SOME mixin => amend_registration (name, morph) mixin export) + |> (case mixin of NONE => I | SOME mixin => amend_registration (name, morph) mixin export) (* activate import hierarchy as far as not already active *) |> activate_facts (SOME export) (name, morph) end; diff -r 9100e6aa9272 -r bad72cba8a92 src/Pure/variable.ML --- a/src/Pure/variable.ML Sun Mar 11 20:18:38 2012 +0100 +++ b/src/Pure/variable.ML Sun Mar 11 22:06:13 2012 +0100 @@ -292,8 +292,8 @@ (* specialized name space *) -fun is_fixed ctxt x = can (Name_Space.the_entry (fixes_space ctxt)) x; -fun newly_fixed inner outer x = is_fixed inner x andalso not (is_fixed outer x); +val is_fixed = Name_Space.defined_entry o fixes_space; +fun newly_fixed inner outer = is_fixed inner andf (not o is_fixed outer); val fixed_ord = Name_Space.entry_ord o fixes_space; val intern_fixed = Name_Space.intern o fixes_space; @@ -406,7 +406,7 @@ fun export_inst inner outer = let val declared_outer = is_declared outer; - fun still_fixed x = is_fixed outer x orelse not (is_fixed inner x); + val still_fixed = not o newly_fixed inner outer; val gen_fixes = Symtab.fold (fn (y, _) => not (is_fixed outer y) ? cons y)