A+Practical+Theory+of+Programming+05

A+Practical+Theory+of+Programming+05 - Specification state...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Specification state space memory int ; (0,..20); char ; rat state memory contents –2; 15; "A"; 3.14 prestate initial state σ = σ ; σ 1 ; σ 2 ; σ 3 = i ; n ; c ; x poststate final state σ′ = σ′ ; σ′ 1 ; σ′ 2 ; σ′ 3 = i ′ ; n ′ ; c ′ ; x ′ addresses low level 0 , 1 , 2 , 3 state variables high level i , n , c , x initial values i , n , c , x final values i ′ , n ′ , c ′ , x ′ For now: prestate, poststate Later: time (termination = finite time), space, interaction, communication, ... 1/64 Specification specification of computer behavior: a boolean expression in variables σ and σ′ We provide a prestate as input. A computation satisfies a specification by computing a satisfactory poststate as output. The given prestate and computed poststate must make the specification true. 2/64 Specification specification of computer behavior: a boolean expression in the initial values x , y , ... and final values x ′ , y ′ , ... of some state variables We provide initial values as input. A computation satisfies a specification by computing satisfactory final values as output. The given initial values and computed final values must make the specification true. 3/64 Specification Specification S is unsatisfiable for prestate σ : ¢(§ σ′ · S ) < 1 Specification S is satisfiable for prestate σ : ¢(§ σ′ · S ) ≥ 1 Specification S is deterministic for prestate σ : ¢(§ σ′ · S ) ≤ 1 Specification S is nondeterministic for prestate σ : ¢(§ σ′ · S ) > 1 Specification S is satisfiable for prestate σ : ∃σ′ · S Specification S is implementable : ∀σ · ∃σ′ · S 4/64 Specification examples x ′ = x +1 ∧ y ′ = y implementable, deterministic x ′ > x implementable, nondeterministic T implementable, extremely nondeterministic ⊥ unimplementable, overly deterministic x ≥ 0 ∧ y ′ =0 unimplementable, overly deterministic x ≥ 0 ⇒ y ′ =0 implementable, nondeterministic ok = σ′ = σ = x ′ = x ∧ y ′ = y ∧ ... x := e = σ′ = σ address " x " e = x ′ = e ∧ y ′ = y ∧ ... x := x + y = x ′ = x + y ∧ y ′ = y if x = y then x := x + y else x ′ + y ′ = 3 5/64 dependent composition S . R = ∃ x ′′ , y ′′ , ...· (substitute x ′′ , y ′′ , ... for x ′ , y ′ , ... in S ) ∧ (substitute x ′′ , y ′′ , ... for x , y , ... in R ) In integer variable x x ′ = x ∨ x ′ = x +1 . x ′ = x ∨ x ′ = x +1 = ∃ x ′′ · ( x ′′ = x ∨ x ′′ = x +1) ∧ ( x ′ = x ′′ ∨ x ′ = x ′′ +1) distribute ∧ over ∨ = ∃ x ′′ · x ′′ = x ∧ x ′ = x ′′ ∨ x ′′ = x +1 ∧ x ′ = x ′′ ∨ x ′′ = x ∧ x ′ = x ′′ +1 ∨ x ′′ = x +1 ∧ x ′ = x ′′ +1 distribute ∃ over ∨ = ( ∃ x ′′ · x ′′ = x ∧ x ′ = x ′′ ) ∨ ( ∃ x ′′ · x ′′ = x +1 ∧ x ′ = x ′′ ) ∨ ( ∃ x ′′ · x ′′ = x ∧ x ′ = x ′′ +1) ∨ ( ∃ x ′′ · x ′′ = x +1...
View Full Document

{[ snackBarMessage ]}

Page1 / 64

A+Practical+Theory+of+Programming+05 - Specification state...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online