packages feed

hydra-coq (empty) → 0.17.0

raw patch · 12 files changed

+11876/−0 lines, 12 filesdep +basedep +containersdep +hydra-kernel

Dependencies added: base, containers, hydra-kernel, scientific

Files

+ CHANGELOG.md view
@@ -0,0 +1,1372 @@+# Hydra changelog++All notable changes to the Hydra project are documented in this file.++This changelog tracks changes across all Hydra implementations+(Haskell, Java, Python, Scala, TypeScript, Clojure, Common Lisp, Emacs Lisp, Scheme)+and supporting infrastructure.++The format is inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)+and [Apache TinkerPop](https://github.com/apache/tinkerpop/blob/master/CHANGELOG.asciidoc).++Pre-1.0 versions are listed below.+Untagged versions correspond to in-repository version bumps that were not pushed as Git tags or Hackage releases;+they are documented here for completeness.++---++## [0.17.0] - 2026-07-01++Major themes: first-class support for effects and I/O in the kernel, TypeScript and+Scala reaching publishable parity with the other hosts, and continued maturation of+the published-host build model.++### Highlights++- **Effects and I/O** ([#286](https://github.com/CategoricalData/hydra/issues/286),+  [#288](https://github.com/CategoricalData/hydra/issues/288),+  [#494](https://github.com/CategoricalData/hydra/issues/494)): a new `effect` variant+  on `hydra.core.Type` for representing effectful computations; new kernel modules+  `hydra.file` (`FilePath`, `FileType`, `FileStatus`, `FileExtension`), `hydra.time`+  (`Timespec`), and `hydra.error.file`; new primitive libraries `hydra.lib.effects`,+  `hydra.lib.files`, and `hydra.lib.text` with byte-level I/O; and a new+  `EffectfulTestCase` mechanism so the common test suite can exercise effectful+  primitives across hosts.+- **TypeScript is a complete implementation**+  ([#462](https://github.com/CategoricalData/hydra/issues/462)): self-hosts and passes+  the common test suite, with a per-package npm publish pipeline+  ([#492](https://github.com/CategoricalData/hydra/issues/492)).+- **Scala publishing**: per-package Maven Central publish infrastructure+  ([#491](https://github.com/CategoricalData/hydra/issues/491)).+- **Published-host build model**: published mode now compiles the kernel from the+  co-generated `dist/haskell` rather than Hackage, removing the need for a+  `haskell=local` shim ([#500](https://github.com/CategoricalData/hydra/issues/500));+  the oil-and-water principle and cold-build workflow for `dist/haskell` are documented+  ([#376](https://github.com/CategoricalData/hydra/issues/376)).+- **Kernel hygiene**: `uniqueLabel` (apostrophe suffixes) replaced by `chooseUniqueLabel`+  (numeric suffixes) in `hydra.names`+  ([#436](https://github.com/CategoricalData/hydra/issues/436)).++### Implementations++Eight hosts self-host and pass the common test suite across five families: Haskell,+Java, Python, Scala, and the four Lisp dialects (Clojure, Common Lisp, Scheme, Emacs+Lisp), with TypeScript now joining as a complete host/target. Go remains a "head bud"+(the coder still has emission bugs and the head's runtime is largely placeholder; it+does not yet host the test suite).++### New Features++- Translingual cross-reference convention for `doc` strings: doc-escape tags render to+  each host's native doc syntax (Javadoc, Haddock, Sphinx, TSDoc)+  ([#433](https://github.com/CategoricalData/hydra/issues/433)).+- Neo4j JSON-artifact validation demo, exercised across Java, Python, Haskell, and+  TypeScript ([#510](https://github.com/CategoricalData/hydra/issues/510)).++### Improvements++- The Java/Maven publish set now covers every official Hydra target language, one coder+  package per implementation family+  ([#468](https://github.com/CategoricalData/hydra/issues/468)).+- JVM Maven artifact groups are bifurcated to `net.fortytwo.hydra.java` and+  `net.fortytwo.hydra.scala`, so the Java and Scala (and future Clojure) publish sets+  never collide on coordinates+  ([#519](https://github.com/CategoricalData/hydra/issues/519)).+- Host-specific third-party integrations (the former `bindings/` tree) are folded into+  `overlay/`, unifying hand-written host-native source under one tree+  ([#511](https://github.com/CategoricalData/hydra/issues/511)).+- The coder de-parameterizes context and error types, simplifying generated coder+  signatures ([#518](https://github.com/CategoricalData/hydra/issues/518)).+- TypeScript-to-Java generation now emits the `hydra.lib.*` aggregate namespace+  interfaces (`Maps`, `Strings`, etc.)+  ([#499](https://github.com/CategoricalData/hydra/issues/499)).++---++## [0.16.1] - 2026-06-16++Major themes: the first release built by bootstrapping from previously published+packages, the first full 9 × 9 cross-implementation bootstrapping sweep, and+published-package self-containment fixes for the artifacts that bootstrap rests on.++### Highlights++- **Bootstrap from published packages**: the build links the published 0.16.0 hosts+  (Hackage / Maven Central / PyPI) and uses them to build the next version of Hydra,+  resting on 0.16.0's forward-compatibility guarantees — the published-host consume+  model with a `--local-host` shim, used for the first time in a release+  ([#370](https://github.com/CategoricalData/hydra/issues/370)). 0.16.1 still builds+  against **local** Haskell and Python hosts (`hostOverrides`), because the published+  0.16.0 artifacts it would otherwise consume are the very ones being repaired below.+- **First full 9 × 9 bootstrapping sweep** — every implementation generating every+  other; dozens of cross-host issues surfaced and fixed+  ([#409](https://github.com/CategoricalData/hydra/issues/409), ongoing).+- **Published-package self-containment**: relocate each host's hand-written runtime+  into `overlay/<lang>/hydra-kernel/` so it ships inside the published `hydra-kernel`+  artifact — Python `hydra.python.util` into the wheel+  ([#461](https://github.com/CategoricalData/hydra/issues/461),+  [#472](https://github.com/CategoricalData/hydra/issues/472)) and the Haskell+  authoring DSL + `Libraries`/`Terms` into the sdist+  ([#473](https://github.com/CategoricalData/hydra/issues/473)). Generalized to a+  uniform `overlay/ = transform(packages) + copy(overlay)` model across all hosts+  ([#434](https://github.com/CategoricalData/hydra/issues/434)).+- **Kernel self-containment via generated `hydra.lib.*` registries**: primitive+  names are derived from generated `PrimitiveDefinition` def-modules rather than+  hand-written name strings, in every host+  ([#473](https://github.com/CategoricalData/hydra/issues/473)).+- **In-memory encode/decode synthesis**: derived `hydra.{encode,decode}.*` modules+  are synthesized at build time and excluded from `dist/`, with the synthesizer (not+  inference) as the authority for their annotations+  ([#448](https://github.com/CategoricalData/hydra/issues/448),+  [#476](https://github.com/CategoricalData/hydra/issues/476)).+- **Release hardening**: Apache source-release compliance (signed source archive,+  LICENSE/NOTICE bundling, KEYS) ([#441](https://github.com/CategoricalData/hydra/issues/441)),+  per-package publish orchestrators ([#449](https://github.com/CategoricalData/hydra/issues/449)),+  and packaging-boundary verification gated in CI and at publish time+  ([#472](https://github.com/CategoricalData/hydra/issues/472)).++### New features++- Published-host consume model wired through `bin/sync.sh` for all three hosts+  (`--published-host` default, `--local-host` shim), with the version basis keyed+  off `hydra.json` and the `VERSION` file retired+  ([#370](https://github.com/CategoricalData/hydra/issues/370),+  [#347](https://github.com/CategoricalData/hydra/issues/347)).+- Java and Python coder DSL sources made the sole source of truth; the legacy+  Haskell DSL copies were deleted and cross-package references resolve by name+  ([#346](https://github.com/CategoricalData/hydra/issues/346)).+- Per-host `verify-distribution.sh` self-containment gates (Haskell stages the+  per-package trio and `stack build`s it; Python installs the wheels into an+  isolated venv and imports the kernel modules; Java resolves the published jars+  from an offline consumer), run in CI and as a hard gate in `bin/prepare-release.sh`+  ([#472](https://github.com/CategoricalData/hydra/issues/472)).+- Apache-compliant canonical source archive: signed + checksummed `git archive`+  tarball as the release of record, root `NOTICE`, `KEYS`, and a release-verify CI+  workflow ([#441](https://github.com/CategoricalData/hydra/issues/441)).+- Per-package publish orchestrators `publish-maven.sh` / `publish-pypi.sh` with+  dependency-closure and leaves-first ordering checks+  ([#449](https://github.com/CategoricalData/hydra/issues/449)).+- `hydra-typescript` published as a target Java/Maven + PyPI artifact+  ([#468](https://github.com/CategoricalData/hydra/issues/468)).+- Java coder emits a fluent builder for every generated record type+  ([#465](https://github.com/CategoricalData/hydra/issues/465)); Python coder emits+  per-field `with_<field>` copy-update methods and a fluent builder+  ([#466](https://github.com/CategoricalData/hydra/issues/466)).++### Improvements++- Drop the vestigial `InferenceContext` parameter from the `Primitive.implementation`+  carrier across all hosts; add a graph-free `funT` coder and six `lists` default+  implementations ([#446](https://github.com/CategoricalData/hydra/issues/446)).+- Derive package routing from declared modules; split derived generation into broad+  `mainDslModules` and scoped `mainEncodingModules`+  ([#474](https://github.com/CategoricalData/hydra/issues/474),+  [#475](https://github.com/CategoricalData/hydra/issues/475)).+- Hash JSON content into the per-package input digest; add `digest-check+  refresh-input` and a CI guard that force-regenerates and diffs+  `dist/haskell/hydra-{java,python}` ([#469](https://github.com/CategoricalData/hydra/issues/469)).+- Per-package inference seeds downstream packages from each package's full universe+  while inferring only write targets, fixing `hydra-scala` inference within the CI+  heap budget; declare the `hydra-java` dependency in `hydra-scala` for cold+  ordering ([#470](https://github.com/CategoricalData/hydra/issues/470)).+- Remove the vestigial `Lib/Defaults` registry and empty `defaultLibModules`+  manifest field from all hosts ([#437](https://github.com/CategoricalData/hydra/issues/437)).+- Bundle LICENSE + NOTICE into Java jars (`META-INF`) and Python wheels+  (`dist-info`); declare Apache-2.0 in the Scala build+  ([#441](https://github.com/CategoricalData/hydra/issues/441)).+- Mark lazy parameters on the Scala and Common Lisp primitive registries so eager+  coders thunk correctly ([#453](https://github.com/CategoricalData/hydra/issues/453),+  [#477](https://github.com/CategoricalData/hydra/issues/477),+  [#425](https://github.com/CategoricalData/hydra/issues/425)).+- Staging-loop WIP-commit gate to keep `WIP:` commits off `origin/main`+  ([#466](https://github.com/CategoricalData/hydra/issues/466)).++### Bug fixes++- **Python wheel self-containment**: the `hydra-kernel` wheel now ships+  `hydra.python.util`; gated by a packaging-boundary smoke test in CI and+  `publish-pypi.sh` ([#472](https://github.com/CategoricalData/hydra/issues/472),+  [#461](https://github.com/CategoricalData/hydra/issues/461)).+- **Haskell sdist self-containment**: track the generated `Hydra/Dsl/Terms.hs`+  (was gitignored) so the committed dist exports `ToPrimName`, fixing the cold+  build of the published `hydra-kernel`+  ([#473](https://github.com/CategoricalData/hydra/issues/473)).+- Decode synthesizer threads the fully-applied result type into wrap/record/union+  decoder bodies, so derived decoders emit `DataRow<v>` rather than raw `DataRow`,+  fixing Java and Scala generic decode compilation+  ([#476](https://github.com/CategoricalData/hydra/issues/476)).+- Scala coder emits explicit type arguments for polymorphic non-primitive+  references under a type application (e.g. `requireField`), fixing `Any`-inference+  of curried decoder lambda parameters in `decode/typed`+  ([#434](https://github.com/CategoricalData/hydra/issues/434)).+- Common Lisp and Emacs Lisp: move the hand-written runtime to a dialect-tier path+  so it no longer collides with the generated `hydra.lib.*` def-modules+  ([#434](https://github.com/CategoricalData/hydra/issues/434)).+- Python coder uses the binding `TypeScheme` as the authoritative source for+  parameter and return types ([#488](https://github.com/CategoricalData/hydra/issues/488));+  fixes a duplicate `self` parameter in builders+  ([#478](https://github.com/CategoricalData/hydra/issues/478)).+- Sort term definitions by name in source-file generation so non-Haskell hosts emit+  deterministic alphabetical Haskell output (host-independent of `Maps.elems`+  iteration order) ([#489](https://github.com/CategoricalData/hydra/issues/489)).+- Java coder serializes the `static` method modifier (previously a non-exhaustive+  case) ([#465](https://github.com/CategoricalData/hydra/issues/465)); JavaDoc+  `@link`/`@param` sanitization for strict doclint+  ([#449](https://github.com/CategoricalData/hydra/issues/449)).+- Scala host writer appends a trailing newline when missing, fixing a Lisp-target+  byte mismatch ([#463](https://github.com/CategoricalData/hydra/issues/463)).+- Clojure host: silent wrapping `bigint_to_int{8,16,32,64}` casts per the kernel+  contract ([#483](https://github.com/CategoricalData/hydra/issues/483)); load-order+  and `--kernel-only` filter fixes after kernel renames+  ([#425](https://github.com/CategoricalData/hydra/issues/425)); load the+  `hydra-haskell` baseline for Clojure→Haskell rebuilds+  ([#487](https://github.com/CategoricalData/hydra/issues/487),+  [#460](https://github.com/CategoricalData/hydra/issues/460)).+- Lisp-dialect bootstrap fixes: emit JSON object entries as 2-element `Pair` lists+  rather than dotted cons ([#452](https://github.com/CategoricalData/hydra/issues/452),+  also fixing [#16](https://github.com/CategoricalData/hydra/issues/16)); read+  module names via the correct struct accessor+  ([#471](https://github.com/CategoricalData/hydra/issues/471)); drop stale+  surplus flag arguments from `generate-source-files` calls+  ([#457](https://github.com/CategoricalData/hydra/issues/457),+  [#458](https://github.com/CategoricalData/hydra/issues/458),+  [#464](https://github.com/CategoricalData/hydra/issues/464)); rename eta-wrapped+  projection/unwrap parameters to avoid kernel shadowing+  ([#428](https://github.com/CategoricalData/hydra/issues/428)); propagate a+  non-zero exit from the Scheme test runner on failures and fix Scheme float+  scientific-notation formatting for `|x| >= 1e7`+  ([#447](https://github.com/CategoricalData/hydra/issues/447)).+- Cross-host target dispatch: Common Lisp and Clojure hosts dispatch Scala and+  TypeScript targets ([#482](https://github.com/CategoricalData/hydra/issues/482),+  [#483](https://github.com/CategoricalData/hydra/issues/483)); Scala/Java host+  target-dispatch completions ([#5](https://github.com/CategoricalData/hydra/issues/5),+  [#7](https://github.com/CategoricalData/hydra/issues/7),+  [#17](https://github.com/CategoricalData/hydra/issues/17)).+- TypeScript test runtime reads the kernel JSON field names `body`/`signature`+  (not legacy `term`/`typeScheme`); `lists.nub` dedups by canonical JSON+  ([#485](https://github.com/CategoricalData/hydra/issues/485)).+- Sync robustness: always reassemble `dist/python` under `HYDRA_IN_SYNC` to heal+  partial-dist state ([#480](https://github.com/CategoricalData/hydra/issues/480));+  persist the run dir on bootstrap prep-phase failures+  ([#481](https://github.com/CategoricalData/hydra/issues/481)); complete per-host+  static deps so the bootstrap demo finds fresh dist+  ([#445](https://github.com/CategoricalData/hydra/issues/445)).+- Pin the Python target test interpreter to Python ≥ 3.12+  ([#486](https://github.com/CategoricalData/hydra/issues/486)); Emacs Lisp / Scheme+  target test-runner re-copy robustness+  ([#456](https://github.com/CategoricalData/hydra/issues/456)).+- JavaDoc Pages publish rewritten to build a combined site from the CI-generated+  `dist/java/` artifact, fixing the failure mode where `pages.yml` ran against a+  bare checkout with no `dist/java/` present+  ([#450](https://github.com/CategoricalData/hydra/issues/450)).++### Documentation++- Document the `overlay/` self-containment model, the published-host consume model+  for all three hosts, the `hydra.json` version / host-version basis, and a+  migration-shims recipe ([#434](https://github.com/CategoricalData/hydra/issues/434),+  [#370](https://github.com/CategoricalData/hydra/issues/370),+  [#347](https://github.com/CategoricalData/hydra/issues/347)).+- Document the kernel self-containment / `hydra.lib.*` def-module model and the+  derived-module no-inference invariant+  ([#473](https://github.com/CategoricalData/hydra/issues/473),+  [#466](https://github.com/CategoricalData/hydra/issues/466)); generated Java and+  Python record builders documented in the DSL guides+  ([#465](https://github.com/CategoricalData/hydra/issues/465),+  [#466](https://github.com/CategoricalData/hydra/issues/466)).+- Use absolute GitHub URLs in package READMEs so links resolve when published+  standalone ([#454](https://github.com/CategoricalData/hydra/issues/454)); bundle a+  README into each Python package dir for sdist metadata+  ([#418](https://github.com/CategoricalData/hydra/issues/418)).++---++## [0.16.0] - 2026-06-09++Major themes: primitive-metadata reification, self-hosting coder DSLs with all+eight hosts passing the common test suite, finalized `hydra.packaging`, and a+deep kernel-vocabulary cleanup.++### Highlights++- **`PrimitiveDefinition` and per-namespace registry modules** with host-independent+  specs for every standard-library primitive ([#156](https://github.com/CategoricalData/hydra/issues/156), [#319](https://github.com/CategoricalData/hydra/issues/319)).+- **Self-hosting coder DSLs; all eight hosts pass the common test suite**, including+  the completed TypeScript head ([#344](https://github.com/CategoricalData/hydra/issues/344), [#126](https://github.com/CategoricalData/hydra/issues/126)).+- **Finalized `hydra.packaging`** and a unified `Module.dependencies` field ([#369](https://github.com/CategoricalData/hydra/issues/369), [#354](https://github.com/CategoricalData/hydra/issues/354)).+- **Kernel-vocabulary cleanup**: `maybe`→`optional` across kernel and hosts, plus+  order-preserving JSON objects ([#401](https://github.com/CategoricalData/hydra/issues/401), [#398](https://github.com/CategoricalData/hydra/issues/398)).++### New features++- Reify `PrimitiveDefinition` in `hydra.packaging` with per-namespace `hydra.lib.<sub>` registries ([#156](https://github.com/CategoricalData/hydra/issues/156)).+- Host-independent `comments` specifications for all standard-library primitives ([#319](https://github.com/CategoricalData/hydra/issues/319)).+- Kernel-oriented style checks in `hydra.validate.*` ([#321](https://github.com/CategoricalData/hydra/issues/321), [#351](https://github.com/CategoricalData/hydra/issues/351), [#352](https://github.com/CategoricalData/hydra/issues/352)), on a reshaped validation API ([#320](https://github.com/CategoricalData/hydra/issues/320)).+- Promote the JSON Schema coder to a full DSL coder ([#350](https://github.com/CategoricalData/hydra/issues/350)).+- Transpose coder sources into host-native DSLs for self-hosting ([#344](https://github.com/CategoricalData/hydra/issues/344), [#358](https://github.com/CategoricalData/hydra/issues/358)).+- `Term`-typed annotations replacing `Map<Name, Term>` ([#386](https://github.com/CategoricalData/hydra/issues/386)).+- Language-specific EDSL features on the kernel `Language` ([#233](https://github.com/CategoricalData/hydra/issues/233)).+- Primitive-metadata-driven laziness in eager coders ([#391](https://github.com/CategoricalData/hydra/issues/391)).+- `/test` skill and `bin/test.sh` for target-language test validation ([#387](https://github.com/CategoricalData/hydra/issues/387)).+- Automatic differentiation: a `grad` transform ([#324](https://github.com/CategoricalData/hydra/issues/324)).+- `hydra.show.error.pg` for `InvalidGraphError` ([#374](https://github.com/CategoricalData/hydra/issues/374)).++### Improvements++- Finalize `hydra.packaging`: `Binding`→`TypeDefinition`, `Module`/`Package` `comments`, `moduleName` cleanup ([#369](https://github.com/CategoricalData/hydra/issues/369), [#396](https://github.com/CategoricalData/hydra/issues/396), [#402](https://github.com/CategoricalData/hydra/issues/402), [#404](https://github.com/CategoricalData/hydra/issues/404)).+- Merge `Module.termDependencies`/`typeDependencies` into one `dependencies` field ([#354](https://github.com/CategoricalData/hydra/issues/354)).+- Resolve the `maybe`/`optional` ambiguity across kernel and all hosts ([#401](https://github.com/CategoricalData/hydra/issues/401)).+- Order-preserving JSON objects; order-sensitive `Value` equality ([#398](https://github.com/CategoricalData/hydra/issues/398)).+- Rename `Namespace`→`ModuleName` ([#316](https://github.com/CategoricalData/hydra/issues/316)) and the phantom DSL types to `Typed*` ([#397](https://github.com/CategoricalData/hydra/issues/397)).+- Move from a type-class enum to type-class names ([#275](https://github.com/CategoricalData/hydra/issues/275)).+- Repackage "eval lib" modules as kernel lib modules; promote remaining sources ([#260](https://github.com/CategoricalData/hydra/issues/260), [#355](https://github.com/CategoricalData/hydra/issues/355), [#356](https://github.com/CategoricalData/hydra/issues/356)).+- Reshape `hydra.context` into `InferenceContext` ([#368](https://github.com/CategoricalData/hydra/issues/368)).+- Streamline the Haskell, Java, Python, and Scala syntax models, re-pinning Java to SE 21 and Python to the 3.14 PEG grammar ([#297](https://github.com/CategoricalData/hydra/issues/297)).+- Adopt persistent immutable collections across hosts ([#359](https://github.com/CategoricalData/hydra/issues/359), [#360](https://github.com/CategoricalData/hydra/issues/360), [#361](https://github.com/CategoricalData/hydra/issues/361), [#362](https://github.com/CategoricalData/hydra/issues/362)).+- Migrate underscored kernel definition names to camelCase ([#348](https://github.com/CategoricalData/hydra/issues/348)).+- Tidy qualified/unqualified imports in the Haskell DSL sources ([#308](https://github.com/CategoricalData/hydra/issues/308)).+- Eliminate the `Hydra.Module.Compat` shim ([#315](https://github.com/CategoricalData/hydra/issues/315)).+- Homogenize writer conventions across target languages ([#339](https://github.com/CategoricalData/hydra/issues/339)).+- Disambiguate format-version field naming across JSON metadata ([#412](https://github.com/CategoricalData/hydra/issues/412)).+- Per-package DSL→JSON build with per-package incremental inference ([#381](https://github.com/CategoricalData/hydra/issues/381), [#395](https://github.com/CategoricalData/hydra/issues/395)).+- Prune stale `dist/` outputs; self-heal digests; exclude digests from VCS; reconcile drift; fail loud ([#357](https://github.com/CategoricalData/hydra/issues/357), [#393](https://github.com/CategoricalData/hydra/issues/393), [#405](https://github.com/CategoricalData/hydra/issues/405), [#378](https://github.com/CategoricalData/hydra/issues/378), [#379](https://github.com/CategoricalData/hydra/issues/379), [#392](https://github.com/CategoricalData/hydra/issues/392), [#414](https://github.com/CategoricalData/hydra/issues/414)).+- Accept all valid (host, target) pairs in the generation drivers ([#421](https://github.com/CategoricalData/hydra/issues/421)).+- Move Gradle build infrastructure into `heads/java/`; remove top-level `pixi.toml` ([#384](https://github.com/CategoricalData/hydra/issues/384), [#385](https://github.com/CategoricalData/hydra/issues/385)).+- Eliminate post-generation test patches; fix loader/runner kludges; re-enable test timing ([#307](https://github.com/CategoricalData/hydra/issues/307), [#309](https://github.com/CategoricalData/hydra/issues/309), [#311](https://github.com/CategoricalData/hydra/issues/311)).+- Performance/benchmarks and usability assessments ([#277](https://github.com/CategoricalData/hydra/issues/277), [#283](https://github.com/CategoricalData/hydra/issues/283)).+- Split the Hackage distribution into per-package distributions ([#418](https://github.com/CategoricalData/hydra/issues/418)).++### Bug fixes++- Encode `uint32` JSON literals as numbers, not strings ([#431](https://github.com/CategoricalData/hydra/issues/431)).+- Satisfy or suppress warnings in generated Java ([#349](https://github.com/CategoricalData/hydra/issues/349)).+- Restore JSON parser test cases (polymorphic case handling, ordering fallback) ([#336](https://github.com/CategoricalData/hydra/issues/336)).+- Keep annotations through `termAlternatives`/`typeAlternatives` adaptation ([#353](https://github.com/CategoricalData/hydra/issues/353)).+- Scala host decodes module JSON containing term definitions ([#342](https://github.com/CategoricalData/hydra/issues/342)).+- Java coder: fix exponential `let`-bound `cases` cost ([#372](https://github.com/CategoricalData/hydra/issues/372)) and explicit type args on `PersistentMap.ofEntries` ([#394](https://github.com/CategoricalData/hydra/issues/394)).+- Python-host codegen: drop extra `pyStringToPyStrings` wrapping ([#367](https://github.com/CategoricalData/hydra/issues/367)).+- `escape_literal_char` no longer mangles RDF triples ([#363](https://github.com/CategoricalData/hydra/issues/363)).+- Sync robustness: stale coder JSON, omitted native modules, dead helper, bad source dirs ([#406](https://github.com/CategoricalData/hydra/issues/406), [#400](https://github.com/CategoricalData/hydra/issues/400), [#411](https://github.com/CategoricalData/hydra/issues/411), [#408](https://github.com/CategoricalData/hydra/issues/408)).+- Cross-host self-hosting fixes (Scala, TypeScript, and the four Lisp dialects) ([#422](https://github.com/CategoricalData/hydra/issues/422), [#423](https://github.com/CategoricalData/hydra/issues/423), [#424](https://github.com/CategoricalData/hydra/issues/424), [#429](https://github.com/CategoricalData/hydra/issues/429), [#444](https://github.com/CategoricalData/hydra/issues/444), [#366](https://github.com/CategoricalData/hydra/issues/366), [#389](https://github.com/CategoricalData/hydra/issues/389), [#407](https://github.com/CategoricalData/hydra/issues/407), [#425](https://github.com/CategoricalData/hydra/issues/425), [#426](https://github.com/CategoricalData/hydra/issues/426), [#427](https://github.com/CategoricalData/hydra/issues/427), [#432](https://github.com/CategoricalData/hydra/issues/432), [#438](https://github.com/CategoricalData/hydra/issues/438), [#439](https://github.com/CategoricalData/hydra/issues/439), [#443](https://github.com/CategoricalData/hydra/issues/443)).++### Removed++- Removed the `bigfloat` literal type from `FloatType` and `FloatValue` ([#330](https://github.com/CategoricalData/hydra/issues/330)).+  Arbitrary-precision floating-point values were inconsistently supported+  across host languages (Java/Scala in particular lacked a true IEEE 754+  arbitrary-precision implementation), and nothing in the codebase relied on+  them. `FloatType` and `FloatValue` now have only `float32` and `float64`+  variants. Removed library primitives: `bigfloatToBigint`, `bigfloatToFloat32`,+  `bigfloatToFloat64`, `bigintToBigfloat`, `float32ToBigfloat`,+  `float64ToBigfloat`, `readBigfloat`, `showBigfloat`, `roundBigfloat`. New+  primitives `float32ToFloat64` and `float64ToFloat32` (the latter lossy)+  replace the removed bigfloat-routed conversions.+- Removed `heads/haskell/bin/assemble-hackage-sdist.sh` ([#418](https://github.com/CategoricalData/hydra/issues/418)), the 0.15-era+  bridge that flattened the multi-source-dir Haskell head into one self-contained+  `hydra` sdist. Superseded by the per-package assembler (see Improvements).++### Documentation++- Comprehensive documentation refresh for 0.16 ([#383](https://github.com/CategoricalData/hydra/issues/383))+  spanning nine tracks across READMEs, `docs/`, the wiki, CLAUDE.md, and+  in-source kernel comments.+- New `docs/json-format.md` reference describing the canonical JSON wire format+  (tagged-union duality, optional-field rules, IEEE 754 sentinels, integer+  threshold).+- New wiki pages: `Design` (rationale behind each major choice) and `Inference`+  (HM type inference with class constraints).+- Cross-checked every prose doc against current code; corrected drift in+  primitive-checking sections of `docs/recipes/maintenance.md`, the `Primitive`+  shape in `docs/implementation.md` and `docs/recipes/adding-primitives.md`,+  and the build-system narrative.+- Wove motivation ("the why") through the existing doc surface rather than+  collecting it into separately-titled sidebars; landed an inference-overview+  centerpiece on the wiki ([#377](https://github.com/CategoricalData/hydra/issues/377)).+- Aligned doc vocabulary with the LambdaGraph paper and the literature review+  for the design space Hydra inhabits.+- Net-new READMEs for `packages/hydra-kernel`, `packages/hydra-ext`,+  `packages/hydra-coq`, and `packages/hydra-wasm`; top-level `README.md`+  now carries a canonical packages table.+- Audited and refreshed the Claude surface: CLAUDE.md "Where to look up X"+  table extended with rows for `docs/getting-started.md`, `docs/json-format.md`,+  and the `Design` / `Inference` wiki pages; hard-rules block reordered by+  violation frequency; `claude/pitfalls.md` superseded entries folded into+  `docs/troubleshooting.md` / recipes.+- Project-descriptor strings reviewed and aligned across 24 build / packaging+  files (Hackage synopsis, Maven Central description, PyPI / conda-forge+  classifiers, Hydra-format `package.json` files).+- `docs/index.html` (the GitHub Pages landing page) refreshed with audience+  hops into wiki Concepts / Design, `docs/getting-started.md`, and the GitHub+  repo, plus the full published-artifact list across Hackage, Maven Central,+  PyPI, and conda-forge.+- In-source kernel-code rationale comments added at key Sources sites covering+  injection / pair / either / unit-void duality, error taxonomy, variant+  records, inference-context threading, validation profiles, reduction state,+  lexical filters, name mangling, scoping, variable handling, defaults+  integration, and Tarjan SCC choice rationale. JSON encode/decode modules+  cross-reference `docs/json-format.md`.+- Filed `Primitive.implementation` carrier-simplification follow-up+  ([#446](https://github.com/CategoricalData/hydra/issues/446))+  to drop the unused `InferenceContext` and `Graph` parameters once the+  `Lib/Defaults/` integration ([#437](https://github.com/CategoricalData/hydra/issues/437))+  lands.++---++## [0.15.0] - 2026-04-29++A structural-cleanup release.+The repository is reorganized into a three-tree+`packages/` (DSL sources) / `heads/` (per-host runtime) / `dist/` (generated output)+layout ([#290](https://github.com/CategoricalData/hydra/issues/290)), the kernel is simplified ([#251](https://github.com/CategoricalData/hydra/issues/251), [#292](https://github.com/CategoricalData/hydra/issues/292), [#332](https://github.com/CategoricalData/hydra/issues/332)), and Java + Python now+ship as per-package publishable artifacts on Maven Central / PyPI / conda-forge+([#305](https://github.com/CategoricalData/hydra/issues/305)).+Incremental, content-hash-based caches accelerate the sync pipeline ([#247](https://github.com/CategoricalData/hydra/issues/247)).+Three new generation-only targets — Coq ([#326](https://github.com/CategoricalData/hydra/issues/326)), WebAssembly ([#325](https://github.com/CategoricalData/hydra/issues/325)), and an+automatic-differentiation demo ([#324](https://github.com/CategoricalData/hydra/issues/324)) — are in progress as Claude collaborations.++### Highlights++- **Three-tree repository layout**: `packages/` (DSL), `heads/` (host runtime),+  `dist/` (generated) ([#290](https://github.com/CategoricalData/hydra/issues/290)).+- **Per-package distributions** for Java (4 Maven artifacts) and Python (5 wheels):+  `hydra-kernel`, `hydra-pg`, `hydra-rdf`, `hydra-{java,python}`, plus `hydra-ext`+  on PyPI ([#305](https://github.com/CategoricalData/hydra/issues/305)).+- **Kernel simplifications**: `Function`/`Elimination` removed ([#332](https://github.com/CategoricalData/hydra/issues/332)),+  `FunctionPrimitive` removed ([#251](https://github.com/CategoricalData/hydra/issues/251)), `Hydra.Ext.*` prefix retired ([#331](https://github.com/CategoricalData/hydra/issues/331)),+  `Context` error wrapper gone ([#292](https://github.com/CategoricalData/hydra/issues/292)).+- **Incremental caches** across the sync pipeline; ~70x speedup on no-op resync ([#247](https://github.com/CategoricalData/hydra/issues/247)).+- **JSON kernel format v1** with formal wire-format spec and four-field rename ([#343](https://github.com/CategoricalData/hydra/issues/343)).+- **Three new generation-only targets** (in progress): Coq ([#326](https://github.com/CategoricalData/hydra/issues/326)), WebAssembly ([#325](https://github.com/CategoricalData/hydra/issues/325)),+  automatic-differentiation demo ([#324](https://github.com/CategoricalData/hydra/issues/324)).++### New features++- Per-package distributions ([#305](https://github.com/CategoricalData/hydra/issues/305)): standalone Maven / PyPI / conda-forge builds,+  generated `build.gradle` / `pyproject.toml` per package, transitive dep resolution.+- JSON kernel format v1 ([#343](https://github.com/CategoricalData/hydra/issues/343)): formal spec at `docs/json-format.md`,+  four-field rename to `typeScheme`, `Module` field reorder, `formatVersion` stamp.+- `decimal` literal type in the kernel ([#338](https://github.com/CategoricalData/hydra/issues/338)) across all hosts.+- Type-directed JSON encoder with idiomatic optional encoding ([#314](https://github.com/CategoricalData/hydra/issues/314), [#318](https://github.com/CategoricalData/hydra/issues/318)).+- Incremental type inference plus content-hash caches ([#247](https://github.com/CategoricalData/hydra/issues/247)).+- Coq generation target ([#326](https://github.com/CategoricalData/hydra/issues/326), in progress): `hydra-coq` package, 131/131 `.v` files pass `coqc`.+- WebAssembly target ([#325](https://github.com/CategoricalData/hydra/issues/325), in progress): `hydra-wasm` package, M4 closure mechanism.+- Automatic-differentiation demo ([#324](https://github.com/CategoricalData/hydra/issues/324), in progress): symbolic source-to-source.+- `hydra.show.error` module ([#265](https://github.com/CategoricalData/hydra/issues/265)): consolidated error-message builders.+- `hydra.lib.maybes.toList` primitive ([#257](https://github.com/CategoricalData/hydra/issues/257)).+- NaN / Inf round-tripping through JSON and per-language serdes ([#312](https://github.com/CategoricalData/hydra/issues/312), [#318](https://github.com/CategoricalData/hydra/issues/318), [#330](https://github.com/CategoricalData/hydra/issues/330)).+- Typeclass inference test group ([#274](https://github.com/CategoricalData/hydra/issues/274)).+- Term and type linters ([#232](https://github.com/CategoricalData/hydra/issues/232)).+- Validation for modules and graphs ([#155](https://github.com/CategoricalData/hydra/issues/155)).+- User-defined-function (UDF) support and DSL-vs-primitive overrides+  ([#62](https://github.com/CategoricalData/hydra/issues/62), [#63](https://github.com/CategoricalData/hydra/issues/63), [#102](https://github.com/CategoricalData/hydra/issues/102), [#158](https://github.com/CategoricalData/hydra/issues/158)).+- Stale-source detection across sync entrypoints ([#228](https://github.com/CategoricalData/hydra/issues/228)).++### Improvements++- Sync infrastructure: matrix tool, per-package orchestrator, per-language wrappers ([#290](https://github.com/CategoricalData/hydra/issues/290)).+- TestGraph post-generation patches eliminated; DSL emits `TestEnv` refs directly.+- Minimized standard imports in generated Haskell ([#161](https://github.com/CategoricalData/hydra/issues/161)); improved auto-aliases ([#322](https://github.com/CategoricalData/hydra/issues/322)).+- Removed kernel term dependencies from the interpreter ([#257](https://github.com/CategoricalData/hydra/issues/257)).+- Removed `Graph` and `Context` arguments from primitive implementations ([#266](https://github.com/CategoricalData/hydra/issues/266)).+- Refactored kernel term modules: split rewriting/schemas, renamed show.meta → codegen,+  moved `Coder` to `coders`, merged `extract.helpers` ([#221](https://github.com/CategoricalData/hydra/issues/221)).+- Removed Aeson and HsYAML dependencies; YAML coder moved to `hydra-ext` ([#261](https://github.com/CategoricalData/hydra/issues/261)).+- Lisp recursive let bindings via SCC ([#341](https://github.com/CategoricalData/hydra/issues/341)); parenthesis cleanup ([#84](https://github.com/CategoricalData/hydra/issues/84)).+- Everything-to-everything bootstrapping demo ([#254](https://github.com/CategoricalData/hydra/issues/254)).+- Re-enabled skipped Python tests; `disabledForPython` retired ([#263](https://github.com/CategoricalData/hydra/issues/263)).+- Promoted host-specific code in `packages/` into per-head locations ([#337](https://github.com/CategoricalData/hydra/issues/337)).+- Migrated `hydra.common` Java module out ([#10](https://github.com/CategoricalData/hydra/issues/10)).+- Test infrastructure unification under `UniversalTestCase` ([#246](https://github.com/CategoricalData/hydra/issues/246)).+- Default property graph → RDF mapping ([#296](https://github.com/CategoricalData/hydra/issues/296)).+- 13 unsafe partial primitives replaced with `Maybe`-returning alternatives ([#201](https://github.com/CategoricalData/hydra/issues/201)).+- Java generated code uses standard `java.util` collection interfaces ([#313](https://github.com/CategoricalData/hydra/issues/313)).+- `Term.union` renamed to `Term.inject` ([#334](https://github.com/CategoricalData/hydra/issues/334)).+- Inconsistencies in domain DSLs cleaned up ([#219](https://github.com/CategoricalData/hydra/issues/219)).+- Coder packages moved out of hydra-haskell ([#182](https://github.com/CategoricalData/hydra/issues/182)).+- Java package-naming scheme revised ([#223](https://github.com/CategoricalData/hydra/issues/223)).+- Decimal used (instead of bigfloat) for JSON numbers ([#340](https://github.com/CategoricalData/hydra/issues/340)).+- Hydra kernel moved out of hydra-haskell ([#282](https://github.com/CategoricalData/hydra/issues/282)).++### Bug fixes++- `substInTypeScheme` capture-unsafe substitution under nested forall binders.+- Java `Float64` arithmetic primitives corrected for current `PrimitiveFunction` API.+- Clojure decimal handling: value-based equality, `BigInteger` return from `decimal_to_bigint`.+- Scheme runtime R7RS imports for `sets.scm` / `maps.scm` / `eithers.map_set`.+- Python coder defaults corrected from `Py.Name` to `Py.Expression`.+- Scala host JSON-decode failure on modules containing term definitions ([#342](https://github.com/CategoricalData/hydra/issues/342)).+- Lisp coder mutually-recursive let bindings for Clojure ([#341](https://github.com/CategoricalData/hydra/issues/341)).++### Documentation++- Documentation refresh for the 0.15 packaging restructure ([#290](https://github.com/CategoricalData/hydra/issues/290), [#331](https://github.com/CategoricalData/hydra/issues/331)); CLAUDE.md,+  READMEs, recipes, demos, and seven wiki pages updated.+- Code-generation recipe rewritten for the per-package dist layout ([#282](https://github.com/CategoricalData/hydra/issues/282)).+- New `maintenance.md` recipe consolidates non-source-file scans, stale generated+  detection, design-violation checks, and freshness checks.+- Documentation style guide added at `docs/documentation-style-guide.md`.+- Cross-worktree messaging protocol documented in CLAUDE.md.+- Decimal type documented in the lexicon and per-language READMEs ([#338](https://github.com/CategoricalData/hydra/issues/338)).+- JSON encoding format docs updated for idiomatic optional encoding ([#314](https://github.com/CategoricalData/hydra/issues/314)).++---++## [0.14.1] - 2026-03-30++Patch release.+Regenerates all implementations after a fix to the group eval primitive ([#281](https://github.com/CategoricalData/hydra/issues/281)),+and relocates the property-graph and RDF/SHACL "ext" modules into hydra-java and hydra-python.++### Improvements++- Moved PG, RDF, and SHACL ext modules from hydra-ext into hydra-java and hydra-python.++### Bug fixes++- Group eval primitive fix; all targets regenerated ([#281](https://github.com/CategoricalData/hydra/issues/281)).+- JavaDoc HTML-entity escaping in generated `DestructuringPattern.java`.++---++## [0.14.0] - 2026-03-29++Major release adding four new complete Hydra implementations — Scala ([#273](https://github.com/CategoricalData/hydra/issues/273)),+Clojure ([#278](https://github.com/CategoricalData/hydra/issues/278)), Common Lisp, and Scheme — bringing the total to seven bootstrapping hosts+(plus Emacs Lisp, which passes the test suite but does not yet participate in bootstrapping).+Also includes kernel simplifications, an Avro bidirectional coder ([#301](https://github.com/CategoricalData/hydra/issues/301)),+eval primitives ([#281](https://github.com/CategoricalData/hydra/issues/281)), new demos, and significant performance work on the Scheme host.++### Highlights++- **Four new complete implementations**: Hydra-Scala ([#273](https://github.com/CategoricalData/hydra/issues/273)), Hydra-Clojure ([#278](https://github.com/CategoricalData/hydra/issues/278)),+  Hydra-Common Lisp, and Hydra-Scheme pass the common test suite and can serve as+  bootstrapping hosts.+  The four Lisp dialects share a single coder and serializer.+- **Kernel simplifications**: removed `RowType`/`WrappedType` ([#82](https://github.com/CategoricalData/hydra/issues/82)),+  unified `Graph`/`TypeContext`/`InferenceContext` ([#192](https://github.com/CategoricalData/hydra/issues/192)),+  replaced `Module.elements` with `Module.definitions` ([#214](https://github.com/CategoricalData/hydra/issues/214)),+  consolidated error types ([#268](https://github.com/CategoricalData/hydra/issues/268)), and promoted all staging modules to DSL sources ([#267](https://github.com/CategoricalData/hydra/issues/267)).+- **Avro bidirectional coder** ([#301](https://github.com/CategoricalData/hydra/issues/301)) with property graph pipeline demo.+- **Scheme bootstrap performance**: 58 minutes → 5.7 minutes via O(1) vhash data structures+  and IEEE 754 float precision fixes.++### Breaking changes++- Removed legacy adapter framework; replaced by the staging-promoted variant ([#236](https://github.com/CategoricalData/hydra/issues/236), [#295](https://github.com/CategoricalData/hydra/issues/295)).+- Replaced legacy Flow monad with Either ([#245](https://github.com/CategoricalData/hydra/issues/245)).+- Removed `Module.elements`; use `Module.definitions` ([#214](https://github.com/CategoricalData/hydra/issues/214)).+- Removed `RowType` and `WrappedType` ([#82](https://github.com/CategoricalData/hydra/issues/82)).+- Renamed `hydra.accessors` to `hydra.paths` ([#271](https://github.com/CategoricalData/hydra/issues/271)).+- Renamed `hydra.tarjan` and merged into `hydra.sorting` ([#220](https://github.com/CategoricalData/hydra/issues/220)).+- Merged `hydra.constraints` into `hydra.query` ([#272](https://github.com/CategoricalData/hydra/issues/272)).+- Moved `hydra.workflow` to hydra-ext ([#270](https://github.com/CategoricalData/hydra/issues/270)).+- Consolidated `hydra.compute` into `hydra.util` ([#269](https://github.com/CategoricalData/hydra/issues/269)).+- Removed `hydra.describe` ([#216](https://github.com/CategoricalData/hydra/issues/216)) and types from `hydra.mantle` ([#217](https://github.com/CategoricalData/hydra/issues/217)).+- Replaced `OtherError` with task-specific error types ([#268](https://github.com/CategoricalData/hydra/issues/268)).+- Java: lowered minimum Java version to 11 ([#249](https://github.com/CategoricalData/hydra/issues/249)).+- Java: `Pair` replaces `Tuple2` ([#252](https://github.com/CategoricalData/hydra/issues/252)); `Comparable` implemented for generated classes ([#131](https://github.com/CategoricalData/hydra/issues/131)).++### New features++- Hydra-Scala ([#273](https://github.com/CategoricalData/hydra/issues/273)): complete implementation, sbt/Scala 3, 3043 tests.+- Hydra-Lisp: Clojure ([#278](https://github.com/CategoricalData/hydra/issues/278)), Common Lisp, Emacs Lisp, Scheme — four dialects,+  one coder. CI workflows for Clojure, Common Lisp, and Scheme.+- Avro bidirectional coder ([#301](https://github.com/CategoricalData/hydra/issues/301)) with demo.+- Eval primitives ([#281](https://github.com/CategoricalData/hydra/issues/281)): Logic, Equality, Math, collections, and Groups.+- Generated DSL modules ([#180](https://github.com/CategoricalData/hydra/issues/180)): `hydra.dsls` generates DSL helpers from type modules.+- New demos: GraphQL+JSON ([#279](https://github.com/CategoricalData/hydra/issues/279)), PG validation ([#284](https://github.com/CategoricalData/hydra/issues/284)), SHACL ([#294](https://github.com/CategoricalData/hydra/issues/294)), Avro+PG.+- Packaging module ([#290](https://github.com/CategoricalData/hydra/issues/290)): `hydra.packaging` with `Package` type and validation.+- New primitives: `lists.foldr` ([#280](https://github.com/CategoricalData/hydra/issues/280)), `maybes.toList`, float rounding ([#264](https://github.com/CategoricalData/hydra/issues/264), [#285](https://github.com/CategoricalData/hydra/issues/285)).+- Cross-language benchmarking suite ([#234](https://github.com/CategoricalData/hydra/issues/234)).+- Limited typeclass inference ([#164](https://github.com/CategoricalData/hydra/issues/164)).+- Standardized validation patterns across modules ([#291](https://github.com/CategoricalData/hydra/issues/291)).++### Improvements++- Promoted all staging modules to DSL sources ([#267](https://github.com/CategoricalData/hydra/issues/267)).+- Removed legacy adapters, JSON/YAML coders, grammar framework ([#236](https://github.com/CategoricalData/hydra/issues/236), [#295](https://github.com/CategoricalData/hydra/issues/295)).+- Java: efficient immutable data structures ([#193](https://github.com/CategoricalData/hydra/issues/193)); flattened term naming.+- Java: hidden specialized collection classes in type-level files ([#313](https://github.com/CategoricalData/hydra/issues/313)).+- Inference error messages improved ([#231](https://github.com/CategoricalData/hydra/issues/231)).+- Combined nested let bindings in the Haskell coder ([#248](https://github.com/CategoricalData/hydra/issues/248)).+- Simplified `hydra.adapt.simple` ([#255](https://github.com/CategoricalData/hydra/issues/255)).+- Removed Haskell operators dependency from tests ([#288](https://github.com/CategoricalData/hydra/issues/288)).+- Regression tests for non-Haskell/Java coders ([#85](https://github.com/CategoricalData/hydra/issues/85)).+- Regex support added ([#293](https://github.com/CategoricalData/hydra/issues/293)).+- `hydra.annotations.isNativeType` revisited ([#214](https://github.com/CategoricalData/hydra/issues/214)).+- Migrated grammar-generated models ([#295](https://github.com/CategoricalData/hydra/issues/295)).+- `<<= -shouldBe-> <<~` operator change ([#276](https://github.com/CategoricalData/hydra/issues/276)).+- Minimize Generation.hs ([#225](https://github.com/CategoricalData/hydra/issues/225)).+- Implemented missing Flows primitives ([#183](https://github.com/CategoricalData/hydra/issues/183)).+- Removed JavaDocs from the repository ([#262](https://github.com/CategoricalData/hydra/issues/262)).+- Floating-point test portability fixes for Linux CI ([#264](https://github.com/CategoricalData/hydra/issues/264), [#285](https://github.com/CategoricalData/hydra/issues/285)).+- Moved YAML coder to hydra-ext ([#224](https://github.com/CategoricalData/hydra/issues/224)).+- Minimized native Python and Java primitives in favor of DSL implementations ([#244](https://github.com/CategoricalData/hydra/issues/244)).+- Removed the `disabledForPython` test tag ([#250](https://github.com/CategoricalData/hydra/issues/250)).++### Release tooling++- 0.14 release tracking ([#304](https://github.com/CategoricalData/hydra/issues/304)).++### Documentation++- Thorough cleanup of user documentation ([#302](https://github.com/CategoricalData/hydra/issues/302), [#303](https://github.com/CategoricalData/hydra/issues/303)).+- Coding style guide added to wiki.+- Updated 'new implementation' recipe with learnings from Clojure head ([#278](https://github.com/CategoricalData/hydra/issues/278)).++---++## [0.13.0] - 2026-02-27++Major release completing Hydra-Python ([#66](https://github.com/CategoricalData/hydra/issues/66)) and Hydra-Java ([#166](https://github.com/CategoricalData/hydra/issues/166)) as self-hosting Hydra implementations+and demonstrating mutual self-hosting across all three languages.+Significant improvements to type inference, type checking, rewriting, and adaptation.+New language features include first-class Either types, typeclass inference, binary data support,+and a native JSON parser/writer.+Comprehensive tooling for cross-implementation bootstrapping+and provisional support for Go, Rust, and JavaScript targets.++### Highlights++- **Mutual self-hosting across three implementations**: Hydra is now fully self-hosting+  in Haskell ([#179](https://github.com/CategoricalData/hydra/issues/179)), Java, and Python, and can cross-generate between every combination+  of host and target language (9 paths total).+- **Hydra-Java is complete** ([#166](https://github.com/CategoricalData/hydra/issues/166)): all kernel and generation tests pass.+- **Hydra-Python is complete** ([#66](https://github.com/CategoricalData/hydra/issues/66)): 100% test parity with Haskell.+- **Language coders promoted into the Hydra kernel** ([#176](https://github.com/CategoricalData/hydra/issues/176)): Haskell, Java, and Python+  coders are now defined as Hydra DSL modules, making them self-hosting.+- **Either type support** ([#210](https://github.com/CategoricalData/hydra/issues/210)) with full inference, checking, and library support.+- **Native JSON parser and writer** ([#188](https://github.com/CategoricalData/hydra/issues/188), [#243](https://github.com/CategoricalData/hydra/issues/243), [#253](https://github.com/CategoricalData/hydra/issues/253)): Hydra's own JSON parser and writer+  replace the Aeson dependency; bootstrap-from-JSON architecture for cross-implementation+  code generation.++### Breaking changes++- Renamed `Optional` to `Maybe` throughout the codebase ([#204](https://github.com/CategoricalData/hydra/issues/204)):+  `hydra.lib.optionals` → `hydra.lib.maybes`; all `optional` variants renamed to `maybe`.+- Removed unlabeled product and sum types; replaced with pair types ([#212](https://github.com/CategoricalData/hydra/issues/212)).+- Renamed `hydra.core.TypedTerm` to `hydra.core.TypeApplicationTerm`.+- Renamed `hydra.json` to `hydra.json.model`.+- Renamed `hydra.lib.maps.remove` to `hydra.lib.maps.delete`.+- Removed deprecated `hydra.decoding` module.+- Removed old `hydra.mantle.Either` type (replaced by core `Either`).+- Removed `hydra.lib.tuples` library.+- Removed C# coder stub (C# syntax model remains).+- DSL syntax migration: removed `OverloadedStrings` for term expressions ([#238](https://github.com/CategoricalData/hydra/issues/238)).+- Removed `Hydra.Dsl.ShorthandTypes` ([#222](https://github.com/CategoricalData/hydra/issues/222)).++### New features++- Self-hosting in Haskell ([#179](https://github.com/CategoricalData/hydra/issues/179)) and full mutual cross-generation (Haskell ↔ Java ↔ Python).+- New bootstrapping demo validating all 9 paths across 249 modules.+- Promoted Haskell, Java, and Python coders from staging code into Hydra DSL sources ([#176](https://github.com/CategoricalData/hydra/issues/176)).+- JSON-as-source-of-truth bootstrapping architecture ([#243](https://github.com/CategoricalData/hydra/issues/243), [#253](https://github.com/CategoricalData/hydra/issues/253)):+  new executables and scripts enabling `bootstrap-from-json` for cross-implementation+  code generation.+- Generated term encoders and decoders replace legacy hand-coded modules ([#47](https://github.com/CategoricalData/hydra/issues/47)).+- Hydra-Python completion ([#66](https://github.com/CategoricalData/hydra/issues/66)): restructured project layout with `src/main` and+  `src/gen-main` ([#191](https://github.com/CategoricalData/hydra/issues/191)); full library implementations including `hydra.lib.flows`;+  `@lru_cache` optimization for nullary bindings; PyPy compatibility.+- Hydra-Java completion ([#166](https://github.com/CategoricalData/hydra/issues/166)): all kernel and generation tests pass; deep changes+  to Java coder; `Lazy` utility class for delayed evaluation; array-type support+  in Java serde; tail-call optimization in the Java coder; `Tuple` implements `Comparable`.+- Either type ([#210](https://github.com/CategoricalData/hydra/issues/210)): `EitherType`, `either` term constructor, `hydra.lib.eithers` library+  with `either`, `map`, `mapList`, `mapMaybe`, `bimap`, `bind`, `fromLeft`, `fromRight`,+  `isLeft`, `isRight`, `lefts`, `rights`, `partitionEithers`.+- Pair type as a core construct ([#211](https://github.com/CategoricalData/hydra/issues/211)).+- Void type ([#237](https://github.com/CategoricalData/hydra/issues/237)): uninhabited `void` type as the dual of `unit`; type-level only.+- Native JSON parser and writer ([#188](https://github.com/CategoricalData/hydra/issues/188), [#242](https://github.com/CategoricalData/hydra/issues/242)):+  bidirectional JSON encoder/decoder; replaces the Aeson dependency;+  cross-checked via a special test runner.+- Typeclass inference ([#164](https://github.com/CategoricalData/hydra/issues/164)):+  type schemes with typeclass constraints via `TypeVariableMetadata`;+  typeclass metadata on primitive definitions; Haskell coder uses typeclass info.+- Binary/`ByteString` support ([#172](https://github.com/CategoricalData/hydra/issues/172)): binary data via `ByteString` instead of `String`;+  Haskell coder uses `Data.ByteString`; new `binaryToBytes` primitive.+- Parser combinators: new `hydra.parsing` module with combinator types and DSL.+- Higher-order primitive interpreter ([#198](https://github.com/CategoricalData/hydra/issues/198)): all primitives are fully interpretable+  across all three implementations; legacy `requiresInterp` tag removed.+- Let hoisting and flattening: hoisting polymorphic let terms;+  refined hoisting for monomorphic bindings inside polymorphic ones;+  more efficient `liftLambdaAboveLet` ([#202](https://github.com/CategoricalData/hydra/issues/202));+  case-statement hoisting ([#241](https://github.com/CategoricalData/hydra/issues/241)); subterm hoisting helpers.+- Provisional language targets: Go ([#65](https://github.com/CategoricalData/hydra/issues/65)), Rust (with experimental type-level coder),+  JavaScript (syntax model, serde, DSL, generated sources), and Java/Python syntax DSLs.+- New adapter framework ([#236](https://github.com/CategoricalData/hydra/issues/236)): all external coders refactored+  (Haskell, YAML, Scala, JSON Schema, C++, PDL, Protobuf, GraphQL).+- Compact labeled records and variants ([#122](https://github.com/CategoricalData/hydra/issues/122)).+- New primitives:+  `hydra.lib.lists.find`, `hydra.lib.lists.partition`,+  `hydra.lib.flows.withDefault`, `hydra.lib.flows.foldl`,+  `hydra.lib.math.{max,min,abs,pred,signum,succ,even,odd}`,+  `hydra.lib.pairs.bimap`, `hydra.lib.eithers.bind`,+  `hydra.lib.literals.binaryToBytes`, complete `readXxx`/`showXxx` families,+  `hydra.lexical.chooseUniqueName`, `neg` renamed to `negate`,+  full floating-point math primitives in Python ([#208](https://github.com/CategoricalData/hydra/issues/208)).+- DeepCore DSL: a layer one level deeper than the Meta DSLs,+  for programs that construct programs that construct terms.+- `typeOf` implementation ([#168](https://github.com/CategoricalData/hydra/issues/168)).+- Implement `Comparable` for generated Java classes ([#131](https://github.com/CategoricalData/hydra/issues/131)); update of Hydra-Java ([#166](https://github.com/CategoricalData/hydra/issues/166)).+- Compact labeled records exploration ([#122](https://github.com/CategoricalData/hydra/issues/122)).+- Comparison primitives without typeclasses ([#187](https://github.com/CategoricalData/hydra/issues/187)).+- Investigated core support for Either and Flow monads ([#200](https://github.com/CategoricalData/hydra/issues/200)).++### Improvements++- Type system:+  - Refactored `hydra.inference` to create new module `hydra.checking`.+  - Inference checks after unification to prevent schema names from being unified+    with inferred type variables.+  - Type application terms preserved when preparing application terms for Python.+  - Sanity-check tuple projection index against arity during inference.+  - Bind lost type variables in term annotations.+  - Made `extendTypeContextForLet` tolerant of untyped bindings.+- Code generation:+  - Python: support for deeply-nested match statements; more complete `let` support;+    Pythonic syntax for polymorphic function definitions; refinements for complex+    case-hoisting scenarios; performance improvements ([#209](https://github.com/CategoricalData/hydra/issues/209), [#239](https://github.com/CategoricalData/hydra/issues/239), [#240](https://github.com/CategoricalData/hydra/issues/240)); inline+    let/case rewriting for Python targets ([#203](https://github.com/CategoricalData/hydra/issues/203)).+  - Java: method declaration style consistent with calling style.+  - Haskell: standardized typeclass names.+  - Increased maximum trace depth to support more complex sources.+- Common test suite promotion: all tests promoted into a shared, implementation-independent+  test kernel ([#213](https://github.com/CategoricalData/hydra/issues/213)).+- Statically-compiled test suite in Haskell ([#207](https://github.com/CategoricalData/hydra/issues/207)).+- Included all Hydra kernel types in test schema ([#205](https://github.com/CategoricalData/hydra/issues/205)).+- Reorganized Haskell DSL definitions; standardized imports.+- Added TODO comments to all unsafe primitives ([#201](https://github.com/CategoricalData/hydra/issues/201)).+- New `rewriteAndFoldTerm` utility for simultaneous rewriting and folding.+- Lexical helper for dereferencing schema types through aliases.+- Made JSON parser lazy with new `lazy` parser combinator.+- More efficient substitution helpers for empty substitutions.+- Precomputed type/inference context in kernel test runner for performance.+- Property graph encoding and decoding modules promoted into DSL.+- `hydra.tabular` and `hydra.pg.graphson` modules promoted into DSL.+- `hydra.show.*` modules generated into Java and Python.+- Aligned epsilon encoding with the LambdaGraph spec ([#89](https://github.com/CategoricalData/hydra/issues/89)).+- Fixed asymmetry of introductions and eliminations ([#86](https://github.com/CategoricalData/hydra/issues/86), [#134](https://github.com/CategoricalData/hydra/issues/134)).+- Minimized inferred type annotations ([#114](https://github.com/CategoricalData/hydra/issues/114)).+- Investigated combining products with records, sums with unions ([#196](https://github.com/CategoricalData/hydra/issues/196), [#212](https://github.com/CategoricalData/hydra/issues/212)).+- Refined type reduction in adapters ([#144](https://github.com/CategoricalData/hydra/issues/144)).+- Investigation of unification issues ([#163](https://github.com/CategoricalData/hydra/issues/163)).+- Refactored RowType ([#82](https://github.com/CategoricalData/hydra/issues/82)).+- LLM-assisted PG schemas and mappings ([#171](https://github.com/CategoricalData/hydra/issues/171)).+- Simplified unit-valued variants in Python ([#206](https://github.com/CategoricalData/hydra/issues/206)).+- Checked for inconsistencies between Term/TTerm and Type/TType DSLs ([#218](https://github.com/CategoricalData/hydra/issues/218)).+- GenPG demo: refactored to support Haskell, Python, and Java; Python runner;+  Java generation; finalized output format.+- Testing: extended test runners for let hoisting (Haskell, Python, Java);+  floating-point precision tests; ordering tests for `hydra.lib.maps`/`hydra.lib.sets`;+  inference tests for inferred System F terms; case-hoisting test cases; new JSON coder tests;+  thorough test cases for all primitives ([#199](https://github.com/CategoricalData/hydra/issues/199)).++### Bug fixes++- Fixed interpreter bugs causing test failures ([#235](https://github.com/CategoricalData/hydra/issues/235)).+- Fixed bug in type checking in connection with dead code.+- Fixed bug in `removeTypesFromTerm`.+- Fixed bug in `typeOfMap`.+- Fixed 32-bit max int value in `hydra.constants`.+- Fixed numeric precision in Python.+- Added `BigDecimal` support and fixed `uint8` (short) support in Java.+- Fixed Haskell coder with respect to imports for binary literals.+- Excluded `Prelude.encodeFloat` and `Prelude.decodeFloat` from generated Haskell+  due to name collisions.+- Fixed consistency issues in Python primitives:+  `hydra.lib.sets.toList`, `hydra.lib.maps.union` (precedence),+  `hydra.lib.strings.lines`, `hydra.lib.strings.readString` (dequoting),+  `hydra.lib.lists.apply`, `hydra.lib.maps.toList`.+- Fixed Haskell type signature of `hydra.lists.span`.+- Fixed issue with eta expansion of typed terms.+- Fixed shadowing issue in generated encoding modules.+- Added missing alternatives in `hydra.rewriting.rewriteTermM`.++### Documentation++- Updated main README with complete implementation status.+- Added Documentation sections to all implementation READMEs.+- Fixed outdated Code-organization.md (Python now uses `src/gen-main`).+- Fixed incorrect code paths in Implementation.md.+- Added Java section to Testing wiki.+- Comprehensive developer recipes in `docs/recipes/`.+- Documentation for tail-call optimization implementation.+- Added Haddock comments to Haskell primitives.+- Created wiki page on the release process ([#194](https://github.com/CategoricalData/hydra/issues/194)).++### Community++- Accepted babeloff's `isTrivialTerm` changes.++---++## [0.12.0] - 2025-08-28++A consolidation release: significant Python progress, kernel-level cleanup,+and a wave of bookkeeping closures for Hydra-Java module ports.++### Breaking changes++- Removed `hydra.decoding` module ([#190](https://github.com/CategoricalData/hydra/issues/190)).+- Flattened dependency tiers; eliminated tier-1, tier-2, tier-3 organization ([#184](https://github.com/CategoricalData/hydra/issues/184)).+- Removed `typed` term variant ([#173](https://github.com/CategoricalData/hydra/issues/173), [#162](https://github.com/CategoricalData/hydra/issues/162)).+- Module naming changes: moved tabular and relational modules into kernel ([#152](https://github.com/CategoricalData/hydra/issues/152)).+- Standardized on uncurried helper functions in term-level DSLs ([#174](https://github.com/CategoricalData/hydra/issues/174)).+- Renamed `hydra.lib.flows.traverseOptional` to `hydra.lib.flows.mapOptional`.+- Eliminated camel-cased namespace parts from the kernel ([#152](https://github.com/CategoricalData/hydra/issues/152)).+- Replaced list and optional eliminations with primitive functions ([#150](https://github.com/CategoricalData/hydra/issues/150)).+- Moved `Hydra.Ext` to hydra-ext ([#178](https://github.com/CategoricalData/hydra/issues/178)); moved 'ext' sources into hydra-ext ([#189](https://github.com/CategoricalData/hydra/issues/189)).++### New features++- Significant progress toward Hydra-Python completion:+  generated all kernel types and terms into Python;+  added `Decimal` support for bigfloat values;+  environment tracking for variable scoping;+  generated `hydra.languages` into Python;+  `__hash__` and `__eq__` on serializable generated classes ([#160](https://github.com/CategoricalData/hydra/issues/160)).+- Designated `unit` term and type variants ([#186](https://github.com/CategoricalData/hydra/issues/186)).+- `hydra.lib.flows.mapElems` and `hydra.lib.flows.mapKeys` utilities.+- Promoted JSON coder into the DSL ([#181](https://github.com/CategoricalData/hydra/issues/181)).+- Promoted JSON utilities into the DSL ([#181](https://github.com/CategoricalData/hydra/issues/181)).+- C# coder ([#139](https://github.com/CategoricalData/hydra/issues/139)).+- GQL model and parser ([#140](https://github.com/CategoricalData/hydra/issues/140)).+- Tabular adapters ([#142](https://github.com/CategoricalData/hydra/issues/142)).+- Type-level C++ coder ([#170](https://github.com/CategoricalData/hydra/issues/170)).+- Variable-types-to-Haskell-typedefs transformation ([#70](https://github.com/CategoricalData/hydra/issues/70)).+- A newline at the end of each generated file ([#154](https://github.com/CategoricalData/hydra/issues/154)).+- Refactor kernel modules and primitives by connectivity ([#177](https://github.com/CategoricalData/hydra/issues/177)).++### Improvements++- Condensed repeated elements in error traces ([#165](https://github.com/CategoricalData/hydra/issues/165)).+- Fixed transitive schema dependencies ([#185](https://github.com/CategoricalData/hydra/issues/185)).+- Improved adapter solution with respect to literals.+- Better handling of type variables in Python coder.+- Enhanced term-level Python generation with proper ordering to minimize forward references.+- Topo-sort helper function for dependency management.+- Updated all Python libraries with latest changes.+- Distinguished between deannotation and detyping of terms.+- Adapted primitives when applying language constraints to a graph.+- Use unqualified names where possible in generated code ([#153](https://github.com/CategoricalData/hydra/issues/153)).+- Eliminated `Data.Graph` (containers) dependency ([#167](https://github.com/CategoricalData/hydra/issues/167)).+- "Close the loop" demonstration ([#175](https://github.com/CategoricalData/hydra/issues/175)).+- Implemented `typeOf` ([#168](https://github.com/CategoricalData/hydra/issues/168)).++### Bug fixes++- Fixed System F terms for records and case statements ([#168](https://github.com/CategoricalData/hydra/issues/168)).+- Fixed issue with transitive type-level module dependencies ([#185](https://github.com/CategoricalData/hydra/issues/185)).+- Corrected handling of variable references in Python application terms.+- Fixed nullary functions in Python (added empty parens).+- Added missing alternatives in `hydra.rewriting.rewriteTermM`.++### Bookkeeping++- Closed long-standing Hydra-Java module-port issues+  ([#9](https://github.com/CategoricalData/hydra/issues/9), [#11](https://github.com/CategoricalData/hydra/issues/11), [#15](https://github.com/CategoricalData/hydra/issues/15), [#16](https://github.com/CategoricalData/hydra/issues/16), [#18](https://github.com/CategoricalData/hydra/issues/18), [#19](https://github.com/CategoricalData/hydra/issues/19), [#20](https://github.com/CategoricalData/hydra/issues/20), [#21](https://github.com/CategoricalData/hydra/issues/21), [#22](https://github.com/CategoricalData/hydra/issues/22), [#23](https://github.com/CategoricalData/hydra/issues/23), [#25](https://github.com/CategoricalData/hydra/issues/25), [#44](https://github.com/CategoricalData/hydra/issues/44), [#45](https://github.com/CategoricalData/hydra/issues/45));+  most of the underlying work shipped in earlier releases.+- Closed Hydra-Java DSL-port issues ([#24](https://github.com/CategoricalData/hydra/issues/24), [#26](https://github.com/CategoricalData/hydra/issues/26), [#27](https://github.com/CategoricalData/hydra/issues/27), [#28](https://github.com/CategoricalData/hydra/issues/28), [#29](https://github.com/CategoricalData/hydra/issues/29)) and+  the Scala/Avro tracking issues ([#77](https://github.com/CategoricalData/hydra/issues/77), [#81](https://github.com/CategoricalData/hydra/issues/81)); these had been resolved+  by earlier releases (Scala in 0.14.0, Avro bidi in 0.14.0).++### Documentation++- Updated Hydra-Haskell README.+- Updated Hydra-Java README with corrected links.+- Updated JavaDocs.++---++## [0.11.0] - 2025-03-16++Untagged in-repository version.+A type-inference rebase release: major restructuring of inference internals+to align with Algorithm W, plus a sweeping removal of explicit type annotations+across the kernel.++### Highlights++- **Inference rebased on Algorithm W** ([#118](https://github.com/CategoricalData/hydra/issues/118)): unify-early strategy ([#146](https://github.com/CategoricalData/hydra/issues/146)),+  infinite-type checks restored ([#116](https://github.com/CategoricalData/hydra/issues/116)), recursive-element inference ([#90](https://github.com/CategoricalData/hydra/issues/90)),+  unified handling of elements and let bindings ([#112](https://github.com/CategoricalData/hydra/issues/112)), minimized manual+  type annotations ([#119](https://github.com/CategoricalData/hydra/issues/119)).+- **`hydra.inference` module** introduced for inference type definitions;+  substitution and unification moved up a level.++### Breaking changes++- Argument order of `Logic.ifElse` changed ([#147](https://github.com/CategoricalData/hydra/issues/147)).++### New features++- Inference test cases promoted into the common test suite ([#148](https://github.com/CategoricalData/hydra/issues/148));+  added "kernel examples" inference tests; more recursion / mutual recursion cases.++### Improvements++- Removed type annotations across all kernel sources ([#119](https://github.com/CategoricalData/hydra/issues/119)).+- Migrated to fully-applied primitive library DSLs ([#157](https://github.com/CategoricalData/hydra/issues/157)).+- Aligned `Graph` and `Element` with `LetBinding` ([#159](https://github.com/CategoricalData/hydra/issues/159)).+- `hydra.core.Unit` recognized by the Haskell coder.+- Refactored inference tests.++### Bug fixes++- Fix for underdetermined type in `hydra.decode`.++---++## [0.10.0] - 2025-02-19++Untagged in-repository version.+Adds Hydra-Python (initial completion), a GraphSON coder,+provisional Hydra-Go support, and dot-separated namespace conventions.++### Highlights++- **Hydra-Python initial completion** ([#80](https://github.com/CategoricalData/hydra/issues/80), [#66](https://github.com/CategoricalData/hydra/issues/66)): Python coder, generated kernel+  modules in Python, and full library implementations across kernel namespaces.+- **GraphSON coder** ([#79](https://github.com/CategoricalData/hydra/issues/79)).+- **Provisional Hydra-Go** ([#65](https://github.com/CategoricalData/hydra/issues/65)).+- **Namespace formatting** standardized to dot-separated form ([#151](https://github.com/CategoricalData/hydra/issues/151)).++### Breaking changes++- All namespaces use dot-separated form ([#151](https://github.com/CategoricalData/hydra/issues/151)).++### New features++- Hydra-Python: Python coder; generated `hydra.coreEncoding`, `hydra.strip`,+  `hydra.literals` and other kernel modules in Python; tuple-expression support;+  updated `hydra.constants` in Python.+- GraphSON coder ([#79](https://github.com/CategoricalData/hydra/issues/79)).+- Provisional Hydra-Go ([#65](https://github.com/CategoricalData/hydra/issues/65)).+- `string-to-char-list` and `char-list-to-string` primitives ([#149](https://github.com/CategoricalData/hydra/issues/149)).+- Restored normalization for generated term variables ([#145](https://github.com/CategoricalData/hydra/issues/145)).++### Improvements++- Re-leveled dependency tiers ([#135](https://github.com/CategoricalData/hydra/issues/135)).+- Updated all Java, Haskell, hydra-ext, and Python primitives to current sources.++---++## [0.9.0] - 2025-01-06++Untagged in-repository version.+Bootstraps Hydra-Python and the JSON Schema coder; introduces a fluent Java DSL for flows.++### Highlights++- **JSON Schema coder** ([#141](https://github.com/CategoricalData/hydra/issues/141)).+- **Python coder scaffold**: serde, language constraints, and generated Haskell+  sources for Python.+- **Fluent-style Java DSL for flows** ([#143](https://github.com/CategoricalData/hydra/issues/143)).++### New features++- JSON Schema coder ([#141](https://github.com/CategoricalData/hydra/issues/141)).+- Python coder scaffold and serde.+- Provisional Python language constraints module.+- Fluent-style Java DSL for flows ([#143](https://github.com/CategoricalData/hydra/issues/143)); moved Flows DSL into `hydra.dsl`.+- New `hydra.coders` DSL.+- New DSL functions for core variants.++### Improvements++- Generalized `Namespaces` so it can be used for languages other than Haskell.+- Local-name-only Python type aliases (the directory tree provides the namespace).+- Coders DSL used to simplify Java language-constraint sources.+- Removed redundant productions in the Python grammar.+- Added unit tests for fluent flows.++### Documentation++- Updated JavaDocs for 0.9.0.++---++## [0.8.1] - 2024-09-24++Patch release.++### Improvements++- Generalized the property graph merging utility to accept type systems other than Hydra Core.++---++## [0.8.0] - 2024-09-09++C# support ([#139](https://github.com/CategoricalData/hydra/issues/139)), Graphviz DOT coder, term accessors, and a small breaking change in Java+to support Spark.++### Breaking changes++- Made `FlowException` serializable for Spark support (may affect existing error handling).++### New features++- C# syntax module based on the Microsoft ANTLR grammar ([#139](https://github.com/CategoricalData/hydra/issues/139)).+- Graphviz DOT coder ([#136](https://github.com/CategoricalData/hydra/issues/136)):+  full support for lambdas and recursive `let` statements;+  compact 'accessor graph' visualization option;+  customizable label styles;+  highlighted let-bound terms; edge labels.+- Term accessor type to facilitate lenses and path-aware transformations.+- OpenGQL grammar and generated Haskell for the OpenGQL model ([#140](https://github.com/CategoricalData/hydra/issues/140)).++### Improvements++- Added `</>` as alternative to `@@` application operator in Haskell DSLs.+- Utilities for working with term accessors.+- More specific exception class for JSON decoding.+- Additional convenience methods on `JsonDecoding.java`.+- Used transitive dependencies in hydra-java and hydra-ext.+- Upgraded ANTLR to address a vulnerability.+- Moved TinkerPop utilities from `hydra/ext/org/apache/tinkerpop` into `hydra/pg`.++---++## [0.7.0] - 2024-08-21++Major refactoring of module organization and namespace management.+Establishes the DNS-style namespace convention in hydra-ext+and lifts property-graph models into a top-level `hydra/pg` namespace.++### Breaking changes++- Namespace reorganization: migrated to DNS-based module naming in hydra-ext ([#138](https://github.com/CategoricalData/hydra/issues/138)):+  `hydra/ext/avro` → `hydra/ext/org/apache/avro`,+  `hydra/ext/graphql` → `hydra/ext/org/graphql`,+  `hydra/ext/yaml` → `hydra/ext/org/yaml`,+  `hydra/ext/json/decoding` → `hydra/ext/org/json/decoding`,+  `hydra/ext/rdf` → `hydra/ext/org/w3/rdf`,+  `hydra/ext/shacl` → `hydra/ext/org/w3/shacl`,+  `hydra/ext/tinkerpop` → `hydra/ext/org/apache/tinkerpop`.+- Property graphs: promoted property graph modules from+  `hydra/ext/org/apache/tinkerpop` to `hydra/pg`.+- Project structure: renamed `hydra-extensions` to `hydra-ext`;+  renamed `hydra/langs` to `hydra/ext` ([#138](https://github.com/CategoricalData/hydra/issues/138));+  made hydra-ext into a Gradle subproject alongside hydra-java;+  added top-level Gradle build.++### Improvements++- Moved TinkerPop modules from hydra-haskell into hydra-ext for better separation.+- Moved miscellaneous models to `Hydra.Ext.Other` ([#138](https://github.com/CategoricalData/hydra/issues/138)).+- Moved XML Schema, SQL, ShEx, and OWL models to hydra-ext.+- Moved KQL, Parquet, and Python modules to hydra-ext.+- Separated JavaDocs for hydra-java and hydra-ext.+- Updated publishing configuration in `build.gradle`.++---++## [0.6.0] - 2024-08-19++Type-system improvements (System F type abstraction/application; eliminated polymorphic+types from Hydra Core), expanded language support (Graphviz DOT model, generated Java+field-name constants), and revamped annotation handling.++### Breaking changes++- Eliminated `InferenceContext` helper type ([#103](https://github.com/CategoricalData/hydra/issues/103)).+- Changed typing environment from `Map Name Type` to `Map Name TypeScheme` in graphs ([#76](https://github.com/CategoricalData/hydra/issues/76)).+- Updated annotations and flows to use `map<Name, Term>` instead of `map<string, Term>` ([#133](https://github.com/CategoricalData/hydra/issues/133)).+- Unified `Name` and `FieldName`; aliased to `string` ([#121](https://github.com/CategoricalData/hydra/issues/121)).+- Renamed `hydra/core.UnitType` to `hydra/core.Unit` ([#123](https://github.com/CategoricalData/hydra/issues/123)).+- Eliminated annotation classes; Hydra has a single built-in notion of annotations ([#113](https://github.com/CategoricalData/hydra/issues/113)).+- Unified the `Nominal` type with `RowType` ([#115](https://github.com/CategoricalData/hydra/issues/115)).+- Removed the `extends` parameter for row types ([#132](https://github.com/CategoricalData/hydra/issues/132)).+- Replaced `hydra/Kv` with `hydra/Annotations` (rename revisited).++### New features++- System F support: `typeAbstraction` and `typeApplication` term constructors.+- Python3 syntax model based on the official Python BNF ([#80](https://github.com/CategoricalData/hydra/issues/80)).+- Graphviz DOT model and initial support ([#136](https://github.com/CategoricalData/hydra/issues/136)).+- Field-name constants generated in Java code generation ([#137](https://github.com/CategoricalData/hydra/issues/137)).+- Provisional Algorithm W implementation in Haskell (originally from @wisnesky), kept for reference.++### Improvements++- Primitive organization: Hydra primitives organized into libraries for namespace management.+- Code generation:+  - Escaped field name constants and `with_` methods in Java coder.+  - Generated field name constants in Java ([#137](https://github.com/CategoricalData/hydra/issues/137)).+  - Avoided duplicated comments in wrapper classes in generated Java.+  - Removed superfluous newtype comments in Haskell coder.+- Updated Delta Parquet model to follow the Java API more closely.+- Enriched OpenCypher features module with the complete list of standard Cypher functions.+- Added convenience methods to `JsonEncoding.java`.+- Restored `Hydra.Inference` subdirectory.+- Allowed arbitrary case for element names ([#7](https://github.com/CategoricalData/hydra/issues/7)).+- Corrected `uint8` representation in Java to `Short` ([#120](https://github.com/CategoricalData/hydra/issues/120)).++### Bug fixes++- Fixed handling of type annotations in term adapters.+- Fixed decoding of encoded terms annotated with a type.+- Corrected encoding of universal types in `showTerm` ([#117](https://github.com/CategoricalData/hydra/issues/117)).++---++## [0.5.3] - 2024-08-06++Patch release.+Preserves order of map key/value pairs and set elements during JSON serialization.++### Bug fixes++- Preserved ordering of key/value pairs and set elements in JSON output.++### New features++- Polymorphic `equal` primitive in Haskell and Java.+- Generated Hydra type definitions together with native instantiations of Hydra types+  in Haskell (a stepping stone toward generated coders, [#47](https://github.com/CategoricalData/hydra/issues/47)).++---++## [0.5.1] - 2024-08-01++Patch release.+Dependency updates and minor improvements following the 0.5.0 Hydra Core overhaul.++### Improvements++- Updated dependencies.++---++## [0.5.0] - 2024-07-26++Untagged in-repository version.+Major Hydra Core overhaul: eliminates polymorphic types in favor of explicit+TypeScheme; consolidates the annotation system; revamps `Let` term encoding.++### Breaking changes++- Eliminated polymorphic types from Hydra Core in Haskell ([#125](https://github.com/CategoricalData/hydra/issues/125)):+  removed type parameters from `hydra/core` types in Hydra-Java; replaced type schemes+  with forall types ([#76](https://github.com/CategoricalData/hydra/issues/76)).+- Revamped core encoding and `Let`: bindings are now a list of+  `(name, term, optional type scheme)` triplets instead of a map.+- Unified typed-term types and moved `TypeScheme` into Hydra Core.+- Eliminated `AnnotationClass`; Hydra has a single built-in notion of annotations now ([#113](https://github.com/CategoricalData/hydra/issues/113)).+- Renamed and refactored phantom-type wrappers ([#128](https://github.com/CategoricalData/hydra/issues/128)); removed deprecated `Reference`+  type from `hydra/phantoms`.+- Removed incomplete support for stream types and stream terms ([#88](https://github.com/CategoricalData/hydra/issues/88)).++### New features++- `LiteralTypes` DSL module so literals can be built independently of terms.+- `Hydra.Minimal` module to facilitate collaboration on Hydra application prototypes.+- `TypeConstraint` type added to the kernel.+- `foldl` primitive in Haskell and Java; DSL uses `foldl` instead of the built-in+  list elimination term by default.++### Improvements++- Improvements to Java and JSON coders; improved untyped JSON coder.+- Pre-order and post-order term-traversal test cases added.+- Refactored type inference tests.+- Restored generated Java (Core through Tier 3) with only a few manual tweaks.+- Element names allow arbitrary case ([#7](https://github.com/CategoricalData/hydra/issues/7)).++---++## [0.4.0] - 2024-07-10++Untagged in-repository version.+Adds null checks to generated Java (breaking, but justified — Hydra-Java disallows nulls),+the Gremlin model, and Protobuf annotation refinements.++### Breaking changes++- Null checks added to constructors and `withXXX()` methods in generated Java;+  null values are no longer permitted in Hydra-Java.+- Removed Java 8 restriction (raised minimum Java version).++### New features++- Gremlin model ([#127](https://github.com/CategoricalData/hydra/issues/127)); generated Haskell for Gremlin.+- `hydra/lib/lists.safeHead` primitive in Haskell (necessary in Java due to eager evaluation).+- Support for Protobuf `deprecated=true` annotation; non-string Protobuf options.+- Java options in generated Protobuf.++### Improvements++- Used `java.util.Objects.requireNonNull` instead of a custom null check in generated Java.+- Added 'automatically generated file' disclaimer to generated Java files.+- Added autogen comments and null checks to (most) generated Java.+- Added necessary schema-level dependencies for built-in modules.+- Added null checks to the Flows DSL in Java.++---++## [0.3.0] - 2024-06-05++Untagged in-repository version.+Adds an OpenCypher parser based on an ANTLR grammar ([#124](https://github.com/CategoricalData/hydra/issues/124)),+a KQL (Kusto Query Language) model and serializer,+a Delta Parquet model,+and an early property graph queries model in the style of Cypher.++### New features++- OpenCypher parser based on the OpenCypher M23 ANTLR grammar ([#124](https://github.com/CategoricalData/hydra/issues/124));+  ANTLR added as a build dependency;+  large Cypher test suite drawn from the Cypher Manual.+- Cypher-to-PG-query transformer (Java; partially implemented).+- Property graph queries DSL and generated property graph query classes in Java.+- Property graph queries model (Cypher / future GQL style).+- KQL (Kusto Query Language) initial model and basic serializer.+- Delta Parquet model with generated sources.++### Improvements++- Java options and `deprecated=true` support in generated Protobuf.+- Convenience methods in Java.++---++## [0.2.0] - 2024-01-10++Hydra-Java 0.2.0 release.+Significant Java tooling and DSL build-out, Protobuf bidirectional coder,+Python3 syntax model ([#80](https://github.com/CategoricalData/hydra/issues/80)), property graph validation ([#100](https://github.com/CategoricalData/hydra/issues/100)),+JSON bidirectional support in Java ([#104](https://github.com/CategoricalData/hydra/issues/104)),+OpenCypher initial model ([#108](https://github.com/CategoricalData/hydra/issues/108)),+Cypher unification, and the start of the typed-DSL story in Haskell.++### New features++- Property graph validation: validator type, optionality on property types,+  customizable id/property handling in the merging adapter, fine-tuned validation,+  comprehensive unit tests in Java ([#100](https://github.com/CategoricalData/hydra/issues/100)).+- Bidirectional JSON serialization/deserialization in Java ([#104](https://github.com/CategoricalData/hydra/issues/104)).+- Checkstyle configuration based on Google style guide ([#111](https://github.com/CategoricalData/hydra/issues/111)).+- Python3 syntax model based on the official Python BNF ([#80](https://github.com/CategoricalData/hydra/issues/80)).+- Initial OpenCypher model and parser scaffold ([#108](https://github.com/CategoricalData/hydra/issues/108)).+- Protobuf coder ([#99](https://github.com/CategoricalData/hydra/issues/99)): type encoder, field numbering, formatting, deprecated annotation,+  Java options, non-string options.+- Adapter framework tolerance of recursive types ([#58](https://github.com/CategoricalData/hydra/issues/58)); default branch for case+  statements ([#60](https://github.com/CategoricalData/hydra/issues/60)).+- Topological sort in type inference ([#67](https://github.com/CategoricalData/hydra/issues/67)).+- `hydra/query` model ([#73](https://github.com/CategoricalData/hydra/issues/73)).+- Records-to-TinkerPop-elements coder ([#64](https://github.com/CategoricalData/hydra/issues/64)).+- Equality primitives for all literal types ([#92](https://github.com/CategoricalData/hydra/issues/92)); polymorphic logic primitives ([#95](https://github.com/CategoricalData/hydra/issues/95)).+- `mapKeys` primitive ([#93](https://github.com/CategoricalData/hydra/issues/93)).+- Tuple support in Java ([#94](https://github.com/CategoricalData/hydra/issues/94)).+- Java 8 as an optional target ([#96](https://github.com/CategoricalData/hydra/issues/96)); optionally generate Java classes as `Serializable` ([#97](https://github.com/CategoricalData/hydra/issues/97)).+- Bidirectional "merged vertex" and "merged edge" coders ([#106](https://github.com/CategoricalData/hydra/issues/106)).+- Nullability and parameterization in the tabular model ([#107](https://github.com/CategoricalData/hydra/issues/107)).+- Term-level / type-level dependency distinction for modules ([#109](https://github.com/CategoricalData/hydra/issues/109)).+- Flatten nested `let` terms for transformation into Java ([#110](https://github.com/CategoricalData/hydra/issues/110)).+- Various `Flow` utilities in Java: `bind3`; convenience methods for consuming results;+  `fromFlow` variants including one that throws.++### Improvements++- Hydra-Java module ports ([#10](https://github.com/CategoricalData/hydra/issues/10), [#12](https://github.com/CategoricalData/hydra/issues/12), [#13](https://github.com/CategoricalData/hydra/issues/13), [#14](https://github.com/CategoricalData/hydra/issues/14), [#17](https://github.com/CategoricalData/hydra/issues/17), [#30](https://github.com/CategoricalData/hydra/issues/30), [#31](https://github.com/CategoricalData/hydra/issues/31), [#32](https://github.com/CategoricalData/hydra/issues/32), [#33](https://github.com/CategoricalData/hydra/issues/33), [#34](https://github.com/CategoricalData/hydra/issues/34), [#35](https://github.com/CategoricalData/hydra/issues/35),+  [#38](https://github.com/CategoricalData/hydra/issues/38), [#39](https://github.com/CategoricalData/hydra/issues/39), [#41](https://github.com/CategoricalData/hydra/issues/41), [#43](https://github.com/CategoricalData/hydra/issues/43), [#48](https://github.com/CategoricalData/hydra/issues/48), [#71](https://github.com/CategoricalData/hydra/issues/71), [#72](https://github.com/CategoricalData/hydra/issues/72), [#75](https://github.com/CategoricalData/hydra/issues/75), [#83](https://github.com/CategoricalData/hydra/issues/83)):+  `Common`, `CoreEncoding`, `CoreLanguage`, `Kernel`, `Flows`, `Lists`, `Literals`,+  `Math`, `Sets`, `Strings`, `Optionals`, `Maps`, `Flows` primitives, `Sets` primitives.+- Common DSLs in Haskell: Flow support ([#68](https://github.com/CategoricalData/hydra/issues/68)), Let support ([#69](https://github.com/CategoricalData/hydra/issues/69)).+- Renamed annotation type parameter `m` to `a` ([#41](https://github.com/CategoricalData/hydra/issues/41)).+- Updated wrapper, element, and variable types ([#75](https://github.com/CategoricalData/hydra/issues/75)).+- Removed `schema` field from `Element` ([#83](https://github.com/CategoricalData/hydra/issues/83)).+- GraphQL coder ([#78](https://github.com/CategoricalData/hydra/issues/78)).+- Code quality:+  - Updated main and test sources to conform to Checkstyle configuration ([#111](https://github.com/CategoricalData/hydra/issues/111)).+  - Extended line-length limit from 100 to 120 characters.+  - Disabled overly restrictive indentation and import-order rules.+  - Disabled `RightCurlyAlone` for compact inline map definitions.+- Streamlined property-graph element merging to unify properties with identical+  keys and types ([#106](https://github.com/CategoricalData/hydra/issues/106)).+- Convenience functions for printing literals and literal types in the Java DSL.+- Minor addition to JSON decoding.+- DSL convenience: alphabetic-case flexibility for element names ([#7](https://github.com/CategoricalData/hydra/issues/7)).++### Bug fixes++- Fixed type annotations for the Sets Java port ([#48](https://github.com/CategoricalData/hydra/issues/48)).+- Various minor fixes during the Java module ports.++---++## [0.1.1] - 2022-12-04++Patch release the same day as 0.1.0.+README polish only.++---++## [0.1.0] - 2022-12-04++First packaged release of Hydra (Hackage).+This release contains the complete foundation of Hydra.++### Core language++- Hydra's core type and data languages (`hydra.core`).+- Core models for graphs and modules.+- Computation model with the `Flow` monad.+- BNF grammars support.+- Phantom types.+- Basic operations on types and terms.++### Type system++- Hindley–Milner-style type inference.+- Type schemes with polymorphism.+- Type/term validation.++### Transformations++- Adapter system: type-to-type rewriting and transformation.+- Coders:+  Haskell coder (types and terms),+  Java coder (types and terms),+  partial Scala coder (terms only),+  Avro coder,+  JSON coder,+  PDL (Pegasus Data Language) coder,+  RDF + SHACL coder,+  YAML coder.++### Language support++- Models for GraphQL, OWL (Web Ontology Language), ShEx (Shape Expressions),+  and TinkerPop-style property graphs.++### Developer tools++- Type-construction DSL and term-construction DSL.+- QuickCheck property-based tests.++### Implementations++- Hydra-Haskell: bootstrapping implementation with full kernel.+- Hydra-Java: Java implementation with mature tooling.++### Community++- Set up the LambdaGraph Discord server ([#2](https://github.com/CategoricalData/hydra/issues/2)).++---++## Contributing++We welcome contributions! Please see:++- [Developer recipes](https://github.com/CategoricalData/hydra/tree/main/docs/recipes)+- [LambdaGraph Discord](https://bit.ly/lg-discord)++## Release process++See the [Release policy](https://github.com/CategoricalData/hydra/wiki/Release-policy)+wiki page and [docs/release-workflow.md](docs/release-workflow.md)+for information on how Hydra releases are versioned, built, and published.
+ LICENSE view
@@ -0,0 +1,201 @@+                                 Apache License+                           Version 2.0, January 2004+                        http://www.apache.org/licenses/++   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++   1. Definitions.++      "License" shall mean the terms and conditions for use, reproduction,+      and distribution as defined by Sections 1 through 9 of this document.++      "Licensor" shall mean the copyright owner or entity authorized by+      the copyright owner that is granting the License.++      "Legal Entity" shall mean the union of the acting entity and all+      other entities that control, are controlled by, or are under common+      control with that entity. For the purposes of this definition,+      "control" means (i) the power, direct or indirect, to cause the+      direction or management of such entity, whether by contract or+      otherwise, or (ii) ownership of fifty percent (50%) or more of the+      outstanding shares, or (iii) beneficial ownership of such entity.++      "You" (or "Your") shall mean an individual or Legal Entity+      exercising permissions granted by this License.++      "Source" form shall mean the preferred form for making modifications,+      including but not limited to software source code, documentation+      source, and configuration files.++      "Object" form shall mean any form resulting from mechanical+      transformation or translation of a Source form, including but+      not limited to compiled object code, generated documentation,+      and conversions to other media types.++      "Work" shall mean the work of authorship, whether in Source or+      Object form, made available under the License, as indicated by a+      copyright notice that is included in or attached to the work+      (an example is provided in the Appendix below).++      "Derivative Works" shall mean any work, whether in Source or Object+      form, that is based on (or derived from) the Work and for which the+      editorial revisions, annotations, elaborations, or other modifications+      represent, as a whole, an original work of authorship. For the purposes+      of this License, Derivative Works shall not include works that remain+      separable from, or merely link (or bind by name) to the interfaces of,+      the Work and Derivative Works thereof.++      "Contribution" shall mean any work of authorship, including+      the original version of the Work and any modifications or additions+      to that Work or Derivative Works thereof, that is intentionally+      submitted to Licensor for inclusion in the Work by the copyright owner+      or by an individual or Legal Entity authorized to submit on behalf of+      the copyright owner. For the purposes of this definition, "submitted"+      means any form of electronic, verbal, or written communication sent+      to the Licensor or its representatives, including but not limited to+      communication on electronic mailing lists, source code control systems,+      and issue tracking systems that are managed by, or on behalf of, the+      Licensor for the purpose of discussing and improving the Work, but+      excluding communication that is conspicuously marked or otherwise+      designated in writing by the copyright owner as "Not a Contribution."++      "Contributor" shall mean Licensor and any individual or Legal Entity+      on behalf of whom a Contribution has been received by Licensor and+      subsequently incorporated within the Work.++   2. Grant of Copyright License. Subject to the terms and conditions of+      this License, each Contributor hereby grants to You a perpetual,+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable+      copyright license to reproduce, prepare Derivative Works of,+      publicly display, publicly perform, sublicense, and distribute the+      Work and such Derivative Works in Source or Object form.++   3. Grant of Patent License. Subject to the terms and conditions of+      this License, each Contributor hereby grants to You a perpetual,+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable+      (except as stated in this section) patent license to make, have made,+      use, offer to sell, sell, import, and otherwise transfer the Work,+      where such license applies only to those patent claims licensable+      by such Contributor that are necessarily infringed by their+      Contribution(s) alone or by combination of their Contribution(s)+      with the Work to which such Contribution(s) was submitted. If You+      institute patent litigation against any entity (including a+      cross-claim or counterclaim in a lawsuit) alleging that the Work+      or a Contribution incorporated within the Work constitutes direct+      or contributory patent infringement, then any patent licenses+      granted to You under this License for that Work shall terminate+      as of the date such litigation is filed.++   4. Redistribution. You may reproduce and distribute copies of the+      Work or Derivative Works thereof in any medium, with or without+      modifications, and in Source or Object form, provided that You+      meet the following conditions:++      (a) You must give any other recipients of the Work or+          Derivative Works a copy of this License; and++      (b) You must cause any modified files to carry prominent notices+          stating that You changed the files; and++      (c) You must retain, in the Source form of any Derivative Works+          that You distribute, all copyright, patent, trademark, and+          attribution notices from the Source form of the Work,+          excluding those notices that do not pertain to any part of+          the Derivative Works; and++      (d) If the Work includes a "NOTICE" text file as part of its+          distribution, then any Derivative Works that You distribute must+          include a readable copy of the attribution notices contained+          within such NOTICE file, excluding those notices that do not+          pertain to any part of the Derivative Works, in at least one+          of the following places: within a NOTICE text file distributed+          as part of the Derivative Works; within the Source form or+          documentation, if provided along with the Derivative Works; or,+          within a display generated by the Derivative Works, if and+          wherever such third-party notices normally appear. The contents+          of the NOTICE file are for informational purposes only and+          do not modify the License. You may add Your own attribution+          notices within Derivative Works that You distribute, alongside+          or as an addendum to the NOTICE text from the Work, provided+          that such additional attribution notices cannot be construed+          as modifying the License.++      You may add Your own copyright statement to Your modifications and+      may provide additional or different license terms and conditions+      for use, reproduction, or distribution of Your modifications, or+      for any such Derivative Works as a whole, provided Your use,+      reproduction, and distribution of the Work otherwise complies with+      the conditions stated in this License.++   5. Submission of Contributions. Unless You explicitly state otherwise,+      any Contribution intentionally submitted for inclusion in the Work+      by You to the Licensor shall be under the terms and conditions of+      this License, without any additional terms or conditions.+      Notwithstanding the above, nothing herein shall supersede or modify+      the terms of any separate license agreement you may have executed+      with Licensor regarding such Contributions.++   6. Trademarks. This License does not grant permission to use the trade+      names, trademarks, service marks, or product names of the Licensor,+      except as required for reasonable and customary use in describing the+      origin of the Work and reproducing the content of the NOTICE file.++   7. Disclaimer of Warranty. Unless required by applicable law or+      agreed to in writing, Licensor provides the Work (and each+      Contributor provides its Contributions) on an "AS IS" BASIS,+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+      implied, including, without limitation, any warranties or conditions+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+      PARTICULAR PURPOSE. You are solely responsible for determining the+      appropriateness of using or redistributing the Work and assume any+      risks associated with Your exercise of permissions under this License.++   8. Limitation of Liability. In no event and under no legal theory,+      whether in tort (including negligence), contract, or otherwise,+      unless required by applicable law (such as deliberate and grossly+      negligent acts) or agreed to in writing, shall any Contributor be+      liable to You for damages, including any direct, indirect, special,+      incidental, or consequential damages of any character arising as a+      result of this License or out of the use or inability to use the+      Work (including but not limited to damages for loss of goodwill,+      work stoppage, computer failure or malfunction, or any and all+      other commercial damages or losses), even if such Contributor+      has been advised of the possibility of such damages.++   9. Accepting Warranty or Additional Liability. While redistributing+      the Work or Derivative Works thereof, You may choose to offer,+      and charge a fee for, acceptance of support, warranty, indemnity,+      or other liability obligations and/or rights consistent with this+      License. However, in accepting such obligations, You may act only+      on Your own behalf and on Your sole responsibility, not on behalf+      of any other Contributor, and only if You agree to indemnify,+      defend, and hold each Contributor harmless for any liability+      incurred by, or claims asserted against, such Contributor by reason+      of your accepting any such warranty or additional liability.++   END OF TERMS AND CONDITIONS++   APPENDIX: How to apply the Apache License to your work.++      To apply the Apache License to your work, attach the following+      boilerplate notice, with the fields enclosed by brackets "[]"+      replaced with your own identifying information. (Don't include+      the brackets!)  The text should be enclosed in the appropriate+      comment syntax for the file format. We also recommend that a+      file or class name and description of purpose be included on the+      same "printed page" as the copyright notice for easier+      identification within third-party archives.++   Copyright [yyyy] [name of copyright owner]++   Licensed under the Apache License, Version 2.0 (the "License");+   you may not use this file except in compliance with the License.+   You may obtain a copy of the License at++       http://www.apache.org/licenses/LICENSE-2.0++   Unless required by applicable law or agreed to in writing, software+   distributed under the License is distributed on an "AS IS" BASIS,+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+   See the License for the specific language governing permissions and+   limitations under the License.
+ NOTICE view
@@ -0,0 +1,3 @@+Hydra+Copyright 2021-2026 The Hydra authors+https://github.com/CategoricalData/hydra
+ hydra-coq.cabal view
@@ -0,0 +1,47 @@+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.39.1.+--+-- see: https://github.com/sol/hpack++name:           hydra-coq+version:        0.17.0+synopsis:       Hydra's Coq coder: emit Coq/Gallina source from Hydra modules+description:    Hydra is an implementation of the LambdaGraph data model, which takes advantage of an isomorphism between labeled hypergraphs and typed lambda calculus: in Hydra, "graphs are programs, and programs are graphs". Coq support for Hydra+category:       Data+homepage:       https://github.com/CategoricalData/hydra#readme+bug-reports:    https://github.com/CategoricalData/hydra/issues+author:         Joshua Shinavier <josh@fortytwo.net>+maintainer:     Joshua Shinavier <josh@fortytwo.net>+license:        Apache-2.0+license-file:   LICENSE+build-type:     Simple+extra-source-files:+    LICENSE+    NOTICE+    CHANGELOG.md++source-repository head+  type: git+  location: https://github.com/CategoricalData/hydra++library+  exposed-modules:+      Hydra.Coq.Coder+      Hydra.Coq.Environment+      Hydra.Coq.Generate+      Hydra.Coq.Language+      Hydra.Coq.Serde+      Hydra.Coq.Syntax+      Hydra.Coq.Utils+      Hydra.Dsl.Coq.Syntax+  other-modules:+      Paths_hydra_coq+  hs-source-dirs:+      src/main/haskell+  build-depends:+      base >=4.19.0 && <4.22+    , containers >=0.6.7 && <0.8+    , hydra-kernel ==0.17.0+    , scientific >=0.3.7 && <0.4+  default-language: Haskell2010
+ src/main/haskell/Hydra/Coq/Coder.hs view
@@ -0,0 +1,617 @@+-- Note: this is an automatically generated file. Do not edit.+-- | Coq code generator: converts Hydra modules to Coq source++module Hydra.Coq.Coder where+import qualified Hydra.Ast as Ast+import qualified Hydra.Coders as Coders+import qualified Hydra.Coq.Environment as Environment+import qualified Hydra.Coq.Language as Language+import qualified Hydra.Coq.Syntax as Syntax+import qualified Hydra.Coq.Utils as Utils+import qualified Hydra.Core as Core+import qualified Hydra.Error.Checking as Checking+import qualified Hydra.Error.Core as ErrorCore+import qualified Hydra.Error.Packaging as ErrorPackaging+import qualified Hydra.Errors as Errors+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Graph as Graph+import qualified Hydra.Json.Model as Model+import qualified Hydra.Overlay.Haskell.Lib.Eithers as Eithers+import qualified Hydra.Overlay.Haskell.Lib.Equality as Equality+import qualified Hydra.Overlay.Haskell.Lib.Lists as Lists+import qualified Hydra.Overlay.Haskell.Lib.Literals as Literals+import qualified Hydra.Overlay.Haskell.Lib.Logic as Logic+import qualified Hydra.Overlay.Haskell.Lib.Maps as Maps+import qualified Hydra.Overlay.Haskell.Lib.Optionals as Optionals+import qualified Hydra.Overlay.Haskell.Lib.Pairs as Pairs+import qualified Hydra.Overlay.Haskell.Lib.Sets as Sets+import qualified Hydra.Overlay.Haskell.Lib.Strings as Strings+import qualified Hydra.Packaging as Packaging+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Paths as Paths+import qualified Hydra.Query as Query+import qualified Hydra.Relational as Relational+import qualified Hydra.Tabular as Tabular+import qualified Hydra.Testing as Testing+import qualified Hydra.Topology as Topology+import qualified Hydra.Typed as Typed+import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util+import qualified Hydra.Validation as Validation+import qualified Hydra.Variants as Variants+import Prelude hiding  (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+-- | Build the Coq dependent-function term `forall (_ : dom), cod` used as the arrow type+coqArrow :: Syntax.Term -> Syntax.Term -> Syntax.Term+coqArrow dom cod =+    Syntax.TermForallOrFun (Syntax.ForallOrFunForall (Syntax.Forall {+      Syntax.forallBinders = (Syntax.OpenBindersBinders [+        Syntax.BinderType (Syntax.TypeBinders {+          Syntax.typeBindersNames = [+            Syntax.Name Nothing],+          Syntax.typeBindersType = (coqTypeTerm dom)})]),+      Syntax.forallType = (coqTypeTerm cod)}))+coqIdent :: String -> Syntax.Ident+coqIdent s = Syntax.Ident (Syntax.String_ s)+coqName :: String -> Syntax.Name+coqName s = Syntax.Name (Just (coqIdent s))+coqQualid :: String -> Syntax.Qualid+coqQualid s =+    Syntax.Qualid {+      Syntax.qualidId = (coqIdent s),+      Syntax.qualidFieldIds = []}+-- | Apply a Coq term to a list of argument terms, parenthesising each+coqTermApp :: Syntax.Term -> [Syntax.Term] -> Syntax.Term+coqTermApp f args =+    Logic.ifElse (Lists.null args) f (Syntax.TermTerm100 (Syntax.Term100Term10 (Syntax.Term10Application (Syntax.ApplicationNormal (Syntax.NormalApplication {+      Syntax.normalApplicationLhs = (Syntax.Term1Term0 (Syntax.Term0Parens f)),+      Syntax.normalApplicationRhs = (Lists.map (\a -> Syntax.ArgTerm (Syntax.Term1Term0 (Syntax.Term0Parens a))) args)})))))+-- | Build a Coq Term expressing `(t : T)` with the normal cast operator+coqTermCast :: Syntax.Term -> Syntax.Type -> Syntax.Term+coqTermCast t ty =+    Syntax.TermTerm100 (Syntax.Term100Cast (Syntax.TypeCast {+      Syntax.typeCastTerm = (Syntax.Term10OneTerm (Syntax.OneTermTerm1 (Syntax.Term1Term0 (Syntax.Term0Parens t)))),+      Syntax.typeCastType = ty,+      Syntax.typeCastOperator = Syntax.TypeCastOperatorNormal}))+-- | Build a Coq Term that references a (possibly qualified) identifier+coqTermQualid :: String -> Syntax.Term+coqTermQualid s =+    Syntax.TermTerm100 (Syntax.Term100Term10 (Syntax.Term10OneTerm (Syntax.OneTermExplicit (Syntax.QualidAnnotated {+      Syntax.qualidAnnotatedQualid = (coqQualid s),+      Syntax.qualidAnnotatedUnivAnnot = Nothing}))))+coqTypeTerm :: Syntax.Term -> Syntax.Type+coqTypeTerm t = Syntax.Type t+-- | Produce `Axiom name : type.` from a (name, Hydra type) pair+encodeAxiomDefinitionPair :: Environment.CoqEnvironment -> (String, Core.Type) -> Syntax.Sentence+encodeAxiomDefinitionPair env nt =+    Syntax.Sentence {+      Syntax.sentenceComment = Nothing,+      Syntax.sentenceContent = (Syntax.SentenceContentAxiom (Syntax.AxiomDeclaration {+        Syntax.axiomDeclarationName = (coqIdent (Pairs.first nt)),+        Syntax.axiomDeclarationType = (coqTypeTerm (encodeType env (Pairs.second nt)))}))}+-- | Map a Haskell-`show`n Double/Scientific to a Coq term, routing NaN/Inf to base-lib axioms+encodeFloatLiteral :: String -> Syntax.Term+encodeFloatLiteral s =+    Logic.ifElse (Equality.equal s "Infinity") (coqTermQualid "hydra_posInf") (Logic.ifElse (Equality.equal s "-Infinity") (coqTermQualid "hydra_negInf") (Logic.ifElse (Equality.equal s "NaN") (coqTermQualid "hydra_nan") (coqTermQualid (Strings.cat [+      "(",+      s,+      ")"]))))+-- | Encode a Lambda into a Coq `fun` expression, sanitising the parameter name+encodeLambdaTerm :: Environment.CoqEnvironment -> Core.Lambda -> Syntax.Term+encodeLambdaTerm env lam =++      let paramName = sanitizeVar (Core.unName (Core.lambdaParameter lam))+          binder =+                  Optionals.cases (Core.lambdaDomain lam) (Syntax.BinderName (coqName paramName)) (\domTy -> Syntax.BinderType (Syntax.TypeBinders {+                    Syntax.typeBindersNames = [+                      coqName paramName],+                    Syntax.typeBindersType = (coqTypeTerm (encodeType env domTy))}))+      in (Syntax.TermForallOrFun (Syntax.ForallOrFunFun (Syntax.Fun {+        Syntax.funBinders = (Syntax.OpenBindersBinders [+          binder]),+        Syntax.funBody = (encodeTerm env (Core.lambdaBody lam))})))+-- | Translate a Hydra literal into its Coq stdlib form, with disambiguating parentheses+encodeLiteral :: Core.Literal -> Syntax.Term+encodeLiteral lit =+    case lit of+      Core.LiteralBoolean v0 -> Logic.ifElse v0 (coqTermQualid "true") (coqTermQualid "false")+      Core.LiteralDecimal v0 -> coqTermQualid (Strings.cat [+        "(",+        (Literals.showDecimal v0),+        ")"])+      Core.LiteralFloat v0 -> case v0 of+        Core.FloatValueFloat32 v1 -> encodeFloatLiteral (Literals.showFloat64 (Literals.float32ToFloat64 v1))+        Core.FloatValueFloat64 v1 -> encodeFloatLiteral (Literals.showFloat64 v1)+      Core.LiteralInteger v0 -> case v0 of+        Core.IntegerValueBigint v1 -> coqTermQualid (Strings.cat [+          "(",+          (Literals.showBigint v1),+          ")%Z"])+        Core.IntegerValueInt8 v1 -> coqTermQualid (Strings.cat [+          "(",+          (Literals.showInt8 v1),+          ")%Z"])+        Core.IntegerValueInt16 v1 -> coqTermQualid (Strings.cat [+          "(",+          (Literals.showInt16 v1),+          ")%Z"])+        Core.IntegerValueInt32 v1 -> coqTermQualid (Strings.cat [+          "(",+          (Literals.showInt32 v1),+          ")%Z"])+        Core.IntegerValueInt64 v1 -> coqTermQualid (Strings.cat [+          "(",+          (Literals.showInt64 v1),+          ")%Z"])+        Core.IntegerValueUint8 v1 -> coqTermQualid (Strings.cat [+          "(",+          (Literals.showUint8 v1),+          ")"])+        Core.IntegerValueUint16 v1 -> coqTermQualid (Strings.cat [+          "(",+          (Literals.showUint16 v1),+          ")"])+        Core.IntegerValueUint32 v1 -> coqTermQualid (Strings.cat [+          "(",+          (Literals.showUint32 v1),+          ")"])+        Core.IntegerValueUint64 v1 -> coqTermQualid (Strings.cat [+          "(",+          (Literals.showUint64 v1),+          ")"])+      Core.LiteralString v0 -> coqTermQualid (Strings.cat [+        "\"",+        (escapeCoqString v0),+        "\"%string"])+      Core.LiteralBinary _ -> coqTermQualid "\"\""+-- | Map a Hydra LiteralType to its Coq stdlib counterpart+encodeLiteralType :: Core.LiteralType -> Syntax.Term+encodeLiteralType lt =+    case lt of+      Core.LiteralTypeBoolean -> coqTermQualid "bool"+      Core.LiteralTypeDecimal -> coqTermQualid "Q"+      Core.LiteralTypeFloat _ -> coqTermQualid "Q"+      Core.LiteralTypeInteger v0 -> case v0 of+        Core.IntegerTypeBigint -> coqTermQualid "Z"+        Core.IntegerTypeInt8 -> coqTermQualid "Z"+        Core.IntegerTypeInt16 -> coqTermQualid "Z"+        Core.IntegerTypeInt32 -> coqTermQualid "Z"+        Core.IntegerTypeInt64 -> coqTermQualid "Z"+        Core.IntegerTypeUint8 -> coqTermQualid "nat"+        Core.IntegerTypeUint16 -> coqTermQualid "nat"+        Core.IntegerTypeUint32 -> coqTermQualid "nat"+        Core.IntegerTypeUint64 -> coqTermQualid "nat"+      Core.LiteralTypeString -> coqTermQualid "string"+      Core.LiteralTypeBinary -> coqTermQualid "string"+-- | Translate a Hydra record projection into a Coq lambda that pulls out the field+encodeProjectionElim :: Environment.CoqEnvironment -> Core.Projection -> Syntax.Term+encodeProjectionElim env p =++      let fname = Core.projectionFieldName p+          rawFname = Core.unName fname+          sanitizedSet = Environment.coqEnvironmentSanitizedAccessors env+      in (Logic.ifElse (Sets.member rawFname sanitizedSet) (Syntax.TermForallOrFun (Syntax.ForallOrFunFun (Syntax.Fun {+        Syntax.funBinders = (Syntax.OpenBindersBinders [+          Syntax.BinderName (coqName "_")]),+        Syntax.funBody = (coqTermQualid "hydra_unreachable")}))) (Syntax.TermForallOrFun (Syntax.ForallOrFunFun (Syntax.Fun {+        Syntax.funBinders = (Syntax.OpenBindersBinders [+          Syntax.BinderName (coqName "r_")]),+        Syntax.funBody = (coqTermApp (coqTermQualid rawFname) [+          coqTermQualid "r_"])}))))+-- | Translate a Hydra Term into its Coq Term counterpart. The environment provides the constructor-count map used by encodeUnionElim (to decide whether a match is exhaustive) and the ambiguous-name set used by resolveQualifiedName (to decide whether cross-module references need to stay fully qualified).+encodeTerm :: Environment.CoqEnvironment -> Core.Term -> Syntax.Term+encodeTerm env tm =+    case tm of+      Core.TermAnnotated v0 -> encodeTerm env (Core.annotatedTermBody v0)+      Core.TermApplication v0 -> coqTermApp (encodeTerm env (Core.applicationFunction v0)) [+        encodeTerm env (Core.applicationArgument v0)]+      Core.TermCases v0 -> encodeUnionElim env v0+      Core.TermEither v0 -> Eithers.either (\l -> coqTermApp (coqTermQualid "inl") [+        encodeTerm env l]) (\r -> coqTermApp (coqTermQualid "inr") [+        encodeTerm env r]) v0+      Core.TermInject v0 ->+        let uname = Core.injectionTypeName v0+            ufield = Core.injectionField v0+            fname = Core.fieldName ufield+            fterm = Core.fieldTerm ufield+            constrName = unionConstructorName (Core.unName uname) (Core.unName fname)+        in (coqTermApp (coqTermQualid (resolveQualifiedName env constrName)) [+          encodeTerm env fterm])+      Core.TermLambda v0 -> encodeLambdaTerm env v0+      Core.TermLet v0 ->+        let bindings = Core.letBindings v0+            body = Core.letBody v0+        in (Lists.foldr (\binding -> \acc ->+          let bname = Core.bindingName binding+              bterm = Core.bindingTerm binding+              safeName = sanitizeVar (Core.unName bname)+              recursive = termReferencesVar bname bterm+              recBody =+                      coqTermApp (coqTermQualid "hydra_fix") [+                        Syntax.TermForallOrFun (Syntax.ForallOrFunFun (Syntax.Fun {+                          Syntax.funBinders = (Syntax.OpenBindersBinders [+                            Syntax.BinderName (coqName safeName)]),+                          Syntax.funBody = (encodeTerm env bterm)}))]+              boundTerm = Logic.ifElse recursive recBody (encodeTerm env bterm)+          in (Syntax.TermLet (Syntax.Let {+            Syntax.letBindings = (Syntax.LetBindingsNamed (Syntax.LetNamed {+              Syntax.letNamedBinder = Syntax.LetBinder {+                Syntax.letBinderName = (coqName safeName),+                Syntax.letBinderType = Nothing,+                Syntax.letBinderTerm = boundTerm},+              Syntax.letNamedBinders = []})),+            Syntax.letIn = acc}))) (encodeTerm env body) bindings)+      Core.TermList v0 -> Lists.foldr (\el -> \acc -> coqTermApp (coqTermQualid "cons") [+        encodeTerm env el,+        acc]) (coqTermQualid "nil") v0+      Core.TermLiteral v0 -> encodeLiteral v0+      Core.TermMap v0 -> Lists.foldr (\kv -> \acc -> coqTermApp (coqTermQualid "cons") [+        coqTermApp (coqTermQualid "pair") [+          encodeTerm env (Pairs.first kv),+          (encodeTerm env (Pairs.second kv))],+        acc]) (coqTermQualid "nil") (Maps.toList v0)+      Core.TermOptional v0 -> Optionals.cases v0 (coqTermQualid "None") (\v -> coqTermApp (coqTermQualid "Some") [+        encodeTerm env v])+      Core.TermPair v0 -> coqTermApp (coqTermQualid "pair") [+        encodeTerm env (Pairs.first v0),+        (encodeTerm env (Pairs.second v0))]+      Core.TermProject v0 -> encodeProjectionElim env v0+      Core.TermRecord v0 ->+        let rname = Core.recordTypeName v0+            rfields = Core.recordFields v0+        in (Logic.ifElse (Lists.null rfields) (coqTermQualid "tt") (coqTermApp (coqTermQualid (resolveQualifiedName env (Strings.cat2 "Build_" (Core.unName rname)))) (Lists.map (\f -> encodeTerm env (Core.fieldTerm f)) rfields)))+      Core.TermSet v0 -> Lists.foldr (\el -> \acc -> coqTermApp (coqTermQualid "cons") [+        encodeTerm env el,+        acc]) (coqTermQualid "nil") (Sets.toList v0)+      Core.TermTypeApplication v0 ->+        let body = Core.typeApplicationTermBody v0+            tyArg = Core.typeApplicationTermType v0+            encoded = encodeTerm env body+            isGround = Sets.null (Utils.collectFreeTypeVarsInType tyArg)+        in (Logic.ifElse (Logic.not isGround) encoded (case body of+          Core.TermOptional v1 -> Optionals.cases v1 (coqTermCast (coqTermQualid "None") (coqTypeTerm (coqTermApp (coqTermQualid "option") [+            encodeType env tyArg]))) (\_ -> encoded)+          Core.TermList v1 -> Logic.ifElse (Logic.and (Lists.null v1) (case tyArg of+            Core.TypeEither _ -> True+            Core.TypePair _ -> True+            Core.TypeMap _ -> True+            _ -> False)) (coqTermCast (coqTermQualid "nil") (coqTypeTerm (coqTermApp (coqTermQualid "list") [+            encodeType env tyArg]))) encoded+          Core.TermEither _ -> case tyArg of+            Core.TypeEither v2 ->+              let sumTy =+                      coqTypeTerm (coqTermApp (coqTermQualid "sum") [+                        encodeType env (Core.eitherTypeLeft v2),+                        (encodeType env (Core.eitherTypeRight v2))])+              in (coqTermCast encoded sumTy)+            _ -> encoded+          Core.TermTypeApplication v1 ->+            let innerBody = Core.typeApplicationTermBody v1+                innerTyArg = Core.typeApplicationTermType v1+                innerEncoded = encodeTerm env innerBody+            in case innerBody of+              Core.TermEither _ ->+                let sumTy =+                        coqTypeTerm (coqTermApp (coqTermQualid "sum") [+                          encodeType env innerTyArg,+                          (encodeType env tyArg)])+                in (coqTermCast innerEncoded sumTy)+              _ -> encoded+          _ -> encoded))+      Core.TermTypeLambda v0 -> encodeTerm env (Core.typeLambdaBody v0)+      Core.TermUnit -> coqTermQualid "tt"+      Core.TermUnwrap v0 -> encodeWrapElim v0+      Core.TermVariable v0 -> coqTermQualid (resolveQualifiedName env (Core.unName v0))+      Core.TermWrap v0 -> encodeTerm env (Core.wrappedTermBody v0)+-- | Build a Coq `Definition name := body.` sentence from a Hydra term+encodeTermDefinition :: Environment.CoqEnvironment -> String -> Core.Term -> Syntax.SentenceContent+encodeTermDefinition env name body =+    Syntax.SentenceContentDefinition (Syntax.Definition {+      Syntax.definitionLocality = Nothing,+      Syntax.definitionName = (coqIdent name),+      Syntax.definitionBinders = [],+      Syntax.definitionType = Nothing,+      Syntax.definitionBody = (encodeTerm env body)})+-- | Wrap encodeTermDefinition in a Coq Sentence with no leading comment+encodeTermDefinitionPair :: Environment.CoqEnvironment -> (String, Core.Term) -> Syntax.Sentence+encodeTermDefinitionPair env ed =+    Syntax.Sentence {+      Syntax.sentenceComment = Nothing,+      Syntax.sentenceContent = (encodeTermDefinition env (Pairs.first ed) (Pairs.second ed))}+-- | Translate a Hydra Type into a Coq Term representing that type. The environment is consulted to resolve qualified type variable references+encodeType :: Environment.CoqEnvironment -> Core.Type -> Syntax.Term+encodeType env ty =+    case ty of+      Core.TypeAnnotated v0 -> encodeType env (Core.annotatedTypeBody v0)+      Core.TypeApplication v0 -> coqTermApp (encodeType env (Core.applicationTypeFunction v0)) [+        encodeType env (Core.applicationTypeArgument v0)]+      Core.TypeEither v0 -> coqTermApp (coqTermQualid "sum") [+        encodeType env (Core.eitherTypeLeft v0),+        (encodeType env (Core.eitherTypeRight v0))]+      Core.TypeForall v0 -> Syntax.TermForallOrFun (Syntax.ForallOrFunForall (Syntax.Forall {+        Syntax.forallBinders = (Syntax.OpenBindersBinders [+          Syntax.BinderType (Syntax.TypeBinders {+            Syntax.typeBindersNames = [+              coqName (Core.unName (Core.forallTypeParameter v0))],+            Syntax.typeBindersType = (coqTypeTerm (coqTermQualid "Type"))})]),+        Syntax.forallType = (coqTypeTerm (encodeType env (Core.forallTypeBody v0)))}))+      Core.TypeFunction v0 -> coqArrow (encodeType env (Core.functionTypeDomain v0)) (encodeType env (Core.functionTypeCodomain v0))+      Core.TypeList v0 -> coqTermApp (coqTermQualid "list") [+        encodeType env v0]+      Core.TypeLiteral v0 -> encodeLiteralType v0+      Core.TypeMap v0 -> coqTermApp (coqTermQualid "list") [+        coqTermApp (coqTermQualid "prod") [+          encodeType env (Core.mapTypeKeys v0),+          (encodeType env (Core.mapTypeValues v0))]]+      Core.TypeOptional v0 -> coqTermApp (coqTermQualid "option") [+        encodeType env v0]+      Core.TypePair v0 -> coqTermApp (coqTermQualid "prod") [+        encodeType env (Core.pairTypeFirst v0),+        (encodeType env (Core.pairTypeSecond v0))]+      Core.TypeRecord _ -> coqTermQualid "unit"+      Core.TypeSet v0 -> coqTermApp (coqTermQualid "list") [+        encodeType env v0]+      Core.TypeUnion _ -> coqTermQualid "unit"+      Core.TypeUnit -> coqTermQualid "unit"+      Core.TypeVariable v0 ->+        let raw = Core.unName v0+            headSeg = Optionals.fromOptional raw (Lists.maybeHead (Strings.splitOn "." raw))+        in (Logic.ifElse (Logic.or (Equality.equal headSeg "hydra") (Equality.equal headSeg "Build_hydra")) (coqTermQualid (resolveQualifiedName env raw)) (coqTermQualid raw))+      Core.TypeVoid -> coqTermQualid "Empty_set"+      Core.TypeWrap v0 -> encodeType env v0+-- | Build a Coq `Definition name : Type := body.` sentence from a Hydra type+encodeTypeDefinition :: Environment.CoqEnvironment -> String -> Core.Type -> Syntax.SentenceContent+encodeTypeDefinition env name ty =+    Syntax.SentenceContentDefinition (Syntax.Definition {+      Syntax.definitionLocality = Nothing,+      Syntax.definitionName = (coqIdent name),+      Syntax.definitionBinders = [],+      Syntax.definitionType = (Just (coqTypeTerm (coqTermQualid "Type"))),+      Syntax.definitionBody = (encodeType env ty)})+-- | Wrap encodeTypeDefinition in a Coq Sentence with no leading comment+encodeTypeDefinitionPair :: Environment.CoqEnvironment -> (String, Core.Type) -> Syntax.Sentence+encodeTypeDefinitionPair env td =+    Syntax.Sentence {+      Syntax.sentenceComment = Nothing,+      Syntax.sentenceContent = (encodeTypeDefinition env (Pairs.first td) (Pairs.second td))}+-- | Construct a Coq Inductive Constructor line `Name_Tag : body -> Name` for a union variant+encodeUnionConstructor :: Environment.CoqEnvironment -> String -> Core.FieldType -> Syntax.Constructor+encodeUnionConstructor env typeName f =++      let ufn = Core.fieldTypeName f+          uft = Core.fieldTypeType f+          constrName =+                  Strings.cat [+                    typeName,+                    "_",+                    (Formatting.capitalize (Core.unName ufn))]+      in Syntax.Constructor {+        Syntax.constructorName = (coqIdent constrName),+        Syntax.constructorBinders = [],+        Syntax.constructorType = (Just (coqTypeTerm (coqArrow (encodeType env uft) (coqTermQualid typeName))))}+-- | Build a Coq match expression from a Hydra union eliminator. Uses the constructor-count map in the environment to decide whether the match is exhaustive: if so, an explicit default is suppressed; if not and the kernel didn't provide one, inserts `| _ => hydra_unreachable`.+encodeUnionElim :: Environment.CoqEnvironment -> Core.CaseStatement -> Syntax.Term+encodeUnionElim env cs =++      let csName = Core.caseStatementTypeName cs+          csCases = Core.caseStatementCases cs+          csDefault = Core.caseStatementDefault cs+          csLocalName = localTypeName (Core.unName csName)+          expectedCount = Maps.lookup csLocalName (Environment.coqEnvironmentConstructorCounts env)+          caseCount = Lists.length csCases+          baseEqs =+                  Lists.map (\c ->+                    let cfn = Core.caseAlternativeName c+                        cft = Core.caseAlternativeHandler c+                        constr = resolveQualifiedName env (unionConstructorName (Core.unName csName) (Core.unName cfn))+                    in (Logic.ifElse (isUnitLambda cft) (Syntax.Equation {+                      Syntax.equationPattern = [+                        [+                          Syntax.PatternPattern (Syntax.Pattern10Qualiid (Syntax.Pattern10_Qualid {+                            Syntax.pattern10_QualidQualid = (coqQualid constr),+                            Syntax.pattern10_QualidPatterns = [+                              Syntax.Pattern1 {+                                Syntax.pattern1Pattern = (Syntax.Pattern0Qualid (coqQualid "_")),+                                Syntax.pattern1Scope = Nothing}]}))]],+                      Syntax.equationTerm = (encodeTerm env (unitLambdaBody cft))}) (Syntax.Equation {+                      Syntax.equationPattern = [+                        [+                          Syntax.PatternPattern (Syntax.Pattern10Qualiid (Syntax.Pattern10_Qualid {+                            Syntax.pattern10_QualidQualid = (coqQualid constr),+                            Syntax.pattern10_QualidPatterns = [+                              Syntax.Pattern1 {+                                Syntax.pattern1Pattern = (Syntax.Pattern0Qualid (coqQualid "v_")),+                                Syntax.pattern1Scope = Nothing}]}))]],+                      Syntax.equationTerm = (coqTermApp (encodeTerm env cft) [+                        coqTermQualid "v_"])}))) csCases+          wildcardEq =+                  \body -> Syntax.Equation {+                    Syntax.equationPattern = [+                      [+                        Syntax.PatternPattern (Syntax.Pattern10Qualiid (Syntax.Pattern10_Qualid {+                          Syntax.pattern10_QualidQualid = (coqQualid "_"),+                          Syntax.pattern10_QualidPatterns = []}))]],+                    Syntax.equationTerm = body}+          defaultEqs =+                  Optionals.cases csDefault (Logic.ifElse (Optionals.cases expectedCount False (\n -> Logic.not (Equality.gte caseCount n))) [+                    wildcardEq (coqTermQualid "hydra_unreachable")] []) (\defT -> Logic.ifElse (Optionals.cases expectedCount False (\n -> Equality.gte caseCount n)) [] [+                    wildcardEq (encodeTerm env defT)])+          allEqs = Lists.concat2 baseEqs defaultEqs+      in (Syntax.TermForallOrFun (Syntax.ForallOrFunFun (Syntax.Fun {+        Syntax.funBinders = (Syntax.OpenBindersBinders [+          Syntax.BinderName (coqName "x_")]),+        Syntax.funBody = (Syntax.TermTerm100 (Syntax.Term100Term10 (Syntax.Term10OneTerm (Syntax.OneTermTerm1 (Syntax.Term1Term0 (Syntax.Term0Match (Syntax.Match {+          Syntax.matchCaseItems = [+            Syntax.CaseItem {+              Syntax.caseItemTerm = (Syntax.Term100Term10 (Syntax.Term10OneTerm (Syntax.OneTermExplicit (Syntax.QualidAnnotated {+                Syntax.qualidAnnotatedQualid = (coqQualid "x_"),+                Syntax.qualidAnnotatedUnivAnnot = Nothing})))),+              Syntax.caseItemAs = Nothing,+              Syntax.caseItemIn = Nothing}],+          Syntax.matchReturn = Nothing,+          Syntax.matchPipe = True,+          Syntax.matchEquations = allEqs})))))))})))+-- | A Hydra wrap eliminator is just the identity on the wrapped object in Coq+encodeWrapElim :: t0 -> Syntax.Term+encodeWrapElim _n =+    Syntax.TermForallOrFun (Syntax.ForallOrFunFun (Syntax.Fun {+      Syntax.funBinders = (Syntax.OpenBindersBinders [+        Syntax.BinderName (coqName "w_")]),+      Syntax.funBody = (coqTermQualid "w_")}))+-- | Escape a string for Coq string literals: double any embedded quotes+escapeCoqString :: String -> String+escapeCoqString s = Strings.intercalate "\"\"" (Strings.splitOn "\"" s)+-- | Collect a chain of leading lambdas as Coq binders, converting type annotations as well+extractLambdaBinders :: Environment.CoqEnvironment -> Core.Term -> [Syntax.Binder]+extractLambdaBinders env tm =+    case tm of+      Core.TermAnnotated v0 -> extractLambdaBinders env (Core.annotatedTermBody v0)+      Core.TermLambda v0 ->+        let param = Core.lambdaParameter v0+            mDomain = Core.lambdaDomain v0+            binder =+                    Optionals.cases mDomain (Syntax.BinderName (coqName (Core.unName param))) (\domTy -> Syntax.BinderType (Syntax.TypeBinders {+                      Syntax.typeBindersNames = [+                        coqName (Core.unName param)],+                      Syntax.typeBindersType = (coqTypeTerm (encodeType env domTy))}))+        in (Lists.cons binder (extractLambdaBinders env (Core.lambdaBody v0)))+      _ -> []+-- | True if the Maybe Type is the unit type, looking through annotations+isUnitDomain :: Maybe Core.Type -> Bool+isUnitDomain mty =+    Optionals.cases mty False (\ty -> case ty of+      Core.TypeUnit -> True+      Core.TypeRecord v0 -> Lists.null v0+      Core.TypeAnnotated v0 -> isUnitDomain (Just (Core.annotatedTypeBody v0))+      _ -> False)+-- | Detect a lambda over the unit type whose parameter is not referenced in the body+isUnitLambda :: Core.Term -> Bool+isUnitLambda tm =+    case tm of+      Core.TermAnnotated v0 -> isUnitLambda (Core.annotatedTermBody v0)+      Core.TermLambda v0 ->+        let unused = Logic.not (termReferencesVar (Core.lambdaParameter v0) (Core.lambdaBody v0))+        in (Logic.and (isUnitDomain (Core.lambdaDomain v0)) unused)+      _ -> False+-- | Take the last dot-separated segment of a (possibly) qualified Hydra name and sanitize it+localTypeName :: String -> String+localTypeName s =++      let parts = Strings.splitOn "." s+          localPart = Optionals.fromOptional s (Lists.maybeLast parts)+      in (sanitizeVar localPart)+-- | Build a Coq Document from lists of type definitions and term definitions+moduleToCoq :: Environment.CoqEnvironment -> [(String, Core.Type)] -> [(String, Core.Term)] -> Syntax.Document+moduleToCoq env typeDefs termDefs =++      let typesSentences = Lists.map (\td -> encodeTypeDefinitionPair env td) typeDefs+          termsSentences = Lists.map (\ed -> encodeTermDefinitionPair env ed) termDefs+      in Syntax.Document {+        Syntax.documentSentences = (Lists.concat [+          [+            standardImports],+          typesSentences,+          termsSentences])}+-- | Rewrite a stripped hydra.lib.<mod>.<func> name to avoid Coq keyword collisions+renameLibKeyword :: String -> String+renameLibKeyword s =+    Logic.ifElse (Equality.equal s "lists.at") "lists.at_" (Logic.ifElse (Equality.equal s "math.mod") "math.mod_" s)+-- | Emit a Coq `Require Import m1 m2 ...` sentence with a `Standard library imports` comment+requireImportSentence :: [String] -> Syntax.Sentence+requireImportSentence mods =+    Syntax.Sentence {+      Syntax.sentenceComment = (Just (Syntax.Comment "Standard library imports")),+      Syntax.sentenceContent = (Syntax.SentenceContentRequireImport (Syntax.RequireImport {+        Syntax.requireImportFrom = Nothing,+        Syntax.requireImportRequire = True,+        Syntax.requireImportQualification = (Just Syntax.ImportQualificationImport),+        Syntax.requireImportModules = (Lists.map (\m -> coqQualid m) mods)}))}+-- | Resolve a (possibly qualified) Hydra identifier to the form that should appear in Coq source+resolveQualifiedName :: Environment.CoqEnvironment -> String -> String+resolveQualifiedName env s =++      let parts = Strings.splitOn "." s+          head1 = Optionals.fromOptional s (Lists.maybeHead parts)+          currentNs = Environment.coqEnvironmentCurrentNamespace env+          ambig = Environment.coqEnvironmentAmbiguousNames env+      in (Logic.ifElse (Equality.equal head1 "Coq") (Optionals.fromOptional s (Lists.maybeLast parts)) (Logic.ifElse (Equality.equal head1 "Build_hydra") (Strings.cat2 "Build_" (sanitizeStripped (Optionals.fromOptional s (Lists.maybeLast parts)))) (Logic.ifElse (Equality.equal head1 "hydra") (+        let rest = Lists.drop 1 parts+            head2 = Optionals.fromOptional "" (Lists.maybeHead rest)+        in (Logic.ifElse (Equality.equal head2 "lib") (renameLibKeyword (Strings.intercalate "." (Lists.drop 1 rest))) (+          let localRaw = Optionals.fromOptional s (Lists.maybeLast parts)+              localN = sanitizeStripped localRaw+              sourceNs = Strings.intercalate "." (Optionals.fromOptional [] (Lists.maybeInit parts))+              isCurrent = Equality.equal sourceNs currentNs+              isAmbig = Sets.member localRaw ambig+              isCollisionProne =+                      Logic.and (Equality.equal (Lists.length parts) 3) (Logic.and (Equality.equal head2 "parsers") (Logic.not isCurrent))+          in (Logic.ifElse (Logic.and isAmbig (Logic.not isCurrent)) (Strings.cat [+            sourceNs,+            ".",+            localN]) (Logic.ifElse isCollisionProne (Strings.cat [+            sanitizeStripped head2,+            ".",+            (sanitizeStripped localRaw)]) localN))))) (sanitizeVar s))))+-- | Append an underscore if a stripped-local-name reference collides with a Coq reserved word+sanitizeStripped :: String -> String+sanitizeStripped s = Formatting.escapeWithUnderscore Language.coqStrippedReservedWords s+-- | Append an underscore if the name collides with a Coq reserved word+sanitizeVar :: String -> String+sanitizeVar s = Formatting.escapeWithUnderscore Language.coqReservedWords s+-- | The Coq stdlib modules plus the hand-written hydra.lib.base axioms+standardImports :: Syntax.Sentence+standardImports =+    requireImportSentence [+      "Stdlib.Strings.String",+      "Stdlib.Lists.List",+      "Stdlib.ZArith.ZArith",+      "Stdlib.QArith.QArith",+      "hydra.lib.base"]+-- | Peel off leading lambdas and annotations, returning the first non-lambda body+stripLambdas :: Core.Term -> Core.Term+stripLambdas tm =+    case tm of+      Core.TermAnnotated v0 -> stripLambdas (Core.annotatedTermBody v0)+      Core.TermLambda v0 -> stripLambdas (Core.lambdaBody v0)+      _ -> tm+-- | Syntactic free-variable check over the shapes encodeTerm walks through+termReferencesVar :: Core.Name -> Core.Term -> Bool+termReferencesVar name tm =+    case tm of+      Core.TermVariable v0 -> Equality.equal v0 name+      Core.TermAnnotated v0 -> termReferencesVar name (Core.annotatedTermBody v0)+      Core.TermApplication v0 -> Logic.or (termReferencesVar name (Core.applicationFunction v0)) (termReferencesVar name (Core.applicationArgument v0))+      Core.TermLambda v0 -> termReferencesVar name (Core.lambdaBody v0)+      Core.TermCases v0 -> Logic.or (Optionals.isGiven (Lists.find (\f -> termReferencesVar name (Core.caseAlternativeHandler f)) (Core.caseStatementCases v0))) (Optionals.cases (Core.caseStatementDefault v0) False (\d -> termReferencesVar name d))+      Core.TermLet v0 -> Logic.or (Optionals.isGiven (Lists.find (\b -> termReferencesVar name (Core.bindingTerm b)) (Core.letBindings v0))) (termReferencesVar name (Core.letBody v0))+      Core.TermList v0 -> Optionals.isGiven (Lists.find (\el -> termReferencesVar name el) v0)+      Core.TermOptional v0 -> Optionals.cases v0 False (\el -> termReferencesVar name el)+      Core.TermPair v0 -> Logic.or (termReferencesVar name (Pairs.first v0)) (termReferencesVar name (Pairs.second v0))+      Core.TermRecord v0 -> Optionals.isGiven (Lists.find (\f -> termReferencesVar name (Core.fieldTerm f)) (Core.recordFields v0))+      Core.TermInject v0 -> termReferencesVar name (Core.fieldTerm (Core.injectionField v0))+      Core.TermEither v0 -> Eithers.either (\l -> termReferencesVar name l) (\r -> termReferencesVar name r) v0+      Core.TermTypeApplication v0 -> termReferencesVar name (Core.typeApplicationTermBody v0)+      Core.TermTypeLambda v0 -> termReferencesVar name (Core.typeLambdaBody v0)+      Core.TermWrap v0 -> termReferencesVar name (Core.wrappedTermBody v0)+      _ -> False+-- | Combine a type name and field name into a constructor identifier, preserving the namespace prefix+unionConstructorName :: String -> String -> String+unionConstructorName typeName fieldName =++      let parts = Strings.splitOn "." typeName+          localPart = Optionals.fromOptional typeName (Lists.maybeLast parts)+          prefixParts = Optionals.fromOptional [] (Lists.maybeInit parts)+          prefix = Logic.ifElse (Lists.null prefixParts) "" (Strings.cat2 (Strings.intercalate "." prefixParts) ".")+          sanitized = sanitizeVar localPart+      in (Strings.cat [+        prefix,+        sanitized,+        "_",+        (Formatting.capitalize fieldName)])+-- | Peel the outer unit lambda off a term, returning the body+unitLambdaBody :: Core.Term -> Core.Term+unitLambdaBody tm =+    case tm of+      Core.TermAnnotated v0 -> unitLambdaBody (Core.annotatedTermBody v0)+      Core.TermLambda v0 -> Core.lambdaBody v0+      _ -> tm
+ src/main/haskell/Hydra/Coq/Environment.hs view
@@ -0,0 +1,26 @@+-- Note: this is an automatically generated file. Do not edit.+-- | Environment types for Coq code generation++module Hydra.Coq.Environment where+import qualified Hydra.Core as Core+import Prelude hiding  (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+import qualified Data.Map as M+import qualified Data.Set as S+-- | Cross-module state threaded through the Coq encoder+data CoqEnvironment =+  CoqEnvironment {+    -- | The Hydra namespace of the module currently being encoded (e.g. "hydra.core"). Used by the name resolver to decide whether a cross-namespace reference needs to stay qualified.+    coqEnvironmentCurrentNamespace :: String,+    -- | Number of constructors in each union type, keyed by local type name (e.g. "Term" -> 14). Used to decide whether a match is exhaustive.+    coqEnvironmentConstructorCounts :: (M.Map String Int),+    -- | Local names (without namespace prefix) that are defined in more than one module. References to these must be kept fully qualified.+    coqEnvironmentAmbiguousNames :: (S.Set String),+    -- | Accessor names for record fields that were sanitized to unit due to Coq's strict positivity requirement. Applications of these accessors are replaced with hydra_unreachable at emission time.+    coqEnvironmentSanitizedAccessors :: (S.Set String)}+  deriving (Eq, Ord, Read, Show)+_CoqEnvironment = Core.Name "hydra.coq.environment.CoqEnvironment"+_CoqEnvironment_currentNamespace = Core.Name "currentNamespace"+_CoqEnvironment_constructorCounts = Core.Name "constructorCounts"+_CoqEnvironment_ambiguousNames = Core.Name "ambiguousNames"+_CoqEnvironment_sanitizedAccessors = Core.Name "sanitizedAccessors"
+ src/main/haskell/Hydra/Coq/Generate.hs view
@@ -0,0 +1,762 @@+-- Note: this is an automatically generated file. Do not edit.+-- | Coq code generation driver — pre-passes, sentence producers, and per-module pipeline++module Hydra.Coq.Generate where+import qualified Hydra.Ast as Ast+import qualified Hydra.Coders as Coders+import qualified Hydra.Coq.Coder as Coder+import qualified Hydra.Coq.Environment as Environment+import qualified Hydra.Coq.Language as Language+import qualified Hydra.Coq.Serde as Serde+import qualified Hydra.Coq.Syntax as Syntax+import qualified Hydra.Coq.Utils as Utils+import qualified Hydra.Core as Core+import qualified Hydra.Error.Checking as Checking+import qualified Hydra.Error.Core as ErrorCore+import qualified Hydra.Error.Packaging as ErrorPackaging+import qualified Hydra.Errors as Errors+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Graph as Graph+import qualified Hydra.Json.Model as Model+import qualified Hydra.Overlay.Haskell.Lib.Equality as Equality+import qualified Hydra.Overlay.Haskell.Lib.Lists as Lists+import qualified Hydra.Overlay.Haskell.Lib.Literals as Literals+import qualified Hydra.Overlay.Haskell.Lib.Logic as Logic+import qualified Hydra.Overlay.Haskell.Lib.Maps as Maps+import qualified Hydra.Overlay.Haskell.Lib.Math as Math+import qualified Hydra.Overlay.Haskell.Lib.Optionals as Optionals+import qualified Hydra.Overlay.Haskell.Lib.Pairs as Pairs+import qualified Hydra.Overlay.Haskell.Lib.Sets as Sets+import qualified Hydra.Overlay.Haskell.Lib.Strings as Strings+import qualified Hydra.Packaging as Packaging+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Paths as Paths+import qualified Hydra.Query as Query+import qualified Hydra.Relational as Relational+import qualified Hydra.Scoping as Scoping+import qualified Hydra.Serialization as Serialization+import qualified Hydra.Tabular as Tabular+import qualified Hydra.Testing as Testing+import qualified Hydra.Topology as Topology+import qualified Hydra.Typed as Typed+import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util+import qualified Hydra.Validation as Validation+import qualified Hydra.Variants as Variants+import Prelude hiding  (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+import qualified Data.Map as M+import qualified Data.Set as S+-- | Render an axiom-only Coq module: imports + dependency imports + Axiom declarations+buildAxiomOnlyContent :: Environment.CoqEnvironment -> String -> t0 -> [(String, t1)] -> [(String, (t2, ([Core.Name], (Maybe Core.Type))))] -> Packaging.Module -> String+buildAxiomOnlyContent env desc nsStr typeDefs termDefs mod_ =++      let typeOfType = Core.TypeVariable (Core.Name "Type")+          typeAxioms = Lists.map (\nt -> Coder.encodeAxiomDefinitionPair env (Pairs.first nt, typeOfType)) typeDefs+          termAxioms =+                  Optionals.cat (Lists.map (\td ->+                    let name = Pairs.first td+                        tvars = Pairs.first (Pairs.second (Pairs.second td))+                        mty = Pairs.second (Pairs.second (Pairs.second td))+                    in (Optionals.cases mty Nothing (\schemeTy ->+                      let wrapped =+                              Lists.foldr (\v -> \t -> Core.TypeForall (Core.ForallType {+                                Core.forallTypeParameter = v,+                                Core.forallTypeBody = t})) schemeTy tvars+                      in (Just (Coder.encodeAxiomDefinitionPair env (name, wrapped)))))) termDefs)+          deps = Utils.moduleDependencyNames mod_+          depSentences = dependencyImports deps+          allSentences = Lists.cons Coder.standardImports (Lists.concat2 depSentences (Lists.concat2 typeAxioms termAxioms))+          doc_ = Syntax.Document {+                Syntax.documentSentences = allSentences}+          body = Serialization.printExpr (Serialization.parenthesize (Serde.documentToExpr doc_))+      in (Strings.cat [+        desc,+        body,+        "\n"])+-- | Assemble the full (non-axiom) Coq source for a module+buildFullModule :: Ord t1 => (Environment.CoqEnvironment -> M.Map (String, String) String -> t0 -> String -> t1 -> String -> [(String, Core.Type)] -> [(String, (Core.Term, ([Core.Name], (Maybe Core.Type))))] -> M.Map t1 String)+buildFullModule env fieldMap mod_ nsStr path desc typeDefs termDefs =++      let termDefsForSort = Lists.map (\td -> (Pairs.first td, (Pairs.first (Pairs.second td)))) termDefs+          termDefMap = Maps.fromList (Lists.map (\td -> (Pairs.first td, (Pairs.second td))) termDefs)+          termGroups = Utils.sortTermDefsSCC termDefsForSort+          termGroups2 =+                  Lists.map (\cg ->+                    let cyc = Pairs.first cg+                        grp = Pairs.second cg+                        enriched =+                                Optionals.cat (Lists.map (\nt ->+                                  let nm = Pairs.first nt+                                      t = Pairs.second nt+                                  in (Optionals.map (\rec ->+                                    let body2 = Utils.normalizeInnerTypeLambdas (Utils.rewriteTermFields fieldMap t)+                                        rest = Pairs.second rec+                                        vs = Pairs.first rest+                                        mty = Pairs.second rest+                                    in (nm, (body2, (vs, mty)))) (Maps.lookup nm termDefMap))) grp)+                    in (cyc, enriched)) termGroups+          typeGroups = Utils.sortTypeDefsSCC typeDefs+          typeSentences = Lists.concat (Lists.map (\g -> generateTypeGroup env g) typeGroups)+          termRenderedParts =+                  Lists.concat (Lists.map (\cg ->+                    let cyc = Pairs.first cg+                        grp = Pairs.second cg+                    in (Logic.ifElse cyc [+                      encodeMutualGroupText env grp] (Lists.map (\td ->+                      let sentences = encodeTermGroupSingleton env td+                          nm = Pairs.first td+                          body = Pairs.first (Pairs.second td)+                          tv = Pairs.first (Pairs.second (Pairs.second td))+                          schemeVarNames = Sets.fromList (Lists.map (\n -> Core.unName n) tv)+                          body2 = Utils.reorderLetBindings (Utils.eraseUnboundTypeVarDomains schemeVarNames body)+                          binders = mkTypeBinders body2 tv+                          allTypeVarNames = Pairs.first binders+                          rendered = renderSentences sentences+                          argsLine =+                                  Logic.ifElse (Lists.null allTypeVarNames) "" (Strings.cat [+                                    "\nArguments ",+                                    nm,+                                    " ",+                                    (Strings.intercalate " " (Lists.map (\v -> Strings.cat [+                                      "{",+                                      v,+                                      "}"]) allTypeVarNames)),+                                    "."])+                      in (Strings.cat [+                        rendered,+                        argsLine,+                        "\n"])) grp))) termGroups2)+          allQualifiedNamesFromTypes = Sets.unions (Lists.map (\nt -> Utils.collectQualifiedNamesInType (Pairs.second nt)) typeDefs)+          allQualifiedNamesFromTerms =+                  Sets.unions (Lists.map (\td -> Utils.collectQualifiedNamesInTerm (Pairs.first (Pairs.second td))) termDefs)+          allQualifiedNamesFromTermTypes =+                  Sets.unions (Optionals.cat (Lists.map (\td ->+                    let mty = Pairs.second (Pairs.second (Pairs.second td))+                    in (Optionals.map (\ty ->+                      let ep = Utils.extractTypeParams ty+                          bodyTy = Pairs.second ep+                      in (Utils.collectQualifiedNamesInType bodyTy)) mty)) termDefs))+          allQualifiedNames =+                  Sets.union allQualifiedNamesFromTypes (Sets.union allQualifiedNamesFromTerms allQualifiedNamesFromTermTypes)+          nsSet = Sets.fromList (Lists.map (\q -> Utils.extractQualifiedNamespace q) (Sets.toList allQualifiedNames))+          strStartsWith =+                  \pref -> \s -> Logic.and (Equality.gte (Strings.length s) (Strings.length pref)) (Equality.equal (Strings.fromList (Lists.take (Strings.length pref) (Strings.toList s))) pref)+          hasStrictSuffix =+                  \nsC -> \otherList -> Optionals.isGiven (Lists.find (\other -> Logic.and (Logic.not (Equality.equal other nsC)) (strStartsWith (Strings.cat [+                    nsC,+                    "."]) other)) otherList)+          referencedNs =+                  Lists.nub (Lists.filter (\nsC -> Logic.and (Logic.not (Equality.equal nsC nsStr)) (Logic.not (hasStrictSuffix nsC (Sets.toList nsSet)))) (Sets.toList nsSet))+          depSentences = dependencyImports referencedNs+          importText = renderRequireImports depSentences+          typeSentencesText = renderSentences typeSentences+          allTermText = Strings.cat termRenderedParts+          typeArgsDecls = generateArgumentsDecls typeDefs+          content =+                  Strings.cat [+                    desc,+                    importText,+                    "\n",+                    typeSentencesText,+                    "\n",+                    allTermText,+                    typeArgsDecls,+                    "\n"]+      in (Maps.fromList [+        (path, content)])+-- | Emit a Require Import sentence for the given dependency namespaces; empty list yields no sentence+dependencyImports :: [String] -> [Syntax.Sentence]+dependencyImports deps =+    Logic.ifElse (Lists.null deps) [] [+      Syntax.Sentence {+        Syntax.sentenceComment = (Just (Syntax.Comment "Module dependencies")),+        Syntax.sentenceContent = (Syntax.SentenceContentRequireImport (Syntax.RequireImport {+          Syntax.requireImportFrom = Nothing,+          Syntax.requireImportRequire = True,+          Syntax.requireImportQualification = (Just Syntax.ImportQualificationImport),+          Syntax.requireImportModules = (Lists.map (\d -> Coder.coqQualid d) deps)}))}]+-- | Render a mutually recursive term group as a hydra_fix bundle plus projection Definitions+encodeMutualGroupText :: Environment.CoqEnvironment -> [(String, (Core.Term, ([Core.Name], (Maybe Core.Type))))] -> String+encodeMutualGroupText env group =++      let groupSchemeVars =+              Sets.fromList (Lists.concat (Lists.map (\td ->+                let rest1 = Pairs.second td+                    rest2 = Pairs.second rest1+                    tv = Pairs.first rest2+                in (Lists.map (\n -> Core.unName n) tv)) group))+          funInfos =+                  Lists.map (\td ->+                    let name = Pairs.first td+                        rest1 = Pairs.second td+                        body = Pairs.first rest1+                        rest2 = Pairs.second rest1+                        mType = Pairs.second rest2+                        body2 = Utils.reorderLetBindings (Utils.eraseUnboundTypeVarDomains groupSchemeVars body)+                        coqBody = Coder.encodeTerm env body2+                        bodyText = Serialization.printExpr (Serialization.parenthesize (Serde.termToExpr coqBody))+                        typeText =+                                Optionals.cases mType "_" (\ty ->+                                  let ep = Utils.extractTypeParams ty+                                      bodyTy = Pairs.second ep+                                  in (Serialization.printExpr (Serialization.parenthesize (Serde.typeToExpr (Syntax.Type (Coder.encodeType env bodyTy))))))+                    in (name, (typeText, bodyText))) group+          allTypeVarNames =+                  Lists.nub (Lists.concat (Lists.map (\td ->+                    let rest1 = Pairs.second td+                        b = Pairs.first rest1+                        rest2 = Pairs.second rest1+                        tv = Pairs.first rest2+                        binders = mkTypeBinders b tv+                    in (Pairs.first binders)) group))+          names = Lists.map (\fi -> Pairs.first fi) funInfos+          bundleName =+                  Strings.cat [+                    Strings.intercalate "_" (Lists.take 2 names),+                    "_bundle"]+          n = Lists.length funInfos+          types = Lists.map (\fi -> Pairs.first (Pairs.second fi)) funInfos+          productType = makeProdType types+          projExprs = makeProjectionExprs n "bundle_"+          letParts =+                  Lists.map (\np ->+                    let nm = Pairs.first (Pairs.first np)+                        proj = Pairs.second np+                    in (Strings.cat [+                      nm,+                      " := ",+                      proj])) (Lists.zip funInfos projExprs)+          letBlock =+                  Logic.ifElse (Lists.null letParts) "" (Strings.cat [+                    "let ",+                    (Strings.intercalate " in\n    let " letParts),+                    " in\n    "])+          bodies = Lists.map (\fi -> Pairs.second (Pairs.second fi)) funInfos+          prodVal = makeProdVal bodies+          typBindText =+                  Logic.ifElse (Lists.null allTypeVarNames) "" (Strings.cat [+                    " ",+                    (Strings.intercalate " " (Lists.map (\v -> Strings.cat [+                      "(",+                      v,+                      " : Type)"]) allTypeVarNames))])+          bundleArgsLine = implicitArgsLine bundleName allTypeVarNames+          bundleDef =+                  Strings.cat [+                    "Definition ",+                    bundleName,+                    typBindText,+                    " :=\n  hydra_fix (fun (bundle_ : ",+                    productType,+                    ") =>\n    ",+                    letBlock,+                    prodVal,+                    ").\n",+                    bundleArgsLine]+          indexed = Lists.zip (Math.range 0 (Math.sub n 1)) funInfos+          projDefs =+                  Strings.cat (Lists.map (\iFi ->+                    let i = Pairs.first iFi+                        fi = Pairs.second iFi+                        nm = Pairs.first fi+                        t = Pairs.first (Pairs.second fi)+                        projText0 = Optionals.fromOptional "" (Maps.lookup i (Maps.fromList (Lists.zip (Math.range 0 (Math.sub n 1)) projExprs)))+                        projText = replaceBundle projText0 bundleName+                        argsDef = implicitArgsLine nm allTypeVarNames+                    in (Strings.cat [+                      "Definition ",+                      nm,+                      typBindText,+                      " : ",+                      t,+                      " :=\n  ",+                      projText,+                      ".\n",+                      argsDef])) indexed)+      in (Strings.cat [+        bundleDef,+        "\n",+        projDefs])+-- | Encode a non-cyclic term definition as a Coq Definition sentence+encodeTermGroupSingleton :: Environment.CoqEnvironment -> (String, (Core.Term, ([Core.Name], (Maybe Core.Type)))) -> [Syntax.Sentence]+encodeTermGroupSingleton env td =++      let name = Pairs.first td+          rest1 = Pairs.second td+          body = Pairs.first rest1+          rest2 = Pairs.second rest1+          typeVars = Pairs.first rest2+          mType = Pairs.second rest2+          schemeVarNames = Sets.fromList (Lists.map (\n -> Core.unName n) typeVars)+          body2 = Utils.reorderLetBindings (Utils.eraseUnboundTypeVarDomains schemeVarNames body)+          coqBody = Coder.encodeTerm env body2+          binders = mkTypeBinders body2 typeVars+          typeBinders = Pairs.second binders+          returnType =+                  Optionals.cases mType Nothing (\ty ->+                    let ep = Utils.extractTypeParams ty+                        bodyTy = Pairs.second ep+                    in (Just (Syntax.Type (Coder.encodeType env bodyTy))))+      in [+        Syntax.Sentence {+          Syntax.sentenceComment = Nothing,+          Syntax.sentenceContent = (Syntax.SentenceContentDefinition (Syntax.Definition {+            Syntax.definitionLocality = Nothing,+            Syntax.definitionName = (Coder.coqIdent name),+            Syntax.definitionBinders = typeBinders,+            Syntax.definitionType = returnType,+            Syntax.definitionBody = coqBody}))}]+-- | Produce Arguments {p} declarations for every parameterized type's constructor and field accessors+generateArgumentsDecls :: [(String, Core.Type)] -> String+generateArgumentsDecls typeDefs =++      let implicitAll =+              \params -> Strings.intercalate " " (Lists.map (\p -> Strings.cat [+                "{",+                p,+                "}"]) params)+          linesFor =+                  \triple ->+                    let name = Pairs.first triple+                        params = Pairs.first (Pairs.second triple)+                        bodyTy = Pairs.second (Pairs.second triple)+                        impAll = implicitAll params+                    in case bodyTy of+                      Core.TypeUnion v0 -> Lists.map (\ft -> Strings.cat [+                        "Arguments ",+                        name,+                        "_",+                        (Formatting.capitalize (Core.unName (Core.fieldTypeName ft))),+                        " ",+                        impAll,+                        "."]) v0+                      Core.TypeRecord v0 -> Logic.ifElse (Lists.null v0) [] (+                        let constrLine =+                                Strings.cat [+                                  "Arguments Build_",+                                  name,+                                  " ",+                                  impAll,+                                  "."]+                            fieldLines =+                                    Lists.map (\ft -> Strings.cat [+                                      "Arguments ",+                                      (Formatting.decapitalize name),+                                      "_",+                                      (Utils.sanitize (Utils.localName (Core.unName (Core.fieldTypeName ft)))),+                                      " ",+                                      impAll,+                                      "."]) v0+                        in (Lists.cons constrLine fieldLines))+                      _ -> []+          triples =+                  Optionals.cat (Lists.map (\nt ->+                    let name = Pairs.first nt+                        ty = Pairs.second nt+                        ep = Utils.extractTypeParams ty+                        params = Pairs.first ep+                        bodyTy = Pairs.second ep+                    in (Logic.ifElse (Lists.null params) Nothing (Just (name, (params, bodyTy))))) typeDefs)+          allLines = Lists.concat (Lists.map linesFor triples)+      in (Logic.ifElse (Lists.null allLines) "" (Strings.cat [+        "\n",+        (Strings.intercalate "\n" allLines),+        "\n"]))+-- | Emit Coq sentences for a type-definition SCC group, handling mutual recursion and positivity+generateTypeGroup :: Environment.CoqEnvironment -> (Bool, [(String, Core.Type)]) -> [Syntax.Sentence]+generateTypeGroup env group =++      let cyclic = Pairs.first group+          defs = Pairs.second group+      in (Logic.ifElse (Logic.and (Logic.not cyclic) (Equality.equal (Lists.length defs) 1)) (Optionals.fromOptional [] (Optionals.map (\d -> generateTypeSentence env (Pairs.first d) (Pairs.second d)) (Lists.maybeHead defs))) (+        let groupNames = Sets.fromList (Lists.map (\d -> Pairs.first d) defs)+            hasPositivity = Utils.hasPositivityIssue groupNames defs+            sanitizedGroup =+                    Logic.ifElse hasPositivity (Lists.map (\d -> (Pairs.first d, (Utils.sanitizePositivity groupNames (Pairs.second d)))) defs) defs+            bodies = Lists.concat (Lists.map (\d -> makeInductiveBody env (Pairs.first d) (Pairs.second d)) sanitizedGroup)+            accessors = Lists.concat (Lists.map (\d -> makeAccessorDefs d) sanitizedGroup)+            inductiveSent =+                    Logic.ifElse (Lists.null bodies) [] [+                      Syntax.Sentence {+                        Syntax.sentenceComment = Nothing,+                        Syntax.sentenceContent = (Syntax.SentenceContentInductive (Syntax.InductiveDefinition {+                          Syntax.inductiveDefinitionLocality = Nothing,+                          Syntax.inductiveDefinitionCoinductive = False,+                          Syntax.inductiveDefinitionBodies = bodies}))}]+        in (Lists.concat2 inductiveSent accessors)))+-- | Generate the Coq sentence(s) for a non-cyclic type definition+generateTypeSentence :: Environment.CoqEnvironment -> String -> Core.Type -> [Syntax.Sentence]+generateTypeSentence env name ty =++      let extracted = Utils.extractTypeParams ty+          params = Pairs.first extracted+          bodyTy = Pairs.second extracted+          paramBinders =+                  Lists.map (\p -> Syntax.BinderType (Syntax.TypeBinders {+                    Syntax.typeBindersNames = [+                      Coder.coqName p],+                    Syntax.typeBindersType = (Syntax.Type (Coder.coqTermQualid "Type"))})) params+          mkDef =+                  \n -> \binders -> \body -> Syntax.Sentence {+                    Syntax.sentenceComment = Nothing,+                    Syntax.sentenceContent = (Syntax.SentenceContentDefinition (Syntax.Definition {+                      Syntax.definitionLocality = Nothing,+                      Syntax.definitionName = (Coder.coqIdent n),+                      Syntax.definitionBinders = binders,+                      Syntax.definitionType = (Just (Syntax.Type (Coder.coqTermQualid "Type"))),+                      Syntax.definitionBody = body}))}+      in case bodyTy of+        Core.TypeUnion v0 ->+          let body =+                  Syntax.InductiveBody {+                    Syntax.inductiveBodyName = (Coder.coqIdent name),+                    Syntax.inductiveBodyBinders = paramBinders,+                    Syntax.inductiveBodyType = (Just (Syntax.Type (Coder.coqTermQualid "Type"))),+                    Syntax.inductiveBodyConstructors = (Lists.map (\ft -> makeConstructor env name params ft) v0)}+              indDef =+                      Syntax.InductiveDefinition {+                        Syntax.inductiveDefinitionLocality = Nothing,+                        Syntax.inductiveDefinitionCoinductive = False,+                        Syntax.inductiveDefinitionBodies = [+                          body]}+          in [+            Syntax.Sentence {+              Syntax.sentenceComment = Nothing,+              Syntax.sentenceContent = (Syntax.SentenceContentInductive indDef)}]+        Core.TypeRecord v0 -> Logic.ifElse (Lists.null v0) [+          mkDef name paramBinders (Coder.coqTermQualid "unit")] [+          Syntax.Sentence {+            Syntax.sentenceComment = Nothing,+            Syntax.sentenceContent = (Syntax.SentenceContentRecord (Syntax.RecordDefinition {+              Syntax.recordDefinitionLocality = Nothing,+              Syntax.recordDefinitionName = (Coder.coqIdent name),+              Syntax.recordDefinitionBinders = paramBinders,+              Syntax.recordDefinitionSort = (Just Syntax.SortType),+              Syntax.recordDefinitionBody = Syntax.RecordBody {+                Syntax.recordBodyConstructor = (Just (Coder.coqIdent (Strings.cat [+                  "Build_",+                  name]))),+                Syntax.recordBodyFields = (Lists.map (\ft ->+                  let fn = Utils.sanitize (Utils.localName (Core.unName (Core.fieldTypeName ft)))+                      prefixedFn =+                              Strings.cat [+                                Formatting.decapitalize name,+                                "_",+                                fn]+                      ftCoq = Coder.encodeType env (Core.fieldTypeType ft)+                  in Syntax.RecordField {+                    Syntax.recordFieldName = (Coder.coqIdent prefixedFn),+                    Syntax.recordFieldType = (Syntax.Type ftCoq)}) v0)}}))}]+        _ -> [+          mkDef name paramBinders (Coder.encodeType env bodyTy)]+-- | Collect local names that occur in more than one module's type or term definitions+globalAmbiguousNames :: [Packaging.Module] -> S.Set String+globalAmbiguousNames modules =++      let allNames =+              Lists.concat (Lists.map (\m ->+                let nsStr = Packaging.unModuleName (Packaging.moduleName m)+                    fromDef =+                            \def_ -> case def_ of+                              Packaging.DefinitionType v0 -> Just (Utils.localName (Core.unName (Packaging.typeDefinitionName v0)), nsStr)+                              Packaging.DefinitionTerm v0 -> Just (Utils.localName (Core.unName (Packaging.termDefinitionName v0)), nsStr)+                              _ -> Nothing+                in (Optionals.cat (Lists.map fromDef (Packaging.moduleDefinitions m)))) modules)+          nameToNs =+                  Lists.foldl (\acc -> \np ->+                    let n = Pairs.first np+                        nsVal = Pairs.second np+                        existing = Optionals.fromOptional Sets.empty (Maps.lookup n acc)+                    in (Maps.insert n (Sets.insert nsVal existing) acc)) Maps.empty allNames+      in (Sets.fromList (Optionals.cat (Lists.map (\entry -> Logic.ifElse (Equality.gte (Lists.length (Sets.toList (Pairs.second entry))) 2) (Just (Pairs.first entry)) Nothing) (Maps.toList nameToNs))))+-- | Collect all type definitions from every module and run buildConstructorCounts over them+globalConstructorCounts :: [Packaging.Module] -> M.Map String Int+globalConstructorCounts modules =++      let allTypeDefs =+              Lists.concat (Lists.map (\m -> Optionals.cat (Lists.map (\def_ -> case def_ of+                Packaging.DefinitionType v0 -> Just (Utils.localName (Core.unName (Packaging.typeDefinitionName v0)), (Core.typeSchemeBody (Packaging.typeDefinitionBody v0)))+                _ -> Nothing) (Packaging.moduleDefinitions m))) modules)+      in (Utils.buildConstructorCounts allTypeDefs)+-- | Delegate to CoqUtils.buildFieldMapping across all supplied modules+globalFieldMapping :: [Packaging.Module] -> M.Map (String, String) String+globalFieldMapping modules = Utils.buildFieldMapping modules+-- | Collect sanitized accessor names by SCC-sorting every module's type defs and folding collectSanitizedAccessors+globalSanitizedAccessors :: [Packaging.Module] -> S.Set String+globalSanitizedAccessors modules =++      let allTypeGroups =+              Lists.concat (Lists.map (\m ->+                let typeDefs =+                        Optionals.cat (Lists.map (\def_ -> case def_ of+                          Packaging.DefinitionType v0 -> Just (Utils.localName (Core.unName (Packaging.typeDefinitionName v0)), (Core.typeSchemeBody (Packaging.typeDefinitionBody v0)))+                          _ -> Nothing) (Packaging.moduleDefinitions m))+                in (Utils.sortTypeDefsSCC typeDefs)) modules)+      in (Utils.collectSanitizedAccessors allTypeGroups)+-- | Emit an Arguments line marking every type parameter of a definition as implicit+implicitArgsLine :: String -> [String] -> String+implicitArgsLine name typeVarNames =+    Logic.ifElse (Lists.null typeVarNames) "" (Strings.cat [+      "Arguments ",+      name,+      " ",+      (Strings.intercalate " " (Lists.map (\v -> Strings.cat [+        "{",+        v,+        "}"]) typeVarNames)),+      ".\n"])+-- | Build one Definition per record field, pattern-matching on Build_T+makeAccessorDefs :: (String, Core.Type) -> [Syntax.Sentence]+makeAccessorDefs nt =++      let name = Pairs.first nt+          ty = Pairs.second nt+          extracted = Utils.extractTypeParams ty+          bodyTy = Pairs.second extracted+      in case bodyTy of+        Core.TypeRecord v0 -> Logic.ifElse (Lists.null v0) [] (+          let nFields = Lists.length v0+              fieldVars =+                      Lists.map (\i -> Strings.cat [+                        "f",+                        (Literals.showInt32 i)]) (Math.range 0 (Math.sub nFields 1))+              constrPat =+                      Syntax.Pattern10_Qualid {+                        Syntax.pattern10_QualidQualid = (Coder.coqQualid (Strings.cat [+                          "Build_",+                          name])),+                        Syntax.pattern10_QualidPatterns = (Lists.map (\v -> Syntax.Pattern1 {+                          Syntax.pattern1Pattern = (Syntax.Pattern0Qualid (Coder.coqQualid v)),+                          Syntax.pattern1Scope = Nothing}) fieldVars)}+              indexed = Lists.zip (Math.range 0 (Math.sub nFields 1)) v0+          in (Lists.map (\ift -> makeOneAccessor name constrPat fieldVars (Pairs.first ift) (Pairs.second ift)) indexed))+        _ -> []+-- | Build a Coq Constructor from a union field (prepended with the type name and capitalized field name)+makeConstructor :: Environment.CoqEnvironment -> String -> [String] -> Core.FieldType -> Syntax.Constructor+makeConstructor env typeName params ft =++      let fn = Core.unName (Core.fieldTypeName ft)+          constrName =+                  Strings.cat [+                    typeName,+                    "_",+                    (Formatting.capitalize fn)]+          fieldTy = Core.fieldTypeType ft+          argType = Coder.encodeType env fieldTy+          returnType = makeReturnType typeName params+      in Syntax.Constructor {+        Syntax.constructorName = (Coder.coqIdent constrName),+        Syntax.constructorBinders = [],+        Syntax.constructorType = (Just (Syntax.Type (Coder.coqArrow argType returnType)))}+-- | Build an Inductive body for a union or record type in a mutual group+makeInductiveBody :: Environment.CoqEnvironment -> String -> Core.Type -> [Syntax.InductiveBody]+makeInductiveBody env name ty =++      let extracted = Utils.extractTypeParams ty+          params = Pairs.first extracted+          bodyTy = Pairs.second extracted+          paramBinders =+                  Lists.map (\p -> Syntax.BinderType (Syntax.TypeBinders {+                    Syntax.typeBindersNames = [+                      Coder.coqName p],+                    Syntax.typeBindersType = (Syntax.Type (Coder.coqTermQualid "Type"))})) params+      in case bodyTy of+        Core.TypeUnion v0 -> [+          Syntax.InductiveBody {+            Syntax.inductiveBodyName = (Coder.coqIdent name),+            Syntax.inductiveBodyBinders = paramBinders,+            Syntax.inductiveBodyType = (Just (Syntax.Type (Coder.coqTermQualid "Type"))),+            Syntax.inductiveBodyConstructors = (Lists.map (\ft -> makeConstructor env name params ft) v0)}]+        Core.TypeRecord v0 -> Logic.ifElse (Lists.null v0) [+          Syntax.InductiveBody {+            Syntax.inductiveBodyName = (Coder.coqIdent name),+            Syntax.inductiveBodyBinders = paramBinders,+            Syntax.inductiveBodyType = (Just (Syntax.Type (Coder.coqTermQualid "Type"))),+            Syntax.inductiveBodyConstructors = [+              Syntax.Constructor {+                Syntax.constructorName = (Coder.coqIdent (Strings.cat [+                  "Build_",+                  name])),+                Syntax.constructorBinders = [],+                Syntax.constructorType = (Just (Syntax.Type (makeReturnType name params)))}]}] (+          let constrType =+                  Lists.foldr (\ft -> \acc -> Coder.coqArrow (Coder.encodeType env (Core.fieldTypeType ft)) acc) (makeReturnType name params) v0+          in [+            Syntax.InductiveBody {+              Syntax.inductiveBodyName = (Coder.coqIdent name),+              Syntax.inductiveBodyBinders = paramBinders,+              Syntax.inductiveBodyType = (Just (Syntax.Type (Coder.coqTermQualid "Type"))),+              Syntax.inductiveBodyConstructors = [+                Syntax.Constructor {+                  Syntax.constructorName = (Coder.coqIdent (Strings.cat [+                    "Build_",+                    name])),+                  Syntax.constructorBinders = [],+                  Syntax.constructorType = (Just (Syntax.Type constrType))}]}])+        _ -> []+-- | Emit a Definition for a record field accessor, keyed by the Build_T pattern+makeOneAccessor :: String -> Syntax.Pattern10_Qualid -> [String] -> Int -> Core.FieldType -> Syntax.Sentence+makeOneAccessor typeName constrPat fieldVars idx ft =++      let fn = Utils.sanitize (Utils.localName (Core.unName (Core.fieldTypeName ft)))+          prefixedFn =+                  Strings.cat [+                    Formatting.decapitalize typeName,+                    "_",+                    fn]+          returnExpr =+                  Coder.coqTermQualid (Optionals.fromOptional "" (Maps.lookup idx (Maps.fromList (Lists.zip (Math.range 0 (Math.sub (Lists.length fieldVars) 1)) fieldVars))))+          matchExpr =+                  Syntax.TermTerm100 (Syntax.Term100Term10 (Syntax.Term10OneTerm (Syntax.OneTermTerm1 (Syntax.Term1Term0 (Syntax.Term0Match (Syntax.Match {+                    Syntax.matchCaseItems = [+                      Syntax.CaseItem {+                        Syntax.caseItemTerm = (Syntax.Term100Term10 (Syntax.Term10OneTerm (Syntax.OneTermExplicit (Syntax.QualidAnnotated {+                          Syntax.qualidAnnotatedQualid = (Coder.coqQualid "r_"),+                          Syntax.qualidAnnotatedUnivAnnot = Nothing})))),+                        Syntax.caseItemAs = Nothing,+                        Syntax.caseItemIn = Nothing}],+                    Syntax.matchReturn = Nothing,+                    Syntax.matchPipe = False,+                    Syntax.matchEquations = [+                      Syntax.Equation {+                        Syntax.equationPattern = [+                          [+                            Syntax.PatternPattern (Syntax.Pattern10Qualiid constrPat)]],+                        Syntax.equationTerm = returnExpr}]}))))))+      in Syntax.Sentence {+        Syntax.sentenceComment = Nothing,+        Syntax.sentenceContent = (Syntax.SentenceContentDefinition (Syntax.Definition {+          Syntax.definitionLocality = Nothing,+          Syntax.definitionName = (Coder.coqIdent prefixedFn),+          Syntax.definitionBinders = [+            Syntax.BinderType (Syntax.TypeBinders {+              Syntax.typeBindersNames = [+                Coder.coqName "r_"],+              Syntax.typeBindersType = (Syntax.Type (Coder.coqTermQualid typeName))})],+          Syntax.definitionType = Nothing,+          Syntax.definitionBody = matchExpr}))}+-- | Emit nested `prod (T1) (prod ...)` textual type expression+makeProdType :: [String] -> String+makeProdType ts =+    Optionals.fromOptional "unit" (Optionals.map (\p -> Logic.ifElse (Equality.equal (Lists.length ts) 1) (Pairs.first p) (Strings.cat [+      "prod (",+      (Pairs.first p),+      ") (",+      (makeProdType (Pairs.second p)),+      ")"])) (Lists.uncons ts))+-- | Emit a nested `(pair (b1) (...))` textual value expression+makeProdVal :: [String] -> String+makeProdVal bs =+    Optionals.fromOptional "tt" (Optionals.map (\p -> Logic.ifElse (Equality.equal (Lists.length bs) 1) (Pairs.first p) (Strings.cat [+      "(pair (",+      (Pairs.first p),+      ") (",+      (makeProdVal (Pairs.second p)),+      "))"])) (Lists.uncons bs))+-- | Emit the n projection expressions extracting each member of a nested pair bundle+makeProjectionExprs :: Int -> String -> [String]+makeProjectionExprs n bvar =++      let snds =+              \k -> \v -> Logic.ifElse (Equality.equal k 0) v (snds (Math.sub k 1) (Strings.cat [+                "(snd ",+                v,+                ")"]))+          mkProj =+                  \i -> \total -> \v -> Logic.ifElse (Equality.equal i 0) (Strings.cat [+                    "(fst ",+                    v,+                    ")"]) (Logic.ifElse (Equality.equal i (Math.sub total 1)) (snds i v) (Strings.cat [+                    "(fst ",+                    (snds i v),+                    ")"]))+      in (Logic.ifElse (Equality.lte n 0) [] (Logic.ifElse (Equality.equal n 1) [+        bvar] (Lists.map (\i -> mkProj i n bvar) (Math.range 0 (Math.sub n 1)))))+-- | Return-type Coq term: `TypeName` or `TypeName p1 p2 ...`+makeReturnType :: String -> [String] -> Syntax.Term+makeReturnType typeName params =+    Logic.ifElse (Lists.null params) (Coder.coqTermQualid typeName) (Coder.coqTermApp (Coder.coqTermQualid typeName) (Lists.map (\p -> Coder.coqTermQualid p) params))+-- | Build a Coq `(p : Type)` binder for a type parameter+makeTypeBinder :: String -> Syntax.Binder+makeTypeBinder p =+    Syntax.BinderType (Syntax.TypeBinders {+      Syntax.typeBindersNames = [+        Coder.coqName p],+      Syntax.typeBindersType = (Syntax.Type (Coder.coqTermQualid "Type"))})+-- | Collect type-variable names and the Coq binders needed for a term definition+mkTypeBinders :: Core.Term -> [Core.Name] -> ([String], [Syntax.Binder])+mkTypeBinders body typeVars =++      let schemeVarNames = Sets.fromList (Lists.map (\n -> Core.unName n) typeVars)+          innerTypeVars = Logic.ifElse (Lists.null typeVars) Sets.empty (Utils.collectFreeTypeVars body)+          explicit = Lists.map (\n -> Core.unName n) typeVars+          extras = Lists.filter (\nm -> Logic.not (Sets.member nm schemeVarNames)) (Sets.toList innerTypeVars)+          allTypeVarNames = Lists.nub (Lists.concat2 explicit extras)+          binders = Lists.map (\v -> makeTypeBinder v) allTypeVarNames+      in (allTypeVarNames, binders)+-- | Top-level driver: dispatch a module to either full-emission or axiom-only emission, producing (path, content) pairs+moduleToCoq :: M.Map (String, String) String -> M.Map String Int -> S.Set String -> S.Set String -> Packaging.Module -> [Packaging.Definition] -> M.Map String String+moduleToCoq fieldMap constrCounts ambiguousNames globalSanitizedAcc mod_ defs =++      let nsStr = Packaging.unModuleName (Packaging.moduleName mod_)+          path = namespaceToPath nsStr+          desc =+                  Optionals.cases (Optionals.bind (Packaging.moduleMetadata mod_) (\em -> Packaging.entityMetadataDescription em)) "" (\d -> Strings.cat [+                    "(* ",+                    d,+                    " *)\n\n"])+          axiomOnlyModules =+                  [+                    "hydra.hoisting",+                    "hydra.inference"]+          isAxiomOnly = Lists.elem nsStr axiomOnlyModules+          typeDefs =+                  Optionals.cat (Lists.map (\def_ -> case def_ of+                    Packaging.DefinitionType v0 -> Just (Utils.localName (Core.unName (Packaging.typeDefinitionName v0)), (Core.typeSchemeBody (Packaging.typeDefinitionBody v0)))+                    _ -> Nothing) defs)+          termDefs =+                  Optionals.cat (Lists.map (\def_ -> case def_ of+                    Packaging.DefinitionTerm v0 ->+                      let msig = Packaging.termDefinitionSignature v0+                          mts = Optionals.map Scoping.termSignatureToTypeScheme msig+                          vs = Optionals.cases mts [] (\ts -> Core.typeSchemeVariables ts)+                          mty = Optionals.map (\ts -> Core.typeSchemeBody ts) mts+                      in (Just (Utils.localName (Core.unName (Packaging.termDefinitionName v0)), (Packaging.termDefinitionBody v0, (vs, mty))))+                    _ -> Nothing) defs)+          localDefNames =+                  Sets.fromList (Lists.concat2 (Lists.map (\nt -> Pairs.first nt) typeDefs) (Lists.map (\td -> Pairs.first td) termDefs))+          moduleAmbig = Sets.union ambiguousNames localDefNames+          env =+                  Environment.CoqEnvironment {+                    Environment.coqEnvironmentCurrentNamespace = nsStr,+                    Environment.coqEnvironmentConstructorCounts = constrCounts,+                    Environment.coqEnvironmentAmbiguousNames = moduleAmbig,+                    Environment.coqEnvironmentSanitizedAccessors = globalSanitizedAcc}+      in (Logic.ifElse isAxiomOnly (Maps.fromList [+        (path, (buildAxiomOnlyContent env desc nsStr typeDefs termDefs mod_))]) (buildFullModule env fieldMap mod_ nsStr path desc typeDefs termDefs))+-- | Convert a Hydra namespace string (e.g. hydra.show.core) into a relative .v file path+namespaceToPath :: String -> String+namespaceToPath ns =++      let parts = Strings.splitOn "." ns+          dirParts = Optionals.fromOptional [] (Lists.maybeInit parts)+          fileName =+                  Strings.cat [+                    Optionals.fromOptional ns (Lists.maybeLast parts),+                    ".v"]+      in (Logic.ifElse (Lists.null dirParts) fileName (Strings.cat [+        Strings.intercalate "/" dirParts,+        "/",+        fileName]))+-- | Pretty-print the standard-imports sentence followed by additional dependency imports+renderRequireImports :: [Syntax.Sentence] -> String+renderRequireImports depSentences = renderSentences (Lists.cons Coder.standardImports depSentences)+-- | Pretty-print a Document containing the given Coq sentences+renderSentences :: [Syntax.Sentence] -> String+renderSentences sentences =+    Serialization.printExpr (Serialization.parenthesize (Serde.documentToExpr (Syntax.Document {+      Syntax.documentSentences = sentences})))+-- | Replace literal `bundle_` with the given replacement string+replaceBundle :: String -> String -> String+replaceBundle s bname = Strings.intercalate bname (Strings.splitOn "bundle_" s)
+ src/main/haskell/Hydra/Coq/Language.hs view
@@ -0,0 +1,238 @@+-- Note: this is an automatically generated file. Do not edit.+-- | Language constraints for Coq code generation++module Hydra.Coq.Language where+import qualified Hydra.Ast as Ast+import qualified Hydra.Coders as Coders+import qualified Hydra.Constants as Constants+import qualified Hydra.Coq.Syntax as Syntax+import qualified Hydra.Core as Core+import qualified Hydra.Error.Checking as Checking+import qualified Hydra.Error.Core as ErrorCore+import qualified Hydra.Error.Packaging as ErrorPackaging+import qualified Hydra.Errors as Errors+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Graph as Graph+import qualified Hydra.Json.Model as Model+import qualified Hydra.Overlay.Haskell.Lib.Sets as Sets+import qualified Hydra.Packaging as Packaging+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Paths as Paths+import qualified Hydra.Query as Query+import qualified Hydra.Relational as Relational+import qualified Hydra.Tabular as Tabular+import qualified Hydra.Testing as Testing+import qualified Hydra.Topology as Topology+import qualified Hydra.Typed as Typed+import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util+import qualified Hydra.Validation as Validation+import qualified Hydra.Variants as Variants+import Prelude hiding  (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+import qualified Data.Set as S+coqLanguage :: Coders.Language+coqLanguage =+    Coders.Language {+      Coders.languageName = (Coders.LanguageName "hydra.coq"),+      Coders.languageConstraints = Coders.LanguageConstraints {+        Coders.languageConstraintsLiteralVariants = literalVariants,+        Coders.languageConstraintsFloatTypes = floatTypes,+        Coders.languageConstraintsIntegerTypes = integerTypes,+        Coders.languageConstraintsTermVariants = termVariants,+        Coders.languageConstraintsTypeVariants = typeVariants,+        Coders.languageConstraintsTypes = typePredicate}}+  where+    literalVariants =+        Sets.fromList [+          Variants.LiteralVariantBoolean,+          Variants.LiteralVariantFloat,+          Variants.LiteralVariantInteger,+          Variants.LiteralVariantString]+    floatTypes = Sets.fromList [+      Core.FloatTypeFloat64]+    integerTypes = Sets.fromList [+      Core.IntegerTypeBigint]+    termVariants =+        Sets.fromList [+          Variants.TermVariantApplication,+          Variants.TermVariantEither,+          Variants.TermVariantCases,+          Variants.TermVariantLambda,+          Variants.TermVariantProject,+          Variants.TermVariantUnwrap,+          Variants.TermVariantTypeApplication,+          Variants.TermVariantTypeLambda,+          Variants.TermVariantLet,+          Variants.TermVariantList,+          Variants.TermVariantLiteral,+          Variants.TermVariantMap,+          Variants.TermVariantOptional,+          Variants.TermVariantPair,+          Variants.TermVariantRecord,+          Variants.TermVariantSet,+          Variants.TermVariantInject,+          Variants.TermVariantUnit,+          Variants.TermVariantVariable,+          Variants.TermVariantWrap]+    typeVariants =+        Sets.fromList [+          Variants.TypeVariantAnnotated,+          Variants.TypeVariantApplication,+          Variants.TypeVariantEither,+          Variants.TypeVariantForall,+          Variants.TypeVariantFunction,+          Variants.TypeVariantList,+          Variants.TypeVariantLiteral,+          Variants.TypeVariantMap,+          Variants.TypeVariantOptional,+          Variants.TypeVariantPair,+          Variants.TypeVariantRecord,+          Variants.TypeVariantSet,+          Variants.TypeVariantUnion,+          Variants.TypeVariantUnit,+          Variants.TypeVariantVariable,+          Variants.TypeVariantVoid,+          Variants.TypeVariantWrap]+    typePredicate = \_ -> True+coqReservedWords :: S.Set String+coqReservedWords =+    Sets.fromList [+      "as",+      "at",+      "cofix",+      "do",+      "else",+      "end",+      "exists",+      "exists2",+      "fix",+      "for",+      "forall",+      "fun",+      "if",+      "IF",+      "in",+      "let",+      "match",+      "mod",+      "open",+      "Prop",+      "return",+      "Set",+      "then",+      "Type",+      "using",+      "where",+      "with",+      "Axiom",+      "Class",+      "Coercion",+      "Context",+      "Definition",+      "Fixpoint",+      "Hypothesis",+      "Inductive",+      "Instance",+      "Lemma",+      "Module",+      "Notation",+      "Proof",+      "Qed",+      "Record",+      "Require",+      "Import",+      "Section",+      "End",+      "Theorem",+      "Example",+      "Variable",+      "Variables",+      "cons",+      "pair",+      "nil",+      "list",+      "option",+      "prod",+      "sum",+      "unit",+      "bool",+      "nat",+      "string",+      "term",+      "literal",+      "graph",+      "element"]+coqStrippedReservedWords :: S.Set String+coqStrippedReservedWords =+    Sets.fromList [+      "as",+      "at",+      "cofix",+      "do",+      "else",+      "end",+      "exists",+      "exists2",+      "fix",+      "for",+      "forall",+      "fun",+      "if",+      "IF",+      "in",+      "let",+      "match",+      "mod",+      "Prop",+      "return",+      "Set",+      "then",+      "Type",+      "using",+      "where",+      "with",+      "Axiom",+      "Class",+      "Coercion",+      "Context",+      "Definition",+      "Fixpoint",+      "Hypothesis",+      "Inductive",+      "Instance",+      "Lemma",+      "Module",+      "Notation",+      "Proof",+      "Qed",+      "Record",+      "Require",+      "Import",+      "Section",+      "End",+      "Theorem",+      "Example",+      "Variable",+      "Variables",+      "bool",+      "nat",+      "list",+      "option",+      "prod",+      "sum",+      "unit",+      "string",+      "String",+      "Empty_set",+      "true",+      "false",+      "None",+      "Some",+      "nil",+      "cons",+      "pair",+      "inl",+      "inr",+      "tt",+      "graph"]
+ src/main/haskell/Hydra/Coq/Serde.hs view
@@ -0,0 +1,603 @@+-- Note: this is an automatically generated file. Do not edit.+-- | Coq serializer: converts Coq AST to concrete Coq source code++module Hydra.Coq.Serde where+import qualified Hydra.Ast as Ast+import qualified Hydra.Coders as Coders+import qualified Hydra.Constants as Constants+import qualified Hydra.Coq.Syntax as Syntax+import qualified Hydra.Core as Core+import qualified Hydra.Error.Checking as Checking+import qualified Hydra.Error.Core as ErrorCore+import qualified Hydra.Error.Packaging as ErrorPackaging+import qualified Hydra.Errors as Errors+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Graph as Graph+import qualified Hydra.Json.Model as Model+import qualified Hydra.Overlay.Haskell.Lib.Lists as Lists+import qualified Hydra.Overlay.Haskell.Lib.Literals as Literals+import qualified Hydra.Overlay.Haskell.Lib.Logic as Logic+import qualified Hydra.Overlay.Haskell.Lib.Optionals as Optionals+import qualified Hydra.Overlay.Haskell.Lib.Strings as Strings+import qualified Hydra.Packaging as Packaging+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Paths as Paths+import qualified Hydra.Query as Query+import qualified Hydra.Relational as Relational+import qualified Hydra.Serialization as Serialization+import qualified Hydra.Tabular as Tabular+import qualified Hydra.Testing as Testing+import qualified Hydra.Topology as Topology+import qualified Hydra.Typed as Typed+import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util+import qualified Hydra.Validation as Validation+import qualified Hydra.Variants as Variants+import Prelude hiding  (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+applicationToExpr :: Syntax.Application -> Ast.Expr+applicationToExpr app =+    case app of+      Syntax.ApplicationNormal v0 -> Serialization.spaceSep [+        term1ToExpr (Syntax.normalApplicationLhs v0),+        (Serialization.spaceSep (Lists.map (\a -> case a of+          Syntax.ArgIdent v1 -> Serialization.spaceSep [+            Serialization.parens (Serialization.spaceSep [+              identToExpr (Syntax.identArgIdent v1),+              (Serialization.cst ":="),+              (termToExpr (Syntax.identArgTerm v1))])]+          Syntax.ArgNatural v1 ->+            let v = Syntax.unNatural (Syntax.naturalArgNatural v1)+            in (Serialization.cst (Literals.showBigint v))+          Syntax.ArgTerm v1 -> term1ToExpr v1) (Syntax.normalApplicationRhs v0)))]+      Syntax.ApplicationAnnotated v0 -> Serialization.spaceSep [+        Serialization.cst "@",+        (qualidToExpr (Syntax.qualidAnnotatedQualid (Syntax.annotatedApplicationAnnot v0)))]+axiomDeclarationToExpr :: Syntax.AxiomDeclaration -> Ast.Expr+axiomDeclarationToExpr a =+    Serialization.suffix "." (Serialization.spaceSep [+      Serialization.cst "Axiom",+      (identToExpr (Syntax.axiomDeclarationName a)),+      (Serialization.cst ":"),+      (typeToExpr (Syntax.axiomDeclarationType a))])+binderToExpr :: Syntax.Binder -> Ast.Expr+binderToExpr b =+    case b of+      Syntax.BinderName v0 -> Optionals.cases (Syntax.unName v0) (Serialization.cst "_") (\i -> identToExpr i)+      Syntax.BinderType v0 ->+        let names =+                Lists.map (\n -> Optionals.cases (Syntax.unName n) (Serialization.cst "_") (\i -> identToExpr i)) (Syntax.typeBindersNames v0)+            ty = typeToExpr (Syntax.typeBindersType v0)+        in (Serialization.parens (Serialization.spaceSep [+          Serialization.spaceSep names,+          (Serialization.cst ":"),+          ty]))+      Syntax.BinderTerm v0 ->+        let name = Optionals.cases (Syntax.unName (Syntax.letBinderName v0)) (Serialization.cst "_") (\i -> identToExpr i)+            ty =+                    Optionals.cases (Syntax.letBinderType v0) [] (\t -> [+                      Serialization.cst ":",+                      (typeToExpr t)])+            body = termToExpr (Syntax.letBinderTerm v0)+        in (Serialization.parens (Serialization.spaceSep (Lists.concat [+          [+            name],+          ty,+          [+            Serialization.cst ":=",+            body]])))+      Syntax.BinderImplicit v0 -> case v0 of+        Syntax.ImplicitBindersMaximallyInserted v1 ->+          let names =+                  Lists.map (\n -> Optionals.cases (Syntax.unName n) (Serialization.cst "_") (\i -> identToExpr i)) (Syntax.typeBindersNames v1)+              ty = typeToExpr (Syntax.typeBindersType v1)+          in (Serialization.brackets Serialization.curlyBraces Serialization.inlineStyle (Serialization.spaceSep [+            Serialization.spaceSep names,+            (Serialization.cst ":"),+            ty]))+        Syntax.ImplicitBindersNonMaximallyInserted v1 ->+          let names =+                  Lists.map (\n -> Optionals.cases (Syntax.unName n) (Serialization.cst "_") (\i -> identToExpr i)) (Syntax.typeBindersNames v1)+              ty = typeToExpr (Syntax.typeBindersType v1)+          in (Serialization.brackets Serialization.squareBrackets Serialization.inlineStyle (Serialization.spaceSep [+            Serialization.spaceSep names,+            (Serialization.cst ":"),+            ty]))+      Syntax.BinderGeneralizing v0 -> case v0 of+        Syntax.GeneralizingBinderExplicit v1 -> Serialization.parens (termToExpr (Syntax.typeclassConstraintTerm v1))+        Syntax.GeneralizingBinderImplicitMaximallyInserted v1 -> Serialization.brackets Serialization.curlyBraces Serialization.inlineStyle (termToExpr (Syntax.typeclassConstraintTerm v1))+        Syntax.GeneralizingBinderImplicitNonMaximallyInserted v1 -> Serialization.brackets Serialization.squareBrackets Serialization.inlineStyle (termToExpr (Syntax.typeclassConstraintTerm v1))+      Syntax.BinderPattern _ -> Serialization.cst "_"+commentToExpr :: Syntax.Comment -> Ast.Expr+commentToExpr c =+    Serialization.cst (Strings.cat [+      "(* ",+      (Syntax.unComment c),+      " *)"])+constructorToExpr :: Syntax.Constructor -> Ast.Expr+constructorToExpr c =++      let name = identToExpr (Syntax.constructorName c)+          binders = Lists.map (\b -> binderToExpr b) (Syntax.constructorBinders c)+          ty =+                  Optionals.cases (Syntax.constructorType c) [] (\t -> [+                    Serialization.cst ":",+                    (typeToExpr t)])+      in (Serialization.spaceSep (Lists.concat [+        [+          Serialization.cst "|",+          name],+        binders,+        ty]))+definitionToExpr :: Syntax.Definition -> Ast.Expr+definitionToExpr d =++      let locPart = Optionals.cases (Syntax.definitionLocality d) [] (\l -> [+            localityToExpr l])+          name = identToExpr (Syntax.definitionName d)+          binders = Lists.map (\b -> binderToExpr b) (Syntax.definitionBinders d)+          ty =+                  Optionals.cases (Syntax.definitionType d) [] (\t -> [+                    Serialization.cst ":",+                    (typeToExpr t)])+          body = termToExpr (Syntax.definitionBody d)+      in (Serialization.suffix "." (Serialization.spaceSep (Lists.concat [+        locPart,+        [+          Serialization.cst "Definition",+          name],+        binders,+        ty,+        [+          Serialization.cst ":=",+          body]])))+documentToExpr :: Syntax.Document -> Ast.Expr+documentToExpr doc = Serialization.doubleNewlineSep (Lists.map (\s -> sentenceToExpr s) (Syntax.documentSentences doc))+fixpointDefinitionToExpr :: Syntax.FixpointDefinition -> Ast.Expr+fixpointDefinitionToExpr fd =++      let locPart = Optionals.cases (Syntax.fixpointDefinitionLocality fd) [] (\l -> [+            localityToExpr l])+          name = identToExpr (Syntax.fixpointDefinitionName fd)+          binders = Lists.map (\b -> binderToExpr b) (Syntax.fixpointDefinitionBinders fd)+          ty =+                  Optionals.cases (Syntax.fixpointDefinitionType fd) [] (\t -> [+                    Serialization.cst ":",+                    (typeToExpr t)])+          body = termToExpr (Syntax.fixpointDefinitionBody fd)+      in (Serialization.suffix "." (Serialization.spaceSep (Lists.concat [+        locPart,+        [+          Serialization.cst "Fixpoint",+          name],+        binders,+        ty,+        [+          Serialization.cst ":=",+          body]])))+identToExpr :: Syntax.Ident -> Ast.Expr+identToExpr ident = Serialization.cst (Syntax.unString (Syntax.unIdent ident))+inductiveBodyToExpr :: Syntax.InductiveBody -> Ast.Expr+inductiveBodyToExpr ib =++      let name = identToExpr (Syntax.inductiveBodyName ib)+          binders = Lists.map (\b -> binderToExpr b) (Syntax.inductiveBodyBinders ib)+          ty =+                  Optionals.cases (Syntax.inductiveBodyType ib) [] (\t -> [+                    Serialization.cst ":",+                    (typeToExpr t)])+          constrs = Lists.map (\c -> constructorToExpr c) (Syntax.inductiveBodyConstructors ib)+      in (Serialization.newlineSep (Lists.concat [+        [+          Serialization.spaceSep (Lists.concat [+            [+              name],+            binders,+            ty,+            [+              Serialization.cst ":="]])],+        constrs]))+inductiveDefinitionToExpr :: Syntax.InductiveDefinition -> Ast.Expr+inductiveDefinitionToExpr id =++      let locPart = Optionals.cases (Syntax.inductiveDefinitionLocality id) [] (\l -> [+            localityToExpr l])+          kwPart =+                  Logic.ifElse (Syntax.inductiveDefinitionCoinductive id) (Serialization.cst "CoInductive") (Serialization.cst "Inductive")+          bodyExprs = Lists.map (\b -> inductiveBodyToExpr b) (Syntax.inductiveDefinitionBodies id)+          firstBody = Optionals.fromOptional (Serialization.cst "") (Lists.maybeHead bodyExprs)+          restBodies =+                  Lists.map (\b -> Serialization.spaceSep [+                    Serialization.cst "with",+                    b]) (Lists.drop 1 bodyExprs)+          firstLine =+                  Serialization.spaceSep (Lists.concat [+                    locPart,+                    [+                      kwPart,+                      firstBody]])+      in (Serialization.suffix "." (Serialization.newlineSep (Lists.cons firstLine restBodies)))+localityToExpr :: Syntax.Locality -> Ast.Expr+localityToExpr loc =+    case loc of+      Syntax.LocalityLocal -> Serialization.cst "Local"+      Syntax.LocalityGlobal -> Serialization.cst "Global"+matchToExpr :: Syntax.Match -> Ast.Expr+matchToExpr m =++      let items =+              Lists.map (\ci ->+                let t = term100ToExpr (Syntax.caseItemTerm ci)+                    asP =+                            Optionals.cases (Syntax.caseItemAs ci) [] (\n -> [+                              Serialization.cst "as",+                              (Optionals.cases (Syntax.unName n) (Serialization.cst "_") (\i -> identToExpr i))])+                in (Serialization.spaceSep (Lists.concat [+                  [+                    t],+                  asP]))) (Syntax.matchCaseItems m)+          ret =+                  Optionals.cases (Syntax.matchReturn m) [] (\r -> [+                    Serialization.cst "return",+                    (term100ToExpr r)])+          eqs =+                  Lists.map (\eq ->+                    let patGroups = Lists.map (\grp -> Serialization.spaceSep (Lists.map (\p -> patternToExpr p) grp)) (Syntax.equationPattern eq)+                        pats = Serialization.infixWsList " | " patGroups+                        body = termToExpr (Syntax.equationTerm eq)+                    in (Serialization.spaceSep [+                      Serialization.cst "|",+                      pats,+                      (Serialization.cst "=>"),+                      body])) (Syntax.matchEquations m)+      in (Serialization.newlineSep (Lists.concat [+        [+          Serialization.spaceSep (Lists.concat [+            [+              Serialization.cst "match"],+            items,+            ret,+            [+              Serialization.cst "with"]])],+        eqs,+        [+          Serialization.cst "end"]]))+moduleDefinitionToExpr :: Syntax.ModuleDefinition -> Ast.Expr+moduleDefinitionToExpr md =++      let name = identToExpr (Syntax.moduleDefinitionName md)+          sentences = Lists.map (\s -> sentenceToExpr s) (Syntax.moduleDefinitionSentences md)+      in (Serialization.doubleNewlineSep (Lists.concat [+        [+          Serialization.suffix "." (Serialization.spaceSep [+            Serialization.cst "Module",+            name])],+        sentences,+        [+          Serialization.suffix "." (Serialization.spaceSep [+            Serialization.cst "End",+            name])]]))+pattern0ToExpr :: Syntax.Pattern0 -> Ast.Expr+pattern0ToExpr p =+    case p of+      Syntax.Pattern0Qualid v0 -> qualidToExpr v0+      Syntax.Pattern0QualIdAndPattern _ -> Serialization.cst "..."+      Syntax.Pattern0Placeholder -> Serialization.cst "_"+      Syntax.Pattern0Parens v0 -> Serialization.parens (Serialization.infixWsList ", " (Lists.map (\p2 -> patternToExpr p2) v0))+      Syntax.Pattern0Number v0 ->+        let v = Syntax.unNumber v0+        in (Serialization.cst (Literals.showFloat64 v))+      Syntax.Pattern0String v0 -> Serialization.spaceSep [+        Serialization.cst "\"",+        (Serialization.cst (Syntax.unString v0)),+        (Serialization.cst "\"")]+pattern10ToExpr :: Syntax.Pattern10 -> Ast.Expr+pattern10ToExpr p =+    case p of+      Syntax.Pattern10As v0 -> Serialization.spaceSep [+        pattern1ToExpr (Syntax.pattern10_AsPattern v0),+        (Serialization.cst "as"),+        (Optionals.cases (Syntax.unName (Syntax.pattern10_AsAs v0)) (Serialization.cst "_") (\i -> identToExpr i))]+      Syntax.Pattern10Patterns v0 ->+        let first = pattern1ToExpr (Syntax.pattern10_PatternsPattern v0)+            rest = Lists.map (\p2 -> pattern1ToExpr p2) (Syntax.pattern10_PatternsPatterns v0)+        in (Serialization.spaceSep (Lists.cons first rest))+      Syntax.Pattern10Qualiid v0 ->+        let q = qualidToExpr (Syntax.pattern10_QualidQualid v0)+            args = Lists.map (\p2 -> pattern1ToExpr p2) (Syntax.pattern10_QualidPatterns v0)+        in (Logic.ifElse (Lists.null args) q (Serialization.spaceSep (Lists.cons q args)))+pattern1ToExpr :: Syntax.Pattern1 -> Ast.Expr+pattern1ToExpr p = pattern0ToExpr (Syntax.pattern1Pattern p)+patternToExpr :: Syntax.Pattern -> Ast.Expr+patternToExpr p =+    case p of+      Syntax.PatternPattern v0 -> pattern10ToExpr v0+      Syntax.PatternTerm _ -> Serialization.cst "_"+qualidToExpr :: Syntax.Qualid -> Ast.Expr+qualidToExpr q =++      let idExpr = identToExpr (Syntax.qualidId q)+          fieldIds = Syntax.qualidFieldIds q+          fieldExprs = Lists.map (\f -> identToExpr (Syntax.unFieldIdent f)) fieldIds+      in (Logic.ifElse (Lists.null fieldExprs) idExpr (Serialization.dotSep (Lists.concat2 [+        idExpr] fieldExprs)))+recordDefinitionToExpr :: Syntax.RecordDefinition -> Ast.Expr+recordDefinitionToExpr rd =++      let locPart = Optionals.cases (Syntax.recordDefinitionLocality rd) [] (\l -> [+            localityToExpr l])+          name = identToExpr (Syntax.recordDefinitionName rd)+          binders = Lists.map (\b -> binderToExpr b) (Syntax.recordDefinitionBinders rd)+          sortPart =+                  Optionals.cases (Syntax.recordDefinitionSort rd) [] (\s -> [+                    Serialization.cst ":",+                    (sortToExpr s)])+          body = Syntax.recordDefinitionBody rd+          constrPart = Optionals.cases (Syntax.recordBodyConstructor body) [] (\c -> [+                identToExpr c])+          fields = Lists.map (\f -> Serialization.suffix " ;" (recordFieldToExpr f)) (Syntax.recordBodyFields body)+      in (Serialization.suffix "." (Serialization.newlineSep (Lists.concat [+        [+          Serialization.spaceSep (Lists.concat [+            locPart,+            [+              Serialization.cst "Record"],+            [+              name],+            binders,+            sortPart,+            [+              Serialization.cst ":="],+            constrPart,+            [+              Serialization.cst "{"]])],+        fields,+        [+          Serialization.cst "}"]])))+recordFieldToExpr :: Syntax.RecordField -> Ast.Expr+recordFieldToExpr rf =+    Serialization.spaceSep [+      identToExpr (Syntax.recordFieldName rf),+      (Serialization.cst ":"),+      (typeToExpr (Syntax.recordFieldType rf))]+requireImportToExpr :: Syntax.RequireImport -> Ast.Expr+requireImportToExpr ri =++      let fromPart =+              Optionals.cases (Syntax.requireImportFrom ri) [] (\q -> [+                Serialization.cst "From",+                (qualidToExpr q)])+          requirePart = Logic.ifElse (Syntax.requireImportRequire ri) [+                Serialization.cst "Require"] []+          qualPart =+                  Optionals.cases (Syntax.requireImportQualification ri) [] (\q -> case q of+                    Syntax.ImportQualificationImport -> [+                      Serialization.cst "Import"]+                    Syntax.ImportQualificationExport -> [+                      Serialization.cst "Export"])+          mods = Lists.map (\m -> qualidToExpr m) (Syntax.requireImportModules ri)+      in (Serialization.suffix "." (Serialization.spaceSep (Lists.concat [+        fromPart,+        requirePart,+        qualPart,+        mods])))+sectionDefinitionToExpr :: Syntax.SectionDefinition -> Ast.Expr+sectionDefinitionToExpr sd =++      let name = identToExpr (Syntax.sectionDefinitionName sd)+          sentences = Lists.map (\s -> sentenceToExpr s) (Syntax.sectionDefinitionSentences sd)+      in (Serialization.doubleNewlineSep (Lists.concat [+        [+          Serialization.suffix "." (Serialization.spaceSep [+            Serialization.cst "Section",+            name])],+        sentences,+        [+          Serialization.suffix "." (Serialization.spaceSep [+            Serialization.cst "End",+            name])]]))+sentenceContentToExpr :: Syntax.SentenceContent -> Ast.Expr+sentenceContentToExpr sc =+    case sc of+      Syntax.SentenceContentAxiom v0 -> axiomDeclarationToExpr v0+      Syntax.SentenceContentDefinition v0 -> definitionToExpr v0+      Syntax.SentenceContentFixpoint v0 -> fixpointDefinitionToExpr v0+      Syntax.SentenceContentInductive v0 -> inductiveDefinitionToExpr v0+      Syntax.SentenceContentModule v0 -> moduleDefinitionToExpr v0+      Syntax.SentenceContentNotation _ -> Serialization.cst "(* notation *)"+      Syntax.SentenceContentRecord v0 -> recordDefinitionToExpr v0+      Syntax.SentenceContentRequireImport v0 -> requireImportToExpr v0+      Syntax.SentenceContentSection v0 -> sectionDefinitionToExpr v0+      Syntax.SentenceContentTheorem v0 -> theoremBodyToExpr v0+sentenceToExpr :: Syntax.Sentence -> Ast.Expr+sentenceToExpr s =++      let cmtPart = Optionals.cases (Syntax.sentenceComment s) [] (\c -> [+            commentToExpr c])+          content = sentenceContentToExpr (Syntax.sentenceContent s)+      in (Serialization.newlineSep (Lists.concat [+        cmtPart,+        [+          content]]))+sortToExpr :: Syntax.Sort -> Ast.Expr+sortToExpr s =+    case s of+      Syntax.SortSet -> Serialization.cst "Set"+      Syntax.SortProp -> Serialization.cst "Prop"+      Syntax.SortSProp -> Serialization.cst "SProp"+      Syntax.SortType -> Serialization.cst "Type"+      Syntax.SortTypeWithAnyUniverse -> Serialization.cst "Type"+      Syntax.SortTypeWithUniverse _ -> Serialization.noSep [+        Serialization.cst "Type",+        (Serialization.cst "@{"),+        (Serialization.cst "}")]+term0ToExpr :: Syntax.Term0 -> Ast.Expr+term0ToExpr t =+    case t of+      Syntax.Term0QualidAnnotated v0 -> qualidToExpr (Syntax.qualidAnnotatedQualid v0)+      Syntax.Term0Sort v0 -> sortToExpr v0+      Syntax.Term0PrimitiveNotations v0 -> case v0 of+        Syntax.PrimitiveNotationsNumber v1 ->+          let v = Syntax.unNumber v1+          in (Serialization.cst (Literals.showFloat64 v))+        Syntax.PrimitiveNotationsString v1 -> Serialization.spaceSep [+          Serialization.cst "\"",+          (Serialization.cst (Syntax.unString v1)),+          (Serialization.cst "\"")]+      Syntax.Term0Evar _ -> Serialization.cst "?evar"+      Syntax.Term0Match v0 -> matchToExpr v0+      Syntax.Term0Record -> Serialization.cst "{| |}"+      Syntax.Term0Generalizing -> Serialization.cst "`( )"+      Syntax.Term0Ltac -> Serialization.cst "ltac:( )"+      Syntax.Term0Parens v0 -> Serialization.parens (termToExpr v0)+term100ToExpr :: Syntax.Term100 -> Ast.Expr+term100ToExpr t =+    case t of+      Syntax.Term100Cast v0 -> Serialization.spaceSep [+        term10ToExpr (Syntax.typeCastTerm v0),+        (Serialization.cst ":"),+        (typeToExpr (Syntax.typeCastType v0))]+      Syntax.Term100Term10 v0 -> term10ToExpr v0+term10ToExpr :: Syntax.Term10 -> Ast.Expr+term10ToExpr t =+    case t of+      Syntax.Term10Application v0 -> applicationToExpr v0+      Syntax.Term10OneTerm v0 -> case v0 of+        Syntax.OneTermExplicit v1 -> qualidToExpr (Syntax.qualidAnnotatedQualid v1)+        Syntax.OneTermTerm1 v1 -> term1ToExpr v1+term1ToExpr :: Syntax.Term1 -> Ast.Expr+term1ToExpr t =+    case t of+      Syntax.Term1Projection -> Serialization.cst "?projection"+      Syntax.Term1Scope -> Serialization.cst "?scope"+      Syntax.Term1Term0 v0 -> term0ToExpr v0+termToExpr :: Syntax.Term -> Ast.Expr+termToExpr t =+    case t of+      Syntax.TermForallOrFun v0 -> case v0 of+        Syntax.ForallOrFunForall v1 -> Serialization.spaceSep [+          Serialization.cst "forall",+          case (Syntax.forallBinders v1) of+            Syntax.OpenBindersType v2 ->+              let names =+                      Lists.map (\n -> Optionals.cases (Syntax.unName n) (Serialization.cst "_") (\i -> identToExpr i)) (Syntax.typeBindersNames v2)+                  ty = typeToExpr (Syntax.typeBindersType v2)+              in (Serialization.spaceSep [+                Serialization.parens (Serialization.spaceSep [+                  Serialization.spaceSep names,+                  (Serialization.cst ":"),+                  ty])])+            Syntax.OpenBindersBinders v2 -> Serialization.spaceSep (Lists.map (\b -> binderToExpr b) v2),+          (Serialization.cst ","),+          (typeToExpr (Syntax.forallType v1))]+        Syntax.ForallOrFunFun v1 -> Serialization.spaceSep [+          Serialization.cst "fun",+          case (Syntax.funBinders v1) of+            Syntax.OpenBindersType v2 ->+              let names =+                      Lists.map (\n -> Optionals.cases (Syntax.unName n) (Serialization.cst "_") (\i -> identToExpr i)) (Syntax.typeBindersNames v2)+                  ty = typeToExpr (Syntax.typeBindersType v2)+              in (Serialization.spaceSep [+                Serialization.parens (Serialization.spaceSep [+                  Serialization.spaceSep names,+                  (Serialization.cst ":"),+                  ty])])+            Syntax.OpenBindersBinders v2 -> Serialization.spaceSep (Lists.map (\b -> binderToExpr b) v2),+          (Serialization.cst "=>"),+          (termToExpr (Syntax.funBody v1))]+      Syntax.TermLet v0 ->+        let bindings = Syntax.letBindings v0+            body = termToExpr (Syntax.letIn v0)+        in case bindings of+          Syntax.LetBindingsNamed v1 ->+            let binder = Syntax.letNamedBinder v1+                name = Optionals.cases (Syntax.unName (Syntax.letBinderName binder)) (Serialization.cst "_") (\i -> identToExpr i)+                binders = Lists.map (\b -> binderToExpr b) (Syntax.letNamedBinders v1)+                ty =+                        Optionals.cases (Syntax.letBinderType binder) [] (\t2 -> [+                          Serialization.cst ":",+                          (typeToExpr t2)])+                val = termToExpr (Syntax.letBinderTerm binder)+            in (Serialization.spaceSep [+              Serialization.cst "let",+              (Serialization.spaceSep (Lists.concat [+                [+                  name],+                binders,+                ty,+                [+                  Serialization.cst ":=",+                  val],+                [+                  Serialization.cst "in"]])),+              body])+          Syntax.LetBindingsDestructuring _ -> Serialization.spaceSep [+            Serialization.cst "let",+            (Serialization.cst "..."),+            (Serialization.cst "in"),+            body]+      Syntax.TermIf v0 ->+        let cond = termToExpr (Syntax.ifCondition v0)+            thn = termToExpr (Syntax.ifThen v0)+            els = termToExpr (Syntax.ifElse v0)+        in (Serialization.spaceSep [+          Serialization.cst "if",+          cond,+          (Serialization.cst "then"),+          thn,+          (Serialization.cst "else"),+          els])+      Syntax.TermFix v0 -> case v0 of+        Syntax.FixDecl v1 -> Serialization.spaceSep [+          Serialization.cst "fix",++            let name = identToExpr (Syntax.fix_DeclIdent v1)+                binders = Lists.map (\b -> binderToExpr b) (Syntax.fix_DeclBinders v1)+                ty =+                        Optionals.cases (Syntax.fix_DeclType v1) [] (\t2 -> [+                          Serialization.cst ":",+                          (typeToExpr t2)])+                body = termToExpr (Syntax.fix_DeclTerm v1)+            in (Serialization.spaceSep (Lists.concat [+              [+                name],+              binders,+              ty,+              [+                Serialization.cst ":=",+                body]]))]+        Syntax.FixQual _ -> Serialization.cst "fix"+      Syntax.TermCofix _ -> Serialization.spaceSep [+        Serialization.cst "cofix",+        (Serialization.cst "...")]+      Syntax.TermTerm100 v0 -> term100ToExpr v0+theoremBodyToExpr :: Syntax.TheoremBody -> Ast.Expr+theoremBodyToExpr tb =++      let kindKw =+              case (Syntax.theoremBodyKind tb) of+                Syntax.TheoremKindTheorem -> Serialization.cst "Theorem"+                Syntax.TheoremKindLemma -> Serialization.cst "Lemma"+                Syntax.TheoremKindProposition -> Serialization.cst "Proposition"+                Syntax.TheoremKindCorollary -> Serialization.cst "Corollary"+                Syntax.TheoremKindExample -> Serialization.cst "Example"+          name = identToExpr (Syntax.theoremBodyName tb)+          binders = Lists.map (\b -> binderToExpr b) (Syntax.theoremBodyBinders tb)+          ty = typeToExpr (Syntax.theoremBodyType tb)+          proof = termToExpr (Syntax.theoremBodyProof tb)+      in (Serialization.newlineSep [+        Serialization.suffix "." (Serialization.spaceSep (Lists.concat [+          [+            kindKw,+            name],+          binders,+          [+            Serialization.cst ":",+            ty]])),+        (Serialization.cst "Proof."),+        (Serialization.spaceSep [+          Serialization.cst "exact",+          (Serialization.parens proof)]),+        (Serialization.cst "Qed.")])+typeToExpr :: Syntax.Type -> Ast.Expr+typeToExpr t = termToExpr (Syntax.unType t)
+ src/main/haskell/Hydra/Coq/Syntax.hs view
@@ -0,0 +1,917 @@+-- Note: this is an automatically generated file. Do not edit.+-- | A model for Coq core and extensions. Based on the Coq 8.15 grammar:+-- |   https://coq.github.io/doc/v8.15/refman/language/core/basic.html#essential-vocabulary+-- |   Extended with Vernacular commands for complete .v file generation.++module Hydra.Coq.Syntax where+import qualified Hydra.Core as Core+import Prelude hiding  (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+data AnnotatedApplication =+  AnnotatedApplication {+    annotatedApplicationAnnot :: QualidAnnotated,+    annotatedApplicationTerms :: [Term1]}+  deriving (Eq, Ord, Read, Show)+_AnnotatedApplication = Core.Name "hydra.coq.syntax.AnnotatedApplication"+_AnnotatedApplication_annot = Core.Name "annot"+_AnnotatedApplication_terms = Core.Name "terms"+data Application =+  ApplicationNormal NormalApplication |+  ApplicationAnnotated AnnotatedApplication+  deriving (Eq, Ord, Read, Show)+_Application = Core.Name "hydra.coq.syntax.Application"+_Application_normal = Core.Name "normal"+_Application_annotated = Core.Name "annotated"+data Arg =+  ArgIdent IdentArg |+  ArgNatural NaturalArg |+  ArgTerm Term1+  deriving (Eq, Ord, Read, Show)+_Arg = Core.Name "hydra.coq.syntax.Arg"+_Arg_ident = Core.Name "ident"+_Arg_natural = Core.Name "natural"+_Arg_term = Core.Name "term"+data Binder =+  BinderName Name |+  BinderType TypeBinders |+  BinderTerm LetBinder |+  BinderImplicit ImplicitBinders |+  BinderGeneralizing GeneralizingBinder |+  BinderPattern Pattern0+  deriving (Eq, Ord, Read, Show)+_Binder = Core.Name "hydra.coq.syntax.Binder"+_Binder_name = Core.Name "name"+_Binder_type = Core.Name "type"+_Binder_term = Core.Name "term"+_Binder_implicit = Core.Name "implicit"+_Binder_generalizing = Core.Name "generalizing"+_Binder_pattern = Core.Name "pattern"+data CaseItem =+  CaseItem {+    caseItemTerm :: Term100,+    caseItemAs :: (Maybe Name),+    caseItemIn :: (Maybe Pattern)}+  deriving (Eq, Ord, Read, Show)+_CaseItem = Core.Name "hydra.coq.syntax.CaseItem"+_CaseItem_term = Core.Name "term"+_CaseItem_as = Core.Name "as"+_CaseItem_in = Core.Name "in"+data Cofix =+  Cofix {+    cofixBody :: CofixBody,+    cofixQual :: (Maybe CofixQual)}+  deriving (Eq, Ord, Read, Show)+_Cofix = Core.Name "hydra.coq.syntax.Cofix"+_Cofix_body = Core.Name "body"+_Cofix_qual = Core.Name "qual"+data CofixBody =+  CofixBody {+    cofixBodyIdent :: Ident,+    cofixBodyBinders :: [Binder],+    cofixBodyType :: (Maybe Type),+    cofixBodyTerm :: Term}+  deriving (Eq, Ord, Read, Show)+_CofixBody = Core.Name "hydra.coq.syntax.CofixBody"+_CofixBody_ident = Core.Name "ident"+_CofixBody_binders = Core.Name "binders"+_CofixBody_type = Core.Name "type"+_CofixBody_term = Core.Name "term"+data CofixQual =+  CofixQualIn Term |+  CofixQualWith CofixWith+  deriving (Eq, Ord, Read, Show)+_CofixQual = Core.Name "hydra.coq.syntax.CofixQual"+_CofixQual_in = Core.Name "in"+_CofixQual_with = Core.Name "with"+data CofixWith =+  CofixWith {+    cofixWithWith :: [CofixBody],+    cofixWithFor :: (Maybe Ident)}+  deriving (Eq, Ord, Read, Show)+_CofixWith = Core.Name "hydra.coq.syntax.CofixWith"+_CofixWith_with = Core.Name "with"+_CofixWith_for = Core.Name "for"+data Equation =+  Equation {+    equationPattern :: [[Pattern]],+    equationTerm :: Term}+  deriving (Eq, Ord, Read, Show)+_Equation = Core.Name "hydra.coq.syntax.Equation"+_Equation_pattern = Core.Name "pattern"+_Equation_term = Core.Name "term"+data ExistentialVariable =+  ExistentialVariable {+    existentialVariableIdent :: Ident,+    existentialVariableVariant :: ExistentialVariableVariant}+  deriving (Eq, Ord, Read, Show)+_ExistentialVariable = Core.Name "hydra.coq.syntax.ExistentialVariable"+_ExistentialVariable_ident = Core.Name "ident"+_ExistentialVariable_variant = Core.Name "variant"+data ExistentialVariableVariant =+  ExistentialVariableVariantPlaceholder |+  ExistentialVariableVariantInside1 |+  ExistentialVariableVariantInside2 |+  ExistentialVariableVariantOutside (Maybe IdentArg)+  deriving (Eq, Ord, Read, Show)+_ExistentialVariableVariant = Core.Name "hydra.coq.syntax.ExistentialVariableVariant"+_ExistentialVariableVariant_placeholder = Core.Name "placeholder"+_ExistentialVariableVariant_inside1 = Core.Name "inside1"+_ExistentialVariableVariant_inside2 = Core.Name "inside2"+_ExistentialVariableVariant_outside = Core.Name "outside"+newtype FieldIdent =+  FieldIdent {+    unFieldIdent :: Ident}+  deriving (Eq, Ord, Read, Show)+_FieldIdent = Core.Name "hydra.coq.syntax.FieldIdent"+data Fix =+  FixDecl Fix_Decl |+  FixQual (Maybe Fix_Qual)+  deriving (Eq, Ord, Read, Show)+_Fix = Core.Name "hydra.coq.syntax.Fix"+_Fix_decl = Core.Name "decl"+_Fix_qual = Core.Name "qual"+data FixAnnot =+  FixAnnotStruct Ident |+  FixAnnotWf FixAnnot_Wf |+  FixAnnotMeasure FixAnnot_Measure+  deriving (Eq, Ord, Read, Show)+_FixAnnot = Core.Name "hydra.coq.syntax.FixAnnot"+_FixAnnot_struct = Core.Name "struct"+_FixAnnot_wf = Core.Name "wf"+_FixAnnot_measure = Core.Name "measure"+data FixAnnot_Measure =+  FixAnnot_Measure {+    fixAnnot_MeasureTerm :: OneTerm,+    fixAnnot_MeasureIdent :: (Maybe Ident),+    fixAnnot_MeasureTerm2 :: (Maybe OneTerm)}+  deriving (Eq, Ord, Read, Show)+_FixAnnot_Measure = Core.Name "hydra.coq.syntax.FixAnnot_Measure"+_FixAnnot_Measure_term = Core.Name "term"+_FixAnnot_Measure_ident = Core.Name "ident"+_FixAnnot_Measure_term2 = Core.Name "term2"+data FixAnnot_Wf =+  FixAnnot_Wf {+    fixAnnot_WfTerm :: OneTerm,+    fixAnnot_WfIdent :: Ident}+  deriving (Eq, Ord, Read, Show)+_FixAnnot_Wf = Core.Name "hydra.coq.syntax.FixAnnot_Wf"+_FixAnnot_Wf_term = Core.Name "term"+_FixAnnot_Wf_ident = Core.Name "ident"+data Fix_Decl =+  Fix_Decl {+    fix_DeclIdent :: Ident,+    fix_DeclBinders :: [Binder],+    fix_DeclAnnot :: (Maybe FixAnnot),+    fix_DeclType :: (Maybe Type),+    fix_DeclTerm :: Term}+  deriving (Eq, Ord, Read, Show)+_Fix_Decl = Core.Name "hydra.coq.syntax.Fix_Decl"+_Fix_Decl_ident = Core.Name "ident"+_Fix_Decl_binders = Core.Name "binders"+_Fix_Decl_annot = Core.Name "annot"+_Fix_Decl_type = Core.Name "type"+_Fix_Decl_term = Core.Name "term"+data Fix_Qual =+  Fix_QualIn Term |+  Fix_QualWith FixWith+  deriving (Eq, Ord, Read, Show)+_Fix_Qual = Core.Name "hydra.coq.syntax.Fix_Qual"+_Fix_Qual_in = Core.Name "in"+_Fix_Qual_with = Core.Name "with"+data FixWith =+  FixWith {+    fixWithDecls :: [Fix_Decl],+    fixWithFor :: (Maybe Ident)}+  deriving (Eq, Ord, Read, Show)+_FixWith = Core.Name "hydra.coq.syntax.FixWith"+_FixWith_decls = Core.Name "decls"+_FixWith_for = Core.Name "for"+data Forall =+  Forall {+    forallBinders :: OpenBinders,+    forallType :: Type}+  deriving (Eq, Ord, Read, Show)+_Forall = Core.Name "hydra.coq.syntax.Forall"+_Forall_binders = Core.Name "binders"+_Forall_type = Core.Name "type"+data ForallOrFun =+  ForallOrFunForall Forall |+  ForallOrFunFun Fun+  deriving (Eq, Ord, Read, Show)+_ForallOrFun = Core.Name "hydra.coq.syntax.ForallOrFun"+_ForallOrFun_forall = Core.Name "forall"+_ForallOrFun_fun = Core.Name "fun"+data Fun =+  Fun {+    funBinders :: OpenBinders,+    funBody :: Term}+  deriving (Eq, Ord, Read, Show)+_Fun = Core.Name "hydra.coq.syntax.Fun"+_Fun_binders = Core.Name "binders"+_Fun_body = Core.Name "body"+data GeneralizingBinder =+  -- | Terms surrounded by `( ) introduce their free variables as explicit arguments+  GeneralizingBinderExplicit TypeclassConstraint |+  -- | Terms surrounded by `{ } introduce their free variables as maximally inserted implicit arguments+  GeneralizingBinderImplicitMaximallyInserted TypeclassConstraint |+  -- | Terms surrounded by `[ ] introduce them as non-maximally inserted implicit arguments+  GeneralizingBinderImplicitNonMaximallyInserted TypeclassConstraint+  deriving (Eq, Ord, Read, Show)+_GeneralizingBinder = Core.Name "hydra.coq.syntax.GeneralizingBinder"+_GeneralizingBinder_explicit = Core.Name "explicit"+_GeneralizingBinder_implicitMaximallyInserted = Core.Name "implicitMaximallyInserted"+_GeneralizingBinder_implicitNonMaximallyInserted = Core.Name "implicitNonMaximallyInserted"+newtype Ident =+  Ident {+    unIdent :: String_}+  deriving (Eq, Ord, Read, Show)+_Ident = Core.Name "hydra.coq.syntax.Ident"+data IdentArg =+  IdentArg {+    identArgIdent :: Ident,+    identArgTerm :: Term}+  deriving (Eq, Ord, Read, Show)+_IdentArg = Core.Name "hydra.coq.syntax.IdentArg"+_IdentArg_ident = Core.Name "ident"+_IdentArg_term = Core.Name "term"+-- | Pattern match on boolean values+data If =+  If {+    ifCondition :: Term,+    ifReturnAs :: (Maybe ReturnAs),+    ifThen :: Term,+    ifElse :: Term}+  deriving (Eq, Ord, Read, Show)+_If = Core.Name "hydra.coq.syntax.If"+_If_condition = Core.Name "condition"+_If_returnAs = Core.Name "returnAs"+_If_then = Core.Name "then"+_If_else = Core.Name "else"+-- | In the context of a function definition, these forms specify that name is an implicit argument.+data ImplicitBinders =+  -- | The first form, with curly braces, makes name a maximally inserted implicit argument+  ImplicitBindersMaximallyInserted TypeBinders |+  -- | The second form, with square brackets, makes name a non-maximally inserted implicit argument.+  ImplicitBindersNonMaximallyInserted TypeBinders+  deriving (Eq, Ord, Read, Show)+_ImplicitBinders = Core.Name "hydra.coq.syntax.ImplicitBinders"+_ImplicitBinders_maximallyInserted = Core.Name "maximallyInserted"+_ImplicitBinders_nonMaximallyInserted = Core.Name "nonMaximallyInserted"+-- | A let-in definition+data Let =+  Let {+    letBindings :: LetBindings,+    letIn :: Term}+  deriving (Eq, Ord, Read, Show)+_Let = Core.Name "hydra.coq.syntax.Let"+_Let_bindings = Core.Name "bindings"+_Let_in = Core.Name "in"+-- | Some constructions allow the binding of a variable to value. This is called a 'let-binder'.+data LetBinder =+  LetBinder {+    letBinderName :: Name,+    letBinderType :: (Maybe Type),+    letBinderTerm :: Term}+  deriving (Eq, Ord, Read, Show)+_LetBinder = Core.Name "hydra.coq.syntax.LetBinder"+_LetBinder_name = Core.Name "name"+_LetBinder_type = Core.Name "type"+_LetBinder_term = Core.Name "term"+data LetBindings =+  LetBindingsNamed LetNamed |+  LetBindingsDestructuring LetDestructuring+  deriving (Eq, Ord, Read, Show)+_LetBindings = Core.Name "hydra.coq.syntax.LetBindings"+_LetBindings_named = Core.Name "named"+_LetBindings_destructuring = Core.Name "destructuring"+data LetNamed =+  LetNamed {+    letNamedBinder :: LetBinder,+    letNamedBinders :: [Binder]}+  deriving (Eq, Ord, Read, Show)+_LetNamed = Core.Name "hydra.coq.syntax.LetNamed"+_LetNamed_binder = Core.Name "binder"+_LetNamed_binders = Core.Name "binders"+data LetDestructuring =+  LetDestructuringVariant1 LetDestructuring_Variant1 |+  LetDestructuringVariant2 LetDestructuring_Variant2 |+  LetDestructuringVariant3 LetDestructuring_Variant3+  deriving (Eq, Ord, Read, Show)+_LetDestructuring = Core.Name "hydra.coq.syntax.LetDestructuring"+_LetDestructuring_variant1 = Core.Name "variant1"+_LetDestructuring_variant2 = Core.Name "variant2"+_LetDestructuring_variant3 = Core.Name "variant3"+data LetDestructuring_Variant1 =+  LetDestructuring_Variant1 {+    letDestructuring_Variant1Names :: [Name],+    letDestructuring_Variant1ReturnAs :: (Maybe ReturnAs),+    letDestructuring_Variant1Term :: Term}+  deriving (Eq, Ord, Read, Show)+_LetDestructuring_Variant1 = Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"+_LetDestructuring_Variant1_names = Core.Name "names"+_LetDestructuring_Variant1_returnAs = Core.Name "returnAs"+_LetDestructuring_Variant1_term = Core.Name "term"+data LetDestructuring_Variant2 =+  LetDestructuring_Variant2 {+    letDestructuring_Variant2Pattern :: Pattern,+    letDestructuring_Variant2Term :: Term,+    letDestructuring_Variant2Return :: (Maybe Term100)}+  deriving (Eq, Ord, Read, Show)+_LetDestructuring_Variant2 = Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"+_LetDestructuring_Variant2_pattern = Core.Name "pattern"+_LetDestructuring_Variant2_term = Core.Name "term"+_LetDestructuring_Variant2_return = Core.Name "return"+data LetDestructuring_Variant3 =+  LetDestructuring_Variant3 {+    letDestructuring_Variant3Pattern1 :: Pattern,+    letDestructuring_Variant3Pattern2 :: Pattern,+    letDestructuring_Variant3Term :: Term,+    letDestructuring_Variant3Return :: Term100}+  deriving (Eq, Ord, Read, Show)+_LetDestructuring_Variant3 = Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"+_LetDestructuring_Variant3_pattern1 = Core.Name "pattern1"+_LetDestructuring_Variant3_pattern2 = Core.Name "pattern2"+_LetDestructuring_Variant3_term = Core.Name "term"+_LetDestructuring_Variant3_return = Core.Name "return"+data Match =+  Match {+    matchCaseItems :: [CaseItem],+    matchReturn :: (Maybe Term100),+    matchPipe :: Bool,+    matchEquations :: [Equation]}+  deriving (Eq, Ord, Read, Show)+_Match = Core.Name "hydra.coq.syntax.Match"+_Match_caseItems = Core.Name "caseItems"+_Match_return = Core.Name "return"+_Match_pipe = Core.Name "pipe"+_Match_equations = Core.Name "equations"+newtype Name =+  Name {+    unName :: (Maybe Ident)}+  deriving (Eq, Ord, Read, Show)+_Name = Core.Name "hydra.coq.syntax.Name"+-- | A non-negative arbitrary-precision integer+newtype Natural =+  Natural {+    unNatural :: Integer}+  deriving (Eq, Ord, Read, Show)+_Natural = Core.Name "hydra.coq.syntax.Natural"+data NaturalArg =+  NaturalArg {+    naturalArgNatural :: Natural,+    naturalArgTerm :: Term}+  deriving (Eq, Ord, Read, Show)+_NaturalArg = Core.Name "hydra.coq.syntax.NaturalArg"+_NaturalArg_natural = Core.Name "natural"+_NaturalArg_term = Core.Name "term"+data NormalApplication =+  NormalApplication {+    normalApplicationLhs :: Term1,+    normalApplicationRhs :: [Arg]}+  deriving (Eq, Ord, Read, Show)+_NormalApplication = Core.Name "hydra.coq.syntax.NormalApplication"+_NormalApplication_lhs = Core.Name "lhs"+_NormalApplication_rhs = Core.Name "rhs"+newtype Number =+  Number {+    unNumber :: Double}+  deriving (Eq, Ord, Read, Show)+_Number = Core.Name "hydra.coq.syntax.Number"+data OneTerm =+  OneTermExplicit QualidAnnotated |+  OneTermTerm1 Term1+  deriving (Eq, Ord, Read, Show)+_OneTerm = Core.Name "hydra.coq.syntax.OneTerm"+_OneTerm_explicit = Core.Name "explicit"+_OneTerm_term1 = Core.Name "term1"+data OpenBinders =+  OpenBindersType TypeBinders |+  OpenBindersBinders [Binder]+  deriving (Eq, Ord, Read, Show)+_OpenBinders = Core.Name "hydra.coq.syntax.OpenBinders"+_OpenBinders_type = Core.Name "type"+_OpenBinders_binders = Core.Name "binders"+data Pattern =+  PatternPattern Pattern10 |+  PatternTerm (Maybe Term)+  deriving (Eq, Ord, Read, Show)+_Pattern = Core.Name "hydra.coq.syntax.Pattern"+_Pattern_pattern = Core.Name "pattern"+_Pattern_term = Core.Name "term"+data Pattern0 =+  Pattern0Qualid Qualid |+  Pattern0QualIdAndPattern QualidAndPattern |+  Pattern0Placeholder |+  Pattern0Parens [Pattern] |+  Pattern0Number Number |+  Pattern0String String_+  deriving (Eq, Ord, Read, Show)+_Pattern0 = Core.Name "hydra.coq.syntax.Pattern0"+_Pattern0_qualid = Core.Name "qualid"+_Pattern0_qualIdAndPattern = Core.Name "qualIdAndPattern"+_Pattern0_placeholder = Core.Name "placeholder"+_Pattern0_parens = Core.Name "parens"+_Pattern0_number = Core.Name "number"+_Pattern0_string = Core.Name "string"+data Pattern1 =+  Pattern1 {+    pattern1Pattern :: Pattern0,+    pattern1Scope :: (Maybe ScopeKey)}+  deriving (Eq, Ord, Read, Show)+_Pattern1 = Core.Name "hydra.coq.syntax.Pattern1"+_Pattern1_pattern = Core.Name "pattern"+_Pattern1_scope = Core.Name "scope"+data Pattern10 =+  Pattern10As Pattern10_As |+  Pattern10Patterns Pattern10_Patterns |+  Pattern10Qualiid Pattern10_Qualid+  deriving (Eq, Ord, Read, Show)+_Pattern10 = Core.Name "hydra.coq.syntax.Pattern10"+_Pattern10_as = Core.Name "as"+_Pattern10_patterns = Core.Name "patterns"+_Pattern10_qualiid = Core.Name "qualiid"+data Pattern10_As =+  Pattern10_As {+    pattern10_AsPattern :: Pattern1,+    pattern10_AsAs :: Name}+  deriving (Eq, Ord, Read, Show)+_Pattern10_As = Core.Name "hydra.coq.syntax.Pattern10_As"+_Pattern10_As_pattern = Core.Name "pattern"+_Pattern10_As_as = Core.Name "as"+data Pattern10_Patterns =+  Pattern10_Patterns {+    pattern10_PatternsPattern :: Pattern1,+    pattern10_PatternsPatterns :: [Pattern1]}+  deriving (Eq, Ord, Read, Show)+_Pattern10_Patterns = Core.Name "hydra.coq.syntax.Pattern10_Patterns"+_Pattern10_Patterns_pattern = Core.Name "pattern"+_Pattern10_Patterns_patterns = Core.Name "patterns"+data Pattern10_Qualid =+  Pattern10_Qualid {+    pattern10_QualidQualid :: Qualid,+    pattern10_QualidPatterns :: [Pattern1]}+  deriving (Eq, Ord, Read, Show)+_Pattern10_Qualid = Core.Name "hydra.coq.syntax.Pattern10_Qualid"+_Pattern10_Qualid_qualid = Core.Name "qualid"+_Pattern10_Qualid_patterns = Core.Name "patterns"+data PrimitiveNotations =+  PrimitiveNotationsNumber Number |+  PrimitiveNotationsString String_+  deriving (Eq, Ord, Read, Show)+_PrimitiveNotations = Core.Name "hydra.coq.syntax.PrimitiveNotations"+_PrimitiveNotations_number = Core.Name "number"+_PrimitiveNotations_string = Core.Name "string"+-- | A qualified identifier+data Qualid =+  Qualid {+    qualidId :: Ident,+    qualidFieldIds :: [FieldIdent]}+  deriving (Eq, Ord, Read, Show)+_Qualid = Core.Name "hydra.coq.syntax.Qualid"+_Qualid_id = Core.Name "id"+_Qualid_fieldIds = Core.Name "fieldIds"+data QualidAndPattern =+  QualidAndPattern {+    qualidAndPatternQualid :: Qualid,+    qualidAndPatternPattern :: Pattern}+  deriving (Eq, Ord, Read, Show)+_QualidAndPattern = Core.Name "hydra.coq.syntax.QualidAndPattern"+_QualidAndPattern_qualid = Core.Name "qualid"+_QualidAndPattern_pattern = Core.Name "pattern"+data QualidAnnotated =+  QualidAnnotated {+    qualidAnnotatedQualid :: Qualid,+    qualidAnnotatedUnivAnnot :: (Maybe UnivAnnot)}+  deriving (Eq, Ord, Read, Show)+_QualidAnnotated = Core.Name "hydra.coq.syntax.QualidAnnotated"+_QualidAnnotated_qualid = Core.Name "qualid"+_QualidAnnotated_univAnnot = Core.Name "univAnnot"+data ReturnAs =+  ReturnAs {+    returnAsAs :: (Maybe Name),+    returnAsReturn :: Term100}+  deriving (Eq, Ord, Read, Show)+_ReturnAs = Core.Name "hydra.coq.syntax.ReturnAs"+_ReturnAs_as = Core.Name "as"+_ReturnAs_return = Core.Name "return"+newtype ScopeKey =+  ScopeKey {+    unScopeKey :: Ident}+  deriving (Eq, Ord, Read, Show)+_ScopeKey = Core.Name "hydra.coq.syntax.ScopeKey"+-- | The types of types are called sorts.+data Sort =+  -- | The sort 𝖲𝖾𝗍 intends to be the type of small sets.+  SortSet |+  -- | The sort 𝖯𝗋𝗈𝗉 intends to be the type of logical propositions.+  SortProp |+  -- | The sort 𝖲𝖯𝗋𝗈𝗉 is like 𝖯𝗋𝗈𝗉 but the propositions in 𝖲𝖯𝗋𝗈𝗉 are known to have irrelevant proofs (all proofs are equal).+  SortSProp |+  SortType |+  SortTypeWithAnyUniverse |+  SortTypeWithUniverse Universe+  deriving (Eq, Ord, Read, Show)+_Sort = Core.Name "hydra.coq.syntax.Sort"+_Sort_set = Core.Name "set"+_Sort_prop = Core.Name "prop"+_Sort_sProp = Core.Name "sProp"+_Sort_type = Core.Name "type"+_Sort_typeWithAnyUniverse = Core.Name "typeWithAnyUniverse"+_Sort_typeWithUniverse = Core.Name "typeWithUniverse"+newtype String_ =+  String_ {+    unString :: String}+  deriving (Eq, Ord, Read, Show)+_String = Core.Name "hydra.coq.syntax.String"+data Term =+  TermForallOrFun ForallOrFun |+  TermLet Let |+  TermIf If |+  TermFix Fix |+  TermCofix Cofix |+  TermTerm100 Term100+  deriving (Eq, Ord, Read, Show)+_Term = Core.Name "hydra.coq.syntax.Term"+_Term_forallOrFun = Core.Name "forallOrFun"+_Term_let = Core.Name "let"+_Term_if = Core.Name "if"+_Term_fix = Core.Name "fix"+_Term_cofix = Core.Name "cofix"+_Term_term100 = Core.Name "term100"+data Term0 =+  Term0QualidAnnotated QualidAnnotated |+  Term0Sort Sort |+  Term0PrimitiveNotations PrimitiveNotations |+  Term0Evar ExistentialVariable |+  Term0Match Match |+  Term0Record |+  Term0Generalizing |+  Term0Ltac |+  Term0Parens Term+  deriving (Eq, Ord, Read, Show)+_Term0 = Core.Name "hydra.coq.syntax.Term0"+_Term0_qualidAnnotated = Core.Name "qualidAnnotated"+_Term0_sort = Core.Name "sort"+_Term0_primitiveNotations = Core.Name "primitiveNotations"+_Term0_evar = Core.Name "evar"+_Term0_match = Core.Name "match"+_Term0_record = Core.Name "record"+_Term0_generalizing = Core.Name "generalizing"+_Term0_ltac = Core.Name "ltac"+_Term0_parens = Core.Name "parens"+data Term1 =+  Term1Projection |+  Term1Scope |+  Term1Term0 Term0+  deriving (Eq, Ord, Read, Show)+_Term1 = Core.Name "hydra.coq.syntax.Term1"+_Term1_projection = Core.Name "projection"+_Term1_scope = Core.Name "scope"+_Term1_term0 = Core.Name "term0"+data Term10 =+  Term10Application Application |+  Term10OneTerm OneTerm+  deriving (Eq, Ord, Read, Show)+_Term10 = Core.Name "hydra.coq.syntax.Term10"+_Term10_application = Core.Name "application"+_Term10_oneTerm = Core.Name "oneTerm"+data Term100 =+  Term100Cast TypeCast |+  Term100Term10 Term10+  deriving (Eq, Ord, Read, Show)+_Term100 = Core.Name "hydra.coq.syntax.Term100"+_Term100_cast = Core.Name "cast"+_Term100_term10 = Core.Name "term10"+newtype Type =+  Type {+    unType :: Term}+  deriving (Eq, Ord, Read, Show)+_Type = Core.Name "hydra.coq.syntax.Type"+data TypeCast =+  TypeCast {+    typeCastTerm :: Term10,+    typeCastType :: Type,+    typeCastOperator :: TypeCastOperator}+  deriving (Eq, Ord, Read, Show)+_TypeCast = Core.Name "hydra.coq.syntax.TypeCast"+_TypeCast_term = Core.Name "term"+_TypeCast_type = Core.Name "type"+_TypeCast_operator = Core.Name "operator"+data TypeCastOperator =+  -- | The expression term10 : type is a type cast expression. It enforces the type of term10 to be type.+  TypeCastOperatorNormal |+  -- | term10 <: type specifies that the virtual machine will be used to type check that term10 has type type (see vm_compute).+  TypeCastOperatorVmCompute |+  -- | term10 <<: type specifies that compilation to OCaml will be used to type check that term10 has type type (see native_compute).+  TypeCastOperatorNativeCompute+  deriving (Eq, Ord, Read, Show)+_TypeCastOperator = Core.Name "hydra.coq.syntax.TypeCastOperator"+_TypeCastOperator_normal = Core.Name "normal"+_TypeCastOperator_vmCompute = Core.Name "vmCompute"+_TypeCastOperator_nativeCompute = Core.Name "nativeCompute"+data TypeBinders =+  TypeBinders {+    typeBindersNames :: [Name],+    typeBindersType :: Type}+  deriving (Eq, Ord, Read, Show)+_TypeBinders = Core.Name "hydra.coq.syntax.TypeBinders"+_TypeBinders_names = Core.Name "names"+_TypeBinders_type = Core.Name "type"+data TypeclassConstraint =+  TypeclassConstraint {+    typeclassConstraintName :: (Maybe Name),+    typeclassConstraintGeneralizing :: Bool,+    typeclassConstraintTerm :: Term}+  deriving (Eq, Ord, Read, Show)+_TypeclassConstraint = Core.Name "hydra.coq.syntax.TypeclassConstraint"+_TypeclassConstraint_name = Core.Name "name"+_TypeclassConstraint_generalizing = Core.Name "generalizing"+_TypeclassConstraint_term = Core.Name "term"+newtype UnivAnnot =+  UnivAnnot {+    unUnivAnnot :: [UniverseLevel]}+  deriving (Eq, Ord, Read, Show)+_UnivAnnot = Core.Name "hydra.coq.syntax.UnivAnnot"+data Universe =+  UniverseMax [Universe_Expr] |+  UniverseExpr Universe_Expr+  deriving (Eq, Ord, Read, Show)+_Universe = Core.Name "hydra.coq.syntax.Universe"+_Universe_max = Core.Name "max"+_Universe_expr = Core.Name "expr"+data Universe_Expr =+  Universe_Expr {+    universe_ExprName :: UniverseName,+    universe_ExprNumber :: (Maybe Natural)}+  deriving (Eq, Ord, Read, Show)+_Universe_Expr = Core.Name "hydra.coq.syntax.Universe_Expr"+_Universe_Expr_name = Core.Name "name"+_Universe_Expr_number = Core.Name "number"+data UniverseLevel =+  UniverseLevelSet |+  UniverseLevelProp |+  UniverseLevelType |+  UniverseLevelIgnored |+  UniverseLevelQualid Qualid+  deriving (Eq, Ord, Read, Show)+_UniverseLevel = Core.Name "hydra.coq.syntax.UniverseLevel"+_UniverseLevel_set = Core.Name "set"+_UniverseLevel_prop = Core.Name "prop"+_UniverseLevel_type = Core.Name "type"+_UniverseLevel_ignored = Core.Name "ignored"+_UniverseLevel_qualid = Core.Name "qualid"+data UniverseName =+  UniverseNameQualid Qualid |+  UniverseNameSet |+  UniverseNameProp+  deriving (Eq, Ord, Read, Show)+_UniverseName = Core.Name "hydra.coq.syntax.UniverseName"+_UniverseName_qualid = Core.Name "qualid"+_UniverseName_set = Core.Name "set"+_UniverseName_prop = Core.Name "prop"+-- | An Axiom declaration: `Axiom <name> : <type>.`+data AxiomDeclaration =+  AxiomDeclaration {+    axiomDeclarationName :: Ident,+    axiomDeclarationType :: Type}+  deriving (Eq, Ord, Read, Show)+_AxiomDeclaration = Core.Name "hydra.coq.syntax.AxiomDeclaration"+_AxiomDeclaration_name = Core.Name "name"+_AxiomDeclaration_type = Core.Name "type"+-- | A Coq comment (* ... *)+newtype Comment =+  Comment {+    unComment :: String}+  deriving (Eq, Ord, Read, Show)+_Comment = Core.Name "hydra.coq.syntax.Comment"+-- | A constructor in an Inductive definition+data Constructor =+  Constructor {+    constructorName :: Ident,+    constructorBinders :: [Binder],+    constructorType :: (Maybe Type)}+  deriving (Eq, Ord, Read, Show)+_Constructor = Core.Name "hydra.coq.syntax.Constructor"+_Constructor_name = Core.Name "name"+_Constructor_binders = Core.Name "binders"+_Constructor_type = Core.Name "type"+-- | A Definition or Let command: Definition name binders : type := term.+data Definition =+  Definition {+    definitionLocality :: (Maybe Locality),+    definitionName :: Ident,+    definitionBinders :: [Binder],+    definitionType :: (Maybe Type),+    definitionBody :: Term}+  deriving (Eq, Ord, Read, Show)+_Definition = Core.Name "hydra.coq.syntax.Definition"+_Definition_locality = Core.Name "locality"+_Definition_name = Core.Name "name"+_Definition_binders = Core.Name "binders"+_Definition_type = Core.Name "type"+_Definition_body = Core.Name "body"+-- | A complete Coq .v file+data Document =+  Document {+    documentSentences :: [Sentence]}+  deriving (Eq, Ord, Read, Show)+_Document = Core.Name "hydra.coq.syntax.Document"+_Document_sentences = Core.Name "sentences"+-- | A Fixpoint command for recursive definitions+data FixpointDefinition =+  FixpointDefinition {+    fixpointDefinitionLocality :: (Maybe Locality),+    fixpointDefinitionName :: Ident,+    fixpointDefinitionBinders :: [Binder],+    fixpointDefinitionAnnot :: (Maybe FixAnnot),+    fixpointDefinitionType :: (Maybe Type),+    fixpointDefinitionBody :: Term,+    fixpointDefinitionWith :: [Fix_Decl]}+  deriving (Eq, Ord, Read, Show)+_FixpointDefinition = Core.Name "hydra.coq.syntax.FixpointDefinition"+_FixpointDefinition_locality = Core.Name "locality"+_FixpointDefinition_name = Core.Name "name"+_FixpointDefinition_binders = Core.Name "binders"+_FixpointDefinition_annot = Core.Name "annot"+_FixpointDefinition_type = Core.Name "type"+_FixpointDefinition_body = Core.Name "body"+_FixpointDefinition_with = Core.Name "with"+-- | Qualification for Require/Import commands+data ImportQualification =+  ImportQualificationImport |+  ImportQualificationExport+  deriving (Eq, Ord, Read, Show)+_ImportQualification = Core.Name "hydra.coq.syntax.ImportQualification"+_ImportQualification_import = Core.Name "import"+_ImportQualification_export = Core.Name "export"+-- | A single body in an Inductive definition (supports mutual induction via 'with')+data InductiveBody =+  InductiveBody {+    inductiveBodyName :: Ident,+    inductiveBodyBinders :: [Binder],+    inductiveBodyType :: (Maybe Type),+    inductiveBodyConstructors :: [Constructor]}+  deriving (Eq, Ord, Read, Show)+_InductiveBody = Core.Name "hydra.coq.syntax.InductiveBody"+_InductiveBody_name = Core.Name "name"+_InductiveBody_binders = Core.Name "binders"+_InductiveBody_type = Core.Name "type"+_InductiveBody_constructors = Core.Name "constructors"+-- | An Inductive or CoInductive definition with one or more mutually inductive bodies+data InductiveDefinition =+  InductiveDefinition {+    inductiveDefinitionLocality :: (Maybe Locality),+    inductiveDefinitionCoinductive :: Bool,+    inductiveDefinitionBodies :: [InductiveBody]}+  deriving (Eq, Ord, Read, Show)+_InductiveDefinition = Core.Name "hydra.coq.syntax.InductiveDefinition"+_InductiveDefinition_locality = Core.Name "locality"+_InductiveDefinition_coinductive = Core.Name "coinductive"+_InductiveDefinition_bodies = Core.Name "bodies"+-- | Local or Global qualifier for commands+data Locality =+  LocalityLocal |+  LocalityGlobal+  deriving (Eq, Ord, Read, Show)+_Locality = Core.Name "hydra.coq.syntax.Locality"+_Locality_local = Core.Name "local"+_Locality_global = Core.Name "global"+-- | A Module ... End block+data ModuleDefinition =+  ModuleDefinition {+    moduleDefinitionName :: Ident,+    moduleDefinitionSentences :: [Sentence]}+  deriving (Eq, Ord, Read, Show)+_ModuleDefinition = Core.Name "hydra.coq.syntax.ModuleDefinition"+_ModuleDefinition_name = Core.Name "name"+_ModuleDefinition_sentences = Core.Name "sentences"+-- | A Notation declaration+data NotationDeclaration =+  NotationDeclaration {+    notationDeclarationNotation :: String_,+    notationDeclarationDefinition :: Term,+    notationDeclarationLevel :: (Maybe Natural),+    notationDeclarationAssociativity :: (Maybe String)}+  deriving (Eq, Ord, Read, Show)+_NotationDeclaration = Core.Name "hydra.coq.syntax.NotationDeclaration"+_NotationDeclaration_notation = Core.Name "notation"+_NotationDeclaration_definition = Core.Name "definition"+_NotationDeclaration_level = Core.Name "level"+_NotationDeclaration_associativity = Core.Name "associativity"+-- | The body of a Record definition+data RecordBody =+  RecordBody {+    recordBodyConstructor :: (Maybe Ident),+    recordBodyFields :: [RecordField]}+  deriving (Eq, Ord, Read, Show)+_RecordBody = Core.Name "hydra.coq.syntax.RecordBody"+_RecordBody_constructor = Core.Name "constructor"+_RecordBody_fields = Core.Name "fields"+-- | A Record or Structure definition+data RecordDefinition =+  RecordDefinition {+    recordDefinitionLocality :: (Maybe Locality),+    recordDefinitionName :: Ident,+    recordDefinitionBinders :: [Binder],+    recordDefinitionSort :: (Maybe Sort),+    recordDefinitionBody :: RecordBody}+  deriving (Eq, Ord, Read, Show)+_RecordDefinition = Core.Name "hydra.coq.syntax.RecordDefinition"+_RecordDefinition_locality = Core.Name "locality"+_RecordDefinition_name = Core.Name "name"+_RecordDefinition_binders = Core.Name "binders"+_RecordDefinition_sort = Core.Name "sort"+_RecordDefinition_body = Core.Name "body"+-- | A field in a Record definition+data RecordField =+  RecordField {+    recordFieldName :: Ident,+    recordFieldType :: Type}+  deriving (Eq, Ord, Read, Show)+_RecordField = Core.Name "hydra.coq.syntax.RecordField"+_RecordField_name = Core.Name "name"+_RecordField_type = Core.Name "type"+-- | A Require Import/Export command+data RequireImport =+  RequireImport {+    requireImportFrom :: (Maybe Qualid),+    requireImportRequire :: Bool,+    requireImportQualification :: (Maybe ImportQualification),+    requireImportModules :: [Qualid]}+  deriving (Eq, Ord, Read, Show)+_RequireImport = Core.Name "hydra.coq.syntax.RequireImport"+_RequireImport_from = Core.Name "from"+_RequireImport_require = Core.Name "require"+_RequireImport_qualification = Core.Name "qualification"+_RequireImport_modules = Core.Name "modules"+-- | A Section ... End block+data SectionDefinition =+  SectionDefinition {+    sectionDefinitionName :: Ident,+    sectionDefinitionSentences :: [Sentence]}+  deriving (Eq, Ord, Read, Show)+_SectionDefinition = Core.Name "hydra.coq.syntax.SectionDefinition"+_SectionDefinition_name = Core.Name "name"+_SectionDefinition_sentences = Core.Name "sentences"+-- | A top-level sentence in a Coq document, optionally preceded by a comment+data Sentence =+  Sentence {+    sentenceComment :: (Maybe Comment),+    sentenceContent :: SentenceContent}+  deriving (Eq, Ord, Read, Show)+_Sentence = Core.Name "hydra.coq.syntax.Sentence"+_Sentence_comment = Core.Name "comment"+_Sentence_content = Core.Name "content"+-- | The content of a top-level sentence+data SentenceContent =+  SentenceContentAxiom AxiomDeclaration |+  SentenceContentDefinition Definition |+  SentenceContentFixpoint FixpointDefinition |+  SentenceContentInductive InductiveDefinition |+  SentenceContentModule ModuleDefinition |+  SentenceContentNotation NotationDeclaration |+  SentenceContentRecord RecordDefinition |+  SentenceContentRequireImport RequireImport |+  SentenceContentSection SectionDefinition |+  SentenceContentTheorem TheoremBody+  deriving (Eq, Ord, Read, Show)+_SentenceContent = Core.Name "hydra.coq.syntax.SentenceContent"+_SentenceContent_axiom = Core.Name "axiom"+_SentenceContent_definition = Core.Name "definition"+_SentenceContent_fixpoint = Core.Name "fixpoint"+_SentenceContent_inductive = Core.Name "inductive"+_SentenceContent_module = Core.Name "module"+_SentenceContent_notation = Core.Name "notation"+_SentenceContent_record = Core.Name "record"+_SentenceContent_requireImport = Core.Name "requireImport"+_SentenceContent_section = Core.Name "section"+_SentenceContent_theorem = Core.Name "theorem"+-- | A Theorem/Lemma/Proposition with a proof term+data TheoremBody =+  TheoremBody {+    theoremBodyKind :: TheoremKind,+    theoremBodyName :: Ident,+    theoremBodyBinders :: [Binder],+    theoremBodyType :: Type,+    theoremBodyProof :: Term}+  deriving (Eq, Ord, Read, Show)+_TheoremBody = Core.Name "hydra.coq.syntax.TheoremBody"+_TheoremBody_kind = Core.Name "kind"+_TheoremBody_name = Core.Name "name"+_TheoremBody_binders = Core.Name "binders"+_TheoremBody_type = Core.Name "type"+_TheoremBody_proof = Core.Name "proof"+-- | The kind of theorem command+data TheoremKind =+  TheoremKindTheorem |+  TheoremKindLemma |+  TheoremKindProposition |+  TheoremKindCorollary |+  TheoremKindExample+  deriving (Eq, Ord, Read, Show)+_TheoremKind = Core.Name "hydra.coq.syntax.TheoremKind"+_TheoremKind_theorem = Core.Name "theorem"+_TheoremKind_lemma = Core.Name "lemma"+_TheoremKind_proposition = Core.Name "proposition"+_TheoremKind_corollary = Core.Name "corollary"+_TheoremKind_example = Core.Name "example"
+ src/main/haskell/Hydra/Coq/Utils.hs view
@@ -0,0 +1,645 @@+-- Note: this is an automatically generated file. Do not edit.+-- | Pure helpers for the Coq code generator++module Hydra.Coq.Utils where+import qualified Hydra.Ast as Ast+import qualified Hydra.Coders as Coders+import qualified Hydra.Coq.Language as Language+import qualified Hydra.Core as Core+import qualified Hydra.Error.Checking as Checking+import qualified Hydra.Error.Core as ErrorCore+import qualified Hydra.Error.Packaging as ErrorPackaging+import qualified Hydra.Errors as Errors+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Graph as Graph+import qualified Hydra.Json.Model as Model+import qualified Hydra.Overlay.Haskell.Lib.Eithers as Eithers+import qualified Hydra.Overlay.Haskell.Lib.Equality as Equality+import qualified Hydra.Overlay.Haskell.Lib.Lists as Lists+import qualified Hydra.Overlay.Haskell.Lib.Logic as Logic+import qualified Hydra.Overlay.Haskell.Lib.Maps as Maps+import qualified Hydra.Overlay.Haskell.Lib.Math as Math+import qualified Hydra.Overlay.Haskell.Lib.Optionals as Optionals+import qualified Hydra.Overlay.Haskell.Lib.Pairs as Pairs+import qualified Hydra.Overlay.Haskell.Lib.Sets as Sets+import qualified Hydra.Overlay.Haskell.Lib.Strings as Strings+import qualified Hydra.Packaging as Packaging+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Paths as Paths+import qualified Hydra.Query as Query+import qualified Hydra.Relational as Relational+import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Sorting as Sorting+import qualified Hydra.Tabular as Tabular+import qualified Hydra.Testing as Testing+import qualified Hydra.Topology as Topology+import qualified Hydra.Typed as Typed+import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util+import qualified Hydra.Validation as Validation+import qualified Hydra.Variables as Variables+import qualified Hydra.Variants as Variants+import Prelude hiding  (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+import qualified Data.Map as M+import qualified Data.Set as S+-- | Build a map from each union-type definition's name to its constructor count+buildConstructorCounts :: Ord t0 => ([(t0, Core.Type)] -> M.Map t0 Int)+buildConstructorCounts defs =+    Maps.fromList (Lists.concat (Lists.map (\nt ->+      let name = Pairs.first nt+          ty = Pairs.second nt+          extracted = extractTypeParams ty+          bodyTy = Pairs.second extracted+      in case bodyTy of+        Core.TypeUnion v0 -> [+          (name, (Lists.length v0))]+        _ -> []) defs))+-- | Build a map keyed by (qualifiedTypeName, rawFieldName) producing the prefixed Coq accessor name+buildFieldMapping :: [Packaging.Module] -> M.Map (String, String) String+buildFieldMapping modules =+    Maps.fromList (Lists.concat (Lists.map (\m -> Lists.concat (Lists.map (\def_ -> case def_ of+      Packaging.DefinitionType v0 ->+        let qname = Core.unName (Packaging.typeDefinitionName v0)+            tname = localName qname+            ty = Core.typeSchemeBody (Packaging.typeDefinitionBody v0)+            extracted = extractTypeParams ty+            bodyTy = Pairs.second extracted+        in case bodyTy of+          Core.TypeRecord v1 -> Lists.map (\ft ->+            let rawFn = localNameRaw (Core.unName (Core.fieldTypeName ft))+                fn = sanitize rawFn+                prefixed =+                        Strings.cat [+                          Formatting.decapitalize tname,+                          "_",+                          fn]+            in ((qname, rawFn), prefixed)) v1+          _ -> []+      _ -> []) (Packaging.moduleDefinitions m))) modules))+-- | Collect the set of free type-variable-like names (t0, t1, ...) referenced anywhere inside a Term+collectFreeTypeVars :: Core.Term -> S.Set String+collectFreeTypeVars tm =+    case tm of+      Core.TermAnnotated v0 -> collectFreeTypeVars (Core.annotatedTermBody v0)+      Core.TermApplication v0 -> Sets.union (collectFreeTypeVars (Core.applicationFunction v0)) (collectFreeTypeVars (Core.applicationArgument v0))+      Core.TermCases v0 -> Sets.union (Optionals.cases (Core.caseStatementDefault v0) Sets.empty (\d -> collectFreeTypeVars d)) (Sets.unions (Lists.map (\f -> collectFreeTypeVars (Core.caseAlternativeHandler f)) (Core.caseStatementCases v0)))+      Core.TermEither v0 -> Eithers.either (\l -> collectFreeTypeVars l) (\r -> collectFreeTypeVars r) v0+      Core.TermInject v0 -> collectFreeTypeVars (Core.fieldTerm (Core.injectionField v0))+      Core.TermLambda v0 ->+        let paramName = Core.unName (Core.lambdaParameter v0)+            domVars = Optionals.cases (Core.lambdaDomain v0) Sets.empty (\dty -> collectFreeTypeVarsInType dty)+            bodyVars = collectFreeTypeVars (Core.lambdaBody v0)+            allVars = Sets.union domVars bodyVars+        in (Logic.ifElse (isTypeVarLike paramName) (Sets.delete paramName allVars) allVars)+      Core.TermLet v0 ->+        let bindVars =+                Sets.unions (Lists.map (\b -> Sets.union (collectFreeTypeVars (Core.bindingTerm b)) (Optionals.cases (Core.bindingTypeScheme b) Sets.empty (\sch -> collectFreeTypeVarsInTypeScheme sch))) (Core.letBindings v0))+        in (Sets.union bindVars (collectFreeTypeVars (Core.letBody v0)))+      Core.TermList v0 -> Sets.unions (Lists.map (\el -> collectFreeTypeVars el) v0)+      Core.TermOptional v0 -> Optionals.cases v0 Sets.empty (\el -> collectFreeTypeVars el)+      Core.TermPair v0 -> Sets.union (collectFreeTypeVars (Pairs.first v0)) (collectFreeTypeVars (Pairs.second v0))+      Core.TermRecord v0 -> Sets.unions (Lists.map (\f -> collectFreeTypeVars (Core.fieldTerm f)) (Core.recordFields v0))+      Core.TermSet v0 -> Sets.unions (Lists.map (\el -> collectFreeTypeVars el) (Sets.toList v0))+      Core.TermTypeApplication v0 -> collectFreeTypeVars (Core.typeApplicationTermBody v0)+      Core.TermTypeLambda v0 -> Sets.delete (Core.unName (Core.typeLambdaParameter v0)) (collectFreeTypeVars (Core.typeLambdaBody v0))+      Core.TermWrap v0 -> collectFreeTypeVars (Core.wrappedTermBody v0)+      _ -> Sets.empty+-- | Collect names of type-variable-like references (t0, t1, ...) inside a Type+collectFreeTypeVarsInType :: Core.Type -> S.Set String+collectFreeTypeVarsInType ty =+    case ty of+      Core.TypeAnnotated v0 -> collectFreeTypeVarsInType (Core.annotatedTypeBody v0)+      Core.TypeApplication v0 -> Sets.union (collectFreeTypeVarsInType (Core.applicationTypeFunction v0)) (collectFreeTypeVarsInType (Core.applicationTypeArgument v0))+      Core.TypeForall v0 -> collectFreeTypeVarsInType (Core.forallTypeBody v0)+      Core.TypeFunction v0 -> Sets.union (collectFreeTypeVarsInType (Core.functionTypeDomain v0)) (collectFreeTypeVarsInType (Core.functionTypeCodomain v0))+      Core.TypeList v0 -> collectFreeTypeVarsInType v0+      Core.TypeMap v0 -> Sets.union (collectFreeTypeVarsInType (Core.mapTypeKeys v0)) (collectFreeTypeVarsInType (Core.mapTypeValues v0))+      Core.TypeOptional v0 -> collectFreeTypeVarsInType v0+      Core.TypePair v0 -> Sets.union (collectFreeTypeVarsInType (Core.pairTypeFirst v0)) (collectFreeTypeVarsInType (Core.pairTypeSecond v0))+      Core.TypeRecord v0 -> Sets.unions (Lists.map (\f -> collectFreeTypeVarsInType (Core.fieldTypeType f)) v0)+      Core.TypeSet v0 -> collectFreeTypeVarsInType v0+      Core.TypeUnion v0 -> Sets.unions (Lists.map (\f -> collectFreeTypeVarsInType (Core.fieldTypeType f)) v0)+      Core.TypeVariable v0 ->+        let nm = Core.unName v0+        in (Logic.ifElse (isTypeVarLike nm) (Sets.singleton nm) Sets.empty)+      Core.TypeWrap v0 -> collectFreeTypeVarsInType v0+      _ -> Sets.empty+-- | Collect type-variable-like names declared or referenced by a TypeScheme+collectFreeTypeVarsInTypeScheme :: Core.TypeScheme -> S.Set String+collectFreeTypeVarsInTypeScheme ts =++      let explicit =+              Sets.fromList (Lists.map (\n -> Core.unName n) (Lists.filter (\n -> isTypeVarLike (Core.unName n)) (Core.typeSchemeVariables ts)))+      in (Sets.union explicit (collectFreeTypeVarsInType (Core.typeSchemeBody ts)))+-- | Flatten consecutive TermLet wrappers into (bindings, innermostBody)+collectLetBindings :: Core.Term -> ([Core.Binding], Core.Term)+collectLetBindings tm =+    case tm of+      Core.TermLet v0 ->+        let rest = collectLetBindings (Core.letBody v0)+        in (Lists.concat2 (Core.letBindings v0) (Pairs.first rest), (Pairs.second rest))+      _ -> ([], tm)+-- | Collect the set of qualified (hydra.*) Name strings that a Hydra Term references+collectQualifiedNamesInTerm :: Core.Term -> S.Set String+collectQualifiedNamesInTerm tm =+    case tm of+      Core.TermAnnotated v0 -> collectQualifiedNamesInTerm (Core.annotatedTermBody v0)+      Core.TermApplication v0 -> Sets.union (collectQualifiedNamesInTerm (Core.applicationFunction v0)) (collectQualifiedNamesInTerm (Core.applicationArgument v0))+      Core.TermCases v0 -> Sets.union (qualifiedFromName (Core.caseStatementTypeName v0)) (Sets.union (Sets.unions (Lists.map (\f -> collectQualifiedNamesInTerm (Core.caseAlternativeHandler f)) (Core.caseStatementCases v0))) (Optionals.cases (Core.caseStatementDefault v0) Sets.empty (\d -> collectQualifiedNamesInTerm d)))+      Core.TermEither v0 -> Eithers.either (\l -> collectQualifiedNamesInTerm l) (\r -> collectQualifiedNamesInTerm r) v0+      Core.TermInject v0 -> Sets.union (qualifiedFromName (Core.injectionTypeName v0)) (collectQualifiedNamesInTerm (Core.fieldTerm (Core.injectionField v0)))+      Core.TermLambda v0 -> Sets.union (Optionals.cases (Core.lambdaDomain v0) Sets.empty (\domTy -> collectQualifiedNamesInType domTy)) (collectQualifiedNamesInTerm (Core.lambdaBody v0))+      Core.TermLet v0 -> Sets.union (Sets.unions (Lists.map (\b -> collectQualifiedNamesInTerm (Core.bindingTerm b)) (Core.letBindings v0))) (collectQualifiedNamesInTerm (Core.letBody v0))+      Core.TermList v0 -> Sets.unions (Lists.map (\el -> collectQualifiedNamesInTerm el) v0)+      Core.TermOptional v0 -> Optionals.cases v0 Sets.empty (\el -> collectQualifiedNamesInTerm el)+      Core.TermPair v0 -> Sets.union (collectQualifiedNamesInTerm (Pairs.first v0)) (collectQualifiedNamesInTerm (Pairs.second v0))+      Core.TermRecord v0 -> Sets.union (qualifiedFromName (Core.recordTypeName v0)) (Sets.unions (Lists.map (\f -> collectQualifiedNamesInTerm (Core.fieldTerm f)) (Core.recordFields v0)))+      Core.TermTypeApplication v0 -> Sets.union (collectQualifiedNamesInTerm (Core.typeApplicationTermBody v0)) (collectQualifiedNamesInType (Core.typeApplicationTermType v0))+      Core.TermTypeLambda v0 -> collectQualifiedNamesInTerm (Core.typeLambdaBody v0)+      Core.TermVariable v0 -> qualifiedFromName v0+      Core.TermWrap v0 -> collectQualifiedNamesInTerm (Core.wrappedTermBody v0)+      _ -> Sets.empty+-- | Collect the set of qualified (hydra.*) Name strings that a Hydra Type references+collectQualifiedNamesInType :: Core.Type -> S.Set String+collectQualifiedNamesInType ty =+    case ty of+      Core.TypeAnnotated v0 -> collectQualifiedNamesInType (Core.annotatedTypeBody v0)+      Core.TypeApplication v0 -> Sets.union (collectQualifiedNamesInType (Core.applicationTypeFunction v0)) (collectQualifiedNamesInType (Core.applicationTypeArgument v0))+      Core.TypeEither v0 -> Sets.union (collectQualifiedNamesInType (Core.eitherTypeLeft v0)) (collectQualifiedNamesInType (Core.eitherTypeRight v0))+      Core.TypeForall v0 -> collectQualifiedNamesInType (Core.forallTypeBody v0)+      Core.TypeFunction v0 -> Sets.union (collectQualifiedNamesInType (Core.functionTypeDomain v0)) (collectQualifiedNamesInType (Core.functionTypeCodomain v0))+      Core.TypeList v0 -> collectQualifiedNamesInType v0+      Core.TypeMap v0 -> Sets.union (collectQualifiedNamesInType (Core.mapTypeKeys v0)) (collectQualifiedNamesInType (Core.mapTypeValues v0))+      Core.TypeOptional v0 -> collectQualifiedNamesInType v0+      Core.TypePair v0 -> Sets.union (collectQualifiedNamesInType (Core.pairTypeFirst v0)) (collectQualifiedNamesInType (Core.pairTypeSecond v0))+      Core.TypeRecord v0 -> Sets.unions (Lists.map (\f -> collectQualifiedNamesInType (Core.fieldTypeType f)) v0)+      Core.TypeSet v0 -> collectQualifiedNamesInType v0+      Core.TypeUnion v0 -> Sets.unions (Lists.map (\f -> collectQualifiedNamesInType (Core.fieldTypeType f)) v0)+      Core.TypeVariable v0 -> qualifiedFromName v0+      Core.TypeWrap v0 -> collectQualifiedNamesInType v0+      _ -> Sets.empty+-- | Collect qualified (hydra.*) Name strings from a TypeScheme's body, after stripping forall binders+collectQualifiedNamesInTypeScheme :: Core.TypeScheme -> S.Set String+collectQualifiedNamesInTypeScheme ts =++      let extracted = extractTypeParams (Core.typeSchemeBody ts)+          body = Pairs.second extracted+      in (collectQualifiedNamesInType body)+-- | Return the set of decapitalized, sanitized accessor names whose fields were replaced with unit due to positivity issues+collectSanitizedAccessors :: [(t0, [(String, Core.Type)])] -> S.Set String+collectSanitizedAccessors typeGroups =+    Sets.fromList (Lists.concat (Lists.map (\group ->+      let defs = Pairs.second group+          groupNames = Sets.fromList (Lists.map (\nt -> Pairs.first nt) defs)+      in (Logic.ifElse (hasPositivityIssue groupNames defs) (Lists.concat (Lists.map (\nt ->+        let typeName = Pairs.first nt+            ty = Pairs.second nt+            extracted = extractTypeParams ty+            bodyTy = Pairs.second extracted+        in case bodyTy of+          Core.TypeRecord v0 -> Optionals.cat (Lists.map (\f -> Logic.ifElse (fieldCausesPositivityIssue groupNames (Core.fieldTypeType f)) (Just (Strings.cat [+            Formatting.decapitalize typeName,+            "_",+            (sanitize (localName (Core.unName (Core.fieldTypeName f))))])) Nothing) v0)+          _ -> []) defs)) [])) typeGroups))+-- | Wrap a mutually recursive binding group in a hydra_fix nested-pair bundle with per-name projection lets+encodeMutualLetGroup :: [Core.Binding] -> Core.Term -> Core.Term+encodeMutualLetGroup grp body =++      let n = Lists.length grp+          bundleName = Core.Name "hydra_mutual_bundle_"+          bundleInner = Core.Name "hydra_mutual_b_"+          innerBundleVar = Core.TermVariable bundleInner+          outerBundleVar = Core.TermVariable bundleName+          appVar =+                  \fname -> \v -> Core.TermApplication (Core.Application {+                    Core.applicationFunction = (Core.TermVariable (Core.Name fname)),+                    Core.applicationArgument = v})+          nestedSecond = \k -> \v -> Logic.ifElse (Equality.equal k 0) v (appVar "pairs.second" (nestedSecond (Math.sub k 1) v))+          mkProj =+                  \bvar -> \i -> Logic.ifElse (Equality.equal i (Math.sub n 1)) (nestedSecond i bvar) (appVar "pairs.first" (nestedSecond i bvar))+          mkProjBindings =+                  \bvar -> Lists.map (\ib ->+                    let i = Pairs.first ib+                        b = Pairs.second ib+                    in Core.Binding {+                      Core.bindingName = (Core.bindingName b),+                      Core.bindingTerm = (mkProj bvar i),+                      Core.bindingTypeScheme = (Core.bindingTypeScheme b)}) (Lists.zip (Math.range 0 (Math.sub n 1)) grp)+          innerProjBindings = mkProjBindings innerBundleVar+          outerProjBindings = mkProjBindings outerBundleVar+          strippedBindings =+                  Lists.map (\b -> Core.Binding {+                    Core.bindingName = (Core.bindingName b),+                    Core.bindingTerm = (stripHydraFix (Core.bindingName b) (Core.bindingTerm b)),+                    Core.bindingTypeScheme = (Core.bindingTypeScheme b)}) grp+          mkPair =+                  \ts -> Optionals.fromOptional (Core.TermVariable (Core.Name "tt")) (Optionals.map (\p -> Logic.ifElse (Equality.equal (Lists.length ts) 1) (Pairs.first p) (Core.TermPair (Pairs.first p, (mkPair (Pairs.second p))))) (Lists.uncons ts))+          pairExpr = mkPair (Lists.map (\b -> Core.bindingTerm b) strippedBindings)+          fixBody = rebuildLets innerProjBindings pairExpr+          fixTerm =+                  Core.TermApplication (Core.Application {+                    Core.applicationFunction = (Core.TermVariable (Core.Name "hydra_fix")),+                    Core.applicationArgument = (Core.TermLambda (Core.Lambda {+                      Core.lambdaParameter = bundleInner,+                      Core.lambdaDomain = Nothing,+                      Core.lambdaBody = fixBody}))})+          bundleBinding =+                  Core.Binding {+                    Core.bindingName = bundleName,+                    Core.bindingTerm = fixTerm,+                    Core.bindingTypeScheme = Nothing}+      in (Core.TermLet (Core.Let {+        Core.letBindings = [+          bundleBinding],+        Core.letBody = (rebuildLets outerProjBindings body)}))+-- | Erase lambda domain annotations referencing unbound type variables; recurse under new type binders+eraseUnboundTypeVarDomains :: S.Set String -> Core.Term -> Core.Term+eraseUnboundTypeVarDomains initialBound term0 =++      let eraseIfUnbound =+              \bound -> \mdom -> Optionals.cases mdom Nothing (\ty -> Logic.ifElse (hasUnboundTypeVar bound ty) Nothing (Just ty))+          f =+                  \recurse -> \bound -> \term -> case term of+                    Core.TermLambda v0 ->+                      let paramName = Core.unName (Core.lambdaParameter v0)+                          dom = Core.lambdaDomain v0+                          isTypeParam =+                                  Optionals.cases dom False (\d -> case d of+                                    Core.TypeVariable v1 -> Equality.equal (Core.unName v1) "Type"+                                    _ -> False)+                          bound2 = Logic.ifElse (Logic.and isTypeParam (isTypeVarLike paramName)) (Sets.insert paramName bound) bound+                      in (Core.TermLambda (Core.Lambda {+                        Core.lambdaParameter = (Core.lambdaParameter v0),+                        Core.lambdaDomain = (eraseIfUnbound bound dom),+                        Core.lambdaBody = (f recurse bound2 (Core.lambdaBody v0))}))+                    _ -> recurse bound term+      in (Rewriting.rewriteTermWithContext f initialBound term0)+-- | Extract the namespace (everything except the last dot-separated component) from a qualified Hydra name+extractQualifiedNamespace :: String -> String+extractQualifiedNamespace s =++      let parts = Strings.splitOn "." s+      in (Logic.ifElse (Equality.gte (Lists.length parts) 2) (Strings.intercalate "." (Optionals.fromOptional [] (Lists.maybeInit parts))) s)+-- | Peel off leading forall binders, returning the list of parameter names and the inner body type+extractTypeParams :: Core.Type -> ([String], Core.Type)+extractTypeParams ty =+    case ty of+      Core.TypeForall v0 ->+        let param = Core.unName (Core.forallTypeParameter v0)+            rest = extractTypeParams (Core.forallTypeBody v0)+        in (Lists.cons param (Pairs.first rest), (Pairs.second rest))+      Core.TypeAnnotated v0 -> extractTypeParams (Core.annotatedTypeBody v0)+      _ -> ([], ty)+-- | Return True if the field type contains a function whose domain mentions a group member+fieldCausesPositivityIssue :: S.Set String -> Core.Type -> Bool+fieldCausesPositivityIssue groupNames fty =+    case fty of+      Core.TypeFunction v0 -> Logic.or (typeContainsGroupRef groupNames (Core.functionTypeDomain v0)) (fieldCausesPositivityIssue groupNames (Core.functionTypeCodomain v0))+      Core.TypeAnnotated v0 -> fieldCausesPositivityIssue groupNames (Core.annotatedTypeBody v0)+      Core.TypeForall v0 -> fieldCausesPositivityIssue groupNames (Core.forallTypeBody v0)+      Core.TypeWrap v0 -> fieldCausesPositivityIssue groupNames v0+      _ -> False+-- | Return True if any definition in the group has a record/union field whose type causes a positivity violation+hasPositivityIssue :: S.Set String -> [(t0, Core.Type)] -> Bool+hasPositivityIssue groupNames defs =+    Lists.foldl (\acc -> \nt -> Logic.or acc (+      let ty = Pairs.second nt+          extracted = extractTypeParams ty+          bodyTy = Pairs.second extracted+      in case bodyTy of+        Core.TypeRecord v0 -> Lists.foldl (\acc2 -> \f -> Logic.or acc2 (fieldCausesPositivityIssue groupNames (Core.fieldTypeType f))) False v0+        Core.TypeUnion v0 -> Lists.foldl (\acc2 -> \f -> Logic.or acc2 (fieldCausesPositivityIssue groupNames (Core.fieldTypeType f))) False v0+        _ -> False)) False defs+-- | Return True if the type mentions a t<digits> variable not present in the given set+hasUnboundTypeVar :: S.Set String -> Core.Type -> Bool+hasUnboundTypeVar bound ty =+    case ty of+      Core.TypeAnnotated v0 -> hasUnboundTypeVar bound (Core.annotatedTypeBody v0)+      Core.TypeApplication v0 -> Logic.or (hasUnboundTypeVar bound (Core.applicationTypeFunction v0)) (hasUnboundTypeVar bound (Core.applicationTypeArgument v0))+      Core.TypeFunction v0 -> Logic.or (hasUnboundTypeVar bound (Core.functionTypeDomain v0)) (hasUnboundTypeVar bound (Core.functionTypeCodomain v0))+      Core.TypeList v0 -> hasUnboundTypeVar bound v0+      Core.TypeMap v0 -> Logic.or (hasUnboundTypeVar bound (Core.mapTypeKeys v0)) (hasUnboundTypeVar bound (Core.mapTypeValues v0))+      Core.TypeOptional v0 -> hasUnboundTypeVar bound v0+      Core.TypePair v0 -> Logic.or (hasUnboundTypeVar bound (Core.pairTypeFirst v0)) (hasUnboundTypeVar bound (Core.pairTypeSecond v0))+      Core.TypeSet v0 -> hasUnboundTypeVar bound v0+      Core.TypeVariable v0 ->+        let nm = Core.unName v0+        in (Logic.and (isTypeVarLike nm) (Logic.not (Sets.member nm bound)))+      _ -> False+-- | Return True if a Term (possibly under TermAnnotated wrappers) is a TermTypeLambda+isTypeLambdaTerm :: Core.Term -> Bool+isTypeLambdaTerm tm =+    case tm of+      Core.TermAnnotated v0 -> isTypeLambdaTerm (Core.annotatedTermBody v0)+      Core.TermTypeLambda _ -> True+      _ -> False+-- | Return True if the string is of the form `t<digits>` with at least one digit+isTypeVarLike :: String -> Bool+isTypeVarLike s =++      let chars = Strings.toList s+      in (Optionals.fromOptional False (Optionals.map (\p ->+        let firstCh = Pairs.first p+            rest = Pairs.second p+        in (Logic.ifElse (Logic.not (Equality.equal firstCh 116)) False (Logic.and (Logic.not (Lists.null rest)) (Lists.foldl (\acc -> \c -> Logic.and acc (Logic.and (Equality.gte c 48) (Equality.lte c 57))) True rest)))) (Lists.uncons chars)))+-- | Return the last dot-separated segment of a qualified Hydra name, sanitised via `sanitize`+localName :: String -> String+localName s =++      let parts = Strings.splitOn "." s+          raw = Optionals.fromOptional s (Lists.maybeLast parts)+      in (sanitize raw)+-- | Return the last dot-separated segment of a qualified Hydra name, unsanitized+localNameRaw :: String -> String+localNameRaw s =++      let parts = Strings.splitOn "." s+      in (Optionals.fromOptional s (Lists.maybeLast parts))+-- | Return the deduplicated list of dependency namespace strings for a Module, excluding its own namespace+moduleDependencyNames :: Packaging.Module -> [String]+moduleDependencyNames m =++      let allDeps = Lists.map (\dep -> Packaging.unModuleName (Packaging.moduleDependencyModule dep)) (Packaging.moduleDependencies m)+          ownNs = Packaging.unModuleName (Packaging.moduleName m)+          filtered = Lists.filter (\s -> Logic.not (Equality.equal s ownNs)) allDeps+      in (Lists.nub filtered)+-- | Rewrite inner TermTypeLambda nodes and type applications so that polymorphic helpers work under Coq's erasure-based encoding+normalizeInnerTypeLambdas :: Core.Term -> Core.Term+normalizeInnerTypeLambdas term =++      let stripTypeLambdas =+              \tm -> case tm of+                Core.TermTypeLambda v0 ->+                  let rest = stripTypeLambdas (Core.typeLambdaBody v0)+                  in (Lists.cons (Core.unName (Core.typeLambdaParameter v0)) (Pairs.first rest), (Pairs.second rest))+                _ -> ([], tm)+          rebuildTypeLambdas =+                  \params -> \body -> Lists.foldr (\p -> \acc -> Core.TermTypeLambda (Core.TypeLambda {+                    Core.typeLambdaParameter = (Core.Name p),+                    Core.typeLambdaBody = acc})) body params+          f =+                  \recurse -> \polyNames -> \tm -> case tm of+                    Core.TermLet v0 ->+                      let newPoly =+                              Sets.fromList (Optionals.cat (Lists.map (\b -> Logic.ifElse (isTypeLambdaTerm (Core.bindingTerm b)) (Just (Core.unName (Core.bindingName b))) Nothing) (Core.letBindings v0)))+                          polyNames2 = Sets.union polyNames newPoly+                      in (Core.TermLet (Core.Let {+                        Core.letBindings = (Lists.map (\b -> Core.Binding {+                          Core.bindingName = (Core.bindingName b),+                          Core.bindingTerm = (f recurse polyNames2 (Core.bindingTerm b)),+                          Core.bindingTypeScheme = (Logic.ifElse (isTypeLambdaTerm (Core.bindingTerm b)) Nothing (Core.bindingTypeScheme b))}) (Core.letBindings v0)),+                        Core.letBody = (f recurse polyNames2 (Core.letBody v0))}))+                    Core.TermTypeLambda v0 -> f recurse polyNames (Core.TermLambda (Core.Lambda {+                      Core.lambdaParameter = (Core.typeLambdaParameter v0),+                      Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "Type"))),+                      Core.lambdaBody = (Core.typeLambdaBody v0)}))+                    Core.TermTypeApplication v0 ->+                      let body = Core.typeApplicationTermBody v0+                          ttype = Core.typeApplicationTermType v0+                      in (Logic.ifElse (targetsPolyName polyNames body) (f recurse polyNames (Core.TermApplication (Core.Application {+                        Core.applicationFunction = body,+                        Core.applicationArgument = (typeToTerm ttype)}))) (f recurse polyNames body))+                    _ -> recurse polyNames tm+          stripped = stripTypeLambdas term+          outerParams = Pairs.first stripped+          body0 = Pairs.second stripped+      in (Logic.ifElse (Lists.null outerParams) term (rebuildTypeLambdas outerParams (Rewriting.rewriteTermWithContext f Sets.empty body0)))+-- | Sort bindings into SCC groups using free-var analysis and local-name matching+processLetSCCs :: [Core.Binding] -> [[Core.Binding]]+processLetSCCs bindings =++      let getName = \b -> Core.unName (Core.bindingName b)+          names = Sets.fromList (Lists.map getName bindings)+          localNames = Sets.fromList (Lists.map (\b -> localNameRaw (getName b)) bindings)+          allNames = Sets.union names localNames+          depVars =+                  \b ->+                    let varsName = Variables.freeVariablesInTerm (Core.bindingTerm b)+                        vars = Sets.fromList (Lists.map (\n -> Core.unName n) (Sets.toList varsName))+                        localVars = Sets.fromList (Lists.map (\v -> localNameRaw v) (Sets.toList vars))+                    in (Sets.toList (Sets.intersection allNames (Sets.union vars localVars)))+      in (Sorting.topologicalSortNodes getName depVars bindings)+-- | Wrap a Hydra Name as a singleton set of its raw string, iff it is a qualified (hydra.*) reference+qualifiedFromName :: Core.Name -> S.Set String+qualifiedFromName n =++      let raw = Core.unName n+          parts = Strings.splitOn "." raw+      in (Logic.ifElse (Logic.and (Equality.gte (Lists.length parts) 2) (Equality.equal (Optionals.fromOptional "" (Lists.maybeHead parts)) "hydra")) (Sets.singleton raw) Sets.empty)+-- | Build a chain of single-binding TermLet wrappers around the given body+rebuildLets :: [Core.Binding] -> Core.Term -> Core.Term+rebuildLets bindings body =+    Lists.foldr (\b -> \acc -> Core.TermLet (Core.Let {+      Core.letBindings = [+        b],+      Core.letBody = acc})) body bindings+-- | Rebuild a chain of TermLet/hydra_fix wrappers from SCC-sorted binding groups+rebuildMutualLets :: [[Core.Binding]] -> Core.Term -> Core.Term+rebuildMutualLets groups body =+    Lists.foldr (\grp -> \acc -> Logic.ifElse (Equality.equal (Lists.length grp) 1) (Core.TermLet (Core.Let {+      Core.letBindings = grp,+      Core.letBody = acc})) (encodeMutualLetGroup grp acc)) body groups+-- | Topologically reorder let bindings and pair-encode mutually recursive groups+reorderLetBindings :: Core.Term -> Core.Term+reorderLetBindings term0 =++      let f =+              \recurse -> \tm -> case tm of+                Core.TermLet _ ->+                  let flat = collectLetBindings tm+                      allBindings = Pairs.first flat+                      innerBody = Pairs.second flat+                      groups = processLetSCCs allBindings+                      groups2 =+                              Lists.map (\grp -> Lists.map (\b -> Core.Binding {+                                Core.bindingName = (Core.bindingName b),+                                Core.bindingTerm = (reorderLetBindings (Core.bindingTerm b)),+                                Core.bindingTypeScheme = (Core.bindingTypeScheme b)}) grp) groups+                  in (rebuildMutualLets groups2 (reorderLetBindings innerBody))+                _ -> recurse tm+      in (Rewriting.rewriteTerm f term0)+-- | Replace field names in TermProject nodes using the given (typeName, rawFieldName) -> prefixedName map+rewriteTermFields :: M.Map (String, String) String -> Core.Term -> Core.Term+rewriteTermFields fm term0 =++      let rewrite =+              \recurse -> \term -> case term of+                Core.TermProject v0 ->+                  let tname = Core.unName (Core.projectionTypeName v0)+                      rawFn = localNameRaw (Core.unName (Core.projectionFieldName v0))+                      key = (tname, rawFn)+                      newFname = Optionals.fromOptional (Core.projectionFieldName v0) (Optionals.map (\s -> Core.Name s) (Maps.lookup key fm))+                  in (Core.TermProject (Core.Projection {+                    Core.projectionTypeName = (Core.projectionTypeName v0),+                    Core.projectionFieldName = newFname}))+                _ -> recurse term+      in (Rewriting.rewriteTerm rewrite term0)+-- | Escape a stripped local name against Coq's stripped reserved-words set+sanitize :: String -> String+sanitize s = Formatting.escapeWithUnderscore Language.coqStrippedReservedWords s+-- | Rewrite a Type, replacing offending record/union fields with TypeUnit and restoring forall binders+sanitizePositivity :: S.Set String -> Core.Type -> Core.Type+sanitizePositivity groupNames ty =++      let extracted = extractTypeParams ty+          params = Pairs.first extracted+          bodyTy = Pairs.second extracted+          sanitizeField =+                  \f -> Logic.ifElse (fieldCausesPositivityIssue groupNames (Core.fieldTypeType f)) (Core.FieldType {+                    Core.fieldTypeName = (Core.fieldTypeName f),+                    Core.fieldTypeType = Core.TypeUnit}) f+          sanitized =+                  case bodyTy of+                    Core.TypeRecord v0 -> Core.TypeRecord (Lists.map sanitizeField v0)+                    Core.TypeUnion v0 -> Core.TypeUnion (Lists.map sanitizeField v0)+                    _ -> bodyTy+      in (Lists.foldr (\p -> \t -> Core.TypeForall (Core.ForallType {+        Core.forallTypeParameter = (Core.Name p),+        Core.forallTypeBody = t})) sanitized params)+-- | Group term definitions into SCC components with a cyclic/acyclic flag+sortTermDefsSCC :: [(String, Core.Term)] -> [(Bool, [(String, Core.Term)])]+sortTermDefsSCC defs =++      let localNames = Sets.fromList (Lists.map (\d -> Pairs.first d) defs)+          depsOf = \d -> Sets.toList (termRefs localNames (Pairs.second d))+          comps = Sorting.topologicalSortNodes (\d -> Pairs.first d) depsOf defs+      in (Lists.map (\grp -> Logic.ifElse (Equality.gte (Lists.length grp) 2) (True, grp) (Optionals.fromOptional (False, grp) (Optionals.map (\d ->+        let name = Pairs.first d+            deps = termRefs localNames (Pairs.second d)+        in (Sets.member name deps, grp)) (Lists.maybeHead grp)))) comps)+-- | Group type definitions into SCC components with a cyclic/acyclic flag+sortTypeDefsSCC :: [(String, Core.Type)] -> [(Bool, [(String, Core.Type)])]+sortTypeDefsSCC defs =++      let localNames = Sets.fromList (Lists.map (\d -> Pairs.first d) defs)+          depsOf = \d -> Sets.toList (typeRefs localNames (Pairs.second d))+          comps = Sorting.topologicalSortNodes (\d -> Pairs.first d) depsOf defs+      in (Lists.map (\grp -> Logic.ifElse (Equality.gte (Lists.length grp) 2) (True, grp) (Optionals.fromOptional (False, grp) (Optionals.map (\d ->+        let name = Pairs.first d+            deps = typeRefs localNames (Pairs.second d)+        in (Sets.member name deps, grp)) (Lists.maybeHead grp)))) comps)+-- | Strip an outer hydra_fix lambda wrapper, substituting the inner self-reference for the binding name+stripHydraFix :: Core.Name -> Core.Term -> Core.Term+stripHydraFix bName tm =+    case tm of+      Core.TermApplication v0 ->+        let fn = Core.applicationFunction v0+            arg = Core.applicationArgument v0+        in case fn of+          Core.TermVariable v1 -> Logic.ifElse (Equality.equal (Core.unName v1) "hydra_fix") (case arg of+            Core.TermLambda v2 -> Variables.substituteVariable (Core.lambdaParameter v2) bName (Core.lambdaBody v2)+            _ -> tm) tm+          _ -> tm+      _ -> tm+-- | Return True if the innermost target of a (possibly nested) type application is a poly-converted local name+targetsPolyName :: S.Set String -> Core.Term -> Bool+targetsPolyName polyNames tm =+    case tm of+      Core.TermVariable v0 -> Sets.member (Core.unName v0) polyNames+      Core.TermTypeApplication v0 -> targetsPolyName polyNames (Core.typeApplicationTermBody v0)+      Core.TermAnnotated v0 -> targetsPolyName polyNames (Core.annotatedTermBody v0)+      _ -> False+-- | Walk a Term and collect the local names it references, intersected with the given locally-defined names+termRefs :: S.Set String -> Core.Term -> S.Set String+termRefs locals tm =+    case tm of+      Core.TermAnnotated v0 -> termRefs locals (Core.annotatedTermBody v0)+      Core.TermApplication v0 -> Sets.union (termRefs locals (Core.applicationFunction v0)) (termRefs locals (Core.applicationArgument v0))+      Core.TermCases v0 -> Sets.union (Sets.unions (Lists.map (\f -> termRefs locals (Core.caseAlternativeHandler f)) (Core.caseStatementCases v0))) (Optionals.cases (Core.caseStatementDefault v0) Sets.empty (\d -> termRefs locals d))+      Core.TermEither v0 -> Eithers.either (\l -> termRefs locals l) (\r -> termRefs locals r) v0+      Core.TermInject v0 -> termRefs locals (Core.fieldTerm (Core.injectionField v0))+      Core.TermLambda v0 -> termRefs locals (Core.lambdaBody v0)+      Core.TermLet v0 -> Sets.union (Sets.unions (Lists.map (\b -> termRefs locals (Core.bindingTerm b)) (Core.letBindings v0))) (termRefs locals (Core.letBody v0))+      Core.TermList v0 -> Sets.unions (Lists.map (\el -> termRefs locals el) v0)+      Core.TermOptional v0 -> Optionals.cases v0 Sets.empty (\el -> termRefs locals el)+      Core.TermPair v0 -> Sets.union (termRefs locals (Pairs.first v0)) (termRefs locals (Pairs.second v0))+      Core.TermRecord v0 -> Sets.unions (Lists.map (\f -> termRefs locals (Core.fieldTerm f)) (Core.recordFields v0))+      Core.TermTypeApplication v0 -> termRefs locals (Core.typeApplicationTermBody v0)+      Core.TermTypeLambda v0 -> termRefs locals (Core.typeLambdaBody v0)+      Core.TermVariable v0 ->+        let local = localName (Core.unName v0)+        in (Logic.ifElse (Sets.member local locals) (Sets.singleton local) Sets.empty)+      Core.TermWrap v0 -> termRefs locals (Core.wrappedTermBody v0)+      _ -> Sets.empty+-- | Return True if the Type mentions any type variable whose local name is in the given set+typeContainsGroupRef :: S.Set String -> Core.Type -> Bool+typeContainsGroupRef groupNames ty =+    case ty of+      Core.TypeAnnotated v0 -> typeContainsGroupRef groupNames (Core.annotatedTypeBody v0)+      Core.TypeApplication v0 -> Logic.or (typeContainsGroupRef groupNames (Core.applicationTypeFunction v0)) (typeContainsGroupRef groupNames (Core.applicationTypeArgument v0))+      Core.TypeEither v0 -> Logic.or (typeContainsGroupRef groupNames (Core.eitherTypeLeft v0)) (typeContainsGroupRef groupNames (Core.eitherTypeRight v0))+      Core.TypeForall v0 -> typeContainsGroupRef groupNames (Core.forallTypeBody v0)+      Core.TypeFunction v0 -> Logic.or (typeContainsGroupRef groupNames (Core.functionTypeDomain v0)) (typeContainsGroupRef groupNames (Core.functionTypeCodomain v0))+      Core.TypeList v0 -> typeContainsGroupRef groupNames v0+      Core.TypeMap v0 -> Logic.or (typeContainsGroupRef groupNames (Core.mapTypeKeys v0)) (typeContainsGroupRef groupNames (Core.mapTypeValues v0))+      Core.TypeOptional v0 -> typeContainsGroupRef groupNames v0+      Core.TypePair v0 -> Logic.or (typeContainsGroupRef groupNames (Core.pairTypeFirst v0)) (typeContainsGroupRef groupNames (Core.pairTypeSecond v0))+      Core.TypeSet v0 -> typeContainsGroupRef groupNames v0+      Core.TypeVariable v0 -> Sets.member (localName (Core.unName v0)) groupNames+      Core.TypeWrap v0 -> typeContainsGroupRef groupNames v0+      _ -> False+-- | Walk a Type and collect the local names it references, intersected with the given locally-defined names+typeRefs :: S.Set String -> Core.Type -> S.Set String+typeRefs locals ty =+    case ty of+      Core.TypeAnnotated v0 -> typeRefs locals (Core.annotatedTypeBody v0)+      Core.TypeApplication v0 -> Sets.union (typeRefs locals (Core.applicationTypeFunction v0)) (typeRefs locals (Core.applicationTypeArgument v0))+      Core.TypeEither v0 -> Sets.union (typeRefs locals (Core.eitherTypeLeft v0)) (typeRefs locals (Core.eitherTypeRight v0))+      Core.TypeForall v0 -> typeRefs locals (Core.forallTypeBody v0)+      Core.TypeFunction v0 -> Sets.union (typeRefs locals (Core.functionTypeDomain v0)) (typeRefs locals (Core.functionTypeCodomain v0))+      Core.TypeList v0 -> typeRefs locals v0+      Core.TypeMap v0 -> Sets.union (typeRefs locals (Core.mapTypeKeys v0)) (typeRefs locals (Core.mapTypeValues v0))+      Core.TypeOptional v0 -> typeRefs locals v0+      Core.TypePair v0 -> Sets.union (typeRefs locals (Core.pairTypeFirst v0)) (typeRefs locals (Core.pairTypeSecond v0))+      Core.TypeRecord v0 -> Sets.unions (Lists.map (\f -> typeRefs locals (Core.fieldTypeType f)) v0)+      Core.TypeSet v0 -> typeRefs locals v0+      Core.TypeUnion v0 -> Sets.unions (Lists.map (\f -> typeRefs locals (Core.fieldTypeType f)) v0)+      Core.TypeVariable v0 ->+        let local = localName (Core.unName v0)+        in (Logic.ifElse (Sets.member local locals) (Sets.singleton local) Sets.empty)+      Core.TypeWrap v0 -> typeRefs locals v0+      _ -> Sets.empty+-- | Convert a Hydra Type to a placeholder Term for use as an explicit Coq type argument. Coq-builtin type constructors are marked with a `Coq.` prefix so the encoder can emit them raw without going through sanitizeVar, which would clash with user-level lambda parameters of the same name (e.g. `list` -> `list_`).+typeToTerm :: Core.Type -> Core.Term+typeToTerm ty =+    case ty of+      Core.TypeVariable v0 -> Core.TermVariable v0+      Core.TypeList v0 -> Core.TermApplication (Core.Application {+        Core.applicationFunction = (Core.TermVariable (Core.Name "Coq.list")),+        Core.applicationArgument = (typeToTerm v0)})+      Core.TypeOptional v0 -> Core.TermApplication (Core.Application {+        Core.applicationFunction = (Core.TermVariable (Core.Name "Coq.option")),+        Core.applicationArgument = (typeToTerm v0)})+      Core.TypeSet v0 -> Core.TermApplication (Core.Application {+        Core.applicationFunction = (Core.TermVariable (Core.Name "Coq.list")),+        Core.applicationArgument = (typeToTerm v0)})+      Core.TypeApplication v0 -> Core.TermApplication (Core.Application {+        Core.applicationFunction = (typeToTerm (Core.applicationTypeFunction v0)),+        Core.applicationArgument = (typeToTerm (Core.applicationTypeArgument v0))})+      Core.TypeFunction _ -> Core.TermVariable (Core.Name "Coq.unit")+      Core.TypePair v0 -> Core.TermApplication (Core.Application {+        Core.applicationFunction = (Core.TermApplication (Core.Application {+          Core.applicationFunction = (Core.TermVariable (Core.Name "Coq.prod")),+          Core.applicationArgument = (typeToTerm (Core.pairTypeFirst v0))})),+        Core.applicationArgument = (typeToTerm (Core.pairTypeSecond v0))})+      Core.TypeMap v0 -> Core.TermApplication (Core.Application {+        Core.applicationFunction = (Core.TermVariable (Core.Name "Coq.list")),+        Core.applicationArgument = (Core.TermApplication (Core.Application {+          Core.applicationFunction = (Core.TermVariable (Core.Name "Coq.prod")),+          Core.applicationArgument = (typeToTerm (Core.mapTypeKeys v0))}))})+      Core.TypeUnit -> Core.TermVariable (Core.Name "Coq.unit")+      Core.TypeLiteral _ -> Core.TermVariable (Core.Name "Coq.unit")+      Core.TypeEither v0 -> Core.TermApplication (Core.Application {+        Core.applicationFunction = (Core.TermApplication (Core.Application {+          Core.applicationFunction = (Core.TermVariable (Core.Name "Coq.sum")),+          Core.applicationArgument = (typeToTerm (Core.eitherTypeLeft v0))})),+        Core.applicationArgument = (typeToTerm (Core.eitherTypeRight v0))})+      Core.TypeRecord _ -> Core.TermVariable (Core.Name "Coq.unit")+      Core.TypeUnion _ -> Core.TermVariable (Core.Name "Coq.unit")+      Core.TypeWrap v0 -> typeToTerm v0+      Core.TypeAnnotated v0 -> typeToTerm (Core.annotatedTypeBody v0)+      Core.TypeForall v0 -> typeToTerm (Core.forallTypeBody v0)+      Core.TypeVoid -> Core.TermVariable (Core.Name "Coq.Empty_set")+      _ -> Core.TermVariable (Core.Name "Coq.unit")
+ src/main/haskell/Hydra/Dsl/Coq/Syntax.hs view
@@ -0,0 +1,6445 @@+-- Note: this is an automatically generated file. Do not edit.+-- | DSL functions for hydra.coq.syntax++module Hydra.Dsl.Coq.Syntax where+import qualified Hydra.Coq.Syntax as Syntax+import qualified Hydra.Core as Core+import qualified Hydra.Typed as Typed+import Prelude hiding  (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.Scientific as Sci+-- | DSL constructor for hydra.coq.syntax.AnnotatedApplication+annotatedApplication :: Typed.TypedTerm Syntax.QualidAnnotated -> Typed.TypedTerm [Syntax.Term1] -> Typed.TypedTerm Syntax.AnnotatedApplication+annotatedApplication annot terms =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.AnnotatedApplication"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Typed.unTypedTerm annot)},+        Core.Field {+          Core.fieldName = (Core.Name "terms"),+          Core.fieldTerm = (Typed.unTypedTerm terms)}]}))+-- | DSL accessor for the annot field of hydra.coq.syntax.AnnotatedApplication+annotatedApplicationAnnot :: Typed.TypedTerm Syntax.AnnotatedApplication -> Typed.TypedTerm Syntax.QualidAnnotated+annotatedApplicationAnnot x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.AnnotatedApplication"),+        Core.projectionFieldName = (Core.Name "annot")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the terms field of hydra.coq.syntax.AnnotatedApplication+annotatedApplicationTerms :: Typed.TypedTerm Syntax.AnnotatedApplication -> Typed.TypedTerm [Syntax.Term1]+annotatedApplicationTerms x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.AnnotatedApplication"),+        Core.projectionFieldName = (Core.Name "terms")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the annot field of hydra.coq.syntax.AnnotatedApplication+annotatedApplicationWithAnnot :: Typed.TypedTerm Syntax.AnnotatedApplication -> Typed.TypedTerm Syntax.QualidAnnotated -> Typed.TypedTerm Syntax.AnnotatedApplication+annotatedApplicationWithAnnot original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.AnnotatedApplication"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "terms"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.AnnotatedApplication"),+              Core.projectionFieldName = (Core.Name "terms")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the terms field of hydra.coq.syntax.AnnotatedApplication+annotatedApplicationWithTerms :: Typed.TypedTerm Syntax.AnnotatedApplication -> Typed.TypedTerm [Syntax.Term1] -> Typed.TypedTerm Syntax.AnnotatedApplication+annotatedApplicationWithTerms original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.AnnotatedApplication"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.AnnotatedApplication"),+              Core.projectionFieldName = (Core.Name "annot")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "terms"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL injection for the annotated variant of hydra.coq.syntax.Application+applicationAnnotated :: Typed.TypedTerm Syntax.AnnotatedApplication -> Typed.TypedTerm Syntax.Application+applicationAnnotated x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Application"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "annotated"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the normal variant of hydra.coq.syntax.Application+applicationNormal :: Typed.TypedTerm Syntax.NormalApplication -> Typed.TypedTerm Syntax.Application+applicationNormal x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Application"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "normal"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the ident variant of hydra.coq.syntax.Arg+argIdent :: Typed.TypedTerm Syntax.IdentArg -> Typed.TypedTerm Syntax.Arg+argIdent x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Arg"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "ident"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the natural variant of hydra.coq.syntax.Arg+argNatural :: Typed.TypedTerm Syntax.NaturalArg -> Typed.TypedTerm Syntax.Arg+argNatural x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Arg"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "natural"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the term variant of hydra.coq.syntax.Arg+argTerm :: Typed.TypedTerm Syntax.Term1 -> Typed.TypedTerm Syntax.Arg+argTerm x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Arg"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "term"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.coq.syntax.AxiomDeclaration+axiomDeclaration :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.AxiomDeclaration+axiomDeclaration name type_ =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.AxiomDeclaration"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm name)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm type_)}]}))+-- | DSL accessor for the name field of hydra.coq.syntax.AxiomDeclaration+axiomDeclarationName :: Typed.TypedTerm Syntax.AxiomDeclaration -> Typed.TypedTerm Syntax.Ident+axiomDeclarationName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.AxiomDeclaration"),+        Core.projectionFieldName = (Core.Name "name")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.coq.syntax.AxiomDeclaration+axiomDeclarationType :: Typed.TypedTerm Syntax.AxiomDeclaration -> Typed.TypedTerm Syntax.Type+axiomDeclarationType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.AxiomDeclaration"),+        Core.projectionFieldName = (Core.Name "type")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the name field of hydra.coq.syntax.AxiomDeclaration+axiomDeclarationWithName :: Typed.TypedTerm Syntax.AxiomDeclaration -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.AxiomDeclaration+axiomDeclarationWithName original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.AxiomDeclaration"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.AxiomDeclaration"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.coq.syntax.AxiomDeclaration+axiomDeclarationWithType :: Typed.TypedTerm Syntax.AxiomDeclaration -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.AxiomDeclaration+axiomDeclarationWithType original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.AxiomDeclaration"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.AxiomDeclaration"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL injection for the generalizing variant of hydra.coq.syntax.Binder+binderGeneralizing :: Typed.TypedTerm Syntax.GeneralizingBinder -> Typed.TypedTerm Syntax.Binder+binderGeneralizing x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Binder"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "generalizing"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the implicit variant of hydra.coq.syntax.Binder+binderImplicit :: Typed.TypedTerm Syntax.ImplicitBinders -> Typed.TypedTerm Syntax.Binder+binderImplicit x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Binder"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "implicit"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the name variant of hydra.coq.syntax.Binder+binderName :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.Binder+binderName x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Binder"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "name"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the pattern variant of hydra.coq.syntax.Binder+binderPattern :: Typed.TypedTerm Syntax.Pattern0 -> Typed.TypedTerm Syntax.Binder+binderPattern x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Binder"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "pattern"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the term variant of hydra.coq.syntax.Binder+binderTerm :: Typed.TypedTerm Syntax.LetBinder -> Typed.TypedTerm Syntax.Binder+binderTerm x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Binder"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "term"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the type variant of hydra.coq.syntax.Binder+binderType :: Typed.TypedTerm Syntax.TypeBinders -> Typed.TypedTerm Syntax.Binder+binderType x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Binder"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "type"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.coq.syntax.CaseItem+caseItem :: Typed.TypedTerm Syntax.Term100 -> Typed.TypedTerm (Maybe Syntax.Name) -> Typed.TypedTerm (Maybe Syntax.Pattern) -> Typed.TypedTerm Syntax.CaseItem+caseItem term as in_ =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.CaseItem"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)},+        Core.Field {+          Core.fieldName = (Core.Name "as"),+          Core.fieldTerm = (Typed.unTypedTerm as)},+        Core.Field {+          Core.fieldName = (Core.Name "in"),+          Core.fieldTerm = (Typed.unTypedTerm in_)}]}))+-- | DSL accessor for the as field of hydra.coq.syntax.CaseItem+caseItemAs :: Typed.TypedTerm Syntax.CaseItem -> Typed.TypedTerm (Maybe Syntax.Name)+caseItemAs x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CaseItem"),+        Core.projectionFieldName = (Core.Name "as")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the in field of hydra.coq.syntax.CaseItem+caseItemIn :: Typed.TypedTerm Syntax.CaseItem -> Typed.TypedTerm (Maybe Syntax.Pattern)+caseItemIn x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CaseItem"),+        Core.projectionFieldName = (Core.Name "in")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term field of hydra.coq.syntax.CaseItem+caseItemTerm :: Typed.TypedTerm Syntax.CaseItem -> Typed.TypedTerm Syntax.Term100+caseItemTerm x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CaseItem"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the as field of hydra.coq.syntax.CaseItem+caseItemWithAs :: Typed.TypedTerm Syntax.CaseItem -> Typed.TypedTerm (Maybe Syntax.Name) -> Typed.TypedTerm Syntax.CaseItem+caseItemWithAs original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.CaseItem"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CaseItem"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "as"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "in"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CaseItem"),+              Core.projectionFieldName = (Core.Name "in")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the in field of hydra.coq.syntax.CaseItem+caseItemWithIn :: Typed.TypedTerm Syntax.CaseItem -> Typed.TypedTerm (Maybe Syntax.Pattern) -> Typed.TypedTerm Syntax.CaseItem+caseItemWithIn original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.CaseItem"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CaseItem"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "as"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CaseItem"),+              Core.projectionFieldName = (Core.Name "as")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "in"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the term field of hydra.coq.syntax.CaseItem+caseItemWithTerm :: Typed.TypedTerm Syntax.CaseItem -> Typed.TypedTerm Syntax.Term100 -> Typed.TypedTerm Syntax.CaseItem+caseItemWithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.CaseItem"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "as"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CaseItem"),+              Core.projectionFieldName = (Core.Name "as")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "in"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CaseItem"),+              Core.projectionFieldName = (Core.Name "in")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.coq.syntax.Cofix+cofix :: Typed.TypedTerm Syntax.CofixBody -> Typed.TypedTerm (Maybe Syntax.CofixQual) -> Typed.TypedTerm Syntax.Cofix+cofix body qual =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Cofix"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Typed.unTypedTerm body)},+        Core.Field {+          Core.fieldName = (Core.Name "qual"),+          Core.fieldTerm = (Typed.unTypedTerm qual)}]}))+-- | DSL accessor for the body field of hydra.coq.syntax.Cofix+cofixBody :: Typed.TypedTerm Syntax.Cofix -> Typed.TypedTerm Syntax.CofixBody+cofixBody x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Cofix"),+        Core.projectionFieldName = (Core.Name "body")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL constructor for hydra.coq.syntax.CofixBody+cofixBody2 :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.CofixBody+cofixBody2 ident binders type_ term =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Typed.unTypedTerm ident)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm binders)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm type_)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)}]}))+-- | DSL accessor for the binders field of hydra.coq.syntax.CofixBody+cofixBodyBinders :: Typed.TypedTerm Syntax.CofixBody -> Typed.TypedTerm [Syntax.Binder]+cofixBodyBinders x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+        Core.projectionFieldName = (Core.Name "binders")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the ident field of hydra.coq.syntax.CofixBody+cofixBodyIdent :: Typed.TypedTerm Syntax.CofixBody -> Typed.TypedTerm Syntax.Ident+cofixBodyIdent x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+        Core.projectionFieldName = (Core.Name "ident")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term field of hydra.coq.syntax.CofixBody+cofixBodyTerm :: Typed.TypedTerm Syntax.CofixBody -> Typed.TypedTerm Syntax.Term+cofixBodyTerm x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.coq.syntax.CofixBody+cofixBodyType :: Typed.TypedTerm Syntax.CofixBody -> Typed.TypedTerm (Maybe Syntax.Type)+cofixBodyType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+        Core.projectionFieldName = (Core.Name "type")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the binders field of hydra.coq.syntax.CofixBody+cofixBodyWithBinders :: Typed.TypedTerm Syntax.CofixBody -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm Syntax.CofixBody+cofixBodyWithBinders original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+              Core.projectionFieldName = (Core.Name "ident")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the ident field of hydra.coq.syntax.CofixBody+cofixBodyWithIdent :: Typed.TypedTerm Syntax.CofixBody -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.CofixBody+cofixBodyWithIdent original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the term field of hydra.coq.syntax.CofixBody+cofixBodyWithTerm :: Typed.TypedTerm Syntax.CofixBody -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.CofixBody+cofixBodyWithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+              Core.projectionFieldName = (Core.Name "ident")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the type field of hydra.coq.syntax.CofixBody+cofixBodyWithType :: Typed.TypedTerm Syntax.CofixBody -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm Syntax.CofixBody+cofixBodyWithType original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+              Core.projectionFieldName = (Core.Name "ident")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixBody"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL accessor for the qual field of hydra.coq.syntax.Cofix+cofixQual :: Typed.TypedTerm Syntax.Cofix -> Typed.TypedTerm (Maybe Syntax.CofixQual)+cofixQual x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Cofix"),+        Core.projectionFieldName = (Core.Name "qual")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL injection for the in variant of hydra.coq.syntax.CofixQual+cofixQualIn :: Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.CofixQual+cofixQualIn x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.CofixQual"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "in"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the with variant of hydra.coq.syntax.CofixQual+cofixQualWith :: Typed.TypedTerm Syntax.CofixWith -> Typed.TypedTerm Syntax.CofixQual+cofixQualWith x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.CofixQual"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "with"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.coq.syntax.CofixWith+cofixWith :: Typed.TypedTerm [Syntax.CofixBody] -> Typed.TypedTerm (Maybe Syntax.Ident) -> Typed.TypedTerm Syntax.CofixWith+cofixWith with for =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.CofixWith"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "with"),+          Core.fieldTerm = (Typed.unTypedTerm with)},+        Core.Field {+          Core.fieldName = (Core.Name "for"),+          Core.fieldTerm = (Typed.unTypedTerm for)}]}))+-- | DSL updater for the body field of hydra.coq.syntax.Cofix+cofixWithBody :: Typed.TypedTerm Syntax.Cofix -> Typed.TypedTerm Syntax.CofixBody -> Typed.TypedTerm Syntax.Cofix+cofixWithBody original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Cofix"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "qual"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Cofix"),+              Core.projectionFieldName = (Core.Name "qual")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL accessor for the for field of hydra.coq.syntax.CofixWith+cofixWithFor :: Typed.TypedTerm Syntax.CofixWith -> Typed.TypedTerm (Maybe Syntax.Ident)+cofixWithFor x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixWith"),+        Core.projectionFieldName = (Core.Name "for")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the qual field of hydra.coq.syntax.Cofix+cofixWithQual :: Typed.TypedTerm Syntax.Cofix -> Typed.TypedTerm (Maybe Syntax.CofixQual) -> Typed.TypedTerm Syntax.Cofix+cofixWithQual original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Cofix"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Cofix"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "qual"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL accessor for the with field of hydra.coq.syntax.CofixWith+cofixWithWith :: Typed.TypedTerm Syntax.CofixWith -> Typed.TypedTerm [Syntax.CofixBody]+cofixWithWith x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixWith"),+        Core.projectionFieldName = (Core.Name "with")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the for field of hydra.coq.syntax.CofixWith+cofixWithWithFor :: Typed.TypedTerm Syntax.CofixWith -> Typed.TypedTerm (Maybe Syntax.Ident) -> Typed.TypedTerm Syntax.CofixWith+cofixWithWithFor original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.CofixWith"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "with"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixWith"),+              Core.projectionFieldName = (Core.Name "with")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "for"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the with field of hydra.coq.syntax.CofixWith+cofixWithWithWith :: Typed.TypedTerm Syntax.CofixWith -> Typed.TypedTerm [Syntax.CofixBody] -> Typed.TypedTerm Syntax.CofixWith+cofixWithWithWith original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.CofixWith"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "with"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "for"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.CofixWith"),+              Core.projectionFieldName = (Core.Name "for")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for the hydra.coq.syntax.Comment wrapper+comment :: Typed.TypedTerm String -> Typed.TypedTerm Syntax.Comment+comment x =+    Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+      Core.wrappedTermTypeName = (Core.Name "hydra.coq.syntax.Comment"),+      Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL constructor for hydra.coq.syntax.Constructor+constructor :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm Syntax.Constructor+constructor name binders type_ =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Constructor"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm name)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm binders)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm type_)}]}))+-- | DSL accessor for the binders field of hydra.coq.syntax.Constructor+constructorBinders :: Typed.TypedTerm Syntax.Constructor -> Typed.TypedTerm [Syntax.Binder]+constructorBinders x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Constructor"),+        Core.projectionFieldName = (Core.Name "binders")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.coq.syntax.Constructor+constructorName :: Typed.TypedTerm Syntax.Constructor -> Typed.TypedTerm Syntax.Ident+constructorName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Constructor"),+        Core.projectionFieldName = (Core.Name "name")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.coq.syntax.Constructor+constructorType :: Typed.TypedTerm Syntax.Constructor -> Typed.TypedTerm (Maybe Syntax.Type)+constructorType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Constructor"),+        Core.projectionFieldName = (Core.Name "type")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the binders field of hydra.coq.syntax.Constructor+constructorWithBinders :: Typed.TypedTerm Syntax.Constructor -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm Syntax.Constructor+constructorWithBinders original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Constructor"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Constructor"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Constructor"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the name field of hydra.coq.syntax.Constructor+constructorWithName :: Typed.TypedTerm Syntax.Constructor -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.Constructor+constructorWithName original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Constructor"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Constructor"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Constructor"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.coq.syntax.Constructor+constructorWithType :: Typed.TypedTerm Syntax.Constructor -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm Syntax.Constructor+constructorWithType original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Constructor"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Constructor"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Constructor"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.Definition+definition :: Typed.TypedTerm (Maybe Syntax.Locality) -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Definition+definition locality name binders type_ body =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Definition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Typed.unTypedTerm locality)},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm name)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm binders)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm type_)},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Typed.unTypedTerm body)}]}))+-- | DSL accessor for the binders field of hydra.coq.syntax.Definition+definitionBinders :: Typed.TypedTerm Syntax.Definition -> Typed.TypedTerm [Syntax.Binder]+definitionBinders x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+        Core.projectionFieldName = (Core.Name "binders")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body field of hydra.coq.syntax.Definition+definitionBody :: Typed.TypedTerm Syntax.Definition -> Typed.TypedTerm Syntax.Term+definitionBody x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+        Core.projectionFieldName = (Core.Name "body")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the locality field of hydra.coq.syntax.Definition+definitionLocality :: Typed.TypedTerm Syntax.Definition -> Typed.TypedTerm (Maybe Syntax.Locality)+definitionLocality x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+        Core.projectionFieldName = (Core.Name "locality")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.coq.syntax.Definition+definitionName :: Typed.TypedTerm Syntax.Definition -> Typed.TypedTerm Syntax.Ident+definitionName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+        Core.projectionFieldName = (Core.Name "name")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.coq.syntax.Definition+definitionType :: Typed.TypedTerm Syntax.Definition -> Typed.TypedTerm (Maybe Syntax.Type)+definitionType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+        Core.projectionFieldName = (Core.Name "type")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the binders field of hydra.coq.syntax.Definition+definitionWithBinders :: Typed.TypedTerm Syntax.Definition -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm Syntax.Definition+definitionWithBinders original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Definition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the body field of hydra.coq.syntax.Definition+definitionWithBody :: Typed.TypedTerm Syntax.Definition -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Definition+definitionWithBody original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Definition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the locality field of hydra.coq.syntax.Definition+definitionWithLocality :: Typed.TypedTerm Syntax.Definition -> Typed.TypedTerm (Maybe Syntax.Locality) -> Typed.TypedTerm Syntax.Definition+definitionWithLocality original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Definition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the name field of hydra.coq.syntax.Definition+definitionWithName :: Typed.TypedTerm Syntax.Definition -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.Definition+definitionWithName original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Definition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.coq.syntax.Definition+definitionWithType :: Typed.TypedTerm Syntax.Definition -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm Syntax.Definition+definitionWithType original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Definition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Definition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.coq.syntax.Document+document :: Typed.TypedTerm [Syntax.Sentence] -> Typed.TypedTerm Syntax.Document+document sentences =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Document"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "sentences"),+          Core.fieldTerm = (Typed.unTypedTerm sentences)}]}))+-- | DSL accessor for the sentences field of hydra.coq.syntax.Document+documentSentences :: Typed.TypedTerm Syntax.Document -> Typed.TypedTerm [Syntax.Sentence]+documentSentences x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Document"),+        Core.projectionFieldName = (Core.Name "sentences")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the sentences field of hydra.coq.syntax.Document+documentWithSentences :: Typed.TypedTerm Syntax.Document -> Typed.TypedTerm [Syntax.Sentence] -> Typed.TypedTerm Syntax.Document+documentWithSentences original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Document"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "sentences"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.Equation+equation :: Typed.TypedTerm [[Syntax.Pattern]] -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Equation+equation pattern term =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Equation"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Typed.unTypedTerm pattern)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)}]}))+-- | DSL accessor for the pattern field of hydra.coq.syntax.Equation+equationPattern :: Typed.TypedTerm Syntax.Equation -> Typed.TypedTerm [[Syntax.Pattern]]+equationPattern x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Equation"),+        Core.projectionFieldName = (Core.Name "pattern")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term field of hydra.coq.syntax.Equation+equationTerm :: Typed.TypedTerm Syntax.Equation -> Typed.TypedTerm Syntax.Term+equationTerm x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Equation"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the pattern field of hydra.coq.syntax.Equation+equationWithPattern :: Typed.TypedTerm Syntax.Equation -> Typed.TypedTerm [[Syntax.Pattern]] -> Typed.TypedTerm Syntax.Equation+equationWithPattern original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Equation"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Equation"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the term field of hydra.coq.syntax.Equation+equationWithTerm :: Typed.TypedTerm Syntax.Equation -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Equation+equationWithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Equation"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Equation"),+              Core.projectionFieldName = (Core.Name "pattern")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.ExistentialVariable+existentialVariable :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.ExistentialVariableVariant -> Typed.TypedTerm Syntax.ExistentialVariable+existentialVariable ident variant =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.ExistentialVariable"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Typed.unTypedTerm ident)},+        Core.Field {+          Core.fieldName = (Core.Name "variant"),+          Core.fieldTerm = (Typed.unTypedTerm variant)}]}))+-- | DSL accessor for the ident field of hydra.coq.syntax.ExistentialVariable+existentialVariableIdent :: Typed.TypedTerm Syntax.ExistentialVariable -> Typed.TypedTerm Syntax.Ident+existentialVariableIdent x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.ExistentialVariable"),+        Core.projectionFieldName = (Core.Name "ident")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the variant field of hydra.coq.syntax.ExistentialVariable+existentialVariableVariant :: Typed.TypedTerm Syntax.ExistentialVariable -> Typed.TypedTerm Syntax.ExistentialVariableVariant+existentialVariableVariant x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.ExistentialVariable"),+        Core.projectionFieldName = (Core.Name "variant")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL injection for the inside1 variant of hydra.coq.syntax.ExistentialVariableVariant+existentialVariableVariantInside1 :: Typed.TypedTerm Syntax.ExistentialVariableVariant+existentialVariableVariantInside1 =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.ExistentialVariableVariant"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "inside1"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the inside2 variant of hydra.coq.syntax.ExistentialVariableVariant+existentialVariableVariantInside2 :: Typed.TypedTerm Syntax.ExistentialVariableVariant+existentialVariableVariantInside2 =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.ExistentialVariableVariant"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "inside2"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the outside variant of hydra.coq.syntax.ExistentialVariableVariant+existentialVariableVariantOutside :: Typed.TypedTerm (Maybe Syntax.IdentArg) -> Typed.TypedTerm Syntax.ExistentialVariableVariant+existentialVariableVariantOutside x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.ExistentialVariableVariant"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "outside"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the placeholder variant of hydra.coq.syntax.ExistentialVariableVariant+existentialVariableVariantPlaceholder :: Typed.TypedTerm Syntax.ExistentialVariableVariant+existentialVariableVariantPlaceholder =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.ExistentialVariableVariant"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "placeholder"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL updater for the ident field of hydra.coq.syntax.ExistentialVariable+existentialVariableWithIdent :: Typed.TypedTerm Syntax.ExistentialVariable -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.ExistentialVariable+existentialVariableWithIdent original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.ExistentialVariable"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "variant"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.ExistentialVariable"),+              Core.projectionFieldName = (Core.Name "variant")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the variant field of hydra.coq.syntax.ExistentialVariable+existentialVariableWithVariant :: Typed.TypedTerm Syntax.ExistentialVariable -> Typed.TypedTerm Syntax.ExistentialVariableVariant -> Typed.TypedTerm Syntax.ExistentialVariable+existentialVariableWithVariant original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.ExistentialVariable"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.ExistentialVariable"),+              Core.projectionFieldName = (Core.Name "ident")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "variant"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for the hydra.coq.syntax.FieldIdent wrapper+fieldIdent :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.FieldIdent+fieldIdent x =+    Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+      Core.wrappedTermTypeName = (Core.Name "hydra.coq.syntax.FieldIdent"),+      Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL injection for the measure variant of hydra.coq.syntax.FixAnnot+fixAnnotMeasure :: Typed.TypedTerm Syntax.FixAnnot_Measure -> Typed.TypedTerm Syntax.FixAnnot+fixAnnotMeasure x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "measure"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the struct variant of hydra.coq.syntax.FixAnnot+fixAnnotStruct :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.FixAnnot+fixAnnotStruct x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "struct"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the wf variant of hydra.coq.syntax.FixAnnot+fixAnnotWf :: Typed.TypedTerm Syntax.FixAnnot_Wf -> Typed.TypedTerm Syntax.FixAnnot+fixAnnotWf x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "wf"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.coq.syntax.FixAnnot_Measure+fixAnnot_Measure :: Typed.TypedTerm Syntax.OneTerm -> Typed.TypedTerm (Maybe Syntax.Ident) -> Typed.TypedTerm (Maybe Syntax.OneTerm) -> Typed.TypedTerm Syntax.FixAnnot_Measure+fixAnnot_Measure term ident term2 =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Measure"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)},+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Typed.unTypedTerm ident)},+        Core.Field {+          Core.fieldName = (Core.Name "term2"),+          Core.fieldTerm = (Typed.unTypedTerm term2)}]}))+-- | DSL accessor for the ident field of hydra.coq.syntax.FixAnnot_Measure+fixAnnot_MeasureIdent :: Typed.TypedTerm Syntax.FixAnnot_Measure -> Typed.TypedTerm (Maybe Syntax.Ident)+fixAnnot_MeasureIdent x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Measure"),+        Core.projectionFieldName = (Core.Name "ident")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term field of hydra.coq.syntax.FixAnnot_Measure+fixAnnot_MeasureTerm :: Typed.TypedTerm Syntax.FixAnnot_Measure -> Typed.TypedTerm Syntax.OneTerm+fixAnnot_MeasureTerm x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Measure"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term2 field of hydra.coq.syntax.FixAnnot_Measure+fixAnnot_MeasureTerm2 :: Typed.TypedTerm Syntax.FixAnnot_Measure -> Typed.TypedTerm (Maybe Syntax.OneTerm)+fixAnnot_MeasureTerm2 x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Measure"),+        Core.projectionFieldName = (Core.Name "term2")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the ident field of hydra.coq.syntax.FixAnnot_Measure+fixAnnot_MeasureWithIdent :: Typed.TypedTerm Syntax.FixAnnot_Measure -> Typed.TypedTerm (Maybe Syntax.Ident) -> Typed.TypedTerm Syntax.FixAnnot_Measure+fixAnnot_MeasureWithIdent original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Measure"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Measure"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "term2"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Measure"),+              Core.projectionFieldName = (Core.Name "term2")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the term field of hydra.coq.syntax.FixAnnot_Measure+fixAnnot_MeasureWithTerm :: Typed.TypedTerm Syntax.FixAnnot_Measure -> Typed.TypedTerm Syntax.OneTerm -> Typed.TypedTerm Syntax.FixAnnot_Measure+fixAnnot_MeasureWithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Measure"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Measure"),+              Core.projectionFieldName = (Core.Name "ident")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term2"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Measure"),+              Core.projectionFieldName = (Core.Name "term2")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the term2 field of hydra.coq.syntax.FixAnnot_Measure+fixAnnot_MeasureWithTerm2 :: Typed.TypedTerm Syntax.FixAnnot_Measure -> Typed.TypedTerm (Maybe Syntax.OneTerm) -> Typed.TypedTerm Syntax.FixAnnot_Measure+fixAnnot_MeasureWithTerm2 original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Measure"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Measure"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Measure"),+              Core.projectionFieldName = (Core.Name "ident")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term2"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.FixAnnot_Wf+fixAnnot_Wf :: Typed.TypedTerm Syntax.OneTerm -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.FixAnnot_Wf+fixAnnot_Wf term ident =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Wf"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)},+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Typed.unTypedTerm ident)}]}))+-- | DSL accessor for the ident field of hydra.coq.syntax.FixAnnot_Wf+fixAnnot_WfIdent :: Typed.TypedTerm Syntax.FixAnnot_Wf -> Typed.TypedTerm Syntax.Ident+fixAnnot_WfIdent x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Wf"),+        Core.projectionFieldName = (Core.Name "ident")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term field of hydra.coq.syntax.FixAnnot_Wf+fixAnnot_WfTerm :: Typed.TypedTerm Syntax.FixAnnot_Wf -> Typed.TypedTerm Syntax.OneTerm+fixAnnot_WfTerm x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Wf"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the ident field of hydra.coq.syntax.FixAnnot_Wf+fixAnnot_WfWithIdent :: Typed.TypedTerm Syntax.FixAnnot_Wf -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.FixAnnot_Wf+fixAnnot_WfWithIdent original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Wf"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Wf"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the term field of hydra.coq.syntax.FixAnnot_Wf+fixAnnot_WfWithTerm :: Typed.TypedTerm Syntax.FixAnnot_Wf -> Typed.TypedTerm Syntax.OneTerm -> Typed.TypedTerm Syntax.FixAnnot_Wf+fixAnnot_WfWithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Wf"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixAnnot_Wf"),+              Core.projectionFieldName = (Core.Name "ident")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL injection for the decl variant of hydra.coq.syntax.Fix+fixDecl :: Typed.TypedTerm Syntax.Fix_Decl -> Typed.TypedTerm Syntax.Fix+fixDecl x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Fix"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "decl"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the qual variant of hydra.coq.syntax.Fix+fixQual :: Typed.TypedTerm (Maybe Syntax.Fix_Qual) -> Typed.TypedTerm Syntax.Fix+fixQual x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Fix"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "qual"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.coq.syntax.FixWith+fixWith :: Typed.TypedTerm [Syntax.Fix_Decl] -> Typed.TypedTerm (Maybe Syntax.Ident) -> Typed.TypedTerm Syntax.FixWith+fixWith decls for =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixWith"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "decls"),+          Core.fieldTerm = (Typed.unTypedTerm decls)},+        Core.Field {+          Core.fieldName = (Core.Name "for"),+          Core.fieldTerm = (Typed.unTypedTerm for)}]}))+-- | DSL accessor for the decls field of hydra.coq.syntax.FixWith+fixWithDecls :: Typed.TypedTerm Syntax.FixWith -> Typed.TypedTerm [Syntax.Fix_Decl]+fixWithDecls x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixWith"),+        Core.projectionFieldName = (Core.Name "decls")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the for field of hydra.coq.syntax.FixWith+fixWithFor :: Typed.TypedTerm Syntax.FixWith -> Typed.TypedTerm (Maybe Syntax.Ident)+fixWithFor x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixWith"),+        Core.projectionFieldName = (Core.Name "for")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the decls field of hydra.coq.syntax.FixWith+fixWithWithDecls :: Typed.TypedTerm Syntax.FixWith -> Typed.TypedTerm [Syntax.Fix_Decl] -> Typed.TypedTerm Syntax.FixWith+fixWithWithDecls original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixWith"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "decls"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "for"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixWith"),+              Core.projectionFieldName = (Core.Name "for")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the for field of hydra.coq.syntax.FixWith+fixWithWithFor :: Typed.TypedTerm Syntax.FixWith -> Typed.TypedTerm (Maybe Syntax.Ident) -> Typed.TypedTerm Syntax.FixWith+fixWithWithFor original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixWith"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "decls"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixWith"),+              Core.projectionFieldName = (Core.Name "decls")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "for"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.Fix_Decl+fix_Decl :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm (Maybe Syntax.FixAnnot) -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Fix_Decl+fix_Decl ident binders annot type_ term =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Typed.unTypedTerm ident)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm binders)},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Typed.unTypedTerm annot)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm type_)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)}]}))+-- | DSL accessor for the annot field of hydra.coq.syntax.Fix_Decl+fix_DeclAnnot :: Typed.TypedTerm Syntax.Fix_Decl -> Typed.TypedTerm (Maybe Syntax.FixAnnot)+fix_DeclAnnot x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+        Core.projectionFieldName = (Core.Name "annot")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the binders field of hydra.coq.syntax.Fix_Decl+fix_DeclBinders :: Typed.TypedTerm Syntax.Fix_Decl -> Typed.TypedTerm [Syntax.Binder]+fix_DeclBinders x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+        Core.projectionFieldName = (Core.Name "binders")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the ident field of hydra.coq.syntax.Fix_Decl+fix_DeclIdent :: Typed.TypedTerm Syntax.Fix_Decl -> Typed.TypedTerm Syntax.Ident+fix_DeclIdent x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+        Core.projectionFieldName = (Core.Name "ident")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term field of hydra.coq.syntax.Fix_Decl+fix_DeclTerm :: Typed.TypedTerm Syntax.Fix_Decl -> Typed.TypedTerm Syntax.Term+fix_DeclTerm x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.coq.syntax.Fix_Decl+fix_DeclType :: Typed.TypedTerm Syntax.Fix_Decl -> Typed.TypedTerm (Maybe Syntax.Type)+fix_DeclType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+        Core.projectionFieldName = (Core.Name "type")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the annot field of hydra.coq.syntax.Fix_Decl+fix_DeclWithAnnot :: Typed.TypedTerm Syntax.Fix_Decl -> Typed.TypedTerm (Maybe Syntax.FixAnnot) -> Typed.TypedTerm Syntax.Fix_Decl+fix_DeclWithAnnot original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "ident")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the binders field of hydra.coq.syntax.Fix_Decl+fix_DeclWithBinders :: Typed.TypedTerm Syntax.Fix_Decl -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm Syntax.Fix_Decl+fix_DeclWithBinders original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "ident")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "annot")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the ident field of hydra.coq.syntax.Fix_Decl+fix_DeclWithIdent :: Typed.TypedTerm Syntax.Fix_Decl -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.Fix_Decl+fix_DeclWithIdent original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "annot")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the term field of hydra.coq.syntax.Fix_Decl+fix_DeclWithTerm :: Typed.TypedTerm Syntax.Fix_Decl -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Fix_Decl+fix_DeclWithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "ident")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "annot")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the type field of hydra.coq.syntax.Fix_Decl+fix_DeclWithType :: Typed.TypedTerm Syntax.Fix_Decl -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm Syntax.Fix_Decl+fix_DeclWithType original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "ident")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "annot")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Decl"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL injection for the in variant of hydra.coq.syntax.Fix_Qual+fix_QualIn :: Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Fix_Qual+fix_QualIn x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Qual"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "in"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the with variant of hydra.coq.syntax.Fix_Qual+fix_QualWith :: Typed.TypedTerm Syntax.FixWith -> Typed.TypedTerm Syntax.Fix_Qual+fix_QualWith x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Fix_Qual"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "with"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.coq.syntax.FixpointDefinition+fixpointDefinition :: Typed.TypedTerm (Maybe Syntax.Locality) -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm (Maybe Syntax.FixAnnot) -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm [Syntax.Fix_Decl] -> Typed.TypedTerm Syntax.FixpointDefinition+fixpointDefinition locality name binders annot type_ body with =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Typed.unTypedTerm locality)},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm name)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm binders)},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Typed.unTypedTerm annot)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm type_)},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Typed.unTypedTerm body)},+        Core.Field {+          Core.fieldName = (Core.Name "with"),+          Core.fieldTerm = (Typed.unTypedTerm with)}]}))+-- | DSL accessor for the annot field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionAnnot :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm (Maybe Syntax.FixAnnot)+fixpointDefinitionAnnot x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+        Core.projectionFieldName = (Core.Name "annot")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the binders field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionBinders :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm [Syntax.Binder]+fixpointDefinitionBinders x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+        Core.projectionFieldName = (Core.Name "binders")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionBody :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm Syntax.Term+fixpointDefinitionBody x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+        Core.projectionFieldName = (Core.Name "body")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the locality field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionLocality :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm (Maybe Syntax.Locality)+fixpointDefinitionLocality x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+        Core.projectionFieldName = (Core.Name "locality")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionName :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm Syntax.Ident+fixpointDefinitionName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+        Core.projectionFieldName = (Core.Name "name")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionType :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm (Maybe Syntax.Type)+fixpointDefinitionType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+        Core.projectionFieldName = (Core.Name "type")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the with field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionWith :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm [Syntax.Fix_Decl]+fixpointDefinitionWith x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+        Core.projectionFieldName = (Core.Name "with")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the annot field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionWithAnnot :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm (Maybe Syntax.FixAnnot) -> Typed.TypedTerm Syntax.FixpointDefinition+fixpointDefinitionWithAnnot original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "with"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "with")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the binders field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionWithBinders :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm Syntax.FixpointDefinition+fixpointDefinitionWithBinders original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "annot")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "with"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "with")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the body field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionWithBody :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.FixpointDefinition+fixpointDefinitionWithBody original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "annot")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "with"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "with")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the locality field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionWithLocality :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm (Maybe Syntax.Locality) -> Typed.TypedTerm Syntax.FixpointDefinition+fixpointDefinitionWithLocality original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "annot")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "with"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "with")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the name field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionWithName :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.FixpointDefinition+fixpointDefinitionWithName original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "annot")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "with"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "with")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionWithType :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm Syntax.FixpointDefinition+fixpointDefinitionWithType original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "annot")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "with"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "with")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the with field of hydra.coq.syntax.FixpointDefinition+fixpointDefinitionWithWith :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm [Syntax.Fix_Decl] -> Typed.TypedTerm Syntax.FixpointDefinition+fixpointDefinitionWithWith original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "annot"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "annot")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.FixpointDefinition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "with"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.Forall+forall_ :: Typed.TypedTerm Syntax.OpenBinders -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.Forall+forall_ binders type_ =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Forall"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm binders)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm type_)}]}))+-- | DSL accessor for the binders field of hydra.coq.syntax.Forall+forallBinders :: Typed.TypedTerm Syntax.Forall -> Typed.TypedTerm Syntax.OpenBinders+forallBinders x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Forall"),+        Core.projectionFieldName = (Core.Name "binders")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL injection for the forall variant of hydra.coq.syntax.ForallOrFun+forallOrFunForall :: Typed.TypedTerm Syntax.Forall -> Typed.TypedTerm Syntax.ForallOrFun+forallOrFunForall x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.ForallOrFun"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "forall"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the fun variant of hydra.coq.syntax.ForallOrFun+forallOrFunFun :: Typed.TypedTerm Syntax.Fun -> Typed.TypedTerm Syntax.ForallOrFun+forallOrFunFun x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.ForallOrFun"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "fun"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL accessor for the type field of hydra.coq.syntax.Forall+forallType :: Typed.TypedTerm Syntax.Forall -> Typed.TypedTerm Syntax.Type+forallType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Forall"),+        Core.projectionFieldName = (Core.Name "type")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the binders field of hydra.coq.syntax.Forall+forallWithBinders :: Typed.TypedTerm Syntax.Forall -> Typed.TypedTerm Syntax.OpenBinders -> Typed.TypedTerm Syntax.Forall+forallWithBinders original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Forall"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Forall"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.coq.syntax.Forall+forallWithType :: Typed.TypedTerm Syntax.Forall -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.Forall+forallWithType original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Forall"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Forall"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.Fun+fun :: Typed.TypedTerm Syntax.OpenBinders -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Fun+fun binders body =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Fun"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm binders)},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Typed.unTypedTerm body)}]}))+-- | DSL accessor for the binders field of hydra.coq.syntax.Fun+funBinders :: Typed.TypedTerm Syntax.Fun -> Typed.TypedTerm Syntax.OpenBinders+funBinders x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fun"),+        Core.projectionFieldName = (Core.Name "binders")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body field of hydra.coq.syntax.Fun+funBody :: Typed.TypedTerm Syntax.Fun -> Typed.TypedTerm Syntax.Term+funBody x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fun"),+        Core.projectionFieldName = (Core.Name "body")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the binders field of hydra.coq.syntax.Fun+funWithBinders :: Typed.TypedTerm Syntax.Fun -> Typed.TypedTerm Syntax.OpenBinders -> Typed.TypedTerm Syntax.Fun+funWithBinders original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Fun"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fun"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the body field of hydra.coq.syntax.Fun+funWithBody :: Typed.TypedTerm Syntax.Fun -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Fun+funWithBody original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Fun"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Fun"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL injection for the explicit variant of hydra.coq.syntax.GeneralizingBinder+generalizingBinderExplicit :: Typed.TypedTerm Syntax.TypeclassConstraint -> Typed.TypedTerm Syntax.GeneralizingBinder+generalizingBinderExplicit x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.GeneralizingBinder"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "explicit"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the implicitMaximallyInserted variant of hydra.coq.syntax.GeneralizingBinder+generalizingBinderImplicitMaximallyInserted :: Typed.TypedTerm Syntax.TypeclassConstraint -> Typed.TypedTerm Syntax.GeneralizingBinder+generalizingBinderImplicitMaximallyInserted x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.GeneralizingBinder"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "implicitMaximallyInserted"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the implicitNonMaximallyInserted variant of hydra.coq.syntax.GeneralizingBinder+generalizingBinderImplicitNonMaximallyInserted :: Typed.TypedTerm Syntax.TypeclassConstraint -> Typed.TypedTerm Syntax.GeneralizingBinder+generalizingBinderImplicitNonMaximallyInserted x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.GeneralizingBinder"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "implicitNonMaximallyInserted"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for the hydra.coq.syntax.Ident wrapper+ident :: Typed.TypedTerm Syntax.String_ -> Typed.TypedTerm Syntax.Ident+ident x =+    Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+      Core.wrappedTermTypeName = (Core.Name "hydra.coq.syntax.Ident"),+      Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL constructor for hydra.coq.syntax.IdentArg+identArg :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.IdentArg+identArg ident term =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.IdentArg"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Typed.unTypedTerm ident)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)}]}))+-- | DSL accessor for the ident field of hydra.coq.syntax.IdentArg+identArgIdent :: Typed.TypedTerm Syntax.IdentArg -> Typed.TypedTerm Syntax.Ident+identArgIdent x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.IdentArg"),+        Core.projectionFieldName = (Core.Name "ident")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term field of hydra.coq.syntax.IdentArg+identArgTerm :: Typed.TypedTerm Syntax.IdentArg -> Typed.TypedTerm Syntax.Term+identArgTerm x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.IdentArg"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the ident field of hydra.coq.syntax.IdentArg+identArgWithIdent :: Typed.TypedTerm Syntax.IdentArg -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.IdentArg+identArgWithIdent original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.IdentArg"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.IdentArg"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the term field of hydra.coq.syntax.IdentArg+identArgWithTerm :: Typed.TypedTerm Syntax.IdentArg -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.IdentArg+identArgWithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.IdentArg"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "ident"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.IdentArg"),+              Core.projectionFieldName = (Core.Name "ident")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.If+if_ :: Typed.TypedTerm Syntax.Term -> Typed.TypedTerm (Maybe Syntax.ReturnAs) -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.If+if_ condition returnAs then_ else_ =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.If"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "condition"),+          Core.fieldTerm = (Typed.unTypedTerm condition)},+        Core.Field {+          Core.fieldName = (Core.Name "returnAs"),+          Core.fieldTerm = (Typed.unTypedTerm returnAs)},+        Core.Field {+          Core.fieldName = (Core.Name "then"),+          Core.fieldTerm = (Typed.unTypedTerm then_)},+        Core.Field {+          Core.fieldName = (Core.Name "else"),+          Core.fieldTerm = (Typed.unTypedTerm else_)}]}))+-- | DSL accessor for the condition field of hydra.coq.syntax.If+ifCondition :: Typed.TypedTerm Syntax.If -> Typed.TypedTerm Syntax.Term+ifCondition x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+        Core.projectionFieldName = (Core.Name "condition")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the else field of hydra.coq.syntax.If+ifElse :: Typed.TypedTerm Syntax.If -> Typed.TypedTerm Syntax.Term+ifElse x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+        Core.projectionFieldName = (Core.Name "else")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the returnAs field of hydra.coq.syntax.If+ifReturnAs :: Typed.TypedTerm Syntax.If -> Typed.TypedTerm (Maybe Syntax.ReturnAs)+ifReturnAs x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+        Core.projectionFieldName = (Core.Name "returnAs")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the then field of hydra.coq.syntax.If+ifThen :: Typed.TypedTerm Syntax.If -> Typed.TypedTerm Syntax.Term+ifThen x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+        Core.projectionFieldName = (Core.Name "then")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the condition field of hydra.coq.syntax.If+ifWithCondition :: Typed.TypedTerm Syntax.If -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.If+ifWithCondition original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.If"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "condition"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "returnAs"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+              Core.projectionFieldName = (Core.Name "returnAs")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "then"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+              Core.projectionFieldName = (Core.Name "then")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "else"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+              Core.projectionFieldName = (Core.Name "else")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the else field of hydra.coq.syntax.If+ifWithElse :: Typed.TypedTerm Syntax.If -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.If+ifWithElse original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.If"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "condition"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+              Core.projectionFieldName = (Core.Name "condition")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "returnAs"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+              Core.projectionFieldName = (Core.Name "returnAs")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "then"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+              Core.projectionFieldName = (Core.Name "then")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "else"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the returnAs field of hydra.coq.syntax.If+ifWithReturnAs :: Typed.TypedTerm Syntax.If -> Typed.TypedTerm (Maybe Syntax.ReturnAs) -> Typed.TypedTerm Syntax.If+ifWithReturnAs original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.If"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "condition"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+              Core.projectionFieldName = (Core.Name "condition")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "returnAs"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "then"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+              Core.projectionFieldName = (Core.Name "then")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "else"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+              Core.projectionFieldName = (Core.Name "else")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the then field of hydra.coq.syntax.If+ifWithThen :: Typed.TypedTerm Syntax.If -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.If+ifWithThen original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.If"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "condition"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+              Core.projectionFieldName = (Core.Name "condition")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "returnAs"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+              Core.projectionFieldName = (Core.Name "returnAs")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "then"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "else"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.If"),+              Core.projectionFieldName = (Core.Name "else")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL injection for the maximallyInserted variant of hydra.coq.syntax.ImplicitBinders+implicitBindersMaximallyInserted :: Typed.TypedTerm Syntax.TypeBinders -> Typed.TypedTerm Syntax.ImplicitBinders+implicitBindersMaximallyInserted x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.ImplicitBinders"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "maximallyInserted"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the nonMaximallyInserted variant of hydra.coq.syntax.ImplicitBinders+implicitBindersNonMaximallyInserted :: Typed.TypedTerm Syntax.TypeBinders -> Typed.TypedTerm Syntax.ImplicitBinders+implicitBindersNonMaximallyInserted x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.ImplicitBinders"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "nonMaximallyInserted"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the export variant of hydra.coq.syntax.ImportQualification+importQualificationExport :: Typed.TypedTerm Syntax.ImportQualification+importQualificationExport =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.ImportQualification"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "export"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the import variant of hydra.coq.syntax.ImportQualification+importQualificationImport :: Typed.TypedTerm Syntax.ImportQualification+importQualificationImport =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.ImportQualification"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "import"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL constructor for hydra.coq.syntax.InductiveBody+inductiveBody :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm [Syntax.Constructor] -> Typed.TypedTerm Syntax.InductiveBody+inductiveBody name binders type_ constructors =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm name)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm binders)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm type_)},+        Core.Field {+          Core.fieldName = (Core.Name "constructors"),+          Core.fieldTerm = (Typed.unTypedTerm constructors)}]}))+-- | DSL accessor for the binders field of hydra.coq.syntax.InductiveBody+inductiveBodyBinders :: Typed.TypedTerm Syntax.InductiveBody -> Typed.TypedTerm [Syntax.Binder]+inductiveBodyBinders x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+        Core.projectionFieldName = (Core.Name "binders")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the constructors field of hydra.coq.syntax.InductiveBody+inductiveBodyConstructors :: Typed.TypedTerm Syntax.InductiveBody -> Typed.TypedTerm [Syntax.Constructor]+inductiveBodyConstructors x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+        Core.projectionFieldName = (Core.Name "constructors")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.coq.syntax.InductiveBody+inductiveBodyName :: Typed.TypedTerm Syntax.InductiveBody -> Typed.TypedTerm Syntax.Ident+inductiveBodyName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+        Core.projectionFieldName = (Core.Name "name")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.coq.syntax.InductiveBody+inductiveBodyType :: Typed.TypedTerm Syntax.InductiveBody -> Typed.TypedTerm (Maybe Syntax.Type)+inductiveBodyType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+        Core.projectionFieldName = (Core.Name "type")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the binders field of hydra.coq.syntax.InductiveBody+inductiveBodyWithBinders :: Typed.TypedTerm Syntax.InductiveBody -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm Syntax.InductiveBody+inductiveBodyWithBinders original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "constructors"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+              Core.projectionFieldName = (Core.Name "constructors")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the constructors field of hydra.coq.syntax.InductiveBody+inductiveBodyWithConstructors :: Typed.TypedTerm Syntax.InductiveBody -> Typed.TypedTerm [Syntax.Constructor] -> Typed.TypedTerm Syntax.InductiveBody+inductiveBodyWithConstructors original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "constructors"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the name field of hydra.coq.syntax.InductiveBody+inductiveBodyWithName :: Typed.TypedTerm Syntax.InductiveBody -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.InductiveBody+inductiveBodyWithName original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "constructors"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+              Core.projectionFieldName = (Core.Name "constructors")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.coq.syntax.InductiveBody+inductiveBodyWithType :: Typed.TypedTerm Syntax.InductiveBody -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm Syntax.InductiveBody+inductiveBodyWithType original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "constructors"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveBody"),+              Core.projectionFieldName = (Core.Name "constructors")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.coq.syntax.InductiveDefinition+inductiveDefinition :: Typed.TypedTerm (Maybe Syntax.Locality) -> Typed.TypedTerm Bool -> Typed.TypedTerm [Syntax.InductiveBody] -> Typed.TypedTerm Syntax.InductiveDefinition+inductiveDefinition locality coinductive bodies =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.InductiveDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Typed.unTypedTerm locality)},+        Core.Field {+          Core.fieldName = (Core.Name "coinductive"),+          Core.fieldTerm = (Typed.unTypedTerm coinductive)},+        Core.Field {+          Core.fieldName = (Core.Name "bodies"),+          Core.fieldTerm = (Typed.unTypedTerm bodies)}]}))+-- | DSL accessor for the bodies field of hydra.coq.syntax.InductiveDefinition+inductiveDefinitionBodies :: Typed.TypedTerm Syntax.InductiveDefinition -> Typed.TypedTerm [Syntax.InductiveBody]+inductiveDefinitionBodies x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveDefinition"),+        Core.projectionFieldName = (Core.Name "bodies")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the coinductive field of hydra.coq.syntax.InductiveDefinition+inductiveDefinitionCoinductive :: Typed.TypedTerm Syntax.InductiveDefinition -> Typed.TypedTerm Bool+inductiveDefinitionCoinductive x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveDefinition"),+        Core.projectionFieldName = (Core.Name "coinductive")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the locality field of hydra.coq.syntax.InductiveDefinition+inductiveDefinitionLocality :: Typed.TypedTerm Syntax.InductiveDefinition -> Typed.TypedTerm (Maybe Syntax.Locality)+inductiveDefinitionLocality x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveDefinition"),+        Core.projectionFieldName = (Core.Name "locality")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the bodies field of hydra.coq.syntax.InductiveDefinition+inductiveDefinitionWithBodies :: Typed.TypedTerm Syntax.InductiveDefinition -> Typed.TypedTerm [Syntax.InductiveBody] -> Typed.TypedTerm Syntax.InductiveDefinition+inductiveDefinitionWithBodies original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.InductiveDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveDefinition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "coinductive"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveDefinition"),+              Core.projectionFieldName = (Core.Name "coinductive")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "bodies"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the coinductive field of hydra.coq.syntax.InductiveDefinition+inductiveDefinitionWithCoinductive :: Typed.TypedTerm Syntax.InductiveDefinition -> Typed.TypedTerm Bool -> Typed.TypedTerm Syntax.InductiveDefinition+inductiveDefinitionWithCoinductive original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.InductiveDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveDefinition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "coinductive"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "bodies"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveDefinition"),+              Core.projectionFieldName = (Core.Name "bodies")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the locality field of hydra.coq.syntax.InductiveDefinition+inductiveDefinitionWithLocality :: Typed.TypedTerm Syntax.InductiveDefinition -> Typed.TypedTerm (Maybe Syntax.Locality) -> Typed.TypedTerm Syntax.InductiveDefinition+inductiveDefinitionWithLocality original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.InductiveDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "coinductive"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveDefinition"),+              Core.projectionFieldName = (Core.Name "coinductive")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "bodies"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.InductiveDefinition"),+              Core.projectionFieldName = (Core.Name "bodies")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.coq.syntax.Let+let_ :: Typed.TypedTerm Syntax.LetBindings -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Let+let_ bindings in_ =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Let"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "bindings"),+          Core.fieldTerm = (Typed.unTypedTerm bindings)},+        Core.Field {+          Core.fieldName = (Core.Name "in"),+          Core.fieldTerm = (Typed.unTypedTerm in_)}]}))+-- | DSL constructor for hydra.coq.syntax.LetBinder+letBinder :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.LetBinder+letBinder name type_ term =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetBinder"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm name)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm type_)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)}]}))+-- | DSL accessor for the name field of hydra.coq.syntax.LetBinder+letBinderName :: Typed.TypedTerm Syntax.LetBinder -> Typed.TypedTerm Syntax.Name+letBinderName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetBinder"),+        Core.projectionFieldName = (Core.Name "name")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term field of hydra.coq.syntax.LetBinder+letBinderTerm :: Typed.TypedTerm Syntax.LetBinder -> Typed.TypedTerm Syntax.Term+letBinderTerm x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetBinder"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.coq.syntax.LetBinder+letBinderType :: Typed.TypedTerm Syntax.LetBinder -> Typed.TypedTerm (Maybe Syntax.Type)+letBinderType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetBinder"),+        Core.projectionFieldName = (Core.Name "type")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the name field of hydra.coq.syntax.LetBinder+letBinderWithName :: Typed.TypedTerm Syntax.LetBinder -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.LetBinder+letBinderWithName original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetBinder"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetBinder"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetBinder"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the term field of hydra.coq.syntax.LetBinder+letBinderWithTerm :: Typed.TypedTerm Syntax.LetBinder -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.LetBinder+letBinderWithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetBinder"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetBinder"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetBinder"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the type field of hydra.coq.syntax.LetBinder+letBinderWithType :: Typed.TypedTerm Syntax.LetBinder -> Typed.TypedTerm (Maybe Syntax.Type) -> Typed.TypedTerm Syntax.LetBinder+letBinderWithType original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetBinder"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetBinder"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetBinder"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL accessor for the bindings field of hydra.coq.syntax.Let+letBindings :: Typed.TypedTerm Syntax.Let -> Typed.TypedTerm Syntax.LetBindings+letBindings x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Let"),+        Core.projectionFieldName = (Core.Name "bindings")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL injection for the destructuring variant of hydra.coq.syntax.LetBindings+letBindingsDestructuring :: Typed.TypedTerm Syntax.LetDestructuring -> Typed.TypedTerm Syntax.LetBindings+letBindingsDestructuring x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.LetBindings"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "destructuring"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the named variant of hydra.coq.syntax.LetBindings+letBindingsNamed :: Typed.TypedTerm Syntax.LetNamed -> Typed.TypedTerm Syntax.LetBindings+letBindingsNamed x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.LetBindings"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "named"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the variant1 variant of hydra.coq.syntax.LetDestructuring+letDestructuringVariant1 :: Typed.TypedTerm Syntax.LetDestructuring_Variant1 -> Typed.TypedTerm Syntax.LetDestructuring+letDestructuringVariant1 x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "variant1"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the variant2 variant of hydra.coq.syntax.LetDestructuring+letDestructuringVariant2 :: Typed.TypedTerm Syntax.LetDestructuring_Variant2 -> Typed.TypedTerm Syntax.LetDestructuring+letDestructuringVariant2 x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "variant2"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the variant3 variant of hydra.coq.syntax.LetDestructuring+letDestructuringVariant3 :: Typed.TypedTerm Syntax.LetDestructuring_Variant3 -> Typed.TypedTerm Syntax.LetDestructuring+letDestructuringVariant3 x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "variant3"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.coq.syntax.LetDestructuring_Variant1+letDestructuring_Variant1 :: Typed.TypedTerm [Syntax.Name] -> Typed.TypedTerm (Maybe Syntax.ReturnAs) -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.LetDestructuring_Variant1+letDestructuring_Variant1 names returnAs term =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "names"),+          Core.fieldTerm = (Typed.unTypedTerm names)},+        Core.Field {+          Core.fieldName = (Core.Name "returnAs"),+          Core.fieldTerm = (Typed.unTypedTerm returnAs)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)}]}))+-- | DSL accessor for the names field of hydra.coq.syntax.LetDestructuring_Variant1+letDestructuring_Variant1Names :: Typed.TypedTerm Syntax.LetDestructuring_Variant1 -> Typed.TypedTerm [Syntax.Name]+letDestructuring_Variant1Names x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"),+        Core.projectionFieldName = (Core.Name "names")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the returnAs field of hydra.coq.syntax.LetDestructuring_Variant1+letDestructuring_Variant1ReturnAs :: Typed.TypedTerm Syntax.LetDestructuring_Variant1 -> Typed.TypedTerm (Maybe Syntax.ReturnAs)+letDestructuring_Variant1ReturnAs x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"),+        Core.projectionFieldName = (Core.Name "returnAs")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term field of hydra.coq.syntax.LetDestructuring_Variant1+letDestructuring_Variant1Term :: Typed.TypedTerm Syntax.LetDestructuring_Variant1 -> Typed.TypedTerm Syntax.Term+letDestructuring_Variant1Term x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the names field of hydra.coq.syntax.LetDestructuring_Variant1+letDestructuring_Variant1WithNames :: Typed.TypedTerm Syntax.LetDestructuring_Variant1 -> Typed.TypedTerm [Syntax.Name] -> Typed.TypedTerm Syntax.LetDestructuring_Variant1+letDestructuring_Variant1WithNames original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "names"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "returnAs"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"),+              Core.projectionFieldName = (Core.Name "returnAs")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the returnAs field of hydra.coq.syntax.LetDestructuring_Variant1+letDestructuring_Variant1WithReturnAs :: Typed.TypedTerm Syntax.LetDestructuring_Variant1 -> Typed.TypedTerm (Maybe Syntax.ReturnAs) -> Typed.TypedTerm Syntax.LetDestructuring_Variant1+letDestructuring_Variant1WithReturnAs original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "names"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"),+              Core.projectionFieldName = (Core.Name "names")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "returnAs"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the term field of hydra.coq.syntax.LetDestructuring_Variant1+letDestructuring_Variant1WithTerm :: Typed.TypedTerm Syntax.LetDestructuring_Variant1 -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.LetDestructuring_Variant1+letDestructuring_Variant1WithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "names"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"),+              Core.projectionFieldName = (Core.Name "names")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "returnAs"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant1"),+              Core.projectionFieldName = (Core.Name "returnAs")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.LetDestructuring_Variant2+letDestructuring_Variant2 :: Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm (Maybe Syntax.Term100) -> Typed.TypedTerm Syntax.LetDestructuring_Variant2+letDestructuring_Variant2 pattern term return =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Typed.unTypedTerm pattern)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Typed.unTypedTerm return)}]}))+-- | DSL accessor for the pattern field of hydra.coq.syntax.LetDestructuring_Variant2+letDestructuring_Variant2Pattern :: Typed.TypedTerm Syntax.LetDestructuring_Variant2 -> Typed.TypedTerm Syntax.Pattern+letDestructuring_Variant2Pattern x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"),+        Core.projectionFieldName = (Core.Name "pattern")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the return field of hydra.coq.syntax.LetDestructuring_Variant2+letDestructuring_Variant2Return :: Typed.TypedTerm Syntax.LetDestructuring_Variant2 -> Typed.TypedTerm (Maybe Syntax.Term100)+letDestructuring_Variant2Return x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"),+        Core.projectionFieldName = (Core.Name "return")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term field of hydra.coq.syntax.LetDestructuring_Variant2+letDestructuring_Variant2Term :: Typed.TypedTerm Syntax.LetDestructuring_Variant2 -> Typed.TypedTerm Syntax.Term+letDestructuring_Variant2Term x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the pattern field of hydra.coq.syntax.LetDestructuring_Variant2+letDestructuring_Variant2WithPattern :: Typed.TypedTerm Syntax.LetDestructuring_Variant2 -> Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.LetDestructuring_Variant2+letDestructuring_Variant2WithPattern original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"),+              Core.projectionFieldName = (Core.Name "return")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the return field of hydra.coq.syntax.LetDestructuring_Variant2+letDestructuring_Variant2WithReturn :: Typed.TypedTerm Syntax.LetDestructuring_Variant2 -> Typed.TypedTerm (Maybe Syntax.Term100) -> Typed.TypedTerm Syntax.LetDestructuring_Variant2+letDestructuring_Variant2WithReturn original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"),+              Core.projectionFieldName = (Core.Name "pattern")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the term field of hydra.coq.syntax.LetDestructuring_Variant2+letDestructuring_Variant2WithTerm :: Typed.TypedTerm Syntax.LetDestructuring_Variant2 -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.LetDestructuring_Variant2+letDestructuring_Variant2WithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"),+              Core.projectionFieldName = (Core.Name "pattern")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant2"),+              Core.projectionFieldName = (Core.Name "return")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.coq.syntax.LetDestructuring_Variant3+letDestructuring_Variant3 :: Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Term100 -> Typed.TypedTerm Syntax.LetDestructuring_Variant3+letDestructuring_Variant3 pattern1 pattern2 term return =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern1"),+          Core.fieldTerm = (Typed.unTypedTerm pattern1)},+        Core.Field {+          Core.fieldName = (Core.Name "pattern2"),+          Core.fieldTerm = (Typed.unTypedTerm pattern2)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Typed.unTypedTerm return)}]}))+-- | DSL accessor for the pattern1 field of hydra.coq.syntax.LetDestructuring_Variant3+letDestructuring_Variant3Pattern1 :: Typed.TypedTerm Syntax.LetDestructuring_Variant3 -> Typed.TypedTerm Syntax.Pattern+letDestructuring_Variant3Pattern1 x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+        Core.projectionFieldName = (Core.Name "pattern1")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the pattern2 field of hydra.coq.syntax.LetDestructuring_Variant3+letDestructuring_Variant3Pattern2 :: Typed.TypedTerm Syntax.LetDestructuring_Variant3 -> Typed.TypedTerm Syntax.Pattern+letDestructuring_Variant3Pattern2 x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+        Core.projectionFieldName = (Core.Name "pattern2")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the return field of hydra.coq.syntax.LetDestructuring_Variant3+letDestructuring_Variant3Return :: Typed.TypedTerm Syntax.LetDestructuring_Variant3 -> Typed.TypedTerm Syntax.Term100+letDestructuring_Variant3Return x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+        Core.projectionFieldName = (Core.Name "return")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term field of hydra.coq.syntax.LetDestructuring_Variant3+letDestructuring_Variant3Term :: Typed.TypedTerm Syntax.LetDestructuring_Variant3 -> Typed.TypedTerm Syntax.Term+letDestructuring_Variant3Term x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the pattern1 field of hydra.coq.syntax.LetDestructuring_Variant3+letDestructuring_Variant3WithPattern1 :: Typed.TypedTerm Syntax.LetDestructuring_Variant3 -> Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.LetDestructuring_Variant3+letDestructuring_Variant3WithPattern1 original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern1"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "pattern2"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+              Core.projectionFieldName = (Core.Name "pattern2")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+              Core.projectionFieldName = (Core.Name "return")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the pattern2 field of hydra.coq.syntax.LetDestructuring_Variant3+letDestructuring_Variant3WithPattern2 :: Typed.TypedTerm Syntax.LetDestructuring_Variant3 -> Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.LetDestructuring_Variant3+letDestructuring_Variant3WithPattern2 original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern1"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+              Core.projectionFieldName = (Core.Name "pattern1")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "pattern2"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+              Core.projectionFieldName = (Core.Name "return")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the return field of hydra.coq.syntax.LetDestructuring_Variant3+letDestructuring_Variant3WithReturn :: Typed.TypedTerm Syntax.LetDestructuring_Variant3 -> Typed.TypedTerm Syntax.Term100 -> Typed.TypedTerm Syntax.LetDestructuring_Variant3+letDestructuring_Variant3WithReturn original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern1"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+              Core.projectionFieldName = (Core.Name "pattern1")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "pattern2"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+              Core.projectionFieldName = (Core.Name "pattern2")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the term field of hydra.coq.syntax.LetDestructuring_Variant3+letDestructuring_Variant3WithTerm :: Typed.TypedTerm Syntax.LetDestructuring_Variant3 -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.LetDestructuring_Variant3+letDestructuring_Variant3WithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern1"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+              Core.projectionFieldName = (Core.Name "pattern1")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "pattern2"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+              Core.projectionFieldName = (Core.Name "pattern2")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetDestructuring_Variant3"),+              Core.projectionFieldName = (Core.Name "return")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL accessor for the in field of hydra.coq.syntax.Let+letIn :: Typed.TypedTerm Syntax.Let -> Typed.TypedTerm Syntax.Term+letIn x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Let"),+        Core.projectionFieldName = (Core.Name "in")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL constructor for hydra.coq.syntax.LetNamed+letNamed :: Typed.TypedTerm Syntax.LetBinder -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm Syntax.LetNamed+letNamed binder binders =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetNamed"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "binder"),+          Core.fieldTerm = (Typed.unTypedTerm binder)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm binders)}]}))+-- | DSL accessor for the binder field of hydra.coq.syntax.LetNamed+letNamedBinder :: Typed.TypedTerm Syntax.LetNamed -> Typed.TypedTerm Syntax.LetBinder+letNamedBinder x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetNamed"),+        Core.projectionFieldName = (Core.Name "binder")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the binders field of hydra.coq.syntax.LetNamed+letNamedBinders :: Typed.TypedTerm Syntax.LetNamed -> Typed.TypedTerm [Syntax.Binder]+letNamedBinders x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetNamed"),+        Core.projectionFieldName = (Core.Name "binders")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the binder field of hydra.coq.syntax.LetNamed+letNamedWithBinder :: Typed.TypedTerm Syntax.LetNamed -> Typed.TypedTerm Syntax.LetBinder -> Typed.TypedTerm Syntax.LetNamed+letNamedWithBinder original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetNamed"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "binder"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetNamed"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the binders field of hydra.coq.syntax.LetNamed+letNamedWithBinders :: Typed.TypedTerm Syntax.LetNamed -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm Syntax.LetNamed+letNamedWithBinders original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.LetNamed"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "binder"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.LetNamed"),+              Core.projectionFieldName = (Core.Name "binder")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the bindings field of hydra.coq.syntax.Let+letWithBindings :: Typed.TypedTerm Syntax.Let -> Typed.TypedTerm Syntax.LetBindings -> Typed.TypedTerm Syntax.Let+letWithBindings original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Let"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "bindings"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "in"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Let"),+              Core.projectionFieldName = (Core.Name "in")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the in field of hydra.coq.syntax.Let+letWithIn :: Typed.TypedTerm Syntax.Let -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Let+letWithIn original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Let"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "bindings"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Let"),+              Core.projectionFieldName = (Core.Name "bindings")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "in"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL injection for the global variant of hydra.coq.syntax.Locality+localityGlobal :: Typed.TypedTerm Syntax.Locality+localityGlobal =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Locality"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "global"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the local variant of hydra.coq.syntax.Locality+localityLocal :: Typed.TypedTerm Syntax.Locality+localityLocal =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Locality"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "local"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL constructor for hydra.coq.syntax.Match+match :: Typed.TypedTerm [Syntax.CaseItem] -> Typed.TypedTerm (Maybe Syntax.Term100) -> Typed.TypedTerm Bool -> Typed.TypedTerm [Syntax.Equation] -> Typed.TypedTerm Syntax.Match+match caseItems return pipe equations =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Match"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "caseItems"),+          Core.fieldTerm = (Typed.unTypedTerm caseItems)},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Typed.unTypedTerm return)},+        Core.Field {+          Core.fieldName = (Core.Name "pipe"),+          Core.fieldTerm = (Typed.unTypedTerm pipe)},+        Core.Field {+          Core.fieldName = (Core.Name "equations"),+          Core.fieldTerm = (Typed.unTypedTerm equations)}]}))+-- | DSL accessor for the caseItems field of hydra.coq.syntax.Match+matchCaseItems :: Typed.TypedTerm Syntax.Match -> Typed.TypedTerm [Syntax.CaseItem]+matchCaseItems x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+        Core.projectionFieldName = (Core.Name "caseItems")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the equations field of hydra.coq.syntax.Match+matchEquations :: Typed.TypedTerm Syntax.Match -> Typed.TypedTerm [Syntax.Equation]+matchEquations x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+        Core.projectionFieldName = (Core.Name "equations")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the pipe field of hydra.coq.syntax.Match+matchPipe :: Typed.TypedTerm Syntax.Match -> Typed.TypedTerm Bool+matchPipe x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+        Core.projectionFieldName = (Core.Name "pipe")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the return field of hydra.coq.syntax.Match+matchReturn :: Typed.TypedTerm Syntax.Match -> Typed.TypedTerm (Maybe Syntax.Term100)+matchReturn x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+        Core.projectionFieldName = (Core.Name "return")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the caseItems field of hydra.coq.syntax.Match+matchWithCaseItems :: Typed.TypedTerm Syntax.Match -> Typed.TypedTerm [Syntax.CaseItem] -> Typed.TypedTerm Syntax.Match+matchWithCaseItems original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Match"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "caseItems"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+              Core.projectionFieldName = (Core.Name "return")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "pipe"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+              Core.projectionFieldName = (Core.Name "pipe")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "equations"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+              Core.projectionFieldName = (Core.Name "equations")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the equations field of hydra.coq.syntax.Match+matchWithEquations :: Typed.TypedTerm Syntax.Match -> Typed.TypedTerm [Syntax.Equation] -> Typed.TypedTerm Syntax.Match+matchWithEquations original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Match"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "caseItems"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+              Core.projectionFieldName = (Core.Name "caseItems")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+              Core.projectionFieldName = (Core.Name "return")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "pipe"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+              Core.projectionFieldName = (Core.Name "pipe")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "equations"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the pipe field of hydra.coq.syntax.Match+matchWithPipe :: Typed.TypedTerm Syntax.Match -> Typed.TypedTerm Bool -> Typed.TypedTerm Syntax.Match+matchWithPipe original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Match"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "caseItems"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+              Core.projectionFieldName = (Core.Name "caseItems")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+              Core.projectionFieldName = (Core.Name "return")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "pipe"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "equations"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+              Core.projectionFieldName = (Core.Name "equations")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the return field of hydra.coq.syntax.Match+matchWithReturn :: Typed.TypedTerm Syntax.Match -> Typed.TypedTerm (Maybe Syntax.Term100) -> Typed.TypedTerm Syntax.Match+matchWithReturn original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Match"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "caseItems"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+              Core.projectionFieldName = (Core.Name "caseItems")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "pipe"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+              Core.projectionFieldName = (Core.Name "pipe")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "equations"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Match"),+              Core.projectionFieldName = (Core.Name "equations")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.coq.syntax.ModuleDefinition+moduleDefinition :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm [Syntax.Sentence] -> Typed.TypedTerm Syntax.ModuleDefinition+moduleDefinition name sentences =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.ModuleDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm name)},+        Core.Field {+          Core.fieldName = (Core.Name "sentences"),+          Core.fieldTerm = (Typed.unTypedTerm sentences)}]}))+-- | DSL accessor for the name field of hydra.coq.syntax.ModuleDefinition+moduleDefinitionName :: Typed.TypedTerm Syntax.ModuleDefinition -> Typed.TypedTerm Syntax.Ident+moduleDefinitionName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.ModuleDefinition"),+        Core.projectionFieldName = (Core.Name "name")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the sentences field of hydra.coq.syntax.ModuleDefinition+moduleDefinitionSentences :: Typed.TypedTerm Syntax.ModuleDefinition -> Typed.TypedTerm [Syntax.Sentence]+moduleDefinitionSentences x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.ModuleDefinition"),+        Core.projectionFieldName = (Core.Name "sentences")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the name field of hydra.coq.syntax.ModuleDefinition+moduleDefinitionWithName :: Typed.TypedTerm Syntax.ModuleDefinition -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.ModuleDefinition+moduleDefinitionWithName original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.ModuleDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "sentences"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.ModuleDefinition"),+              Core.projectionFieldName = (Core.Name "sentences")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the sentences field of hydra.coq.syntax.ModuleDefinition+moduleDefinitionWithSentences :: Typed.TypedTerm Syntax.ModuleDefinition -> Typed.TypedTerm [Syntax.Sentence] -> Typed.TypedTerm Syntax.ModuleDefinition+moduleDefinitionWithSentences original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.ModuleDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.ModuleDefinition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "sentences"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for the hydra.coq.syntax.Name wrapper+name :: Typed.TypedTerm (Maybe Syntax.Ident) -> Typed.TypedTerm Syntax.Name+name x =+    Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+      Core.wrappedTermTypeName = (Core.Name "hydra.coq.syntax.Name"),+      Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL constructor for the hydra.coq.syntax.Natural wrapper+natural :: Typed.TypedTerm Integer -> Typed.TypedTerm Syntax.Natural+natural x =+    Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+      Core.wrappedTermTypeName = (Core.Name "hydra.coq.syntax.Natural"),+      Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL constructor for hydra.coq.syntax.NaturalArg+naturalArg :: Typed.TypedTerm Syntax.Natural -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.NaturalArg+naturalArg natural term =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.NaturalArg"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "natural"),+          Core.fieldTerm = (Typed.unTypedTerm natural)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)}]}))+-- | DSL accessor for the natural field of hydra.coq.syntax.NaturalArg+naturalArgNatural :: Typed.TypedTerm Syntax.NaturalArg -> Typed.TypedTerm Syntax.Natural+naturalArgNatural x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NaturalArg"),+        Core.projectionFieldName = (Core.Name "natural")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term field of hydra.coq.syntax.NaturalArg+naturalArgTerm :: Typed.TypedTerm Syntax.NaturalArg -> Typed.TypedTerm Syntax.Term+naturalArgTerm x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NaturalArg"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the natural field of hydra.coq.syntax.NaturalArg+naturalArgWithNatural :: Typed.TypedTerm Syntax.NaturalArg -> Typed.TypedTerm Syntax.Natural -> Typed.TypedTerm Syntax.NaturalArg+naturalArgWithNatural original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.NaturalArg"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "natural"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NaturalArg"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the term field of hydra.coq.syntax.NaturalArg+naturalArgWithTerm :: Typed.TypedTerm Syntax.NaturalArg -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.NaturalArg+naturalArgWithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.NaturalArg"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "natural"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NaturalArg"),+              Core.projectionFieldName = (Core.Name "natural")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.NormalApplication+normalApplication :: Typed.TypedTerm Syntax.Term1 -> Typed.TypedTerm [Syntax.Arg] -> Typed.TypedTerm Syntax.NormalApplication+normalApplication lhs rhs =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.NormalApplication"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "lhs"),+          Core.fieldTerm = (Typed.unTypedTerm lhs)},+        Core.Field {+          Core.fieldName = (Core.Name "rhs"),+          Core.fieldTerm = (Typed.unTypedTerm rhs)}]}))+-- | DSL accessor for the lhs field of hydra.coq.syntax.NormalApplication+normalApplicationLhs :: Typed.TypedTerm Syntax.NormalApplication -> Typed.TypedTerm Syntax.Term1+normalApplicationLhs x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NormalApplication"),+        Core.projectionFieldName = (Core.Name "lhs")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the rhs field of hydra.coq.syntax.NormalApplication+normalApplicationRhs :: Typed.TypedTerm Syntax.NormalApplication -> Typed.TypedTerm [Syntax.Arg]+normalApplicationRhs x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NormalApplication"),+        Core.projectionFieldName = (Core.Name "rhs")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the lhs field of hydra.coq.syntax.NormalApplication+normalApplicationWithLhs :: Typed.TypedTerm Syntax.NormalApplication -> Typed.TypedTerm Syntax.Term1 -> Typed.TypedTerm Syntax.NormalApplication+normalApplicationWithLhs original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.NormalApplication"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "lhs"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "rhs"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NormalApplication"),+              Core.projectionFieldName = (Core.Name "rhs")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the rhs field of hydra.coq.syntax.NormalApplication+normalApplicationWithRhs :: Typed.TypedTerm Syntax.NormalApplication -> Typed.TypedTerm [Syntax.Arg] -> Typed.TypedTerm Syntax.NormalApplication+normalApplicationWithRhs original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.NormalApplication"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "lhs"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NormalApplication"),+              Core.projectionFieldName = (Core.Name "lhs")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "rhs"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.NotationDeclaration+notationDeclaration :: Typed.TypedTerm Syntax.String_ -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm (Maybe Syntax.Natural) -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.NotationDeclaration+notationDeclaration notation definition level associativity =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "notation"),+          Core.fieldTerm = (Typed.unTypedTerm notation)},+        Core.Field {+          Core.fieldName = (Core.Name "definition"),+          Core.fieldTerm = (Typed.unTypedTerm definition)},+        Core.Field {+          Core.fieldName = (Core.Name "level"),+          Core.fieldTerm = (Typed.unTypedTerm level)},+        Core.Field {+          Core.fieldName = (Core.Name "associativity"),+          Core.fieldTerm = (Typed.unTypedTerm associativity)}]}))+-- | DSL accessor for the associativity field of hydra.coq.syntax.NotationDeclaration+notationDeclarationAssociativity :: Typed.TypedTerm Syntax.NotationDeclaration -> Typed.TypedTerm (Maybe String)+notationDeclarationAssociativity x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+        Core.projectionFieldName = (Core.Name "associativity")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the definition field of hydra.coq.syntax.NotationDeclaration+notationDeclarationDefinition :: Typed.TypedTerm Syntax.NotationDeclaration -> Typed.TypedTerm Syntax.Term+notationDeclarationDefinition x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+        Core.projectionFieldName = (Core.Name "definition")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the level field of hydra.coq.syntax.NotationDeclaration+notationDeclarationLevel :: Typed.TypedTerm Syntax.NotationDeclaration -> Typed.TypedTerm (Maybe Syntax.Natural)+notationDeclarationLevel x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+        Core.projectionFieldName = (Core.Name "level")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the notation field of hydra.coq.syntax.NotationDeclaration+notationDeclarationNotation :: Typed.TypedTerm Syntax.NotationDeclaration -> Typed.TypedTerm Syntax.String_+notationDeclarationNotation x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+        Core.projectionFieldName = (Core.Name "notation")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the associativity field of hydra.coq.syntax.NotationDeclaration+notationDeclarationWithAssociativity :: Typed.TypedTerm Syntax.NotationDeclaration -> Typed.TypedTerm (Maybe String) -> Typed.TypedTerm Syntax.NotationDeclaration+notationDeclarationWithAssociativity original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "notation"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+              Core.projectionFieldName = (Core.Name "notation")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "definition"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+              Core.projectionFieldName = (Core.Name "definition")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "level"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+              Core.projectionFieldName = (Core.Name "level")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "associativity"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the definition field of hydra.coq.syntax.NotationDeclaration+notationDeclarationWithDefinition :: Typed.TypedTerm Syntax.NotationDeclaration -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.NotationDeclaration+notationDeclarationWithDefinition original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "notation"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+              Core.projectionFieldName = (Core.Name "notation")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "definition"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "level"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+              Core.projectionFieldName = (Core.Name "level")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "associativity"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+              Core.projectionFieldName = (Core.Name "associativity")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the level field of hydra.coq.syntax.NotationDeclaration+notationDeclarationWithLevel :: Typed.TypedTerm Syntax.NotationDeclaration -> Typed.TypedTerm (Maybe Syntax.Natural) -> Typed.TypedTerm Syntax.NotationDeclaration+notationDeclarationWithLevel original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "notation"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+              Core.projectionFieldName = (Core.Name "notation")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "definition"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+              Core.projectionFieldName = (Core.Name "definition")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "level"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "associativity"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+              Core.projectionFieldName = (Core.Name "associativity")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the notation field of hydra.coq.syntax.NotationDeclaration+notationDeclarationWithNotation :: Typed.TypedTerm Syntax.NotationDeclaration -> Typed.TypedTerm Syntax.String_ -> Typed.TypedTerm Syntax.NotationDeclaration+notationDeclarationWithNotation original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "notation"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "definition"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+              Core.projectionFieldName = (Core.Name "definition")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "level"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+              Core.projectionFieldName = (Core.Name "level")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "associativity"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.NotationDeclaration"),+              Core.projectionFieldName = (Core.Name "associativity")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for the hydra.coq.syntax.Number wrapper+number :: Typed.TypedTerm Double -> Typed.TypedTerm Syntax.Number+number x =+    Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+      Core.wrappedTermTypeName = (Core.Name "hydra.coq.syntax.Number"),+      Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL injection for the explicit variant of hydra.coq.syntax.OneTerm+oneTermExplicit :: Typed.TypedTerm Syntax.QualidAnnotated -> Typed.TypedTerm Syntax.OneTerm+oneTermExplicit x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.OneTerm"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "explicit"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the term1 variant of hydra.coq.syntax.OneTerm+oneTermTerm1 :: Typed.TypedTerm Syntax.Term1 -> Typed.TypedTerm Syntax.OneTerm+oneTermTerm1 x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.OneTerm"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "term1"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the binders variant of hydra.coq.syntax.OpenBinders+openBindersBinders :: Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm Syntax.OpenBinders+openBindersBinders x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.OpenBinders"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "binders"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the type variant of hydra.coq.syntax.OpenBinders+openBindersType :: Typed.TypedTerm Syntax.TypeBinders -> Typed.TypedTerm Syntax.OpenBinders+openBindersType x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.OpenBinders"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "type"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the number variant of hydra.coq.syntax.Pattern0+pattern0Number :: Typed.TypedTerm Syntax.Number -> Typed.TypedTerm Syntax.Pattern0+pattern0Number x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Pattern0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "number"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the parens variant of hydra.coq.syntax.Pattern0+pattern0Parens :: Typed.TypedTerm [Syntax.Pattern] -> Typed.TypedTerm Syntax.Pattern0+pattern0Parens x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Pattern0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "parens"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the placeholder variant of hydra.coq.syntax.Pattern0+pattern0Placeholder :: Typed.TypedTerm Syntax.Pattern0+pattern0Placeholder =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Pattern0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "placeholder"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the qualIdAndPattern variant of hydra.coq.syntax.Pattern0+pattern0QualIdAndPattern :: Typed.TypedTerm Syntax.QualidAndPattern -> Typed.TypedTerm Syntax.Pattern0+pattern0QualIdAndPattern x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Pattern0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "qualIdAndPattern"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the qualid variant of hydra.coq.syntax.Pattern0+pattern0Qualid :: Typed.TypedTerm Syntax.Qualid -> Typed.TypedTerm Syntax.Pattern0+pattern0Qualid x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Pattern0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "qualid"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the string variant of hydra.coq.syntax.Pattern0+pattern0String :: Typed.TypedTerm Syntax.String_ -> Typed.TypedTerm Syntax.Pattern0+pattern0String x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Pattern0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "string"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.coq.syntax.Pattern1+pattern1 :: Typed.TypedTerm Syntax.Pattern0 -> Typed.TypedTerm (Maybe Syntax.ScopeKey) -> Typed.TypedTerm Syntax.Pattern1+pattern1 pattern scope =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Pattern1"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Typed.unTypedTerm pattern)},+        Core.Field {+          Core.fieldName = (Core.Name "scope"),+          Core.fieldTerm = (Typed.unTypedTerm scope)}]}))+-- | DSL injection for the as variant of hydra.coq.syntax.Pattern10+pattern10As :: Typed.TypedTerm Syntax.Pattern10_As -> Typed.TypedTerm Syntax.Pattern10+pattern10As x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "as"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the patterns variant of hydra.coq.syntax.Pattern10+pattern10Patterns :: Typed.TypedTerm Syntax.Pattern10_Patterns -> Typed.TypedTerm Syntax.Pattern10+pattern10Patterns x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "patterns"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the qualiid variant of hydra.coq.syntax.Pattern10+pattern10Qualiid :: Typed.TypedTerm Syntax.Pattern10_Qualid -> Typed.TypedTerm Syntax.Pattern10+pattern10Qualiid x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "qualiid"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.coq.syntax.Pattern10_As+pattern10_As :: Typed.TypedTerm Syntax.Pattern1 -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.Pattern10_As+pattern10_As pattern as =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Pattern10_As"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Typed.unTypedTerm pattern)},+        Core.Field {+          Core.fieldName = (Core.Name "as"),+          Core.fieldTerm = (Typed.unTypedTerm as)}]}))+-- | DSL accessor for the as field of hydra.coq.syntax.Pattern10_As+pattern10_AsAs :: Typed.TypedTerm Syntax.Pattern10_As -> Typed.TypedTerm Syntax.Name+pattern10_AsAs x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10_As"),+        Core.projectionFieldName = (Core.Name "as")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the pattern field of hydra.coq.syntax.Pattern10_As+pattern10_AsPattern :: Typed.TypedTerm Syntax.Pattern10_As -> Typed.TypedTerm Syntax.Pattern1+pattern10_AsPattern x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10_As"),+        Core.projectionFieldName = (Core.Name "pattern")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the as field of hydra.coq.syntax.Pattern10_As+pattern10_AsWithAs :: Typed.TypedTerm Syntax.Pattern10_As -> Typed.TypedTerm Syntax.Name -> Typed.TypedTerm Syntax.Pattern10_As+pattern10_AsWithAs original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Pattern10_As"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10_As"),+              Core.projectionFieldName = (Core.Name "pattern")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "as"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the pattern field of hydra.coq.syntax.Pattern10_As+pattern10_AsWithPattern :: Typed.TypedTerm Syntax.Pattern10_As -> Typed.TypedTerm Syntax.Pattern1 -> Typed.TypedTerm Syntax.Pattern10_As+pattern10_AsWithPattern original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Pattern10_As"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "as"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10_As"),+              Core.projectionFieldName = (Core.Name "as")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.coq.syntax.Pattern10_Patterns+pattern10_Patterns :: Typed.TypedTerm Syntax.Pattern1 -> Typed.TypedTerm [Syntax.Pattern1] -> Typed.TypedTerm Syntax.Pattern10_Patterns+pattern10_Patterns pattern patterns =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Patterns"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Typed.unTypedTerm pattern)},+        Core.Field {+          Core.fieldName = (Core.Name "patterns"),+          Core.fieldTerm = (Typed.unTypedTerm patterns)}]}))+-- | DSL accessor for the pattern field of hydra.coq.syntax.Pattern10_Patterns+pattern10_PatternsPattern :: Typed.TypedTerm Syntax.Pattern10_Patterns -> Typed.TypedTerm Syntax.Pattern1+pattern10_PatternsPattern x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Patterns"),+        Core.projectionFieldName = (Core.Name "pattern")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the patterns field of hydra.coq.syntax.Pattern10_Patterns+pattern10_PatternsPatterns :: Typed.TypedTerm Syntax.Pattern10_Patterns -> Typed.TypedTerm [Syntax.Pattern1]+pattern10_PatternsPatterns x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Patterns"),+        Core.projectionFieldName = (Core.Name "patterns")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the pattern field of hydra.coq.syntax.Pattern10_Patterns+pattern10_PatternsWithPattern :: Typed.TypedTerm Syntax.Pattern10_Patterns -> Typed.TypedTerm Syntax.Pattern1 -> Typed.TypedTerm Syntax.Pattern10_Patterns+pattern10_PatternsWithPattern original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Patterns"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "patterns"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Patterns"),+              Core.projectionFieldName = (Core.Name "patterns")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the patterns field of hydra.coq.syntax.Pattern10_Patterns+pattern10_PatternsWithPatterns :: Typed.TypedTerm Syntax.Pattern10_Patterns -> Typed.TypedTerm [Syntax.Pattern1] -> Typed.TypedTerm Syntax.Pattern10_Patterns+pattern10_PatternsWithPatterns original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Patterns"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Patterns"),+              Core.projectionFieldName = (Core.Name "pattern")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "patterns"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.Pattern10_Qualid+pattern10_Qualid :: Typed.TypedTerm Syntax.Qualid -> Typed.TypedTerm [Syntax.Pattern1] -> Typed.TypedTerm Syntax.Pattern10_Qualid+pattern10_Qualid qualid patterns =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Qualid"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "qualid"),+          Core.fieldTerm = (Typed.unTypedTerm qualid)},+        Core.Field {+          Core.fieldName = (Core.Name "patterns"),+          Core.fieldTerm = (Typed.unTypedTerm patterns)}]}))+-- | DSL accessor for the patterns field of hydra.coq.syntax.Pattern10_Qualid+pattern10_QualidPatterns :: Typed.TypedTerm Syntax.Pattern10_Qualid -> Typed.TypedTerm [Syntax.Pattern1]+pattern10_QualidPatterns x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Qualid"),+        Core.projectionFieldName = (Core.Name "patterns")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the qualid field of hydra.coq.syntax.Pattern10_Qualid+pattern10_QualidQualid :: Typed.TypedTerm Syntax.Pattern10_Qualid -> Typed.TypedTerm Syntax.Qualid+pattern10_QualidQualid x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Qualid"),+        Core.projectionFieldName = (Core.Name "qualid")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the patterns field of hydra.coq.syntax.Pattern10_Qualid+pattern10_QualidWithPatterns :: Typed.TypedTerm Syntax.Pattern10_Qualid -> Typed.TypedTerm [Syntax.Pattern1] -> Typed.TypedTerm Syntax.Pattern10_Qualid+pattern10_QualidWithPatterns original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Qualid"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "qualid"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Qualid"),+              Core.projectionFieldName = (Core.Name "qualid")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "patterns"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the qualid field of hydra.coq.syntax.Pattern10_Qualid+pattern10_QualidWithQualid :: Typed.TypedTerm Syntax.Pattern10_Qualid -> Typed.TypedTerm Syntax.Qualid -> Typed.TypedTerm Syntax.Pattern10_Qualid+pattern10_QualidWithQualid original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Qualid"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "qualid"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "patterns"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern10_Qualid"),+              Core.projectionFieldName = (Core.Name "patterns")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL accessor for the pattern field of hydra.coq.syntax.Pattern1+pattern1Pattern :: Typed.TypedTerm Syntax.Pattern1 -> Typed.TypedTerm Syntax.Pattern0+pattern1Pattern x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern1"),+        Core.projectionFieldName = (Core.Name "pattern")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the scope field of hydra.coq.syntax.Pattern1+pattern1Scope :: Typed.TypedTerm Syntax.Pattern1 -> Typed.TypedTerm (Maybe Syntax.ScopeKey)+pattern1Scope x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern1"),+        Core.projectionFieldName = (Core.Name "scope")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the pattern field of hydra.coq.syntax.Pattern1+pattern1WithPattern :: Typed.TypedTerm Syntax.Pattern1 -> Typed.TypedTerm Syntax.Pattern0 -> Typed.TypedTerm Syntax.Pattern1+pattern1WithPattern original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Pattern1"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "scope"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern1"),+              Core.projectionFieldName = (Core.Name "scope")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the scope field of hydra.coq.syntax.Pattern1+pattern1WithScope :: Typed.TypedTerm Syntax.Pattern1 -> Typed.TypedTerm (Maybe Syntax.ScopeKey) -> Typed.TypedTerm Syntax.Pattern1+pattern1WithScope original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Pattern1"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Pattern1"),+              Core.projectionFieldName = (Core.Name "pattern")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "scope"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL injection for the pattern variant of hydra.coq.syntax.Pattern+patternPattern :: Typed.TypedTerm Syntax.Pattern10 -> Typed.TypedTerm Syntax.Pattern+patternPattern x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Pattern"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "pattern"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the term variant of hydra.coq.syntax.Pattern+patternTerm :: Typed.TypedTerm (Maybe Syntax.Term) -> Typed.TypedTerm Syntax.Pattern+patternTerm x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Pattern"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "term"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the number variant of hydra.coq.syntax.PrimitiveNotations+primitiveNotationsNumber :: Typed.TypedTerm Syntax.Number -> Typed.TypedTerm Syntax.PrimitiveNotations+primitiveNotationsNumber x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.PrimitiveNotations"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "number"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the string variant of hydra.coq.syntax.PrimitiveNotations+primitiveNotationsString :: Typed.TypedTerm Syntax.String_ -> Typed.TypedTerm Syntax.PrimitiveNotations+primitiveNotationsString x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.PrimitiveNotations"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "string"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.coq.syntax.Qualid+qualid :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm [Syntax.FieldIdent] -> Typed.TypedTerm Syntax.Qualid+qualid id fieldIds =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Qualid"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "id"),+          Core.fieldTerm = (Typed.unTypedTerm id)},+        Core.Field {+          Core.fieldName = (Core.Name "fieldIds"),+          Core.fieldTerm = (Typed.unTypedTerm fieldIds)}]}))+-- | DSL constructor for hydra.coq.syntax.QualidAndPattern+qualidAndPattern :: Typed.TypedTerm Syntax.Qualid -> Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.QualidAndPattern+qualidAndPattern qualid pattern =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.QualidAndPattern"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "qualid"),+          Core.fieldTerm = (Typed.unTypedTerm qualid)},+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Typed.unTypedTerm pattern)}]}))+-- | DSL accessor for the pattern field of hydra.coq.syntax.QualidAndPattern+qualidAndPatternPattern :: Typed.TypedTerm Syntax.QualidAndPattern -> Typed.TypedTerm Syntax.Pattern+qualidAndPatternPattern x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.QualidAndPattern"),+        Core.projectionFieldName = (Core.Name "pattern")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the qualid field of hydra.coq.syntax.QualidAndPattern+qualidAndPatternQualid :: Typed.TypedTerm Syntax.QualidAndPattern -> Typed.TypedTerm Syntax.Qualid+qualidAndPatternQualid x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.QualidAndPattern"),+        Core.projectionFieldName = (Core.Name "qualid")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the pattern field of hydra.coq.syntax.QualidAndPattern+qualidAndPatternWithPattern :: Typed.TypedTerm Syntax.QualidAndPattern -> Typed.TypedTerm Syntax.Pattern -> Typed.TypedTerm Syntax.QualidAndPattern+qualidAndPatternWithPattern original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.QualidAndPattern"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "qualid"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.QualidAndPattern"),+              Core.projectionFieldName = (Core.Name "qualid")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the qualid field of hydra.coq.syntax.QualidAndPattern+qualidAndPatternWithQualid :: Typed.TypedTerm Syntax.QualidAndPattern -> Typed.TypedTerm Syntax.Qualid -> Typed.TypedTerm Syntax.QualidAndPattern+qualidAndPatternWithQualid original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.QualidAndPattern"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "qualid"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "pattern"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.QualidAndPattern"),+              Core.projectionFieldName = (Core.Name "pattern")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.coq.syntax.QualidAnnotated+qualidAnnotated :: Typed.TypedTerm Syntax.Qualid -> Typed.TypedTerm (Maybe Syntax.UnivAnnot) -> Typed.TypedTerm Syntax.QualidAnnotated+qualidAnnotated qualid univAnnot =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.QualidAnnotated"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "qualid"),+          Core.fieldTerm = (Typed.unTypedTerm qualid)},+        Core.Field {+          Core.fieldName = (Core.Name "univAnnot"),+          Core.fieldTerm = (Typed.unTypedTerm univAnnot)}]}))+-- | DSL accessor for the qualid field of hydra.coq.syntax.QualidAnnotated+qualidAnnotatedQualid :: Typed.TypedTerm Syntax.QualidAnnotated -> Typed.TypedTerm Syntax.Qualid+qualidAnnotatedQualid x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.QualidAnnotated"),+        Core.projectionFieldName = (Core.Name "qualid")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the univAnnot field of hydra.coq.syntax.QualidAnnotated+qualidAnnotatedUnivAnnot :: Typed.TypedTerm Syntax.QualidAnnotated -> Typed.TypedTerm (Maybe Syntax.UnivAnnot)+qualidAnnotatedUnivAnnot x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.QualidAnnotated"),+        Core.projectionFieldName = (Core.Name "univAnnot")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the qualid field of hydra.coq.syntax.QualidAnnotated+qualidAnnotatedWithQualid :: Typed.TypedTerm Syntax.QualidAnnotated -> Typed.TypedTerm Syntax.Qualid -> Typed.TypedTerm Syntax.QualidAnnotated+qualidAnnotatedWithQualid original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.QualidAnnotated"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "qualid"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "univAnnot"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.QualidAnnotated"),+              Core.projectionFieldName = (Core.Name "univAnnot")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the univAnnot field of hydra.coq.syntax.QualidAnnotated+qualidAnnotatedWithUnivAnnot :: Typed.TypedTerm Syntax.QualidAnnotated -> Typed.TypedTerm (Maybe Syntax.UnivAnnot) -> Typed.TypedTerm Syntax.QualidAnnotated+qualidAnnotatedWithUnivAnnot original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.QualidAnnotated"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "qualid"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.QualidAnnotated"),+              Core.projectionFieldName = (Core.Name "qualid")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "univAnnot"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL accessor for the fieldIds field of hydra.coq.syntax.Qualid+qualidFieldIds :: Typed.TypedTerm Syntax.Qualid -> Typed.TypedTerm [Syntax.FieldIdent]+qualidFieldIds x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Qualid"),+        Core.projectionFieldName = (Core.Name "fieldIds")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the id field of hydra.coq.syntax.Qualid+qualidId :: Typed.TypedTerm Syntax.Qualid -> Typed.TypedTerm Syntax.Ident+qualidId x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Qualid"),+        Core.projectionFieldName = (Core.Name "id")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the fieldIds field of hydra.coq.syntax.Qualid+qualidWithFieldIds :: Typed.TypedTerm Syntax.Qualid -> Typed.TypedTerm [Syntax.FieldIdent] -> Typed.TypedTerm Syntax.Qualid+qualidWithFieldIds original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Qualid"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "id"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Qualid"),+              Core.projectionFieldName = (Core.Name "id")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "fieldIds"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the id field of hydra.coq.syntax.Qualid+qualidWithId :: Typed.TypedTerm Syntax.Qualid -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.Qualid+qualidWithId original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Qualid"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "id"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "fieldIds"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Qualid"),+              Core.projectionFieldName = (Core.Name "fieldIds")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.coq.syntax.RecordBody+recordBody :: Typed.TypedTerm (Maybe Syntax.Ident) -> Typed.TypedTerm [Syntax.RecordField] -> Typed.TypedTerm Syntax.RecordBody+recordBody constructor fields =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RecordBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "constructor"),+          Core.fieldTerm = (Typed.unTypedTerm constructor)},+        Core.Field {+          Core.fieldName = (Core.Name "fields"),+          Core.fieldTerm = (Typed.unTypedTerm fields)}]}))+-- | DSL accessor for the constructor field of hydra.coq.syntax.RecordBody+recordBodyConstructor :: Typed.TypedTerm Syntax.RecordBody -> Typed.TypedTerm (Maybe Syntax.Ident)+recordBodyConstructor x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordBody"),+        Core.projectionFieldName = (Core.Name "constructor")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the fields field of hydra.coq.syntax.RecordBody+recordBodyFields :: Typed.TypedTerm Syntax.RecordBody -> Typed.TypedTerm [Syntax.RecordField]+recordBodyFields x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordBody"),+        Core.projectionFieldName = (Core.Name "fields")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the constructor field of hydra.coq.syntax.RecordBody+recordBodyWithConstructor :: Typed.TypedTerm Syntax.RecordBody -> Typed.TypedTerm (Maybe Syntax.Ident) -> Typed.TypedTerm Syntax.RecordBody+recordBodyWithConstructor original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RecordBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "constructor"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "fields"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordBody"),+              Core.projectionFieldName = (Core.Name "fields")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the fields field of hydra.coq.syntax.RecordBody+recordBodyWithFields :: Typed.TypedTerm Syntax.RecordBody -> Typed.TypedTerm [Syntax.RecordField] -> Typed.TypedTerm Syntax.RecordBody+recordBodyWithFields original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RecordBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "constructor"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordBody"),+              Core.projectionFieldName = (Core.Name "constructor")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "fields"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.RecordDefinition+recordDefinition :: Typed.TypedTerm (Maybe Syntax.Locality) -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm (Maybe Syntax.Sort) -> Typed.TypedTerm Syntax.RecordBody -> Typed.TypedTerm Syntax.RecordDefinition+recordDefinition locality name binders sort body =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Typed.unTypedTerm locality)},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm name)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm binders)},+        Core.Field {+          Core.fieldName = (Core.Name "sort"),+          Core.fieldTerm = (Typed.unTypedTerm sort)},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Typed.unTypedTerm body)}]}))+-- | DSL accessor for the binders field of hydra.coq.syntax.RecordDefinition+recordDefinitionBinders :: Typed.TypedTerm Syntax.RecordDefinition -> Typed.TypedTerm [Syntax.Binder]+recordDefinitionBinders x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+        Core.projectionFieldName = (Core.Name "binders")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body field of hydra.coq.syntax.RecordDefinition+recordDefinitionBody :: Typed.TypedTerm Syntax.RecordDefinition -> Typed.TypedTerm Syntax.RecordBody+recordDefinitionBody x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+        Core.projectionFieldName = (Core.Name "body")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the locality field of hydra.coq.syntax.RecordDefinition+recordDefinitionLocality :: Typed.TypedTerm Syntax.RecordDefinition -> Typed.TypedTerm (Maybe Syntax.Locality)+recordDefinitionLocality x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+        Core.projectionFieldName = (Core.Name "locality")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.coq.syntax.RecordDefinition+recordDefinitionName :: Typed.TypedTerm Syntax.RecordDefinition -> Typed.TypedTerm Syntax.Ident+recordDefinitionName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+        Core.projectionFieldName = (Core.Name "name")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the sort field of hydra.coq.syntax.RecordDefinition+recordDefinitionSort :: Typed.TypedTerm Syntax.RecordDefinition -> Typed.TypedTerm (Maybe Syntax.Sort)+recordDefinitionSort x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+        Core.projectionFieldName = (Core.Name "sort")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the binders field of hydra.coq.syntax.RecordDefinition+recordDefinitionWithBinders :: Typed.TypedTerm Syntax.RecordDefinition -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm Syntax.RecordDefinition+recordDefinitionWithBinders original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "sort"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "sort")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the body field of hydra.coq.syntax.RecordDefinition+recordDefinitionWithBody :: Typed.TypedTerm Syntax.RecordDefinition -> Typed.TypedTerm Syntax.RecordBody -> Typed.TypedTerm Syntax.RecordDefinition+recordDefinitionWithBody original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "sort"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "sort")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the locality field of hydra.coq.syntax.RecordDefinition+recordDefinitionWithLocality :: Typed.TypedTerm Syntax.RecordDefinition -> Typed.TypedTerm (Maybe Syntax.Locality) -> Typed.TypedTerm Syntax.RecordDefinition+recordDefinitionWithLocality original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "sort"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "sort")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the name field of hydra.coq.syntax.RecordDefinition+recordDefinitionWithName :: Typed.TypedTerm Syntax.RecordDefinition -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.RecordDefinition+recordDefinitionWithName original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "sort"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "sort")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the sort field of hydra.coq.syntax.RecordDefinition+recordDefinitionWithSort :: Typed.TypedTerm Syntax.RecordDefinition -> Typed.TypedTerm (Maybe Syntax.Sort) -> Typed.TypedTerm Syntax.RecordDefinition+recordDefinitionWithSort original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "locality"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "locality")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "sort"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "body"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordDefinition"),+              Core.projectionFieldName = (Core.Name "body")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.coq.syntax.RecordField+recordField :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.RecordField+recordField name type_ =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RecordField"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm name)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm type_)}]}))+-- | DSL accessor for the name field of hydra.coq.syntax.RecordField+recordFieldName :: Typed.TypedTerm Syntax.RecordField -> Typed.TypedTerm Syntax.Ident+recordFieldName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordField"),+        Core.projectionFieldName = (Core.Name "name")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.coq.syntax.RecordField+recordFieldType :: Typed.TypedTerm Syntax.RecordField -> Typed.TypedTerm Syntax.Type+recordFieldType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordField"),+        Core.projectionFieldName = (Core.Name "type")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the name field of hydra.coq.syntax.RecordField+recordFieldWithName :: Typed.TypedTerm Syntax.RecordField -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.RecordField+recordFieldWithName original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RecordField"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordField"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.coq.syntax.RecordField+recordFieldWithType :: Typed.TypedTerm Syntax.RecordField -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.RecordField+recordFieldWithType original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RecordField"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RecordField"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.RequireImport+requireImport :: Typed.TypedTerm (Maybe Syntax.Qualid) -> Typed.TypedTerm Bool -> Typed.TypedTerm (Maybe Syntax.ImportQualification) -> Typed.TypedTerm [Syntax.Qualid] -> Typed.TypedTerm Syntax.RequireImport+requireImport from require qualification modules =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "from"),+          Core.fieldTerm = (Typed.unTypedTerm from)},+        Core.Field {+          Core.fieldName = (Core.Name "require"),+          Core.fieldTerm = (Typed.unTypedTerm require)},+        Core.Field {+          Core.fieldName = (Core.Name "qualification"),+          Core.fieldTerm = (Typed.unTypedTerm qualification)},+        Core.Field {+          Core.fieldName = (Core.Name "modules"),+          Core.fieldTerm = (Typed.unTypedTerm modules)}]}))+-- | DSL accessor for the from field of hydra.coq.syntax.RequireImport+requireImportFrom :: Typed.TypedTerm Syntax.RequireImport -> Typed.TypedTerm (Maybe Syntax.Qualid)+requireImportFrom x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+        Core.projectionFieldName = (Core.Name "from")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the modules field of hydra.coq.syntax.RequireImport+requireImportModules :: Typed.TypedTerm Syntax.RequireImport -> Typed.TypedTerm [Syntax.Qualid]+requireImportModules x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+        Core.projectionFieldName = (Core.Name "modules")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the qualification field of hydra.coq.syntax.RequireImport+requireImportQualification :: Typed.TypedTerm Syntax.RequireImport -> Typed.TypedTerm (Maybe Syntax.ImportQualification)+requireImportQualification x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+        Core.projectionFieldName = (Core.Name "qualification")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the require field of hydra.coq.syntax.RequireImport+requireImportRequire :: Typed.TypedTerm Syntax.RequireImport -> Typed.TypedTerm Bool+requireImportRequire x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+        Core.projectionFieldName = (Core.Name "require")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the from field of hydra.coq.syntax.RequireImport+requireImportWithFrom :: Typed.TypedTerm Syntax.RequireImport -> Typed.TypedTerm (Maybe Syntax.Qualid) -> Typed.TypedTerm Syntax.RequireImport+requireImportWithFrom original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "from"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "require"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+              Core.projectionFieldName = (Core.Name "require")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "qualification"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+              Core.projectionFieldName = (Core.Name "qualification")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "modules"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+              Core.projectionFieldName = (Core.Name "modules")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the modules field of hydra.coq.syntax.RequireImport+requireImportWithModules :: Typed.TypedTerm Syntax.RequireImport -> Typed.TypedTerm [Syntax.Qualid] -> Typed.TypedTerm Syntax.RequireImport+requireImportWithModules original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "from"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+              Core.projectionFieldName = (Core.Name "from")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "require"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+              Core.projectionFieldName = (Core.Name "require")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "qualification"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+              Core.projectionFieldName = (Core.Name "qualification")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "modules"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the qualification field of hydra.coq.syntax.RequireImport+requireImportWithQualification :: Typed.TypedTerm Syntax.RequireImport -> Typed.TypedTerm (Maybe Syntax.ImportQualification) -> Typed.TypedTerm Syntax.RequireImport+requireImportWithQualification original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "from"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+              Core.projectionFieldName = (Core.Name "from")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "require"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+              Core.projectionFieldName = (Core.Name "require")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "qualification"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "modules"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+              Core.projectionFieldName = (Core.Name "modules")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the require field of hydra.coq.syntax.RequireImport+requireImportWithRequire :: Typed.TypedTerm Syntax.RequireImport -> Typed.TypedTerm Bool -> Typed.TypedTerm Syntax.RequireImport+requireImportWithRequire original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "from"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+              Core.projectionFieldName = (Core.Name "from")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "require"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "qualification"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+              Core.projectionFieldName = (Core.Name "qualification")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "modules"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.RequireImport"),+              Core.projectionFieldName = (Core.Name "modules")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.coq.syntax.ReturnAs+returnAs :: Typed.TypedTerm (Maybe Syntax.Name) -> Typed.TypedTerm Syntax.Term100 -> Typed.TypedTerm Syntax.ReturnAs+returnAs as return =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.ReturnAs"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "as"),+          Core.fieldTerm = (Typed.unTypedTerm as)},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Typed.unTypedTerm return)}]}))+-- | DSL accessor for the as field of hydra.coq.syntax.ReturnAs+returnAsAs :: Typed.TypedTerm Syntax.ReturnAs -> Typed.TypedTerm (Maybe Syntax.Name)+returnAsAs x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.ReturnAs"),+        Core.projectionFieldName = (Core.Name "as")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the return field of hydra.coq.syntax.ReturnAs+returnAsReturn :: Typed.TypedTerm Syntax.ReturnAs -> Typed.TypedTerm Syntax.Term100+returnAsReturn x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.ReturnAs"),+        Core.projectionFieldName = (Core.Name "return")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the as field of hydra.coq.syntax.ReturnAs+returnAsWithAs :: Typed.TypedTerm Syntax.ReturnAs -> Typed.TypedTerm (Maybe Syntax.Name) -> Typed.TypedTerm Syntax.ReturnAs+returnAsWithAs original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.ReturnAs"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "as"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.ReturnAs"),+              Core.projectionFieldName = (Core.Name "return")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the return field of hydra.coq.syntax.ReturnAs+returnAsWithReturn :: Typed.TypedTerm Syntax.ReturnAs -> Typed.TypedTerm Syntax.Term100 -> Typed.TypedTerm Syntax.ReturnAs+returnAsWithReturn original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.ReturnAs"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "as"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.ReturnAs"),+              Core.projectionFieldName = (Core.Name "as")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "return"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for the hydra.coq.syntax.ScopeKey wrapper+scopeKey :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.ScopeKey+scopeKey x =+    Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+      Core.wrappedTermTypeName = (Core.Name "hydra.coq.syntax.ScopeKey"),+      Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL constructor for hydra.coq.syntax.SectionDefinition+sectionDefinition :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm [Syntax.Sentence] -> Typed.TypedTerm Syntax.SectionDefinition+sectionDefinition name sentences =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.SectionDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm name)},+        Core.Field {+          Core.fieldName = (Core.Name "sentences"),+          Core.fieldTerm = (Typed.unTypedTerm sentences)}]}))+-- | DSL accessor for the name field of hydra.coq.syntax.SectionDefinition+sectionDefinitionName :: Typed.TypedTerm Syntax.SectionDefinition -> Typed.TypedTerm Syntax.Ident+sectionDefinitionName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.SectionDefinition"),+        Core.projectionFieldName = (Core.Name "name")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the sentences field of hydra.coq.syntax.SectionDefinition+sectionDefinitionSentences :: Typed.TypedTerm Syntax.SectionDefinition -> Typed.TypedTerm [Syntax.Sentence]+sectionDefinitionSentences x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.SectionDefinition"),+        Core.projectionFieldName = (Core.Name "sentences")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the name field of hydra.coq.syntax.SectionDefinition+sectionDefinitionWithName :: Typed.TypedTerm Syntax.SectionDefinition -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.SectionDefinition+sectionDefinitionWithName original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.SectionDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "sentences"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.SectionDefinition"),+              Core.projectionFieldName = (Core.Name "sentences")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the sentences field of hydra.coq.syntax.SectionDefinition+sectionDefinitionWithSentences :: Typed.TypedTerm Syntax.SectionDefinition -> Typed.TypedTerm [Syntax.Sentence] -> Typed.TypedTerm Syntax.SectionDefinition+sectionDefinitionWithSentences original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.SectionDefinition"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.SectionDefinition"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "sentences"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.Sentence+sentence :: Typed.TypedTerm (Maybe Syntax.Comment) -> Typed.TypedTerm Syntax.SentenceContent -> Typed.TypedTerm Syntax.Sentence+sentence comment content =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Sentence"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "comment"),+          Core.fieldTerm = (Typed.unTypedTerm comment)},+        Core.Field {+          Core.fieldName = (Core.Name "content"),+          Core.fieldTerm = (Typed.unTypedTerm content)}]}))+-- | DSL accessor for the comment field of hydra.coq.syntax.Sentence+sentenceComment :: Typed.TypedTerm Syntax.Sentence -> Typed.TypedTerm (Maybe Syntax.Comment)+sentenceComment x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Sentence"),+        Core.projectionFieldName = (Core.Name "comment")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the content field of hydra.coq.syntax.Sentence+sentenceContent :: Typed.TypedTerm Syntax.Sentence -> Typed.TypedTerm Syntax.SentenceContent+sentenceContent x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Sentence"),+        Core.projectionFieldName = (Core.Name "content")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL injection for the axiom variant of hydra.coq.syntax.SentenceContent+sentenceContentAxiom :: Typed.TypedTerm Syntax.AxiomDeclaration -> Typed.TypedTerm Syntax.SentenceContent+sentenceContentAxiom x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.SentenceContent"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "axiom"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the definition variant of hydra.coq.syntax.SentenceContent+sentenceContentDefinition :: Typed.TypedTerm Syntax.Definition -> Typed.TypedTerm Syntax.SentenceContent+sentenceContentDefinition x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.SentenceContent"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "definition"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the fixpoint variant of hydra.coq.syntax.SentenceContent+sentenceContentFixpoint :: Typed.TypedTerm Syntax.FixpointDefinition -> Typed.TypedTerm Syntax.SentenceContent+sentenceContentFixpoint x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.SentenceContent"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "fixpoint"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the inductive variant of hydra.coq.syntax.SentenceContent+sentenceContentInductive :: Typed.TypedTerm Syntax.InductiveDefinition -> Typed.TypedTerm Syntax.SentenceContent+sentenceContentInductive x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.SentenceContent"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "inductive"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the module variant of hydra.coq.syntax.SentenceContent+sentenceContentModule :: Typed.TypedTerm Syntax.ModuleDefinition -> Typed.TypedTerm Syntax.SentenceContent+sentenceContentModule x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.SentenceContent"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "module"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the notation variant of hydra.coq.syntax.SentenceContent+sentenceContentNotation :: Typed.TypedTerm Syntax.NotationDeclaration -> Typed.TypedTerm Syntax.SentenceContent+sentenceContentNotation x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.SentenceContent"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "notation"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the record variant of hydra.coq.syntax.SentenceContent+sentenceContentRecord :: Typed.TypedTerm Syntax.RecordDefinition -> Typed.TypedTerm Syntax.SentenceContent+sentenceContentRecord x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.SentenceContent"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "record"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the requireImport variant of hydra.coq.syntax.SentenceContent+sentenceContentRequireImport :: Typed.TypedTerm Syntax.RequireImport -> Typed.TypedTerm Syntax.SentenceContent+sentenceContentRequireImport x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.SentenceContent"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "requireImport"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the section variant of hydra.coq.syntax.SentenceContent+sentenceContentSection :: Typed.TypedTerm Syntax.SectionDefinition -> Typed.TypedTerm Syntax.SentenceContent+sentenceContentSection x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.SentenceContent"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "section"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the theorem variant of hydra.coq.syntax.SentenceContent+sentenceContentTheorem :: Typed.TypedTerm Syntax.TheoremBody -> Typed.TypedTerm Syntax.SentenceContent+sentenceContentTheorem x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.SentenceContent"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "theorem"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL updater for the comment field of hydra.coq.syntax.Sentence+sentenceWithComment :: Typed.TypedTerm Syntax.Sentence -> Typed.TypedTerm (Maybe Syntax.Comment) -> Typed.TypedTerm Syntax.Sentence+sentenceWithComment original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Sentence"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "comment"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "content"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Sentence"),+              Core.projectionFieldName = (Core.Name "content")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the content field of hydra.coq.syntax.Sentence+sentenceWithContent :: Typed.TypedTerm Syntax.Sentence -> Typed.TypedTerm Syntax.SentenceContent -> Typed.TypedTerm Syntax.Sentence+sentenceWithContent original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Sentence"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "comment"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Sentence"),+              Core.projectionFieldName = (Core.Name "comment")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "content"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL injection for the prop variant of hydra.coq.syntax.Sort+sortProp :: Typed.TypedTerm Syntax.Sort+sortProp =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Sort"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "prop"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the sProp variant of hydra.coq.syntax.Sort+sortSProp :: Typed.TypedTerm Syntax.Sort+sortSProp =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Sort"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "sProp"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the set variant of hydra.coq.syntax.Sort+sortSet :: Typed.TypedTerm Syntax.Sort+sortSet =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Sort"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "set"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the type variant of hydra.coq.syntax.Sort+sortType :: Typed.TypedTerm Syntax.Sort+sortType =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Sort"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "type"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the typeWithAnyUniverse variant of hydra.coq.syntax.Sort+sortTypeWithAnyUniverse :: Typed.TypedTerm Syntax.Sort+sortTypeWithAnyUniverse =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Sort"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "typeWithAnyUniverse"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the typeWithUniverse variant of hydra.coq.syntax.Sort+sortTypeWithUniverse :: Typed.TypedTerm Syntax.Universe -> Typed.TypedTerm Syntax.Sort+sortTypeWithUniverse x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Sort"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "typeWithUniverse"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for the hydra.coq.syntax.String wrapper+string :: Typed.TypedTerm String -> Typed.TypedTerm Syntax.String_+string x =+    Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+      Core.wrappedTermTypeName = (Core.Name "hydra.coq.syntax.String"),+      Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL injection for the evar variant of hydra.coq.syntax.Term0+term0Evar :: Typed.TypedTerm Syntax.ExistentialVariable -> Typed.TypedTerm Syntax.Term0+term0Evar x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "evar"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the generalizing variant of hydra.coq.syntax.Term0+term0Generalizing :: Typed.TypedTerm Syntax.Term0+term0Generalizing =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "generalizing"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the ltac variant of hydra.coq.syntax.Term0+term0Ltac :: Typed.TypedTerm Syntax.Term0+term0Ltac =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "ltac"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the match variant of hydra.coq.syntax.Term0+term0Match :: Typed.TypedTerm Syntax.Match -> Typed.TypedTerm Syntax.Term0+term0Match x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "match"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the parens variant of hydra.coq.syntax.Term0+term0Parens :: Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Term0+term0Parens x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "parens"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the primitiveNotations variant of hydra.coq.syntax.Term0+term0PrimitiveNotations :: Typed.TypedTerm Syntax.PrimitiveNotations -> Typed.TypedTerm Syntax.Term0+term0PrimitiveNotations x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "primitiveNotations"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the qualidAnnotated variant of hydra.coq.syntax.Term0+term0QualidAnnotated :: Typed.TypedTerm Syntax.QualidAnnotated -> Typed.TypedTerm Syntax.Term0+term0QualidAnnotated x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "qualidAnnotated"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the record variant of hydra.coq.syntax.Term0+term0Record :: Typed.TypedTerm Syntax.Term0+term0Record =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "record"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the sort variant of hydra.coq.syntax.Term0+term0Sort :: Typed.TypedTerm Syntax.Sort -> Typed.TypedTerm Syntax.Term0+term0Sort x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term0"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "sort"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the cast variant of hydra.coq.syntax.Term100+term100Cast :: Typed.TypedTerm Syntax.TypeCast -> Typed.TypedTerm Syntax.Term100+term100Cast x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term100"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "cast"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the term10 variant of hydra.coq.syntax.Term100+term100Term10 :: Typed.TypedTerm Syntax.Term10 -> Typed.TypedTerm Syntax.Term100+term100Term10 x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term100"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "term10"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the application variant of hydra.coq.syntax.Term10+term10Application :: Typed.TypedTerm Syntax.Application -> Typed.TypedTerm Syntax.Term10+term10Application x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term10"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "application"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the oneTerm variant of hydra.coq.syntax.Term10+term10OneTerm :: Typed.TypedTerm Syntax.OneTerm -> Typed.TypedTerm Syntax.Term10+term10OneTerm x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term10"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "oneTerm"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the projection variant of hydra.coq.syntax.Term1+term1Projection :: Typed.TypedTerm Syntax.Term1+term1Projection =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term1"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "projection"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the scope variant of hydra.coq.syntax.Term1+term1Scope :: Typed.TypedTerm Syntax.Term1+term1Scope =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term1"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "scope"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the term0 variant of hydra.coq.syntax.Term1+term1Term0 :: Typed.TypedTerm Syntax.Term0 -> Typed.TypedTerm Syntax.Term1+term1Term0 x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term1"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "term0"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the cofix variant of hydra.coq.syntax.Term+termCofix :: Typed.TypedTerm Syntax.Cofix -> Typed.TypedTerm Syntax.Term+termCofix x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "cofix"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the fix variant of hydra.coq.syntax.Term+termFix :: Typed.TypedTerm Syntax.Fix -> Typed.TypedTerm Syntax.Term+termFix x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "fix"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the forallOrFun variant of hydra.coq.syntax.Term+termForallOrFun :: Typed.TypedTerm Syntax.ForallOrFun -> Typed.TypedTerm Syntax.Term+termForallOrFun x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "forallOrFun"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the if variant of hydra.coq.syntax.Term+termIf :: Typed.TypedTerm Syntax.If -> Typed.TypedTerm Syntax.Term+termIf x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "if"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the let variant of hydra.coq.syntax.Term+termLet :: Typed.TypedTerm Syntax.Let -> Typed.TypedTerm Syntax.Term+termLet x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "let"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the term100 variant of hydra.coq.syntax.Term+termTerm100 :: Typed.TypedTerm Syntax.Term100 -> Typed.TypedTerm Syntax.Term+termTerm100 x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Term"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "term100"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL constructor for hydra.coq.syntax.TheoremBody+theoremBody :: Typed.TypedTerm Syntax.TheoremKind -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.TheoremBody+theoremBody kind name binders type_ proof =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "kind"),+          Core.fieldTerm = (Typed.unTypedTerm kind)},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm name)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm binders)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm type_)},+        Core.Field {+          Core.fieldName = (Core.Name "proof"),+          Core.fieldTerm = (Typed.unTypedTerm proof)}]}))+-- | DSL accessor for the binders field of hydra.coq.syntax.TheoremBody+theoremBodyBinders :: Typed.TypedTerm Syntax.TheoremBody -> Typed.TypedTerm [Syntax.Binder]+theoremBodyBinders x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+        Core.projectionFieldName = (Core.Name "binders")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the kind field of hydra.coq.syntax.TheoremBody+theoremBodyKind :: Typed.TypedTerm Syntax.TheoremBody -> Typed.TypedTerm Syntax.TheoremKind+theoremBodyKind x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+        Core.projectionFieldName = (Core.Name "kind")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.coq.syntax.TheoremBody+theoremBodyName :: Typed.TypedTerm Syntax.TheoremBody -> Typed.TypedTerm Syntax.Ident+theoremBodyName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+        Core.projectionFieldName = (Core.Name "name")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the proof field of hydra.coq.syntax.TheoremBody+theoremBodyProof :: Typed.TypedTerm Syntax.TheoremBody -> Typed.TypedTerm Syntax.Term+theoremBodyProof x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+        Core.projectionFieldName = (Core.Name "proof")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.coq.syntax.TheoremBody+theoremBodyType :: Typed.TypedTerm Syntax.TheoremBody -> Typed.TypedTerm Syntax.Type+theoremBodyType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+        Core.projectionFieldName = (Core.Name "type")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the binders field of hydra.coq.syntax.TheoremBody+theoremBodyWithBinders :: Typed.TypedTerm Syntax.TheoremBody -> Typed.TypedTerm [Syntax.Binder] -> Typed.TypedTerm Syntax.TheoremBody+theoremBodyWithBinders original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "kind"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "kind")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "proof"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "proof")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the kind field of hydra.coq.syntax.TheoremBody+theoremBodyWithKind :: Typed.TypedTerm Syntax.TheoremBody -> Typed.TypedTerm Syntax.TheoremKind -> Typed.TypedTerm Syntax.TheoremBody+theoremBodyWithKind original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "kind"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "proof"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "proof")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the name field of hydra.coq.syntax.TheoremBody+theoremBodyWithName :: Typed.TypedTerm Syntax.TheoremBody -> Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.TheoremBody+theoremBodyWithName original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "kind"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "kind")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "proof"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "proof")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the proof field of hydra.coq.syntax.TheoremBody+theoremBodyWithProof :: Typed.TypedTerm Syntax.TheoremBody -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.TheoremBody+theoremBodyWithProof original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "kind"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "kind")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "proof"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the type field of hydra.coq.syntax.TheoremBody+theoremBodyWithType :: Typed.TypedTerm Syntax.TheoremBody -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.TheoremBody+theoremBodyWithType original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "kind"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "kind")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "binders"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "binders")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "proof"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TheoremBody"),+              Core.projectionFieldName = (Core.Name "proof")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL injection for the corollary variant of hydra.coq.syntax.TheoremKind+theoremKindCorollary :: Typed.TypedTerm Syntax.TheoremKind+theoremKindCorollary =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.TheoremKind"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "corollary"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the example variant of hydra.coq.syntax.TheoremKind+theoremKindExample :: Typed.TypedTerm Syntax.TheoremKind+theoremKindExample =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.TheoremKind"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "example"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the lemma variant of hydra.coq.syntax.TheoremKind+theoremKindLemma :: Typed.TypedTerm Syntax.TheoremKind+theoremKindLemma =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.TheoremKind"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "lemma"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the proposition variant of hydra.coq.syntax.TheoremKind+theoremKindProposition :: Typed.TypedTerm Syntax.TheoremKind+theoremKindProposition =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.TheoremKind"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "proposition"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the theorem variant of hydra.coq.syntax.TheoremKind+theoremKindTheorem :: Typed.TypedTerm Syntax.TheoremKind+theoremKindTheorem =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.TheoremKind"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "theorem"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL constructor for the hydra.coq.syntax.Type wrapper+type_ :: Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.Type+type_ x =+    Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+      Core.wrappedTermTypeName = (Core.Name "hydra.coq.syntax.Type"),+      Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL constructor for hydra.coq.syntax.TypeBinders+typeBinders :: Typed.TypedTerm [Syntax.Name] -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.TypeBinders+typeBinders names type_ =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TypeBinders"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "names"),+          Core.fieldTerm = (Typed.unTypedTerm names)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm type_)}]}))+-- | DSL accessor for the names field of hydra.coq.syntax.TypeBinders+typeBindersNames :: Typed.TypedTerm Syntax.TypeBinders -> Typed.TypedTerm [Syntax.Name]+typeBindersNames x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeBinders"),+        Core.projectionFieldName = (Core.Name "names")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.coq.syntax.TypeBinders+typeBindersType :: Typed.TypedTerm Syntax.TypeBinders -> Typed.TypedTerm Syntax.Type+typeBindersType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeBinders"),+        Core.projectionFieldName = (Core.Name "type")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the names field of hydra.coq.syntax.TypeBinders+typeBindersWithNames :: Typed.TypedTerm Syntax.TypeBinders -> Typed.TypedTerm [Syntax.Name] -> Typed.TypedTerm Syntax.TypeBinders+typeBindersWithNames original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TypeBinders"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "names"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeBinders"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.coq.syntax.TypeBinders+typeBindersWithType :: Typed.TypedTerm Syntax.TypeBinders -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.TypeBinders+typeBindersWithType original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TypeBinders"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "names"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeBinders"),+              Core.projectionFieldName = (Core.Name "names")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL constructor for hydra.coq.syntax.TypeCast+typeCast :: Typed.TypedTerm Syntax.Term10 -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.TypeCastOperator -> Typed.TypedTerm Syntax.TypeCast+typeCast term type_ operator =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TypeCast"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm type_)},+        Core.Field {+          Core.fieldName = (Core.Name "operator"),+          Core.fieldTerm = (Typed.unTypedTerm operator)}]}))+-- | DSL accessor for the operator field of hydra.coq.syntax.TypeCast+typeCastOperator :: Typed.TypedTerm Syntax.TypeCast -> Typed.TypedTerm Syntax.TypeCastOperator+typeCastOperator x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeCast"),+        Core.projectionFieldName = (Core.Name "operator")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL injection for the nativeCompute variant of hydra.coq.syntax.TypeCastOperator+typeCastOperatorNativeCompute :: Typed.TypedTerm Syntax.TypeCastOperator+typeCastOperatorNativeCompute =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.TypeCastOperator"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "nativeCompute"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the normal variant of hydra.coq.syntax.TypeCastOperator+typeCastOperatorNormal :: Typed.TypedTerm Syntax.TypeCastOperator+typeCastOperatorNormal =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.TypeCastOperator"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "normal"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the vmCompute variant of hydra.coq.syntax.TypeCastOperator+typeCastOperatorVmCompute :: Typed.TypedTerm Syntax.TypeCastOperator+typeCastOperatorVmCompute =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.TypeCastOperator"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "vmCompute"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL accessor for the term field of hydra.coq.syntax.TypeCast+typeCastTerm :: Typed.TypedTerm Syntax.TypeCast -> Typed.TypedTerm Syntax.Term10+typeCastTerm x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeCast"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the type field of hydra.coq.syntax.TypeCast+typeCastType :: Typed.TypedTerm Syntax.TypeCast -> Typed.TypedTerm Syntax.Type+typeCastType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeCast"),+        Core.projectionFieldName = (Core.Name "type")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the operator field of hydra.coq.syntax.TypeCast+typeCastWithOperator :: Typed.TypedTerm Syntax.TypeCast -> Typed.TypedTerm Syntax.TypeCastOperator -> Typed.TypedTerm Syntax.TypeCast+typeCastWithOperator original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TypeCast"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeCast"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeCast"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "operator"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL updater for the term field of hydra.coq.syntax.TypeCast+typeCastWithTerm :: Typed.TypedTerm Syntax.TypeCast -> Typed.TypedTerm Syntax.Term10 -> Typed.TypedTerm Syntax.TypeCast+typeCastWithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TypeCast"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeCast"),+              Core.projectionFieldName = (Core.Name "type")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "operator"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeCast"),+              Core.projectionFieldName = (Core.Name "operator")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the type field of hydra.coq.syntax.TypeCast+typeCastWithType :: Typed.TypedTerm Syntax.TypeCast -> Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.TypeCast+typeCastWithType original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TypeCast"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeCast"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "type"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "operator"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeCast"),+              Core.projectionFieldName = (Core.Name "operator")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL constructor for hydra.coq.syntax.TypeclassConstraint+typeclassConstraint :: Typed.TypedTerm (Maybe Syntax.Name) -> Typed.TypedTerm Bool -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.TypeclassConstraint+typeclassConstraint name generalizing term =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TypeclassConstraint"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm name)},+        Core.Field {+          Core.fieldName = (Core.Name "generalizing"),+          Core.fieldTerm = (Typed.unTypedTerm generalizing)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm term)}]}))+-- | DSL accessor for the generalizing field of hydra.coq.syntax.TypeclassConstraint+typeclassConstraintGeneralizing :: Typed.TypedTerm Syntax.TypeclassConstraint -> Typed.TypedTerm Bool+typeclassConstraintGeneralizing x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeclassConstraint"),+        Core.projectionFieldName = (Core.Name "generalizing")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the name field of hydra.coq.syntax.TypeclassConstraint+typeclassConstraintName :: Typed.TypedTerm Syntax.TypeclassConstraint -> Typed.TypedTerm (Maybe Syntax.Name)+typeclassConstraintName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeclassConstraint"),+        Core.projectionFieldName = (Core.Name "name")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the term field of hydra.coq.syntax.TypeclassConstraint+typeclassConstraintTerm :: Typed.TypedTerm Syntax.TypeclassConstraint -> Typed.TypedTerm Syntax.Term+typeclassConstraintTerm x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeclassConstraint"),+        Core.projectionFieldName = (Core.Name "term")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the generalizing field of hydra.coq.syntax.TypeclassConstraint+typeclassConstraintWithGeneralizing :: Typed.TypedTerm Syntax.TypeclassConstraint -> Typed.TypedTerm Bool -> Typed.TypedTerm Syntax.TypeclassConstraint+typeclassConstraintWithGeneralizing original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TypeclassConstraint"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeclassConstraint"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "generalizing"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeclassConstraint"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the name field of hydra.coq.syntax.TypeclassConstraint+typeclassConstraintWithName :: Typed.TypedTerm Syntax.TypeclassConstraint -> Typed.TypedTerm (Maybe Syntax.Name) -> Typed.TypedTerm Syntax.TypeclassConstraint+typeclassConstraintWithName original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TypeclassConstraint"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "generalizing"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeclassConstraint"),+              Core.projectionFieldName = (Core.Name "generalizing")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeclassConstraint"),+              Core.projectionFieldName = (Core.Name "term")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the term field of hydra.coq.syntax.TypeclassConstraint+typeclassConstraintWithTerm :: Typed.TypedTerm Syntax.TypeclassConstraint -> Typed.TypedTerm Syntax.Term -> Typed.TypedTerm Syntax.TypeclassConstraint+typeclassConstraintWithTerm original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.TypeclassConstraint"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeclassConstraint"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "generalizing"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.TypeclassConstraint"),+              Core.projectionFieldName = (Core.Name "generalizing")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "term"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))+-- | DSL accessor for the body of hydra.coq.syntax.Comment+unComment :: Typed.TypedTerm Syntax.Comment -> Typed.TypedTerm String+unComment x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.coq.syntax.Comment")),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.coq.syntax.FieldIdent+unFieldIdent :: Typed.TypedTerm Syntax.FieldIdent -> Typed.TypedTerm Syntax.Ident+unFieldIdent x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.coq.syntax.FieldIdent")),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.coq.syntax.Ident+unIdent :: Typed.TypedTerm Syntax.Ident -> Typed.TypedTerm Syntax.String_+unIdent x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.coq.syntax.Ident")),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.coq.syntax.Name+unName :: Typed.TypedTerm Syntax.Name -> Typed.TypedTerm (Maybe Syntax.Ident)+unName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.coq.syntax.Name")),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.coq.syntax.Natural+unNatural :: Typed.TypedTerm Syntax.Natural -> Typed.TypedTerm Integer+unNatural x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.coq.syntax.Natural")),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.coq.syntax.Number+unNumber :: Typed.TypedTerm Syntax.Number -> Typed.TypedTerm Double+unNumber x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.coq.syntax.Number")),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.coq.syntax.ScopeKey+unScopeKey :: Typed.TypedTerm Syntax.ScopeKey -> Typed.TypedTerm Syntax.Ident+unScopeKey x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.coq.syntax.ScopeKey")),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.coq.syntax.String+unString :: Typed.TypedTerm Syntax.String_ -> Typed.TypedTerm String+unString x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.coq.syntax.String")),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.coq.syntax.Type+unType :: Typed.TypedTerm Syntax.Type -> Typed.TypedTerm Syntax.Term+unType x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.coq.syntax.Type")),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the body of hydra.coq.syntax.UnivAnnot+unUnivAnnot :: Typed.TypedTerm Syntax.UnivAnnot -> Typed.TypedTerm [Syntax.UniverseLevel]+unUnivAnnot x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermUnwrap (Core.Name "hydra.coq.syntax.UnivAnnot")),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL constructor for the hydra.coq.syntax.UnivAnnot wrapper+univAnnot :: Typed.TypedTerm [Syntax.UniverseLevel] -> Typed.TypedTerm Syntax.UnivAnnot+univAnnot x =+    Typed.TypedTerm (Core.TermWrap (Core.WrappedTerm {+      Core.wrappedTermTypeName = (Core.Name "hydra.coq.syntax.UnivAnnot"),+      Core.wrappedTermBody = (Typed.unTypedTerm x)}))+-- | DSL injection for the expr variant of hydra.coq.syntax.Universe+universeExpr :: Typed.TypedTerm Syntax.Universe_Expr -> Typed.TypedTerm Syntax.Universe+universeExpr x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Universe"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "expr"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the ignored variant of hydra.coq.syntax.UniverseLevel+universeLevelIgnored :: Typed.TypedTerm Syntax.UniverseLevel+universeLevelIgnored =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.UniverseLevel"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "ignored"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the prop variant of hydra.coq.syntax.UniverseLevel+universeLevelProp :: Typed.TypedTerm Syntax.UniverseLevel+universeLevelProp =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.UniverseLevel"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "prop"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the qualid variant of hydra.coq.syntax.UniverseLevel+universeLevelQualid :: Typed.TypedTerm Syntax.Qualid -> Typed.TypedTerm Syntax.UniverseLevel+universeLevelQualid x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.UniverseLevel"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "qualid"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the set variant of hydra.coq.syntax.UniverseLevel+universeLevelSet :: Typed.TypedTerm Syntax.UniverseLevel+universeLevelSet =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.UniverseLevel"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "set"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the type variant of hydra.coq.syntax.UniverseLevel+universeLevelType :: Typed.TypedTerm Syntax.UniverseLevel+universeLevelType =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.UniverseLevel"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "type"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the max variant of hydra.coq.syntax.Universe+universeMax :: Typed.TypedTerm [Syntax.Universe_Expr] -> Typed.TypedTerm Syntax.Universe+universeMax x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.Universe"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "max"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the prop variant of hydra.coq.syntax.UniverseName+universeNameProp :: Typed.TypedTerm Syntax.UniverseName+universeNameProp =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.UniverseName"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "prop"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL injection for the qualid variant of hydra.coq.syntax.UniverseName+universeNameQualid :: Typed.TypedTerm Syntax.Qualid -> Typed.TypedTerm Syntax.UniverseName+universeNameQualid x =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.UniverseName"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "qualid"),+        Core.fieldTerm = (Typed.unTypedTerm x)}}))+-- | DSL injection for the set variant of hydra.coq.syntax.UniverseName+universeNameSet :: Typed.TypedTerm Syntax.UniverseName+universeNameSet =+    Typed.TypedTerm (Core.TermInject (Core.Injection {+      Core.injectionTypeName = (Core.Name "hydra.coq.syntax.UniverseName"),+      Core.injectionField = Core.Field {+        Core.fieldName = (Core.Name "set"),+        Core.fieldTerm = Core.TermUnit}}))+-- | DSL constructor for hydra.coq.syntax.Universe_Expr+universe_Expr :: Typed.TypedTerm Syntax.UniverseName -> Typed.TypedTerm (Maybe Syntax.Natural) -> Typed.TypedTerm Syntax.Universe_Expr+universe_Expr name number =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Universe_Expr"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm name)},+        Core.Field {+          Core.fieldName = (Core.Name "number"),+          Core.fieldTerm = (Typed.unTypedTerm number)}]}))+-- | DSL accessor for the name field of hydra.coq.syntax.Universe_Expr+universe_ExprName :: Typed.TypedTerm Syntax.Universe_Expr -> Typed.TypedTerm Syntax.UniverseName+universe_ExprName x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Universe_Expr"),+        Core.projectionFieldName = (Core.Name "name")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL accessor for the number field of hydra.coq.syntax.Universe_Expr+universe_ExprNumber :: Typed.TypedTerm Syntax.Universe_Expr -> Typed.TypedTerm (Maybe Syntax.Natural)+universe_ExprNumber x =+    Typed.TypedTerm (Core.TermApplication (Core.Application {+      Core.applicationFunction = (Core.TermProject (Core.Projection {+        Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Universe_Expr"),+        Core.projectionFieldName = (Core.Name "number")})),+      Core.applicationArgument = (Typed.unTypedTerm x)}))+-- | DSL updater for the name field of hydra.coq.syntax.Universe_Expr+universe_ExprWithName :: Typed.TypedTerm Syntax.Universe_Expr -> Typed.TypedTerm Syntax.UniverseName -> Typed.TypedTerm Syntax.Universe_Expr+universe_ExprWithName original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Universe_Expr"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)},+        Core.Field {+          Core.fieldName = (Core.Name "number"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Universe_Expr"),+              Core.projectionFieldName = (Core.Name "number")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))}]}))+-- | DSL updater for the number field of hydra.coq.syntax.Universe_Expr+universe_ExprWithNumber :: Typed.TypedTerm Syntax.Universe_Expr -> Typed.TypedTerm (Maybe Syntax.Natural) -> Typed.TypedTerm Syntax.Universe_Expr+universe_ExprWithNumber original newVal =+    Typed.TypedTerm (Core.TermRecord (Core.Record {+      Core.recordTypeName = (Core.Name "hydra.coq.syntax.Universe_Expr"),+      Core.recordFields = [+        Core.Field {+          Core.fieldName = (Core.Name "name"),+          Core.fieldTerm = (Core.TermApplication (Core.Application {+            Core.applicationFunction = (Core.TermProject (Core.Projection {+              Core.projectionTypeName = (Core.Name "hydra.coq.syntax.Universe_Expr"),+              Core.projectionFieldName = (Core.Name "name")})),+            Core.applicationArgument = (Typed.unTypedTerm original)}))},+        Core.Field {+          Core.fieldName = (Core.Name "number"),+          Core.fieldTerm = (Typed.unTypedTerm newVal)}]}))