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
impl EncounterArgumentationState
Sourcepub fn new(registry: CatalogRegistry) -> Self
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.
Sourcepub fn argument_count(&self) -> usize
pub fn argument_count(&self) -> usize
Number of argument nodes in the framework.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Number of edges (attacks + supports) in the framework.
Sourcepub fn add_scheme_instance(
&mut self,
actor: &str,
instance: SchemeInstance,
) -> ArgumentId
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.
Sourcepub fn add_scheme_instance_for_affordance(
&mut self,
actor: &str,
affordance_name: &str,
bindings: &HashMap<String, String>,
instance: SchemeInstance,
) -> ArgumentId
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.
Sourcepub fn argument_id_for(&self, key: &AffordanceKey) -> Option<ArgumentId>
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.
Sourcepub fn actors_for(&self, id: &ArgumentId) -> &[String]
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.
Sourcepub fn actors_by_argument(&self) -> &HashMap<ArgumentId, Vec<String>>
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.
Sourcepub fn instances_for(&self, id: &ArgumentId) -> &[SchemeInstance]
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.
Sourcepub fn attackers_of(&self, target: &ArgumentId) -> Vec<ArgumentId>
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.
Sourcepub fn has_accepted_counter_by(
&self,
responder: &str,
target: &ArgumentId,
) -> Result<bool, Error>
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).
Sourcepub fn add_weighted_attack(
&mut self,
attacker: &ArgumentId,
target: &ArgumentId,
weight: f64,
) -> Result<(), Error>
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.
Sourcepub fn add_weighted_support(
&mut self,
supporter: &ArgumentId,
supported: &ArgumentId,
weight: f64,
) -> Result<(), Error>
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.
Sourcepub fn at_intensity(self, intensity: Budget) -> Self
pub fn at_intensity(self, intensity: Budget) -> Self
Builder method setting the scene-intensity budget. Returns
self by value to allow chaining.
Sourcepub fn set_intensity(&self, intensity: Budget)
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.
Sourcepub fn is_credulously_accepted(&self, arg: &ArgumentId) -> Result<bool, Error>
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).
Sourcepub fn is_skeptically_accepted(&self, arg: &ArgumentId) -> Result<bool, Error>
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).
Sourcepub fn coalitions(&self) -> Result<Vec<Coalition<ArgumentId>>, Error>
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).
Sourcepub fn drain_errors(&self) -> Vec<Error>
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.