let translate log smt w =
let goal = Why.goal L_why w in
let base = Filename.chop_suffix goal ".why" in
let file = Printf.sprintf "%s_why.%s" base smt.ext in
let args = Array.append smt.why [| goal |] in
let stdout = Buffer.create 512 in
Log.command log "why" args ;
Task.command ~stdout "why" args
>>? Log.output log stdout
>>= fun res ->
if res = 0 then Task.return file
else Task.failed "Why exit %d" res