Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Understanding Subtyping in Programming Language Theory: A Step-by-Step Proof
Prashant Basnet
Nov 13, 2024
116 views
this lecture is from CSCE-550, Nov 12, 2024.
Why understand the lecture on Programming language theory (Subtyping) is important to study ?
Today's lecture highlighted the significance of programming language theory, particularly in the context of type systems. This theory is crucial for:
First thing first let's note:
Subtyping Rules:
Proving Subtyping Relationships:
So we pick a middle ground - T2:
let me explain T2 with a simpler analogy!
Think of it like proving a friend can get from New York to Los Angeles:
Chicago is like our T2 - it's a stepping stone or midpoint that makes the proof easier.
In our type problem:
T2 is just a midpoint type we invented to make the proof easier. Instead of making one big jump (proving Start can be used as End directly), we prove:
We don't drop both at once! That's the whole point of having T2 - it lets us drop one thing at a time, making each step simpler to prove. It's like:
This is our end goal!
where T2 = {y:Nat, x:{a:Nat}}, This shows we can drop the b field.
After dropping b, we have T2 = {y:Nat, x:{a:Nat}} and we want to get to {x:{a:Nat}}
But we don't just drop y directly.
let's hold on R3 at the moment, we will come back to R3 after R4 & R5
Now with THIS RESULT, R1 & R2 we do R4:
This just says we can reorder fields:
Applying S-Width rule (R4):
The S-Width rule says we can drop fields from a record type, but in many type systems, we want this to be predictable and mechanical. So the convention is that we can drop fields from the end or right side of the record.
that's why we needed step R4 (permutation) first:
It's like:
Conclusion
Thus, using valid subtyping rules, we have shown that
This is proven by:
This proves our original sub typing relationship is valid!
Each step used only our allowed rules (S-Width, S-Perm, S-Depth, etc.) to get from start to finish.
This demonstrates how we can derive valid conclusions through a series of logical steps.