Documentation

Lean.Elab.StructInst

Structure instances are of the form:

  "{" >> optional (atomic (sepBy1 termParser ", " >> " with "))
      >> manyIndent (group ((structInstFieldAbbrev <|> structInstField) >> optional ", "))
      >> optEllipsis
      >> optional (" : " >> termParser)
      >> " }"
Equations
  • One or more equations did not get rendered due to their size.

Expand field abbreviations. Example: { x, y := 0 } expands to { x := x, y := 0 }

Equations
  • One or more equations did not get rendered due to their size.
Equations
Equations
  • One or more equations did not get rendered due to their size.
inductive Lean.Elab.Term.StructInst.FieldVal (σ : Type) :
Type
Equations
Equations
  • Lean.Elab.Term.StructInst.instInhabitedField = { default := { ref := default, lhs := default, val := default, expr? := default } }
Equations

true iff all fields of the given structure are marked as default

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.
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.
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.
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.
Equations
  • One or more equations did not get rendered due to their size.
  • allStructNames : Array Lean.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
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.
Equations
  • One or more equations did not get rendered due to their size.

Reduce default value. It performs beta reduction and projections of the given structures.

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.

Structure instance. { x := e, ... } assigns e to field x, which may be inherited. If e is itself a variable called x, it can be elided: fun y => { x := 1, y }. A structure update of an existing value can be given via with: { point with x := 1 }. The structure type can be specified if not inferable: { x := 1, y := 2 : Point }.

Equations
  • One or more equations did not get rendered due to their size.