Verifikation reaktiver Systeme - Universität Kaiserslautern
Verifikation reaktiver Systeme - Universität Kaiserslautern
Verifikation reaktiver Systeme - Universität Kaiserslautern
Erfolgreiche ePaper selbst erstellen
Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.
235<br />
The fourth let part constructs the two subgoals (numerators are equal, denominators<br />
are equal) using the constructor function mk_eq. These subgoals prove<br />
the initial goal; the argument for this is !a1 b1 a2 b2. (a1=a2) /\ (b1=b2) ==><br />
(abs\_frac(a1,b1)=abs\_frac(a2,b2)).<br />
(* FRAC_REP_ABS_SUBST: 0 < b |- (rep_frac (abs_frac (a,b)) = (a,b)) : thm *)<br />
(* NMR: !a b. 0 < b ==> (nmr (abs_frac (a,b)) = a) *)<br />
val NMR = store_thm("NMR", ‘‘!a b. 0 < b ==> (nmr (abs_frac (a,b)) = a)‘‘,<br />
REPEAT STRIP_TAC THEN<br />
REWRITE_TAC[nmr_def] THEN<br />
REWRITE_TAC[FRAC_REP_ABS_SUBST] );<br />
(* DNM: !a b. 0 < b ==> (nmr (abs_frac (a,b)) = a) *)<br />
val DNM = store_thm("DNM", ‘‘!a b. 0 < b ==> (dnm (abs_frac (a,b)) = b)‘‘,<br />
REPEAT STRIP_TAC THEN<br />
REWRITE_TAC[dnm_def] THEN<br />
REWRITE_TAC[FRAC_REP_ABS_SUBST] );<br />
The pair library offers theorems to simplify terms of the form FST(a,b)=a or<br />
SND(a,b)=b. Similar theorems are provided by the fractions library. NMR and DNM<br />
reduce the terms nmr(abs frac(a,b)) and dnm(abs frac(a,b)). Both of them<br />
require that the denominator of the included fraction is positive. Otherwise, this<br />
simplification step cannot be done. In most cases, this means the proof gets stuck<br />
at this place.<br />
To show the required precondition, another tactic comes to help:<br />
(* INT_MUL_POS_SIGN: |- !a b. 0 0 0<br />
ASSUME_TAC( (prove(intSyntax.mk_less(intSyntax.zero_tm,term1),<br />
ARW_TAC[FRAC_DNM_POSITIVE,INT_MUL_POS_SIGN])) )<br />
handle HOL_ERR _ => raise ERR "FRAC_NOT_NAN_ASM_TAC" "";<br />
For a given term, the tactic tries to prove that it is positive, using the facts<br />
that the denominator of a fraction is positive and the product of two positive<br />
numbers is positive.<br />
Equipped with these utilities, some properties of fractions can be shown quite<br />
elegantly, e.g. the associativity of the addition:<br />
val FRAC_ADD_ASSOC = store_thm("FRAC_ADD_ASSOC",<br />
‘‘!a b c. add a (add b c) = add (add a b) c‘‘,<br />
REPEAT STRIP_TAC<br />
THEN REWRITE_TAC[add_def]<br />
THEN DNM_POS_ASM_TAC ‘‘dnm a * dnm b‘‘<br />
THEN DNM_POS_ASM_TAC ‘‘dnm b * dnm c‘‘<br />
THEN ARW_TAC[NMR,DNM]<br />
THEN FRAC_EQ_TAC<br />
THEN INT_RING_TAC );