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.

FDS Week 1 Homework

Week 1 homework.

Resources

Download Files

Definitions File

theory Defs
imports Main
begin

fun snoc :: "'a list \<Rightarrow> 'a \<Rightarrow> 'a list" where
"snoc [] x = [x]" |
"snoc (y # ys) x = y # (snoc ys x)"

fun reverse :: "'a list \<Rightarrow> 'a list" (*<*) where
"reverse [] = []" |
"reverse (x # xs) = snoc (reverse xs) x" (*>*)

end

Template File

theory Template
imports Defs
begin

fun lmax :: "nat list \<Rightarrow> nat"
  where
  "lmax _ = undefined"

lemma max_greater: "x \<in> set xs \<Longrightarrow> x\<le>lmax xs"
  sorry

lemma max_reverse: "lmax (reverse xs) = lmax xs"
  sorry

end

Check File

theory Check
imports Submission
begin

lemma max_greater: "x \<in> set xs \<Longrightarrow> x\<le>lmax xs"
  by (rule max_greater)

lemma max_reverse: "lmax (reverse xs) = lmax xs"
  by (rule max_reverse)


end

Terms and Conditions