src/HOL/IMP/Procs.thy
author wenzelm
Sun Nov 02 18:21:45 2014 +0100 (2014-11-02)
changeset 58889 5b7a9633cfa8
parent 58310 91ea607a34d8
permissions -rw-r--r--
modernized header uniformly as section;
wenzelm@58889
     1
section "Extensions and Variations of IMP"
kleing@43158
     2
kleing@43158
     3
theory Procs imports BExp begin
kleing@43158
     4
kleing@43158
     5
subsection "Procedures and Local Variables"
kleing@43158
     6
nipkow@45212
     7
type_synonym pname = string
nipkow@45212
     8
blanchet@58310
     9
datatype
kleing@43158
    10
  com = SKIP 
nipkow@45212
    11
      | Assign vname aexp        ("_ ::= _" [1000, 61] 61)
nipkow@52046
    12
      | Seq    com  com          ("_;;/ _"  [60, 61] 60)
kleing@43158
    13
      | If     bexp com com     ("(IF _/ THEN _/ ELSE _)"  [0, 0, 61] 61)
kleing@43158
    14
      | While  bexp com         ("(WHILE _/ DO _)"  [0, 61] 61)
nipkow@52046
    15
      | Var    vname com        ("(1{VAR _;/ _})")
nipkow@52046
    16
      | Proc   pname com com    ("(1{PROC _ = _;/ _})")
nipkow@45212
    17
      | CALL   pname
kleing@43158
    18
kleing@43158
    19
definition "test_com =
nipkow@52046
    20
{VAR ''x'';
nipkow@52046
    21
 {PROC ''p'' = ''x'' ::= N 1;
nipkow@52046
    22
  {PROC ''q'' = CALL ''p'';
nipkow@52046
    23
   {VAR ''x'';
nipkow@52046
    24
    ''x'' ::= N 2;;
nipkow@52046
    25
    {PROC ''p'' = ''x'' ::= N 3;
nipkow@52046
    26
     CALL ''q'';; ''y'' ::= V ''x''}}}}}"
kleing@43158
    27
kleing@43158
    28
end