typedef unsigned (1..3) db;
typedef db[db] dbs;
typedef struct {
	db a;
	db b;
} pair;
typedef enum { lammin, kylma, t } huoltari;
typedef union {
	db a;
	pair p;
	struct {
		dbs t;
		db u;
	} neste;
	huoltari tyyppi;
} kesoil;
typedef pair[bool] pairs;
huoltari kallis = t;

place huoltoasema kesoil: pair t :
	(a = t.a, p = t, neste = { { t.a, t.b, +t.a }, +t.b}), tyyppi = kylma;

place unused pair: db t : db s (s != t): {t, s};

place used pair: pair p (p.a < p.b): p;

place p dbs: dbs p (p[1] == 1 && p[1] + p[2] + p[3] < 5): p;

place q dbs: db p : db g : ({ p, g, p }, is unsigned p#{ g, p, 2 });

place sock pair: db s : {s,+s};
place weird pairs: pair s : {s,+s};
place gizmo pairs: db t: (db u (t == 3 && u != t): {{t,u},{u,t}}, {{t,+t},{++t,t}});
place shoe pairs: db t : db u (u != t && t == 3) :
  ({{t,u},{u,t}},{{u,t},{t,u}});

place boot pairs: db s : pair t (t != {s, s}) : is unsigned s#{t,t};
place paired pairs: pair s : pairs t (t != {s, s}) : t;

place b db:
	db b ((b & 1) != 0) :
	(b, db c (c != b && b == 1) : c),
	db d : is unsigned d#+d;
