I've managed to prove that equality within a type is indeed decidable.
Require Import Coq.Logic.Decidable.
Inductive Person : Set :=
alice
|bob
|charlie.
Print Person_rec.
Inductive Role : Set :=
truth_teller
|spy
|liar.
Definition eq_def (S:Set) :Prop := forall p0 p1:S, decidable (p0 = p1).
Lemma person_eq_def : eq_def Person.
Proof.
unfold eq_def.
intros.
unfold decidable.
destruct p0; destruct p1;
auto || (right; discriminate).
Qed.
Lemma role_eq_def : eq_def Role.
Proof.
unfold eq_def.
intros.
unfold decidable.
destruct p0; destruct p1;
auto || (right; discriminate).
Qed.
What disturbs me a bit is two aspects.
The demonstrations for
person_eq_def
androle_eq_def
are the same. There must be a way to prevent this type of repetition, but I failed to find it.Is there an advanced tactic that I missed to prove these?