pub enum LogicExpr<'a> {
Show 33 variants
Predicate {
name: Symbol,
args: &'a [Term<'a>],
world: Option<Symbol>,
},
Identity {
left: &'a Term<'a>,
right: &'a Term<'a>,
},
Metaphor {
tenor: &'a Term<'a>,
vehicle: &'a Term<'a>,
},
Quantifier {
kind: QuantifierKind,
variable: Symbol,
body: &'a LogicExpr<'a>,
island_id: u32,
},
Categorical(Box<CategoricalData<'a>>),
Relation(Box<RelationData<'a>>),
Modal {
vector: ModalVector,
operand: &'a LogicExpr<'a>,
},
Temporal {
operator: TemporalOperator,
body: &'a LogicExpr<'a>,
},
Aspectual {
operator: AspectOperator,
body: &'a LogicExpr<'a>,
},
Voice {
operator: VoiceOperator,
body: &'a LogicExpr<'a>,
},
BinaryOp {
left: &'a LogicExpr<'a>,
op: TokenType,
right: &'a LogicExpr<'a>,
},
UnaryOp {
op: TokenType,
operand: &'a LogicExpr<'a>,
},
Question {
wh_variable: Symbol,
body: &'a LogicExpr<'a>,
},
YesNoQuestion {
body: &'a LogicExpr<'a>,
},
Atom(Symbol),
Lambda {
variable: Symbol,
body: &'a LogicExpr<'a>,
},
App {
function: &'a LogicExpr<'a>,
argument: &'a LogicExpr<'a>,
},
Intensional {
operator: Symbol,
content: &'a LogicExpr<'a>,
},
Event {
predicate: &'a LogicExpr<'a>,
adverbs: &'a [Symbol],
},
NeoEvent(Box<NeoEventData<'a>>),
Imperative {
action: &'a LogicExpr<'a>,
},
SpeechAct {
performer: Symbol,
act_type: Symbol,
content: &'a LogicExpr<'a>,
},
Counterfactual {
antecedent: &'a LogicExpr<'a>,
consequent: &'a LogicExpr<'a>,
},
Causal {
effect: &'a LogicExpr<'a>,
cause: &'a LogicExpr<'a>,
},
Comparative {
adjective: Symbol,
subject: &'a Term<'a>,
object: &'a Term<'a>,
difference: Option<&'a Term<'a>>,
},
Superlative {
adjective: Symbol,
subject: &'a Term<'a>,
domain: Symbol,
},
Scopal {
operator: Symbol,
body: &'a LogicExpr<'a>,
},
Control {
verb: Symbol,
subject: &'a Term<'a>,
object: Option<&'a Term<'a>>,
infinitive: &'a LogicExpr<'a>,
},
Presupposition {
assertion: &'a LogicExpr<'a>,
presupposition: &'a LogicExpr<'a>,
},
Focus {
kind: FocusKind,
focused: &'a Term<'a>,
scope: &'a LogicExpr<'a>,
},
TemporalAnchor {
anchor: Symbol,
body: &'a LogicExpr<'a>,
},
Distributive {
predicate: &'a LogicExpr<'a>,
},
GroupQuantifier {
group_var: Symbol,
count: u32,
member_var: Symbol,
restriction: &'a LogicExpr<'a>,
body: &'a LogicExpr<'a>,
},
}Expand description
First-order logic expression with modal, temporal, and event extensions.
This is the core AST type representing logical formulas. All nodes are
arena-allocated with the 'a lifetime tracking the arena’s scope.
§Categories
- Core FOL:
Predicate,Quantifier,BinaryOp,UnaryOp,Identity - Lambda calculus:
Lambda,App,Atom - Modal logic:
Modal,Intensional - Temporal/Aspect:
Temporal,Aspectual,Voice - Event semantics:
Event,NeoEvent - Questions:
Question,YesNoQuestion - Pragmatics:
SpeechAct,Focus,Presupposition - Comparison:
Comparative,Superlative - Other:
Counterfactual,Causal,Control,Imperative
Variants§
Predicate
Atomic predicate: P(t1, t2, ...) with optional world parameter.
Fields
Identity
Identity statement: t1 = t2.
Metaphor
Metaphorical assertion: tenor “is” vehicle (non-literal identity).
Quantifier
Quantified formula: ∀x.φ or ∃x.φ with scope island tracking.
Fields
kind: QuantifierKindCategorical(Box<CategoricalData<'a>>)
Aristotelian categorical proposition (boxed to keep enum small).
Relation(Box<RelationData<'a>>)
Simple S-V-O relation (boxed).
Modal
Modal operator: □φ (necessity) or ◇φ (possibility).
Temporal
Tense operator: PAST(φ) or FUTURE(φ).
Aspectual
Aspect operator: PROG(φ), PERF(φ), HAB(φ), ITER(φ).
Voice
Voice operator: PASSIVE(φ).
BinaryOp
Binary connective: φ ∧ ψ, φ ∨ ψ, φ → ψ, φ ↔ ψ.
UnaryOp
Unary operator: ¬φ.
Question
Wh-question: λx.φ where x is the questioned variable.
YesNoQuestion
Yes/no question: ?φ (is φ true?).
Atom(Symbol)
Atomic symbol (variable or constant in lambda context).
Lambda
Lambda abstraction: λx.φ.
App
Function application: (φ)(ψ).
Intensional
Intensional context: operator[content] for opaque verbs (believes, seeks).
Event
Legacy event semantics (Davidson-style with adverb list).
NeoEvent(Box<NeoEventData<'a>>)
Neo-Davidsonian event with thematic roles (boxed).
Imperative
Imperative command: !φ.
SpeechAct
Speech act: performative utterance with illocutionary force.
Counterfactual
Counterfactual conditional: “If P had been, Q would have been”.
Causal
Causal relation: “effect because cause”.
Comparative
Comparative: “X is taller than Y (by 2 inches)”.
Fields
Superlative
Superlative: “X is the tallest among domain”.
Scopal
Scopal adverb: “only”, “always”, etc. as operators.
Control
Control verb: “wants to VP”, “persuaded X to VP”.
Fields
Presupposition
Presupposition-assertion structure.
Focus
Focus particle: “only X”, “even X” with alternative set.
TemporalAnchor
Temporal anchor: “yesterday(φ)”, “now(φ)”.
Distributive
Distributive operator: *P distributes P over group members.
GroupQuantifier
Group quantifier for collective cardinal readings.
∃g(Group(g) ∧ Count(g,n) ∧ ∀x(Member(x,g) → Restriction(x)) ∧ Body(g))
Implementations§
Source§impl<'a> LogicExpr<'a>
impl<'a> LogicExpr<'a>
Sourcepub fn transpile_discourse(
&self,
registry: &mut SymbolRegistry,
interner: &Interner,
format: OutputFormat,
) -> String
pub fn transpile_discourse( &self, registry: &mut SymbolRegistry, interner: &Interner, format: OutputFormat, ) -> String
Transpile a discourse (multiple sentences) as numbered formulas. If the expression is a top-level conjunction of sentences, formats as:
1) formula1
2) formula2
3) formula3If it’s a single sentence, just returns the formula without numbering.
pub fn write_logic<W: Write, F: LogicFormatter>( &self, w: &mut W, registry: &mut SymbolRegistry, interner: &Interner, fmt: &F, ) -> Result
Sourcepub fn transpile_with<F: LogicFormatter>(
&self,
registry: &mut SymbolRegistry,
interner: &Interner,
fmt: &F,
) -> String
pub fn transpile_with<F: LogicFormatter>( &self, registry: &mut SymbolRegistry, interner: &Interner, fmt: &F, ) -> String
Transpiles to a logic formula string using a custom formatter.
Sourcepub fn transpile(
&self,
registry: &mut SymbolRegistry,
interner: &Interner,
format: OutputFormat,
) -> String
pub fn transpile( &self, registry: &mut SymbolRegistry, interner: &Interner, format: OutputFormat, ) -> String
Transpiles to a logic formula string in the specified output format.
§Formats
OutputFormat::Unicode: ∀x(Cat(x) → Sleeps(x))OutputFormat::LaTeX:\forall x(Cat(x) \to Sleeps(x))OutputFormat::SimpleFOL: Ax(Cat(x) -> Sleeps(x))OutputFormat::Kripke: □(P) @w0
Sourcepub fn transpile_ctx<F: LogicFormatter>(
&self,
ctx: &mut TranspileContext<'_>,
fmt: &F,
) -> String
pub fn transpile_ctx<F: LogicFormatter>( &self, ctx: &mut TranspileContext<'_>, fmt: &F, ) -> String
Transpiles using a TranspileContext and custom formatter.
Sourcepub fn transpile_ctx_unicode(&self, ctx: &mut TranspileContext<'_>) -> String
pub fn transpile_ctx_unicode(&self, ctx: &mut TranspileContext<'_>) -> String
Transpiles to Unicode format using a TranspileContext.
Sourcepub fn transpile_ctx_latex(&self, ctx: &mut TranspileContext<'_>) -> String
pub fn transpile_ctx_latex(&self, ctx: &mut TranspileContext<'_>) -> String
Transpiles to LaTeX format using a TranspileContext.