use std::fmt::Debug;
use midnight_zk_stdlib::MidnightVK;
use super::AggregableRelation;
use crate::ivc::F;
#[derive(Clone, Debug)]
pub struct Claim {
pub vk: MidnightVK,
pub statement: Box<dyn Statement>,
}
pub trait Statement: Debug {
fn format_instance(&self) -> F;
fn clone_boxed(&self) -> Box<dyn Statement>;
}
impl Clone for Box<dyn Statement> {
fn clone(&self) -> Self {
self.clone_boxed()
}
}
#[derive(Debug, Clone)]
pub struct TypedStatement<R: AggregableRelation>(pub R::Instance);
impl<R: AggregableRelation> TypedStatement<R> {
pub fn new(instance: R::Instance) -> Self {
Self(instance)
}
}
impl<R> Statement for TypedStatement<R>
where
R: AggregableRelation + Debug + 'static,
R::Instance: Debug + Clone,
{
fn format_instance(&self) -> F {
R::format_statement(&self.0)
}
fn clone_boxed(&self) -> Box<dyn Statement> {
Box::new(self.clone())
}
}