Module MyEquality.
Inductive eq {X:Type} : X -> X -> Prop :=
| eq_refl : forall x, eq x x.
Notation "x = y" := (eq x y)
(at level 70, no associativity)
: type_scope.
(** The way to think about this definition is that, given a set [X], it defines a _family_ of propositions "[x] is equal to [y]," indexed by pairs of values ([x] and [y]) from [X].  There is just one way of constructing evidence for each member of this family: applying the constructor [eq_refl] to a type [X] and a value [x : X] yields evidence that [x] is equal to [x]. *)
(** **** Exercise: 2 stars (leibniz_equality)  *)
(** The inductive definition of equality corresponds to _Leibniz equality_: what we mean when we say "[x] and [y] are equal" is that every property on [P] that is true of [x] is also true of [y].  *)

Lemma leibniz_equality : forall (X : Type) (x y: X),
x = y -> forall P:X->Prop, P x -> P y.