Add spec for memorization of exist matcher.

Follow up to #515.

/cc @danielfone