That AQL I would guess it should contain something like:
....
FROM EHR e
CONTAINS VERSION v [LATEST_VERSION]
CONTAINS COMPOSITION c
WHERE
v/lifecycle_state/defining_code/code_string = 523
...
About the use-case, I think it sounds very much reasonable, and is exactly for what I was looking as a feedback to improve REST specifications, as alternative to get this data without the of AQL. For instance in this case a GET /ehr/{ehr_id}/composition?lifecycle_state=deleted (thus retrieve all deleted compositions) or a GET /admin/ehr/{ehr_id}/contribution?audit_details.change_type=deleted(admin-level get all contribution that were about content soft delete) might make some sense. Any suggestion ?