Arrange multops so that Boolean arguments come first.
This helps recursive implication checks. Also order atomic propositions with strverscmp(). * src/ltlast/formula.hh (formula_ptr_less_than_multop, is_literal, atomic_prop_cmp): New. * src/ltlast/formula.cc (is_literal, atomic_prop_cmp): Implement them. * src/ltlast/multop.cc: Use formula_ptr_less_than_multop. * src/ltltest/isop.test, src/ltltest/ltlfilt.test, src/tgbatest/det.test, src/tgbatest/dstar.test, src/tgbatest/explicit.test, src/tgbatest/explpro2.test, src/tgbatest/explpro3.test, src/tgbatest/explprod.test, src/tgbatest/nondet.test, src/tgbatest/tripprod.test: Adjust tests. * NEWS: Mention the new order.
This commit is contained in:
parent
1f384c2c63
commit
536e45b342
14 changed files with 143 additions and 57 deletions
|
|
@ -20,9 +20,14 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "config.h"
|
||||
#include "formula.hh"
|
||||
#include "misc/hash.hh"
|
||||
#include "misc/casts.hh"
|
||||
#include <iostream>
|
||||
#include "unop.hh"
|
||||
#include "atomic_prop.hh"
|
||||
#include <string.h>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
@ -114,5 +119,22 @@ namespace spot
|
|||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
const formula* is_literal(const formula* f)
|
||||
{
|
||||
const unop* g = is_Not(f);
|
||||
if (g)
|
||||
f = g->child();
|
||||
return is_atomic_prop(f);
|
||||
}
|
||||
|
||||
int atomic_prop_cmp(const formula* f, const formula* g)
|
||||
{
|
||||
const atomic_prop* a = down_cast<const atomic_prop*>(f);
|
||||
const atomic_prop* b = down_cast<const atomic_prop*>(g);
|
||||
return strverscmp(a->name().c_str(), b->name().c_str());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue