Docsity

EECS 755 Project: Defining and Verifying a Simple Expression Language - Prof. Perry Alexan, Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
EECS 755 - Systems Requirements Modeling
Fall Semester, 2007
Project 1
October 17, 2007
This project involves defining a simple language and verifying correctness
properties related to evaluation and type checking. Specifically, we will
define the abstract syntax of a simple expression language and define eval
and typeof function that evaluate and determine the type of expressions
respectively. Finally, we will verify the standard progress and preservation
properties for the language.
Please submit a single Isabelle theory file that contains your definitions and
proofs. You are free to use any Isabelle definition or verification features
in your solution. Documentation is important - particularly if you do not
complete your proofs.
1. Using the Isabelle definition mechanism of your choice, define the
typeof function that takes a term and returns its type.
2. Prove the following theorems over your typeof function:
(a) T rue ∧F alse :: boolean
(b) [[A:: boolean;B:: boolean]] =⇒A∧B:: boolean
(c) C:: boolean =⇒if C then 1else 2 :: integ er
(d) [[A:: boolean;B:: boolean;C:: boolean]] =⇒(A∧B)∧C::
boolean
(e) (1 + 2) >2 :: boolean
3. Using the Isabelle definition mechanism of your choice, define the
eval function that takes a term and returns its value.
1
pf3

Partial preview of the text

Download EECS 755 Project: Defining and Verifying a Simple Expression Language - Prof. Perry Alexan and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

EECS 755 - Systems Requirements Modeling

Fall Semester, 2007

Project 1

October 17, 2007

This project involves defining a simple language and verifying correctness properties related to evaluation and type checking. Specifically, we will define the abstract syntax of a simple expression language and define eval and typeof function that evaluate and determine the type of expressions respectively. Finally, we will verify the standard progress and preservation properties for the language.

Please submit a single Isabelle theory file that contains your definitions and proofs. You are free to use any Isabelle definition or verification features in your solution. Documentation is important - particularly if you do not complete your proofs.

  1. Using the Isabelle definition mechanism of your choice, define the typeof function that takes a term and returns its type.
  2. Prove the following theorems over your typeof function:

(a) T rue ∧ F alse :: boolean (b) [[A :: boolean; B :: boolean]] =⇒ A ∧ B :: boolean (c) C :: boolean =⇒ if C then 1 else 2 :: integer (d) [[A :: boolean; B :: boolean; C :: boolean]] =⇒ (A ∧ B) ∧ C :: boolean (e) (1 + 2) > 2 :: boolean

  1. Using the Isabelle definition mechanism of your choice, define the eval function that takes a term and returns its value.
  1. Translate the following expressions into your language AST and prove the following theorems over your eval function:

(a) T rue ∧ F alse = F alse (b) A ∧ B = B ∧ A (c) (A ∧ B) ∧ C = A ∧ (B ∧ C) (d) if T rue ∧ F alse then 1 else 2 = 2 (e) (if C then 1 else 2 = 1)OR(if C then 1 else 2 = 2)

You can always add the assumption that your variables are of the correct type if that is useful for you.

  1. Prove the preservation assertion over your typeof and eval func- tions. Recall that preservation is showing that the type of an expres- sion is the same as the type of the value resulting from evaluation: typeof (t) = typeof (eval(t)) Remember that you can add the assumption that t type checks cor- rectly.
  2. Prove the progress assertion over your eval function. Recall that progress is showing that either an expression is a value or evaluates to a value where values are True, False and integers.