kleenelogic 1.0.4

dotnet add package kleenelogic --version 1.0.4
                    
NuGet\Install-Package kleenelogic -Version 1.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="kleenelogic" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="kleenelogic" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="kleenelogic" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add kleenelogic --version 1.0.4
                    
#r "nuget: kleenelogic, 1.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package kleenelogic@1.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=kleenelogic&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=kleenelogic&version=1.0.4
                    
Install as a Cake Tool

KleeneLogic

KleeneLogic is a compact, fast implementation of Kleene's strong three-valued logic (K3) for C# / .NET. It gives you True, False, and Unknown with real logic operators.

Install

dotnet add package KleeneLogic

Quick start

using KleeneLogic;

Kleene a = Kleene.True;
Kleene b = Kleene.Unknown;

var result = a & b | !a;

Why use this

  • bool? (nullable Boolean) has the right values but no operators
  • You can keep uncertainty without collapsing it to false
  • Operators are branch-free and follow K3 truth tables

Control flow semantics

Kleene defines operator true and operator false:

  • if (k) runs only when k == True
  • if (!k) runs only when k == False
  • Unknown is neither true nor false

Defaults (explicit collapse)

Kleene isAllowed = ruleResult.Default(Kleene.False);
bool canProceed = isApproved.Default(false);

Parsing

Kleene k = Kleene.Parse("unknown"); // invariant default

Accepted invariant inputs are case-insensitive true, false, unknown. Alias for unknown: maybe. Numeric forms -1, 0, 1 are also accepted. Overloads accepting an IFormatProvider enable language-specific tokens. No-culture overloads use invariant terms; English culture (en-*) uses yes, no, unknown. Invariant input tokens true, false, maybe are accepted even with an explicit non-invariant culture. Language terms are read from kleene.language-terms.json next to the assembly, with built-in fallback defaults.

JSON (System.Text.Json)

using KleeneLogic;
using KleeneLogic.Serialization;
using System.Text.Json;

var opts = new JsonSerializerOptions();
opts.Converters.Add(new KleeneJsonConverter());

var k = JsonSerializer.Deserialize<Kleene>("null", opts); // Unknown
  • Source and full documentation: see the repository root README.md
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 82 3/20/2026
1.0.2 79 3/20/2026
1.0.0 94 2/3/2026