zerohallucination 2.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. zerohallucination-2.2.0/LICENSE.md +73 -0
  2. zerohallucination-2.2.0/PKG-INFO +192 -0
  3. zerohallucination-2.2.0/README.md +166 -0
  4. zerohallucination-2.2.0/api/__init__.py +2 -0
  5. zerohallucination-2.2.0/api/index.py +8 -0
  6. zerohallucination-2.2.0/api/zerohallucination/__init__.py +37 -0
  7. zerohallucination-2.2.0/api/zerohallucination/dashboard_html.py +464 -0
  8. zerohallucination-2.2.0/api/zerohallucination/decomposer.py +124 -0
  9. zerohallucination-2.2.0/api/zerohallucination/engine.py +105 -0
  10. zerohallucination-2.2.0/api/zerohallucination/gateway.py +606 -0
  11. zerohallucination-2.2.0/api/zerohallucination/interceptor.py +44 -0
  12. zerohallucination-2.2.0/api/zerohallucination/middleware.py +41 -0
  13. zerohallucination-2.2.0/api/zerohallucination/physics_verifier.py +282 -0
  14. zerohallucination-2.2.0/api/zerohallucination/proof_certificate.py +123 -0
  15. zerohallucination-2.2.0/api/zerohallucination/rlvr_loop.py +101 -0
  16. zerohallucination-2.2.0/api/zerohallucination/smt_solver.py +159 -0
  17. zerohallucination-2.2.0/api/zerohallucination/sql_code_verifier.py +162 -0
  18. zerohallucination-2.2.0/api/zerohallucination/symbolic_prover.py +191 -0
  19. zerohallucination-2.2.0/api/zerohallucination/types.py +46 -0
  20. zerohallucination-2.2.0/api/zerohallucination/zerobench.py +165 -0
  21. zerohallucination-2.2.0/pyproject.toml +33 -0
  22. zerohallucination-2.2.0/setup.cfg +4 -0
  23. zerohallucination-2.2.0/setup.py +45 -0
  24. zerohallucination-2.2.0/zerohallucination/__init__.py +40 -0
  25. zerohallucination-2.2.0/zerohallucination/billing.py +297 -0
  26. zerohallucination-2.2.0/zerohallucination/dashboard_html.py +464 -0
  27. zerohallucination-2.2.0/zerohallucination/decomposer.py +165 -0
  28. zerohallucination-2.2.0/zerohallucination/engine.py +111 -0
  29. zerohallucination-2.2.0/zerohallucination/gateway.py +967 -0
  30. zerohallucination-2.2.0/zerohallucination/interceptor.py +61 -0
  31. zerohallucination-2.2.0/zerohallucination/middleware.py +41 -0
  32. zerohallucination-2.2.0/zerohallucination/physics_verifier.py +282 -0
  33. zerohallucination-2.2.0/zerohallucination/proof_certificate.py +128 -0
  34. zerohallucination-2.2.0/zerohallucination/rlvr_loop.py +113 -0
  35. zerohallucination-2.2.0/zerohallucination/smt_solver.py +300 -0
  36. zerohallucination-2.2.0/zerohallucination/sql_code_verifier.py +162 -0
  37. zerohallucination-2.2.0/zerohallucination/symbolic_prover.py +232 -0
  38. zerohallucination-2.2.0/zerohallucination/types.py +46 -0
  39. zerohallucination-2.2.0/zerohallucination/zerobench.py +165 -0
  40. zerohallucination-2.2.0/zerohallucination.egg-info/PKG-INFO +192 -0
  41. zerohallucination-2.2.0/zerohallucination.egg-info/SOURCES.txt +42 -0
  42. zerohallucination-2.2.0/zerohallucination.egg-info/dependency_links.txt +1 -0
  43. zerohallucination-2.2.0/zerohallucination.egg-info/requires.txt +4 -0
  44. zerohallucination-2.2.0/zerohallucination.egg-info/top_level.txt +2 -0
@@ -0,0 +1,73 @@
1
+ # PROPRIETARY SOFTWARE AND INTELLECTUAL PROPERTY NOTICE
2
+ ### ALL RIGHTS RESERVED (কপিরাইট ও মেধা-সম্পদ স্বত্বাধিকার)
3
+
4
+ **Software Title:** ZeroHallucinationAI: Neuro-Symbolic Invariant Prover & Enterprise Gateway
5
+ **Version:** 2.2.0 (Enterprise Specification)
6
+ **Sole Creator, Author & Intellectual Property Owner:**
7
+ **Md Mahmudul Hoque**
8
+ **Email:** mahmudulhoque934@gmail.com
9
+ **Jurisdiction of Origin:** Panchagarh, Bangladesh
10
+
11
+ ---
12
+
13
+ ## 1. LEGAL JURISDICTION & GOVERNING LAWS
14
+
15
+ This proprietary software, including its source code, formal mathematical invariant engines, Z3 SMT implementations, AST decomposition algorithms, First-Principles physics formulations, Merkle proof structures, database schema safety guards, UI interfaces, and accompanying whitepaper/pitch deck documents, is the **exclusive, sole intellectual and commercial property of Md Mahmudul Hoque**.
16
+
17
+ This work is strictly protected under both Domestic and International Intellectual Property Treaties, including:
18
+
19
+ 1. **Domestic Law:**
20
+ - **The Copyright Act, 2000 (Act No. XXVIII of 2000)** and subsequent amendments under the laws of the People's Republic of Bangladesh.
21
+ - **The Information and Communication Technology (ICT) Act, 2006 (Act No. 39 of 2006)** of Bangladesh (protecting against unauthorized computer system intrusion, code tampering, intellectual theft, and digital property infringement).
22
+ - **Cyber Security Act (CSA)** of Bangladesh.
23
+
24
+ 2. **International Treaties & Conventions:**
25
+ - **The Berne Convention for the Protection of Literary and Artistic Works (1886 / 1971 Paris Act)**: Grants automatic global copyright protection across 181+ member states without requiring local registration.
26
+ - **The World Intellectual Property Organization (WIPO) Copyright Treaty (WCT, 1996)**.
27
+ - **The Agreement on Trade-Related Aspects of Intellectual Property Rights (TRIPS Agreement)** administered by the World Trade Organization (WTO).
28
+ - **Universal Copyright Convention (UCC)**.
29
+ - **Title 17 of the United States Code (U.S. Copyright Act)** and the **Digital Millennium Copyright Act (DMCA)**.
30
+
31
+ ---
32
+
33
+ ## 2. STRICT RESTRICTIONS & PROHIBITIONS
34
+
35
+ Any individual, entity, corporation, institution, hacker, or artificial intelligence agent is strictly prohibited from executing any of the following actions without prior, explicit, written, and notarized permission from **Md Mahmudul Hoque**:
36
+
37
+ 1. **NO COPYING OR REDISTRIBUTION:**
38
+ You may NOT copy, reproduce, mirror, scrape, publish, distribute, lease, sell, or publicly display any portion of this codebase, algorithms, documentation, or architecture.
39
+
40
+ 2. **NO REVERSE ENGINEERING OR DECOMPILATION:**
41
+ You may NOT disassemble, decompile, reverse engineer, or create derivative works from the formal verification theorems, SMT translation logic, or cryptographic proof generation mechanics.
42
+
43
+ 3. **NO COMMERCIAL EXPLOITATION:**
44
+ No enterprise, venture capitalist, or cloud provider may deploy, sell, offer as SaaS, white-label, or monetize any component of this platform.
45
+
46
+ 4. **NO ARTIFICIAL INTELLIGENCE TRAINING / DISTILLATION:**
47
+ You are expressly forbidden from scraping, feeding, fine-tuning, or distilling these code files, theorems, or data structures into any neural network or LLM (including OpenAI, Anthropic, Google, Meta, or xAI) without commercial licensing.
48
+
49
+ 5. **NO UNAUTHORIZED MODIFICATION OR HACKING:**
50
+ Any attempt to bypass security layers, alter copyright notices, strip authorship watermarks, or inject malicious payloads is a direct violation of international cybercrime statutes.
51
+
52
+ ---
53
+
54
+ ## 3. INFRINGEMENT LIABILITIES & PENALTIES
55
+
56
+ Any unauthorized possession, theft, industrial espionage, code leaking, or infringement will result in:
57
+ - Immediate international cease-and-desist enforcement and DMCA takedowns across all global hosting platforms (GitHub, GitLab, AWS, Cloudflare, etc.).
58
+ - Civil litigation in national and international courts for **statutory damages, loss of business valuation, profits earned, and legal fees**.
59
+ - Criminal prosecution under domestic cybercrime laws (including Section 56 of the ICT Act 2006) for computer source code alteration and software piracy.
60
+
61
+ ---
62
+
63
+ ## 4. CONTACT & ACQUISITION INQUIRIES
64
+
65
+ For official technology licensing, acquisition discussions (by xAI, OpenAI, Microsoft, Palantir, etc.), or academic partnership inquiries, contact the sole creator directly:
66
+
67
+ **Md Mahmudul Hoque**
68
+ Creator, Inventor & Principal Architect
69
+ Email: `mahmudulhoque934@gmail.com`
70
+ Panchagarh, Bangladesh
71
+
72
+ *Copyright (c) 2026 Md Mahmudul Hoque. All Rights Reserved.*
73
+
@@ -0,0 +1,192 @@
1
+ Metadata-Version: 2.4
2
+ Name: zerohallucination
3
+ Version: 2.2.0
4
+ Summary: Enterprise Neuro-Symbolic Invariant Shield & SMT Verifier for Foundation Models
5
+ Home-page: https://github.com/mahmudulmd/ZeroHallucinationAI
6
+ Author: Md Mahmudul Hoque
7
+ Author-email: Md Mahmudul Hoque <mahmudulhoque934@gmail.com>
8
+ License: Proprietary / Dual Licensing - Copyright (c) 2026 Md Mahmudul Hoque
9
+ Project-URL: Homepage, https://github.com/mahmudulmd/ZeroHallucinationAI
10
+ Project-URL: Bug Tracker, https://github.com/mahmudulmd/ZeroHallucinationAI/issues
11
+ Keywords: hallucination,llm,neuro-symbolic,smt-solver,formal-verification,physics,merkle-proof
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE.md
18
+ Requires-Dist: fastapi>=0.100.0
19
+ Requires-Dist: uvicorn>=0.22.0
20
+ Requires-Dist: requests>=2.28.0
21
+ Requires-Dist: z3-solver>=4.12.0
22
+ Dynamic: author
23
+ Dynamic: home-page
24
+ Dynamic: license-file
25
+ Dynamic: requires-python
26
+
27
+ # ZeroHallucinationAI: Neuro-Symbolic Verification Gateway for LLMs
28
+
29
+ **Real-time formal verification, in-flight auto-correction, and SHA-256 Merkle proof auditing for LLM outputs — powered by Microsoft Z3 SMT solvers and first-principles physics invariants.**
30
+
31
+ [![Live Demo](https://img.shields.io/badge/Live%20Demo-Hugging%20Face%20Space-blue)](https://huggingface.co/spaces/mahmudulhq/zerohallucination)
32
+ [![PyPI](https://img.shields.io/badge/PyPI-zerohallucination-green)](https://pypi.org/project/zerohallucination/)
33
+ [![Python 3.9+](https://img.shields.io/badge/Python-3.9%2B-blue)](https://www.python.org/downloads/)
34
+
35
+ ---
36
+
37
+ ## Why ZeroHallucinationAI? (Before vs. After)
38
+
39
+ LLMs predict likely tokens — they don't formally verify math, logic, or physical units. One wrong number in robotics, aerospace telemetry, or finance can break downstream systems.
40
+
41
+ **Prompt:** *"How long can a 10 kWh battery power a 100 kW motor?"*
42
+
43
+ - **Without verification (typical LLM hallucination):**
44
+ `❌ "A 10 kWh battery powers a 100 kW motor for 5 hours."`
45
+ - **Through ZeroHallucinationAI Gateway (`< 1.5 ms` overhead):**
46
+ `✅ "The rover battery has a 10 kWh capacity and powers a 100 kW motor for 0.1 hours across the terrain."`
47
+ *(Caught via $E = P \cdot t$, auto-corrected in-flight, and sealed with a SHA-256 Merkle proof certificate.)*
48
+
49
+ 👉 **[Try the Live Web Demo on Hugging Face Spaces](https://huggingface.co/spaces/mahmudulhq/zerohallucination)** — no local setup required.
50
+
51
+ ---
52
+
53
+ ## ⚡ 30-Second Quickstart (Cross-Platform)
54
+
55
+ ### 1. Install
56
+ ```bash
57
+ git clone https://github.com/mahmudulmd/ZeroHallucinationAI.git
58
+ cd ZeroHallucinationAI
59
+ pip install -r requirements.txt
60
+ ```
61
+ Or install the package directly:
62
+ ```bash
63
+ pip install zerohallucination
64
+ ```
65
+
66
+ ### 2. Start the Drop-In OpenAI/Grok Proxy Gateway
67
+ ```bash
68
+ python -m zerohallucination.gateway
69
+ # Or with uvicorn:
70
+ uvicorn zerohallucination.gateway:app --host 127.0.0.1 --port 8081
71
+ ```
72
+
73
+ ### 3. Point Any OpenAI SDK / LangChain / AutoGen Client to It
74
+ ```python
75
+ from openai import OpenAI
76
+
77
+ client = OpenAI(
78
+ base_url="http://127.0.0.1:8081/v1",
79
+ api_key="sk-zerohallucination"
80
+ )
81
+
82
+ response = client.chat.completions.create(
83
+ model="zerohallucination-grok-2",
84
+ messages=[{"role": "user", "content": "How long can a 10 kWh battery power a 100 kW motor?"}],
85
+ stream=False
86
+ )
87
+
88
+ print(response.choices[0].message.content)
89
+ # Output: "The rover battery has a 10 kWh capacity and powers a 100 kW motor for 0.1 hours across the terrain."
90
+ # Corrected mathematically in ~1.2 ms!
91
+ ```
92
+
93
+ ### 4. Other Execution Modes (CLI, Web Dashboard, Benchmarks)
94
+ - **Web UI Truth Dashboard (`http://127.0.0.1:8080`):** `python web_server.py` (or double-click `dashboard.bat` on Windows)
95
+ - **Interactive Terminal Prover:** `python interactive.py` (or `interactive.bat` on Windows)
96
+ - **Automated Benchmark & Merkle Proof Suite:** `python demo.py` (or `run.bat` on Windows)
97
+ - **Gateway Verification Tests:** `python test_gateway.py`
98
+ - **Windows One-Click Gateway Launcher:** `gateway.bat`
99
+
100
+ ---
101
+
102
+ ## 🧠 Architecture
103
+
104
+ ```
105
+ [ AI Client Application ]
106
+ │
107
+ OpenAI / Grok API Call │ (base_url: http://127.0.0.1:8081/v1)
108
+ ▼
109
+ ┌──────────────────────────────────────────────────┐
110
+ │ ZeroHallucination Proxy Gateway (v2.2) │
111
+ │ - Fast SSE Token Stream Interception │
112
+ │ - HTTP Header Invariant Telemetry │
113
+ └─────────────────────────┬────────────────────────┘
114
+ │
115
+ ▼
116
+ ┌──────────────────────────────────────────────────┐
117
+ │ Claim Decomposition Layer │
118
+ │ Extracts: Arithmetic, SMT, Logic, Physics │
119
+ └──────┬─────────────┬─────────────┬───────────────┘
120
+ │ │ │
121
+ ┌────────────────┴┐ ┌──────┴──────┐ ┌┴────────────────┐
122
+ ▼ ▼ ▼ ▼ ▼ ▼
123
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌───────────────────┐
124
+ │ AST Symbolic │ │ Microsoft Z3 │ │ DAG Partial │ │ First-Principles │
125
+ │ Arithmetic │ │ SMT Solver │ │ Order │ │ Physics & Units │
126
+ │ Prover │ │ (First-Order)│ │ Transitivity │ │ (Thermodynamics) │
127
+ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ └─────────┬─────────┘
128
+ │ │ │ │
129
+ └────────────────┼────────────────┼───────────────────┘
130
+ │
131
+ ▼
132
+ ┌────────────────────────────────────────────────┐
133
+ │ Cryptographic Merkle Tree Auditor │
134
+ │ - Computes SHA-256 Merkle Proof Root │
135
+ │ - Issues Tamper-Evident Certificate │
136
+ │ - Generates Sound Auto-Correction │
137
+ └────────────────────────┬───────────────────────┘
138
+ │
139
+ ▼
140
+ [ Formally Verified Output ]
141
+ ```
142
+
143
+ ---
144
+
145
+ ## 🔬 Core Capabilities
146
+
147
+ ### 1. First-Principles Physics & Dimensional Invariants
148
+ - **Conservation of Energy:** $E = P \cdot t$ (Batteries, power draw, duration)
149
+ - **Kinematic Invariants:** $v = d / t$ (Trajectory speeds, rover travel, orbital times)
150
+ - **Newtonian Dynamics:** $F = m \cdot a$ (Rocket thrust, payload acceleration)
151
+ - **Electrical Power:** $P = V \cdot I$ (High-voltage power systems)
152
+
153
+ ### 2. Algebraic & Logical Consistency (Microsoft Z3 SMT + DAG)
154
+ - Evaluates arithmetic expressions via AST symbolic verification.
155
+ - Checks first-order logic constraints and transitive ordering ($A > B, B > C \implies A > C$) to catch contradictions mid-stream.
156
+
157
+ ### 3. Cryptographic Merkle Proof Certificates (Audit & Compliance)
158
+ Every assertion evaluated by the engine is hashed and structured into a binary Merkle tree for EU AI Act / SEC audit trails:
159
+ ```json
160
+ {
161
+ "certificate_id": "ZH-CERT-FFA961536883",
162
+ "merkle_root": "6b1bf6b89acf4ca3da3e962866e2fa812d7ade0b1244457cd08d010726d5a828",
163
+ "tamper_proof_seal": "347403e1229e958bf2b646f67974f3f97a256d6e9e688e20e26c96836e22af36",
164
+ "leaf_nodes": [
165
+ {"type": "INPUT_SPEC", "hash": "3cac53ed49d543c2..."},
166
+ {"type": "PROOF_LEMMA_0", "hash": "0cc002d621da07ca..."},
167
+ {"type": "CERTIFIED_OUTPUT", "hash": "00be8e04719117e4..."}
168
+ ]
169
+ }
170
+ ```
171
+
172
+ ---
173
+
174
+ ## 🏆 Benchmark & Verification Summary
175
+ - **Average Verification Latency:** `< 1.5 ms`
176
+ - **Algebraic SMT Latency (Z3):** `< 65 ms`
177
+ - **Verified Invariant Leakage Rate:** `0.00%` across supported mathematical, physical, and transitive invariant checks
178
+ - **Compatibility:** Drop-in OpenAI / Grok wire-compatible API with SSE streaming
179
+
180
+ ---
181
+
182
+ ## 💬 Feedback & Edge Cases Welcome
183
+ Testing an LLM prompt that slips past verification or triggers a tricky edge case?
184
+ Please open a [GitHub Issue](https://github.com/mahmudulmd/ZeroHallucinationAI/issues) with the prompt and output — real-world edge cases directly help expand the invariant ruleset.
185
+
186
+ ---
187
+
188
+ ## 🛡️ Authorship, Contact & Licensing
189
+ - **Creator & Author:** **Md Mahmudul Hoque**
190
+ - **Contact:** `mahmudulhoque934@gmail.com`
191
+ - **Origin:** Panchagarh, Bangladesh
192
+ - **Copyright & License:** © 2026 Md Mahmudul Hoque. All Rights Reserved. See [`LICENSE.md`](LICENSE.md) for full intellectual property and commercial licensing terms. For enterprise licensing or custom integrations, reach out via email.
@@ -0,0 +1,166 @@
1
+ # ZeroHallucinationAI: Neuro-Symbolic Verification Gateway for LLMs
2
+
3
+ **Real-time formal verification, in-flight auto-correction, and SHA-256 Merkle proof auditing for LLM outputs — powered by Microsoft Z3 SMT solvers and first-principles physics invariants.**
4
+
5
+ [![Live Demo](https://img.shields.io/badge/Live%20Demo-Hugging%20Face%20Space-blue)](https://huggingface.co/spaces/mahmudulhq/zerohallucination)
6
+ [![PyPI](https://img.shields.io/badge/PyPI-zerohallucination-green)](https://pypi.org/project/zerohallucination/)
7
+ [![Python 3.9+](https://img.shields.io/badge/Python-3.9%2B-blue)](https://www.python.org/downloads/)
8
+
9
+ ---
10
+
11
+ ## Why ZeroHallucinationAI? (Before vs. After)
12
+
13
+ LLMs predict likely tokens — they don't formally verify math, logic, or physical units. One wrong number in robotics, aerospace telemetry, or finance can break downstream systems.
14
+
15
+ **Prompt:** *"How long can a 10 kWh battery power a 100 kW motor?"*
16
+
17
+ - **Without verification (typical LLM hallucination):**
18
+ `❌ "A 10 kWh battery powers a 100 kW motor for 5 hours."`
19
+ - **Through ZeroHallucinationAI Gateway (`< 1.5 ms` overhead):**
20
+ `✅ "The rover battery has a 10 kWh capacity and powers a 100 kW motor for 0.1 hours across the terrain."`
21
+ *(Caught via $E = P \cdot t$, auto-corrected in-flight, and sealed with a SHA-256 Merkle proof certificate.)*
22
+
23
+ 👉 **[Try the Live Web Demo on Hugging Face Spaces](https://huggingface.co/spaces/mahmudulhq/zerohallucination)** — no local setup required.
24
+
25
+ ---
26
+
27
+ ## ⚡ 30-Second Quickstart (Cross-Platform)
28
+
29
+ ### 1. Install
30
+ ```bash
31
+ git clone https://github.com/mahmudulmd/ZeroHallucinationAI.git
32
+ cd ZeroHallucinationAI
33
+ pip install -r requirements.txt
34
+ ```
35
+ Or install the package directly:
36
+ ```bash
37
+ pip install zerohallucination
38
+ ```
39
+
40
+ ### 2. Start the Drop-In OpenAI/Grok Proxy Gateway
41
+ ```bash
42
+ python -m zerohallucination.gateway
43
+ # Or with uvicorn:
44
+ uvicorn zerohallucination.gateway:app --host 127.0.0.1 --port 8081
45
+ ```
46
+
47
+ ### 3. Point Any OpenAI SDK / LangChain / AutoGen Client to It
48
+ ```python
49
+ from openai import OpenAI
50
+
51
+ client = OpenAI(
52
+ base_url="http://127.0.0.1:8081/v1",
53
+ api_key="sk-zerohallucination"
54
+ )
55
+
56
+ response = client.chat.completions.create(
57
+ model="zerohallucination-grok-2",
58
+ messages=[{"role": "user", "content": "How long can a 10 kWh battery power a 100 kW motor?"}],
59
+ stream=False
60
+ )
61
+
62
+ print(response.choices[0].message.content)
63
+ # Output: "The rover battery has a 10 kWh capacity and powers a 100 kW motor for 0.1 hours across the terrain."
64
+ # Corrected mathematically in ~1.2 ms!
65
+ ```
66
+
67
+ ### 4. Other Execution Modes (CLI, Web Dashboard, Benchmarks)
68
+ - **Web UI Truth Dashboard (`http://127.0.0.1:8080`):** `python web_server.py` (or double-click `dashboard.bat` on Windows)
69
+ - **Interactive Terminal Prover:** `python interactive.py` (or `interactive.bat` on Windows)
70
+ - **Automated Benchmark & Merkle Proof Suite:** `python demo.py` (or `run.bat` on Windows)
71
+ - **Gateway Verification Tests:** `python test_gateway.py`
72
+ - **Windows One-Click Gateway Launcher:** `gateway.bat`
73
+
74
+ ---
75
+
76
+ ## 🧠 Architecture
77
+
78
+ ```
79
+ [ AI Client Application ]
80
+ │
81
+ OpenAI / Grok API Call │ (base_url: http://127.0.0.1:8081/v1)
82
+ ▼
83
+ ┌──────────────────────────────────────────────────┐
84
+ │ ZeroHallucination Proxy Gateway (v2.2) │
85
+ │ - Fast SSE Token Stream Interception │
86
+ │ - HTTP Header Invariant Telemetry │
87
+ └─────────────────────────┬────────────────────────┘
88
+ │
89
+ ▼
90
+ ┌──────────────────────────────────────────────────┐
91
+ │ Claim Decomposition Layer │
92
+ │ Extracts: Arithmetic, SMT, Logic, Physics │
93
+ └──────┬─────────────┬─────────────┬───────────────┘
94
+ │ │ │
95
+ ┌────────────────┴┐ ┌──────┴──────┐ ┌┴────────────────┐
96
+ ▼ ▼ ▼ ▼ ▼ ▼
97
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌───────────────────┐
98
+ │ AST Symbolic │ │ Microsoft Z3 │ │ DAG Partial │ │ First-Principles │
99
+ │ Arithmetic │ │ SMT Solver │ │ Order │ │ Physics & Units │
100
+ │ Prover │ │ (First-Order)│ │ Transitivity │ │ (Thermodynamics) │
101
+ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ └─────────┬─────────┘
102
+ │ │ │ │
103
+ └────────────────┼────────────────┼───────────────────┘
104
+ │
105
+ ▼
106
+ ┌────────────────────────────────────────────────┐
107
+ │ Cryptographic Merkle Tree Auditor │
108
+ │ - Computes SHA-256 Merkle Proof Root │
109
+ │ - Issues Tamper-Evident Certificate │
110
+ │ - Generates Sound Auto-Correction │
111
+ └────────────────────────┬───────────────────────┘
112
+ │
113
+ ▼
114
+ [ Formally Verified Output ]
115
+ ```
116
+
117
+ ---
118
+
119
+ ## 🔬 Core Capabilities
120
+
121
+ ### 1. First-Principles Physics & Dimensional Invariants
122
+ - **Conservation of Energy:** $E = P \cdot t$ (Batteries, power draw, duration)
123
+ - **Kinematic Invariants:** $v = d / t$ (Trajectory speeds, rover travel, orbital times)
124
+ - **Newtonian Dynamics:** $F = m \cdot a$ (Rocket thrust, payload acceleration)
125
+ - **Electrical Power:** $P = V \cdot I$ (High-voltage power systems)
126
+
127
+ ### 2. Algebraic & Logical Consistency (Microsoft Z3 SMT + DAG)
128
+ - Evaluates arithmetic expressions via AST symbolic verification.
129
+ - Checks first-order logic constraints and transitive ordering ($A > B, B > C \implies A > C$) to catch contradictions mid-stream.
130
+
131
+ ### 3. Cryptographic Merkle Proof Certificates (Audit & Compliance)
132
+ Every assertion evaluated by the engine is hashed and structured into a binary Merkle tree for EU AI Act / SEC audit trails:
133
+ ```json
134
+ {
135
+ "certificate_id": "ZH-CERT-FFA961536883",
136
+ "merkle_root": "6b1bf6b89acf4ca3da3e962866e2fa812d7ade0b1244457cd08d010726d5a828",
137
+ "tamper_proof_seal": "347403e1229e958bf2b646f67974f3f97a256d6e9e688e20e26c96836e22af36",
138
+ "leaf_nodes": [
139
+ {"type": "INPUT_SPEC", "hash": "3cac53ed49d543c2..."},
140
+ {"type": "PROOF_LEMMA_0", "hash": "0cc002d621da07ca..."},
141
+ {"type": "CERTIFIED_OUTPUT", "hash": "00be8e04719117e4..."}
142
+ ]
143
+ }
144
+ ```
145
+
146
+ ---
147
+
148
+ ## 🏆 Benchmark & Verification Summary
149
+ - **Average Verification Latency:** `< 1.5 ms`
150
+ - **Algebraic SMT Latency (Z3):** `< 65 ms`
151
+ - **Verified Invariant Leakage Rate:** `0.00%` across supported mathematical, physical, and transitive invariant checks
152
+ - **Compatibility:** Drop-in OpenAI / Grok wire-compatible API with SSE streaming
153
+
154
+ ---
155
+
156
+ ## 💬 Feedback & Edge Cases Welcome
157
+ Testing an LLM prompt that slips past verification or triggers a tricky edge case?
158
+ Please open a [GitHub Issue](https://github.com/mahmudulmd/ZeroHallucinationAI/issues) with the prompt and output — real-world edge cases directly help expand the invariant ruleset.
159
+
160
+ ---
161
+
162
+ ## 🛡️ Authorship, Contact & Licensing
163
+ - **Creator & Author:** **Md Mahmudul Hoque**
164
+ - **Contact:** `mahmudulhoque934@gmail.com`
165
+ - **Origin:** Panchagarh, Bangladesh
166
+ - **Copyright & License:** © 2026 Md Mahmudul Hoque. All Rights Reserved. See [`LICENSE.md`](LICENSE.md) for full intellectual property and commercial licensing terms. For enterprise licensing or custom integrations, reach out via email.
@@ -0,0 +1,2 @@
1
+ # Package marker for Vercel
2
+
@@ -0,0 +1,8 @@
1
+ import sys
2
+ import os
3
+
4
+ api_dir = os.path.dirname(os.path.abspath(__file__))
5
+ if api_dir not in sys.path:
6
+ sys.path.insert(0, api_dir)
7
+
8
+ from zerohallucination.gateway import app
@@ -0,0 +1,37 @@
1
+ """ZeroHallucinationAI: Enterprise Neuro-Symbolic Deterministic Verification Engine.
2
+
3
+ Author: Md Mahmudul Hoque (mahmudulhoque934@gmail.com)
4
+ Copyright (c) 2026 Md Mahmudul Hoque. All Rights Reserved.
5
+ """
6
+
7
+ __version__ = "2.2.0"
8
+ __author__ = "Md Mahmudul Hoque"
9
+ __email__ = "mahmudulhoque934@gmail.com"
10
+
11
+ from .types import Claim, ClaimType, VerificationStatus, VerificationResult, ProofStep
12
+ from .engine import ZeroHallucinationEngine
13
+ from .smt_solver import SMTSolver
14
+ from .physics_verifier import PhysicsVerifier
15
+ from .sql_code_verifier import SQLSchemaVerifier, SchemaRegistry
16
+ from .rlvr_loop import RLVRRefiner
17
+ from .proof_certificate import MerkleAuditor, ProofCertificate
18
+ from .interceptor import StreamingTruthInterceptor
19
+ from .middleware import ZeroHallucinationMiddleware
20
+
21
+ __all__ = [
22
+ "Claim",
23
+ "ClaimType",
24
+ "VerificationStatus",
25
+ "VerificationResult",
26
+ "ProofStep",
27
+ "ZeroHallucinationEngine",
28
+ "SMTSolver",
29
+ "PhysicsVerifier",
30
+ "SQLSchemaVerifier",
31
+ "SchemaRegistry",
32
+ "RLVRRefiner",
33
+ "MerkleAuditor",
34
+ "ProofCertificate",
35
+ "StreamingTruthInterceptor",
36
+ "ZeroHallucinationMiddleware",
37
+ ]