Quick Intro to MLTT*

Quick Intro to MLTT*

Quick Intro to MLTT* Sergey Goncharov FAU Erlangen-Nürnberg April 28, 2021 * (intensional) Martin-Löf type theory Roadmap 1 A Cherry-Banana Calculus 2 Formal Systems 3 Principles of Type Theory 4 Formal MLTT adapted from the HoTT book 1 47 A Cherry-Banana Calculus A Cherry-Banana Calculus Consider a Cherry-Banana Calculus: X X Y X (i) (ii) (iii) (iv) X XY X Each rule scheme represents an infinite number of rules, obtained by replacing variables X; Y with non-empty finite sequences of and We can build proofs or derivations, like (i) (i) (iv) (ii) (iii) starting from rules without premises, i.e. axioms 2 47 Deriavability We have shown that is derivable But is not derivable: no rule has it as the conclusion The fact that is not derivable is a meta-property of this system, it is provable in a very weak meta-logic But is not derivable either: neither derivation ? ? ? (ii) (iii) can be finished. This requires a stronger meta-logic, supporting induction. For a proof: define the derivation height, and show by induction that it cannot be finite 3 47 Derivable and Admissible Rules A rule (scheme) is derivable, if it can be obtained by X combining existing rules, e.g. , for X (i) X (iv) (ii) X (iii) X A rule (scheme) is admissible if by adding it, one can derive X nothing new. Trivial example X Derivable rules are always admissible, but admissible need not be derivable 4 47 Formal Systems Formal Systems A formal system consists of Finite alphabet of symbols Language over that alphabet, determined by a grammar Inference rules Example: Alphabet: , Language: X ::= j j X j X Inference rules: as above Schematization ensures that an infinite set of rules can be organized in a finite way. More generally, one typically requires the set of rules to be recursive or recursively enumerable 5 47 More Examples λ-calculus: I Language M; N ::= x j λx: M j NM I Rules: η-conversion, β-reduction Operational semantics I Language for judgements M ! N (small-step) or M + v (big-step), requires a sublanguage for terms M; N and values v I Custom set of rules First-order logic (Hilbert style) I Language: first-order formulas φ φ ! I Lots of axioms + two rules: (modus ponens) and φ (generalization) 8x: φ First-order logic (Gentzen style) I Language of sequents φ1; : : : ; φn ` 1; : : : ; m of formulas I Lots of rules + one axiom φ ` φ 6 47 Foundations Formal systems (since Hilbert) are used in foundations of mathematics: inference process captures building new knowledge from old, inferred judgements are theorems Two big questions: I (In-)consistency: Can we derive contradictions: φ and :φ? I (In-)completeness: Can we always derive either φ or :φ? These questions are "meta" (!) – we need another formal system, to deal with them for a given system However, we can also encode the meta-logic in the system itself, provided the system is suciently expressive For systems far behind what is needed for formalizing mathematics (Robinson “induction free” arithmetic) neither consistency not completeness can be established by itself. This is what Gödel incompleteness means 7 47 Foundations: Set Theory Most of mathematicians in the world work in a specially chosen foundation of mathematics – set theory, say ZFC, if you really press them to detail ZFC =Zermelo–Fraenkel set theory + the axiom ofChoice ZFC is manufactured in two stages: I A formal system for first-order logic I A first order theory, i.e. the axioms, sets must satisfy By Gödel, ZFC is incomplete (or inconsistent), i.e. there are formulas that are neither provable not disprovable, e.g. continuum hypothesis, existence of large cardinals, etc By adding them (assuming consistency) one obtains another incomplete system 8 47 Set Theory: Issues There are lots of issues with set theory, type theory aims to fix The language of set theory is unsuitable for direct use: numbers, functions, smooth manifolds must all be encoded as sets. Think of π \ R Logic is decoupled from structures we involve, i.e. we care so much how true statements are derived, but not how complex structures are build from their parts The axioms are arbitrary and do not help to orient proofs towards reaching goals The background logic of sets features debatable principles, preventing computational implementation, hence impinging automation: excluded middle, axiom of choice, impredicativity 9 47 Example: Total Computable Functions Total computable functions are those computable functions (normally partial), which are total But what means total? Totality is a logical property, which must be proven. Proven where? I The theory of computable functions can be developed in natural arithmetic, and then it is the question, which axioms we choose. There exist extremely slowly converging functions (see Goodstein’s theorem), whose totality cannot be proven in Peano arithmetic I Also in set theory, because of incompleteness, there are total computable functions, which are not provably total Logic and computation are thus intimately connected, but that connection is obscured by dumb encodings into set theory and running along dierent paths 10 47 Practical Considerations Set theory is a very theoretical theory – it is done by set theorists, the rest never mind and just do math Theoretically, set theory is relevant to the whole math, though. That is an example of the general situation: Theoretically, there is no dierence between theory and practice. Practically, there is Type theory aims at an inclusive, unifying platform, reconciling various aspects of algebra, logic and computability in one package. This is of direct use for programming, verification, proof automation, but also for abstract math, citing Voevodsky: And I now do my mathematics with a proof assistant. I have a lot of wishes in terms of getting this proof assistant to work better, but at least I don’t have to go home and worry about having made a mistake in my work. I know that if I did something, I did it, and I don’t have to come back to it nor do I have to worry about my arguments being too complicated or about how to convince others that my arguments are correct. I can just trust the computer. There are many people in computer science who are contributing to our program, but most mathematicians still don’t believe that it is a good idea. And I think that is very wrong. 11 47 Principles of Type Theory Types Simply-typed λ-calculus is a good start By adding types to the untyped lambda calculus, we prevent non-termination via (λx: xx)(λx: xx) and enable strong normalization: every λ-term has a unique normal form, regardless of the reduction strategy We need two kinds of rules: term formation rules Γ ` f : A ! B Γ ` t: A Γ; x: A ` t: A Γ ` f t: B Γ ` λx: t: A ! B and reduction rules for αβη-reduction (omited) Types are used for programming to prevent errors, to structure code, avoid boiler plate, etc, etc We need a far more advanced type system than simply typed λ-calculus, even more than most of the advanced programming languages have 12 47 Propositions as Types If we add to the simply-typed λ-calculus the unit type 1, the empty type 0 and binary coproducts, we obtain a beautiful correspondence between propositions and types Proposition Type False 0 True 1 A ^ B A × B A _ B A + B A ! B A ! B It is advisable to spell this out for every raw, for example, for products, we see that to have an inhabitant of A × B, we have to provide an inhabitant both for A and for B A constructive interpretation of logic and types is thus coded in! 13 47 Proofs as Programs A judgement Γ ` t: A (where Γ = (x1 : A1;:::; x1 : A1)) can now be viewed as a proof of A1 ^ ::: ^ An ! A Example: a proof of (A ! B) ! (B _ A) ! B: f : A ! B ` λx: B + A: case x of inl y 7! y; inr z 7! f z: B The derivation rules of propositional logic in the natural deduction (viz. Fitch) style precisely correspond to formation rules of λ-terms Computational interpretation: a proposition is derivable, i we can construct a program, i.e. a proof, which it types Exception is the excluded middle law: φ _ (φ ! False), which fails to have a computational interpretation in this sense (!) 14 47 Induction as Recursion If we add the type of natural numbers N (and other so-called inductive types), we obtain a connection between induction (logic) and structural recursion (programs) zero: 1 ! N and suc: N ! N are constructors Recursion on N (primitive recursion), produces unique ^ f : X × N ! Y for any given fzero : X ! Y and fsuc : X × N ! X, such that ^ ^ ^ f(x; zero) = fzero(x) f(x; suc n) = fsuc(f(x; n); n) A proof “by induction” = constructing a witness by resursion General (non-structural) recursion fix:(X ! X) ! X (like in Haskell) would contradict both I logic: every proposition X is provable with fix(id: X ! X), and I computational interpretation: (fix f) is generally a non-terminating program (infinite proof?) 15 47 Dependent Types Stil, we can extend the type system in many other “safe” ways Consider the type Vec(n) of vectors of length n. Then, the type of all vectors is the dependent sum P Vec(n) (i: N) Function n 7! (0;:::; n − 1) is an inhabitant of the dependent product Q Vec(n) (compare with ! P Vec(n)) (n: N) N (i: N) P and Q extend the propositions as types correspondence: Proposition Type P (9x: X) φ(x) (x : X) φ(x) Q (8x: X) φ(x) (x : X) φ(x) Type theories supporting dependent types are called dependent type theories.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    54 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us