This statement seems to be wrong given the subtyping system in the SF chapter. However, in some intersection type systems, this holds for the Top (aka. ω) type.
This is not contradictory. This is called type equivalence or bi-directional subtyping. Example: {name:String, age:Nat} and {age:Nat, name:String}. If A <: B and B <: A, this means that everywhere where A is required we can use B, and vice versa.
yes, they have Top for this system they define:
this is how they define Top : a type that lies above every other type and is inhabited by all (well-typed) values. Is it the Top you describe?
so it would be :
Top <: Top -> Top
is it true? with their Top?
As for statements I marked as contradictory… they should be true, They both should be true (my AND is extremely confusing, sorry for it). So if they both true, then initial statement is true (one we are trying to solve).
Your example for type equivalence… they call it Record Permutation, and it’s about records, not about arrow type. And we have arrow type here. right? so we should use arrow type rule, right?
so conditions which above the line in arrow type rule, they both should be true. That is why I wrote AND, but they can’t be true for arrow type, right?
so is it correct they we have a contradiction, so initial statement is false?
No, this does not hold in this system. You could try to formally prove (in Coq) that this doesn’t hold.
Here’s the idea:
Prove that if U <: S -> T, then there exists U1, U2, such that U = U1 -> U2, S <: U1 and U2 <: T.
From this follow: forall S, not S <: S -> S.
The proof script for (1) would begin with:
intros U S T. intros H.
remember (S -> T) as ST. (* This replaces `S->T` with the fresh variable `ST` and introduces an equation `eqnST: ST = S -> T` *)
induction H; inversion H; clear H.
...
Oh, oh you are so right… I see now. They even have this theorem in the chapter below… just the one you suggested. 3 stars… Thank you. Will try to prove it.