Finch
Copyright(c) Leon Vatthauer 2026
LicenseGPL-3
MaintainerLeon Vatthauer <leon.vatthauer@fau.de>
Stabilityexperimental
Portabilitynon-portable (ghc-wasm-meta)
Safe HaskellNone
LanguageGHC2024

Parser.Proof

Description

This module defines parsers for Derivations and full Proofs.

Synopsis

Line parsers

pFormula :: FormulaParser m => m Formula Source #

Parses a Formula, capturing the source text and wrapping the result in ParsedValid.

pAssumption :: FormulaParser m => m Assumption Source #

Parses an Assumption, capturing the source text and wrapping the result in ParsedValid.

Proof structure parsers

withIndent :: Parser m => Int -> m a -> m a Source #

Combinator that gates a parser behind n leading | symbols.

pFormulaSep :: Parser m => Int -> m () Source #

Parses the --- separator that divides Assumptions from Derivations in a Proof, respecting the current indentation depth.

pProof :: FormulaParser m => Int -> m Proof Source #

Parses a Proof at the given indentation depth.

The structure is:

  1. Zero or more Assumptions, collected up to the --- separator.
  2. One or more Derivations or nested SubProofs.
  3. The final element must be a Derivation.

Entry points

parseLine Source #

Arguments

:: [(Text, Text, Int)]

List of operators as (alias, operator, arity).

-> [(Text, Text)]

List of infix predicates as (alias, predicate).

-> [(Text, Text)]

List of quantifiers as (alias, quantifier).

-> Text

Input Text to parse.

-> Either Text Derivation 

Parses a single Derivation line from a Text. Returns Left with a human-readable error message on failure, or Right with the parsed Derivation on success.

parseProof Source #

Arguments

:: [(Text, Text, Int)]

List of operators as (alias, operator, arity).

-> [(Text, Text)]

List of infix predicates as (alias, predicate).

-> [(Text, Text)]

List of quantifiers as (alias, quantifier).

-> Text

Input Text to parse.

-> Either Text Proof 

Parses a full Proof from a Text. Returns Left with a human-readable error message on failure, or Right with the parsed Proof on success.