CSE 3341.03 Winter 2008 Introduction to Program Verification February 5. calculating with simplify. review the simplify algorithm. simplify(Expr) = Result if path_arg(Path, Expr) = Lhs , % (there is a path in Expr to the sub-expression LHS) and Lhs ->> Rhs , and
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
calculating with simplify
if path_arg(Path, Expr) = Lhs,
% (there is a path in Expr to the sub-expression LHS)
and Lhs ->> Rhs, and
Modified = change_path_arg(Path, Expr, Rhs), and
Result = simplify(Modified)
and there is a rule that
Lhs ->> Rhs, and Modified is the term Expr with the Lhs subterm replaced by Rhs,
otherwiseResult is the input Expr
looks for a file named file.simp
|: assert(( rule )).
adds the rule at the end of the current list of rules
indigo 301 % simplify
Version 1.4.2SWI, January 6, 2007
|:x > 0 implies a+a=a*2.
x>0 implies a+a=a*2 ->>
0<x implies a+a=a*2
Can we simplify further?
|:assert((M*N ->> Product :- Product assigned M*N)).
|: assert((0*X ->> 0)).
|:2*q+q*((a+8-a)-7) + q.
2*q+q* (a+8-a-7)+q ->>
"if it quacks like a duck . . ."
Leibnitz law ?
a stack computer will have stack operations or functions defined frompush, pop, and top
evaluate an ADT expression
context: ADT defined by axioms in the form of identities
method: input ADT axioms and definitions to the simplify tool in the form of simplification rules; input an expression to be checked and see if it simplifies to the expected result.
background: mathematical simplification rules.The correctness of the evaluation is relative to the assumed correctness of the simplification rules and the correctness of the ADT axioms and definitions.
turn them into rewrite rules and use them to do symbolic calculation on stacks
does it really work by popping S, and pushing the top element of this new stack onto the original S?
(that's why the datatype is abstract)
e. g. pop(pop(push(a, nil)))
pop=87 Stack: ..., VAL -> ...
pop2=88 Stack: ..., VAL1, VAL2 -> ...
dup=89 Stack: ..., V -> ..., V, V
input bytecode sequence, perhaps as a list [. . , . . . . . ] and initial stack (as an expression) to simplify
confirm the simplification yields desired result.
(a) and (b)