A hypothesis that has not yet been matched against a premise, or a rule pattern substitution.
- fvarId
(fvarId : Lean.FVarId)
: RawHyp
The hypothesis.
- patSubst
(subst : Substitution)
: RawHyp
The rule pattern substitution.
Instances For
Equations
Instances For
Equations
- Aesop.instBEqRawHyp.beq (Aesop.RawHyp.fvarId a) (Aesop.RawHyp.fvarId b) = (a == b)
- Aesop.instBEqRawHyp.beq (Aesop.RawHyp.patSubst a) (Aesop.RawHyp.patSubst b) = (a == b)
- Aesop.instBEqRawHyp.beq x✝¹ x✝ = false
Instances For
Equations
Equations
Instances For
Equations
A hypothesis that was matched against a premise, or a rule pattern substitution.
- fvarId? : Option Lean.FVarId
The hypothesis, or
noneif this is a rule pattern substitution. - subst : Substitution
The substitution that results from matching the hypothesis against a premise or that was derived from the pattern.
Instances For
Instances For
Equations
- Aesop.instInhabitedHyp = { default := Aesop.instInhabitedHyp.default }
Equations
- One or more equations did not get rendered due to their size.
Returns true if h is the hyp fvarId or is a pattern substitution
containing fvarId.
Equations
- Aesop.Hyp.containsHyp fvarId h = (h.fvarId? == some fvarId || Aesop.Substitution.containsHyp fvarId h.subst)
Instances For
Does this Hyp represent a pattern substitution?
Equations
- h.isPatSubst = h.fvarId?.isSome
Instances For
Partial matches associated with a particular slot instantiation. An entry
s ↦ e ↦ (ms, hs) indicates that for the instantiation e of slot s, we have
partial matches ms and hypotheses hs.
Instances For
Equations
Equations
- Aesop.instInhabitedInstMap.default = { map := default }
Instances For
Equations
- Aesop.InstMap.instEmptyCollection = { emptyCollection := { map := Lean.PersistentHashMap.empty } }
Equations
- One or more equations did not get rendered due to their size.
Returns the set of matches and hypotheses associated with a slot slot
with instantiation inst.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns the set of matches and hypotheses associated with a slot slot
with instantiation inst, or (∅, ∅) if slot and inst do not have any
associated matches.
Instances For
Applies a transfomation to the data associated to slot and inst.
If there is no such data, the transformation is applied to (∅, ∅). Returns the
new instantiation map and the result of f.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Inserts a hyp associated with slot slot and instantiation inst.
The hyp must be a valid assignment for the slot's premise. Returns true if
the hyp was not previously associated with slot and inst.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Inserts a match associated with slot slot and instantiation inst.
The match's level must be slot. Returns true if the match was not previously
associated with slot and inst.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Inserts a match. The match m is associated with the slot given by its
level (i.e., the maximal slot for which m contains a hypothesis) and the
instantiation of var given by the map's substitution. Returns true if the
match was not previously associated with this slot and instantiation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Modify the maps for slot slot and all later slots.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Map from variables to the matches and hypotheses of slots whose types contain the variables.
- map : Lean.PHashMap PremiseIndex InstMap
Instances For
Equations
Equations
Instances For
Equations
- Aesop.VariableMap.instEmptyCollection = { emptyCollection := { map := Lean.PersistentHashMap.empty } }
Equations
- Aesop.VariableMap.instToMessageData = { toMessageData := fun (m : Aesop.VariableMap) => Aesop.ppPHashMap✝ true m.map }
Get the InstMap associated with a variable.
Equations
- vmap.find? var = Lean.PersistentHashMap.find? vmap.map var
Instances For
Modify the InstMap associated to variable var. If no such InstMap
exists, the function f is applied to the empty InstMap and the result is
associated with var. Returns the new variable map and the result of f.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add a hypothesis hyp. Precondition: hyp matches the premise of slot
slot with substitution hyp.subst (and hence hyp.subst contains a mapping
for each variable in slot.common). Returns true if the variable map
changed.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add a match m. Precondition: nextSlot is the slot with index
m.level + 1. Returns true if the variable map changed.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Remove a hyp from slot and all later slots.
Equations
- vmap.eraseHyp hyp slot = { map := Lean.PersistentHashMap.map vmap.map fun (x : Aesop.InstMap) => x.eraseHyp hyp slot }
Instances For
Remove the pattern substitution subst from slot and all later slots.
Equations
- vmap.erasePatSubst subst slot = { map := Lean.PersistentHashMap.map vmap.map fun (x : Aesop.InstMap) => x.erasePatSubst subst slot }
Instances For
Find matches in slot slot - 1 whose substitutions are compatible with
subst. Preconditions: slot.index is nonzero, slot.common is nonempty and
each variable contained in slot.common is also contained in subst.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Find hyps in slot whose substitutions are compatible with subst.
Precondition: slot.common is nonempty and each variable contained in it is
also contained in subst.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Structure representing the state of a slot cluster.
The cluster's slots.
- conclusionDeps : Array PremiseIndex
The premises that appear in the rule's conclusion. These are the same for all cluster states of a rule, but are stored here for convenience.
- variableMap : VariableMap
The variable map for this cluster.
- completeMatches : Lean.PHashSet Match
Complete matches for this cluster.
- addHypsLazily : Bool
When this flag is
true, hyps are added to theslotQueuesrather than thevariableMap. This is an optimisation that avoids performing unifications until a rule can potentially generate a complete match. More precisely:addHypsLazilyis initially set totrue.- While
addHypsLazilyistrue, hyps are added to (and deleted from) theslotQueuesand are not added to thevariableMap. Once an addition causes all slot queues to have at least one element,addHypsLazilyis permanently set tofalseand hyps for slot 0 are added to thevariableMap. - While
addHypsLazilyisfalse:- Hyps for slot
iare added directly to the variable maps ifi = 0or the sloti - 1has matches. Otherwise they are added to the slot queue fori. (More precisely, we only track whether sloti - 1has had matches at some point. This allows us to ignore deletions.) - The insertion of a match into slot
icauses all hyps at sloti + 1to be moved from the slot queue into thevariableMap.
- Hyps for slot
Hypotheses or pattern substitutions that have been added to the cluster state, but have not yet been added to the
variableMap.There is exactly one queue for each slot.
The
ith element of this array istrueif a match was at some point added to sloti.There is exactly one boolean for each slot.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Get the slot with the given premise index.
Equations
- cs.findSlot? i = Array.find? (fun (x : Aesop.Slot) => x.premiseIndex == i) cs.slots
Instances For
Match hypothesis hyp against the slot with index slot in cs (which
must be a valid index).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Context for the AddM monad.
- premiseMVars : Array Lean.MVarId
Metavariables for the premises of the rule for which a hyp or match is being added. When adding hyps, they are unified with these metavariables.
- premiseLMVars : Array Lean.LMVarId
Metavariables for level parameters appearing in the rule's premises.
Instances For
A monad for operations that add hyps or matches to a cluster state. The monad's state is an array of complete matches discovered while adding hyps/matches.
Equations
Instances For
Run an AddM action.
Equations
- Aesop.ClusterState.AddM.run premiseMVars premiseLMVars x = (ReaderT.run x { premiseMVars := premiseMVars, premiseLMVars := premiseLMVars }).run #[]
Instances For
Add a match to the cluster state. Returns the new cluster state and any new complete matches for this cluster.
Add a hypothesis to the cluster state. hyp.subst must be the substitution
that results from applying h to slot.
Add a hypothesis or pattern substitution to the cluster state.
Insert the raw hyps from slot's queue into the variable map.
Add a hypothesis or pattern substitution to the queue for its slot. If
afterwards each slot queue contains at least one element, then the returned
cluster state cs has cs.addHypsLazily = false.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add a hypothesis or pattern substitution to the cluster state. If a
hypothesis is given and its type does not match the premise corresponding to
slot, it is not added.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Erase a RawHyp from the slot queue of the given slot.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Erase a hypothesis from the cluster state's variable map.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Erase a pattern substitution from the cluster state.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The source of a pattern substitution. The same substitution can have multiple sources.
- hyp
(fvarId : Lean.FVarId)
: PatSubstSource
The pattern substitution came from the given hypothesis.
- target : PatSubstSource
The pattern substitution came from the goal's target.
Instances For
Equations
Equations
Equations
Instances For
Equations
Forward state for one rule.
- rule : ForwardRule
The rule to which this state belongs.
- clusterStates : Array ClusterState
States for each of the rule's slot clusters.
- patSubstSources : Lean.PHashMap Substitution (Lean.PHashSet PatSubstSource)
The sources of all pattern substitutions present in the
clusterStates. Invariant: each pattern substitution in the cluster states is associated with a nonempty set.
Instances For
Equations
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
The initial (empty) rule state for a given forward rule.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add a hypothesis or pattern substitution to the rule state. Returns the new
rule state and any newly completed matches. If a hypothesis is given and it does
not match premise pi, nothing happens.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Erase a pattern substitution that was obtained from the given source.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Erase a hypothesis from the rule state.
Equations
- One or more equations did not get rendered due to their size.
Instances For
State representing the non-complete matches of a given set of forward rules in a given local context.
- ruleStates : Lean.PHashMap RuleName RuleState
Map from each rule's name to its
RuleState - hyps : Lean.PHashMap Lean.FVarId (Lean.PArray (RuleName × PremiseIndex))
A map from hypotheses to the rules and premises that they matched against when they were initially added to the rule state. Invariant: the rule states in which a hypothesis
happear are exactly those identified by the rule names inhyps[h]. Furthermore,honly appears in slots with premise indices greater than or equal to those inhyps[h]. - patSubsts : Lean.PHashMap PatSubstSource (Lean.PArray (RuleName × Substitution))
The pattern substitutions present in the rule states. Invariant:
patSubstsmaps the sourcesto a rule namerand pattern substitutioniiff the rule state ofrcontainsiwith sources. - hypTypes : Lean.PHashSet RPINF
Normalised types of all non-implementation detail hypotheses in the local context.
Instances For
Equations
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Add a hypothesis to the forward state. If fs represents a local context
lctx, then fs.addHyp h ms represents lctx with h added. ms must
overapproximate the rules for which h may unify with a maximal premise.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add a hypothesis to the forward state. If fs represents a local context
lctx, then fs.addHyp h ms represents lctx with h added. ms must
overapproximate the rules for which h may unify with a maximal premise.
Equations
- Aesop.ForwardState.addHyp goal h ms fs = Aesop.ForwardState.addHypCore #[] goal h ms fs
Instances For
Add a pattern substitution to the forward state.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add a pattern substitution to the forward state.
Equations
- Aesop.ForwardState.addPatSubst goal r patSubst fs = Aesop.ForwardState.addPatSubstCore #[] goal r patSubst fs
Instances For
Add multiple pattern substitutions to the forward state.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add multiple pattern substitutions to the forward state.
Equations
- Aesop.ForwardState.addPatSubsts goal patSubsts fs = Aesop.ForwardState.addPatSubstsCore #[] goal patSubsts fs
Instances For
Add a hypothesis and to the forward state, along with any rule pattern substitutions obtained from it.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add a hypothesis and to the forward state, along with any rule pattern substitutions obtained from it.
Equations
- Aesop.ForwardState.addHypWithPatSubsts goal h ms patSubsts fs = Aesop.ForwardState.addHypWithPatSubstsCore #[] goal h ms patSubsts fs
Instances For
Erase pattern substitutions with the given source.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Remove a hypothesis from the forward state. If fs represents a local
context lctx, then fs.eraseHyp h ms represents lctx with h removed.
type must be the normalised type of h. ms must contain all rules for which
h may unify with a maximal premise.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Erase all pattern substitutions whose source is the target.
Instances For
Update the pattern substitutions after the goal's target changed.
goal is the new goal. newPatSubsts are the new target's pattern
substitutions.
Equations
- Aesop.ForwardState.updateTargetPatSubstsCore ruleMatches goal newPatSubsts fs = Aesop.ForwardState.addPatSubstsCore ruleMatches goal newPatSubsts fs.eraseTargetPatSubsts
Instances For
Update the pattern substitutions after the goal's target changed.
goal is the new goal. newPatSubsts are the new target's pattern
substitutions.
Equations
- Aesop.ForwardState.updateTargetPatSubsts goal newPatSubsts fs = Aesop.ForwardState.updateTargetPatSubstsCore #[] goal newPatSubsts fs