Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

OCaml The application of a substitution to a tree t, written (t ), is the simultaneous replacement of all variables vi occurring in t by

OCaml

The application of a substitution to a tree t, written (t ), is the simultaneous replacement of all variables vi occurring in t by the their tree/variable associations in . For example, with 1 defined as above, we would have:

v0 1 = v0 { (v0 -> (C -> C))/v1, (C -> v1)/v0 } = (C -> v1).

Write the function applySubstitutionToTree : subst -> t -> t such that a function call(applySubstitutionToTree subst t), produces the result of performing the substitution subst on tree t.

For example, in OCaml syntax, if we have

let t0 = Arrow { from = Var 0; too = Arrow { from = C; too = C }} let t1 = Arrow { from = C ; too = Var v1 } let s1 = [ {tree = t0; var = 1} ; {tree = t1; var = 0} ]

Then we should get

 # applySubstitutionToTree s1 t0;; - : t = Arrow {from = Arrow {from = C; too = Var 1}; too = Arrow {from = C; too = C}}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

5 Why does forward bias depend on risk aversion?

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago