File: .lake/packages/lean4/src/lean/lake/Lake/Util/Family.lean

full_name: Lake.FamilyDef
code: /--
Defines a single mapping of the **open type family** `Fam`, namely `Fam a = β`.
See the module documentation of `Lake.Util.Family` for details on what an open
type family is in Lake.
-/
class FamilyDef {α : Type u} (Fam : α → Type v) (a : α) (β : semiOutParam $ Type v) : Prop where
  family_key_eq_type : Fam a = β
goal: Prop

full_name: Lake.FamilyDef.family_key_eq_type
code: /--
Defines a single mapping of the **open type family** `Fam`, namely `Fam a = β`.
See the module documentation of `Lake.Util.Family` for details on what an open
type family is in Lake.
-/
class FamilyDef {α : Type u} (Fam : α → Type v) (a : α) (β : semiOutParam $ Type v) : Prop where
  family_key_eq_type : Fam a = β
goal: Fam a = β

full_name: Lake.FamilyOut.family_key_eq_type
code: /-- Like `FamilyDef`, but `β` is an `outParam`. -/
class FamilyOut {α : Type u} (Fam : α → Type v) (a : α) (β : outParam $ Type v) : Prop where
  family_key_eq_type : Fam a = β
goal: Fam a = β

full_name: Lake.FamilyOut
code: /-- Like `FamilyDef`, but `β` is an `outParam`. -/
class FamilyOut {α : Type u} (Fam : α → Type v) (a : α) (β : outParam $ Type v) : Prop where
  family_key_eq_type : Fam a = β
goal: Prop

full_name: Lake.instFamilyOutOfFamilyDef
code: instance [FamilyDef Fam a β] : FamilyOut Fam a β 
goal: ∀ {α : Type u_1} {Fam : α → Type u_2} {a : α} {β : Type u_2} [inst : Lake.FamilyDef Fam a β], Lake.FamilyOut Fam a β

full_name: Lake.instFamilyDef
code: /-- The constant type family -/
instance : FamilyDef (fun _ => β) a β 
goal: ∀ {α : Type u_2} {a : α}, Lake.FamilyDef (fun x => β) a β

full_name: Lake.toFamily
code: /-- Cast a datum from its individual type to its general family. -/
@[macro_inline] def toFamily [FamilyOut Fam a β] (b : β) : Fam a 
goal: {α : Type u_1} → {Fam : α → Type u_2} → {a : α} → {β : Type u_2} → [inst : Lake.FamilyOut Fam a β] → β → Fam a

full_name: Lake.ofFamily
code: /-- Cast a datum from its general family to its individual type. -/
@[macro_inline] def ofFamily [FamilyOut Fam a β] (b : Fam a) : β 
goal: {α : Type u_1} → {Fam : α → Type u_2} → {a : α} → {β : Type u_2} → [inst : Lake.FamilyOut Fam a β] → Fam a → β

full_name: Lake.«_aux_.lake_packages_lean4_src_lean_lake_Lake_Util_Family___macroRules_Lake_familyDef_1»
code: macro (name := familyDef) doc?:optional(Parser.Command.docComment)
"family_def " id:ident " : " fam:ident key:term " := " ty:term : command => do
  let tid := extractMacroScopes fam.getId |>.name
  if let (tid, _) :: _ ← Macro.resolveGlobalName tid then
    let app := Syntax.mkApp fam #[key]
    let axm := mkIdentFrom id (canonical := true) <| `_root_ ++ tid ++ id.getId
    `($[$doc?]? @[simp] axiom $axm : $app = $ty
    instance : FamilyDef $fam $key $ty := ⟨$axm⟩)
  else
    Macro.throwErrorAt fam s!"unknown family '{tid}'"
goal: Lean.Macro

full_name: Lake.familyDef
code: macro (name := familyDef) doc?:optional(Parser.Command.docComment)
"family_def " id:ident " : " fam:ident key:term " := " ty:term : command => do
  let tid := extractMacroScopes fam.getId |>.name
  if let (tid, _) :: _ ← Macro.resolveGlobalName tid then
    let app := Syntax.mkApp fam #[key]
    let axm := mkIdentFrom id (canonical := true) <| `_root_ ++ tid ++ id.getId
    `($[$doc?]? @[simp] axiom $axm : $app = $ty
    instance : FamilyDef $fam $key $ty := ⟨$axm⟩)
  else
    Macro.throwErrorAt fam s!"unknown family '{tid}'"
goal: Lean.ParserDescr