| 1 |
(* An example showing that prop-extensionality is incompatible with |
| 2 |
powerful extensions of the guard condition. |
| 3 |
Unlike the example in guard2, it is not exploiting the fact that |
| 4 |
the elimination of False always produces a subterm. |
| 5 |
|
| 6 |
Example due to Cristobal Camarero on Coq-Club. |
| 7 |
Adapted to nested types by Bruno Barras. |
| 8 |
*) |
| 9 |
|
| 10 |
Axiom prop_ext: forall P Q, (P<->Q)->P=Q. |
| 11 |
|
| 12 |
Module Unboxed. |
| 13 |
|
| 14 |
Inductive True2:Prop:= I2: (False->True2)->True2. |
| 15 |
|
| 16 |
Theorem Heq: (False->True2)=True2. |
| 17 |
Proof. |
| 18 |
apply prop_ext. split. |
| 19 |
- intros. constructor. exact H. |
| 20 |
- intros. exact H. |
| 21 |
Qed. |
| 22 |
|
| 23 |
Fail Fixpoint con (x:True2) :False := |
| 24 |
match x with |
| 25 |
I2 f => con (match Heq in _=T return T with eq_refl => f end) |
| 26 |
end. |
| 27 |
|
| 28 |
End Unboxed. |
| 29 |
|
| 30 |
(* This boxed example shows that it is not enough to just require |
| 31 |
that the return type of the match on Heq is an inductive type |
| 32 |
*) |
| 33 |
Module Boxed. |
| 34 |
|
| 35 |
Inductive box (T:Type) := Box (_:T). |
| 36 |
Definition unbox {T} (b:box T) : T := let (x) := b in x. |
| 37 |
|
| 38 |
Inductive True2:Prop:= I2: box(False->True2)->True2. |
| 39 |
|
| 40 |
Definition Heq: (False->True2) <-> True2 := |
| 41 |
conj (fun f => I2 (Box _ f)) (fun x _ => x). |
| 42 |
|
| 43 |
Fail Fixpoint con (x:True2) :False := |
| 44 |
match x with |
| 45 |
I2 f => con (unbox(match prop_ext _ _ Heq in _=T return box T with eq_refl => f end)) |
| 46 |
end. |
| 47 |
|
| 48 |
End Boxed. |