
Higher-order logic and equality; multiple ways to use lambda calculus for logic - burakemir
https://blog.burakemir.ch/2020/04/higher-order-logic-and-equality.html
======
lidHanteyk
In a world where cranks use Curry-Howard to justify their ridiculous beliefs,
it is refreshing to see not just a correct application, but a well-formed and
aesthetically pleasing presentation. Thank you for not trying to obfuscate the
material.

~~~
throwaway_pdp09
> where cranks use Curry-Howard to justify their ridiculous beliefs

I'm not an abstract thinker so that correspondence is not interesting to me
(open to being educated though if it is applicable to my daily work), but to
what ridiculous beliefs do you refer? TIA

~~~
lidHanteyk
Curry-Howard-Lambek distills largely into a big table which relates type
theory, category theory, formal logic, and metamathematics. This table is very
precise, but high-dimensional, so that we can only take small limited slices
of it. Nonetheless, the slices that we take are very formal. The important
parts are well-known and published, say at [0] or [1]; extending beyond this
is possible but requires care and effort. That said, once one groks the nature
of the correspondence, then it becomes painfully obvious, to the point where
folks who don't grok it seem block-headed.

I don't really have a glossary or nosology of how people misuse this, but I'd
say some wrong ideas include:

* If a language has a type system, then it is usable for formal proofs, it is sound, and it is a language that ends the need for other languages.

* Dependently-typed languages have values that are also types, so all values are types, and therefore dependent typing makes no sense.

* Because my language uses higher-order logic instead of first-order logic, Turing's results don't limit my language's problem-solving abilities.

* Because of my religious beliefs, type universes have a certain shape, and thus Cantor's results are incorrect.

* The English language is far more powerful than any programming language.

* All logic is really just intuitionistic logic.

* All logic is really just linear logic.

* Syntactic formalism must be wrong, because abstracta only exist in my mind.

To repeat myself, all of these are _wrong_ , despite some relatively large
tribes of programmers believing them sincerely.

[0]
[https://ncatlab.org/nlab/show/relation+between+type+theory+a...](https://ncatlab.org/nlab/show/relation+between+type+theory+and+category+theory)

[1]
[http://math.ucr.edu/home/baez/rosetta.pdf](http://math.ucr.edu/home/baez/rosetta.pdf)

~~~
cscurmudgeon
Thank you! That list intersects with some of what has been troubling me too.
You should write a blog post or paper expanding on these. Some of these
beliefs are more dangerous than others. Especially:

> * All logic is really just linear logic.

and

> * Because of my religious beliefs, type universes have a certain shape, and
> thus Cantor's results are incorrect.

------
carapace
IMO Paul Tarau has some good stuff in this area, e.g.: "On a uniform
representation of combinators, arithmetic, lambda terms and types", Paul Tarau
[https://dl.acm.org/doi/10.1145/2790449.2790526](https://dl.acm.org/doi/10.1145/2790449.2790526)

Abstract:

> A uniform representation, as binary trees with empty leaves, is given to
> expressions built with Rosser's X-combinator, natural numbers, lambda terms
> and simple types. Type inference, normalization of combinator expressions
> and lambda terms in de Bruijn notation, ranking/unranking algorithms and
> tree-based natural numbers are described as a literate Prolog program.

> With sound unification and compact expression of combinatorial generation
> algorithms, logic programming is shown to conveniently host a declarative
> playground where interesting properties and behaviors emerge from the
> interaction of heterogenous but deeply connected computational objects.

------
p0llard
> Yet, I believe it is fairly common to call this kind of logic intuitionistic
> logic, even though there is no rule for ⊥.

I don't believe this is very common—it's _an_ intuitionist logic, but
"intuitionistic logic" by itself pretty much always includes ex falso—but
actually it's rather strange that this is the case; it's not immediately clear
that ex falso is constructive at all!

Minimal logic is both 'intuitionistic' (since LEM does not hold) and
paraconsistent (since ex falso does not hold). I actually think there's a
fairly solid case to say that only paraconsistent logics can be thought of as
truly constructive; certainly if we start from BHK, it's not at all obvious
that ex falso is a sound principle, and Kolmogorov himself had great issues
accepting this. When he finally managed to convince himself of this in 1932
[1], it seems more that he was trying to finish off the logical framework by
sidestepping the issue.

Kapsner [2] argues that the constructivist can only accept ex falso if she is
willing to accept so called "empty promise constructions" as being
constructive (see the source for more details on what this means, but it seems
to broadly line up with Kolmogorov's justification); I personally don't think
that they are compatible with the way BHK is usually presented at all.

Brouwer isn't around to tell us exactly what _he_ means by constructivism, so
ultimately this is all philosophical, but I think this it's an interesting
area that people don't really think aboutl I think a lot of people are exposed
to intuitionistic logic via Martin-Lof type theories but don't actually
consider how the logic fits into the wider notion of constructivism.

[1] : [https://plato.stanford.edu/entries/intuitionistic-logic-
deve...](https://plato.stanford.edu/entries/intuitionistic-logic-
development/#Kolm1932Heyt1934)

[2] :
[https://www.springer.com/gp/book/9783319052052](https://www.springer.com/gp/book/9783319052052)

------
ibn-python
During undergrad, I was only exposed to logic in my set theory and theory of
computation classes. Any recommendations on good books/textbooks that are good
for a relative beginners exploring set theory and type theory?

~~~
TheAsprngHacker
This is a list of type theory resources: [https://github.com/jozefg/learn-
tt](https://github.com/jozefg/learn-tt)

This is an exposition of Martin-Lof's dependent type theory:
[http://www.cs.nott.ac.uk/~psztxa/mgs-17/notes-
mgs17.pdf](http://www.cs.nott.ac.uk/~psztxa/mgs-17/notes-mgs17.pdf) Section 5
is about Homotopy Type Theory (HoTT), a newer type theory that is still being
developed.

Chapter 1 of the HoTT book introduces Martin-Lof's dependent type theory, then
the rest of the book covers HoTT-specific topics:
[https://homotopytypetheory.org/book/](https://homotopytypetheory.org/book/)

------
alan-crowe
These are ideas are implemented in the theorem prover HOL light
[https://www.cl.cam.ac.uk/~jrh13/hol-
light/](https://www.cl.cam.ac.uk/~jrh13/hol-light/)

I find the discussion in of logic in
[https://sites.math.northwestern.edu/~richter/HolInformalMath...](https://sites.math.northwestern.edu/~richter/HolInformalMath.pdf)
more concrete and more accessible.

------
thekhatribharat
I put a related question on Computer Science Stack Exchange a week ago.
Linking it here in the hopes that HN users roll-calling here will shed some
light.

Ref: [https://cs.stackexchange.com/questions/122066/does-the-
under...](https://cs.stackexchange.com/questions/122066/does-the-underlying-
computational-calculus-in-type-theories-affect-decidability)

------
asplake
Struggling to get past the Minimal Logic section as I don’t recognise the
notation. Any pointers?

~~~
justinpombrio
The term you want to search for is "Natural Deduction". It's what you use if
you study type theory. I don't know any lightweight introductions off the top
of my head.

[https://en.wikipedia.org/wiki/Natural_deduction](https://en.wikipedia.org/wiki/Natural_deduction)

The short version is that

    
    
        A     B
        -------
           C
    

means "If A and B, then C". Any free variables in A, B, C are universally
quantified outside the "if". The reason for writing the rules in this weird
format is that you can combine them in a tree:

    
    
        A     B
        -------
           C       D
           ---------
               E
    

This proves E, given A, B, and D, via the application of two rules.

~~~
dvt
The blog post (and your response) is actually a bit confusing, as we should be
seeing inline rules -- at least that's how I've seen it in just about every
textbook. The "implication" rule you suggest is actually (technically) called
"elimination" (in λ-calculus, we say you _eliminate a variable_ ) and should
be denoted via _→e_ (sometimes the arrow is omitted). As a more practical
example, see proposition (11) in this paper I wrote back in college[1]. There
are two elimination rules, both denoted by an inline _→e_.

[1] [https://dvt.name/logic/horse2.pdf](https://dvt.name/logic/horse2.pdf)

~~~
mkolosick
While naming the different derivation rules can be useful for guiding readers
the names are not formally necessary.

The rules

    
    
      A   B
      -----
        C
    

and

    
    
      A   B
      ----- (→c)
        C
    

are logically equivalent, the latter just gives you a name to refer to the
rule by.

Additionally, I would be careful about correcting others that something is
"technically" called something else as programming language researchers often
use many names for the same concept.

~~~
dvt
> Additionally, I would be careful about correcting others that something is
> "technically" called something else as programming language researchers
> often use many names for the same concept.

My point had nothing to do with programming language research (in fact, my
academic background is logic/metalogic). And by the way, this is _not_ a rule:

    
    
        A   B
        ----- (→c)
          C
    

It's a _derivation_ (also known as a _proof_ ) -- technical terms are
important when doing logic. The rule is →c -- so I know what you're doing by
including the →c there. Why the →c is necessary (and, again, I've seen it in
every lambda calculus/type theory book I've taken a gander at) is because
there are many rules[1] (including _several_ kinds of elimination, so things
can get complicated and it's important to keep our ducks in a row).

[1] [https://www.irif.fr/~mellies/mpri/mpri-
ens/biblio/Selinger-L...](https://www.irif.fr/~mellies/mpri/mpri-
ens/biblio/Selinger-Lambda-Calculus-Notes.pdf)

~~~
mkolosick
Perhaps using abstract names A, B, and C was unclear. The following is the
rule that is commonly referred to as modus ponens:

    
    
      A → B    A
      -----------
           B 
    

However, modus ponens is just one of the names for this. I could also call it
function elimination. I could call it →e. Or I could not bother giving it a
name and just say that this is a rule in my logic call it whatever you want in
your head if you so desire.

Things _can_ get complicated, but they aren't always complicated so naming
rules isn't strictly necessary.

