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.
theory Defs imports Main begin declare [[names_short]] 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" consts double :: "'a list \<Rightarrow> 'a list" end
theory Submission imports Defs begin fun double :: "'a list \<Rightarrow> 'a list" where "double _ = undefined" value "double [1,2,(3::nat)] = [1,1,2,2,3,3]" theorem double_len: "length (double xs) = 2 * length xs" sorry theorem reverse_double: "reverse (double xs) = double (reverse xs)" sorry theorem rev_double: "rev (double xs) = double (rev xs)" sorry end
theory Check imports Submission begin theorem double_len: "length (double xs) = 2 * length xs" by (rule Submission.double_len) theorem reverse_double: "reverse (double xs) = double (reverse xs)" by (rule Submission.reverse_double) theorem rev_double: "rev (double xs) = double (rev xs)" by (rule Submission.rev_double) end