diff --git a/packages/viewer/src/components/Traits/Redundancy.svelte b/packages/viewer/src/components/Traits/Redundancy.svelte index 05a9948..0f95a31 100644 --- a/packages/viewer/src/components/Traits/Redundancy.svelte +++ b/packages/viewer/src/components/Traits/Redundancy.svelte @@ -1,26 +1,19 @@ -{#if result.kind === 'contradiction'} +{#if result.redundant}
Notice: - This asserted property can be deduced from the other asserted traits for - this space. + 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/stores/deduction.ts b/packages/viewer/src/stores/deduction.ts index 853c2b9..17c5bb3 100644 --- a/packages/viewer/src/stores/deduction.ts +++ b/packages/viewer/src/stores/deduction.ts @@ -18,7 +18,6 @@ import type { Traits, } from '@/models' import { eachTick, read, subscribeUntil } from '@/util' -import type { Result } from '@pi-base/core' export type State = { checked: Set @@ -190,12 +189,12 @@ function loadProof( return result } -export function checkNegation( - theorems: Theorems, +export function checkIfRedundant( space: Space, - traits: Traits, property: Property, -): Result { + 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]) => { @@ -206,5 +205,14 @@ export function checkNegation( } }), ) - return deduceTraits(indexTheorems(theorems), map) + 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 } }