Add trivial identities for &&, <>->, []-> and Boolean arguments.
* src/ltlast/binop.cc (EConcat, UConcat): Rewrite "{b}<>-> f"
as "b && f", and rewrite "{b}[]->f" as "b->f".
* src/ltlast/binop.hh (binop::instance): Document trivial
identities for <>-> and []->.
* src/ltlast/multop.cc (multop::instance): Rewrite "b1 & b2"
as "b1 && b2" when b1 and b2 are Boolean.
(multop::multop): Always disable is.boolean for AndNLM.
* src/ltlast/multop.hh: Document the rewriting.
* src/ltltest/equals.cc: Show the two formulas if the exit_code
is 1, to help debugging.
* src/ltltest/equals.test: Add more tests.
* src/ltltest/kind.test: Adjust tests.
This commit is contained in:
parent
0e4e2a79b2
commit
a2da5184b5
7 changed files with 63 additions and 13 deletions
|
|
@ -25,6 +25,7 @@
|
|||
#include <utility>
|
||||
#include "binop.hh"
|
||||
#include "unop.hh"
|
||||
#include "multop.hh"
|
||||
#include "constant.hh"
|
||||
#include "visitor.hh"
|
||||
#include <iostream>
|
||||
|
|
@ -365,6 +366,7 @@ namespace spot
|
|||
// - 1 <>-> Exp = Exp
|
||||
// - [*0] <>-> Exp = 0
|
||||
// - Exp <>-> 0 = 0
|
||||
// - boolExp <>-> Exp = boolExp & Exp
|
||||
if (first == constant::true_instance())
|
||||
return second;
|
||||
if (first == constant::false_instance()
|
||||
|
|
@ -378,12 +380,15 @@ namespace spot
|
|||
first->destroy();
|
||||
return second;
|
||||
}
|
||||
if (first->is_boolean())
|
||||
return multop::instance(multop::And, first, second);
|
||||
break;
|
||||
case UConcat:
|
||||
// - 0 []-> Exp = 1
|
||||
// - 1 []-> Exp = Exp
|
||||
// - [*0] []-> Exp = 1
|
||||
// - Exp []-> 1 = 1
|
||||
// - boolExp []-> Exp = boolExp -> Exp
|
||||
if (first == constant::true_instance())
|
||||
return second;
|
||||
if (first == constant::false_instance()
|
||||
|
|
@ -397,6 +402,8 @@ namespace spot
|
|||
first->destroy();
|
||||
return second;
|
||||
}
|
||||
if (first->is_boolean())
|
||||
return binop::instance(binop::Implies, first, second);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue