Presentation is loading. Please wait.

Presentation is loading. Please wait.

School of Computing and Mathematics, University of Huddersfield CIA2326: Week 11 LECTURE: Formal Specification TUTORIAL/PRACTICAL: Finish off last weeks.

Similar presentations


Presentation on theme: "School of Computing and Mathematics, University of Huddersfield CIA2326: Week 11 LECTURE: Formal Specification TUTORIAL/PRACTICAL: Finish off last weeks."— Presentation transcript:

1 School of Computing and Mathematics, University of Huddersfield CIA2326: Week 11 LECTURE: Formal Specification TUTORIAL/PRACTICAL: Finish off last weeks exercises NEXT Week LECTURE: Revision TUTORIAL/PRACTICAL: c/w solutions

2 School of Computing and Engineering, University of Huddersfield Last Week: Formal Specifications FOR: good for capturing requirements in safety related/critical applications because - can eliminate bugs EARLY in SD process - can be used as a precise contract - can be reasoned with using logic - can be manipulated using computer tools - can be used as a basis to “prove” code correct

3 School of Computing and Engineering, University of Huddersfield Last Week: Formal Specifications AGAINST - not very understandable if they are in Maths -are only part of the story – they do not guarantee quality -themselves need validating – they may have bugs e.g. be incomplete, inconsistent

4 School of Computing and Mathematics, University of Huddersfield Formal Specification : Logic -Can write parts of requirements specifications as logic statements For all Segment1, Segment2 in Segments segments_are_in_oceanic_conflict(Segment1,Segment2)  are_in_vertical_oceanic_conflict(Segment1,Segment2) AND are_in_lateral_and_longitudinal_oceanic_conflict(Segment1,Segment2) (the_Profile_containing(Segment) is_wholly_or_partly_in_shanwick_oca) => [(Segment starts_at_or_after_first_recognised_pt_for_oceanic_cpr) (the_entry_Time_of(Segment) is_at_or_later_than the_Time_of( the_first_recognised_4D_pt_for_oceanic_cpr_of( the_Profile_containing(Segment))))

5 School of Computing and Mathematics, University of Huddersfield Formal Specification : Logic This has the advantages MODULARITY – statements can be added/removed in relative isolation. Definitions can be built up hierarchically Individuals (eg Segment1) can be regarded as “objects” with structure Logic statements tend to be are more readable than maths Logic statements tend to be are more abstract than other approaches – see below There are well developed proof tools for logic

6 Formal Specification : Algebra Sortname: Segments Function names: the_Segment(Profile,4D_pt1,4D_pt2,Val) ;; primitive the_Profile_containing(Segment) ;; Ax.2 the_entry_4D_pt_of(Segment) ;; Ax.3 the_exit_4D_pt_of(Segment) ;; Ax.4 the_machno_Val_on(Segment) ;; Ax.5 the_cruise_climb_status_Val_of(Segment) ;; Ax.6.... Predicate names: Segment1 = Segment2 ;; constrained equality (Ax.1) Segment1 \= Segment2 ;; constrained inequality (Ax.1) (Int_gte_0 is_a_min_long_sep_value_for Segment1 and Segment2 entered_via_the_mst_command) ;; primitive (time_periods_of Segment1 and Segment2 overlap) ;; Ax.7 (flight_level_ranges_of Segment1 and Segment2 overlap) ;; Ax.8 (Flight_level lies_in_flight_level_range_of Segment).... Axioms: Segment1 = Segment2 [the_entry_4D_pt_of(Segment1) = the_entry_4D_pt_of(Segment2) & the_exit_4D_pt_of(Segment1) = the_exit_4D_pt_of(Segment2) & the_machno_Val_on(Segment1) = the_machno_Val_on(Segment2) & the_Profile_containing(Segment1) = the_Profile_containing(Segment2) ]....

7 School of Computing and Mathematics, University of Huddersfield “State – Based” Formal Specs Lang(FSL) The most commonly used type of FSL using a combination of Logic, Abstract Data Types and Maths Examples: Z, VDM, B They also incorporate “methods” for refining a specification into a program. They are all supplied with “tools environments” which include syntax checkers, proof tools and animators..

8 School of Computing and Mathematics, University of Huddersfield “State – Based” Formal Specs Lang(FSL) Basics: Define the “state” of the system in terms of mathematical data structures such as SETS, MAPS and basic types. Define the “operations” on the system via PRE and POST conditions. The conditions are composed of logical combinations of the mathematical data structures. Define “invariants” – those properties of the system that should always be true.

9 School of Computing and Mathematics, University of Huddersfield Conclusions Formal Specifications are important for certain types of software project They are meant to precisely and objectively capture what is required There are many FSL types – logic based, algebra based, state based.


Download ppt "School of Computing and Mathematics, University of Huddersfield CIA2326: Week 11 LECTURE: Formal Specification TUTORIAL/PRACTICAL: Finish off last weeks."

Similar presentations


Ads by Google