@@ -392,8 +392,18 @@ Section Tactics.
392
392
(** To explicit pattern-matching and control the naming of variables/hypotheses
393
393
introduced by an elimination, it is possible to use the
394
394
[dependent elimination] tactic, which provides access to the [Equations]
395
- pattern-matching notation inside proofs: *)
395
+ pattern-matching notation inside proofs.
396
+ Note that the syntax of the patterns for [dependent elimination] follows the
397
+ syntax of Equation definitions clauses, rather than the Ltac tactics [as] clauses. *)
398
+
399
+ Goal forall n m, n + m = m + n.
400
+ Proof .
401
+ induction n as [|n' IH]; intros m.
402
+ dependent elimination m as [O|S m'].
403
+ Abort .
396
404
405
+ (** As for Equations definitions, the patterns should cover solely the possible
406
+ values of the hypothesis. *)
397
407
Goal forall a b (x : vec nat 2), (vcons a x = vcons b x) -> a = b.
398
408
Proof .
399
409
intros a b x H.
@@ -419,24 +429,6 @@ Section Tactics.
419
429
Fail dependent elimination x as [vcons hd (vcons tl vnil)|vcons hd vnil].
420
430
Abort .
421
431
422
- (** A more low-level and fragile tactic [depelim] is also available, which can
423
- generate fresh names for the new variables and does not require patterns. *)
424
-
425
- Context (A : Type).
426
- Context (a b : A).
427
-
428
- Goal forall (x y : vec A 2), (vcons a (vcons a x) = vcons a (vcons b y)) -> a = b /\ x = y.
429
- intros x y H. depelim H. now split.
430
- Qed .
431
-
432
- Goal forall ( x : vec A 2) z, (vcons a x = z) -> vtail z = x.
433
- intros x z H. depelim H. simp vtail. reflexivity.
434
- Qed .
435
-
436
- Goal forall (x : vec nat 2), (vcons 0 x = vcons 1 x) -> False.
437
- intros x H. depelim H.
438
- Qed .
439
-
440
432
End Tactics.
441
433
442
434
(** ** 3. Unifying Indices and Inaccessible Patterns
0 commit comments