{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.calculatorx.com/schemas/math.pythagorean.output.json",
  "title": "Pythagorean theorem — success output",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "status",
    "capability_id",
    "engine",
    "inputs",
    "result",
    "result_detail",
    "calculation_version",
    "verification",
    "review"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Requested tool id"
    },
    "status": {
      "const": "success"
    },
    "capability_id": {
      "const": "math.pythagorean"
    },
    "tool": {
      "type": "string",
      "description": "Requested tool id"
    },
    "engine": {
      "type": "string"
    },
    "inputs": {
      "description": "Normalized calculation inputs (aliases resolved to canonical form)",
      "type": "object",
      "properties": {
        "mode": {
          "enum": [
            "solve",
            "verify"
          ]
        },
        "solve_for": {
          "enum": [
            "a",
            "b",
            "c"
          ]
        },
        "a": {
          "type": "number",
          "exclusiveMinimum": 0,
          "x-quantity-kind": "length",
          "x-dimension": [
            1,
            0,
            0,
            0,
            0,
            0,
            0
          ],
          "x-unit-policy": "arbitrary_consistent_length",
          "x-uuce-role": "scalar"
        },
        "b": {
          "type": "number",
          "exclusiveMinimum": 0,
          "x-quantity-kind": "length",
          "x-dimension": [
            1,
            0,
            0,
            0,
            0,
            0,
            0
          ],
          "x-unit-policy": "arbitrary_consistent_length",
          "x-uuce-role": "scalar"
        },
        "c": {
          "type": "number",
          "exclusiveMinimum": 0,
          "x-quantity-kind": "length",
          "x-dimension": [
            1,
            0,
            0,
            0,
            0,
            0,
            0
          ],
          "x-unit-policy": "arbitrary_consistent_length",
          "x-uuce-role": "scalar"
        }
      },
      "required": [
        "mode"
      ],
      "additionalProperties": false
    },
    "result": {
      "type": "object",
      "properties": {
        "calculation_version": {
          "const": "1.2.0"
        },
        "status": {
          "enum": [
            "success",
            "invalid"
          ]
        },
        "mode": {
          "enum": [
            "solve",
            "verify"
          ]
        },
        "solve_for": {
          "enum": [
            "a",
            "b",
            "c",
            null
          ]
        },
        "mode_label": {
          "type": "string"
        },
        "formula": {
          "type": "string"
        },
        "heading": {
          "type": "string"
        },
        "value": {
          "type": [
            "number",
            "null"
          ]
        },
        "a": {
          "type": "number",
          "exclusiveMinimum": 0,
          "x-quantity-kind": "length",
          "x-dimension": [
            1,
            0,
            0,
            0,
            0,
            0,
            0
          ],
          "x-unit-policy": "arbitrary_consistent_length",
          "x-uuce-role": "scalar"
        },
        "b": {
          "type": "number",
          "exclusiveMinimum": 0,
          "x-quantity-kind": "length",
          "x-dimension": [
            1,
            0,
            0,
            0,
            0,
            0,
            0
          ],
          "x-unit-policy": "arbitrary_consistent_length",
          "x-uuce-role": "scalar"
        },
        "c": {
          "type": "number",
          "exclusiveMinimum": 0,
          "x-quantity-kind": "length",
          "x-dimension": [
            1,
            0,
            0,
            0,
            0,
            0,
            0
          ],
          "x-unit-policy": "arbitrary_consistent_length",
          "x-uuce-role": "scalar"
        },
        "area": {
          "type": [
            "number",
            "null"
          ],
          "x-quantity-kind": "area",
          "x-dimension": [
            2,
            0,
            0,
            0,
            0,
            0,
            0
          ],
          "x-unit-policy": "input_length_unit_squared",
          "x-uuce-role": "scalar"
        },
        "perimeter": {
          "type": [
            "number",
            "null"
          ],
          "x-quantity-kind": "length",
          "x-dimension": [
            1,
            0,
            0,
            0,
            0,
            0,
            0
          ],
          "x-unit-policy": "arbitrary_consistent_length",
          "x-uuce-role": "scalar"
        },
        "valid": {
          "type": "boolean"
        },
        "message": {
          "type": [
            "string",
            "null"
          ]
        },
        "explainer": {
          "type": "string"
        },
        "inputs_summary": {
          "type": "string"
        },
        "steps": {
          "type": "array",
          "minItems": 6,
          "maxItems": 6,
          "items": {
            "type": "string"
          }
        },
        "radicand": {
          "type": [
            "number",
            "null"
          ]
        },
        "exact": {
          "type": [
            "string",
            "null"
          ]
        },
        "display": {
          "type": "object",
          "properties": {
            "value": {
              "type": "string"
            },
            "exact": {
              "type": [
                "string",
                "null"
              ]
            },
            "a": {
              "type": "string"
            },
            "b": {
              "type": "string"
            },
            "c": {
              "type": "string"
            },
            "area": {
              "type": "string"
            },
            "perimeter": {
              "type": "string"
            }
          },
          "required": [
            "value",
            "exact",
            "a",
            "b",
            "c",
            "area",
            "perimeter"
          ],
          "additionalProperties": false
        },
        "triangle": {
          "type": "object",
          "properties": {
            "a": {
              "type": "number",
              "x-quantity-kind": "length",
              "x-dimension": [
                1,
                0,
                0,
                0,
                0,
                0,
                0
              ],
              "x-unit-policy": "arbitrary_consistent_length",
              "x-uuce-role": "scalar"
            },
            "b": {
              "type": "number",
              "x-quantity-kind": "length",
              "x-dimension": [
                1,
                0,
                0,
                0,
                0,
                0,
                0
              ],
              "x-unit-policy": "arbitrary_consistent_length",
              "x-uuce-role": "scalar"
            },
            "c": {
              "type": "number",
              "x-quantity-kind": "length",
              "x-dimension": [
                1,
                0,
                0,
                0,
                0,
                0,
                0
              ],
              "x-unit-policy": "arbitrary_consistent_length",
              "x-uuce-role": "scalar"
            },
            "highlight": {
              "enum": [
                "a",
                "b",
                "c",
                null
              ]
            },
            "valid": {
              "type": "boolean"
            }
          },
          "required": [
            "a",
            "b",
            "c",
            "highlight",
            "valid"
          ],
          "additionalProperties": false
        },
        "verify_evidence": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "object",
              "properties": {
                "abs_diff": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "relative": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "tolerance": {
                  "const": 0.000001
                },
                "scale": {
                  "type": "number",
                  "exclusiveMinimum": 0
                },
                "scaled_residual": {
                  "type": "number",
                  "minimum": 0
                },
                "triangle_valid": {
                  "type": "boolean"
                }
              },
              "required": [
                "abs_diff",
                "relative",
                "tolerance",
                "scale",
                "scaled_residual",
                "triangle_valid"
              ],
              "additionalProperties": false
            }
          ]
        },
        "area_status": {
          "enum": [
            "ok",
            "range",
            "not_applicable"
          ]
        },
        "perimeter_status": {
          "enum": [
            "ok",
            "range"
          ]
        },
        "algorithm": {
          "enum": [
            "scaled-hypot",
            "scaled-difference-of-squares",
            "scaled-squared-residual"
          ]
        },
        "numeric_domain": {
          "const": "real"
        },
        "exactness": {
          "const": "approximate"
        },
        "numeric_backend": {
          "const": "binary64"
        }
      },
      "required": [
        "calculation_version",
        "status",
        "mode",
        "solve_for",
        "mode_label",
        "formula",
        "heading",
        "value",
        "a",
        "b",
        "c",
        "area",
        "perimeter",
        "valid",
        "message",
        "explainer",
        "inputs_summary",
        "steps",
        "radicand",
        "exact",
        "display",
        "triangle",
        "verify_evidence",
        "area_status",
        "perimeter_status",
        "algorithm",
        "numeric_domain",
        "exactness",
        "numeric_backend"
      ],
      "additionalProperties": false
    },
    "result_detail": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "value",
        "unit",
        "formatted"
      ],
      "properties": {
        "unit_contract": {
          "type": "object",
          "const": {
            "protocol": "calculatorx-field-unit-contract-v1",
            "capability_id": "math.pythagorean",
            "registry_version": "0.3.0-preview.3",
            "declaration_scope": "Field/branch declarations only; inactive fields are not asserted to exist. No conversion-engine migration or new numerical certification.",
            "path_format": "Paths relative to inputs or result_detail.value; dot separates properties, * denotes array items, $ denotes a scalar result.",
            "inputs": {},
            "outputs": {},
            "quantity_policy": {
              "physical_unit_id": null,
              "input_policy": "Abstract consistent coordinate/length units; no physical unit is selected by this calculator.",
              "derived_policy": "Lengths inherit the input length unit U; areas U^2; volumes U^3. No implicit conversion or fixed metre binding.",
              "coefficient_policy": "Normalized implicit line/equation coefficients have equation-scale conventions, not universal physical unit IDs.",
              "model_roles": "leg/hypotenuse are geometric model roles, distinct from the UUCE scalar unit role."
            }
          }
        },
        "value": {
          "type": "object",
          "properties": {
            "calculation_version": {
              "const": "1.2.0"
            },
            "status": {
              "enum": [
                "success",
                "invalid"
              ]
            },
            "mode": {
              "enum": [
                "solve",
                "verify"
              ]
            },
            "solve_for": {
              "enum": [
                "a",
                "b",
                "c",
                null
              ]
            },
            "mode_label": {
              "type": "string"
            },
            "formula": {
              "type": "string"
            },
            "heading": {
              "type": "string"
            },
            "value": {
              "type": [
                "number",
                "null"
              ]
            },
            "a": {
              "type": "number",
              "exclusiveMinimum": 0,
              "x-quantity-kind": "length",
              "x-dimension": [
                1,
                0,
                0,
                0,
                0,
                0,
                0
              ],
              "x-unit-policy": "arbitrary_consistent_length",
              "x-uuce-role": "scalar"
            },
            "b": {
              "type": "number",
              "exclusiveMinimum": 0,
              "x-quantity-kind": "length",
              "x-dimension": [
                1,
                0,
                0,
                0,
                0,
                0,
                0
              ],
              "x-unit-policy": "arbitrary_consistent_length",
              "x-uuce-role": "scalar"
            },
            "c": {
              "type": "number",
              "exclusiveMinimum": 0,
              "x-quantity-kind": "length",
              "x-dimension": [
                1,
                0,
                0,
                0,
                0,
                0,
                0
              ],
              "x-unit-policy": "arbitrary_consistent_length",
              "x-uuce-role": "scalar"
            },
            "area": {
              "type": [
                "number",
                "null"
              ],
              "x-quantity-kind": "area",
              "x-dimension": [
                2,
                0,
                0,
                0,
                0,
                0,
                0
              ],
              "x-unit-policy": "input_length_unit_squared",
              "x-uuce-role": "scalar"
            },
            "perimeter": {
              "type": [
                "number",
                "null"
              ],
              "x-quantity-kind": "length",
              "x-dimension": [
                1,
                0,
                0,
                0,
                0,
                0,
                0
              ],
              "x-unit-policy": "arbitrary_consistent_length",
              "x-uuce-role": "scalar"
            },
            "valid": {
              "type": "boolean"
            },
            "message": {
              "type": [
                "string",
                "null"
              ]
            },
            "explainer": {
              "type": "string"
            },
            "inputs_summary": {
              "type": "string"
            },
            "steps": {
              "type": "array",
              "minItems": 6,
              "maxItems": 6,
              "items": {
                "type": "string"
              }
            },
            "radicand": {
              "type": [
                "number",
                "null"
              ]
            },
            "exact": {
              "type": [
                "string",
                "null"
              ]
            },
            "display": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                },
                "exact": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "a": {
                  "type": "string"
                },
                "b": {
                  "type": "string"
                },
                "c": {
                  "type": "string"
                },
                "area": {
                  "type": "string"
                },
                "perimeter": {
                  "type": "string"
                }
              },
              "required": [
                "value",
                "exact",
                "a",
                "b",
                "c",
                "area",
                "perimeter"
              ],
              "additionalProperties": false
            },
            "triangle": {
              "type": "object",
              "properties": {
                "a": {
                  "type": "number",
                  "x-quantity-kind": "length",
                  "x-dimension": [
                    1,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0
                  ],
                  "x-unit-policy": "arbitrary_consistent_length",
                  "x-uuce-role": "scalar"
                },
                "b": {
                  "type": "number",
                  "x-quantity-kind": "length",
                  "x-dimension": [
                    1,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0
                  ],
                  "x-unit-policy": "arbitrary_consistent_length",
                  "x-uuce-role": "scalar"
                },
                "c": {
                  "type": "number",
                  "x-quantity-kind": "length",
                  "x-dimension": [
                    1,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0
                  ],
                  "x-unit-policy": "arbitrary_consistent_length",
                  "x-uuce-role": "scalar"
                },
                "highlight": {
                  "enum": [
                    "a",
                    "b",
                    "c",
                    null
                  ]
                },
                "valid": {
                  "type": "boolean"
                }
              },
              "required": [
                "a",
                "b",
                "c",
                "highlight",
                "valid"
              ],
              "additionalProperties": false
            },
            "verify_evidence": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "type": "object",
                  "properties": {
                    "abs_diff": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "relative": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "tolerance": {
                      "const": 0.000001
                    },
                    "scale": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "scaled_residual": {
                      "type": "number",
                      "minimum": 0
                    },
                    "triangle_valid": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "abs_diff",
                    "relative",
                    "tolerance",
                    "scale",
                    "scaled_residual",
                    "triangle_valid"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "area_status": {
              "enum": [
                "ok",
                "range",
                "not_applicable"
              ]
            },
            "perimeter_status": {
              "enum": [
                "ok",
                "range"
              ]
            },
            "algorithm": {
              "enum": [
                "scaled-hypot",
                "scaled-difference-of-squares",
                "scaled-squared-residual"
              ]
            },
            "numeric_domain": {
              "const": "real"
            },
            "exactness": {
              "const": "approximate"
            },
            "numeric_backend": {
              "const": "binary64"
            }
          },
          "required": [
            "calculation_version",
            "status",
            "mode",
            "solve_for",
            "mode_label",
            "formula",
            "heading",
            "value",
            "a",
            "b",
            "c",
            "area",
            "perimeter",
            "valid",
            "message",
            "explainer",
            "inputs_summary",
            "steps",
            "radicand",
            "exact",
            "display",
            "triangle",
            "verify_evidence",
            "area_status",
            "perimeter_status",
            "algorithm",
            "numeric_domain",
            "exactness",
            "numeric_backend"
          ],
          "additionalProperties": false
        },
        "unit": {
          "type": [
            "string",
            "null"
          ]
        },
        "formatted": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "formula": {
      "anyOf": [
        {
          "type": "null"
        },
        {
          "type": "string"
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string"
            },
            "expression": {
              "type": "string"
            },
            "label": {
              "type": "string"
            }
          }
        }
      ]
    },
    "assumptions": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "severity": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "suggestion": {
            "type": "string"
          }
        }
      }
    },
    "verification": {
      "type": "object",
      "additionalProperties": true,
      "description": "Computational verification under CVP. Review-policy tiers live on `review`, not here.",
      "required": [
        "cvp"
      ],
      "properties": {
        "cvp": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "status",
            "protocol",
            "profile",
            "verified_scope",
            "verification_revision",
            "evidence_digest"
          ],
          "properties": {
            "status": {
              "type": "string",
              "description": "CVP verification status (e.g. VERIFIED)"
            },
            "protocol": {
              "type": "string",
              "description": "CVP protocol id, e.g. 1.0.0-proposed"
            },
            "profile": {
              "type": "string"
            },
            "verified_scope": {
              "type": "string"
            },
            "verification_revision": {
              "type": [
                "string",
                "null"
              ]
            },
            "evidence_digest": {
              "type": [
                "string",
                "null"
              ]
            },
            "production": {
              "type": [
                "string",
                "null"
              ],
              "description": "Production freshness, e.g. CURRENT"
            },
            "evidence": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      }
    },
    "review": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "tier",
        "engine_tested",
        "expert_reviewed",
        "source_checked",
        "reviewed_by",
        "reviewer_role",
        "last_reviewed"
      ],
      "properties": {
        "tier": {
          "type": "string",
          "enum": [
            "candidate",
            "engine_tested",
            "internally_reviewed",
            "expert_verified"
          ]
        },
        "engine_tested": {
          "type": "boolean"
        },
        "expert_reviewed": {
          "type": "boolean"
        },
        "internally_reviewed": {
          "type": "boolean"
        },
        "review_kind": {
          "type": [
            "string",
            "null"
          ]
        },
        "source_checked": {
          "type": "boolean"
        },
        "reviewed_by": {
          "type": [
            "string",
            "null"
          ]
        },
        "reviewer_role": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_reviewed": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "tier": {
                "const": "expert_verified"
              }
            },
            "required": [
              "tier"
            ]
          },
          "then": {
            "properties": {
              "engine_tested": {
                "const": true
              },
              "expert_reviewed": {
                "const": true
              },
              "source_checked": {
                "const": true
              },
              "reviewed_by": {
                "type": "string",
                "minLength": 1
              },
              "reviewer_role": {
                "type": "string",
                "minLength": 1
              },
              "last_reviewed": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "tier": {
                "const": "internally_reviewed"
              }
            },
            "required": [
              "tier"
            ]
          },
          "then": {
            "properties": {
              "engine_tested": {
                "const": true
              },
              "internally_reviewed": {
                "const": true
              },
              "source_checked": {
                "const": true
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "tier": {
                "const": "engine_tested"
              }
            },
            "required": [
              "tier"
            ]
          },
          "then": {
            "properties": {
              "engine_tested": {
                "const": true
              }
            }
          }
        }
      ]
    },
    "calculation_version": {
      "type": "string",
      "const": "1.2.0"
    },
    "api_version": {
      "type": "string"
    },
    "api_contract_version": {
      "type": "string"
    },
    "spec_version": {
      "type": "string"
    },
    "page": {
      "type": [
        "string",
        "null"
      ],
      "description": "Canonical calculator page URL"
    },
    "links": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_input": {
          "type": "string",
          "format": "uri"
        },
        "schema_output": {
          "type": "string",
          "format": "uri"
        },
        "evidence": {
          "type": "string",
          "format": "uri"
        },
        "openapi": {
          "type": "string",
          "format": "uri"
        },
        "capabilities": {
          "type": "string",
          "format": "uri"
        },
        "mcp": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  },
  "x-unit-contract": {
    "protocol": "calculatorx-field-unit-contract-v1",
    "capability_id": "math.pythagorean",
    "registry_version": "0.3.0-preview.3",
    "declaration_scope": "Field/branch declarations only; inactive fields are not asserted to exist. No conversion-engine migration or new numerical certification.",
    "path_format": "Paths relative to inputs or result_detail.value; dot separates properties, * denotes array items, $ denotes a scalar result.",
    "inputs": {},
    "outputs": {},
    "quantity_policy": {
      "physical_unit_id": null,
      "input_policy": "Abstract consistent coordinate/length units; no physical unit is selected by this calculator.",
      "derived_policy": "Lengths inherit the input length unit U; areas U^2; volumes U^3. No implicit conversion or fixed metre binding.",
      "coefficient_policy": "Normalized implicit line/equation coefficients have equation-scale conventions, not universal physical unit IDs.",
      "model_roles": "leg/hypotenuse are geometric model roles, distinct from the UUCE scalar unit role."
    }
  }
}
