Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with static check on function application in the arrays encoding #1490

Closed
rodrigo7491 opened this issue Mar 16, 2022 · 0 comments · Fixed by #1492
Closed

Problem with static check on function application in the arrays encoding #1490

rodrigo7491 opened this issue Mar 16, 2022 · 0 comments · Fixed by #1492
Assignees
Labels
bug Farrays Feature: New SMT encoding with arrays

Comments

@rodrigo7491
Copy link
Collaborator

Description

Work on #1461 exposed a bug with function application in the arrays encoding. In the case which the function's arguments can be computed statically the application's result is not being computed correctly.

Input specification

This problem was found on the mis spec.

The command line parameters used to run the tool

apalache-mc check --length=5 --inv=IsIndependent --smt-encoding=arrays mis.tla

Expected behavior

No error.

System information

  • Apalache version [apalache-mc version]: v0.22.1-201-gbfdcd7d2
  • OS [e.g. Ubuntu Linux or Mac OS, and the current version]: Linux Mint 20.2
  • JDK version [e.g. OpenJDK 0.8.0]: openjdk 11.0.14 2022-01-18

Additional context

CEX generated:

---------------------------- MODULE counterexample ----------------------------

EXTENDS mis

(* Constant initialization state *)
ConstInit == TRUE

(* Initial state *)
State0 ==
  Nb = { <<1, 2>>, <<2, 1>> }
    /\ awake = SetAsFun({ <<1, TRUE>>, <<2, TRUE>>, <<3, TRUE>> })
    /\ msgs = SetAsFun({ <<1, {}>>, <<2, {}>>, <<3, {}>> })
    /\ rem_nbrs = SetAsFun({ <<1, {2}>>, <<2, {1}>>, <<3, {}>> })
    /\ round = 1
    /\ status
      = SetAsFun({ <<1, "unknown">>, <<2, "unknown">>, <<3, "unknown">> })
    /\ val = SetAsFun({ <<1, 80>>, <<2, 1>>, <<3, 1>> })

(* Transition 0 to State1 *)
State1 ==
  Nb = { <<1, 2>>, <<2, 1>> }
    /\ awake = SetAsFun({ <<1, TRUE>>, <<2, TRUE>>, <<3, TRUE>> })
    /\ msgs
      = SetAsFun({ <<
          1, { [src |-> 1, type |-> "val", val |-> 81],
            [src |-> 2, type |-> "val", val |-> 81] }
        >>,
        <<2, {[src |-> 1, type |-> "val", val |-> 81]}>>,
        <<3, {}>> })
    /\ rem_nbrs = SetAsFun({ <<1, {2}>>, <<2, {1}>>, <<3, {}>> })
    /\ round = 2
    /\ status = SetAsFun({ <<1, "winner">>, <<2, "winner">>, <<3, "winner">> })
    /\ val = SetAsFun({ <<1, 77>>, <<2, 5>>, <<3, 27>> })

(* The following formula holds true in the last state and violates the invariant *)
InvariantViolation ==
  Skolem((\E edge$2 \in Nb:
    status[edge$2[1]] = "winner" /\ status[edge$2[2]] = "winner"))

================================================================================
@rodrigo7491 rodrigo7491 added bug Farrays Feature: New SMT encoding with arrays labels Mar 16, 2022
@rodrigo7491 rodrigo7491 added this to the Arrays Encoding milestone Mar 16, 2022
@rodrigo7491 rodrigo7491 self-assigned this Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Farrays Feature: New SMT encoding with arrays
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant