Agda-2.5.4: A dependently typed functional programming language and proof assistant

Safe HaskellNone
LanguageHaskell2010

Agda.TypeChecking.Rewriting.NonLinMatch

Description

Non-linear matching of the lhs of a rewrite rule against a neutral term.

Given a lhs

Δ ⊢ lhs : B

and a candidate term

Γ ⊢ t : A

we seek a substitution Γ ⊢ σ : Δ such that

Γ ⊢ B[σ] = A and Γ ⊢ lhs[σ] = t : A

Synopsis

Documentation

class PatternFrom a b where #

Turn a term into a non-linear pattern, treating the free variables as pattern variables. The first argument indicates the relevance we are working under: if this is Irrelevant, then we construct a pattern that never fails to match. The second argument is the number of bound variables (from pattern lambdas).

Minimal complete definition

patternFrom

Methods

patternFrom :: Relevance -> Int -> a -> TCM b #

Instances
PatternFrom Sort NLPat # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

patternFrom :: Relevance -> Int -> Sort -> TCM NLPat #

PatternFrom Type NLPType # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

PatternFrom Term NLPat # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

patternFrom :: Relevance -> Int -> Term -> TCM NLPat #

PatternFrom a b => PatternFrom [a] [b] # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

patternFrom :: Relevance -> Int -> [a] -> TCM [b] #

PatternFrom a b => PatternFrom (Dom a) (Dom b) # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

patternFrom :: Relevance -> Int -> Dom a -> TCM (Dom b) #

PatternFrom a b => PatternFrom (Arg a) (Arg b) # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

patternFrom :: Relevance -> Int -> Arg a -> TCM (Arg b) #

PatternFrom a b => PatternFrom (Abs a) (Abs b) # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

patternFrom :: Relevance -> Int -> Abs a -> TCM (Abs b) #

PatternFrom a NLPat => PatternFrom (Elim' a) (Elim' NLPat) # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

patternFrom :: Relevance -> Int -> Elim' a -> TCM (Elim' NLPat) #

type NLM = ExceptT Blocked_ (StateT NLMState ReduceM) #

Monad for non-linear matching.

data NLMState #

Constructors

NLMState 
Instances
Null NLMState # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

empty :: NLMState #

null :: NLMState -> Bool #

liftRed :: ReduceM a -> NLM a #

tellSub :: Relevance -> Int -> Term -> NLM () #

Add substitution i |-> v to result of matching.

tellEq :: Telescope -> Telescope -> Term -> Term -> NLM () #

data PostponedEquation #

Matching against a term produces a constraint which we have to verify after applying the substitution computed by matching.

Constructors

PostponedEquation 

Fields

  • eqFreeVars :: Telescope

    Telescope of free variables in the equation

  • eqLhs :: Term

    Term from pattern, living in pattern context.

  • eqRhs :: Term

    Term from scrutinee, living in context where matching was invoked.

class Match a b where #

Match a non-linear pattern against a neutral term, returning a substitution.

Minimal complete definition

match

Methods

match #

Arguments

:: Relevance

Are we currently matching in an irrelevant context?

-> Telescope

The telescope of pattern variables

-> Telescope

The telescope of lambda-bound variables

-> a

The pattern to match

-> b

The term to be matched against the pattern

-> NLM () 
Instances
Match NLPType Type # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

match :: Relevance -> Telescope -> Telescope -> NLPType -> Type -> NLM () #

Match NLPat Level # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

match :: Relevance -> Telescope -> Telescope -> NLPat -> Level -> NLM () #

Match NLPat Sort # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

match :: Relevance -> Telescope -> Telescope -> NLPat -> Sort -> NLM () #

Match NLPat Term # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

match :: Relevance -> Telescope -> Telescope -> NLPat -> Term -> NLM () #

Match a b => Match [a] [b] # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

match :: Relevance -> Telescope -> Telescope -> [a] -> [b] -> NLM () #

Match a b => Match (Dom a) (Dom b) # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

match :: Relevance -> Telescope -> Telescope -> Dom a -> Dom b -> NLM () #

Match a b => Match (Arg a) (Arg b) # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

match :: Relevance -> Telescope -> Telescope -> Arg a -> Arg b -> NLM () #

(Match a b, Subst t1 a, Subst t2 b) => Match (Abs a) (Abs b) # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

match :: Relevance -> Telescope -> Telescope -> Abs a -> Abs b -> NLM () #

Match a b => Match (Elim' a) (Elim' b) # 
Instance details

Defined in Agda.TypeChecking.Rewriting.NonLinMatch

Methods

match :: Relevance -> Telescope -> Telescope -> Elim' a -> Elim' b -> NLM () #

reallyFree :: (Reduce a, Normalise a, Free a) => (Int -> Bool) -> a -> ReduceM (Either Blocked_ (Maybe a)) #

equal :: Term -> Term -> ReduceM (Maybe Blocked_) #

Untyped βη-equality, does not handle things like empty record types. Returns Nothing if the terms are equal, or `Just b` if the terms are not (where b contains information about possible metas blocking the comparison)

normaliseB' :: (Reduce t, Normalise t) => t -> ReduceM (Blocked t) #

Normalise the given term but also preserve blocking tags TODO: implement a more efficient version of this.