608 | _ => mk_step ())] |
608 | _ => mk_step ())] |
609 end) |
609 end) |
610 |
610 |
611 (**** PARSING OF SPASS OUTPUT ****) |
611 (**** PARSING OF SPASS OUTPUT ****) |
612 |
612 |
613 (* SPASS returns clause references of the form "x.y". We ignore "y", whose role |
613 (* SPASS returns clause references of the form "x.y". We ignore "y". *) |
614 is not clear anyway. *) |
|
615 val parse_dot_name = scan_general_id --| $$ "." --| scan_general_id |
614 val parse_dot_name = scan_general_id --| $$ "." --| scan_general_id |
616 |
615 |
617 val parse_spass_annotations = |
616 val parse_spass_annotations = |
618 Scan.optional ($$ ":" |-- Scan.repeat (parse_dot_name --| Scan.option ($$ ","))) [] |
617 Scan.optional ($$ ":" |-- Scan.repeat (parse_dot_name --| Scan.option ($$ ","))) [] |
619 |
618 |
620 (* It is not clear why some literals are followed by sequences of stars and/or |
619 (* We ignore the stars and the pluses that follow literals. *) |
621 pluses. We ignore them. *) |
|
622 fun parse_decorated_atom x = |
620 fun parse_decorated_atom x = |
623 (parse_atom --| Scan.repeat ($$ "*" || $$ "+" || $$ " ")) x |
621 (parse_atom --| Scan.repeat ($$ "*" || $$ "+" || $$ " ")) x |
624 |
622 |
625 fun mk_horn ([], []) = AAtom (ATerm (("c_False", []), [])) |
623 fun mk_horn ([], []) = AAtom (ATerm (("c_False", []), [])) |
626 | mk_horn ([], pos_lits) = foldr1 (uncurry (mk_aconn AOr)) pos_lits |
624 | mk_horn ([], pos_lits) = foldr1 (uncurry (mk_aconn AOr)) pos_lits |
627 | mk_horn (neg_lits, []) = mk_anot (foldr1 (uncurry (mk_aconn AAnd)) neg_lits) |
625 | mk_horn (neg_lits, []) = mk_anot (foldr1 (uncurry (mk_aconn AAnd)) neg_lits) |
628 | mk_horn (neg_lits, pos_lits) = |
626 | mk_horn (neg_lits, pos_lits) = |
629 mk_aconn AImplies (foldr1 (uncurry (mk_aconn AAnd)) neg_lits) |
627 mk_aconn AImplies (foldr1 (uncurry (mk_aconn AAnd)) neg_lits) |
630 (foldr1 (uncurry (mk_aconn AOr)) pos_lits) |
628 (foldr1 (uncurry (mk_aconn AOr)) pos_lits) |
631 |
629 |
632 fun parse_horn_clause x = |
630 fun parse_horn_clause x = |
633 (Scan.repeat parse_decorated_atom --| $$ "|" --| $$ "|" |
631 (Scan.repeat parse_decorated_atom --| $$ "|" --| $$ "|" |
634 -- Scan.repeat parse_decorated_atom --| $$ "-" --| $$ ">" |
632 -- Scan.repeat parse_decorated_atom --| $$ "-" --| $$ ">" |
635 -- Scan.repeat parse_decorated_atom |
633 -- Scan.repeat parse_decorated_atom |