# Loop Invariants - Discrete Math - Lecture Slides, Slides for Discrete Mathematics. Allahabad University

## Discrete Mathematics

Description: Some concept of Discrete Math are Unique Path, Addition Rule, Clay Mathematics, Complexity Theory, Correspondence Principle, Discrete Mathematics, Group Theory, Random Variable, Major Concepts. Main points of this lecture are: Loop Invariants, Simple, Examples, Involve, Selection Sort, Further Information, Loop Invariant, Inductive, Statement, Loop Invariant
Showing pages  1  -  4  of  56
Discrete aths
Objectives
to show the use of induction for proving properties of code involving loops
use induction to prove that functions work
introduce pre- and post- conditions,
loop termination
2. Loop Invariants
Docsity.com
Overview
1. What is a Loop Invariant?
2. Three simple examples
they involve while loops
3. Selection Sort
4. Further Information
Docsity.com
1. What is a Loop Invariant?
A loop invariant is an inductive statement
which says something which is always true
Loop invariants are useful for:
code specification
debugging
continued
Docsity.com
A loop invariant is typically written as an
inductive statement S(n), where n is some
changing element of the loop. For
example:
the loop counter/index
a loop variable which changes on each
iteration
Docsity.com