python-archieve-projects/WechatBot/node_modules/fp-ts/lib/BooleanAlgebra.js

83 lines
2.7 KiB
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFunctionBooleanAlgebra = exports.booleanAlgebraBoolean = exports.getDualBooleanAlgebra = exports.booleanAlgebraVoid = exports.reverse = void 0;
/**
* Boolean algebras are Heyting algebras with the additional constraint that the law of the excluded middle is true
* (equivalently, double-negation is true).
*
* Instances should satisfy the following laws in addition to the `HeytingAlgebra` laws:
*
* - Excluded middle: `a ¬a <-> 1`
*
* Boolean algebras generalize classical logic: one is equivalent to "true" and zero is equivalent to "false".
*
* @since 2.0.0
*/
var function_1 = require("./function");
// -------------------------------------------------------------------------------------
// combinators
// -------------------------------------------------------------------------------------
/**
* Every boolean algebras has a dual algebra, which involves reversing one/zero as well as join/meet.
*
* @since 2.10.0
*/
var reverse = function (B) { return ({
meet: function (x, y) { return B.join(x, y); },
join: function (x, y) { return B.meet(x, y); },
zero: B.one,
one: B.zero,
implies: function (x, y) { return B.join(B.not(x), y); },
not: B.not
}); };
exports.reverse = reverse;
// -------------------------------------------------------------------------------------
// instances
// -------------------------------------------------------------------------------------
/**
* @category instances
* @since 2.0.0
*/
exports.booleanAlgebraVoid = {
meet: function () { return undefined; },
join: function () { return undefined; },
zero: undefined,
one: undefined,
implies: function () { return undefined; },
not: function () { return undefined; }
};
// -------------------------------------------------------------------------------------
// deprecated
// -------------------------------------------------------------------------------------
/**
* Use [`reverse`](#reverse) instead.
*
* @category zone of death
* @since 2.0.0
* @deprecated
*/
exports.getDualBooleanAlgebra = exports.reverse;
/**
* Use [`BooleanAlgebra`](./boolean.ts.html#booleanalgebra) instead.
*
* @category zone of death
* @since 2.0.0
* @deprecated
*/
exports.booleanAlgebraBoolean = {
meet: function (x, y) { return x && y; },
join: function (x, y) { return x || y; },
zero: false,
one: true,
implies: function (x, y) { return !x || y; },
not: function (x) { return !x; }
};
/**
* Use [`getBooleanAlgebra`](./function.ts.html#getbooleanalgebra) instead.
*
* @category zone of death
* @since 2.0.0
* @deprecated
*/
exports.getFunctionBooleanAlgebra = function_1.getBooleanAlgebra;