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

Fitch.Unification

Description

This module implements the ability to check a Term, Formula or Assumption against its TermSpec, FormulaSpec or AssumptionSpec.

Furthermore, implements a variant of the Martelli Montanari unification algorithm. where tFormulae or Terms are unified on a specific variable, meaning the variable must occur on the left-hand-side of the resulting unifier.

Synopsis

Collecting Variables

All variables

class AllVars a where Source #

Type class for structures that have variables occuring in them.

Minimal complete definition

allVars

Methods

allVars :: a -> Set Name Source #

Returns all variables occuring in the structure.

makeFresh :: Name -> a -> Name Source #

Takes a name and a structure and makes it fresh w.r.t. all the variables occuring in the structure.

isFresh :: Name -> a -> Bool Source #

Checks if a variable is fresh in a structure.

Free variables

class FreeVars a where Source #

Type class for structures that have variables occuring in them.

Methods

freeVars :: a -> Set Name Source #

Returns only the free (i.e. unbound) variables occuring in the structure.

Instances

Instances details
FreeVars RawAssumption Source # 
Instance details

Defined in Fitch.Unification

FreeVars RawFormula Source # 
Instance details

Defined in Fitch.Unification

FreeVars Term Source # 
Instance details

Defined in Fitch.Unification

Methods

freeVars :: Term -> Set Name Source #

Substitution

class Substitute a b where Source #

Type class for substitution.

Methods

subst :: Subst b -> a -> a Source #

Takes a substitution and replaces variables occuring in the structure of type a with elements of type b. Of course this only makes sense if the type a also contains the type b.

Instances

Instances details
Substitute RawFormula Term Source # 
Instance details

Defined in Fitch.Unification

Substitute Term Term Source # 
Instance details

Defined in Fitch.Unification

Methods

subst :: Subst Term -> Term -> Term Source #

Unification

unifyTermsOnVariable :: Name -> [(Term, Term)] -> Maybe [(Name, Term)] Source #

Unification on terms, this is the Martelli-Montanari unification algorithm with a twist: the unification happens on a variable x. Meaning the resulting unificator must have the variable x on the left hand side.

This is guaranteed by adding a new orient rule, which orients assignments of the form x := y, where y is also a variable.