UPDE — PHA-C Lean Kinematic Proof Obligation¶
PHACKinematicProofObligation is the review-only bridge between a verified
runtime PHACAcceptanceRecord and the Lean module SPOFormal.Kinematic. It
converts the accepted PHA-C trajectory envelope into fixed-point natural-number
fields that match KinematicBounds, then signs the manifest with a
deterministic SHA-256 hash.
Formal guarantee boundary¶
The Lean files prove arithmetic certificate predicates over the fixed-point manifest fields named below. They do not prove that a live plant, accelerator, hardware bridge, QPU, neuromorphic target, or external controller will remain safe. The runtime still needs sensor calibration, actuator bounds, deployment network controls, and operator approval before any result can be promoted from review evidence to operational evidence.
Current release guarantees are therefore scoped as follows:
| Surface | What is proven or checked | What is not claimed |
|---|---|---|
Lean SPOFormal.Kinematic |
fixed-point kinematic, sampled-rate, phase-budget, and acceptance certificate implications | real-analysis proof of the physical system or hardware actuation safety |
| Python verifier | schema, theorem names, fixed-point arithmetic replay, hash replay, and disabled-execution flags | independent theorem proving |
| Rust/Go/Julia/Mojo PHA-C rows | source-contract parity and benchmark/reference gates where toolchains are available | universal native execution across every downstream language row |
| Release docs | review-only handoff evidence for MIF/FRC consumers | automatic permission to actuate live systems |
The obligation does not execute Lean, write to hardware, mutate a supervisor, or change a coupling policy. It records the exact theorem and Boolean certificate predicate that a reviewer or CI proof gate must use:
- Lean module:
SPOFormal.Kinematic - Predicate:
KinematicBounds.budgetCertificate - Theorem:
budget_certificate_discharges_budget - Continuous-envelope module:
SPOFormal.Continuous - Continuous predicate:
ContinuousEnvelopeBounds.budgetCertificate - Continuous theorem:
continuous_envelope_certificate_discharges_horizon - Phase-budget module:
SPOFormal.Kinematic - Phase predicate:
PhaseBudgetBounds.budgetCertificate - Phase theorem:
phase_budget_certificate_discharges_phase_lock - Combined acceptance predicate:
KinematicBounds.acceptanceCertificate - Combined acceptance theorem:
acceptance_certificate_discharges_runtime_preconditions
Use cases¶
Use this manifest when the PHA-C acceptance chain needs a formal review bridge:
- MIF/FRC handoff packages that need fixed-point assumptions to specialise into downstream constants;
- release evidence that must prove runtime PHA-C acceptance has a named Lean theorem target, not only empirical trajectory hashes;
- benchmark gates that must fail when the accepted trajectory no longer fits the finite-horizon Gronwall merge-window certificate;
- Studio or audit panels that need a compact proof-obligation hash without exposing raw trajectory arrays.
Fixed-point mapping¶
The builder first verifies the source PHACAcceptanceRecord, then projects the
runtime envelope into integer units:
| Manifest field | Runtime source | Lean role |
|---|---|---|
time_step_s |
accepted integration dt |
sampled-rate time step |
fixed_point_time_scale_s |
manifest time scale, default 1e-6 |
sampled-rate fixed-point clock |
time_scale_units_per_second |
ceil(1 / fixed_point_time_scale_s) |
sampled-rate denominator |
time_step_units |
ceil(time_step_s / fixed_point_time_scale_s) |
sampled-rate numerator |
horizon_time_units |
horizon_steps * time_step_units |
reviewed horizon duration |
initial_tolerance_units |
max observed spatial dispersion | KinematicBounds.initialTolerance |
lipschitz_step_gain_units |
explicit control, default 0 |
KinematicBounds.lipschitzStepGain |
relative_velocity_rate_bound_units_per_second |
predictive slack divided by dt |
SampledRateKinematicBounds.relativeVelocityRateBound |
relative_velocity_step_bound_units |
explicit predictive slack, default 0 |
KinematicBounds.relativeVelocityStepBound |
configured_coupling_residual_step_bound_units |
explicit predictive residual slack, default 0 |
residual-bound provenance |
coupling_residual_rate_bound_units_per_second |
max of configured residual slack and observed moving-frame residual, divided by dt |
SampledRateKinematicBounds.couplingResidualRateBound |
coupling_residual_step_bound_units |
max of configured residual slack and observed moving-frame residual | KinematicBounds.couplingResidualStepBound |
continuous_drive_rate_bound_units_per_second |
velocity-rate plus residual-rate bound | ContinuousEnvelopeBounds.driveRateBound |
continuous_horizon_drive_bound_units |
sampled continuous drive over horizon_time_units |
ContinuousEnvelopeBounds.sampledDriveBoundAt |
continuous_linear_budget_units |
initial dispersion plus sampled horizon drive | ContinuousEnvelopeBounds.budgetAt |
continuous_margin_units |
merge tolerance minus continuous budget | ContinuousEnvelopeBounds.budgetCertificate |
merge_window_tolerance_units |
spatial merge tolerance | KinematicBounds.mergeWindowTolerance |
horizon_steps |
accepted PHA-C step count | KinematicBounds.horizonSteps |
phase_tolerance_units |
accepted phase tolerance | phase-lock certificate input |
max_phase_dispersion_units |
max observed phase dispersion | replayed phase evidence |
configured_phase_drift_bound_units |
explicit predictive phase-drift slack, default 0 |
phase-bound provenance |
phase_budget_units |
observed dispersion plus configured phase drift | phase-lock budget |
phase_margin_units |
phase tolerance minus phase budget | phase-lock certificate margin |
phase_budget_discharged |
phase_budget_units <= phase_tolerance_units |
PhaseBudgetBounds.budgetCertificate |
acceptance_kinematic_equations_validated |
verified acceptance record preserved final-position, velocity, and path-length equations | runtime-to-formal acceptance precondition |
acceptance_kinematic_summary_replay_tolerance |
replay tolerance inherited from PHACAcceptanceRecord |
runtime-to-formal tolerance provenance |
acceptance_kinematic_summary_replay_tolerance_units |
fixed-point replay tolerance | AcceptanceKinematicReplayBounds.summaryReplayTolerance |
acceptance_kinematic_summary_replay_tolerance_limit_units |
fixed-point replay tolerance limit | AcceptanceKinematicReplayBounds.summaryReplayToleranceLimit |
acceptance_replay_certificate_discharged |
equation flag plus tolerance bound | AcceptanceKinematicReplayBounds.replayCertificate |
acceptance_certificate_discharged |
spatial budget plus phase budget plus replay certificate | KinematicBounds.acceptanceCertificate |
The default is a replay certificate. The observed spatial dispersion already
includes the accepted moving-frame trajectory, while the residual term proves
the ballistic coordinate update was mechanically valid. Downstream predictive
lanes can provide non-zero relative_velocity_step_bound_m and non-zero
coupling_residual_step_bound_m values when they need a reviewed residual
envelope beyond the observed replay residual. The verifier requires the
configured residual units to fit inside the sampled residual bound before the
same Lean theorem can certify a future horizon rather than the replay envelope.
Non-zero lipschitz_step_gain_units can then be added for finite-horizon
growth.
The phase side is also explicit. Downstream lanes can provide
phase_drift_bound_rad when the reviewed handoff must budget future phase
drift in addition to the accepted replay dispersion. The manifest records that
slack as configured_phase_drift_bound_units, records
phase_budget_units = max_phase_dispersion_units +
configured_phase_drift_bound_units, and derives phase_margin_units from the
budget rather than from replay dispersion alone. The manifest names the Lean
PhaseBudgetBounds.budgetCertificate predicate and
phase_budget_certificate_discharges_phase_lock theorem so the phase budget is
reviewed by a formal fixed-point mirror instead of only by Python arithmetic.
The Boolean phase_budget_discharged must match that theorem condition exactly
before the combined PHA-C proof obligations can discharge.
The manifest also carries acceptance_kinematic_equations_validated and
acceptance_kinematic_summary_replay_tolerance. These fields bind the Lean
obligation to the verified acceptance record's final-position,
maximum-velocity, and path-length equation replay, so a formal manifest cannot
be detached from mechanically valid moving-frame summary evidence.
The Lean mirror now names the same requirement as
AcceptanceKinematicReplayBounds.replayCertificate and folds it into
KinematicBounds.acceptanceCertificate. A release reviewer can therefore check
one Boolean fixed-point acceptance certificate that joins the spatial Gronwall
budget, phase-lock budget, and runtime equation-replay provenance instead of
reviewing the replay flag as loose metadata. The Python manifest now records
acceptance_certificate_predicate,
acceptance_certificate_theorem, acceptance_replay_certificate_discharged,
and acceptance_certificate_discharged, and the verifier recomputes each field
from the same fixed-point units before accepting the manifest hash.
For non-zero gain, the runtime manifest replays the Lean recurrence
previous + gain * previous + drive, records the terminal
gronwall_budget_units, records the signed
gronwall_budget_margin_units, and hashes the full budget trace as
gronwall_budget_trace_sha256. The legacy linear_budget_units field remains
as the zero-gain reference budget; the merge-window margin is now derived from
the Gronwall terminal budget.
For continuous-rate handoffs, the manifest also records a sampled-rate mirror:
per-second relative-velocity and residual bounds are sampled through
time_step_units / time_scale_units_per_second before they enter the discrete
Lean budget. The Lean side names this bridge SampledRateKinematicBounds and
proves that a sampled-rate certificate discharges the same finite-horizon
merge-window budget after conversion to KinematicBounds.
The manifest also records the continuous-envelope theorem target. That layer
samples the same per-second rates over horizon_time_units, records the
continuous horizon drive, and requires the signed continuous margin to be
non-negative before proof_obligations_discharged can be true. The Lean side
names this boundary ContinuousEnvelopeBounds; it is a dependency-light
fixed-point continuous envelope, not a Mathlib real-analysis proof.
Minimal example¶
from scpn_phase_orchestrator.upde.pha_c_acceptance import (
build_pha_c_acceptance_record,
)
from scpn_phase_orchestrator.upde.pha_c_formal_obligation import (
build_pha_c_kinematic_proof_obligation,
verify_pha_c_kinematic_proof_obligation,
)
record = build_pha_c_acceptance_record(...)
obligation = build_pha_c_kinematic_proof_obligation(record)
assert obligation.lean_theorem == "budget_certificate_discharges_budget"
assert obligation.acceptance_certificate_predicate == (
"KinematicBounds.acceptanceCertificate"
)
assert obligation.acceptance_certificate_theorem == (
"acceptance_certificate_discharges_runtime_preconditions"
)
assert obligation.acceptance_replay_certificate_discharged
assert obligation.acceptance_certificate_discharged
assert obligation.proof_obligations_discharged
verify_pha_c_kinematic_proof_obligation(obligation)
Verification boundary¶
verify_pha_c_kinematic_proof_obligation(...) checks:
- exact schema, evidence kind, claim boundary, Lean kinematic, continuous, and phase-budget module, predicate, and theorem names;
- review-only flags:
execution_disabled=Trueandactuating=False; - finite positive metric and phase fixed-point scales;
- finite positive time scale and accepted time-step sampling fields;
- natural-number fields and the Lean equations for drive, linear zero-gain reference budget, Gronwall budget trace, terminal budget, and merge-window margin;
- continuous-envelope theorem metadata, drive-rate sum, horizon-drive replay, continuous budget, and continuous margin;
- configured residual-bound provenance and its fit inside the sampled residual drive bound;
- configured phase-drift provenance, phase-budget replay, and phase tolerance margin consistency;
phase_budget_dischargedreplay against the LeanPhaseBudgetBounds.budgetCertificatecondition;acceptance_kinematic_equations_validatedreplay against the verified acceptance record's moving-frame summary equations;- fixed-point replay-tolerance units, replay certificate discharge, and the
combined
KinematicBounds.acceptanceCertificatedischarge; - lower-case SHA-256 fields; and
- canonical manifest hash replay.
If proof_obligations_discharged disagrees with the fixed-point certificate
math, verification fails closed.
The public serialisation helpers
PHACKinematicProofObligation.to_dict() and
pha_c_kinematic_proof_obligation_to_dict(...) call the same verifier before
returning a manifest. A stale or tampered dataclass therefore cannot publish a
canonical JSON payload without replaying the fixed-point certificate checks and
hash validation first.
PHACKinematicProofObligation
dataclass
¶
PHACKinematicProofObligation(
schema_version: str,
evidence_kind: str,
claim_boundary: str,
acceptance_claim_boundary: str,
execution_disabled: bool,
actuating: bool,
lean_module: str,
lean_certificate_predicate: str,
lean_theorem: str,
continuous_lean_module: str,
continuous_certificate_predicate: str,
continuous_theorem: str,
phase_lean_module: str,
phase_certificate_predicate: str,
phase_theorem: str,
acceptance_certificate_predicate: str,
acceptance_certificate_theorem: str,
fixed_point_scale_m: float,
fixed_point_scale_rad: float,
fixed_point_time_scale_s: float,
time_step_s: float,
time_scale_units_per_second: int,
time_step_units: int,
horizon_time_units: int,
initial_tolerance_units: int,
lipschitz_step_gain_units: int,
relative_velocity_rate_bound_units_per_second: int,
relative_velocity_step_bound_units: int,
configured_coupling_residual_step_bound_units: int,
coupling_residual_rate_bound_units_per_second: int,
coupling_residual_step_bound_units: int,
continuous_drive_rate_bound_units_per_second: int,
continuous_horizon_drive_bound_units: int,
continuous_linear_budget_units: int,
continuous_margin_units: int,
drive_bound_units: int,
merge_window_tolerance_units: int,
horizon_steps: int,
linear_budget_units: int,
gronwall_budget_units: int,
gronwall_budget_margin_units: int,
gronwall_budget_trace_sha256: str,
window_budget_margin_units: int,
phase_tolerance_units: int,
max_phase_dispersion_units: int,
configured_phase_drift_bound_units: int,
phase_budget_units: int,
phase_margin_units: int,
phase_budget_discharged: bool,
acceptance_kinematic_equations_validated: bool,
acceptance_kinematic_summary_replay_tolerance: float,
acceptance_kinematic_summary_replay_tolerance_units: int,
acceptance_kinematic_summary_replay_tolerance_limit_units: int,
acceptance_replay_certificate_discharged: bool,
acceptance_certificate_discharged: bool,
observed_velocity_step_units: int,
kinematic_residual_units: int,
path_length_units: int,
max_spatial_dispersion_units: int,
continuous_envelope_discharged: bool,
proof_obligations_discharged: bool,
acceptance_sha256: str,
timeline_sha256: str,
record_sha256: str,
)
Review-only fixed-point obligations linked to the Lean kinematic proof.
build_pha_c_kinematic_proof_obligation ¶
build_pha_c_kinematic_proof_obligation(
record: PHACAcceptanceRecord,
*,
fixed_point_scale_m: float = PHA_C_FORMAL_DEFAULT_SCALE_M,
fixed_point_scale_rad: float = PHA_C_FORMAL_DEFAULT_SCALE_RAD,
fixed_point_time_scale_s: float = PHA_C_FORMAL_DEFAULT_TIME_SCALE_S,
relative_velocity_step_bound_m: float = 0.0,
coupling_residual_step_bound_m: float = 0.0,
phase_drift_bound_rad: float = 0.0,
lipschitz_step_gain_units: int = 0,
) -> PHACKinematicProofObligation
Project a verified PHA-C acceptance record into Lean proof obligations.
The default obligation is a replay certificate: the maximum observed
spatial dispersion is already measured over the accepted trajectory, so the
Lean drive term only includes explicitly supplied future relative-velocity
slack and the signed moving-frame residual. MIF/FRC specialisations can
provide non-zero relative_velocity_step_bound_m and
coupling_residual_step_bound_m, phase_drift_bound_rad, and
lipschitz_step_gain_units values when they want a predictive
finite-horizon Gronwall certificate instead of a replay-only envelope.
Parameters¶
record : PHACAcceptanceRecord The PHA-C record to operate on. fixed_point_scale_m : float Spatial fixed-point scale in metres. fixed_point_scale_rad : float Phase fixed-point scale in radians. fixed_point_time_scale_s : float Temporal fixed-point scale in seconds. relative_velocity_step_bound_m : float Per-step relative-velocity bound in metres. coupling_residual_step_bound_m : float Per-step coupling-residual bound in metres. phase_drift_bound_rad : float Per-step phase-drift bound in radians. lipschitz_step_gain_units : int Lipschitz step-gain bound in dimensionless integer units.
Returns¶
PHACKinematicProofObligation The Lean proof-obligation projection of the acceptance record.
Source code in src/scpn_phase_orchestrator/upde/pha_c_formal_obligation.py
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | |
pha_c_kinematic_proof_obligation_to_dict ¶
pha_c_kinematic_proof_obligation_to_dict(
obligation: PHACKinematicProofObligation,
) -> dict[str, bool | float | int | str]
Return a verified canonical JSON-safe proof-obligation manifest.
Parameters¶
obligation : PHACKinematicProofObligation The PHA-C kinematic proof obligation to verify and serialise.
Returns¶
dict[str, bool | float | int | str] The verified canonical JSON-safe proof-obligation manifest.
Source code in src/scpn_phase_orchestrator/upde/pha_c_formal_obligation.py
verify_pha_c_kinematic_proof_obligation ¶
verify_pha_c_kinematic_proof_obligation(
obligation: PHACKinematicProofObligation,
) -> PHACKinematicProofObligation
Validate a PHA-C Lean proof-obligation manifest fail-closed.
Parameters¶
obligation : PHACKinematicProofObligation The PHA-C kinematic proof obligation to operate on.
Returns¶
PHACKinematicProofObligation The same obligation after fail-closed validation.
Raises¶
TypeError If the manifest has the wrong type. ValueError If the manifest fails validation.
Source code in src/scpn_phase_orchestrator/upde/pha_c_formal_obligation.py
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 | |