I’m a fairly new user of Coq. I came up with an inductive definition FiniteSet : nat -> Set
, for which FiniteSet n
is intended to have exactly n
elements:
Inductive FiniteSet : nat -> Set :=
(* Taking the successor means we introduce a new element. *)
| Fin_n (n : nat) : FiniteSet (S n)
(* We may lift the elements from the previous set into the next. *)
| Fin_s {n : nat} (F : FiniteSet n) : FiniteSet (S n).
I wanted to try and prove that Fin_n 0
is the unique element of FiniteSet 1
as so:
Remark finite_one_unique : forall a : FiniteSet 1, a = Fin_n 0.
Proof. intro a. destruct a. (* I thought I could continue from here... *)
But this doesn’t work; Coq complains [some lines omitted]:
Abstracting over the terms "n" and "a" leads to a term
fun (n0 : nat) (a0 : FiniteSet n0) => a0 = Fin_n 0
which is ill-typed.
Reason is: Illegal application:
The term "@eq" of type "forall A : Type, A -> A -> Prop"
I don’t know how to perform case analysis on this object. I’ve also tried using inversion
but to no avail.
There’s clearly some issue with how I parameterize this type via n
, but I simply don’t know how I can fix it so that I can perform this analysis. Any help would be appreciated!