Skip to content

Equations does not handle implicit constructor coercions in patterns #647

@tperami

Description

@tperami

The regular match pattern elaborator is able to insert constructor coercions in a match pattern when the type of the pattern and the discriminee are known. For example:

Inductive new_bool := old_bool (b : bool).
Coercion old_bool : bool >-> new_bool.

Definition proj_new_bool (nb : new_bool) : bool :=
  match nb with
  | true => true (* Elaborated to | old_bool true => true *)
  | false => false (* Elaborated to | old_bool false => false *)
  end.

However, Equations is not able to do that:

Fail Equations proj_new_bool_fail : new_bool -> bool :=
| true => true;
| false => false.

Equations proj_new_bool_annoying : new_bool -> bool :=
| old_bool true => true;
| old_bool false => false.

How hard would that be to fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions