• Keine Ergebnisse gefunden

Verifying Functions

N/A
N/A
Protected

Academic year: 2022

Aktie "Verifying Functions"

Copied!
2
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

5. Verifying Functions 5.0

Chapter 5

Verifying Functions

©Arnd Poetzsch-Heffter et al. TU Kaiserslautern 248

5. Verifying Functions 5.0

Overview of Chapter

5. Verifying Functions 5.1 Introduction

5.2 Case study: Greatest common devisor 5.3 Well-definedness of recursive functions 5.4 Case study: Quicksort

©Arnd Poetzsch-Heffter et al. TU Kaiserslautern 249

5. Verifying Functions 5.1 Introduction

Section 5.1

Introduction

©Arnd Poetzsch-Heffter et al. TU Kaiserslautern 250

5. Verifying Functions 5.1 Introduction

Motivation

Verifying properties of functions

Verifying properties of functions is a fundamental task in theorem proving and software engineering:

Functions allow to express recursive algorithms

Functions can be used to model systems (e.g., a compiler is essentially a function)

Functions are used to specify input/output behavior of procedures, so calledIO-properties

Verifying recursive functions is related to terminiation proofs

©Arnd Poetzsch-Heffter et al. TU Kaiserslautern 251

(2)

5. Verifying Functions 5.1 Introduction

Specification

Kinds of specifications:

specification = model + properties

=⇒ verify that model has the properties or

specification = model1+ model2+ relationship

=⇒ verify that models are in the relationship

Here:

specification = function definition + property of function

©Arnd Poetzsch-Heffter et al. TU Kaiserslautern 252

5. Verifying Functions 5.1 Introduction

Basic proof techniques

Verify:

well-definedness of function by:

I structural induction according to parameter types

I more general: well-founded ordering on parameter space:

“show that parameters get smaller”

property of defined function:

I structural induction according to parameter types

I in general, proof technique depends on properties

©Arnd Poetzsch-Heffter et al. TU Kaiserslautern 253

5. Verifying Functions 5.1 Introduction

Discussion

Verification

checks for consistency of models and properties

I models may not reflect what designer/programmer had in mind

I properties may not reflect what designer/programmer had in mind

works for the full parameter space (in contrast to testing)

discovers also “pathological” problems

uses redundancy to find errors

helps to improve the descriptions

Formalverification avoids misunderstanding, allows using tools, and avoids errors in proofs.

©Arnd Poetzsch-Heffter et al. TU Kaiserslautern 254

5. Verifying Functions 5.2 Case study: Greatest common devisor

Section 5.2

Case study: Greatest common devisor

©Arnd Poetzsch-Heffter et al. TU Kaiserslautern 255

Referenzen

ÄHNLICHE DOKUMENTE

1) Karten mit schwarzen Zahlen der Reihe nach auslegen. Jeder schwarzen Zahl eine passende rote Zahl zuordnen, so dass das Ergebnis immer 5 ist. 2) Karten an zwei Spieler

Die Kärtchen von 1-10 werden ausgedruckt (dickeres Papier, Karton, etc. verwenden) und anschließend ausgeschnitten.. Die Größe der Kärtchen

In this paper, we introduce a model-based code mining framework, which allows to identify the variability between related variants realized in source code of OOP languages..

5.2 Case study: Greatest common devisor 5.3 Well-definedness of total recursive functions 5.4 Case study: Quicksort.. ©Arnd Poetzsch-Heffter

(s3) Here, we essentially use the property x#(rev yl) = rev (yl@[x]) and the fact that by taking the tail of the list reachable from appl, the corresponding prefix gets longer by

A recursively defined function is well-defined if the arguments in all recursive calls are smaller w.r.t. some

XPath has a large set of built-in functions (even more in XPath 2.0) that can be used in XPath predicates and in XSLT scripts for computing values from document nodes.

Removing intermediate data structures is called deforestation, since data structures are tree-shaped in the general case. In our case, we would like to fuse an unfold followed by