Theory PortCombinators
subsection ‹Policy Combinators with Ports›
theory
PortCombinators
imports
PolicyCombinators
begin
text‹
This theory defines policy combinators for those network models which
have ports. They are provided in addition to the the ones defined in the
PolicyCombinators theory.
This theory requires from the network models a definition for the two following constants:
\begin{itemize}
\item $src\_port :: ('\alpha,'\beta) packet \Rightarrow ('\gamma::port)$
\item $dest\_port :: ('\alpha,'\beta) packet \Rightarrow ('\gamma::port)$
\end{itemize}
›
definition
allow_all_from_port :: "'α::adr net ⇒ ('γ::port) ⇒ (('α,'β) packet ↦ unit)" where
"allow_all_from_port src_net s_port = {pa. src_port pa = s_port} ◃ allow_all_from src_net"
definition
deny_all_from_port :: "'α::adr net ⇒ 'γ::port ⇒ (('α,'β) packet ↦ unit)" where
"deny_all_from_port src_net s_port = {pa. src_port pa = s_port} ◃ deny_all_from src_net "
definition
allow_all_to_port :: "'α::adr net ⇒ 'γ::port ⇒ (('α,'β) packet ↦ unit)" where
"allow_all_to_port dest_net d_port = {pa. dest_port pa = d_port} ◃ allow_all_to dest_net"
definition
deny_all_to_port :: "'α::adr net ⇒ 'γ::port ⇒ (('α,'β) packet ↦ unit)" where
"deny_all_to_port dest_net d_port = {pa. dest_port pa = d_port} ◃ deny_all_to dest_net"
definition
allow_all_from_port_to:: "'α::adr net ⇒ 'γ::port ⇒ 'α::adr net ⇒ (('α,'β) packet ↦ unit)"
where
"allow_all_from_port_to src_net s_port dest_net
= {pa. src_port pa = s_port} ◃ allow_all_from_to src_net dest_net"
definition
deny_all_from_port_to::"'α::adr net ⇒ 'γ::port ⇒ 'α::adr net ⇒ (('α,'β) packet ↦ unit)"
where
"deny_all_from_port_to src_net s_port dest_net
= {pa. src_port pa = s_port} ◃ deny_all_from_to src_net dest_net "
definition
allow_all_from_port_to_port::"'α::adr net ⇒ 'γ::port ⇒ 'α::adr net ⇒ 'γ::port ⇒
(('α,'β) packet ↦ unit)" where
"allow_all_from_port_to_port src_net s_port dest_net d_port =
{pa. dest_port pa = d_port} ◃ allow_all_from_port_to src_net s_port dest_net"
definition
deny_all_from_port_to_port :: "'α::adr net ⇒ 'γ::port ⇒ 'α::adr net ⇒
'γ::port ⇒ (('α,'β) packet ↦ unit)" where
"deny_all_from_port_to_port src_net s_port dest_net d_port =
{pa. dest_port pa = d_port} ◃ deny_all_from_port_to src_net s_port dest_net"
definition
allow_all_from_to_port :: "'α::adr net ⇒ 'α::adr net ⇒
'γ::port ⇒ (('α,'β) packet ↦ unit)" where
"allow_all_from_to_port src_net dest_net d_port =
{pa. dest_port pa = d_port} ◃ allow_all_from_to src_net dest_net"
definition
deny_all_from_to_port :: "'α::adr net ⇒ 'α::adr net ⇒ 'γ::port ⇒
(('α,'β) packet ↦ unit)" where
"deny_all_from_to_port src_net dest_net d_port =
{pa. dest_port pa = d_port} ◃ deny_all_from_to src_net dest_net"
definition
allow_from_port_to :: "'γ::port ⇒ 'α::adr net ⇒ 'α::adr net ⇒ (('α,'β) packet ↦ unit)"
where
"allow_from_port_to port src_net dest_net =
{pa. src_port pa = port} ◃ allow_all_from_to src_net dest_net"
definition
deny_from_port_to :: "'γ::port ⇒ 'α::adr net ⇒ 'α::adr net ⇒ (('α,'β) packet ↦ unit)"
where
"deny_from_port_to port src_net dest_net =
{pa. src_port pa = port} ◃ deny_all_from_to src_net dest_net"
definition
allow_from_to_port :: "'γ::port ⇒ 'α::adr net ⇒ 'α::adr net ⇒ (('α,'β) packet ↦ unit)"
where
"allow_from_to_port port src_net dest_net =
{pa. dest_port pa = port} ◃ allow_all_from_to src_net dest_net"
definition
deny_from_to_port :: "'γ::port ⇒ 'α::adr net ⇒ 'α::adr net ⇒ (('α,'β) packet ↦ unit)"
where
"deny_from_to_port port src_net dest_net =
{pa. dest_port pa = port} ◃ deny_all_from_to src_net dest_net"
definition
allow_from_ports_to :: "'γ::port set ⇒ 'α::adr net ⇒ 'α::adr net ⇒
(('α,'β) packet ↦ unit)" where
"allow_from_ports_to ports src_net dest_net =
{pa. src_port pa ∈ ports} ◃ allow_all_from_to src_net dest_net"
definition
allow_from_to_ports :: "'γ::port set ⇒ 'α::adr net ⇒ 'α::adr net ⇒
(('α,'β) packet ↦ unit)" where
"allow_from_to_ports ports src_net dest_net =
{pa. dest_port pa ∈ ports} ◃ allow_all_from_to src_net dest_net"
definition
deny_from_ports_to :: "'γ::port set ⇒ 'α::adr net ⇒ 'α::adr net ⇒
(('α,'β) packet ↦ unit)" where
"deny_from_ports_to ports src_net dest_net =
{pa. src_port pa ∈ ports} ◃ deny_all_from_to src_net dest_net"
definition
deny_from_to_ports :: "'γ::port set ⇒ 'α::adr net ⇒ 'α::adr net ⇒
(('α,'β) packet ↦ unit)" where
"deny_from_to_ports ports src_net dest_net =
{pa. dest_port pa ∈ ports} ◃ deny_all_from_to src_net dest_net"
definition
allow_all_from_port_tos:: "'α::adr net ⇒ ('γ::port) set ⇒ 'α::adr net ⇒ (('α,'β) packet ↦ unit)"
where
"allow_all_from_port_tos src_net s_port dest_net
= {pa. dest_port pa ∈ s_port} ◃ allow_all_from_to src_net dest_net"
text‹
As before, we put all the rules into one lemma called PortCombinators to ease writing later.
›
lemmas PortCombinatorsCore =
allow_all_from_port_def deny_all_from_port_def allow_all_to_port_def
deny_all_to_port_def allow_all_from_to_port_def
deny_all_from_to_port_def
allow_from_ports_to_def allow_from_to_ports_def
deny_from_ports_to_def deny_from_to_ports_def
allow_all_from_port_to_def deny_all_from_port_to_def
allow_from_port_to_def allow_from_to_port_def deny_from_to_port_def
deny_from_port_to_def allow_all_from_port_tos_def
lemmas PortCombinators = PortCombinatorsCore PolicyCombinators
end