From Undecidability Require Export ArithPrelim. (* [nia] etc. *)
From Coq Require Export BinPos.
(* Compute 42. (* default number notation is still for [nat] *) *)
Local Open Scope positive_scope.
(* Local Set Printing All. *)
(* Compute 42 % positive. *)
(* Compute 42 : positive. *)
(* Local Unset Printing All. *)
(* Big binary numbers are not a problem for Coq *)
(* Compute (42 ^ 42) % positive. *)
(* Number of bits required to represent this big number *)
(* Compute Pos.size_nat (42 ^ 42). *)
(* ** General definitions and lemmas on binary numbers *)
(* Append a lower-order bit *)
Definition append_bit (p : positive) (b : bool) := if b then p~1 else p~0.
Notation "p ~~ b" := (append_bit p b) (at level 7, left associativity, format "p '~~' b") : positive_scope.
Definition bitToSigPos (b : bool) : sigPos := if b then sigPos_xI else sigPos_xO.
Definition bitToSigPos' (b : bool) : sigPos^+ := inr (bitToSigPos b).

Lemma Encode_positive_app_xI (p : positive) :
encode_pos (p ~ 0) = encode_pos p ++ [sigPos_xO].