COMP4161 S2/2016 Advanced Topics in Software Verification

COMP4161 S2/2016
Advanced Topics in Software Verification
Assignment 1 Solution
August 7, 2016
1
Types
Let Γ = [x :: δ ⇒ δ ⇒ α, a :: α ⇒ β ⇒ γ, b :: δ, c :: δ ⇒ β] in
Γ ` a :: α ⇒ β ⇒ γ
var
∆
Γ ` a (x b b) :: β ⇒ γ
app
Γ ` c :: δ ⇒ β
var
Γ ` c b :: β
Γ ` a (x b b) (c b) :: γ
var
app
Γ ` b :: δ
app
[x :: δ ⇒ δ ⇒ α, a :: α ⇒ β ⇒ γ, b :: δ] ` λc. a (x b b) (c b) :: (δ ⇒ β) ⇒ γ
abs
[x :: δ ⇒ δ ⇒ α, a :: α ⇒ β ⇒ γ] ` λb c. a (x b b) (c b) :: δ ⇒ (δ ⇒ β) ⇒ γ
[x :: δ ⇒ δ ⇒ α] ` λa b c. a (x b b) (c b) :: (α ⇒ β ⇒ γ) ⇒ δ ⇒ (δ ⇒ β) ⇒ γ
abs
abs
where the tree ∆ is:
var
var
Γ ` x :: δ ⇒ δ ⇒ α
Γ ` b :: δ app
Γ ` x b :: δ ⇒ α
Γ ` x b b :: α
var
Γ ` b :: δ app
The term is type correct in contexts that map x to the type δ ⇒ δ ⇒ α.
1
2
λ-Calculus
(a)
or true false
=or (λx y. if x true y) true false
−→β (λy. if true true y) false
−→β if true true false
=if (λz x y. z x y) true true false
−→β (λx y. true x y) true false
−→β (λy. true true y) false
−→β true true false
=true (λx y. x) true false
−→β (λy. true) false
−→β true
(b) A type for λ x y. x is α ⇒ β ⇒ α.
[x :: α, y :: β] ` x :: α
var
[x :: α] ` λ y. x :: β ⇒ α
[] ` λ x y. x :: α ⇒ β ⇒ α
abs
abs
(c) A type for or true false is α ⇒ β ⇒ α. Indeed, β reduction satisfies
the property of subject reduction meaning that a term has the same type
than its normal form. The β normal form for or true false is true and
it is of type α ⇒ β ⇒ α.
3
Propositional Logic
See the Isabelle theory.
4
Higher Order Logic
See the Isabelle theory.
2