git @ Cat's Eye Technologies Eqthy / master src / eqthy / objects.py
master

Tree @master (Download .tar.gz)

objects.py @masterraw · history · blame

# Copyright (c) 2022-2024 Chris Pressey, Cat's Eye Technologies
# This file is distributed under a 2-clause BSD license.  See LICENSES directory:
# SPDX-License-Identifier: LicenseRef-BSD-2-Clause-X-Eqthy

"""Objects in the Eqthy document structure."""
from dataclasses import dataclass
from typing import List, Union
from .terms import Eqn, Term, Variable


class Hint:
    pass


@dataclass(frozen=True)
class Reflexivity(Hint):
    pass


@dataclass(frozen=True)
class Substitution(Hint):
    term: Term
    variable: Variable


@dataclass(frozen=True)
class Congruence(Hint):
    term: Term
    variable: Variable


@dataclass(frozen=True)
class Reference(Hint):
    name: str
    side: Union[str, None]
    substs: List[Eqn]


# proof objects

@dataclass(frozen=True)
class Axiom:
    name: str
    eqn: Eqn


@dataclass(frozen=True)
class Step:
    eqn: Eqn
    hint: Union[Hint, None]


@dataclass(frozen=True)
class Theorem:
    name: str
    eqn: Eqn
    steps: List[Step]


@dataclass(frozen=True)
class Document:
    axioms: List[Axiom]
    theorems: List[Theorem]