Skip to main content

EncounterArgumentationState

Struct EncounterArgumentationState 

Source
pub struct EncounterArgumentationState { /* private fields */ }
Expand description

Encounter-level argumentation state composing schemes (premises + conclusion), bipolar graph structure (attacks + supports), weighted edge strengths, and a configurable scene-intensity budget.

Implementations§

Source§

impl EncounterArgumentationState

Source

pub fn new(registry: CatalogRegistry) -> Self

Create a new state with the given scheme registry and zero scene intensity. Consumers that want relationship-modulated attack weights should construct a societas-aware WeightSource (e.g. societas_encounter::SocietasRelationshipSource from the societas-encounter crate with the argumentation feature enabled), then pass its computed weights into add_weighted_attack; the state does not auto-wire the source.

Source

pub fn intensity(&self) -> Budget

Read-only access to the current scene intensity.

Source

pub fn argument_count(&self) -> usize

Number of argument nodes in the framework.

Source

pub fn edge_count(&self) -> usize

Number of edges (attacks + supports) in the framework.

Source

pub fn add_scheme_instance( &mut self, actor: &str, instance: SchemeInstance, ) -> ArgumentId

Add a scheme instance asserted by actor. The instance’s conclusion literal becomes an argument node in the framework (if not already present). The actor and instance are recorded against that node for later lookup via actors_for / instances_for. Returns the argument’s identifier.

Source

pub fn add_scheme_instance_for_affordance( &mut self, actor: &str, affordance_name: &str, bindings: &HashMap<String, String>, instance: SchemeInstance, ) -> ArgumentId

Add a scheme instance asserted by actor for the named affordance with the given bindings. Functionally identical to Self::add_scheme_instance plus an entry in the affordance forward index so consumers can later look up this argument from an (actor, affordance_name, bindings) triple.

If two scheme instances produce the same conclusion literal (same ArgumentId), both actors are recorded against that single argument node — convergence behaviour is the same as Self::add_scheme_instance. Both keys in the forward index point at the shared id.

Convergence has a downstream consequence for Self::has_accepted_counter_by: see that method’s docs.

Re-seeding the same key silently overwrites. Calling this method twice with identical (actor, affordance_name, bindings) triples replaces the previous entry; the most recent ArgumentId wins. Callers should seed each affordance at most once per scene.

Source

pub fn argument_id_for(&self, key: &AffordanceKey) -> Option<ArgumentId>

Look up the argument id associated with an affordance key, if one was seeded via Self::add_scheme_instance_for_affordance.

Source

pub fn actors_for(&self, id: &ArgumentId) -> &[String]

Return the list of actors who have asserted the given argument. Empty slice if the argument is not associated with any actor.

Source

pub fn actors_by_argument(&self) -> &HashMap<ArgumentId, Vec<String>>

Read-only access to the actor-per-argument map. Used by bridge weight sources (e.g. societas_encounter::SocietasRelationshipSource from the societas-encounter crate) to resolve an ArgumentId back to the actors whose asserted schemes produce that conclusion.

Source

pub fn instances_for(&self, id: &ArgumentId) -> &[SchemeInstance]

Return the list of scheme instances backing the given argument. Empty slice if the argument is not scheme-backed.

Source

pub fn attackers_of(&self, target: &ArgumentId) -> Vec<ArgumentId>

Return the direct attackers of target in the current framework. Ignores support edges and does NOT resolve the β-inconsistent residual — this is a structural query.

Consumers that want “is there a credulously accepted attacker at current β?” should query each attacker via Self::is_credulously_accepted.

If the underlying framework contains multiple attack edges for the same (attacker, target) pair (the framework does not deduplicate), the attacker id appears once per edge in the returned Vec. Consumers that want a set projection should .dedup() or collect through a HashSet.

Source

pub fn has_accepted_counter_by( &self, responder: &str, target: &ArgumentId, ) -> Result<bool, Error>

Return true iff responder has put forward (via Self::add_scheme_instance or Self::add_scheme_instance_for_affordance) some argument that (1) directly attacks target, AND (2) is credulously accepted at the current scene intensity.

This is the per-responder counter-argument query used by the bridge’s crate::state_acceptance::StateAcceptanceEval to decide whether a responder rejects a proposed action. It differs from Self::is_credulously_accepted (which is a global β acceptance check regardless of who asserted the argument).

Returns Err if the framework exceeds the weighted-bipolar residual enumeration limit. The bridge wraps this error into its error latch; consumers should rarely see Err surface directly.

Shared-ArgumentId attribution. If two actors both assert scheme instances whose conclusions resolve to the same ArgumentId (i.e., they independently endorse the same argument), both appear in Self::actors_for against that node. This method considers all of them to “have put forward” the argument — so it returns true for any responder in the shared set, not just the specific actor who seeded the instance that carries the attack edge. Consumers who need strict per-instance attribution should seed distinct conclusions for each actor (e.g., "alice_opposes" vs "bob_opposes" rather than a shared "oppose" literal).

Source

pub fn add_weighted_attack( &mut self, attacker: &ArgumentId, target: &ArgumentId, weight: f64, ) -> Result<(), Error>

Add a weighted attack edge. Both endpoints are implicitly added to the framework if not already present. Returns Error::WeightedBipolar for invalid weights.

Source

pub fn add_weighted_support( &mut self, supporter: &ArgumentId, supported: &ArgumentId, weight: f64, ) -> Result<(), Error>

Add a weighted support edge. Both endpoints are implicitly added. Returns Error::WeightedBipolar for invalid weights or self-support.

Source

pub fn at_intensity(self, intensity: Budget) -> Self

Builder method setting the scene-intensity budget. Returns self by value to allow chaining.

Source

pub fn set_intensity(&self, intensity: Budget)

Mutate the scene intensity (β) through a shared reference. Used by consumers — notably the bridge’s StateAcceptanceEval and StateActionScorer — that hold &self during encounter’s resolve loops but still want to escalate β mid-scene.

For new-state construction prefer the by-value builder Self::at_intensity.

Source

pub fn is_credulously_accepted(&self, arg: &ArgumentId) -> Result<bool, Error>

Whether the argument is credulously accepted under the current scene intensity (at least one preferred extension of at least one β-inconsistent residual contains it).

Source

pub fn is_skeptically_accepted(&self, arg: &ArgumentId) -> Result<bool, Error>

Whether the argument is skeptically accepted under the current scene intensity (every preferred extension of every β-inconsistent residual contains it).

Source

pub fn coalitions(&self) -> Result<Vec<Coalition<ArgumentId>>, Error>

Detect coalitions (strongly-connected components of the support graph) at the current framework state. Independent of scene intensity — coalitions are a structural property of supports, not a semantic query.

Returns Err(Error::WeightedBipolar) if the framework exceeds the underlying edge-enumeration limit (currently 24 attacks + supports combined).

Source

pub fn drain_errors(&self) -> Vec<Error>

Drain all errors observed by bridge impls whose trait signature can’t propagate Result. Clears the internal buffer. Returns an empty Vec if no errors occurred since the last drain.

Errors are returned in the order they were recorded, so the first entry is the first error observed in the current drain window.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.