1. 28 Apr, 2012 40 commits
    • Alexandre Duret-Lutz's avatar
      Combine Boolean formulae in Fusion arguments. · 2669df1c
      Alexandre Duret-Lutz authored
      * src/ltlast/multop.cc (multop::instance): Implement
      the rewriting.   "a:b:c[*]:d:e" becomes "{{a&&b}&c[*]}:{d&&e}".
      * src/ltlast/multop.hh: Document it.
      * src/ltltest/equals.test, src/ltltest/kind.test: Add test cases.
      2669df1c
    • Alexandre Duret-Lutz's avatar
      Add trivial identities for &&, <>->, []-> and Boolean arguments. · a2da5184
      Alexandre Duret-Lutz authored
      * 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.
      a2da5184
    • Alexandre Duret-Lutz's avatar
      Cosmetic change to please sanity checks. · 0e4e2a79
      Alexandre Duret-Lutz authored
      * src/ltlvisit/randomltl.cc (random_formula::update_sums): Remove
      duplicate semicolon.
      0e4e2a79
    • Alexandre Duret-Lutz's avatar
      Disable LTL reductions on SERE formulae. · 6e6b6b1e
      Alexandre Duret-Lutz authored
      * src/ltlvisit/contain.cc (recurse, reduce_tau03): Do not
      run on non-PSL formulae.
      * src/ltlvisit/reduce.cc (reduce_visitor::visit): Skip
      multop::Fusion operators, and do not run syntactic_implication_neg
      on SERE formulae.
      * src/ltlvisit/syntimpl.cc (inf_right_recurse_visitor::visit):
      Skip [*0].
      6e6b6b1e
    • Alexandre Duret-Lutz's avatar
      Track SERE formulas. · 459921ef
      Alexandre Duret-Lutz authored
      * src/ltlast/atomic_prop.cc, src/ltlast/automatop.cc,
      src/ltlast/binop.cc, src/ltlast/bunop.cc, src/ltlast/constant.cc,
      src/ltlast/formula.cc, src/ltlast/formula.hh,
      src/ltlast/multop.cc, src/ltlast/unop.cc: Add a bit is.sere_formula
      to track SEREs, and fix tracking of PSL formulae.
      * src/ltltest/kind.test: Adjust.
      459921ef
    • Alexandre Duret-Lutz's avatar
      Add support for the {SERE}! PSL operator. · fdd73d51
      Alexandre Duret-Lutz authored
      * src/ltlparse/ltlscan.ll: Recognize }!.  Also remove
      five duplicate rules.
      * src/ltlparse/ltlparse.yy: Build {r}<>->1 when parsing {r}!.
      * src/ltlvisit/tostring.cc: Print {r}! instead of {r}<>->1.
      * src/ltltest/tostring.test, src/ltltest/equals.test:
      Add more tests.
      fdd73d51
    • Alexandre Duret-Lutz's avatar
      Cosmetic changes in doc for bunop and multop. · c48b9bcf
      Alexandre Duret-Lutz authored
      * src/ltlast/bunop.hh, src/ltlast/multop.hh: Reorder some comments.
      c48b9bcf
    • Alexandre Duret-Lutz's avatar
      Fix handling of PSL operators in reductions rules. · c8801935
      Alexandre Duret-Lutz authored
      We still don't have any PSL-specific reductions, but at least
      the LTL reduction now appear to work on PSL formulas.
      
      * src/ltlvisit/basicreduce.cc (basic_reduce_visitor): Fix the
      call to std::copy to handle Concat, Fusion, and AndNLM.
      * src/ltlvisit/reduce.cc (reduce_visitor): Fix handling
      of UConcat, EConcat, and EConcatMarked.
      * src/tgbatest/randpsl.test: Activate reductions.
      * src/ltltest/reducpsl.test: New file.
      * src/ltltest/Makefile.am (TESTS): Add it.
      c8801935
    • Alexandre Duret-Lutz's avatar
      Plug a memory leak in randltl. · b8b4aa72
      Alexandre Duret-Lutz authored
      * src/ltlvisit/randomltl.hh (random_formula::~random_formula):
      Declare as virtual.
      b8b4aa72
    • Alexandre Duret-Lutz's avatar
      Translate 50 random PSL formulae until we get a better test. · 87acb151
      Alexandre Duret-Lutz authored
      * src/tgbatest/randpsl.test: New file.
      * src/tgbatest/Makefile.am (TESTS): Add it.
      87acb151
    • Alexandre Duret-Lutz's avatar
      Fix infinite recursion when translating E* and E accepts [*0]. · a29c87b2
      Alexandre Duret-Lutz authored
      * src/tgbaalgos/ltl2tgba_fm.cc (ratexp_trad_visitor::visit):
      Use a different translating rule for E* if E accepts [*0].
      * src/tgbatest/ltl2tgba.test: Add test case.
      a29c87b2
    • Alexandre Duret-Lutz's avatar
      Add random generators of Boolean, SERE, and PSL formula. · cce6dd34
      Alexandre Duret-Lutz authored
      * src/ltlvisit/randomltl.cc, src/ltlvisit/randomltl.hh:
      (random_boolean, random_sere, random_psl): Add new classes.
      * src/ltltest/randltl.cc: Add options to support the above.
      Nore: the -p option was renamed to -pL for consistency, but
      it is still understood.
      cce6dd34
    • Alexandre Duret-Lutz's avatar
      Make it possible to format SERE. · cc889a7f
      Alexandre Duret-Lutz authored
      * src/ltlvisit/tostring.hh, src/ltlvisit/tostring.cc (to_string):
      Add third option to enable formating suitable for SERE.
      cc889a7f
    • Alexandre Duret-Lutz's avatar
    • Alexandre Duret-Lutz's avatar
      Relax usage of ->, <->, and xor in SERE. · eab91aab
      Alexandre Duret-Lutz authored
      * src/ltlparse/ltlparse.yy (rationalexp): Allow ->, <->, and xor,
      in rational expressions as long as they apply only to Boolean
      formulae.
      * src/tgbaalgos/ltl2tgba_fm.cc (ratexp_trad_visitor): Adjust
      assert in handling of unop::Not.
      eab91aab
    • Alexandre Duret-Lutz's avatar
      Equal and Goto should only apply to Boolean expressions. · 8cafa200
      Alexandre Duret-Lutz authored
      * src/ltlast/bunop.cc (bunop::bunop): Ensure it using an assert.
      8cafa200
    • Alexandre Duret-Lutz's avatar
      Prepare the introduction of random_sere() and random_psl(). · 7c7704f9
      Alexandre Duret-Lutz authored
      * src/ltlvisit/randomltl.hh (random_ltl): Split this class into...
      (random_formula, random_ltl): ... these.
      * src/ltlvisit/randomltl.cc: New
      7c7704f9
    • Alexandre Duret-Lutz's avatar
      Speedup syntactic_implication() by using a cache. · 4ef7805e
      Alexandre Duret-Lutz authored
      * src/ltlvisit/syntimpl.hh (syntactic_implication,
      syntactic_implication_neg): Move as member of ...
      (syntactic_implication_cache): ... this new class, that holds
      a cache of results to speedup these functions.
      * src/ltlvisit/syntimpl.cc: Adjust to use (lookup, populate,
      and cleanup) the cache.
      * src/ltltest/syntimpl.cc: Likewise.
      * src/ltlvisit/reduce.hh (reduce): Take an optional
      syntactic_implication_cache parameter.
      * src/ltlvisit/reduce.cc: Adjust to use a
      syntactic_implication_cache.
      * src/ltltest/equals.cc: Call dump_instances() to help debugging.
      4ef7805e
    • Alexandre Duret-Lutz's avatar
      Speedup some rewriting by detecting cases where they do nothing. · 20c088a4
      Alexandre Duret-Lutz authored
      * src/ltlvisit/nenoform.cc, src/ltlvisit/lunabbrev.cc,
      src/ltlvisit/simpfg.cc, src/ltlvisit/tunabbrev.cc: Do not recurse
      if the formula properties indicate that it is already in the right
      form.
      20c088a4
    • Alexandre Duret-Lutz's avatar
      Remove the has_mark() function in favor of the is_marked() method. · 6380968f
      Alexandre Duret-Lutz authored
      * src/ltlast/unop.cc (NegClosure): Reset is.not_marked.
      * src/ltlvisit/mark.hh,
      src/ltlvisit/mark.cc (has_mark_visitor, has_mark): Remove.
      * src/tgbaalgos/ltl2tgba_fm.cc: Use f->is_marked() instead
      of has_mark(f).
      6380968f
    • Alexandre Duret-Lutz's avatar
      Get rid of all dynamic_cast<>s while working on LTL formulae. · 957ba664
      Alexandre Duret-Lutz authored
      They are too slow.
      
      * src/ltlast/formula.hh (opkind, kind, kind_): Use an enum
      to indicate the actual kind of the formula.  This way we can
      check the kind of a formula without relying on dynamic_cast.
      * src/ltlast/atomic_prop.cc, src/ltlast/automatop.cc,
      src/ltlast/binop.cc, src/ltlast/bunop.cc, src/ltlast/constant.cc,
      src/ltlast/multop.cc, src/ltlast/refformula.cc,
      src/ltlast/refformula.hh, src/ltlast/unop.cc: Adjust constructors.
      * src/ltlvisit/basicreduce.cc, src/ltlvisit/mark.cc,
      src/ltlvisit/reduce.cc, src/ltlvisit/syntimpl.cc,
      src/ltlvisit/tostring.cc: Replace all dynamic_cast by a
      call to kind() followed by a static_cast.
      957ba664
    • Alexandre Duret-Lutz's avatar
      Replace the constant_term visitor by a flag in the formulae. · 48cde88b
      Alexandre Duret-Lutz authored
      * src/ltlast/formula.hh (formula::accepts_eword): New method.
      (formula::is.accepting_eword): New flag.
      * src/ltlast/formula.cc (print_formula_props): Display the new
      property.
      * src/ltlast/atomic_prop.cc, src/ltlast/automatop.cc,
      src/ltlast/binop.cc, src/ltlast/bunop.cc, src/ltlast/constant.cc,
      src/ltlast/multop.cc, src/ltlast/unop.cc: Update
      is.accepting_eword as appropriate.
      * src/ltltest/consterm.cc, src/tgbaalgos/ltl2tgba_fm.cc: Adjust to
      use accepts_eword().
      * src/ltlvisit/consterm.cc, src/ltlvisit/consterm.hh: Delete.
      * src/ltlvisit/Makefile.am: Remove these files.
      48cde88b
    • Alexandre Duret-Lutz's avatar
      Maintain basic LTL properties using a bitfield inside formula objects. · 546260e7
      Alexandre Duret-Lutz authored
      This bitfield is easily updated as the formulae are constructed.
      Doing so avoids many AST recursions to compute these properties
      individually.  This patch removes the eventual_universal_visitor,
      as well as the kind_of() function.
      
      * src/ltlast/formula.hh (is_boolean, is_sugar_free_boolean,
      is_in_nenoform, is_X_free, is_sugar_free_ltl,
      is_ltl_formula, is_eltl_formula, is_psl_formula, is_eventual,
      is_universal, is_marked): New methods to query formula
      properties in constant time.
      (get_props, ltl_prop): A method and structure for
      implementation as a field bit in an unsigned, for fast
      computation.
      (print_formula_props): New function.
      * src/ltlast/formula.cc (print_formula_props): Implement it.
      * src/ltlast/atomic_prop.cc, src/ltlast/binop.cc,
      src/ltlast/bunop.cc, src/ltlast/constant.cc, src/ltlast/multop.cc,
      src/ltlast/unop.cc, src/ltlast/automatop.cc: Compute the
      properties as instances are constructed.
      * src/ltlparse/ltlparse.yy: Update to use is_boolean() instead
      of kind_of().
      * src/ltltest/kind.cc: Update to use print_formula_props().
      * src/ltltest/kind.test: Adjust to test eventual and universal
      properties.
      * src/ltlvisit/kind.cc, src/ltlvisit/kind.hh: Delete these files.
      * src/ltlvisit/Makefile.am: Remove kind.hh and kind.cc.
      * src/ltlvisit/reduce.cc (recurse_eu, eventual_universal_visitor):
      Remove, no longer needed.
      (reduce_visitor, is_eventual, is_universal): Adjust to
      use formula::is_eventual(), and formula::is_universal().
      * src/ltlvisit/reduce.hh (is_eventual, is_universal): Declare as
      deprecated.
      546260e7
    • Alexandre Duret-Lutz's avatar
      Simplify fUf, fRf, fWf, and fRF as f. · 1671aa5d
      Alexandre Duret-Lutz authored
      * src/ltlast/binop.cc (binop::instance): Simplify fUf, fRf, fWf,
      and fRF.
      * src/ltlast/binop.hh: Document it.
      * src/ltltest/equals.test: Add new tests for 'Exp U Exp'
      and 'Exp R Exp', and all missing tests for W and M.
      1671aa5d
    • Alexandre Duret-Lutz's avatar
      Do not simplify F([*0]) and G([*0]). Make sure it does not happen. · 5bb171c8
      Alexandre Duret-Lutz authored
      * src/ltlast/unop.hh, src/ltlast/unop.cc: Replace the
      simplification by an assert.
      5bb171c8
    • Alexandre Duret-Lutz's avatar
      Fix trivial identity (0 => Exp) == 1, and add rewritings for =>. · 473cf771
      Alexandre Duret-Lutz authored
      The new rewriting are (Exp => Exp) = 1, (Exp <=> Exp) == 1,
      and (Exp ^ Exp) == 0.
      
      * src/ltlast/binop.hh: Fix documentation.
      * src/ltlast/binop.cc: Fix implementation.
      * src/ltltest/equals.test: More tests.
      * src/tgbatest/emptchk.test: Remove a useless test.
      473cf771
    • Alexandre Duret-Lutz's avatar
      Read p=0Wq=1 and p=0Mq=1 correctly. · f2732dd8
      Alexandre Duret-Lutz authored
      * src/ltlparse/ltlscan.ll: Handle p=0Wq=1 and p=0Mq=1 in
      the same way as we did for
      * src/ltltest/parse.test: More tests.
      f2732dd8
    • Alexandre Duret-Lutz's avatar
      Accept more syntaxes as range specifications for [*], [=], and [->]. · 754ff36b
      Alexandre Duret-Lutz authored
      * src/ltlparse/ltlscan.ll (OP_SQBKT_SEP): Accept ":" and "to"
      in addition to ".." and ",".
      (OP_UNBOUNDED): Recognize "$" for the rule below.
      * src/ltlparse/ltlparse.yy: Accept [OP1:$] as a synonym
      for [OP1:], for people used to SVA's syntax.
      * src/ltltest/equals.test: Test these syntaxes.
      754ff36b
    • Alexandre Duret-Lutz's avatar
      Fix rewriting of Negated constants and atomic propositions · 4fd4f83e
      Alexandre Duret-Lutz authored
      * src/tgbaalgos/ltl2tgba_fm.cc (ratexp_trad_visitor): Take a
      "negated" parameter and use it.
      4fd4f83e
    • Alexandre Duret-Lutz's avatar
      Speed up computation of constant term on [->] and [=] operators. · c6a751b9
      Alexandre Duret-Lutz authored
      * src/ltlvisit/consterm.cc: Stop the recursion on [->] and [=].
      c6a751b9
    • Alexandre Duret-Lutz's avatar
    • Alexandre Duret-Lutz's avatar
      Introduce [->min..max] operator. · da74b4f1
      Alexandre Duret-Lutz authored
      * src/ltlast/bunop.hh: Declare bunop::Goto
      * src/ltlast/bunop.cc: Handle it.
      * src/ltlparse/ltlparse.yy,
      src/ltlparse/ltlscan.ll: Add rules for [->min..max].
      * src/tgbaalgos/ltl2tgba_fm.cc: Handle bunop::Goto in
      the translation.
      * src/ltltest/equals.test: Test trivial identities.
      * src/tgbatest/ltl2tgba.test: Test two more formulae using [->].
      da74b4f1
    • Alexandre Duret-Lutz's avatar
      Rewrite Exp[=0..] as [*]. · 2c31e541
      Alexandre Duret-Lutz authored
      * src/ltlast/bunop.cc: Implement this rewriting.
      * src/ltlast/bunop.hh: Document it.
      * src/ltltest/equals.test: Test it.
      2c31e541
    • Alexandre Duret-Lutz's avatar
      Introduce [=min..max] operator. · 8d4a413a
      Alexandre Duret-Lutz authored
      * src/ltlast/bunop.hh: Declare bunop::Equal
      * src/ltlast/bunop.cc: Handle it.
      * src/ltlparse/ltlparse.yy,
      src/ltlparse/ltlscan.ll: Add rules for [=min..max].
      * src/tgbaalgos/ltl2tgba_fm.cc: Handle bunop::Equal in
      the translation.
      * src/ltltest/equals.test: Test trivial identities
      for [=min..max].
      * src/tgbatest/ltl2tgba.test: Add new formulae to test.
      8d4a413a
    • Alexandre Duret-Lutz's avatar
      Simplify ![*0] as [+]. · d7781bc4
      Alexandre Duret-Lutz authored
      * src/ltlast/unop.cc: Simplify ![*0] as 1[+].
      * src/ltlast/unop.hh: Document it.
      d7781bc4
    • Alexandre Duret-Lutz's avatar
      Add functions to compute the kind of a formula (LTL, PSL, Boolean...) · 437128b5
      Alexandre Duret-Lutz authored
      * src/ltlvisit/kind.hh, src/ltlvisit/kind.cc: New files.
      * src/ltlvisit/Makefile.am: Add them.
      * src/ltltest/kind.test, src/ltltest/kind.cc: New files.
      * src/ltltest/Makefile.am: Add them.
      437128b5
    • Alexandre Duret-Lutz's avatar
      Add support for [+]. · 567b4607
      Alexandre Duret-Lutz authored
      * src/ltlast/bunop.cc (bunop::format): Output [*1..] as [+].
      * src/ltlvisit/tostring.cc: Output "a*" as "a[*]" for consistency.
      * src/ltlparse/ltlparse.yy, src/ltlparse/ltlscan.ll: Recognize [+].
      * src/ltltest/tostring.test, src/ltltest/equals.test,
      src/tgbatest/ltl2tgba.test: More tests.
      567b4607
    • Alexandre Duret-Lutz's avatar
      Add support the bounded star operator [*i..j]. · 126b724a
      Alexandre Duret-Lutz authored
      * src/ltlast/bunop.hh, src/ltlast/bunop.cc: New files for
      bounded unary operators.
      * src/ltlast/Makefile.am, src/ltlast/allnodes.hh: Add them.
      * src/ltlast/predecl.hh (bunop): Declare.
      * src/ltlast/unop.hh, src/ltlast/unop.cc (Star): Remove
      declaration of Star and associated code.
      * src/ltlast/visitor.hh: Add visit(bunop* node) methods.
      * src/ltlparse/ltlparse.yy, src/ltlparse/ltlscan.ll: Add parse
      rules for LTL.  This required passing the parse_error list
      to the lexer, so it can report scanning errors when it reads
      a number that does not fit in an unsigned int.
      * src/ltlparse/parsedecl.hh (YY_DECL): Take error_list
      as third argument.
      * src/ltltest/consterm.test, src/ltltest/tostring.test,
      src/ltltest/equals.test, src/tgbatest/ltl2tgba.test: More tests.
      * src/ltlvisit/basicreduce.cc, src/ltlvisit/clone.cc,
      src/ltlvisit/clone.hh, src/ltlvisit/consterm.cc,
      src/ltlvisit/dotty.cc, src/ltlvisit/mark.cc,
      src/ltlvisit/nenoform.cc, src/ltlvisit/postfix.cc,
      src/ltlvisit/postfix.hh, src/ltlvisit/reduce.cc,
      src/ltlvisit/syntimpl.cc, src/ltlvisit/tostring.cc,
      src/ltlvisit/tunabbrev.cc, src/tgba/formula2bdd.cc,
      src/tgbaalgos/eltl2tgba_lacim.cc, src/tgbaalgos/ltl2taa.cc,
      src/tgbaalgos/ltl2tgba_lacim.cc: Adjust syntax to use
      "bunop::Star" instead of "unop::Star".
      * src/tgbaalgos/ltl2tgba_fm.cc: Likewise, but also adjust
      the code to handle the bounds of the operator.
      126b724a
    • Alexandre Duret-Lutz's avatar
      Print '{!a}*' rather than '!a*'. · 47b2bea8
      Alexandre Duret-Lutz authored
      * src/ltlvisit/tostring.cc: Use braces for unary operators in
      Star.
      * src/ltltest/tostring.test: Add some PSL formulae, it cannot
      hurt.
      47b2bea8
    • Alexandre Duret-Lutz's avatar
      Fix deterministic translation of []->. · aef6c1a0
      Alexandre Duret-Lutz authored
      * src/tgbaalgos/ltl2tgba_fm.cc (ratexp_trad_visitor::visit): Fix
      the "deterministic case" of []->, and merge it with the
      non-deterministic case.
      aef6c1a0