Relating Answer Set Programming and Many-sorted Logics for Formal Verification