anthem-rs/src/translate/verify_properties.rs

33 lines
725 B
Rust
Raw Normal View History

mod context;
mod head_type;
mod translate_body;
pub use context::Context;
2020-02-01 15:32:41 +01:00
use head_type::*;
use translate_body::*;
2020-01-25 12:55:23 +01:00
2020-02-01 15:32:41 +01:00
pub fn read(rule: &clingo::ast::Rule, context: &mut Context) -> Result<(), crate::Error>
{
2020-02-01 17:13:43 +01:00
let translated_body = translate_body(rule.body(), context)?;
2020-02-01 15:32:41 +01:00
2020-02-01 17:13:43 +01:00
let head_type = determine_head_type(rule.head(),
2020-02-01 15:32:41 +01:00
|name, arity| context.find_or_create_predicate_declaration(name, arity))?;
2020-02-01 17:13:43 +01:00
match head_type
2020-02-01 15:32:41 +01:00
{
HeadType::ChoiceWithSingleAtom(test) =>
2020-02-01 17:13:43 +01:00
log::debug!("translating choice rule with single atom"),
HeadType::IntegrityConstraint =>
2020-02-01 17:13:43 +01:00
log::debug!("translating integrity constraint"),
HeadType::Trivial =>
2020-02-01 17:13:43 +01:00
{
log::debug!("skipping trivial rule");
return Ok(());
},
2020-02-01 15:32:41 +01:00
_ => (),
}
Ok(())
2020-01-24 13:32:43 +01:00
}