coq icon indicating copy to clipboard operation
coq copied to clipboard

[Set Record Elimination Schemes] should take advantage of judgmental eta (polyproj)

Open JasonGross opened this issue 11 years ago • 0 comments

The eliminators for records with eta should just be defined as function application or the identity function, not using pattern matching:

Set Implicit Arguments.

Require Import Logic.

Global Set Universe Polymorphism.
Global Set Asymmetric Patterns.
Local Set Record Elimination Schemes.
Local Set Primitive Projections.

Record prod (A B : Type) : Type :=
  pair { fst : A; snd : B }.

Print prod_rect.
(** prod_rect =
fun (A B : Type) (P : prod A B -> Type)
  (f : forall (fst : A) (snd : B), P {| fst := fst; snd := snd |})
  (p : prod A B) =>
match p as p0 return (P p0) with
| {| fst := x; snd := x0 |} => f x x0
end
     : forall (A B : Type) (P : prod A B -> Type),
       (forall (fst : A) (snd : B), P {| fst := fst; snd := snd |}) ->
       forall p : prod A B, P p

Arguments A, B are implicit
Argument scopes are [type_scope type_scope _ _ _]
 *)

(* What I really want: *)
Definition prod_rect' A B (P : prod A B -> Type) (u : forall (fst : A) (snd : B), P (pair fst snd))
           (p : prod A B) : P p
  := u (fst p) (snd p).

JasonGross avatar Feb 05 '14 22:02 JasonGross