| 1 |
Set Asymmetric Patterns. |
| 2 |
|
| 3 |
Section eq. |
| 4 |
Let A := { X : Type & X }. |
| 5 |
Let B := (fun x : A => projT1 x). |
| 6 |
Let T := (fun (a' : A) (b' : B a') => projT2 a' = b'). |
| 7 |
Let T' := T. |
| 8 |
Let t1T := (fun _ : A => unit). |
| 9 |
Let f1 := (fun x (_ : t1T x) => projT2 x). |
| 10 |
Let t1 := (fun x (y : t1T x) => @eq_refl (projT1 x) (projT2 x)). |
| 11 |
Let t1T' := t1T. |
| 12 |
Let f1' := f1. |
| 13 |
Let t1' := t1. |
| 14 |
|
| 15 |
Theorem eq_matches_commute |
| 16 |
a' b' (t' : T a' b') |
| 17 |
(rta : forall b'', T' a' b'' -> A) |
| 18 |
(rtb : forall b'' t'', B (rta b'' t'')) |
| 19 |
(rt1 : forall y, T _ (rtb (f1' a' y) (@t1' a' y))) |
| 20 |
(R : forall (b : B (rta b' t')), T _ b -> Type) |
| 21 |
(r1 : forall y, R (f1 _ y) (@t1 _ y)) |
| 22 |
: match |
| 23 |
match t' as t0' in (@eq _ _ b0') return T (rta b0' t0') (rtb b0' t0') with |
| 24 |
| eq_refl => rt1 tt |
| 25 |
end |
| 26 |
as t0 in (@eq _ _ b0) |
| 27 |
return R b0 t0 |
| 28 |
with |
| 29 |
| eq_refl => r1 tt |
| 30 |
end |
| 31 |
= |
| 32 |
match t' |
| 33 |
as t0' in (@eq _ _ b0') |
| 34 |
return (forall (R : forall (b : B (rta b0' t0')), T _ b -> Type) |
| 35 |
(r1 : forall y, R (f1 _ y) (@t1 _ y)), |
| 36 |
R _ (match t0' as t0'0 in (@eq _ _ b0'0) return T (rta b0'0 t0'0) (rtb b0'0 t0'0) with |
| 37 |
| eq_refl => rt1 tt |
| 38 |
end)) |
| 39 |
with |
| 40 |
| eq_refl => fun _ r1 => |
| 41 |
match rt1 tt with |
| 42 |
| eq_refl => r1 tt |
| 43 |
end |
| 44 |
end R r1. |
| 45 |
Proof. |
| 46 |
destruct t'; reflexivity. |
| 47 |
Defined. |
| 48 |
|
| 49 |
Theorem eq_match_beta2 |
| 50 |
a b (t : T a b) |
| 51 |
X |
| 52 |
(R : forall b' (t' : T a b'), X b' -> Type) |
| 53 |
(r1 : forall y x, R _ (@t1 _ y) x) |
| 54 |
x |
| 55 |
: match t as t' in (@eq _ _ b') return forall x, R b' t' x with |
| 56 |
| eq_refl => r1 tt |
| 57 |
end (x b) |
| 58 |
= |
| 59 |
match t as t' in (@eq _ _ b') return R b' t' (x b') with |
| 60 |
| eq_refl => r1 tt (x _) |
| 61 |
end. |
| 62 |
Proof. |
| 63 |
destruct t; reflexivity. |
| 64 |
Defined. |
| 65 |
End eq. |
| 66 |
|
| 67 |
Definition typeof {T} (_ : T) := T. |
| 68 |
|
| 69 |
Eval compute in (eq_sym (eq_sym _)). |
| 70 |
Goal forall T (x y : T) (p : x = y), True. |
| 71 |
intros. |
| 72 |
pose proof |
| 73 |
(@eq_matches_commute |
| 74 |
(existT (fun T => T) T x) y p |
| 75 |
(fun b'' _ => existT (fun T => T) T b'') |
| 76 |
(fun _ _ => x) |
| 77 |
(fun _ => eq_refl) |
| 78 |
(fun x' _ => x' = y) |
| 79 |
(fun _ => eq_refl) |
| 80 |
) as H0. |
| 81 |
compute in H0. |
| 82 |
change (fun (x' : T) (_ : y = x') => x' = y) with ((fun y => fun (x' : T) (_ : y = x') => x' = y) y) in H0. |
| 83 |
pose proof (fun k => @eq_trans _ _ _ k H0). |
| 84 |
Abort. |