<!--H3: Section C.1-->
(apx:c.1)=
# A brief introduction to clausal logic #

```{solution} ex:1.2
```

There are six answers to this query:
```Prolog
{ W→green_park }
{ W→piccadilly_circus }
{ W→leicester_square }
{ W→bond_street }
{ W→oxford_circus }
{ W→tottenham_court_road }
```
The proof trees for the first three answers are analogous to {numref}`fig:1.2`. The proof tree for the fourth answer is given below (the two remaining proof trees are similar):
```{figure} /src/fig/appendices/image002.svg
---
width: 100%
name: 'fig:a.1'
---
```

+++

```{solution} ex:1.4
```

The first specification can immediately be translated to Prolog:
```Prolog
list([]).
list([_First|Rest]):-list(Rest).
```
A list of even length is either the empty list, or a non-empty list with two more elements than the next shorter list of even length:
```Prolog
evenlist([]).
evenlist([_First,_Second|Rest]):-evenlist(Rest).
```
In order to adapt this definition for lists of odd length, only the non-recursive clause needs to be changed:
```Prolog
oddlist([_One]).
oddlist([_First,_Second|Rest]):-oddlist(Rest).
```
Notice that `oddlist` can also be defined in terms of `evenlist` (or *vice versa*):
```Prolog
oddlist([_First|Rest]):-evenlist(Rest).
```

+++

```{solution} ex:1.5
```

```Prolog
?-reachable(bond_street,piccadilly_circus,[S1,S2|Rest]).
```
