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.

Path Length

This is the task corresponding to exercise 1. Path Length.

Resources

Download Files

Definitions File

theory Defs
  imports "HOL-Library.Tree"
begin

declare [[names_short]]

fun pl :: "'a tree \<Rightarrow> nat" where
"pl Leaf = 0" |
"pl (Node l x r) = pl l + size1 l + pl r + size1 r"

fun pl2 :: "'a tree \<Rightarrow> nat \<Rightarrow> nat" where
"pl2 Leaf n = n" |
"pl2 (Node l x r) n = pl2 l (n+1) + pl2 r (n+1)"

end

Template File

theory Submission
  imports Defs
begin

lemma pl2_pl: "pl2 t n = pl t + a * n"
  oops

lemma pl0: "pl2 t 0 = pl t"
  sorry

end

Check File

theory Check
  imports Submission
begin

lemma pl0: "pl2 t 0 = pl t"
  by (rule Submission.pl0)

end

Terms and Conditions