170 likes | 334 Views
A precise analysis. Determinism, soundness, completeness for Determinism for Additional properties of Comparisons. Analysis for with errors : Observation : (determinism for for )
E N D
A precise analysis • Determinism, soundness, completeness for • Determinism for • Additional properties of • Comparisons Pls – analysis – Catriel Beeri
Analysis for with errors : Observation: (determinism for for ) Theme: Prove by induction on length of selected path For the proof, we need some concepts and results Pls – analysis – Catriel Beeri
(op-apply) (eval-tuple) (eval-rand) Applicability of rules: A rule r is applicable (ישים) to E, if there is a proof tree for EE’, with r associated with the root. A group of rules is applicable to E if one of them is applicable Why is it an interesting concept? Note: it is a semantic concept! Pls – analysis – Catriel Beeri
A characterization (if & only if ) of applicability for an application expression E1 E2: For you: Similar characterization for if, tuple Pls – analysis – Catriel Beeri
Q: Are the conditions mutually exclusive? Q: Have we proved determinism? Q: Have we proved completeness? A: we still depend on a semantic condition of having a transition Pls – analysis – Catriel Beeri
A reformulation (with some redundancy) of the (iff ) characterization of applicability (for E1 E2): Pls – analysis – Catriel Beeri
By removing the transition condition mutually exclusive, syntactic, only if conditions: But, it is still possible that two rules in a group are applicable, Or a rule generates more than one transition Pls – analysis – Catriel Beeri
Corollary (Inversion): If E has a transition, then • Its primary construct • value tests for (some) direct sub-expressions determine the sub-expression of E that has a transition why “inversion” ? Pls – analysis – Catriel Beeri
Observations: • Knowing primary construct of E all rules not for E’s expression kind are excluded • Value tests on (some) direct sub-expressions more rules excluded rules not excluded are potentially applicable (given current knowledge) • If the remaining rules are proper, they select a unique direct sub-expression else, E is a candidate for a reduction This leads to the notions of selected pathselected sub-expression (using the conditions in last table) Pls – analysis – Catriel Beeri
The selection path in a composite expression E (ford): • Contains its root • If it contains node n labeled by • Application: n = E1 E2, then • It contains E1 (operator) if E1 is not a value • It contains E2 (operand) if E2 is not a value, but E1 is • Stops at n if both E1 E2 are values • Tuple: ….. • If: … Its end is the (root of) the selected sub-expressionof E As we go down the path, a set of (potentially applicable) rules is associated with each node, that all select the same child as next node Pls – analysis – Catriel Beeri
applic A value tuple (eval-rand) (rand-error) (App-rand) A non-value v1 v2 Example: , The condition: v1 in Op (1st expr) selects a unique axiom, then we climb up Application rules Non-value tuple rules with i = 1 applic (apply-op) (apply-error) (app-axioms) Application rules Pls – analysis – Catriel Beeri
Soundness (=determinism) and completeness (progress): A composite expression E has a unique proof tree for a transition, hence a unique transition. and • E’s selected sub-expression is a redex, (always true for the rules with error) • If E’ E’’ (regular), then the transition for E is E {E’’/E’}E • Else, E’ ER, and also E ER Pls – analysis – Catriel Beeri
Proof: induction on length of selection path • 0: E is a candidate for a reduction always a redex obviously all the claims hold • N>0: Induction hypothesis: claim is true for the unique child E1 one level down on the selected path. The (unique) transition of E1 determines a unique applicable rule for E hence there is a unique proof tree/transition for E. Pls – analysis – Catriel Beeri
Determinism for : Can prove directly, using same technique Or, recall that But, for some expressions, there is no d transition Pls – analysis – Catriel Beeri
Additional properties is not a functionalrelation! Possibly many successors to an expression, many computations Claim (confluence): All computations from an expression E terminate in same final (extended) value (proof in chapter) Pls – analysis – Catriel Beeri
Functionality, Soundness & completeness for natural: • For , for each E there is at most one: • applicable rule, • proof tree, • value V, s.t. Proved by induction on E (we did that already) • For , replace • at most by unique • Value V by XV (V or ER) Here, uniqueness of proof tree fails for derivations of ER, but there is never an evaluation to a value, another to ER Pls – analysis – Catriel Beeri
Comparison of transition, natural • (w/o ER) • (with ER) The semantics express the same intuitive semantics(for values ofexpressions) in different styles (which one is easier to write – transition or natural?) Pls – analysis – Catriel Beeri