# HG changeset patch # User haftmann # Date 1276350497 -7200 # Node ID 6c9f23863808483d70310b4374751b4637c61ba9 # Parent e6b1a0693f3fc89cec345e278276254045639230# Parent f51ff37811bfabd9b96dd95cef1ccd295dfb9113 merged diff -r e6b1a0693f3f -r 6c9f23863808 src/HOL/Bali/DeclConcepts.thy --- a/src/HOL/Bali/DeclConcepts.thy Sat Jun 12 11:12:54 2010 +0200 +++ b/src/HOL/Bali/DeclConcepts.thy Sat Jun 12 15:48:17 2010 +0200 @@ -244,30 +244,30 @@ lemma mhead_static_simp [simp]: "is_static (mhead m) = is_static m" by (cases m) (simp add: mhead_def member_is_static_simp) -constdefs --{* some mnemotic selectors for various pairs *} - - "decliface":: "(qtname \ ('a::type) decl_scheme) \ qtname" - "decliface \ fst" --{* get the interface component *} +-- {* some mnemotic selectors for various pairs *} + +definition decliface :: "qtname \ 'a decl_scheme \ qtname" where + "decliface = fst" --{* get the interface component *} - "mbr":: "(qtname \ memberdecl) \ memberdecl" - "mbr \ snd" --{* get the memberdecl component *} +definition mbr :: "qtname \ memberdecl \ memberdecl" where + "mbr = snd" --{* get the memberdecl component *} - "mthd":: "('b \ 'a) \ 'a" - --{* also used for mdecl, mhead *} - "mthd \ snd" --{* get the method component *} +definition mthd :: "'b \ 'a \ 'a" where + "mthd = snd" --{* get the method component *} + --{* also used for mdecl, mhead *} - "fld":: "('b \ ('a::type) decl_scheme) \ ('a::type) decl_scheme" - --{* also used for @{text "((vname \ qtname)\ field)"} *} - "fld \ snd" --{* get the field component *} +definition fld :: "'b \ 'a decl_scheme \ 'a decl_scheme" where + "fld = snd" --{* get the field component *} + --{* also used for @{text "((vname \ qtname)\ field)"} *} +-- {* some mnemotic selectors for @{text "(vname \ qtname)"} *} -constdefs --{* some mnemotic selectors for @{text "(vname \ qtname)"} *} - fname:: "(vname \ 'a) \ vname" --{* also used for fdecl *} - "fname \ fst" - - declclassf:: "(vname \ qtname) \ qtname" - "declclassf \ snd" +definition fname:: "vname \ 'a \ vname" where + "fname = fst" + --{* also used for fdecl *} +definition declclassf:: "(vname \ qtname) \ qtname" where + "declclassf = snd" lemma decliface_simp[simp]: "decliface (I,m) = I" @@ -318,12 +318,13 @@ lemma declclassf_simp[simp]:"declclassf (n,c) = c" by (simp add: declclassf_def) -constdefs --{* some mnemotic selectors for @{text "(vname \ qtname)"} *} - "fldname" :: "(vname \ qtname) \ vname" - "fldname \ fst" + --{* some mnemotic selectors for @{text "(vname \ qtname)"} *} - "fldclass" :: "(vname \ qtname) \ qtname" - "fldclass \ snd" +definition fldname :: "vname \ qtname \ vname" where + "fldname = fst" + +definition fldclass :: "vname \ qtname \ qtname" where + "fldclass = snd" lemma fldname_simp[simp]: "fldname (n,c) = n" by (simp add: fldname_def) @@ -337,8 +338,8 @@ text {* Convert a qualified method declaration (qualified with its declaring class) to a qualified member declaration: @{text methdMembr} *} -definition methdMembr :: "(qtname \ mdecl) \ (qtname \ memberdecl)" where - "methdMembr m \ (fst m,mdecl (snd m))" +definition methdMembr :: "qtname \ mdecl \ qtname \ memberdecl" where + "methdMembr m = (fst m, mdecl (snd m))" lemma methdMembr_simp[simp]: "methdMembr (c,m) = (c,mdecl m)" by (simp add: methdMembr_def) diff -r e6b1a0693f3f -r 6c9f23863808 src/HOL/Bali/WellType.thy --- a/src/HOL/Bali/WellType.thy Sat Jun 12 11:12:54 2010 +0200 +++ b/src/HOL/Bali/WellType.thy Sat Jun 12 15:48:17 2010 +0200 @@ -103,22 +103,23 @@ "mheads G S (ClassT C) = cmheads G S C" "mheads G S (ArrayT T) = accObjectmheads G S (ArrayT T)" -constdefs +definition --{* applicable methods, cf. 15.11.2.1 *} - appl_methds :: "prog \ qtname \ ref_ty \ sig \ (emhead \ ty list)\ set" - "appl_methds G S rt \ \ sig. + appl_methds :: "prog \ qtname \ ref_ty \ sig \ (emhead \ ty list)\ set" where + "appl_methds G S rt = (\ sig. {(mh,pTs') |mh pTs'. mh \ mheads G S rt \name=name sig,parTs=pTs'\ \ - G\(parTs sig)[\]pTs'}" + G\(parTs sig)[\]pTs'})" +definition --{* more specific methods, cf. 15.11.2.2 *} - more_spec :: "prog \ emhead \ ty list \ emhead \ ty list \ bool" - "more_spec G \ \(mh,pTs). \(mh',pTs'). G\pTs[\]pTs'" + more_spec :: "prog \ emhead \ ty list \ emhead \ ty list \ bool" where + "more_spec G = (\(mh,pTs). \(mh',pTs'). G\pTs[\]pTs')" (*more_spec G \\((d,h),pTs). \((d',h'),pTs'). G\RefT d\RefT d'\G\pTs[\]pTs'*) +definition --{* maximally specific methods, cf. 15.11.2.2 *} - max_spec :: "prog \ qtname \ ref_ty \ sig \ (emhead \ ty list)\ set" - - "max_spec G S rt sig \{m. m \appl_methds G S rt sig \ + max_spec :: "prog \ qtname \ ref_ty \ sig \ (emhead \ ty list)\ set" where + "max_spec G S rt sig = {m. m \appl_methds G S rt sig \ (\m'\appl_methds G S rt sig. more_spec G m' m \ m'=m)}" diff -r e6b1a0693f3f -r 6c9f23863808 src/HOL/Import/proof_kernel.ML --- a/src/HOL/Import/proof_kernel.ML Sat Jun 12 11:12:54 2010 +0200 +++ b/src/HOL/Import/proof_kernel.ML Sat Jun 12 15:48:17 2010 +0200 @@ -1946,7 +1946,7 @@ val p3 = string_of_mixfix csyn val p4 = smart_string_of_cterm crhs in - add_dump ("constdefs\n " ^ p1 ^ " :: \"" ^ p2 ^ "\" "^ p3 ^ "\n " ^ p4) thy'' + add_dump ("definition\n " ^ p1 ^ " :: \"" ^ p2 ^ "\" "^ p3 ^ " where\n " ^ p4) thy'' end else add_dump ("consts\n " ^ quotename constname ^ " :: \"" ^ @@ -2139,18 +2139,6 @@ end handle e => (message "exception in new_type_definition"; print_exn e) -fun add_dump_constdefs thy defname constname rhs ty = - let - val n = quotename constname - val t = Syntax.string_of_typ_global thy ty - val syn = string_of_mixfix (mk_syn thy constname) - (*val eq = smart_string_of_cterm (cterm_of thy (Const(rhs, ty)))*) - val eq = quote (constname ^ " == "^rhs) - val d = case defname of NONE => "" | SOME defname => (quotename defname)^" : " - in - add_dump ("constdefs\n " ^ n ^ " :: \"" ^ t ^ "\" " ^ syn ^ "\n " ^ d ^ eq) thy - end - fun add_dump_syntax thy name = let val n = quotename name diff -r e6b1a0693f3f -r 6c9f23863808 src/HOL/List.thy --- a/src/HOL/List.thy Sat Jun 12 11:12:54 2010 +0200 +++ b/src/HOL/List.thy Sat Jun 12 15:48:17 2010 +0200 @@ -4188,8 +4188,8 @@ primrec -- {*The lexicographic ordering for lists of the specified length*} lexn :: "('a \ 'a) set \ nat \ ('a list \ 'a list) set" where - "lexn r 0 = {}" - | "lexn r (Suc n) = (prod_fun (%(x, xs). x#xs) (%(x, xs). x#xs) ` (r <*lex*> lexn r n)) Int + [code del]: "lexn r 0 = {}" + | [code del]: "lexn r (Suc n) = (prod_fun (%(x, xs). x#xs) (%(x, xs). x#xs) ` (r <*lex*> lexn r n)) Int {(xs, ys). length xs = Suc n \ length ys = Suc n}" definition diff -r e6b1a0693f3f -r 6c9f23863808 src/HOL/MicroJava/BV/BVSpec.thy --- a/src/HOL/MicroJava/BV/BVSpec.thy Sat Jun 12 11:12:54 2010 +0200 +++ b/src/HOL/MicroJava/BV/BVSpec.thy Sat Jun 12 15:48:17 2010 +0200 @@ -15,48 +15,53 @@ to type \emph{checking}. *} -constdefs +definition -- "The program counter will always be inside the method:" - check_bounded :: "instr list \ exception_table \ bool" - "check_bounded ins et \ + check_bounded :: "instr list \ exception_table \ bool" where + "check_bounded ins et \ (\pc < length ins. \pc' \ set (succs (ins!pc) pc). pc' < length ins) \ (\e \ set et. fst (snd (snd e)) < length ins)" +definition -- "The method type only contains declared classes:" - check_types :: "jvm_prog \ nat \ nat \ JVMType.state list \ bool" - "check_types G mxs mxr phi \ set phi \ states G mxs mxr" + check_types :: "jvm_prog \ nat \ nat \ JVMType.state list \ bool" where + "check_types G mxs mxr phi \ set phi \ states G mxs mxr" +definition -- "An instruction is welltyped if it is applicable and its effect" -- "is compatible with the type at all successor instructions:" wt_instr :: "[instr,jvm_prog,ty,method_type,nat,p_count, - exception_table,p_count] \ bool" - "wt_instr i G rT phi mxs max_pc et pc \ + exception_table,p_count] \ bool" where + "wt_instr i G rT phi mxs max_pc et pc \ app i G mxs rT pc et (phi!pc) \ (\(pc',s') \ set (eff i G pc et (phi!pc)). pc' < max_pc \ G \ s' <=' phi!pc')" +definition -- {* The type at @{text "pc=0"} conforms to the method calling convention: *} - wt_start :: "[jvm_prog,cname,ty list,nat,method_type] \ bool" - "wt_start G C pTs mxl phi == + wt_start :: "[jvm_prog,cname,ty list,nat,method_type] \ bool" where + "wt_start G C pTs mxl phi \ G \ Some ([],(OK (Class C))#((map OK pTs))@(replicate mxl Err)) <=' phi!0" +definition -- "A method is welltyped if the body is not empty, if execution does not" -- "leave the body, if the method type covers all instructions and mentions" -- "declared classes only, if the method calling convention is respected, and" -- "if all instructions are welltyped." wt_method :: "[jvm_prog,cname,ty list,ty,nat,nat,instr list, - exception_table,method_type] \ bool" - "wt_method G C pTs rT mxs mxl ins et phi \ - let max_pc = length ins in + exception_table,method_type] \ bool" where + "wt_method G C pTs rT mxs mxl ins et phi \ + (let max_pc = length ins in 0 < max_pc \ length phi = length ins \ check_bounded ins et \ check_types G mxs (1+length pTs+mxl) (map OK phi) \ wt_start G C pTs mxl phi \ - (\pc. pc wt_instr (ins!pc) G rT phi mxs max_pc et pc)" + (\pc. pc wt_instr (ins!pc) G rT phi mxs max_pc et pc))" +definition -- "A program is welltyped if it is wellformed and all methods are welltyped" - wt_jvm_prog :: "[jvm_prog,prog_type] \ bool" - "wt_jvm_prog G phi == + wt_jvm_prog :: "[jvm_prog,prog_type] \ bool" where + "wt_jvm_prog G phi \ wf_prog (\G C (sig,rT,(maxs,maxl,b,et)). wt_method G C (snd sig) rT maxs maxl b et (phi C sig)) G" diff -r e6b1a0693f3f -r 6c9f23863808 src/HOL/MicroJava/JVM/JVMDefensive.thy --- a/src/HOL/MicroJava/JVM/JVMDefensive.thy Sat Jun 12 11:12:54 2010 +0200 +++ b/src/HOL/MicroJava/JVM/JVMDefensive.thy Sat Jun 12 15:48:17 2010 +0200 @@ -117,10 +117,10 @@ | Normal s' \ if check G s' then Normal (exec (G, s')) else TypeError" -constdefs +definition exec_all_d :: "jvm_prog \ jvm_state type_error \ jvm_state type_error \ bool" - ("_ |- _ -jvmd-> _" [61,61,61]60) - "G |- s -jvmd-> t \ + ("_ |- _ -jvmd-> _" [61,61,61]60) where + "G |- s -jvmd-> t \ (s,t) \ ({(s,t). exec_d G s = TypeError \ t = TypeError} \ {(s,t). \t'. exec_d G s = Normal (Some t') \ t = Normal t'})\<^sup>*" diff -r e6b1a0693f3f -r 6c9f23863808 src/HOL/Tools/refute.ML --- a/src/HOL/Tools/refute.ML Sat Jun 12 11:12:54 2010 +0200 +++ b/src/HOL/Tools/refute.ML Sat Jun 12 15:48:17 2010 +0200 @@ -517,7 +517,7 @@ end (* ------------------------------------------------------------------------- *) -(* get_def: looks up the definition of a constant, as created by "constdefs" *) +(* get_def: looks up the definition of a constant *) (* ------------------------------------------------------------------------- *) (* theory -> string * Term.typ -> (string * Term.term) option *) @@ -711,7 +711,7 @@ (* Note: currently we use "inverse" functions to the definitional *) (* mechanisms provided by Isabelle/HOL, e.g. for "axclass", *) - (* "typedef", "constdefs". A more general approach could consider *) + (* "typedef", "definition". A more general approach could consider *) (* *every* axiom of the theory and collect it if it has a constant/ *) (* type/typeclass in common with the term 't'. *) diff -r e6b1a0693f3f -r 6c9f23863808 src/HOL/Wellfounded.thy --- a/src/HOL/Wellfounded.thy Sat Jun 12 11:12:54 2010 +0200 +++ b/src/HOL/Wellfounded.thy Sat Jun 12 15:48:17 2010 +0200 @@ -683,10 +683,8 @@ text{* Lexicographic combinations *} definition - lex_prod :: "[('a*'a)set, ('b*'b)set] => (('a*'b)*('a*'b))set" - (infixr "<*lex*>" 80) -where - "ra <*lex*> rb == {((a,b),(a',b')). (a,a') : ra | a=a' & (b,b') : rb}" + lex_prod :: "('a \'a) set \ ('b \ 'b) set \ (('a \ 'b) \ ('a \ 'b)) set" (infixr "<*lex*>" 80) where + [code del]: "ra <*lex*> rb = {((a, b), (a', b')). (a, a') \ ra \ a = a' \ (b, b') \ rb}" lemma wf_lex_prod [intro!]: "[| wf(ra); wf(rb) |] ==> wf(ra <*lex*> rb)" apply (unfold wf_def lex_prod_def) diff -r e6b1a0693f3f -r 6c9f23863808 src/HOL/ex/Codegenerator_Candidates.thy --- a/src/HOL/ex/Codegenerator_Candidates.thy Sat Jun 12 11:12:54 2010 +0200 +++ b/src/HOL/ex/Codegenerator_Candidates.thy Sat Jun 12 15:48:17 2010 +0200 @@ -26,8 +26,6 @@ While_Combinator begin -declare lexn.simps [code del] - inductive sublist :: "'a list \ 'a list \ bool" where empty: "sublist [] xs" | drop: "sublist ys xs \ sublist ys (x # xs)" diff -r e6b1a0693f3f -r 6c9f23863808 src/ZF/ZF.thy --- a/src/ZF/ZF.thy Sat Jun 12 11:12:54 2010 +0200 +++ b/src/ZF/ZF.thy Sat Jun 12 15:48:17 2010 +0200 @@ -199,10 +199,7 @@ finalconsts 0 Pow Inf Union PrimReplace mem -defs -(*don't try to use constdefs: the declaration order is tightly constrained*) - - (* Bounded Quantifiers *) +defs (* Bounded Quantifiers *) Ball_def: "Ball(A, P) == \x. x\A --> P(x)" Bex_def: "Bex(A, P) == \x. x\A & P(x)"