src/HOL/Data_Structures/Isin2.thy
author Manuel Eberl <eberlm@in.tum.de>
Mon, 26 Mar 2018 16:12:55 +0200
changeset 67950 99eaa5cedbb7
parent 67929 30486b96274d
child 67964 08cc5ab18c84
permissions -rw-r--r--
Added some simple facts about limits

(* Author: Tobias Nipkow *)

section \<open>Function \textit{isin} for Tree2\<close>

theory Isin2
imports
  Tree2
  Cmp
  Set_by_Ordered
begin

fun isin :: "('a::linorder,'b) tree \<Rightarrow> 'a \<Rightarrow> bool" where
"isin Leaf x = False" |
"isin (Node _ l a r) x =
  (case cmp x a of
     LT \<Rightarrow> isin l x |
     EQ \<Rightarrow> True |
     GT \<Rightarrow> isin r x)"

lemma isin_set: "sorted(inorder t) \<Longrightarrow> isin t x = (x \<in> set(inorder t))"
by (induction t) (auto simp: isin_simps)

end