Temporal Operators¶
API Reference¶
masa.common.pctl.Next ¶
Bases: BoundedPCTLFormula
Bounded PCTL next operator \(X\) with probability threshold.
This represents:
Informally, the formula holds at state \(s\) iff the probability that \(\Phi\) holds in the next state is at least \(p\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prob
|
float
|
Probability threshold \(p \in [0,1]\). |
required |
subformula
|
BoundedPCTLFormula
|
The subformula \(\Phi\) evaluated at the next state. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
prob |
Probability threshold \(p\). |
|
subformula |
Nested formula \(\Phi\). |
|
bound_param |
Local bound contributed by this operator (fixed to 1). |
See Also
_prob_seq: Computes the shifted probability sequence for
\(X\,\Phi\).
Source code in masa/common/pctl.py
_next_prob_seq_core_dense
staticmethod
¶
JAX core for Next on a dense kernel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m
|
ndarray
|
Dense Markov-chain transition matrix of shape |
required |
sub_seq
|
ndarray
|
Subformula sequence of shape |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Sequence of shape |
ndarray
|
operator is defined to have probability 0 at time 0), and rows 1..T |
ndarray
|
contain one-step expectations of |
Source code in masa/common/pctl.py
_next_prob_seq_core_compact
staticmethod
¶
JAX core for Next on a compact kernel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
succ
|
ndarray
|
Successor ids of shape |
required |
p
|
ndarray
|
Successor probabilities of shape |
required |
sub_seq
|
ndarray
|
Subformula sequence of shape |
required |
K
|
int
|
Max successors per state (static argument for JIT). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Sequence of shape |
Source code in masa/common/pctl.py
_prob_seq ¶
_prob_seq(kernel: Kernel, vec_label_fn: ndarray, atom_dict: Dict[str, int], max_k: int | None = None) -> np.ndarray
Compute the probability sequence for \(X\,\Phi\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kernel
|
Kernel
|
Markov-chain kernel (dense or compact). |
required |
vec_label_fn
|
ndarray
|
Vectorized labeling matrix |
required |
atom_dict
|
Dict[str, int]
|
Mapping from atom string to row index. |
required |
max_k
|
int | None
|
Local horizon (inclusive). If |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Float64 array of shape |
Notes
If max_k == 0, returns a single row of zeros.
Source code in masa/common/pctl.py
sat ¶
Threshold the one-step probability for \(\mathbb{P}_{\ge p}[X\,\Phi]\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kernel
|
Kernel
|
Markov-chain kernel (dense or compact). |
required |
vec_label_fn
|
ndarray
|
Vectorized labeling matrix |
required |
atom_dict
|
Dict[str, int]
|
Mapping from atom string to row index. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Float64 array of shape |
Source code in masa/common/pctl.py
masa.common.pctl.Until ¶
Bases: BoundedPCTLFormula
Bounded PCTL until operator \(U^{\le B}\) with probability threshold.
This represents:
Informally, the formula holds at state \(s\) iff the probability that \(\Phi_2\) becomes true within \(B\) steps while \(\Phi_1\) holds at all preceding steps is at least \(p\).
The bounded-until recurrence computed by _prob_seq is:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prob
|
float
|
Probability threshold \(p \in [0,1]\). |
required |
bound
|
Local bound \(B\). |
required | |
subformula_1
|
BoundedPCTLFormula
|
Continuation condition \(\Phi_1\). |
required |
subformula_2
|
BoundedPCTLFormula
|
Target condition \(\Phi_2\). |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
prob |
Probability threshold. |
|
bound_param |
Local bound \(B\). |
|
subformula_1 |
Continuation formula. |
|
subformula_2 |
Target formula. |
Source code in masa/common/pctl.py
_bound
property
¶
Total bound for Until.
Returns:
| Type | Description |
|---|---|
|
|
_until_prob_seq_core_dense
staticmethod
¶
JAX core for bounded-until probabilities using a dense kernel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m
|
ndarray
|
Dense Markov-chain transition matrix of shape |
required |
sat1
|
ndarray
|
Satisfaction mask for \(\Phi_1\), shape |
required |
sat2
|
ndarray
|
Satisfaction mask for \(\Phi_2\), shape |
required |
max_k
|
int
|
Local bound \(B\). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Float64 JAX array of shape |
Source code in masa/common/pctl.py
_until_prob_seq_core_compact
staticmethod
¶
_until_prob_seq_core_compact(succ: ndarray, p: ndarray, sat1: ndarray, sat2: ndarray, max_k: int, K: int) -> jnp.ndarray
JAX core for bounded-until probabilities using a compact kernel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
succ
|
ndarray
|
Successor ids |
required |
p
|
ndarray
|
Successor probabilities |
required |
sat1
|
ndarray
|
Satisfaction mask for \(\Phi_1\), shape |
required |
sat2
|
ndarray
|
Satisfaction mask for \(\Phi_2\), shape |
required |
max_k
|
int
|
Local bound \(B\). |
required |
K
|
int
|
Max successors per state (static argument for JIT). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Float64 JAX array of shape |
Source code in masa/common/pctl.py
_prob_seq ¶
_prob_seq(kernel: Kernel, vec_label_fn: ndarray, atom_dict: Dict[str, int], max_k: int | None = None) -> np.ndarray
Compute the bounded-until probability sequence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kernel
|
Kernel
|
Markov-chain kernel (dense or compact). |
required |
vec_label_fn
|
ndarray
|
Vectorized labeling matrix |
required |
atom_dict
|
Dict[str, int]
|
Mapping from atom string to row index. |
required |
max_k
|
int | None
|
Local horizon (inclusive). If |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Float64 array of shape |
Source code in masa/common/pctl.py
sat ¶
Threshold \(\mathbb{P}_{\ge p}[\Phi_1\ U^{\le B}\ \Phi_2]\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kernel
|
Kernel
|
Markov-chain kernel (dense or compact). |
required |
vec_label_fn
|
ndarray
|
Vectorized labeling matrix |
required |
atom_dict
|
Dict[str, int]
|
Mapping from atom string to row index. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Float64 array of shape |
Source code in masa/common/pctl.py
masa.common.pctl.Always ¶
Bases: BoundedPCTLFormula
Bounded PCTL always operator \(G^{\le B}\) with probability threshold.
This represents:
MASA implements bounded always via duality:
with the threshold transformation \(p \mapsto 1-p\) applied to the inner until.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prob
|
float
|
Probability threshold \(p \in [0,1]\). |
required |
bound
|
int
|
Local bound \(B\). |
required |
subformula
|
BoundedPCTLFormula
|
Subformula \(\Phi\). |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
prob |
Probability threshold. |
|
bound_param |
Local bound. |
|
subformula |
Nested formula. |
|
_inner |
Desugared formula (internal) built from |
Source code in masa/common/pctl.py
masa.common.pctl.Eventually ¶
Bases: BoundedPCTLFormula
Bounded PCTL eventually operator \(F^{\le B}\) with probability threshold.
This represents:
MASA implements bounded eventually as a bounded until:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prob
|
float
|
Probability threshold \(p \in [0,1]\). |
required |
bound
|
int
|
Local bound \(B\). |
required |
subformula
|
BoundedPCTLFormula
|
Subformula \(\Phi\). |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
prob |
Probability threshold. |
|
bound_param |
Local bound. |
|
subformula |
Nested formula. |
|
_inner |
Desugared formula (internal) built from |