File: .lake/packages/aesop/Aesop/RulePattern.lean

full_name: Aesop.RulePattern.pattern
code: /--
A rule pattern. For a rule of type `∀ (x₀ : T₀) ... (xₙ : Tₙ), U`, a valid rule
pattern is an expression `p` such that `x₀ : T₁, ..., xₙ : Tₙ ⊢ p : P`. Let
`y₀, ..., yₖ` be those variables `xᵢ` on which `p` depends. When `p` matches an
expression `e`, this means that `e` is defeq to `p` (where each `yᵢ` is replaced
with a metavariable) and we obtain a substitution

    {y₀ ↦ t₀ : T₀, y₁ ↦ t₁ : T₁[x₀ := t₀], ...}

Now suppose we want to match the above rule type against a type `V` (where `V`
is the target for an `apply`-like rule and a hypothesis type for a
`forward`-like rule). To that end, we take `U` and replace each `xᵢ` where
`xᵢ = yⱼ` with `tⱼ` and each `xᵢ` with `xᵢ ≠ yⱼ ∀ j` with a metavariable. The
resulting expression `U'` is then matched against `V`.
-/
structure RulePattern where
  /--
  An expression of the form `λ y₀ ... yₖ, p` representing the
  pattern.
  -/
  pattern : AbstractMVarsResult
  /--
  A partial map from the index set `{0, ..., n-1}` into `{0, ..., k-1}`. If
  `argMap[i] = j`, this indicates that when matching against the rule type, the
  instantiation `tⱼ` of `yⱼ` should be substituted for `xᵢ`.
  -/
  argMap : Array (Option Nat)
  deriving Inhabited
goal: Lean.Meta.AbstractMVarsResult

full_name: Aesop.RulePattern.argMap
code: /--
A rule pattern. For a rule of type `∀ (x₀ : T₀) ... (xₙ : Tₙ), U`, a valid rule
pattern is an expression `p` such that `x₀ : T₁, ..., xₙ : Tₙ ⊢ p : P`. Let
`y₀, ..., yₖ` be those variables `xᵢ` on which `p` depends. When `p` matches an
expression `e`, this means that `e` is defeq to `p` (where each `yᵢ` is replaced
with a metavariable) and we obtain a substitution

    {y₀ ↦ t₀ : T₀, y₁ ↦ t₁ : T₁[x₀ := t₀], ...}

Now suppose we want to match the above rule type against a type `V` (where `V`
is the target for an `apply`-like rule and a hypothesis type for a
`forward`-like rule). To that end, we take `U` and replace each `xᵢ` where
`xᵢ = yⱼ` with `tⱼ` and each `xᵢ` with `xᵢ ≠ yⱼ ∀ j` with a metavariable. The
resulting expression `U'` is then matched against `V`.
-/
structure RulePattern where
  /--
  An expression of the form `λ y₀ ... yₖ, p` representing the
  pattern.
  -/
  pattern : AbstractMVarsResult
  /--
  A partial map from the index set `{0, ..., n-1}` into `{0, ..., k-1}`. If
  `argMap[i] = j`, this indicates that when matching against the rule type, the
  instantiation `tⱼ` of `yⱼ` should be substituted for `xᵢ`.
  -/
  argMap : Array (Option Nat)
  deriving Inhabited
goal: Array (Option Nat)

full_name: Aesop.RulePattern
code: /--
A rule pattern. For a rule of type `∀ (x₀ : T₀) ... (xₙ : Tₙ), U`, a valid rule
pattern is an expression `p` such that `x₀ : T₁, ..., xₙ : Tₙ ⊢ p : P`. Let
`y₀, ..., yₖ` be those variables `xᵢ` on which `p` depends. When `p` matches an
expression `e`, this means that `e` is defeq to `p` (where each `yᵢ` is replaced
with a metavariable) and we obtain a substitution

    {y₀ ↦ t₀ : T₀, y₁ ↦ t₁ : T₁[x₀ := t₀], ...}

Now suppose we want to match the above rule type against a type `V` (where `V`
is the target for an `apply`-like rule and a hypothesis type for a
`forward`-like rule). To that end, we take `U` and replace each `xᵢ` where
`xᵢ = yⱼ` with `tⱼ` and each `xᵢ` with `xᵢ ≠ yⱼ ∀ j` with a metavariable. The
resulting expression `U'` is then matched against `V`.
-/
structure RulePattern where
  /--
  An expression of the form `λ y₀ ... yₖ, p` representing the
  pattern.
  -/
  pattern : AbstractMVarsResult
  /--
  A partial map from the index set `{0, ..., n-1}` into `{0, ..., k-1}`. If
  `argMap[i] = j`, this indicates that when matching against the rule type, the
  instantiation `tⱼ` of `yⱼ` should be substituted for `xᵢ`.
  -/
  argMap : Array (Option Nat)
  deriving Inhabited
goal: Type

full_name: Aesop.instInhabitedRulePattern
code: /--
A rule pattern. For a rule of type `∀ (x₀ : T₀) ... (xₙ : Tₙ), U`, a valid rule
pattern is an expression `p` such that `x₀ : T₁, ..., xₙ : Tₙ ⊢ p : P`. Let
`y₀, ..., yₖ` be those variables `xᵢ` on which `p` depends. When `p` matches an
expression `e`, this means that `e` is defeq to `p` (where each `yᵢ` is replaced
with a metavariable) and we obtain a substitution

    {y₀ ↦ t₀ : T₀, y₁ ↦ t₁ : T₁[x₀ := t₀], ...}

Now suppose we want to match the above rule type against a type `V` (where `V`
is the target for an `apply`-like rule and a hypothesis type for a
`forward`-like rule). To that end, we take `U` and replace each `xᵢ` where
`xᵢ = yⱼ` with `tⱼ` and each `xᵢ` with `xᵢ ≠ yⱼ ∀ j` with a metavariable. The
resulting expression `U'` is then matched against `V`.
-/
structure RulePattern where
  /--
  An expression of the form `λ y₀ ... yₖ, p` representing the
  pattern.
  -/
  pattern : AbstractMVarsResult
  /--
  A partial map from the index set `{0, ..., n-1}` into `{0, ..., k-1}`. If
  `argMap[i] = j`, this indicates that when matching against the rule type, the
  instantiation `tⱼ` of `yⱼ` should be substituted for `xᵢ`.
  -/
  argMap : Array (Option Nat)
  deriving Inhabited
goal: Inhabited Aesop.RulePattern

full_name: Aesop.RulePattern.open
code: def «open» (pat : RulePattern) : MetaM (Array MVarId × Expr) 
goal: Lean.MetaM (Array Lean.MVarId × Lean.Expr)

full_name: Aesop.RulePatternInstantiation
code: def RulePatternInstantiation 
goal: Type

full_name: Aesop.RulePatternInstantiation.toArray
code: def RulePatternInstantiation.toArray : RulePatternInstantiation → Array Expr 
goal: Aesop.RulePatternInstantiation → Array Lean.Expr

full_name: Aesop.instEmptyCollectionRulePatternInstantiation
code: instance : EmptyCollection RulePatternInstantiation 
goal: EmptyCollection Aesop.RulePatternInstantiation

full_name: Aesop.forEachExprInGoalCore
code: def forEachExprInGoalCore (mvarId : MVarId) (g : Expr → m Bool) :
    MonadCacheT Expr Unit m Unit 
goal: Lean.MonadCacheT Lean.Expr Unit m Unit

full_name: Aesop.forEachExprInGoal'
code: @[inline, always_inline]
def forEachExprInGoal' (mvarId : MVarId) (g : Expr → m Bool) : m Unit 
goal: m Unit

full_name: Aesop.forEachExprInGoal
code: @[inline, always_inline]
def forEachExprInGoal (mvarId : MVarId) (g : Expr → m Unit) : m Unit 
goal: m Unit

full_name: Aesop.matchRulePatternsCore
code: def matchRulePatternsCore (pats : Array (RuleName × RulePattern))
    (mvarId : MVarId) :
    StateRefT (HashMap RuleName (HashSet RulePatternInstantiation)) MetaM Unit 
goal: StateRefT' IO.RealWorld (Lean.HashMap Aesop.RuleName (Lean.HashSet Aesop.RulePatternInstantiation)) Lean.MetaM Unit

full_name: Aesop.matchRulePatterns
code: def matchRulePatterns (pats : Array (RuleName × RulePattern))
    (mvarId : MVarId) :
    MetaM (HashMap RuleName (HashSet RulePatternInstantiation)) 
goal: Lean.MetaM (Lean.HashMap Aesop.RuleName (Lean.HashSet Aesop.RulePatternInstantiation))

full_name: Aesop.RulePattern.getInstantiation
code: def getInstantiation [Monad m] [MonadError m] (pat : RulePattern)
    (inst : RulePatternInstantiation) (argIndex : Nat) : m (Option Expr) 
goal: m (Option Lean.Expr)

full_name: Aesop.RulePattern.openRuleType
code: def openRuleType (pat : RulePattern) (inst : RulePatternInstantiation)
    (type : Expr) :
    MetaM (Array Expr × Array BinderInfo × Expr × HashSet MVarId) 
goal: Lean.MetaM (Array Lean.Expr × Array Lean.BinderInfo × Lean.Expr × Lean.HashSet Lean.MVarId)

full_name: Aesop.RulePattern.specializeRule
code: def specializeRule (pat : RulePattern) (inst : RulePatternInstantiation)
    (rule : Expr) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Aesop.RulePattern.elab.fvarsToMVars
code: def «elab» (stx : Term) (ruleType : Expr) : TermElabM RulePattern 
goal: Lean.MetaM (Lean.Expr × Array Lean.MVarId)

full_name: Aesop.RulePattern.elab.setMVarUserNamesToUniqueNames
code: def «elab» (stx : Term) (ruleType : Expr) : TermElabM RulePattern 
goal: Lean.MetaM Unit

full_name: Aesop.RulePattern.elab
code: def «elab» (stx : Term) (ruleType : Expr) : TermElabM RulePattern 
goal: Lean.Elab.TermElabM Aesop.RulePattern

full_name: Aesop.RulePattern.elab.abstractMVars'
code: def «elab» (stx : Term) (ruleType : Expr) : TermElabM RulePattern 
goal: Lean.MetaM (Lean.Meta.AbstractMVarsResult × Lean.HashMap Lean.MVarId Nat)