Skip to content

Dedup: extract shared _all_elim_str helper for AllElim/AllElimTypes (refs #813) - #1147

Open
jsiek wants to merge 1 commit into
mainfrom
routine/20260728-010202
Open

Dedup: extract shared _all_elim_str helper for AllElim/AllElimTypes (refs #813)#1147
jsiek wants to merge 1 commit into
mainfrom
routine/20260728-010202

Conversation

@jsiek

@jsiek jsiek commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

Small duplication-reduction slice for the #813 umbrella.

AllElim.__str__ and AllElimTypes.__str__ in abstract_syntax/proofs.py
were byte-for-byte identical except for the two bracket glyphs — [/] for
term arguments vs </> for type arguments. Both already delegated their
base-proof rendering to the module-level _postfix_base_str.

This PR folds the shared control flow into a new module-level helper next to
_postfix_base_str:

def _all_elim_str(univ, arg, pos, open_b, close_b) -> str: ...

so each __str__ becomes a one-line call:

  • AllElimTypes.__str___all_elim_str(self.univ, self.arg, self.pos, "<", ">")
  • AllElim.__str___all_elim_str(self.univ, self.arg, self.pos, "[", "]")

No behavior change: the emitted string is identical for both cases.

Tests

Ran locally (green):

  • python3 test-deduce.py --equiv — RD/LALR AST equivalence and the
    pretty-print round-trip corpus, which exercises AllElim/AllElimTypes
    printing directly.
  • python3 test-deduce.py --passable — should-validate under both parsers.

ruff and mypy are not installed in this container; CI's static-checks leg
covers them. The change is a pure refactor with no signature changes to public
APIs.

Refs #813.

Resume this session on ginger: ~/deduce-runner/resume.sh 208dc587-9660-431b-b3f2-a9d904333886 routine/20260728-010202

🤖 Generated with Claude Code

…refs #813)

AllElim.__str__ and AllElimTypes.__str__ were byte-for-byte identical
except for the bracket glyphs ([ ] vs < >). Fold the shared logic into
a module-level _all_elim_str(univ, arg, pos, open_b, close_b) helper
next to _postfix_base_str, which both already call.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant