2

More specially, given arbitrary Lean proof/theorem, is it possible to express it solely using first-order logic? If so, is it practical, i.e. the generated FOL will not be enormously large?

I have seen https://www.cl.cam.ac.uk/~lp15/papers/Automation/translations.pdf, but since I am not an expert, I am still not sure whether all Lean's proof code can be converted.

Other mathematical proof languages are also OK.

ch271828n
  • 15,854
  • 5
  • 53
  • 88

1 Answers1

3

The short answer is: yes, it is not impractically large and this is done in particular when translating proofs to SMT solvers for sledgehammer-like tools. There is a fair amount of blowup, but it is a linear factor on the order of 2-5. You probably lose more from not having specific support for all the built in rules, and in the case of DTT, writing down all the defeq proofs which are normally implicit.

Mario Carneiro
  • 1,548
  • 1
  • 18
  • 32
  • 3
    Hmm that would seem weird, given that FOL is refutation complete and HOL is undecidable. So HOL must be able to express more things than FOL. – Mathias Fleury Nov 20 '22 at 14:59
  • Thank you! Is there any doc/material I can learn a bit more? – ch271828n Nov 20 '22 at 23:40
  • @MathiasFleury Totally agree, so a bit confused now – ch271828n Nov 20 '22 at 23:40
  • 2
    Ah I think I get it, but I might be wrong (not a theoretician). The issue is that once you have found a proof, the translation can be done, but finding a proof is harder. Image `\exists f. map f (a::'a list) = a` (and that you cannot express in FOL). Finding the function is hard, but once you have found it, then writing down the properties about in FOL should work. – Mathias Fleury Nov 21 '22 at 08:51
  • 4
    @MathiasFleury I have two counterpoints to bring up to your observation. (1) Refutation completeness is about the relation between the syntax and semantics, so it's not immediately relevant. FOL is also undecidable. If you use a different semantics for the same syntax (which is what this embedding amounts to), then you can get different completeness results. (2) Does that result still hold if you add axioms to the FOL theory? You can clearly embed HOL in ZFC and ZFC is a first order theory. (Substitute NBG if you don't like that ZFC is not finitely axiomatizable.) – Mario Carneiro Nov 21 '22 at 20:48
  • 1
    Very interesting topic and discussion. – Javier Díaz Nov 21 '22 at 23:16
  • 1
    @MarioCarneiro I trust you here (even though I still fail to se how `\exists f. map f (a::'a list) = a` can be converted to FOL). – Mathias Fleury Nov 22 '22 at 08:52
  • @MathiasFleury The translation would be `\exists f \in A -> B, map(A, B, f, a) = a` (you can elide some of the arguments to `map` if you get clever with encodings). Here `A`, `B`, `f` and `a` are all first order variables (either in set theory or in a cut down version sufficient to encode HOL types and terms). The hard part is encoding lambda; you can either extend the definition of FOL a bit to allow for binding syntaxes, or you can do "lambda lifting", i.e. rewrite formulas using lambdas to only have them in the form `(\lam x, e) = f` and then replace this with `\forall x, e = app(f, x)`. – Mario Carneiro Nov 22 '22 at 20:35
  • (You can also use S/K/I combinators to encode lambda, but I'm really not a fan of this, it makes the expressions quite unreadable and I think it's not that great for SMT solvers either.) – Mario Carneiro Nov 22 '22 at 20:44