#![doc = include_str!("../README.md")]
#![no_std]
#![forbid(unsafe_code)]
extern crate alloc;
pub use polyzonotope;
mod dynamics;
mod linear;
mod nonlinear;
mod taylor;
pub use dynamics::{Dynamics, IntervalTensor, Polynomial};
pub use linear::{LinearReach, LinearSystem, Step};
pub use nonlinear::{Adaptive, Method, NonlinearReach, NonlinearSettings, Restructure, Splitting};
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum ReachError {
InvalidStep,
StepTooLarge,
AbstractionDiverged,
MissingDerivatives,
}
impl core::fmt::Display for ReachError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_str(match self {
Self::InvalidStep => "time step must be finite and non-negative",
Self::StepTooLarge => "time step too large for the Taylor remainder bound",
Self::AbstractionDiverged => "abstraction error of the step did not converge",
Self::MissingDerivatives => "polynomialization needs third derivatives of the dynamics",
})
}
}
impl core::error::Error for ReachError {}
#[derive(Clone, Debug, PartialEq)]
pub struct ReachFailure {
pub proven: alloc::vec::Vec<alloc::vec::Vec<Step>>,
pub error: ReachError,
}
impl core::fmt::Display for ReachFailure {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{} after {} proven steps", self.error, self.proven.len())
}
}
impl core::error::Error for ReachFailure {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
Some(&self.error)
}
}