transaction/1 retry loop vs idempotent retractall/assertz for non-duplicating writes
A design is needed to retry a write goal that can fail transiently while guaranteeing the dynamic fact is present exactly once and external side effects are not duplicated. The constraint is SWI-Prolog database semantics. transaction/1 runs a goal atomically and rolls back assert/retract changes on failure, so a retry loop around transaction/1 cannot leave p