pub struct CompiledLogicProgram { /* private fields */ }Implementations§
Source§impl CompiledLogicProgram
impl CompiledLogicProgram
Sourcepub fn prepare_conditioned(
&self,
py: Python<'_>,
prob_source: &str,
memory_mb: Option<u64>,
) -> PyResult<CompiledConditionedProgram>
pub fn prepare_conditioned( &self, py: Python<'_>, prob_source: &str, memory_mb: Option<u64>, ) -> PyResult<CompiledConditionedProgram>
Compile this program’s accepted epistemic evidence and prob_source once.
The returned handle can be evaluated repeatedly while independent
probabilistic fact priors are changed atomically. It does not accept
caller-supplied input relations, matching evaluate_conditioned.
Sourcepub fn evaluate_conditioned(
&self,
py: Python<'_>,
prob_source: &str,
memory_mb: Option<u64>,
) -> PyResult<EpistemicEvalResult>
pub fn evaluate_conditioned( &self, py: Python<'_>, prob_source: &str, memory_mb: Option<u64>, ) -> PyResult<EpistemicEvalResult>
Run this epistemic program on the GPU and condition prob_source on what it knows.
The compiled program must contain epistemic operators (know, possible, …)
AND lower to a single-component epistemic plan: ordinary Datalog programs are
rejected, because there is no accepted world view to condition on. Only facts
declared in the epistemic program’s own source are used to build that world view.
Both epistemic modes are reachable here. FAEEL programs and non-recursive
G91-compatibility programs (#pragma epistemic_mode = g91) both lower to a
single-component epistemic plan and condition normally;
epistemic_evidence().epistemic_mode names the mode, and the trace’s
accepted_faeel_world_view_evidence_consumed /
accepted_g91_world_view_evidence_consumed pair says which one actually supplied
the evidence. Only the recursive G91 shapes (positive possible cycles that
need tuple-level compatibility) compile to a dedicated G91-compatibility plan and
are rejected at plan level, alongside split, stratified and WFS plans.
LIMITATION: unlike evaluate, this method does not accept dlpack_inputs.
Caller-supplied input relations are NOT consulted — if the epistemic program
depends on a relation that is normally supplied at call time via
evaluate(dlpack_inputs=...), that relation is empty here and no world view is
accepted. This method then RAISES RuntimeError (“Unsupported epistemic
construct: accepted GPU world-view evidence … probabilistic evidence requires
non-empty accepted GPU final output”); it does NOT fall back to the unconditioned
prior. That is fail-closed by design: a conditioned query that silently became
unconditioned would be indistinguishable from a successful one, which is exactly
the failure the trace counters exist to make visible. To test for the case
without catching an exception, call epistemic_evidence() first — it reports
accepted_world_views == 0 without raising.
The returned trace must show a non-zero gpu_conditioned_evidence_facts —
otherwise the conditioning did not reach the GPU exact path.
gpu_conditioned_evidence_facts is the total the
engine itself validates; the per-class counters
(gpu_conditioned_know_evidence_facts,
gpu_conditioned_possible_evidence_facts,
gpu_conditioned_not_known_evidence_facts,
gpu_conditioned_not_possible_evidence_facts) break it down. A possible-only
or negated-evidence program conditions correctly with the know counter at 0,
so check the total, not the know class alone.
Sourcepub fn epistemic_evidence(&self, py: Python<'_>) -> PyResult<EpistemicEvidence>
pub fn epistemic_evidence(&self, py: Python<'_>) -> PyResult<EpistemicEvidence>
Run this epistemic program on the GPU and report what it accepted.
Diagnostic counterpart of evaluate_conditioned: it answers whether the
know-broadcast happened at all, without involving the probabilistic tier.
LIMITATION: like evaluate_conditioned, this only ever sees facts declared in
the epistemic program’s own source; it does not accept caller-supplied input
relations. A program that depends on such a relation reports
accepted_world_views == 0, accepted_candidates == 0 and
final_output_rows == 0 here — without raising. The operator censuses
(know_operator_count, possible_operator_count) are read off the plan, not the
execution, so they stay non-zero: it is the accepted/consumed family that goes to
zero, not “every counter”. Calling evaluate_conditioned() on that same program
RAISES rather than returning an unconditioned result, so this method is the
non-raising way to probe for the case first.
Source§impl CompiledLogicProgram
impl CompiledLogicProgram
pub fn evaluate( &self, py: Python<'_>, dlpack_inputs: Option<&Bound<'_, PyDict>>, memory_mb: Option<u64>, ) -> PyResult<LogicEvalResult>
pub fn session(&self) -> PyResult<LogicRelationSession>
Sourcepub fn memory_stats(&self, py: Python<'_>) -> PyResult<Py<PyAny>>
pub fn memory_stats(&self, py: Python<'_>) -> PyResult<Py<PyAny>>
Return memory diagnostics including allocated_bytes and memory_limit_bytes.
pub fn rule_provenance(&self, py: Python<'_>) -> PyResult<Py<PyAny>>
pub fn proof_traces(&self, py: Python<'_>) -> PyResult<Py<PyAny>>
Trait Implementations§
impl DerefToPyAny for CompiledLogicProgram
impl ExtractPyClassWithClone for CompiledLogicProgram
Source§impl<'py> IntoPyObject<'py> for CompiledLogicProgram
impl<'py> IntoPyObject<'py> for CompiledLogicProgram
Source§type Target = CompiledLogicProgram
type Target = CompiledLogicProgram
Source§type Output = Bound<'py, <CompiledLogicProgram as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <CompiledLogicProgram as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for CompiledLogicProgram
impl PyClass for CompiledLogicProgram
Source§impl PyClassImpl for CompiledLogicProgram
impl PyClassImpl for CompiledLogicProgram
Source§const MODULE: Option<&str> = ::core::option::Option::None
const MODULE: Option<&str> = ::core::option::Option::None
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = c"\x00"
const RAW_DOC: &'static CStr = c"\x00"
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<CompiledLogicProgram as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<CompiledLogicProgram>
type Layout = <<CompiledLogicProgram as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<CompiledLogicProgram>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
type Inventory = Pyo3MethodsInventoryForCompiledLogicProgram
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyTypeInfo for CompiledLogicProgram
impl PyTypeInfo for CompiledLogicProgram
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
prefer using ::type_object(py).name() to get the correct runtime value
Source§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
prefer using ::type_object(py).module() to get the correct runtime value
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.Auto Trait Implementations§
impl Freeze for CompiledLogicProgram
impl RefUnwindSafe for CompiledLogicProgram
impl Send for CompiledLogicProgram
impl Sync for CompiledLogicProgram
impl Unpin for CompiledLogicProgram
impl UnsafeUnpin for CompiledLogicProgram
impl UnwindSafe for CompiledLogicProgram
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self into a Python object. Read more§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
isinstance and issubclass function. Read more