Docsity

Understanding Expression Meaning: Denotational Semantics & Proof Trees - Prof. Alan Mattox, Study notes of Programming Languages

Toggle sidebar
bg1
CS 440 — Denotational Semantics April 3, 2009
1 Introduction and Objectives
In this lecture we demonstrate another kind of semantics.
Your objective is to know the different parts of a natural rule, how to structure a proof-tree,
and how natural semantics are different than operational semantics.
2 Semantic Rules
How do you explain what an expression means?
The major insight of language semantics is that the meaning of an expression can be determined
by combining the meaning of its subexpressions.
Examples:
•What is the meaning of (if true 4 38)?
•What is the meaning of (+ 8 34)?
An evaluation has the following form:
e⇓v
where eis some expression, and vis a value.
•(if true 4 38) ⇓4
•(+ 13 4)⇓17
Note: a textual numeral 13 represents the mathematical number 13.
2.1 The Parts of a Rule
M1⇓true M2⇓V
(if M1M2M3)⇓V
•Assumptions are above the bar.
•Conclusion is below the bar.
•If a rule has no assumptions, then it is called an axiom.
•The ⇓is pronounced “evaluates to” or “down-arrow”.
Mattox Beckman Page 1 Illinois Institute of Technology
pf3
pf4

Partial preview of the text

Download Understanding Expression Meaning: Denotational Semantics & Proof Trees - Prof. Alan Mattox and more Study notes Programming Languages in PDF only on Docsity!

1 Introduction and Objectives

In this lecture we demonstrate another kind of semantics. Your objective is to know the different parts of a natural rule, how to structure a proof-tree, and how natural semantics are different than operational semantics.

2 Semantic Rules

How do you explain what an expression means? The major insight of language semantics is that the meaning of an expression can be determined by combining the meaning of its subexpressions. Examples:

  • What is the meaning of (if true 4 38)?
  • What is the meaning of (+ 8 34)?

An evaluation has the following form:

e ⇓ v

where e is some expression, and v is a value.

  • (if true 4 38) ⇓ 4
  • (+ 13 4) ⇓ 17

Note: a textual numeral 13 represents the mathematical number 13.

2.1 The Parts of a Rule

M 1 ⇓ true M 2 ⇓ V (if M 1 M 2 M 3 ) ⇓ V

  • Assumptions are above the bar.
  • Conclusion is below the bar.
  • If a rule has no assumptions, then it is called an axiom.
  • The ⇓ is pronounced “evaluates to” or “down-arrow”.

2.2 Some Simple Rules

Integers

n ⇓ n

Booleans

true ⇓ true

false ⇓ f alse

Addition

e 1 ⇓ v 1 e 2 ⇓ v 2 (+ e 1 e 2 ⇓ v 1 + v 2

General Operators

e 1 ⇓ v 1 e 2 ⇓ v 2 (⊕ e 1 e 2 ) ⇓ v 1 ⊕ v 2

3 Proof Trees

To use these rules, you combine them into a proof tree. To prove: (* (+ 2 3) (+ 3 5)) ⇓ 40

3.1 Activity

  • Try writing the rules for if, and, and or.

5 Activity

Try the following problems.

  1. Write a rule for a function that has two parameters.
  2. Write a rule for the map function.