lean4-htt/tests/lean/run/3150.lean
Kyle Miller 7557542bc2
feat: make structure parent projections nameable (#7100)
This PR modifies the `structure` syntax so that parents can be named,
like in
```lean
structure S extends toParent : P
```
**Breaking change:** The syntax is also modified so that the resultant
type comes *before* the `extends` clause, for example `structure S :
Prop extends P`. This is necessary to prevent a parsing ambiguity, but
also this is the natural place for the resultant type. Implements RFC
#7099.

Will need followup PRs for cleanup after a stage0 update.
2025-02-18 07:38:13 +00:00

24 lines
541 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class One (α : Type) where
one : α
variable (R A : Type) [One R] [One A]
class OneHom where
toFun : R → A
map_one : toFun One.one = One.one
structure Subone where
mem : R → Prop
one_mem : mem One.one
structure Subalgebra [OneHom R A] : Type extends Subone A where
algebraMap_mem : ∀ r : R, mem (OneHom.toFun r)
one_mem := OneHom.map_one (R := R) (A := A) ▸ algebraMap_mem One.one
/--
error: fields missing: 'one_mem'
-/
#guard_msgs in
example [OneHom R A] : Subalgebra R A where
mem := _
algebraMap_mem := _