Closes #017 - Fix KaTeX rendering corruption and inject detailed blueprint contents

This commit is contained in:
Antigravity Agent
2026-06-14 12:41:18 +02:00
parent 94ccf63a38
commit 2f0599a3cd
6 changed files with 154 additions and 72 deletions

View File

@@ -62,15 +62,15 @@ export default function CryptoMathModal({ isOpen, onClose }: CryptoMathModalProp
</p>
<div className="grid grid-cols-3 gap-3 text-xs text-slate-400 font-mono text-center">
<div className="bg-slate-950/40 p-3 rounded-lg border border-slate-800/50">
<span className="block text-rose-400 font-bold">State 1 (S1)</span>
<span className="block text-rose-400 font-bold">State 1 (<InlineMath math="S_1" />)</span>
<span>Bearish Squeeze / Crackdown</span>
</div>
<div className="bg-slate-950/40 p-3 rounded-lg border border-slate-800/50">
<span className="block text-slate-300 font-bold">State 2 (S2)</span>
<span className="block text-slate-300 font-bold">State 2 (<InlineMath math="S_2" />)</span>
<span>Consolidation / Mean Reversion</span>
</div>
<div className="bg-slate-950/40 p-3 rounded-lg border border-slate-800/50">
<span className="block text-emerald-400 font-bold">State 3 (S3)</span>
<span className="block text-emerald-400 font-bold">State 3 (<InlineMath math="S_3" />)</span>
<span>Parabolic Bull Run</span>
</div>
</div>
@@ -83,9 +83,9 @@ export default function CryptoMathModal({ isOpen, onClose }: CryptoMathModalProp
Calculates transition probabilities over rolling 90-day return vectors:
</p>
<div className="bg-slate-950/40 p-4 rounded-xl border border-slate-800/60 my-2">
<BlockMath math="P = \\begin{bmatrix} p_{11} & p_{12} & p_{13} \\\\ p_{21} & p_{22} & p_{23} \\\\ p_{31} & p_{32} & p_{33} \\end{bmatrix}" />
<BlockMath math="P = \begin{bmatrix} p_{11} & p_{12} & p_{13} \\ p_{21} & p_{22} & p_{23} \\ p_{31} & p_{32} & p_{33} \end{bmatrix}" />
<p className="text-[11px] text-slate-400 font-mono mt-2 text-center">
{"where "}<InlineMath math="p_{ij} = P(X_{t+1} = S_j \\mid X_t = S_i)" />{" represents the frequency probability of moving from State i to State j."}
where <InlineMath math="p_{ij} = P(X_{t+1} = S_j \mid X_t = S_i)" /> represents the frequency probability of moving from State <InlineMath math="S_i" /> to State <InlineMath math="S_j" />.
</p>
</div>
</div>
@@ -97,13 +97,13 @@ export default function CryptoMathModal({ isOpen, onClose }: CryptoMathModalProp
When external alpha inputs (e.g. Funding Rate anomalies, Whale inflows) occur, state probabilities are updated using Bayes' theorem:
</p>
<div className="bg-slate-950/40 p-4 rounded-xl border border-slate-800/60 my-2">
<BlockMath math="P(S_i \\mid \\text{Alpha}) = \\frac{P(\\text{Alpha} \\mid S_i) \\times P(S_i)}{\\sum_{j=1}^3 P(\\text{Alpha} \\mid S_j) \\times P(S_j)}" />
<BlockMath math="P(S_i \mid \text{Alpha}) = \frac{P(\text{Alpha} \mid S_i) \times P(S_i)}{\sum_{j=1}^3 P(\text{Alpha} \mid S_j) \times P(S_j)}" />
<p className="text-[11px] text-slate-400 mt-2 font-mono leading-relaxed">
{"Where:"}
Where:
<br />
{"- "}<InlineMath math="P(S_i)" />{" is the prior state probability from the Markov transition matrix."}
- <InlineMath math="P(S_i)" /> is the prior state probability from the Markov transition matrix.
<br />
{"- "}<InlineMath math="P(\\text{Alpha} \\mid S_i)" />{" is the conditional likelihood of observing this whale spike / funding squeeze in State i."}
- <InlineMath math="P(\text{Alpha} \mid S_i)" /> is the conditional likelihood of observing this whale spike / funding squeeze in State <InlineMath math="S_i" />.
</p>
</div>
</div>
@@ -125,7 +125,7 @@ export default function CryptoMathModal({ isOpen, onClose }: CryptoMathModalProp
<p className="text-xs text-slate-400 leading-relaxed pt-2">
The Random Forest ensemble evaluates 10 non-linear decision trees to output the short-term and medium-term trend probabilities:
</p>
<BlockMath math="P_{\\text{ML}} = \\frac{1}{M} \\sum_{m=1}^{M} T_m(FR_t, OI_t, LS_t, W_t)" />
<BlockMath math="P_{\text{ML}} = \frac{1}{M} \sum_{m=1}^{M} T_m(FR_t, OI_t, LS_t, W_t)" />
</div>
</div>
@@ -138,23 +138,23 @@ export default function CryptoMathModal({ isOpen, onClose }: CryptoMathModalProp
<div className="bg-slate-950/40 p-5 rounded-2xl border border-slate-850 space-y-4">
<div>
<p className="text-xs text-slate-350 mb-2 font-semibold">1. Prior Distribution (Accuracy History):</p>
<BlockMath math="\\theta \\sim \\text{Beta}(\\alpha_{\\text{prior}}, \\beta_{\\text{prior}})" />
<BlockMath math="\theta \sim \text{Beta}(\alpha_{\text{prior}}, \beta_{\text{prior}})" />
<p className="text-[10px] text-slate-500 font-mono">
where <InlineMath math="\\alpha_{\\text{prior}}" /> represents historical prediction successes and <InlineMath math="\\beta_{\\text{prior}}" /> represents false alarms.
where <InlineMath math="\alpha_{\text{prior}}" /> represents historical prediction successes and <InlineMath math="\beta_{\text{prior}}" /> represents false alarms.
</p>
</div>
<div>
<p className="text-xs text-slate-350 mb-2 font-semibold">2. Likelihood Formulation (Binomial pseudo-observations):</p>
<BlockMath math="P(x \\mid \\theta) = \\binom{w}{k} \\theta^k (1 - \\theta)^{w - k}" />
<BlockMath math="P(x \mid \theta) = \binom{w}{k} \theta^k (1 - \theta)^{w - k}" />
<p className="text-[10px] text-slate-500 font-mono">
where <InlineMath math="k = P_{\\text{ML}} \\times w" /> is the number of simulated successes and <InlineMath math="w - k = (1 - P_{\\text{ML}}) \\times w" /> is the number of simulated failures.
where <InlineMath math="k = P_{\text{ML}} \times w" /> is the number of simulated successes and <InlineMath math="w - k = (1 - P_{\text{ML}}) \times w" /> is the number of simulated failures.
</p>
</div>
<div>
<p className="text-xs text-slate-350 mb-2 font-semibold">3. Conjugate Posterior Update:</p>
<BlockMath math="\\alpha_{\\text{post}} = \\alpha_{\\text{prior}} + k, \\quad \\beta_{\\text{post}} = \\beta_{\\text{prior}} + (w - k)" />
<BlockMath math="\alpha_{\text{post}} = \alpha_{\text{prior}} + k, \quad \beta_{\text{post}} = \beta_{\text{prior}} + (w - k)" />
</div>
</div>
</div>
@@ -163,20 +163,20 @@ export default function CryptoMathModal({ isOpen, onClose }: CryptoMathModalProp
<div className="space-y-3">
<h4 className="text-xs font-bold text-cyan-400 uppercase tracking-wider font-mono">F. Mathematical Proof of Posterior Mean Integration</h4>
<p className="text-xs leading-relaxed text-slate-400">
To resolve a single operational point-estimate from our posterior distribution, we integrate out the continuous parameter <InlineMath math="\\theta" /> to calculate the mathematical expectation of the posterior distribution:
To resolve a single operational point-estimate from our posterior distribution, we integrate out the continuous parameter <InlineMath math="\theta" /> to calculate the mathematical expectation of the posterior distribution:
</p>
<div className="bg-slate-950/40 p-5 rounded-2xl border border-slate-850 space-y-4">
<p className="text-xs text-slate-350 font-semibold">Posterior Expectation Integral Proof:</p>
<BlockMath math="\\mathbb{E}[\\theta \\mid \\text{Data}] = \\int_{0}^{1} \\theta \\cdot P(\\theta \\mid \\text{Data}) \\, d\\theta = \\int_{0}^{1} \\theta \\cdot \\frac{\\theta^{\\alpha_{\\text{post}}-1}(1-\\theta)^{\\beta_{\\text{post}}-1}}{\\text{B}(\\alpha_{\\text{post}}, \\beta_{\\text{post}})} \\, d\\theta" />
<BlockMath math="\mathbb{E}[\theta \mid \text{Data}] = \int_{0}^{1} \theta \cdot P(\theta \mid \text{Data}) \, d\theta = \int_{0}^{1} \theta \cdot \frac{\theta^{\alpha_{\text{post}}-1}(1-\theta)^{\beta_{\text{post}}-1}}{\text{B}(\alpha_{\text{post}}, \beta_{\text{post}})} \, d\theta" />
<p className="text-xs text-slate-400 leading-relaxed">
Using the definition of the Beta function <InlineMath math="\\text{B}(a, b) = \\frac{\\Gamma(a)\\Gamma(b)}{\\Gamma(a+b)}" /> and the recurrence relation <InlineMath math="\\Gamma(x+1) = x\\Gamma(x)" />:
Using the definition of the Beta function <InlineMath math="\text{B}(a, b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}" /> and the recurrence relation <InlineMath math="\Gamma(x+1) = x\Gamma(x)" />:
</p>
<BlockMath math="\\mathbb{E}[\\theta \\mid \\text{Data}] = \\frac{\\text{B}(\\alpha_{\\text{post}} + 1, \\beta_{\\text{post}})}{\\text{B}(\\alpha_{\\text{post}}, \\beta_{\\text{post}})} = \\frac{\\Gamma(\\alpha_{\\text{post}} + 1)\\Gamma(\\beta_{\\text{post}})}{\\Gamma(\\alpha_{\\text{post}} + \\beta_{\\text{post}} + 1)} \\cdot \\frac{\\Gamma(\\alpha_{\\text{post}} + \\beta_{\\text{post}})}{\\Gamma(\\alpha_{\\text{post}})\\Gamma(\\beta_{\\text{post}})}" />
<BlockMath math="\\mathbb{E}[\\theta \\mid \\text{Data}] = \\frac{\\alpha_{\\text{post}}\\Gamma(\\alpha_{\\text{post}})\\Gamma(\\beta_{\\text{post}})}{(\\alpha_{\\text{post}} + \\beta_{\\text{post}})\\Gamma(\\alpha_{\\text{post}} + \\beta_{\\text{post}})} \\cdot \\frac{\\Gamma(\\alpha_{\\text{post}} + \\beta_{\\text{post}})}{\\Gamma(\\alpha_{\\text{post}})\\Gamma(\\beta_{\\text{post}})} = \\frac{\\alpha_{\\text{post}}}{\\alpha_{\\text{post}} + \\beta_{\\text{post}}}" />
<BlockMath math="\mathbb{E}[\theta \mid \text{Data}] = \frac{\text{B}(\alpha_{\text{post}} + 1, \beta_{\text{post}})}{\text{B}(\alpha_{\text{post}}, \beta_{\text{post}})} = \frac{\Gamma(\alpha_{\text{post}} + 1)\Gamma(\beta_{\text{post}})}{\Gamma(\alpha_{\text{post}} + \beta_{\text{post}} + 1)} \cdot \frac{\Gamma(\alpha_{\text{post}} + \beta_{\text{post}})}{\Gamma(\alpha_{\text{post}})\Gamma(\beta_{\text{post}})}" />
<BlockMath math="\mathbb{E}[\theta \mid \text{Data}] = \frac{\alpha_{\text{post}}\Gamma(\alpha_{\text{post}})\Gamma(\beta_{\text{post}})}{(\alpha_{\text{post}} + \beta_{\text{post}})\Gamma(\alpha_{\text{post}} + \beta_{\text{post}})} \cdot \frac{\Gamma(\alpha_{\text{post}} + \beta_{\text{post}})}{\Gamma(\alpha_{\text{post}})\Gamma(\beta_{\text{post}})} = \frac{\alpha_{\text{post}}}{\alpha_{\text{post}} + \beta_{\text{post}}}" />
<p className="text-xs text-slate-350 font-semibold pt-2">Expanded Workstation Implementation Formula:</p>
<BlockMath math="P_{\\text{Posterior}} = \\frac{\\alpha_{\\text{prior}} + (P_{\\text{ML}} \\times w)}{\\alpha_{\\text{prior}} + \\beta_{\\text{prior}} + w}" />
<BlockMath math="P_{\text{Posterior}} = \frac{\alpha_{\text{prior}} + (P_{\text{ML}} \times w)}{\alpha_{\text{prior}} + \beta_{\text{prior}} + w}" />
<p className="text-[10px] text-slate-500 font-mono leading-relaxed">
This formulation ensures that if the prior model is highly accurate (large <InlineMath math="\\alpha_{\\text{prior}}" />), the raw ML signal is smoothed towards historical baseline expectations. If historical errors are high, the prior variance restricts overreaction to noisy signals.
This formulation ensures that if the prior model is highly accurate (large <InlineMath math="\alpha_{\text{prior}}" />), the raw ML signal is smoothed towards historical baseline expectations. If historical errors are high, the prior variance restricts overreaction to noisy signals.
</p>
</div>
</div>