|
| 1 | +-- SPDX-License-Identifier: PMPL-1.0-or-later |
| 2 | +-- Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk> |
| 3 | +-- |
| 4 | +-- nesy-solver playground schema — minimal subset of clickhouse-init.sql. |
| 5 | +-- Creates just the tables verisim-api needs to serve the playground: |
| 6 | +-- verisimdb.proof_attempts — row-per-attempt log |
| 7 | +-- verisimdb.mv_prover_success_by_class — strategy aggregate view |
| 8 | +-- |
| 9 | +-- Apply (via HTTP): |
| 10 | +-- curl -s 'http://clickhouse-nesy.internal:8123/' \ |
| 11 | +-- --data-binary @nesy-playground-schema.sql |
| 12 | +-- |
| 13 | +-- Or via clickhouse-client: |
| 14 | +-- clickhouse-client --host clickhouse-nesy.internal \ |
| 15 | +-- --multiquery < nesy-playground-schema.sql |
| 16 | + |
| 17 | +CREATE DATABASE IF NOT EXISTS verisimdb; |
| 18 | + |
| 19 | +CREATE TABLE IF NOT EXISTS verisimdb.proof_attempts |
| 20 | +( |
| 21 | + attempt_id String, |
| 22 | + obligation_id String, |
| 23 | + repo String, |
| 24 | + file String, |
| 25 | + claim String, |
| 26 | + obligation_class String, |
| 27 | + prover_used Enum8('coq' = 0, 'lean' = 1, 'agda' = 2, 'isabelle' = 3, |
| 28 | + 'idris2' = 4, 'fstar' = 5, 'z3' = 6, 'cvc5' = 7, |
| 29 | + 'altergo' = 8, 'dafny' = 9, 'why3' = 10, 'metamath' = 11, |
| 30 | + 'hol_light' = 12, 'mizar' = 13, 'hol4' = 14, 'pvs' = 15, |
| 31 | + 'acl2' = 16, 'tlaps' = 17, 'vampire' = 18, 'eprover' = 19, |
| 32 | + 'other' = 99), |
| 33 | + outcome Enum8('success' = 0, 'timeout' = 1, 'failure' = 2, 'unknown' = 3), |
| 34 | + duration_ms UInt64, |
| 35 | + confidence Float32, |
| 36 | + parent_attempt_id Nullable(String), |
| 37 | + strategy_tag String, |
| 38 | + started_at DateTime64(3), |
| 39 | + completed_at DateTime64(3), |
| 40 | + prover_output String, |
| 41 | + error_message Nullable(String) |
| 42 | +) |
| 43 | +ENGINE = MergeTree() |
| 44 | +ORDER BY (obligation_class, prover_used, started_at) |
| 45 | +PARTITION BY toYYYYMM(started_at) |
| 46 | +SETTINGS index_granularity = 8192; |
| 47 | + |
| 48 | +CREATE MATERIALIZED VIEW IF NOT EXISTS verisimdb.mv_prover_success_by_class |
| 49 | +ENGINE = SummingMergeTree() |
| 50 | +ORDER BY (obligation_class, prover_used) |
| 51 | +AS SELECT |
| 52 | + obligation_class, |
| 53 | + prover_used, |
| 54 | + countIf(outcome = 'success') AS success_count, |
| 55 | + count() AS total_attempts, |
| 56 | + sum(duration_ms) AS total_duration_ms |
| 57 | +FROM verisimdb.proof_attempts |
| 58 | +GROUP BY obligation_class, prover_used; |
0 commit comments