Built with Alectryon, running Coq+SerAPI v8.10.0+0.7.0. Coq sources are in this panel; goals and messages will appear in the other. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus.
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
(* <O___,, * (see CREDITS file for the list of authors) *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
John Major's Equality as proposed by Conor McBride
Reference:
McBride Elimination with a Motive, Proceedings of TYPES 2000,
LNCS 2277, pp 197-216, 2002.
Set Implicit Arguments. Unset Elimination Schemes. Inductive JMeq (A:Type) (x:A) : forall B:Type, B -> Prop := JMeq_refl : JMeq x x. Set Elimination Schemes. Arguments JMeq_refl {A x} , [A] x. Register JMeq as core.JMeq.type. Register JMeq_refl as core.JMeq.refl. Hint Resolve JMeq_refl : core. Definition JMeq_hom {A : Type} (x y : A) := JMeq x y. Register JMeq_hom as core.JMeq.hom.forall (A B : Type) (x : A) (y : B), JMeq x y -> JMeq y xintros; destruct H; trivial. Qed. Hint Immediate JMeq_sym : core. Register JMeq_sym as core.JMeq.sym.forall (A B : Type) (x : A) (y : B), JMeq x y -> JMeq y xforall (A B C : Type) (x : A) (y : B) (z : C), JMeq x y -> JMeq y z -> JMeq x zdestruct 2; trivial. Qed. Register JMeq_trans as core.JMeq.trans. Axiom JMeq_eq : forall (A:Type) (x y:A), JMeq x y -> x = y.forall (A B C : Type) (x : A) (y : B) (z : C), JMeq x y -> JMeq y z -> JMeq x zforall (A : Type) (x : A) (P : A -> Prop), P x -> forall y : A, JMeq x y -> P yintros A x P H y H'; case JMeq_eq with (1 := H'); trivial. Qed. Register JMeq_ind as core.JMeq.ind.forall (A : Type) (x : A) (P : A -> Prop), P x -> forall y : A, JMeq x y -> P yforall (A : Type) (x : A) (P : A -> Set), P x -> forall y : A, JMeq x y -> P yintros A x P H y H'; case JMeq_eq with (1 := H'); trivial. Qed.forall (A : Type) (x : A) (P : A -> Set), P x -> forall y : A, JMeq x y -> P yforall (A : Type) (x : A) (P : A -> Type), P x -> forall y : A, JMeq x y -> P yintros A x P H y H'; case JMeq_eq with (1 := H'); trivial. Qed.forall (A : Type) (x : A) (P : A -> Type), P x -> forall y : A, JMeq x y -> P yforall (A : Type) (x : A) (P : A -> Prop), P x -> forall y : A, JMeq y x -> P yintros A x P H y H'; case JMeq_eq with (1 := JMeq_sym H'); trivial. Qed.forall (A : Type) (x : A) (P : A -> Prop), P x -> forall y : A, JMeq y x -> P yforall (A : Type) (x : A) (P : A -> Set), P x -> forall y : A, JMeq y x -> P yintros A x P H y H'; case JMeq_eq with (1 := JMeq_sym H'); trivial. Qed.forall (A : Type) (x : A) (P : A -> Set), P x -> forall y : A, JMeq y x -> P yforall (A : Type) (x : A) (P : A -> Type), P x -> forall y : A, JMeq y x -> P yintros A x P H y H'; case JMeq_eq with (1 := JMeq_sym H'); trivial. Qed.forall (A : Type) (x : A) (P : A -> Type), P x -> forall y : A, JMeq y x -> P yforall (A : Type) (x : A) (B : Type) (f : A -> B) (y : A), JMeq x y -> f x = f yintros A x B f y H; case JMeq_eq with (1 := H); trivial. Qed. Register JMeq_congr as core.JMeq.congr.forall (A : Type) (x : A) (B : Type) (f : A -> B) (y : A), JMeq x y -> f x = f y
JMeq is equivalent to eq_dep Type (fun X ⇒ X)
Require Import Eqdep.forall (A B : Type) (x : A) (y : B), JMeq x y -> eq_dep Type (fun X : Type => X) A x B yforall (A B : Type) (x : A) (y : B), JMeq x y -> eq_dep Type (fun X : Type => X) A x B yapply eq_dep_intro. Qed.A:Typex:Aeq_dep Type (fun X : Type => X) A x A xforall (A B : Type) (x : A) (y : B), eq_dep Type (fun X : Type => X) A x B y -> JMeq x yforall (A B : Type) (x : A) (y : B), eq_dep Type (fun X : Type => X) A x B y -> JMeq x yapply JMeq_refl. Qed.A:Typex:AJMeq x x
eq_dep U P p x q y is strictly finer than JMeq (P p) x (P q) y
forall (U : Type) (P : U -> Type) (p : U) (x : P p) (q : U) (y : P q), eq_dep U P p x q y -> JMeq x yforall (U : Type) (P : U -> Type) (p : U) (x : P p) (q : U) (y : P q), eq_dep U P p x q y -> JMeq x yapply JMeq_refl. Qed.U:TypeP:U -> Typep:Ux:P pJMeq x xexists (U : Type) (P : U -> Type) (p q : U) (x : P p) (y : P q), JMeq x y /\ ~ eq_dep U P p x q yexists (U : Type) (P : U -> Type) (p q : U) (x : P p) (y : P q), JMeq x y /\ ~ eq_dep U P p x q yexists (P : bool -> Type) (p q : bool) (x : P p) (y : P q), JMeq x y /\ ~ eq_dep bool P p x q yexists (p q : bool) (x y : True), JMeq x y /\ ~ eq_dep bool (fun _ : bool => True) p x q yexists (q : bool) (x y : True), JMeq x y /\ ~ eq_dep bool (fun _ : bool => True) true x q yexists x y : True, JMeq x y /\ ~ eq_dep bool (fun _ : bool => True) true x false yexists y : True, JMeq I y /\ ~ eq_dep bool (fun _ : bool => True) true I false yJMeq I I /\ ~ eq_dep bool (fun _ : bool => True) true I false IJMeq I I~ eq_dep bool (fun _ : bool => True) true I false Itrivial.JMeq I I~ eq_dep bool (fun _ : bool => True) true I false IH:eq_dep bool (fun _ : bool => True) true I false IFalsediscriminate. Qed.H:eq_dep bool (fun _ : bool => True) true I false IH0:true = falseFalse
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)
forall (U : Type) (P : U -> Type) (p q : U) (x : P p) (y : P q), p = q -> JMeq x y -> eq_dep U P p x q yforall (U : Type) (P : U -> Type) (p q : U) (x : P p) (y : P q), p = q -> JMeq x y -> eq_dep U P p x q yU:TypeP:U -> Typep, q:Ux:P py:P qH:p = qH0:JMeq x yeq_dep U P p x q yU:TypeP:U -> Typep:Ux, y:P pH0:JMeq x yeq_dep U P p x p yreflexivity. Qed. (* Compatibility *) Notation sym_JMeq := JMeq_sym (only parsing). Notation trans_JMeq := JMeq_trans (only parsing).U:TypeP:U -> Typep:Uy:P peq_dep U P p y p y