1 / 13

OOSC – Lab 3

Learn how to formalize ADT specifications, including types, functions, axioms, and preconditions. Ensure completeness, correctness, and consistency in ADT specifications.

jonellf
Download Presentation

OOSC – Lab 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. OOSC – Lab 3

  2. ADT • Formalizing the specifications • The need to know precisely how operations can be used by clients and what they will do • The ADT specification consists of • Types • Functions • Axioms • Preconditions

  3. ADT (cont.) • An ADT specification is a formal, mathematical description rather than a software text. • The axioms and preconditions express the semantics of a type and are essential to a full, unambiguous description

  4. Types • Indicates the types being specified • Simply lists the types introduced in the specification

  5. Functions • Lists operations applicable to instances of the ADT • Each line introduces a mathematical function modeling one of the operations on the ADT • We may have • Operation which may modify objects • Creators • queries

  6. Partial functions • The domain of a partial function is the subset containing those elements for which the function yields a value • partial functions may reflect that not every operation is applicable to every object

  7. Axioms • A way of implicit definition (free of representation) • State the properties of function values(and not giving the value itself) • We may have • predicates (expressing that a property is always true for every possible value) • Definition of ADT behavior

  8. Preconditions • An ADT specification which includes partial functions must specify the domain of each of them • For each function, the require clause indicates what conditions the function’s arguments must satisfy to belong to the function’s domain • Every partial function has a precondition

  9. Is the specification complete? • Is there any way to be sure that a specification describes all relevant properties of the objects it is intend to cover? • A “well formed” expression simply indicates whether all functions in an expression have the right number and types of arguments

  10. Correctness • In case there are no preconditions, every well formed expression is correct • Otherwise … we shall prove (in a recursive way) that for any expression of the form f(x1,…,xn) all xj are correct, and their values satisfy the precondition of f

  11. Sufficient completeness • Checks if all axioms of the theory make it possible to solve the following problems for any well-formed expression e: • Determines whether e is correct • If e is a query expression and has been shown to be correct, express e’s value under a form not involving any value of the ADT type(i.e. use other types such as booleans and literals)

  12. Sufficient completeness (cont.) • A useful practical guideline to check that no important property has left out of a specification • Some steps: • Any query expression must have the form q(e), where q is one of the query functions, and e is an expression of our ADT • We will treat each query function separately, and will prove the claim by induction on the structure of the ADT expression e • The base case is the creator expression of the ADT • Prove that all defined and deduced queries can be computed

  13. Consistency • For any well formed query expression e, the axioms make it possible to infer at most one value for e

More Related