Ray Tayek writes: << hi, reading junit recipies by martin fowler. talking about equality as an equivalence relation on objects. if one of the fields of the objects that is in included in the equals method has a floating point number, then one uses some idea of "close enough" (i.e. within some epsilon). this is clearly reflexive and symmetric, but not transitive. he conjectures that this idea of "close enough" is the *only* case (in the space of equals methods for object) of having a equals relation that is symmetric and reflexive and not transitive. does anyone have a counter example?
It's hard to know what is meant here by "an equals relation", since in math the concept of an "equivalence relation" is defined by possessing reflexivity, symmetry, and transitivity. It's easy to come up with a relation having the first two properties but not transitivity: Let the set on which the relation is defined be {A, B, C}. Let the entire relation be defined by A~A, B~B, C~C, A~B, B~A, B~C, and C~B. Then ~ is easily seen to be reflexive and symmetric, but not transitive (A~B and B~C but not A~C). This minimal example can be transplanted to any set S havng at least 3 elements, such as all real numbers: Pick 3 elements from S, call them A,B,C, and define ~ among A,B,C just as above. Let all other elements X satisfy X ~ X but no other "~" statement. Then you again have reflexivity and symmetry but not transitivity (since only one counterexample is needed). I don't know what it would mean to say this is or is not a "close enough" example. --Dan