> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Perform backward chaining to prove a goal

> Perform backward-chaining proof search. **Required scope:** write

Perform backward-chaining proof search.

**Required scope:** `write`

### Request body

`BackwardChainRequest`

<ParamField body="goal_args" type="string[]" required>
  Arguments for the goal
</ParamField>

<ParamField body="goal_predicate" type="string" required>
  The goal to prove
</ParamField>

<ParamField body="max_depth" type="integer">
  Maximum proof depth
</ParamField>

<ParamField body="use_belief_guard" type="boolean">
  Route the proof through the AGM belief guard: consult entrenchment before search, expand/revise the belief base with each proof.
</ParamField>

### Response

`BackwardChainResponse`

<ResponseField name="belief_actions" type="string[]">
  Audit log of AGM belief-base mutations (present iff `use_belief_guard`).
</ResponseField>

<ResponseField name="proofs" type="ProofInfo[]" required>
  <Expandable title="ProofInfo">
    <ResponseField name="confidence" type="number (float)" required />

    <ResponseField name="steps" type="string[]" required />

    <ResponseField name="substitution" type="object" required />
  </Expandable>
</ResponseField>

<ResponseField name="proved" type="boolean" required />

<ResponseField name="total_proofs" type="integer" required />

### Status codes

| Code  | Meaning                                            |
| ----- | -------------------------------------------------- |
| `200` | Backward chaining completed                        |
| `400` | Invalid request                                    |
| `401` | Unauthorized — missing or invalid credentials      |
| `403` | Forbidden — the key/token lacks the required scope |
| `429` | Rate limited — see Retry-After / X-RateLimit-Reset |
| `500` | Backward chaining failed                           |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.nsr.stateset.com/api/v1/backward-chain' \
    --header 'X-API-Key: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
    "goal_args": [
      "string"
    ],
    "goal_predicate": "string",
    "max_depth": 1,
    "use_belief_guard": true
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "belief_actions": [
      "string"
    ],
    "proofs": [
      {
        "confidence": 7.5,
        "steps": [],
        "substitution": {}
      }
    ],
    "proved": true,
    "total_proofs": 1
  }
  ```
</ResponseExample>
