Generating views #
A view takes a term apart one level: its operator, as a constructor, and its kids. Each theory
has its own view, generated from its specification beside its constructors — or, for what no
specification describes, written by hand and registered — and def.term_view V gathers the views
of every theory the current module imports into one inductive.
gen_untyped_view% from <Spec module>generates a theory's sort-erased view, an inductive with one constructor per operator, and its viewerof?, then registers it.register_untyped_view% <View> [ctor KIND, …]registers a hand-written one.def.untyped_term_view V—def.term_view Vunderopen Cvc.Untyped— generates the aggregateV: the leaves, a variantof<Theory>per registered view, a catch-allother, one@[match_pattern]abbreviation per operator so that a pattern can skip the theory, a viewerV.of, and aTermViewinstance.
Which theories def.term_view gathers is decided by the registry, which holds exactly the views of
the modules imported: importing a theory is what makes its operators visible.
Like Cvc.Gen.Term, this module imports neither layer: every name the generated code mentions is
built with mkIdent, fully qualified.
The registry #
Equations
The registered sort-erased views, imported ones included.
Every registered sort-erased view.
Equations
- Cvc.untypedViews = do let __do_lift ← Lean.getEnv pure (Cvc.untypedViewExt.getState __do_lift)
Instances For
Emitted names #
Built with mkIdent and spliced, never written in a quotation: a name written there resolves
against this module's environment, which imports neither layer.
Equations
- Cvc.viewTermId = Lean.mkIdent `Cvc.Untyped.Term
Instances For
Equations
- Cvc.viewKidsId = Lean.mkIdent `Cvc.Untyped.Kids
Instances For
Equations
- Cvc.viewKidsOfId = Lean.mkIdent `Cvc.Untyped.Kids.of?
Instances For
Equations
- Cvc.viewGetKidsId = Lean.mkIdent `Cvc.Untyped.Term.getKids
Instances For
Equations
- Cvc.viewGetKindId = Lean.mkIdent `Cvc.Untyped.Term.getKind?
Instances For
Equations
- Cvc.viewIndexAtId = Lean.mkIdent `Cvc.Untyped.Term.indexAt?
Instances For
Equations
- Cvc.viewGetSymbolId = Lean.mkIdent `Cvc.Untyped.Term.getSymbol
Instances For
Equations
- Cvc.viewBVarId = Lean.mkIdent `Cvc.Untyped.BVar
Instances For
Equations
- Cvc.viewAsBVarId = Lean.mkIdent `Cvc.Untyped.Term.asBVar
Instances For
Equations
- Cvc.viewTermViewId = Lean.mkIdent `Cvc.Untyped.TermView
Instances For
The kinds of values: the leaves own them, so no view does.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A docstring node.
Equations
- Cvc.viewDoc s = Lean.mkNode `Lean.Parser.Command.docComment #[Lean.mkAtom "/--", Lean.mkAtom (s ++ " -/")]
Instances For
A theory's sort-erased view #
A view's constructor, and its viewer's alternative.
Equations
- Cvc.ViewCtor = (Lean.TSyntax `Lean.Parser.Command.ctor × Lean.TSyntax `Lean.Parser.Term.matchAlt)
Instances For
One entry's constructor in its theory's view, and the viewer's alternative for it.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Generates and registers a theory's sort-erased view from its specification module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Registers a hand-written sort-erased view: its inductive, and each constructor with the kind it owns. The theory is the inductive's last component.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Lists the registered sort-erased views: each theory, how many operators it takes apart, and the specification entries it has no constructor for.
Equations
- Cvc.untypedViewsStx = Lean.ParserDescr.node `Cvc.untypedViewsStx 1024 (Lean.ParserDescr.symbol "#untyped_views")
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
The sort-erased aggregate #
The aggregate's variant holding a theory's view: ofArith, which no operator's name can clash
with.
Equations
- Cvc.theoryVariant theory = Lean.Name.mkSimple (toString "of" ++ toString theory)
Instances For
Generates the sort-erased aggregate V from every registered view.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Declares V, a sort-erased term taken apart one level, over every theory imported.
V.of t takes t apart; a match on it names operators directly (.add kids, .ite c a b), the
leaves .value, .symbol and .bvar, or .other for a term no imported theory takes apart. Needs
variable [Ω] in scope.
Equations
- One or more equations did not get rendered due to their size.