File: .lake/packages/lean4/src/lean/Lean/Meta/Match/Basic.lean

full_name: Lean.Meta.Match.mkNamedPattern
code: def mkNamedPattern (x h p : Expr) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.Match.isNamedPattern
code: def isNamedPattern (e : Expr) : Bool 
goal: Bool

full_name: Lean.Meta.Match.isNamedPattern?
code: def isNamedPattern? (e : Expr) : Option Expr 
goal: Option Lean.Expr

full_name: Lean.Meta.Match.Pattern.inaccessible
code: inductive Pattern : Type where
  | inaccessible (e : Expr) : Pattern
  | var          (fvarId : FVarId) : Pattern
  | ctor         (ctorName : Name) (us : List Level) (params : List Expr) (fields : List Pattern) : Pattern
  | val          (e : Expr) : Pattern
  | arrayLit     (type : Expr) (xs : List Pattern) : Pattern
  | as           (varId : FVarId) (p : Pattern) (hId : FVarId) : Pattern
  deriving Inhabited
goal: Lean.Meta.Match.Pattern

full_name: Lean.Meta.Match.Pattern.var
code: inductive Pattern : Type where
  | inaccessible (e : Expr) : Pattern
  | var          (fvarId : FVarId) : Pattern
  | ctor         (ctorName : Name) (us : List Level) (params : List Expr) (fields : List Pattern) : Pattern
  | val          (e : Expr) : Pattern
  | arrayLit     (type : Expr) (xs : List Pattern) : Pattern
  | as           (varId : FVarId) (p : Pattern) (hId : FVarId) : Pattern
  deriving Inhabited
goal: Lean.Meta.Match.Pattern

full_name: Lean.Meta.Match.instInhabitedPattern
code: inductive Pattern : Type where
  | inaccessible (e : Expr) : Pattern
  | var          (fvarId : FVarId) : Pattern
  | ctor         (ctorName : Name) (us : List Level) (params : List Expr) (fields : List Pattern) : Pattern
  | val          (e : Expr) : Pattern
  | arrayLit     (type : Expr) (xs : List Pattern) : Pattern
  | as           (varId : FVarId) (p : Pattern) (hId : FVarId) : Pattern
  deriving Inhabited
goal: Inhabited Lean.Meta.Match.Pattern

full_name: Lean.Meta.Match.Pattern.val
code: inductive Pattern : Type where
  | inaccessible (e : Expr) : Pattern
  | var          (fvarId : FVarId) : Pattern
  | ctor         (ctorName : Name) (us : List Level) (params : List Expr) (fields : List Pattern) : Pattern
  | val          (e : Expr) : Pattern
  | arrayLit     (type : Expr) (xs : List Pattern) : Pattern
  | as           (varId : FVarId) (p : Pattern) (hId : FVarId) : Pattern
  deriving Inhabited
goal: Lean.Meta.Match.Pattern

full_name: Lean.Meta.Match.Pattern.arrayLit
code: inductive Pattern : Type where
  | inaccessible (e : Expr) : Pattern
  | var          (fvarId : FVarId) : Pattern
  | ctor         (ctorName : Name) (us : List Level) (params : List Expr) (fields : List Pattern) : Pattern
  | val          (e : Expr) : Pattern
  | arrayLit     (type : Expr) (xs : List Pattern) : Pattern
  | as           (varId : FVarId) (p : Pattern) (hId : FVarId) : Pattern
  deriving Inhabited
goal: Lean.Meta.Match.Pattern

full_name: Lean.Meta.Match.Pattern.ctor
code: inductive Pattern : Type where
  | inaccessible (e : Expr) : Pattern
  | var          (fvarId : FVarId) : Pattern
  | ctor         (ctorName : Name) (us : List Level) (params : List Expr) (fields : List Pattern) : Pattern
  | val          (e : Expr) : Pattern
  | arrayLit     (type : Expr) (xs : List Pattern) : Pattern
  | as           (varId : FVarId) (p : Pattern) (hId : FVarId) : Pattern
  deriving Inhabited
goal: Lean.Meta.Match.Pattern

full_name: Lean.Meta.Match.Pattern
code: inductive Pattern : Type where
  | inaccessible (e : Expr) : Pattern
  | var          (fvarId : FVarId) : Pattern
  | ctor         (ctorName : Name) (us : List Level) (params : List Expr) (fields : List Pattern) : Pattern
  | val          (e : Expr) : Pattern
  | arrayLit     (type : Expr) (xs : List Pattern) : Pattern
  | as           (varId : FVarId) (p : Pattern) (hId : FVarId) : Pattern
  deriving Inhabited
goal: Type

full_name: Lean.Meta.Match.Pattern.as
code: inductive Pattern : Type where
  | inaccessible (e : Expr) : Pattern
  | var          (fvarId : FVarId) : Pattern
  | ctor         (ctorName : Name) (us : List Level) (params : List Expr) (fields : List Pattern) : Pattern
  | val          (e : Expr) : Pattern
  | arrayLit     (type : Expr) (xs : List Pattern) : Pattern
  | as           (varId : FVarId) (p : Pattern) (hId : FVarId) : Pattern
  deriving Inhabited
goal: Lean.Meta.Match.Pattern

full_name: Lean.Meta.Match.Pattern.toMessageData
code: partial def toMessageData : Pattern → MessageData
  
goal: Lean.Meta.Match.Pattern → Lean.MessageData

full_name: Lean.Meta.Match.Pattern.toExpr.visit
code: partial def toExpr (p : Pattern) (annotate := false) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.Match.Pattern.toExpr
code: partial def toExpr (p : Pattern) (annotate := false) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.Match.Pattern.applyFVarSubst
code: /-- Apply the free variable substitution `s` to the given pattern -/
partial def applyFVarSubst (s : FVarSubst) : Pattern → Pattern
  
goal: Lean.Meta.Match.Pattern → Lean.Meta.Match.Pattern

full_name: Lean.Meta.Match.Pattern.replaceFVarId
code: def replaceFVarId (fvarId : FVarId) (v : Expr) (p : Pattern) : Pattern 
goal: Lean.Meta.Match.Pattern

full_name: Lean.Meta.Match.Pattern.hasExprMVar
code: partial def hasExprMVar : Pattern → Bool
  
goal: Lean.Meta.Match.Pattern → Bool

full_name: Lean.Meta.Match.Pattern.collectFVars
code: partial def collectFVars (p : Pattern) : StateRefT CollectFVars.State MetaM Unit 
goal: StateRefT' IO.RealWorld Lean.CollectFVars.State Lean.MetaM Unit

full_name: Lean.Meta.Match.instantiatePatternMVars
code: partial def instantiatePatternMVars : Pattern → MetaM Pattern
  
goal: Lean.Meta.Match.Pattern → Lean.MetaM Lean.Meta.Match.Pattern

full_name: Lean.Meta.Match.AltLHS.patterns
code: structure AltLHS where
  ref        : Syntax
  fvarDecls  : List LocalDecl -- Free variables used in the patterns.
  patterns   : List Pattern
goal: List Lean.Meta.Match.Pattern

full_name: Lean.Meta.Match.AltLHS.ref
code: structure AltLHS where
  ref        : Syntax
  fvarDecls  : List LocalDecl -- Free variables used in the patterns.
  patterns   : List Pattern
goal: Lean.Syntax

full_name: Lean.Meta.Match.AltLHS.fvarDecls
code: structure AltLHS where
  ref        : Syntax
  fvarDecls  : List LocalDecl -- Free variables used in the patterns.
  patterns   : List Pattern
goal: List Lean.LocalDecl

full_name: Lean.Meta.Match.AltLHS
code: structure AltLHS where
  ref        : Syntax
  fvarDecls  : List LocalDecl -- Free variables used in the patterns.
  patterns   : List Pattern
goal: Type

full_name: Lean.Meta.Match.AltLHS.collectFVars
code: def AltLHS.collectFVars (altLHS: AltLHS) : StateRefT CollectFVars.State MetaM Unit 
goal: StateRefT' IO.RealWorld Lean.CollectFVars.State Lean.MetaM Unit

full_name: Lean.Meta.Match.instantiateAltLHSMVars
code: def instantiateAltLHSMVars (altLHS : AltLHS) : MetaM AltLHS 
goal: Lean.MetaM Lean.Meta.Match.AltLHS

full_name: Lean.Meta.Match.Alt.cnstrs
code: /-- `Match` alternative -/
structure Alt where
  /-- `Syntax` object for providing position information -/
  ref       : Syntax
  /--
  Original alternative index. Alternatives can be split, this index is the original
  position of the alternative that generated this one.
  -/
  idx       : Nat
  /--
  Right-hand-side of the alternative.
  -/
  rhs       : Expr
  /--
  Alternative pattern variables.
  -/
  fvarDecls : List LocalDecl
  /--
  Alternative patterns.
  -/
  patterns  : List Pattern
  /--
  Pending constraints `lhs ≋ rhs` that need to be solved before the alternative
  is considered acceptable. We generate them when processing inaccessible patterns.
  Note that `lhs` and `rhs` often have different types.
  After we perform additional case analysis, their types become definitionally equal.
  -/
  cnstrs    : List (Expr × Expr)
  deriving Inhabited
goal: List (Lean.Expr × Lean.Expr)

full_name: Lean.Meta.Match.instInhabitedAlt
code: /-- `Match` alternative -/
structure Alt where
  /-- `Syntax` object for providing position information -/
  ref       : Syntax
  /--
  Original alternative index. Alternatives can be split, this index is the original
  position of the alternative that generated this one.
  -/
  idx       : Nat
  /--
  Right-hand-side of the alternative.
  -/
  rhs       : Expr
  /--
  Alternative pattern variables.
  -/
  fvarDecls : List LocalDecl
  /--
  Alternative patterns.
  -/
  patterns  : List Pattern
  /--
  Pending constraints `lhs ≋ rhs` that need to be solved before the alternative
  is considered acceptable. We generate them when processing inaccessible patterns.
  Note that `lhs` and `rhs` often have different types.
  After we perform additional case analysis, their types become definitionally equal.
  -/
  cnstrs    : List (Expr × Expr)
  deriving Inhabited
goal: Inhabited Lean.Meta.Match.Alt

full_name: Lean.Meta.Match.Alt.ref
code: /-- `Match` alternative -/
structure Alt where
  /-- `Syntax` object for providing position information -/
  ref       : Syntax
  /--
  Original alternative index. Alternatives can be split, this index is the original
  position of the alternative that generated this one.
  -/
  idx       : Nat
  /--
  Right-hand-side of the alternative.
  -/
  rhs       : Expr
  /--
  Alternative pattern variables.
  -/
  fvarDecls : List LocalDecl
  /--
  Alternative patterns.
  -/
  patterns  : List Pattern
  /--
  Pending constraints `lhs ≋ rhs` that need to be solved before the alternative
  is considered acceptable. We generate them when processing inaccessible patterns.
  Note that `lhs` and `rhs` often have different types.
  After we perform additional case analysis, their types become definitionally equal.
  -/
  cnstrs    : List (Expr × Expr)
  deriving Inhabited
goal: Lean.Syntax

full_name: Lean.Meta.Match.Alt.patterns
code: /-- `Match` alternative -/
structure Alt where
  /-- `Syntax` object for providing position information -/
  ref       : Syntax
  /--
  Original alternative index. Alternatives can be split, this index is the original
  position of the alternative that generated this one.
  -/
  idx       : Nat
  /--
  Right-hand-side of the alternative.
  -/
  rhs       : Expr
  /--
  Alternative pattern variables.
  -/
  fvarDecls : List LocalDecl
  /--
  Alternative patterns.
  -/
  patterns  : List Pattern
  /--
  Pending constraints `lhs ≋ rhs` that need to be solved before the alternative
  is considered acceptable. We generate them when processing inaccessible patterns.
  Note that `lhs` and `rhs` often have different types.
  After we perform additional case analysis, their types become definitionally equal.
  -/
  cnstrs    : List (Expr × Expr)
  deriving Inhabited
goal: List Lean.Meta.Match.Pattern

full_name: Lean.Meta.Match.Alt
code: /-- `Match` alternative -/
structure Alt where
  /-- `Syntax` object for providing position information -/
  ref       : Syntax
  /--
  Original alternative index. Alternatives can be split, this index is the original
  position of the alternative that generated this one.
  -/
  idx       : Nat
  /--
  Right-hand-side of the alternative.
  -/
  rhs       : Expr
  /--
  Alternative pattern variables.
  -/
  fvarDecls : List LocalDecl
  /--
  Alternative patterns.
  -/
  patterns  : List Pattern
  /--
  Pending constraints `lhs ≋ rhs` that need to be solved before the alternative
  is considered acceptable. We generate them when processing inaccessible patterns.
  Note that `lhs` and `rhs` often have different types.
  After we perform additional case analysis, their types become definitionally equal.
  -/
  cnstrs    : List (Expr × Expr)
  deriving Inhabited
goal: Type

full_name: Lean.Meta.Match.Alt.fvarDecls
code: /-- `Match` alternative -/
structure Alt where
  /-- `Syntax` object for providing position information -/
  ref       : Syntax
  /--
  Original alternative index. Alternatives can be split, this index is the original
  position of the alternative that generated this one.
  -/
  idx       : Nat
  /--
  Right-hand-side of the alternative.
  -/
  rhs       : Expr
  /--
  Alternative pattern variables.
  -/
  fvarDecls : List LocalDecl
  /--
  Alternative patterns.
  -/
  patterns  : List Pattern
  /--
  Pending constraints `lhs ≋ rhs` that need to be solved before the alternative
  is considered acceptable. We generate them when processing inaccessible patterns.
  Note that `lhs` and `rhs` often have different types.
  After we perform additional case analysis, their types become definitionally equal.
  -/
  cnstrs    : List (Expr × Expr)
  deriving Inhabited
goal: List Lean.LocalDecl

full_name: Lean.Meta.Match.Alt.rhs
code: /-- `Match` alternative -/
structure Alt where
  /-- `Syntax` object for providing position information -/
  ref       : Syntax
  /--
  Original alternative index. Alternatives can be split, this index is the original
  position of the alternative that generated this one.
  -/
  idx       : Nat
  /--
  Right-hand-side of the alternative.
  -/
  rhs       : Expr
  /--
  Alternative pattern variables.
  -/
  fvarDecls : List LocalDecl
  /--
  Alternative patterns.
  -/
  patterns  : List Pattern
  /--
  Pending constraints `lhs ≋ rhs` that need to be solved before the alternative
  is considered acceptable. We generate them when processing inaccessible patterns.
  Note that `lhs` and `rhs` often have different types.
  After we perform additional case analysis, their types become definitionally equal.
  -/
  cnstrs    : List (Expr × Expr)
  deriving Inhabited
goal: Lean.Expr

full_name: Lean.Meta.Match.Alt.idx
code: /-- `Match` alternative -/
structure Alt where
  /-- `Syntax` object for providing position information -/
  ref       : Syntax
  /--
  Original alternative index. Alternatives can be split, this index is the original
  position of the alternative that generated this one.
  -/
  idx       : Nat
  /--
  Right-hand-side of the alternative.
  -/
  rhs       : Expr
  /--
  Alternative pattern variables.
  -/
  fvarDecls : List LocalDecl
  /--
  Alternative patterns.
  -/
  patterns  : List Pattern
  /--
  Pending constraints `lhs ≋ rhs` that need to be solved before the alternative
  is considered acceptable. We generate them when processing inaccessible patterns.
  Note that `lhs` and `rhs` often have different types.
  After we perform additional case analysis, their types become definitionally equal.
  -/
  cnstrs    : List (Expr × Expr)
  deriving Inhabited
goal: Nat

full_name: Lean.Meta.Match.Alt.toMessageData
code: partial def toMessageData (alt : Alt) : MetaM MessageData 
goal: Lean.MetaM Lean.MessageData

full_name: Lean.Meta.Match.Alt.applyFVarSubst
code: def applyFVarSubst (s : FVarSubst) (alt : Alt) : Alt 
goal: Lean.Meta.Match.Alt

full_name: Lean.Meta.Match.Alt.replaceFVarId
code: def replaceFVarId (fvarId : FVarId) (v : Expr) (alt : Alt) : Alt 
goal: Lean.Meta.Match.Alt

full_name: Lean.Meta.Match.Alt.isLocalDecl
code: /-- Return `true` if `fvarId` is one of the alternative pattern variables -/
def isLocalDecl (fvarId : FVarId) (alt : Alt) : Bool 
goal: Bool

full_name: Lean.Meta.Match.Alt.checkAndReplaceFVarId
code: /--
  Similar to `checkAndReplaceFVarId`, but ensures type of `v` is definitionally equal to type of `fvarId`.
  This extra check is necessary when performing dependent elimination and inaccessible terms have been used.
  For example, consider the following code fragment:

```
inductive Vec (α : Type u) : Nat → Type u where
  | nil : Vec α 0
  | cons {n} (head : α) (tail : Vec α n) : Vec α (n+1)

inductive VecPred {α : Type u} (P : α → Prop) : {n : Nat} → Vec α n → Prop where
  | nil   : VecPred P Vec.nil
  | cons  {n : Nat} {head : α} {tail : Vec α n} : P head → VecPred P tail → VecPred P (Vec.cons head tail)

theorem ex {α : Type u} (P : α → Prop) : {n : Nat} → (v : Vec α (n+1)) → VecPred P v → Exists P
  | _, Vec.cons head _, VecPred.cons h (w : VecPred P Vec.nil) => ⟨head, h⟩
```
Recall that `_` in a pattern can be elaborated into pattern variable or an inaccessible term.
The elaborator uses an inaccessible term when typing constraints restrict its value.
Thus, in the example above, the `_` at `Vec.cons head _` becomes the inaccessible pattern `.(Vec.nil)`
because the type ascription `(w : VecPred P Vec.nil)` propagates typing constraints that restrict its value to be `Vec.nil`.
After elaboration the alternative becomes:
```
  | .(0), @Vec.cons .(α) .(0) head .(Vec.nil), @VecPred.cons .(α) .(P) .(0) .(head) .(Vec.nil) h w => ⟨head, h⟩
```
where
```
(head : α), (h: P head), (w : VecPred P Vec.nil)
```
Then, when we process this alternative in this module, the following check will detect that
`w` has type `VecPred P Vec.nil`, when it is supposed to have type `VecPred P tail`.
Note that if we had written
```
theorem ex {α : Type u} (P : α → Prop) : {n : Nat} → (v : Vec α (n+1)) → VecPred P v → Exists P
  | _, Vec.cons head Vec.nil, VecPred.cons h (w : VecPred P Vec.nil) => ⟨head, h⟩
```
we would get the easier to digest error message
```
missing cases:
_, (Vec.cons _ _ (Vec.cons _ _ _)), _
```
-/
def checkAndReplaceFVarId (fvarId : FVarId) (v : Expr) (alt : Alt) : MetaM Alt 
goal: Lean.MetaM Lean.Meta.Match.Alt

full_name: Lean.Meta.Match.Example.ctor
code: inductive Example where
  | var        : FVarId → Example
  | underscore : Example
  | ctor       : Name → List Example → Example
  | val        : Expr → Example
  | arrayLit   : List Example → Example
goal: Lean.Name → List Lean.Meta.Match.Example → Lean.Meta.Match.Example

full_name: Lean.Meta.Match.Example.var
code: inductive Example where
  | var        : FVarId → Example
  | underscore : Example
  | ctor       : Name → List Example → Example
  | val        : Expr → Example
  | arrayLit   : List Example → Example
goal: Lean.FVarId → Lean.Meta.Match.Example

full_name: Lean.Meta.Match.Example.underscore
code: inductive Example where
  | var        : FVarId → Example
  | underscore : Example
  | ctor       : Name → List Example → Example
  | val        : Expr → Example
  | arrayLit   : List Example → Example
goal: Lean.Meta.Match.Example

full_name: Lean.Meta.Match.Example
code: inductive Example where
  | var        : FVarId → Example
  | underscore : Example
  | ctor       : Name → List Example → Example
  | val        : Expr → Example
  | arrayLit   : List Example → Example
goal: Type

full_name: Lean.Meta.Match.Example.arrayLit
code: inductive Example where
  | var        : FVarId → Example
  | underscore : Example
  | ctor       : Name → List Example → Example
  | val        : Expr → Example
  | arrayLit   : List Example → Example
goal: List Lean.Meta.Match.Example → Lean.Meta.Match.Example

full_name: Lean.Meta.Match.Example.val
code: inductive Example where
  | var        : FVarId → Example
  | underscore : Example
  | ctor       : Name → List Example → Example
  | val        : Expr → Example
  | arrayLit   : List Example → Example
goal: Lean.Expr → Lean.Meta.Match.Example

full_name: Lean.Meta.Match.Example.replaceFVarId
code: partial def replaceFVarId (fvarId : FVarId) (ex : Example) : Example → Example
  
goal: Lean.Meta.Match.Example → Lean.Meta.Match.Example

full_name: Lean.Meta.Match.Example.applyFVarSubst
code: partial def applyFVarSubst (s : FVarSubst) : Example → Example
  
goal: Lean.Meta.Match.Example → Lean.Meta.Match.Example

full_name: Lean.Meta.Match.Example.varsToUnderscore
code: partial def varsToUnderscore : Example → Example
  
goal: Lean.Meta.Match.Example → Lean.Meta.Match.Example

full_name: Lean.Meta.Match.Example.toMessageData
code: partial def toMessageData : Example → MessageData
  
goal: Lean.Meta.Match.Example → Lean.MessageData

full_name: Lean.Meta.Match.examplesToMessageData
code: def examplesToMessageData (cex : List Example) : MessageData 
goal: Lean.MessageData

full_name: Lean.Meta.Match.Problem
code: structure Problem where
  mvarId        : MVarId
  vars          : List Expr
  alts          : List Alt
  examples      : List Example
  deriving Inhabited
goal: Type

full_name: Lean.Meta.Match.Problem.mvarId
code: structure Problem where
  mvarId        : MVarId
  vars          : List Expr
  alts          : List Alt
  examples      : List Example
  deriving Inhabited
goal: Lean.MVarId

full_name: Lean.Meta.Match.Problem.vars
code: structure Problem where
  mvarId        : MVarId
  vars          : List Expr
  alts          : List Alt
  examples      : List Example
  deriving Inhabited
goal: List Lean.Expr

full_name: Lean.Meta.Match.Problem.examples
code: structure Problem where
  mvarId        : MVarId
  vars          : List Expr
  alts          : List Alt
  examples      : List Example
  deriving Inhabited
goal: List Lean.Meta.Match.Example

full_name: Lean.Meta.Match.instInhabitedProblem
code: structure Problem where
  mvarId        : MVarId
  vars          : List Expr
  alts          : List Alt
  examples      : List Example
  deriving Inhabited
goal: Inhabited Lean.Meta.Match.Problem

full_name: Lean.Meta.Match.Problem.alts
code: structure Problem where
  mvarId        : MVarId
  vars          : List Expr
  alts          : List Alt
  examples      : List Example
  deriving Inhabited
goal: List Lean.Meta.Match.Alt

full_name: Lean.Meta.Match.withGoalOf
code: def withGoalOf {α} (p : Problem) (x : MetaM α) : MetaM α 
goal: Lean.MetaM α

full_name: Lean.Meta.Match.Problem.toMessageData
code: def Problem.toMessageData (p : Problem) : MetaM MessageData 
goal: Lean.MetaM Lean.MessageData

full_name: Lean.Meta.Match.CounterExample
code: abbrev CounterExample 
goal: Type

full_name: Lean.Meta.Match.counterExampleToMessageData
code: def counterExampleToMessageData (cex : CounterExample) : MessageData 
goal: Lean.MessageData

full_name: Lean.Meta.Match.counterExamplesToMessageData
code: def counterExamplesToMessageData (cexs : List CounterExample) : MessageData 
goal: Lean.MessageData

full_name: Lean.Meta.Match.MatcherResult
code: structure MatcherResult where
  matcher         : Expr -- The matcher. It is not just `Expr.const matcherName` because the type of the major premises may contain free variables.
  counterExamples : List CounterExample
  unusedAltIdxs   : List Nat
  addMatcher      : MetaM Unit
goal: Type

full_name: Lean.Meta.Match.MatcherResult.unusedAltIdxs
code: structure MatcherResult where
  matcher         : Expr -- The matcher. It is not just `Expr.const matcherName` because the type of the major premises may contain free variables.
  counterExamples : List CounterExample
  unusedAltIdxs   : List Nat
  addMatcher      : MetaM Unit
goal: List Nat

full_name: Lean.Meta.Match.MatcherResult.counterExamples
code: structure MatcherResult where
  matcher         : Expr -- The matcher. It is not just `Expr.const matcherName` because the type of the major premises may contain free variables.
  counterExamples : List CounterExample
  unusedAltIdxs   : List Nat
  addMatcher      : MetaM Unit
goal: List Lean.Meta.Match.CounterExample

full_name: Lean.Meta.Match.MatcherResult.matcher
code: structure MatcherResult where
  matcher         : Expr -- The matcher. It is not just `Expr.const matcherName` because the type of the major premises may contain free variables.
  counterExamples : List CounterExample
  unusedAltIdxs   : List Nat
  addMatcher      : MetaM Unit
goal: Lean.Expr

full_name: Lean.Meta.Match.MatcherResult.addMatcher
code: structure MatcherResult where
  matcher         : Expr -- The matcher. It is not just `Expr.const matcherName` because the type of the major premises may contain free variables.
  counterExamples : List CounterExample
  unusedAltIdxs   : List Nat
  addMatcher      : MetaM Unit
goal: Lean.MetaM Unit

full_name: Lean.Meta.Match.toPattern
code: /--
  Convert a expression occurring as the argument of a `match` motive application back into a `Pattern`
  For example, we can use this method to convert `x::y::xs` at
  ```
  ...
  (motive : List Nat → Sort u_1) (xs : List Nat) (h_1 : (x y : Nat) → (xs : List Nat) → motive (x :: y :: xs))
  ...
  ```
  into a pattern object
-/
partial def toPattern (e : Expr) : MetaM Pattern 
goal: Lean.MetaM Lean.Meta.Match.Pattern