From b7e4dbd4ff8ff12dc061ffb4664670b11831fd81 Mon Sep 17 00:00:00 2001 From: letouzey Date: Fri, 6 Apr 2007 00:58:14 +0000 Subject: simplier version of tail_plus git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@9750 85f007b7-540e-0410-9357-904b9bb8a0f7 --- theories/Arith/Plus.v | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/theories/Arith/Plus.v b/theories/Arith/Plus.v index 98961fce8e..5f7517c751 100644 --- a/theories/Arith/Plus.v +++ b/theories/Arith/Plus.v @@ -198,16 +198,14 @@ Qed. tail-recursive, whereas [plus] is not. This can be useful when extracting programs. *) -Fixpoint plus_acc q n {struct n} : nat := +Fixpoint tail_plus n m {struct n} : nat := match n with - | O => q - | S p => plus_acc (S q) p + | O => m + | S n => tail_plus n (S m) end. -Definition tail_plus n m := plus_acc m n. - Lemma plus_tail_plus : forall n m, n + m = tail_plus n m. -unfold tail_plus in |- *; induction n as [| n IHn]; simpl in |- *; auto. +induction n as [| n IHn]; simpl in |- *; auto. intro m; rewrite <- IHn; simpl in |- *; auto. Qed. -- cgit v1.2.3