Skip to content

Commit 212a073

Browse files
committed
Simpler introduction to [dependent elimination .. as .]
1 parent 3e6edf0 commit 212a073

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

src/Tutorial_Equations_indexed.v

+11-19
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,18 @@ Section Tactics.
392392
(** To explicit pattern-matching and control the naming of variables/hypotheses
393393
introduced by an elimination, it is possible to use the
394394
[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.
396404

405+
(** As for Equations definitions, the patterns should cover solely the possible
406+
values of the hypothesis. *)
397407
Goal forall a b (x : vec nat 2), (vcons a x = vcons b x) -> a = b.
398408
Proof.
399409
intros a b x H.
@@ -419,24 +429,6 @@ Section Tactics.
419429
Fail dependent elimination x as [vcons hd (vcons tl vnil)|vcons hd vnil].
420430
Abort.
421431

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-
440432
End Tactics.
441433

442434
(** ** 3. Unifying Indices and Inaccessible Patterns

0 commit comments

Comments
 (0)