Skip to content

Dependent type inference for branches #2693

Answered by aseemr
gancherj asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @gancherj, you are right, there are two subtyping constraints as you have written.

When typechecking the match term here, F* creates a fresh unification variable b |- ?u:Type for the type of the match. The gamma for the unification variable ?u is just b, i.e. b is the only free variable that may occur in the solution of ?u.

For the then branch, F* creates a subtyping constraint a:nat{a == x + 1} <: ?u, and similarly a:nat{a == z + 1} <: ?u for the else branch. Since these are rigid-flex subtyping constraints, F* defers solving them until it has typechecked the whole term, this is so that it can collect other constraints on say ?u; in this case though these are the only two.

F* then col…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gancherj
Comment options

Answer selected by gancherj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants