The power -algebra
DefinitionMSKleene_PowerThe power (subset) -algebra associated with a many-sorted -algebra (Proposition 2.32; for single-sorted algebras, Mezei–Wright 1967).
Its carrier is the sortwise powerset . For an operation symbol of rank and a tuple of subsets , the interpreted operation returns the image
The predicate Args.pmem expresses that an argument tuple is a componentwise member of a tuple of subsets, and powerOp packages the image above. The singleton -sorted map , , is also defined.
This object is where regular expressions are interpreted as languages.
/-
The power (subset) `Σ`-algebra `A^℘` associated with a many-sorted `Σ`-algebra
`A` (Proposition 2.32; for single-sorted algebras, Mezei–Wright 1967, Def. 2.2).
Carrier: sortwise powerset `s ↦ Set (A_s)`.
Operation `σ^{A^℘}`: sends a tuple of subsets `(L_i)` to the image
`{ σ^A(x_i) | x_i ∈ L_i for every i }`.
Also: the singleton map `{·} : A → A^℘`, `x ↦ {x}`, as an `S`-sorted map.
-/
import Definitions.Def_MSKleene_Core
namespace MSKleene
universe u
variable {S : Type u} {sig : Signature S}
/-- `Args.pmem xs Ls` holds when the argument tuple `xs` is a componentwise
member of the tuple of subsets `Ls`. -/
def Args.pmem {A : SSet S} :
{w : List S} → Args A w → Args (fun s => Set (A s)) w → Prop
| [], _, _ => True
| _ :: _, (x, xs), (L, Ls) => x ∈ L ∧ Args.pmem xs Ls
/-- The image of a tuple of subsets under an operation of the algebra `A`:
`{ A.op σ xs | xs a componentwise member of Ls }`. -/
def powerOp (A : Algebra sig) {w : List S} {s : S} (σ : sig w s)
(Ls : Args (fun s => Set (A.carrier s)) w) : Set (A.carrier s) :=
{ y | ∃ xs : Args A.carrier w, Args.pmem xs Ls ∧ y = A.op σ xs }
/-- The power `Σ`-algebra `A^℘` (Proposition 2.32). -/
def powerAlgebra (A : Algebra sig) : Algebra sig where
carrier := fun s => Set (A.carrier s)
op := fun σ Ls => powerOp A σ Ls
@[simp] theorem powerAlgebra_carrier (A : Algebra sig) (s : S) :
(powerAlgebra A).carrier s = Set (A.carrier s) := rfl
@[simp] theorem powerAlgebra_op (A : Algebra sig) {w : List S} {s : S}
(σ : sig w s) (Ls : Args (fun s => Set (A.carrier s)) w) :
(powerAlgebra A).op σ Ls = powerOp A σ Ls := rfl
/-- The singleton `S`-sorted map `{·}^Σ_A : A → A^℘`. -/
def singletonMap (A : Algebra sig) : SMap A.carrier (powerAlgebra A).carrier :=
fun s a => ({a} : Set (A.carrier s))
theorem singletonMap_apply (A : Algebra sig) (s : S) (a : A.carrier s) :
singletonMap A s a = ({a} : Set (A.carrier s)) := rfl
end MSKleene
Read-back
What the Lean code literally says, in plain math · claude-sonnet-5
Args.pmem
This definition introduces a predicate ("positional membership"). Fix an arbitrary type whose elements are called sorts, and an implicit family assigning a type to each sort . For a list of sorts (implicit), denotes the iterated product (a one‑element type when is empty), and denotes the product whose ‑th entry is a subset of . Given a tuple and a tuple of subsets , the proposition is defined by recursion on :
- when is the empty list, — it holds unconditionally, and both tuples are the trivial one‑element tuple;
- when , writing with and with , we have .
Thus asserts that every component of the tuple lies in the correspondingly positioned subset of ; for the empty arity it is vacuously true.
powerOp
Fix a sort type and an implicit signature over , where a signature assigns to each arity list and result sort a type of operation symbols. Let be an algebra for : it provides a carrier family and, for each operation symbol , an interpretation . Given an implicit arity and result sort , an operation symbol , and a tuple whose ‑th entry is a subset , the definition sets
as a subset of . In words, it is the set of all values obtained by applying the operation of to some argument tuple each of whose components lies in the corresponding subset listed by . When is the empty list, there are no components, holds trivially, and this reduces to the singleton containing the interpreted constant, with the trivial empty tuple.
powerAlgebra
With and as above and an algebra for , this defines a new algebra for the same signature . Its carrier at each sort is , the type of all subsets of 's carrier at . Its interpretation of an operation symbol applied to a tuple of subsets is , the set described in the previous paragraph.
powerAlgebra_carrier
This theorem is marked as a simplification lemma. It states that for every algebra for and every sort , the carrier of the algebra at sort is equal, as a type, to . The proof is by reflexivity, i.e. the two sides are definitionally equal.
powerAlgebra_op
This theorem is marked as a simplification lemma. It states that for every algebra for , every implicit arity and result sort , every operation symbol , and every tuple whose ‑th component is a subset of , the interpretation of in the algebra applied to equals . The proof is by reflexivity.
singletonMap
With , , and an algebra for , this defines as a sorted map from the carrier of to the carrier of ; that is, a family of functions indexed by sorts, where at sort it is a function . Concretely, at sort it sends an element to the singleton subset of . It is asserted only to be such a sorted map; there is no claim that it is a homomorphism of algebras.
singletonMap_apply
This theorem (not marked as a simplification lemma) states that for every algebra for , every sort , and every element , the value of at sort on the argument is the singleton set . The proof is by reflexivity.
Confirmed by the mission captain (proposal self-audit).