Presentation is loading. Please wait.

Presentation is loading. Please wait.

Winter 2004/5Pls – analysis – Catriel Beeri1 A precise analysis  Determinism, soundness, completeness for  Determinism for  Additional properties of.

Similar presentations


Presentation on theme: "Winter 2004/5Pls – analysis – Catriel Beeri1 A precise analysis  Determinism, soundness, completeness for  Determinism for  Additional properties of."— Presentation transcript:

1 Winter 2004/5Pls – analysis – Catriel Beeri1 A precise analysis  Determinism, soundness, completeness for  Determinism for  Additional properties of  Comparisons

2 Winter 2004/5Pls – analysis – Catriel Beeri2 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

3 Winter 2004/5Pls – analysis – Catriel Beeri3 Applicability of rules: A rule r is applicable (ישים) to E, if there is a proof tree for E  E’, with r associated with the root. A group of rules is applicable to E if one of them is applicable (op-apply) (eval-tuple) (eval-rand) Why is it an interesting concept? Note: it is a semantic concept!

4 Winter 2004/5Pls – analysis – Catriel Beeri4 A characterization (if & only if ) of applicability for an application expression E1 E2: For you: Similar characterization for if, tuple GroupRulecondition app-rator(eval-rator) E1  d E’1 app-rator(rator-error) E1  d ER app-rand(eval-rand) E1 in Val, E2  d E’2 app-rand(rand-error) E1 in Val, E2  d ER app-axioms(apply-op)E1, E2 in Val, E1 in Op app-axioms(apply-error)E1, E2 in Val, E1 !in Op

5 Winter 2004/5Pls – analysis – Catriel Beeri5 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

6 Winter 2004/5Pls – analysis – Catriel Beeri6 A reformulation (with some redundancy) of the (iff ) characterization of applicability (for E1 E2): GroupRulecondition app-rator(eval-rator) E1 not in Val, E1  d E’1 app-rator(rator-error) E1 !in Val, E1  d ER app-rand(eval-rand)E1 in Val, E2 !in Val, E2  d E’2 app-rand(rand-error)E1 in Val, E2 !in Val, E2  d ER app-axioms(apply-op)E1, E2 in Val, E1 in Op app-axioms(apply-error)E1, E2 in Val, E1 !in Op

7 Winter 2004/5Pls – analysis – Catriel Beeri7 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 Groupcondition (app-rator)E1 !in Val (app-rand)E1 in Val, E2 !in Val (app-axioms)E1, E2 both in Val

8 Winter 2004/5Pls – analysis – Catriel Beeri8 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” ?

9 Winter 2004/5Pls – analysis – Catriel Beeri9 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 path selected sub-expression (using the conditions in last table)

10 Winter 2004/5Pls – analysis – Catriel Beeri10 The selection path in a composite expression E (for  d) : 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-expression of 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

11 Winter 2004/5Pls – analysis – Catriel Beeri11 Example:, The condition: v1 in Op (1 st expr) selects a unique axiom, then we climb up applic tuple Application rules tuple rules with i = 1 A value applic A non-value Application rules(apply-op) (apply-error) (app-axioms) v2 v1 (eval-rand) (rand-error) (App-rand) Non- value

12 Winter 2004/5Pls – analysis – Catriel Beeri12 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

13 Winter 2004/5Pls – analysis – Catriel Beeri13 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.

14 Winter 2004/5Pls – analysis – Catriel Beeri14 Determinism for : Can prove directly, using same technique Or, recall that But, for some expressions, there is no  d transition

15 Winter 2004/5Pls – analysis – Catriel Beeri15  is not a functional relation! 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) Additional properties

16 Winter 2004/5Pls – analysis – Catriel Beeri16 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

17 Winter 2004/5Pls – analysis – Catriel Beeri17 Comparison of transition, natural (w/o ER) (with ER) The semantics express the same intuitive semantics (for values of expressions) in different styles (which one is easier to write – transition or natural?)


Download ppt "Winter 2004/5Pls – analysis – Catriel Beeri1 A precise analysis  Determinism, soundness, completeness for  Determinism for  Additional properties of."

Similar presentations


Ads by Google