#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use super::{GenericControl, Id, Model, Options, Statistics, Symbol};
use crate::{ast, ControlCtx};
use std::fmt;
pub trait Theory<'a> {
fn register<C>(&mut self, ctl: &mut GenericControl<C>) -> bool
where
C: ControlCtx;
fn rewrite_statement(
&mut self,
stm: &ast::Statement,
builder: &mut ast::ProgramBuilder,
) -> bool;
fn prepare<C>(&mut self, ctl: &mut GenericControl<C>) -> bool
where
C: ControlCtx;
fn register_options(&mut self, options: &mut Options) -> bool;
fn validate_options(&mut self) -> bool;
fn on_model(&mut self, model: &mut Model) -> bool;
fn on_statistics(&mut self, step: &mut Statistics, akku: &mut Statistics) -> bool;
fn lookup_symbol(&mut self, symbol: Symbol, index: &mut usize) -> bool;
fn get_symbol(&mut self, index: usize) -> Symbol;
fn assignment(&'a self, thread_id: Id) -> Box<dyn Iterator<Item = (Symbol, TheoryValue)> + 'a>;
fn configure(&mut self, key: &str, value: &str) -> bool;
}
#[derive(Copy, Clone, Debug)]
pub enum TheoryValue {
IntNumber(u64),
DoubleNumber(f64),
Symbol(Symbol),
}
impl fmt::Display for TheoryValue {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
TheoryValue::IntNumber(int) => u64::fmt(int, f),
TheoryValue::DoubleNumber(double) => f64::fmt(double, f),
TheoryValue::Symbol(sym) => Symbol::fmt(sym, f),
}
}
}