real : THEORY BEGIN %(sturm) and (mono-poly) incorporate some nice decision procedures IMPORTING Sturm@strategies %IMPORTING Tarski@strategies % Subtypes D1 and D2 which is the set {1,2,3,4,5} D1: TYPE = {i: nat | i = 1 OR i= 2 OR i=3 OR i=4 OR i=5} D2: TYPE = {i: nat | 1 <= i AND i <= 5} conja1: CONJECTURE (FORALL (x:D1) : x*x >= x) % The abobe proves wih (grind) or the proof below (saved with with C-c 2p): %|- conja1 : PROOF %|- (then (skeep) (typepred "x") (assert)) %|- QED conja2: CONJECTURE (FORALL (x:D2) : x*x >= x) %|- conja2 : PROOF %|- (then (skeep) (lemma "both_sides_div_pos_neg_ge1") (grind)) %|- QED % Lemma is: FORALL (n0z: nonzero_real, x, y: real): % IF n0z > 0 THEN x/n0z >= y/n0z ELSE y/n0z >= x/n0z ENDIF % IFF x >= y % We could also prove the above automatically in one step using (sturm). % The following should not prove because e.g. x = 0.5 is a counter-example conjb: CONJECTURE (FORALL (x:real) : x^2 >= x) conjc: CONJECTURE (FORALL (x: real): x >= 1.0 IMPLIES x * x >= x) % (sturm) proves the above automatically. % Alternatively, manip introduces additional rules such as (div-by): %|- conj4 : PROOF %|- (then (skeep) (div-by 1 "x")) %|- QED example_14 : LEMMA FORALL (x:real) : x ## [| 0, oo |] IMPLIES -x^3 <= 0 %|- example_14 : PROOF %|- (sturm) %|- QED mono_example_4: LEMMA FORALL (x,y:real): x /= y IMPLIES x^3 /= y^3 %|- mono_example_4 : PROOF %|- (mono-poly) %|- QED END real