@@ -9,6 +9,7 @@ Author: Daniel Kroening, kroening@kroening.com
99#include " sequence.h"
1010
1111#include < util/arith_tools.h>
12+ #include < util/mathematical_types.h>
1213
1314#include < ebmc/ebmc_error.h>
1415#include < temporal-logic/temporal_logic.h>
@@ -367,36 +368,21 @@ sequence_matchest instantiate_sequence(
367368 else if (expr.id () == ID_sva_sequence_repetition_star) // [*...]
368369 {
369370 auto &repetition = to_sva_sequence_repetition_star_expr (expr);
370- if (repetition.is_unbounded () && repetition. repetitions_given ())
371+ if (repetition.is_empty_match ())
371372 {
372- // [*x:$]
373- auto from = numeric_cast_v<mp_integer>(repetition.from ());
374- auto &op = repetition.op ();
375-
376- // Is op a sequence or a state predicate?
377- if (is_SVA_sequence_operator (op))
378- PRECONDITION (false ); // no support
379-
380- sequence_matchest result;
381-
382- // we incrementally add conjuncts to the condition
383- exprt::operandst conjuncts;
384-
385- for (mp_integer u = t; u < no_timeframes; ++u)
386- {
387- // does op hold in timeframe u?
388- auto cond_u = instantiate (op, u, no_timeframes);
389- conjuncts.push_back (cond_u);
390-
391- if (conjuncts.size () >= from)
392- result.push_back ({u, conjunction (conjuncts)});
393- }
394-
395- // Empty match allowed?
396- if (from == 0 )
397- result.push_back ({t, true_exprt{}});
373+ // [*0] denotes the empty match
374+ return {{t, true_exprt{}}};
375+ }
376+ else if (repetition.is_unbounded () && repetition.repetitions_given ())
377+ {
378+ // [*from:$] -> op[*from:to]
379+ // with to = no_timeframes - t
380+ auto to = from_integer (no_timeframes - t, integer_typet{});
381+ auto new_repetition = sva_sequence_repetition_star_exprt{
382+ repetition.op (), repetition.from (), to};
398383
399- return result;
384+ return instantiate_sequence (
385+ new_repetition.lower (), semantics, t, no_timeframes);
400386 }
401387 else
402388 {
0 commit comments