Light cast alpha

I want everything that is black or white (changeable with invert node) to be transparent, depending on the light fall. I have tried a few things but so far no success. :/