Module Pos
<: UsualOrderedTypeFull
<: UsualDecidableTypeFull
<: TotalOrder.
(** * Definitions of operations, now in a separate file *)
Include BinPosDef.Pos.
(** In functor applications that follow, we only inline t and eq *)
Set Inline Level 30.
(** * Logical Predicates *)
Definition eq := @Logic.eq positive.
Definition eq_equiv := @eq_equivalence positive.
Include BackportEq.
Definition lt x y := (x ?= y) = Lt.
Definition gt x y := (x ?= y) = Gt.
Definition le x y := (x ?= y) <> Gt.
Definition ge x y := (x ?= y) <> Lt.
Infix "<=" := le : positive_scope.
Infix "<" := lt : positive_scope.
Infix ">=" := ge : positive_scope.
Infix ">" := gt : positive_scope.
Notation "x <= y <= z" := (x <= y /\ y <= z) : positive_scope.
Notation "x <= y < z" := (x <= y /\ y < z) : positive_scope.
Notation "x < y < z" := (x < y /\ y < z) : positive_scope.
Notation "x < y <= z" := (x < y /\ y <= z) : positive_scope.
(**********************************************************************)
(** * Properties of operations over positive numbers *)
(** ** Decidability of equality on binary positive numbers *)
(** ** Successor and double *)
(** ** Successor and predecessor *)
(** ** Injectivity of successor *)
(** ** Predecessor to [N] *)
(**********************************************************************)
(** * Properties of addition on binary positive numbers *)
(** ** Specification of [succ] in term of [add] *)
(** ** Specification of [add_carry] *)
(** ** Commutativity *)
(** ** Permutation of [add] and [succ] *)
(** ** Simplification *)
(** ** Addition is associative *)
(** ** Commutation of addition and double *)
(** ** Miscellaneous *)
(**********************************************************************)
(** * Peano induction and recursion on binary positive positive numbers *)
(** The Peano-like recursor function for [positive] (due to Daniel Schepler) *)
Fixpoint peano_rect (P:positive->Type) (a:P 1)
(f: forall p:positive, P p -> P (succ p)) (p:positive) : P p :=
let f2 := peano_rect (fun p:positive => P (p~0)) (f _ a)
(fun (p:positive) (x:P (p~0)) => f _ (f _ x))
in
match p with
| q~1 => f _ (f2 q)
| q~0 => f2 q
| 1 => a
end.
Definition peano_rec (P:positive->Set) := peano_rect P.
(** Peano induction *)
Definition peano_ind (P:positive->Prop) := peano_rect P.
(** Peano case analysis *)

Theorem peano_case :
forall P:positive -> Prop,
P 1 -> (forall n:positive, P (succ n)) -> forall p:positive, P p.