Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] How to make Coq ``see'' emptyness of inductively defined Props?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] How to make Coq ``see'' emptyness of inductively defined Props?


Chronological Thread 
  • From: Adam Chlipala <adamc AT csail.mit.edu>
  • To: Wolfram Kahl <kahl AT cas.mcmaster.ca>
  • Cc: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] How to make Coq ``see'' emptyness of inductively defined Props?
  • Date: Mon, 23 Jul 2012 10:35:31 -0400

On 07/23/2012 10:26 AM, Wolfram Kahl wrote:
However, I am still puzzled why I wasn't able to define IsSome_extract
starting from the inductive definition:

Inductive IsSome {T : Type} : option T -> Prop :=
| isSome : forall (r : T), IsSome (Some r).

This definition is used throughout in the remainder of this message.
I want to have IsSome_extract, and try:

Definition IsSome_extract : forall {A : Type} {x : option A} (xS : IsSome
x) , A :=
fun {A : Type} {x : option A} (xS : IsSome x) => match x with
| None => match xS return A with
end
| Some a => a
end.

It's a good thing that Coq rejects this definition, since _any_ definition of [IsSome_extract] would be breaking basic rules about what [Prop] means, and could even lead to logical inconsistency! ;)

A type in [Prop] is meant to have no computational content, and yet here you are trying to extract a potentially computational value out of one of these.

Putting the definition in [Type] instead, everything goes through quite naturally. I don't know why you're proceeding by case analysis on [x] instead of [xS], which is much more direct.

(**)
Inductive IsSome {T : Type} : option T -> Type :=
| isSome : forall (r : T), IsSome (Some r).

Definition IsSome_extract {A : Type} {x : option A} (xS : IsSome x) : A :=
let (v) := xS in v.
(**)




Archive powered by MHonArc 2.6.18.

Top of Page