Self-Test 2

Unification and lists 2
 
You are advised to write down the solutions for all questions before you look at the answers.
 
  Do the following unify and (if so) what are the variable instantiations?
 
1.
| ?- Var = [1, 2, 3].
2.
| ?- Var = [Head, Tail].
3.
| ?- [_|Tail] = Var.
4.
| ?- [Head|Tail] = [Head|Tail].
5.
| ?- [Hd1, Hd2|LH_Tail] = [Head|RH_Tail].
6.
| ?- [LH_Hd1, LH_Hd2, LH_Hd3] = [RH_Hd1, RH_Hd2, RH_Hd3|Tail].
   
  Describe what will happen if you attempt the following and why it will happen:
 
1.
| ?- S = [_|S].
2.
| ?- [Hd1, Hd2|Tail] = [Head|Tail].
3.
| ?- [Head, Tl] = [Head|Tl].