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.

Homework 8

This is the task corresponding to homework 8.

Resources

Download Files

Definitions File

theory Defs
  imports "HOL-Data_Structures.Cmp" "HOL-Data_Structures.Set_Specs"
begin

type_synonym bv = "bool list"
  
definition set_bv :: "bv \<Rightarrow> nat set" 
  where "set_bv bs = { i. i<length bs \<and> bs!i }"

datatype 'a itree = iLeaf | iNode "'a itree" "'a \<times> 'a" "'a itree"

fun set_itree2:: "'a::ord itree \<Rightarrow> 'a set" where
  "set_itree2 iLeaf = {}"
| "set_itree2 (iNode l (low, high) r) = {low .. high} \<union> ((set_itree2 l) \<union> (set_itree2 r))"

fun set_itree3:: "'a itree \<Rightarrow> ('a \<times> 'a) set" where 
  "set_itree3 iLeaf = {}"
| "set_itree3 (iNode l (low, high) r) = {(low, high)} \<union> ((set_itree3 l) \<union> (set_itree3 r))"


consts ibst :: "'a::linorder itree \<Rightarrow> bool"

consts delete :: "int \<Rightarrow> int itree \<Rightarrow> int itree"


end

Template File

theory Submission
  imports Defs
begin

interpretation bv_set: Set \<comment> \<open>Your parameters here\<close> 
  oops

fun ibst :: "'a::linorder itree \<Rightarrow> bool"  where
  "ibst _ = False"

fun delete :: "int \<Rightarrow> int itree \<Rightarrow> int itree"  where
  "delete _ _ = iLeaf"

lemma delete_set_minus: "ibst t \<Longrightarrow> set_itree2 (delete x t) = (set_itree2 t) - {x}"
  sorry

lemma ibst_delete: "ibst t \<Longrightarrow> ibst (delete x t)"
  sorry

end

Check File

theory Check
  imports Submission
begin

lemma delete_set_minus: "ibst t \<Longrightarrow> set_itree2 (delete x t) = (set_itree2 t) - {x}"
  by (rule Submission.delete_set_minus)

lemma ibst_delete: "ibst t \<Longrightarrow> ibst (delete x t)"
  by (rule Submission.ibst_delete)

end

Terms and Conditions