Question: PLEASE READ CAREFULLY BEFORE ANSWERING!!! PLEASE DON'T COPY PASTE THE PREVIOUS ANSWERS OR CODE FROM PREVIOUS QUESTIONS. DON'T WASTE MY TIME. THERE IS NO COMMENT

PLEASE READ CAREFULLY BEFORE ANSWERING!!! PLEASE DON'T COPY PASTE THE PREVIOUS ANSWERS OR CODE FROM PREVIOUS QUESTIONS. DON'T WASTE MY TIME. THERE IS NO COMMENT SECTION FOR ME TO COMMENT OTHERWISE I WOULD HAVE

GIVE CORRECT SOLUTION PREVIOUS CODES ARE INCOMPLETE AND DON'T WORK FOR THE EXAMPLES PROVIDED IN THE QUESTION. PLEASE READ THE QUESTION BEFORE ANSWERING.

PLEASE PROVIDE THE SUCCESSFUL OUTPUT SCREEN CAPTURE OF YOUR CODE TO SHOW IT WORKS WITH ALL EXAMPLES BECAUSE IT DOESN'T. PLEASE DON'T MAKE FUN.

PLEASE READ CAREFULLY BEFORE ANSWERING!!! PLEASE DON'T COPY PASTE THE PREVIOUS ANSWERSOR CODE FROM PREVIOUS QUESTIONS. DON'T WASTE MY TIME. THERE IS NO

Write a program in C++ that implements the following unification algorithm. Unify(E1,E2) If ( both E1 and E2 are constant or empty ) \{ If ( E1=E2 ), then return \{\} Else return FAIL \} If ( E1 is a variable ) \{ If E1 occurs in E2, then return FAIL Else return {E2/E1} \} If ( E2 is variable ) \{ If E2 occurs in E1, then return FAIL Else return {E1/E2} \} If ( E1 or E2 is empty ), then return FAIL HE1 = first element of E1 HE2 = first element of E2 SUBS1 = unify (HE1, HE2) If (SUBS1 = FAIL) then return FAIL TE1 = apply SUBS1 to rest of E1 TE2 = apply SUBS1 to rest of E2 SUBS2 = unify (TE1,TE2) If (SUBS2 = FAIL) then return FAIL Else return composition(SUBS1, SUBS2) E1 and E2 are two terms where variables start with upper case letters and function/constant symbols start with lower case letters. You need to consider "Occur Check". Example This is an implementation of the unification algonithm. Flease enter the first term: a Flease enter the second terme x The unifier is: X=a Flease enter the first term: X Flease enter the second tenem y The unifier is: Y=X Flease enter the first term: X Flease enter the second terme I[Y] The unifise is: X=f(y) Flease enter the first term: X Flease enter the socond terme m/2,Y The unifiar is: x=h(a,) Please enter the first term: f(flX, YuX Flease enter the second terenc fff(V,U), [U,Y] The unifise is: X=V,Y=U,V=e[U,U) Flease enter the first term: f(IIX, Y,XS) Fhezse enter the second terme ff[f,U, U.g[U,F)] The unifise is: Invalid Please enter the first term: X Fhease enter the second terme fx The unifier is: there is no unifier Write a program in C++ that implements the following unification algorithm. Unify(E1,E2) If ( both E1 and E2 are constant or empty ) \{ If ( E1=E2 ), then return \{\} Else return FAIL \} If ( E1 is a variable ) \{ If E1 occurs in E2, then return FAIL Else return {E2/E1} \} If ( E2 is variable ) \{ If E2 occurs in E1, then return FAIL Else return {E1/E2} \} If ( E1 or E2 is empty ), then return FAIL HE1 = first element of E1 HE2 = first element of E2 SUBS1 = unify (HE1, HE2) If (SUBS1 = FAIL) then return FAIL TE1 = apply SUBS1 to rest of E1 TE2 = apply SUBS1 to rest of E2 SUBS2 = unify (TE1,TE2) If (SUBS2 = FAIL) then return FAIL Else return composition(SUBS1, SUBS2) E1 and E2 are two terms where variables start with upper case letters and function/constant symbols start with lower case letters. You need to consider "Occur Check". Example This is an implementation of the unification algonithm. Flease enter the first term: a Flease enter the second terme x The unifier is: X=a Flease enter the first term: X Flease enter the second tenem y The unifier is: Y=X Flease enter the first term: X Flease enter the second terme I[Y] The unifise is: X=f(y) Flease enter the first term: X Flease enter the socond terme m/2,Y The unifiar is: x=h(a,) Please enter the first term: f(flX, YuX Flease enter the second terenc fff(V,U), [U,Y] The unifise is: X=V,Y=U,V=e[U,U) Flease enter the first term: f(IIX, Y,XS) Fhezse enter the second terme ff[f,U, U.g[U,F)] The unifise is: Invalid Please enter the first term: X Fhease enter the second terme fx The unifier is: there is no unifier

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!