Retry loop livelock

Input

{
  "check_livelocks": true,
  "initial": {
    "phase": "idle",
    "tries": 0
  },
  "initial_states": null,
  "reachability": null,
  "terminal_condition": {
    "op": "in",
    "values": [
      "acked",
      "failed"
    ],
    "var": "phase"
  },
  "transitions": [
    {
      "guard": {
        "op": "eq",
        "value": "idle",
        "var": "phase"
      },
      "name": "send",
      "updates": {
        "phase": {
          "op": "const",
          "value": "sending"
        }
      }
    },
    {
      "guard": {
        "op": "eq",
        "value": "sending",
        "var": "phase"
      },
      "name": "retry",
      "updates": {
        "tries": {
          "arg": {
            "left": {
              "op": "var",
              "var": "tries"
            },
            "op": "add",
            "right": {
              "op": "const",
              "value": 1
            }
          },
          "max": 2,
          "min": 0,
          "op": "clamp"
        }
      }
    },
    {
      "guard": {
        "op": "eq",
        "value": "sending",
        "var": "phase"
      },
      "name": "ack",
      "updates": {
        "phase": {
          "op": "const",
          "value": "acked"
        }
      }
    },
    {
      "guard": {
        "args": [
          {
            "op": "eq",
            "value": "sending",
            "var": "phase"
          },
          {
            "op": "eq",
            "value": 2,
            "var": "tries"
          }
        ],
        "op": "and"
      },
      "name": "give_up",
      "updates": {
        "phase": {
          "op": "const",
          "value": "failed"
        }
      }
    }
  ],
  "variables": [
    {
      "name": "phase",
      "type": "enum",
      "values": [
        "idle",
        "sending",
        "acked",
        "failed"
      ]
    },
    {
      "max": 2,
      "min": 0,
      "name": "tries",
      "type": "int"
    }
  ]
}

Output

Build-time verified. stats.elapsed_ms normalized to 0.

{
  "deadlock": {
    "found": false,
    "trace": null
  },
  "domain_violations": [],
  "exhaustive": false,
  "invariant_violations": [],
  "livelock": {
    "found": true,
    "loop_start": 3,
    "trace": [
      {
        "state": {
          "phase": "idle",
          "tries": 0
        },
        "step": 0,
        "transition": null
      },
      {
        "state": {
          "phase": "sending",
          "tries": 0
        },
        "step": 1,
        "transition": "send"
      },
      {
        "state": {
          "phase": "sending",
          "tries": 1
        },
        "step": 2,
        "transition": "retry"
      },
      {
        "state": {
          "phase": "sending",
          "tries": 2
        },
        "step": 3,
        "transition": "retry"
      },
      {
        "state": {
          "phase": "sending",
          "tries": 2
        },
        "step": 4,
        "transition": "retry"
      }
    ]
  },
  "reachability": [],
  "states_explored": 8,
  "stats": {
    "elapsed_ms": 0,
    "timed_out": false
  },
  "status": "counterexample_found",
  "transitions_fired": 8,
  "unreachable_transitions": [],
  "verified": true
}

Request

curl --fail-with-body --silent --show-error https://oracles.burgeonads.com/v1/verify/state-machine -H 'Content-Type: application/json' --data-raw '{"variables":[{"name":"phase","type":"enum","values":["idle","sending","acked","failed"]},{"name":"tries","type":"int","min":0,"max":2}],"initial":{"phase":"idle","tries":0},"initial_states":null,"transitions":[{"name":"send","guard":{"op":"eq","var":"phase","value":"idle"},"updates":{"phase":{"op":"const","value":"sending"}}},{"name":"retry","guard":{"op":"eq","var":"phase","value":"sending"},"updates":{"tries":{"op":"clamp","arg":{"op":"add","left":{"op":"var","var":"tries"},"right":{"op":"const","value":1}},"min":0,"max":2}}},{"name":"ack","guard":{"op":"eq","var":"phase","value":"sending"},"updates":{"phase":{"op":"const","value":"acked"}}},{"name":"give_up","guard":{"op":"and","args":[{"op":"eq","var":"phase","value":"sending"},{"op":"eq","var":"tries","value":2}]},"updates":{"phase":{"op":"const","value":"failed"}}}],"terminal_condition":{"op":"in","var":"phase","values":["acked","failed"]},"check_livelocks":true,"reachability":null}'