1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
|
Section inversion_sigma.
Local Unset Implicit Arguments.
Context A (B B' : A -> Prop) (C C' : forall a, B a -> Prop)
(D : forall a b, C a b -> Prop) (E : forall a b c, D a b c -> Prop).
Context (AP : Prop) (BP BP' : AP -> Prop) (CP CP' : forall a, BP a -> Prop)
(DP : forall a b, CP a b -> Prop) (EP : forall a b c, DP a b c -> Prop).
(* Require that, after destructing sigma types and inverting
equalities, we can subst equalities of variables only, and reduce
down to [eq_refl = eq_refl]. *)
Local Ltac destr_sigma :=
repeat match goal with
| [ H : ex _ |- _ ] => destruct H
| [ H : sig _ |- _ ] => destruct H
| [ H : sigT _ |- _ ] => destruct H
| [ H : ex2 _ _ |- _ ] => destruct H
| [ H : sig2 _ _ |- _ ] => destruct H
| [ H : sigT2 _ _ |- _ ] => destruct H
end; simpl in *.
Local Ltac fin_test_inversion_sigma :=
match goal with
| [ |- eq_refl = eq_refl ] => reflexivity
end.
Local Ltac test_inversion_sigma :=
intros;
destr_sigma;
inversion_sigma;
repeat match goal with
| [ H : ?x = ?y |- _ ] => is_var x; is_var y; subst x; simpl in *
end;
fin_test_inversion_sigma.
Local Ltac test_inversion_sigma_in_H :=
intros;
destr_sigma;
repeat match goal with H : _ = _ |- _ => inversion_sigma H end;
repeat match goal with
| [ H : ?x = ?y |- _ ] => is_var x; is_var y; subst x; simpl in *
end;
fin_test_inversion_sigma.
Goal forall (x y : { a : A & { b : { b : B a & C a b } & { d : D a (projT1 b) (projT2 b) & E _ _ _ d } } })
(p : x = y), p = p.
Proof.
intros x y p; destr_sigma.
inversion_sigma p as [-> p]; cbn [eq_rect] in *.
lazymatch type of p with
| existT _ (existT _ ?a ?b) (existT _ ?c ?d) = existT _ (existT _ ?e ?f) (existT _ ?g ?h)
=> is_var a; is_var b; is_var c; is_var d; is_var e; is_var f; is_var g; is_var h
end.
inversion_sigma p as [p1 p2].
lazymatch type of p1 with existT _ ?a ?b = existT _ ?c ?d => is_var a; is_var b; is_var c; is_var d end.
inversion_sigma p1 as [-> <-]; cbn [eq_rect eq_existT_uncurried eq_sigT eq_existT_curried eq_sigT_uncurried] in * |- .
lazymatch type of p2 with existT _ ?a ?b = existT _ ?c ?d => is_var a; is_var b; is_var c; is_var d end.
inversion_sigma p2 as [-> <-].
cbn.
fin_test_inversion_sigma.
Qed.
Goal forall (x y : { a : A | { b : { b : B a | C a b } | { d : D a (proj1_sig b) (proj2_sig b) | E _ _ _ d } } })
(p : x = y), p = p.
Proof.
intros x y p; destr_sigma.
inversion_sigma p as [-> p]; cbn [eq_rect] in *.
lazymatch type of p with
| exist _ (exist _ ?a ?b) (exist _ ?c ?d) = exist _ (exist _ ?e ?f) (exist _ ?g ?h)
=> is_var a; is_var b; is_var c; is_var d; is_var e; is_var f; is_var g; is_var h
end.
inversion_sigma p as [p1 p2].
lazymatch type of p1 with exist _ ?a ?b = exist _ ?c ?d => is_var a; is_var b; is_var c; is_var d end.
inversion_sigma p1 as [-> <-]; cbn [eq_rect eq_exist_uncurried eq_sig eq_exist_curried eq_sig_uncurried] in * |- .
lazymatch type of p2 with exist _ ?a ?b = exist _ ?c ?d => is_var a; is_var b; is_var c; is_var d end.
inversion_sigma p2 as [-> <-].
cbn.
fin_test_inversion_sigma.
Qed.
Goal forall (x y : exists a : AP, exists b : exists b : BP a, CP a b, exists d : DP a (ex_proj1 b) (ex_proj2 b), EP _ _ _ d)
(p : x = y), p = p.
Proof.
intros x y p; destr_sigma.
inversion_sigma p as [-> p]; cbn [eq_rect] in *.
lazymatch type of p with
| ex_intro _ (ex_intro _ ?a ?b) (ex_intro _ ?c ?d) = ex_intro _ (ex_intro _ ?e ?f) (ex_intro _ ?g ?h)
=> is_var a; is_var b; is_var c; is_var d; is_var e; is_var f; is_var g; is_var h
end.
inversion_sigma p as [p1 p2].
lazymatch type of p1 with ex_intro _ ?a ?b = ex_intro _ ?c ?d => is_var a; is_var b; is_var c; is_var d end.
inversion_sigma p1 as [-> <-]; cbn [eq_rect eq_ex_intro_uncurried eq_ex_intro eq_ex eq_ex_uncurried] in * |- .
lazymatch type of p2 with ex_intro _ ?a ?b = ex_intro _ ?c ?d => is_var a; is_var b; is_var c; is_var d end.
inversion_sigma p2 as [-> <-].
cbn.
fin_test_inversion_sigma.
Qed.
Goal forall (x y : { a : { a : A & B a } & C _ (projT2 a) & C' _ (projT2 a) })
(p : x = y), p = p.
Proof.
intros x y p; destr_sigma.
inversion_sigma p as [p <- <-]; cbn [eq_rect] in *.
lazymatch type of p with existT _ ?a ?b = existT _ ?c ?d => is_var a; is_var b; is_var c; is_var d end.
inversion_sigma p as [-> <-].
cbn.
fin_test_inversion_sigma.
Qed.
Goal forall (x y : { a : { a : A & B a } | C _ (projT2 a) & C' _ (projT2 a) })
(p : x = y), p = p.
Proof.
intros x y p; destr_sigma.
inversion_sigma p as [p <- <-]; cbn [eq_rect] in *.
lazymatch type of p with existT _ ?a ?b = existT _ ?c ?d => is_var a; is_var b; is_var c; is_var d end.
inversion_sigma p as [-> <-].
cbn.
fin_test_inversion_sigma.
Qed.
Goal forall (x y : exists2 a : exists a : AP, BP a, CP _ (ex_proj2 a) & CP' _ (ex_proj2 a))
(p : x = y), p = p.
Proof.
intros x y p; destr_sigma.
inversion_sigma p as [p <- <-]; cbn [eq_rect] in *.
lazymatch type of p with ex_intro _ ?a ?b = ex_intro _ ?c ?d => is_var a; is_var b; is_var c; is_var d end.
inversion_sigma p as [-> <-].
cbn.
fin_test_inversion_sigma.
Qed.
Goal forall (x y : { a : { a : A & B a & B' a } & C _ (projT2 (sigT_of_sigT2 a)) & C' _ (projT2 (sigT_of_sigT2 a)) })
(p : x = y), p = p.
Proof.
intros x y p; destr_sigma.
inversion_sigma p as [p <- <-]; cbn [eq_rect] in *.
lazymatch type of p with existT2 _ _ ?a ?b ?c = existT2 _ _ ?d ?e ?f => is_var a; is_var b; is_var c; is_var d; is_var e; is_var f end.
inversion_sigma p as [-> <- <-].
cbn.
fin_test_inversion_sigma.
Qed.
Goal forall (x y : { a : { a : A & B a & B' a } | C _ (projT2 (sigT_of_sigT2 a)) & C' _ (projT2 (sigT_of_sigT2 a)) })
(p : x = y), p = p.
Proof.
intros x y p; destr_sigma.
inversion_sigma p as [p <- <-]; cbn [eq_rect] in *.
lazymatch type of p with existT2 _ _ ?a ?b ?c = existT2 _ _ ?d ?e ?f => is_var a; is_var b; is_var c; is_var d; is_var e; is_var f end.
inversion_sigma p as [-> <- <-].
cbn.
fin_test_inversion_sigma.
Qed.
Goal forall (x y : exists2 a : exists2 a : AP, BP a & BP' a, CP _ (ex_proj2 (ex_of_ex2 a)) & CP' _ (ex_proj2 (ex_of_ex2 a)))
(p : x = y), p = p.
Proof.
intros x y p; destr_sigma.
inversion_sigma p as [p <- <-]; cbn [eq_rect] in *.
lazymatch type of p with ex_intro2 _ _ ?a ?b ?c = ex_intro2 _ _ ?d ?e ?f => is_var a; is_var b; is_var c; is_var d; is_var e; is_var f end.
inversion_sigma p as [-> <- <-].
cbn.
fin_test_inversion_sigma.
Qed.
Goal forall (x y : { a : A & { b : { b : B a & C a b } & { d : D a (projT1 b) (projT2 b) & E _ _ _ d } } })
(p : x = y), p = p.
Proof. test_inversion_sigma. Qed.
Goal forall (x y : { a : A | { b : { b : B a | C a b } | { d : D a (proj1_sig b) (proj2_sig b) | E _ _ _ d } } })
(p : x = y), p = p.
Proof. test_inversion_sigma. Qed.
Goal forall (x y : exists a : AP, exists b : exists b : BP a, CP a b, exists d : DP a (ex_proj1 b) (ex_proj2 b), EP _ _ _ d)
(p : x = y), p = p.
Proof. test_inversion_sigma. Qed.
Goal forall (x y : { a : { a : A & B a } & C _ (projT2 a) & C' _ (projT2 a) })
(p : x = y), p = p.
Proof. test_inversion_sigma. Qed.
Goal forall (x y : { a : { a : A & B a } | C _ (projT2 a) & C' _ (projT2 a) })
(p : x = y), p = p.
Proof. test_inversion_sigma. Qed.
Goal forall (x y : { a : { a : A & B a & B' a } | C _ (projT2 (sigT_of_sigT2 a)) & C' _ (projT2 (sigT_of_sigT2 a)) })
(p : x = y), p = p.
Proof. test_inversion_sigma. Qed.
Goal forall (x y : { a : { a : A & B a & B' a } | C _ (projT2 (sigT_of_sigT2 a)) & C' _ (projT2 (sigT_of_sigT2 a)) })
(p : x = y), p = p.
Proof. test_inversion_sigma. Qed.
Goal forall (x y : exists2 a : exists2 a : AP, BP a & BP' a, CP _ (ex_proj2 (ex_of_ex2 a)) & CP' _ (ex_proj2 (ex_of_ex2 a)))
(p : x = y), p = p.
Proof. test_inversion_sigma. Qed.
Goal forall (x y : { a : A & { b : { b : B a & C a b } & { d : D a (projT1 b) (projT2 b) & E _ _ _ d } } })
(p : x = y), p = p.
Proof. test_inversion_sigma_in_H. Qed.
Goal forall (x y : { a : A | { b : { b : B a | C a b } | { d : D a (proj1_sig b) (proj2_sig b) | E _ _ _ d } } })
(p : x = y), p = p.
Proof. test_inversion_sigma_in_H. Qed.
Goal forall (x y : exists a : AP, exists b : exists b : BP a, CP a b, exists d : DP a (ex_proj1 b) (ex_proj2 b), EP _ _ _ d)
(p : x = y), p = p.
Proof. test_inversion_sigma_in_H. Qed.
Goal forall (x y : { a : { a : A & B a } & C _ (projT2 a) & C' _ (projT2 a) })
(p : x = y), p = p.
Proof. test_inversion_sigma_in_H. Qed.
Goal forall (x y : { a : { a : A & B a } | C _ (projT2 a) & C' _ (projT2 a) })
(p : x = y), p = p.
Proof. test_inversion_sigma_in_H. Qed.
Goal forall (x y : { a : { a : A & B a & B' a } | C _ (projT2 (sigT_of_sigT2 a)) & C' _ (projT2 (sigT_of_sigT2 a)) })
(p : x = y), p = p.
Proof. test_inversion_sigma_in_H. Qed.
Goal forall (x y : { a : { a : A & B a & B' a } | C _ (projT2 (sigT_of_sigT2 a)) & C' _ (projT2 (sigT_of_sigT2 a)) })
(p : x = y), p = p.
Proof. test_inversion_sigma_in_H. Qed.
Goal forall (x y : exists2 a : exists2 a : AP, BP a & BP' a, CP _ (ex_proj2 (ex_of_ex2 a)) & CP' _ (ex_proj2 (ex_of_ex2 a)))
(p : x = y), p = p.
Proof. test_inversion_sigma_in_H. Qed.
End inversion_sigma.
|