Start of topic | Skip to actions

Concoqtion Bugs

Joseph: Coq blocks need to be split in an unjustified way (Joseph will add this to the bugs page).

Joseph: If you overuse variable names in Concoqtion and MetaOCaml?, sometimes they are not shadowed correctly

Emir: Might be a bug. Must be checked.

Context Refinement and "as"

Match statement without as is more expressive than match statement with as. Match statement don't work normally on tuples when you have as. This is not a bug. That's what match is supposed to be doing. Here is why:

All the context refinement does is that it allows you to have non linear patterns. With the as context refinement don't work.

let rec eval .|e,t| (exp:('(e),'(t)) tterm) (env: '(evalEnv e)): '(evalTyp t) =
  match exp as ((e1,t1) tterm) in (envTyp t1) with
  |VarZ .... -> fst env

For example in the above code Concoqtion can't resolve that env is a pair and therefore fst doesn't work.

When the as is here, we have that VarZ is of type ((e1,t1) tterm) and therefore is matched with ((Pair(e2,t1),t2) tterm). But all you know about env is that is evalEnv e not evalEnv e1. If you knew that, you would be able to take its first since e1 is now known to be Pair(e2,t1).

When we don't have the as, context refinement work allowing us to detect that e1 is the same as e and therefore we can take its first.

Maybe we will be able to have a Concoqtion version that can do the same things that we can do with context refinement when we have the as. This will be possible if the user is allowed to refer in the as statement to variables that are defined outside the match.

The reason we were not able to do delete is because context refinement is broken because it don't support nested patterns. The problem we were talking about now is different because we can't express in the language things that be inferred using context refinement.

Q: Do we currently have 1 level context refinement?

A: There is only one level context refinement but currently incomplete since it doesn't yet support nested patterns.

Type Checker

Angela: Two questions about type checker from the Index Now paper.

type '(env) some_exp = 
| SE of let 't:'(typ) in '(t) r_typ * ('env,'(t)) expr.

Q: Why do we need to the return both these values? Do we really need '(t) r_typ?

A: Yes this looks like an extra piece of information but it is be needed at run-time.

Type checking: (e1 e2)

let res1 = tc e1 in 
let res2 = tc e2 in
Q: Why do we need the cast?

A: Because we must make sure that res1 has type a -> b and res2 has type a. So we need casting to make the comparisons of the types that are hidden within the existensials.

Next lecture we will talk about cast.

-- CherifAndraos - 17 Mar 2007


End of topic
Skip to actions | Back to top
Creative Commons LicenseThis work is licensed under a Creative Commons Attribution 2.5 License. Please follow our citation guidelines.