Skip to content
Snippets Groups Projects
Verified Commit e906ec8e authored by jonahbeneb02's avatar jonahbeneb02
Browse files

07: Add first draft of slides and tutorial tasks

parent 53b95298
No related branches found
No related tags found
No related merge requests found
---
theme: metropolis
aspectratio: 169
---
# Tutorium 7
Strukturelle Induktion, Algebraische Datentypen
# Beispiel für Strukturelle Induktion
```Haskell
sum :: (Num a) => [a] -> a
sum [] = 0 -- sum.1
sum (x:xs) = x + sum xs -- sum.2
```
**zu zeigen:**
`sum (xs ++ ys) = sum xs + sum ys`
# Beispiel für Strukturelle Induktion
**Induktionsvoraussetzung:** `sum (xs ++ ys) = sum xs + sum ys`
**Induktionsanfang:**
zeigen für Startelement
```Haskell
xs = []
sum ([] ++ ys)
= sum ys
= 0 + sum ys -- sum.1
= sum [] + sum ys
```
# Beispiel für Strukturelle Induktion
**Induktionsschritt:**
```Haskell
xs = (x:xs)
sum ((x:xs) ++ ys) -- sum.2
= x + sum (xs ++ ys) -- IV.
= x + sum xs + sum ys -- sum.2
= sum (x:xs) + sum ys
```
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment