strategies
, we define
a strategy as a mapping gamma on natural numbers,
The Coq
source is organized
as a proof :
Lemma binary:strategy. Proof. Realizer [n:nat](quotient two n) . Program_all. Logical goal solving ... Qed.The logical part of the proof deals with inequalities, and uses the results of modules
Le_lt_compl
,
euclid
, and
Mult_compl
.
binary
can be shortened.
May be in the future releases ...
quotient
comes from
$COQTH/PROGRAMS/Euclid_proof:
Lemma quotient : (b:nat)(gt b O)-> (a:nat){q:nat|(Ex [r:nat](a=(plus (mult q b) r))/\ (gt b r))}.This is why the sequence:
Realizer [n:nat](quotient two n) . Program_all. Elim y;Induction 1; Intros H1 H2.gives us a goal:
n0,x:nat. H1: n=(plus (mult n0 two) x) H2: (gt two x) ================== (lt (S O) n0) /\ (lt n0 n)
enum1
of Le_lt_compl
,
used in
Case (enum1 x H2);Intro H3.gives us two subgoals:
n0,x:nat. H1: n=(plus (mult n0 two) x) H2: (gt two x) H3: x = O ================== (lt (S O) n0) /\ (lt n0 n)
n0,x:nat. H1: n=(plus (mult n0 two) x) H2: (gt two x) H3: x = (S O) ================== (lt (S O) n0) /\ (lt n0 n)
#load "Demo.ml";; ##open "Demo";; #binary;; - : int -> int = <fun> #binary 87;; - : int = 43