Documentation

Lean.Compiler.LCNF.WithPtrEq

Type check for withPtrEq #

withPtrEq a b k h is logically equal to k (), but the compiler implements it by withPtrEqUnsafe, which returns true without calling k if a and b are pointer-equal. This is only correct if pointer equality implies equality for values of the type of a and b.

The compiler erases proofs as well as values whose type is a sort or a type former. Erasing proofs is harmless because of proof irrelevance, but two values that differ only in an erased type may be represented by the same object at runtime. checkWithPtrEqType therefore checks conservatively that values of the given type cannot contain types or type formers:

Checks that pointer equality implies equality for values of type, which is required for compiling withPtrEq at type, and throws an error otherwise. See the module docstring for details.

Equations
Instances For