Algorithmic Game Semantics (Survey) by jxu74514

VIEWS: 15 PAGES: 21

									Algorithmic Game Semantics (Survey)


           Hongseok Yang
               KAIST




                                      1
Game Semantics
   Game semantics cares about how a term interacts with the
    environment by output/inputs or by accessing free
    variables.
       A function lx. x+y is interpreted by the following
        interaction between opponent (O) and player (P):
        1.  O asks the result of the function;
        2.  P asks the value of the input x;
        3.  O provides the value of x, denoted by n;
        4.  P asks the value of the free variable y;
        5.  O provides the value of y, denoted by m; and
        6.  P gives the result of the function, which is n+m.
   In game semantics, this interaction is expressed by a set of
    sequences {qqx0qy00, qqx0qy11, …, qqx4qy59, … }, that is,
    scripts for certain games.
                                                             2
Game Semantics: Success Stories
Full abstraction of PCF:
  Abramsky&Jagadeesan&Malacaria, Hyland&Ong,
  Nicau
Full abstraction of PCF+states:
  Abramsky&Mccusker
Full abstraction of PCF+control operators:
  Laird
Full abstraction of PCF+general references:
  Abramsky&Honda&Mccusker


                                           3
Complaints about Game Semantics
   The real game semantics, however, is much more
    complicated.
      A term is interpreted as a strategy, which is a
        set of “justified” sequences that satisfies
        certain conditions.
      Though the semantics is compositional,
        working with the semantics to show useful
        results about programs requires complicated
        combinatorial reasoning.
   It is not clear what reasoning principles a game
    model can provide.

                                                    4
Ghica&McGusker’s Solution
   Key observation: when only first-order functions
    and tail-recursions are considered, the existing
    game models can be simplified dramatically. In
    fact, they can be expressed using regular
    languages.
   They considered such a restriction on Idealized
    Algol, which is a higher-order call-by-name
    imperative programming language.




                                                   5
Second-order Finitary Idealized Algol
   The second-order finitary Idealized Algol is a
    call-by-name imperative programming language
    with first-order procedures.
   Types:
       Data Type:     D ::= bool | Nint
       Basic Type: B ::= exp[D] | com | var[D]
       General Type: T ::= B | B->T
   Terms
       x1:T1 … xn:T |- t: T


                                                6
Terms in the Second-order Finitary
Idealized Algol
   Typing rules:




   Some constants:




                                     7
Interpretation
   All data types D and general type T are interpreted
    as finite sets MD and MT, whose elements are
    called “moves.”
   Each term“x1:T1..xn:Tn|-t:T”is interpreted as a
    regular language Rt over the alphabet
    MT1+..+MTn+MT.
   The regular language R denotes all the interaction
    between the term t and the environment.




                                                    8
Interpretation of Types
   A type is interpreted as a finite set:




                                             9
Interpretation of Constant Terms
   A constant k:T is interpreted as a regular language
    over MT.




                                                   10
Interpretation of Terms
   A term “x:T1..x:Tn |- t:T” denotes a regular
    language over MT1+..+MTn+MT.
   The interpretation is defined inductively on the
    size of the proof tree of “x:T1..x:Tn |- t:T.”
   “G, x:T |- x:T” is interpreted by the copycat
    strategy.




                                                       11
Interpretation of Lambda Abstraction


   The lambda abstraction is interpreted simply by
    renaming the tags of moves in disjoint union.

    where f is the “tag-renaming” isomorphism:

   E.g:



                                                      12
Interpretation of Application
   Application = linear application + contractions




   We interpret linear application and contraction
    instead.




                                                      13
Interpretation of Linear Application


   We let t and u interact, and hide the interaction.

    where




                                                     14
Interpretation of Linear Application
     “y:T ` (lx.x) true : exp[bool]”
   Let R,S be the interpretations of (lx.x) and true:




   We use MD* = e:




   So, the interpretation of y:T`(lx.x)true:exp[bool] is qb trueb

                                                               15
Interpretation of Contraction


   We rename the tags of the moves for x and y so
    that they become moves for the same variable z.

    where

   E.g:



                                                 16
Interpretation of Variable Declaration


   We restrict the play of the opponent for x, and
    hide the interaction for the variable x.

    where




                                                      17
Example: Locality of Variables




   Note that p:com|- p:com is also interpreted as
    runbrunadoneadone^b. So, “p” and “new x in p”
    are equivalent.




                                                     18
Model-Checking Algorithm of
Observational Equivalence
   The presented game semantics is fully abstract;
    therefore, two terms have the same denotations iff
    they are observationally equivalent.
   The semantics interprets a term by a regular
    language.
   So, the behavioral equivalence reduces to the
    equivalence of two regular languages, which is
    decidable.




                                                  19
Hoare Triples
   A Hoare triple {P}C{Q} is expressible by an
    observational equivalence of the following two
    programs:




   So, when the semantics can interpret assertions
    as regular languages, it provides a model-
    checking algorithm of Hoare triples.


                                                     20
Conclusion
   Ghica and McGusker initiated a new direction of research in
    the game semantics community, called algorithmic game
    semantics.
   Algorithmic game semanticists produce “practical” models
    in that they are understandable and can be used for
    software model checking.
   This idea allows a compositional model checking method,
    and the algorithmic game model can serve as a concrete
    semantics for doing abstract interpretation.
   No model checking tools have been implemented based on
    this idea yet. And, the model checking algorithm, as it is in
    the semantics, is very slow.


                                                             21

								
To top