Our site saves small pieces of text information (cookies) on your device in order to deliver better content and for statistical purposes. You can disable the usage of cookies by changing the settings of your browser. By browsing our website without changing the browser settings you grant us permission to store that information on your device.

# FDS Week 5 Homework

Week 5 homework.

## Resources

### Definitions File

```theory Defs
imports Main
begin
fun sumto :: "(nat \<Rightarrow> nat) \<Rightarrow> nat \<Rightarrow> nat" where
"sumto f 0 = 0" |
"sumto f (Suc n) = sumto f n + f(Suc n)"
end
```

### Template File

```theory Template
imports Defs
begin

lemma split_lists: "\<exists>ys zs. length ys = length xs div n \<and> xs=ys@zs"
sorry

lemma sum_ident:
"sumto (\<lambda>i. i* 2 ^ i) n = n * 2 ^ (n + 1) - (2 ^ (n + 1) - 2)"
sorry

end
```

### Check File

```theory Check
imports Template
begin

lemma split_lists: "\<exists>ys zs. length ys = length xs div n \<and> xs=ys@zs"
by(rule split_lists)

lemma sum_ident: "sumto (\<lambda>i. i* 2 ^ i) n = n * 2 ^ (n + 1) - (2 ^ (n + 1) - 2)"
by(rule sum_ident)

end
```

Terms and Conditions