Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/693343d7-a38c-8012-a67c-11cbed4c0fd9
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== For State S the desired distributive law Ξ» : State S β O β O β State S would be: ==== <syntaxhighlight>Ξ»_A : (S -> (O A Γ S)) -> O (S -> (A Γ S)) </syntaxhighlight> This requires pushing state inside the O structure. Two natural semantics: # Shared-state semantics: meta-levels and base-level share one global S. That is, O computations access the same S. If the O structure is such that we can push s into each leaf and reconstruct, an appropriate Ξ» may exist. For Tree, one could attempt: ``<code> Ξ» (h : S -> (Tree A Γ S)) := Node MergeOp [ ... ] ??? </code>`` but in general coordinating the threaded state across branching Node requires design decisions (how nodes interleave, whether branches run in sequence or in parallel, whether to merge resulting states). # Isolated-state semantics (practical): prefer StateT S O or O applied over State depending on semantics: - StateT S O A := S -> O (A Γ S) β meta-runner with global state threaded inside O. - O (State S A) := O (S -> (A Γ S)) β meta-structures each have stateful computations as leaves. Hence, instead of proving existence of Ξ» in general, the practical engineering solution is to stack monads with StateT or State transformer and choose composition according to desired semantics. This is the standard pattern in applicative/monad transformer design (Haskell-style). If you want a formal distributive law existence proof for a particular O and a chosen state semantics, give me O concretely (e.g., this Tree with merge semantics) and Iβll build/verify Ξ».
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)