Skip to content

Commit 6a362d9

Browse files
committed
Revise the section on propositional natural deduction
1 parent 16c5fbe commit 6a362d9

16 files changed

Lines changed: 359 additions & 275 deletions

src/notebook/math/logic/classical_logic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
parse_natural_deduction_rule('→₋', '(φ → ψ), φ ⊩ ψ'),
2424

2525
parse_natural_deduction_rule('↔₊', '[φ] ψ, [ψ] φ ⊩ (φ ↔ ψ)'),
26-
parse_natural_deduction_rule('↔₋ₗ', '(φ ↔ ψ), φψ'),
27-
parse_natural_deduction_rule('↔₋ᵣ', '(φ ↔ ψ), ψφ'),
26+
parse_natural_deduction_rule('↔₋ₗ', '(φ ↔ ψ), ψφ'),
27+
parse_natural_deduction_rule('↔₋ᵣ', '(φ ↔ ψ), φψ'),
2828

2929
parse_natural_deduction_rule('∀₊', 'φ[x ↦ y*] ⊩ ∀x.φ'),
3030
parse_natural_deduction_rule('∀₋', '∀x.φ ⊩ φ[x ↦ τ]'),

src/notebook/math/logic/deduction/test_proof_tree.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,40 @@ def test_efq() -> None:
117117
)
118118

119119

120+
# ex:def:propositional_natural_deduction_systems/efq_vs_dne
121+
def test_dne() -> None:
122+
tree = apply(
123+
CLASSICAL_NATURAL_DEDUCTION_SYSTEM['→₊'],
124+
prop_premise(
125+
tree=apply(
126+
CLASSICAL_NATURAL_DEDUCTION_SYSTEM['DNE'],
127+
prop_premise(
128+
tree=apply(
129+
CLASSICAL_NATURAL_DEDUCTION_SYSTEM['¬₋'],
130+
prop_assume('¬¬p', 'u'),
131+
prop_assume('¬p', 'v'),
132+
),
133+
discharge='¬p',
134+
marker='v'
135+
)
136+
),
137+
discharge='¬¬p',
138+
marker='u'
139+
)
140+
)
141+
142+
assert str(tree) == dedent('''\
143+
[¬¬p]ᵘ [¬p]ᵛ
144+
_______________ ¬₋
145+
146+
v _______________ DNE
147+
p
148+
u _______________ →₊
149+
(¬¬p → p)
150+
'''
151+
)
152+
153+
120154
# thm:minimal_implicational_logic_axioms_nd_proof
121155
def test_implication_distributivity_axiom_tree() -> None:
122156
tree = apply(

src/notebook/math/logic/theories/boolean/test_axioms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_bottom_minimality_proof() -> None:
9191
CLASSICAL_NATURAL_DEDUCTION_SYSTEM['∀₊'],
9292
premise(
9393
tree=apply(
94-
CLASSICAL_NATURAL_DEDUCTION_SYSTEM['↔₋'],
94+
CLASSICAL_NATURAL_DEDUCTION_SYSTEM['↔₋'],
9595
apply(
9696
CLASSICAL_NATURAL_DEDUCTION_SYSTEM['∀₋'],
9797
premise(
@@ -119,7 +119,7 @@ def test_bottom_minimality_proof() -> None:
119119
∀y.((⫫ ≤ y) ↔ ((⫫ ⩓ y) = ⫫)) [∀x.((⫫ ⩓ x) = ⫫)]ᵛ
120120
__________________________________ ∀₋ ___________________ ∀₋
121121
((⫫ ≤ x) ↔ ((⫫ ⩓ x) = ⫫)) ((⫫ ⩓ x) = ⫫)
122-
____________________________________________________________ ↔₋
122+
____________________________________________________________ ↔₋
123123
(⫫ ≤ x)
124124
____________________________________________________________ ∀₊
125125
∀x.(⫫ ≤ x)

text/curry_howard_correspondence.tex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ \section{Curry-Howard correspondence}\label{sec:curry_howard_correspondence}
268268

269269
Introducing more complicated types, for example for handling first-order and higher-order logic, is often done, in the tradition established by Per Martin-L\"of, via a stout list of metatheoretic \hyperref[def:inference_rule]{inference rules}. The classification of these rules is described in \cref{rem:type_theory_rule_classification}, and concrete rules extending the Curry-Howard correspondence to higher-order logic are presented in \fullref{sec:dependent_types}.
270270

271-
Fortunately, for the types we will consider in this section, we will be able to easily reuse the machinery we have built for untyped and simply typed (with only arrow types) \( \muplambda \)-calculus, with some small adjustments. See \cref{rem:product_type_equality_rules} for a more concrete discussion. We will however only limit ourselves to introduction and elimination rules since we will not need the rest. We will avoid introducing judgmental equality rules because we have spent considerable effort ensuring correctness of even \hyperref[def:lambda_term_alpha_equivalence]{\( \alpha \)-equivalence}.
271+
Fortunately, for the types we will consider in this section, we will be able to easily reuse the machinery we have built for untyped and simply typed (with only arrow types) \( \muplambda \)-calculus, with some small adjustments. See \cref{rem:simple_product_type_equality_rules} for a more concrete discussion. We will however only limit ourselves to introduction and elimination rules since we will not need the rest. We will avoid introducing judgmental equality rules because we have spent considerable effort ensuring correctness of even \hyperref[def:lambda_term_alpha_equivalence]{\( \alpha \)-equivalence}.
272272

273273
Still, we will still find useful the classification of rules, mostly because of the respective terminology.
274274
\end{remark}
@@ -375,14 +375,14 @@ \section{Curry-Howard correspondence}\label{sec:curry_howard_correspondence}
375375
\begin{comments}
376376
\item A treatment of product types within simple type theory can be found in \cite[\S 4.3.1]{Mimram2020ProgramEqualsProof}.
377377

378-
\item We discuss how equality rules and \( \beta\eta \)-reduction are related in \cref{rem:product_type_equality_rules}.
378+
\item We discuss how equality rules and \( \beta\eta \)-reduction are related in \cref{rem:simple_product_type_equality_rules}.
379379

380380
\item This is a binary analogue to the dependent products defined in \cref{def:dependent_product}.
381381
\end{comments}
382382

383-
\begin{remark}\label{rem:product_type_equality_rules}
383+
\begin{remark}\label{rem:simple_product_type_equality_rules}
384384
In \cref{ex:def:beta_eta_reduction/pairs}, we have shown that the \( \muplambda \)-terms \ref{ex:def:beta_eta_reduction/pairs/intro}, \ref{ex:def:beta_eta_reduction/pairs/elim_left} and \ref{ex:def:beta_eta_reduction/pairs/elim_right} enable the following \( \beta \)-reductions:
385-
\begin{align}\label{eq:rem:product_type_equality_rules/beta}
385+
\begin{align}\label{eq:rem:simple_product_type_equality_rules/beta}
386386
P_{-L} (P_+ A B) \bred* A
387387
&&
388388
\T{and}
@@ -440,13 +440,13 @@ \section{Curry-Howard correspondence}\label{sec:curry_howard_correspondence}
440440
\end{paracol}
441441

442442
There is one important downside related to \( \eta \)-reduction and \hyperref[rem:type_theory_rule_classification/equality/uniq]{uniqueness rules}, however. We could expect that
443-
\begin{equation}\label{eq:rem:product_type_equality_rules/eta}
443+
\begin{equation}\label{eq:rem:simple_product_type_equality_rules/eta}
444444
P_+ (P_{-L} M) (P_{-R} A) \redrel*{\beta\eta} A.
445445
\end{equation}
446446

447-
\incite*[corr. 1.23]{Barendregt1974SurjectivePairing} demonstrates that there is no triple of untyped \( \muplambda \)-terms \( P_+ \), \( P_{-L} \) and \( P_{+R} \) satisfying \eqref{eq:rem:product_type_equality_rules/eta}.
447+
\incite*[corr. 1.23]{Barendregt1974SurjectivePairing} demonstrates that there is no triple of untyped \( \muplambda \)-terms \( P_+ \), \( P_{-L} \) and \( P_{+R} \) satisfying \eqref{eq:rem:simple_product_type_equality_rules/eta}.
448448

449-
Barendregt calls a triple satisfying \eqref{eq:rem:product_type_equality_rules/beta} a \enquote{pairing}, and a triple additionally satisfying \eqref{eq:rem:product_type_equality_rules/eta} --- a \enquote{surjective pairing}. Thus, his result states that untyped \( \muplambda \)-calculus does not admit a surjective pairing, despite the obvious pairing shown in \cref{ex:def:beta_eta_reduction/pairs}.
449+
Barendregt calls a triple satisfying \eqref{eq:rem:simple_product_type_equality_rules/beta} a \enquote{pairing}, and a triple additionally satisfying \eqref{eq:rem:simple_product_type_equality_rules/eta} --- a \enquote{surjective pairing}. Thus, his result states that untyped \( \muplambda \)-calculus does not admit a surjective pairing, despite the obvious pairing shown in \cref{ex:def:beta_eta_reduction/pairs}.
450450

451451
Thus, even for simple types, adding new congruence and uniqueness rules cannot be circumvented by a simpler mechanism such as \( \delta \)-reduction. This will unfortunately require us to reprove all results involving either \( \beta\eta \)-reduction or only \( \alpha \)-equivalence. So, our decision is to avoid new rules and to sacrifice \hyperref[con:extensionality]{extensionality} for the sake of simplicity.
452452
\end{remark}
@@ -499,7 +499,7 @@ \section{Curry-Howard correspondence}\label{sec:curry_howard_correspondence}
499499

500500
\item As with the \hyperref[def:simple_empty_type]{empty type}, unless we make the constants \( \synS_{+L} \) and \( \synS_{+R} \) depend on the types of the terms, we break the type uniqueness for typed terms shown in \cref{thm:typed_term_habitation_uniqueness}. Again, this is a sacrifice for the sake of simplicity of our formalized system.
501501

502-
\item We discuss how equality rules and \( \beta\eta \)-reduction are related in \cref{rem:sum_type_equality_rules}.
502+
\item We discuss how equality rules and \( \beta\eta \)-reduction are related in \cref{rem:simple_sum_type_equality_rules}.
503503

504504
\item This is a binary analogue to the dependent sums defined in \cref{def:dependent_sum}.
505505
\end{comments}
@@ -522,8 +522,8 @@ \section{Curry-Howard correspondence}\label{sec:curry_howard_correspondence}
522522
\item One downside of our approach is that some recursive tree traversals like that in \fullref{alg:simply_typed_reduction} become much more involved because application terms (i.e. \( M = NK \)) can be produced by a variety of rules. With a dedicated syntax, only \ref{inf:def:arrow_type/elim} is able to produce such terms.
523523
\end{comments}
524524

525-
\begin{remark}\label{rem:sum_type_equality_rules}
526-
Similarly to product types, we can use \( \beta\delta \)-reduction to emulate \hyperref[rem:type_theory_rule_classification/equality/comp]{computation rules}. See \cref{rem:product_type_equality_rules} for a broader discussion of the general idea.
525+
\begin{remark}\label{rem:simple_sum_type_equality_rules}
526+
Similarly to product types, we can use \( \beta\delta \)-reduction to emulate \hyperref[rem:type_theory_rule_classification/equality/comp]{computation rules}. See \cref{rem:simple_product_type_equality_rules} for a broader discussion of the general idea.
527527

528528
In our case, given \( M: \tau \), we have
529529
\begin{equation*}

text/dependent_types.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ \section{Dependent types}\label{sec:dependent_types}
834834
N[a \mapsto M].
835835
\end{align*}
836836

837-
This is the desired result, as discussed in \cref{rem:sum_type_equality_rules}.
837+
This is the desired result, as discussed in \cref{rem:simple_sum_type_equality_rules}.
838838
\end{remark}
839839

840840
\begin{remark}\label{rem:dependent_sum_as_binary_product}

text/first_order_logic.tex

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,11 +749,17 @@ \section{First-order logic}\label{sec:first_order_logic}
749749

750750
However, as per \cref{rem:model_theory_structure_terminology}, unlike in general institutions, we will refer to structures as \enquote{models} only with respect to a theory.
751751

752-
We say that \( \mscrX \) is a \term[ru=модель (\cite[2.6.21]{Герасимов2014Вычислимость}), en=model (\cite[def. def.2.2.13(ii)]{Hinman2005Logic})]{model} \hi{of} the set of closed formulas \( \Gamma \) and write \( \mscrX \vDash \Gamma \) if and only if \( \Bracks{\varphi}_\mscrX = T \) for every formula \( \varphi \in \Gamma \).
752+
We say that \( \mscrX \) is a \term[ru=модель (\cite[2.6.21]{Герасимов2014Вычислимость}), en=model (\cite[def. def.2.2.13(ii)]{Hinman2005Logic})]{model} \hi{of} the set of closed formulas \( \Gamma \) and write \( \mscrX \vDash \Gamma \) if and only if \( \Bracks{\varphi}_\mscrX = T \) for every (closed) formula \( \varphi \in \Gamma \).
753753

754754
We also say that \( \varphi \) is \term[en=valid (\cite[144]{VanDalen2004LogicAndStructure})]{valid} in \( \mscrX \).
755755

756-
\thmitem{def:fol_semantics/satisfiable} If \( \Gamma \) has a model, we say that it is \term[ru=выполнимая (формула) (\cite[def. 2.4.1]{Герасимов2014Вычислимость}), en=satisfiable (formula) (\cite[71]{VanDalen2004LogicAndStructure})]{satisfiable}.
756+
Via \hyperref[def:fol_implicit_universal_quantification]{implicit universal quantification}, it is possible to extend the model relation to arbitrary formulas, not necessarily closed. Then \( \mscrX \) becomes a model of \( \varphi \) if and only if it is a model if its \hyperref[def:fol_quantifier_closure]{universal closure}.
757+
758+
\thmitem{def:fol_semantics/satisfaction} Consider some formula \( \varphi \), not necessarily closed. If there exists a structure \( \mscrX \) and a variable assignment \( v \) into \( \mscrX \) such that \( \Bracks{\varphi}_\mscrX^v = \semtop \), we say that \( v \) \term[en=satisfies (\cite[def. 2.1.23(i)]{Hinman2005Logic})]{satisfies} \( \varphi \).
759+
760+
Thus, \( \mscrX \) satisfies \( \varphi \) if and only if \( \mscrX \) is a model of its \hyperref[def:fol_quantifier_closure]{existential closure}. This coincides with validity in the case where \( \varphi \) is closed.
761+
762+
We say that \( \varphi \) is \term[ru=выполнимая (формула) (\cite[def. 2.4.1]{Герасимов2014Вычислимость}), en=satisfiable (formula) (\cite[71]{VanDalen2004LogicAndStructure})]{satisfiable} if at least one interpretation satisfies it.
757763

758764
\thmitem{def:fol_semantics/tautology} We call the closed formula \( \varphi \) a \term[ru=тавтология (\cite[def. 2.4.1]{Герасимов2014Вычислимость}), en=tautology (\cite[97]{Hinman2005Logic})]{tautology} if \( \Bracks{\varphi}_\mscrX = \semtop \) for every interpretation \( \mscrX \), and a \term[ru=противоречивая формула (\cite[def. 2.4.1]{Герасимов2014Вычислимость})]{contradiction} if \( \Bracks{\varphi}_\mscrX < \semtop \) for every \( \mscrX \).
759765

@@ -885,12 +891,19 @@ \section{First-order logic}\label{sec:first_order_logic}
885891
\end{remark}
886892

887893
\begin{definition}\label{def:fol_implicit_universal_quantification}\mimprovised
888-
We can extend the satisfaction relation from \cref{def:fol_semantics/model} for arbitrary \hyperref[def:fol_formula]{first-order formulas} as follows.
894+
We can extend the model relation from \cref{def:fol_semantics/model} for arbitrary \hyperref[def:fol_formula]{first-order formulas} as follows via \hyperref[def:fol_universal_validity]{universal validity}.
889895

890896
In a given \hyperref[def:fol_structure]{structure} \( \mscrX \), let \( \mscrX \vDash \varphi \) if and only if \( \Bracks{\varphi}_\mscrX^v = T \) for every variable assignment \( v \) in \( \mscrX \). Instead of using variable assignments, we can rely on the \hyperref[def:fol_quantifier_closure]{universal closure} of \( \varphi \) by requiring \( \Bracks{\qforall {x_1} \ldots \qforall {x_n} \varphi}_\mscrX = T \). This approach, which we will call \term{implicit universal quantification}, is used in \cite[def. 2.2.1]{Hinman2005Logic} and \cite[94]{Герасимов2014Вычислимость}.
891897

892898
This easily extends to sets of formulas, so we let \( \mscrX \vDash \Gamma \) if and only if \( \mscrX \vDash \psi \) for every \( \psi \) in \( \Gamma \). For the corresponding entailment relation, let \( \Gamma \vDash \varphi \) if and only if \( \mscrX \vDash \varphi \) whenever \( \mscrX \vDash \Gamma \).
893899
\end{definition}
900+
\begin{comments}
901+
\item We must be careful about using implicit universal quantification for two reasons:
902+
\begin{itemize}
903+
\item It is incompatible with \fullref{thm:fol_semantic_deduction_theorem}, as shown in \cref{rem:implicit_quantification_and_deduction}.
904+
\item It can lead to confusion with implicit existential quantification, which is used in \cref{def:fol_semantics/satisfaction} to generalize satisfaction.
905+
\end{itemize}
906+
\end{comments}
894907

895908
\begin{remark}\label{rem:implicit_quantification_and_deduction}
896909
For first-order logic, we have defined the \hyperref[def:institution]{institution} in \cref{def:fol_institution} only for \hyperref[def:closed_fol_formula]{closed first-order formulas}. It is tempting to allow formulas with free variables via \hyperref[def:fol_implicit_universal_quantification]{implicit universal quantification}.

text/heyting_algebras.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ \section{Heyting algebras}\label{sec:heyting_algebras}
100100
\mathllap{\synx \rightarrow \synx} \syneq \mathrlap{\top.}
101101
\end{equation}
102102

103-
\thmitem{def:heyting_algebra/axioms/modus_ponens} The following variation of \ref{inf:thm:axiomatic_derivation_as_natural_deduction/mp}:
103+
\thmitem{def:heyting_algebra/axioms/modus_ponens} The following variation of \ref{inf:def:axiomatic_derivation_as_natural_deduction/mp}:
104104
\begin{equation}\label{eq:def:heyting_algebra/axioms/modus_ponens}
105105
\mathllap{\synx \wedge (\synx \rightarrow \syny)} \syneq \mathrlap{\synx \wedge \syny.}
106106
\end{equation}

text/higher_order_natural_deduction.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ \section{Higher-order natural deduction}\label{sec:higher_order_natural_deductio
364364
\begin{remark}\label{rem:hol_axiomatic_derivations}
365365
We will outline the proof system of Andrews' \( \logic{Q}_0 \) from \incite[\S 51]{Andrews2002Logic} since it is the most refined of the Church-like systems listed in \cref{rem:higher_order_logic_and_type_theory/types}.
366366

367-
It is based on \hyperref[def:propositional_axiomatic_derivation_system]{axiomatic derivation systems}, but instead of \ref{inf:thm:axiomatic_derivation_as_natural_deduction/mp}, it features a peculiar rule:
367+
It is based on \hyperref[def:propositional_axiomatic_derivation_system]{axiomatic derivation systems}, but instead of \ref{inf:def:axiomatic_derivation_as_natural_deduction/mp}, it features a peculiar rule:
368368
\begin{displayquote}
369369
\textit{Rule R}. From \( \mathbf{C} \) and \( \mathbf{A_\alpha} = \mathbf{B_\alpha} \) to infer the result of replacing one occurrence of \( \mathbf{A_\alpha} \) in \( \mathbf{C} \) by an occurrence of \( \mathbf{B_\alpha} \), provided that the occurrence of \( \mathbf{A_\alpha} \) in \( \mathbf{C} \) is not (an occurrence of a variable) immediately preceded by \( \muplambda \).
370370
\end{displayquote}
@@ -552,7 +552,7 @@ \section{Higher-order natural deduction}\label{sec:higher_order_natural_deductio
552552
553553
\hypo{ [\psi \syniff y^{\syn\omicron}]^w }
554554
\hypo{ [\psi]^v }
555-
\infer2[\ref{inf:def:propositional_natural_deduction_systems/iff/elim_left}]{ y^{\syn\omicron} }
555+
\infer2[\ref{inf:def:propositional_natural_deduction_systems/iff/elim_right}]{ y^{\syn\omicron} }
556556
557557
\hypo{ [\psi \syniff y^{\syn\omicron}]^w }
558558
\infer[left label=\( w \)]2[\ref{inf:def:propositional_natural_deduction_systems/iff/intro}]{ y^{\syn\omicron} \syniff (\psi \syniff y^{\syn\omicron}) }

text/mathematical_logic.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ \chapter{Mathematical logic}\label{ch:mathematical_logic}
5656

5757
In such case, it seems reasonable to say that the formula is a \hyperref[con:hypothetical_judgment]{hypothetical judgment} whose hypotheses disambiguate it. This is correct as long as the aforementioned terms are vague, but it is incorrect in the more precise meaning we will consider here.
5858

59-
The reason for this is that the validity of hypothetical judgments is determined via logical consequence. In the sequent notation from \cref{rem:sequent_notation}, \( \varphi \vdash \psi \) expresses that \( \psi \) is a logical consequence of \( \varphi \). Then, as per \ref{inf:thm:axiomatic_derivation_as_natural_deduction/mp}, if \( \varphi \) is considered true, so is \( \psi \).
59+
The reason for this is that the validity of hypothetical judgments is determined via logical consequence. In the sequent notation from \cref{rem:sequent_notation}, \( \varphi \vdash \psi \) expresses that \( \psi \) is a logical consequence of \( \varphi \). Then, as per \ref{inf:def:axiomatic_derivation_as_natural_deduction/mp}, if \( \varphi \) is considered true, so is \( \psi \).
6060

6161
The hypotheses in ambiguous formulas are instead not logical. Such is the case where \( \varphi \) depends on a \hyperref[con:variable_binding]{free variable} \( x \). Disambiguation is then achieved by substituting or binding \( x \), not via logical consequence.
6262
\end{remark}

0 commit comments

Comments
 (0)