aboutsummaryrefslogtreecommitdiffhomepage
path: root/theories/PArith
diff options
context:
space:
mode:
authorGravatar pboutill <pboutill@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-12-21 21:47:43 +0000
committerGravatar pboutill <pboutill@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-12-21 21:47:43 +0000
commitec8332223b1f6716e49bbf78e0489881ca7bfa2b (patch)
tree95c23e65916507f8442e3d5f1ac11e675fca52b8 /theories/PArith
parente9428d3127ca159451437c2abbc6306e0c31f513 (diff)
nat_iter n f x -> nat_rect _ x (fun _ => f) n
It is much beter for everything (includind guard condition and simpl refolding) excepts typeclasse inference because unification does not recognize (fun x => f x b) a when it sees f a b ... git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16112 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'theories/PArith')
-rw-r--r--theories/PArith/BinPosDef.v4
-rw-r--r--theories/PArith/Pnat.v2
2 files changed, 3 insertions, 3 deletions
diff --git a/theories/PArith/BinPosDef.v b/theories/PArith/BinPosDef.v
index 4beeea31d..6d85f0723 100644
--- a/theories/PArith/BinPosDef.v
+++ b/theories/PArith/BinPosDef.v
@@ -484,8 +484,8 @@ Fixpoint lxor (p q:positive) : N :=
(** Shifts. NB: right shift of 1 stays at 1. *)
-Definition shiftl_nat (p:positive)(n:nat) := nat_iter n xO p.
-Definition shiftr_nat (p:positive)(n:nat) := nat_iter n div2 p.
+Definition shiftl_nat (p:positive)(n:nat) := nat_rect _ p (fun _ => xO) n.
+Definition shiftr_nat (p:positive)(n:nat) := nat_rect _ p (fun _ => div2) n.
Definition shiftl (p:positive)(n:N) :=
match n with
diff --git a/theories/PArith/Pnat.v b/theories/PArith/Pnat.v
index 31e88a403..33505ccb3 100644
--- a/theories/PArith/Pnat.v
+++ b/theories/PArith/Pnat.v
@@ -192,7 +192,7 @@ Qed.
Theorem inj_iter :
forall p {A} (f:A->A) (x:A),
- Pos.iter p f x = nat_iter (to_nat p) f x.
+ Pos.iter p f x = nat_rect (fun _ => A) x (fun _ => f) (to_nat p).
Proof.
induction p using peano_ind. trivial.
intros. rewrite inj_succ, iter_succ. simpl. now f_equal.