| 1 |
(* Check forward dependencies *) |
| 2 |
|
| 3 |
Check |
| 4 |
(fun (P : nat -> Prop) Q (A : P 0 -> Q) (B : forall n : nat, P (S n) -> Q) |
| 5 |
x => |
| 6 |
match x return Q with |
| 7 |
| exist _ O H => A H |
| 8 |
| exist _ (S n) H => B n H |
| 9 |
end). |
| 10 |
|
| 11 |
(* Check dependencies in anonymous arguments (from FTA/listn.v) *) |
| 12 |
|
| 13 |
Inductive listn (A : Set) : nat -> Set := |
| 14 |
| niln : listn A 0 |
| 15 |
| consn : forall (a : A) (n : nat), listn A n -> listn A (S n). |
| 16 |
|
| 17 |
Section Folding. |
| 18 |
Variable B C : Set. |
| 19 |
Variable g : B -> C -> C. |
| 20 |
Variable c : C. |
| 21 |
|
| 22 |
Fixpoint foldrn (n : nat) (bs : listn B n) {struct bs} : C := |
| 23 |
match bs with |
| 24 |
| niln _ => c |
| 25 |
| consn _ b _ tl => g b (foldrn _ tl) |
| 26 |
end. |
| 27 |
End Folding. |
| 28 |
|
| 29 |
(** Testing post-processing of nested dependencies *) |
| 30 |
|
| 31 |
Check fun x:{x|x=0}*nat+nat => match x with |
| 32 |
| inl ((exist _ 0 eq_refl),0) => None |
| 33 |
| _ => Some 0 |
| 34 |
end. |
| 35 |
|
| 36 |
Check fun x:{_:{x|x=0}|True}+nat => match x with |
| 37 |
| inl (exist _ (exist _ 0 eq_refl) I) => None |
| 38 |
| _ => Some 0 |
| 39 |
end. |
| 40 |
|
| 41 |
Check fun x:{_:{x|x=0}|True}+nat => match x with |
| 42 |
| inl (exist _ (exist _ 0 eq_refl) I) => None |
| 43 |
| _ => Some 0 |
| 44 |
end. |
| 45 |
|
| 46 |
Check fun x:{_:{x|x=0}|True}+nat => match x return option nat with |
| 47 |
| inl (exist _ (exist _ 0 eq_refl) I) => None |
| 48 |
| _ => Some 0 |
| 49 |
end. |
| 50 |
|
| 51 |
(* the next two examples were failing from r14703 (Nov 22 2011) to r14732 *) |
| 52 |
(* due to a bug in dependencies postprocessing (revealed by CoLoR) *) |
| 53 |
|
| 54 |
Check fun x:{x:nat*nat|fst x = 0 & True} => match x return option nat with |
| 55 |
| exist2 _ _ (x,y) eq_refl I => None |
| 56 |
end. |
| 57 |
|
| 58 |
Check fun x:{_:{x:nat*nat|fst x = 0 & True}|True}+nat => match x return option nat with |
| 59 |
| inl (exist _ (exist2 _ _ (x,y) eq_refl I) I) => None |
| 60 |
| _ => Some 0 |
| 61 |
end. |
| 62 |
|
| 63 |
(* -------------------------------------------------------------------- *) |
| 64 |
(* Example to test patterns matching on dependent families *) |
| 65 |
(* This exemple extracted from the development done by Nacira Chabane *) |
| 66 |
(* (equipe Paris 6) *) |
| 67 |
(* -------------------------------------------------------------------- *) |
| 68 |
|
| 69 |
|
| 70 |
Require Import Prelude. |
| 71 |
|
| 72 |
Section Orderings. |
| 73 |
Variable U : Type. |
| 74 |
|
| 75 |
Definition Relation := U -> U -> Prop. |
| 76 |
|
| 77 |
Variable R : Relation. |
| 78 |
|
| 79 |
Definition Reflexive : Prop := forall x : U, R x x. |
| 80 |
|
| 81 |
Definition Transitive : Prop := forall x y z : U, R x y -> R y z -> R x z. |
| 82 |
|
| 83 |
Definition Symmetric : Prop := forall x y : U, R x y -> R y x. |
| 84 |
|
| 85 |
Definition Antisymmetric : Prop := forall x y : U, R x y -> R y x -> x = y. |
| 86 |
|
| 87 |
Definition contains (R R' : Relation) : Prop := |
| 88 |
forall x y : U, R' x y -> R x y. |
| 89 |
Definition same_relation (R R' : Relation) : Prop := |
| 90 |
contains R R' /\ contains R' R. |
| 91 |
Inductive Equivalence : Prop := |
| 92 |
Build_Equivalence : Reflexive -> Transitive -> Symmetric -> Equivalence. |
| 93 |
|
| 94 |
Inductive PER : Prop := |
| 95 |
Build_PER : Symmetric -> Transitive -> PER. |
| 96 |
|
| 97 |
End Orderings. |
| 98 |
|
| 99 |
(***** Setoid *******) |
| 100 |
|
| 101 |
Inductive Setoid : Type := |
| 102 |
Build_Setoid : |
| 103 |
forall (S : Type) (R : Relation S), Equivalence _ R -> Setoid. |
| 104 |
|
| 105 |
Definition elem (A : Setoid) := let (S, R, e) := A in S. |
| 106 |
|
| 107 |
Definition equal (A : Setoid) := |
| 108 |
let (S, R, e) as s return (Relation (elem s)) := A in R. |
| 109 |
|
| 110 |
|
| 111 |
Axiom prf_equiv : forall A : Setoid, Equivalence (elem A) (equal A). |
| 112 |
Axiom prf_refl : forall A : Setoid, Reflexive (elem A) (equal A). |
| 113 |
Axiom prf_sym : forall A : Setoid, Symmetric (elem A) (equal A). |
| 114 |
Axiom prf_trans : forall A : Setoid, Transitive (elem A) (equal A). |
| 115 |
|
| 116 |
Section Maps. |
| 117 |
Variable A B : Setoid. |
| 118 |
|
| 119 |
Definition Map_law (f : elem A -> elem B) := |
| 120 |
forall x y : elem A, equal _ x y -> equal _ (f x) (f y). |
| 121 |
|
| 122 |
Inductive Map : Type := |
| 123 |
Build_Map : forall (f : elem A -> elem B) (p : Map_law f), Map. |
| 124 |
|
| 125 |
Definition explicit_ap (m : Map) := |
| 126 |
match m return (elem A -> elem B) with |
| 127 |
| Build_Map f p => f |
| 128 |
end. |
| 129 |
|
| 130 |
Axiom pres : forall m : Map, Map_law (explicit_ap m). |
| 131 |
|
| 132 |
Definition ext (f g : Map) := |
| 133 |
forall x : elem A, equal _ (explicit_ap f x) (explicit_ap g x). |
| 134 |
|
| 135 |
Axiom Equiv_map_eq : Equivalence Map ext. |
| 136 |
|
| 137 |
Definition Map_setoid := Build_Setoid Map ext Equiv_map_eq. |
| 138 |
|
| 139 |
End Maps. |
| 140 |
|
| 141 |
Notation ap := (explicit_ap _ _). |
| 142 |
|
| 143 |
(* <Warning> : Grammar is replaced by Notation *) |
| 144 |
|
| 145 |
|
| 146 |
Definition ap2 (A B C : Setoid) (f : elem (Map_setoid A (Map_setoid B C))) |
| 147 |
(a : elem A) := ap (ap f a). |
| 148 |
|
| 149 |
|
| 150 |
(***** posint ******) |
| 151 |
|
| 152 |
Inductive posint : Type := |
| 153 |
| Z : posint |
| 154 |
| Suc : posint -> posint. |
| 155 |
|
| 156 |
Axiom |
| 157 |
f_equal : forall (A B : Type) (f : A -> B) (x y : A), x = y -> f x = f y. |
| 158 |
Axiom eq_Suc : forall n m : posint, n = m -> Suc n = Suc m. |
| 159 |
|
| 160 |
(* The predecessor function *) |
| 161 |
|
| 162 |
Definition pred (n : posint) : posint := |
| 163 |
match n return posint with |
| 164 |
| Z => (* Z *) Z |
| 165 |
(* Suc u *) |
| 166 |
| Suc u => u |
| 167 |
end. |
| 168 |
|
| 169 |
Axiom pred_Sucn : forall m : posint, m = pred (Suc m). |
| 170 |
Axiom eq_add_Suc : forall n m : posint, Suc n = Suc m -> n = m. |
| 171 |
Axiom not_eq_Suc : forall n m : posint, n <> m -> Suc n <> Suc m. |
| 172 |
|
| 173 |
|
| 174 |
Definition IsSuc (n : posint) : Prop := |
| 175 |
match n return Prop with |
| 176 |
| Z => (* Z *) False |
| 177 |
(* Suc p *) |
| 178 |
| Suc p => True |
| 179 |
end. |
| 180 |
Definition IsZero (n : posint) : Prop := |
| 181 |
match n with |
| 182 |
| Z => True |
| 183 |
| Suc _ => False |
| 184 |
end. |
| 185 |
|
| 186 |
Axiom Z_Suc : forall n : posint, Z <> Suc n. |
| 187 |
Axiom Suc_Z : forall n : posint, Suc n <> Z. |
| 188 |
Axiom n_Sucn : forall n : posint, n <> Suc n. |
| 189 |
Axiom Sucn_n : forall n : posint, Suc n <> n. |
| 190 |
Axiom eqT_symt : forall a b : posint, a <> b -> b <> a. |
| 191 |
|
| 192 |
|
| 193 |
(******* Dsetoid *****) |
| 194 |
|
| 195 |
Definition Decidable (A : Type) (R : Relation A) := |
| 196 |
forall x y : A, R x y \/ ~ R x y. |
| 197 |
|
| 198 |
|
| 199 |
Record DSetoid : Type := |
| 200 |
{Set_of : Setoid; prf_decid : Decidable (elem Set_of) (equal Set_of)}. |
| 201 |
|
| 202 |
(* example de Dsetoide d'entiers *) |
| 203 |
|
| 204 |
|
| 205 |
Axiom eqT_equiv : Equivalence posint (eq (A:=posint)). |
| 206 |
Axiom Eq_posint_deci : Decidable posint (eq (A:=posint)). |
| 207 |
|
| 208 |
(* Dsetoide des posint*) |
| 209 |
|
| 210 |
Definition Set_of_posint := Build_Setoid posint (eq (A:=posint)) eqT_equiv. |
| 211 |
|
| 212 |
Definition Dposint := Build_DSetoid Set_of_posint Eq_posint_deci. |
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
(**************************************) |
| 217 |
|
| 218 |
|
| 219 |
(* Definition des signatures *) |
| 220 |
(* une signature est un ensemble d'operateurs muni |
| 221 |
de l'arite de chaque operateur *) |
| 222 |
|
| 223 |
|
| 224 |
Module Sig. |
| 225 |
|
| 226 |
Record Signature : Type := |
| 227 |
{Sigma : DSetoid; Arity : Map (Set_of Sigma) (Set_of Dposint)}. |
| 228 |
|
| 229 |
Parameter S : Signature. |
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
Parameter Var : DSetoid. |
| 234 |
|
| 235 |
Inductive TERM : Type := |
| 236 |
| var : elem (Set_of Var) -> TERM |
| 237 |
| oper : |
| 238 |
forall op : elem (Set_of (Sigma S)), LTERM (ap (Arity S) op) -> TERM |
| 239 |
with LTERM : posint -> Type := |
| 240 |
| nil : LTERM Z |
| 241 |
| cons : TERM -> forall n : posint, LTERM n -> LTERM (Suc n). |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
(* -------------------------------------------------------------------- *) |
| 246 |
(* Examples *) |
| 247 |
(* -------------------------------------------------------------------- *) |
| 248 |
|
| 249 |
|
| 250 |
Parameter t1 t2 : TERM. |
| 251 |
|
| 252 |
Type |
| 253 |
match t1, t2 with |
| 254 |
| var v1, var v2 => True |
| 255 |
| oper op1 l1, oper op2 l2 => False |
| 256 |
| _, _ => False |
| 257 |
end. |
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
Parameter n2 : posint. |
| 262 |
Parameter l1 l2 : LTERM n2. |
| 263 |
|
| 264 |
Type |
| 265 |
match l1, l2 with |
| 266 |
| nil, nil => True |
| 267 |
| cons v m y, nil => False |
| 268 |
| _, _ => False |
| 269 |
end. |
| 270 |
|
| 271 |
|
| 272 |
Type |
| 273 |
match l1, l2 with |
| 274 |
| nil, nil => True |
| 275 |
| cons u n x, cons v m y => False |
| 276 |
| _, _ => False |
| 277 |
end. |
| 278 |
|
| 279 |
Module Type Version1. |
| 280 |
|
| 281 |
Definition equalT (t1 t2 : TERM) : Prop := |
| 282 |
match t1, t2 with |
| 283 |
| var v1, var v2 => True |
| 284 |
| oper op1 l1, oper op2 l2 => False |
| 285 |
| _, _ => False |
| 286 |
end. |
| 287 |
|
| 288 |
Definition EqListT (n1 : posint) (l1 : LTERM n1) (n2 : posint) |
| 289 |
(l2 : LTERM n2) : Prop := |
| 290 |
match l1, l2 with |
| 291 |
| nil, nil => True |
| 292 |
| cons t1 n1' l1', cons t2 n2' l2' => False |
| 293 |
| _, _ => False |
| 294 |
end. |
| 295 |
|
| 296 |
End Version1. |
| 297 |
|
| 298 |
|
| 299 |
(* ------------------------------------------------------------------*) |
| 300 |
(* Initial example (without patterns) *) |
| 301 |
(*-------------------------------------------------------------------*) |
| 302 |
|
| 303 |
Module Version2. |
| 304 |
|
| 305 |
Fixpoint equalT (t1 : TERM) : TERM -> Prop := |
| 306 |
match t1 return (TERM -> Prop) with |
| 307 |
| var v1 => |
| 308 |
(*var*) |
| 309 |
fun t2 : TERM => |
| 310 |
match t2 return Prop with |
| 311 |
| var v2 => |
| 312 |
(*var*) equal _ v1 v2 |
| 313 |
(*oper*) |
| 314 |
| oper op2 _ => False |
| 315 |
end |
| 316 |
(*oper*) |
| 317 |
| oper op1 l1 => |
| 318 |
fun t2 : TERM => |
| 319 |
match t2 return Prop with |
| 320 |
| var v2 => |
| 321 |
(*var*) False |
| 322 |
(*oper*) |
| 323 |
| oper op2 l2 => |
| 324 |
equal _ op1 op2 /\ |
| 325 |
EqListT (ap (Arity S) op1) l1 (ap (Arity S) op2) l2 |
| 326 |
end |
| 327 |
end |
| 328 |
|
| 329 |
with EqListT (n1 : posint) (l1 : LTERM n1) {struct l1} : |
| 330 |
forall n2 : posint, LTERM n2 -> Prop := |
| 331 |
match l1 in (LTERM _) return (forall n2 : posint, LTERM n2 -> Prop) with |
| 332 |
| nil => |
| 333 |
(*nil*) |
| 334 |
fun (n2 : posint) (l2 : LTERM n2) => |
| 335 |
match l2 in (LTERM _) return Prop with |
| 336 |
| nil => |
| 337 |
(*nil*) True |
| 338 |
(*cons*) |
| 339 |
| cons t2 n2' l2' => False |
| 340 |
end |
| 341 |
(*cons*) |
| 342 |
| cons t1 n1' l1' => |
| 343 |
fun (n2 : posint) (l2 : LTERM n2) => |
| 344 |
match l2 in (LTERM _) return Prop with |
| 345 |
| nil => |
| 346 |
(*nil*) False |
| 347 |
(*cons*) |
| 348 |
| cons t2 n2' l2' => equalT t1 t2 /\ EqListT n1' l1' n2' l2' |
| 349 |
end |
| 350 |
end. |
| 351 |
|
| 352 |
End Version2. |
| 353 |
|
| 354 |
(* ---------------------------------------------------------------- *) |
| 355 |
(* Version with simple patterns *) |
| 356 |
(* ---------------------------------------------------------------- *) |
| 357 |
|
| 358 |
Module Version3. |
| 359 |
|
| 360 |
Fixpoint equalT (t1 : TERM) : TERM -> Prop := |
| 361 |
match t1 with |
| 362 |
| var v1 => |
| 363 |
fun t2 : TERM => |
| 364 |
match t2 with |
| 365 |
| var v2 => equal _ v1 v2 |
| 366 |
| oper op2 _ => False |
| 367 |
end |
| 368 |
| oper op1 l1 => |
| 369 |
fun t2 : TERM => |
| 370 |
match t2 with |
| 371 |
| var _ => False |
| 372 |
| oper op2 l2 => |
| 373 |
equal _ op1 op2 /\ |
| 374 |
EqListT (ap (Arity S) op1) l1 (ap (Arity S) op2) l2 |
| 375 |
end |
| 376 |
end |
| 377 |
|
| 378 |
with EqListT (n1 : posint) (l1 : LTERM n1) {struct l1} : |
| 379 |
forall n2 : posint, LTERM n2 -> Prop := |
| 380 |
match l1 return (forall n2 : posint, LTERM n2 -> Prop) with |
| 381 |
| nil => |
| 382 |
fun (n2 : posint) (l2 : LTERM n2) => |
| 383 |
match l2 with |
| 384 |
| nil => True |
| 385 |
| _ => False |
| 386 |
end |
| 387 |
| cons t1 n1' l1' => |
| 388 |
fun (n2 : posint) (l2 : LTERM n2) => |
| 389 |
match l2 with |
| 390 |
| nil => False |
| 391 |
| cons t2 n2' l2' => equalT t1 t2 /\ EqListT n1' l1' n2' l2' |
| 392 |
end |
| 393 |
end. |
| 394 |
|
| 395 |
End Version3. |
| 396 |
|
| 397 |
Module Version4. |
| 398 |
|
| 399 |
Fixpoint equalT (t1 : TERM) : TERM -> Prop := |
| 400 |
match t1 with |
| 401 |
| var v1 => |
| 402 |
fun t2 : TERM => |
| 403 |
match t2 with |
| 404 |
| var v2 => equal _ v1 v2 |
| 405 |
| oper op2 _ => False |
| 406 |
end |
| 407 |
| oper op1 l1 => |
| 408 |
fun t2 : TERM => |
| 409 |
match t2 with |
| 410 |
| var _ => False |
| 411 |
| oper op2 l2 => |
| 412 |
equal _ op1 op2 /\ |
| 413 |
EqListT (ap (Arity S) op1) l1 (ap (Arity S) op2) l2 |
| 414 |
end |
| 415 |
end |
| 416 |
|
| 417 |
with EqListT (n1 : posint) (l1 : LTERM n1) (n2 : posint) |
| 418 |
(l2 : LTERM n2) {struct l1} : Prop := |
| 419 |
match l1 with |
| 420 |
| nil => match l2 with |
| 421 |
| nil => True |
| 422 |
| _ => False |
| 423 |
end |
| 424 |
| cons t1 n1' l1' => |
| 425 |
match l2 with |
| 426 |
| nil => False |
| 427 |
| cons t2 n2' l2' => equalT t1 t2 /\ EqListT n1' l1' n2' l2' |
| 428 |
end |
| 429 |
end. |
| 430 |
|
| 431 |
End Version4. |
| 432 |
|
| 433 |
(* ---------------------------------------------------------------- *) |
| 434 |
(* Version with multiple patterns *) |
| 435 |
(* ---------------------------------------------------------------- *) |
| 436 |
|
| 437 |
Module Version5. |
| 438 |
|
| 439 |
Fixpoint equalT (t1 t2 : TERM) {struct t1} : Prop := |
| 440 |
match t1, t2 with |
| 441 |
| var v1, var v2 => equal _ v1 v2 |
| 442 |
| oper op1 l1, oper op2 l2 => |
| 443 |
equal _ op1 op2 /\ EqListT (ap (Arity S) op1) l1 (ap (Arity S) op2) l2 |
| 444 |
| _, _ => False |
| 445 |
end |
| 446 |
|
| 447 |
with EqListT (n1 : posint) (l1 : LTERM n1) (n2 : posint) |
| 448 |
(l2 : LTERM n2) {struct l1} : Prop := |
| 449 |
match l1, l2 with |
| 450 |
| nil, nil => True |
| 451 |
| cons t1 n1' l1', cons t2 n2' l2' => |
| 452 |
equalT t1 t2 /\ EqListT n1' l1' n2' l2' |
| 453 |
| _, _ => False |
| 454 |
end. |
| 455 |
|
| 456 |
End Version5. |
| 457 |
|
| 458 |
(* ------------------------------------------------------------------ *) |
| 459 |
|
| 460 |
End Sig. |
| 461 |
|
| 462 |
(* Exemple soumis par Bruno *) |
| 463 |
|
| 464 |
Definition bProp (b : bool) : Prop := if b then True else False. |
| 465 |
|
| 466 |
Definition f0 (F : False) (ty : bool) : bProp ty := |
| 467 |
match ty as _, ty return (bProp ty) with |
| 468 |
| true, true => I |
| 469 |
| _, false => F |
| 470 |
| _, true => I |
| 471 |
end. |
| 472 |
|
| 473 |
(* Simplification of bug/wish #1671 *) |
| 474 |
|
| 475 |
Inductive I : unit -> Type := |
| 476 |
| C : forall a, I a -> I tt. |
| 477 |
|
| 478 |
(* |
| 479 |
Definition F (l:I tt) : l = l := |
| 480 |
match l return l = l with |
| 481 |
| C tt (C _ l') => refl_equal (C tt (C _ l')) |
| 482 |
end. |
| 483 |
|
| 484 |
one would expect that the compilation of F (this involves |
| 485 |
some kind of pattern-unification) would produce: |
| 486 |
*) |
| 487 |
|
| 488 |
Definition F (l:I tt) : l = l := |
| 489 |
match l return l = l with |
| 490 |
| C tt l' => match l' return C _ l' = C _ l' with C _ l'' => refl_equal (C tt (C _ l'')) end |
| 491 |
end. |
| 492 |
|
| 493 |
Inductive J : nat -> Type := |
| 494 |
| D : forall a, J (S a) -> J a. |
| 495 |
|
| 496 |
(* |
| 497 |
Definition G (l:J O) : l = l := |
| 498 |
match l return l = l with |
| 499 |
| D O (D 1 l') => refl_equal (D O (D 1 l')) |
| 500 |
| D _ _ => refl_equal _ |
| 501 |
end. |
| 502 |
|
| 503 |
one would expect that the compilation of G (this involves inversion) |
| 504 |
would produce: |
| 505 |
*) |
| 506 |
|
| 507 |
Definition G (l:J O) : l = l := |
| 508 |
match l return l = l with |
| 509 |
| D 0 l'' => |
| 510 |
match l'' as _l'' in J n return |
| 511 |
match n return forall l:J n, Prop with |
| 512 |
| O => fun _ => l = l |
| 513 |
| S p => fun l'' => D p l'' = D p l'' |
| 514 |
end _l'' with |
| 515 |
| D 1 l' => refl_equal (D O (D 1 l')) |
| 516 |
| _ => refl_equal _ |
| 517 |
end |
| 518 |
| _ => refl_equal _ |
| 519 |
end. |
| 520 |
|
| 521 |
Fixpoint app {A} {n m} (v : listn A n) (w : listn A m) : listn A (n + m) := |
| 522 |
match v with |
| 523 |
| niln _ => w |
| 524 |
| consn _ a n' v' => consn _ a _ (app v' w) |
| 525 |
end. |
| 526 |
|
| 527 |
(* Testing regression of bug 2106 *) |
| 528 |
|
| 529 |
Set Implicit Arguments. |
| 530 |
|
| 531 |
Inductive nt := E. |
| 532 |
Definition root := E. |
| 533 |
Inductive ctor : list nt -> nt -> Type := |
| 534 |
Plus : ctor (cons E (cons E nil)) E. |
| 535 |
|
| 536 |
Inductive term : nt -> Type := |
| 537 |
| Term : forall s n, ctor s n -> spine s -> term n |
| 538 |
with spine : list nt -> Type := |
| 539 |
| EmptySpine : spine nil |
| 540 |
| ConsSpine : forall n s, term n -> spine s -> spine (n :: s). |
| 541 |
|
| 542 |
Inductive step : nt -> nt -> Type := |
| 543 |
| Step : forall l n r n' (c:ctor (l++n::r) n'), spine l -> spine r -> step n |
| 544 |
n'. |
| 545 |
|
| 546 |
Definition test (s:step E E) := |
| 547 |
match s with |
| 548 |
| @Step nil _ (cons E nil) _ Plus l l' => true |
| 549 |
| _ => false |
| 550 |
end. |
| 551 |
|
| 552 |
(* Testing regression of bug 2454 ("get" used not be type-checkable when |
| 553 |
defined with its type constraint) *) |
| 554 |
|
| 555 |
Inductive K : nat -> Type := KC : forall (p q:nat), K p. |
| 556 |
|
| 557 |
Definition get : K O -> nat := fun x => match x with KC p q => q end. |
| 558 |
|
| 559 |
(* Checking correct order of substitution of realargs *) |
| 560 |
(* (was broken from revision 14664 to 14669) *) |
| 561 |
(* Example extracted from contrib CoLoR *) |
| 562 |
|
| 563 |
Inductive EQ : nat -> nat -> Prop := R x y : EQ x y. |
| 564 |
|
| 565 |
Check fun e t (d1 d2:EQ e t) => |
| 566 |
match d1 in EQ e1 t1, d2 in EQ e2 t2 return |
| 567 |
(e1,t1) = (e2,t2) -> (e1,t1) = (e,t) -> 0=0 |
| 568 |
with |
| 569 |
| R _ _, R _ _ => fun _ _ => eq_refl |
| 570 |
end. |