(******************************************  Copied From Coq.Logic.JMeq.  No longer involving JMeq_eq, which is potentially inconsistenty with homotopy type theory.  TODO: let reflexivity, symmetry and transitivity work again.  ******************************************)
Definition JMeq {A:Type} (x:A) {B:Type} (y: B): Prop :=
{H: @eq Type A B | @eq_rect Type A (fun T: Type => T) x B H = y}.
Hint Resolve JMeq_refl.
Hint Immediate JMeq_sym.
(** [JMeq] is equivalent to [eq_dep Type (fun X => X)] *)
(** [eq_dep U P p x q y] is strictly finer than [JMeq (P p) x (P q) y] *)
(** However, when the dependencies are equal, [JMeq (P p) x (P q) y] is as strong as [eq_dep U P p x q y] (this uses [JMeq_eq]) *)
(* Compatibility *)
Notation sym_JMeq := JMeq_sym (only parsing).
Notation trans_JMeq := JMeq_trans (only parsing).
(******************************************  The following is the original floyd/jmeq_lemmas.v  ******************************************)
Ltac solve_JMeq_sumtype H :=
match type of H with
| JMeq ?x ?y =>
destruct x; destruct y;
[apply JMeq_sumtype_ll in H; auto
|apply JMeq_sumtype_lr in H; auto; inversion H
|apply JMeq_sumtype_rl in H; auto; inversion H
|apply JMeq_sumtype_rr in H; auto]
end.

Lemma eq_rect_r_eq_rect_r_eq_sym: forall {T} {A B: T} F x (H: A = B),
eq_rect_r F (eq_rect_r F x H) (eq_sym H) = x.