Vertex #
Describes universe polymorphism (or lack thereof) for vertices.
- polymorphic : UniverseLevels
- concrete (levels : Array Lean.Level) : UniverseLevels
Instances For
Equations
- GeneralizationLinter.instBEqUniverseLevels.beq GeneralizationLinter.UniverseLevels.polymorphic GeneralizationLinter.UniverseLevels.polymorphic = true
- GeneralizationLinter.instBEqUniverseLevels.beq (GeneralizationLinter.UniverseLevels.concrete a) (GeneralizationLinter.UniverseLevels.concrete b) = (a == b)
- GeneralizationLinter.instBEqUniverseLevels.beq x✝¹ x✝ = false
Instances For
Equations
Instances For
A vertex of the class graph.
- name : Lean.Name
Name of the typeclass.
Example:
Module R M→Module
Key arguments (see
keyArgs), with constants passed through and everything else canonicalized to bvars (though structured arguments keep their structure). For the bvars, the only information that is preserved is which, if any, of the arguments were equal to one another.
Examples
Class application patternNotes Module R M#[bvar 0, bvar 1]fvars become bvars SomeClass α β γ β#[bvar 0, bvar 1, bvar 2, bvar 1]repeated fvars reuse bvar index Pow α ℕ#[bvar 0, ℕ]bare constant is preserved IsTrans α (·=·)#[bvar 0, bvar 1]opaque relation becomes bvar OfNat α 1#[bvar 0, 1]nat literal is preserved Monoid (List α)#[List (bvar 0)]structure inside carrier is preserved Monoid (List (List (α × β)))#[List (List ((bvar 0) × (bvar 1)))]structure inside carrier is preserved Module (α × β) M#[(bvar 0) × (bvar 1), bvar 2]structure inside carrier is preserved - levels : UniverseLevels
If the typeclass is universe polymorphic, this is indicated through a single value
.polymorphic. If the typeclass's universe levels are concrete, they are all specified through.concrete #[u₁ … uₙ], where e.g.u₁might be 0 (i.e., not a variable). The fact that we treat all universe polymorphism the same can lead to problems.For example, consider the following instance:
instance CategoryTheory.locallySmall_self.{v, u} (C : Type.{u}) [inst : CategoryTheory.Category.{v, u} C] : CategoryTheory.LocallySmall.{v, v, u} C instWhen scanning this instance,
extractEdge?will mint the following edge:{ src := { name := ``CategoryTheory.Category, pattern := #[#0], levels := .polymorphic }, tgt := { name := ``CategoryTheory.LocallySmall, pattern := #[#0], levels := .polymorphic } }The fact that the real target was
LocallySmall.{v, v, u}and notLocallySmall.{w, v, u}is lost. This could lead to unsound candidates that the verifier must catch. However, most of the time, the target levels are pinned indirectly byVertex.pattern. For example:instance ContinuousAdd.to_continuousVAdd.{u} {M : Type.{u}} [inst₁ : TopologicalSpace.{u} M] [inst₂ : Add.{u} M] [inst₃ : ContinuousAdd.{u} M inst₁ inst₂] : ContinuousVAdd.{u, u} M M (instVAddOfAdd.{u} M inst₂) inst₁ inst₁When scanning this instance,
extractEdge?will mint the following edge:{ src := { name := ``ContinuousAdd, pattern := #[#0], levels := .polymorphic }, tgt := { name := ``ContinuousVAdd, pattern := #[#0, #0], levels := .polymorphic } }Here, even though the information about the universe levels appears lost, it is actually pinned by
pattern := #[#0, #0], because the two arguments that the pattern refers to are tied to the two universe levels:class ContinuousVAdd.{u, v} (M : Type.{u}) (X : Type.{v}) -- Note: M = X ⟹ u = v [inst₁ : VAdd.{u, v} M X] [inst₂ : TopologicalSpace.{u} M] [inst₃ : TopologicalSpace.{v} X] : PropFuture work could include making the handling of universe levels more precise, though we hypothesize the gains from this may be modest.
Instances For
Equations
Instances For
Equations
Equations
A specific class application parsed at runtime into a (canonicalized) vertex together with the original values of the canonicalized arguments.
The concrete terms abstracted by
pattern's bvars:subst[k]is the term thatbvar kstands for.
Examples
Class application patternsubstModule R M#[bvar 0, bvar 1]#[R, M]SomeClass α β γ β#[bvar 0, bvar 1, bvar 2, bvar 1]#[α, β, γ]Pow α ℕ#[bvar 0, ℕ]#[α]IsTrans α (·=·)#[bvar 0, bvar 1]#[α, (·=·)]OfNat α 1#[bvar 0, 1]#[α]Monoid (List α)#[List (bvar 0)]#[α]Monoid (List (List (α × β)))#[List (List ((bvar 0) × (bvar 1)))]#[α, β]Module (α × β) M#[(bvar 0) × (bvar 1), bvar 2]#[α, β, M]- familyArity : Nat
Length of the decomposed Π-prefix of a family application, 0 (default) for an ordinary application. The prefix itself isn't stored, but rederived from the original binder type later on.
Examples
[Group G] -- familyArity := 0 [∀ i, C (f i)] -- familyArity := 1 [∀ i [D i], C (f i)] -- familyArity := 2
Instances For
Equations
Returns true iff pattern subsumes target.
Examples
subsumes #[.bvar 0] #[4] -- true
subsumes #[.bvar 0] #[4, 2] -- false: size mismatch
subsumes #[.bvar 0, .bvar 1] #[4] -- false: size mismatch
subsumes #[.bvar 0, .bvar 1] #[4, 2] -- true
subsumes #[.bvar 0, .bvar 1] #[4, 4] -- true
subsumes #[.bvar 0, .bvar 0] #[4, 2] -- false: 2nd occurrence of `.bvar 0` doesn't match 1st
subsumes #[.bvar 0, .bvar 0] #[4, 4] -- true
subsumes #[.bvar 0] #[List Nat] -- true
subsumes #[List (.bvar 0)] #[List Nat] -- true
Equations
- One or more equations did not get rendered due to their size.
Instances For
If the number of subsumers of v.pattern isn't estimated to exceed maxCombined (default 2048),
then all proper subsumers of v.pattern (i.e., subsumers of v.pattern that are not equal to
v.pattern) are returned as an array of vertices, where each output vertex w inherits all fields
from v except for v.pattern, which instead is set to the subsumer.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a vertex query, returns the array of vertices that match query. This is used to match
non-universe-polymorphic vertices with both the corresponding non-universe-polymorphic vertex and
the corresponding universe-polymorphic vertex.
If includeSubsumers is true (default false), then the query is extended to any subsuming
vertices.
Examples
Small.{0} αwill matchSmall.{0} αandSmall α(the latter we understand to be universe-polymorphic).Small.{123} αwill only matchSmall α, as there is no specificSmall.{123} αvertex in the class graph.
Equations
- One or more equations did not get rendered due to their size.