diff -r f87d1105e181 -r ee939247b2fb src/HOL/Bali/AxSem.thy --- a/src/HOL/Bali/AxSem.thy Mon Jul 26 13:50:52 2010 +0200 +++ b/src/HOL/Bali/AxSem.thy Mon Jul 26 17:41:26 2010 +0200 @@ -62,8 +62,9 @@ translations (type) "'a assn" <= (type) "vals \ state \ 'a \ bool" -definition assn_imp :: "'a assn \ 'a assn \ bool" (infixr "\" 25) where - "P \ Q \ \Y s Z. P Y s Z \ Q Y s Z" +definition + assn_imp :: "'a assn \ 'a assn \ bool" (infixr "\" 25) + where "(P \ Q) = (\Y s Z. P Y s Z \ Q Y s Z)" lemma assn_imp_def2 [iff]: "(P \ Q) = (\Y s Z. P Y s Z \ Q Y s Z)" apply (unfold assn_imp_def) @@ -75,8 +76,9 @@ subsection "peek-and" -definition peek_and :: "'a assn \ (state \ bool) \ 'a assn" (infixl "\." 13) where - "P \. p \ \Y s Z. P Y s Z \ p s" +definition + peek_and :: "'a assn \ (state \ bool) \ 'a assn" (infixl "\." 13) + where "(P \. p) = (\Y s Z. P Y s Z \ p s)" lemma peek_and_def2 [simp]: "peek_and P p Y s = (\Z. (P Y s Z \ p s))" apply (unfold peek_and_def) @@ -114,8 +116,9 @@ subsection "assn-supd" -definition assn_supd :: "'a assn \ (state \ state) \ 'a assn" (infixl ";." 13) where - "P ;. f \ \Y s' Z. \s. P Y s Z \ s' = f s" +definition + assn_supd :: "'a assn \ (state \ state) \ 'a assn" (infixl ";." 13) + where "(P ;. f) = (\Y s' Z. \s. P Y s Z \ s' = f s)" lemma assn_supd_def2 [simp]: "assn_supd P f Y s' Z = (\s. P Y s Z \ s' = f s)" apply (unfold assn_supd_def) @@ -124,8 +127,9 @@ subsection "supd-assn" -definition supd_assn :: "(state \ state) \ 'a assn \ 'a assn" (infixr ".;" 13) where - "f .; P \ \Y s. P Y (f s)" +definition + supd_assn :: "(state \ state) \ 'a assn \ 'a assn" (infixr ".;" 13) + where "(f .; P) = (\Y s. P Y (f s))" lemma supd_assn_def2 [simp]: "(f .; P) Y s = P Y (f s)" @@ -143,8 +147,9 @@ subsection "subst-res" -definition subst_res :: "'a assn \ res \ 'a assn" ("_\_" [60,61] 60) where - "P\w \ \Y. P w" +definition + subst_res :: "'a assn \ res \ 'a assn" ("_\_" [60,61] 60) + where "P\w = (\Y. P w)" lemma subst_res_def2 [simp]: "(P\w) Y = P w" apply (unfold subst_res_def) @@ -178,8 +183,9 @@ subsection "subst-Bool" -definition subst_Bool :: "'a assn \ bool \ 'a assn" ("_\=_" [60,61] 60) where - "P\=b \ \Y s Z. \v. P (Val v) s Z \ (normal s \ the_Bool v=b)" +definition + subst_Bool :: "'a assn \ bool \ 'a assn" ("_\=_" [60,61] 60) + where "P\=b = (\Y s Z. \v. P (Val v) s Z \ (normal s \ the_Bool v=b))" lemma subst_Bool_def2 [simp]: "(P\=b) Y s Z = (\v. P (Val v) s Z \ (normal s \ the_Bool v=b))" @@ -193,8 +199,9 @@ subsection "peek-res" -definition peek_res :: "(res \ 'a assn) \ 'a assn" where - "peek_res Pf \ \Y. Pf Y Y" +definition + peek_res :: "(res \ 'a assn) \ 'a assn" + where "peek_res Pf = (\Y. Pf Y Y)" syntax "_peek_res" :: "pttrn \ 'a assn \ 'a assn" ("\_:. _" [0,3] 3) @@ -221,8 +228,9 @@ subsection "ign-res" -definition ign_res :: " 'a assn \ 'a assn" ("_\" [1000] 1000) where - "P\ \ \Y s Z. \Y. P Y s Z" +definition + ign_res :: "'a assn \ 'a assn" ("_\" [1000] 1000) + where "P\ = (\Y s Z. \Y. P Y s Z)" lemma ign_res_def2 [simp]: "P\ Y s Z = (\Y. P Y s Z)" apply (unfold ign_res_def) @@ -252,8 +260,9 @@ subsection "peek-st" -definition peek_st :: "(st \ 'a assn) \ 'a assn" where - "peek_st P \ \Y s. P (store s) Y s" +definition + peek_st :: "(st \ 'a assn) \ 'a assn" + where "peek_st P = (\Y s. P (store s) Y s)" syntax "_peek_st" :: "pttrn \ 'a assn \ 'a assn" ("\_.. _" [0,3] 3) @@ -296,8 +305,9 @@ subsection "ign-res-eq" -definition ign_res_eq :: "'a assn \ res \ 'a assn" ("_\=_" [60,61] 60) where - "P\=w \ \Y:. P\ \. (\s. Y=w)" +definition + ign_res_eq :: "'a assn \ res \ 'a assn" ("_\=_" [60,61] 60) + where "P\=w \ (\Y:. P\ \. (\s. Y=w))" lemma ign_res_eq_def2 [simp]: "(P\=w) Y s Z = ((\Y. P Y s Z) \ Y=w)" apply (unfold ign_res_eq_def) @@ -326,8 +336,9 @@ subsection "RefVar" -definition RefVar :: "(state \ vvar \ state) \ 'a assn \ 'a assn" (infixr "..;" 13) where - "vf ..; P \ \Y s. let (v,s') = vf s in P (Var v) s'" +definition + RefVar :: "(state \ vvar \ state) \ 'a assn \ 'a assn" (infixr "..;" 13) + where "(vf ..; P) = (\Y s. let (v,s') = vf s in P (Var v) s')" lemma RefVar_def2 [simp]: "(vf ..; P) Y s = P (Var (fst (vf s))) (snd (vf s))" @@ -337,12 +348,13 @@ subsection "allocation" -definition Alloc :: "prog \ obj_tag \ 'a assn \ 'a assn" where - "Alloc G otag P \ \Y s Z. - \s' a. G\s \halloc otag\a\ s'\ P (Val (Addr a)) s' Z" +definition + Alloc :: "prog \ obj_tag \ 'a assn \ 'a assn" + where "Alloc G otag P = (\Y s Z. \s' a. G\s \halloc otag\a\ s'\ P (Val (Addr a)) s' Z)" -definition SXAlloc :: "prog \ 'a assn \ 'a assn" where - "SXAlloc G P \ \Y s Z. \s'. G\s \sxalloc\ s' \ P Y s' Z" +definition + SXAlloc :: "prog \ 'a assn \ 'a assn" + where "SXAlloc G P = (\Y s Z. \s'. G\s \sxalloc\ s' \ P Y s' Z)" lemma Alloc_def2 [simp]: "Alloc G otag P Y s Z = @@ -359,11 +371,12 @@ section "validity" -definition type_ok :: "prog \ term \ state \ bool" where - "type_ok G t s \ - \L T C A. (normal s \ \prg=G,cls=C,lcl=L\\t\T \ - \prg=G,cls=C,lcl=L\\dom (locals (store s))\t\A ) - \ s\\(G,L)" +definition + type_ok :: "prog \ term \ state \ bool" where + "type_ok G t s = + (\L T C A. (normal s \ \prg=G,cls=C,lcl=L\\t\T \ + \prg=G,cls=C,lcl=L\\dom (locals (store s))\t\A ) + \ s\\(G,L))" datatype 'a triple = triple "('a assn)" "term" "('a assn)" (** should be something like triple = \'a. triple ('a assn) term ('a assn) **) @@ -407,34 +420,35 @@ definition mtriples :: "('c \ 'sig \ 'a assn) \ ('c \ 'sig \ expr) \ ('c \ 'sig \ 'a assn) \ ('c \ 'sig) set \ 'a triples" ("{{(1_)}/ _-\/ {(1_)} | _}"[3,65,3,65]75) where - "{{P} tf-\ {Q} | ms} \ (\(C,sig). {Normal(P C sig)} tf C sig-\ {Q C sig})`ms" + "{{P} tf-\ {Q} | ms} = (\(C,sig). {Normal(P C sig)} tf C sig-\ {Q C sig})`ms" -consts - - triple_valid :: "prog \ nat \ 'a triple \ bool" - ( "_\_:_" [61,0, 58] 57) - ax_valids :: "prog \ 'b triples \ 'a triples \ bool" - ("_,_|\_" [61,58,58] 57) +definition + triple_valid :: "prog \ nat \ 'a triple \ bool" ("_\_:_" [61,0, 58] 57) + where + "G\n:t = + (case t of {P} t\ {Q} \ + \Y s Z. P Y s Z \ type_ok G t s \ + (\Y' s'. G\s \t\\n\ (Y',s') \ Q Y' s' Z))" abbreviation - triples_valid:: "prog \ nat \ 'a triples \ bool" - ( "_||=_:_" [61,0, 58] 57) - where "G||=n:ts == Ball ts (triple_valid G n)" + triples_valid:: "prog \ nat \ 'a triples \ bool" ( "_||=_:_" [61,0, 58] 57) + where "G||=n:ts == Ball ts (triple_valid G n)" + +notation (xsymbols) + triples_valid ("_|\_:_" [61,0, 58] 57) + + +definition + ax_valids :: "prog \ 'b triples \ 'a triples \ bool" ("_,_|\_" [61,58,58] 57) + where "(G,A|\ts) = (\n. G|\n:A \ G|\n:ts)" abbreviation - ax_valid :: "prog \ 'b triples \ 'a triple \ bool" - ( "_,_|=_" [61,58,58] 57) - where "G,A |=t == G,A|\{t}" + ax_valid :: "prog \ 'b triples \ 'a triple \ bool" ( "_,_|=_" [61,58,58] 57) + where "G,A |=t == G,A|\{t}" notation (xsymbols) - triples_valid ("_|\_:_" [61,0, 58] 57) and ax_valid ("_,_\_" [61,58,58] 57) -defs triple_valid_def: "G\n:t \ case t of {P} t\ {Q} \ - \Y s Z. P Y s Z \ type_ok G t s \ - (\Y' s'. G\s \t\\n\ (Y',s') \ Q Y' s' Z)" - -defs ax_valids_def:"G,A|\ts \ \n. G|\n:A \ G|\n:ts" lemma triple_valid_def2: "G\n:{P} t\ {Q} = (\Y s Z. P Y s Z @@ -625,8 +639,9 @@ axioms *) -definition adapt_pre :: "'a assn \ 'a assn \ 'a assn \ 'a assn" where -"adapt_pre P Q Q'\\Y s Z. \Y' s'. \Z'. P Y s Z' \ (Q Y' s' Z' \ Q' Y' s' Z)" +definition + adapt_pre :: "'a assn \ 'a assn \ 'a assn \ 'a assn" + where "adapt_pre P Q Q' = (\Y s Z. \Y' s'. \Z'. P Y s Z' \ (Q Y' s' Z' \ Q' Y' s' Z))" section "rules derived by induction"