# HG changeset patch # User wenzelm # Date 1265759116 -3600 # Node ID af4c18c30593626654dcdd21b27581d71fc05e1c # Parent 894e82be8d05ccb8b7390dfa0e967655c1610b7b modernized syntax translations, using mostly abbreviation/notation; minor tuning; diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/AxExample.thy --- a/src/HOL/Bali/AxExample.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/AxExample.thy Wed Feb 10 00:45:16 2010 +0100 @@ -166,7 +166,7 @@ apply (tactic "ax_tac 1" (* NewC *)) apply (tactic "ax_tac 1" (* ax_Alloc *)) (* just for clarification: *) -apply (rule_tac Q' = "Normal ((\Y s Z. arr_inv (store s) \ vf=lvar (VName e) (store s)) \. heap_free tree \. initd Ext)" in conseq2) +apply (rule_tac Q' = "Normal ((\Y s Z. arr_inv (store s) \ vf=lvar (VName e) (store s)) \. heap_free three \. initd Ext)" in conseq2) prefer 2 apply (simp add: invocation_declclass_def dynmethd_def) apply (unfold dynlookup_def) diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/AxSem.thy --- a/src/HOL/Bali/AxSem.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/AxSem.thy Wed Feb 10 00:45:16 2010 +0100 @@ -6,7 +6,6 @@ header {* Axiomatic semantics of Java expressions and statements (see also Eval.thy) *} - theory AxSem imports Evaln TypeSafe begin text {* @@ -39,14 +38,15 @@ *} types res = vals --{* result entry *} -syntax - Val :: "val \ res" - Var :: "var \ res" - Vals :: "val list \ res" -translations - "Val x" => "(In1 x)" - "Var x" => "(In2 x)" - "Vals x" => "(In3 x)" + +abbreviation (input) + Val where "Val x == In1 x" + +abbreviation (input) + Var where "Var x == In2 x" + +abbreviation (input) + Vals where "Vals x == In3 x" syntax "_Val" :: "[pttrn] => pttrn" ("Val:_" [951] 950) @@ -54,9 +54,9 @@ "_Vals" :: "[pttrn] => pttrn" ("Vals:_" [951] 950) translations - "\Val:v . b" == "(\v. b) \ the_In1" - "\Var:v . b" == "(\v. b) \ the_In2" - "\Vals:v. b" == "(\v. b) \ the_In3" + "\Val:v . b" == "(\v. b) \ CONST the_In1" + "\Var:v . b" == "(\v. b) \ CONST the_In2" + "\Vals:v. b" == "(\v. b) \ CONST the_In3" --{* relation on result values, state and auxiliary variables *} types 'a assn = "res \ state \ 'a \ bool" @@ -105,10 +105,9 @@ apply auto done -syntax - Normal :: "'a assn \ 'a assn" -translations - "Normal P" == "P \. normal" +abbreviation + Normal :: "'a assn \ 'a assn" + where "Normal P == P \. normal" lemma peek_and_Normal [simp]: "peek_and (Normal P) p = Normal (peek_and P p)" apply (rule ext) @@ -207,9 +206,9 @@ "peek_res Pf \ \Y. Pf Y Y" syntax -"@peek_res" :: "pttrn \ 'a assn \ 'a assn" ("\_:. _" [0,3] 3) + "_peek_res" :: "pttrn \ 'a assn \ 'a assn" ("\_:. _" [0,3] 3) translations - "\w:. P" == "peek_res (\w. P)" + "\w:. P" == "CONST peek_res (\w. P)" lemma peek_res_def2 [simp]: "peek_res P Y = P Y Y" apply (unfold peek_res_def) @@ -268,9 +267,9 @@ "peek_st P \ \Y s. P (store s) Y s" syntax -"@peek_st" :: "pttrn \ 'a assn \ 'a assn" ("\_.. _" [0,3] 3) + "_peek_st" :: "pttrn \ 'a assn \ 'a assn" ("\_.. _" [0,3] 3) translations - "\s.. P" == "peek_st (\s. P)" + "\s.. P" == "CONST peek_st (\s. P)" lemma peek_st_def2 [simp]: "(\s.. Pf s) Y s = Pf (store s) Y s" apply (unfold peek_st_def) @@ -386,33 +385,31 @@ ("{(1_)}/ _>/ {(1_)}" [3,65,3]75) types 'a triples = "'a triple set" -syntax - +abbreviation var_triple :: "['a assn, var ,'a assn] \ 'a triple" ("{(1_)}/ _=>/ {(1_)}" [3,80,3] 75) + where "{P} e=> {Q} == {P} In2 e> {Q}" + +abbreviation expr_triple :: "['a assn, expr ,'a assn] \ 'a triple" ("{(1_)}/ _->/ {(1_)}" [3,80,3] 75) + where "{P} e-> {Q} == {P} In1l e> {Q}" + +abbreviation exprs_triple :: "['a assn, expr list ,'a assn] \ 'a triple" ("{(1_)}/ _#>/ {(1_)}" [3,65,3] 75) + where "{P} e#> {Q} == {P} In3 e> {Q}" + +abbreviation stmt_triple :: "['a assn, stmt, 'a assn] \ 'a triple" ("{(1_)}/ ._./ {(1_)}" [3,65,3] 75) - -syntax (xsymbols) + where "{P} .c. {Q} == {P} In1r c> {Q}" - triple :: "['a assn, term ,'a assn] \ 'a triple" - ("{(1_)}/ _\/ {(1_)}" [3,65,3] 75) - var_triple :: "['a assn, var ,'a assn] \ 'a triple" - ("{(1_)}/ _=\/ {(1_)}" [3,80,3] 75) - expr_triple :: "['a assn, expr ,'a assn] \ 'a triple" - ("{(1_)}/ _-\/ {(1_)}" [3,80,3] 75) - exprs_triple :: "['a assn, expr list ,'a assn] \ 'a triple" - ("{(1_)}/ _\\/ {(1_)}" [3,65,3] 75) - -translations - "{P} e-\ {Q}" == "{P} In1l e\ {Q}" - "{P} e=\ {Q}" == "{P} In2 e\ {Q}" - "{P} e\\ {Q}" == "{P} In3 e\ {Q}" - "{P} .c. {Q}" == "{P} In1r c\ {Q}" +notation (xsymbols) + triple ("{(1_)}/ _\/ {(1_)}" [3,65,3] 75) and + var_triple ("{(1_)}/ _=\/ {(1_)}" [3,80,3] 75) and + expr_triple ("{(1_)}/ _-\/ {(1_)}" [3,80,3] 75) and + exprs_triple ("{(1_)}/ _\\/ {(1_)}" [3,65,3] 75) lemma inj_triple: "inj (\(P,t,Q). {P} t\ {Q})" apply (rule inj_onI) @@ -436,26 +433,25 @@ ax_valids :: "prog \ 'b triples \ 'a triples \ bool" ("_,_|\_" [61,58,58] 57) -syntax - +abbreviation triples_valid:: "prog \ nat \ 'a triples \ bool" ( "_||=_:_" [61,0, 58] 57) - ax_valid :: "prog \ 'b triples \ 'a triple \ bool" - ( "_,_|=_" [61,58,58] 57) - -syntax (xsymbols) + where "G||=n:ts == Ball ts (triple_valid G n)" - triples_valid:: "prog \ nat \ 'a triples \ bool" - ( "_|\_:_" [61,0, 58] 57) - ax_valid :: "prog \ 'b triples \ 'a triple \ bool" - ( "_,_\_" [61,58,58] 57) +abbreviation + 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)" -translations "G|\n:ts" == "Ball ts (triple_valid G n)" -defs ax_valids_def:"G,A|\ts \ \n. G|\n:A \ G|\n:ts" -translations "G,A \t" == "G,A|\{t}" + +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 diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/Basis.thy --- a/src/HOL/Bali/Basis.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/Basis.thy Wed Feb 10 00:45:16 2010 +0100 @@ -27,12 +27,8 @@ apply fast+ done -syntax - "3" :: nat ("3") - "4" :: nat ("4") -translations - "3" == "Suc 2" - "4" == "Suc 3" +abbreviation nat3 :: nat ("3") where "3 == Suc 2" +abbreviation nat4 :: nat ("4") where "4 == Suc 3" (*unused*) lemma range_bool_domain: "range f = {f True, f False}" @@ -182,10 +178,7 @@ hide const In0 In1 -syntax - fun_sum :: "('a => 'c) => ('b => 'c) => (('a+'b) => 'c)" (infixr "'(+')"80) -translations - "fun_sum" == "CONST sum_case" +notation sum_case (infixr "'(+')"80) consts the_Inl :: "'a + 'b \ 'a" the_Inr :: "'a + 'b \ 'b" @@ -201,18 +194,17 @@ primrec "the_In2 (In2 b) = b" primrec "the_In3 (In3 c) = c" -syntax - In1l :: "'al \ ('al + 'ar, 'b, 'c) sum3" - In1r :: "'ar \ ('al + 'ar, 'b, 'c) sum3" -translations - "In1l e" == "In1 (CONST Inl e)" - "In1r c" == "In1 (CONST Inr c)" +abbreviation In1l :: "'al \ ('al + 'ar, 'b, 'c) sum3" + where "In1l e == In1 (Inl e)" + +abbreviation In1r :: "'ar \ ('al + 'ar, 'b, 'c) sum3" + where "In1r c == In1 (Inr c)" -syntax the_In1l :: "('al + 'ar, 'b, 'c) sum3 \ 'al" - the_In1r :: "('al + 'ar, 'b, 'c) sum3 \ 'ar" -translations - "the_In1l" == "the_Inl \ the_In1" - "the_In1r" == "the_Inr \ the_In1" +abbreviation the_In1l :: "('al + 'ar, 'b, 'c) sum3 \ 'al" + where "the_In1l == the_Inl \ the_In1" + +abbreviation the_In1r :: "('al + 'ar, 'b, 'c) sum3 \ 'ar" + where "the_In1r == the_Inr \ the_In1" ML {* fun sum3_instantiate ctxt thm = map (fn s => @@ -319,8 +311,8 @@ syntax "_lpttrn" :: "[pttrn,pttrn] => pttrn" ("_#/_" [901,900] 900) translations - "%y#x#xs. b" == "lsplit (%y x#xs. b)" - "%x#xs . b" == "lsplit (%x xs . b)" + "%y#x#xs. b" == "CONST lsplit (%y x#xs. b)" + "%x#xs . b" == "CONST lsplit (%x xs . b)" lemma lsplit [simp]: "lsplit c (x#xs) = c x xs" apply (unfold lsplit_def) diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/Decl.thy --- a/src/HOL/Bali/Decl.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/Decl.thy Wed Feb 10 00:45:16 2010 +0100 @@ -402,17 +402,21 @@ "prog"<= (type) "\ifaces::idecl list,classes::cdecl list\" "prog"<= (type) "\ifaces::idecl list,classes::cdecl list,\::'a\" -syntax - iface :: "prog \ (qtname, iface) table" - "class" :: "prog \ (qtname, class) table" - is_iface :: "prog \ qtname \ bool" - is_class :: "prog \ qtname \ bool" +abbreviation + iface :: "prog \ (qtname, iface) table" + where "iface G I == table_of (ifaces G) I" + +abbreviation + "class" :: "prog \ (qtname, class) table" + where "class G C == table_of (classes G) C" -translations - "iface G I" == "table_of (ifaces G) I" - "class G C" == "table_of (classes G) C" - "is_iface G I" == "iface G I \ None" - "is_class G C" == "class G C \ None" +abbreviation + is_iface :: "prog \ qtname \ bool" + where "is_iface G I == iface G I \ None" + +abbreviation + is_class :: "prog \ qtname \ bool" + where "is_class G C == class G C \ None" section "is type" @@ -445,21 +449,22 @@ subint1_def: "subint1 G \ {(I,J). \i\iface G I: J\set (isuperIfs i)}" subcls1_def: "subcls1 G \ {(C,D). C\Object \ (\c\class G C: super c = D)}" -syntax - "_subcls1" :: "prog => [qtname, qtname] => bool" ("_|-_<:C1_" [71,71,71] 70) - "_subclseq":: "prog => [qtname, qtname] => bool" ("_|-_<=:C _"[71,71,71] 70) - "_subcls" :: "prog => [qtname, qtname] => bool" ("_|-_<:C _"[71,71,71] 70) +abbreviation + subcls1_syntax :: "prog => [qtname, qtname] => bool" ("_|-_<:C1_" [71,71,71] 70) + where "G|-C <:C1 D == (C,D) \ subcls1 G" + +abbreviation + subclseq_syntax :: "prog => [qtname, qtname] => bool" ("_|-_<=:C _"[71,71,71] 70) + where "G|-C <=:C D == (C,D) \(subcls1 G)^*" (* cf. 8.1.3 *) -syntax (xsymbols) - "_subcls1" :: "prog \ [qtname, qtname] \ bool" ("_\_\\<^sub>C\<^sub>1_" [71,71,71] 70) - "_subclseq":: "prog \ [qtname, qtname] \ bool" ("_\_\\<^sub>C _" [71,71,71] 70) - "_subcls" :: "prog \ [qtname, qtname] \ bool" ("_\_\\<^sub>C _" [71,71,71] 70) +abbreviation + subcls_syntax :: "prog => [qtname, qtname] => bool" ("_|-_<:C _"[71,71,71] 70) + where "G|-C <:C D == (C,D) \(subcls1 G)^+" -translations - "G\C \\<^sub>C\<^sub>1 D" == "(C,D) \ subcls1 G" - "G\C \\<^sub>C D" == "(C,D) \(subcls1 G)^*" (* cf. 8.1.3 *) - "G\C \\<^sub>C D" == "(C,D) \(subcls1 G)^+" - +notation (xsymbols) + subcls1_syntax ("_\_\\<^sub>C\<^sub>1_" [71,71,71] 70) and + subclseq_syntax ("_\_\\<^sub>C _" [71,71,71] 70) and + subcls_syntax ("_\_\\<^sub>C _" [71,71,71] 70) lemma subint1I: "\iface G I = Some i; J \ set (isuperIfs i)\ \ (I,J) \ subint1 G" diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/DeclConcepts.thy --- a/src/HOL/Bali/DeclConcepts.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/DeclConcepts.thy Wed Feb 10 00:45:16 2010 +0100 @@ -13,8 +13,8 @@ "is_public G qn \ (case class G qn of None \ (case iface G qn of None \ False - | Some iface \ access iface = Public) - | Some class \ access class = Public)" + | Some i \ access i = Public) + | Some c \ access c = Public)" subsection "accessibility of types (cf. 6.6.1)" text {* @@ -445,21 +445,17 @@ | Protected \ True | Public \ True)" -syntax -Method_inheritable_in:: +abbreviation +Method_inheritable_in_syntax:: "prog \ (qtname \ mdecl) \ pname \ bool" ("_ \Method _ inheritable'_in _ " [61,61,61] 60) + where "G\Method m inheritable_in p == G\methdMembr m inheritable_in p" -translations -"G\Method m inheritable_in p" == "G\methdMembr m inheritable_in p" - -syntax +abbreviation Methd_inheritable_in:: "prog \ sig \ (qtname \ methd) \ pname \ bool" ("_ \Methd _ _ inheritable'_in _ " [61,61,61,61] 60) - -translations -"G\Methd s m inheritable_in p" == "G\(method s m) inheritable_in p" + where "G\Methd s m inheritable_in p == G\(method s m) inheritable_in p" subsubsection "declared-in/undeclared-in" @@ -486,17 +482,15 @@ fdecl (fn,f ) \ cdeclaredfield G C fn = Some f | mdecl (sig,m) \ cdeclaredmethd G C sig = Some m)" -syntax +abbreviation method_declared_in:: "prog \ (qtname \ mdecl) \ qtname \ bool" ("_\Method _ declared'_in _" [61,61,61] 60) -translations -"G\Method m declared_in C" == "G\mdecl (mthd m) declared_in C" + where "G\Method m declared_in C == G\mdecl (mthd m) declared_in C" -syntax +abbreviation methd_declared_in:: "prog \ sig \(qtname \ methd) \ qtname \ bool" ("_\Methd _ _ declared'_in _" [61,61,61,61] 60) -translations -"G\Methd s m declared_in C" == "G\mdecl (s,mthd m) declared_in C" + where "G\Methd s m declared_in C == G\mdecl (s,mthd m) declared_in C" lemma declared_in_classD: "G\m declared_in C \ is_class G C" @@ -538,26 +532,20 @@ of S will not inherit the member, regardless if they are in the same package as A or not.*} -syntax +abbreviation method_member_of:: "prog \ (qtname \ mdecl) \ qtname \ bool" ("_ \Method _ member'_of _" [61,61,61] 60) + where "G\Method m member_of C == G\(methdMembr m) member_of C" -translations - "G\Method m member_of C" \ "G\(methdMembr m) member_of C" - -syntax +abbreviation methd_member_of:: "prog \ sig \ (qtname \ methd) \ qtname \ bool" ("_ \Methd _ _ member'_of _" [61,61,61,61] 60) + where "G\Methd s m member_of C == G\(method s m) member_of C" -translations - "G\Methd s m member_of C" \ "G\(method s m) member_of C" - -syntax +abbreviation fieldm_member_of:: "prog \ vname \ (qtname \ field) \ qtname \ bool" ("_ \Field _ _ member'_of _" [61,61,61] 60) - -translations - "G\Field n f member_of C" \ "G\fieldm n f member_of C" + where "G\Field n f member_of C == G\fieldm n f member_of C" constdefs inherits:: "prog \ qtname \ (qtname \ memberdecl) \ bool" @@ -578,19 +566,15 @@ is necessary since not all members are inherited to subclasses. So such members are not member-of the subclass but member-in the subclass.*} -syntax +abbreviation method_member_in:: "prog \ (qtname \ mdecl) \ qtname \ bool" ("_ \Method _ member'_in _" [61,61,61] 60) + where "G\Method m member_in C == G\(methdMembr m) member_in C" -translations - "G\Method m member_in C" \ "G\(methdMembr m) member_in C" - -syntax +abbreviation methd_member_in:: "prog \ sig \ (qtname \ methd) \ qtname \ bool" ("_ \Methd _ _ member'_in _" [61,61,61,61] 60) - -translations - "G\Methd s m member_in C" \ "G\(method s m) member_in C" + where "G\Methd s m member_in C == G\(method s m) member_in C" lemma member_inD: "G\m member_in C \ \ provC. G\ C \\<^sub>C provC \ G \ m member_of provC" @@ -649,18 +633,16 @@ | Indirect: "\G\new overrides intr; G\intr overrides old\ \ G\new overrides old" -syntax +abbreviation (input) sig_stat_overrides:: "prog \ sig \ (qtname \ methd) \ (qtname \ methd) \ bool" ("_,_\ _ overrides\<^sub>S _" [61,61,61,61] 60) -translations - "G,s\new overrides\<^sub>S old" \ "G\(qmdecl s new) overrides\<^sub>S (qmdecl s old)" + where "G,s\new overrides\<^sub>S old == G\(qmdecl s new) overrides\<^sub>S (qmdecl s old)" -syntax +abbreviation (input) sig_overrides:: "prog \ sig \ (qtname \ methd) \ (qtname \ methd) \ bool" ("_,_\ _ overrides _" [61,61,61,61] 60) -translations - "G,s\new overrides old" \ "G\(qmdecl s new) overrides (qmdecl s old)" + where "G,s\new overrides old == G\(qmdecl s new) overrides (qmdecl s old)" subsubsection "Hiding" @@ -674,11 +656,10 @@ G\Method old declared_in (declclass old) \ G\Method old inheritable_in pid (declclass new)" -syntax -sig_hides:: "prog \ sig \ (qtname \ mdecl) \ (qtname \ mdecl) \ bool" +abbreviation +sig_hides:: "prog \ sig \ (qtname \ methd) \ (qtname \ methd) \ bool" ("_,_\ _ hides _" [61,61,61,61] 60) -translations - "G,s\new hides old" \ "G\(qmdecl s new) hides (qmdecl s old)" + where "G,s\new hides old == G\(qmdecl s new) hides (qmdecl s old)" lemma hidesI: "\is_static new; msig new = msig old; @@ -731,14 +712,14 @@ "prog \ (qtname \ memberdecl) \ qtname \ qtname \ bool" ("_ \ _ in _ permits'_acc'_from _" [61,61,61,61] 60) -"G\membr in class permits_acc_from accclass +"G\membr in cls permits_acc_from accclass \ (case (accmodi membr) of Private \ (declclass membr = accclass) | Package \ (pid (declclass membr) = pid accclass) | Protected \ (pid (declclass membr) = pid accclass) \ (G\accclass \\<^sub>C declclass membr - \ (G\class \\<^sub>C accclass \ is_static membr)) + \ (G\cls \\<^sub>C accclass \ is_static membr)) | Public \ True)" text {* The subcondition of the @{term "Protected"} case: @@ -774,12 +755,14 @@ | "G\Method m of cls accessible_from accclass \ accessible_fromR G accclass (methdMembr m) cls" -| Immediate: "\G\membr member_of class; +| Immediate: "!!membr class. + \G\membr member_of class; G\(Class class) accessible_in (pid accclass); G\membr in class permits_acc_from accclass \ \ G\membr of class accessible_from accclass" -| Overriding: "\G\membr member_of class; +| Overriding: "!!membr class C new old supr. + \G\membr member_of class; G\(Class class) accessible_in (pid accclass); membr=(C,mdecl new); G\(C,new) overrides\<^sub>S old; @@ -787,23 +770,21 @@ G\Method old of supr accessible_from accclass \\ G\membr of class accessible_from accclass" -syntax +abbreviation methd_accessible_from:: "prog \ sig \ (qtname \ methd) \ qtname \ qtname \ bool" ("_ \Methd _ _ of _ accessible'_from _" [61,61,61,61,61] 60) + where + "G\Methd s m of cls accessible_from accclass == + G\(method s m) of cls accessible_from accclass" -translations -"G\Methd s m of cls accessible_from accclass" - \ "G\(method s m) of cls accessible_from accclass" - -syntax +abbreviation field_accessible_from:: "prog \ vname \ (qtname \ field) \ qtname \ qtname \ bool" ("_ \Field _ _ of _ accessible'_from _" [61,61,61,61,61] 60) - -translations -"G\Field fn f of C accessible_from accclass" - \ "G\(fieldm fn f) of C accessible_from accclass" + where + "G\Field fn f of C accessible_from accclass == + G\(fieldm fn f) of C accessible_from accclass" inductive dyn_accessible_fromR :: "prog \ qtname \ (qtname \ memberdecl) \ qtname \ bool" @@ -817,34 +798,32 @@ | "G\Method m in C dyn_accessible_from accC \ dyn_accessible_fromR G accC (methdMembr m) C" -| Immediate: "\G\membr member_in class; +| Immediate: "!!class. \G\membr member_in class; G\membr in class permits_acc_from accclass \ \ G\membr in class dyn_accessible_from accclass" -| Overriding: "\G\membr member_in class; +| Overriding: "!!class. \G\membr member_in class; membr=(C,mdecl new); G\(C,new) overrides old; G\class \\<^sub>C supr; G\Method old in supr dyn_accessible_from accclass \\ G\membr in class dyn_accessible_from accclass" -syntax +abbreviation methd_dyn_accessible_from:: "prog \ sig \ (qtname \ methd) \ qtname \ qtname \ bool" ("_ \Methd _ _ in _ dyn'_accessible'_from _" [61,61,61,61,61] 60) + where + "G\Methd s m in C dyn_accessible_from accC == + G\(method s m) in C dyn_accessible_from accC" -translations -"G\Methd s m in C dyn_accessible_from accC" - \ "G\(method s m) in C dyn_accessible_from accC" - -syntax +abbreviation field_dyn_accessible_from:: "prog \ vname \ (qtname \ field) \ qtname \ qtname \ bool" ("_ \Field _ _ in _ dyn'_accessible'_from _" [61,61,61,61,61] 60) - -translations -"G\Field fn f in dynC dyn_accessible_from accC" - \ "G\(fieldm fn f) in dynC dyn_accessible_from accC" + where + "G\Field fn f in dynC dyn_accessible_from accC == + G\(fieldm fn f) in dynC dyn_accessible_from accC" lemma accessible_from_commonD: "G\m of C accessible_from S diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/Eval.thy --- a/src/HOL/Bali/Eval.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/Eval.thy Wed Feb 10 00:45:16 2010 +0100 @@ -125,20 +125,21 @@ assignment. *} -syntax (xsymbols) +abbreviation (xsymbols) dummy_res :: "vals" ("\") -translations - "\" == "In1 Unit" + where "\ == In1 Unit" + +abbreviation (input) + val_inj_vals ("\_\\<^sub>e" 1000) + where "\e\\<^sub>e == In1 e" -syntax - val_inj_vals:: "expr \ term" ("\_\\<^sub>e" 1000) - var_inj_vals:: "var \ term" ("\_\\<^sub>v" 1000) - lst_inj_vals:: "expr list \ term" ("\_\\<^sub>l" 1000) +abbreviation (input) + var_inj_vals ("\_\\<^sub>v" 1000) + where "\v\\<^sub>v == In2 v" -translations - "\e\\<^sub>e" \ "In1 e" - "\v\\<^sub>v" \ "In2 v" - "\es\\<^sub>l" \ "In3 es" +abbreviation (input) + lst_inj_vals ("\_\\<^sub>l" 1000) + where "\es\\<^sub>l == In3 es" constdefs undefined3 :: "('al + 'ar, 'b, 'c) sum3 \ vals" diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/Example.thy --- a/src/HOL/Bali/Example.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/Example.thy Wed Feb 10 00:45:16 2010 +0100 @@ -1202,74 +1202,52 @@ abbreviation "one == Suc 0" abbreviation "two == Suc one" -abbreviation "tree == Suc two" -abbreviation "four == Suc tree" +abbreviation "three == Suc two" +abbreviation "four == Suc three" + +abbreviation + "obj_a == \tag=Arr (PrimT Boolean) 2 + ,values= empty(Inr 0\Bool False)(Inr 1\Bool False)\" -syntax - obj_a :: obj - obj_b :: obj - obj_c :: obj - arr_N :: "(vn, val) table" - arr_a :: "(vn, val) table" - globs1 :: globs - globs2 :: globs - globs3 :: globs - globs8 :: globs - locs3 :: locals - locs4 :: locals - locs8 :: locals - s0 :: state - s0' :: state - s9' :: state - s1 :: state - s1' :: state - s2 :: state - s2' :: state - s3 :: state - s3' :: state - s4 :: state - s4' :: state - s6' :: state - s7' :: state - s8 :: state - s8' :: state +abbreviation + "obj_b == \tag=CInst Ext + ,values=(empty(Inl (vee, Base)\Null ) + (Inl (vee, Ext )\Intg 0))\" + +abbreviation + "obj_c == \tag=CInst (SXcpt NullPointer),values=CONST empty\" + +abbreviation "arr_N == empty(Inl (arr, Base)\Null)" +abbreviation "arr_a == empty(Inl (arr, Base)\Addr a)" + +abbreviation + "globs1 == empty(Inr Ext \\tag=undefined, values=empty\) + (Inr Base \\tag=undefined, values=arr_N\) + (Inr Object\\tag=undefined, values=empty\)" -translations - "obj_a" <= "\tag=Arr (PrimT Boolean) (CONST two) - ,values=CONST empty(CONST Inr 0\Bool False)(CONST Inr (CONST one)\Bool False)\" - "obj_b" <= "\tag=CInst (CONST Ext) - ,values=(CONST empty(CONST Inl (CONST vee, CONST Base)\Null ) - (CONST Inl (CONST vee, CONST Ext )\Intg 0))\" - "obj_c" == "\tag=CInst (SXcpt NullPointer),values=CONST empty\" - "arr_N" == "CONST empty(CONST Inl (CONST arr, CONST Base)\Null)" - "arr_a" == "CONST empty(CONST Inl (CONST arr, CONST Base)\Addr a)" - "globs1" == "CONST empty(CONST Inr (CONST Ext) \\tag=CONST undefined, values=CONST empty\) - (CONST Inr (CONST Base) \\tag=CONST undefined, values=arr_N\) - (CONST Inr Object\\tag=CONST undefined, values=CONST empty\)" - "globs2" == "CONST empty(CONST Inr (CONST Ext) \\tag=CONST undefined, values=CONST empty\) - (CONST Inr Object\\tag=CONST undefined, values=CONST empty\) - (CONST Inl a\obj_a) - (CONST Inr (CONST Base) \\tag=CONST undefined, values=arr_a\)" - "globs3" == "globs2(CONST Inl b\obj_b)" - "globs8" == "globs3(CONST Inl c\obj_c)" - "locs3" == "CONST empty(VName (CONST e)\Addr b)" - "locs4" == "CONST empty(VName (CONST z)\Null)(CONST Inr()\Addr b)" - "locs8" == "locs3(VName (CONST z)\Addr c)" - "s0" == " st (CONST empty) (CONST empty)" - "s0'" == " Norm s0" - "s1" == " st globs1 (CONST empty)" - "s1'" == " Norm s1" - "s2" == " st globs2 (CONST empty)" - "s2'" == " Norm s2" - "s3" == " st globs3 locs3 " - "s3'" == " Norm s3" - "s4" == " st globs3 locs4" - "s4'" == " Norm s4" - "s6'" == "(Some (Xcpt (Std NullPointer)), s4)" - "s7'" == "(Some (Xcpt (Std NullPointer)), s3)" - "s8" == " st globs8 locs8" - "s8'" == " Norm s8" - "s9'" == "(Some (Xcpt (Std IndOutBound)), s8)" +abbreviation + "globs2 == empty(Inr Ext \\tag=undefined, values=empty\) + (Inr Object\\tag=undefined, values=empty\) + (Inl a\obj_a) + (Inr Base \\tag=undefined, values=arr_a\)" + +abbreviation "globs3 == globs2(Inl b\obj_b)" +abbreviation "globs8 == globs3(Inl c\obj_c)" +abbreviation "locs3 == empty(VName e\Addr b)" +abbreviation "locs8 == locs3(VName z\Addr c)" + +abbreviation "s0 == st empty empty" +abbreviation "s0' == Norm s0" +abbreviation "s1 == st globs1 empty" +abbreviation "s1' == Norm s1" +abbreviation "s2 == st globs2 empty" +abbreviation "s2' == Norm s2" +abbreviation "s3 == st globs3 locs3" +abbreviation "s3' == Norm s3" +abbreviation "s7' == (Some (Xcpt (Std NullPointer)), s3)" +abbreviation "s8 == st globs8 locs8" +abbreviation "s8' == Norm s8" +abbreviation "s9' == (Some (Xcpt (Std IndOutBound)), s8)" declare Pair_eq [simp del] @@ -1293,7 +1271,7 @@ apply (rule eval_Is (* NewC *)) (* begin init Ext *) apply (erule_tac V = "the (new_Addr ?h) = b" in thin_rl) -apply (erule_tac V = "atleast_free ?h tree" in thin_rl) +apply (erule_tac V = "atleast_free ?h three" in thin_rl) apply (erule_tac [2] V = "atleast_free ?h four" in thin_rl) apply (erule_tac [2] V = "new_Addr ?h = Some a" in thin_rl) apply (rule eval_Is (* Init Ext *)) @@ -1336,7 +1314,7 @@ apply (drule alloc_one) apply (simp (no_asm_simp)) apply clarsimp -apply (erule_tac V = "atleast_free ?h tree" in thin_rl) +apply (erule_tac V = "atleast_free ?h three" in thin_rl) apply (drule_tac x = "a" in new_AddrD2 [THEN spec]) apply (simp (no_asm_use)) apply (rule eval_Is (* Try *)) diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/Name.thy --- a/src/HOL/Bali/Name.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/Name.thy Wed Feb 10 00:45:16 2010 +0100 @@ -20,13 +20,11 @@ datatype lname --{* names for local variables and the This pointer *} = EName ename | This -syntax - VName :: "vname \ lname" - Result :: lname +abbreviation VName :: "vname \ lname" + where "VName n == EName (VNam n)" -translations - "VName n" == "EName (VNam n)" - "Result" == "EName Res" +abbreviation Result :: lname + where "Result == EName Res" datatype xname --{* names of standard exceptions *} = Throwable diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/State.thy --- a/src/HOL/Bali/State.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/State.thy Wed Feb 10 00:45:16 2010 +0100 @@ -254,13 +254,11 @@ by (simp add: heap_def) -syntax - val_this :: "st \ val" - lookup_obj :: "st \ val \ obj" +abbreviation val_this :: "st \ val" + where "val_this s == the (locals s This)" -translations - "val_this s" == "CONST the (locals s This)" - "lookup_obj s a'" == "CONST the (heap s (the_Addr a'))" +abbreviation lookup_obj :: "st \ val \ obj" + where "lookup_obj s a' == the (heap s (the_Addr a'))" subsection "memory allocation" @@ -286,12 +284,8 @@ subsection "initialization" -syntax - - init_vals :: "('a, ty) table \ ('a, val) table" - -translations - "init_vals vs" == "CONST Option.map default_val \ vs" +abbreviation init_vals :: "('a, ty) table \ ('a, val) table" + where "init_vals vs == Option.map default_val \ vs" lemma init_arr_comps_base [simp]: "init_vals (arr_comps T 0) = empty" apply (unfold arr_comps_def in_bounds_def) @@ -325,11 +319,9 @@ init_obj :: "prog \ obj_tag \ oref \ st \ st" "init_obj G oi r \ gupd(r\\tag=oi, values=init_vals (var_tys G oi r)\)" -syntax +abbreviation init_class_obj :: "prog \ qtname \ st \ st" - -translations - "init_class_obj G C" == "init_obj G CONST undefined (CONST Inr C)" + where "init_class_obj G C == init_obj G undefined (Inr C)" lemma gupd_def2 [simp]: "gupd(r\obj) (st g l) = st (g(r\obj)) l" apply (unfold gupd_def) @@ -513,19 +505,17 @@ apply auto done -syntax +abbreviation raise_if :: "bool \ xname \ abopt \ abopt" + where "raise_if c xn == abrupt_if c (Some (Xcpt (Std xn)))" + +abbreviation np :: "val \ abopt \ abopt" + where "np v == raise_if (v = Null) NullPointer" - raise_if :: "bool \ xname \ abopt \ abopt" - np :: "val \ \ abopt \ abopt" - check_neg:: "val \ \ abopt \ abopt" - error_if :: "bool \ error \ abopt \ abopt" - -translations +abbreviation check_neg :: "val \ abopt \ abopt" + where "check_neg i' == raise_if (the_Intg i'<0) NegArrSize" - "raise_if c xn" == "abrupt_if c (Some (Xcpt (Std xn)))" - "np v" == "raise_if (v = Null) NullPointer" - "check_neg i'" == "raise_if (the_Intg i'<0) NegArrSize" - "error_if c e" == "abrupt_if c (Some (Error e))" +abbreviation error_if :: "bool \ error \ abopt \ abopt" + where "error_if c e == abrupt_if c (Some (Error e))" lemma raise_if_None [simp]: "(raise_if c x y = None) = (\c \ y = None)" apply (simp add: abrupt_if_def) @@ -592,22 +582,23 @@ types state = "abopt \ st" --{* state including abruption information *} -syntax - Norm :: "st \ state" - abrupt :: "state \ abopt" - store :: "state \ st" - translations - - "Norm s" == "(None,s)" - "abrupt" => "fst" - "store" => "snd" "abopt" <= (type) "State.abrupt option" "abopt" <= (type) "abrupt option" "state" <= (type) "abopt \ State.st" "state" <= (type) "abopt \ st" +abbreviation + Norm :: "st \ state" + where "Norm s == (None, s)" +abbreviation (input) + abrupt :: "state \ abopt" + where "abrupt == fst" + +abbreviation (input) + store :: "state \ st" + where "store == snd" lemma single_stateE: "\Z. Z = (s::state) \ False" apply (erule_tac x = "(Some k,y)" in all_dupE) @@ -683,15 +674,11 @@ lemma supd_abrupt_invariant [simp]: "abrupt (supd f s) = abrupt s" by (cases s) simp -syntax +abbreviation set_lvars :: "locals \ state \ state" + where "set_lvars l == supd (set_locals l)" - set_lvars :: "locals \ state \ state" - restore_lvars :: "state \ state \ state" - -translations - - "set_lvars l" == "supd (set_locals l)" - "restore_lvars s' s" == "set_lvars (locals (store s')) s" +abbreviation restore_lvars :: "state \ state \ state" + where "restore_lvars s' s == set_lvars (locals (store s')) s" lemma set_set_lvars [simp]: "\ s. set_lvars l (set_lvars l' s) = set_lvars l s" apply (simp (no_asm_simp) only: split_tupled_all) diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/Term.thy --- a/src/HOL/Bali/Term.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/Term.thy Wed Feb 10 00:45:16 2010 +0100 @@ -244,22 +244,23 @@ "stmt" <= (type) "Term.stmt" "term" <= (type) "(expr+stmt,var,expr list) sum3" -syntax - - this :: expr - LAcc :: "vname \ expr" ("!!") - LAss :: "vname \ expr \stmt" ("_:==_" [90,85] 85) - Return :: "expr \ stmt" - StatRef :: "ref_ty \ expr" +abbreviation this :: expr + where "this == Acc (LVar This)" + +abbreviation LAcc :: "vname \ expr" ("!!") + where "!!v == Acc (LVar (EName (VNam v)))" -translations - - "this" == "Acc (LVar This)" - "!!v" == "Acc (LVar (EName (VNam v)))" - "v:==e" == "Expr (Ass (LVar (EName (VNam v))) e)" - "Return e" == "Expr (Ass (LVar (EName Res)) e);; Jmp Ret" - --{* \tt Res := e;; Jmp Ret *} - "StatRef rt" == "Cast (RefT rt) (Lit Null)" +abbreviation + LAss :: "vname \ expr \stmt" ("_:==_" [90,85] 85) + where "v:==e == Expr (Ass (LVar (EName (VNam v))) e)" + +abbreviation + Return :: "expr \ stmt" + where "Return e == Expr (Ass (LVar (EName Res)) e);; Jmp Ret" --{* \tt Res := e;; Jmp Ret *} + +abbreviation + StatRef :: "ref_ty \ expr" + where "StatRef rt == Cast (RefT rt) (Lit Null)" constdefs @@ -275,17 +276,21 @@ expressions, variables and expression lists into general terms. *} -syntax - expr_inj_term:: "expr \ term" ("\_\\<^sub>e" 1000) - stmt_inj_term:: "stmt \ term" ("\_\\<^sub>s" 1000) - var_inj_term:: "var \ term" ("\_\\<^sub>v" 1000) - lst_inj_term:: "expr list \ term" ("\_\\<^sub>l" 1000) +abbreviation (input) + expr_inj_term :: "expr \ term" ("\_\\<^sub>e" 1000) + where "\e\\<^sub>e == In1l e" + +abbreviation (input) + stmt_inj_term :: "stmt \ term" ("\_\\<^sub>s" 1000) + where "\c\\<^sub>s == In1r c" -translations - "\e\\<^sub>e" \ "In1l e" - "\c\\<^sub>s" \ "In1r c" - "\v\\<^sub>v" \ "In2 v" - "\es\\<^sub>l" \ "In3 es" +abbreviation (input) + var_inj_term :: "var \ term" ("\_\\<^sub>v" 1000) + where "\v\\<^sub>v == In2 v" + +abbreviation (input) + lst_inj_term :: "expr list \ term" ("\_\\<^sub>l" 1000) + where "\es\\<^sub>l == In3 es" text {* It seems to be more elegant to have an overloaded injection like the following. @@ -300,7 +305,7 @@ @{text AxSem} don't follow this convention right now, but introduce subtle syntactic sugar in the relations themselves to make a distinction on expressions, statements and so on. So unfortunately you will encounter a -mixture of dealing with these injections. The translations above are used +mixture of dealing with these injections. The abbreviations above are used as bridge between the different conventions. *} diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/Trans.thy --- a/src/HOL/Bali/Trans.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/Trans.thy Wed Feb 10 00:45:16 2010 +0100 @@ -60,13 +60,13 @@ by (simp) declare the_var_AVar_def [simp del] -syntax (xsymbols) - Ref :: "loc \ expr" - SKIP :: "expr" +abbreviation + Ref :: "loc \ expr" + where "Ref a == Lit (Addr a)" -translations - "Ref a" == "Lit (Addr a)" - "SKIP" == "Lit Unit" +abbreviation + SKIP :: "expr" + where "SKIP == Lit Unit" inductive step :: "[prog,term \ state,term \ state] \ bool" ("_\_ \1 _"[61,82,82] 81) diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/Type.thy --- a/src/HOL/Bali/Type.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/Type.thy Wed Feb 10 00:45:16 2010 +0100 @@ -36,17 +36,11 @@ "ref_ty" <= (type) "Type.ref_ty" "ty" <= (type) "Type.ty" -syntax - NT :: " \ ty" - Iface :: "qtname \ ty" - Class :: "qtname \ ty" - Array :: "ty \ ty" ("_.[]" [90] 90) - -translations - "NT" == "RefT NullT" - "Iface I" == "RefT (IfaceT I)" - "Class C" == "RefT (ClassT C)" - "T.[]" == "RefT (ArrayT T)" +abbreviation "NT == RefT NullT" +abbreviation "Iface I == RefT (IfaceT I)" +abbreviation "Class C == RefT (ClassT C)" +abbreviation Array :: "ty \ ty" ("_.[]" [90] 90) + where "T.[] == RefT (ArrayT T)" constdefs the_Class :: "ty \ qtname" diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/TypeRel.thy --- a/src/HOL/Bali/TypeRel.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/TypeRel.thy Wed Feb 10 00:45:16 2010 +0100 @@ -35,37 +35,22 @@ (*subclseq, by translation*) (* subclass + identity *) implmt1 :: "prog \ (qtname \ qtname) set" --{* direct implementation *} -syntax +abbreviation + subint1_syntax :: "prog => [qtname, qtname] => bool" ("_|-_<:I1_" [71,71,71] 70) + where "G|-I <:I1 J == (I,J) \ subint1 G" - "_subint1" :: "prog => [qtname, qtname] => bool" ("_|-_<:I1_" [71,71,71] 70) - "_subint" :: "prog => [qtname, qtname] => bool" ("_|-_<=:I _"[71,71,71] 70) - (* Defined in Decl.thy: - "_subcls1" :: "prog => [qtname, qtname] => bool" ("_|-_<:C1_" [71,71,71] 70) - "_subclseq":: "prog => [qtname, qtname] => bool" ("_|-_<=:C _"[71,71,71] 70) - "_subcls" :: "prog => [qtname, qtname] => bool" ("_|-_<:C _"[71,71,71] 70) - *) - "@implmt1" :: "prog => [qtname, qtname] => bool" ("_|-_~>1_" [71,71,71] 70) - -syntax (xsymbols) +abbreviation + subint_syntax :: "prog => [qtname, qtname] => bool" ("_|-_<=:I _"[71,71,71] 70) + where "G|-I <=:I J == (I,J) \(subint1 G)^*" --{* cf. 9.1.3 *} - "_subint1" :: "prog \ [qtname, qtname] \ bool" ("_\_\I1_" [71,71,71] 70) - "_subint" :: "prog \ [qtname, qtname] \ bool" ("_\_\I _" [71,71,71] 70) - (* Defined in Decl.thy: -\ "_subcls1" :: "prog \ [qtname, qtname] \ bool" ("_\_\\<^sub>C\<^sub>1_" [71,71,71] 70) - "_subclseq":: "prog \ [qtname, qtname] \ bool" ("_\_\\<^sub>C _" [71,71,71] 70) - "_subcls" :: "prog \ [qtname, qtname] \ bool" ("_\_\\<^sub>C _" [71,71,71] 70) - *) - "_implmt1" :: "prog \ [qtname, qtname] \ bool" ("_\_\1_" [71,71,71] 70) +abbreviation + implmt1_syntax :: "prog => [qtname, qtname] => bool" ("_|-_~>1_" [71,71,71] 70) + where "G|-C ~>1 I == (C,I) \ implmt1 G" -translations - - "G\I \I1 J" == "(I,J) \ subint1 G" - "G\I \I J" == "(I,J) \(subint1 G)^*" --{* cf. 9.1.3 *} - (* Defined in Decl.thy: - "G\C \\<^sub>C\<^sub>1 D" == "(C,D) \ subcls1 G" - "G\C \\<^sub>C D" == "(C,D) \(subcls1 G)^*" - *) - "G\C \1 I" == "(C,I) \ implmt1 G" +notation (xsymbols) + subint1_syntax ("_\_\I1_" [71,71,71] 70) and + subint_syntax ("_\_\I _" [71,71,71] 70) and + implmt1_syntax ("_\_\1_" [71,71,71] 70) section "subclass and subinterface relations" diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/WellForm.thy --- a/src/HOL/Bali/WellForm.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/WellForm.thy Wed Feb 10 00:45:16 2010 +0100 @@ -2925,7 +2925,7 @@ then show "?P m" by (auto simp add: permits_acc_def) next - case (Overriding new C declC newm old Sup) + case (Overriding new declC newm old Sup C) assume member_new: "G \ new member_in C" and new: "new = (declC, mdecl newm)" and override: "G \ (declC, newm) overrides old" and diff -r 894e82be8d05 -r af4c18c30593 src/HOL/Bali/WellType.thy --- a/src/HOL/Bali/WellType.thy Tue Feb 09 16:07:09 2010 +0100 +++ b/src/HOL/Bali/WellType.thy Wed Feb 10 00:45:16 2010 +0100 @@ -43,11 +43,9 @@ "env" <= (type) "\prg::prog,cls::qtname,lcl::lenv,\::'a\" - -syntax +abbreviation pkg :: "env \ pname" --{* select the current package from an environment *} -translations - "pkg e" == "pid (cls e)" + where "pkg e == pid (cls e)" section "Static overloading: maximally specific methods " @@ -426,29 +424,33 @@ E,dt\e#es\\T#Ts" -syntax (* for purely static typing *) - "_wt" :: "env \ [term,tys] \ bool" ("_|-_::_" [51,51,51] 50) - "_wt_stmt" :: "env \ stmt \ bool" ("_|-_:<>" [51,51 ] 50) - "_ty_expr" :: "env \ [expr ,ty ] \ bool" ("_|-_:-_" [51,51,51] 50) - "_ty_var" :: "env \ [var ,ty ] \ bool" ("_|-_:=_" [51,51,51] 50) - "_ty_exprs":: "env \ [expr list, - \ ty list] \ bool" ("_|-_:#_" [51,51,51] 50) +(* for purely static typing *) +abbreviation + wt_syntax :: "env \ [term,tys] \ bool" ("_|-_::_" [51,51,51] 50) + where "E|-t::T == E,empty_dt\t\ T" + +abbreviation + wt_stmt_syntax :: "env \ stmt \ bool" ("_|-_:<>" [51,51 ] 50) + where "E|-s:<> == E|-In1r s :: Inl (PrimT Void)" + +abbreviation + ty_expr_syntax :: "env \ [expr, ty] \ bool" ("_|-_:-_" [51,51,51] 50) + where "E|-e:-T == E|-In1l e :: Inl T" -syntax (xsymbols) - "_wt" :: "env \ [term,tys] \ bool" ("_\_\_" [51,51,51] 50) - "_wt_stmt" :: "env \ stmt \ bool" ("_\_\\" [51,51 ] 50) - "_ty_expr" :: "env \ [expr ,ty ] \ bool" ("_\_\-_" [51,51,51] 50) - "_ty_var" :: "env \ [var ,ty ] \ bool" ("_\_\=_" [51,51,51] 50) - "_ty_exprs" :: "env \ [expr list, - \ ty list] \ bool" ("_\_\\_" [51,51,51] 50) +abbreviation + ty_var_syntax :: "env \ [var, ty] \ bool" ("_|-_:=_" [51,51,51] 50) + where "E|-e:=T == E|-In2 e :: Inl T" -translations - "E\t\ T" == "E,empty_dt\t\ T" - "E\s\\" == "E\In1r s\CONST Inl (PrimT Void)" - "E\e\-T" == "E\In1l e\CONST Inl T" - "E\e\=T" == "E\In2 e\CONST Inl T" - "E\e\\T" == "E\In3 e\CONST Inr T" +abbreviation + ty_exprs_syntax :: "env \ [expr list, ty list] \ bool" ("_|-_:#_" [51,51,51] 50) + where "E|-e:#T == E|-In3 e :: Inr T" +notation (xsymbols) + wt_syntax ("_\_\_" [51,51,51] 50) and + wt_stmt_syntax ("_\_\\" [51,51 ] 50) and + ty_expr_syntax ("_\_\-_" [51,51,51] 50) and + ty_var_syntax ("_\_\=_" [51,51,51] 50) and + ty_exprs_syntax ("_\_\\_" [51,51,51] 50) declare not_None_eq [simp del] declare split_if [split del] split_if_asm [split del]