Skip to content

zipper_algebra: Implement majority-of-three using DNF zipper merge#43

Open
marcin-rzeznicki wants to merge 1 commit into
zipper_xorfrom
zipper_maj
Open

zipper_algebra: Implement majority-of-three using DNF zipper merge#43
marcin-rzeznicki wants to merge 1 commit into
zipper_xorfrom
zipper_maj

Conversation

@marcin-rzeznicki

Copy link
Copy Markdown
Collaborator

This PR adds a majority zipper operation, returning values present in at least two of the three inputs.

The implementation is expressed directly in terms of the DNF merge engine using the identity:

maj(a, b, c)
  = (a ∧ b)
  ∨ (a ∧ c)
  ∨ (b ∧ c)

A value therefore survives iff it is present in at least two operands.

This serves both as a useful operation and as a demonstration of the expressive power of the DNF evaluator. Unlike pairwise merge operators such as Join, Meet, or Subtract, majority is naturally described as a disjunction of conjunctions, making it a good fit for the new DNF traversal framework.

The implementation reuses the existing DNF merge machinery and requires no specialized traversal logic.

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