## subtypep.complex.8 ansi test failure

Analysis of the situation (for future reference):

**Specification of subtypep**

Let `x`

be a number type and `y`

be its upgraded complex part type,

`y = (upgraded-complex-part-type x)`

which must satisfy

`x ⊂ y`

`(subtypep '(complex x1) '(complex x2)) => true, true`

if:

`x1`

is a subtype of`x2`

`=> (subtypep '(complex x1) '(complex x2)) = true if x1 ⊂ x2`

or

`(upgraded-complex-part-type 'x1)`

and`(upgraded-complex-part-type 'x2)`

return two different type specifiers that always refer to the same sets of objects; in this case,`(complex x1)`

and`(complex x2)`

both refer to the same specialized representation.

`=> (subtypep '(complex x1) '(complex x2)) = true if y1 = y2`

Putting all of this into a table:

y1 = y2 | y1 ≠ y2 | |
---|---|---|

x1 ⊂ x2 | true | true |

x1 ⊄ x2 | true | false |

**Inconsistency with typep**

`typep`

is not consistent with `subtypep`

for complex number types:

`(typep object '(complex type-specifier))`

returns true for all complex numbers that can result from giving numbers of type`type-specifier`

to the function`complex`

, plus all other complex numbers of the same specialized representation.

`=> (typep z '(complex x)) = true if (realpart z) ∈ y and (imagpart z) ∈ y`

Both the real and the imaginary parts of any such complex number must satisfy

`(typep realpart 'type-specifier)`

and`(typep imagpart 'type-specifier)`

`=> (typep z '(complex x)) = true if (realpart z) ∈ x and (imagpart z) ∈ x`

But `x ⊂ y`

, thus the first requirement is redundant:

z ∈ (complex y) | z ∉ (complex y) | |
---|---|---|

z ∈ (complex x) | true | never happens |

z ∉ (complex x) | false | false |

Not only that, this is also inconsistent with `subtypep`

since for a `z`

with `z ∉ (complex x)`

but `z ∈ (complex y)`

`(typep z '(complex x))`

will return false but `(subtypep '(complex (eql z)) '(complex x))`

returns true, for example:

```
> (typep #C(1 1) '(complex (eql 0)))
NIL
> (subtypep '(complex (eql 1)) '(complex (eql 0)))
T
T
```