Wikifunctions:Type proposals/Kleenean
Summary
The kleenean type represents values of three-valued logic: true, false and maybe
Uses
- Why should this exist?
So that we can represent three-valued logic.
- What kinds of functions would be created using this?
Most Boolean functions can be made to work with Kleeneans instead.
- What standard concepts, if any, does this align with?
The three-valued logic proposed by Stephen Cole Kleene.
See Wikifunctions:Project_chat/Archive/2024/06#Overloading_types_(or_not)
Structure
Kleeneans are represented as an enumeration with three values. Like all enumeration types, the Kleenean consists of a single key. The key is an identity key.
Values
There are three values.
- False
- Maybe
- True
Example values
Value
{
"type": "Kleenean",
"value": "True"
}
|
{
"Z1K1": "Znnnnn",
"ZnnnnnK1": "Zmmmmm"
}
|
Validator
The validator ensures that:
- the identity key points directly to a value of Kleenean
Identity
Two Kleeneans are the same if their identity is the same ZID.
Converting to code
Python
We represent them as numbers: 1 for true, 0 for maybe, and -1 for false.
JavaScript
We represent them as numbers: 1 for true, 0 for maybe, and -1 for false.
Renderer
As for all enumerations, the renderer displays the label of the value object.
Parsers
As with all enumerations, there is no parser, but a selector based on pre-defined values.
Alternatives
We could use Boolean (Z40) plus void (Z24), however that would require proper union types to correctly type in functions, which we do not have.
We could use sign, however the UI for that would not be great: Kleenean and (positive, neutral)
We could also represent them in code as 1 for true, 0.5 for maybe, and 0 for false
Comments
Support as proposer.
I am not a fan of the conversion to code but I do not know what we should do for that.ScienceD90 (talk) 19:56, 17 June 2024 (UTC)Weak oppose
Support (see replies) - is it really necessary? Functionally, the Sign (Z16659) object is really similar. I'm not opposed to the idea of making signs have Kleenean logic, though. infernostars (talk) (contribs) 18:52, 21 July 2024 (UTC)
- I made this proposal to avoid conflation between signs and Kleeneans. Which is easier to understand: Kleenean and (positive, neutral) or Kleenean and (Kleenean true, Kleenean maybe)? -- ScienceD90 (talk) 12:35, 22 July 2024 (UTC)
- Fair enough, casting between the two should be fairly easy if that's desired anyway. Changing my vote to a
Support. infernostars (talk) (contribs) 19:22, 22 July 2024 (UTC)
- Fair enough, casting between the two should be fairly easy if that's desired anyway. Changing my vote to a
- I made this proposal to avoid conflation between signs and Kleeneans. Which is easier to understand: Kleenean and (positive, neutral) or Kleenean and (Kleenean true, Kleenean maybe)? -- ScienceD90 (talk) 12:35, 22 July 2024 (UTC)
Support --dringsim 17:39, 27 October 2024 (UTC)
Support LGTM. Feeglgeef (talk) 01:09, 1 December 2024 (UTC)
Support Should be a simple and clean one. Unlikely to have heaps of use, but good to have. --99of9 (talk) 11:31, 20 January 2025 (UTC)