Propositional Logic#
Summary#
Propositional Logic (plog) system is an abstract data type defining logical relationships between variables in a combinatorial optimization manner.
Data types#
puan.logic.plog.AtLeast:AtLeastis a compound proposition which takes propositions and represents a lower bound on the result of those propositions. For example, select at least one of x, y and z would be defined asAtLeast(propositions=["x","y","z"], value=1)and represented by the linear inequality \(x+y+z \ge 1\).
puan.logic.plog.AtMost:AtMostis a compound proposition which takes propositions and represents a lower bound on the result of those propositions. For example, select at most two of x, y and z would be defined asAtMost(propositions=["x","y","z"], value=2)and represented by the linear inequality \(-x-y-z \ge -2\).
puan.logic.plog.All:Allis a compound proposition representing a conjunction of all given propositions.Allis represented by anAtLeastproposition with value set to the number of given propositions. For example,All("x","y","z")is equivalent toAtLeast(propositions=["x","y","z"], value=3).
puan.logic.plog.Any:Anyis a compound proposition representing a disjunction of all given propositions.Anyis represented by anAtLeastproposition with value set to 1. For example,Any("x","y","z")is equivalent toAtLeast(propositions=["x","y","z"], value=1).
puan.logic.plog.Imply:Implyis the implication logic operand and has two main inputs: condition and consequence. For example, if x is selected then y and z must be selected could be defined with theImplyclass asImply("x", All("y","z")).
puan.logic.plog.Xor:Xoris restricting all propositions within to be selected exactly once. For example,Xor("x","y","z")means that one and exactly one of x, y and z must be selected.
puan.logic.plog.XNor:XNoris a negatedXor. In the special case of two propositions, this is equivalent to the biconditional logical connective (<->).
puan.logic.plog.Not:Notis negating a proposition. For example,Not(All("x","y","z"))means that x, y and z can never be selected all together and is equivalent toAtMost(propositions=["x","y","z"], value=2).