spot/src/tgbatest/ltl2tgba.cc
Alexandre Duret-Lutz 1551c5d947 Upgrade GPL v2+ to GPL v3+.
* NEWS: Mention this.
* COPYING: Replace by GPL v3.
* src/sanity/style.test: Check files with the wrong license,
in case we forgot to update it during a merge.
* Makefile.am, bench/Makefile.am, bench/emptchk/Makefile.am,
bench/emptchk/defs.in, bench/emptchk/ltl-human.sh,
bench/emptchk/ltl-random.sh, bench/emptchk/pml-clserv.sh,
bench/emptchk/pml-eeaean.sh, bench/emptchk/pml2tgba.pl,
bench/ltl2tgba/big, bench/ltl2tgba/defs.in, bench/ltl2tgba/known,
bench/ltl2tgba/lbtt2csv.pl, bench/ltl2tgba/ltl2baw.in,
bench/ltl2tgba/parseout.pl, bench/ltl2tgba/small,
bench/ltlclasses/Makefile.am, bench/ltlclasses/defs.in,
bench/ltlclasses/run, bench/ltlcounter/Makefile.am,
bench/ltlcounter/defs.in, bench/ltlcounter/run,
bench/scc-stats/Makefile.am, bench/scc-stats/stats.cc,
bench/split-product/Makefile.am, bench/split-product/cutscc.cc,
bench/split-product/pml2tgba.pl, bench/wdba/Makefile.am,
bench/wdba/defs.in, bench/wdba/run, configure.ac, doc/Makefile.am,
doc/dot.in, doc/tl/Makefile.am, iface/Makefile.am,
iface/dve2/Makefile.am, iface/dve2/defs.in, iface/dve2/dve2.cc,
iface/dve2/dve2.hh, iface/dve2/dve2check.cc,
iface/dve2/dve2check.test, iface/dve2/finite.test,
iface/dve2/kripke.test, iface/gspn/Makefile.am, iface/gspn/common.cc,
iface/gspn/common.hh, iface/gspn/dcswave.test,
iface/gspn/dcswaveeltl.test, iface/gspn/dcswavefm.test,
iface/gspn/dcswaveltl.test, iface/gspn/dottygspn.cc,
iface/gspn/dottyssp.cc, iface/gspn/gspn.cc, iface/gspn/gspn.hh,
iface/gspn/ltlgspn.cc, iface/gspn/simple.test, iface/gspn/ssp.cc,
iface/gspn/ssp.hh, iface/gspn/udcsefm.test, iface/gspn/udcseltl.test,
iface/gspn/udcsfm.test, iface/gspn/udcsltl.test, src/Makefile.am,
src/bin/Makefile.am, src/bin/common_cout.cc, src/bin/common_cout.hh,
src/bin/common_finput.cc, src/bin/common_finput.hh,
src/bin/common_output.cc, src/bin/common_output.hh,
src/bin/common_post.cc, src/bin/common_post.hh, src/bin/common_r.cc,
src/bin/common_r.hh, src/bin/common_range.cc, src/bin/common_range.hh,
src/bin/common_setup.cc, src/bin/common_setup.hh,
src/bin/common_sys.hh, src/bin/genltl.cc, src/bin/ltl2tgba.cc,
src/bin/ltl2tgta.cc, src/bin/ltlfilt.cc, src/bin/man/Makefile.am,
src/bin/randltl.cc, src/eltlparse/Makefile.am,
src/eltlparse/eltlparse.yy, src/eltlparse/eltlscan.ll,
src/eltlparse/fmterror.cc, src/eltlparse/parsedecl.hh,
src/eltlparse/public.hh, src/eltltest/Makefile.am,
src/eltltest/acc.cc, src/eltltest/acc.test, src/eltltest/defs.in,
src/eltltest/nfa.cc, src/eltltest/nfa.test, src/evtgba/Makefile.am,
src/evtgba/evtgba.cc, src/evtgba/evtgba.hh, src/evtgba/evtgbaiter.hh,
src/evtgba/explicit.cc, src/evtgba/explicit.hh, src/evtgba/product.cc,
src/evtgba/product.hh, src/evtgba/symbol.cc, src/evtgba/symbol.hh,
src/evtgbaalgos/Makefile.am, src/evtgbaalgos/dotty.cc,
src/evtgbaalgos/dotty.hh, src/evtgbaalgos/reachiter.cc,
src/evtgbaalgos/reachiter.hh, src/evtgbaalgos/save.cc,
src/evtgbaalgos/save.hh, src/evtgbaalgos/tgba2evtgba.cc,
src/evtgbaalgos/tgba2evtgba.hh, src/evtgbaparse/Makefile.am,
src/evtgbaparse/evtgbaparse.yy, src/evtgbaparse/evtgbascan.ll,
src/evtgbaparse/fmterror.cc, src/evtgbaparse/parsedecl.hh,
src/evtgbaparse/public.hh, src/evtgbatest/Makefile.am,
src/evtgbatest/defs.in, src/evtgbatest/explicit.cc,
src/evtgbatest/explicit.test, src/evtgbatest/ltl2evtgba.cc,
src/evtgbatest/ltl2evtgba.test, src/evtgbatest/product.cc,
src/evtgbatest/product.test, src/evtgbatest/readsave.cc,
src/evtgbatest/readsave.test, src/kripke/Makefile.am,
src/kripke/fairkripke.cc, src/kripke/fairkripke.hh,
src/kripke/kripke.cc, src/kripke/kripke.hh,
src/kripke/kripkeexplicit.cc, src/kripke/kripkeexplicit.hh,
src/kripke/kripkeprint.cc, src/kripke/kripkeprint.hh,
src/kripkeparse/Makefile.am, src/kripkeparse/fmterror.cc,
src/kripkeparse/kripkeparse.yy, src/kripkeparse/kripkescan.ll,
src/kripkeparse/parsedecl.hh, src/kripkeparse/public.hh,
src/kripkeparse/scankripke.ll, src/kripketest/Makefile.am,
src/kripketest/bad_parsing.test, src/kripketest/defs.in,
src/kripketest/kripke.test, src/kripketest/parse_print_test.cc,
src/ltlast/Makefile.am, src/ltlast/allnodes.hh,
src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh,
src/ltlast/automatop.cc, src/ltlast/automatop.hh, src/ltlast/binop.cc,
src/ltlast/binop.hh, src/ltlast/bunop.cc, src/ltlast/bunop.hh,
src/ltlast/constant.cc, src/ltlast/constant.hh, src/ltlast/formula.cc,
src/ltlast/formula.hh, src/ltlast/formula_tree.cc,
src/ltlast/formula_tree.hh, src/ltlast/multop.cc,
src/ltlast/multop.hh, src/ltlast/nfa.cc, src/ltlast/nfa.hh,
src/ltlast/predecl.hh, src/ltlast/refformula.cc,
src/ltlast/refformula.hh, src/ltlast/unop.cc, src/ltlast/unop.hh,
src/ltlast/visitor.hh, src/ltlenv/Makefile.am, src/ltlenv/declenv.cc,
src/ltlenv/declenv.hh, src/ltlenv/defaultenv.cc,
src/ltlenv/defaultenv.hh, src/ltlenv/environment.hh,
src/ltlparse/Makefile.am, src/ltlparse/fmterror.cc,
src/ltlparse/ltlfile.cc, src/ltlparse/ltlfile.hh,
src/ltlparse/ltlparse.yy, src/ltlparse/ltlscan.ll,
src/ltlparse/parsedecl.hh, src/ltlparse/public.hh,
src/ltltest/Makefile.am, src/ltltest/consterm.cc,
src/ltltest/consterm.test, src/ltltest/defs.in, src/ltltest/equals.cc,
src/ltltest/equals.test, src/ltltest/kind.cc, src/ltltest/kind.test,
src/ltltest/length.cc, src/ltltest/length.test,
src/ltltest/lunabbrev.test, src/ltltest/nenoform.test,
src/ltltest/parse.test, src/ltltest/parseerr.test,
src/ltltest/readltl.cc, src/ltltest/reduc.cc, src/ltltest/reduc.test,
src/ltltest/reduccmp.test, src/ltltest/reducpsl.test,
src/ltltest/syntimpl.cc, src/ltltest/syntimpl.test,
src/ltltest/tostring.cc, src/ltltest/tostring.test,
src/ltltest/tunabbrev.test, src/ltltest/tunenoform.test,
src/ltltest/utf8.test, src/ltltest/uwrm.test,
src/ltlvisit/Makefile.am, src/ltlvisit/apcollect.cc,
src/ltlvisit/apcollect.hh, src/ltlvisit/clone.cc,
src/ltlvisit/clone.hh, src/ltlvisit/contain.cc,
src/ltlvisit/contain.hh, src/ltlvisit/destroy.cc,
src/ltlvisit/destroy.hh, src/ltlvisit/dotty.cc, src/ltlvisit/dotty.hh,
src/ltlvisit/dump.cc, src/ltlvisit/dump.hh, src/ltlvisit/lbt.cc,
src/ltlvisit/lbt.hh, src/ltlvisit/length.cc, src/ltlvisit/length.hh,
src/ltlvisit/lunabbrev.cc, src/ltlvisit/lunabbrev.hh,
src/ltlvisit/mark.cc, src/ltlvisit/mark.hh, src/ltlvisit/nenoform.cc,
src/ltlvisit/nenoform.hh, src/ltlvisit/postfix.cc,
src/ltlvisit/postfix.hh, src/ltlvisit/randomltl.cc,
src/ltlvisit/randomltl.hh, src/ltlvisit/reduce.cc,
src/ltlvisit/reduce.hh, src/ltlvisit/relabel.cc,
src/ltlvisit/relabel.hh, src/ltlvisit/simpfg.cc,
src/ltlvisit/simpfg.hh, src/ltlvisit/simplify.cc,
src/ltlvisit/simplify.hh, src/ltlvisit/snf.cc, src/ltlvisit/snf.hh,
src/ltlvisit/tostring.cc, src/ltlvisit/tostring.hh,
src/ltlvisit/tunabbrev.cc, src/ltlvisit/tunabbrev.hh,
src/ltlvisit/wmunabbrev.cc, src/ltlvisit/wmunabbrev.hh,
src/misc/Makefile.am, src/misc/acccompl.cc, src/misc/acccompl.hh,
src/misc/accconv.cc, src/misc/accconv.hh, src/misc/bareword.cc,
src/misc/bareword.hh, src/misc/bddalloc.cc, src/misc/bddalloc.hh,
src/misc/bddlt.hh, src/misc/bddop.cc, src/misc/bddop.hh,
src/misc/casts.hh, src/misc/escape.cc, src/misc/escape.hh,
src/misc/fixpool.hh, src/misc/freelist.cc, src/misc/freelist.hh,
src/misc/hash.hh, src/misc/hashfunc.hh, src/misc/intvcmp2.cc,
src/misc/intvcmp2.hh, src/misc/intvcomp.cc, src/misc/intvcomp.hh,
src/misc/ltstr.hh, src/misc/memusage.cc, src/misc/memusage.hh,
src/misc/minato.cc, src/misc/minato.hh, src/misc/modgray.cc,
src/misc/modgray.hh, src/misc/mspool.hh, src/misc/optionmap.cc,
src/misc/optionmap.hh, src/misc/random.cc, src/misc/random.hh,
src/misc/timer.cc, src/misc/timer.hh, src/misc/unique_ptr.hh,
src/misc/version.cc, src/misc/version.hh, src/neverparse/Makefile.am,
src/neverparse/fmterror.cc, src/neverparse/neverclaimparse.yy,
src/neverparse/neverclaimscan.ll, src/neverparse/parsedecl.hh,
src/neverparse/public.hh, src/saba/Makefile.am,
src/saba/explicitstateconjunction.cc,
src/saba/explicitstateconjunction.hh, src/saba/saba.cc,
src/saba/saba.hh, src/saba/sabacomplementtgba.cc,
src/saba/sabacomplementtgba.hh, src/saba/sabastate.hh,
src/saba/sabasucciter.hh, src/sabaalgos/Makefile.am,
src/sabaalgos/sabadotty.cc, src/sabaalgos/sabadotty.hh,
src/sabaalgos/sabareachiter.cc, src/sabaalgos/sabareachiter.hh,
src/sabatest/Makefile.am, src/sabatest/defs.in,
src/sabatest/sabacomplementtgba.cc, src/sanity/Makefile.am,
src/sanity/readme.test, src/sanity/style.test, src/ta/Makefile.am,
src/ta/ta.cc, src/ta/ta.hh, src/ta/taexplicit.cc,
src/ta/taexplicit.hh, src/ta/taproduct.cc, src/ta/taproduct.hh,
src/ta/tgta.cc, src/ta/tgta.hh, src/ta/tgtaexplicit.cc,
src/ta/tgtaexplicit.hh, src/ta/tgtaproduct.cc, src/ta/tgtaproduct.hh,
src/taalgos/Makefile.am, src/taalgos/dotty.cc, src/taalgos/dotty.hh,
src/taalgos/emptinessta.cc, src/taalgos/emptinessta.hh,
src/taalgos/minimize.cc, src/taalgos/minimize.hh,
src/taalgos/reachiter.cc, src/taalgos/reachiter.hh,
src/taalgos/statessetbuilder.cc, src/taalgos/statessetbuilder.hh,
src/taalgos/stats.cc, src/taalgos/stats.hh, src/taalgos/tgba2ta.cc,
src/taalgos/tgba2ta.hh, src/tgba/Makefile.am, src/tgba/bdddict.cc,
src/tgba/bdddict.hh, src/tgba/bddprint.cc, src/tgba/bddprint.hh,
src/tgba/formula2bdd.cc, src/tgba/formula2bdd.hh,
src/tgba/futurecondcol.cc, src/tgba/futurecondcol.hh,
src/tgba/public.hh, src/tgba/sba.hh, src/tgba/state.hh,
src/tgba/statebdd.cc, src/tgba/statebdd.hh, src/tgba/succiter.hh,
src/tgba/succiterconcrete.cc, src/tgba/succiterconcrete.hh,
src/tgba/taatgba.cc, src/tgba/taatgba.hh, src/tgba/tgba.cc,
src/tgba/tgba.hh, src/tgba/tgbabddconcrete.cc,
src/tgba/tgbabddconcrete.hh, src/tgba/tgbabddconcretefactory.cc,
src/tgba/tgbabddconcretefactory.hh,
src/tgba/tgbabddconcreteproduct.cc,
src/tgba/tgbabddconcreteproduct.hh, src/tgba/tgbabddcoredata.cc,
src/tgba/tgbabddcoredata.hh, src/tgba/tgbabddfactory.hh,
src/tgba/tgbaexplicit.cc, src/tgba/tgbaexplicit.hh,
src/tgba/tgbakvcomplement.cc, src/tgba/tgbakvcomplement.hh,
src/tgba/tgbaproduct.cc, src/tgba/tgbaproduct.hh,
src/tgba/tgbasafracomplement.cc, src/tgba/tgbasafracomplement.hh,
src/tgba/tgbascc.cc, src/tgba/tgbascc.hh, src/tgba/tgbasgba.cc,
src/tgba/tgbasgba.hh, src/tgba/tgbatba.cc, src/tgba/tgbatba.hh,
src/tgba/tgbaunion.cc, src/tgba/tgbaunion.hh, src/tgba/wdbacomp.cc,
src/tgba/wdbacomp.hh, src/tgbaalgos/Makefile.am,
src/tgbaalgos/bfssteps.cc, src/tgbaalgos/bfssteps.hh,
src/tgbaalgos/cutscc.cc, src/tgbaalgos/cutscc.hh,
src/tgbaalgos/cycles.cc, src/tgbaalgos/cycles.hh,
src/tgbaalgos/degen.cc, src/tgbaalgos/degen.hh,
src/tgbaalgos/dotty.cc, src/tgbaalgos/dotty.hh,
src/tgbaalgos/dottydec.cc, src/tgbaalgos/dottydec.hh,
src/tgbaalgos/dupexp.cc, src/tgbaalgos/dupexp.hh,
src/tgbaalgos/eltl2tgba_lacim.cc, src/tgbaalgos/eltl2tgba_lacim.hh,
src/tgbaalgos/emptiness.cc, src/tgbaalgos/emptiness.hh,
src/tgbaalgos/emptiness_stats.hh, src/tgbaalgos/gtec/Makefile.am,
src/tgbaalgos/gtec/ce.cc, src/tgbaalgos/gtec/ce.hh,
src/tgbaalgos/gtec/explscc.cc, src/tgbaalgos/gtec/explscc.hh,
src/tgbaalgos/gtec/gtec.cc, src/tgbaalgos/gtec/gtec.hh,
src/tgbaalgos/gtec/nsheap.cc, src/tgbaalgos/gtec/nsheap.hh,
src/tgbaalgos/gtec/sccstack.cc, src/tgbaalgos/gtec/sccstack.hh,
src/tgbaalgos/gtec/status.cc, src/tgbaalgos/gtec/status.hh,
src/tgbaalgos/gv04.cc, src/tgbaalgos/gv04.hh, src/tgbaalgos/isdet.cc,
src/tgbaalgos/isdet.hh, src/tgbaalgos/isweakscc.cc,
src/tgbaalgos/isweakscc.hh, src/tgbaalgos/lbtt.cc,
src/tgbaalgos/lbtt.hh, src/tgbaalgos/ltl2taa.cc,
src/tgbaalgos/ltl2taa.hh, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbaalgos/ltl2tgba_fm.hh, src/tgbaalgos/ltl2tgba_lacim.cc,
src/tgbaalgos/ltl2tgba_lacim.hh, src/tgbaalgos/magic.cc,
src/tgbaalgos/magic.hh, src/tgbaalgos/minimize.cc,
src/tgbaalgos/minimize.hh, src/tgbaalgos/ndfs_result.hxx,
src/tgbaalgos/neverclaim.cc, src/tgbaalgos/neverclaim.hh,
src/tgbaalgos/postproc.cc, src/tgbaalgos/postproc.hh,
src/tgbaalgos/powerset.cc, src/tgbaalgos/powerset.hh,
src/tgbaalgos/projrun.cc, src/tgbaalgos/projrun.hh,
src/tgbaalgos/randomgraph.cc, src/tgbaalgos/randomgraph.hh,
src/tgbaalgos/reachiter.cc, src/tgbaalgos/reachiter.hh,
src/tgbaalgos/reducerun.cc, src/tgbaalgos/reducerun.hh,
src/tgbaalgos/reductgba_sim.cc, src/tgbaalgos/reductgba_sim.hh,
src/tgbaalgos/replayrun.cc, src/tgbaalgos/replayrun.hh,
src/tgbaalgos/rundotdec.cc, src/tgbaalgos/rundotdec.hh,
src/tgbaalgos/safety.cc, src/tgbaalgos/safety.hh,
src/tgbaalgos/save.cc, src/tgbaalgos/save.hh, src/tgbaalgos/scc.cc,
src/tgbaalgos/scc.hh, src/tgbaalgos/sccfilter.cc,
src/tgbaalgos/sccfilter.hh, src/tgbaalgos/se05.cc,
src/tgbaalgos/se05.hh, src/tgbaalgos/simulation.cc,
src/tgbaalgos/simulation.hh, src/tgbaalgos/stats.cc,
src/tgbaalgos/stats.hh, src/tgbaalgos/tau03.cc,
src/tgbaalgos/tau03.hh, src/tgbaalgos/tau03opt.cc,
src/tgbaalgos/tau03opt.hh, src/tgbaalgos/weight.cc,
src/tgbaalgos/weight.hh, src/tgbaparse/Makefile.am,
src/tgbaparse/fmterror.cc, src/tgbaparse/parsedecl.hh,
src/tgbaparse/public.hh, src/tgbaparse/tgbaparse.yy,
src/tgbaparse/tgbascan.ll, src/tgbatest/Makefile.am,
src/tgbatest/babiak.test, src/tgbatest/bddprod.test,
src/tgbatest/complementation.cc, src/tgbatest/complementation.test,
src/tgbatest/cycles.test, src/tgbatest/defs.in,
src/tgbatest/degendet.test, src/tgbatest/degenid.test,
src/tgbatest/dfs.test, src/tgbatest/dupexp.test,
src/tgbatest/eltl2tgba.test, src/tgbatest/emptchk.test,
src/tgbatest/emptchke.test, src/tgbatest/emptchkr.test,
src/tgbatest/explicit.cc, src/tgbatest/explicit.test,
src/tgbatest/explicit2.cc, src/tgbatest/explicit2.test,
src/tgbatest/explpro2.test, src/tgbatest/explpro3.test,
src/tgbatest/explpro4.test, src/tgbatest/explprod.cc,
src/tgbatest/explprod.test, src/tgbatest/intvcmp2.cc,
src/tgbatest/intvcomp.cc, src/tgbatest/intvcomp.test,
src/tgbatest/kv.test, src/tgbatest/ltl2neverclaim.test,
src/tgbatest/ltl2ta.test, src/tgbatest/ltl2tgba.cc,
src/tgbatest/ltl2tgba.test, src/tgbatest/ltlcounter.test,
src/tgbatest/ltlprod.cc, src/tgbatest/ltlprod.test,
src/tgbatest/mixprod.cc, src/tgbatest/mixprod.test,
src/tgbatest/neverclaimread.test, src/tgbatest/nondet.test,
src/tgbatest/obligation.test, src/tgbatest/powerset.cc,
src/tgbatest/randpsl.test, src/tgbatest/randtgba.cc,
src/tgbatest/randtgba.test, src/tgbatest/readsave.test,
src/tgbatest/renault.test, src/tgbatest/scc.test,
src/tgbatest/sccsimpl.test, src/tgbatest/spotlbtt.test,
src/tgbatest/spotlbtt2.test, src/tgbatest/taatgba.cc,
src/tgbatest/taatgba.test, src/tgbatest/tgbaread.cc,
src/tgbatest/tgbaread.test, src/tgbatest/tripprod.cc,
src/tgbatest/tripprod.test, src/tgbatest/wdba.test,
src/tgbatest/wdba2.test, wrap/Makefile.am, wrap/python/Makefile.am,
wrap/python/ajax/Makefile.am, wrap/python/ajax/spot.in,
wrap/python/buddy.i, wrap/python/spot.i,
wrap/python/tests/Makefile.am, wrap/python/tests/alarm.py,
wrap/python/tests/bddnqueen.py, wrap/python/tests/implies.py,
wrap/python/tests/interdep.py, wrap/python/tests/ltl2tgba.py,
wrap/python/tests/ltl2tgba.test, wrap/python/tests/ltlparse.py,
wrap/python/tests/ltlsimple.py, wrap/python/tests/minato.py,
wrap/python/tests/modgray.py, wrap/python/tests/optionmap.py,
wrap/python/tests/parsetgba.py, wrap/python/tests/run.in,
wrap/python/tests/setxor.py: Update licence version, and replace the
FSF address by a URL.
2012-10-12 22:05:18 +02:00

1634 lines
46 KiB
C++

// -*- coding: utf-8 -*-
// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005, 2006, 2007 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis
// Coopératifs (SRC), Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// 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 <iostream>
#include <iomanip>
#include <cassert>
#include <fstream>
#include <string>
#include <cstdlib>
#include "ltlvisit/tostring.hh"
#include "ltlvisit/apcollect.hh"
#include "ltlast/allnodes.hh"
#include "ltlparse/public.hh"
#include "tgbaalgos/ltl2tgba_lacim.hh"
#include "tgbaalgos/ltl2tgba_fm.hh"
#include "tgbaalgos/ltl2taa.hh"
#include "tgba/bddprint.hh"
#include "tgbaalgos/save.hh"
#include "tgbaalgos/dotty.hh"
#include "tgbaalgos/lbtt.hh"
#include "tgba/tgbatba.hh"
#include "tgba/tgbasgba.hh"
#include "tgbaalgos/degen.hh"
#include "tgba/tgbaproduct.hh"
#include "tgba/futurecondcol.hh"
#include "tgbaalgos/reducerun.hh"
#include "tgbaparse/public.hh"
#include "neverparse/public.hh"
#include "tgbaalgos/dupexp.hh"
#include "tgbaalgos/minimize.hh"
#include "taalgos/minimize.hh"
#include "tgbaalgos/neverclaim.hh"
#include "tgbaalgos/replayrun.hh"
#include "tgbaalgos/rundotdec.hh"
#include "tgbaalgos/sccfilter.hh"
#include "tgbaalgos/safety.hh"
#include "tgbaalgos/eltl2tgba_lacim.hh"
#include "tgbaalgos/gtec/gtec.hh"
#include "eltlparse/public.hh"
#include "misc/timer.hh"
#include "misc/unique_ptr.hh"
#include "tgbaalgos/stats.hh"
#include "tgbaalgos/scc.hh"
#include "tgbaalgos/emptiness_stats.hh"
#include "tgbaalgos/scc.hh"
#include "tgbaalgos/isdet.hh"
#include "tgbaalgos/cycles.hh"
#include "tgbaalgos/isweakscc.hh"
#include "kripkeparse/public.hh"
#include "tgbaalgos/simulation.hh"
#include "taalgos/tgba2ta.hh"
#include "taalgos/dotty.hh"
#include "taalgos/stats.hh"
std::string
ltl_defs()
{
std::string s = "\
X=(0 1 true \
1 2 $0 \
accept 2) \
U=(0 0 $0 \
0 1 $1 \
accept 1) \
G=(0 0 $0) \
F=U(true, $0) \
W=G($0)|U($0, $1) \
R=!U(!$0, !$1) \
M=F($0)&R($0, $1)";
return s;
}
void
syntax(char* prog)
{
// Display the supplied name unless it appears to be a libtool wrapper.
char* slash = strrchr(prog, '/');
if (slash && (strncmp(slash + 1, "lt-", 3) == 0))
prog = slash + 4;
std::cerr << "Usage: "<< prog << " [-f|-l|-le|-taa] [OPTIONS...] formula"
<< std::endl
<< " "<< prog << " [-f|-l|-le|-taa] -F [OPTIONS...] file"
<< std::endl
<< " "<< prog << " -X [OPTIONS...] file" << std::endl
<< std::endl
<< "Translate an LTL formula into an automaton, or read the "
<< "automaton from a file." << std::endl
<< "Optionally multiply this automaton by another"
<< " automaton read from a file." << std::endl
<< "Output the result in various formats, or perform an emptiness "
<< "check." << std::endl
<< std::endl
<< "Input options:" << std::endl
<< " -F read the formula from a file, not from the command line"
<< std::endl
<< " -X do not compute an automaton, read it from a file"
<< std::endl
<< " -XN do not compute an automaton, read it from a"
<< " neverclaim file" << std::endl
<< " -Pfile multiply the formula automaton with the TGBA read"
<< " from `file'\n"
<< " -KPfile multiply the formula automaton with the Kripke"
<< " structure from `file'\n"
<< std::endl
<< "Translation algorithm:" << std::endl
<< " -f use Couvreur's FM algorithm for LTL"
<< " (default)" << std::endl
<< " -l use Couvreur's LaCIM algorithm for LTL "
<< std::endl
<< " -le use Couvreur's LaCIM algorithm for ELTL"
<< std::endl
<< " -taa use Tauriainen's TAA-based algorithm for LTL"
<< std::endl
<< std::endl
<< "Options for Couvreur's FM algorithm (-f):" << std::endl
<< " -fr reduce formula at each step of FM" << std::endl
<< " as specified with the -r{1..7} options" << std::endl
<< " -L fair-loop approximation (implies -f)" << std::endl
<< " -p branching postponement (implies -f)" << std::endl
<< " -U[PROPS] consider atomic properties of the formula as "
<< "exclusive events, and" << std::endl
<< " PROPS as unobservables events (implies -f)"
<< std::endl
<< " -x try to produce a more deterministic automaton "
<< "(implies -f)" << std::endl
<< " -y do not merge states with same symbolic representation "
<< "(implies -f)" << std::endl
<< std::endl
<< "Options for Couvreur's LaCIM algorithm (-l or -le):"
<< std::endl
<< " -a display the acceptance_conditions BDD, not the "
<< "reachability graph"
<< std::endl
<< " -A same as -a, but as a set" << std::endl
<< " -lo pre-define standard LTL operators as automata "
<< "(implies -le)" << std::endl
<< " -r display the relation BDD, not the reachability graph"
<< std::endl
<< " -R same as -r, but as a set" << std::endl
<< " -R3b symbolically prune unaccepting SCC from BDD relation"
<< std::endl
<< std::endl
<< "Options for Tauriainen's TAA-based algorithm (-taa):"
<< std::endl
<< " -c enable language containment checks (implies -taa)"
<< std::endl
<< std::endl
<< "Formula simplification (before translation):"
<< std::endl
<< " -r1 reduce formula using basic rewriting" << std::endl
<< " -r2 reduce formula using class of eventuality and "
<< "universality" << std::endl
<< " -r3 reduce formula using implication between "
<< "sub-formulae" << std::endl
<< " -r4 reduce formula using all above rules" << std::endl
<< " -r5 reduce formula using tau03" << std::endl
<< " -r6 reduce formula using tau03+" << std::endl
<< " -r7 reduce formula using tau03+ and -r4" << std::endl
<< " -rd display the reduced formula" << std::endl
<< " -rD dump statistics about the simplifier cache" << std::endl
<< " -rL disable basic rewritings producing larger formulas"
<< std::endl << std::endl
<< "Automaton degeneralization (after translation):"
<< std::endl
<< " -lS move generalized acceptance conditions to states "
<< "(SGBA)" << std::endl
<< " -D degeneralize the automaton as a TBA" << std::endl
<< " -DS degeneralize the automaton as an SBA" << std::endl
<< std::endl
<< "Automaton simplifications (after translation):"
<< std::endl
<< " -R3 use SCC to reduce the automaton" << std::endl
<< " -R3f clean more acceptance conditions than -R3" << std::endl
<< " "
<< "(prefer -R3 over -R3f if you degeneralize with -D, -DS, or -N)"
<< std::endl
<< " -RDS reduce the automaton with direct simulation"
<< std::endl
<< " -RRS reduce the automaton with reverse simulation"
<< std::endl
<< " -RIS iterate both direct and reverse simulations"
<< std::endl
<< " -Rm attempt to WDBA-minimize the automaton" << std::endl
<< std::endl
<< " -RM attempt to WDBA-minimize the automaton unless the "
<< "result is bigger" << std::endl
<< std::endl
<< "Automaton conversion:" << std::endl
<< " -M convert into a deterministic minimal monitor "
<< "(implies -R3 or R3b)" << std::endl
<< " -s convert to explicit automaton, and number states "
<< "in DFS order" << std::endl
<< " -S convert to explicit automaton, and number states "
<< "in BFS order" << std::endl
<< std::endl
<< "Conversion to Testing Automaton:" << std::endl
<< " -TA output a Generalized Testing Automaton (GTA),\n"
<< " or a Testing Automaton (TA) with -DS\n"
<< " -lv add an artificial livelock state to obtain a "
<< "Single-pass (G)TA\n"
<< " -sp convert into a single-pass (G)TA without artificial "
<< "livelock state\n"
<< " -in do not use an artificial initial state\n"
<< " -TGTA output a Transition-based Generalized TA"
<< std::endl
<< " -RT reduce the (G)TA/TGTA using bisimulation.\n"
<< std::endl
<< "Options for performing emptiness checks (on TGBA):" << std::endl
<< " -e[ALGO] run emptiness check, expect and compute an "
<< "accepting run" << std::endl
<< " -E[ALGO] run emptiness check, expect no accepting run"
<< std::endl
<< " -C compute an accepting run (Counterexample) if it exists"
<< std::endl
<< " -CR compute and replay an accepting run (implies -C)"
<< std::endl
<< " -g graph the accepting run on the automaton (requires -e)"
<< std::endl
<< " -G graph the accepting run seen as an automaton "
<< " (requires -e)" << std::endl
<< " -m try to reduce accepting runs, in a second pass"
<< std::endl
<< "Where ALGO should be one of:" << std::endl
<< " Cou99(OPTIONS) (the default)" << std::endl
<< " CVWY90(OPTIONS)" << std::endl
<< " GV04(OPTIONS)" << std::endl
<< " SE05(OPTIONS)" << std::endl
<< " Tau03(OPTIONS)" << std::endl
<< " Tau03_opt(OPTIONS)" << std::endl
<< std::endl
<< "If no emptiness check is run, the automaton will be output "
<< "in dot format" << std::endl << "by default. This can be "
<< "changed with the following options." << std::endl
<< std::endl
<< "Output options (if no emptiness check):" << std::endl
<< " -b output the automaton in the format of spot"
<< std::endl
<< " -FC dump the automaton showing future conditions on states"
<< std::endl
<< " -k display statistics on the automaton (size and SCCs)"
<< std::endl
<< " -ks display statistics on the automaton (size only)"
<< std::endl
<< " -kt display statistics on the automaton (size + "
<< "subtransitions)"
<< std::endl
<< " -K dump the graph of SCCs in dot format" << std::endl
<< " -KV verbosely dump the graph of SCCs in dot format"
<< std::endl
<< " -KC list cycles in automaton" << std::endl
<< " -KW list weak SCCs" << std::endl
<< " -N output the never clain for Spin (implies -DS)"
<< std::endl
<< " -NN output the never clain for Spin, with commented states"
<< " (implies -DS)" << std::endl
<< " -O tell if a formula represents a safety, guarantee, "
<< "or obligation property"
<< std::endl
<< " -t output automaton in LBTT's format" << std::endl
<< std::endl
<< "Miscellaneous options:" << std::endl
<< " -0 produce minimal output dedicated to the paper"
<< std::endl
<< " -8 output UTF-8 formulae" << std::endl
<< " -d turn on traces during parsing" << std::endl
<< " -T time the different phases of the translation"
<< std::endl
<< " -v display the BDD variables used by the automaton"
<< std::endl
<< std::endl;
exit(2);
}
int
main(int argc, char** argv)
{
int exit_code = 0;
bool debug_opt = false;
bool paper_opt = false;
bool utf8_opt = false;
enum { NoDegen, DegenTBA, DegenSBA } degeneralize_opt = NoDegen;
enum { TransitionLabeled, StateLabeled } labeling_opt = TransitionLabeled;
enum { TransFM, TransLaCIM, TransLaCIM_ELTL, TransLaCIM_ELTL_ops, TransTAA }
translation = TransFM;
bool fm_red = false;
bool fm_exprop_opt = false;
bool fm_symb_merge_opt = true;
bool file_opt = false;
int output = 0;
int formula_index = 0;
const char* echeck_algo = 0;
spot::emptiness_check_instantiator* echeck_inst = 0;
enum { NoneDup, BFS, DFS } dupexp = NoneDup;
bool expect_counter_example = false;
bool accepting_run = false;
bool accepting_run_replay = false;
bool from_file = false;
bool read_neverclaim = false;
bool scc_filter = false;
bool simpltl = false;
spot::ltl::ltl_simplifier_options redopt(false, false, false, false,
false, false, false);
bool simpcache_stats = false;
bool scc_filter_all = false;
bool symbolic_scc_pruning = false;
bool display_reduced_form = false;
bool post_branching = false;
bool fair_loop_approx = false;
bool graph_run_opt = false;
bool graph_run_tgba_opt = false;
bool opt_reduce = false;
bool opt_minimize = false;
bool reject_bigger = false;
bool opt_bisim_ta = false;
bool opt_monitor = false;
bool containment = false;
bool show_fc = false;
bool spin_comments = false;
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::ltl::atomic_prop_set* unobservables = 0;
spot::tgba* system = 0;
const spot::tgba* product = 0;
const spot::tgba* product_to_free = 0;
spot::bdd_dict* dict = new spot::bdd_dict();
spot::timer_map tm;
bool use_timer = false;
bool assume_sba = false;
bool reduction_dir_sim = false;
bool reduction_rev_sim = false;
bool reduction_iterated_sim = false;
spot::tgba* temp_dir_sim = 0;
bool ta_opt = false;
bool tgta_opt = false;
bool opt_with_artificial_initial_state = true;
bool opt_single_pass_emptiness_check = false;
bool opt_with_artificial_livelock = false;
spot::tgba* temp_rev_sim = 0;
spot::tgba* temp_iterated_sim = 0;
for (;;)
{
if (argc < formula_index + 2)
syntax(argv[0]);
++formula_index;
if (!strcmp(argv[formula_index], "-0"))
{
paper_opt = true;
}
else if (!strcmp(argv[formula_index], "-8"))
{
utf8_opt = true;
spot::enable_utf8();
}
else if (!strcmp(argv[formula_index], "-a"))
{
output = 2;
}
else if (!strcmp(argv[formula_index], "-A"))
{
output = 4;
}
else if (!strcmp(argv[formula_index], "-b"))
{
output = 7;
}
else if (!strcmp(argv[formula_index], "-c"))
{
containment = true;
translation = TransTAA;
}
else if (!strcmp(argv[formula_index], "-C"))
{
accepting_run = true;
}
else if (!strcmp(argv[formula_index], "-CR"))
{
accepting_run = true;
accepting_run_replay = true;
}
else if (!strcmp(argv[formula_index], "-d"))
{
debug_opt = true;
}
else if (!strcmp(argv[formula_index], "-D"))
{
degeneralize_opt = DegenTBA;
}
else if (!strcmp(argv[formula_index], "-DS"))
{
degeneralize_opt = DegenSBA;
}
else if (!strncmp(argv[formula_index], "-e", 2))
{
echeck_algo = 2 + argv[formula_index];
if (!*echeck_algo)
echeck_algo = "Cou99";
const char* err;
echeck_inst =
spot::emptiness_check_instantiator::construct(echeck_algo, &err);
if (!echeck_inst)
{
std::cerr << "Failed to parse argument of -e near `"
<< err << "'" << std::endl;
exit(2);
}
expect_counter_example = true;
output = -1;
}
else if (!strncmp(argv[formula_index], "-E", 2))
{
const char* echeck_algo = 2 + argv[formula_index];
if (!*echeck_algo)
echeck_algo = "Cou99";
const char* err;
echeck_inst =
spot::emptiness_check_instantiator::construct(echeck_algo, &err);
if (!echeck_inst)
{
std::cerr << "Failed to parse argument of -e near `"
<< err << "'" << std::endl;
exit(2);
}
expect_counter_example = false;
output = -1;
}
else if (!strcmp(argv[formula_index], "-f"))
{
translation = TransFM;
}
else if (!strcmp(argv[formula_index], "-fr"))
{
fm_red = true;
translation = TransFM;
}
else if (!strcmp(argv[formula_index], "-F"))
{
file_opt = true;
}
else if (!strcmp(argv[formula_index], "-FC"))
{
show_fc = true;
}
else if (!strcmp(argv[formula_index], "-g"))
{
accepting_run = true;
graph_run_opt = true;
}
else if (!strcmp(argv[formula_index], "-G"))
{
accepting_run = true;
graph_run_tgba_opt = true;
}
else if (!strcmp(argv[formula_index], "-k"))
{
output = 9;
}
else if (!strcmp(argv[formula_index], "-ks"))
{
output = 12;
}
else if (!strcmp(argv[formula_index], "-kt"))
{
output = 13;
}
else if (!strcmp(argv[formula_index], "-K"))
{
output = 10;
}
else if (!strncmp(argv[formula_index], "-KP", 3))
{
tm.start("reading -KP's argument");
spot::kripke_parse_error_list pel;
system = spot::kripke_parse(argv[formula_index] + 3,
pel, dict, env, debug_opt);
if (spot::format_kripke_parse_errors(std::cerr,
argv[formula_index] + 2, pel))
return 2;
tm.stop("reading -KP's argument");
}
else if (!strcmp(argv[formula_index], "-KV"))
{
output = 11;
}
else if (!strcmp(argv[formula_index], "-KC"))
{
output = 15;
}
else if (!strcmp(argv[formula_index], "-KW"))
{
output = 16;
}
else if (!strcmp(argv[formula_index], "-l"))
{
translation = TransLaCIM;
}
else if (!strcmp(argv[formula_index], "-le"))
{
/* -lo is documented to imply -le, so do not overwrite it. */
if (translation != TransLaCIM_ELTL_ops)
translation = TransLaCIM_ELTL;
}
else if (!strcmp(argv[formula_index], "-lo"))
{
translation = TransLaCIM_ELTL_ops;
}
else if (!strcmp(argv[formula_index], "-L"))
{
fair_loop_approx = true;
translation = TransFM;
}
else if (!strcmp(argv[formula_index], "-lS"))
{
labeling_opt = StateLabeled;
}
else if (!strcmp(argv[formula_index], "-m"))
{
opt_reduce = true;
}
else if (!strcmp(argv[formula_index], "-N"))
{
degeneralize_opt = DegenSBA;
output = 8;
}
else if (!strcmp(argv[formula_index], "-NN"))
{
degeneralize_opt = DegenSBA;
output = 8;
spin_comments = true;
}
else if (!strcmp(argv[formula_index], "-O"))
{
output = 14;
opt_minimize = true;
}
else if (!strcmp(argv[formula_index], "-p"))
{
post_branching = true;
translation = TransFM;
}
else if (!strncmp(argv[formula_index], "-P", 2))
{
tm.start("reading -P's argument");
spot::tgba_parse_error_list pel;
spot::tgba_explicit_string* s;
s = spot::tgba_parse(argv[formula_index] + 2,
pel, dict, env, env, debug_opt);
if (spot::format_tgba_parse_errors(std::cerr,
argv[formula_index] + 2, pel))
return 2;
s->merge_transitions();
tm.stop("reading -P's argument");
system = s;
}
else if (!strcmp(argv[formula_index], "-r"))
{
output = 1;
}
else if (!strcmp(argv[formula_index], "-r1"))
{
simpltl = true;
redopt.reduce_basics = true;
}
else if (!strcmp(argv[formula_index], "-r2"))
{
simpltl = true;
redopt.event_univ = true;
}
else if (!strcmp(argv[formula_index], "-r3"))
{
simpltl = true;
redopt.synt_impl = true;
}
else if (!strcmp(argv[formula_index], "-r4"))
{
simpltl = true;
redopt.reduce_basics = true;
redopt.event_univ = true;
redopt.synt_impl = true;
}
else if (!strcmp(argv[formula_index], "-r5"))
{
simpltl = true;
redopt.containment_checks = true;
}
else if (!strcmp(argv[formula_index], "-r6"))
{
simpltl = true;
redopt.containment_checks = true;
redopt.containment_checks_stronger = true;
}
else if (!strcmp(argv[formula_index], "-r7"))
{
simpltl = true;
redopt.reduce_basics = true;
redopt.event_univ = true;
redopt.synt_impl = true;
redopt.containment_checks = true;
redopt.containment_checks_stronger = true;
}
else if (!strcmp(argv[formula_index], "-R"))
{
output = 3;
}
else if (!strcmp(argv[formula_index], "-R1q")
|| !strcmp(argv[formula_index], "-R1t")
|| !strcmp(argv[formula_index], "-R2q")
|| !strcmp(argv[formula_index], "-R2t"))
{
// For backward compatibility, make all these options
// equal to -RDS.
reduction_dir_sim = true;
}
else if (!strcmp(argv[formula_index], "-RRS"))
{
reduction_rev_sim = true;
}
else if (!strcmp(argv[formula_index], "-R3"))
{
scc_filter = true;
}
else if (!strcmp(argv[formula_index], "-R3f"))
{
scc_filter = true;
scc_filter_all = true;
}
else if (!strcmp(argv[formula_index], "-R3b"))
{
symbolic_scc_pruning = true;
}
else if (!strcmp(argv[formula_index], "-rd"))
{
display_reduced_form = true;
}
else if (!strcmp(argv[formula_index], "-rD"))
{
simpcache_stats = true;
}
else if (!strcmp(argv[formula_index], "-RDS"))
{
reduction_dir_sim = true;
}
else if (!strcmp(argv[formula_index], "-RIS"))
{
reduction_iterated_sim = true;
}
else if (!strcmp(argv[formula_index], "-rL"))
{
simpltl = true;
redopt.reduce_basics = true;
redopt.reduce_size_strictly = true;
}
else if (!strcmp(argv[formula_index], "-Rm"))
{
opt_minimize = true;
}
else if (!strcmp(argv[formula_index], "-RM"))
{
opt_minimize = true;
reject_bigger = true;
}
else if (!strcmp(argv[formula_index], "-RT"))
{
opt_bisim_ta = true;
}
else if (!strcmp(argv[formula_index], "-M"))
{
opt_monitor = true;
}
else if (!strcmp(argv[formula_index], "-s"))
{
dupexp = DFS;
}
else if (!strcmp(argv[formula_index], "-S"))
{
dupexp = BFS;
}
else if (!strcmp(argv[formula_index], "-t"))
{
output = 6;
}
else if (!strcmp(argv[formula_index], "-T"))
{
use_timer = true;
}
else if (!strcmp(argv[formula_index], "-TA"))
{
ta_opt = true;
}
else if (!strcmp(argv[formula_index], "-TGTA"))
{
tgta_opt = true;
}
else if (!strcmp(argv[formula_index], "-lv"))
{
opt_with_artificial_livelock = true;
}
else if (!strcmp(argv[formula_index], "-sp"))
{
opt_single_pass_emptiness_check = true;
}
else if (!strcmp(argv[formula_index], "-in"))
{
opt_with_artificial_initial_state = false;
}
else if (!strcmp(argv[formula_index], "-taa"))
{
translation = TransTAA;
}
else if (!strncmp(argv[formula_index], "-U", 2))
{
unobservables = new spot::ltl::atomic_prop_set;
translation = TransFM;
// Parse -U's argument.
const char* tok = strtok(argv[formula_index] + 2, ", \t;");
while (tok)
{
unobservables->insert
(static_cast<const spot::ltl::atomic_prop*>(env.require(tok)));
tok = strtok(0, ", \t;");
}
}
else if (!strcmp(argv[formula_index], "-v"))
{
output = 5;
}
else if (!strcmp(argv[formula_index], "-x"))
{
translation = TransFM;
fm_exprop_opt = true;
}
else if (!strcmp(argv[formula_index], "-X"))
{
from_file = true;
}
else if (!strcmp(argv[formula_index], "-XN"))
{
from_file = true;
read_neverclaim = true;
}
else if (!strcmp(argv[formula_index], "-y"))
{
translation = TransFM;
fm_symb_merge_opt = false;
}
else
{
break;
}
}
if ((graph_run_opt || graph_run_tgba_opt)
&& (!echeck_inst || !expect_counter_example))
{
std::cerr << argv[0] << ": error: -g and -G require -e." << std::endl;
exit(1);
}
std::string input;
if (file_opt)
{
tm.start("reading formula");
if (strcmp(argv[formula_index], "-"))
{
std::ifstream fin(argv[formula_index]);
if (!fin)
{
std::cerr << "Cannot open " << argv[formula_index] << std::endl;
exit(2);
}
if (!std::getline(fin, input, '\0'))
{
std::cerr << "Cannot read " << argv[formula_index] << std::endl;
exit(2);
}
}
else
{
std::getline(std::cin, input, '\0');
}
tm.stop("reading formula");
}
else
{
input = argv[formula_index];
}
const spot::ltl::formula* f = 0;
if (!from_file) // Reading a formula, not reading an automaton from a file.
{
switch (translation)
{
case TransFM:
case TransLaCIM:
case TransTAA:
{
spot::ltl::parse_error_list pel;
tm.start("parsing formula");
f = spot::ltl::parse(input, pel, env, debug_opt);
tm.stop("parsing formula");
exit_code = spot::ltl::format_parse_errors(std::cerr, input, pel);
}
break;
case TransLaCIM_ELTL:
{
spot::eltl::parse_error_list p;
tm.start("parsing formula");
f = spot::eltl::parse_string(input, p, env, false);
tm.stop("parsing formula");
exit_code = spot::eltl::format_parse_errors(std::cerr, p);
}
break;
case TransLaCIM_ELTL_ops:
{
// Call the LTL parser first to handle operators such as
// [] or <> and rewrite the output as a string with G or F.
// Then prepend definitions of usual LTL operators, and parse
// the result again as an ELTL formula.
spot::ltl::parse_error_list pel;
tm.start("parsing formula");
f = spot::ltl::parse(input, pel, env, debug_opt);
input = ltl_defs();
input += "%";
input += spot::ltl::to_string(f, true);
f->destroy();
spot::eltl::parse_error_list p;
f = spot::eltl::parse_string(input, p, env, debug_opt);
tm.stop("parsing formula");
exit_code = spot::eltl::format_parse_errors(std::cerr, p);
}
break;
}
}
if (f || from_file)
{
spot::tgba_bdd_concrete* concrete = 0;
const spot::tgba* to_free = 0;
const spot::tgba* to_free2 = 0;
spot::tgba* a = 0;
if (from_file)
{
spot::tgba_explicit_string* e;
if (!read_neverclaim)
{
spot::tgba_parse_error_list pel;
tm.start("parsing automaton");
to_free = a = e = spot::tgba_parse(input, pel, dict,
env, env, debug_opt);
tm.stop("parsing automaton");
if (spot::format_tgba_parse_errors(std::cerr, input, pel))
{
delete to_free;
delete dict;
return 2;
}
}
else
{
spot::neverclaim_parse_error_list pel;
tm.start("parsing neverclaim");
to_free = a = e = spot::neverclaim_parse(input, pel, dict,
env, debug_opt);
tm.stop("parsing neverclaim");
if (spot::format_neverclaim_parse_errors(std::cerr, input, pel))
{
delete to_free;
delete dict;
return 2;
}
assume_sba = true;
}
e->merge_transitions();
}
else
{
spot::ltl::ltl_simplifier* simp = 0;
if (simpltl)
simp = new spot::ltl::ltl_simplifier(redopt, dict);
if (simp)
{
tm.start("reducing formula");
const spot::ltl::formula* t = simp->simplify(f);
f->destroy();
tm.stop("reducing formula");
f = t;
if (display_reduced_form)
{
if (utf8_opt)
std::cout << spot::ltl::to_utf8_string(f) << std::endl;
else
std::cout << spot::ltl::to_string(f) << std::endl;
}
// This helps ltl_to_tgba_fm() to order BDD variables in
// a more natural way.
simp->clear_as_bdd_cache();
}
if (f->is_psl_formula()
&& !f->is_ltl_formula()
&& translation != TransFM)
{
std::cerr << "Only the FM algorithm can translate PSL formulae;"
<< " I'm using it for this formula." << std::endl;
translation = TransFM;
}
tm.start("translating formula");
switch (translation)
{
case TransFM:
a = spot::ltl_to_tgba_fm(f, dict, fm_exprop_opt,
fm_symb_merge_opt,
post_branching,
fair_loop_approx,
unobservables,
fm_red ? simp : 0);
break;
case TransTAA:
a = spot::ltl_to_taa(f, dict, containment);
break;
case TransLaCIM:
a = concrete = spot::ltl_to_tgba_lacim(f, dict);
break;
case TransLaCIM_ELTL:
case TransLaCIM_ELTL_ops:
a = concrete = spot::eltl_to_tgba_lacim(f, dict);
break;
}
tm.stop("translating formula");
to_free = a;
if (simp && simpcache_stats)
{
simp->print_stats(std::cerr);
bddStat s;
bdd_stats(&s);
std::cerr << "BDD produced: " << s.produced
<< "\n nodenum: " << s.nodenum
<< "\n maxnodenum: " << s.maxnodenum
<< "\n freenodes: " << s.freenodes
<< "\n minfreenodes: " << s.minfreenodes
<< "\n varnum: " << s.varnum
<< "\n cachesize: " << s.cachesize
<< "\n gbcnum: " << s.gbcnum
<< std::endl;
bdd_fprintstat(stderr);
dict->dump(std::cerr);
}
delete simp;
}
if (opt_monitor && !scc_filter)
{
if (dynamic_cast<const spot::tgba_bdd_concrete*>(a))
symbolic_scc_pruning = true;
else
scc_filter = true;
}
if (symbolic_scc_pruning)
{
const spot::tgba_bdd_concrete* bc =
dynamic_cast<const spot::tgba_bdd_concrete*>(a);
if (!bc)
{
std::cerr << ("Error: Automaton is not symbolic: cannot "
"prune SCCs symbolically.\n"
" Try -R3 instead of -R3b, or use "
"another translation.")
<< std::endl;
exit(2);
}
else
{
tm.start("reducing A_f w/ symbolic SCC pruning");
if (bc)
const_cast<spot::tgba_bdd_concrete*>(bc)
->delete_unaccepting_scc();
tm.stop("reducing A_f w/ symbolic SCC pruning");
}
}
// Remove dead SCCs and useless acceptance conditions before
// degeneralization.
const spot::tgba* aut_scc = 0;
if (scc_filter)
{
tm.start("SCC-filter");
aut_scc = a = spot::scc_filter(a, scc_filter_all);
tm.stop("SCC-filter");
assume_sba = false;
}
const spot::tgba* degeneralized = 0;
spot::tgba* minimized = 0;
if (opt_minimize)
{
tm.start("obligation minimization");
minimized = minimize_obligation(a, f, 0, reject_bigger);
tm.stop("obligation minimization");
if (minimized == 0)
{
// if (!f)
{
std::cerr << "Error: Without a formula I cannot make "
<< "sure that the automaton built with -Rm\n"
<< " is correct." << std::endl;
exit(2);
}
}
else if (minimized == a)
{
minimized = 0;
}
else
{
a = minimized;
// When the minimization succeed, simulation is useless.
reduction_dir_sim = false;
reduction_rev_sim = false;
assume_sba = true;
}
}
if (reduction_dir_sim && !reduction_iterated_sim)
{
tm.start("direct simulation");
temp_dir_sim = spot::simulation(a);
a = temp_dir_sim;
tm.stop("direct simulation");
assume_sba = false;
}
if (reduction_rev_sim && !reduction_iterated_sim)
{
tm.start("reverse simulation");
temp_rev_sim = spot::cosimulation(a);
a = temp_rev_sim;
tm.stop("reverse simulation");
assume_sba = false;
}
if (reduction_iterated_sim)
{
tm.start("Reduction w/ iterated simulations");
temp_iterated_sim = spot::iterated_simulations(a);
a = temp_iterated_sim;
tm.stop("Reduction w/ iterated simulations");
assume_sba = false;
}
if (scc_filter && (reduction_dir_sim || reduction_rev_sim))
{
tm.start("SCC-filter post-sim");
delete aut_scc;
aut_scc = a = spot::scc_filter(a, scc_filter_all);
tm.stop("SCC-filter post-sim");
}
unsigned int n_acc = a->number_of_acceptance_conditions();
if (echeck_inst
&& degeneralize_opt == NoDegen
&& n_acc > 1
&& echeck_inst->max_acceptance_conditions() < n_acc)
{
degeneralize_opt = DegenTBA;
assume_sba = false;
}
if (!assume_sba && !opt_monitor)
{
if (degeneralize_opt == DegenTBA)
{
degeneralized = a = new spot::tgba_tba_proxy(a);
}
else if (degeneralize_opt == DegenSBA)
{
tm.start("degeneralization");
degeneralized = a = spot::degeneralize(a);
tm.stop("degeneralization");
assume_sba = true;
}
else if (labeling_opt == StateLabeled)
{
degeneralized = a = new spot::tgba_sgba_proxy(a);
}
}
if (opt_monitor)
{
tm.start("Monitor minimization");
minimized = a = minimize_monitor(a);
tm.stop("Monitor minimization");
assume_sba = false; // All states are accepting, so double
// circles in the dot output are
// pointless.
}
const spot::tgba* expl = 0;
switch (dupexp)
{
case NoneDup:
break;
case BFS:
expl = a = tgba_dupexp_bfs(a);
break;
case DFS:
expl = a = tgba_dupexp_dfs(a);
break;
}
//TA, STA, GTA, SGTA and TGTA
if (ta_opt || tgta_opt)
{
bdd atomic_props_set_bdd = atomic_prop_collect_as_bdd(f, a);
if (ta_opt)
{
spot::ta* testing_automaton = 0;
tm.start("conversion to TA");
testing_automaton
= tgba_to_ta(a, atomic_props_set_bdd, degeneralize_opt
== DegenSBA, opt_with_artificial_initial_state,
opt_single_pass_emptiness_check,
opt_with_artificial_livelock);
tm.stop("conversion to TA");
spot::ta* testing_automaton_nm = 0;
if (opt_bisim_ta)
{
tm.start("TA bisimulation");
testing_automaton_nm = testing_automaton;
testing_automaton = minimize_ta(testing_automaton);
tm.stop("TA bisimulation");
}
if (output != -1)
{
tm.start("producing output");
switch (output)
{
case 0:
spot::dotty_reachable(std::cout, testing_automaton);
break;
case 12:
stats_reachable(testing_automaton).dump(std::cout);
break;
default:
std::cerr << "unsupported output option" << std::endl;
exit(1);
}
tm.stop("producing output");
}
delete testing_automaton_nm;
delete testing_automaton;
delete a;
a = 0;
degeneralized = 0;
if (degeneralize_opt != DegenSBA)
to_free = 0;
output = -1;
}
if (tgta_opt)
{
spot::tgta_explicit* tgta = tgba_to_tgta(a, atomic_props_set_bdd);
if (opt_bisim_ta)
{
tm.start("TA bisimulation");
a = minimize_tgta(tgta);
tm.stop("TA bisimulation");
delete tgta;
}
else
{
a = tgta;
}
to_free2 = a;
if (output != -1)
{
tm.start("producing output");
switch (output)
{
case 0:
spot::dotty_reachable(std::cout,
dynamic_cast<spot::tgta_explicit*>(a)->get_ta());
break;
case 12:
stats_reachable(a).dump(std::cout);
break;
default:
std::cerr << "unsupported output option" << std::endl;
exit(1);
}
tm.stop("producing output");
}
output = -1;
}
}
spot::tgba* product_degeneralized = 0;
if (system)
{
product = product_to_free = a = new spot::tgba_product(system, a);
assume_sba = false;
unsigned int n_acc = a->number_of_acceptance_conditions();
if (echeck_inst
&& degeneralize_opt == NoDegen
&& n_acc > 1
&& echeck_inst->max_acceptance_conditions() < n_acc)
degeneralize_opt = DegenTBA;
if (degeneralize_opt == DegenTBA)
{
product = product_degeneralized = a =
new spot::tgba_tba_proxy(product);
}
else if (degeneralize_opt == DegenSBA)
{
tm.start("degeneralize product");
product = product_degeneralized = a =
spot::degeneralize(product);
tm.stop("degeneralize product");
assume_sba = true;
}
}
if (echeck_inst
&& (a->number_of_acceptance_conditions()
< echeck_inst->min_acceptance_conditions()))
{
if (!paper_opt)
{
std::cerr << echeck_algo << " requires at least "
<< echeck_inst->min_acceptance_conditions()
<< " acceptance conditions." << std::endl;
exit(1);
}
else
{
std::cout << std::endl;
exit(0);
}
}
if (show_fc)
{
a = new spot::future_conditions_collector(a, true);
}
if (utf8_opt)
{
if (spot::tgba_explicit_formula* tef =
dynamic_cast<spot::tgba_explicit_formula*>(a))
tef->enable_utf8();
else if (spot::sba_explicit_formula* sef =
dynamic_cast<spot::sba_explicit_formula*>(a))
sef->enable_utf8();
}
if (output != -1)
{
tm.start("producing output");
switch (output)
{
case 0:
spot::dotty_reachable(std::cout, a, assume_sba);
break;
case 1:
if (concrete)
spot::bdd_print_dot(std::cout, concrete->get_dict(),
concrete->get_core_data().relation);
break;
case 2:
if (concrete)
spot::bdd_print_dot(std::cout, concrete->get_dict(),
concrete->
get_core_data().acceptance_conditions);
break;
case 3:
if (concrete)
spot::bdd_print_set(std::cout, concrete->get_dict(),
concrete->get_core_data().relation);
break;
case 4:
if (concrete)
spot::bdd_print_set(std::cout, concrete->get_dict(),
concrete->
get_core_data().acceptance_conditions);
break;
case 5:
a->get_dict()->dump(std::cout);
break;
case 6:
spot::lbtt_reachable(std::cout, a);
break;
case 7:
spot::tgba_save_reachable(std::cout, a);
break;
case 8:
{
assert(degeneralize_opt == DegenSBA);
if (assume_sba || dynamic_cast<const spot::tgba_sba_proxy*>(a))
spot::never_claim_reachable(std::cout, a, f, spin_comments);
else
{
// It is possible that we have applied other
// operations to the automaton since its initial
// degeneralization. Let's degeneralize again!
spot::unique_ptr<spot::tgba> s(spot::degeneralize(a));
spot::never_claim_reachable(std::cout, s, f, spin_comments);
}
break;
}
case 9:
stats_reachable(a).dump(std::cout);
build_scc_stats(a).dump(std::cout);
break;
case 10:
dump_scc_dot(a, std::cout, false);
break;
case 11:
dump_scc_dot(a, std::cout, true);
break;
case 12:
stats_reachable(a).dump(std::cout);
break;
case 13:
sub_stats_reachable(a).dump(std::cout);
std::cout << "nondeterministic states: "
<< count_nondet_states(a) << std::endl;
break;
case 14:
if (minimized == 0)
{
std::cout << "this is not an obligation property";
}
else
{
bool g = is_guarantee_automaton(minimized);
bool s = is_safety_mwdba(minimized);
if (g && !s)
{
std::cout << "this is a guarantee property (hence, "
<< "an obligation property)";
}
else if (s && !g)
{
std::cout << "this is a safety property (hence, "
<< "an obligation property)";
}
else if (s && g)
{
std::cout << "this is a guarantee and a safety property"
<< " (and of course an obligation property)";
}
else
{
std::cout << "this is an obligation property that is "
<< "neither a safety nor a guarantee";
}
}
std::cout << std::endl;
break;
case 15:
{
spot::scc_map m(a);
m.build_map();
spot::enumerate_cycles c(m);
unsigned max = m.scc_count();
for (unsigned n = 0; n < max; ++n)
{
std::cout << "Cycles in SCC #" << n << std::endl;
c.run(n);
}
break;
}
case 16:
{
spot::scc_map m(a);
m.build_map();
unsigned max = m.scc_count();
for (unsigned n = 0; n < max; ++n)
{
bool w = spot::is_weak_scc(m, n);
std::cout << "SCC #" << n
<< (w ? " is weak" : " is not weak")
<< std::endl;
}
break;
}
default:
assert(!"unknown output option");
}
tm.stop("producing output");
}
if (echeck_inst)
{
spot::emptiness_check* ec = echeck_inst->instantiate(a);
bool search_many = echeck_inst->options().get("repeated");
assert(ec);
do
{
tm.start("running emptiness check");
spot::emptiness_check_result* res = ec->check();
tm.stop("running emptiness check");
if (paper_opt)
{
std::ios::fmtflags old = std::cout.flags();
std::cout << std::left << std::setw(25)
<< echeck_algo << ", ";
spot::tgba_statistics a_size =
spot::stats_reachable(ec->automaton());
std::cout << std::right << std::setw(10)
<< a_size.states << ", "
<< std::right << std::setw(10)
<< a_size.transitions << ", ";
std::cout <<
ec->automaton()->number_of_acceptance_conditions()
<< ", ";
const spot::ec_statistics* ecs =
dynamic_cast<const spot::ec_statistics*>(ec);
if (ecs)
std::cout << std::right << std::setw(10)
<< ecs->states() << ", "
<< std::right << std::setw(10)
<< ecs->transitions() << ", "
<< std::right << std::setw(10)
<< ecs->max_depth();
else
std::cout << "no stats, , ";
if (res)
std::cout << ", accepting run found";
else
std::cout << ", no accepting run found";
std::cout << std::endl;
std::cout << std::setiosflags(old);
}
else
{
if (!graph_run_opt && !graph_run_tgba_opt)
ec->print_stats(std::cout);
if (expect_counter_example != !!res &&
(!expect_counter_example || ec->safe()))
exit_code = 1;
if (!res)
{
std::cout << "no accepting run found";
if (!ec->safe() && expect_counter_example)
{
std::cout << " even if expected" << std::endl;
std::cout << "this may be due to the use of the bit"
<< " state hashing technique" << std::endl;
std::cout << "you can try to increase the heap size "
<< "or use an explicit storage"
<< std::endl;
}
std::cout << std::endl;
break;
}
else if (accepting_run)
{
tm.start("computing accepting run");
spot::tgba_run* run = res->accepting_run();
tm.stop("computing accepting run");
if (!run)
{
std::cout << "an accepting run exists" << std::endl;
}
else
{
if (opt_reduce)
{
tm.start("reducing accepting run");
spot::tgba_run* redrun =
spot::reduce_run(res->automaton(), run);
tm.stop("reducing accepting run");
delete run;
run = redrun;
}
if (accepting_run_replay)
{
tm.start("replaying acc. run");
if (!spot::replay_tgba_run(std::cout, a,
run, true))
exit_code = 1;
tm.stop("replaying acc. run");
}
else
{
tm.start("printing accepting run");
if (graph_run_opt)
{
spot::tgba_run_dotty_decorator deco(run);
spot::dotty_reachable(std::cout, a,
assume_sba, &deco);
}
else if (graph_run_tgba_opt)
{
spot::unique_ptr<spot::tgba>
ar(spot::tgba_run_to_tgba(a, run));
spot::dotty_reachable(std::cout, ar, false);
}
else
{
spot::print_tgba_run(std::cout, a, run);
}
tm.stop("printing accepting run");
}
delete run;
}
}
else
{
std::cout << "an accepting run exists "
<< "(use -C to print it)" << std::endl;
}
}
delete res;
}
while (search_many);
delete ec;
}
delete to_free2;
if (show_fc)
delete a;
if (f)
f->destroy();
delete product_degeneralized;
delete product_to_free;
delete system;
delete expl;
delete minimized;
delete degeneralized;
delete aut_scc;
delete to_free;
delete echeck_inst;
delete temp_dir_sim;
delete temp_rev_sim;
delete temp_iterated_sim;
}
else
{
exit_code = 1;
}
if (use_timer)
tm.print(std::cout);
if (unobservables)
{
for (spot::ltl::atomic_prop_set::iterator i =
unobservables->begin(); i != unobservables->end(); ++i)
(*i)->destroy();
delete unobservables;
}
spot::ltl::atomic_prop::dump_instances(std::cerr);
spot::ltl::unop::dump_instances(std::cerr);
spot::ltl::binop::dump_instances(std::cerr);
spot::ltl::multop::dump_instances(std::cerr);
spot::ltl::automatop::dump_instances(std::cerr);
assert(spot::ltl::atomic_prop::instance_count() == 0);
assert(spot::ltl::unop::instance_count() == 0);
assert(spot::ltl::binop::instance_count() == 0);
assert(spot::ltl::multop::instance_count() == 0);
assert(spot::ltl::automatop::instance_count() == 0);
delete dict;
return exit_code;
}