Move unit tests for `overlap` to their own file

Signed-off-by: Ambrose Bonnaire-Sergeant <abonnairesergeant@gmail.com>
Extract nth helper functions for filters

The comments became redundant between the implementation and function
names.

Signed-off-by: Ambrose Bonnaire-Sergeant <abonnairesergeant@gmail.com>
Extract nth helper functions for return type and filters

Signed-off-by: Ambrose Bonnaire-Sergeant <abonnairesergeant@gmail.com>
Make nth helper function's variable names more verbose

Signed-off-by: Ambrose Bonnaire-Sergeant <abonnairesergeant@gmail.com>
Get nth's index once at the top

Signed-off-by: Ambrose Bonnaire-Sergeant <abonnairesergeant@gmail.com>
Helpers for converting expressions to objects/types

Signed-off-by: Ambrose Bonnaire-Sergeant <abonnairesergeant@gmail.com>
`first` now uses a path expression

This allows code like `(= :foo (first x))` to refine the type of `x`.

Signed-off-by: Ambrose Bonnaire-Sergeant <abonnairesergeant@gmail.com>
Rename FirstPE to NthPE

Since it no longer can be assumed to operate on the first item, we
also add an index identifying the item. This index is not used yet.

Signed-off-by: Ambrose Bonnaire-Sergeant <abonnairesergeant@gmail.com>
`second` now uses a path expression

This allows code like `(= :foo (second x))` to refine the type of `x`.

Signed-off-by: Ambrose Bonnaire-Sergeant <abonnairesergeant@gmail.com>
`nth` now uses a path expression

This allows code like `(= :foo (nth x 5))` to refine the type of `x`.

Signed-off-by: Ambrose Bonnaire-Sergeant <abonnairesergeant@gmail.com>
Correct `update`s calls to `restrict`; the existing type should be first, the restricting type second

Signed-off-by: Ambrose Bonnaire-Sergeant <abonnairesergeant@gmail.com>
Index needs to be a nat to enter special nth case.
Rename test.type-ctors-test to test.overlap
Scope types in overlap tests
Make HSequential overlap case more accurate.

Handles complex cases like (overlap '[Num Int] '[Int Num]) => false
Comment out randomly failing tests. See CTYP-150