Skip to content

Negative sets as data#341

Merged
jclaggett merged 3 commits intomainfrom
negative-sets-as-data
Mar 22, 2026
Merged

Negative sets as data#341
jclaggett merged 3 commits intomainfrom
negative-sets-as-data

Conversation

@jclaggett
Copy link
Copy Markdown
Collaborator

@jclaggett jclaggett commented Mar 21, 2026

This is a new article summarizing how to define negative sets as data and then how to work with them.

Gorm and others added 2 commits March 21, 2026 10:22
Cofinite sets with one sentinel key — all set operations reduce
to three map primitives (merge, keep, remove). No special types,
no wrapper objects, no case explosion.

Includes working Clojure implementation, verification of all four
polarity combinations, and proofs of De Morgan's laws, identity
elements, and self-complement properties.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Clay/Kindly article describing a map-based representation for finite and cofinite (“negative”) sets using a sentinel key, and derives union/intersection/difference/complement via a small dispatch table over three map primitives.

Changes:

  • New post file with Quarto metadata under :clay/:quarto.
  • Introduces a sentinel-key encoding (:neg) plus constructors/predicates.
  • Implements set operations via a 2×2 polarity dispatch and includes worked examples/verification tables.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/math/sets/negative_sets.clj
Comment thread src/math/sets/negative_sets.clj Outdated
Comment thread src/math/sets/negative_sets.clj Outdated
;; | Empty set | `{}` |
;; | Universal set | `{:neg :neg}` |
;; | Complement | Toggle `:neg` key |
;; | Membership | pos: `get ≠ nil` · neg: `get = nil` |
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The summary row for Membership says pos: get ≠ nil · neg: get = nil, but the implementation uses contains? (key presence). Using get is not equivalent when a set contains nil (or if values could ever be nil), since (get m nil) can’t distinguish “present with nil value” from “absent”. Suggest updating the summary to reflect contains?/find semantics (and, if desired, noting that get only works under the invariant value == key and key != nil).

Suggested change
;; | Membership | pos: `get ≠ nil` · neg: `get = nil` |
;; | Membership | pos: key present (`contains?` / `find`) · neg: key absent |

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in following commit

- Use map-* operations in table
- specify contains? in Membership
@jclaggett jclaggett merged commit 0648ca4 into main Mar 22, 2026
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