Logic, Relational Semantics, and CoInduction - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Logic, Relational Semantics, and CoInduction

Description:

A form of 'big step' semantics, where we can go from an initial configuration to ... We will devise a semantics resembling type inference -- statically infer the ... – PowerPoint PPT presentation

Number of Views:141
Avg rating:3.0/5.0
Slides: 26
Provided by: markh77
Category:

less

Transcript and Presenter's Notes

Title: Logic, Relational Semantics, and CoInduction


1
Logic, Relational Semantics, and Co-Induction
  • Mark Hills
  • CS498
  • 11/17/2004

2
Outline
  • Programming Language Semantics
  • Relational Semantics
  • Static Semantics/Typing
  • Dynamic Semantics/Values
  • Consistency
  • Our Sample Language
  • Syntax
  • Static Semantics
  • Dynamic Semantics
  • Non-well-founded sets, closures, and the need for
    co-induction

3
Outline, Next Lecture
  • The Proof of Consistency
  • Mechanization in Isabelle HOL

4
Relational Semantics
  • A form of big step semantics, where we can go
    from an initial configuration to the final
    configuration as one large transition
  • Rules similar to natural deduction rules, allow
    us to create a derivation
  • Program meaning can then be deduced in a manner
    similar to a proof

5
Relational Semantics Examples
6
Static Semantics
  • Used to assign any meaning to a language that we
    can determine statically here, we use it to
    assign types to expressions
  • Static since they are based on the syntax of the
    language, not dynamic runtime information for the
    language
  • We will devise a semantics resembling type
    inference -- statically infer the types of
    expressions in our language

7
Dynamic Semantics
  • Determine the meaning of language constructs
    during execution
  • Interested in values produced by executions of
    programs in a language
  • Dynamic, since determined by what actually
    happens during the execution of a program we
    cannot determine the values statically

8
A Potential Problem
  • What if the type of the value derived using the
    dynamic semantics and the type of the expression
    derived using the static semantics are different?

9
Consistency
  • The type of an expression in the static semantics
    should be identical to the type of a value for
    that expression in the dynamic semantics
  • Papers goal prove that this is the case for a
    simple language

10
The Sample Language
  • Our language is a simple language of expressions,
    with constants, variables, function abstraction,
    function application, and an explicit recursive
    function operator
  • The recursive function operator is what leads us
    to co-induction

11
Language Conventions
  • We assume the following definitions

12
Expressions
  • Expressions take the form shown below
  • Lambda abstractions are represented by the fn
    expression, while recursive functions use fix

13
Notational Conventions
  • Taking A and B to be two sets, we have the
    following standard definitions
  • A B is the disjoint union (originally this was
    )
  • A ?fin B is the set of finite maps from A to B
  • a1 ? b1, , an ? bn is another notation for the
    set of finite maps, with as the empty set
  • dom(f) is the domain of the finite map f, while
    rng(f) is the range
  • If f, g are elements of A ?fin B f g means f
    modified by g, meaning that the value would be
    g(a) if a 2 dom(g) otherwise f(a)

14
Dynamic Semantics
  • Expressions evaluate to values in environments.
    Here is our notation for them

15
Dynamic Semantics
16
Dynamic Semantics
17
Static Semantics
  • Expressions elaborate to some type in a type
    environment. Here is our notation for types and
    type environments

18
Static Semantics
19
Static Semantics
20
Consistency
  • We want to show that the dynamic and static
    semantics are consistent
  • We need a stronger notion than basic consistency
    since we also need to reason about types for
    values, specifically in our case closures

21
Consistency
  • Our correspondence relation we want the
    greatest fixed point of this

22
Our Problem
  • If we have a closure that references itself, it
    wont be an element of s, since we are
    calculating it

23
Non-Well-Founded Sets
  • Languages contain many examples of
    non-well-founded sets, including closures for
    recursive functions, which is what we will be
    focusing on here
  • Since we are dealing with a non-well-founded set,
    we cannot use induction instead, we need to use
    co-induction

24
Next Time
  • Discuss the proof on consistency
  • Hopefully see it in Isabelle HOL
  • Note they do NOT use the method
    (abstraction/representation functions from an
    existing type) that we have been using

25
References
  • Some material in this paper is from Co-induction
    in relational semantics by Robin Milner and Mads
    Tofte, from Theoretical Computer Science 87
    (1991), 209-220
  • The core of this paper is based on A case-study
    of co-induction in Isabelle HOL by Jacob Frost.
  • Additional material on semantics is from
    Semantics of Programming Languages by Carl Gunter.

26
Operational Semantics
  • Operational semantics provides the semantics for
    a programming language by describing how a
    computation is performed
  • We can think of a program as having some sort of
    instruction state the code we are executing and
    our point of control in that code as well as
    data state
  • To simplify matters, instead of keeping track of
    the control state, we can actually modify the
    program as we go so that the next instruction to
    execute is the next one in the program
  • We can then keep track of a machine
    configuration, made up of the instruction state
    and the data state, or memory, and see our
    semantics as being a relation from states to
    states
  • This method of semantics is referred to as
    structural operational semantics or transition
    semantics, and is considered a small step
    semantics, since each step in the execution of
    the program provides a transform from a
    configuration to a following configuration
  • Instead of doing this, we could also specify
    semantics in terms of a big step, from the
    initial configuration to the final memory contents

27
Example Language
28
Transition Semantics Examples
Write a Comment
User Comments (0)
About PowerShow.com