\section{Model of Computation}
\label{sec:computationModel}

The model of computation for SPCL's runtime environment is very
similar to Prolog. The runtime environment is represented by the
PolicyEngine and defines various namespaces called `zones'. The
PolicyEngine bootstraps each zone with a policy as defined by an
SPCL source file. Then, the runtime environment loads and resolves
the objects and references in the zone's policy. Any system is now
free to talk the SPCL protocol (make SPCL 'CAN' queries) to the
PolicyEngine.

The PolicyEngine runs the following algorithm to answer a query:

\begin{tabbing}
\hspace{0.5in} \=query( \=princi\=pal, groups, objects, action\_string, 
conditions, zone) \{\+\+\\
    switchTo[ zone ];\\
    conditions = conditions $\bigcup$ get[ current\_conditions ];\\
    find[ principals and groups ];\\
    $\forall$( principal )\{\+\\
        find[ rules ];  //find relevant rules\\
        resolve[ action\_string, conditions ] with [ object.actions ]\\
        if( match ) rule.fire() AND return;\-\\
    \}\\
    $\forall$( group )\{\+\\
        find[ rules ];  //find relevant rules\\
        resolve[ action\_string, conditions ] with [ object.actions ]\\
        if( match ) rule.fire() AND return;\-\\
    \}\-\\
\}\-\\
\end{tabbing}

