CafeOBJ Algebraic Specification - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

CafeOBJ Algebraic Specification

Description:

Programming Languages. Why does the compiler never say maybe' Because compilers are precise ... Programming languages are consistent. Wasn't always the case. ANSI C ... – PowerPoint PPT presentation

Number of Views:44
Avg rating:3.0/5.0
Slides: 21
Provided by: csM8
Category:

less

Transcript and Presenter's Notes

Title: CafeOBJ Algebraic Specification


1
CafeOBJ Algebraic Specification
  • Formal Methods se304/cs407

2
Programming Languages
  • When you compile your program 1 of two
    things happens
  • It compiles successfully (the compiler says yes,
    that is syntactically correct)
  • It does not compile (the compiler says no,
    that is not syntactically correct)
  • Why does the compiler never say maybe

3
Programming Languages
  • Why does the compiler never say maybe
  • Because compilers are precise
  • The language is precisely laid out using special
    notation
  • No ambiguities

4
Programming Languages
  • Imagine
  • Compiler A says no
  • Compiler B says yes
  • Rarely happens (unless theres a bug)
  • Why?
  • Programming languages are consistent
  • Wasnt always the case
  • ANSI C

5
Programming languages as specifications
  • Programming languages are specifications
  • Sets out what the system does
  • precisely,
  • unambiguously,
  • consitently
  • Not very good specifications

6
Programming languages are not good specifications
  • Hard to relate
  • What system does
  • With what system should do
  • Too much detail
  • Makes design mistakes difficult to spot
  • Too difficult to read
  • Often dont make assumptions explicit
  • Implementation dependent

7
Algebraic Specification
  • What is it?
  • Descriptions of what a system does
  • In maths
  • Implementation independent

8
Algebraic Specification
  • What is it for?
  • Formal description of systems
  • Automatic checking for
  • Ambiguity
  • Incompleteness
  • Inconsistency
  • One of the classes of Formal Methods
  • More on different types of FM tomorrow

9
CafeOBJ
  • What is CafeOBJ?
  • Among other things
  • An algebraic specification language
  • A subset is executable

10
CafeOBJ
  • The point
  • to state axioms that can be used to draw logical
    conclusions (about the system)
  • The axioms are made up of
  • sorts (types)
  • operators on those sorts (, f(a, b), )

11
Maths
  • Algebra
  • Operator is based on mathematical concept of
    function
  • Unambiguous, static mapping
  • Not an algorithm
  • Symmetrical
  • (Non symmetrical transitions after the break)

12
Mathematical functions
  • Domain
  • Set from which arguments can come
  • Codomain
  • Set from which results can come

13
Mathematical functions
  • Arity
  • Number and sort of arguments
  • No arity constant
  • Coarity
  • Sort of result
  • Rank
  • Pair of arity and coarity

14
Mathematical functions
  • Infix
  • a b
  • Prefix
  • -a
  • Postfix
  • b!
  • Standard
  • f(a, b, c)

15
CafeOBJ - modules
  • Concepts you are trying to specify are outlined
    in modules
  • Divided into 3 sections
  • Imports
  • Signature definitions
  • Axioms

16
Modules - syntax
  • module module_name
  • imports
  • module_element
  • signature
  • module_element
  • axioms
  • module_element

17
Modules
  • Imports
  • Very like the concept of extends in Java
  • Allows us to reuse other modules
  • Signature definitions
  • Like method declarations (not definitions)
  • Describe operations without implementation details

18
Modules
  • Axioms
  • The basis for a logical argument
  • Assumptions which
  • Are reasonable
  • By logical steps
  • Allow us to draw a conclusion
  • Allow us to reason about our modules

19
Todays lab
  • An introduction to CafeOBJ
  • j\cafeobj\cafeobj.exe
  • http//www.ldl.jaist.ac.jp/cafeobj/

20
Experiment
Write a Comment
User Comments (0)
About PowerShow.com