theory SALOverflowPlatform_deep = SALSafetyLogic_deep + TupleOrd: section {* SAL Overflow Platform *} text {* In this theory we instantiate a wellformedness checker and the generic VCG from the PCC Framework. *} subsection {* Wellformedness Checker *} consts checkPos :: "SALprogram \ (pos list) \ bool" primrec "checkPos prg [] = True" "checkPos prg (pc # pcs) = (if (let (pn, i) = pc in (case (cmd prg pc) of None \ False | Some c \ (case c of SET x n \ True | ADD x y \ True | SUB x y \ True | INC x \ True | JMPEQ x y t \ (t = 0) \ ((anF prg (pn, i)) \ None) | JMPL x y t \ (t = 0) \ ((anF prg (pn, i)) \ None) | JLE x y t \ (t = 0) \ ((anF prg (pn, i)) \ None) | JMPB t \ ((anF prg (pn, i - t)) \ None) | JMPI x \ (case (anF prg pc) of None \ False | Some A \ jumptargets pn x A \ []) | CALL x pn' \ (anF prg (pn', 0) \ None) | RET x \ (list_all (\ (pc, B). anF prg pc \ None) (ret_succs prg pc x (callpoints prg pn))) \ (0 < pn) | MOV s t \ True | HALT \ True ))) then (checkPos prg pcs) else False)" constdefs wf :: "SALprogram \ bool" "wf prg \ checkPos prg (domC prg)" constdefs domA :: "SALprogram \ pos list" "domA \ \ prg. [pc\ domC prg. (anF prg pc) \ None]" constdefs vcgSALDeep :: "SALprogram \ SALform" "vcgSALDeep prg \ vcG Conj Impl FalseF ipc initF safeF succsF wpF domC domA anF prg" syntax callmem :: "env \ tram" ("\ _") callpc :: "env \ pos" ("\ _") callenv :: "env \ env" ("\ _") subsection {* Generate ML code for the VCG *} (*<*) types_code set ("(_ -> bool)") consts_code "op :" ("(_ |> _)") "Collect" ("(_)") ML {* fun term_of_fun_type _ _ _ _= error "term_of_fun_type applied" *} ML {* fun term_of_bool _ = error "term_of_bool applied" *} (*>*) generate_code ("vcgSALDeep.ML") [term_of] vcg = "vcgSALDeep" end