| 1 |
Set Implicit Arguments. |
| 2 |
|
| 3 |
Require Import Logic. |
| 4 |
|
| 5 |
Set Asymmetric Patterns. |
| 6 |
Set Nonrecursive Elimination Schemes. |
| 7 |
Set Primitive Projections. |
| 8 |
|
| 9 |
Record prod (A B : Type) : Type := |
| 10 |
pair { fst : A; snd : B }. |
| 11 |
|
| 12 |
Print prod_rect. |
| 13 |
(** prod_rect = |
| 14 |
fun (A B : Type) (P : prod A B -> Type) |
| 15 |
(f : forall (fst : A) (snd : B), P {| fst := fst; snd := snd |}) |
| 16 |
(p : prod A B) => |
| 17 |
match p as p0 return (P p0) with |
| 18 |
| {| fst := x; snd := x0 |} => f x x0 |
| 19 |
end |
| 20 |
: forall (A B : Type) (P : prod A B -> Type), |
| 21 |
(forall (fst : A) (snd : B), P {| fst := fst; snd := snd |}) -> |
| 22 |
forall p : prod A B, P p |
| 23 |
|
| 24 |
Arguments A, B are implicit |
| 25 |
Argument scopes are [type_scope type_scope _ _ _] |
| 26 |
*) |
| 27 |
|
| 28 |
(* What I really want: *) |
| 29 |
Definition prod_rect' A B (P : prod A B -> Type) (u : forall (fst : A) (snd : B), P (pair fst snd)) |
| 30 |
(p : prod A B) : P p |
| 31 |
:= u (fst p) (snd p). |
| 32 |
|
| 33 |
Notation typeof x := (ltac:(let T := type of x in exact T)) (only parsing). |
| 34 |
|
| 35 |
(* Check for eta *) |
| 36 |
Check eq_refl : typeof (@prod_rect) = typeof (@prod_rect'). |
| 37 |
|
| 38 |
(* Check for the recursion principle I want *) |
| 39 |
Check eq_refl : @prod_rect = @prod_rect'. |