Skip to content

Instantly share code, notes, and snippets.

@strangeglyph
Last active October 27, 2015 15:09
Show Gist options
  • Save strangeglyph/a68bb4c5a41b2fee1a8c to your computer and use it in GitHub Desktop.
Save strangeglyph/a68bb4c5a41b2fee1a8c to your computer and use it in GitHub Desktop.
pub trait Formula {
type C: Clause;
fn get_unit(&self) -> Option<&Self::C>;
fn force_assignment(&mut self, lit: Literal, reason: &Self::C);
}
fn unit<F: Formula>(f: &mut F) -> bool {
let unit_clause = match f.get_unit() {
Some(x) => x,
None => return false
};
f.force_assignment(unit_clause.unit_lit().unwrap(), unit_clause);
true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment