#![allow(clippy::items_after_test_module)]
use oxilean_kernel::{BinderInfo, Declaration, Environment, Expr, Level, Name};
use std::collections::{HashMap, HashSet, VecDeque};
use super::types::{
BddNode, BuchiAutomaton, CtlChecker, CtlFormula, FairnessConstraint, LtlFormula, MuFormula,
ParityGame, StreettAutomaton, TransitionSystem,
};
pub fn app(f: Expr, a: Expr) -> Expr {
Expr::App(Box::new(f), Box::new(a))
}
pub fn app2(f: Expr, a: Expr, b: Expr) -> Expr {
app(app(f, a), b)
}
pub fn app3(f: Expr, a: Expr, b: Expr, c: Expr) -> Expr {
app(app2(f, a, b), c)
}
pub fn cst(s: &str) -> Expr {
Expr::Const(Name::str(s), vec![])
}
pub fn prop() -> Expr {
Expr::Sort(Level::zero())
}
pub fn type0() -> Expr {
Expr::Sort(Level::succ(Level::zero()))
}
pub fn pi(bi: BinderInfo, name: &str, dom: Expr, body: Expr) -> Expr {
Expr::Pi(bi, Name::str(name), Box::new(dom), Box::new(body))
}
pub fn arrow(a: Expr, b: Expr) -> Expr {
pi(BinderInfo::Default, "_", a, b)
}
pub fn bvar(n: u32) -> Expr {
Expr::BVar(n)
}
pub fn nat_ty() -> Expr {
cst("Nat")
}
pub fn bool_ty() -> Expr {
cst("Bool")
}
pub fn transition_system_ty() -> Expr {
type0()
}
pub fn state_ty() -> Expr {
type0()
}
pub fn transition_relation_ty() -> Expr {
arrow(cst("State"), arrow(cst("State"), prop()))
}
pub fn labeling_ty() -> Expr {
arrow(cst("State"), arrow(nat_ty(), bool_ty()))
}
pub fn path_ty() -> Expr {
arrow(nat_ty(), cst("State"))
}
pub fn fair_path_ty() -> Expr {
arrow(cst("FairnessConstraint"), arrow(path_ty(), prop()))
}
pub fn ltl_formula_ty() -> Expr {
type0()
}
pub fn ltl_next_ty() -> Expr {
arrow(cst("LtlFormula"), cst("LtlFormula"))
}
pub fn ltl_finally_ty() -> Expr {
arrow(cst("LtlFormula"), cst("LtlFormula"))
}
pub fn ltl_globally_ty() -> Expr {
arrow(cst("LtlFormula"), cst("LtlFormula"))
}
pub fn ltl_until_ty() -> Expr {
arrow(
cst("LtlFormula"),
arrow(cst("LtlFormula"), cst("LtlFormula")),
)
}
pub fn ltl_release_ty() -> Expr {
arrow(
cst("LtlFormula"),
arrow(cst("LtlFormula"), cst("LtlFormula")),
)
}
pub fn ltl_weak_until_ty() -> Expr {
arrow(
cst("LtlFormula"),
arrow(cst("LtlFormula"), cst("LtlFormula")),
)
}
pub fn ltl_sat_ty() -> Expr {
arrow(path_ty(), arrow(nat_ty(), arrow(cst("LtlFormula"), prop())))
}
pub fn ltl_model_sat_ty() -> Expr {
arrow(cst("TransitionSystem"), arrow(cst("LtlFormula"), prop()))
}
pub fn ctl_formula_ty() -> Expr {
type0()
}
pub fn ctl_ex_ty() -> Expr {
arrow(cst("CtlFormula"), cst("CtlFormula"))
}
pub fn ctl_ef_ty() -> Expr {
arrow(cst("CtlFormula"), cst("CtlFormula"))
}
pub fn ctl_eg_ty() -> Expr {
arrow(cst("CtlFormula"), cst("CtlFormula"))
}
pub fn ctl_ax_ty() -> Expr {
arrow(cst("CtlFormula"), cst("CtlFormula"))
}
pub fn ctl_af_ty() -> Expr {
arrow(cst("CtlFormula"), cst("CtlFormula"))
}
pub fn ctl_ag_ty() -> Expr {
arrow(cst("CtlFormula"), cst("CtlFormula"))
}
pub fn ctl_eu_ty() -> Expr {
arrow(
cst("CtlFormula"),
arrow(cst("CtlFormula"), cst("CtlFormula")),
)
}
pub fn ctl_au_ty() -> Expr {
arrow(
cst("CtlFormula"),
arrow(cst("CtlFormula"), cst("CtlFormula")),
)
}
pub fn ctl_sat_ty() -> Expr {
arrow(
cst("TransitionSystem"),
arrow(cst("State"), arrow(cst("CtlFormula"), prop())),
)
}
pub fn ctl_star_formula_ty() -> Expr {
type0()
}
pub fn ctl_star_path_ty() -> Expr {
type0()
}
pub fn ctl_star_sat_ty() -> Expr {
arrow(
cst("TransitionSystem"),
arrow(cst("CtlStarFormula"), prop()),
)
}
pub fn buchi_automaton_ty() -> Expr {
type0()
}
pub fn buchi_run_ty() -> Expr {
arrow(nat_ty(), cst("State"))
}
pub fn buchi_accepting_ty() -> Expr {
arrow(cst("BuchiAutomaton"), arrow(buchi_run_ty(), prop()))
}
pub fn buchi_language_ty() -> Expr {
arrow(cst("BuchiAutomaton"), arrow(path_ty(), prop()))
}
pub fn generalized_buchi_ty() -> Expr {
type0()
}
pub fn rabin_automaton_ty() -> Expr {
type0()
}
pub fn ctl_model_checker_ty() -> Expr {
arrow(
cst("TransitionSystem"),
arrow(cst("CtlFormula"), arrow(cst("State"), bool_ty())),
)
}
pub fn ltl_model_checker_ty() -> Expr {
arrow(cst("TransitionSystem"), arrow(cst("LtlFormula"), bool_ty()))
}
pub fn counterexample_ty() -> Expr {
type0()
}
pub fn pre_image_ty() -> Expr {
arrow(
cst("TransitionSystem"),
arrow(
arrow(cst("State"), bool_ty()),
arrow(cst("State"), bool_ty()),
),
)
}
pub fn post_image_ty() -> Expr {
arrow(
cst("TransitionSystem"),
arrow(
arrow(cst("State"), bool_ty()),
arrow(cst("State"), bool_ty()),
),
)
}
pub fn bdd_ty() -> Expr {
type0()
}
pub fn bdd_manager_ty() -> Expr {
type0()
}
pub fn symbolic_relation_ty() -> Expr {
arrow(cst("BDDManager"), cst("BDD"))
}
pub fn symbolic_reach_ty() -> Expr {
arrow(cst("TransitionSystem"), cst("BDD"))
}
pub fn mu_formula_ty() -> Expr {
type0()
}
pub fn least_fixpoint_ty() -> Expr {
arrow(arrow(cst("MuFormula"), cst("MuFormula")), cst("MuFormula"))
}
pub fn greatest_fixpoint_ty() -> Expr {
arrow(arrow(cst("MuFormula"), cst("MuFormula")), cst("MuFormula"))
}
pub fn mu_sat_ty() -> Expr {
arrow(
cst("TransitionSystem"),
arrow(cst("State"), arrow(cst("MuFormula"), prop())),
)
}
pub fn alternation_depth_ty() -> Expr {
arrow(cst("MuFormula"), nat_ty())
}
pub fn af_mu_calculus_ty() -> Expr {
arrow(cst("MuFormula"), prop())
}
pub fn fairness_constraint_ty() -> Expr {
type0()
}
pub fn strong_fairness_ty() -> Expr {
arrow(cst("FairnessConstraint"), prop())
}
pub fn weak_fairness_ty() -> Expr {
arrow(cst("FairnessConstraint"), prop())
}
pub fn fair_ctl_sat_ty() -> Expr {
arrow(
cst("TransitionSystem"),
arrow(cst("FairnessConstraint"), arrow(cst("CtlFormula"), prop())),
)
}
pub fn parity_game_ty() -> Expr {
type0()
}
pub fn parity_condition_ty() -> Expr {
arrow(cst("State"), nat_ty())
}
pub fn player0_wins_ty() -> Expr {
arrow(cst("ParityGame"), arrow(cst("State"), prop()))
}
pub fn positional_determinacy_ty() -> Expr {
prop()
}
pub fn strategy_ty() -> Expr {
arrow(cst("State"), cst("State"))
}
pub fn winning_strategy_ty() -> Expr {
arrow(cst("ParityGame"), arrow(strategy_ty(), prop()))
}
pub fn concurrent_game_ty() -> Expr {
type0()
}
pub fn atl_formula_ty() -> Expr {
type0()
}
pub fn atl_coop_x_ty() -> Expr {
arrow(
cst("AgentCoalition"),
arrow(cst("AtlFormula"), cst("AtlFormula")),
)
}
pub fn atl_coop_f_ty() -> Expr {
arrow(
cst("AgentCoalition"),
arrow(cst("AtlFormula"), cst("AtlFormula")),
)
}
pub fn atl_coop_g_ty() -> Expr {
arrow(
cst("AgentCoalition"),
arrow(cst("AtlFormula"), cst("AtlFormula")),
)
}
pub fn atl_coop_u_ty() -> Expr {
arrow(
cst("AgentCoalition"),
arrow(
cst("AtlFormula"),
arrow(cst("AtlFormula"), cst("AtlFormula")),
),
)
}
pub fn atl_sat_ty() -> Expr {
arrow(
cst("ConcurrentGameStructure"),
arrow(cst("State"), arrow(cst("AtlFormula"), prop())),
)
}
pub fn safety_property_ty() -> Expr {
arrow(arrow(path_ty(), prop()), prop())
}
pub fn liveness_property_ty() -> Expr {
arrow(arrow(path_ty(), prop()), prop())
}
pub fn buchi_safety_ty() -> Expr {
arrow(cst("BuchiAutomaton"), prop())
}
pub fn buchi_liveness_ty() -> Expr {
arrow(cst("BuchiAutomaton"), prop())
}
pub fn fairness_liveness_ty() -> Expr {
arrow(cst("FairnessConstraint"), arrow(cst("LtlFormula"), prop()))
}
pub fn build_temporal_logic_env(env: &mut Environment) {
let axioms: &[(&str, Expr)] = &[
("TransitionSystem", transition_system_ty()),
("State", state_ty()),
("TransitionRelation", transition_relation_ty()),
("Labeling", labeling_ty()),
("Path", path_ty()),
("FairnessConstraint", fairness_constraint_ty()),
("FairPath", fair_path_ty()),
("LtlFormula", ltl_formula_ty()),
("LtlNext", ltl_next_ty()),
("LtlFinally", ltl_finally_ty()),
("LtlGlobally", ltl_globally_ty()),
("LtlUntil", ltl_until_ty()),
("LtlRelease", ltl_release_ty()),
("LtlWeakUntil", ltl_weak_until_ty()),
("LtlSat", ltl_sat_ty()),
("LtlModelSat", ltl_model_sat_ty()),
("CtlFormula", ctl_formula_ty()),
("CtlEX", ctl_ex_ty()),
("CtlEF", ctl_ef_ty()),
("CtlEG", ctl_eg_ty()),
("CtlAX", ctl_ax_ty()),
("CtlAF", ctl_af_ty()),
("CtlAG", ctl_ag_ty()),
("CtlEU", ctl_eu_ty()),
("CtlAU", ctl_au_ty()),
("CtlSat", ctl_sat_ty()),
("CtlStarFormula", ctl_star_formula_ty()),
("CtlStarPath", ctl_star_path_ty()),
("CtlStarSat", ctl_star_sat_ty()),
("BuchiAutomaton", buchi_automaton_ty()),
("BuchiRun", buchi_run_ty()),
("BuchiAccepting", buchi_accepting_ty()),
("BuchiLanguage", buchi_language_ty()),
("GeneralizedBuchi", generalized_buchi_ty()),
("RabinAutomaton", rabin_automaton_ty()),
("CtlModelChecker", ctl_model_checker_ty()),
("LtlModelChecker", ltl_model_checker_ty()),
("Counterexample", counterexample_ty()),
("PreImage", pre_image_ty()),
("PostImage", post_image_ty()),
("BDD", bdd_ty()),
("BDDManager", bdd_manager_ty()),
("SymbolicRelation", symbolic_relation_ty()),
("SymbolicReach", symbolic_reach_ty()),
("MuFormula", mu_formula_ty()),
("LeastFixpoint", least_fixpoint_ty()),
("GreatestFixpoint", greatest_fixpoint_ty()),
("MuSat", mu_sat_ty()),
("AlternationDepth", alternation_depth_ty()),
("AfMuCalculus", af_mu_calculus_ty()),
("StrongFairness", strong_fairness_ty()),
("WeakFairness", weak_fairness_ty()),
("FairCtlSat", fair_ctl_sat_ty()),
("ParityGame", parity_game_ty()),
("ParityCondition", parity_condition_ty()),
("Player0Wins", player0_wins_ty()),
("PositionalDeterminacy", positional_determinacy_ty()),
("Strategy", strategy_ty()),
("WinningStrategy", winning_strategy_ty()),
("ConcurrentGameStructure", concurrent_game_ty()),
("AtlFormula", atl_formula_ty()),
("AgentCoalition", type0()),
("AtlCoopX", atl_coop_x_ty()),
("AtlCoopF", atl_coop_f_ty()),
("AtlCoopG", atl_coop_g_ty()),
("AtlCoopU", atl_coop_u_ty()),
("AtlSat", atl_sat_ty()),
("SafetyProperty", safety_property_ty()),
("LivenessProperty", liveness_property_ty()),
("BuchiSafety", buchi_safety_ty()),
("BuchiLiveness", buchi_liveness_ty()),
("FairnessLiveness", fairness_liveness_ty()),
];
for (name, ty) in axioms {
env.add(Declaration::Axiom {
name: Name::str(*name),
univ_params: vec![],
ty: ty.clone(),
})
.ok();
}
}
pub type AtomId = u32;
pub type BuchiState = u32;
pub type MuVar = String;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_ctl_checker_ef() {
let mut ts = TransitionSystem::new(3);
ts.add_initial(0);
ts.add_transition(0, 1);
ts.add_transition(1, 2);
ts.add_label(2, 0);
let checker = CtlChecker::new(&ts);
let ef_p = CtlFormula::ef(CtlFormula::Atom(0));
let sat = checker.sat(&ef_p);
assert!(sat.contains(&0));
assert!(sat.contains(&1));
assert!(sat.contains(&2));
assert!(checker.check(&ef_p));
}
#[test]
fn test_ctl_checker_ag() {
let mut ts = TransitionSystem::new(2);
ts.add_initial(0);
ts.add_transition(0, 1);
ts.add_transition(1, 0);
ts.add_label(0, 0);
ts.add_label(1, 0);
let checker = CtlChecker::new(&ts);
let ag_p = CtlFormula::ag(CtlFormula::Atom(0));
assert!(checker.check(&ag_p));
}
#[test]
fn test_ctl_checker_au() {
let mut ts = TransitionSystem::new(3);
ts.add_initial(0);
ts.add_transition(0, 1);
ts.add_transition(1, 2);
ts.add_label(0, 0);
ts.add_label(1, 0);
ts.add_label(2, 1);
let checker = CtlChecker::new(&ts);
let au = CtlFormula::AU(Box::new(CtlFormula::Atom(0)), Box::new(CtlFormula::Atom(1)));
assert!(checker.check(&au));
}
#[test]
fn test_ltl_formula_nnf() {
let gp = LtlFormula::globally(LtlFormula::Atom(0));
let neg_gp = LtlFormula::Not(Box::new(gp));
let nnf = neg_gp.nnf();
assert_eq!(
nnf,
LtlFormula::Finally(Box::new(LtlFormula::Not(Box::new(LtlFormula::Atom(0)))))
);
}
#[test]
fn test_transition_system_reachability() {
let mut ts = TransitionSystem::new(4);
ts.add_initial(0);
ts.add_transition(0, 1);
ts.add_transition(1, 2);
let reachable = ts.reachable_states();
assert!(reachable.contains(&0));
assert!(reachable.contains(&1));
assert!(reachable.contains(&2));
assert!(!reachable.contains(&3));
}
#[test]
fn test_mu_formula_alternation_depth() {
let ag_true = MuFormula::ag(MuFormula::True);
assert_eq!(ag_true.alternation_depth(), 0);
let ef_true = MuFormula::ef(MuFormula::True);
assert_eq!(ef_true.alternation_depth(), 0);
}
#[test]
fn test_bdd_eval() {
let bdd = BddNode::Node(
0,
Box::new(BddNode::Zero),
Box::new(BddNode::Node(
1,
Box::new(BddNode::Zero),
Box::new(BddNode::One),
)),
);
let mut assign_tt = HashMap::new();
assign_tt.insert(0u32, true);
assign_tt.insert(1u32, true);
assert!(bdd.eval(&assign_tt));
let mut assign_tf = HashMap::new();
assign_tf.insert(0u32, true);
assign_tf.insert(1u32, false);
assert!(!bdd.eval(&assign_tf));
}
#[test]
fn test_parity_game_solver() {
let mut game = ParityGame::new();
let v0 = game.add_vertex(0, 0);
game.add_edge(v0, v0);
let (w0, w1) = game.solve();
assert!(w0.contains(&v0));
assert!(!w1.contains(&v0));
}
#[test]
fn test_build_temporal_logic_env() {
let mut env = Environment::new();
build_temporal_logic_env(&mut env);
assert!(env.get(&Name::str("LtlFormula")).is_some());
assert!(env.get(&Name::str("CtlFormula")).is_some());
assert!(env.get(&Name::str("BuchiAutomaton")).is_some());
assert!(env.get(&Name::str("MuFormula")).is_some());
assert!(env.get(&Name::str("ParityGame")).is_some());
assert!(env.get(&Name::str("AtlFormula")).is_some());
}
#[test]
fn test_register_temporal_logic_extended() {
let mut env = Environment::new();
build_temporal_logic_env(&mut env);
let result = register_temporal_logic_extended(&mut env);
assert!(result.is_ok());
assert!(env.get(&Name::str("TctlFormula")).is_some());
assert!(env.get(&Name::str("MtlFormula")).is_some());
assert!(env.get(&Name::str("BmcInstance")).is_some());
}
}
pub fn tctl_formula_ty() -> Expr {
type0()
}
pub fn tl_ext_tctl_ef_bounded_ty() -> Expr {
arrow(
nat_ty(),
arrow(nat_ty(), arrow(cst("TctlFormula"), cst("TctlFormula"))),
)
}
pub fn tl_ext_tctl_ag_bounded_ty() -> Expr {
arrow(
nat_ty(),
arrow(nat_ty(), arrow(cst("TctlFormula"), cst("TctlFormula"))),
)
}
pub fn tl_ext_tctl_sat_ty() -> Expr {
arrow(
cst("TimedTransitionSystem"),
arrow(
cst("State"),
arrow(nat_ty(), arrow(cst("TctlFormula"), prop())),
),
)
}
pub fn mtl_formula_ty() -> Expr {
type0()
}
pub fn tl_ext_mtl_until_bounded_ty() -> Expr {
arrow(
cst("MtlFormula"),
arrow(
cst("MtlFormula"),
arrow(nat_ty(), arrow(nat_ty(), cst("MtlFormula"))),
),
)
}
pub fn tl_ext_mtl_finally_bounded_ty() -> Expr {
arrow(
nat_ty(),
arrow(nat_ty(), arrow(cst("MtlFormula"), cst("MtlFormula"))),
)
}
pub fn tl_ext_mtl_globally_bounded_ty() -> Expr {
arrow(
nat_ty(),
arrow(nat_ty(), arrow(cst("MtlFormula"), cst("MtlFormula"))),
)
}
pub fn tl_ext_stl_formula_ty() -> Expr {
type0()
}
pub fn tl_ext_stl_signal_ty() -> Expr {
arrow(nat_ty(), nat_ty())
}
pub fn tl_ext_stl_sat_ty() -> Expr {
arrow(
tl_ext_stl_signal_ty(),
arrow(nat_ty(), arrow(cst("StlFormula"), prop())),
)
}
pub fn tl_ext_stl_robustness_ty() -> Expr {
arrow(
cst("StlFormula"),
arrow(tl_ext_stl_signal_ty(), arrow(nat_ty(), nat_ty())),
)
}
pub fn tl_ext_itl_formula_ty() -> Expr {
type0()
}
pub fn tl_ext_itl_chop_ty() -> Expr {
arrow(
cst("ItlFormula"),
arrow(cst("ItlFormula"), cst("ItlFormula")),
)
}
pub fn tl_ext_itl_projection_ty() -> Expr {
arrow(cst("ItlFormula"), cst("ItlFormula"))
}
pub fn tl_ext_itl_sat_ty() -> Expr {
arrow(nat_ty(), arrow(nat_ty(), arrow(cst("ItlFormula"), prop())))
}
pub fn tl_ext_ltl_to_gba_ty() -> Expr {
arrow(cst("LtlFormula"), cst("GeneralizedBuchi"))
}
pub fn tl_ext_gba_to_nba_ty() -> Expr {
arrow(cst("GeneralizedBuchi"), cst("BuchiAutomaton"))
}
pub fn tl_ext_product_automaton_ty() -> Expr {
arrow(
cst("TransitionSystem"),
arrow(cst("BuchiAutomaton"), cst("BuchiAutomaton")),
)
}
pub fn tl_ext_ltl_check_correctness_ty() -> Expr {
arrow(cst("TransitionSystem"), arrow(cst("LtlFormula"), prop()))
}
pub fn tl_ext_streett_automaton_ty() -> Expr {
type0()
}
pub fn tl_ext_muller_automaton_ty() -> Expr {
type0()
}
pub fn tl_ext_rabin_condition_ty() -> Expr {
arrow(cst("RabinAutomaton"), prop())
}
pub fn tl_ext_streett_condition_ty() -> Expr {
arrow(cst("StreettAutomaton"), prop())
}
pub fn tl_ext_buchi_to_rabin_ty() -> Expr {
arrow(cst("BuchiAutomaton"), cst("RabinAutomaton"))
}
pub fn tl_ext_rabin_streett_dual_ty() -> Expr {
arrow(cst("RabinAutomaton"), cst("StreettAutomaton"))
}
pub fn tl_ext_omega_regular_ty() -> Expr {
arrow(cst("BuchiAutomaton"), arrow(path_ty(), prop()))
}
pub fn tl_ext_omega_regular_closed_ty() -> Expr {
arrow(
cst("BuchiAutomaton"),
arrow(cst("BuchiAutomaton"), cst("BuchiAutomaton")),
)
}
pub fn tl_ext_ltl_omega_regular_ty() -> Expr {
arrow(cst("LtlFormula"), cst("BuchiAutomaton"))
}
pub fn bmc_instance_ty() -> Expr {
type0()
}
pub fn tl_ext_bmc_unrolling_ty() -> Expr {
arrow(cst("TransitionSystem"), arrow(nat_ty(), cst("BmcFormula")))
}
pub fn tl_ext_bmc_formula_ty() -> Expr {
type0()
}
pub fn tl_ext_bmc_soundness_ty() -> Expr {
arrow(
cst("TransitionSystem"),
arrow(nat_ty(), arrow(cst("LtlFormula"), prop())),
)
}
pub fn tl_ext_bmc_completeness_ty() -> Expr {
arrow(
cst("TransitionSystem"),
arrow(cst("LtlFormula"), arrow(nat_ty(), prop())),
)
}
pub fn tl_ext_ic3_frame_ty() -> Expr {
type0()
}
pub fn tl_ext_ic3_invariant_ty() -> Expr {
arrow(cst("TransitionSystem"), arrow(cst("LtlFormula"), prop()))
}
pub fn tl_ext_ic3_termination_ty() -> Expr {
arrow(cst("TransitionSystem"), prop())
}
pub fn tl_ext_ic3_correctness_ty() -> Expr {
arrow(
cst("TransitionSystem"),
arrow(cst("LtlFormula"), arrow(cst("Ic3Frame"), prop())),
)
}
pub fn tl_ext_ctl_embeds_ctl_star_ty() -> Expr {
arrow(cst("CtlFormula"), cst("CtlStarFormula"))
}
pub fn tl_ext_ltl_embeds_ctl_star_ty() -> Expr {
arrow(cst("LtlFormula"), cst("CtlStarFormula"))
}
pub fn tl_ext_linear_mu_formula_ty() -> Expr {
type0()
}
pub fn tl_ext_linear_mu_sat_ty() -> Expr {
arrow(
path_ty(),
arrow(nat_ty(), arrow(cst("LinearMuFormula"), prop())),
)
}
pub fn tl_ext_pnueli_completeness_ty() -> Expr {
arrow(cst("LtlFormula"), prop())
}
pub fn tl_ext_cegar_ty() -> Expr {
arrow(
cst("TransitionSystem"),
arrow(cst("CtlFormula"), arrow(cst("TransitionSystem"), prop())),
)
}
pub fn tl_ext_por_ty() -> Expr {
arrow(cst("TransitionSystem"), cst("TransitionSystem"))
}
pub fn tl_ext_symmetry_reduction_ty() -> Expr {
arrow(cst("TransitionSystem"), cst("TransitionSystem"))
}
pub fn tl_ext_var_ordering_ty() -> Expr {
arrow(cst("BDDManager"), arrow(nat_ty(), cst("BDDManager")))
}
pub fn register_temporal_logic_extended(env: &mut Environment) -> Result<(), String> {
let axioms: &[(&str, Expr)] = &[
("TctlFormula", tctl_formula_ty()),
("TctlEFBounded", tl_ext_tctl_ef_bounded_ty()),
("TctlAGBounded", tl_ext_tctl_ag_bounded_ty()),
("TimedTransitionSystem", type0()),
("TctlSat", tl_ext_tctl_sat_ty()),
("MtlFormula", mtl_formula_ty()),
("MtlUntilBounded", tl_ext_mtl_until_bounded_ty()),
("MtlFinallyBounded", tl_ext_mtl_finally_bounded_ty()),
("MtlGloballyBounded", tl_ext_mtl_globally_bounded_ty()),
("StlFormula", tl_ext_stl_formula_ty()),
("StlSat", tl_ext_stl_sat_ty()),
("StlRobustness", tl_ext_stl_robustness_ty()),
("ItlFormula", tl_ext_itl_formula_ty()),
("ItlChop", tl_ext_itl_chop_ty()),
("ItlProjection", tl_ext_itl_projection_ty()),
("ItlSat", tl_ext_itl_sat_ty()),
("LtlToGba", tl_ext_ltl_to_gba_ty()),
("GbaToNba", tl_ext_gba_to_nba_ty()),
("ProductAutomaton", tl_ext_product_automaton_ty()),
(
"LtlModelCheckCorrectness",
tl_ext_ltl_check_correctness_ty(),
),
("StreettAutomaton", tl_ext_streett_automaton_ty()),
("MullerAutomaton", tl_ext_muller_automaton_ty()),
("RabinCondition", tl_ext_rabin_condition_ty()),
("StreettCondition", tl_ext_streett_condition_ty()),
("BuchiToRabin", tl_ext_buchi_to_rabin_ty()),
("RabinStreettDual", tl_ext_rabin_streett_dual_ty()),
("OmegaRegularLanguage", tl_ext_omega_regular_ty()),
("OmegaRegularClosed", tl_ext_omega_regular_closed_ty()),
("LtlIsOmegaRegular", tl_ext_ltl_omega_regular_ty()),
("BmcInstance", bmc_instance_ty()),
("BmcFormula", tl_ext_bmc_formula_ty()),
("BmcUnrolling", tl_ext_bmc_unrolling_ty()),
("BmcSoundness", tl_ext_bmc_soundness_ty()),
("BmcCompleteness", tl_ext_bmc_completeness_ty()),
("Ic3Frame", tl_ext_ic3_frame_ty()),
("Ic3Invariant", tl_ext_ic3_invariant_ty()),
("Ic3Termination", tl_ext_ic3_termination_ty()),
("Ic3Correctness", tl_ext_ic3_correctness_ty()),
("CtlEmbedsCtlStar", tl_ext_ctl_embeds_ctl_star_ty()),
("LtlEmbedsCtlStar", tl_ext_ltl_embeds_ctl_star_ty()),
("LinearMuFormula", tl_ext_linear_mu_formula_ty()),
("LinearMuSat", tl_ext_linear_mu_sat_ty()),
("PnueliCompleteness", tl_ext_pnueli_completeness_ty()),
("CegarLoop", tl_ext_cegar_ty()),
("PartialOrderReduction", tl_ext_por_ty()),
("SymmetryReduction", tl_ext_symmetry_reduction_ty()),
("VariableOrdering", tl_ext_var_ordering_ty()),
];
for (name, ty) in axioms {
env.add(Declaration::Axiom {
name: Name::str(*name),
univ_params: vec![],
ty: ty.clone(),
})
.map_err(|e| e.to_string())?;
}
Ok(())
}