Cookies disclaimer

I agree 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.

Tries with Compression

This is the task corresponding to exercise 3. Tries with Compression.


Download Files

Definitions File

theory Defs
  imports Main

declare [[names_short]]
datatype bt = Lf bool | Nd bt bt

fun \<alpha> :: "bt \<Rightarrow> nat \<Rightarrow> bool list set" where
"\<alpha> (Lf b) d = (if b then {bs. length bs = d} else {})" |
"\<alpha> (Nd l r) d = Cons True ` \<alpha> l (d-1) \<union> Cons False ` \<alpha> r (d-1)"

fun ht :: "bt \<Rightarrow> nat" where
"ht (Lf _) = 0" |
"ht (Nd l r) = max (ht l) (ht r) + 1"


Template File

theory Submission
  imports Defs

fun isin :: "bt \<Rightarrow> bool list \<Rightarrow> bool" where
  "isin _ = undefined"

fun inter :: "bt \<Rightarrow> bt \<Rightarrow> bt" where
  "inter _ = undefined"

fun compressed :: "bt \<Rightarrow> bool" where
  "compressed _ \<longleftrightarrow> undefined"

fun compress :: "bt \<Rightarrow> bt" where
  "compress _ = undefined"


Check File

theory Check
  imports Submission


Terms and Conditions