Documentation

Linglib.Tactics.RSAPredict.ReflectBridge

RSAPredict Reflection Bridge #

Direct RExpr reification for all RSA comparison goals.

Design #

The proof-free reifier builds RExpr AST nodes whose denote is definitionally equal to the original expression. The kernel verifies this via iota-reduction of denote (structural recursion, O(1) per node).

  1. Reify: Convert both sides of the comparison to RExpr AST + meta-level bounds. No congruence proof trees — the kernel handles definitional equality.
  2. Check: native_decide on checkGtOptMemo/checkNotGtOpt (evalValid + separation).
  3. Assign: Directly assign gt_of_checkGtOptMemo lhsRExpr rhsRExpr hcheck — the kernel verifies denote(lhsRExpr) ≡ lhsExpr and denote(rhsRExpr) ≡ rhsExpr.

This eliminates the congruence proof tree (O(n) nodes → O(1) proof term) and the equality bridge (gt_of_eq_gt_eq), reducing both reification time and proof term size.

Try to unfold an expression to RationalAction.policy ra s a.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    Extract RSA config and arguments from a policy expression. Returns (cfg, u, w) where the expression is cfg.L1 u w.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Extract RSA config and arguments from a policy expression. Returns (cfg, l, w, u) where the expression is cfg.S1 l w u.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Module-scope reification cache shared across all rsa_predict invocations within a file. The first theorem pays the full reification cost; subsequent theorems for the same model get cache hits on shared sub-expressions (L0 policies, S1 scores, belief distributions, etc.).

        Direct RExpr reification for lhs > rhs goals. Runs native_decide on tree-based checkGtOptMemo (sorry-free soundness).

        When both sides are policy ra s a₁/a₂ with the same ra and s, applies denominator cancellation first via policy_gt_of_score_gt, reducing the goal to a score comparison that skips the shared normalization constant.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Direct RExpr reification for not (lhs > rhs) goals. Assigns proofs directly — the kernel verifies denote ≡ original.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Direct RExpr reification for lhs = rhs goals. Tries structural equality first (same RExpr), then exact ℚ evaluation.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For