| 1 |
Require Import TestSuite.admit. |
| 2 |
(* -*- mode: coq; coq-prog-args: ("-indices-matter") -*- *) |
| 3 |
Set Universe Polymorphism. |
| 4 |
|
| 5 |
Inductive Empty : Prop := . |
| 6 |
|
| 7 |
Inductive paths {A : Type} (a : A) : A -> Type := |
| 8 |
idpath : paths a a. |
| 9 |
|
| 10 |
Notation "x = y :> A" := (@paths A x y) : type_scope. |
| 11 |
Notation "x = y" := (x = y :>_) : type_scope. |
| 12 |
Arguments idpath {A a} , [A] a. |
| 13 |
|
| 14 |
Definition idmap {A : Type} : A -> A := fun x => x. |
| 15 |
|
| 16 |
Definition path_sum {A B : Type} (z z' : A + B) |
| 17 |
(pq : match z, z' with |
| 18 |
| inl z0, inl z'0 => z0 = z'0 |
| 19 |
| inr z0, inr z'0 => z0 = z'0 |
| 20 |
| _, _ => Empty |
| 21 |
end) |
| 22 |
: z = z'. |
| 23 |
|
| 24 |
admit. |
| 25 |
Defined. |
| 26 |
Definition ap {A B:Type} (f:A -> B) {x y:A} (p:x = y) : f x = f y |
| 27 |
:= match p with idpath => idpath end. |
| 28 |
|
| 29 |
Theorem ex2_8 {A B A' B' : Type} (g : A -> A') (h : B -> B') (x y : A + B) |
| 30 |
|
| 31 |
(pq : match (x, y) with (inl x', inl y') => x' = y' | (inr x', inr y') => x' = y' | _ => Empty end) : |
| 32 |
let f z := match z with inl z' => inl (g z') | inr z' => inr (h z') end in |
| 33 |
ap f (path_sum x y pq) = path_sum (f x) (f y) |
| 34 |
((match x as x return match (x, y) with |
| 35 |
(inl x', inl y') => x' = y' |
| 36 |
| (inr x', inr y') => x' = y' |
| 37 |
| _ => Empty |
| 38 |
end -> match (f x, f y) with |
| 39 |
| (inl x', inl y') => x' = y' |
| 40 |
| (inr x', inr y') => x' = y' |
| 41 |
| _ => Empty end with |
| 42 |
| inl x' => match y with |
| 43 |
| inl y' => ap g |
| 44 |
| inr y' => idmap |
| 45 |
end |
| 46 |
| inr x' => match y with |
| 47 |
| inl y' => idmap |
| 48 |
| inr y' => ap h |
| 49 |
end |
| 50 |
end) pq). |
| 51 |
|
| 52 |
Admitted. |
| 53 |
(* Toplevel input, characters 20-29: |
| 54 |
Error: Matching on term "f y" of type "A' + B'" expects 2 branches. *) |