( ce: ReturnType<typeof createEngine>, e: Entry )
| 78 | } |
| 79 | |
| 80 | function classifyEntry( |
| 81 | ce: ReturnType<typeof createEngine>, |
| 82 | e: Entry |
| 83 | ): EntryOutcome { |
| 84 | const conjuncts = conjunctsOf(e.assumptions); |
| 85 | |
| 86 | ce.pushScope(); |
| 87 | try { |
| 88 | let assumable = true; |
| 89 | let failure: EntryOutcome | undefined; |
| 90 | |
| 91 | for (const c of conjuncts) { |
| 92 | let result: string; |
| 93 | try { |
| 94 | result = ce.assume(ce.expr(c as any, { canonical: !hasPartHead(c) })); |
| 95 | } catch { |
| 96 | assumable = false; |
| 97 | failure ??= 'assume-threw'; |
| 98 | continue; |
| 99 | } |
| 100 | if (result !== 'ok' && result !== 'tautology') { |
| 101 | assumable = false; |
| 102 | if (result === 'contradiction') failure ??= 'contradiction'; |
| 103 | else if (result === 'internal-error') failure ??= 'internal-error'; |
| 104 | else failure ??= 'not-a-predicate'; |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | if (!assumable) return failure!; |
| 109 | |
| 110 | // Dischargeability: verify the full assumptions expression. Box |
| 111 | // canonically — verify() itself boxes raw, which would leave plain |
| 112 | // MathJSON unbound. |
| 113 | let verified: boolean | undefined; |
| 114 | try { |
| 115 | verified = ce.verify(ce.expr(e.assumptions as any)); |
| 116 | } catch { |
| 117 | return 'verify-threw'; |
| 118 | } |
| 119 | if (verified === true) return 'dischargeable'; |
| 120 | if (verified === false) return 'verify-false'; |
| 121 | return 'verify-undefined'; |
| 122 | } finally { |
| 123 | ce.popScope(); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | function main(): void { |
| 128 | const corpus = loadCorpus(DATA_DIR); |
no test coverage detected