get_grounded and filter_rules implementation