Skip to content

Commit

Permalink
Move impl TryFrom<GeneralTerm> for Variable to the syntax tree
Browse files Browse the repository at this point in the history
  • Loading branch information
teiesti authored and ZachJHansen committed Aug 23, 2024
1 parent 5a7b863 commit 39c51e1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
22 changes: 22 additions & 0 deletions src/syntax_tree/fol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,28 @@ pub struct Variable {

impl_node!(Variable, Format, VariableParser);

impl TryFrom<GeneralTerm> for Variable {
type Error = GeneralTerm;

fn try_from(term: GeneralTerm) -> std::result::Result<Self, Self::Error> {
match term {
GeneralTerm::Variable(v) => Ok(Variable {
name: v,
sort: Sort::General,
}),
GeneralTerm::IntegerTerm(IntegerTerm::Variable(v)) => Ok(Variable {
name: v,
sort: Sort::Integer,
}),
GeneralTerm::SymbolicTerm(SymbolicTerm::Variable(v)) => Ok(Variable {
name: v,
sort: Sort::Symbol,
}),
x => Err(x),
}
}
}

#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub enum BinaryConnective {
Conjunction,
Expand Down
22 changes: 0 additions & 22 deletions src/verifying/outline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,6 @@ use {
thiserror::Error,
};

impl TryFrom<fol::GeneralTerm> for fol::Variable {
type Error = fol::GeneralTerm;

fn try_from(term: fol::GeneralTerm) -> std::result::Result<Self, Self::Error> {
match term {
fol::GeneralTerm::Variable(v) => Ok(fol::Variable {
name: v,
sort: fol::Sort::General,
}),
fol::GeneralTerm::IntegerTerm(fol::IntegerTerm::Variable(v)) => Ok(fol::Variable {
name: v,
sort: fol::Sort::Integer,
}),
fol::GeneralTerm::SymbolicTerm(fol::SymbolicTerm::Variable(v)) => Ok(fol::Variable {
name: v,
sort: fol::Sort::Symbol,
}),
x => Err(x),
}
}
}

// If all the conjectures are proven,
// then all consequences can be added as axioms to the next proof step
// A basic lemma F has conjectures [F] and consequences [F]
Expand Down

0 comments on commit 39c51e1

Please sign in to comment.