converters.petri_net: the inductive Petri net models an XOR join as an AND join #4

Open
opened 2026-10-06 13:44:53 +00:00 by ffrauenberger · 0 comments
Owner

Severity: medium (the net is wrong after every XOR, but the Petri net view is opt-in and nothing in the app replays it)

Where

  • app/converters/petri_net_converter.py:124-141

Problem

When a process tree is converted into a Petri net, an xor node gets one silent join transition, and the exit place of every branch is connected to it:

join_id = new_tau("xor_join")
...
for child in children:
    child_entry, child_exit = build_fragment(child)
    ...
    toolkit.add_arc(child_exit, join_id)      # every branch -> the same tau
toolkit.add_arc(join_id, exit_place)

A Petri-net transition only fires when all of its input places hold a token. In an exclusive choice only one branch is executed, so only one child_exit receives a token. The join can never fire, and the net deadlocks after every XOR block.

In Petri net notation the drawing shows an AND join; only the tooltip of the exit place says "Exclusive". The "par" case is correct.

Steps to reproduce

  1. Open the application
  2. Import a log whose process contains an exclusive choice whose branches survive the SPM filter (e.g. {a,b,d: 5, a,c,d: 5, a,b,e,d: 1})
  3. Select the Inductive Miner (or IMf) and enable Petri-Net Visualization
  4. Replay a trace through the XOR block on the resulting net with a strict token game (nothing in the UI does this)

Or test the converter directly with the tree ('seq','a',('xor','b','c'),'d').

Expected behavior

Each XOR branch connects to the shared exit place through its own silent transition, and every trace of the log can reach p_end.

Actual behavior

All branches feed the same silent transition, which can never fire. No trace through an XOR block reaches p_end; the net is unsound. The DOT/SVG/PNG exports and the pickled petri_net show the wrong net.

Corrections from the review

  • The log a,b,d / a,c,d from the first draft does not trigger the bug: the SPM filter removes b and c at every threshold.
  • There is no Petri net export format. The affected exports are the DOT/SVG/PNG drawings and the pickled petri_net dict.
  • The gateway metadata of shared places is overwritten: in ('seq',('xor',a,b),('xor',c,d)) the middle place is first tagged as an XOR join, then as an XOR split (petri_net_converter.py:130-131). This only affects tooltips.
  • SPM can be negative, so the minimum SPM threshold still drops activities (base_mining.py:424, :437-440). This needs its own issue.

Fix

In build_fragment, branch op == "xor" (petri_net_converter.py:124-141):

  • remove join_id = new_tau("xor_join") and its register_transition (:127-128)
  • replace toolkit.add_arc(child_exit, join_id) (:139) with connect_places(child_exit, exit_place, "xor_join")
  • remove toolkit.add_arc(join_id, exit_place) (:140)

Building each child with exit_override=exit_place is also correct and gives fewer silent transitions.

Check

New tests/converters/petri_net_converter_test.py. Do not use simulate_trace as the oracle: it fires silent transitions greedily (petri_net.py:150-163, :360-383) and rejects valid traces even on the fixed net. Use a small strict reachability helper. Cover:

  • xor inside seq
  • ('xor','tau',X) (optional activity)
  • xor at the root (exit = p_end)
  • xor as a loop redo
  • a negative trace that must be rejected

from issues/BUG-004-inductive-petri-net-xor-join-is-and-join.md (code analysis of commit 6bcc646, 2026-10-03), corrected by the review in verdicts-claude/BUG-004-inductive-petri-net-xor-join-is-and-join.md

**Severity:** medium (the net is wrong after every XOR, but the Petri net view is opt-in and nothing in the app replays it) ## Where - `app/converters/petri_net_converter.py:124-141` ## Problem When a process tree is converted into a Petri net, an `xor` node gets **one** silent join transition, and the exit place of **every** branch is connected to it: ```python join_id = new_tau("xor_join") ... for child in children: child_entry, child_exit = build_fragment(child) ... toolkit.add_arc(child_exit, join_id) # every branch -> the same tau toolkit.add_arc(join_id, exit_place) ``` A Petri-net transition only fires when **all** of its input places hold a token. In an exclusive choice only one branch is executed, so only one `child_exit` receives a token. The join can never fire, and the net deadlocks after every XOR block. In Petri net notation the drawing shows an AND join; only the tooltip of the exit place says "Exclusive". The `"par"` case is correct. ### Steps to reproduce 1. Open the application 2. Import a log whose process contains an exclusive choice whose branches survive the SPM filter (e.g. `{a,b,d: 5, a,c,d: 5, a,b,e,d: 1}`) 3. Select the Inductive Miner (or IMf) and enable *Petri-Net Visualization* 4. Replay a trace through the XOR block on the resulting net with a strict token game (nothing in the UI does this) Or test the converter directly with the tree `('seq','a',('xor','b','c'),'d')`. ### Expected behavior Each XOR branch connects to the shared exit place through its own silent transition, and every trace of the log can reach `p_end`. ### Actual behavior All branches feed the same silent transition, which can never fire. No trace through an XOR block reaches `p_end`; the net is unsound. The DOT/SVG/PNG exports and the pickled `petri_net` show the wrong net. ### Corrections from the review - The log `a,b,d` / `a,c,d` from the first draft does not trigger the bug: the SPM filter removes `b` and `c` at every threshold. - There is no Petri net export format. The affected exports are the DOT/SVG/PNG drawings and the pickled `petri_net` dict. - The gateway metadata of shared places is overwritten: in `('seq',('xor',a,b),('xor',c,d))` the middle place is first tagged as an XOR join, then as an XOR split (`petri_net_converter.py:130-131`). This only affects tooltips. - SPM can be negative, so the minimum SPM threshold still drops activities (`base_mining.py:424`, `:437-440`). This needs its own issue. ## Fix In `build_fragment`, branch `op == "xor"` (`petri_net_converter.py:124-141`): - remove `join_id = new_tau("xor_join")` and its `register_transition` (`:127-128`) - replace `toolkit.add_arc(child_exit, join_id)` (`:139`) with `connect_places(child_exit, exit_place, "xor_join")` - remove `toolkit.add_arc(join_id, exit_place)` (`:140`) Building each child with `exit_override=exit_place` is also correct and gives fewer silent transitions. ## Check New `tests/converters/petri_net_converter_test.py`. Do **not** use `simulate_trace` as the oracle: it fires silent transitions greedily (`petri_net.py:150-163`, `:360-383`) and rejects valid traces even on the fixed net. Use a small strict reachability helper. Cover: - `xor` inside `seq` - `('xor','tau',X)` (optional activity) - `xor` at the root (exit = `p_end`) - `xor` as a loop redo - a negative trace that must be rejected --- from `issues/BUG-004-inductive-petri-net-xor-join-is-and-join.md` (code analysis of commit 6bcc646, 2026-10-03), corrected by the review in `verdicts-claude/BUG-004-inductive-petri-net-xor-join-is-and-join.md`
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ffrauenberger/ProcessIntel#4
No description provided.