An explanation of what this package is about
[This explanation is taken from the vignette accompanying the package.]
The probability calculus is an extension of the calculus of propositional logic. Besides the truth or falsity of propositions, the probability calculus also considers a continuum of degrees of credibility – probabilities – between those two extremes. Just as propositional logic gives a set of rules to derive the truth or falsity of some propositions from the truth or falsity of others, so the probability calculus gives a set of rules to derive the probability for some propositions from the probability for others; these rules include the logical ones as a special case. (See vignette for references.)
There are different logical deduction systems, each with many dialects, to express the rules of propositional logic. One of them is the sequent calculus. The probability calculus has many analogies with the sequent calculus.
In sequent calculus we express that proposition is true within a set of axioms by the notation
The same is expressed in the probability calculus by the notation (note the reflection)
but in this case we can also consider degrees of credibility different from .
What about inferences?
In propositional logic, suppose we assert that:
- proposition is true given a set of axioms ,
- proposition is true given the set of axioms augmented with the proposition .
Then we can also assert that is true given the set of axioms . This is a logical inference. In the notation of sequent calculus (Takeuti 1987) it is written as follows:
The conclusion follows from the initial assertions by the application of a set of inference rules.
In the probability calculus the same inference can be expressed as follows:
This final probability can be shown to follow from the initial ones by the well-known probability rules. Another example of a simple probability inference, which immediately follows by the probability rules, is
The probability rules effectively imply the rules of propositional logic as special cases.
What’s remarkable is that the probability rules allow us to algorithmically determine the lower and upper values that a probability can have, under the assertion of the values of other probabilities. This algorithm is equivalent to solving a (fractional)-linear optimization problem. It is well-known, for instance, that if
then the probability cannot be larger than the minimum of the two above, that is,
The present package offers the function inferP()
, which implements this algorithm.
Examples
Let’s use inferP()
for the simple example just discussed:
inferP(
target = P(a & b | c),
P(a | c) == 0.2,
P(b | c) == 0.7
)
the answer we obtain is
min max
0.0 0.2
Now let’s check a classical logical inference, modus ponens. The symbol >
stands for if-then :
inferP(
target = P(b | I),
P(a > b | I) == 1,
P(a | I) == 1
)
min max
1 1
Other example: the probability of a proposition based on contradictory premises () is undefined:
inferP(
target = P(a | b & !b)
)
min max
NA NA
Let’s check a variant of the cut rule of sequent calculus:
inferP(
target = P(X + Y | I & J),
P(A & X | I) == 1,
P(Y | A & J) == 1
)
min max
1 1
More information about notation and constraints is available in the help function help('inferP')
. More interesting examples, such as the Monty Hall problem, are given in the package’s vignette.
Installation
The package can be installed with
remotes::install_github('pglpm/Pinference')
It requires the lpSolve package.