I no know logical shit

No.13013042 ViewReplyOriginalReport
How would I logically quantify a left right relationship?

If I have a set:
X = {Green_House, Red_House, Blue_House, Yellow_House, Ivory_House}

I want to say the the houses are adjacent to each other in a left/right manner with two houses on the end. The houses on the end would be adjacent to one other house while the ones in the middle would be adjacent two a left and a right house?

I imagine it would look something like this:
adj(x,y) = [(x?X)?(y?X)?(x?y)?( 0<||adj||<3)]