Draft
docs: document composition-operator semantics (XOR parity, self-XOR, AND-before-OR precedence)#824
Conversation
…AND-before-OR precedence)
Copilot
AI
changed the title
[WIP] Document composition operator semantics for AHB expressions
docs: document composition-operator semantics (XOR parity, self-XOR, AND-before-OR precedence)
Jul 23, 2026
hf-kklein
approved these changes
Jul 23, 2026
hf-kklein
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three non-obvious behaviours of
U/O/Xcomposition operators were undocumented, regularly surprising AHB authors and consumers. This PR adds the documentation — no behavioural changes.README — new "Operator Semantics & Precedence" section
U(AND) binds tighter thanO/X(OR/XOR).[1] O [2] U [3]parses as[1] O ([2] U [3]), not([1] O [2]) U [3]. Full precedence ladder documented.Xchains as a left-associative boolean XOR fold — fulfilled iff an odd number of operands are fulfilled. The trap:[1] X [2] X [3]with all three fulfilled →true.[1] X [1]is alwaysfalseregardless of[1]'s state.Also updated the existing functionality bullet to reference the new section and explicitly mention XOR in the precedence description.
Docstrings
LogicalOperator.XOR(enums.py): clarified parity semantics and self-XOR caveat; fixed typoexcluxive → exclusive.BaseTransformer.xor_composition(base_transformer.py): noted odd-parity and self-XOR in abstract method docstring.RequirementConstraintTransformer.xor_composition(requirement_constraint_expression_evaluation.py): added concrete parity examples ([1] X [2]→ false,[1] X [2] X [3]→ true).