Predicate logic: How do you self-check the logical structure of your own arguments?Can you use both sides of an equation to prove equality?Can every true theorem that has a proof be proven by contradiction?What are the prerequisites for studying mathematical logic?Computability viewpoint of Godel/Rosser's incompleteness theoremCalculus of Natural Deduction That Works for Empty StructuresQuantifier inference rules restrictionsGiven $(p ⇒ (q ⇒ r))$, use the Fitch system to prove $((p ⇒ q) ⇒ (p ⇒ r))$Translating between Huth/Ryan box and Fitch notationsComplete calculus of first-order logic working for empty structures toobook recommendation - formal systemsWhy is axiomatic system needed in propositional logic?Logical structure of arguments.What syntax exists for higher order logic?Decidability of predicate calculus with equality onlyModels and signatures for propositional logicOn understanding nullary relations and the definition of $mathfrak A models P$ for a structure $mathfrak A$ and 0-ary predicate $P$How does one show that every L-tautology $varphi$ is provable $vdash varphi$?How does one show that an intersection of set of propositions is provable iff each proposition is individually provable?Confusion over the definition of “model”First order theory for a given sentential logic

Why didn’t Eve recognize the little cockroach as a living organism?

Does convergence of polynomials imply that of its coefficients?

Animating wave motion in water

What is the reasoning behind standardization (dividing by standard deviation)?

DisplayForm problem with pi in FractionBox

Weird lines in Microsoft Word

Would mining huge amounts of resources on the Moon change its orbit?

Why are there no stars visible in cislunar space?

When should a starting writer get his own webpage?

Why does Surtur say that Thor is Asgard's doom?

Do native speakers use "ultima" and "proxima" frequently in spoken English?

Knife as defense against stray dogs

Print a physical multiplication table

Should I be concerned about student access to a test bank?

Why is there so much iron?

What is the difference between something being completely legal and being completely decriminalized?

is this saw blade faulty?

The English Debate

Norwegian Refugee travel document

Fair way to split coins

What is the tangent at a sharp point on a curve?

Help with identifying unique aircraft over NE Pennsylvania

How old is Nick Fury?

Is VPN a layer 3 concept?



Predicate logic: How do you self-check the logical structure of your own arguments?


Can you use both sides of an equation to prove equality?Can every true theorem that has a proof be proven by contradiction?What are the prerequisites for studying mathematical logic?Computability viewpoint of Godel/Rosser's incompleteness theoremCalculus of Natural Deduction That Works for Empty StructuresQuantifier inference rules restrictionsGiven $(p ⇒ (q ⇒ r))$, use the Fitch system to prove $((p ⇒ q) ⇒ (p ⇒ r))$Translating between Huth/Ryan box and Fitch notationsComplete calculus of first-order logic working for empty structures toobook recommendation - formal systemsWhy is axiomatic system needed in propositional logic?Logical structure of arguments.What syntax exists for higher order logic?Decidability of predicate calculus with equality onlyModels and signatures for propositional logicOn understanding nullary relations and the definition of $mathfrak A models P$ for a structure $mathfrak A$ and 0-ary predicate $P$How does one show that every L-tautology $varphi$ is provable $vdash varphi$?How does one show that an intersection of set of propositions is provable iff each proposition is individually provable?Confusion over the definition of “model”First order theory for a given sentential logic













7












$begingroup$


In propositional logic, there are truth tables. So you can check if the logical structure of your argument is, not correct per se, but if it's what you intended it to be.



In predicate logic, I have seen no reference to truth tables, nor have I seen any use (literal use) of truth tables when searching for examples where truth tables are used in PL.



It would be nice to check the logical structure of my own arguments, as I will not always have someone to validate my own work. I plan on employing my skills in logic, but I want a sure fire way to ensure that my form is correct :)










share|cite|improve this question









$endgroup$







  • 1




    $begingroup$
    There are well-known rules of inference.
    $endgroup$
    – Hagen von Eitzen
    Mar 3 '16 at 19:03










  • $begingroup$
    There are several proof verification software packages that are available free online.
    $endgroup$
    – Dan Christensen
    Mar 4 '16 at 4:53











  • $begingroup$
    Starting from a set of axioms, you can carry out your proof in some Hilbert style deduction system. In fact, "natural" proofs (those that we use on a daily basis) can be thought of as instructions to build a formal deduction in the Hilbert calculus...
    $endgroup$
    – Stefan Mesken
    Mar 5 '16 at 14:26
















7












$begingroup$


In propositional logic, there are truth tables. So you can check if the logical structure of your argument is, not correct per se, but if it's what you intended it to be.



In predicate logic, I have seen no reference to truth tables, nor have I seen any use (literal use) of truth tables when searching for examples where truth tables are used in PL.



It would be nice to check the logical structure of my own arguments, as I will not always have someone to validate my own work. I plan on employing my skills in logic, but I want a sure fire way to ensure that my form is correct :)










share|cite|improve this question









$endgroup$







  • 1




    $begingroup$
    There are well-known rules of inference.
    $endgroup$
    – Hagen von Eitzen
    Mar 3 '16 at 19:03










  • $begingroup$
    There are several proof verification software packages that are available free online.
    $endgroup$
    – Dan Christensen
    Mar 4 '16 at 4:53











  • $begingroup$
    Starting from a set of axioms, you can carry out your proof in some Hilbert style deduction system. In fact, "natural" proofs (those that we use on a daily basis) can be thought of as instructions to build a formal deduction in the Hilbert calculus...
    $endgroup$
    – Stefan Mesken
    Mar 5 '16 at 14:26














7












7








7


12



$begingroup$


In propositional logic, there are truth tables. So you can check if the logical structure of your argument is, not correct per se, but if it's what you intended it to be.



In predicate logic, I have seen no reference to truth tables, nor have I seen any use (literal use) of truth tables when searching for examples where truth tables are used in PL.



It would be nice to check the logical structure of my own arguments, as I will not always have someone to validate my own work. I plan on employing my skills in logic, but I want a sure fire way to ensure that my form is correct :)










share|cite|improve this question









$endgroup$




In propositional logic, there are truth tables. So you can check if the logical structure of your argument is, not correct per se, but if it's what you intended it to be.



In predicate logic, I have seen no reference to truth tables, nor have I seen any use (literal use) of truth tables when searching for examples where truth tables are used in PL.



It would be nice to check the logical structure of my own arguments, as I will not always have someone to validate my own work. I plan on employing my skills in logic, but I want a sure fire way to ensure that my form is correct :)







logic predicate-logic






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Mar 3 '16 at 18:52









Jim JamJim Jam

6701722




6701722







  • 1




    $begingroup$
    There are well-known rules of inference.
    $endgroup$
    – Hagen von Eitzen
    Mar 3 '16 at 19:03










  • $begingroup$
    There are several proof verification software packages that are available free online.
    $endgroup$
    – Dan Christensen
    Mar 4 '16 at 4:53











  • $begingroup$
    Starting from a set of axioms, you can carry out your proof in some Hilbert style deduction system. In fact, "natural" proofs (those that we use on a daily basis) can be thought of as instructions to build a formal deduction in the Hilbert calculus...
    $endgroup$
    – Stefan Mesken
    Mar 5 '16 at 14:26













  • 1




    $begingroup$
    There are well-known rules of inference.
    $endgroup$
    – Hagen von Eitzen
    Mar 3 '16 at 19:03










  • $begingroup$
    There are several proof verification software packages that are available free online.
    $endgroup$
    – Dan Christensen
    Mar 4 '16 at 4:53











  • $begingroup$
    Starting from a set of axioms, you can carry out your proof in some Hilbert style deduction system. In fact, "natural" proofs (those that we use on a daily basis) can be thought of as instructions to build a formal deduction in the Hilbert calculus...
    $endgroup$
    – Stefan Mesken
    Mar 5 '16 at 14:26








1




1




$begingroup$
There are well-known rules of inference.
$endgroup$
– Hagen von Eitzen
Mar 3 '16 at 19:03




$begingroup$
There are well-known rules of inference.
$endgroup$
– Hagen von Eitzen
Mar 3 '16 at 19:03












$begingroup$
There are several proof verification software packages that are available free online.
$endgroup$
– Dan Christensen
Mar 4 '16 at 4:53





$begingroup$
There are several proof verification software packages that are available free online.
$endgroup$
– Dan Christensen
Mar 4 '16 at 4:53













$begingroup$
Starting from a set of axioms, you can carry out your proof in some Hilbert style deduction system. In fact, "natural" proofs (those that we use on a daily basis) can be thought of as instructions to build a formal deduction in the Hilbert calculus...
$endgroup$
– Stefan Mesken
Mar 5 '16 at 14:26





$begingroup$
Starting from a set of axioms, you can carry out your proof in some Hilbert style deduction system. In fact, "natural" proofs (those that we use on a daily basis) can be thought of as instructions to build a formal deduction in the Hilbert calculus...
$endgroup$
– Stefan Mesken
Mar 5 '16 at 14:26











1 Answer
1






active

oldest

votes


















8












$begingroup$

Truth tables are not enough to capture first-order logic (with quantifiers), so we use inference rules instead. Each inference rule is chosen to be sound, meaning that if you start with true statements and use the rule you will deduce only true statements. We say that these rules are truth-preserving. If you choose carefully enough, you can make it so that the rules are not just truth-preserving but also allow you to deduce every (well-formed) statement that is necessarily true (in all situations).



What you are probably looking for (namely a practical way to rigorously check the logical validity of your arguments) is natural deduction. There are many different styles, the most intuitive type being Fitch-style, which mark subcontexts using indentation or some related visual demarcation. The following system uses indentation and follows the intuition most closely in my opinion.
$
defblock#1beginarrayll &#1endarray
deffitch#1#2beginarrayl#1\hline#2endarray
defsub#1#2text#1:\block#2
defimpRightarrow
defeqLeftrightarrow
defnnmathbbN
defnonevarnothing
defpowmathcalP
$




Contexts



Every line is either a header or a statement. Only headers can have lines subsumed under it, as in a multi-level list. The context of each statement is specified by all the headers that are in effect.



For example a case analysis would look like:



$subIf $A$... \ subIf $neg A$...$



And reasoning about an arbitrary member of a collection $S$ would look like:



$subGiven $x in S$...$



Note that what is stated in some context may be invalid in other contexts. Once you understand the principle behind contexts and the indentation, the following rules are very natural. Also note that for first-order logic the above two kinds of context headers (for conditional subcontexts and universal subcontexts respectively) are the only kinds needed.



Syntax rules



A statement must be an atomic (indivisible) proposition or a compound statement formed in the usual way using boolean operations or quantifiers, with the restriction that every variable that is bound by a quantifier is not already used to refer to some object in the current context, and that there are no nested quantifiers that bind the same variable.



Natural deduction rules



Each inference rule is of the form:



$fitchtextXtextY$



which means that if the last lines you have written match "X" then you can write "Y" immediately after that at the same level of indentation. Each application of an inference rule is also tied to the current context, which is defined to be the context of "X". We will not mention "current context" all the time.




Boolean operations



Take any statements $A,B,C$ (in the current context).



restate: If we prove something we can affirm it again in the same context.



$fitchA.\...A.$



Note that "$...$" denote any number of lines that are at least at the depicted indentation level. In the above rule, this means that all the lines written since the earlier writing of "$A.$" must be in the same context (or some subcontext).



In practice we never actually write the same line twice, but to make the description of the rules easy we shall to consider it written anyway. I'll mark all such lines with square-brackets as follows:



$fitchA. \ ...[A.]$



⇒sub     ⇒restate     (We can create a conditional subcontext where $A$ holds.)



$fitchsubIf $A$[A.]$
$fitchB. \ ... \ subIf $A$...block[B.]$



⇒intro     ⇒elim     ("$imp$" internally captures contextual statements.)



$fitchsubIf $A$... \ B. \ ... \ ...[A imp B.]$
$fitchA imp B. \ A.B.$



∧intro     ∧elim



$fitchA. \ B.A land B.$
$fitchA land B.[A.] \ [B.]$



∨intro     ∨elim



$fitchA.[A lor B.] \ [B lor A.]$
$fitchA lor B. \ A imp C. \ B imp C.C.$



¬intro     ¬elim     ¬¬elim



$fitchA imp bot.neg A.$
$fitchA. \ neg A.bot.$
$fitchneg neg A.A.$



Note that by using ¬intro and ¬¬elim we can get the following additional inference rule:



$fitchneg A imp bot.A.$



which corresponds to how one would attempt to prove $A$ by contradiction, namely to show that assuming $neg A$ implies a falsehood.



⇔intro     ⇔elim



$fitchA imp B. \ B imp A.A eq B.$
$fitchA eq B.[A imp B.] \ [B imp A.]$



Quantifiers and equality



I show the rules for restricted quantifiers because usually we think in terms of them. First we need some definitions.



Unused variable: A variable that is not declared in the header of any containing ∀-subcontext or in any previous ∃-elimination ("let") step in the current context or any containing contexts.



Fresh variable: A variable that does not appear in any previous statement.



Object expression: An expression that refers to an object. In classical first-order logic, the object expressions are simply the well-formed terms (whose free variables are each declared in the header of some containing ∀-subcontext). In the following rules $E,F$ (if involved) can be any object expressions.



And we need at least one type over which we can quantify, which is provided by the following rule.



universe: $obj$ is a type, which includes all objects.



$fitch[E in obj.]$



Now take any type $S$ and a property $P$ and an unused variable $x$ that does not appear in $S$ or $P$. By $P$ being a property we mean that $P(x)$ is a statement about $x$.



∀sub         ∀restate         (We can create a subcontext in which $x$ is of type $S$.)



$fitchsubGiven $x in S$[x in S.]$
$fitchA. \ ... \ subGiven $x in S$...block[A.]$ ($x$ must not appear in $A$)



∀intro         ∀elim



$fitchsubGiven $x in S$... \ P(x). \ ... \ ...forall x in S ( P(x) ).$
$fitchforall x in S ( P(x) ). \ ... \ E in S. \ ...P(E).$ (unused variables appearing in $P$ must not appear in $E$)



∃intro           ∃elim



$fitchE in S. \ ... \ P(E). \ ...exists x in S ( P(x) ).$
$fitchexists x in S ( P(x) ).textLet $y in S$ such that $P(y)$. \ [y in S.] \ [P(y).]$ (where $y$ is a fresh variable)



=intro       =elim



$fitch[E=E.]$
$fitchE=F. \ P(E).P(F).$ (unused variables appearing in $P$ must not appear in $F$)



Variable renaming



Finally, the following rules for variable renaming are redundant, but would significantly shorten proofs.



∀rename         ∃rename



$fitchforall x in S ( P(x) ).[forall y in S ( P(y) ).]$
$fitchexists x in S ( P(x) ).[exists y in S ( P(y) ).]$



  (where $y$ is an unused variable that does not appear in $P$)



Short-forms



For convenience we also write "$forall x,y in S ( P(x,y) )$" as short-form for "$forall x in S ( forall y in S ( P(x,y) ) )$", and similarly for more variables and for "$exists$".



Additionally, "$exists! x in S ( P(x) )$" is short-form for "$exists x in S ( P(x) land forall y in S ( P(y) imp x=y ) )$".




Example



Here is an example, where $S,T$ are any types and $P$ is any property with two parameters.



First with all lines shown:



  If $exists x in S ( forall y in T ( P(x,y) ) )$:   [⇒sub]

    $exists x in S ( forall y in T ( P(x,y) ) )$.   [⇒sub]

    Let $a in S$ such that $forall y in T ( P(a,y) )$.   [∃elim]

    $a in S$.   [∃elim]

    $forall y in T ( P(a,y) )$.   [∃elim]

    $forall z in T ( P(a,z) )$.   [∀rename]

    Given $y in T$:   [∀sub]

      $y in T$.   [∀sub]

      $forall z in T ( P(a,z) )$.   [∀restate]

      $y in T$.   [restate]

      $P(a,y)$.   [∀elim]

      $a in S$.   [∀restate]

      $exists x in S ( P(x,y) )$.   [∃intro]

    $forall y in T ( exists x in S ( P(x,y) ) )$.   [∀intro]

$exists x in S ( forall y in T ( P(x,y) ) ) imp forall y in T ( exists x in S ( P(x,y) ) )$.   [⇒intro]



Finally with all lines in square-brackets removed:



  If $exists x in S ( forall y in T ( P(x,y) ) )$:   [⇒sub]

    Let $a in S$ such that $forall y in T ( P(a,y) )$.   [∃elim]

    Given $y in T$:   [∀sub]

      $P(a,y)$.   [∀elim]

      $exists x in S ( P(x,y) )$.   [∃intro]

    $forall y in T ( exists x in S ( P(x,y) ) )$.   [∀intro]

$exists x in S ( forall y in T ( P(x,y) ) ) imp forall y in T ( exists x in S ( P(x,y) ) )$.   [⇒intro]



This final proof is much cleaner yet still easily computer-verifiable.



Notes



The above rules avoid the usual trouble that most other systems have, where variables used for witnesses of existential statements must be distinguished from variables used for arbitrary objects. The reason is that every variable here is either specified by a ∀-subcontext or by a "let"-statement; in other words there are no free variables. The fact that every variable is bound is strongly related to the fact that this system allows an empty universe, if there are no other axioms.



Also, every variable is specified by a unique header or "let"-statement in the current context; in other words there is no variable shadowing. This is by design, and in actual mathematical practice we also abide by this, though most other formal systems do not. As a consequence, sentences such as "$exists x forall x ( x=x )$." simply cannot be written down in this system. If you wish to permit such kind of terrible sentences, you would have to modify the rules appropriately, but it will most probably cause a headache.



Finally, there were some subtle technical decisions. For the quantifier rules, the reason I required that $x$ does not appear in $S,P$ is that, if we later on include rules for specifying types, we would usually have variable names in its syntax, which would cause problems. For example, if we have written in the current context "$x∈y:y∈S∧y∈T$" and "$x∈U$", it will not be sensible to allow writing "$∃y∈U ( y∈y:y∈S∧y∈T )$". Similarly, if we have written "$x=y:P(y)$" and "$∃y∈U ( Q(x,y) )$", we do not want to allow writing "$∃y∈U ( Q(y:P(y),y) )$".




To illustrate the flexibility of this system, I will express both Peano Arithmetic and Set Theory as extra rules that can be simply added to the system.



Peano Arithmetic



Add the type $nn$ and the symbols of PA, namely the constant-symbols $0,1$ and the $2$-input function-symbols $+,·$ and the $2$-input predicate-symbol $<$.



Add the axioms of PA$^-$, adapted from here:




  • $forall x,y in nn ( x+y in nn )$.


  • $forall x,y in nn ( x·y in nn )$.


  • $forall x,y in nn ( x+y=y+x )$.


  • $forall x,y in nn ( x·y=y·x )$.


  • $forall x,y,z in nn ( x+(y+z)=(x+y)+z )$.


  • $forall x,y,z in nn ( x·(y·z)=(x·y)·z )$.


  • $forall x,y,z in nn ( x·(y+z)=x·z+y·z )$.


  • $forall x in nn ( x+0=x )$.


  • $forall x in nn ( x·1=x )$.


  • $forall x in nn ( neg x<x )$.


  • $forall x,y in nn ( x<y lor y<x lor x=y )$.


  • $forall x,y,z in nn ( x<y land y<z imp x<z )$.


  • $forall x,y,z in nn ( x<y imp x+z<y+z )$.


  • $forall x,y,z in nn ( x<y land 0<z imp x·z<y·z )$.


  • $forall x,y in nn ( x<y imp exists z in nn ( x+z=y ) )$.


  • $0<1$.


  • $forall x in nn ( 0=x lor 1=x lor 1<x )$.

Add the induction axioms, namely for each property $P$ involving only the symbols of PA and quantifiers over $nn$ add the following axiom:




  • $P(0) land forall k in nn ( P(k) imp P(k+1) ) imp forall k in nn ( P(k) )$.

Set Theory



Add the type $set$ and the rule that every member of $set$ is also a type.



Add the unary function-symbols $pow,bigcup$, the binary function-symbols $×,FN$, and the constant-symbol $none$. We reuse the binary predicate-symbol $in$, as there will be no ambiguity. Also add the following rules (in every context) for the other notation:



  • If $E,F in obj$, then $(E,F) in obj$ and $E,F in set$.

  • If $S,T in set$, then $S×T in set$ and $FN(S,T) in set$ and $pow(S) in set$.

  • If $S,T in set$ and $f in FN(S,T)$ and $x in S$, then $f(x) in T$.

  • If $S in set$ and $forall x in S ( x in set )$, then $bigcup(S) in set$.

Add the following axioms:




  • extensionality:   $forall S,T in set ( S=T eq forall x in obj ( x in S eq x in T ) ).$


  • empty-set:   $forall x in obj ( neg x in none ).$


  • naturals:   $nn in set$.


  • power-set:   $forall S in set ( pow(S) = T : T in set land forall x in T ( x in S ) ).$


  • pair:   $forall x,y in obj ( x,y = z : x=z lor x=y ).$


  • ordered-pair:   $forall x,y in obj forall z,w in obj ( (x,y)=(z,w) eq x=z land y=w ).$


  • product-type:   $forall S,T in set ( S×T = t : exists x in S exists y in T ( t=(x,y) ) ).$


  • function-type:   $forall S,T in set ( FN(S,T) = \ F : F in S×T land forall x in S exists! y in T ( (x,y) in F ) ).$


  • function-application:   $forall S,T in set forall f in FN(S,T) forall x in S ( (x,f(x)) in f ).$


  • union:   $forall S in set ( bigcup(S) = x : exists T in set ( x in T land T in S ) ).$


  • choice:   $forall S,T in set forall R in S×T ( forall x in S exists y in T ( (x,y) in R ) \ imp exists f in FN(S,T) forall x in S ( (x,f(x)) in R ) ).$

Add the following rules:



type-notation



Take (in the current context) any property $P$ and object expression $E$ and unused variable $x$.



Then $ x : P(x) $ is a type and its membership is governed by:



$fitchE in x : P(x) eq P(E).$. ($x$ must not appear in $E$ or $P$)



comprehension



Take any property $P$ and unused variable $x$.



$fitchS in set. x : x in S land P(x) in set.$. ($x$ must not appear in $S$ or $P$)



collection



Take any $2$-parameter property $P$ and unused variables $x,y$.



$fitchS in set. \ forall x in S exists y in obj ( P(x,y) ). y : exists x in S ( P(x,y) ) in set.$ ($x,y$ must not appear in $S$ or $P$)



induction



Take any property $P$ with $1$ parameter from $nn$.



$fitchP(0). \ forall k in nn ( P(k) imp P(k+1) ).forall k in nn ( P(k) ).$ ($k$ must not appear in $P$)



The induction rule subsumes the induction axioms for PA, and essentially the only difference is that the property $P$ can involve set operations and quantification over sets.



function-notation



This rule is theoretically unnecessary but pragmatically very convenient (also known as lambda expressions in computer science).



Take any set $S$ and any object expression $E$ with $1$ parameter from $S$, and unused variable $x$.



Then $( S x mapsto E(x) )$ is an object and its behaviour is governed by:



$fitchforall x in S ( E(x) in T ). \ f = ( S x mapsto E(x) ).f in FN(S,T) land forall x in S ( f(x) = E(x) ).$



Foundational system



Combining the above Peano Arithmetic plus Set Theory yields a foundational system that is essentially as strong as ZFC but much more user-friendly. It is also agnostic to the existence of objects that are not sets, and does not even assume that the members of $nn$ are sets. It also treats cartesian products and ordered pairs as inbuilt abstract notions. This is how we use them in actual mathematics. (More precisely, the above system directly interprets ZFC minus regularity.)






share|cite|improve this answer











$endgroup$












  • $begingroup$
    Hey man, thanks you very much for all your help :)
    $endgroup$
    – Jim Jam
    Mar 9 '16 at 22:39






  • 1




    $begingroup$
    @user108262: You're welcome and I hope it helps you as much as it has helped me! When I devised these rules I was strongly influenced by programming where the context of every statement is explicit. That really is the key, because it is then simple to construct the inference rules based on intuition. Like in programming, there can be multiple statements within the same context, and this minimizes the amount of writing needed, in stark contrast to Hilbert-style systems. I presented it here in Fitch-style but we can just as well use braces or indentation like in C or Python.
    $endgroup$
    – user21820
    Mar 10 '16 at 0:57










  • $begingroup$
    I decided to update my post with all the rules, and I changed to Python style. The underlying idea is certainly correct, as I've used it for years. But it is a long post and there may be bugs, so if anyone has any question feel free to ask me at chat.stackexchange.com/rooms/44058/logic.
    $endgroup$
    – user21820
    Dec 31 '16 at 17:04










Your Answer





StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1681857%2fpredicate-logic-how-do-you-self-check-the-logical-structure-of-your-own-argumen%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









8












$begingroup$

Truth tables are not enough to capture first-order logic (with quantifiers), so we use inference rules instead. Each inference rule is chosen to be sound, meaning that if you start with true statements and use the rule you will deduce only true statements. We say that these rules are truth-preserving. If you choose carefully enough, you can make it so that the rules are not just truth-preserving but also allow you to deduce every (well-formed) statement that is necessarily true (in all situations).



What you are probably looking for (namely a practical way to rigorously check the logical validity of your arguments) is natural deduction. There are many different styles, the most intuitive type being Fitch-style, which mark subcontexts using indentation or some related visual demarcation. The following system uses indentation and follows the intuition most closely in my opinion.
$
defblock#1beginarrayll &#1endarray
deffitch#1#2beginarrayl#1\hline#2endarray
defsub#1#2text#1:\block#2
defimpRightarrow
defeqLeftrightarrow
defnnmathbbN
defnonevarnothing
defpowmathcalP
$




Contexts



Every line is either a header or a statement. Only headers can have lines subsumed under it, as in a multi-level list. The context of each statement is specified by all the headers that are in effect.



For example a case analysis would look like:



$subIf $A$... \ subIf $neg A$...$



And reasoning about an arbitrary member of a collection $S$ would look like:



$subGiven $x in S$...$



Note that what is stated in some context may be invalid in other contexts. Once you understand the principle behind contexts and the indentation, the following rules are very natural. Also note that for first-order logic the above two kinds of context headers (for conditional subcontexts and universal subcontexts respectively) are the only kinds needed.



Syntax rules



A statement must be an atomic (indivisible) proposition or a compound statement formed in the usual way using boolean operations or quantifiers, with the restriction that every variable that is bound by a quantifier is not already used to refer to some object in the current context, and that there are no nested quantifiers that bind the same variable.



Natural deduction rules



Each inference rule is of the form:



$fitchtextXtextY$



which means that if the last lines you have written match "X" then you can write "Y" immediately after that at the same level of indentation. Each application of an inference rule is also tied to the current context, which is defined to be the context of "X". We will not mention "current context" all the time.




Boolean operations



Take any statements $A,B,C$ (in the current context).



restate: If we prove something we can affirm it again in the same context.



$fitchA.\...A.$



Note that "$...$" denote any number of lines that are at least at the depicted indentation level. In the above rule, this means that all the lines written since the earlier writing of "$A.$" must be in the same context (or some subcontext).



In practice we never actually write the same line twice, but to make the description of the rules easy we shall to consider it written anyway. I'll mark all such lines with square-brackets as follows:



$fitchA. \ ...[A.]$



⇒sub     ⇒restate     (We can create a conditional subcontext where $A$ holds.)



$fitchsubIf $A$[A.]$
$fitchB. \ ... \ subIf $A$...block[B.]$



⇒intro     ⇒elim     ("$imp$" internally captures contextual statements.)



$fitchsubIf $A$... \ B. \ ... \ ...[A imp B.]$
$fitchA imp B. \ A.B.$



∧intro     ∧elim



$fitchA. \ B.A land B.$
$fitchA land B.[A.] \ [B.]$



∨intro     ∨elim



$fitchA.[A lor B.] \ [B lor A.]$
$fitchA lor B. \ A imp C. \ B imp C.C.$



¬intro     ¬elim     ¬¬elim



$fitchA imp bot.neg A.$
$fitchA. \ neg A.bot.$
$fitchneg neg A.A.$



Note that by using ¬intro and ¬¬elim we can get the following additional inference rule:



$fitchneg A imp bot.A.$



which corresponds to how one would attempt to prove $A$ by contradiction, namely to show that assuming $neg A$ implies a falsehood.



⇔intro     ⇔elim



$fitchA imp B. \ B imp A.A eq B.$
$fitchA eq B.[A imp B.] \ [B imp A.]$



Quantifiers and equality



I show the rules for restricted quantifiers because usually we think in terms of them. First we need some definitions.



Unused variable: A variable that is not declared in the header of any containing ∀-subcontext or in any previous ∃-elimination ("let") step in the current context or any containing contexts.



Fresh variable: A variable that does not appear in any previous statement.



Object expression: An expression that refers to an object. In classical first-order logic, the object expressions are simply the well-formed terms (whose free variables are each declared in the header of some containing ∀-subcontext). In the following rules $E,F$ (if involved) can be any object expressions.



And we need at least one type over which we can quantify, which is provided by the following rule.



universe: $obj$ is a type, which includes all objects.



$fitch[E in obj.]$



Now take any type $S$ and a property $P$ and an unused variable $x$ that does not appear in $S$ or $P$. By $P$ being a property we mean that $P(x)$ is a statement about $x$.



∀sub         ∀restate         (We can create a subcontext in which $x$ is of type $S$.)



$fitchsubGiven $x in S$[x in S.]$
$fitchA. \ ... \ subGiven $x in S$...block[A.]$ ($x$ must not appear in $A$)



∀intro         ∀elim



$fitchsubGiven $x in S$... \ P(x). \ ... \ ...forall x in S ( P(x) ).$
$fitchforall x in S ( P(x) ). \ ... \ E in S. \ ...P(E).$ (unused variables appearing in $P$ must not appear in $E$)



∃intro           ∃elim



$fitchE in S. \ ... \ P(E). \ ...exists x in S ( P(x) ).$
$fitchexists x in S ( P(x) ).textLet $y in S$ such that $P(y)$. \ [y in S.] \ [P(y).]$ (where $y$ is a fresh variable)



=intro       =elim



$fitch[E=E.]$
$fitchE=F. \ P(E).P(F).$ (unused variables appearing in $P$ must not appear in $F$)



Variable renaming



Finally, the following rules for variable renaming are redundant, but would significantly shorten proofs.



∀rename         ∃rename



$fitchforall x in S ( P(x) ).[forall y in S ( P(y) ).]$
$fitchexists x in S ( P(x) ).[exists y in S ( P(y) ).]$



  (where $y$ is an unused variable that does not appear in $P$)



Short-forms



For convenience we also write "$forall x,y in S ( P(x,y) )$" as short-form for "$forall x in S ( forall y in S ( P(x,y) ) )$", and similarly for more variables and for "$exists$".



Additionally, "$exists! x in S ( P(x) )$" is short-form for "$exists x in S ( P(x) land forall y in S ( P(y) imp x=y ) )$".




Example



Here is an example, where $S,T$ are any types and $P$ is any property with two parameters.



First with all lines shown:



  If $exists x in S ( forall y in T ( P(x,y) ) )$:   [⇒sub]

    $exists x in S ( forall y in T ( P(x,y) ) )$.   [⇒sub]

    Let $a in S$ such that $forall y in T ( P(a,y) )$.   [∃elim]

    $a in S$.   [∃elim]

    $forall y in T ( P(a,y) )$.   [∃elim]

    $forall z in T ( P(a,z) )$.   [∀rename]

    Given $y in T$:   [∀sub]

      $y in T$.   [∀sub]

      $forall z in T ( P(a,z) )$.   [∀restate]

      $y in T$.   [restate]

      $P(a,y)$.   [∀elim]

      $a in S$.   [∀restate]

      $exists x in S ( P(x,y) )$.   [∃intro]

    $forall y in T ( exists x in S ( P(x,y) ) )$.   [∀intro]

$exists x in S ( forall y in T ( P(x,y) ) ) imp forall y in T ( exists x in S ( P(x,y) ) )$.   [⇒intro]



Finally with all lines in square-brackets removed:



  If $exists x in S ( forall y in T ( P(x,y) ) )$:   [⇒sub]

    Let $a in S$ such that $forall y in T ( P(a,y) )$.   [∃elim]

    Given $y in T$:   [∀sub]

      $P(a,y)$.   [∀elim]

      $exists x in S ( P(x,y) )$.   [∃intro]

    $forall y in T ( exists x in S ( P(x,y) ) )$.   [∀intro]

$exists x in S ( forall y in T ( P(x,y) ) ) imp forall y in T ( exists x in S ( P(x,y) ) )$.   [⇒intro]



This final proof is much cleaner yet still easily computer-verifiable.



Notes



The above rules avoid the usual trouble that most other systems have, where variables used for witnesses of existential statements must be distinguished from variables used for arbitrary objects. The reason is that every variable here is either specified by a ∀-subcontext or by a "let"-statement; in other words there are no free variables. The fact that every variable is bound is strongly related to the fact that this system allows an empty universe, if there are no other axioms.



Also, every variable is specified by a unique header or "let"-statement in the current context; in other words there is no variable shadowing. This is by design, and in actual mathematical practice we also abide by this, though most other formal systems do not. As a consequence, sentences such as "$exists x forall x ( x=x )$." simply cannot be written down in this system. If you wish to permit such kind of terrible sentences, you would have to modify the rules appropriately, but it will most probably cause a headache.



Finally, there were some subtle technical decisions. For the quantifier rules, the reason I required that $x$ does not appear in $S,P$ is that, if we later on include rules for specifying types, we would usually have variable names in its syntax, which would cause problems. For example, if we have written in the current context "$x∈y:y∈S∧y∈T$" and "$x∈U$", it will not be sensible to allow writing "$∃y∈U ( y∈y:y∈S∧y∈T )$". Similarly, if we have written "$x=y:P(y)$" and "$∃y∈U ( Q(x,y) )$", we do not want to allow writing "$∃y∈U ( Q(y:P(y),y) )$".




To illustrate the flexibility of this system, I will express both Peano Arithmetic and Set Theory as extra rules that can be simply added to the system.



Peano Arithmetic



Add the type $nn$ and the symbols of PA, namely the constant-symbols $0,1$ and the $2$-input function-symbols $+,·$ and the $2$-input predicate-symbol $<$.



Add the axioms of PA$^-$, adapted from here:




  • $forall x,y in nn ( x+y in nn )$.


  • $forall x,y in nn ( x·y in nn )$.


  • $forall x,y in nn ( x+y=y+x )$.


  • $forall x,y in nn ( x·y=y·x )$.


  • $forall x,y,z in nn ( x+(y+z)=(x+y)+z )$.


  • $forall x,y,z in nn ( x·(y·z)=(x·y)·z )$.


  • $forall x,y,z in nn ( x·(y+z)=x·z+y·z )$.


  • $forall x in nn ( x+0=x )$.


  • $forall x in nn ( x·1=x )$.


  • $forall x in nn ( neg x<x )$.


  • $forall x,y in nn ( x<y lor y<x lor x=y )$.


  • $forall x,y,z in nn ( x<y land y<z imp x<z )$.


  • $forall x,y,z in nn ( x<y imp x+z<y+z )$.


  • $forall x,y,z in nn ( x<y land 0<z imp x·z<y·z )$.


  • $forall x,y in nn ( x<y imp exists z in nn ( x+z=y ) )$.


  • $0<1$.


  • $forall x in nn ( 0=x lor 1=x lor 1<x )$.

Add the induction axioms, namely for each property $P$ involving only the symbols of PA and quantifiers over $nn$ add the following axiom:




  • $P(0) land forall k in nn ( P(k) imp P(k+1) ) imp forall k in nn ( P(k) )$.

Set Theory



Add the type $set$ and the rule that every member of $set$ is also a type.



Add the unary function-symbols $pow,bigcup$, the binary function-symbols $×,FN$, and the constant-symbol $none$. We reuse the binary predicate-symbol $in$, as there will be no ambiguity. Also add the following rules (in every context) for the other notation:



  • If $E,F in obj$, then $(E,F) in obj$ and $E,F in set$.

  • If $S,T in set$, then $S×T in set$ and $FN(S,T) in set$ and $pow(S) in set$.

  • If $S,T in set$ and $f in FN(S,T)$ and $x in S$, then $f(x) in T$.

  • If $S in set$ and $forall x in S ( x in set )$, then $bigcup(S) in set$.

Add the following axioms:




  • extensionality:   $forall S,T in set ( S=T eq forall x in obj ( x in S eq x in T ) ).$


  • empty-set:   $forall x in obj ( neg x in none ).$


  • naturals:   $nn in set$.


  • power-set:   $forall S in set ( pow(S) = T : T in set land forall x in T ( x in S ) ).$


  • pair:   $forall x,y in obj ( x,y = z : x=z lor x=y ).$


  • ordered-pair:   $forall x,y in obj forall z,w in obj ( (x,y)=(z,w) eq x=z land y=w ).$


  • product-type:   $forall S,T in set ( S×T = t : exists x in S exists y in T ( t=(x,y) ) ).$


  • function-type:   $forall S,T in set ( FN(S,T) = \ F : F in S×T land forall x in S exists! y in T ( (x,y) in F ) ).$


  • function-application:   $forall S,T in set forall f in FN(S,T) forall x in S ( (x,f(x)) in f ).$


  • union:   $forall S in set ( bigcup(S) = x : exists T in set ( x in T land T in S ) ).$


  • choice:   $forall S,T in set forall R in S×T ( forall x in S exists y in T ( (x,y) in R ) \ imp exists f in FN(S,T) forall x in S ( (x,f(x)) in R ) ).$

Add the following rules:



type-notation



Take (in the current context) any property $P$ and object expression $E$ and unused variable $x$.



Then $ x : P(x) $ is a type and its membership is governed by:



$fitchE in x : P(x) eq P(E).$. ($x$ must not appear in $E$ or $P$)



comprehension



Take any property $P$ and unused variable $x$.



$fitchS in set. x : x in S land P(x) in set.$. ($x$ must not appear in $S$ or $P$)



collection



Take any $2$-parameter property $P$ and unused variables $x,y$.



$fitchS in set. \ forall x in S exists y in obj ( P(x,y) ). y : exists x in S ( P(x,y) ) in set.$ ($x,y$ must not appear in $S$ or $P$)



induction



Take any property $P$ with $1$ parameter from $nn$.



$fitchP(0). \ forall k in nn ( P(k) imp P(k+1) ).forall k in nn ( P(k) ).$ ($k$ must not appear in $P$)



The induction rule subsumes the induction axioms for PA, and essentially the only difference is that the property $P$ can involve set operations and quantification over sets.



function-notation



This rule is theoretically unnecessary but pragmatically very convenient (also known as lambda expressions in computer science).



Take any set $S$ and any object expression $E$ with $1$ parameter from $S$, and unused variable $x$.



Then $( S x mapsto E(x) )$ is an object and its behaviour is governed by:



$fitchforall x in S ( E(x) in T ). \ f = ( S x mapsto E(x) ).f in FN(S,T) land forall x in S ( f(x) = E(x) ).$



Foundational system



Combining the above Peano Arithmetic plus Set Theory yields a foundational system that is essentially as strong as ZFC but much more user-friendly. It is also agnostic to the existence of objects that are not sets, and does not even assume that the members of $nn$ are sets. It also treats cartesian products and ordered pairs as inbuilt abstract notions. This is how we use them in actual mathematics. (More precisely, the above system directly interprets ZFC minus regularity.)






share|cite|improve this answer











$endgroup$












  • $begingroup$
    Hey man, thanks you very much for all your help :)
    $endgroup$
    – Jim Jam
    Mar 9 '16 at 22:39






  • 1




    $begingroup$
    @user108262: You're welcome and I hope it helps you as much as it has helped me! When I devised these rules I was strongly influenced by programming where the context of every statement is explicit. That really is the key, because it is then simple to construct the inference rules based on intuition. Like in programming, there can be multiple statements within the same context, and this minimizes the amount of writing needed, in stark contrast to Hilbert-style systems. I presented it here in Fitch-style but we can just as well use braces or indentation like in C or Python.
    $endgroup$
    – user21820
    Mar 10 '16 at 0:57










  • $begingroup$
    I decided to update my post with all the rules, and I changed to Python style. The underlying idea is certainly correct, as I've used it for years. But it is a long post and there may be bugs, so if anyone has any question feel free to ask me at chat.stackexchange.com/rooms/44058/logic.
    $endgroup$
    – user21820
    Dec 31 '16 at 17:04















8












$begingroup$

Truth tables are not enough to capture first-order logic (with quantifiers), so we use inference rules instead. Each inference rule is chosen to be sound, meaning that if you start with true statements and use the rule you will deduce only true statements. We say that these rules are truth-preserving. If you choose carefully enough, you can make it so that the rules are not just truth-preserving but also allow you to deduce every (well-formed) statement that is necessarily true (in all situations).



What you are probably looking for (namely a practical way to rigorously check the logical validity of your arguments) is natural deduction. There are many different styles, the most intuitive type being Fitch-style, which mark subcontexts using indentation or some related visual demarcation. The following system uses indentation and follows the intuition most closely in my opinion.
$
defblock#1beginarrayll &#1endarray
deffitch#1#2beginarrayl#1\hline#2endarray
defsub#1#2text#1:\block#2
defimpRightarrow
defeqLeftrightarrow
defnnmathbbN
defnonevarnothing
defpowmathcalP
$




Contexts



Every line is either a header or a statement. Only headers can have lines subsumed under it, as in a multi-level list. The context of each statement is specified by all the headers that are in effect.



For example a case analysis would look like:



$subIf $A$... \ subIf $neg A$...$



And reasoning about an arbitrary member of a collection $S$ would look like:



$subGiven $x in S$...$



Note that what is stated in some context may be invalid in other contexts. Once you understand the principle behind contexts and the indentation, the following rules are very natural. Also note that for first-order logic the above two kinds of context headers (for conditional subcontexts and universal subcontexts respectively) are the only kinds needed.



Syntax rules



A statement must be an atomic (indivisible) proposition or a compound statement formed in the usual way using boolean operations or quantifiers, with the restriction that every variable that is bound by a quantifier is not already used to refer to some object in the current context, and that there are no nested quantifiers that bind the same variable.



Natural deduction rules



Each inference rule is of the form:



$fitchtextXtextY$



which means that if the last lines you have written match "X" then you can write "Y" immediately after that at the same level of indentation. Each application of an inference rule is also tied to the current context, which is defined to be the context of "X". We will not mention "current context" all the time.




Boolean operations



Take any statements $A,B,C$ (in the current context).



restate: If we prove something we can affirm it again in the same context.



$fitchA.\...A.$



Note that "$...$" denote any number of lines that are at least at the depicted indentation level. In the above rule, this means that all the lines written since the earlier writing of "$A.$" must be in the same context (or some subcontext).



In practice we never actually write the same line twice, but to make the description of the rules easy we shall to consider it written anyway. I'll mark all such lines with square-brackets as follows:



$fitchA. \ ...[A.]$



⇒sub     ⇒restate     (We can create a conditional subcontext where $A$ holds.)



$fitchsubIf $A$[A.]$
$fitchB. \ ... \ subIf $A$...block[B.]$



⇒intro     ⇒elim     ("$imp$" internally captures contextual statements.)



$fitchsubIf $A$... \ B. \ ... \ ...[A imp B.]$
$fitchA imp B. \ A.B.$



∧intro     ∧elim



$fitchA. \ B.A land B.$
$fitchA land B.[A.] \ [B.]$



∨intro     ∨elim



$fitchA.[A lor B.] \ [B lor A.]$
$fitchA lor B. \ A imp C. \ B imp C.C.$



¬intro     ¬elim     ¬¬elim



$fitchA imp bot.neg A.$
$fitchA. \ neg A.bot.$
$fitchneg neg A.A.$



Note that by using ¬intro and ¬¬elim we can get the following additional inference rule:



$fitchneg A imp bot.A.$



which corresponds to how one would attempt to prove $A$ by contradiction, namely to show that assuming $neg A$ implies a falsehood.



⇔intro     ⇔elim



$fitchA imp B. \ B imp A.A eq B.$
$fitchA eq B.[A imp B.] \ [B imp A.]$



Quantifiers and equality



I show the rules for restricted quantifiers because usually we think in terms of them. First we need some definitions.



Unused variable: A variable that is not declared in the header of any containing ∀-subcontext or in any previous ∃-elimination ("let") step in the current context or any containing contexts.



Fresh variable: A variable that does not appear in any previous statement.



Object expression: An expression that refers to an object. In classical first-order logic, the object expressions are simply the well-formed terms (whose free variables are each declared in the header of some containing ∀-subcontext). In the following rules $E,F$ (if involved) can be any object expressions.



And we need at least one type over which we can quantify, which is provided by the following rule.



universe: $obj$ is a type, which includes all objects.



$fitch[E in obj.]$



Now take any type $S$ and a property $P$ and an unused variable $x$ that does not appear in $S$ or $P$. By $P$ being a property we mean that $P(x)$ is a statement about $x$.



∀sub         ∀restate         (We can create a subcontext in which $x$ is of type $S$.)



$fitchsubGiven $x in S$[x in S.]$
$fitchA. \ ... \ subGiven $x in S$...block[A.]$ ($x$ must not appear in $A$)



∀intro         ∀elim



$fitchsubGiven $x in S$... \ P(x). \ ... \ ...forall x in S ( P(x) ).$
$fitchforall x in S ( P(x) ). \ ... \ E in S. \ ...P(E).$ (unused variables appearing in $P$ must not appear in $E$)



∃intro           ∃elim



$fitchE in S. \ ... \ P(E). \ ...exists x in S ( P(x) ).$
$fitchexists x in S ( P(x) ).textLet $y in S$ such that $P(y)$. \ [y in S.] \ [P(y).]$ (where $y$ is a fresh variable)



=intro       =elim



$fitch[E=E.]$
$fitchE=F. \ P(E).P(F).$ (unused variables appearing in $P$ must not appear in $F$)



Variable renaming



Finally, the following rules for variable renaming are redundant, but would significantly shorten proofs.



∀rename         ∃rename



$fitchforall x in S ( P(x) ).[forall y in S ( P(y) ).]$
$fitchexists x in S ( P(x) ).[exists y in S ( P(y) ).]$



  (where $y$ is an unused variable that does not appear in $P$)



Short-forms



For convenience we also write "$forall x,y in S ( P(x,y) )$" as short-form for "$forall x in S ( forall y in S ( P(x,y) ) )$", and similarly for more variables and for "$exists$".



Additionally, "$exists! x in S ( P(x) )$" is short-form for "$exists x in S ( P(x) land forall y in S ( P(y) imp x=y ) )$".




Example



Here is an example, where $S,T$ are any types and $P$ is any property with two parameters.



First with all lines shown:



  If $exists x in S ( forall y in T ( P(x,y) ) )$:   [⇒sub]

    $exists x in S ( forall y in T ( P(x,y) ) )$.   [⇒sub]

    Let $a in S$ such that $forall y in T ( P(a,y) )$.   [∃elim]

    $a in S$.   [∃elim]

    $forall y in T ( P(a,y) )$.   [∃elim]

    $forall z in T ( P(a,z) )$.   [∀rename]

    Given $y in T$:   [∀sub]

      $y in T$.   [∀sub]

      $forall z in T ( P(a,z) )$.   [∀restate]

      $y in T$.   [restate]

      $P(a,y)$.   [∀elim]

      $a in S$.   [∀restate]

      $exists x in S ( P(x,y) )$.   [∃intro]

    $forall y in T ( exists x in S ( P(x,y) ) )$.   [∀intro]

$exists x in S ( forall y in T ( P(x,y) ) ) imp forall y in T ( exists x in S ( P(x,y) ) )$.   [⇒intro]



Finally with all lines in square-brackets removed:



  If $exists x in S ( forall y in T ( P(x,y) ) )$:   [⇒sub]

    Let $a in S$ such that $forall y in T ( P(a,y) )$.   [∃elim]

    Given $y in T$:   [∀sub]

      $P(a,y)$.   [∀elim]

      $exists x in S ( P(x,y) )$.   [∃intro]

    $forall y in T ( exists x in S ( P(x,y) ) )$.   [∀intro]

$exists x in S ( forall y in T ( P(x,y) ) ) imp forall y in T ( exists x in S ( P(x,y) ) )$.   [⇒intro]



This final proof is much cleaner yet still easily computer-verifiable.



Notes



The above rules avoid the usual trouble that most other systems have, where variables used for witnesses of existential statements must be distinguished from variables used for arbitrary objects. The reason is that every variable here is either specified by a ∀-subcontext or by a "let"-statement; in other words there are no free variables. The fact that every variable is bound is strongly related to the fact that this system allows an empty universe, if there are no other axioms.



Also, every variable is specified by a unique header or "let"-statement in the current context; in other words there is no variable shadowing. This is by design, and in actual mathematical practice we also abide by this, though most other formal systems do not. As a consequence, sentences such as "$exists x forall x ( x=x )$." simply cannot be written down in this system. If you wish to permit such kind of terrible sentences, you would have to modify the rules appropriately, but it will most probably cause a headache.



Finally, there were some subtle technical decisions. For the quantifier rules, the reason I required that $x$ does not appear in $S,P$ is that, if we later on include rules for specifying types, we would usually have variable names in its syntax, which would cause problems. For example, if we have written in the current context "$x∈y:y∈S∧y∈T$" and "$x∈U$", it will not be sensible to allow writing "$∃y∈U ( y∈y:y∈S∧y∈T )$". Similarly, if we have written "$x=y:P(y)$" and "$∃y∈U ( Q(x,y) )$", we do not want to allow writing "$∃y∈U ( Q(y:P(y),y) )$".




To illustrate the flexibility of this system, I will express both Peano Arithmetic and Set Theory as extra rules that can be simply added to the system.



Peano Arithmetic



Add the type $nn$ and the symbols of PA, namely the constant-symbols $0,1$ and the $2$-input function-symbols $+,·$ and the $2$-input predicate-symbol $<$.



Add the axioms of PA$^-$, adapted from here:




  • $forall x,y in nn ( x+y in nn )$.


  • $forall x,y in nn ( x·y in nn )$.


  • $forall x,y in nn ( x+y=y+x )$.


  • $forall x,y in nn ( x·y=y·x )$.


  • $forall x,y,z in nn ( x+(y+z)=(x+y)+z )$.


  • $forall x,y,z in nn ( x·(y·z)=(x·y)·z )$.


  • $forall x,y,z in nn ( x·(y+z)=x·z+y·z )$.


  • $forall x in nn ( x+0=x )$.


  • $forall x in nn ( x·1=x )$.


  • $forall x in nn ( neg x<x )$.


  • $forall x,y in nn ( x<y lor y<x lor x=y )$.


  • $forall x,y,z in nn ( x<y land y<z imp x<z )$.


  • $forall x,y,z in nn ( x<y imp x+z<y+z )$.


  • $forall x,y,z in nn ( x<y land 0<z imp x·z<y·z )$.


  • $forall x,y in nn ( x<y imp exists z in nn ( x+z=y ) )$.


  • $0<1$.


  • $forall x in nn ( 0=x lor 1=x lor 1<x )$.

Add the induction axioms, namely for each property $P$ involving only the symbols of PA and quantifiers over $nn$ add the following axiom:




  • $P(0) land forall k in nn ( P(k) imp P(k+1) ) imp forall k in nn ( P(k) )$.

Set Theory



Add the type $set$ and the rule that every member of $set$ is also a type.



Add the unary function-symbols $pow,bigcup$, the binary function-symbols $×,FN$, and the constant-symbol $none$. We reuse the binary predicate-symbol $in$, as there will be no ambiguity. Also add the following rules (in every context) for the other notation:



  • If $E,F in obj$, then $(E,F) in obj$ and $E,F in set$.

  • If $S,T in set$, then $S×T in set$ and $FN(S,T) in set$ and $pow(S) in set$.

  • If $S,T in set$ and $f in FN(S,T)$ and $x in S$, then $f(x) in T$.

  • If $S in set$ and $forall x in S ( x in set )$, then $bigcup(S) in set$.

Add the following axioms:




  • extensionality:   $forall S,T in set ( S=T eq forall x in obj ( x in S eq x in T ) ).$


  • empty-set:   $forall x in obj ( neg x in none ).$


  • naturals:   $nn in set$.


  • power-set:   $forall S in set ( pow(S) = T : T in set land forall x in T ( x in S ) ).$


  • pair:   $forall x,y in obj ( x,y = z : x=z lor x=y ).$


  • ordered-pair:   $forall x,y in obj forall z,w in obj ( (x,y)=(z,w) eq x=z land y=w ).$


  • product-type:   $forall S,T in set ( S×T = t : exists x in S exists y in T ( t=(x,y) ) ).$


  • function-type:   $forall S,T in set ( FN(S,T) = \ F : F in S×T land forall x in S exists! y in T ( (x,y) in F ) ).$


  • function-application:   $forall S,T in set forall f in FN(S,T) forall x in S ( (x,f(x)) in f ).$


  • union:   $forall S in set ( bigcup(S) = x : exists T in set ( x in T land T in S ) ).$


  • choice:   $forall S,T in set forall R in S×T ( forall x in S exists y in T ( (x,y) in R ) \ imp exists f in FN(S,T) forall x in S ( (x,f(x)) in R ) ).$

Add the following rules:



type-notation



Take (in the current context) any property $P$ and object expression $E$ and unused variable $x$.



Then $ x : P(x) $ is a type and its membership is governed by:



$fitchE in x : P(x) eq P(E).$. ($x$ must not appear in $E$ or $P$)



comprehension



Take any property $P$ and unused variable $x$.



$fitchS in set. x : x in S land P(x) in set.$. ($x$ must not appear in $S$ or $P$)



collection



Take any $2$-parameter property $P$ and unused variables $x,y$.



$fitchS in set. \ forall x in S exists y in obj ( P(x,y) ). y : exists x in S ( P(x,y) ) in set.$ ($x,y$ must not appear in $S$ or $P$)



induction



Take any property $P$ with $1$ parameter from $nn$.



$fitchP(0). \ forall k in nn ( P(k) imp P(k+1) ).forall k in nn ( P(k) ).$ ($k$ must not appear in $P$)



The induction rule subsumes the induction axioms for PA, and essentially the only difference is that the property $P$ can involve set operations and quantification over sets.



function-notation



This rule is theoretically unnecessary but pragmatically very convenient (also known as lambda expressions in computer science).



Take any set $S$ and any object expression $E$ with $1$ parameter from $S$, and unused variable $x$.



Then $( S x mapsto E(x) )$ is an object and its behaviour is governed by:



$fitchforall x in S ( E(x) in T ). \ f = ( S x mapsto E(x) ).f in FN(S,T) land forall x in S ( f(x) = E(x) ).$



Foundational system



Combining the above Peano Arithmetic plus Set Theory yields a foundational system that is essentially as strong as ZFC but much more user-friendly. It is also agnostic to the existence of objects that are not sets, and does not even assume that the members of $nn$ are sets. It also treats cartesian products and ordered pairs as inbuilt abstract notions. This is how we use them in actual mathematics. (More precisely, the above system directly interprets ZFC minus regularity.)






share|cite|improve this answer











$endgroup$












  • $begingroup$
    Hey man, thanks you very much for all your help :)
    $endgroup$
    – Jim Jam
    Mar 9 '16 at 22:39






  • 1




    $begingroup$
    @user108262: You're welcome and I hope it helps you as much as it has helped me! When I devised these rules I was strongly influenced by programming where the context of every statement is explicit. That really is the key, because it is then simple to construct the inference rules based on intuition. Like in programming, there can be multiple statements within the same context, and this minimizes the amount of writing needed, in stark contrast to Hilbert-style systems. I presented it here in Fitch-style but we can just as well use braces or indentation like in C or Python.
    $endgroup$
    – user21820
    Mar 10 '16 at 0:57










  • $begingroup$
    I decided to update my post with all the rules, and I changed to Python style. The underlying idea is certainly correct, as I've used it for years. But it is a long post and there may be bugs, so if anyone has any question feel free to ask me at chat.stackexchange.com/rooms/44058/logic.
    $endgroup$
    – user21820
    Dec 31 '16 at 17:04













8












8








8





$begingroup$

Truth tables are not enough to capture first-order logic (with quantifiers), so we use inference rules instead. Each inference rule is chosen to be sound, meaning that if you start with true statements and use the rule you will deduce only true statements. We say that these rules are truth-preserving. If you choose carefully enough, you can make it so that the rules are not just truth-preserving but also allow you to deduce every (well-formed) statement that is necessarily true (in all situations).



What you are probably looking for (namely a practical way to rigorously check the logical validity of your arguments) is natural deduction. There are many different styles, the most intuitive type being Fitch-style, which mark subcontexts using indentation or some related visual demarcation. The following system uses indentation and follows the intuition most closely in my opinion.
$
defblock#1beginarrayll &#1endarray
deffitch#1#2beginarrayl#1\hline#2endarray
defsub#1#2text#1:\block#2
defimpRightarrow
defeqLeftrightarrow
defnnmathbbN
defnonevarnothing
defpowmathcalP
$




Contexts



Every line is either a header or a statement. Only headers can have lines subsumed under it, as in a multi-level list. The context of each statement is specified by all the headers that are in effect.



For example a case analysis would look like:



$subIf $A$... \ subIf $neg A$...$



And reasoning about an arbitrary member of a collection $S$ would look like:



$subGiven $x in S$...$



Note that what is stated in some context may be invalid in other contexts. Once you understand the principle behind contexts and the indentation, the following rules are very natural. Also note that for first-order logic the above two kinds of context headers (for conditional subcontexts and universal subcontexts respectively) are the only kinds needed.



Syntax rules



A statement must be an atomic (indivisible) proposition or a compound statement formed in the usual way using boolean operations or quantifiers, with the restriction that every variable that is bound by a quantifier is not already used to refer to some object in the current context, and that there are no nested quantifiers that bind the same variable.



Natural deduction rules



Each inference rule is of the form:



$fitchtextXtextY$



which means that if the last lines you have written match "X" then you can write "Y" immediately after that at the same level of indentation. Each application of an inference rule is also tied to the current context, which is defined to be the context of "X". We will not mention "current context" all the time.




Boolean operations



Take any statements $A,B,C$ (in the current context).



restate: If we prove something we can affirm it again in the same context.



$fitchA.\...A.$



Note that "$...$" denote any number of lines that are at least at the depicted indentation level. In the above rule, this means that all the lines written since the earlier writing of "$A.$" must be in the same context (or some subcontext).



In practice we never actually write the same line twice, but to make the description of the rules easy we shall to consider it written anyway. I'll mark all such lines with square-brackets as follows:



$fitchA. \ ...[A.]$



⇒sub     ⇒restate     (We can create a conditional subcontext where $A$ holds.)



$fitchsubIf $A$[A.]$
$fitchB. \ ... \ subIf $A$...block[B.]$



⇒intro     ⇒elim     ("$imp$" internally captures contextual statements.)



$fitchsubIf $A$... \ B. \ ... \ ...[A imp B.]$
$fitchA imp B. \ A.B.$



∧intro     ∧elim



$fitchA. \ B.A land B.$
$fitchA land B.[A.] \ [B.]$



∨intro     ∨elim



$fitchA.[A lor B.] \ [B lor A.]$
$fitchA lor B. \ A imp C. \ B imp C.C.$



¬intro     ¬elim     ¬¬elim



$fitchA imp bot.neg A.$
$fitchA. \ neg A.bot.$
$fitchneg neg A.A.$



Note that by using ¬intro and ¬¬elim we can get the following additional inference rule:



$fitchneg A imp bot.A.$



which corresponds to how one would attempt to prove $A$ by contradiction, namely to show that assuming $neg A$ implies a falsehood.



⇔intro     ⇔elim



$fitchA imp B. \ B imp A.A eq B.$
$fitchA eq B.[A imp B.] \ [B imp A.]$



Quantifiers and equality



I show the rules for restricted quantifiers because usually we think in terms of them. First we need some definitions.



Unused variable: A variable that is not declared in the header of any containing ∀-subcontext or in any previous ∃-elimination ("let") step in the current context or any containing contexts.



Fresh variable: A variable that does not appear in any previous statement.



Object expression: An expression that refers to an object. In classical first-order logic, the object expressions are simply the well-formed terms (whose free variables are each declared in the header of some containing ∀-subcontext). In the following rules $E,F$ (if involved) can be any object expressions.



And we need at least one type over which we can quantify, which is provided by the following rule.



universe: $obj$ is a type, which includes all objects.



$fitch[E in obj.]$



Now take any type $S$ and a property $P$ and an unused variable $x$ that does not appear in $S$ or $P$. By $P$ being a property we mean that $P(x)$ is a statement about $x$.



∀sub         ∀restate         (We can create a subcontext in which $x$ is of type $S$.)



$fitchsubGiven $x in S$[x in S.]$
$fitchA. \ ... \ subGiven $x in S$...block[A.]$ ($x$ must not appear in $A$)



∀intro         ∀elim



$fitchsubGiven $x in S$... \ P(x). \ ... \ ...forall x in S ( P(x) ).$
$fitchforall x in S ( P(x) ). \ ... \ E in S. \ ...P(E).$ (unused variables appearing in $P$ must not appear in $E$)



∃intro           ∃elim



$fitchE in S. \ ... \ P(E). \ ...exists x in S ( P(x) ).$
$fitchexists x in S ( P(x) ).textLet $y in S$ such that $P(y)$. \ [y in S.] \ [P(y).]$ (where $y$ is a fresh variable)



=intro       =elim



$fitch[E=E.]$
$fitchE=F. \ P(E).P(F).$ (unused variables appearing in $P$ must not appear in $F$)



Variable renaming



Finally, the following rules for variable renaming are redundant, but would significantly shorten proofs.



∀rename         ∃rename



$fitchforall x in S ( P(x) ).[forall y in S ( P(y) ).]$
$fitchexists x in S ( P(x) ).[exists y in S ( P(y) ).]$



  (where $y$ is an unused variable that does not appear in $P$)



Short-forms



For convenience we also write "$forall x,y in S ( P(x,y) )$" as short-form for "$forall x in S ( forall y in S ( P(x,y) ) )$", and similarly for more variables and for "$exists$".



Additionally, "$exists! x in S ( P(x) )$" is short-form for "$exists x in S ( P(x) land forall y in S ( P(y) imp x=y ) )$".




Example



Here is an example, where $S,T$ are any types and $P$ is any property with two parameters.



First with all lines shown:



  If $exists x in S ( forall y in T ( P(x,y) ) )$:   [⇒sub]

    $exists x in S ( forall y in T ( P(x,y) ) )$.   [⇒sub]

    Let $a in S$ such that $forall y in T ( P(a,y) )$.   [∃elim]

    $a in S$.   [∃elim]

    $forall y in T ( P(a,y) )$.   [∃elim]

    $forall z in T ( P(a,z) )$.   [∀rename]

    Given $y in T$:   [∀sub]

      $y in T$.   [∀sub]

      $forall z in T ( P(a,z) )$.   [∀restate]

      $y in T$.   [restate]

      $P(a,y)$.   [∀elim]

      $a in S$.   [∀restate]

      $exists x in S ( P(x,y) )$.   [∃intro]

    $forall y in T ( exists x in S ( P(x,y) ) )$.   [∀intro]

$exists x in S ( forall y in T ( P(x,y) ) ) imp forall y in T ( exists x in S ( P(x,y) ) )$.   [⇒intro]



Finally with all lines in square-brackets removed:



  If $exists x in S ( forall y in T ( P(x,y) ) )$:   [⇒sub]

    Let $a in S$ such that $forall y in T ( P(a,y) )$.   [∃elim]

    Given $y in T$:   [∀sub]

      $P(a,y)$.   [∀elim]

      $exists x in S ( P(x,y) )$.   [∃intro]

    $forall y in T ( exists x in S ( P(x,y) ) )$.   [∀intro]

$exists x in S ( forall y in T ( P(x,y) ) ) imp forall y in T ( exists x in S ( P(x,y) ) )$.   [⇒intro]



This final proof is much cleaner yet still easily computer-verifiable.



Notes



The above rules avoid the usual trouble that most other systems have, where variables used for witnesses of existential statements must be distinguished from variables used for arbitrary objects. The reason is that every variable here is either specified by a ∀-subcontext or by a "let"-statement; in other words there are no free variables. The fact that every variable is bound is strongly related to the fact that this system allows an empty universe, if there are no other axioms.



Also, every variable is specified by a unique header or "let"-statement in the current context; in other words there is no variable shadowing. This is by design, and in actual mathematical practice we also abide by this, though most other formal systems do not. As a consequence, sentences such as "$exists x forall x ( x=x )$." simply cannot be written down in this system. If you wish to permit such kind of terrible sentences, you would have to modify the rules appropriately, but it will most probably cause a headache.



Finally, there were some subtle technical decisions. For the quantifier rules, the reason I required that $x$ does not appear in $S,P$ is that, if we later on include rules for specifying types, we would usually have variable names in its syntax, which would cause problems. For example, if we have written in the current context "$x∈y:y∈S∧y∈T$" and "$x∈U$", it will not be sensible to allow writing "$∃y∈U ( y∈y:y∈S∧y∈T )$". Similarly, if we have written "$x=y:P(y)$" and "$∃y∈U ( Q(x,y) )$", we do not want to allow writing "$∃y∈U ( Q(y:P(y),y) )$".




To illustrate the flexibility of this system, I will express both Peano Arithmetic and Set Theory as extra rules that can be simply added to the system.



Peano Arithmetic



Add the type $nn$ and the symbols of PA, namely the constant-symbols $0,1$ and the $2$-input function-symbols $+,·$ and the $2$-input predicate-symbol $<$.



Add the axioms of PA$^-$, adapted from here:




  • $forall x,y in nn ( x+y in nn )$.


  • $forall x,y in nn ( x·y in nn )$.


  • $forall x,y in nn ( x+y=y+x )$.


  • $forall x,y in nn ( x·y=y·x )$.


  • $forall x,y,z in nn ( x+(y+z)=(x+y)+z )$.


  • $forall x,y,z in nn ( x·(y·z)=(x·y)·z )$.


  • $forall x,y,z in nn ( x·(y+z)=x·z+y·z )$.


  • $forall x in nn ( x+0=x )$.


  • $forall x in nn ( x·1=x )$.


  • $forall x in nn ( neg x<x )$.


  • $forall x,y in nn ( x<y lor y<x lor x=y )$.


  • $forall x,y,z in nn ( x<y land y<z imp x<z )$.


  • $forall x,y,z in nn ( x<y imp x+z<y+z )$.


  • $forall x,y,z in nn ( x<y land 0<z imp x·z<y·z )$.


  • $forall x,y in nn ( x<y imp exists z in nn ( x+z=y ) )$.


  • $0<1$.


  • $forall x in nn ( 0=x lor 1=x lor 1<x )$.

Add the induction axioms, namely for each property $P$ involving only the symbols of PA and quantifiers over $nn$ add the following axiom:




  • $P(0) land forall k in nn ( P(k) imp P(k+1) ) imp forall k in nn ( P(k) )$.

Set Theory



Add the type $set$ and the rule that every member of $set$ is also a type.



Add the unary function-symbols $pow,bigcup$, the binary function-symbols $×,FN$, and the constant-symbol $none$. We reuse the binary predicate-symbol $in$, as there will be no ambiguity. Also add the following rules (in every context) for the other notation:



  • If $E,F in obj$, then $(E,F) in obj$ and $E,F in set$.

  • If $S,T in set$, then $S×T in set$ and $FN(S,T) in set$ and $pow(S) in set$.

  • If $S,T in set$ and $f in FN(S,T)$ and $x in S$, then $f(x) in T$.

  • If $S in set$ and $forall x in S ( x in set )$, then $bigcup(S) in set$.

Add the following axioms:




  • extensionality:   $forall S,T in set ( S=T eq forall x in obj ( x in S eq x in T ) ).$


  • empty-set:   $forall x in obj ( neg x in none ).$


  • naturals:   $nn in set$.


  • power-set:   $forall S in set ( pow(S) = T : T in set land forall x in T ( x in S ) ).$


  • pair:   $forall x,y in obj ( x,y = z : x=z lor x=y ).$


  • ordered-pair:   $forall x,y in obj forall z,w in obj ( (x,y)=(z,w) eq x=z land y=w ).$


  • product-type:   $forall S,T in set ( S×T = t : exists x in S exists y in T ( t=(x,y) ) ).$


  • function-type:   $forall S,T in set ( FN(S,T) = \ F : F in S×T land forall x in S exists! y in T ( (x,y) in F ) ).$


  • function-application:   $forall S,T in set forall f in FN(S,T) forall x in S ( (x,f(x)) in f ).$


  • union:   $forall S in set ( bigcup(S) = x : exists T in set ( x in T land T in S ) ).$


  • choice:   $forall S,T in set forall R in S×T ( forall x in S exists y in T ( (x,y) in R ) \ imp exists f in FN(S,T) forall x in S ( (x,f(x)) in R ) ).$

Add the following rules:



type-notation



Take (in the current context) any property $P$ and object expression $E$ and unused variable $x$.



Then $ x : P(x) $ is a type and its membership is governed by:



$fitchE in x : P(x) eq P(E).$. ($x$ must not appear in $E$ or $P$)



comprehension



Take any property $P$ and unused variable $x$.



$fitchS in set. x : x in S land P(x) in set.$. ($x$ must not appear in $S$ or $P$)



collection



Take any $2$-parameter property $P$ and unused variables $x,y$.



$fitchS in set. \ forall x in S exists y in obj ( P(x,y) ). y : exists x in S ( P(x,y) ) in set.$ ($x,y$ must not appear in $S$ or $P$)



induction



Take any property $P$ with $1$ parameter from $nn$.



$fitchP(0). \ forall k in nn ( P(k) imp P(k+1) ).forall k in nn ( P(k) ).$ ($k$ must not appear in $P$)



The induction rule subsumes the induction axioms for PA, and essentially the only difference is that the property $P$ can involve set operations and quantification over sets.



function-notation



This rule is theoretically unnecessary but pragmatically very convenient (also known as lambda expressions in computer science).



Take any set $S$ and any object expression $E$ with $1$ parameter from $S$, and unused variable $x$.



Then $( S x mapsto E(x) )$ is an object and its behaviour is governed by:



$fitchforall x in S ( E(x) in T ). \ f = ( S x mapsto E(x) ).f in FN(S,T) land forall x in S ( f(x) = E(x) ).$



Foundational system



Combining the above Peano Arithmetic plus Set Theory yields a foundational system that is essentially as strong as ZFC but much more user-friendly. It is also agnostic to the existence of objects that are not sets, and does not even assume that the members of $nn$ are sets. It also treats cartesian products and ordered pairs as inbuilt abstract notions. This is how we use them in actual mathematics. (More precisely, the above system directly interprets ZFC minus regularity.)






share|cite|improve this answer











$endgroup$



Truth tables are not enough to capture first-order logic (with quantifiers), so we use inference rules instead. Each inference rule is chosen to be sound, meaning that if you start with true statements and use the rule you will deduce only true statements. We say that these rules are truth-preserving. If you choose carefully enough, you can make it so that the rules are not just truth-preserving but also allow you to deduce every (well-formed) statement that is necessarily true (in all situations).



What you are probably looking for (namely a practical way to rigorously check the logical validity of your arguments) is natural deduction. There are many different styles, the most intuitive type being Fitch-style, which mark subcontexts using indentation or some related visual demarcation. The following system uses indentation and follows the intuition most closely in my opinion.
$
defblock#1beginarrayll &#1endarray
deffitch#1#2beginarrayl#1\hline#2endarray
defsub#1#2text#1:\block#2
defimpRightarrow
defeqLeftrightarrow
defnnmathbbN
defnonevarnothing
defpowmathcalP
$




Contexts



Every line is either a header or a statement. Only headers can have lines subsumed under it, as in a multi-level list. The context of each statement is specified by all the headers that are in effect.



For example a case analysis would look like:



$subIf $A$... \ subIf $neg A$...$



And reasoning about an arbitrary member of a collection $S$ would look like:



$subGiven $x in S$...$



Note that what is stated in some context may be invalid in other contexts. Once you understand the principle behind contexts and the indentation, the following rules are very natural. Also note that for first-order logic the above two kinds of context headers (for conditional subcontexts and universal subcontexts respectively) are the only kinds needed.



Syntax rules



A statement must be an atomic (indivisible) proposition or a compound statement formed in the usual way using boolean operations or quantifiers, with the restriction that every variable that is bound by a quantifier is not already used to refer to some object in the current context, and that there are no nested quantifiers that bind the same variable.



Natural deduction rules



Each inference rule is of the form:



$fitchtextXtextY$



which means that if the last lines you have written match "X" then you can write "Y" immediately after that at the same level of indentation. Each application of an inference rule is also tied to the current context, which is defined to be the context of "X". We will not mention "current context" all the time.




Boolean operations



Take any statements $A,B,C$ (in the current context).



restate: If we prove something we can affirm it again in the same context.



$fitchA.\...A.$



Note that "$...$" denote any number of lines that are at least at the depicted indentation level. In the above rule, this means that all the lines written since the earlier writing of "$A.$" must be in the same context (or some subcontext).



In practice we never actually write the same line twice, but to make the description of the rules easy we shall to consider it written anyway. I'll mark all such lines with square-brackets as follows:



$fitchA. \ ...[A.]$



⇒sub     ⇒restate     (We can create a conditional subcontext where $A$ holds.)



$fitchsubIf $A$[A.]$
$fitchB. \ ... \ subIf $A$...block[B.]$



⇒intro     ⇒elim     ("$imp$" internally captures contextual statements.)



$fitchsubIf $A$... \ B. \ ... \ ...[A imp B.]$
$fitchA imp B. \ A.B.$



∧intro     ∧elim



$fitchA. \ B.A land B.$
$fitchA land B.[A.] \ [B.]$



∨intro     ∨elim



$fitchA.[A lor B.] \ [B lor A.]$
$fitchA lor B. \ A imp C. \ B imp C.C.$



¬intro     ¬elim     ¬¬elim



$fitchA imp bot.neg A.$
$fitchA. \ neg A.bot.$
$fitchneg neg A.A.$



Note that by using ¬intro and ¬¬elim we can get the following additional inference rule:



$fitchneg A imp bot.A.$



which corresponds to how one would attempt to prove $A$ by contradiction, namely to show that assuming $neg A$ implies a falsehood.



⇔intro     ⇔elim



$fitchA imp B. \ B imp A.A eq B.$
$fitchA eq B.[A imp B.] \ [B imp A.]$



Quantifiers and equality



I show the rules for restricted quantifiers because usually we think in terms of them. First we need some definitions.



Unused variable: A variable that is not declared in the header of any containing ∀-subcontext or in any previous ∃-elimination ("let") step in the current context or any containing contexts.



Fresh variable: A variable that does not appear in any previous statement.



Object expression: An expression that refers to an object. In classical first-order logic, the object expressions are simply the well-formed terms (whose free variables are each declared in the header of some containing ∀-subcontext). In the following rules $E,F$ (if involved) can be any object expressions.



And we need at least one type over which we can quantify, which is provided by the following rule.



universe: $obj$ is a type, which includes all objects.



$fitch[E in obj.]$



Now take any type $S$ and a property $P$ and an unused variable $x$ that does not appear in $S$ or $P$. By $P$ being a property we mean that $P(x)$ is a statement about $x$.



∀sub         ∀restate         (We can create a subcontext in which $x$ is of type $S$.)



$fitchsubGiven $x in S$[x in S.]$
$fitchA. \ ... \ subGiven $x in S$...block[A.]$ ($x$ must not appear in $A$)



∀intro         ∀elim



$fitchsubGiven $x in S$... \ P(x). \ ... \ ...forall x in S ( P(x) ).$
$fitchforall x in S ( P(x) ). \ ... \ E in S. \ ...P(E).$ (unused variables appearing in $P$ must not appear in $E$)



∃intro           ∃elim



$fitchE in S. \ ... \ P(E). \ ...exists x in S ( P(x) ).$
$fitchexists x in S ( P(x) ).textLet $y in S$ such that $P(y)$. \ [y in S.] \ [P(y).]$ (where $y$ is a fresh variable)



=intro       =elim



$fitch[E=E.]$
$fitchE=F. \ P(E).P(F).$ (unused variables appearing in $P$ must not appear in $F$)



Variable renaming



Finally, the following rules for variable renaming are redundant, but would significantly shorten proofs.



∀rename         ∃rename



$fitchforall x in S ( P(x) ).[forall y in S ( P(y) ).]$
$fitchexists x in S ( P(x) ).[exists y in S ( P(y) ).]$



  (where $y$ is an unused variable that does not appear in $P$)



Short-forms



For convenience we also write "$forall x,y in S ( P(x,y) )$" as short-form for "$forall x in S ( forall y in S ( P(x,y) ) )$", and similarly for more variables and for "$exists$".



Additionally, "$exists! x in S ( P(x) )$" is short-form for "$exists x in S ( P(x) land forall y in S ( P(y) imp x=y ) )$".




Example



Here is an example, where $S,T$ are any types and $P$ is any property with two parameters.



First with all lines shown:



  If $exists x in S ( forall y in T ( P(x,y) ) )$:   [⇒sub]

    $exists x in S ( forall y in T ( P(x,y) ) )$.   [⇒sub]

    Let $a in S$ such that $forall y in T ( P(a,y) )$.   [∃elim]

    $a in S$.   [∃elim]

    $forall y in T ( P(a,y) )$.   [∃elim]

    $forall z in T ( P(a,z) )$.   [∀rename]

    Given $y in T$:   [∀sub]

      $y in T$.   [∀sub]

      $forall z in T ( P(a,z) )$.   [∀restate]

      $y in T$.   [restate]

      $P(a,y)$.   [∀elim]

      $a in S$.   [∀restate]

      $exists x in S ( P(x,y) )$.   [∃intro]

    $forall y in T ( exists x in S ( P(x,y) ) )$.   [∀intro]

$exists x in S ( forall y in T ( P(x,y) ) ) imp forall y in T ( exists x in S ( P(x,y) ) )$.   [⇒intro]



Finally with all lines in square-brackets removed:



  If $exists x in S ( forall y in T ( P(x,y) ) )$:   [⇒sub]

    Let $a in S$ such that $forall y in T ( P(a,y) )$.   [∃elim]

    Given $y in T$:   [∀sub]

      $P(a,y)$.   [∀elim]

      $exists x in S ( P(x,y) )$.   [∃intro]

    $forall y in T ( exists x in S ( P(x,y) ) )$.   [∀intro]

$exists x in S ( forall y in T ( P(x,y) ) ) imp forall y in T ( exists x in S ( P(x,y) ) )$.   [⇒intro]



This final proof is much cleaner yet still easily computer-verifiable.



Notes



The above rules avoid the usual trouble that most other systems have, where variables used for witnesses of existential statements must be distinguished from variables used for arbitrary objects. The reason is that every variable here is either specified by a ∀-subcontext or by a "let"-statement; in other words there are no free variables. The fact that every variable is bound is strongly related to the fact that this system allows an empty universe, if there are no other axioms.



Also, every variable is specified by a unique header or "let"-statement in the current context; in other words there is no variable shadowing. This is by design, and in actual mathematical practice we also abide by this, though most other formal systems do not. As a consequence, sentences such as "$exists x forall x ( x=x )$." simply cannot be written down in this system. If you wish to permit such kind of terrible sentences, you would have to modify the rules appropriately, but it will most probably cause a headache.



Finally, there were some subtle technical decisions. For the quantifier rules, the reason I required that $x$ does not appear in $S,P$ is that, if we later on include rules for specifying types, we would usually have variable names in its syntax, which would cause problems. For example, if we have written in the current context "$x∈y:y∈S∧y∈T$" and "$x∈U$", it will not be sensible to allow writing "$∃y∈U ( y∈y:y∈S∧y∈T )$". Similarly, if we have written "$x=y:P(y)$" and "$∃y∈U ( Q(x,y) )$", we do not want to allow writing "$∃y∈U ( Q(y:P(y),y) )$".




To illustrate the flexibility of this system, I will express both Peano Arithmetic and Set Theory as extra rules that can be simply added to the system.



Peano Arithmetic



Add the type $nn$ and the symbols of PA, namely the constant-symbols $0,1$ and the $2$-input function-symbols $+,·$ and the $2$-input predicate-symbol $<$.



Add the axioms of PA$^-$, adapted from here:




  • $forall x,y in nn ( x+y in nn )$.


  • $forall x,y in nn ( x·y in nn )$.


  • $forall x,y in nn ( x+y=y+x )$.


  • $forall x,y in nn ( x·y=y·x )$.


  • $forall x,y,z in nn ( x+(y+z)=(x+y)+z )$.


  • $forall x,y,z in nn ( x·(y·z)=(x·y)·z )$.


  • $forall x,y,z in nn ( x·(y+z)=x·z+y·z )$.


  • $forall x in nn ( x+0=x )$.


  • $forall x in nn ( x·1=x )$.


  • $forall x in nn ( neg x<x )$.


  • $forall x,y in nn ( x<y lor y<x lor x=y )$.


  • $forall x,y,z in nn ( x<y land y<z imp x<z )$.


  • $forall x,y,z in nn ( x<y imp x+z<y+z )$.


  • $forall x,y,z in nn ( x<y land 0<z imp x·z<y·z )$.


  • $forall x,y in nn ( x<y imp exists z in nn ( x+z=y ) )$.


  • $0<1$.


  • $forall x in nn ( 0=x lor 1=x lor 1<x )$.

Add the induction axioms, namely for each property $P$ involving only the symbols of PA and quantifiers over $nn$ add the following axiom:




  • $P(0) land forall k in nn ( P(k) imp P(k+1) ) imp forall k in nn ( P(k) )$.

Set Theory



Add the type $set$ and the rule that every member of $set$ is also a type.



Add the unary function-symbols $pow,bigcup$, the binary function-symbols $×,FN$, and the constant-symbol $none$. We reuse the binary predicate-symbol $in$, as there will be no ambiguity. Also add the following rules (in every context) for the other notation:



  • If $E,F in obj$, then $(E,F) in obj$ and $E,F in set$.

  • If $S,T in set$, then $S×T in set$ and $FN(S,T) in set$ and $pow(S) in set$.

  • If $S,T in set$ and $f in FN(S,T)$ and $x in S$, then $f(x) in T$.

  • If $S in set$ and $forall x in S ( x in set )$, then $bigcup(S) in set$.

Add the following axioms:




  • extensionality:   $forall S,T in set ( S=T eq forall x in obj ( x in S eq x in T ) ).$


  • empty-set:   $forall x in obj ( neg x in none ).$


  • naturals:   $nn in set$.


  • power-set:   $forall S in set ( pow(S) = T : T in set land forall x in T ( x in S ) ).$


  • pair:   $forall x,y in obj ( x,y = z : x=z lor x=y ).$


  • ordered-pair:   $forall x,y in obj forall z,w in obj ( (x,y)=(z,w) eq x=z land y=w ).$


  • product-type:   $forall S,T in set ( S×T = t : exists x in S exists y in T ( t=(x,y) ) ).$


  • function-type:   $forall S,T in set ( FN(S,T) = \ F : F in S×T land forall x in S exists! y in T ( (x,y) in F ) ).$


  • function-application:   $forall S,T in set forall f in FN(S,T) forall x in S ( (x,f(x)) in f ).$


  • union:   $forall S in set ( bigcup(S) = x : exists T in set ( x in T land T in S ) ).$


  • choice:   $forall S,T in set forall R in S×T ( forall x in S exists y in T ( (x,y) in R ) \ imp exists f in FN(S,T) forall x in S ( (x,f(x)) in R ) ).$

Add the following rules:



type-notation



Take (in the current context) any property $P$ and object expression $E$ and unused variable $x$.



Then $ x : P(x) $ is a type and its membership is governed by:



$fitchE in x : P(x) eq P(E).$. ($x$ must not appear in $E$ or $P$)



comprehension



Take any property $P$ and unused variable $x$.



$fitchS in set. x : x in S land P(x) in set.$. ($x$ must not appear in $S$ or $P$)



collection



Take any $2$-parameter property $P$ and unused variables $x,y$.



$fitchS in set. \ forall x in S exists y in obj ( P(x,y) ). y : exists x in S ( P(x,y) ) in set.$ ($x,y$ must not appear in $S$ or $P$)



induction



Take any property $P$ with $1$ parameter from $nn$.



$fitchP(0). \ forall k in nn ( P(k) imp P(k+1) ).forall k in nn ( P(k) ).$ ($k$ must not appear in $P$)



The induction rule subsumes the induction axioms for PA, and essentially the only difference is that the property $P$ can involve set operations and quantification over sets.



function-notation



This rule is theoretically unnecessary but pragmatically very convenient (also known as lambda expressions in computer science).



Take any set $S$ and any object expression $E$ with $1$ parameter from $S$, and unused variable $x$.



Then $( S x mapsto E(x) )$ is an object and its behaviour is governed by:



$fitchforall x in S ( E(x) in T ). \ f = ( S x mapsto E(x) ).f in FN(S,T) land forall x in S ( f(x) = E(x) ).$



Foundational system



Combining the above Peano Arithmetic plus Set Theory yields a foundational system that is essentially as strong as ZFC but much more user-friendly. It is also agnostic to the existence of objects that are not sets, and does not even assume that the members of $nn$ are sets. It also treats cartesian products and ordered pairs as inbuilt abstract notions. This is how we use them in actual mathematics. (More precisely, the above system directly interprets ZFC minus regularity.)







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Mar 13 at 7:00

























answered Mar 5 '16 at 14:13









user21820user21820

39.4k543155




39.4k543155











  • $begingroup$
    Hey man, thanks you very much for all your help :)
    $endgroup$
    – Jim Jam
    Mar 9 '16 at 22:39






  • 1




    $begingroup$
    @user108262: You're welcome and I hope it helps you as much as it has helped me! When I devised these rules I was strongly influenced by programming where the context of every statement is explicit. That really is the key, because it is then simple to construct the inference rules based on intuition. Like in programming, there can be multiple statements within the same context, and this minimizes the amount of writing needed, in stark contrast to Hilbert-style systems. I presented it here in Fitch-style but we can just as well use braces or indentation like in C or Python.
    $endgroup$
    – user21820
    Mar 10 '16 at 0:57










  • $begingroup$
    I decided to update my post with all the rules, and I changed to Python style. The underlying idea is certainly correct, as I've used it for years. But it is a long post and there may be bugs, so if anyone has any question feel free to ask me at chat.stackexchange.com/rooms/44058/logic.
    $endgroup$
    – user21820
    Dec 31 '16 at 17:04
















  • $begingroup$
    Hey man, thanks you very much for all your help :)
    $endgroup$
    – Jim Jam
    Mar 9 '16 at 22:39






  • 1




    $begingroup$
    @user108262: You're welcome and I hope it helps you as much as it has helped me! When I devised these rules I was strongly influenced by programming where the context of every statement is explicit. That really is the key, because it is then simple to construct the inference rules based on intuition. Like in programming, there can be multiple statements within the same context, and this minimizes the amount of writing needed, in stark contrast to Hilbert-style systems. I presented it here in Fitch-style but we can just as well use braces or indentation like in C or Python.
    $endgroup$
    – user21820
    Mar 10 '16 at 0:57










  • $begingroup$
    I decided to update my post with all the rules, and I changed to Python style. The underlying idea is certainly correct, as I've used it for years. But it is a long post and there may be bugs, so if anyone has any question feel free to ask me at chat.stackexchange.com/rooms/44058/logic.
    $endgroup$
    – user21820
    Dec 31 '16 at 17:04















$begingroup$
Hey man, thanks you very much for all your help :)
$endgroup$
– Jim Jam
Mar 9 '16 at 22:39




$begingroup$
Hey man, thanks you very much for all your help :)
$endgroup$
– Jim Jam
Mar 9 '16 at 22:39




1




1




$begingroup$
@user108262: You're welcome and I hope it helps you as much as it has helped me! When I devised these rules I was strongly influenced by programming where the context of every statement is explicit. That really is the key, because it is then simple to construct the inference rules based on intuition. Like in programming, there can be multiple statements within the same context, and this minimizes the amount of writing needed, in stark contrast to Hilbert-style systems. I presented it here in Fitch-style but we can just as well use braces or indentation like in C or Python.
$endgroup$
– user21820
Mar 10 '16 at 0:57




$begingroup$
@user108262: You're welcome and I hope it helps you as much as it has helped me! When I devised these rules I was strongly influenced by programming where the context of every statement is explicit. That really is the key, because it is then simple to construct the inference rules based on intuition. Like in programming, there can be multiple statements within the same context, and this minimizes the amount of writing needed, in stark contrast to Hilbert-style systems. I presented it here in Fitch-style but we can just as well use braces or indentation like in C or Python.
$endgroup$
– user21820
Mar 10 '16 at 0:57












$begingroup$
I decided to update my post with all the rules, and I changed to Python style. The underlying idea is certainly correct, as I've used it for years. But it is a long post and there may be bugs, so if anyone has any question feel free to ask me at chat.stackexchange.com/rooms/44058/logic.
$endgroup$
– user21820
Dec 31 '16 at 17:04




$begingroup$
I decided to update my post with all the rules, and I changed to Python style. The underlying idea is certainly correct, as I've used it for years. But it is a long post and there may be bugs, so if anyone has any question feel free to ask me at chat.stackexchange.com/rooms/44058/logic.
$endgroup$
– user21820
Dec 31 '16 at 17:04

















draft saved

draft discarded
















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1681857%2fpredicate-logic-how-do-you-self-check-the-logical-structure-of-your-own-argumen%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Lowndes Grove History Architecture References Navigation menu32°48′6″N 79°57′58″W / 32.80167°N 79.96611°W / 32.80167; -79.9661132°48′6″N 79°57′58″W / 32.80167°N 79.96611°W / 32.80167; -79.9661178002500"National Register Information System"Historic houses of South Carolina"Lowndes Grove""+32° 48' 6.00", −79° 57' 58.00""Lowndes Grove, Charleston County (260 St. Margaret St., Charleston)""Lowndes Grove"The Charleston ExpositionIt Happened in South Carolina"Lowndes Grove (House), Saint Margaret Street & Sixth Avenue, Charleston, Charleston County, SC(Photographs)"Plantations of the Carolina Low Countrye

random experiment with two different functions on unit interval Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)Random variable and probability space notionsRandom Walk with EdgesFinding functions where the increase over a random interval is Poisson distributedNumber of days until dayCan an observed event in fact be of zero probability?Unit random processmodels of coins and uniform distributionHow to get the number of successes given $n$ trials , probability $P$ and a random variable $X$Absorbing Markov chain in a computer. Is “almost every” turned into always convergence in computer executions?Stopped random walk is not uniformly integrable

How should I support this large drywall patch? Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How do I cover large gaps in drywall?How do I keep drywall around a patch from crumbling?Can I glue a second layer of drywall?How to patch long strip on drywall?Large drywall patch: how to avoid bulging seams?Drywall Mesh Patch vs. Bulge? To remove or not to remove?How to fix this drywall job?Prep drywall before backsplashWhat's the best way to fix this horrible drywall patch job?Drywall patching using 3M Patch Plus Primer