File tree Expand file tree Collapse file tree 2 files changed +25
-6
lines changed
Expand file tree Collapse file tree 2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ describe('bundle', () => {
9595 ] )
9696 } )
9797
98- it . skip ( 'checks for counterexamples' , ( ) => {
98+ it ( 'checks for counterexamples' , ( ) => {
9999 const { errors } = bundle ( {
100100 properties : [ F . property ( { uid : 'P1' } ) , F . property ( { uid : 'P2' } ) ] ,
101101 spaces : [ F . space ( { uid : 'S1' } ) ] ,
Original file line number Diff line number Diff line change @@ -2,14 +2,16 @@ import { z } from 'zod'
22import yaml from 'yaml-front-matter'
33
44import {
5- Bundle ,
6- Property ,
7- Trait ,
5+ type Bundle ,
6+ ImplicationIndex ,
7+ type Property ,
8+ type Space ,
9+ deduceTraits ,
810 formula as Formula ,
911 schemas ,
1012} from '@pi-base/core'
1113
12- import { File } from './fs.js'
14+ import type { File } from './fs.js'
1315
1416// FIXME
1517type CheckResult =
@@ -18,7 +20,24 @@ type CheckResult =
1820 kind : 'contradiction'
1921 contradiction : { theorems : unknown [ ] ; properties : unknown [ ] }
2022 }
21- function check ( bundle : Bundle , _ : unknown ) : CheckResult {
23+ function check ( bundle : Bundle , space : Space ) : CheckResult {
24+ const implications = new ImplicationIndex (
25+ Array . from ( bundle . theorems . values ( ) ) . map ( ( { uid, when, then } ) => ( {
26+ id : uid ,
27+ when,
28+ then,
29+ } ) ) ,
30+ )
31+ const traits = new Map (
32+ Array . from ( bundle . traits . values ( ) )
33+ . filter ( trait => trait . space === space . uid )
34+ . map ( trait => [ trait . property , trait . value ] ) ,
35+ )
36+
37+ const result = deduceTraits ( implications , traits )
38+ if ( result . kind === 'contradiction' ) {
39+ return result
40+ }
2241 return { kind : 'bundle' , bundle }
2342}
2443
You can’t perform that action at this time.
0 commit comments