isabelle - How to define a supremum on a set? -


i'm trying describe type system of programming language. has common subtype types (voidtype) , common supertype types (anytype):

datatype type =   voidtype |   anytype |   booleantype |   ebooleantype |   realtype |   integertype |   unlimnattype |   stringtype  fun subtype_strict_fun :: "type ⇒ type ⇒ bool" (infix "<:sf" 55)   "_ <:sf voidtype = false" | "voidtype <:sf _ = true" | "anytype <:sf _ = false" | "_ <:sf anytype = true" | "booleantype <:sf ebooleantype = true" | "integertype <:sf realtype = true" | "unlimnattype <:sf integertype = true" | "unlimnattype <:sf realtype = true" | "_ <:sf _ = false"  definition subtype_fun :: "type ⇒ type ⇒ bool" (infix "<:f" 55)   "x <:f y ≡ x = y ∨ x <:sf y" 

i'm trying instantinate type ccpo:

instantiation type :: ccpo begin  definition "less_eq = subtype_fun" definition "less = subtype_strict_fun"  lemma subtype_strict_eq_subtype:   "(x <:sf y) = (x <:f y ∧ ¬ y <:f x)"   (cases x; cases y; simp add: subtype_fun_def)  lemma subtype_refl:   "x <:f x"   (simp add: subtype_fun_def)  lemma subtype_trans:   "x <:f y ⟹ y <:f z ⟹ x <:f z"   (cases x; cases y; cases z; simp add: subtype_fun_def)  lemma subtype_antisym:   "x <:f y ⟹ y <:f x ⟹ x = y"   (cases x; cases y; simp add: subtype_fun_def)  instance   apply intro_classes   apply (simp add: less_eq_type_def less_type_def subtype_strict_eq_subtype)   apply (simp add: less_eq_type_def less_type_def subtype_refl)   apply (metis less_eq_type_def subtype_trans)   apply (metis less_eq_type_def subtype_antisym)  end 

could suggest how define supremum function sup :: ocl.type set ⇒ ocl.type?

the type ocl.type finite, sets of type ocl.type set finite, too. moreover, there top element in hierarchy. therefore, can define sup operation folding sup on given set. locale comm_monoid_set provides necessary infrastructure. first, instantiate type classes semilattice_sup , order_top. interpret comm_monoid_set:

interpretation ocl': abel_semigroup sup "top :: ocl.type" <proof> interpretation ocl: comm_monoid_set sup "top :: ocl.type" <proof> 

this generates folded sup operation on sets under name ocl.f. so,

definition "sup_ocl = ocl.f id" 

gives definition sup operation. general construction works finite upper semilattice top element. not give dedicated setup reasoning ocl.type hierarchy in particular. you'll have derive appropriate rules yourself.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -