0

given this pair of expressions, is it possible to find a MGU for it?

  1. f(x,y)
  2. f(y,x)

I wanted to say that it is possible, when x/y, but I wasn't sure if that's legal. what do you guys say?

thanks!

ibezito
  • 5,782
  • 2
  • 22
  • 46
  • what do you mean by "x/y"? why is x = y not the mgu? – Christian Fritz Nov 16 '13 at 18:33
  • that's what i meant but I was wondered if that's a legal solution, since in the given examples there are 2 inputs which may be different, and in the MGU both of the inputs are identical. perhaps i'm missing something about this subject.. – ibezito Nov 16 '13 at 18:37
  • why are they different? – Christian Fritz Nov 16 '13 at 18:40
  • by the way, is this prolog notation or logical notation? i.e., are x and y variables or constants? – Christian Fritz Nov 16 '13 at 18:41
  • logical notation - they are variables when looking on the logical expression f(x,y), aren't we suppose to assume that x and y are different? – ibezito Nov 16 '13 at 18:43
  • this is perhaps the most common error students make in logical programming: assuming that two different variables must be different. They are not. x=y is perfectly fine. – Christian Fritz Nov 16 '13 at 19:32

1 Answers1

1

Yes, these terms can be easily unified, producing the assertion x=y as a side effect.

Christian Fritz
  • 20,641
  • 3
  • 42
  • 71
  • I think that "side effect" is a misleading term to people who would benefit from the answer. I would prefer "result" or "unifier". – lukstafi Nov 17 '13 at 14:00