



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Formal Specification © John C. Knight 2009, All Rights Reserved 1
Formal Specification © John C. Knight 2009, All Rights Reserved 2
Formal Specification © John C. Knight 2009, All Rights Reserved 3
Formal Specification © John C. Knight 2009, All Rights Reserved 4
Formal Specification © John C. Knight 2009, All Rights Reserved 7
Formal Specification © John C. Knight 2009, All Rights Reserved 8
Formal Specification © John C. Knight 2009, All Rights Reserved 9
Formal Specification © John C. Knight 2009, All Rights Reserved 10
Formal Specification © John C. Knight 2009, All Rights Reserved 19
Formal Specification © John C. Knight 2009, All Rights Reserved 20
Formal Specification © John C. Knight 2009, All Rights Reserved 21
Type Checking
Syntax Checking
Putative Theorems
Establish useful properties
of the specification
Improved accuracy
and completeness
Improved
understanding
Formal Specification © John C. Knight 2009, All Rights Reserved 22
Functional :
Computation defined as desired function computer is to evaluate
Most functional languages derive from LISP
Formal Specification © John C. Knight 2009, All Rights Reserved 25
integer y; read (x); if x > 0 then y := x; while y**2 > x loop y := y – 1; end loop; print (y);
integer y; x > 0 AND y2 <= x AND (y+1)2 > x
The program shall read one positive input and write one output
that is the integer square root of the input. The output squared
shall be less than or equal to the input and the output+1 squared shall be greater than the input.
Formal Specification © John C. Knight 2009, All Rights Reserved 26
Formal Specification © John C. Knight 2009, All Rights Reserved 27
Operation Name
& Pre/Post Condx
(Pred Calculus)
Pre Condition
What Has To Be TrueBefore An Operation Can Be Applied
Post Condition
What Has To Be TrueAfter An Operation Is Applied
REALLY Important REALLY Important
State Description
(Sets, relations, etc)
Invariants (Predicate Calculus)
Formal Specification © John C. Knight 2009, All Rights Reserved 28
Predicates!
Note!
Not
Assignment
Autopilot
Desired_Alt?, Actual_Alt? : £
Elev_setting! : £ Maximum_error : £
ControlAC
((Actual_Alt? < (Desired_Alt? - Max_error) Û Elev_setting! = 1) Ú
(Actual_Alt? > (Desired_Alt? + Max_error) Û Elev_setting! = -1)
Ú (Actual_Alt? < (Desired_Alt? + Max_error) Ù Actual_Alt? > (Desired_Alt? - Max_error) Û Elev_setting! = 0))
óAutopilot