# HG changeset patch # User wenzelm # Date 1140120720 -3600 # Node ID 1b3780be6cc25a2d0e111fb94e1d0636f23d0fd7 # Parent a1a251b297ddc4606d627902bd051d58f63067f1 new-style definitions/abbreviations; diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Complex/ex/Sqrt.thy --- a/src/HOL/Complex/ex/Sqrt.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Complex/ex/Sqrt.thy Thu Feb 16 21:12:00 2006 +0100 @@ -17,17 +17,17 @@ theorem. *} -constdefs - rationals :: "real set" ("\") - "\ \ {x. \m n. n \ 0 \ \x\ = real (m::nat) / real (n::nat)}" +definition + rationals ("\") + "\ = {x. \m n. n \ 0 \ \x\ = real (m::nat) / real (n::nat)}" -theorem rationals_rep: "x \ \ \ - \m n. n \ 0 \ \x\ = real m / real n \ gcd (m, n) = 1" +theorem rationals_rep [elim?]: + assumes "x \ \" + obtains m n where "n \ 0" and "\x\ = real m / real n" and "gcd (m, n) = 1" proof - - assume "x \ \" - then obtain m n :: nat where + from `x \ \` obtain m n :: nat where n: "n \ 0" and x_rat: "\x\ = real m / real n" - by (unfold rationals_def) blast + unfolding rationals_def by blast let ?gcd = "gcd (m, n)" from n have gcd: "?gcd \ 0" by (simp add: gcd_zero) let ?k = "m div ?gcd" @@ -58,14 +58,9 @@ with gcd_k gcd_l have "?gcd * ?gcd' = ?gcd" by simp with gcd show ?thesis by simp qed - ultimately show ?thesis by blast + ultimately show ?thesis .. qed -lemma [elim?]: "r \ \ \ - (\m n. n \ 0 \ \r\ = real m / real n \ gcd (m, n) = 1 \ C) - \ C" - using rationals_rep by blast - subsection {* Main theorem *} @@ -74,10 +69,11 @@ irrational. *} -theorem sqrt_prime_irrational: "prime p \ sqrt (real p) \ \" +theorem sqrt_prime_irrational: + assumes "prime p" + shows "sqrt (real p) \ \" proof - assume p_prime: "prime p" - then have p: "1 < p" by (simp add: prime_def) + from `prime p` have p: "1 < p" by (simp add: prime_def) assume "sqrt (real p) \ \" then obtain m n where n: "n \ 0" and sqrt_rat: "\sqrt (real p)\ = real m / real n" @@ -94,12 +90,12 @@ have "p dvd m \ p dvd n" proof from eq have "p dvd m\" .. - with p_prime show "p dvd m" by (rule prime_dvd_power_two) + with `prime p` show "p dvd m" by (rule prime_dvd_power_two) then obtain k where "m = p * k" .. with eq have "p * n\ = p\ * k\" by (auto simp add: power2_eq_square mult_ac) with p have "n\ = p * k\" by (simp add: power2_eq_square) then have "p dvd n\" .. - with p_prime show "p dvd n" by (rule prime_dvd_power_two) + with `prime p` show "p dvd n" by (rule prime_dvd_power_two) qed then have "p dvd gcd (m, n)" .. with gcd have "p dvd 1" by simp @@ -119,10 +115,11 @@ structure, it is probably closer to proofs seen in mathematics. *} -theorem "prime p \ sqrt (real p) \ \" +theorem + assumes "prime p" + shows "sqrt (real p) \ \" proof - assume p_prime: "prime p" - then have p: "1 < p" by (simp add: prime_def) + from `prime p` have p: "1 < p" by (simp add: prime_def) assume "sqrt (real p) \ \" then obtain m n where n: "n \ 0" and sqrt_rat: "\sqrt (real p)\ = real m / real n" @@ -134,12 +131,12 @@ also have "\ * real (n\) = real (p * n\)" by simp finally have eq: "m\ = p * n\" .. then have "p dvd m\" .. - with p_prime have dvd_m: "p dvd m" by (rule prime_dvd_power_two) + with `prime p` have dvd_m: "p dvd m" by (rule prime_dvd_power_two) then obtain k where "m = p * k" .. with eq have "p * n\ = p\ * k\" by (auto simp add: power2_eq_square mult_ac) with p have "n\ = p * k\" by (simp add: power2_eq_square) then have "p dvd n\" .. - with p_prime have "p dvd n" by (rule prime_dvd_power_two) + with `prime p` have "p dvd n" by (rule prime_dvd_power_two) with dvd_m have "p dvd gcd (m, n)" by (rule gcd_greatest) with gcd have "p dvd 1" by simp then have "p \ 1" by (simp add: dvd_imp_le) diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Lambda/Commutation.thy --- a/src/HOL/Lambda/Commutation.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Lambda/Commutation.thy Thu Feb 16 21:12:00 2006 +0100 @@ -10,25 +10,24 @@ subsection {* Basic definitions *} -constdefs +definition square :: "[('a \ 'a) set, ('a \ 'a) set, ('a \ 'a) set, ('a \ 'a) set] => bool" - "square R S T U == - \x y. (x, y) \ R --> (\z. (x, z) \ S --> (\u. (y, u) \ T \ (z, u) \ U))" + "square R S T U = + (\x y. (x, y) \ R --> (\z. (x, z) \ S --> (\u. (y, u) \ T \ (z, u) \ U)))" commute :: "[('a \ 'a) set, ('a \ 'a) set] => bool" - "commute R S == square R S S R" + "commute R S = square R S S R" diamond :: "('a \ 'a) set => bool" - "diamond R == commute R R" + "diamond R = commute R R" Church_Rosser :: "('a \ 'a) set => bool" - "Church_Rosser R == - \x y. (x, y) \ (R \ R^-1)^* --> (\z. (x, z) \ R^* \ (y, z) \ R^*)" + "Church_Rosser R = + (\x y. (x, y) \ (R \ R^-1)^* --> (\z. (x, z) \ R^* \ (y, z) \ R^*))" -syntax +abbreviation (output) confluent :: "('a \ 'a) set => bool" -translations - "confluent R" == "diamond (R^*)" + "confluent R = diamond (R^*)" subsection {* Basic lemmas *} diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Lambda/Eta.thy --- a/src/HOL/Lambda/Eta.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Lambda/Eta.thy Thu Feb 16 21:12:00 2006 +0100 @@ -21,14 +21,13 @@ consts eta :: "(dB \ dB) set" -syntax - "_eta" :: "[dB, dB] => bool" (infixl "-e>" 50) - "_eta_rtrancl" :: "[dB, dB] => bool" (infixl "-e>>" 50) - "_eta_reflcl" :: "[dB, dB] => bool" (infixl "-e>=" 50) -translations - "s -e> t" == "(s, t) \ eta" - "s -e>> t" == "(s, t) \ eta^*" - "s -e>= t" == "(s, t) \ eta^=" +abbreviation (output) + eta_red :: "[dB, dB] => bool" (infixl "-e>" 50) + "(s -e> t) = ((s, t) \ eta)" + eta_reds :: "[dB, dB] => bool" (infixl "-e>>" 50) + "(s -e>> t) = ((s, t) \ eta^*)" + eta_red0 :: "[dB, dB] => bool" (infixl "-e>=" 50) + "(s -e>= t) = ((s, t) \ eta^=)" inductive eta intros @@ -225,13 +224,12 @@ consts par_eta :: "(dB \ dB) set" -syntax - "_par_eta" :: "[dB, dB] => bool" (infixl "=e>" 50) -translations - "s =e> t" == "(s, t) \ par_eta" +abbreviation (output) + par_eta_red :: "[dB, dB] => bool" (infixl "=e>" 50) + "(s =e> t) = ((s, t) \ par_eta)" syntax (xsymbols) - "_par_eta" :: "[dB, dB] => bool" (infixl "\\<^sub>\" 50) + par_eta_red :: "[dB, dB] => bool" (infixl "\\<^sub>\" 50) inductive par_eta intros diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Lambda/Lambda.thy --- a/src/HOL/Lambda/Lambda.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Lambda/Lambda.thy Thu Feb 16 21:12:00 2006 +0100 @@ -56,15 +56,15 @@ consts beta :: "(dB \ dB) set" -syntax - "_beta" :: "[dB, dB] => bool" (infixl "->" 50) - "_beta_rtrancl" :: "[dB, dB] => bool" (infixl "->>" 50) +abbreviation (output) + beta_red :: "[dB, dB] => bool" (infixl "->" 50) + "(s -> t) = ((s, t) \ beta)" + beta_reds :: "[dB, dB] => bool" (infixl "->>" 50) + "(s ->> t) = ((s, t) \ beta^*)" + syntax (latex) - "_beta" :: "[dB, dB] => bool" (infixl "\\<^sub>\" 50) - "_beta_rtrancl" :: "[dB, dB] => bool" (infixl "\\<^sub>\\<^sup>*" 50) -translations - "s \\<^sub>\ t" == "(s, t) \ beta" - "s \\<^sub>\\<^sup>* t" == "(s, t) \ beta^*" + beta_red :: "[dB, dB] => bool" (infixl "\\<^sub>\" 50) + beta_reds :: "[dB, dB] => bool" (infixl "\\<^sub>\\<^sup>*" 50) inductive beta intros diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Lambda/ListApplication.thy --- a/src/HOL/Lambda/ListApplication.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Lambda/ListApplication.thy Thu Feb 16 21:12:00 2006 +0100 @@ -8,10 +8,9 @@ theory ListApplication imports Lambda begin -syntax - "_list_application" :: "dB => dB list => dB" (infixl "\\" 150) -translations - "t \\ ts" == "foldl (op \) t ts" +abbreviation (output) + list_application :: "dB => dB list => dB" (infixl "\\" 150) + "t \\ ts = foldl (op \) t ts" lemma apps_eq_tail_conv [iff]: "(r \\ ts = s \\ ts) = (r = s)" by (induct ts rule: rev_induct) auto diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Lambda/ListBeta.thy --- a/src/HOL/Lambda/ListBeta.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Lambda/ListBeta.thy Thu Feb 16 21:12:00 2006 +0100 @@ -12,10 +12,9 @@ Lifting beta-reduction to lists of terms, reducing exactly one element. *} -syntax - "_list_beta" :: "dB => dB => bool" (infixl "=>" 50) -translations - "rs => ss" == "(rs, ss) : step1 beta" +abbreviation (output) + list_beta :: "dB list => dB list => bool" (infixl "=>" 50) + "(rs => ss) = ((rs, ss) : step1 beta)" lemma head_Var_reduction: "Var n \\ rs -> v \ \ss. rs => ss \ v = Var n \\ ss" diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Lambda/ListOrder.thy --- a/src/HOL/Lambda/ListOrder.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Lambda/ListOrder.thy Thu Feb 16 21:12:00 2006 +0100 @@ -13,9 +13,9 @@ element. *} -constdefs +definition step1 :: "('a \ 'a) set => ('a list \ 'a list) set" - "step1 r == + "step1 r = {(ys, xs). \us z z' vs. xs = us @ z # vs \ (z', z) \ r \ ys = us @ z' # vs}" diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Lambda/ParRed.thy --- a/src/HOL/Lambda/ParRed.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Lambda/ParRed.thy Thu Feb 16 21:12:00 2006 +0100 @@ -17,10 +17,9 @@ consts par_beta :: "(dB \ dB) set" -syntax - par_beta :: "[dB, dB] => bool" (infixl "=>" 50) -translations - "s => t" == "(s, t) \ par_beta" +abbreviation (output) + par_beta_red :: "[dB, dB] => bool" (infixl "=>" 50) + "(s => t) = ((s, t) \ par_beta)" inductive par_beta intros diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Lambda/Type.thy --- a/src/HOL/Lambda/Type.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Lambda/Type.thy Thu Feb 16 21:12:00 2006 +0100 @@ -11,9 +11,9 @@ subsection {* Environments *} -constdefs +definition shift :: "(nat \ 'a) \ nat \ 'a \ nat \ 'a" ("_<_:_>" [90, 0, 0] 91) - "e \ \j. if j < i then e j else if j = i then a else e (j - 1)" + "e = (\j. if j < i then e j else if j = i then a else e (j - 1))" syntax (xsymbols) shift :: "(nat \ 'a) \ nat \ 'a \ nat \ 'a" ("_\_:_\" [90, 0, 0] 91) syntax (HTML output) @@ -47,21 +47,23 @@ typing :: "((nat \ type) \ dB \ type) set" typings :: "(nat \ type) \ dB list \ type list \ bool" -syntax - "_funs" :: "type list \ type \ type" (infixr "=>>" 200) - "_typing" :: "(nat \ type) \ dB \ type \ bool" ("_ |- _ : _" [50, 50, 50] 50) - "_typings" :: "(nat \ type) \ dB list \ type list \ bool" +abbreviation (output) + funs :: "type list \ type \ type" (infixr "=>>" 200) + "Ts =>> T = foldr Fun Ts T" + + typing_rel :: "(nat \ type) \ dB \ type \ bool" ("_ |- _ : _" [50, 50, 50] 50) + "(env |- t : T) = ((env, t, T) \ typing)" + + typings_rel :: "(nat \ type) \ dB list \ type list \ bool" ("_ ||- _ : _" [50, 50, 50] 50) + "(env ||- ts : Ts) = typings env ts Ts" + syntax (xsymbols) - "_typing" :: "(nat \ type) \ dB \ type \ bool" ("_ \ _ : _" [50, 50, 50] 50) + typing_rel :: "(nat \ type) \ dB \ type \ bool" ("_ \ _ : _" [50, 50, 50] 50) syntax (latex) - "_funs" :: "type list \ type \ type" (infixr "\" 200) - "_typings" :: "(nat \ type) \ dB list \ type list \ bool" + funs :: "type list \ type \ type" (infixr "\" 200) + typings_rel :: "(nat \ type) \ dB list \ type list \ bool" ("_ \ _ : _" [50, 50, 50] 50) -translations - "Ts \ T" \ "foldr Fun Ts T" - "env \ t : T" \ "(env, t, T) \ typing" - "env \ ts : Ts" \ "typings env ts Ts" inductive typing intros diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Lambda/WeakNorm.thy --- a/src/HOL/Lambda/WeakNorm.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Lambda/WeakNorm.thy Thu Feb 16 21:12:00 2006 +0100 @@ -16,9 +16,9 @@ subsection {* Terms in normal form *} -constdefs +definition listall :: "('a \ bool) \ 'a list \ bool" - "listall P xs \ (\i. i < length xs \ P (xs ! i))" + "listall P xs == (\i. i < length xs \ P (xs ! i))" declare listall_def [extraction_expand] @@ -361,12 +361,11 @@ consts -- {* A computationally relevant copy of @{term "e \ t : T"} *} rtyping :: "((nat \ type) \ dB \ type) set" -syntax - "_rtyping" :: "(nat \ type) \ dB \ type \ bool" ("_ |-\<^sub>R _ : _" [50, 50, 50] 50) +abbreviation (output) + rtyping_rel :: "(nat \ type) \ dB \ type \ bool" ("_ |-\<^sub>R _ : _" [50, 50, 50] 50) + "(e |-\<^sub>R t : T) = ((e, t, T) \ rtyping)" syntax (xsymbols) - "_rtyping" :: "(nat \ type) \ dB \ type \ bool" ("_ \\<^sub>R _ : _" [50, 50, 50] 50) -translations - "e \\<^sub>R t : T" \ "(e, t, T) \ rtyping" + rtyping_rel :: "(nat \ type) \ dB \ type \ bool" ("_ \\<^sub>R _ : _" [50, 50, 50] 50) inductive rtyping intros diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Library/Accessible_Part.thy --- a/src/HOL/Library/Accessible_Part.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Library/Accessible_Part.thy Thu Feb 16 21:12:00 2006 +0100 @@ -23,10 +23,9 @@ intros accI: "(!!y. (y, x) \ r ==> y \ acc r) ==> x \ acc r" -syntax +abbreviation (output) termi :: "('a \ 'a) set => 'a set" -translations - "termi r" == "acc (r\)" + "termi r == acc (r\)" subsection {* Induction rules *} diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Library/Coinductive_List.thy --- a/src/HOL/Library/Coinductive_List.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Library/Coinductive_List.thy Thu Feb 16 21:12:00 2006 +0100 @@ -11,12 +11,9 @@ subsection {* List constructors over the datatype universe *} -constdefs - NIL :: "'a Datatype_Universe.item" - "NIL \ Datatype_Universe.In0 (Datatype_Universe.Numb 0)" - CONS :: "'a Datatype_Universe.item \ 'a Datatype_Universe.item - \ 'a Datatype_Universe.item" - "CONS M N \ Datatype_Universe.In1 (Datatype_Universe.Scons M N)" +definition + "NIL = Datatype_Universe.In0 (Datatype_Universe.Numb 0)" + "CONS M N = Datatype_Universe.In1 (Datatype_Universe.Scons M N)" lemma CONS_not_NIL [iff]: "CONS M N \ NIL" and NIL_not_CONS [iff]: "NIL \ CONS M N" @@ -30,9 +27,8 @@ -- {* A continuity result? *} by (simp add: CONS_def In1_UN1 Scons_UN1_y) -constdefs - List_case where - "List_case c h \ Datatype_Universe.Case (\_. c) (Datatype_Universe.Split h)" +definition + "List_case c h = Datatype_Universe.Case (\_. c) (Datatype_Universe.Split h)" lemma List_case_NIL [simp]: "List_case c h NIL = c" and List_case_CONS [simp]: "List_case c h (CONS M N) = h M N" @@ -63,10 +59,8 @@ None \ NIL | Some (z, w) \ CONS z (LList_corec_aux k f w))" -constdefs - LList_corec :: "'a \ ('a \ ('b Datatype_Universe.item \ 'a) option) \ - 'b Datatype_Universe.item" - "LList_corec a f \ \k. LList_corec_aux k f a" +definition + "LList_corec a f = (\k. LList_corec_aux k f a)" text {* Note: the subsequent recursion equation for @{text LList_corec} may @@ -150,12 +144,9 @@ finally show ?thesis . qed -constdefs - LNil :: "'a llist" - "LNil \ Abs_llist NIL" - - LCons :: "'a \ 'a llist \ 'a llist" - "LCons x xs \ Abs_llist (CONS (Datatype_Universe.Leaf x) (Rep_llist xs))" +definition + "LNil = Abs_llist NIL" + "LCons x xs = Abs_llist (CONS (Datatype_Universe.Leaf x) (Rep_llist xs))" lemma LCons_not_LNil [iff]: "LCons x xs \ LNil" apply (simp add: LNil_def LCons_def) @@ -202,11 +193,9 @@ qed -constdefs - llist_case :: "'b \ ('a \ 'a llist \ 'b) \ 'a llist \ 'b" - "llist_case c d l \ +definition + "llist_case c d l = List_case c (\x y. d (inv Datatype_Universe.Leaf x) (Abs_llist y)) (Rep_llist l)" - translations "case p of LNil \ a | LCons x l \ b" \ "llist_case a (\x l. b) p" @@ -219,9 +208,8 @@ CONS_type Abs_llist_inverse Rep_llist Rep_llist_inverse inj_Leaf) -constdefs - llist_corec :: "'a \ ('a \ ('b \ 'a) option) \ 'b llist" - "llist_corec a f \ +definition + "llist_corec a f = Abs_llist (LList_corec a (\z. case f z of None \ None @@ -539,8 +527,7 @@ subsubsection {* @{text Lconst} *} -constdefs - Lconst where +definition "Lconst M \ lfp (\N. CONS M N)" lemma Lconst_fun_mono: "mono (CONS M)" @@ -580,12 +567,9 @@ subsubsection {* @{text Lmap} and @{text lmap} *} -constdefs - Lmap where - "Lmap f M \ LList_corec M (List_case None (\x M'. Some (f x, M')))" - - lmap :: "('a \ 'b) \ 'a llist \ 'b llist" - "lmap f l \ llist_corec l +definition + "Lmap f M = LList_corec M (List_case None (\x M'. Some (f x, M')))" + "lmap f l = llist_corec l (\z. case z of LNil \ None | LCons y z \ Some (f y, z))" @@ -678,15 +662,12 @@ subsubsection {* @{text Lappend} *} -constdefs - Lappend where - "Lappend M N \ LList_corec (M, N) +definition + "Lappend M N = LList_corec (M, N) (split (List_case (List_case None (\N1 N2. Some (N1, (NIL, N2)))) (\M1 M2 N. Some (M1, (M2, N)))))" - - lappend :: "'a llist \ 'a llist \ 'a llist" - "lappend l n \ llist_corec (l, n) + "lappend l n = llist_corec (l, n) (split (llist_case (llist_case None (\n1 n2. Some (n1, (LNil, n2)))) (\l1 l2 n. Some (l1, (l2, n)))))" @@ -760,9 +741,9 @@ text {* @{text llist_fun_equalityI} cannot be used here! *} -constdefs +definition iterates :: "('a \ 'a) \ 'a \ 'a llist" - "iterates f a \ llist_corec a (\x. Some (x, f x))" + "iterates f a = llist_corec a (\x. Some (x, f x))" lemma iterates: "iterates f x = LCons x (iterates f (f x))" apply (unfold iterates_def) diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Library/List_Prefix.thy --- a/src/HOL/Library/List_Prefix.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Library/List_Prefix.thy Thu Feb 16 21:12:00 2006 +0100 @@ -155,9 +155,9 @@ subsection {* Parallel lists *} -constdefs +definition parallel :: "'a list => 'a list => bool" (infixl "\" 50) - "xs \ ys == \ xs \ ys \ \ ys \ xs" + "(xs \ ys) = (\ xs \ ys \ \ ys \ xs)" lemma parallelI [intro]: "\ xs \ ys ==> \ ys \ xs ==> xs \ ys" unfolding parallel_def by blast @@ -215,9 +215,9 @@ subsection {* Postfix order on lists *} -constdefs +definition postfix :: "'a list => 'a list => bool" ("(_/ >>= _)" [51, 50] 50) - "xs >>= ys == \zs. xs = zs @ ys" + "(xs >>= ys) = (\zs. xs = zs @ ys)" lemma postfix_refl [simp, intro!]: "xs >>= xs" by (auto simp add: postfix_def) diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Library/Multiset.thy --- a/src/HOL/Library/Multiset.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Library/Multiset.thy Thu Feb 16 21:12:00 2006 +0100 @@ -20,29 +20,31 @@ Abs_multiset_inverse Rep_multiset_inverse Rep_multiset and [simp] = Rep_multiset_inject [symmetric] -constdefs +definition Mempty :: "'a multiset" ("{#}") - "{#} == Abs_multiset (\a. 0)" + "{#} = Abs_multiset (\a. 0)" single :: "'a => 'a multiset" ("{#_#}") - "{#a#} == Abs_multiset (\b. if b = a then 1 else 0)" + "{#a#} = Abs_multiset (\b. if b = a then 1 else 0)" count :: "'a multiset => 'a => nat" - "count == Rep_multiset" + "count = Rep_multiset" MCollect :: "'a multiset => ('a => bool) => 'a multiset" - "MCollect M P == Abs_multiset (\x. if P x then Rep_multiset M x else 0)" + "MCollect M P = Abs_multiset (\x. if P x then Rep_multiset M x else 0)" + +abbreviation (output) + Melem :: "'a => 'a multiset => bool" ("(_/ :# _)" [50, 51] 50) + "(a :# M) = (0 < count M a)" syntax - "_Melem" :: "'a => 'a multiset => bool" ("(_/ :# _)" [50, 51] 50) "_MCollect" :: "pttrn => 'a multiset => bool => 'a multiset" ("(1{# _ : _./ _#})") translations - "a :# M" == "0 < count M a" "{#x:M. P#}" == "MCollect M (\x. P)" -constdefs +definition set_of :: "'a multiset => 'a set" - "set_of M == {x. x :# M}" + "set_of M = {x. x :# M}" instance multiset :: (type) "{plus, minus, zero}" .. @@ -52,9 +54,9 @@ Zero_multiset_def [simp]: "0 == {#}" size_def: "size M == setsum (count M) (set_of M)" -constdefs - multiset_inter :: "'a multiset \ 'a multiset \ 'a multiset" (infixl "#\" 70) - "multiset_inter A B \ A - (A - B)" +definition + multiset_inter :: "'a multiset \ 'a multiset \ 'a multiset" (infixl "#\" 70) + "multiset_inter A B = A - (A - B)" text {* @@ -377,14 +379,14 @@ subsubsection {* Well-foundedness *} -constdefs +definition mult1 :: "('a \ 'a) set => ('a multiset \ 'a multiset) set" - "mult1 r == + "mult1 r = {(N, M). \a M0 K. M = M0 + {#a#} \ N = M0 + K \ (\b. b :# K --> (b, a) \ r)}" mult :: "('a \ 'a) set => ('a multiset \ 'a multiset) set" - "mult r == (mult1 r)\<^sup>+" + "mult r = (mult1 r)\<^sup>+" lemma not_less_empty [iff]: "(M, {#}) \ mult1 r" by (simp add: mult1_def) @@ -793,16 +795,9 @@ subsection {* Pointwise ordering induced by count *} -consts - mset_le :: "['a multiset, 'a multiset] \ bool" - -syntax - "_mset_le" :: "'a multiset \ 'a multiset \ bool" ("_ \# _" [50,51] 50) -translations - "x \# y" == "mset_le x y" - -defs - mset_le_def: "xs \# ys == (\a. count xs a \ count ys a)" +definition + mset_le :: "['a multiset, 'a multiset] \ bool" ("_ \# _" [50,51] 50) + "(xs \# ys) = (\a. count xs a \ count ys a)" lemma mset_le_refl[simp]: "xs \# xs" unfolding mset_le_def by auto diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Library/Primes.thy --- a/src/HOL/Library/Primes.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Library/Primes.thy Thu Feb 16 21:12:00 2006 +0100 @@ -10,12 +10,12 @@ imports Main begin -constdefs +definition coprime :: "nat => nat => bool" - "coprime m n == gcd (m, n) = 1" + "coprime m n = (gcd (m, n) = 1)" prime :: "nat \ bool" - "prime p == 1 < p \ (\m. m dvd p --> m = 1 \ m = p)" + "prime p = (1 < p \ (\m. m dvd p --> m = 1 \ m = p))" lemma two_is_prime: "prime 2" diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Library/Quotient.thy --- a/src/HOL/Library/Quotient.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Library/Quotient.thy Thu Feb 16 21:12:00 2006 +0100 @@ -74,9 +74,9 @@ representation of elements of a quotient type. *} -constdefs +definition "class" :: "'a::equiv => 'a quot" ("\_\") - "\a\ == Abs_quot {x. a \ x}" + "\a\ = Abs_quot {x. a \ x}" theorem quot_exhaust: "\a. A = \a\" proof (cases A) @@ -133,9 +133,9 @@ subsection {* Picking representing elements *} -constdefs +definition pick :: "'a::equiv quot => 'a" - "pick A == SOME a. A = \a\" + "pick A = (SOME a. A = \a\)" theorem pick_equiv [intro]: "pick \a\ \ a" proof (unfold pick_def) diff -r a1a251b297dd -r 1b3780be6cc2 src/HOL/Unix/Unix.thy --- a/src/HOL/Unix/Unix.thy Thu Feb 16 21:11:58 2006 +0100 +++ b/src/HOL/Unix/Unix.thy Thu Feb 16 21:12:00 2006 +0100 @@ -160,15 +160,13 @@ \cite{Nipkow-et-al:2000:HOL}. *} -constdefs - attributes :: "file \ att" - "attributes file \ +definition + "attributes file = (case file of Val (att, text) \ att | Env att dir \ att)" - attributes_update :: "att \ file \ file" - "attributes_update att file \ + "attributes_update att file = (case file of Val (att', text) \ Val (att, text) | Env att' dir \ Env att dir)" @@ -201,9 +199,8 @@ has user id 0). *} -constdefs - init :: "uid set \ file" - "init users \ +definition + "init users = Env \owner = 0, others = {Readable}\ (\u. if u \ users then Some (Env \owner = u, others = {Readable}\ empty) else None)" @@ -223,8 +220,7 @@ access a file unconditionally (in our simplified model). *} -constdefs - access :: "file \ path \ uid \ perms \ file option" +definition "access root path uid perms \ (case lookup root path of None \ None @@ -648,8 +644,7 @@ transition. *} -constdefs - can_exec :: "file \ operation list \ bool" +definition "can_exec root xs \ \root'. root =xs\ root'" lemma can_exec_nil: "can_exec root []" @@ -843,13 +838,12 @@ notes facts = user\<^isub>1_known user\<^isub>1_not_root users_neq perms\<^isub>1_writable perms\<^isub>2_not_writable - fixes bogus :: "operation list" - and bogus_path :: path - defines "bogus \ +definition (in situation) + "bogus = [Mkdir user\<^isub>1 perms\<^isub>1 [user\<^isub>1, name\<^isub>1], Mkdir user\<^isub>2 perms\<^isub>2 [user\<^isub>1, name\<^isub>1, name\<^isub>2], Creat user\<^isub>2 perms\<^isub>2 [user\<^isub>1, name\<^isub>1, name\<^isub>2, name\<^isub>3]]" - and "bogus_path \ [user\<^isub>1, name\<^isub>1, name\<^isub>2]" + "bogus_path = [user\<^isub>1, name\<^isub>1, name\<^isub>2]" text {* The @{term bogus} operations are the ones that lead into the uncouth @@ -867,9 +861,8 @@ neither owned and nor writable by @{term user\<^isub>1}. *} -locale invariant = situation + - fixes invariant :: "file \ path \ bool" - defines "invariant root path \ +definition (in situation) + "invariant root path \ (\att dir. access root path user\<^isub>1 {} = Some (Env att dir) \ dir \ empty \ user\<^isub>1 \ owner att \ @@ -907,7 +900,7 @@ we just have to inspect rather special cases. *} -lemma (in invariant) cannot_rmdir: +lemma (in situation) cannot_rmdir: assumes inv: "invariant root bogus_path" and rmdir: "root \(Rmdir user\<^isub>1 [user\<^isub>1, name\<^isub>1])\ root'" shows False @@ -923,7 +916,7 @@ ultimately show False by (simp add: bogus_path_def) qed -lemma (in invariant) +lemma (in situation) assumes init: "init users =bogus\ root" notes eval = facts access_def init_def shows init_invariant: "invariant root bogus_path" @@ -946,7 +939,7 @@ required here. *} -lemma (in invariant) preserve_invariant: +lemma (in situation) preserve_invariant: assumes tr: "root \x\ root'" and inv: "invariant root path" and uid: "uid_of x = user\<^isub>1" @@ -1090,8 +1083,7 @@ overall procedure (see \secref{sec:unix-inv-procedure}). *} -corollary result: - includes invariant +corollary (in situation) assumes bogus: "init users =bogus\ root" shows "\ (\xs. (\x \ set xs. uid_of x = user\<^isub>1) \ can_exec root (xs @ [Rmdir user\<^isub>1 [user\<^isub>1, name\<^isub>1]]))" @@ -1100,11 +1092,4 @@ and bogus show ?thesis by (rule general_procedure) qed -text {* - So this is our final result: - - @{thm [display, show_question_marks = false] result [OF - invariant.intro, OF situation.intro]} -*} - end