summaryrefslogtreecommitdiffstats
path: root/src/act4e_solutions/sets_properties.py
blob: 2044abd570e02e3590bd7b7bd0eab2e4633d4b42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from typing import Any, overload, Sequence, TypeVar

import act4e_interfaces as I

X = TypeVar("X")


class SolFiniteSetProperties(I.FiniteSetProperties):
    def is_subset(self, a: I.FiniteSet[X], b: I.FiniteSet[X]) -> bool:
        return all([b.contains(e) for e in a.elements()])

    def equal(self, a: I.FiniteSet[X], b: I.FiniteSet[X]) -> bool:
        return self.is_Subset(a, b) and self.is_subset(b, a)

    def is_strict_subset(self, a: I.FiniteSet[X], b: I.FiniteSet[X]) -> bool:
        return self.is_subset(a, b) and not self.is_subset(b, a)


class SolFiniteMakeSetUnion(I.FiniteMakeSetUnion):
    def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]:
        raise NotImplementedError() # implement here


class SolFiniteMakeSetIntersection(I.FiniteMakeSetIntersection):
    def intersection(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSet[X]:
        raise NotImplementedError()