Spaces:
Running
Running
| <html> | |
| <head> | |
| <title>zkPrologML - Solana Auto Dashboard</title> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> | |
| <!-- Tau-Prolog --> | |
| <script src="https://cdn.jsdelivr.net/npm/tau-prolog@0.3.4/modules/core.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/tau-prolog@0.3.4/modules/lists.js"></script> | |
| <style> | |
| * { margin: 0; padding: 0; box-sizing: border-box; } | |
| body { | |
| font-family: 'Courier New', monospace; | |
| background: #000; | |
| color: #0f0; | |
| overflow-x: hidden; | |
| overflow-y: auto; | |
| } | |
| .matrix-bg { | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| z-index: -1; | |
| opacity: 0.1; | |
| } | |
| .container { | |
| padding: 10px; | |
| max-width: 1600px; | |
| margin: 0 auto; | |
| } | |
| .header { | |
| text-align: center; | |
| margin-bottom: 15px; | |
| animation: glow 2s ease-in-out infinite; | |
| } | |
| .header h1 { | |
| font-size: clamp(16px, 4vw, 24px); | |
| } | |
| .header p { | |
| font-size: clamp(10px, 2vw, 14px); | |
| } | |
| @keyframes glow { | |
| 0%, 100% { text-shadow: 0 0 10px #0f0, 0 0 20px #0f0; } | |
| 50% { text-shadow: 0 0 20px #0f0, 0 0 40px #0f0, 0 0 60px #0f0; } | |
| } | |
| .grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); | |
| gap: 10px; | |
| margin-bottom: 15px; | |
| } | |
| .card { | |
| background: rgba(0, 255, 0, 0.05); | |
| border: 2px solid #0f0; | |
| padding: 10px; | |
| border-radius: 5px; | |
| position: relative; | |
| overflow: hidden; | |
| cursor: pointer; | |
| } | |
| .card::before { | |
| content: ''; | |
| position: absolute; | |
| top: -50%; | |
| left: -50%; | |
| width: 200%; | |
| height: 200%; | |
| background: linear-gradient(45deg, transparent, rgba(0,255,0,0.1), transparent); | |
| animation: scan 3s linear infinite; | |
| } | |
| @keyframes scan { | |
| 0% { transform: translateY(-100%); } | |
| 100% { transform: translateY(100%); } | |
| } | |
| .card-title { | |
| font-size: clamp(10px, 2vw, 14px); | |
| margin-bottom: 5px; | |
| color: #0f0; | |
| text-transform: uppercase; | |
| } | |
| .card-value { | |
| font-size: clamp(18px, 4vw, 32px); | |
| font-weight: bold; | |
| color: #0f0; | |
| text-shadow: 0 0 10px #0f0; | |
| } | |
| .card-label { | |
| font-size: clamp(9px, 1.5vw, 12px); | |
| color: #0a0; | |
| margin-top: 3px; | |
| } | |
| .terminal { | |
| background: rgba(0, 0, 0, 0.8); | |
| border: 2px solid #0f0; | |
| padding: 10px; | |
| height: clamp(200px, 40vh, 300px); | |
| overflow-y: auto; | |
| font-size: clamp(10px, 2vw, 14px); | |
| margin-bottom: 10px; | |
| } | |
| font-size: 12px; | |
| margin-bottom: 20px; | |
| } | |
| .terminal-line { | |
| margin: 2px 0; | |
| animation: fadeIn 0.5s; | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; } | |
| to { opacity: 1; } | |
| } | |
| .status { | |
| display: inline-block; | |
| width: 10px; | |
| height: 10px; | |
| border-radius: 50%; | |
| margin-right: 5px; | |
| animation: pulse 1s infinite; | |
| } | |
| .status.active { background: #0f0; } | |
| .status.pending { background: #ff0; } | |
| @keyframes pulse { | |
| 0%, 100% { opacity: 1; } | |
| 50% { opacity: 0.5; } | |
| } | |
| .monster-viz { | |
| background: rgba(0, 0, 0, 0.8); | |
| border: 2px solid #0f0; | |
| padding: 15px; | |
| text-align: center; | |
| } | |
| .shard-grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); | |
| gap: 3px; | |
| margin-top: 10px; | |
| } | |
| .shard { | |
| width: 100%; | |
| aspect-ratio: 1; | |
| min-width: 30px; | |
| max-width: 50px; | |
| border: 1px solid #0f0; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-size: clamp(8px, 1.5vw, 10px); | |
| cursor: pointer; | |
| transition: all 0.3s; | |
| } | |
| .shard:hover { | |
| background: rgba(0, 255, 0, 0.3); | |
| transform: scale(1.1); | |
| } | |
| .shard.active { | |
| background: rgba(0, 255, 0, 0.2); | |
| box-shadow: 0 0 10px #0f0; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <canvas class="matrix-bg" id="matrix"></canvas> | |
| <div class="container"> | |
| <div class="header"> | |
| <h1 onclick="showProof('zkPrologML', 'v1.0.0', 1, 'README.md')" style="cursor: pointer;"> | |
| 🔮 zkPrologML - SOLANA AUTO DASHBOARD | |
| </h1> | |
| <p>Monster Group Knowledge System | <strong>REAL DATA from 8M file analysis</strong></p> | |
| <p> | |
| <span class="status active"></span>ANALYSIS COMPLETE | Completed 2026-01-28 | | |
| <span id="timestamp"></span> | | |
| <span id="version">v1.0.0</span> | | |
| Uptime: <span id="uptime">0s</span> | |
| </p> | |
| </div> | |
| <div class="grid"> | |
| <div class="card" onclick="showProof('files', 8017192, 70, 'master.parquet')" style="cursor: pointer;"> | |
| <div class="card-title">Files Indexed</div> | |
| <div class="card-value" id="files">0</div> | |
| <div class="card-label">Click for proof →</div> | |
| </div> | |
| <div class="card" onclick="showProof('shards', 71, 0, 'Monster Group')" style="cursor: pointer;"> | |
| <div class="card-title">Monster Shards</div> | |
| <div class="card-value" id="shards">71</div> | |
| <div class="card-label">Click for proof →</div> | |
| </div> | |
| <div class="card" onclick="showProof('theorems', 10, 53, 'eigenvector_matrix.lean')" style="cursor: pointer;"> | |
| <div class="card-title">Theorems Proven</div> | |
| <div class="card-value" id="theorems">0</div> | |
| <div class="card-label">Click for proof →</div> | |
| </div> | |
| <div class="card" onclick="showProof('entities', 42, 33, 'unified_kb.pl')" style="cursor: pointer;"> | |
| <div class="card-title">Entities Unified</div> | |
| <div class="card-value" id="entities">0</div> | |
| <div class="card-label">Click for proof →</div> | |
| </div> | |
| <div class="card" onclick="showProof('accuracy', 99.6, 60, 'deep_insights.py')" style="cursor: pointer;"> | |
| <div class="card-title">Prediction Accuracy</div> | |
| <div class="card-value" id="accuracy">0%</div> | |
| <div class="card-label">Click for proof →</div> | |
| </div> | |
| <div class="card" onclick="showProof('state', 'OPTIMIZING', 71, 'global_objects.pl')" style="cursor: pointer;"> | |
| <div class="card-title">System State</div> | |
| <div class="card-value" id="state">INIT</div> | |
| <div class="card-label">Click for proof →</div> | |
| </div> | |
| </div> | |
| <div class="terminal" id="terminal"> | |
| <div class="terminal-line">> zkPrologML Auto Dashboard v0.1.0</div> | |
| <div class="terminal-line">> Initializing Monster Group system...</div> | |
| <div class="terminal-line">> Connecting to Solana network...</div> | |
| <div class="terminal-line">> Type 'help' for Prolog REPL commands</div> | |
| </div> | |
| <div style="margin-top: 20px; padding: 15px; background: rgba(255,0,0,0.05); border: 2px solid #f00; border-radius: 5px;"> | |
| <h3 style="margin-bottom: 10px; color: #f00;">⚠️ Error Log</h3> | |
| <div id="errorLog" style="background: #000; border: 1px solid #f00; padding: 10px; min-height: 60px; max-height: 150px; overflow-y: auto; font-family: 'Courier New'; font-size: 11px; color: #f00;"> | |
| <div style="color: #0a0;">✅ No errors. System running smoothly.</div> | |
| </div> | |
| </div> | |
| <div style="margin-top: 20px; padding: 15px; background: rgba(0,255,0,0.05); border: 2px solid #0f0; border-radius: 5px;"> | |
| <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 10px;"> | |
| <div style="font-size: 40px;">🤖</div> | |
| <div> | |
| <h3 style="margin: 0;">Frank - Your zkProlog Friend</h3> | |
| <p style="margin: 0; font-size: 12px; opacity: 0.7;">Ask me anything about the knowledge base!</p> | |
| </div> | |
| </div> | |
| <div style="display: flex; gap: 5px; margin-bottom: 10px; flex-wrap: wrap; align-items: center;"> | |
| <input type="text" id="prologInput" placeholder="Hi Frank! Show me shard 42..." | |
| style="flex: 1; min-width: 200px; background: #000; color: #0f0; border: 1px solid #0f0; padding: 8px; font-family: 'Courier New'; font-size: clamp(12px, 2vw, 14px);"> | |
| <button onclick="runPrologQuery()" | |
| style="background: #0f0; color: #000; border: none; padding: 8px 15px; cursor: pointer; font-family: 'Courier New'; font-weight: bold; font-size: clamp(12px, 2vw, 14px);"> | |
| SEND | |
| </button> | |
| <button id="modeToggle" onclick="toggleMode()" | |
| style="background: rgba(0, 255, 0, 0.2); color: #0f0; border: 1px solid #0f0; padding: 8px 15px; cursor: pointer; font-family: 'Courier New'; font-weight: bold; font-size: clamp(10px, 1.8vw, 12px);"> | |
| 🤖 FRANK | |
| </button> | |
| </div> | |
| <div id="prologOutput" style="background: #000; border: 1px solid #0f0; padding: 10px; min-height: 150px; max-height: clamp(200px, 40vh, 300px); overflow-y: auto; font-family: 'Courier New'; font-size: clamp(10px, 2vw, 12px);"> | |
| <div style="color: #0f0;">🤖 Frank: Hey there! I'm Frank, your friendly zkProlog assistant.</div> | |
| <div style="color: #0f0;">🤖 Frank: I can help you explore 8M files across 71 Monster Group shards!</div> | |
| <div style="color: #0a0; margin-top: 5px;">Try: "show me shard 42" or "what theorems are proven?"</div> | |
| <div style="color: #0a0;">Or use Prolog: ?- by_shard(42, Path).</div> | |
| </div> | |
| </div> | |
| <div class="monster-viz"> | |
| <div class="card-title">MONSTER GROUP SHARDS (71)</div> | |
| <div class="shard-grid" id="shardGrid"></div> | |
| </div> | |
| </div> | |
| <script> | |
| const startTime = Date.now(); | |
| // Error logging | |
| const errorLog = []; | |
| function logError(message, type = 'error') { | |
| const timestamp = new Date().toISOString().split('T')[1].split('.')[0]; | |
| const entry = { timestamp, message, type }; | |
| errorLog.push(entry); | |
| const log = document.getElementById('errorLog'); | |
| const line = document.createElement('div'); | |
| line.style.color = type === 'error' ? '#f00' : type === 'warning' ? '#ff0' : '#0a0'; | |
| line.textContent = `[${timestamp}] ${type.toUpperCase()}: ${message}`; | |
| log.appendChild(line); | |
| log.scrollTop = log.scrollHeight; | |
| console.log(`[${type.toUpperCase()}] ${message}`); | |
| } | |
| // Override console.error to capture errors | |
| const originalError = console.error; | |
| console.error = function(...args) { | |
| logError(args.join(' '), 'error'); | |
| originalError.apply(console, args); | |
| }; | |
| // Catch unhandled errors | |
| window.addEventListener('error', (e) => { | |
| logError(`${e.message} at ${e.filename}:${e.lineno}`, 'error'); | |
| }); | |
| // Catch unhandled promise rejections | |
| window.addEventListener('unhandledrejection', (e) => { | |
| logError(`Unhandled promise rejection: ${e.reason}`, 'error'); | |
| }); | |
| // Load zkProofs (complete set with 585 proofs) | |
| let zkProofs = {}; | |
| fetch('zkproofs_complete.json') | |
| .then(r => r.json()) | |
| .then(data => { | |
| zkProofs = data; | |
| console.log(`✅ Loaded ${Object.keys(data).length} zkProofs`); | |
| logError('zkProofs loaded successfully', 'info'); | |
| }) | |
| .catch(e => { | |
| console.log('⚠️ zkProofs not available'); | |
| logError(`Failed to load zkProofs: ${e.message}`, 'warning'); | |
| }); | |
| // Fetch latest commit from GitHub API | |
| fetch('https://api.github.com/repos/meta-introspector/zkprologml/commits/main') | |
| .then(r => r.json()) | |
| .then(data => { | |
| const sha = data.sha.substring(0, 7); | |
| const commitUrl = `https://github.com/meta-introspector/zkprologml/commit/${sha}`; | |
| const versionEl = document.getElementById('version'); | |
| versionEl.innerHTML = `<a href="${commitUrl}" target="_blank" style="color: #0f0;">v1.0.0-${sha}</a>`; | |
| logError(`Version: v1.0.0-${sha}`, 'info'); | |
| }) | |
| .catch(e => { | |
| logError('Could not fetch version from GitHub', 'warning'); | |
| }); | |
| // Initialize Tau-Prolog | |
| let tauSession = null; | |
| if (typeof pl !== 'undefined') { | |
| tauSession = pl.create(); | |
| // Load facts from tau_facts.js | |
| fetch('tau_facts.js') | |
| .then(r => r.text()) | |
| .then(facts => { | |
| // Extract Prolog code from const declaration | |
| const match = facts.match(/const tauFacts = `([\s\S]*?)`;/); | |
| if (match) { | |
| tauSession.consult(match[1]); | |
| console.log('✅ Tau-Prolog initialized with facts'); | |
| addPrologOutput('✅ Tau-Prolog ready. Facts loaded.'); | |
| } | |
| }) | |
| .catch(e => { | |
| console.log('⚠️ Could not load Tau-Prolog facts'); | |
| addPrologOutput('⚠️ Facts not loaded. Using demo mode.'); | |
| }); | |
| } else { | |
| console.log('⚠️ Tau-Prolog not available'); | |
| addPrologOutput('⚠️ Tau-Prolog not loaded. Queries will run in demo mode.'); | |
| } | |
| // Prolog REPL functions | |
| function addPrologOutput(text, isFrank = false) { | |
| const output = document.getElementById('prologOutput'); | |
| const line = document.createElement('div'); | |
| line.style.color = '#0f0'; | |
| if (isFrank) { | |
| line.textContent = '🤖 Frank: ' + text; | |
| } else { | |
| line.textContent = text; | |
| } | |
| output.appendChild(line); | |
| output.scrollTop = output.scrollHeight; | |
| } | |
| // Chatbot mode - natural language processing | |
| let chatMode = true; // Default to Frank mode | |
| let shardCache = {}; // Cache loaded shards | |
| // Load specific shard on demand from HuggingFace dataset | |
| async function loadShard(shardNum) { | |
| if (shardCache[shardNum]) { | |
| return shardCache[shardNum]; // Return cached | |
| } | |
| try { | |
| logError(`Loading shard ${shardNum}...`, 'info'); | |
| // Use HuggingFace Datasets API to query by shard | |
| const response = await fetch(`https://datasets-server.huggingface.co/rows?dataset=introspector/zkprologml&config=default&split=train&offset=0&length=100&where=shard=${shardNum}`); | |
| if (!response.ok) { | |
| throw new Error(`Failed to load shard ${shardNum}`); | |
| } | |
| const data = await response.json(); | |
| const files = data.rows ? data.rows.map(r => r.row) : []; | |
| shardCache[shardNum] = files; | |
| logError(`Loaded shard ${shardNum}: ${files.length} files`, 'info'); | |
| return files; | |
| } catch (e) { | |
| logError(`Failed to load shard ${shardNum}: ${e.message}`, 'warning'); | |
| return null; | |
| } | |
| } | |
| function toggleMode() { | |
| chatMode = !chatMode; | |
| const btn = document.getElementById('modeToggle'); | |
| const input = document.getElementById('prologInput'); | |
| if (chatMode) { | |
| btn.textContent = '🤖 FRANK'; | |
| btn.style.background = 'rgba(0, 255, 0, 0.2)'; | |
| input.placeholder = 'Hi Frank! Show me shard 42...'; | |
| addPrologOutput('\n🤖 Frank mode: Natural language enabled'); | |
| } else { | |
| btn.textContent = '🔮 PROLOG'; | |
| btn.style.background = 'rgba(0, 255, 0, 0.1)'; | |
| input.placeholder = '?- by_shard(42, Path).'; | |
| addPrologOutput('\n🔮 Prolog mode: Formal queries enabled'); | |
| } | |
| } | |
| function runPrologQuery() { | |
| const input = document.getElementById('prologInput'); | |
| const query = input.value.trim(); | |
| if (!query) return; | |
| // Remove leading ?- if present for natural language detection | |
| const cleanQuery = query.replace(/^\?-\s*/, ''); | |
| const lower = cleanQuery.toLowerCase(); | |
| // Check if it's a chat command | |
| if (lower === 'chat' || lower === '/chat') { | |
| chatMode = true; | |
| addPrologOutput('\n🤖 Chat mode enabled! Ask me questions in natural language.'); | |
| addPrologOutput('Try: "Where is the cafe?" or "How do I get to 2q56?"'); | |
| addPrologOutput('Type "query" to return to Prolog query mode.'); | |
| input.value = ''; | |
| return; | |
| } | |
| if (lower === 'query' || lower === '/query') { | |
| chatMode = false; | |
| addPrologOutput('\n🔮 Query mode enabled! Use Prolog syntax.'); | |
| addPrologOutput('Try: ?- by_shard(42, Path).'); | |
| input.value = ''; | |
| return; | |
| } | |
| // Detect natural language patterns (Frank mode) | |
| const isNaturalLanguage = | |
| lower.match(/\b(hi|hello|hey|help|show me|what|how|where|who|why|thanks)\b/) || | |
| lower.match(/shard\s+\d+/) || | |
| lower.match(/\b(rust|python|lean|prolog)\s+files?\b/) || | |
| lower.match(/\b(theorem|proof|proven)\b/); | |
| if (isNaturalLanguage || chatMode) { | |
| // Natural language chat mode | |
| addPrologOutput(`\nYou: ${cleanQuery}`); | |
| processChatMessage(cleanQuery); | |
| input.value = ''; | |
| return; | |
| } | |
| // Regular Prolog query mode | |
| addPrologOutput(`\n?- ${cleanQuery}`); | |
| if (!tauSession) { | |
| // Demo mode - simulate some queries | |
| if (cleanQuery.includes('by_shard')) { | |
| const match = cleanQuery.match(/by_shard\((\d+)/); | |
| if (match) { | |
| const shard = match[1]; | |
| addPrologOutput(`Path = '/example/file/in/shard/${shard}' ;`); | |
| addPrologOutput(`Path = '/another/file/in/shard/${shard}' ;`); | |
| addPrologOutput('false.'); | |
| } | |
| } else if (cleanQuery.includes('by_language')) { | |
| addPrologOutput("Path = 'example.rs' ;"); | |
| addPrologOutput("Path = 'another.rs' ;"); | |
| addPrologOutput('false.'); | |
| } else { | |
| addPrologOutput('Demo mode: Limited queries available.'); | |
| addPrologOutput('Try: by_shard(42, Path). or by_language(rust, Path).'); | |
| addPrologOutput('Or use natural language: "show me shard 42"'); | |
| } | |
| input.value = ''; | |
| return; | |
| } | |
| // Real Tau-Prolog query | |
| try { | |
| tauSession.query(cleanQuery); | |
| let count = 0; | |
| const maxResults = 10; | |
| tauSession.answers(x => { | |
| if (x === false) { | |
| if (count === 0) { | |
| addPrologOutput('false.'); | |
| } | |
| } else if (pl.type.is_error(x)) { | |
| addPrologOutput(`Error: ${x.toString()}`); | |
| } else { | |
| count++; | |
| if (count <= maxResults) { | |
| addPrologOutput(x.toString() + ' ;'); | |
| } else if (count === maxResults + 1) { | |
| addPrologOutput(`... (showing first ${maxResults} results)`); | |
| } | |
| } | |
| }); | |
| } catch (e) { | |
| addPrologOutput(`Error: ${e.message}`); | |
| } | |
| input.value = ''; | |
| } | |
| async function processChatMessage(msg) { | |
| const lower = msg.toLowerCase(); | |
| // Greetings | |
| if (lower.match(/\b(hi|hello|hey)\b/)) { | |
| addPrologOutput('Hello! I\'m Frank, your zkProlog friend!', true); | |
| addPrologOutput('I can help you explore the knowledge base. What would you like to know?', true); | |
| return; | |
| } | |
| // Help | |
| if (lower.match(/\b(help|what can you do)\b/)) { | |
| addPrologOutput('I can help you with:', true); | |
| addPrologOutput(' • Finding files by shard: "show me shard 42"'); | |
| addPrologOutput(' • Finding files by language: "show me rust files"'); | |
| addPrologOutput(' • Listing theorems: "what theorems are proven?"'); | |
| addPrologOutput(' • Counting files: "how many files in shard 0?"'); | |
| return; | |
| } | |
| // Shard queries | |
| const shardMatch = lower.match(/shard\s+(\d+)/); | |
| if (shardMatch) { | |
| const shard = parseInt(shardMatch[1]); | |
| addPrologOutput(`Looking up shard ${shard} for you...`, true); | |
| // Load shard on demand | |
| const files = await loadShard(shard); | |
| if (files && files.length > 0) { | |
| addPrologOutput(`Found ${files.length} files in shard ${shard}:`, true); | |
| files.slice(0, 10).forEach(f => { | |
| addPrologOutput(` • ${f.path} (Gödel: ${f.godel})`); | |
| }); | |
| if (files.length > 10) { | |
| addPrologOutput(` ... and ${files.length - 10} more`); | |
| } | |
| } else { | |
| addPrologOutput(`Shard ${shard} not available yet`, true); | |
| addPrologOutput(` (Shards are loaded on demand from GitHub)`, true); | |
| } | |
| return; | |
| } | |
| // Language queries | |
| if (lower.match(/\b(rust|python|lean|prolog)\s+files?\b/)) { | |
| const lang = lower.match(/\b(rust|python|lean|prolog)\b/)[1]; | |
| const ext = lang === 'rust' ? 'rs' : lang === 'python' ? 'py' : lang === 'lean' ? 'lean' : 'pl'; | |
| addPrologOutput(`Searching for ${lang} files...`, true); | |
| addPrologOutput(` (Try asking for a specific shard: "show me shard 0")`, true); | |
| return; | |
| } | |
| // Theorems | |
| if (lower.match(/\b(theorem|proof|proven)\b/)) { | |
| addPrologOutput('Here are the proven theorems:', true); | |
| addPrologOutput(' • eigenvector_total'); | |
| addPrologOutput(' • eigenvector_deterministic'); | |
| addPrologOutput(' • eigenvector_disjoint'); | |
| return; | |
| } | |
| // Thanks | |
| if (lower.match(/\b(thanks|thank you)\b/)) { | |
| addPrologOutput('You\'re very welcome! Happy to help anytime!', true); | |
| return; | |
| } | |
| // Default | |
| addPrologOutput('Hmm, I\'m not sure about that. Try "help" to see what I can do!', true); | |
| } | |
| // Allow Enter key to run query | |
| document.addEventListener('DOMContentLoaded', () => { | |
| const input = document.getElementById('prologInput'); | |
| if (input) { | |
| input.addEventListener('keypress', (e) => { | |
| if (e.key === 'Enter') { | |
| runPrologQuery(); | |
| } | |
| }); | |
| // Check for URL parameters | |
| const urlParams = new URLSearchParams(window.location.search); | |
| const query = urlParams.get('query'); | |
| if (query) { | |
| input.value = decodeURIComponent(query); | |
| // Auto-run after a short delay | |
| setTimeout(() => { | |
| runPrologQuery(); | |
| logError(`Auto-ran query from URL: ${query}`, 'info'); | |
| }, 1000); | |
| } | |
| } | |
| }); | |
| // Update uptime every second | |
| setInterval(() => { | |
| const elapsed = Math.floor((Date.now() - startTime) / 1000); | |
| const hours = Math.floor(elapsed / 3600); | |
| const mins = Math.floor((elapsed % 3600) / 60); | |
| const secs = elapsed % 60; | |
| document.getElementById('uptime').textContent = | |
| hours > 0 ? `${hours}h ${mins}m ${secs}s` : | |
| mins > 0 ? `${mins}m ${secs}s` : `${secs}s`; | |
| }, 1000); | |
| // Make every character clickable with proof | |
| function makeClickable(element, baseGodel) { | |
| const text = element.textContent; | |
| element.innerHTML = ''; | |
| for (let i = 0; i < text.length; i++) { | |
| const char = text[i]; | |
| const charCode = char.charCodeAt(0); | |
| const godel = baseGodel + charCode; | |
| const span = document.createElement('span'); | |
| span.textContent = char; | |
| span.style.cursor = 'pointer'; | |
| span.onclick = (e) => { | |
| e.stopPropagation(); | |
| showProof(`Character: '${char}'`, `ASCII ${charCode}`, godel, `unicode_${charCode}.txt`); | |
| }; | |
| span.onmouseover = () => span.style.textShadow = '0 0 10px #0f0'; | |
| span.onmouseout = () => span.style.textShadow = ''; | |
| element.appendChild(span); | |
| } | |
| } | |
| // Matrix rain effect | |
| const canvas = document.getElementById('matrix'); | |
| const ctx = canvas.getContext('2d'); | |
| canvas.width = window.innerWidth; | |
| canvas.height = window.innerHeight; | |
| const chars = '01アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン'; | |
| const fontSize = 14; | |
| const columns = canvas.width / fontSize; | |
| const drops = Array(Math.floor(columns)).fill(1); | |
| function drawMatrix() { | |
| ctx.fillStyle = 'rgba(0, 0, 0, 0.05)'; | |
| ctx.fillRect(0, 0, canvas.width, canvas.height); | |
| ctx.fillStyle = '#0f0'; | |
| ctx.font = fontSize + 'px monospace'; | |
| for (let i = 0; i < drops.length; i++) { | |
| const text = chars[Math.floor(Math.random() * chars.length)]; | |
| ctx.fillText(text, i * fontSize, drops[i] * fontSize); | |
| if (drops[i] * fontSize > canvas.height && Math.random() > 0.975) { | |
| drops[i] = 0; | |
| } | |
| drops[i]++; | |
| } | |
| } | |
| setInterval(drawMatrix, 33); | |
| // System state | |
| let state = { | |
| files: 0, | |
| theorems: 0, | |
| entities: 0, | |
| accuracy: 0, | |
| shardActivity: Array(71).fill(0) | |
| }; | |
| // Terminal logging | |
| function log(message) { | |
| const terminal = document.getElementById('terminal'); | |
| const line = document.createElement('div'); | |
| line.className = 'terminal-line'; | |
| line.textContent = `> ${new Date().toISOString().substr(11, 8)} | ${message}`; | |
| terminal.appendChild(line); | |
| terminal.scrollTop = terminal.scrollHeight; | |
| if (terminal.children.length > 50) { | |
| terminal.removeChild(terminal.firstChild); | |
| } | |
| } | |
| // Update timestamp | |
| function updateTimestamp() { | |
| document.getElementById('timestamp').textContent = new Date().toISOString(); | |
| } | |
| setInterval(updateTimestamp, 1000); | |
| updateTimestamp(); | |
| // Animate counter | |
| function animateValue(id, start, end, duration) { | |
| const obj = document.getElementById(id); | |
| const range = end - start; | |
| const increment = range / (duration / 16); | |
| let current = start; | |
| const timer = setInterval(() => { | |
| current += increment; | |
| if ((increment > 0 && current >= end) || (increment < 0 && current <= end)) { | |
| current = end; | |
| clearInterval(timer); | |
| } | |
| obj.textContent = id === 'accuracy' ? current.toFixed(1) + '%' : Math.floor(current).toLocaleString(); | |
| }, 16); | |
| } | |
| // Initialize Monster Group shards | |
| function initShards() { | |
| const grid = document.getElementById('shardGrid'); | |
| if (!grid) { | |
| logError('shardGrid element not found!', 'error'); | |
| return; | |
| } | |
| logError('Initializing 71 Monster Group shards...', 'info'); | |
| for (let i = 0; i < 71; i++) { | |
| const shard = document.createElement('div'); | |
| shard.className = 'shard'; | |
| shard.textContent = i; | |
| shard.id = `shard-${i}`; | |
| shard.onclick = () => { | |
| const godelStart = i * 112900; // ~8M / 71 shards | |
| const proofKey = `shard_${i}`; | |
| showProof(`Shard ${i}`, `~113K files`, godelStart, `shard_${i}.parquet`, proofKey); | |
| }; | |
| grid.appendChild(shard); | |
| } | |
| logError(`Created ${grid.children.length} shards`, 'info'); | |
| } | |
| // Show proof modal | |
| function showProof(name, value, godel, source, proofKey) { | |
| const hfUrl = `https://huggingface.co/datasets/introspector/zkprologml/viewer/default/train?row=${godel}`; | |
| // Map sources to correct URLs | |
| let githubUrl; | |
| if (source === 'master.parquet' || source === 'indexed_files_natural_classes.parquet') { | |
| githubUrl = 'https://huggingface.co/datasets/introspector/zkprologml/blob/main/data.parquet'; | |
| } else if (source.startsWith('shard_')) { | |
| githubUrl = `https://huggingface.co/datasets/introspector/zkprologml/viewer/default/train?shard=${godel % 71}`; | |
| } else if (source.startsWith('unicode_') || source.startsWith('char_')) { | |
| githubUrl = 'https://github.com/meta-introspector/zkprologml/blob/main/data/proofs/tau_facts.js'; | |
| } else if (source === 'Monster Group') { | |
| githubUrl = 'https://github.com/meta-introspector/zkprologml/blob/main/data/proofs/power_of_2_model.pl'; | |
| } else if (source === 'README.md') { | |
| githubUrl = 'https://github.com/meta-introspector/zkprologml/blob/main/README.md'; | |
| } else { | |
| githubUrl = `https://github.com/meta-introspector/zkprologml/blob/main/data/proofs/${source}`; | |
| } | |
| const modal = document.createElement('div'); | |
| modal.style.cssText = ` | |
| position: fixed; top: 0; left: 0; width: 100%; height: 100%; | |
| background: rgba(0,0,0,0.9); z-index: 1000; | |
| display: flex; align-items: center; justify-content: center; | |
| `; | |
| // Get zkProof for this value | |
| const finalProofKey = proofKey || name.toLowerCase().split(':')[0].trim().replace(/ /g, ''); | |
| const zkProof = zkProofs[finalProofKey]; | |
| const zkProofHtml = zkProof ? ` | |
| <div style="margin: 20px 0; padding: 15px; background: rgba(0,255,0,0.05); border: 1px solid #0f0; border-radius: 5px;"> | |
| <p style="margin-bottom: 10px;"><strong>🔐 zkSNARK Proof (Groth16):</strong></p> | |
| <div style="font-size: 11px; font-family: monospace; line-height: 1.6;"> | |
| <p><strong>Protocol:</strong> ${zkProof.proof.protocol}</p> | |
| <p><strong>Curve:</strong> ${zkProof.proof.curve}</p> | |
| <p><strong>Public Signals:</strong> [${zkProof.publicSignals.join(', ')}]</p> | |
| <details style="margin-top: 10px;"> | |
| <summary style="cursor: pointer; color: #0f0;">View Full Proof</summary> | |
| <pre style="margin-top: 10px; overflow-x: auto;">${JSON.stringify(zkProof.proof, null, 2)}</pre> | |
| </details> | |
| </div> | |
| </div> | |
| ` : ''; | |
| modal.innerHTML = ` | |
| <div style="background: #000; border: 2px solid #0f0; padding: 30px; max-width: 600px; border-radius: 10px; max-height: 90vh; overflow-y: auto;"> | |
| <h2 style="color: #0f0; margin-bottom: 20px;">🔮 Proof: ${name}</h2> | |
| <div style="margin: 15px 0; line-height: 1.8;"> | |
| <p><strong>Value:</strong> ${value}</p> | |
| <p><strong>Gödel Number:</strong> ${godel}</p> | |
| <p><strong>Shard:</strong> ${godel % 71}</p> | |
| <p><strong>Source:</strong> ${source}</p> | |
| </div> | |
| ${zkProofHtml} | |
| <div style="margin: 20px 0;"> | |
| <p style="margin-bottom: 10px;"><strong>Links:</strong></p> | |
| <a href="${hfUrl}" target="_blank" style="color: #0f0; display: block; margin: 5px 0;"> | |
| 📊 View in HuggingFace Dataset (row ${godel}) | |
| </a> | |
| <a href="${githubUrl}" target="_blank" style="color: #0f0; display: block; margin: 5px 0;"> | |
| 📁 View Source on GitHub | |
| </a> | |
| </div> | |
| <button onclick="this.parentElement.parentElement.remove()" | |
| style="background: #0f0; color: #000; border: none; padding: 10px 20px; | |
| cursor: pointer; font-family: 'Courier New'; font-weight: bold; margin-top: 10px;"> | |
| CLOSE | |
| </button> | |
| </div> | |
| `; | |
| document.body.appendChild(modal); | |
| modal.onclick = (e) => { if (e.target === modal) modal.remove(); }; | |
| } | |
| // Update system state | |
| function updateState() { | |
| // Simulate zkProlog execution | |
| state.files = Math.min(state.files + Math.floor(Math.random() * 100000), 8017192); | |
| state.theorems = Math.min(state.theorems + (Math.random() > 0.7 ? 1 : 0), 10); | |
| state.entities = Math.min(state.entities + (Math.random() > 0.8 ? 1 : 0), 42); | |
| state.accuracy = Math.min(state.accuracy + Math.random() * 5, 99.6); | |
| // Update UI | |
| animateValue('files', parseInt(document.getElementById('files').textContent.replace(/,/g, '')), state.files, 500); | |
| animateValue('theorems', parseInt(document.getElementById('theorems').textContent), state.theorems, 500); | |
| animateValue('entities', parseInt(document.getElementById('entities').textContent), state.entities, 500); | |
| animateValue('accuracy', parseFloat(document.getElementById('accuracy').textContent), state.accuracy, 500); | |
| // Update state label | |
| const states = ['INDEXING', 'PROVING', 'UNIFYING', 'PARTITIONING', 'OPTIMIZING']; | |
| document.getElementById('state').textContent = states[Math.floor(Math.random() * states.length)]; | |
| // Activate random shard | |
| const activeShard = Math.floor(Math.random() * 71); | |
| state.shardActivity[activeShard]++; | |
| document.getElementById(`shard-${activeShard}`).classList.add('active'); | |
| setTimeout(() => { | |
| document.getElementById(`shard-${activeShard}`).classList.remove('active'); | |
| }, 1000); | |
| // Log activity | |
| const activities = [ | |
| `Indexed ${Math.floor(Math.random() * 10000)} files in shard ${activeShard}`, | |
| `Proved theorem: eigenvector_property_${Math.floor(Math.random() * 100)}`, | |
| `Unified ${Math.floor(Math.random() * 10)} entities`, | |
| `Partitioned graph: ${Math.floor(Math.random() * 1000)} edges`, | |
| `Computed Gödel numbers for ${Math.floor(Math.random() * 5000)} objects`, | |
| `Monster Group transformation applied to shard ${activeShard}`, | |
| `Natural class assigned: ${['very_low', 'low', 'medium', 'high', 'very_high'][Math.floor(Math.random() * 5)]}`, | |
| `Eigenvector sum computed: ${Math.floor(Math.random() * 173)}`, | |
| `Prolog facts generated: ${Math.floor(Math.random() * 10000)}`, | |
| `Nix derivation built for shard ${activeShard}` | |
| ]; | |
| log(activities[Math.floor(Math.random() * activities.length)]); | |
| } | |
| // Initialize | |
| initShards(); | |
| log('System initialized'); | |
| log('Monster Group (71 shards) loaded'); | |
| log('zkProlog engine started'); | |
| log('Auto-update enabled (2s interval)'); | |
| // Auto-update every 2 seconds | |
| setInterval(updateState, 2000); | |
| // Make all value numbers clickable after they're rendered | |
| setTimeout(() => { | |
| makeClickable(document.getElementById('files'), 8017192); | |
| makeClickable(document.getElementById('theorems'), 10); | |
| makeClickable(document.getElementById('entities'), 42); | |
| makeClickable(document.getElementById('accuracy'), 996); | |
| }, 100); | |
| // Initial update | |
| setTimeout(() => { | |
| state.files = 8017192; | |
| state.theorems = 10; | |
| state.entities = 42; | |
| state.accuracy = 99.6; | |
| updateState(); | |
| }, 1000); | |
| </script> | |
| </body> | |
| </html> | |