Skip to content

Commit f9be4de

Browse files
authored
Merge pull request #608 from diffblue/CTL-AU-AR-EU-ER
SMV: parsing and type checking for CTL AR, ER, AU, EU
2 parents 00d17a8 + ff79e03 commit f9be4de

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

regression/ebmc/BDD/AU1.desc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
KNOWNBUG
1+
CORE
22
AU1.smv
33
--bdd
4+
^\[spec1\] x >= 1 AU x = 0: REFUTED$
5+
^\[spec2\] x >= 1 AU x = 10: PROVED$
46
^EXIT=10$
57
^SIGNAL=0$
68
--

regression/ebmc/BDD/AU1.smv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ASSIGN next(x) := case
1010
esac;
1111

1212
-- should fail, since x=0 is not reachable
13-
SPEC A x>=1 U x=0
13+
SPEC A [x>=1 U x=0]
1414

1515
-- should pass
16-
SPEC A x>=1 U x=10
16+
SPEC A [x>=1 U x=10]

src/smvlang/expr2smv.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,14 @@ bool expr2smvt::convert(
476476
return convert_unary(
477477
to_unary_expr(src), dest, src.id_string() + " ", precedence = 7);
478478

479+
else if(
480+
src.id() == ID_AU || src.id() == ID_EU || src.id() == ID_AR ||
481+
src.id() == ID_ER || src.id() == ID_U || src.id() == ID_R)
482+
{
483+
return convert_binary(
484+
to_binary_expr(src), dest, src.id_string(), precedence = 7);
485+
}
486+
479487
else if(src.id()==ID_symbol)
480488
return convert_symbol(to_symbol_expr(src), dest, precedence);
481489

src/smvlang/parser.y

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,13 @@ term : variable_name
467467
| EX_Token term { init($$, ID_EX); mto($$, $2); }
468468
| EF_Token term { init($$, ID_EF); mto($$, $2); }
469469
| EG_Token term { init($$, ID_EG); mto($$, $2); }
470-
| A_Token term { init($$, ID_A); mto($$, $2); }
471-
| E_Token term { init($$, ID_E); mto($$, $2); }
470+
| A_Token '[' term U_Token term ']' { binary($$, $3, ID_AU, $5, bool_typet{}); }
471+
| A_Token '[' term R_Token term ']' { binary($$, $3, ID_AR, $5, bool_typet{}); }
472+
| E_Token '[' term U_Token term ']' { binary($$, $3, ID_EU, $5, bool_typet{}); }
473+
| E_Token '[' term R_Token term ']' { binary($$, $3, ID_ER, $5, bool_typet{}); }
472474
| F_Token term { init($$, ID_F); mto($$, $2); }
473475
| G_Token term { init($$, ID_G); mto($$, $2); }
474476
| X_Token term { init($$, ID_X); mto($$, $2); }
475-
| term U_Token term { binary($$, $1, ID_U, $3, stack_expr($1).type()); }
476-
| term R_Token term { binary($$, $1, ID_U, $3, stack_expr($1).type()); }
477477
| term EQUAL_Token term { binary($$, $1, ID_equal, $3, bool_typet{}); }
478478
| term NOTEQUAL_Token term { binary($$, $1, ID_notequal, $3, bool_typet{}); }
479479
| term LT_Token term { binary($$, $1, ID_lt, $3, bool_typet{}); }

src/smvlang/smv_typecheck.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -933,11 +933,11 @@ void smv_typecheckt::typecheck(
933933
condition=!condition;
934934
}
935935
}
936-
}
937-
else if(expr.id()==ID_AG || expr.id()==ID_AX || expr.id()==ID_AF ||
938-
expr.id()==ID_EG || expr.id()==ID_EX || expr.id()==ID_EF ||
939-
expr.id()==ID_A || expr.id()==ID_E || expr.id()==ID_X ||
940-
expr.id()==ID_F || expr.id()==ID_G)
936+
}
937+
else if(
938+
expr.id() == ID_AG || expr.id() == ID_AX || expr.id() == ID_AF ||
939+
expr.id() == ID_EG || expr.id() == ID_EX || expr.id() == ID_EF ||
940+
expr.id() == ID_X || expr.id() == ID_F || expr.id() == ID_G)
941941
{
942942
if(expr.operands().size()!=1)
943943
{
@@ -951,7 +951,9 @@ void smv_typecheckt::typecheck(
951951

952952
typecheck(to_unary_expr(expr).op(), expr.type(), mode);
953953
}
954-
else if(expr.id() == ID_U || expr.id() == ID_R)
954+
else if(
955+
expr.id() == ID_EU || expr.id() == ID_ER || expr.id() == ID_AU ||
956+
expr.id() == ID_AR || expr.id() == ID_U || expr.id() == ID_R)
955957
{
956958
auto &binary_expr = to_binary_expr(expr);
957959
expr.type() = bool_typet();

0 commit comments

Comments
 (0)