0% found this document useful (0 votes)
13 views17 pages

Lecture 5

Uploaded by

hayil87639
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views17 pages

Lecture 5

Uploaded by

hayil87639
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Formal Methods

Lecture # 5

Umber Noureen Abbas


Lecturer
Department of Computer Science

Department of Computer Science universty of


11/04/2024 1
Sahiwal
Formal methods

• Rigorous techniques and tools for the development


and analysis of computational (hardware/software)
systems Applied at various stages of the development
cycle
• used in reverse engineering to model and analyze
existing systems Based on mathematics and symbolic
logic (formal)

11/04/2024 Department of Computer Science universty of Sahiw 2


al
MAIN ARTIFACTS IN FORMAL METHODS

1. System requirements
2. System implementation

• Formal methods rely on


– some formal specification of (1)
– some formal execution model of (2)
• Use tools to verify mechanically that implementation satisfies
(1) according to (2)

11/04/2024 Department of Computer Science universty of Sahiw 3


al
WHY USE FORMAL METHODS

• Mathematical modeling and analysis contribute to the overall


quality of the final product Increase confidence in the
correctness/robustness/security of a system
• Find more flaws and earlier bugs (i.e., during specification and
design vs. testing and maintenance)

11/04/2024 Department of Computer Science universty of Sahiw 4


al
FORMAL METHODS: THE VISION

• Complement other analysis and design methods


• Help find bugs in code and specification
• Reduce development, and testing, cost
• Ensure certain properties of the formal system model
• Should be highly automated

11/04/2024 Department of Computer Science universty of Sahiw 5


al
FORMAL METHODS AND TESTING

• Run the system at chosen inputs and observe its


behavior
– Randomly chosen
– Intelligently chosen (by hand: expensive!)
– Automatically chosen (need formalized spec)
• What about other inputs? (test coverage)
• What about the observation? (test oracle)
• Challenges can be addressed by/require formal
methods

11/04/2024 Department of Computer Science universty of Sahiw 6


al
A WARNING

• The notion of “formality” is often misunderstood (formal vs.


rigorous)
• The effectiveness of formal methods is still debated
• There are myths about their practicality and cost
• Formal methods are not yet widespread in industry
• They are mostly used in the development of safety, business,
or mission critical software, where the cost of faults is high

11/04/2024 Department of Computer Science universty of Sahiw 7


al
THE MAIN POINT OF FMs IS NOT

• To show “correctness” of entire systems


• What is correctness? Go for specific properties!
• To replace testing entirely
• Formal methods do not go below byte code level
• Some properties are not formalizable
• To replace good design practices

11/04/2024 Department of Computer Science universty of Sahiw 8


al
OVERALL BENEFITS OF USING FORMAL
METHODS
• Forces developers to think systematically about issues
• Improves the quality of specifications, even without formal
verification
• Leads to better design
• Provides a precise reference to check requirements
• Provides documentation within a team of developers
• Gives direction to latter development phases
• Provides a basis for reuse via specification matching
• Can replace (infinitely) many test cases
• Facilitates automatic test case generation

11/04/2024 Department of Computer Science universty of Sahiw 9


al
SPECIFICATIONS: WHAT THE SYSTEM SHOULD
DO
• Simple properties
– Safety properties: something bad will never happen
– Liveness properties: something good will happen eventually
• Non-functional properties
– runtime, memory, usability,
– Complete behaviour specification
– Equivalence check
– Refinement
– Data consistency

11/04/2024 Department of Computer Science universty of Sahiw 10


al
FORMAL SPECIFICATION

• “The expression in some formal language and at some


level of abstraction of a collection of properties that
some system should satisfy” [van Lamsweerde]
• Formal language
– syntax can be mechanically processed and checked
– semantics is defined unambiguously by mathematical
means
• Abstraction
– above the level of source code, several levels possible

11/04/2024 Department of Computer Science universty of Sahiw 11


al
Cont.

• Properties
– expressed in some formal logic
– have a well-defined semantics
• Satisfaction
– ideally (but not always) decided mechanically
– based on automated deduction and/or model checking
techniques

11/04/2024 Department of Computer Science universty of Sahiw 12


al
FORMALIZATION HELPS TO FIND BUGS IN
SPECS
• Well-formedness and consistency of formal specs are
checkable with tools
• Fixed signature (symbols) helps spot incomplete specs
• Failed verification of implementation against spec
• gives feedback on erroneous formalization

11/04/2024 Department of Computer Science universty of Sahiw 13


al
EXPRESSIVENESS OF SPECIFICATION

• Simple
– Finitely many cases
– Approximation, low precision
– Automatic proofs are (in principle) possible
• Complex
– General properties
– High precision, tight modeling
– Automatic proofs (in general) impossible!

11/04/2024 Department of Computer Science universty of Sahiw 14


al
CURRENT AND FUTURE TRENDS

• Slowly but surely formal methods are finding


increased used in industry
• Design for formal verification provers
• Combining static analysis of programs with automatic
methods and with theorem provers
• Combining test and formal verification
• Integration of formal methods into SW development
process

11/04/2024 Department of Computer Science universty of Sahiw 15


al
Questions

Any Question Please?

You can contact me at: umber@uosahiwal.edu.pk

Your Query will be answered within one working day.

11/04/2024 Computer Science Department, University of Sahiwal 16


Thanks

11/04/2024 Computer Science Department, University of Sahiwal 17

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy