pub struct HypothesisBoard { /* private fields */ }Expand description
Main API for hypothesis management
Implementations§
Source§impl HypothesisBoard
impl HypothesisBoard
pub fn new(storage: Arc<dyn HypothesisStorage>) -> Self
pub fn in_memory() -> Self
Sourcepub async fn propose(
&self,
statement: impl Into<String>,
prior: Confidence,
) -> Result<HypothesisId>
pub async fn propose( &self, statement: impl Into<String>, prior: Confidence, ) -> Result<HypothesisId>
Propose a new hypothesis with explicit prior
Sourcepub async fn propose_with_max_uncertainty(
&self,
statement: impl Into<String>,
) -> Result<HypothesisId>
pub async fn propose_with_max_uncertainty( &self, statement: impl Into<String>, ) -> Result<HypothesisId>
Propose with maximum uncertainty (0.5) convenience method
Sourcepub async fn update_with_evidence(
&self,
id: HypothesisId,
likelihood_h: f64,
likelihood_not_h: f64,
) -> Result<Confidence>
pub async fn update_with_evidence( &self, id: HypothesisId, likelihood_h: f64, likelihood_not_h: f64, ) -> Result<Confidence>
Update hypothesis confidence using Bayes formula
Sourcepub async fn set_status(
&self,
id: HypothesisId,
status: HypothesisStatus,
) -> Result<()>
pub async fn set_status( &self, id: HypothesisId, status: HypothesisStatus, ) -> Result<()>
Update hypothesis status
Sourcepub async fn get(&self, id: HypothesisId) -> Result<Option<Hypothesis>>
pub async fn get(&self, id: HypothesisId) -> Result<Option<Hypothesis>>
Get a hypothesis by ID
Sourcepub async fn list(&self) -> Result<Vec<Hypothesis>>
pub async fn list(&self) -> Result<Vec<Hypothesis>>
List all hypotheses
Sourcepub async fn delete(&self, id: HypothesisId) -> Result<bool>
pub async fn delete(&self, id: HypothesisId) -> Result<bool>
Delete a hypothesis
Sourcepub async fn attach_evidence(
&self,
hypothesis_id: HypothesisId,
evidence_type: EvidenceType,
strength: f64,
metadata: EvidenceMetadata,
) -> Result<(EvidenceId, Confidence)>
pub async fn attach_evidence( &self, hypothesis_id: HypothesisId, evidence_type: EvidenceType, strength: f64, metadata: EvidenceMetadata, ) -> Result<(EvidenceId, Confidence)>
Attach evidence to a hypothesis and update confidence
This is the primary method for evidence attachment. It:
- Stores the evidence
- Converts strength to likelihood ratio
- Updates hypothesis confidence using Bayes formula
Sourcepub async fn get_evidence(&self, id: EvidenceId) -> Result<Option<Evidence>>
pub async fn get_evidence(&self, id: EvidenceId) -> Result<Option<Evidence>>
Get evidence by ID
Sourcepub async fn list_evidence(
&self,
hypothesis_id: HypothesisId,
) -> Result<Vec<Evidence>>
pub async fn list_evidence( &self, hypothesis_id: HypothesisId, ) -> Result<Vec<Evidence>>
List all evidence for a hypothesis
Sourcepub async fn list_supporting_evidence(
&self,
hypothesis_id: HypothesisId,
) -> Result<Vec<Evidence>>
pub async fn list_supporting_evidence( &self, hypothesis_id: HypothesisId, ) -> Result<Vec<Evidence>>
Trace supporting evidence for a hypothesis
Sourcepub async fn list_refuting_evidence(
&self,
hypothesis_id: HypothesisId,
) -> Result<Vec<Evidence>>
pub async fn list_refuting_evidence( &self, hypothesis_id: HypothesisId, ) -> Result<Vec<Evidence>>
Trace refuting evidence for a hypothesis
Sourcepub async fn delete_evidence(&self, id: EvidenceId) -> Result<bool>
pub async fn delete_evidence(&self, id: EvidenceId) -> Result<bool>
Delete evidence
Sourcepub async fn state_at(
&self,
checkpoint_service: &CheckpointService,
checkpoint_id: CheckpointId,
) -> Result<Option<HypothesisState>>
pub async fn state_at( &self, checkpoint_service: &CheckpointService, checkpoint_id: CheckpointId, ) -> Result<Option<HypothesisState>>
Query hypothesis state at a past checkpoint time
This enables time-travel queries: “What did I believe at checkpoint X?”
Sourcepub async fn update_confidence_direct(
&self,
id: HypothesisId,
confidence: Confidence,
) -> Result<()>
pub async fn update_confidence_direct( &self, id: HypothesisId, confidence: Confidence, ) -> Result<()>
Directly sets confidence without evidence (used by propagation system)
This method bypasses the normal evidence-based update path and is intended for use by the confidence propagation system, which updates dependents based on cascade computations.
Auto Trait Implementations§
impl Freeze for HypothesisBoard
impl !RefUnwindSafe for HypothesisBoard
impl Send for HypothesisBoard
impl Sync for HypothesisBoard
impl Unpin for HypothesisBoard
impl UnsafeUnpin for HypothesisBoard
impl !UnwindSafe for HypothesisBoard
Blanket Implementations§
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more