ModuleAgda-2.8.0.2Haskell2010
Agda.TypeChecking.Substitute
This module contains the definition of hereditary substitution and application operating on internal syntax which is in β-normal form (β including projection reductions).
Further, it contains auxiliary functions which rely on substitution but not on reduction.
- 5 types
- 1 class
- 56 values
- PackageAgda-2.8.0.2
- Exports64
- LanguageHaskell2010
- LicenceMIT
- SourceSubstitute.hs
Add given binding to the front of the telescope.
Apply Elims while using the given function to report ill-typed
redexes.
Recursive calls for applyE and applySubst happen at type t to
propagate the same strategy to subtrees.
Turn a typed binding (x1 .. xn : A) into a telescope.
If v is a record or constructed value, canProject f v
returns its field f.
In compiled clauses, the variables in the clause body are relative to the pattern variables (including dot patterns) instead of the clause telescope.
Eliminate a constructed term.
defApp f us vs applies Def f us to further arguments vs,
eliminating top projection redexes.
If us is not empty, we cannot have a projection redex, since
the record argument is the first one.
Compute the sort of a function type from the sorts of its domain and codomain.
This function should only be called on reduced sorts,
since the LevelUniv rules should only apply when the sort does not reduce to Set.
Given two levels a and b, compute a ⊔ b and return its
canonical form.
mkPi dom t = telePi (telFromList [dom]) tTurn a typed binding (x1 .. xn : A) into a telescope.
(x:A)->B(x) piApply [u] = B(u)Precondition: The type must contain the right number of pis without having to perform any reduction.
piApply is potentially unsafe, the monadic piApplyM is preferable.
Compute the sort of a pi type from the sorts of its domain
and codomain.
This function should only be called on reduced sorts, since the LevelUniv rules should only apply when the sort doesn't reduce to Set
projDropParsApply proj o args = projDropPars proj o `apply' argsThis function is an optimization, saving us from construction lambdas we immediately remove through application.
The permutation should permute the corresponding context. (right-to-left list)
If permute π : [a]Γ -> [a]Δ, then applySubst (renaming _ π) : Term Γ -> Term Δ
If permute π : [a]Γ -> [a]Δ, then applySubst (renamingR π) : Term Δ -> Term Γ
Returns Left blocker for unknown (blocked) sorts, and otherwise
returns Right s where s indicates the size and fibrancy.
Takes off all exposed function domains from the given type.
This means that it does not reduce to expose Pi-types.
telView'UpTo n t takes off the first n exposed function types of t.
Takes off all (exposed ones) if n < 0.
Uses free variable analysis to introduce NoAbs bindings.
Only abstract the visible components of the telescope, and all that bind variables. Everything will be an Abs! Caution: quadratic time!
Everything will be an Abs.
Given arguments vs : tel (vector typing), extract their individual types.
Returns Nothing is tel is not long enough.
univSort' univInf s gets the next higher sort of s, if it is
known (i.e. it is not just UnivSort s).
Precondition: s is reduced
A sort can either be small (Set l, Prop l, Size, ...) or large (Setω n).
Constructors
Instances4Functor, Eq, Ord, Show
Functor TelVDefined in Agda-2.8.0.2 · Agda.TypeChecking.Substitute(TermSubst a, Eq a) => Eq (TelV a)Defined in Agda-2.8.0.2 · Agda.TypeChecking.Substitute(TermSubst a, Ord a) => Ord (TelV a)Defined in Agda-2.8.0.2 · Agda.TypeChecking.SubstituteShow a => Show (TelV a)Defined in Agda-2.8.0.2 · Agda.TypeChecking.Substitute
Substitutions.
Constructors
IdSIdentity substitution.
Γ ⊢ IdS : ΓEmptyS ImpossibleEmpty substitution, lifts from the empty context. First argument is
IMPOSSIBLE. Apply this to closed terms you want to use in a non-empty context.Γ ⊢ EmptyS : ()a :# Substitution' ainfixr 4Substitution extension, `
cons'.Γ ⊢ u : Aρ Γ ⊢ ρ : Δ ---------------------- Γ ⊢ u :# ρ : Δ, AStrengthen Impossible !Int (Substitution' a)Strengthening substitution. First argument is
IMPOSSIBLE. In'Strengthen err n ρthe numbernmust be non-negative. This substitution should only be applied to valuestfor which none of the variables0up ton - 1are free int[ρ], and in that casenis subtracted from all free de Bruijn indices int[ρ]. Γ ⊢ ρ : Δ |Θ| = n --------------------------- Γ ⊢ Strengthen n ρ : Δ, Θ @Wk !Int (Substitution' a)Weakening substitution, lifts to an extended context.
Γ ⊢ ρ : Δ ------------------- Γ, Ψ ⊢ Wk |Ψ| ρ : ΔLift !Int (Substitution' a)Lifting substitution. Use this to go under a binder.
Lift 1 ρ == var 0 :# Wk 1 ρ.Γ ⊢ ρ : Δ ------------------------- Γ, Ψρ ⊢ Lift |Ψ| ρ : Δ, Ψ
Instances19Eq, Functor, Ord, Foldable, Traversable, KillRange, …
Eq SubstitutionDefined in Agda-2.8.0.2 · Agda.TypeChecking.Substitute · orphanFunctor Substitution'Defined in Agda-2.8.0.2 · Agda.Syntax.InternalOrd SubstitutionDefined in Agda-2.8.0.2 · Agda.TypeChecking.Substitute · orphanFoldable Substitution'Defined in Agda-2.8.0.2 · Agda.Syntax.InternalTraversable Substitution'Defined in Agda-2.8.0.2 · Agda.Syntax.InternalKillRange SubstitutionDefined in Agda-2.8.0.2 · Agda.Syntax.InternalInstantiateFull SubstitutionDefined in Agda-2.8.0.2 · Agda.TypeChecking.ReduceShow a => Show (Substitution' a)Defined in Agda-2.8.0.2 · Agda.Syntax.InternalGeneric (Substitution' a)Defined in Agda-2.8.0.2 · Agda.Syntax.InternalNFData a => NFData (Substitution' a)Defined in Agda-2.8.0.2 · Agda.Syntax.InternalPretty a => Pretty (Substitution' a)Defined in Agda-2.8.0.2 · Agda.Syntax.InternalNull (Substitution' a)Defined in Agda-2.8.0.2 · Agda.Syntax.InternalEndoSubst a => Subst (Substitution' a)Defined in Agda-2.8.0.2 · Agda.TypeChecking.Substitute · orphan(Pretty a, PrettyTCM a, EndoSubst a) => PrettyTCM (Substitution' a)Defined in Agda-2.8.0.2 · Agda.TypeChecking.PrettyTermSize a => TermSize (Substitution' a)Defined in Agda-2.8.0.2 · Agda.Syntax.InternalNamesIn a => NamesIn (Substitution' a)Defined in Agda-2.8.0.2 · Agda.Syntax.Internal.NamesEmbPrj a => EmbPrj (Substitution' a)Defined in Agda-2.8.0.2 · Agda.TypeChecking.Serialise.Instances.Internal · orphantype Rep (Substitution' a) = D1 ('MetaDataDefined in Agda-2.8.0.2 · Agda.Syntax.Internal"Substitution'"
"Agda.Syntax.Internal"
"Agda-2.8.0.2-IWATId8XtJVEb9GRZaI6YB"
'False) ((C1 ('MetaCons"IdS"
'PrefixI 'False) U1 :+: (C1 ('MetaCons"EmptyS"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Impossible)) :+: C1 ('MetaCons":#"
('InfixI 'RightAssociative4
) 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Substitution' a))))) :+: (C1 ('MetaCons"Strengthen"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Impossible) :*: (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Substitution' a)))) :+: (C1 ('MetaCons"Wk"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Substitution' a))) :+: C1 ('MetaCons"Lift"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Substitution' a))))))type SubstArg (Substitution' a) = aDefined in Agda-2.8.0.2 · Agda.TypeChecking.Substitute · orphan
Orphan instances
130 instancesEq LevelEq NotBlockedEq PlusLevelEq SortEq SubstitutionEq TermSyntactic Term equality, ignores stuff below
DontCareand sharing.Eq CandidateEq CandidateKindEq SectionOrd LevelOrd PlusLevelOrd SortOrd SubstitutionOrd TermOrd CandidateOrd CandidateKindDeBruijn BraveTermDeBruijn NLPatSubst ProblemEqSubst NameSubst BraveTermSubst ConPatternInfoSubst DeBruijnPatternSubst EqualityTypeDataSubst EqualityViewSubst PatternSubst TermSubst RangeSubst CandidateSubst CompareAsSubst ConstraintSubst DisplayFormSubst DisplayTermSubst LetBindingSubst NLPSortSubst NLPTypeSubst NLPatSubst RewriteRuleSubst ContextEntrySubst ()Apply BraveTermApply ClauseApply SortApply TermApply CompiledClausesApply DefinitionApply DefnApply DisplayTermApply ExtLamInfoApply FunctionInverseApply NumGeneralizableArgsApply PrimFunApply ProjLamsApply ProjectionApply RewriteRuleApply SystemApply PermutationAbstract ClauseAbstract SortAbstract TelescopeAbstract TermAbstract TypeAbstract CompiledClausesAbstract DefinitionAbstract DefnAbstract FunctionInverseAbstract NumGeneralizableArgsAbstract PrimFunAbstract ProjLamsAbstract ProjectionAbstract RewriteRuletel ⊢ (Γ ⊢ lhs ↦ rhs : t)becomestel, Γ ⊢ lhs ↦ rhs : t)we do not need to change lhs, rhs, and t since they live in Γ. See 'Abstract Clause'.Abstract SystemAbstract PermutationEq a => Eq (Pattern' a)Eq a => Eq (Type' a)Syntactic Type equality, ignores sort annotations.
Eq t => Eq (Blocked t)(Subst a, Eq a) => Eq (Abs a)Equality of binders relies on weakening which is a special case of renaming which is a special case of substitution.
(Subst a, Eq a) => Eq (Tele a)(Subst a, Eq a) => Eq (Elim' a)Ord a => Ord (Dom a)Ord a => Ord (Type' a)(Subst a, Ord a) => Ord (Abs a)(Subst a, Ord a) => Ord (Tele a)(Subst a, Ord a) => Ord (Elim' a)DeBruijn a => DeBruijn (Pattern' a)EndoSubst a => Subst (Substitution' a)Subst a => Subst (Arg a)Subst a => Subst (Ranged a)Subst a => Subst (WithHiding a)Subst a => Subst (Abs a)Subst a => Subst (Blocked a)Subst a => Subst (Level' a)Subst a => Subst (PlusLevel' a)Subst a => Subst (Tele a)Subst a => Subst (Elim' a)Subst a => Subst (List1 a)Subst a => Subst (Maybe a)Subst a => Subst [a](Coercible a Term, Subst a) => Subst (Sort' a)Apply [NamedArg (Pattern' a)]Make sure we only drop variable patterns.
Apply [Polarity]Apply [Occurrence]Apply a => Apply (Case a)Apply a => Apply (WithArity a)Apply t => Apply (Blocked t)Apply t => Apply (Maybe t)Apply t => Apply (Maybe t)Apply t => Apply [t]TermSubst a => Apply (Tele a)DoDrop a => Apply (Drop a)Abstract [Polarity]Abstract [Occurrence]Abstract a => Abstract (Case a)Abstract a => Abstract (WithArity a)Abstract t => Abstract (Maybe t)Abstract t => Abstract [t]DoDrop a => Abstract (Drop a)Subst a => Subst (Named name a)(Subst a, Subst b, SubstArg a ~ SubstArg b) => Subst (Dom' a b)(Subst a, Subst b, SubstArg a ~ SubstArg b) => Subst (a, b)(Ord k, Subst a) => Subst (Map k a)(Coercible a Term, Subst a, Subst b, SubstArg a ~ SubstArg b) => Subst (Type'' a b)Apply v => Apply (Map k v)Apply v => Apply (HashMap k v)(Apply a, Apply b) => Apply (a, b)Abstract v => Abstract (Map k v)Abstract v => Abstract (HashMap k v)(Subst a, Subst b, Subst c, SubstArg a ~ SubstArg b, SubstArg b ~ SubstArg c) => Subst (a, b, c)(Apply a, Apply b, Apply c) => Apply (a, b, c)(Subst a, Subst b, Subst c, Subst d, SubstArg a ~ SubstArg b, SubstArg b ~ SubstArg c, SubstArg c ~ SubstArg d) => Subst (a, b, c, d)