proofpeer / proofpeer-proofscript

The language of ProofPeer: ProofScript
MIT License
8 stars 0 forks source link

Examine interplay between type inference and term quotations. #12

Closed phlegmaticprogrammer closed 10 years ago

phlegmaticprogrammer commented 10 years ago

If a term literal contains a quoted term, then it seems that the type of that term should be used during type inference for the term literal. Is this the case already? If not, find out if it is feasible to implement this behaviour and implement it if it is.

phlegmaticprogrammer commented 10 years ago

As a motivation for why this behaviour seems desirable: Imagine you have for example a pattern match

match t
  case '∀ x. ‹u› x x' =>
    let 'x = 3'
    theorem '‹u› x x' 
      apply(t, 'x')

Then in the second appearance of '‹u› x x' the type inference needs to take the known type of u into account, otherwise the type inference might not yield the intended type. Note that "theorem" is not part of ProofScript yet, but it should be added.

phlegmaticprogrammer commented 10 years ago

As for properties of pattern matching, what you would also want is the following:

match t
  case term-literal =>
    theorem ' ‹term-literal› = ‹term-literal› ' 
      reflexive t

If the case branch matches, then it should yield a valid theorem.

phlegmaticprogrammer commented 10 years ago

That seems to all work out fine.