diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 54686e0..bb346fa 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -14,6 +14,7 @@ export { disproveFormula, proveTheorem, } from './Logic/index.js' +export { type Result } from './Logic/Prover.js' export { type Space, SpacePage } from './Space.js' export { type Theorem, SerializedTheorem } from './Theorem.js' export { type Trait } from './Trait.js' diff --git a/packages/viewer/src/components/Traits/Redundancy.svelte b/packages/viewer/src/components/Traits/Redundancy.svelte new file mode 100644 index 0000000..0f95a31 --- /dev/null +++ b/packages/viewer/src/components/Traits/Redundancy.svelte @@ -0,0 +1,19 @@ + + +{#if result.redundant} +
+ Notice: + This asserted property can be deduced from the other asserted traits for this + space, due to the following theorems. +
+ +{/if} diff --git a/packages/viewer/src/components/Traits/Show.svelte b/packages/viewer/src/components/Traits/Show.svelte index 9fe08b9..e6dfd6d 100644 --- a/packages/viewer/src/components/Traits/Show.svelte +++ b/packages/viewer/src/components/Traits/Show.svelte @@ -2,6 +2,8 @@ import type { Space, Property, Trait, Proof as ProofT } from '@/models' import { Icons, Link, References, Source, Typeset } from '@/components/Shared' import Proof from './Proof.svelte' + import Redundancy from './Redundancy.svelte' + import { contributingUrl } from '@/constants' export let space: Space export let property: Property export let trait: Trait | undefined @@ -36,7 +38,6 @@ ))[] } | undefined - import { contributingUrl } from '@/constants'

Space S{space.id} | Property P{property.id}

@@ -73,6 +74,7 @@

References

+ {:else} Please consider contributing a proof or disproof of this property. diff --git a/packages/viewer/src/stores/deduction.ts b/packages/viewer/src/stores/deduction.ts index b089d01..17c5bb3 100644 --- a/packages/viewer/src/stores/deduction.ts +++ b/packages/viewer/src/stores/deduction.ts @@ -188,3 +188,31 @@ function loadProof( return result } + +export function checkIfRedundant( + space: Space, + property: Property, + thms: Theorems, + traits: Traits, +): { redundant: boolean; theorems: Theorem[] } { + const assertedTraits = traits.forSpace(space).filter(([_, t]) => t.asserted) + const map = new Map( + assertedTraits.map(([p, t]) => { + if (p === property) { + return [p.id, !t.value] + } else { + return [p.id, t.value] + } + }), + ) + const result = deduceTraits(indexTheorems(thms), map) + const redundant = result.kind === 'contradiction' + if (!redundant) { + const theorems: Theorem[] = [] + return { redundant, theorems } + } + const theorems = result.contradiction.theorems + .map(t => thms.find(t)) + .filter(t => t !== null) + return { redundant, theorems } +}