Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I interpret the typing rules on this paper?

Those typing rules are present on the "On the expressivity of elementary linear logic: characterizing Ptime and an exponential time hierarchy" paper:

typing rules

From the “What part of Milner-Hindley do you not understand?” Stack Overflow question, I can read some of those in English, but it is still difficult to figure out how to make a type checker out of that. This is my attempt at reading the first 4 rules:

  • Ax: as an axiom, if x has type A, then x has type A. (Isn't that obvious?)

  • Cut: If a context Γ proves t has type A, and another context , extended with the assertion x has type A, proves u has type B, then those two contexts together prove the substitution of all occurrences of x by t in u has type B. (What does that mean, though? Why there are two contexts, where the extra one comes from? Also, that seems like a rule for substitution, but how, if substitution isn't a term, but an operation? The classical Milner-Hindley has nothing like that; it has just a very simple rule for App.)

  • Weak: If a context proves t has type A, then that context extended with the statement x has type B still proves t has type A. (Again, isn't that obvious?)

  • Contr: if a context extended with x1 has type !A and x2 has type !A proves t has type B, then that context, extended with x has type !A proves substituting all occurrences of x1 and x2 by x in t has type B. (Another rule for substitution, it seems? But why there are two terms above, one term below? Also, why those !s? Where would that all show up on the type checker?)

I quite get what those rules want to say, but I am missing something before it truly clicks and I'm able to implement the corresponding type checker. How can I approach understanding those rules?

like image 285
MaiaVictor Avatar asked Oct 14 '16 19:10

MaiaVictor


People also ask

What are the basic typing rules?

Basic typing rules 1 Do not look at the keyboard while practicing. 2 Use the shift button to type capital letters. 3 To press shift key use your small finger. 4 Do not push yourself to type fast, this may reduce the accuracy rate. More ...

How to learn typing properly?

It has 16 exercises and one advanced typing practice application to learn typing properly. If you can complete the course successfully, you will definitely learn to type. Do not look at the keyboard while practicing. Use the shift button to type capital letters. To press shift key use your small finger.

What is the correct way to type a paragraph?

Rule 1: Within a paragraph, just keep typing. When you use a typewriter, you have to use the carriage return at the end of every line. When you use a word processor, such as Word, you just keep typing. Type type type. Word knows where the margins are.

What is the touch typing method?

Almost every professional typist uses the touch typing method to type. It is the fastest typing method, so it is very important to practice and adopt this method. How to type? Placing the right finger over the right key is the main part of touch typing. There are three rows of letters present in a QWERTY keyboard.


1 Answers

This is a bit too broad, but from your comments I guess that you lack some basics of linear type systems. This system has weakening (not usually allowed in linear logic), so it actually corresponds to affine intuitionistic logic.

The key idea is: you can use every value you have (e.g. variables) at most once.

The type A (x) B (tensor product) roughly stands for the type of pair values, from which you can project out both a A value and a B value.

The type A -o B stands for a linear function which consumes a value A (remember: at most one use!) and produces a single B.

You can have e.g. \x.x : A -o A but you can not have any term : A -o (A (x) A) since that would require you to use the argument twice.

The type !A ("of course A!") stands for values of type A which can be duplicated as will -- as you can do normally in non-linear lambda calculi. This is done by the Contraction rule.

For instance, !A -o !B represents a plain function: it requires a value (in an unbounded amount of copies) and produce a value (in an unbounded amount of copies). You can write a function !A -o (!A (x) !A) as follows:

\a. (a (x) a)

Note that every linear typing rule with multiple premises has to split the environment variables between the premises (e.g. one gets Gamma, the other Delta), without overlap. Otherwise, you could duplicate linear variables. Cut has two contexts because of this. The non-linear cut would be:

G |- t: A        G, x:A |- u: B
--------------------------------
  G |- u[t/x]: B

but here both terms t and u can use the variables in G, hence u[t/x] can use variables twice -- not good. Instead, the linear cut

G1 |- t: A        G2, x:A |- u: B
--------------------------------
  G1,G2 |- u[t/x]: B

forces you to split variables between the two premises: what you use in t is unavailable for u.

like image 119
chi Avatar answered Oct 17 '22 03:10

chi