diff options
author | Camil Staps | 2015-03-18 13:05:33 +0100 |
---|---|---|
committer | Camil Staps | 2015-03-18 13:05:33 +0100 |
commit | e038bd97c96eef24418d63dd236116073205ad56 (patch) | |
tree | beed4a030685bd52c227e2b67193a728763990d4 /week6/camil/9.4.2 | |
parent | Added comments (diff) |
Put w6 in format
Diffstat (limited to 'week6/camil/9.4.2')
-rw-r--r-- | week6/camil/9.4.2 | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/week6/camil/9.4.2 b/week6/camil/9.4.2 deleted file mode 100644 index bc95352..0000000 --- a/week6/camil/9.4.2 +++ /dev/null @@ -1,24 +0,0 @@ -9.4.2 - proof by induction over xs - -Induction base: - Suppose xs = []. Then we have: - - flatten (map (map f) xs) // assumption xs = [] - = flatten (map (map f) []) // definition of map, rule 3 - = flatten [] // definition of flatten, rule 5 - = [] // definition of map, rule 3 - = map f [] // definition of flatten, rule 5 - = map f (flatten []) // assumption xs = [] - = map f (flatten xs). - -Induction step: - Suppose flatten (map (map f) xs) = map f (flatten xs) for certain xs of finite length (induction hypothesis). Then we have: - - flatten (map (map f) [x:xs]) // definition of map, rule 4 - = flatten [map f x : map (map f) xs] // definition of flatten, rule 6 - = (map f x) ++ flatten (map (map f) xs) // induction hypothesis: assumption flatten (map (map f) xs) = map f (flatten xs) - = (map f x) ++ (map f (flatten xs)) // by 9.4.1 - = map f (x ++ (flatten xs)) // definition of flatten, rule 6 - = map f (flatten [x:xs]). - -By the principle of induction we have now proven that flatten (map (map f) xs) = map f (flatten xs) for any list of finite length xs.
\ No newline at end of file |