Fluff around what a cofinite set is.

This commit is contained in:
Alexander McCord 2024-05-08 21:53:46 -07:00 committed by GitHub
parent 0947a3d517
commit 82626520a1
Signed by: DevComp
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,7 @@ A type that represents the complement of the type being negated, which is a unio
Type refinements will produce negation types to get the complementation. For the most part, users will never need to write these negation types themselves, except for when they want to _maintain_ some invariants beyond the scope of the branch.
A [cofinite set](https://en.wikipedia.org/wiki/Cofiniteness) arises when you have a negation type in conjunction with intersection types. For example, `string & ~"a"` is a cofinite string set that accepts any `string` excluding `"a"`. This happens often with type refinements where `typeof(x) == "string" and x ~= "a"` gives rise to the type `string & ~"a"`.
A [cofinite set](https://en.wikipedia.org/wiki/Cofiniteness) arises when you have some negated `X` in conjunction with some supertype of `X`. For example, `string & ~"a"` is a cofinite string set that accepts any `string` excluding `"a"`. This happens often with type refinements where `typeof(x) == "string" and x ~= "a"` gives rise to the type `string & ~"a"`.
## Design