Wang's idea is based around the notion of a sequent (this idea had been introduced years earlier by
Gentzen) and the manipulation of sequents. A sequent is essentially a list of formulae on either side
of a sequent (or provability) symbol
To prove whether a given sequent is true all you need to do is start from some basic sequents and successively apply a series of rules that transform sequents until you end up with the sequent you desire. This process is detailed below.
Additionally, determining whether a formula
We allow the following connectives in decreasing order of precedence:
symbol | meaning |
---|---|
negation | |
conjunction | |
disjunction | |
implication | |
biconditional (both same precedence) |
- A propositional symbol (e.g.
$p, q, ...$ ) is an atomic formula (and thus a formula). - If
$\phi, \psi$ are formulae, then$\neg\phi,\ \phi \land\ \psi,\ \phi \lor\ \psi,\ \phi \rightarrow \psi,\ \phi \leftrightarrow \psi$ are formulae.
If
The logic consists of the following sequent rules. The rst rule (P1) gives a characterisation of simple theorems. The remaining rules are simply ways of transforming sequents into new sequents. The manner in which you can construct a proof for a sequent to determine whether it holds or not is given below.
P1 Initial Rule: If
P2a Rule
P2b Rule
P3a Rule
P3b Rule
P4a Rule
P4b Rule
P5a Rule
P5b Rule
P6a Rule
P6b Rule
The basic idea in proving a sequent
Rule P1 | |
Rule P4a | |
Rule P2a | |
Rule P2b | |
However, a simpler idea (as it will involve much less search) is to begin with the sequent(s) to be proved and apply the rules above in the "backward" direction until you end up with the sequent you desire. In the example then, you would begin at step 4 and apply each of the rules in the backward direction until you end up at step 1 at which point you can conclude the original sequent is a theorem.
The input will consist of a single sequent on the command line. Sequents will be written as: [List of Formulae] seq [List of Formulae] To construct formulae, atoms can be any string of characters (without space) and connectives as follows:
-
$\neg$ : neg -
$\land$ : and -
$\lor$ : or -
$\to$ : imp -
$\leftrightarrow$ : iff -
$\vdash$ : seq
So, for example, the sequent
[p imp q, (neg r) imp (neg q)] seq [p imp r]
Your program should be called assn1q3 and run as follows:
python AutoProve.py "Sequent"
For example
- MAC or linux OS
$ python3 AutoProve.py '[p imp q, (neg r) imp (neg q)] seq [p imp r]'
- window 10
> python AutoProve.py '[p imp q, (neg r) imp (neg q)] seq [p imp r]'
the output will be either True or False and give the proof process.
-
[1] Hao Wang, Toward Mechanical Mathematics, IBM Journal for Research and Development, volume 4, 1960. (Reprinted in: Hao Wang, "Logic, Computers, and Sets", Sciene Press, Peking, 1962. Hao Wang, "A Survey of Mathematical Logic", North Holland Publishing Company, 1964. Hao Wang, "Logic, Computers, and Sets", Chelsea Publishing Company, New York, 1970.)
-
[2] Alfred North Whitehead and Bertrand Russell, Principia Mathematica, 2nd Edition, Cambridge University Press, Cambridge, England, 1927.
Note: please install the plugin for google chrome named MathJex