FM Content - 16456033002016406231

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 11

Formal Methods

Formal Languages
• Formal languages are formed from symbols, strings, and alphabets.
Symbol can be one of the following:
• One of the digits 0-9;
• - One of the upper case letters A-Z;
• - One of the lower case letters a-z;
• - A (, followed by any characters, provided that “(“ and “)” are
properly nested.
Formal Language Anatomy
Vocabulary
• (1) Upper case Roman letters: A B C ……
• (2) Nothing else is a symbol of F.

Formation Rules
• (1) If a string STR begins with ‘P’, then it is a formula.
• (2) Nothing else is a formula of F.
Formal Language Examples
Abstract State Machines (ASM)
• Abstract State Machine is a formal method for specification and
verification.
• The Abstract State Machine (ASM) Project (formerly known as the
Evolving Algebras Project) was started by Yuri Gurevich as an attempt
to bridge the gap between formal models of computation and practical
specification methods.
Formal Language Examples
• To write a program in a language like C or Java, various statements are
used, such as: conditional statements, loop statements, and so forth.
• ASM statements are called rules. The most basic rule7 is the update
rule, which has the form: foo(t1, t2,. . . tn) := t0
• foo is an n-argument function, and t0 through tn are terms, or
expressions. Executing the rule updates the value of the function foo at
the specified arguments to the specified value.
B-Method
• The B-Method is a collection of mathematically based techniques for
the specification, design and implementation of software components.
• Systems are modeled as a collection of interdependent Abstract
Machines, for which an object-based approach is employed at all
stages of development.
• An Abstract Machine is described using the Abstract Machine
Notation (AMN).
• A uniform notation is used at all levels of description, from
specification, through design, to implementation.
B-Method
• AMN is a state-based formal specification language in the same school
as VDM and Z.
• An Abstract Machine comprises a state together with operations on
that state.
• In a specification and a design of an Abstract Machine the state is
modelled using notions like sets, relations, functions, sequences etc.
• The operations are modelled using Pre- and Postconditions using
AMN.
• The operations are described using a pseudo-programming notation
that is a subset of AMN.
B-Method
• The B-Method prescribes how to check the specification for consistency
(preservation of invariant) and how to check designs and
implementations for correctness (correctness of data refinement and
correctness of algorithmic refinement).
• The B-Method further prescribes how to structure large designs and large
developments, and promotes the re-use of specification models and
software modules, with object orientation central to specification
construction and implementation design.
• The formal notation looks like a simple pseudo programming notation.
• There is no real distinction between the specification notation and the
programming notation.
Petri Nets
• A Petri net is a graphical and mathematical modeling tool. It consists
of places, transitions, and arcs that connect them.
• Input arcs connect places with transitions, while output arcs start at a
transition and end at a place.
• Places can contain tokens; the current state of the modeled system (the
marking) is given by the number (and type if the tokens are
distinguishable) of tokens in each place.
• Transitions are active components. They model activities, which can
occur (the transition fires), thus changing the state of the system (the
marking of the Petri net).
Petri Nets
• When the transition fires, it removes tokens from its input places and
adds some at all of its output places.
• The number of tokens removed / added depends on the cardinality of
each arc.
• The interactive firing of transitions in subsequent markings is called
token game.
• Petri nets are a promising tool for describing and studying systems
that are characterized as being concurrent, asynchronous, distributed,
parallel, nondeterministic, and/or stochastic.
Petri Nets
• As a graphical tool, Petri nets can be used as a visual-communication
aid similar to flow charts, block diagrams, and networks.
• Tokens are used in these nets to simulate the dynamic and concurrent
activities of systems.
• As a mathematical tool, it is possible to set up state equations,
algebraic equations, and other mathematical models governing the
behavior of systems.

You might also like