Theory Two_Kleene_Algebra
section ‹2-Kleene algebras›
theory "Two_Kleene_Algebra"
imports Quantales_Converse.Modal_Kleene_Algebra_Var
begin
text ‹Here we develop (globular) 2-semigroups and (globular) 2-Kleene algebras. These should eventually
be extended to n-structures and omega-structures.›
subsection ‹Copies for 0-structures›
class comp0_op =
fixes comp0 :: "'a ⇒ 'a ⇒ 'a" (infixl ‹⋅⇩0› 70)
class id0_op =
fixes id0 :: "'a" (‹1⇩0›)
class star0_op =
fixes star0 :: "'a ⇒ 'a"
class dom0_op =
fixes dom⇩0 :: "'a ⇒ 'a"
class cod0_op =
fixes cod⇩0 :: "'a ⇒ 'a"
class monoid_mult0 = comp0_op + id0_op +
assumes par_assoc0: "x ⋅⇩0 (y ⋅⇩0 z) = (x ⋅⇩0 y) ⋅⇩0 z"
and comp0_unl: "1⇩0 ⋅⇩0 x = x"
and comp0_unr: "x ⋅⇩0 1⇩0 = x"
class dioid0 = monoid_mult0 + join_semilattice_zero +
assumes distl0: "x ⋅⇩0 (y + z) = x ⋅⇩0 y + x ⋅⇩0 z"
and distr0: "(x + y) ⋅⇩0 z = x ⋅⇩0 z + y ⋅⇩0 z"
and annil0: "0 ⋅⇩0 x = 0"
and annir0: "x ⋅⇩0 0 = 0"
class kleene_algebra0 = dioid0 + star0_op +
assumes star0_unfoldl: "1⇩0 + x ⋅⇩0 star0 x ≤ star0 x"
and star0_unfoldr: "1⇩0 + star0 x ⋅⇩0 x ≤ star0 x"
and star0_inductl: "z + x ⋅⇩0 y ≤ y ⟹ star0 x ⋅⇩0 z ≤ y"
and star0_inductr: "z + y ⋅⇩0 x ≤ y ⟹ z ⋅⇩0 star0 x ≤ y"
class domain_semiring0 = dioid0 + dom0_op +
assumes d0_absorb: "x ≤ dom⇩0 x ⋅⇩0 x"
and d0_local: "dom⇩0 (x ⋅⇩0 dom⇩0 y) = dom⇩0 (x ⋅⇩0 y)"
and d0_add: "dom⇩0 (x + y) = dom⇩0 x + dom⇩0 y"
and d0_subid: "dom⇩0 x ≤ 1⇩0"
and d0_zero: "dom⇩0 0 = 0"
class codomain_semiring0 = dioid0 + cod0_op +
assumes cod0_absorb: "x ≤ x ⋅⇩0 cod⇩0 x"
and cod0_local: "cod⇩0 (cod⇩0 x ⋅⇩0 y) = cod⇩0 (x ⋅⇩0 y)"
and cod0_add: "cod⇩0 (x + y) = cod⇩0 x + cod⇩0 y"
and cod0_subid: "cod⇩0 x ≤ 1⇩0"
and cod0_zero: "cod⇩0 0 = 0"
class modal_semiring0 = domain_semiring0 + codomain_semiring0 +
assumes dc_compat0: "dom⇩0 (cod⇩0 x) = cod⇩0 x"
and cd_compat0: "cod⇩0 (dom⇩0 x) = dom⇩0 x"
class modal_kleene_algebra0 = modal_semiring0 + kleene_algebra0
sublocale monoid_mult0 ⊆ mm0: monoid_mult "1⇩0" "(⋅⇩0)"
by (unfold_locales, simp_all add: local.par_assoc0 local.comp0_unl local.comp0_unr)
sublocale dioid0 ⊆ d0: dioid_one_zero _ "(⋅⇩0)" "1⇩0" _ _ _
by (unfold_locales, simp_all add: local.distl0 local.distr0 annil0 annir0)
sublocale dioid0 ⊆ dd0: dioid0 _ _ _ _ "λx y. y ⋅⇩0 x" _
by unfold_locales (simp_all add: local.mm0.mult_assoc local.d0.distrib_left)