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.
Structure
Signs 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 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)
…