Bistable luminescence of trivalent rare-earth ions in crystals