Skip to main content

FormatConverter

Struct FormatConverter 

Source
pub struct FormatConverter { /* private fields */ }
Expand description

Converter for proof formats.

This is a placeholder for future conversion implementations. Currently supports basic error types and scaffolding.

Implementations§

Source§

impl FormatConverter

Source

pub fn new() -> Self

Create a new format converter.

Source

pub fn strict_mode(self, strict: bool) -> Self

Enable strict mode (fail on information loss).

Source

pub fn add_comments(self, add: bool) -> Self

Enable/disable comment generation.

Source

pub fn drat_to_alethe(&self, drat: &DratProof) -> ConversionResult<AletheProof>

Convert DRAT proof to Alethe proof.

This conversion maps:

  • DRAT Add steps to Alethe Input steps (for clauses from the problem)
  • Subsequent Add steps to Resolution steps
  • Delete steps are skipped (Alethe is monotonic)

Note: This is a best-effort conversion. DRAT proofs are untyped and don’t contain all the information needed for a complete Alethe proof.

§Examples
use oxiz_proof::conversion::{FormatConverter};
use oxiz_proof::drat::DratProof;

let converter = FormatConverter::new();
let mut drat = DratProof::new();

// Add some clauses
drat.add_clause(vec![1, 2, -3]);
drat.add_clause(vec![-1, 4]);

// Convert to Alethe
let alethe = converter.drat_to_alethe(&drat).unwrap();
assert_eq!(alethe.len(), 2);
Source

pub fn alethe_to_lfsc( &self, alethe: &AletheProof, ) -> ConversionResult<LfscProof>

Convert Alethe proof to LFSC proof.

This conversion maps:

  • Alethe Assume steps to LFSC variable declarations
  • Alethe Step steps to LFSC proof term applications
  • Alethe rules to corresponding LFSC proof rules
§Examples
use oxiz_proof::conversion::FormatConverter;
use oxiz_proof::alethe::{AletheProof, AletheRule};

let converter = FormatConverter::new();
let mut alethe = AletheProof::new();

// Add assumptions and a resolution step
let a1 = alethe.assume("(or p q)");
let a2 = alethe.assume("(not p)");
alethe.resolution(vec!["q".to_string()], vec![a1, a2]);

// Convert to LFSC
let lfsc = converter.alethe_to_lfsc(&alethe).unwrap();
assert!(!lfsc.is_empty());

Trait Implementations§

Source§

impl Default for FormatConverter

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.