Theory JBasis

Up to index of Isabelle/HOL/MicroJava

theory JBasis
imports Main

(*  Title:      HOL/MicroJava/J/JBasis.thy
ID: $Id$
Author: David von Oheimb
Copyright 1999 TU Muenchen
*)


header {*
\chapter{Java Source Language}\label{cha:j}
\isaheader{Some Auxiliary Definitions}
*}


theory JBasis imports Main begin

lemmas [simp] = Let_def

section "unique"

definition unique :: "('a × 'b) list => bool" where
"unique == distinct o map fst"



lemma fst_in_set_lemma [rule_format (no_asm)]:
"(x, y) : set xys --> x : fst ` set xys"

apply (induct_tac "xys")
apply auto
done

lemma unique_Nil [simp]: "unique []"
apply (unfold unique_def)
apply (simp (no_asm))
done

lemma unique_Cons [simp]: "unique ((x,y)#l) = (unique l & (!y. (x,y) ~: set l))"
apply (unfold unique_def)
apply (auto dest: fst_in_set_lemma)
done

lemma unique_append [rule_format (no_asm)]: "unique l' ==> unique l -->
(!(x,y):set l. !(x',y'):set l'. x' ~= x) --> unique (l @ l')"

apply (induct_tac "l")
apply (auto dest: fst_in_set_lemma)
done

lemma unique_map_inj [rule_format (no_asm)]:
"unique l --> inj f --> unique (map (%(k,x). (f k, g k x)) l)"

apply (induct_tac "l")
apply (auto dest: fst_in_set_lemma simp add: inj_eq)
done

section "More about Maps"

lemma map_of_SomeI [rule_format (no_asm)]:
"unique l --> (k, x) : set l --> map_of l k = Some x"

apply (induct_tac "l")
apply auto
done

lemma Ball_set_table':
"(∀(x,y)∈set l. P x y) --> (∀x. ∀y. map_of l x = Some y --> P x y)"

apply(induct_tac "l")
apply(simp_all (no_asm))
apply safe
apply auto
done
lemmas Ball_set_table = Ball_set_table' [THEN mp];

lemma table_of_remap_SomeD [rule_format (no_asm)]:
"map_of (map (λ((k,k'),x). (k,(k',x))) t) k = Some (k',x) -->
map_of t (k, k') = Some x"

apply (induct_tac "t")
apply auto
done

end