autoproof-0.0.0.0: Propositional logic library
Copyright(c) Artem Mavrin 2021
LicenseBSD3
Maintainerartemvmavrin@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

AutoProof.Internal.AST

Description

Defines an abstract syntax tree class and related functions.

Synopsis

Abstract syntax tree class and metadata type

class AST t where Source #

Abstract syntax tree class.

Minimal complete definition

root, children, metadata

Associated Types

type Root t Source #

The type of the values annotating AST nodes.

Methods

root :: t -> Root t Source #

The value at the AST's root node.

children :: t -> [t] Source #

The AST's child ASTs.

metadata :: t -> ASTMetadata Source #

The AST's metadata

height :: t -> Int Source #

Number of edges on the longest path from the root of the AST to a leaf.

size :: t -> Int Source #

Number of nodes in the AST.

Instances

Instances details
AST (Formula a) Source # 
Instance details

Defined in AutoProof.Internal.Formula.Types

Associated Types

type Root (Formula a) Source #

AST (Proof a) Source # 
Instance details

Defined in AutoProof.Internal.Proof.Types

Associated Types

type Root (Proof a) Source #

data ASTMetadata Source #

Container type for AST properties, intended for constant-time access.

Constructors

ASTMetadata 

Fields

AST functions

subtrees :: (AST t, Ord t) => t -> Set t Source #

(subtrees t) is the set of all subtrees of an AST t (including t itself).

properSubtrees :: (AST t, Ord t) => t -> Set t Source #

(properSubtrees t) is the the set of all proper subtrees of an AST t (i.e., not including t itself).

Helper functions for creating AST constructors

atomicASTConstructor :: (ASTMetadata -> a -> t) -> a -> t Source #

Helper function for creating metadata-aware ASTs.

unaryASTConstructor :: AST t => (ASTMetadata -> t -> t) -> t -> t Source #

Helper function for creating metadata-aware ASTs.

binaryASTConstructor :: AST t => (ASTMetadata -> t -> t -> t) -> t -> t -> t Source #

Helper function for creating metadata-aware ASTs.

unaryRootedASTConstructor :: AST t => (ASTMetadata -> a -> t -> t) -> a -> t -> t Source #

Helper function for creating metadata-aware rooted ASTs.

binaryRootedASTConstructor :: AST t => (ASTMetadata -> a -> t -> t -> t) -> a -> t -> t -> t Source #

Helper function for creating metadata-aware rooted ASTs.

ternaryRootedASTConstructor :: AST t => (ASTMetadata -> a -> t -> t -> t -> t) -> a -> t -> t -> t -> t Source #

Helper function for creating metadata-aware rooted ASTs.