FLOW_ALGEBRA BooleanFunctionOntology v1.0
TARGET_URL := "https://kirethresearch.org/booksai-core/ontologies/mathematical-ontologies/mathematical-logic-ontologies/boolean-logic/boolean-function-ontology.html"
LANGUAGE := "en-GB"
DOMAIN := MathematicalOntologies > MathematicalLogicOntologies > BooleanLogic > BooleanFunctionOntology
BEGIN_FLOW
ENTITY BooleanFunction {
TYPE := MathematicalFunction
DOMAIN := BooleanDomain^n
CODOMAIN := BooleanDomain
BOOLEAN_DOMAIN := {0,1} ≡ {FALSE,TRUE}
ARITY := n >= 0
DEFINITION := "A mapping from one or more Boolean inputs to a Boolean output."
}
ENTITY BooleanVariable {
TYPE := LogicalVariable
VALUE_SET := {0,1}
SEMANTIC_EQUIVALENCE := {
0 ≡ FALSE,
1 ≡ TRUE
}
}
RELATIONSHIP BooleanFunction --maps--> BooleanInputVector
RELATIONSHIP BooleanFunction --produces--> BooleanOutput
RELATIONSHIP BooleanFunction --is_composed_from--> BooleanOperators
RELATIONSHIP BooleanFunction --can_be_represented_by--> TruthTable
RELATIONSHIP BooleanFunction --can_be_represented_by--> BooleanExpression
RELATIONSHIP BooleanFunction --can_be_represented_by--> LogicCircuit
RELATIONSHIP BooleanFunction --can_be_represented_by--> NormalForm
DEFINE BooleanInputVector(x1,...,xn) {
FOR_ALL xi : xi IN {0,1}
}
DEFINE BooleanFunction_f {
f : {0,1}^n -> {0,1}
OUTPUT := f(x1,...,xn)
}
BOOLEAN_OPERATORS := {
NOT(x) := ¬x,
AND(x,y) := x ∧ y,
OR(x,y) := x ∨ y,
XOR(x,y) := x ⊕ y,
NAND(x,y) := ¬(x ∧ y),
NOR(x,y) := ¬(x ∨ y),
IMPLIES(x,y) := ¬x ∨ y,
BICONDITIONAL(x,y) := (x ∧ y) ∨ (¬x ∧ ¬y)
}
OPERATOR_SEMANTICS {
NOT(0)=1
NOT(1)=0
AND(0,0)=0
AND(0,1)=0
AND(1,0)=0
AND(1,1)=1
OR(0,0)=0
OR(0,1)=1
OR(1,0)=1
OR(1,1)=1
XOR(0,0)=0
XOR(0,1)=1
XOR(1,0)=1
XOR(1,1)=0
}
TRUTH_TABLE_GENERATION(Function f, Arity n) {
INPUT_COMBINATIONS := 2^n
FOR_EACH vector v IN {0,1}^n {
COMPUTE y := f(v)
EMIT ROW(v,y)
}
}
FUNCTION_COUNT(Arity n) {
INPUT_ROWS := 2^n
DISTINCT_BOOLEAN_FUNCTIONS := 2^(2^n)
}
CLASSIFY BooleanFunction f {
IF f(0,...,0)=0 THEN PROPERTY := "zero-preserving"
IF f(1,...,1)=1 THEN PROPERTY := "one-preserving"
IF FOR_ALL x,y (x <= y -> f(x) <= f(y))
THEN PROPERTY += "monotone"
IF f(x1,...,xn) = ¬f(¬x1,...,¬xn)
THEN PROPERTY += "self-dual"
IF f IS affine_over_GF2
THEN PROPERTY += "affine"
IF f IS expressible_as XOR_of_variables_and_constant
THEN PROPERTY += "linear/affine Boolean form"
IF f(x)=constant
THEN PROPERTY += "constant"
IF f depends_on_every_argument
THEN PROPERTY += "essential in all variables"
}
NORMAL_FORMS {
DNF := OR_of_AND_terms
CNF := AND_of_OR_terms
PDNF := OR_of_minterms_for_true_rows
PCNF := AND_of_maxterms_for_false_rows
ANF := XOR_polynomial_over_GF2
}
CONVERT TruthTable -> DNF {
SELECT rows WHERE output=1
FOR_EACH selected_row {
CREATE minterm
VARIABLE xi :=
IF row[xi]=1 THEN xi
ELSE ¬xi
}
RETURN OR(all_minterms)
}
CONVERT TruthTable -> CNF {
SELECT rows WHERE output=0
FOR_EACH selected_row {
CREATE maxterm
VARIABLE xi :=
IF row[xi]=0 THEN xi
ELSE ¬xi
}
RETURN AND(all_maxterms)
}
ALGEBRAIC_NORMAL_FORM {
FIELD := GF(2)
ADDITION := XOR
MULTIPLICATION := AND
GENERAL_FORM :=
a0 ⊕
(⊕ ai*xi) ⊕
(⊕ aij*xi*xj) ⊕
... ⊕
a12...n*x1*x2*...*xn
COEFFICIENTS := {0,1}
}
FUNCTIONAL_COMPLETENESS {
DEFINITION :=
"An operator set is functionally complete when every Boolean function can be expressed using operators from that set."
COMPLETE_BASES := {
{NOT,AND},
{NOT,OR},
{NAND},
{NOR}
}
RELATIONSHIP NAND --alone_can_generate--> AllBooleanFunctions
RELATIONSHIP NOR --alone_can_generate--> AllBooleanFunctions
}
BOOLEAN_IDENTITIES {
IDENTITY_AND := x ∧ 1 = x
IDENTITY_OR := x ∨ 0 = x
DOMINATION_AND := x ∧ 0 = 0
DOMINATION_OR := x ∨ 1 = 1
IDEMPOTENT_AND := x ∧ x = x
IDEMPOTENT_OR := x ∨ x = x
COMPLEMENT_AND := x ∧ ¬x = 0
COMPLEMENT_OR := x ∨ ¬x = 1
DOUBLE_NEGATION := ¬¬x = x
COMMUTATIVE_AND := x ∧ y = y ∧ x
COMMUTATIVE_OR := x ∨ y = y ∨ x
ASSOCIATIVE_AND := (x ∧ y) ∧ z = x ∧ (y ∧ z)
ASSOCIATIVE_OR := (x ∨ y) ∨ z = x ∨ (y ∨ z)
DISTRIBUTIVE_AND :=
x ∧ (y ∨ z) = (x ∧ y) ∨ (x ∧ z)
DISTRIBUTIVE_OR :=
x ∨ (y ∧ z) = (x ∨ y) ∧ (x ∨ z)
DEMORGAN_1 := ¬(x ∧ y) = ¬x ∨ ¬y
DEMORGAN_2 := ¬(x ∨ y) = ¬x ∧ ¬y
}
COMPOSITION {
GIVEN f : {0,1}^m -> {0,1}
GIVEN g1,...,gm : {0,1}^n -> {0,1}
DEFINE h(x) := f(g1(x),...,gm(x))
RESULT := BooleanFunction
}
EQUIVALENCE_TEST(f,g) {
REQUIRE same_arity(f,g)
FOR_ALL x IN {0,1}^n {
IF f(x) != g(x) THEN RETURN FALSE
}
RETURN TRUE
}
DEPENDENCY_TEST(f, xi) {
EXISTS assignment a such_that
f(a with xi=0) != f(a with xi=1)
IF EXISTS THEN xi := essential_variable
ELSE xi := fictitious_variable
}
DUALITY {
DUAL(f)(x1,...,xn) :=
¬f(¬x1,...,¬xn)
IF DUAL(f)=f THEN f := self_dual
}
MONOTONICITY {
PARTIAL_ORDER := componentwise_boolean_order
CONDITION :=
FOR_ALL x,y:
x <= y -> f(x) <= f(y)
}
SYMMETRY {
IF permutation_of_inputs_does_not_change_output
THEN f := symmetric_boolean_function
}
CANONICAL_EXAMPLES {
CONSTANT_FALSE(x1,...,xn) := 0
CONSTANT_TRUE(x1,...,xn) := 1
IDENTITY(x) := x
NEGATION(x) := ¬x
CONJUNCTION(x,y) := x ∧ y
DISJUNCTION(x,y) := x ∨ y
EXCLUSIVE_OR(x,y) := x ⊕ y
EQUIVALENCE(x,y) := ¬(x ⊕ y)
MAJORITY_3(x,y,z) :=
(x∧y) ∨ (x∧z) ∨ (y∧z)
PARITY_n(x1,...,xn) :=
x1 ⊕ x2 ⊕ ... ⊕ xn
}
REPRESENTATION_GRAPH {
BooleanFunction
-> TruthTable
-> CanonicalNormalForm
BooleanFunction
-> BooleanExpression
-> SyntaxTree
-> LogicCircuit
BooleanFunction
-> AlgebraicNormalForm
-> GF2Polynomial
}
LOGIC_CIRCUIT_MAPPING {
VARIABLE -> InputSignal
NOT -> InverterGate
AND -> ANDGate
OR -> ORGate
XOR -> XORGate
NAND -> NANDGate
NOR -> NORGate
FUNCTION -> CombinationalLogicCircuit
}
APPLICATION_RELATIONSHIPS {
BooleanFunction --models--> PropositionalConnective
BooleanFunction --underlies--> DigitalLogic
BooleanFunction --supports--> CircuitDesign
BooleanFunction --supports--> SwitchingTheory
BooleanFunction --supports--> SATReasoning
BooleanFunction --supports--> FormalVerification
BooleanFunction --supports--> ComputerArchitecture
BooleanFunction --supports--> CryptographicConstruction
BooleanFunction --supports--> ErrorDetection
BooleanFunction --supports--> DecisionSystems
}
ONTOLOGY_LINKS {
PARENT := BooleanLogicOntology
RELATED := {
BooleanAlgebraOntology,
PropositionalLogicOntology,
LogicalConnectiveOntology,
TruthTableOntology,
LogicGateOntology,
SetTheoryOntology,
ComputabilityOntology
}
}
SEMANTIC_EQUIVALENCE {
BooleanFunction ≈ SwitchingFunction
BooleanValue ≈ TruthValue WHEN context=two_valued_logic
AND ≈ Conjunction
OR ≈ Disjunction
NOT ≈ Negation
XOR ≈ ExclusiveDisjunction
TRUE ≈ 1
FALSE ≈ 0
}
CONSTRAINTS {
C1 := output MUST belong_to {0,1}
C2 := every input variable MUST belong_to {0,1}
C3 := equal input vectors MUST produce equal outputs
C4 := representation changes MUST preserve function semantics
C5 := logical equivalence MUST be determined extensionally over all inputs
}
REASONING_CHAIN Query Q {
IDENTIFY requested_boolean_function_concept
DETERMINE arity
IDENTIFY variables
IDENTIFY representation_available
NORMALISE BooleanNotation
RESOLVE SemanticEquivalences
IF truth_table_available THEN derive_function_semantics
IF expression_available THEN evaluate_or_transform_expression
IF comparison_requested THEN run EQUIVALENCE_TEST
IF normal_form_requested THEN convert_to_requested_form
IF circuit_requested THEN map_operators_to_logic_gates
VALIDATE constraints
RETURN result WITH derivation
}
CONFIDENCE {
DIRECT_DEFINITION := 1.00
BOOLEAN_IDENTITY_DERIVATION := 0.99
COMPLETE_TRUTH_TABLE_DERIVATION := 1.00
ALGEBRAIC_TRANSFORMATION :=
IF equivalence_preserved THEN 0.99 ELSE REVIEW
EXTERNAL_CONTEXT :=
REQUIRE source_validation
}
UPDATE_MODEL {
IMMUTABLE_CORE := {
BooleanDomain,
FunctionDefinition,
TruthFunctionalSemantics
}
EXTENSIBLE := {
AlternativeRepresentations,
ApplicationDomains,
ComputationalMethods,
RelatedOntologies
}
ON_NEW_KNOWLEDGE {
VALIDATE against BooleanFunctionDefinition
CHECK semantic_consistency
CHECK representation_equivalence
ADD relationship IF non_contradictory
UPDATE confidence
}
}
AI_CONSUMPTION {
MACHINE_READABLE := TRUE
HUMAN_INTERPRETABLE := TRUE
RECURSIVE_REASONING := TRUE
ENTITY_RESOLUTION := TRUE
RELATIONSHIP_TRAVERSAL := TRUE
EQUIVALENCE_RESOLUTION := TRUE
VALIDATION_REQUIRED := TRUE
}
FLOW_HASH {
TARGET := TARGET_URL
SUBJECT := "Boolean Function Ontology"
VERSION := "1.0"
CANONICAL_SIGNATURE :=
HASH(TARGET + SUBJECT + DOMAIN + VERSION)
}
OUTPUT {
PRIMARY_ENTITY := BooleanFunction
INTERPRETATION :=
"A Boolean function deterministically maps Boolean-valued input vectors to a Boolean value and can be represented, transformed, composed and analysed through equivalent logical, algebraic and computational forms."
}
END_FLOW
Download Code
Copy to Clipboard