File: .lake/packages/lean4/src/lean/Lean/Elab/StructInst.lean

full_name: Lean.Elab.Term.StructInst.expandStructInstExpectedType
code: @[builtin_macro Lean.Parser.Term.structInst] def expandStructInstExpectedType : Macro 
goal: Lean.Macro

full_name: Lean.Elab.Term.StructInst.expandStructInstFieldAbbrev
code: /-- Expand field abbreviations. Example: `{ x, y := 0 }` expands to `{ x := x, y := 0 }` -/
@[builtin_macro Lean.Parser.Term.structInst] def expandStructInstFieldAbbrev : Macro
  
goal: Lean.Macro

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.expandNonAtomicExplicitSources
code: /--
  If `stx` is of the form `{ s₁, ..., sₙ with ... }` and `sᵢ` is not a local variable, expand into `let src := sᵢ; { ..., src, ... with ... }`.

  Note that this one is not a `Macro` because we need to access the local context.
-/
private def expandNonAtomicExplicitSources (stx : Syntax) : TermElabM (Option Syntax) 
goal: Lean.Elab.TermElabM (Option Lean.Syntax)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.expandNonAtomicExplicitSources.go
code: /--
  If `stx` is of the form `{ s₁, ..., sₙ with ... }` and `sᵢ` is not a local variable, expand into `let src := sᵢ; { ..., src, ... with ... }`.

  Note that this one is not a `Macro` because we need to access the local context.
-/
private def expandNonAtomicExplicitSources (stx : Syntax) : TermElabM (Option Syntax) 
goal: Lean.Elab.TermElabM Lean.Syntax

full_name: Lean.Elab.Term.StructInst.instInhabitedExplicitSourceInfo
code: structure ExplicitSourceInfo where
  stx        : Syntax
  structName : Name
  deriving Inhabited
goal: Inhabited Lean.Elab.Term.StructInst.ExplicitSourceInfo

full_name: Lean.Elab.Term.StructInst.ExplicitSourceInfo.stx
code: structure ExplicitSourceInfo where
  stx        : Syntax
  structName : Name
  deriving Inhabited
goal: Lean.Syntax

full_name: Lean.Elab.Term.StructInst.ExplicitSourceInfo.structName
code: structure ExplicitSourceInfo where
  stx        : Syntax
  structName : Name
  deriving Inhabited
goal: Lean.Name

full_name: Lean.Elab.Term.StructInst.ExplicitSourceInfo
code: structure ExplicitSourceInfo where
  stx        : Syntax
  structName : Name
  deriving Inhabited
goal: Type

full_name: Lean.Elab.Term.StructInst.Source.implicit
code: structure Source where
  explicit : Array ExplicitSourceInfo -- `s₁ ... sₙ with`
  implicit : Option Syntax -- `..`
  deriving Inhabited
goal: Option Lean.Syntax

full_name: Lean.Elab.Term.StructInst.Source.explicit
code: structure Source where
  explicit : Array ExplicitSourceInfo -- `s₁ ... sₙ with`
  implicit : Option Syntax -- `..`
  deriving Inhabited
goal: Array Lean.Elab.Term.StructInst.ExplicitSourceInfo

full_name: Lean.Elab.Term.StructInst.Source
code: structure Source where
  explicit : Array ExplicitSourceInfo -- `s₁ ... sₙ with`
  implicit : Option Syntax -- `..`
  deriving Inhabited
goal: Type

full_name: Lean.Elab.Term.StructInst.instInhabitedSource
code: structure Source where
  explicit : Array ExplicitSourceInfo -- `s₁ ... sₙ with`
  implicit : Option Syntax -- `..`
  deriving Inhabited
goal: Inhabited Lean.Elab.Term.StructInst.Source

full_name: Lean.Elab.Term.StructInst.Source.isNone
code: def Source.isNone : Source → Bool
  
goal: Lean.Elab.Term.StructInst.Source → Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.mkSourcesWithSyntax
code: /-- `optional (atomic (sepBy1 termParser ", " >> " with ")` -/
private def mkSourcesWithSyntax (sources : Array Syntax) : Syntax 
goal: Lean.Syntax

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.getStructSource
code: private def getStructSource (structStx : Syntax) : TermElabM Source 
goal: Lean.Elab.TermElabM Lean.Elab.Term.StructInst.Source

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.isModifyOp?
code: /--
  We say a `{ ... }` notation is a `modifyOp` if it contains only one
  ```
  def structInstArrayRef := leading_parser "[" >> termParser >>"]"
  ```
-/
private def isModifyOp? (stx : Syntax) : TermElabM (Option Syntax) 
goal: Lean.Elab.TermElabM (Option Lean.Syntax)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.elabModifyOp
code: private def elabModifyOp (stx modifyOp : Syntax) (sources : Array ExplicitSourceInfo) (expectedType? : Option Expr) : TermElabM Expr 
goal: Lean.Elab.TermElabM Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.getStructName.throwUnknownExpectedType
code: /--
  Get structure name.
  This method triest to postpone execution if the expected type is not available.

  If the expected type is available and it is a structure, then we use it.
  Otherwise, we use the type of the first source. -/
private def getStructName (expectedType? : Option Expr) (sourceView : Source) : TermElabM Name 
goal: Lean.Elab.TermElabM Lean.Name

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.getStructName.throwUnexpectedExpectedType
code: /--
  Get structure name.
  This method triest to postpone execution if the expected type is not available.

  If the expected type is available and it is a structure, then we use it.
  Otherwise, we use the type of the first source. -/
private def getStructName (expectedType? : Option Expr) (sourceView : Source) : TermElabM Name 
goal: Lean.Elab.TermElabM Lean.Name

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.getStructName
code: /--
  Get structure name.
  This method triest to postpone execution if the expected type is not available.

  If the expected type is available and it is a structure, then we use it.
  Otherwise, we use the type of the first source. -/
private def getStructName (expectedType? : Option Expr) (sourceView : Source) : TermElabM Name 
goal: Lean.Elab.TermElabM Lean.Name

full_name: Lean.Elab.Term.StructInst.FieldLHS.fieldName
code: inductive FieldLHS where
  | fieldName  (ref : Syntax) (name : Name)
  | fieldIndex (ref : Syntax) (idx : Nat)
  | modifyOp   (ref : Syntax) (index : Syntax)
  deriving Inhabited
goal: Lean.Elab.Term.StructInst.FieldLHS

full_name: Lean.Elab.Term.StructInst.instInhabitedFieldLHS
code: inductive FieldLHS where
  | fieldName  (ref : Syntax) (name : Name)
  | fieldIndex (ref : Syntax) (idx : Nat)
  | modifyOp   (ref : Syntax) (index : Syntax)
  deriving Inhabited
goal: Inhabited Lean.Elab.Term.StructInst.FieldLHS

full_name: Lean.Elab.Term.StructInst.FieldLHS
code: inductive FieldLHS where
  | fieldName  (ref : Syntax) (name : Name)
  | fieldIndex (ref : Syntax) (idx : Nat)
  | modifyOp   (ref : Syntax) (index : Syntax)
  deriving Inhabited
goal: Type

full_name: Lean.Elab.Term.StructInst.FieldLHS.fieldIndex
code: inductive FieldLHS where
  | fieldName  (ref : Syntax) (name : Name)
  | fieldIndex (ref : Syntax) (idx : Nat)
  | modifyOp   (ref : Syntax) (index : Syntax)
  deriving Inhabited
goal: Lean.Elab.Term.StructInst.FieldLHS

full_name: Lean.Elab.Term.StructInst.FieldLHS.modifyOp
code: inductive FieldLHS where
  | fieldName  (ref : Syntax) (name : Name)
  | fieldIndex (ref : Syntax) (idx : Nat)
  | modifyOp   (ref : Syntax) (index : Syntax)
  deriving Inhabited
goal: Lean.Elab.Term.StructInst.FieldLHS

full_name: Lean.Elab.Term.StructInst.instToFormatFieldLHS
code: instance : ToFormat FieldLHS 
goal: Lean.ToFormat Lean.Elab.Term.StructInst.FieldLHS

full_name: Lean.Elab.Term.StructInst.FieldVal.nested
code: inductive FieldVal (σ : Type) where
  | term  (stx : Syntax) : FieldVal σ
  | nested (s : σ)       : FieldVal σ
  | default              : FieldVal σ -- mark that field must be synthesized using default value
  deriving Inhabited
goal: Lean.Elab.Term.StructInst.FieldVal σ

full_name: Lean.Elab.Term.StructInst.FieldVal
code: inductive FieldVal (σ : Type) where
  | term  (stx : Syntax) : FieldVal σ
  | nested (s : σ)       : FieldVal σ
  | default              : FieldVal σ -- mark that field must be synthesized using default value
  deriving Inhabited
goal: Type

full_name: Lean.Elab.Term.StructInst.FieldVal.default
code: inductive FieldVal (σ : Type) where
  | term  (stx : Syntax) : FieldVal σ
  | nested (s : σ)       : FieldVal σ
  | default              : FieldVal σ -- mark that field must be synthesized using default value
  deriving Inhabited
goal: Lean.Elab.Term.StructInst.FieldVal σ

full_name: Lean.Elab.Term.StructInst.FieldVal.term
code: inductive FieldVal (σ : Type) where
  | term  (stx : Syntax) : FieldVal σ
  | nested (s : σ)       : FieldVal σ
  | default              : FieldVal σ -- mark that field must be synthesized using default value
  deriving Inhabited
goal: Lean.Elab.Term.StructInst.FieldVal σ

full_name: Lean.Elab.Term.StructInst.instInhabitedFieldVal
code: inductive FieldVal (σ : Type) where
  | term  (stx : Syntax) : FieldVal σ
  | nested (s : σ)       : FieldVal σ
  | default              : FieldVal σ -- mark that field must be synthesized using default value
  deriving Inhabited
goal: {a : Type} → Inhabited (Lean.Elab.Term.StructInst.FieldVal a)

full_name: Lean.Elab.Term.StructInst.instInhabitedField
code: structure Field (σ : Type) where
  ref   : Syntax
  lhs   : List FieldLHS
  val   : FieldVal σ
  expr? : Option Expr := none
  deriving Inhabited
goal: {a : Type} → Inhabited (Lean.Elab.Term.StructInst.Field a)

full_name: Lean.Elab.Term.StructInst.Field
code: structure Field (σ : Type) where
  ref   : Syntax
  lhs   : List FieldLHS
  val   : FieldVal σ
  expr? : Option Expr := none
  deriving Inhabited
goal: Type

full_name: Lean.Elab.Term.StructInst.Field.lhs
code: structure Field (σ : Type) where
  ref   : Syntax
  lhs   : List FieldLHS
  val   : FieldVal σ
  expr? : Option Expr := none
  deriving Inhabited
goal: List Lean.Elab.Term.StructInst.FieldLHS

full_name: Lean.Elab.Term.StructInst.Field.ref
code: structure Field (σ : Type) where
  ref   : Syntax
  lhs   : List FieldLHS
  val   : FieldVal σ
  expr? : Option Expr := none
  deriving Inhabited
goal: Lean.Syntax

full_name: Lean.Elab.Term.StructInst.Field.val
code: structure Field (σ : Type) where
  ref   : Syntax
  lhs   : List FieldLHS
  val   : FieldVal σ
  expr? : Option Expr := none
  deriving Inhabited
goal: Lean.Elab.Term.StructInst.FieldVal σ

full_name: Lean.Elab.Term.StructInst.Field.expr?
code: structure Field (σ : Type) where
  ref   : Syntax
  lhs   : List FieldLHS
  val   : FieldVal σ
  expr? : Option Expr := none
  deriving Inhabited
goal: Option Lean.Expr

full_name: Lean.Elab.Term.StructInst.Field.isSimple
code: def Field.isSimple {σ} : Field σ → Bool
  
goal: Lean.Elab.Term.StructInst.Field σ → Bool

full_name: Lean.Elab.Term.StructInst.Struct.mk
code: inductive Struct where
  /-- Remark: the field `params` is use for default value propagation. It is initially empty, and then set at `elabStruct`. -/
  | mk (ref : Syntax) (structName : Name) (params : Array (Name × Expr)) (fields : List (Field Struct)) (source : Source)
  deriving Inhabited
goal: Lean.Elab.Term.StructInst.Struct

full_name: Lean.Elab.Term.StructInst.Struct
code: inductive Struct where
  /-- Remark: the field `params` is use for default value propagation. It is initially empty, and then set at `elabStruct`. -/
  | mk (ref : Syntax) (structName : Name) (params : Array (Name × Expr)) (fields : List (Field Struct)) (source : Source)
  deriving Inhabited
goal: Type

full_name: Lean.Elab.Term.StructInst.instInhabitedStruct
code: inductive Struct where
  /-- Remark: the field `params` is use for default value propagation. It is initially empty, and then set at `elabStruct`. -/
  | mk (ref : Syntax) (structName : Name) (params : Array (Name × Expr)) (fields : List (Field Struct)) (source : Source)
  deriving Inhabited
goal: Inhabited Lean.Elab.Term.StructInst.Struct

full_name: Lean.Elab.Term.StructInst.Fields
code: abbrev Fields 
goal: Type

full_name: Lean.Elab.Term.StructInst.Struct.ref
code: def Struct.ref : Struct → Syntax
  
goal: Lean.Elab.Term.StructInst.Struct → Lean.Syntax

full_name: Lean.Elab.Term.StructInst.Struct.structName
code: def Struct.structName : Struct → Name
  
goal: Lean.Elab.Term.StructInst.Struct → Lean.Name

full_name: Lean.Elab.Term.StructInst.Struct.params
code: def Struct.params : Struct → Array (Name × Expr)
  
goal: Lean.Elab.Term.StructInst.Struct → Array (Lean.Name × Lean.Expr)

full_name: Lean.Elab.Term.StructInst.Struct.fields
code: def Struct.fields : Struct → Fields
  
goal: Lean.Elab.Term.StructInst.Struct → Lean.Elab.Term.StructInst.Fields

full_name: Lean.Elab.Term.StructInst.Struct.source
code: def Struct.source : Struct → Source
  
goal: Lean.Elab.Term.StructInst.Struct → Lean.Elab.Term.StructInst.Source

full_name: Lean.Elab.Term.StructInst.Struct.allDefault
code: /-- `true` iff all fields of the given structure are marked as `default` -/
partial def Struct.allDefault (s : Struct) : Bool 
goal: Bool

full_name: Lean.Elab.Term.StructInst.formatField
code: def formatField (formatStruct : Struct → Format) (field : Field Struct) : Format 
goal: Lean.Format

full_name: Lean.Elab.Term.StructInst.formatStruct
code: partial def formatStruct : Struct → Format
  
goal: Lean.Elab.Term.StructInst.Struct → Lean.Format

full_name: Lean.Elab.Term.StructInst.instToFormatStruct
code: instance : ToFormat Struct     
goal: Lean.ToFormat Lean.Elab.Term.StructInst.Struct

full_name: Lean.Elab.Term.StructInst.instToStringStruct
code: instance : ToString Struct 
goal: ToString Lean.Elab.Term.StructInst.Struct

full_name: Lean.Elab.Term.StructInst.instToFormatFieldStruct
code: instance : ToFormat (Field Struct) 
goal: Lean.ToFormat (Lean.Elab.Term.StructInst.Field Lean.Elab.Term.StructInst.Struct)

full_name: Lean.Elab.Term.StructInst.instToStringFieldStruct
code: instance : ToString (Field Struct) 
goal: ToString (Lean.Elab.Term.StructInst.Field Lean.Elab.Term.StructInst.Struct)

full_name: Lean.Elab.Term.StructInst.FieldLHS.toSyntax
code: def FieldLHS.toSyntax (first : Bool) : FieldLHS → Syntax
  
goal: Lean.Elab.Term.StructInst.FieldLHS → Lean.Syntax

full_name: Lean.Elab.Term.StructInst.FieldVal.toSyntax
code: def FieldVal.toSyntax : FieldVal Struct → Syntax
  
goal: Lean.Elab.Term.StructInst.FieldVal Lean.Elab.Term.StructInst.Struct → Lean.Syntax

full_name: Lean.Elab.Term.StructInst.Field.toSyntax
code: def Field.toSyntax : Field Struct → Syntax
  
goal: Lean.Elab.Term.StructInst.Field Lean.Elab.Term.StructInst.Struct → Lean.Syntax

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.toFieldLHS
code: private def toFieldLHS (stx : Syntax) : MacroM FieldLHS 
goal: Lean.MacroM Lean.Elab.Term.StructInst.FieldLHS

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.mkStructView
code: private def mkStructView (stx : Syntax) (structName : Name) (source : Source) : MacroM Struct 
goal: Lean.MacroM Lean.Elab.Term.StructInst.Struct

full_name: Lean.Elab.Term.StructInst.Struct.modifyFieldsM
code: def Struct.modifyFieldsM {m : Type → Type} [Monad m] (s : Struct) (f : Fields → m Fields) : m Struct 
goal: m Lean.Elab.Term.StructInst.Struct

full_name: Lean.Elab.Term.StructInst.Struct.modifyFields
code: def Struct.modifyFields (s : Struct) (f : Fields → Fields) : Struct 
goal: Lean.Elab.Term.StructInst.Struct

full_name: Lean.Elab.Term.StructInst.Struct.setFields
code: def Struct.setFields (s : Struct) (fields : Fields) : Struct 
goal: Lean.Elab.Term.StructInst.Struct

full_name: Lean.Elab.Term.StructInst.Struct.setParams
code: def Struct.setParams (s : Struct) (ps : Array (Name × Expr)) : Struct 
goal: Lean.Elab.Term.StructInst.Struct

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.expandCompositeFields
code: private def expandCompositeFields (s : Struct) : Struct 
goal: Lean.Elab.Term.StructInst.Struct

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.expandNumLitFields
code: private def expandNumLitFields (s : Struct) : TermElabM Struct 
goal: Lean.Elab.TermElabM Lean.Elab.Term.StructInst.Struct

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.expandParentFields
code: /-- For example, consider the following structures:
   ```
   structure A where
     x : Nat

   structure B extends A where
     y : Nat

   structure C extends B where
     z : Bool
   ```
   This method expands parent structure fields using the path to the parent structure.
   For example,
   ```
   { x := 0, y := 0, z := true : C }
   ```
   is expanded into
   ```
   { toB.toA.x := 0, toB.y := 0, z := true : C }
   ```
-/
private def expandParentFields (s : Struct) : TermElabM Struct 
goal: Lean.Elab.TermElabM Lean.Elab.Term.StructInst.Struct

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.FieldMap
code: private abbrev FieldMap 
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.mkFieldMap
code: private def mkFieldMap (fields : Fields) : TermElabM FieldMap 
goal: Lean.Elab.TermElabM Lean.Elab.Term.StructInst.FieldMap

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.isSimpleField?
code: private def isSimpleField? : Fields → Option (Field Struct)
  
goal: Lean.Elab.Term.StructInst.Fields → Option (Lean.Elab.Term.StructInst.Field Lean.Elab.Term.StructInst.Struct)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.getFieldIdx
code: private def getFieldIdx (structName : Name) (fieldNames : Array Name) (fieldName : Name) : TermElabM Nat 
goal: Lean.Elab.TermElabM Nat

full_name: Lean.Elab.Term.StructInst.mkProjStx?
code: def mkProjStx? (s : Syntax) (structName : Name) (fieldName : Name) : TermElabM (Option Syntax) 
goal: Lean.Elab.TermElabM (Option Lean.Syntax)

full_name: Lean.Elab.Term.StructInst.findField?
code: def findField? (fields : Fields) (fieldName : Name) : Option (Field Struct) 
goal: Option (Lean.Elab.Term.StructInst.Field Lean.Elab.Term.StructInst.Struct)

full_name: Lean.Elab.Term.StructInst.CtorHeaderResult.ctorFnType
code: structure CtorHeaderResult where
  ctorFn     : Expr
  ctorFnType : Expr
  instMVars  : Array MVarId
  params     : Array (Name × Expr)
goal: Lean.Expr

full_name: Lean.Elab.Term.StructInst.CtorHeaderResult.ctorFn
code: structure CtorHeaderResult where
  ctorFn     : Expr
  ctorFnType : Expr
  instMVars  : Array MVarId
  params     : Array (Name × Expr)
goal: Lean.Expr

full_name: Lean.Elab.Term.StructInst.CtorHeaderResult.instMVars
code: structure CtorHeaderResult where
  ctorFn     : Expr
  ctorFnType : Expr
  instMVars  : Array MVarId
  params     : Array (Name × Expr)
goal: Array Lean.MVarId

full_name: Lean.Elab.Term.StructInst.CtorHeaderResult.params
code: structure CtorHeaderResult where
  ctorFn     : Expr
  ctorFnType : Expr
  instMVars  : Array MVarId
  params     : Array (Name × Expr)
goal: Array (Lean.Name × Lean.Expr)

full_name: Lean.Elab.Term.StructInst.CtorHeaderResult
code: structure CtorHeaderResult where
  ctorFn     : Expr
  ctorFnType : Expr
  instMVars  : Array MVarId
  params     : Array (Name × Expr)
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.mkCtorHeaderAux
code: private def mkCtorHeaderAux : Nat → Expr → Expr → Array MVarId → Array (Name × Expr) → TermElabM CtorHeaderResult
  
goal: Nat →
  Lean.Expr →
    Lean.Expr →
      Array Lean.MVarId → Array (Lean.Name × Lean.Expr) → Lean.Elab.TermElabM Lean.Elab.Term.StructInst.CtorHeaderResult

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.getForallBody
code: private partial def getForallBody : Nat → Expr → Option Expr
  
goal: Nat → Lean.Expr → Option Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.propagateExpectedType
code: private def propagateExpectedType (type : Expr) (numFields : Nat) (expectedType? : Option Expr) : TermElabM Unit 
goal: Lean.Elab.TermElabM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.mkCtorHeader
code: private def mkCtorHeader (ctorVal : ConstructorVal) (expectedType? : Option Expr) : TermElabM CtorHeaderResult 
goal: Lean.Elab.TermElabM Lean.Elab.Term.StructInst.CtorHeaderResult

full_name: Lean.Elab.Term.StructInst.markDefaultMissing
code: def markDefaultMissing (e : Expr) : Expr 
goal: Lean.Expr

full_name: Lean.Elab.Term.StructInst.defaultMissing?
code: def defaultMissing? (e : Expr) : Option Expr 
goal: Option Lean.Expr

full_name: Lean.Elab.Term.StructInst.throwFailedToElabField
code: def throwFailedToElabField {α} (fieldName : Name) (structName : Name) (msgData : MessageData) : TermElabM α 
goal: Lean.Elab.TermElabM α

full_name: Lean.Elab.Term.StructInst.trySynthStructInstance?
code: def trySynthStructInstance? (s : Struct) (expectedType : Expr) : TermElabM (Option Expr) 
goal: Lean.Elab.TermElabM (Option Lean.Expr)

full_name: Lean.Elab.Term.StructInst.ElabStructResult
code: structure ElabStructResult where
  val       : Expr
  struct    : Struct
  instMVars : Array MVarId
goal: Type

full_name: Lean.Elab.Term.StructInst.ElabStructResult.instMVars
code: structure ElabStructResult where
  val       : Expr
  struct    : Struct
  instMVars : Array MVarId
goal: Array Lean.MVarId

full_name: Lean.Elab.Term.StructInst.ElabStructResult.struct
code: structure ElabStructResult where
  val       : Expr
  struct    : Struct
  instMVars : Array MVarId
goal: Lean.Elab.Term.StructInst.Struct

full_name: Lean.Elab.Term.StructInst.ElabStructResult.val
code: structure ElabStructResult where
  val       : Expr
  struct    : Struct
  instMVars : Array MVarId
goal: Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.elabStruct
code: private partial def elabStruct (s : Struct) (expectedType? : Option Expr) : TermElabM ElabStructResult 
goal: Lean.Elab.TermElabM Lean.Elab.Term.StructInst.ElabStructResult

full_name: Lean.Elab.Term.StructInst.DefaultFields.Context.maxDistance
code: structure Context where
  -- We must search for default values overridden in derived structures
  structs : Array Struct := #[]
  allStructNames : Array Name := #[]
  /--
  Consider the following example:
  ```
  structure A where
    x : Nat := 1

  structure B extends A where
    y : Nat := x + 1
    x := y + 1

  structure C extends B where
    z : Nat := 2*y
    x := z + 3
  ```
  And we are trying to elaborate a structure instance for `C`. There are default values for `x` at `A`, `B`, and `C`.
  We say the default value at `C` has distance 0, the one at `B` distance 1, and the one at `A` distance 2.
  The field `maxDistance` specifies the maximum distance considered in a round of Default field computation.
  Remark: since `C` does not set a default value of `y`, the default value at `B` is at distance 0.

  The fixpoint for setting default values works in the following way.
  - Keep computing default values using `maxDistance == 0`.
  - We increase `maxDistance` whenever we failed to compute a new default value in a round.
  - If `maxDistance > 0`, then we interrupt a round as soon as we compute some default value.
    We use depth-first search.
  - We sign an error if no progress is made when `maxDistance` == structure hierarchy depth (2 in the example above).
  -/
  maxDistance : Nat := 0
goal: Nat

full_name: Lean.Elab.Term.StructInst.DefaultFields.Context.allStructNames
code: structure Context where
  -- We must search for default values overridden in derived structures
  structs : Array Struct := #[]
  allStructNames : Array Name := #[]
  /--
  Consider the following example:
  ```
  structure A where
    x : Nat := 1

  structure B extends A where
    y : Nat := x + 1
    x := y + 1

  structure C extends B where
    z : Nat := 2*y
    x := z + 3
  ```
  And we are trying to elaborate a structure instance for `C`. There are default values for `x` at `A`, `B`, and `C`.
  We say the default value at `C` has distance 0, the one at `B` distance 1, and the one at `A` distance 2.
  The field `maxDistance` specifies the maximum distance considered in a round of Default field computation.
  Remark: since `C` does not set a default value of `y`, the default value at `B` is at distance 0.

  The fixpoint for setting default values works in the following way.
  - Keep computing default values using `maxDistance == 0`.
  - We increase `maxDistance` whenever we failed to compute a new default value in a round.
  - If `maxDistance > 0`, then we interrupt a round as soon as we compute some default value.
    We use depth-first search.
  - We sign an error if no progress is made when `maxDistance` == structure hierarchy depth (2 in the example above).
  -/
  maxDistance : Nat := 0
goal: Array Lean.Name

full_name: Lean.Elab.Term.StructInst.DefaultFields.Context.structs
code: structure Context where
  -- We must search for default values overridden in derived structures
  structs : Array Struct := #[]
  allStructNames : Array Name := #[]
  /--
  Consider the following example:
  ```
  structure A where
    x : Nat := 1

  structure B extends A where
    y : Nat := x + 1
    x := y + 1

  structure C extends B where
    z : Nat := 2*y
    x := z + 3
  ```
  And we are trying to elaborate a structure instance for `C`. There are default values for `x` at `A`, `B`, and `C`.
  We say the default value at `C` has distance 0, the one at `B` distance 1, and the one at `A` distance 2.
  The field `maxDistance` specifies the maximum distance considered in a round of Default field computation.
  Remark: since `C` does not set a default value of `y`, the default value at `B` is at distance 0.

  The fixpoint for setting default values works in the following way.
  - Keep computing default values using `maxDistance == 0`.
  - We increase `maxDistance` whenever we failed to compute a new default value in a round.
  - If `maxDistance > 0`, then we interrupt a round as soon as we compute some default value.
    We use depth-first search.
  - We sign an error if no progress is made when `maxDistance` == structure hierarchy depth (2 in the example above).
  -/
  maxDistance : Nat := 0
goal: Array Lean.Elab.Term.StructInst.Struct

full_name: Lean.Elab.Term.StructInst.DefaultFields.Context
code: structure Context where
  -- We must search for default values overridden in derived structures
  structs : Array Struct := #[]
  allStructNames : Array Name := #[]
  /--
  Consider the following example:
  ```
  structure A where
    x : Nat := 1

  structure B extends A where
    y : Nat := x + 1
    x := y + 1

  structure C extends B where
    z : Nat := 2*y
    x := z + 3
  ```
  And we are trying to elaborate a structure instance for `C`. There are default values for `x` at `A`, `B`, and `C`.
  We say the default value at `C` has distance 0, the one at `B` distance 1, and the one at `A` distance 2.
  The field `maxDistance` specifies the maximum distance considered in a round of Default field computation.
  Remark: since `C` does not set a default value of `y`, the default value at `B` is at distance 0.

  The fixpoint for setting default values works in the following way.
  - Keep computing default values using `maxDistance == 0`.
  - We increase `maxDistance` whenever we failed to compute a new default value in a round.
  - If `maxDistance > 0`, then we interrupt a round as soon as we compute some default value.
    We use depth-first search.
  - We sign an error if no progress is made when `maxDistance` == structure hierarchy depth (2 in the example above).
  -/
  maxDistance : Nat := 0
goal: Type

full_name: Lean.Elab.Term.StructInst.DefaultFields.State
code: structure State where
  progress : Bool := false
goal: Type

full_name: Lean.Elab.Term.StructInst.DefaultFields.State.progress
code: structure State where
  progress : Bool := false
goal: Bool

full_name: Lean.Elab.Term.StructInst.DefaultFields.collectStructNames
code: partial def collectStructNames (struct : Struct) (names : Array Name) : Array Name 
goal: Array Lean.Name

full_name: Lean.Elab.Term.StructInst.DefaultFields.getHierarchyDepth
code: partial def getHierarchyDepth (struct : Struct) : Nat 
goal: Nat

full_name: Lean.Elab.Term.StructInst.DefaultFields.isDefaultMissing?
code: def isDefaultMissing? [Monad m] [MonadMCtx m] (field : Field Struct) : m Bool 
goal: m Bool

full_name: Lean.Elab.Term.StructInst.DefaultFields.findDefaultMissing?
code: partial def findDefaultMissing? [Monad m] [MonadMCtx m] (struct : Struct) : m (Option (Field Struct)) 
goal: m (Option (Lean.Elab.Term.StructInst.Field Lean.Elab.Term.StructInst.Struct))

full_name: Lean.Elab.Term.StructInst.DefaultFields.allDefaultMissing.go
code: partial def allDefaultMissing [Monad m] [MonadMCtx m] (struct : Struct) : m (Array (Field Struct)) 
goal: StateT (Array (Lean.Elab.Term.StructInst.Field Lean.Elab.Term.StructInst.Struct)) m Unit

full_name: Lean.Elab.Term.StructInst.DefaultFields.allDefaultMissing
code: partial def allDefaultMissing [Monad m] [MonadMCtx m] (struct : Struct) : m (Array (Field Struct)) 
goal: m (Array (Lean.Elab.Term.StructInst.Field Lean.Elab.Term.StructInst.Struct))

full_name: Lean.Elab.Term.StructInst.DefaultFields.getFieldName
code: def getFieldName (field : Field Struct) : Name 
goal: Lean.Name

full_name: Lean.Elab.Term.StructInst.DefaultFields.M
code: abbrev M 
goal: Type

full_name: Lean.Elab.Term.StructInst.DefaultFields.isRoundDone
code: def isRoundDone : M Bool 
goal: Lean.Elab.Term.StructInst.DefaultFields.M Bool

full_name: Lean.Elab.Term.StructInst.DefaultFields.getFieldValue?
code: def getFieldValue? (struct : Struct) (fieldName : Name) : Option Expr 
goal: Option Lean.Expr

full_name: Lean.Elab.Term.StructInst.DefaultFields.mkDefaultValueAux?
code: partial def mkDefaultValueAux? (struct : Struct) : Expr → TermElabM (Option Expr)
  
goal: Lean.Expr → Lean.Elab.TermElabM (Option Lean.Expr)

full_name: Lean.Elab.Term.StructInst.DefaultFields.mkDefaultValue?
code: def mkDefaultValue? (struct : Struct) (cinfo : ConstantInfo) : TermElabM (Option Expr) 
goal: Lean.Elab.TermElabM (Option Lean.Expr)

full_name: Lean.Elab.Term.StructInst.DefaultFields.reduce
code: /-- Reduce default value. It performs beta reduction and projections of the given structures. -/
partial def reduce (structNames : Array Name) (e : Expr) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Elab.Term.StructInst.DefaultFields.tryToSynthesizeDefault
code: partial def tryToSynthesizeDefault (structs : Array Struct) (allStructNames : Array Name) (maxDistance : Nat) (fieldName : Name) (mvarId : MVarId) : TermElabM Bool 
goal: Lean.Elab.TermElabM Bool

full_name: Lean.Elab.Term.StructInst.DefaultFields.tryToSynthesizeDefault.loop
code: partial def tryToSynthesizeDefault (structs : Array Struct) (allStructNames : Array Name) (maxDistance : Nat) (fieldName : Name) (mvarId : MVarId) : TermElabM Bool 
goal: Lean.Elab.TermElabM Bool

full_name: Lean.Elab.Term.StructInst.DefaultFields.step
code: partial def step (struct : Struct) : M Unit 
goal: Lean.Elab.Term.StructInst.DefaultFields.M Unit

full_name: Lean.Elab.Term.StructInst.DefaultFields.propagateLoop
code: partial def propagateLoop (hierarchyDepth : Nat) (d : Nat) (struct : Struct) : M Unit 
goal: Lean.Elab.Term.StructInst.DefaultFields.M Unit

full_name: Lean.Elab.Term.StructInst.DefaultFields.propagate
code: def propagate (struct : Struct) : TermElabM Unit 
goal: Lean.Elab.TermElabM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.StructInst.0.Lean.Elab.Term.StructInst.elabStructInstAux
code: private def elabStructInstAux (stx : Syntax) (expectedType? : Option Expr) (source : Source) : TermElabM Expr 
goal: Lean.Elab.TermElabM Lean.Expr

full_name: Lean.Elab.Term.StructInst.elabStructInst
code: @[builtin_term_elab structInst] def elabStructInst : TermElab 
goal: Lean.Elab.Term.TermElab

full_name: Lean.Elab.Term.StructInst.initFn._@..lake.packages.lean4.src.lean.Lean.Elab.StructInst._hyg.13052
code: builtin_initialize
  registerTraceClass `Elab.struct
  registerTraceClass `Elab.struct.modifyOp
goal: IO Unit