use crate::proof::ProofNodeId;
use oxiz_core::TermId;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct TheoryId(pub u32);
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CombinationStep {
pub theory: TheoryId,
pub propagated_equalities: Vec<(TermId, TermId)>,
pub justification: Vec<ProofNodeId>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct NelsonOppenCertificate {
pub steps: Vec<CombinationStep>,
pub concluding_theory: TheoryId,
pub contradiction: ProofNodeId,
}
impl NelsonOppenCertificate {
#[must_use]
pub fn new(concluding_theory: TheoryId, contradiction: ProofNodeId) -> Self {
Self {
steps: Vec::new(),
concluding_theory,
contradiction,
}
}
pub fn add_step(&mut self, step: CombinationStep) {
self.steps.push(step);
}
#[must_use]
pub fn verify(&self) -> bool {
let Some(last) = self.steps.last() else {
return false;
};
last.theory == self.concluding_theory
&& (!last.propagated_equalities.is_empty() || !last.justification.is_empty())
}
}