| | import gradio as gr |
| | import json |
| | from src.trignum_core.subtractive_filter import SubtractiveFilter |
| |
|
| | |
| | sf = SubtractiveFilter() |
| |
|
| | import dataclasses |
| |
|
| | def validate_logic(input_text): |
| | if not input_text or len(input_text.strip()) == 0: |
| | return "Please input text to validate.", "βͺ N/A", {} |
| |
|
| | |
| | result = sf.apply(input_text) |
| | |
| | |
| | is_valid = result.illogics_removed == 0 |
| | state_color = "π΅ BLUE (Logic Stable - Cleared for Takeoff)" if is_valid else "π΄ RED (Illogic Detected - THE FREEZE)" |
| | |
| | |
| | details = json.dumps(dataclasses.asdict(result), indent=2) |
| | |
| | |
| | if is_valid: |
| | summary = "β
PASS: The structural integrity of the reasoning is sound. No contradictions, circular logic, or non-sequiturs were detected." |
| | else: |
| | summary = "β FAIL: Structural illogic detected. The reasoning chain is objectively broken prior to any factual verification." |
| | |
| | return summary, state_color, details |
| |
|
| | |
| | with gr.Blocks() as demo: |
| | gr.Markdown( |
| | """ |
| | # π§ TRIGNUM-300M: The Subtractive Filter |
| | ### A Zero-Model Reasoning Integrity Validator |
| | TRIGNUM does not use LLMs to check LLMs. It uses a **deterministic logic engine** to catch structural reasoning failures (contradictions, circular logic, non-sequiturs) *before* an AI agent is allowed to act. |
| | |
| | **Latency:** < 1ms | **Accuracy:** 100% on structural contradictions |
| | """ |
| | ) |
| | |
| | with gr.Row(): |
| | with gr.Column(): |
| | input_box = gr.Textbox( |
| | label="Input AI Reasoning or Text", |
| | lines=10, |
| | placeholder="Paste the output of an LLM here to validate its structural logic..." |
| | ) |
| | submit_btn = gr.Button("Validate Logic (Subtractive Filter)", variant="primary") |
| | |
| | gr.Markdown( |
| | """ |
| | *Try pasting a contradictory statement like:* |
| | "The server is completely offline and unreachable. Therefore, we should establish a WebSocket connection to the server to download the logs." |
| | """ |
| | ) |
| | |
| | with gr.Column(): |
| | state_output = gr.Textbox(label="T-CHIP State", lines=1) |
| | summary_output = gr.Textbox(label="Validation Summary", lines=2) |
| | json_output = gr.Code(label="Raw Filter Telemetry (JSON)", language="json", lines=15) |
| | |
| | submit_btn.click( |
| | fn=validate_logic, |
| | inputs=input_box, |
| | outputs=[summary_output, state_output, json_output] |
| | ) |
| | |
| | gr.Markdown( |
| | """ |
| | --- |
| | **Part of the Trignumentality Epistemic Framework** |
| | Read the Paper: [10.5281/zenodo.18736774](https://doi.org/10.5281/zenodo.18736774) | GitHub: [Codfski/TRIGNUM-300M-TCHIP](https://github.com/Codfski/TRIGNUM-300M-TCHIP) |
| | """ |
| | ) |
| |
|
| | if __name__ == "__main__": |
| | demo.launch(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="slate"), ssr_mode=False) |
| |
|