* src/ltlvisit/Makefile.am: Copyright 2004.
* src/ltltest/inf.test: More test. * src/ltlvisit/basereduc.cc, src/ltlvisit/forminf.cc (spot): Use dynamic_cast. * src/ltlvisit/reducform.cc, src/ltlvisit/reducform.hh, src/ltltest/reduc.test, src/ltltest/reduc.cc: Add an option to choose which rules applies to simplify the formula.
This commit is contained in:
parent
f7e5fe0821
commit
4cd10c3dfc
9 changed files with 489 additions and 460 deletions
|
|
@ -26,6 +26,27 @@
|
|||
. ./defs || exit 1
|
||||
|
||||
#
|
||||
run 1 ./inf 'Xa' 'X(b U a)'
|
||||
run 1 ./inf 'XXa' 'XX(b U a)'
|
||||
|
||||
run 1 ./inf '(e R f)' '(g U f)'
|
||||
run 1 ./inf '( X(a + b))' '( X((a + b)+(c)+(d)))'
|
||||
run 1 ./inf '( X(a + b)) U (e R f)' '( X((a + b)+(c)+(d))) U (g U f)'
|
||||
|
||||
run 0 ./inf 'Xa' 'XX(b U a)'
|
||||
run 0 ./inf 'XXa' 'X(b U a)'
|
||||
|
||||
run 0 ./inf '( X(a + b))' '( X(X(a + b)+(c)+(d)))'
|
||||
run 0 ./inf '( X(a + b)) U (e R f)' '( X(X(a + b)+(c)+(d))) U (g U f)'
|
||||
|
||||
run 0 ./inf 'a' 'b'
|
||||
run 0 ./inf 'a' 'b + c'
|
||||
run 0 ./inf 'a + b' 'a'
|
||||
run 0 ./inf 'a' 'a * c'
|
||||
run 0 ./inf 'a * b' 'c'
|
||||
run 0 ./inf 'a' 'a U b'
|
||||
run 0 ./inf 'a' 'a R b'
|
||||
run 0 ./inf 'a R b' 'a'
|
||||
|
||||
run 1 ./inf '1' '1'
|
||||
run 1 ./inf '0' '0'
|
||||
|
|
@ -52,6 +73,9 @@ run 1 ./inf 'a' 'a R 1'
|
|||
run 1 ./inf 'a R b' 'b'
|
||||
run 1 ./inf 'a R b' '1'
|
||||
|
||||
run 1 ./inf 'Xa' 'X(b U a)'
|
||||
run 1 ./inf 'X(a R b)' 'Xb'
|
||||
|
||||
run 1 ./inf 'a U b' '1 U b'
|
||||
run 1 ./inf 'a R b' '1 R b'
|
||||
|
||||
|
|
|
|||
|
|
@ -34,30 +34,45 @@
|
|||
void
|
||||
syntax(char* prog)
|
||||
{
|
||||
std::cerr << prog << " formula1 (formula2)?" << std::endl;
|
||||
std::cerr << prog << " option formula1 (formula2)?" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
typedef spot::ltl::formula* ptrfunct(const spot::ltl::formula*);
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
if (argc < 2)
|
||||
if (argc < 3)
|
||||
syntax(argv[0]);
|
||||
|
||||
spot::ltl::option o;
|
||||
switch(atoi(argv[1])){
|
||||
case 0:
|
||||
o = spot::ltl::Base;
|
||||
break;
|
||||
case 1:
|
||||
o = spot::ltl::Inf;
|
||||
break;
|
||||
case 2:
|
||||
o = spot::ltl::EventualUniversal;
|
||||
break;
|
||||
case 3:
|
||||
o = spot::ltl::BRI;
|
||||
break;
|
||||
default: return 2;
|
||||
}
|
||||
|
||||
spot::ltl::parse_error_list p1;
|
||||
spot::ltl::formula* f1 = spot::ltl::parse(argv[1], p1);
|
||||
spot::ltl::formula* f1 = spot::ltl::parse(argv[2], p1);
|
||||
spot::ltl::formula* f2 = NULL;
|
||||
|
||||
if (spot::ltl::format_parse_errors(std::cerr, argv[1], p1))
|
||||
if (spot::ltl::format_parse_errors(std::cerr, argv[2], p1))
|
||||
return 2;
|
||||
|
||||
|
||||
if (argc == 3){
|
||||
if (argc == 4){
|
||||
spot::ltl::parse_error_list p2;
|
||||
f2 = spot::ltl::parse(argv[2], p2);
|
||||
if (spot::ltl::format_parse_errors(std::cerr, argv[2], p2))
|
||||
f2 = spot::ltl::parse(argv[3], p2);
|
||||
if (spot::ltl::format_parse_errors(std::cerr, argv[3], p2))
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +93,7 @@ main(int argc, char** argv)
|
|||
std::string f1s_before = spot::ltl::to_string(f1);
|
||||
|
||||
ftmp1 = f1;
|
||||
f1 = spot::ltl::reduce(f1);
|
||||
f1 = spot::ltl::reduce(f1,o);
|
||||
ftmp2 = f1;
|
||||
f1 = spot::ltl::unabbreviate_logic(f1);
|
||||
spot::ltl::destroy(ftmp1);
|
||||
|
|
@ -134,13 +149,6 @@ main(int argc, char** argv)
|
|||
if (length_f1_after < length_f1_before) exit_code = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
spot::ltl::dump(std::cout, f1); std::cout << std::endl;
|
||||
if (f2 != NULL)
|
||||
spot::ltl::dump(std::cout, f2); std::cout << std::endl;
|
||||
*/
|
||||
|
||||
|
||||
spot::ltl::destroy(f1);
|
||||
if (f2 != NULL)
|
||||
spot::ltl::destroy(f2);
|
||||
|
|
|
|||
|
|
@ -23,30 +23,37 @@
|
|||
|
||||
# Check for the reduc visitor.
|
||||
|
||||
. ./defs || exit 1
|
||||
#. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
FICH=${1-$srcdir/formules.ltl}
|
||||
#FICH=${1-$srcdir/formules.ltl}
|
||||
FICH=${1-formules.ltl}
|
||||
|
||||
#####################################
|
||||
|
||||
rm -f result.data
|
||||
|
||||
cat $FICH |
|
||||
while read f; do
|
||||
if [ -n "$f" ] && [ "$f" != "####" ]; then
|
||||
./reduc "$f" >> result.data
|
||||
fi
|
||||
done
|
||||
|
||||
test $? == 0 || exit 1
|
||||
|
||||
for opt in 0 1 2 3
|
||||
do
|
||||
rm -f result.data
|
||||
|
||||
cat $FICH |
|
||||
while read f; do
|
||||
if [ -n "$f" ] && [ "$f" != "####" ]; then
|
||||
./reduc $opt "$f" >> result.data
|
||||
fi
|
||||
done
|
||||
|
||||
test $? == 0 || exit 1
|
||||
|
||||
#####################################
|
||||
|
||||
perl -ne 'BEGIN { $sum1 = 0; $sum2 = 0; }
|
||||
|
||||
perl -ne 'BEGIN { $sum1 = 0; $sum2 = 0; }
|
||||
/^(\d+)\s+(\d+)/;
|
||||
$sum1 += $1;
|
||||
$sum2 += $2;
|
||||
END { print $sum2 * 100 / $sum1; print "\n"; }
|
||||
END { print 100 - ($sum2 * 100 / $sum1); print "\n"; }
|
||||
' < result.data
|
||||
|
||||
done
|
||||
|
||||
#####################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue