| 1 |
(** * Miscellaneous Well-Foundedness Facts *) |
| 2 |
From Coq Require Import Setoid Program. |
| 3 |
From Coq.Program Require Import Wf. |
| 4 |
From Coq Require Import Wf_nat Morphisms. |
| 5 |
From Coq.Init Require Import Wf. |
| 6 |
Require Import Crypto.Util.Telescope.Core. |
| 7 |
Require Import Crypto.Util.Telescope.Instances. |
| 8 |
Require Import Crypto.Util.Telescope.Equality. |
| 9 |
Require Import Crypto.Util.Equality. |
| 10 |
Require Import Crypto.Util.Wf1. |
| 11 |
Require Import Crypto.Util.Tactics.ETransitivity. |
| 12 |
Require Import Crypto.Util.Tactics.DestructHead. |
| 13 |
Require Import Crypto.Util.Tactics.SetEvars. |
| 14 |
Require Import Crypto.Util.Tactics.SubstEvars. |
| 15 |
Require Import Crypto.Util.Tactics.SubstLet. |
| 16 |
|
| 17 |
Local Set Implicit Arguments. |
| 18 |
|
| 19 |
Local Ltac tuplify a b := |
| 20 |
change a with (fst (a, b)) in *; |
| 21 |
change (fst (a, b), b) with (a, b) in *; |
| 22 |
change b with (snd (a, b)) in *; |
| 23 |
change (a, snd (a, b)) with (a, b) in *. |
| 24 |
|
| 25 |
Local Ltac tuplify' a b := |
| 26 |
tuplify a b; |
| 27 |
let tac := (fun T => match T with |
| 28 |
| context[?P (a, b)] |
| 29 |
=> change (P (a, b)) with (P (fst (a, b), snd (a, b))) |
| 30 |
end) in |
| 31 |
match goal with |
| 32 |
| [ |- context[@eq ?T _ _] ] => tac T |
| 33 |
| [ |- context[@flatten_forall_eq ?B ?T _ _] ] => tac B; tac T |
| 34 |
| [ |- context[@flatten_forall_eq_with_assumption ?B ?T _ _ _] ] => tac B; tac T |
| 35 |
| [ |- context[@flatten_append_forall ?B ?T _ _] ] => tac B; tac T |
| 36 |
end. |
| 37 |
|
| 38 |
(** work around https://coq.inria.fr/bugs/show_bug.cgi?id=4471 *) |
| 39 |
Local Ltac tc_goal := |
| 40 |
idtac; |
| 41 |
let H := fresh in |
| 42 |
let G := match goal with |- ?G => constr:(G) end in |
| 43 |
assert_succeeds assert (H : G -> G) by abstract exact (fun x => x). |
| 44 |
|
| 45 |
Local Ltac tuple_generalize a b := |
| 46 |
first [ tuplify a b; |
| 47 |
generalize dependent (a, b); tc_goal |
| 48 |
| tuplify' a b; |
| 49 |
generalize dependent (a, b); tc_goal ]; |
| 50 |
clear a b. |
| 51 |
|
| 52 |
Local Ltac destruct_prods := |
| 53 |
repeat match goal with |
| 54 |
| [ H : forall x : _ * _, _ |- _ ] => specialize (fun a' b' => H (a', b')); simpl in H |
| 55 |
| [ H : (_ * _)%type |- _ ] => destruct H |
| 56 |
end. |
| 57 |
|
| 58 |
Section wf. |
| 59 |
Context A B (R : A * B -> A * B -> Prop) |
| 60 |
(Rwf : well_founded R) |
| 61 |
(P : A * B -> Type) |
| 62 |
(F : forall x x', (forall y y', R (y, y') (x, x') -> P (y, y')) -> P (x, x')). |
| 63 |
|
| 64 |
Fixpoint Fix2_F x x' (a : Acc R (x, x')) : P (x, x') |
| 65 |
:= F (fun y y' (h : R (y, y') (x, x')) => Fix2_F (Acc_inv a h)). |
| 66 |
|
| 67 |
Lemma Fix2_F_eq' |
| 68 |
: forall xx' (r : Acc R xx'), |
| 69 |
F (fun y y' (p : R (y, y') (fst xx', snd xx')) => Fix2_F (x:=y) (x':=y') (Acc_inv r (match xx' return R _ (fst xx', snd xx') -> R _ xx' with |
| 70 |
| (x, x') => fun p => p |
| 71 |
end p))) |
| 72 |
= Fix2_F (x:=fst xx') (x':=snd xx') (match xx' return Acc R xx' -> Acc R (fst xx', snd xx') with |
| 73 |
| (x, x') => fun p => p |
| 74 |
end r). |
| 75 |
Proof. |
| 76 |
destruct r using Acc_inv_dep. |
| 77 |
match goal with |
| 78 |
| [ x : (A * B)%type |- _ ] => destruct x; auto |
| 79 |
end. |
| 80 |
Defined. |
| 81 |
|
| 82 |
Lemma Fix2_F_eq |
| 83 |
: forall x x' (r : Acc R (x, x')), |
| 84 |
F (fun y y' (p : R (y, y') (x, x')) => Fix2_F (x:=y) (x':=y') (Acc_inv r p)) |
| 85 |
= Fix2_F (x:=x) (x':=x') r. |
| 86 |
Proof. |
| 87 |
intros x x'. |
| 88 |
exact (@Fix2_F_eq' (x, x')). |
| 89 |
Defined. |
| 90 |
|
| 91 |
Definition Fix2 (x:A) (x':B) := Fix2_F (Rwf (x, x')). |
| 92 |
|
| 93 |
Section eq. |
| 94 |
Context (F_ext |
| 95 |
: forall x x' |
| 96 |
(f g:forall (y:A) (y':B), R (y, y') (x, x') -> P (y, y')), |
| 97 |
(forall y y' (p:R (y, y') (x, x')), f y y' p = g y y' p) |
| 98 |
-> F f = F g). |
| 99 |
|
| 100 |
Lemma Fix2_F_inv' : forall xx' (r s:Acc R xx'), |
| 101 |
Fix2_F (match xx' return Acc R xx' -> Acc R (fst xx', snd xx') with |
| 102 |
| (x, x') => fun p => p |
| 103 |
end r) |
| 104 |
= Fix2_F (match xx' return Acc R xx' -> Acc R (fst xx', snd xx') with |
| 105 |
| (x, x') => fun p => p |
| 106 |
end s). |
| 107 |
Proof. |
| 108 |
intro xx'; induction (Rwf xx'); intros. |
| 109 |
rewrite <- (Fix2_F_eq' r); rewrite <- (Fix2_F_eq' s); intros. |
| 110 |
destruct_prods. |
| 111 |
apply F_ext; auto. |
| 112 |
Qed. |
| 113 |
|
| 114 |
Lemma Fix2_F_inv : forall (x:A) (x':B) (r s:Acc R (x, x')), Fix2_F r = Fix2_F s. |
| 115 |
Proof. |
| 116 |
intros x x'. |
| 117 |
exact (@Fix2_F_inv' (x, x')). |
| 118 |
Qed. |
| 119 |
|
| 120 |
Lemma Fix2_0_eq : forall (x:A) (x':B), Fix2 x x' = F (fun (y:A) (y':B) (p:R (y, y') (x, x')) => Fix2 y y'). |
| 121 |
Proof. |
| 122 |
intros x x'; unfold Fix2. |
| 123 |
rewrite <- Fix2_F_eq. |
| 124 |
apply F_ext; intros. |
| 125 |
apply Fix2_F_inv. |
| 126 |
Qed. |
| 127 |
End eq. |
| 128 |
|
| 129 |
Section rect. |
| 130 |
Context (Q : forall x x', P (x, x') -> Type) |
| 131 |
(H : forall x x', (forall y y', R (y, y') (x, x') -> Q y y' (@Fix2 y y')) -> Q x x' (@F x x' (fun (y : A) (y' : B) (_ : R (y, y') (x, x')) => @Fix2 y y'))) |
| 132 |
(F_ext : forall (x : A) (x' : B) (f g : forall (y : A) (y' : B), R (y, y') (x, x') -> P (y, y')), |
| 133 |
(forall (y : A) (y' : B) (p : R (y, y') (x, x')), f y y' p = g y y' p) -> @F _ _ f = @F _ _ g). |
| 134 |
|
| 135 |
Definition Fix2_0_rect' xx' |
| 136 |
: @Q (fst xx') (snd xx') (@Fix2 (fst xx') (snd xx')). |
| 137 |
Proof. |
| 138 |
induction (Rwf xx'). |
| 139 |
destruct_prods. |
| 140 |
rewrite Fix2_0_eq; auto. |
| 141 |
Defined. |
| 142 |
|
| 143 |
Definition Fix2_0_rect x x' |
| 144 |
: @Q x x' (@Fix2 x x') |
| 145 |
:= @Fix2_0_rect' (x, x'). |
| 146 |
End rect. |
| 147 |
End wf. |
| 148 |
|
| 149 |
Local Ltac Fix2_Proper_t Fix2_eq wf := |
| 150 |
change (@flatten_forall_eq_relation) with (@flatten_forall_eq); |
| 151 |
change (@flatten_forall_eq_relation_with_assumption) with (@flatten_forall_eq_with_assumption); |
| 152 |
let H := fresh "H" in |
| 153 |
let a := fresh "a" in |
| 154 |
let b := fresh "b" in |
| 155 |
let ab := fresh "ab" in |
| 156 |
unfold forall_relation, pointwise_relation, respectful; |
| 157 |
intros ?? H a b; repeat intro; |
| 158 |
tuple_generalize a b; |
| 159 |
intros ab; intros; |
| 160 |
induction (wf ab); |
| 161 |
rewrite !Fix2_eq; |
| 162 |
destruct_prods; |
| 163 |
[ erewrite H; [ reflexivity | .. ] | .. ]; eauto; intros; |
| 164 |
[ etransitivity; [ symmetry; apply H; reflexivity | apply H; eassumption ]; reflexivity |
| 165 |
| etransitivity; [ apply H; eassumption | symmetry; apply H; reflexivity ]; reflexivity ]. |
| 166 |
|
| 167 |
Global Instance Fix2_0_Proper_eq {A B R wf P} |
| 168 |
: Proper |
| 169 |
((forall_relation |
| 170 |
(fun a => |
| 171 |
forall_relation |
| 172 |
(fun b => |
| 173 |
forall_relation |
| 174 |
(fun a' => |
| 175 |
forall_relation |
| 176 |
(fun b' => |
| 177 |
pointwise_relation _ eq)) |
| 178 |
==> eq))) |
| 179 |
==> (forall_relation (fun a => forall_relation (fun b => eq)))) |
| 180 |
(@Fix2 A B R wf P). |
| 181 |
Proof. Fix2_Proper_t @Fix2_0_eq wf. Qed. |
| 182 |
|
| 183 |
Local Ltac Fix2_eq_t F_ext Rwf := |
| 184 |
let generalize_if_not_var x := |
| 185 |
first [ is_var x; fail 1 |
| 186 |
| generalize x ] in |
| 187 |
intros; |
| 188 |
unfold Fix2; |
| 189 |
rewrite <- Fix2_F_eq; |
| 190 |
apply F_ext; intros; |
| 191 |
repeat match goal with |
| 192 |
| [ |- context[Fix2_F _ _ ?x] ] => generalize_if_not_var x |
| 193 |
| [ |- context[Fix2_F _ _ ?x _] ] => generalize_if_not_var x |
| 194 |
end; |
| 195 |
clear -F_ext Rwf; |
| 196 |
let y := match goal with |- forall x : Acc _ (?y, ?y'), _ => constr:(y) end in |
| 197 |
let y' := match goal with |- forall x : Acc _ (?y, ?y'), _ => constr:(y') end in |
| 198 |
tuplify' y y'; |
| 199 |
let r := fresh "r" in |
| 200 |
let s := fresh "s" in |
| 201 |
intros r s; |
| 202 |
change r with (match (y, y') as yy' return Acc _ yy' -> Acc _ (fst yy', snd yy') with |
| 203 |
| (_, _) => fun p => p |
| 204 |
end r); |
| 205 |
change s with (match (y, y') as yy' return Acc _ yy' -> Acc _ (fst yy', snd yy') with |
| 206 |
| (_, _) => fun p => p |
| 207 |
end s); |
| 208 |
generalize dependent (y, y'); clear y y'; |
| 209 |
let yy' := fresh "yy'" in |
| 210 |
intro yy'; induction (Rwf yy'); |
| 211 |
intros; rewrite <- !Fix2_F_eq; |
| 212 |
apply F_ext; |
| 213 |
destruct_prods; |
| 214 |
eauto. |
| 215 |
|
| 216 |
Section Fix2V. |
| 217 |
Context A A' (B : A * A' -> Telescope) |
| 218 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 219 |
(P : forall aa', flattenT (B aa') Type). |
| 220 |
|
| 221 |
Local Notation Fix2V := (@Fix2 A A' R Rwf (fun aa' => flatten_forall (P aa'))). |
| 222 |
|
| 223 |
Section F. |
| 224 |
Context (F : forall x x', (forall y y', R (y, y') (x, x') -> flatten_forall (P (y, y'))) -> flatten_forall (P (x, x'))). |
| 225 |
|
| 226 |
Definition Fix2V_eq |
| 227 |
(F_ext : forall x x' (f g : forall y y', R (y, y') (x, x') -> flatten_forall (P (y, y'))), |
| 228 |
(forall y y' (p : R (y, y') (x, x')), flatten_forall_eq (f y y' p) (g y y' p)) |
| 229 |
-> flatten_forall_eq (@F x x' f) (@F x x' g)) |
| 230 |
: forall a a', flatten_forall_eq (@Fix2V F a a') (@F a a' (fun y y' (_ : R (y, y') (a, a')) => @Fix2V F y y')). |
| 231 |
Proof. Fix2_eq_t F_ext Rwf. Defined. |
| 232 |
|
| 233 |
Definition Fix2V_eq_with_assumption |
| 234 |
Q |
| 235 |
(F_ext : forall x x' (f g : forall y y', R (y, y') (x, x') -> flatten_forall (P (y, y'))), |
| 236 |
(forall y y' (p : R (y, y') (x, x')), flatten_forall_eq_with_assumption (Q y y') (f y y' p) (g y y' p)) |
| 237 |
-> flatten_forall_eq_with_assumption (Q x x') (@F x x' f) (@F x x' g)) |
| 238 |
: forall a a', flatten_forall_eq_with_assumption (Q a a') (@Fix2V F a a') (@F a a' (fun y y' (_ : R (y, y') (a, a')) => @Fix2V F y y')). |
| 239 |
Proof. Fix2_eq_t F_ext Rwf. Defined. |
| 240 |
|
| 241 |
Definition Fix2V_rect |
| 242 |
(Q : forall a a', flattenT (Telescope_append (B (a, a')) (P (a, a'))) Type) |
| 243 |
(H0 : forall x x', (forall y y', R (y, y') (x, x') -> flatten_append_forall (@Q y y') (@Fix2V F y y')) |
| 244 |
-> flatten_append_forall (@Q x x') (@F x x' (fun y y' (_ : R (y, y') (x, x')) => @Fix2V F y y'))) |
| 245 |
(F_ext : forall x x' (f g : forall y y', R (y, y') (x, x') -> flatten_forall (@P (y, y'))), |
| 246 |
(forall y y' (p : R (y, y') (x, x')), flatten_forall_eq (f y y' p) (g y y' p)) |
| 247 |
-> flatten_forall_eq (@F x x' f) (@F x x' g)) |
| 248 |
a a' |
| 249 |
: flatten_append_forall (@Q a a') (@Fix2V F a a'). |
| 250 |
Proof. |
| 251 |
tuple_generalize a a'. |
| 252 |
intro aa'; induction (Rwf aa'). |
| 253 |
destruct_prods. |
| 254 |
eapply flatten_append_forall_Proper; auto with nocore. |
| 255 |
symmetry; eapply Fix2V_eq; auto with nocore. |
| 256 |
Defined. |
| 257 |
End F. |
| 258 |
|
| 259 |
Global Instance Fix2V_Proper_eq |
| 260 |
: Proper |
| 261 |
((forall_relation |
| 262 |
(fun a => |
| 263 |
forall_relation |
| 264 |
(fun a' => |
| 265 |
(forall_relation |
| 266 |
(fun b => |
| 267 |
forall_relation |
| 268 |
(fun b' => |
| 269 |
pointwise_relation |
| 270 |
_ |
| 271 |
(flatten_forall_eq_relation)))) |
| 272 |
==> flatten_forall_eq_relation))) |
| 273 |
==> (forall_relation (fun a => forall_relation (fun a' => flatten_forall_eq_relation)))) |
| 274 |
Fix2V. |
| 275 |
Proof. Fix2_Proper_t @Fix2V_eq Rwf. Qed. |
| 276 |
|
| 277 |
Global Instance Fix2V_Proper_eq_with_assumption Q |
| 278 |
: Proper |
| 279 |
((forall_relation |
| 280 |
(fun a => |
| 281 |
forall_relation |
| 282 |
(fun a' => |
| 283 |
(forall_relation |
| 284 |
(fun b => |
| 285 |
forall_relation |
| 286 |
(fun b' => |
| 287 |
pointwise_relation |
| 288 |
_ |
| 289 |
(flatten_forall_eq_relation_with_assumption (Q b b'))))) |
| 290 |
==> flatten_forall_eq_relation_with_assumption (Q a a')))) |
| 291 |
==> (forall_relation (fun a => forall_relation (fun a' => flatten_forall_eq_relation_with_assumption (Q a a'))))) |
| 292 |
Fix2V. |
| 293 |
Proof. Fix2_Proper_t @Fix2V_eq_with_assumption Rwf. Qed. |
| 294 |
End Fix2V. |
| 295 |
|
| 296 |
Arguments Fix2V_Proper_eq {A A' B R Rwf P} _ _ _ _ _. |
| 297 |
Arguments Fix2V_Proper_eq_with_assumption {A A' B R Rwf P} _ _ _ _ _ _. |
| 298 |
|
| 299 |
Lemma FixV_2V_eq |
| 300 |
A A' |
| 301 |
(B : A * A' -> Telescope) |
| 302 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 303 |
(P : forall aa', flattenT (B aa') Type) |
| 304 |
(F : forall xx', (forall yy', R yy' xx' -> flatten_forall (P yy')) -> flatten_forall (P xx')) |
| 305 |
(F' : forall x x', (forall y y', R (y, y') (x, x') -> flatten_forall (P (y, y'))) -> flatten_forall (P (x, x')) |
| 306 |
:= fun x x' (f : forall y y', R (y, y') (x, x') -> flatten_forall (P (y, y'))) |
| 307 |
=> F (x, x') (fun yy' => match yy' return R yy' _ -> flatten_forall (P yy') with |
| 308 |
| (y, y') => f y y' |
| 309 |
end)) |
| 310 |
(F_ext : forall xx' (f g : forall yy', R yy' xx' -> flatten_forall (P yy')), |
| 311 |
(forall yy' (p : R yy' xx'), flatten_forall_eq (f yy' p) (g yy' p)) |
| 312 |
-> flatten_forall_eq (@F xx' f) (@F xx' g)) |
| 313 |
: forall aa', flatten_forall_eq (@Fix (A * A') R Rwf (fun aa' => flatten_forall (P aa')) F aa') |
| 314 |
(match aa' with |
| 315 |
| (a, a') => @Fix2 A A' R Rwf (fun aa' => flatten_forall (P aa')) F' a a' |
| 316 |
end). |
| 317 |
Proof. |
| 318 |
intro aa'; induction (Rwf aa'). |
| 319 |
destruct_prods. |
| 320 |
etransitivity; |
| 321 |
[ solve [ apply FixV_eq; intros; destruct_prods; |
| 322 |
apply F_ext; intros; destruct_prods; auto ] |
| 323 |
| ]. |
| 324 |
etransitivity; |
| 325 |
[ |
| 326 |
| solve [ symmetry; |
| 327 |
apply (@Fix2V_eq A A' B R Rwf P F'); intros; destruct_prods; |
| 328 |
apply F_ext; intros; destruct_prods; eauto ] ]. |
| 329 |
apply F_ext; intros; destruct_prods; eauto. |
| 330 |
Qed. |
| 331 |
|
| 332 |
Local Arguments flatten_forall / _ _. |
| 333 |
Local Arguments flattenT / _ _. |
| 334 |
Local Arguments flatten_forall_eq / _ _ _ _. |
| 335 |
Local Arguments flatten_forall_eq_relation / _ _ _ _. |
| 336 |
Local Arguments flatten_forall_eq_with_assumption / _ _ _ _ _. |
| 337 |
Local Arguments flatten_forall_eq_relation_with_assumption / _ _ _ _ _. |
| 338 |
Local Arguments flatten_append_forall / _ _ _ _. |
| 339 |
|
| 340 |
Local Notation type_of x := ((fun T (y : T) => T) _ x). |
| 341 |
|
| 342 |
Section Fix2VTransfer. |
| 343 |
Context A A' (B B' : A * A' -> Telescope) |
| 344 |
(f0 : forall a, flattenT_sig (B a) -> flattenT_sig (B' a)) |
| 345 |
(g0 : forall a, flattenT_sig (B' a) -> flattenT_sig (B a)) |
| 346 |
(sect : forall a x, g0 a (f0 a x) = x) |
| 347 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 348 |
(P : forall a, flattenT (B a) Type). |
| 349 |
|
| 350 |
Let P' : forall a, flattenT (B' a) Type |
| 351 |
:= fun a => flattenT_unapply (fun x => flattenT_apply (P a) (g0 _ x)). |
| 352 |
|
| 353 |
Local Notation Fix2V := (@Fix2 A A' R Rwf (fun a => flatten_forall (P a))). |
| 354 |
Local Notation Fix2V' := (@Fix2 A A' R Rwf (fun a => flatten_forall (P' a))). |
| 355 |
|
| 356 |
Section F. |
| 357 |
Context (F : forall x x', (forall y y', R (y, y') (x, x') -> flatten_forall (P (y, y'))) -> flatten_forall (P (x, x'))). |
| 358 |
|
| 359 |
Let transfer |
| 360 |
: forall y y', |
| 361 |
flatten_forall |
| 362 |
(flattenT_unapply |
| 363 |
(fun x : flattenT_sig (B (y, y')) => flattenT_apply (P' (y, y')) (f0 (y, y') x))) |
| 364 |
-> flatten_forall (P (y, y')). |
| 365 |
Proof. |
| 366 |
intros y y'. |
| 367 |
refine (flatten_forall_eq_rect |
| 368 |
(transitivity |
| 369 |
((_ : Proper (pointwise_relation _ _ ==> _) flattenT_unapply) |
| 370 |
_ _ |
| 371 |
(fun x' => transitivity |
| 372 |
(symmetry (flattenT_apply_unapply _ _)) |
| 373 |
(f_equal (flattenT_apply _) (sect _ _)))) |
| 374 |
(symmetry (flattenT_unapply_apply _)))). |
| 375 |
Defined. |
| 376 |
|
| 377 |
Let transfer' |
| 378 |
: forall a a', |
| 379 |
flatten_forall (P (a, a')) |
| 380 |
-> flatten_forall (P' (a, a')). |
| 381 |
Proof. |
| 382 |
intros a a'. |
| 383 |
refine (fun f' => flatten_forall_unapply (fun x' => flatten_forall_apply f' (g0 _ x'))). |
| 384 |
Defined. |
| 385 |
|
| 386 |
Let untransfer' |
| 387 |
: forall a a', |
| 388 |
flatten_forall (P' (a, a')) |
| 389 |
-> flatten_forall (P (a, a')). |
| 390 |
Proof. |
| 391 |
intros a a'. |
| 392 |
refine (fun f' => _). |
| 393 |
refine (transfer |
| 394 |
_ _ |
| 395 |
(flatten_forall_unapply (fun x => flatten_forall_apply f' (f0 _ x)))). |
| 396 |
Defined. |
| 397 |
|
| 398 |
Let F' : forall x x', (forall y y', R (y, y') (x, x') -> flatten_forall (P' (y, y'))) -> flatten_forall (P' (x, x')) |
| 399 |
:= fun a a' F' => transfer' _ _ (@F a a' (fun y y' pf => transfer _ _ (flatten_forall_unapply (fun x => flatten_forall_apply (F' y y' pf) (f0 _ x))))). |
| 400 |
|
| 401 |
|
| 402 |
Context (F_ext : forall x x' (f g : forall y y', R (y, y') (x, x') -> flatten_forall (P (y, y'))), |
| 403 |
(forall y y' (p : R (y, y') (x, x')), flatten_forall_eq (f y y' p) (g y y' p)) |
| 404 |
-> flatten_forall_eq (@F x x' f) (@F x x' g)). |
| 405 |
|
| 406 |
Lemma F'_ext |
| 407 |
: forall x x' (f g : forall y y', R (y, y') (x, x') -> flatten_forall (P' (y, y'))), |
| 408 |
(forall y y' (p : R (y, y') (x, x')), flatten_forall_eq (f y y' p) (g y y' p)) |
| 409 |
-> flatten_forall_eq (@F' x x' f) (@F' x x' g). |
| 410 |
Proof. |
| 411 |
intros x x' f' g' IH. |
| 412 |
subst F' transfer transfer'; cbv beta. |
| 413 |
apply (_ : Proper (forall_relation _ ==> _) flatten_forall_unapply); intro. |
| 414 |
apply flatten_forall_apply_Proper. |
| 415 |
apply F_ext; intros. |
| 416 |
refine ((_ : Proper (flatten_forall_eq ==> _) (@flatten_forall_eq_rect _ _ _ _)) _ _ _). |
| 417 |
apply (_ : Proper (forall_relation _ ==> _) flatten_forall_unapply); intro. |
| 418 |
apply flatten_forall_apply_Proper. |
| 419 |
apply IH. |
| 420 |
Qed. |
| 421 |
|
| 422 |
Definition Fix2V_transfer_eq |
| 423 |
a a' |
| 424 |
: flatten_forall_eq (@Fix2V F a a') (untransfer' _ _ (@Fix2V' F' a a')). |
| 425 |
Proof. |
| 426 |
tuple_generalize a a'. |
| 427 |
intro a; induction (Rwf a). |
| 428 |
rewrite Fix2V_eq by eauto with nocore. |
| 429 |
etransitivity_rev _. |
| 430 |
{ unfold transfer, untransfer'; cbv beta. |
| 431 |
apply flatten_forall_eq_rect_Proper, flatten_forall_unapply_Proper; intro. |
| 432 |
apply flatten_forall_apply_Proper. |
| 433 |
rewrite Fix2V_eq by auto using F'_ext with nocore. |
| 434 |
reflexivity. } |
| 435 |
etransitivity. |
| 436 |
{ apply F_ext; intros. |
| 437 |
set_evars. |
| 438 |
lazymatch goal with |
| 439 |
| [ H : forall y r, flatten_forall_eq _ _ |- _ ] |
| 440 |
=> specialize (fun y0 y1 => H (y0, y1)); |
| 441 |
simpl @fst in H; simpl @snd in H; |
| 442 |
rewrite H by (destruct_head prod; assumption) |
| 443 |
end. |
| 444 |
match goal with |
| 445 |
| [ |- ?R ?a (?e ?x ?y) ] |
| 446 |
=> revert x y |
| 447 |
end. |
| 448 |
match goal with |
| 449 |
| [ H := ?e |- _ ] => is_evar e; subst H |
| 450 |
end. |
| 451 |
match goal with |
| 452 |
| [ |- forall x y, ?R (@?LHS x y) (?RHS x y) ] |
| 453 |
=> unify LHS RHS; cbv beta |
| 454 |
end. |
| 455 |
reflexivity. } |
| 456 |
lazymatch goal with |
| 457 |
| [ |- context[Fix2V' ?F _ _] ] |
| 458 |
=> generalize (Fix2V' F) |
| 459 |
end. |
| 460 |
subst F'; cbv beta. |
| 461 |
subst untransfer' transfer transfer'; cbv beta. |
| 462 |
intro. |
| 463 |
rewrite flatten_forall_eq_rect_trans. |
| 464 |
match goal with |
| 465 |
| [ |- context[flatten_forall_eq_rect |
| 466 |
(flattenT_unapply_Proper ?P ?Q ?H) |
| 467 |
(flatten_forall_unapply ?f)] ] |
| 468 |
=> rewrite (@flatten_forall_eq_rect_flattenT_unapply_Proper _ P Q H f) |
| 469 |
end. |
| 470 |
etransitivity_rev _. |
| 471 |
{ apply flatten_forall_eq_rect_Proper. |
| 472 |
apply flatten_forall_unapply_Proper; intro. |
| 473 |
match goal with |
| 474 |
| [ |- context[@transitivity _ (@eq ?A) ?P _ _ _ _ _] ] |
| 475 |
=> change (@transitivity _ (@eq ?A) P) with (@eq_trans A) |
| 476 |
end. |
| 477 |
match goal with |
| 478 |
| [ |- context[@symmetry _ (@eq ?A) ?P _ _ _] ] |
| 479 |
=> change (@symmetry _ (@eq ?A) P) with (@eq_sym A) |
| 480 |
end. |
| 481 |
set_evars. |
| 482 |
rewrite @transport_pp. |
| 483 |
match goal with |
| 484 |
| [ |- context G[eq_rect _ (fun T => T) (flatten_forall_apply (flatten_forall_unapply ?k) ?x0) _ (eq_sym (flattenT_apply_unapply ?f1 ?x0))] ] |
| 485 |
=> let H := fresh in |
| 486 |
pose proof (@eq_rect_symmetry_flattenT_apply_unapply _ f1 x0 k) as H; |
| 487 |
cbv beta in H |- *; |
| 488 |
let RHS := match type of H with _ = ?RHS => constr:(RHS) end in |
| 489 |
let LHS := match type of H with ?LHS = _ => constr:(LHS) end in |
| 490 |
let G' := context G[LHS] in |
| 491 |
change G'; |
| 492 |
rewrite H; |
| 493 |
clear H |
| 494 |
end. |
| 495 |
match goal with |
| 496 |
| [ |- context[f_equal _ ?p] ] |
| 497 |
=> destruct p; unfold f_equal; simpl @eq_rect |
| 498 |
end. |
| 499 |
subst_let. |
| 500 |
reflexivity. } |
| 501 |
rewrite flatten_forall_eq_rect_symmetry_flattenT_unapply_apply. |
| 502 |
apply F_ext; intros. |
| 503 |
reflexivity. |
| 504 |
Qed. |
| 505 |
End F. |
| 506 |
End Fix2VTransfer. |
| 507 |
|
| 508 |
Section Fix2_0. |
| 509 |
Context A A' |
| 510 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 511 |
(P : A * A' -> Type). |
| 512 |
|
| 513 |
Local Notation T := (fun _ => bottom). |
| 514 |
|
| 515 |
Let Fix0_2_0_eq' := @FixV_2V_eq A A' T R Rwf P. |
| 516 |
Let Fix0_2_0_eq'T := Eval simpl in type_of Fix0_2_0_eq'. |
| 517 |
|
| 518 |
Definition Fix0_2_0_eq : Fix0_2_0_eq'T := Fix0_2_0_eq'. |
| 519 |
End Fix2_0. |
| 520 |
|
| 521 |
(** A variant of [Fix] that has a nice [Fix_eq] for functions which |
| 522 |
doesn't require [functional_extensionality]. *) |
| 523 |
(* Code generated by the Python script: |
| 524 |
<< |
| 525 |
ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
| 526 |
alpha = ALPHA.lower() |
| 527 |
for fixn in range(1, 11): |
| 528 |
print(r"""Section Fix2_%(fixn)d.""" % locals()) |
| 529 |
def make_forall(n, pat, skip_forall=0): |
| 530 |
mycur = '' |
| 531 |
if n > skip_forall + 1: |
| 532 |
mycur += 'forall ' + ' '.join(alpha[skip_forall:n-1]) + ', ' |
| 533 |
mycur2 = '' |
| 534 |
if n > 1: |
| 535 |
mycur2 += ' ' + ' '.join(alpha[:n-1]) |
| 536 |
return mycur + (pat % mycur2) |
| 537 |
|
| 538 |
cur = " Context A A' (B : A * A' -> Type)" |
| 539 |
for j in range(2, fixn + 1): |
| 540 |
cur += ' (%s : ' % ALPHA[j] |
| 541 |
cur += make_forall(j, '%s%%s -> Type)' % ALPHA[j-1]) |
| 542 |
print(cur) |
| 543 |
print(r""" (R : A * A' -> A * A' -> Prop) (Rwf : well_founded R)""") |
| 544 |
cur = " (P : " |
| 545 |
cur += make_forall(fixn+1, '%s%%s -> Type).' % ALPHA[fixn]) |
| 546 |
print(cur) |
| 547 |
print("") |
| 548 |
def make_tele(chars, final, append=''): |
| 549 |
if chars: |
| 550 |
return '(fun %s => tele _ %s)' % (chars[0], make_tele(chars[1:], final, append + ' ' + chars[0])) |
| 551 |
else: |
| 552 |
return '(fun _ : %s%s => bottom)' % (final, append) |
| 553 |
print(' Local Notation T := %s.' % make_tele(alpha[:fixn], '@' + ALPHA[fixn])) |
| 554 |
fix_underscores = ' '.join('_' for i in range(fixn + 5)) |
| 555 |
letters = ' '.join(ALPHA[1:fixn+1]) |
| 556 |
print(r""" |
| 557 |
Let Fix2_%(fixn)d_eq' := @Fix2V_eq A A' T R Rwf P. |
| 558 |
Let Fix2_%(fixn)d_eq'T := Eval simpl in type_of Fix2_%(fixn)d_eq'. |
| 559 |
|
| 560 |
Let Fix2_%(fixn)d_rect' := @Fix2V_rect A A' T R Rwf P. |
| 561 |
Let Fix2_%(fixn)d_rect'T := Eval simpl in type_of Fix2_%(fixn)d_rect'. |
| 562 |
|
| 563 |
Let Fix2_%(fixn)d_Proper_eq' := @Fix2V_Proper_eq A A' T R Rwf P. |
| 564 |
Let Fix2_%(fixn)d_Proper_eq'T := Eval simpl in type_of Fix2_%(fixn)d_Proper_eq'. |
| 565 |
|
| 566 |
Let Fix2_%(fixn)d_Proper_eq_with_assumption' := @Fix2V_Proper_eq_with_assumption A A' T R Rwf P. |
| 567 |
Let Fix2_%(fixn)d_Proper_eq_with_assumption'T := Eval simpl in type_of Fix2_%(fixn)d_Proper_eq_with_assumption'. |
| 568 |
|
| 569 |
Let Fix%(fixn)d_2_%(fixn)d_eq' := @FixV_2V_eq A A' T R Rwf P. |
| 570 |
Let Fix%(fixn)d_2_%(fixn)d_eq'T := Eval simpl in type_of Fix%(fixn)d_2_%(fixn)d_eq'. |
| 571 |
|
| 572 |
Definition Fix2_%(fixn)d_eq : Fix2_%(fixn)d_eq'T := Fix2_%(fixn)d_eq'. |
| 573 |
Definition Fix2_%(fixn)d_rect : Fix2_%(fixn)d_rect'T := Fix2_%(fixn)d_rect'. |
| 574 |
Definition Fix2_%(fixn)d_Proper_eq : Fix2_%(fixn)d_Proper_eq'T := Fix2_%(fixn)d_Proper_eq'. |
| 575 |
Definition Fix2_%(fixn)d_Proper_eq_with_assumption : Fix2_%(fixn)d_Proper_eq_with_assumption'T := Fix2_%(fixn)d_Proper_eq_with_assumption'. |
| 576 |
Definition Fix%(fixn)d_2_%(fixn)d_eq : Fix%(fixn)d_2_%(fixn)d_eq'T := Fix%(fixn)d_2_%(fixn)d_eq'. |
| 577 |
End Fix2_%(fixn)d. |
| 578 |
|
| 579 |
Arguments Fix2_%(fixn)d_Proper_eq {A A' %(letters)s R Rwf P} %(fix_underscores)s. |
| 580 |
Arguments Fix2_%(fixn)d_Proper_eq_with_assumption {A A' %(letters)s R Rwf P} _ _ %(fix_underscores)s. |
| 581 |
Global Existing Instance Fix2_%(fixn)d_Proper_eq. |
| 582 |
Global Existing Instance Fix2_%(fixn)d_Proper_eq_with_assumption. |
| 583 |
""" % locals()) |
| 584 |
>> *) |
| 585 |
Section Fix2_1. |
| 586 |
Context A A' (B : A * A' -> Type) |
| 587 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 588 |
(P : forall a, B a -> Type). |
| 589 |
|
| 590 |
Local Notation T := (fun a => tele _ (fun _ : @B a => bottom)). |
| 591 |
|
| 592 |
Let Fix2_1_eq' := @Fix2V_eq A A' T R Rwf P. |
| 593 |
Let Fix2_1_eq'T := Eval simpl in type_of Fix2_1_eq'. |
| 594 |
|
| 595 |
Let Fix2_1_rect' := @Fix2V_rect A A' T R Rwf P. |
| 596 |
Let Fix2_1_rect'T := Eval simpl in type_of Fix2_1_rect'. |
| 597 |
|
| 598 |
Let Fix2_1_Proper_eq' := @Fix2V_Proper_eq A A' T R Rwf P. |
| 599 |
Let Fix2_1_Proper_eq'T := Eval simpl in type_of Fix2_1_Proper_eq'. |
| 600 |
|
| 601 |
Let Fix2_1_Proper_eq_with_assumption' := @Fix2V_Proper_eq_with_assumption A A' T R Rwf P. |
| 602 |
Let Fix2_1_Proper_eq_with_assumption'T := Eval simpl in type_of Fix2_1_Proper_eq_with_assumption'. |
| 603 |
|
| 604 |
Let Fix1_2_1_eq' := @FixV_2V_eq A A' T R Rwf P. |
| 605 |
Let Fix1_2_1_eq'T := Eval simpl in type_of Fix1_2_1_eq'. |
| 606 |
|
| 607 |
Definition Fix2_1_eq : Fix2_1_eq'T := Fix2_1_eq'. |
| 608 |
Definition Fix2_1_rect : Fix2_1_rect'T := Fix2_1_rect'. |
| 609 |
Definition Fix2_1_Proper_eq : Fix2_1_Proper_eq'T := Fix2_1_Proper_eq'. |
| 610 |
Definition Fix2_1_Proper_eq_with_assumption : Fix2_1_Proper_eq_with_assumption'T := Fix2_1_Proper_eq_with_assumption'. |
| 611 |
Definition Fix1_2_1_eq : Fix1_2_1_eq'T := Fix1_2_1_eq'. |
| 612 |
End Fix2_1. |
| 613 |
|
| 614 |
Arguments Fix2_1_Proper_eq {A A' B R Rwf P} _ _ _ _ _ _. |
| 615 |
Arguments Fix2_1_Proper_eq_with_assumption {A A' B R Rwf P} _ _ _ _ _ _ _ _. |
| 616 |
Global Existing Instance Fix2_1_Proper_eq. |
| 617 |
Global Existing Instance Fix2_1_Proper_eq_with_assumption. |
| 618 |
|
| 619 |
Section Fix2_2. |
| 620 |
Context A A' (B : A * A' -> Type) (C : forall a, B a -> Type) |
| 621 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 622 |
(P : forall a b, C a b -> Type). |
| 623 |
|
| 624 |
Local Notation T := (fun a => tele _ (fun b => tele _ (fun _ : @C a b => bottom))). |
| 625 |
|
| 626 |
Let Fix2_2_eq' := @Fix2V_eq A A' T R Rwf P. |
| 627 |
Let Fix2_2_eq'T := Eval simpl in type_of Fix2_2_eq'. |
| 628 |
|
| 629 |
Let Fix2_2_rect' := @Fix2V_rect A A' T R Rwf P. |
| 630 |
Let Fix2_2_rect'T := Eval simpl in type_of Fix2_2_rect'. |
| 631 |
|
| 632 |
Let Fix2_2_Proper_eq' := @Fix2V_Proper_eq A A' T R Rwf P. |
| 633 |
Let Fix2_2_Proper_eq'T := Eval simpl in type_of Fix2_2_Proper_eq'. |
| 634 |
|
| 635 |
Let Fix2_2_Proper_eq_with_assumption' := @Fix2V_Proper_eq_with_assumption A A' T R Rwf P. |
| 636 |
Let Fix2_2_Proper_eq_with_assumption'T := Eval simpl in type_of Fix2_2_Proper_eq_with_assumption'. |
| 637 |
|
| 638 |
Let Fix2_2_2_eq' := @FixV_2V_eq A A' T R Rwf P. |
| 639 |
Let Fix2_2_2_eq'T := Eval simpl in type_of Fix2_2_2_eq'. |
| 640 |
|
| 641 |
Definition Fix2_2_eq : Fix2_2_eq'T := Fix2_2_eq'. |
| 642 |
Definition Fix2_2_rect : Fix2_2_rect'T := Fix2_2_rect'. |
| 643 |
Definition Fix2_2_Proper_eq : Fix2_2_Proper_eq'T := Fix2_2_Proper_eq'. |
| 644 |
Definition Fix2_2_Proper_eq_with_assumption : Fix2_2_Proper_eq_with_assumption'T := Fix2_2_Proper_eq_with_assumption'. |
| 645 |
Definition Fix2_2_2_eq : Fix2_2_2_eq'T := Fix2_2_2_eq'. |
| 646 |
End Fix2_2. |
| 647 |
|
| 648 |
Arguments Fix2_2_Proper_eq {A A' B C R Rwf P} _ _ _ _ _ _ _. |
| 649 |
Arguments Fix2_2_Proper_eq_with_assumption {A A' B C R Rwf P} _ _ _ _ _ _ _ _ _. |
| 650 |
Global Existing Instance Fix2_2_Proper_eq. |
| 651 |
Global Existing Instance Fix2_2_Proper_eq_with_assumption. |
| 652 |
|
| 653 |
Section Fix2_3. |
| 654 |
Context A A' (B : A * A' -> Type) (C : forall a, B a -> Type) (D : forall a b, C a b -> Type) |
| 655 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 656 |
(P : forall a b c, D a b c -> Type). |
| 657 |
|
| 658 |
Local Notation T := (fun a => tele _ (fun b => tele _ (fun c => tele _ (fun _ : @D a b c => bottom)))). |
| 659 |
|
| 660 |
Let Fix2_3_eq' := @Fix2V_eq A A' T R Rwf P. |
| 661 |
Let Fix2_3_eq'T := Eval simpl in type_of Fix2_3_eq'. |
| 662 |
|
| 663 |
Let Fix2_3_rect' := @Fix2V_rect A A' T R Rwf P. |
| 664 |
Let Fix2_3_rect'T := Eval simpl in type_of Fix2_3_rect'. |
| 665 |
|
| 666 |
Let Fix2_3_Proper_eq' := @Fix2V_Proper_eq A A' T R Rwf P. |
| 667 |
Let Fix2_3_Proper_eq'T := Eval simpl in type_of Fix2_3_Proper_eq'. |
| 668 |
|
| 669 |
Let Fix2_3_Proper_eq_with_assumption' := @Fix2V_Proper_eq_with_assumption A A' T R Rwf P. |
| 670 |
Let Fix2_3_Proper_eq_with_assumption'T := Eval simpl in type_of Fix2_3_Proper_eq_with_assumption'. |
| 671 |
|
| 672 |
Let Fix3_2_3_eq' := @FixV_2V_eq A A' T R Rwf P. |
| 673 |
Let Fix3_2_3_eq'T := Eval simpl in type_of Fix3_2_3_eq'. |
| 674 |
|
| 675 |
Definition Fix2_3_eq : Fix2_3_eq'T := Fix2_3_eq'. |
| 676 |
Definition Fix2_3_rect : Fix2_3_rect'T := Fix2_3_rect'. |
| 677 |
Definition Fix2_3_Proper_eq : Fix2_3_Proper_eq'T := Fix2_3_Proper_eq'. |
| 678 |
Definition Fix2_3_Proper_eq_with_assumption : Fix2_3_Proper_eq_with_assumption'T := Fix2_3_Proper_eq_with_assumption'. |
| 679 |
Definition Fix3_2_3_eq : Fix3_2_3_eq'T := Fix3_2_3_eq'. |
| 680 |
End Fix2_3. |
| 681 |
|
| 682 |
Arguments Fix2_3_Proper_eq {A A' B C D R Rwf P} _ _ _ _ _ _ _ _. |
| 683 |
Arguments Fix2_3_Proper_eq_with_assumption {A A' B C D R Rwf P} _ _ _ _ _ _ _ _ _ _. |
| 684 |
Global Existing Instance Fix2_3_Proper_eq. |
| 685 |
Global Existing Instance Fix2_3_Proper_eq_with_assumption. |
| 686 |
|
| 687 |
Section Fix2_4. |
| 688 |
Context A A' (B : A * A' -> Type) (C : forall a, B a -> Type) (D : forall a b, C a b -> Type) (E : forall a b c, D a b c -> Type) |
| 689 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 690 |
(P : forall a b c d, E a b c d -> Type). |
| 691 |
|
| 692 |
Local Notation T := (fun a => tele _ (fun b => tele _ (fun c => tele _ (fun d => tele _ (fun _ : @E a b c d => bottom))))). |
| 693 |
|
| 694 |
Let Fix2_4_eq' := @Fix2V_eq A A' T R Rwf P. |
| 695 |
Let Fix2_4_eq'T := Eval simpl in type_of Fix2_4_eq'. |
| 696 |
|
| 697 |
Let Fix2_4_rect' := @Fix2V_rect A A' T R Rwf P. |
| 698 |
Let Fix2_4_rect'T := Eval simpl in type_of Fix2_4_rect'. |
| 699 |
|
| 700 |
Let Fix2_4_Proper_eq' := @Fix2V_Proper_eq A A' T R Rwf P. |
| 701 |
Let Fix2_4_Proper_eq'T := Eval simpl in type_of Fix2_4_Proper_eq'. |
| 702 |
|
| 703 |
Let Fix2_4_Proper_eq_with_assumption' := @Fix2V_Proper_eq_with_assumption A A' T R Rwf P. |
| 704 |
Let Fix2_4_Proper_eq_with_assumption'T := Eval simpl in type_of Fix2_4_Proper_eq_with_assumption'. |
| 705 |
|
| 706 |
Let Fix4_2_4_eq' := @FixV_2V_eq A A' T R Rwf P. |
| 707 |
Let Fix4_2_4_eq'T := Eval simpl in type_of Fix4_2_4_eq'. |
| 708 |
|
| 709 |
Definition Fix2_4_eq : Fix2_4_eq'T := Fix2_4_eq'. |
| 710 |
Definition Fix2_4_rect : Fix2_4_rect'T := Fix2_4_rect'. |
| 711 |
Definition Fix2_4_Proper_eq : Fix2_4_Proper_eq'T := Fix2_4_Proper_eq'. |
| 712 |
Definition Fix2_4_Proper_eq_with_assumption : Fix2_4_Proper_eq_with_assumption'T := Fix2_4_Proper_eq_with_assumption'. |
| 713 |
Definition Fix4_2_4_eq : Fix4_2_4_eq'T := Fix4_2_4_eq'. |
| 714 |
End Fix2_4. |
| 715 |
|
| 716 |
Arguments Fix2_4_Proper_eq {A A' B C D E R Rwf P} _ _ _ _ _ _ _ _ _. |
| 717 |
Arguments Fix2_4_Proper_eq_with_assumption {A A' B C D E R Rwf P} _ _ _ _ _ _ _ _ _ _ _. |
| 718 |
Global Existing Instance Fix2_4_Proper_eq. |
| 719 |
Global Existing Instance Fix2_4_Proper_eq_with_assumption. |
| 720 |
|
| 721 |
Section Fix2_5. |
| 722 |
Context A A' (B : A * A' -> Type) (C : forall a, B a -> Type) (D : forall a b, C a b -> Type) (E : forall a b c, D a b c -> Type) (F : forall a b c d, E a b c d -> Type) |
| 723 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 724 |
(P : forall a b c d e, F a b c d e -> Type). |
| 725 |
|
| 726 |
Local Notation T := (fun a => tele _ (fun b => tele _ (fun c => tele _ (fun d => tele _ (fun e => tele _ (fun _ : @F a b c d e => bottom)))))). |
| 727 |
|
| 728 |
Let Fix2_5_eq' := @Fix2V_eq A A' T R Rwf P. |
| 729 |
Let Fix2_5_eq'T := Eval simpl in type_of Fix2_5_eq'. |
| 730 |
|
| 731 |
Let Fix2_5_rect' := @Fix2V_rect A A' T R Rwf P. |
| 732 |
Let Fix2_5_rect'T := Eval simpl in type_of Fix2_5_rect'. |
| 733 |
|
| 734 |
Let Fix2_5_Proper_eq' := @Fix2V_Proper_eq A A' T R Rwf P. |
| 735 |
Let Fix2_5_Proper_eq'T := Eval simpl in type_of Fix2_5_Proper_eq'. |
| 736 |
|
| 737 |
Let Fix2_5_Proper_eq_with_assumption' := @Fix2V_Proper_eq_with_assumption A A' T R Rwf P. |
| 738 |
Let Fix2_5_Proper_eq_with_assumption'T := Eval simpl in type_of Fix2_5_Proper_eq_with_assumption'. |
| 739 |
|
| 740 |
Let Fix5_2_5_eq' := @FixV_2V_eq A A' T R Rwf P. |
| 741 |
Let Fix5_2_5_eq'T := Eval simpl in type_of Fix5_2_5_eq'. |
| 742 |
|
| 743 |
Definition Fix2_5_eq : Fix2_5_eq'T := Fix2_5_eq'. |
| 744 |
Definition Fix2_5_rect : Fix2_5_rect'T := Fix2_5_rect'. |
| 745 |
Definition Fix2_5_Proper_eq : Fix2_5_Proper_eq'T := Fix2_5_Proper_eq'. |
| 746 |
Definition Fix2_5_Proper_eq_with_assumption : Fix2_5_Proper_eq_with_assumption'T := Fix2_5_Proper_eq_with_assumption'. |
| 747 |
Definition Fix5_2_5_eq : Fix5_2_5_eq'T := Fix5_2_5_eq'. |
| 748 |
End Fix2_5. |
| 749 |
|
| 750 |
Arguments Fix2_5_Proper_eq {A A' B C D E F R Rwf P} _ _ _ _ _ _ _ _ _ _. |
| 751 |
Arguments Fix2_5_Proper_eq_with_assumption {A A' B C D E F R Rwf P} _ _ _ _ _ _ _ _ _ _ _ _. |
| 752 |
Global Existing Instance Fix2_5_Proper_eq. |
| 753 |
Global Existing Instance Fix2_5_Proper_eq_with_assumption. |
| 754 |
|
| 755 |
Section Fix2_6. |
| 756 |
Context A A' (B : A * A' -> Type) (C : forall a, B a -> Type) (D : forall a b, C a b -> Type) (E : forall a b c, D a b c -> Type) (F : forall a b c d, E a b c d -> Type) (G : forall a b c d e, F a b c d e -> Type) |
| 757 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 758 |
(P : forall a b c d e f, G a b c d e f -> Type). |
| 759 |
|
| 760 |
Local Notation T := (fun a => tele _ (fun b => tele _ (fun c => tele _ (fun d => tele _ (fun e => tele _ (fun f => tele _ (fun _ : @G a b c d e f => bottom))))))). |
| 761 |
|
| 762 |
Let Fix2_6_eq' := @Fix2V_eq A A' T R Rwf P. |
| 763 |
Let Fix2_6_eq'T := Eval simpl in type_of Fix2_6_eq'. |
| 764 |
|
| 765 |
Let Fix2_6_rect' := @Fix2V_rect A A' T R Rwf P. |
| 766 |
Let Fix2_6_rect'T := Eval simpl in type_of Fix2_6_rect'. |
| 767 |
|
| 768 |
Let Fix2_6_Proper_eq' := @Fix2V_Proper_eq A A' T R Rwf P. |
| 769 |
Let Fix2_6_Proper_eq'T := Eval simpl in type_of Fix2_6_Proper_eq'. |
| 770 |
|
| 771 |
Let Fix2_6_Proper_eq_with_assumption' := @Fix2V_Proper_eq_with_assumption A A' T R Rwf P. |
| 772 |
Let Fix2_6_Proper_eq_with_assumption'T := Eval simpl in type_of Fix2_6_Proper_eq_with_assumption'. |
| 773 |
|
| 774 |
Let Fix6_2_6_eq' := @FixV_2V_eq A A' T R Rwf P. |
| 775 |
Let Fix6_2_6_eq'T := Eval simpl in type_of Fix6_2_6_eq'. |
| 776 |
|
| 777 |
Definition Fix2_6_eq : Fix2_6_eq'T := Fix2_6_eq'. |
| 778 |
Definition Fix2_6_rect : Fix2_6_rect'T := Fix2_6_rect'. |
| 779 |
Definition Fix2_6_Proper_eq : Fix2_6_Proper_eq'T := Fix2_6_Proper_eq'. |
| 780 |
Definition Fix2_6_Proper_eq_with_assumption : Fix2_6_Proper_eq_with_assumption'T := Fix2_6_Proper_eq_with_assumption'. |
| 781 |
Definition Fix6_2_6_eq : Fix6_2_6_eq'T := Fix6_2_6_eq'. |
| 782 |
End Fix2_6. |
| 783 |
|
| 784 |
Arguments Fix2_6_Proper_eq {A A' B C D E F G R Rwf P} _ _ _ _ _ _ _ _ _ _ _. |
| 785 |
Arguments Fix2_6_Proper_eq_with_assumption {A A' B C D E F G R Rwf P} _ _ _ _ _ _ _ _ _ _ _ _ _. |
| 786 |
Global Existing Instance Fix2_6_Proper_eq. |
| 787 |
Global Existing Instance Fix2_6_Proper_eq_with_assumption. |
| 788 |
|
| 789 |
Section Fix2_7. |
| 790 |
Context A A' (B : A * A' -> Type) (C : forall a, B a -> Type) (D : forall a b, C a b -> Type) (E : forall a b c, D a b c -> Type) (F : forall a b c d, E a b c d -> Type) (G : forall a b c d e, F a b c d e -> Type) (H : forall a b c d e f, G a b c d e f -> Type) |
| 791 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 792 |
(P : forall a b c d e f g, H a b c d e f g -> Type). |
| 793 |
|
| 794 |
Local Notation T := (fun a => tele _ (fun b => tele _ (fun c => tele _ (fun d => tele _ (fun e => tele _ (fun f => tele _ (fun g => tele _ (fun _ : @H a b c d e f g => bottom)))))))). |
| 795 |
|
| 796 |
Let Fix2_7_eq' := @Fix2V_eq A A' T R Rwf P. |
| 797 |
Let Fix2_7_eq'T := Eval simpl in type_of Fix2_7_eq'. |
| 798 |
|
| 799 |
Let Fix2_7_rect' := @Fix2V_rect A A' T R Rwf P. |
| 800 |
Let Fix2_7_rect'T := Eval simpl in type_of Fix2_7_rect'. |
| 801 |
|
| 802 |
Let Fix2_7_Proper_eq' := @Fix2V_Proper_eq A A' T R Rwf P. |
| 803 |
Let Fix2_7_Proper_eq'T := Eval simpl in type_of Fix2_7_Proper_eq'. |
| 804 |
|
| 805 |
Let Fix2_7_Proper_eq_with_assumption' := @Fix2V_Proper_eq_with_assumption A A' T R Rwf P. |
| 806 |
Let Fix2_7_Proper_eq_with_assumption'T := Eval simpl in type_of Fix2_7_Proper_eq_with_assumption'. |
| 807 |
|
| 808 |
Let Fix7_2_7_eq' := @FixV_2V_eq A A' T R Rwf P. |
| 809 |
Let Fix7_2_7_eq'T := Eval simpl in type_of Fix7_2_7_eq'. |
| 810 |
|
| 811 |
Definition Fix2_7_eq : Fix2_7_eq'T := Fix2_7_eq'. |
| 812 |
Definition Fix2_7_rect : Fix2_7_rect'T := Fix2_7_rect'. |
| 813 |
Definition Fix2_7_Proper_eq : Fix2_7_Proper_eq'T := Fix2_7_Proper_eq'. |
| 814 |
Definition Fix2_7_Proper_eq_with_assumption : Fix2_7_Proper_eq_with_assumption'T := Fix2_7_Proper_eq_with_assumption'. |
| 815 |
Definition Fix7_2_7_eq : Fix7_2_7_eq'T := Fix7_2_7_eq'. |
| 816 |
End Fix2_7. |
| 817 |
|
| 818 |
Arguments Fix2_7_Proper_eq {A A' B C D E F G H R Rwf P} _ _ _ _ _ _ _ _ _ _ _ _. |
| 819 |
Arguments Fix2_7_Proper_eq_with_assumption {A A' B C D E F G H R Rwf P} _ _ _ _ _ _ _ _ _ _ _ _ _ _. |
| 820 |
Global Existing Instance Fix2_7_Proper_eq. |
| 821 |
Global Existing Instance Fix2_7_Proper_eq_with_assumption. |
| 822 |
|
| 823 |
Section Fix2_8. |
| 824 |
Context A A' (B : A * A' -> Type) (C : forall a, B a -> Type) (D : forall a b, C a b -> Type) (E : forall a b c, D a b c -> Type) (F : forall a b c d, E a b c d -> Type) (G : forall a b c d e, F a b c d e -> Type) (H : forall a b c d e f, G a b c d e f -> Type) (I : forall a b c d e f g, H a b c d e f g -> Type) |
| 825 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 826 |
(P : forall a b c d e f g h, I a b c d e f g h -> Type). |
| 827 |
|
| 828 |
Local Notation T := (fun a => tele _ (fun b => tele _ (fun c => tele _ (fun d => tele _ (fun e => tele _ (fun f => tele _ (fun g => tele _ (fun h => tele _ (fun _ : @I a b c d e f g h => bottom))))))))). |
| 829 |
|
| 830 |
Let Fix2_8_eq' := @Fix2V_eq A A' T R Rwf P. |
| 831 |
Let Fix2_8_eq'T := Eval simpl in type_of Fix2_8_eq'. |
| 832 |
|
| 833 |
Let Fix2_8_rect' := @Fix2V_rect A A' T R Rwf P. |
| 834 |
Let Fix2_8_rect'T := Eval simpl in type_of Fix2_8_rect'. |
| 835 |
|
| 836 |
Let Fix2_8_Proper_eq' := @Fix2V_Proper_eq A A' T R Rwf P. |
| 837 |
Let Fix2_8_Proper_eq'T := Eval simpl in type_of Fix2_8_Proper_eq'. |
| 838 |
|
| 839 |
Let Fix2_8_Proper_eq_with_assumption' := @Fix2V_Proper_eq_with_assumption A A' T R Rwf P. |
| 840 |
Let Fix2_8_Proper_eq_with_assumption'T := Eval simpl in type_of Fix2_8_Proper_eq_with_assumption'. |
| 841 |
|
| 842 |
Let Fix8_2_8_eq' := @FixV_2V_eq A A' T R Rwf P. |
| 843 |
Let Fix8_2_8_eq'T := Eval simpl in type_of Fix8_2_8_eq'. |
| 844 |
|
| 845 |
Definition Fix2_8_eq : Fix2_8_eq'T := Fix2_8_eq'. |
| 846 |
Definition Fix2_8_rect : Fix2_8_rect'T := Fix2_8_rect'. |
| 847 |
Definition Fix2_8_Proper_eq : Fix2_8_Proper_eq'T := Fix2_8_Proper_eq'. |
| 848 |
Definition Fix2_8_Proper_eq_with_assumption : Fix2_8_Proper_eq_with_assumption'T := Fix2_8_Proper_eq_with_assumption'. |
| 849 |
Definition Fix8_2_8_eq : Fix8_2_8_eq'T := Fix8_2_8_eq'. |
| 850 |
End Fix2_8. |
| 851 |
|
| 852 |
Arguments Fix2_8_Proper_eq {A A' B C D E F G H I R Rwf P} _ _ _ _ _ _ _ _ _ _ _ _ _. |
| 853 |
Arguments Fix2_8_Proper_eq_with_assumption {A A' B C D E F G H I R Rwf P} _ _ _ _ _ _ _ _ _ _ _ _ _ _ _. |
| 854 |
Global Existing Instance Fix2_8_Proper_eq. |
| 855 |
Global Existing Instance Fix2_8_Proper_eq_with_assumption. |
| 856 |
|
| 857 |
Section Fix2_9. |
| 858 |
Context A A' (B : A * A' -> Type) (C : forall a, B a -> Type) (D : forall a b, C a b -> Type) (E : forall a b c, D a b c -> Type) (F : forall a b c d, E a b c d -> Type) (G : forall a b c d e, F a b c d e -> Type) (H : forall a b c d e f, G a b c d e f -> Type) (I : forall a b c d e f g, H a b c d e f g -> Type) (J : forall a b c d e f g h, I a b c d e f g h -> Type) |
| 859 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 860 |
(P : forall a b c d e f g h i, J a b c d e f g h i -> Type). |
| 861 |
|
| 862 |
Local Notation T := (fun a => tele _ (fun b => tele _ (fun c => tele _ (fun d => tele _ (fun e => tele _ (fun f => tele _ (fun g => tele _ (fun h => tele _ (fun i => tele _ (fun _ : @J a b c d e f g h i => bottom)))))))))). |
| 863 |
|
| 864 |
Let Fix2_9_eq' := @Fix2V_eq A A' T R Rwf P. |
| 865 |
Let Fix2_9_eq'T := Eval simpl in type_of Fix2_9_eq'. |
| 866 |
|
| 867 |
Let Fix2_9_rect' := @Fix2V_rect A A' T R Rwf P. |
| 868 |
Let Fix2_9_rect'T := Eval simpl in type_of Fix2_9_rect'. |
| 869 |
|
| 870 |
Let Fix2_9_Proper_eq' := @Fix2V_Proper_eq A A' T R Rwf P. |
| 871 |
Let Fix2_9_Proper_eq'T := Eval simpl in type_of Fix2_9_Proper_eq'. |
| 872 |
|
| 873 |
Let Fix2_9_Proper_eq_with_assumption' := @Fix2V_Proper_eq_with_assumption A A' T R Rwf P. |
| 874 |
Let Fix2_9_Proper_eq_with_assumption'T := Eval simpl in type_of Fix2_9_Proper_eq_with_assumption'. |
| 875 |
|
| 876 |
Let Fix9_2_9_eq' := @FixV_2V_eq A A' T R Rwf P. |
| 877 |
Let Fix9_2_9_eq'T := Eval simpl in type_of Fix9_2_9_eq'. |
| 878 |
|
| 879 |
Definition Fix2_9_eq : Fix2_9_eq'T := Fix2_9_eq'. |
| 880 |
Definition Fix2_9_rect : Fix2_9_rect'T := Fix2_9_rect'. |
| 881 |
Definition Fix2_9_Proper_eq : Fix2_9_Proper_eq'T := Fix2_9_Proper_eq'. |
| 882 |
Definition Fix2_9_Proper_eq_with_assumption : Fix2_9_Proper_eq_with_assumption'T := Fix2_9_Proper_eq_with_assumption'. |
| 883 |
Definition Fix9_2_9_eq : Fix9_2_9_eq'T := Fix9_2_9_eq'. |
| 884 |
End Fix2_9. |
| 885 |
|
| 886 |
Arguments Fix2_9_Proper_eq {A A' B C D E F G H I J R Rwf P} _ _ _ _ _ _ _ _ _ _ _ _ _ _. |
| 887 |
Arguments Fix2_9_Proper_eq_with_assumption {A A' B C D E F G H I J R Rwf P} _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _. |
| 888 |
Global Existing Instance Fix2_9_Proper_eq. |
| 889 |
Global Existing Instance Fix2_9_Proper_eq_with_assumption. |
| 890 |
|
| 891 |
Section Fix2_10. |
| 892 |
Context A A' (B : A * A' -> Type) (C : forall a, B a -> Type) (D : forall a b, C a b -> Type) (E : forall a b c, D a b c -> Type) (F : forall a b c d, E a b c d -> Type) (G : forall a b c d e, F a b c d e -> Type) (H : forall a b c d e f, G a b c d e f -> Type) (I : forall a b c d e f g, H a b c d e f g -> Type) (J : forall a b c d e f g h, I a b c d e f g h -> Type) (K : forall a b c d e f g h i, J a b c d e f g h i -> Type) |
| 893 |
(R : A * A' -> A * A' -> Prop) (Rwf : well_founded R) |
| 894 |
(P : forall a b c d e f g h i j, K a b c d e f g h i j -> Type). |
| 895 |
|
| 896 |
Local Notation T := (fun a => tele _ (fun b => tele _ (fun c => tele _ (fun d => tele _ (fun e => tele _ (fun f => tele _ (fun g => tele _ (fun h => tele _ (fun i => tele _ (fun j => tele _ (fun _ : @K a b c d e f g h i j => bottom))))))))))). |
| 897 |
|
| 898 |
Let Fix2_10_eq' := @Fix2V_eq A A' T R Rwf P. |
| 899 |
Let Fix2_10_eq'T := Eval simpl in type_of Fix2_10_eq'. |
| 900 |
|
| 901 |
Let Fix2_10_rect' := @Fix2V_rect A A' T R Rwf P. |
| 902 |
Let Fix2_10_rect'T := Eval simpl in type_of Fix2_10_rect'. |
| 903 |
|
| 904 |
Let Fix2_10_Proper_eq' := @Fix2V_Proper_eq A A' T R Rwf P. |
| 905 |
Let Fix2_10_Proper_eq'T := Eval simpl in type_of Fix2_10_Proper_eq'. |
| 906 |
|
| 907 |
Let Fix2_10_Proper_eq_with_assumption' := @Fix2V_Proper_eq_with_assumption A A' T R Rwf P. |
| 908 |
Let Fix2_10_Proper_eq_with_assumption'T := Eval simpl in type_of Fix2_10_Proper_eq_with_assumption'. |
| 909 |
|
| 910 |
Let Fix10_2_10_eq' := @FixV_2V_eq A A' T R Rwf P. |
| 911 |
Let Fix10_2_10_eq'T := Eval simpl in type_of Fix10_2_10_eq'. |
| 912 |
|
| 913 |
Definition Fix2_10_eq : Fix2_10_eq'T := Fix2_10_eq'. |
| 914 |
Definition Fix2_10_rect : Fix2_10_rect'T := Fix2_10_rect'. |
| 915 |
Definition Fix2_10_Proper_eq : Fix2_10_Proper_eq'T := Fix2_10_Proper_eq'. |
| 916 |
Definition Fix2_10_Proper_eq_with_assumption : Fix2_10_Proper_eq_with_assumption'T := Fix2_10_Proper_eq_with_assumption'. |
| 917 |
Definition Fix10_2_10_eq : Fix10_2_10_eq'T := Fix10_2_10_eq'. |
| 918 |
End Fix2_10. |
| 919 |
|
| 920 |
Arguments Fix2_10_Proper_eq {A A' B C D E F G H I J K R Rwf P} _ _ _ _ _ _ _ _ _ _ _ _ _ _ _. |
| 921 |
Arguments Fix2_10_Proper_eq_with_assumption {A A' B C D E F G H I J K R Rwf P} _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _. |
| 922 |
Global Existing Instance Fix2_10_Proper_eq. |
| 923 |
Global Existing Instance Fix2_10_Proper_eq_with_assumption. |