encounter_argumentation/lib.rs
1#![deny(missing_docs)]
2#![warn(clippy::all)]
3
4//! Bridge between encounter social interactions and argumentation schemes.
5//!
6//! Provides formal argument resolution for encounter's social interaction
7//! engine, using Walton argumentation schemes evaluated via ASPIC+ and
8//! Dung extension semantics.
9//!
10//! # Quick example — pairwise resolver (v0.1.x; still supported)
11//!
12//! ```
13//! use argumentation_schemes::catalog::default_catalog;
14//! use argumentation_schemes::instantiate;
15//! use encounter_argumentation::resolver::{resolve_argument, ArgumentOutcome};
16//!
17//! let registry = default_catalog();
18//! let expert = registry.by_key("argument_from_expert_opinion").unwrap();
19//! let instance = instantiate(expert, &[
20//! ("expert".into(), "alice".into()),
21//! ("domain".into(), "military".into()),
22//! ("claim".into(), "fortify_east".into()),
23//! ].into_iter().collect()).unwrap();
24//!
25//! let outcome = resolve_argument(&[instance], &[], ®istry);
26//! assert!(matches!(outcome, ArgumentOutcome::ProposerWins { .. }));
27//! ```
28//!
29//! # Quick example — state API (v0.2.0)
30//!
31//! The new `EncounterArgumentationState` unifies scheme reasoning,
32//! bipolar graph structure, weighted attack strengths, and a tunable
33//! scene-intensity budget:
34//!
35//! ```
36//! use argumentation_schemes::catalog::default_catalog;
37//! use argumentation_weighted::types::Budget;
38//! use encounter_argumentation::{ArgumentId, EncounterArgumentationState};
39//!
40//! let registry = default_catalog();
41//! let expert = registry.by_key("argument_from_expert_opinion").unwrap();
42//! let instance = expert.instantiate(&[
43//! ("expert".into(), "alice".into()),
44//! ("domain".into(), "military".into()),
45//! ("claim".into(), "fortify_east".into()),
46//! ].into_iter().collect()).unwrap();
47//!
48//! let mut state = EncounterArgumentationState::new(registry)
49//! .at_intensity(Budget::new(0.4).unwrap());
50//! let alice_arg = state.add_scheme_instance("alice", instance);
51//! state
52//! .add_weighted_attack(&ArgumentId::new("bob_counter"), &alice_arg, 0.3)
53//! .unwrap();
54//!
55//! // At β=0.4 > 0.3 the attack is tolerated: alice's claim is accepted.
56//! assert!(state.is_credulously_accepted(&alice_arg).unwrap());
57//! ```
58
59pub mod acceptance;
60pub mod affordance_key;
61pub mod arg_id;
62pub mod critical_moves;
63/// Error types for encounter-argumentation operations.
64pub mod error;
65pub mod knowledge;
66pub mod resolver;
67pub mod scoring;
68pub mod state;
69pub mod state_acceptance;
70pub mod state_scorer;
71pub mod value_argument;
72
73pub use acceptance::ArgumentAcceptanceEval;
74pub use affordance_key::AffordanceKey;
75pub use arg_id::ArgumentId;
76pub use critical_moves::{cq_to_beat, critical_question_beats};
77pub use error::Error;
78pub use knowledge::{ArgumentKnowledge, ArgumentPosition, StaticKnowledge};
79pub use resolver::{ArgumentOutcome, resolve_argument};
80pub use scoring::SchemeActionScorer;
81pub use state::EncounterArgumentationState;
82pub use state_acceptance::StateAcceptanceEval;
83pub use state_scorer::StateActionScorer;
84pub use value_argument::scheme_value_argument;
85
86/// Numeric rank for a scheme strength (higher = stronger).
87pub(crate) fn strength_rank(strength: argumentation_schemes::types::SchemeStrength) -> u8 {
88 use argumentation_schemes::types::SchemeStrength;
89 match strength {
90 SchemeStrength::Strong => 2,
91 SchemeStrength::Moderate => 1,
92 SchemeStrength::Weak => 0,
93 }
94}