Skip to content

feat(phl): add simplify if tactic#973

Merged
strub merged 1 commit intomainfrom
if-conversion
Apr 14, 2026
Merged

feat(phl): add simplify if tactic#973
strub merged 1 commit intomainfrom
if-conversion

Conversation

@bgregoir
Copy link
Copy Markdown
Contributor

@bgregoir bgregoir commented Apr 10, 2026

Summary

  • Add a new simplify if tactic that performs if-conversion on program
    statements, rewriting if statements into conditional expressions.
  • It is well known that wp on code containing sequences of if grows
    exponentially. By converting if statements into if expressions,
    the weakest precondition becomes linear in the size of the program.
  • The tactic preserves program semantics and can be applied to all
    program logics (hoare, bdhoare, ehoare).

Changes

  • ecPhlCodeTx: implement transform_if and recursive variant
  • ecLowPhlGoal: extend t_code_transform to support eHoare
    judgments, removing the now-unnecessary bdhoare flag
  • ecMatching: add MatchByPos branch selection variant to code
    positions
  • ecParser/ecParsetree: wire up the simplify if syntax
  • Add documentation (doc/tactics/simplify-if.rst) and worked
    examples (examples/tactics/simplify_if.ec)

Usage

(* Transform all if statements whose branches are pure assignments *)
simplify if.

(* Transform a specific if at a given code position *)
simplify if ^if.
simplify if ^if{2}.

@strub strub force-pushed the if-conversion branch 2 times, most recently from dc05bbf to 257fbb2 Compare April 13, 2026 20:18
@strub strub changed the title add tactic 'simplify if' performing if conversion feat(phl): add simplify if tactic Apr 13, 2026
Merges conditional branches that share common code. Also extends
`t_code_transform` to eHoare and adds `MatchByPos` branch selection.
@strub strub enabled auto-merge April 14, 2026 07:50
@strub strub added this pull request to the merge queue Apr 14, 2026
Merged via the queue into main with commit 9c8b4d9 Apr 14, 2026
16 checks passed
@strub strub deleted the if-conversion branch April 14, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants