2020-02-02 19:20:16 +01:00
|
|
|
use structopt::StructOpt as _;
|
|
|
|
|
|
|
|
#[derive(Debug, structopt::StructOpt)]
|
|
|
|
#[structopt(name = "anthem", about = "Use first-order theorem provers with answer set programs.")]
|
2020-02-03 22:20:13 +01:00
|
|
|
enum Command
|
2020-02-02 19:20:16 +01:00
|
|
|
{
|
2020-02-03 22:20:13 +01:00
|
|
|
#[structopt(about = "Verifies a logic program against a specification")]
|
2020-05-05 19:40:57 +02:00
|
|
|
#[structopt(aliases = &["vprog"])]
|
2020-02-03 22:20:13 +01:00
|
|
|
VerifyProgram
|
|
|
|
{
|
2020-05-05 19:40:57 +02:00
|
|
|
/// ASP input program file path
|
|
|
|
#[structopt(name = "program", parse(from_os_str), required(true))]
|
|
|
|
program_path: std::path::PathBuf,
|
|
|
|
|
|
|
|
#[structopt(name = "specification", parse(from_os_str), required(true))]
|
|
|
|
/// Specification file path
|
|
|
|
specification_path: std::path::PathBuf,
|
2020-02-03 22:51:19 +01:00
|
|
|
|
2020-05-07 02:53:48 +02:00
|
|
|
/// Proof direction (forward, backward, both)
|
|
|
|
#[structopt(long, default_value = "forward")]
|
2020-05-11 03:46:11 +02:00
|
|
|
proof_direction: anthem::problem::ProofDirection,
|
2020-05-22 18:14:56 +02:00
|
|
|
|
|
|
|
/// Do not simplify translated program
|
|
|
|
#[structopt(long)]
|
|
|
|
no_simplify: bool,
|
2020-05-22 19:33:06 +02:00
|
|
|
|
|
|
|
/// Whether to use colors in the output (auto, always, never)
|
|
|
|
#[structopt(name = "color", long, default_value = "auto")]
|
|
|
|
color_choice: anthem::output::ColorChoice,
|
2020-02-03 22:20:13 +01:00
|
|
|
}
|
2020-02-02 19:20:16 +01:00
|
|
|
}
|
|
|
|
|
2020-02-01 17:13:43 +01:00
|
|
|
fn main()
|
2020-01-24 13:32:43 +01:00
|
|
|
{
|
2020-05-06 00:13:43 +02:00
|
|
|
pretty_env_logger::init_custom_env("ANTHEM_LOG");
|
2020-01-31 17:19:44 +01:00
|
|
|
|
2020-02-03 22:20:13 +01:00
|
|
|
let command = Command::from_args();
|
2020-02-01 19:20:46 +01:00
|
|
|
|
2020-02-03 22:20:13 +01:00
|
|
|
match command
|
2020-02-02 17:57:27 +01:00
|
|
|
{
|
2020-02-03 22:51:19 +01:00
|
|
|
Command::VerifyProgram
|
|
|
|
{
|
2020-05-05 19:40:57 +02:00
|
|
|
program_path,
|
|
|
|
specification_path,
|
2020-05-07 02:53:48 +02:00
|
|
|
proof_direction,
|
2020-05-22 18:14:56 +02:00
|
|
|
no_simplify,
|
2020-05-22 19:33:06 +02:00
|
|
|
color_choice,
|
2020-02-03 22:51:19 +01:00
|
|
|
}
|
2020-05-06 00:13:43 +02:00
|
|
|
=> anthem::commands::verify_program::run(&program_path, &specification_path,
|
2020-05-22 19:33:06 +02:00
|
|
|
proof_direction, no_simplify, color_choice),
|
2020-02-02 17:57:27 +01:00
|
|
|
}
|
2020-01-24 13:32:43 +01:00
|
|
|
}
|