###### Cookies disclaimer

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.

# Exercise 1

This is the task corresponding to exercise 1.

## Resources

Download Files

### Definitions File

```theory Defs
imports "HOL-Library.Tree"
begin

fun join :: "'a list list \<Rightarrow> 'a list list \<Rightarrow> 'a list list" where
"join xss [] = xss" |
"join [] yss = yss" |
"join (xs#xss) (ys#yss) = (xs @ ys) # join xss yss"

fun levels :: "'a tree \<Rightarrow> 'a list list" where
"levels Leaf = []" |
"levels (Node l a r) = [a] # join (levels l) (levels r)"

definition set2 :: "'a list list \<Rightarrow> 'a set" where
"set2 xss \<equiv> \<Union>(set (map set xss))"

end```

### Template File

```theory Submission
imports Defs
begin

lemma levels_height: "length(levels t) = height t"
sorry

lemma levels_set: "set2 (levels t) = set_tree t"
sorry

end```

### Check File

```theory Check
imports Submission
begin

lemma levels_height: "length(levels t) = height t"
by (rule Submission.levels_height)

lemma levels_set: "set2 (levels t) = set_tree t"
by (rule Submission.levels_set)

end```

Terms and Conditions