Top source

Module mathcomp.classical.internal_Eqdep_dec


Attributes deprecated(since="mathcomp-analysis 1.10.0",
  note="This file is for internal purpose only and should not \
  be imported nor used. It may be removed in the future.").

Import EqNotations.

Section Dependent_Equality.

Variables ( : Type) ( : U -> Type).

Inductive ( : U) ( : P p) : forall : U, P q -> Prop :=
  
eq_dep_intro
Source code
: eq_dep p x p x.

Lemma
eq_dep_sym
Source code
( : U) ( : P p) ( : P q) :
  eq_dep p x q y -> eq_dep q y p x.
Proof.
destruct 1; auto; apply eq_dep_intro. Qed.

Inductive ( : U) ( : P p) ( : U) ( : P q) : Prop :=
  
eq_dep1_intro
Source code
: forall : q = p, x = rew h in y -> eq_dep1 p x q y.

Lemma
eq_dep_dep1
Source code
( : U) ( : P p) ( : P q) :
  eq_dep p x q y -> eq_dep1 p x q y.
Proof.
revert p q x y; intros p; destruct 1.
apply eq_dep1_intro with (eq_refl p); simpl; trivial.
Qed.

End Dependent_Equality.

Section Equivalences.

Variable : Type.

Definition
Eq_rect_eq_on

emptyE_subdef : (forall T : emptyType, all_equal_to (set0 : set T)) * (forall (T : emptyType) (U : Type) (A : set T) (B : set U), (A #<= B)%card) * (forall (T : emptyType) (U : Type) (A : set T) (B : set U), (B #<= A)%card = (B == set0)) * (forall (T : eqType) (x y : T), (x == y : Prop) = (x = y)) emptyE_subdef is not universe polymorphic emptyE_subdef is transparent Expands to: Constant mathcomp.classical.cardinality.emptyE_subdef Declared in library mathcomp.classical.cardinality, line 191, characters 11-24


Source code
( : U) ( : U -> Type) ( : Q p) :=
  forall ( : p = p), x = eq_rect p Q x p h.
Definition
Eq_rect_eq

emptyE : (forall T : emptyType, all_equal_to (set0 : set T)) * (forall (T : emptyType) (U : Type) (A : set T) (B : set U), (A #<= B)%card) * (forall (T : emptyType) (U : Type) (A : set T) (B : set U), (B #<= A)%card = (B == set0)) * (forall (T : eqType) (x y : T), (x == y : Prop) = (x = y)) * (forall (T : emptyType) (U : Type) (A : set T) (B : set U), (B #= A)%card = (B == set0)) * (forall (T : emptyType) (U : Type) (A : set T) (B : set U), (A #= B)%card = (B == set0)) emptyE is not universe polymorphic emptyE is transparent Expands to: Constant mathcomp.classical.cardinality.emptyE Declared in library mathcomp.classical.cardinality, line 363, characters 11-17


Source code
:= forall , Eq_rect_eq_on p Q x.

Definition
Eq_dep_eq_on

countable : forall [T : Type], set T -> bool countable is not universe polymorphic Arguments countable [T]%_type_scope A%_classical_set_scope countable is transparent Expands to: Constant mathcomp.classical.cardinality.countable Declared in library mathcomp.classical.cardinality, line 459, characters 11-20


Source code
( : U -> Type) ( : U) ( : P p) :=
  forall ( : P p), eq_dep _ _ p x p y -> x = y.
Definition
Eq_dep_eq

fset_set : forall [T : choiceType], set T -> {fset T} fset_set is not universe polymorphic Arguments fset_set [T] A%_classical_set_scope fset_set is transparent Expands to: Constant mathcomp.classical.cardinality.fset_set Declared in library mathcomp.classical.cardinality, line 761, characters 11-19


Source code
:= forall , Eq_dep_eq_on P p x.

Definition
Streicher_K_on_

fst_fset : forall [T1 T2 : choiceType], {fset T1 * T2} -> {fset T1} fst_fset is not universe polymorphic Arguments fst_fset [T1 T2] A fst_fset is transparent Expands to: Constant mathcomp.classical.cardinality.fst_fset Declared in library mathcomp.classical.cardinality, line 846, characters 11-19


Source code
( : U) ( : x = x -> Prop) :=
  P (eq_refl x) -> forall : x = x, P p.
Definition
Streicher_K_

snd_fset : forall [T1 T2 : choiceType], {fset T1 * T2} -> {fset T2} snd_fset is not universe polymorphic Arguments snd_fset [T1 T2] A snd_fset is transparent Expands to: Constant mathcomp.classical.cardinality.snd_fset Declared in library mathcomp.classical.cardinality, line 848, characters 11-19


Source code
:= forall , Streicher_K_on_ x P.

Lemma
eq_rect_eq_on__eq_dep1_eq_on
Source code
( : U) ( : U -> Type) ( : P p) :
  Eq_rect_eq_on p P y -> forall ( : P p), eq_dep1 _ _ p x p y -> x = y.
Proof.
intro ere; simple destruct 1; intro; rewrite <-ere; auto. Qed.

Lemma
eq_rect_eq__eq_dep1_eq
Source code
:
  Eq_rect_eq -> forall (:U->Type) (:U) ( :P p), eq_dep1 _ _ p x p y -> x = y.
Proof (fun
eq_rect_eq
Source code
=>
  @eq_rect_eq_on__eq_dep1_eq_on p P x (eq_rect_eq p P x) y).

Lemma
eq_rect_eq_on__eq_dep_eq_on
Source code
( : U) ( : U -> Type) ( : P p) :
  Eq_rect_eq_on p P x -> Eq_dep_eq_on P p x.
Proof.
intros eq_rect_eq; red; intros y H.
symmetry; apply (eq_rect_eq_on__eq_dep1_eq_on _ _ _ eq_rect_eq).
apply eq_dep_sym in H; apply eq_dep_dep1; trivial.
Qed.
Lemma
eq_rect_eq__eq_dep_eq
Source code
: Eq_rect_eq -> Eq_dep_eq.
Proof (fun
eq_rect_eq
Source code
=>
  @eq_rect_eq_on__eq_dep_eq_on p P x (eq_rect_eq p P x) y).

Lemma
Streicher_K_on__eq_rect_eq_on
Source code
( : U) ( : U -> Type) ( : P p) :
  Streicher_K_on_ p (fun => x = rew -> [P] h in x) -> Eq_rect_eq_on p P x.
Proof.
intro Streicher_K; red; intros; apply Streicher_K; reflexivity. Qed.
Lemma
Streicher_K__eq_rect_eq
Source code
: Streicher_K_ -> Eq_rect_eq.
Proof.
End Equivalences.

Unset SsrOldRewriteGoalsOrder.
Set Implicit Arguments.

Section EqdepDec.

Variable : Type.

Let ( : A) ( : x = y) ( : x = y') : y = y' :=
  eq_ind _ (fun => a = y') eq2 _ eq1.

Remark
trans_sym_eq
Source code
( : A) ( : x = y) : comp u u = eq_refl y.
Proof.
now case u. Qed.

Variables ( : A) ( : forall : A, x = y \/ x <> y).

Let (:A) (:x = y) : x = y :=
  match eq_dec y with
  | or_introl eqxy => eqxy
  | or_intror neqxy => False_ind _ (neqxy u)
  end.

#[local] Lemma
nu_constant
Source code
( : A) ( : x = y) : nu u = nu v.
Proof.
now unfold nu; destruct (eq_dec y) as [Heq|Hneq]; [reflexivity|case Hneq].
Qed.

Let ( : A) ( : x = y) : x = y := comp (nu (eq_refl x)) v.

Remark
nu_left_inv_on
Source code
(:A) (:x = y) : nu_inv (nu u) = u.
Proof.
case u; unfold nu_inv; apply trans_sym_eq. Qed.

Theorem
eq_proofs_unicity_on
Source code
( : A) ( : x = y) : p1 = p2.
Proof.
elim (nu_left_inv_on p1).
elim (nu_left_inv_on p2).
elim nu_constant with y p1 p2.
reflexivity.
Qed.

Theorem
K_dec_on
Source code
( : x = x -> Prop) ( : P (eq_refl x)) ( : x = x) : P p.
Proof.
now elim eq_proofs_unicity_on with x (eq_refl x) p. Qed.

End EqdepDec.

Theorem ( : forall : A, x = y \/ x <> y) ( : A) :
  forall : x = x -> Prop, P (eq_refl x) -> forall : x = x, P p.
Proof.
exact (@K_dec_on A x (eq_dec x)). Qed.

Section Eq_dec.

Variables ( : Type) ( : forall : A, {x = y} + {x <> y}).

Theorem
K_dec_type
Source code
( : A) ( : x = x -> Prop) ( : P (eq_refl x)) ( : x = x) :
  P p.
Proof.
elim p using K_dec; [|now trivial].
now intros x0 y; case (eq_dec x0 y); [left|right].
Qed.

Theorem
eq_rect_eq_dec
Source code
: forall ( : A) ( : A -> Type) ( : Q p) ( : p = p),
  x = eq_rect p Q x p h.
Proof.

Unset Implicit Arguments.

Lemma
eq_sigT_eq_dep
Source code
( : Type) ( : U -> Type) ( : U) ( : P p) ( : P q) :
  existT P p x = existT P q y -> eq_dep _ _ p x q y.
Proof.
intros * H; dependent rewrite H; apply eq_dep_intro. Qed.

Section Corollaries.

Variable : Type.

Definition
Inj_dep_pair_on

fimfun : forall {aT rT : Type}, {pred aT -> rT} fimfun is not universe polymorphic Arguments fimfun {aT rT}%_type_scope _ fimfun is transparent Expands to: Constant mathcomp.classical.cardinality.fimfun Declared in library mathcomp.classical.cardinality, line 1340, characters 11-17


Source code
( : U -> Type) ( : U) ( : P p) :=
  forall ( : P p), existT P p x = existT P p y -> x = y.
Definition
Inj_dep_pair

fimfun_key : forall {aT rT : Type}, pred_key (T:=aT -> rT) fimfun fimfun_key is not universe polymorphic Arguments fimfun_key {aT rT}%_type_scope fimfun_key is opaque Expands to: Constant mathcomp.classical.cardinality.fimfun_key Declared in library mathcomp.classical.cardinality, line 1341, characters 11-21


Source code
:= forall , Inj_dep_pair_on P p x.

Lemma
eq_dep_eq_on__inj_pair2_on
Source code
( : U -> Type) ( : U) ( : P p) :
  Eq_dep_eq_on U P p x -> Inj_dep_pair_on P p x.
Proof.
intro ede; red; intros; apply ede; apply eq_sigT_eq_dep; assumption. Qed.
Lemma
eq_dep_eq__inj_pair2
Source code
: Eq_dep_eq U -> Inj_dep_pair.
Proof (fun
eq_dep_eq
Source code
=>
  @eq_dep_eq_on__inj_pair2_on P p x (eq_dep_eq P p x)).

End Corollaries.

Lemma
inj_pair2_eq_dec
Source code
:
  forall ( : A -> Type) ( : A) ( : P p), existT P p x = existT P p y -> x = y.
Proof.
  apply eq_dep_eq__inj_pair2.
  apply eq_rect_eq__eq_dep_eq.
  unfold Eq_rect_eq, Eq_rect_eq_on.
  intros; apply eq_rect_eq_dec.
Qed.

End Eq_dec.