Apa arti dari operator pintu putar terkemuka?

12

Saya tahu bahwa penulis yang berbeda menggunakan notasi yang berbeda untuk mewakili semantik bahasa pemrograman. Sebenarnya Guy Steele mengatasi masalah ini dalam video yang menarik .

Saya ingin tahu apakah ada yang tahu apakah operator pintu putar terkemuka memiliki makna yang dikenal baik. Misalnya saya tidak mengerti operator terkemuka di awal penyebut sebagai berikut:

x:T1t2:T2λx:T1.t2 : T1T2

Bisakah seseorang membantu saya mengerti? Terima kasih.

Jim Newton
sumber
Terkait
leftaroundabout
Wow, pertanyaan ini memiliki lebih dari pandangan "1k", yang lebih dari jumlah pandangan dari semua 29 pertanyaan baru! Seperti yang telah saya periksa, baik tag "type-theory" maupun tag "denotational-semantics" adalah di antara 50 tag populer pertama. Saya ingin tahu tentang penyebab di balik fenomena ini. Saya tidak punya petunjuk. @DW? Apakah saya memiliki pertanyaan meta?
John L.
Jika saya tidak salah, Anda harus memindahkan operator pintu putar ( ), di akhir aturan, antara dan . Saya juga akan menambahkan tagλx:T1t2type-checking
mchar
3
@ Apass.Jack Itu berakhir di Pertanyaan Jaringan Panas sehingga mendapatkan lebih banyak perhatian karena itu.
JAB

Jawaban:

20

Di sebelah kiri pintu putar, Anda dapat menemukan konteks lokal, daftar asumsi terbatas pada jenis variabel yang ada.

x1:T1,,xn:Tne:T

Di atas, bisa menjadi nol, sehingga . Ini berarti tidak ada asumsi pada variabel yang dibuat. Biasanya, ini berarti bahwa adalah istilah tertutup (tanpa variabel bebas) yang memiliki tipe .ne:TeT

Seringkali, aturan yang Anda sebutkan ditulis dalam bentuk yang lebih umum, di mana mungkin ada lebih banyak hipotesis daripada yang disebutkan dalam pertanyaan.

Γ,x:T1t:T2Γ(λx:T1.t):T1T2

Here, Γ represents any context, and Γ,x:T1 represents its extension obtained by appending the additional hypothesis x:T1 to the list Γ. It is common to require that x did not appear in Γ, so that the extension does not "conflict" with a previous assumption.

chi
sumber
7

As a complement to the other answers, note that there are three levels of "implication" in typing derivations. And the same remark holds with logical derivations since there is actually a correspondence between the two (called the Curry-Howard's correspondance).

The first implication is the arrow that appears in formulas, and it corresponds to logical implication in a formula (or a function type for the λ-calculus).

The second implication is materialized by the turnstile symbol, and means "assuming every formula on the left, the formula on the right holds". In particular, the rule you give tells how one should prove an implication: to prove AB, then one must prove B under the assumption that A holds. In terms of the λ-calculus, to prove that λx.t has type AB, one must show that t has type B, assuming that x is a variable of type A (see the correspondence?).

The third level of implication is materialized by the horizontal bar, and means "if every premise (elements at the top) holds, then the conclusion (the element at the bottom) holds". You can link that to the interpretation of the typing rule for λ-abstraction that you gave (see the explanation in the previous paragraph).

Rodolphe Lepigre
sumber
3

In type checking systems, the () represents the ternary relation over type environments, expressions and types: Env×Exp×Typ.

In your example, the expression t2 is typed at type T2 wrt. to a type environment having a type assumption mapping T1 to some type variable x

In this context, a type environment is a partial function that assigns types to variables, usually denoted with Γ where ΓEnv:VarTyp

Note that, the operator reserves its functionality regardless of where it appears, either in the premise or the conclusion of the rule.

mchar
sumber
-1

In every situation that I've seen, XY means that there is a proof of Y assuming that X holds. If X is empty, that means that Y is a tautology: it has a proof without needing any assumptions.

David Richerby
sumber
1
but if what you say is true, this is strange because that's also what the horizontal bar means, right? That if the top is true, then the bottom is true. Thus in effect, the XY would mean if the X is true then Y is unconditionally true.
Jim Newton
1
The horizontal bar means that the thing on the bottom is an immediate deduction from the thing on the top. Though I agree that it looks very strange in your example that an unconditional truth is derived from a conditional one...
David Richerby
Type theory is not logic. It is of course related in many ways and (to some extent intentionally) uses similar notation, but there is certainly no a priori connection to the provability relation, and often no a posteriori connection either (at least not to a remotely reasonable logic). As written the answer is, at best, misleading because it suggests that "x:T1" is a formula which it virtually never is in type theory, e.g. a language containing formulas like (x:T1)(y:T2) is generally not described and is often impossible in a standard meta-logic, e.g. for the linear lambda calculus.
Derek Elkins left SE
@DerekElkins It's a proof system and proof systems are logics. x:T is precisely a proposition, and Γx:T is nothing but the statement that the proposition holds when Γ holds. The fact that disjunctions of propositions aren't formulas is simply a restriction of the logic's syntax.
David Richerby
It's not just disjunction. None of ¬(x:A), (x:A)(y:B), or (x:A)(y:B) are formulas either. Or are you saying it's a logic that only has atomic propositions? I mentioned linear logic as an example. In ordered linear logic, it can very easily be the case that x:A,y:Bt:C holds while y:B,x:At:C does not. What connectives do the comma and correspond to that take the "truth values" of x:A, y:B, and t:C and produce the above behavior? There's an option if the meta-logic is also an ordered linear logic, but then we aren't explaining anything.
Derek Elkins left SE