abella-prover / abella

An interactive theorem prover based on lambda-tree syntax
https://abella-prover.org/
GNU General Public License v3.0
89 stars 18 forks source link

Constants allowed in types inside type constructors #128

Closed RandomActsOfGrammar closed 4 years ago

RandomActsOfGrammar commented 4 years ago

One is able to use a constant in the type of a constant or a type in a definition instead of a type constructor, as in the following code:

Kind pair   type -> type -> type.
Type pair_c   A -> B -> pair A B.

Kind foo   type -> type.
Type foo1   list (pair_c A A) -> foo A.
Type foo2   list (pair A A) -> foo A.

Define bar : list (pair_c A A) -> prop by
  bar L.

The constant foo1 is defined to have arguments of type list (pair_c A A), where pair_c is a constant, not a type constructor. The constant foo2 is the version which is intended. The same happens with the definition of bar.

This only appears to happen when the constant is nested inside a type constructor. For example, the definition

Type foo3   pair_c A A -> foo A.

fails with the error

Error: Unknown type constructor: pair_c

The definition

Define baz : list (pair_c A A) -> prop by
  baz (P::Tl).

also fails, apparently since the variable P would have the non-type type pair_c A A.