Skip to Content
Applied SciencesApplied Sciences
  • Article
  • Open Access

16 January 2026

Constructing Non-Markovian Decision Process via History Aggregator

,
and
School of Computer Science, Peking University, Beijing 100871, China
*
Author to whom correspondence should be addressed.

Abstract

In the domain of algorithmic decision-making, non-Markovian dynamics manifest as a significant impediment, especially for paradigms such as Reinforcement Learning (RL), thereby exerting far-reaching consequences on the advancement and effectiveness of the associated systems. Nevertheless, the existing benchmarks are deficient in comprehensively assessing the capacity of decision algorithms to handle non-Markovian dynamics. To address this deficiency, we have devised a generalized methodology grounded in category theory. Notably, we established the category of Markov Decision Processes (MDP) and the category of non-Markovian Decision Processes (NMDP), and proved the equivalence relationship between them. This theoretical foundation provides a novel perspective for understanding and addressing non-Markovian dynamics. We further introduced non-Markovianity into decision-making problem settings via the History Aggregator for State (HAS). With HAS, we can precisely control the state dependency structure of decision-making problems in the time series. Our analysis demonstrates the effectiveness of our method in representing a broad range of non-Markovian dynamics. This approach facilitates a more rigorous and flexible evaluation of decision algorithms by testing them in problem settings where non-Markovian dynamics are explicitly constructed.

1. Introduction

Decision-making algorithms, such as RL, generally demand that the problem satisfy the Markov assumption, which posits that the current observation encapsulates all accessible information for decision-making, rendering past observations irrelevant. However, many real-world systems do not adhere to this assumption. For example, control systems often exhibit non-Markovianity due to limited sensor information about internal states [1]. Similarly, open quantum systems display non-Markovian characteristics due to complex interactions with their external environment [2]. Such non-Markovian environments are prevalent in real-world applications, including human physiology, biological systems, and material science [3].
To characterize and solve non-Markovian decision problems, a variety of theoretical models beyond the basic MDP formulation have been proposed. These approaches primarily follow two conceptual strands: state abstraction and reward specification.
The first strand aims to convert an NMDP into a solvable MDP by learning a compact representation of history. Markov Abstraction methods [4,5,6,7,8,9,10] fall into this category, where the core idea is to compress the entire history or learn an approximate Markovian state, effectively “solving” the non-Markovianity through representation learning. While powerful, the quality of the abstraction is algorithm-dependent and may inadvertently alter the problem’s inherent difficulty due to information loss.
The second strand focuses on formally specifying the non-Markovian structure, particularly in reward functions. Automaton or logic-based models, such as Reward Machines (RM) [11,12] and Regular Decision Processes (RDP) [13,14], use finite-state automata or temporal logic to explicitly encode complex task objectives and reward dependencies over time. These methods excel at providing interpretable task specifications but are primarily designed for non-Markovian rewards rather than general state transition dynamics.
While offering valuable tools, these existing theoretical models are diverse in formulation and objectives. Crucially, they are often designed to eliminate or specify non-Markovianity for the purpose of solving a given problem. In contrast, there lacks a unified framework to systematically construct non-Markovian problems with controllable temporal dependencies from first principles, a capability essential for generating standardized benchmarks to impartially evaluate algorithm performance. This gap motivates our work.
Table 1 compares our approach with representative paradigms in the literature at the conceptual level. Unlike methods that aim to “solve” non-Markovianity (e.g., by learning abstractions, specifying rewards, or handling partial observability), our HAS framework aims to “construct” non-Markovianity. This provides a generative paradigm that starts from a base MDP and yields NMDPs with clear, controllable dependency structures. Consequently, it enables a pure evaluation of an algorithm’s capability in history memorization and decoding, disentangled from changes in the inherent problem difficulty or confusion with distinct problem classes like POMDPs.
Table 1. Comparison with representative paradigms for handling non-Markovianity.
In response, we establish the MDP category and the NMDP category, providing a unified and rigorous view within the framework of category theory. Under this framework, any general approach that converts NMDPs into MDPs while preserving the transition dynamics can be seen as a functor from the NMDP category to the MDP category. This framework not only encapsulates the essence of preceding research but also paves the way for devising novel strategies to tackle non-Markovian decision problems. Moreover, the utilization of the category theory perspective facilitates a deeper understanding of the relationship between MDP and NMDP. We prove that the MDP category and the NMDP category are equivalent categories based on the intuition that any NMDP can be transformed into an MDP, given that the entire history can be regarded as a state.
Numerous algorithms have emerged to solve non-Markovian decision problems. However, an algorithm that is both commonly accepted and highly effective for NMDPs remains elusive. The evaluation of such algorithms relies on non-Markovian decision problems, which poses a set of challenges. For instance, ref. [15] utilizes a multi-armed bandit and robot grid world with non-Markovian rewards; ref. [3] employs a blood glucose control simulation environment; ref. [5] uses Rotating MAB, Malfunction MAB, Enemy Corridor, Reset—Rotating MAB, and Flickering grid; ref. [16] uses an office grid-world scenario; ref. [17] uses modified Mujoco environments; ref. [18] uses modified Cartpole and mountain Car, along with a controlled non-Markovian random walk. The non-Markovian environments described in the literature, which are scattered and unsystematic, originate from diverse fields. Moreover, most of these environments are either obtained through simple construction or derived from masking some part of the observation in existing MDP, that is, by transforming it into a Partially Observable MDP (POMDP), which may change the internal difficulty because of information loss in the observation. Their simplicity and lack of standardization impede the development of a universal benchmark, thereby limiting the ability to comprehensively evaluate how effectively algorithms can manage non-Markovian dynamics.
To address this gap, we develop a method for constructing NMDPs from MDPs via a reversible History Aggregator for State (HAS). The core idea is to inject controllable temporal dependencies into the state representation by aggregating historical states. The reversibility condition is crucial: it ensures the original MDP state can be losslessly decoded from the NMDP’s full history, thereby preserving the problem’s inherent transition dynamics and optimal performance bound. This allows for a pure assessment of a decision-making algorithm’s core capability in memorizing and decoding history to manage non-Markovianity, isolated from changes in base problem difficulty.
We propose two practical, reversible HAS implementations. The first employs a group operator (e.g., vector addition) for aggregation, inspired by how prefix sums increase Markov order. The second uses convolution with an auxiliary sequence to assign time-decaying weights to past states. As states are typically real-valued vectors, both methods are efficiently implemented using linear algebra. Critically, the constructed NMDPs maintain the same interface as the original MDP, enabling the direct application of any algorithm without modification. This facilitates a direct comparison of performance degradation solely attributable to introduced non-Markovian dependencies.
In summary, this work establishes a new paradigm for principled construction and evaluation in non-Markovian decision-making. Our primary contributions are:
  • A Unifying Categorical Foundation: We establish and prove the equivalence of the MDP and NMDP categories, providing a unified theoretical lens.
  • A Generative Framework for Controlled Non-Markovianity: We introduce the reversible HAS framework to systematically construct NMDPs with precise, tunable temporal dependencies from any base MDP.
  • Practical, Tunable Construction Methods: We instantiate the framework with two implementable HAS classes (group-based and convolution-based), enabling fine-grained control over dependency structures.
  • A Practical Benchmarking Tool: We provide efficient Gymnasium-compatible wrappers to seamlessly convert standard RL benchmarks, enabling reproducible, pure evaluation of algorithmic memory and decoding capabilities.
The ultimate goal is to shift from ad-hoc problem adaptation to principled problem construction. The outcome is a coherent pipeline that transforms canonical MDPs into a family of NMDP benchmarks with clear, tunable non-Markovian characteristics, filling a critical gap in the evaluation toolbox for sequential decision-making.
In Section 2, we introduce the fundamentals of category theory, MDP, and NMDP, along with the basics of algebra. This serves as essential background for understanding our work. In Section 3, we formally describe and prove the equivalence of the MDP and NMDP categories. This not only unifies the two concepts but also naturally leads to the method of constructing NMDPs in the subsequent section. Section 4 presents the definition of HAS, two construction methods using reversible HAS, and an analysis of their properties. These methods innovatively introduce non-Markovianity while preserving the original nature of the problem. Although the main contribution of our work is theoretical, we convert some classical MDPs into NMDPs and conduct several empirical experiments using some RL algorithms in Section 5. This validates our theoretical framework and demonstrates its applicability. The Appendix A, Appendix B, Appendix C, Appendix D, Appendix E, Appendix F, Appendix G, Appendix H, Appendix I, Appendix J, Appendix K and Appendix L provide mathematical proofs, illustrative examples, and intuitive explanations of key concepts. This allows the main text to focus on the key ideas without being cluttered with details. Overall, our work offers a comprehensive, novel, and practical solution for constructing non-Markovian decision problems.

2. Preliminaries

2.1. Notations

In the following, we denote by Δ X : = { p p : X [ 0 , ) , x X p ( x ) = 1 } the set of all probability distributions on the set X, denote by f n an n-variable function created from the unary function f in the manner of f n ( x 1 , x 2 , , x n ) : = ( f ( x 1 ) , f ( x 2 ) , , f ( x n ) ) , and denote by x m : n ( m , n N , m n ) a finite sequence { x i } i = m n . We do not distinguish between x n : n and x n in the following.

2.2. Category Theory

A category is a system of related objects. The objects do not live in isolation: there is some notion of morphism, or equivalently, map, between objects, binding them together [19]. Category theory delves into the relationships between objects and morphisms. Objects can be of any nature, and morphisms denote the relations or transformations linking these objects. For example, all groups together with all group homomorphisms form a category of groups, and any partially ordered set can also form a category. This theory offers a potent framework for apprehending mathematical structures. By distilling common traits, category theory allows for a unified analysis across diverse mathematical domains. It uncovers profound connections and streamlines intricate concepts, presenting a more coherent view of mathematics.
Definition 1 (Category).
A category C consists of:
  • a collection o b ( C ) of  objects;
  • for each A , B o b ( C ) , a collection C ( A , B ) of  morphisms  from A to B ;
  • for each A , B , C o b ( C ) , a function
    C ( A , B ) × C ( B , C ) C ( A , C ) ( g , f ) g f
    called  composition;
  • for each A o b ( C ) , an element 1 A C ( A , A ) , called the  identity  on A .
satisfying the following axioms:
  • associativity: for each f C ( A , B ) , g C ( B , C ) , h C ( C , D ) we have ( h g ) f = h ( g f ) ;
  • identity: for each f C ( A , B ) , we have f = f 1 A = 1 B f .
Just as morphisms convey intra-category object relations or transformations, functors represent inter-category ones.
Definition 2 (Functor).
Let A , B be categories. A functor  F : A B consists of:
  • a function o b ( A ) o b ( B ) written as A F ( A ) ;
  • for each A , A A , a function
    A ( A , A ) B ( F ( A ) , F ( A ) )
    written as f F ( f ) ; satisfying the following axioms:
    F ( f f ) = F ( f ) F ( f ) if A f A f A in A ;
    F ( 1 A ) = 1 F ( A ) if A A .
The collection of functors from A to B also forms a category Fun ( A , B ) .

2.3. Algebra

Definition 3 (Semigroup).
Let S be a non-empty set, · : S × S S is a binary operator, if the following axioms hold:
  • closure: a , b S , a · b S ;
  • associativity: a , b , c S , a · ( b · c ) = ( a · b ) · c .
Then ( S , · ) forms a semigroup.
If there exists a unit  e S in a semigroup ( S , · ) such that a S , a · e = e · a = a , then ( S , · ) becomes a monoid.
Definition 4 (Group).
Let ( G , · ) be a monoid, e is the unit, if the following axiom holds:
  • inverse: a G , a 1 G , a 1 · a = a · a 1 = e .
Then ( G , · ) forms a group.
If the operator in a group ( G , · ) is commutative, i.e., a , b G , a · b = b · a , then ( G , · ) is an Abelian group.
Definition 5 (Ring).
Let R be a non-empty set, if ( R , · ) forms a semigroup, ( R , + ) forms an Abelian group with unit 0 R , and the following axioms hold:
  • left distributivity: a , b , c R , a · ( b + c ) = a · b + a · c ;
  • right distributivity: a , b , c R , ( b + c ) · a = b · a + c · a .
Then ( R , + , · ) forms a ring.
If the operator · in ring ( R , + , · ) is commutative, then ( R , + , · ) becomes a commutative ring, and if ( R , · ) is a monoid with unit 1, then ( R , + , · ) becomes a unital ring with unit 1.
Definition 6 (Left R -Module).
Let ( R , + , · ) be a ring, ( M , ) be an Abelian group, if there exists a map R × M M under which the image of any ( r , m ) R × M is denoted as r m M , and the following axioms hold:
  • R -distributivity:
    r R , m , m M , r ( m m ) = r m r m
  • M -distributivity:
    r , r R , m M , ( r + r ) m = r m r m
  • associativity:
    r , r R , m M , r ( r m ) = ( r · r ) m
  • identity: if ( R , + , · ) is a unital ring with unit 1, then m M , 1 m = m .
Then M is called a left R-module.
A left R-module is a generalization of a linear space. When R becomes a field, left R-module M becomes a linear space.

2.4. MDP and NMDP

Before setting up the MDP and NMDP categories, we define them.
Definition 7 (Markov Decision Process (MDP)).
An MDP M is a tuple ρ 0 , S , A , { T t } t = 0 consisting of:
  • Initial state distribution ρ 0 Δ S ;
  • State set S;
  • Action set A;
  • Transition dynamics at time t:
    T t : S × A Δ S × R
A policy for an MDP at time t is defined as π t : S Δ A . An MDP is called degenerate if s , s S , t N , a A , T t ( s , a ) = T t ( s , a ) , which means there are indistinguishable states in S.
Note that, by definition, an MDP is not necessarily time-homogeneous. However, any non-time-homogeneous MDP can be converted into a time-homogeneous MDP by extending the state set S to be a subset of N × S , where each state is associated with its timestep, i.e., s t ( t , s t ) and T : ( ( t , s t ) , a ) T t ( s t , a ) .
Definition 8 (Non-Markov Decision Process (NMDP)).
An NMDP N is a tuple ρ 0 , S , A , { T t } t = 0 consisting of:
  • Initial state distribution ρ 0 Δ S ;
  • State set S;
  • Action set A;
  • Transition dynamics at time t:
    T t : S t + 1 × A t × R t × A Δ S × R
A policy for an NMDP at time t is π t : S t + 1 × A t × R t Δ A . The history set at time t for an MDP or an NMDP is H t : = S t + 1 × A t × R t , with which transition dynamics and policy of an NMDP can be rewritten as T t : H t × A Δ S × R , π t : H t Δ A . The history set H for an MDP or an NMDP is defined as the disjoint union of all H t , i.e., H : = t = 0 H t . The proper prefix relation between h and h is denoted as h h , indicating that h is a proper prefix of h , i.e., h = ( s 0 : t , a 0 : t 1 , r 0 : t 1 ) and h = ( s 0 : t + k , a 0 : t + k 1 , r 0 : t + k 1 ) , k N + .
With the concept of the history set for both MDPs and NMDPs, we can define operators that extract states, actions, and rewards from a history.
Definition 9 (States, Actions, and Rewards Extraction Operators).
The states, actions, and rewards extraction operators are:
  • E S : h t s 0 : t ( t N , h t H t ) ;
  • E A : h t a 0 : t 1 ( t N + , h t H t ) ;
  • E R : h t r 0 : t 1 ( t N + , h t H t ) .
Definition 10 (Latest State, Action, and Reward Extraction Operators).
The latest state, action, and reward extraction operators at time t are:
  • L S , t : h t s t ( t N , h t H t ) ;
  • L A , t : h t + 1 a t ( t N , h t + 1 H t + 1 ) ;
  • L R , t : h t + 1 r t ( t N , h t + 1 H t + 1 ) .

3. Equivalence of MDP and NMDP Category

In this section, we present the definitions of the MDP category and the NMDP category, together with the theorem regarding their equivalence relationship. The proofs of their well-definedness are provided in the Appendix A and Appendix B.
Definition 11 (MDP Category).
M is a category where:
  • Objects: The objects are MDPs in the form of M = ρ 0 , S , A , { T t } t = 0 ;
  • Morphisms: A morphism ϕ = ( ϕ S , ϕ A , ϕ R ) from M = ρ 0 , S , A , { T t } t = 0 to M = ρ 0 , S , A , { T t } t = 0 where ϕ S : S S , ϕ A : A A , ϕ R : R R , satisfies the following properties:
    ρ 0 = ρ 0 ϕ S ;
    T t ( s , a ) = ( ( T t ( ϕ S , ϕ A ) ) ( s , a ) ) ( ϕ S , ϕ R ) , ( t N , s S , a A ) .
    Identity: 1 M = ( 1 S , 1 A , 1 R ) ;Composition: composition of ( ϕ S , ϕ A , ϕ R ) and ( ϕ S , ϕ A , ϕ R ) is ( ϕ S ϕ S , ϕ A ϕ A , ϕ R ϕ R ) .
Definition 12 (NMDP Category).
N is a category where:
  • Objects: The objects are NMDPs in the form of N = ρ 0 , S , A , { T t } t = 0 ;
  • Morphisms: A morphism ψ = ( ψ S , ψ A , ψ R ) from N = ρ 0 , S , A , { T t } t = 0 to N = ρ 0 , S , A , { T t } t = 0 where ψ S : S S , ψ A : A A , ψ R : R R , satisfies the following properties:
    ρ 0 = ρ 0 ψ S ;
    T t ( h t , a ) = ( ( T t ( ψ H t , ψ A ) ) ( h t , a ) ) ( ψ S , ψ R ) , ( t N + , h t H t , a A ) , where ψ H t = ( ψ S t + 1 , ψ A t , ψ R t ) .
    Identity: 1 N = ( 1 S , 1 A , 1 R ) ;  Composition: composition of ( ψ S , ψ A , ψ R ) and ( ψ S , ψ A , ψ R ) is ( ψ S ψ S , ψ A ψ A , ψ R ψ R ) .
A morphism in either category represents that the transition dynamics of the source decision process can be “simulated” by the target.
As discussed in Section 1, previous algorithmic works have sought functors in Fun ( N , M ) , which can generally be summarized as approximations of the Markov abstraction functor M Fun ( N , M ) , utilizing various techniques to compress history. In contrast to what is described in the existing literature, our definition of Markov abstraction retains the entire history without any compression.
Definition 13 (Markov Abstraction).
Markov abstraction is a functor M : N M . For any N = ρ 0 , S , A , { T t } t = 0 N there exists M = M ( N ) = ρ 0 , S , A , { T t } t = 0 M , ρ 0 = ρ 0 , A = A , which satisfies the following properties:
  • S = H , where H is the history set of N ;
  • T t : S × A Δ S × R ( h t , a ) ( T t ( h t , a ) ) ( L S , t + 1 , 1 R ) .
Note that an MDP is a special case of an NMDP, which naturally induces the non-Markov embedding functor denoted as N Fun ( M , N ) . M and N are well-defined functors (Proof in Appendix C and Appendix D).
Definition 14 (Non-Markov Embedding).
Non-Markov embedding is a functor N : M N . For any M = ρ 0 , S , A , { T t } t = 0 M , there exists N = N ( M ) = ρ 0 , S , A , { T t } t = 0 N , ρ 0 = ρ 0 , S = S , A = A , which satisfies the following property:
  • T t : H t × A Δ S × R ( h t , a ) ( T t ( L S , t , 1 A ) ) ( h t , a ) .
Although M and N have distinct properties by definition, we discover that they are equivalent categories. This leads to the following theorem (Proof in Appendix E).
Theorem 1 (Equivalence of M and N ).
Category M and N are equivalent through functor M and N , i.e., M N 1 M , N M 1 N .

4. NMDP Constructed from MDP via HAS

Unlike many algorithmic studies that focus on developing functors in Fun ( N , M ) to handle NMDP’s history more effectively, our work focuses on constructing functors in Fun ( M , N ) for transforming MDPs into NMDPs. While N is such a functor, it is trivial since, in the constructed NMDP, the states prior to the current time are essentially irrelevant to decision-making. However, our interest lies in functors that can substantially incorporate non-Markovian transition dynamics into MDPs. To this end, we first introduce the History Aggregator for State (HAS), which enables us to construct such functors. Similarly, we can also define the History Aggregator for Reward (HAR), which substantially incorporates non-Markovian reward mechanisms into MDPs. As HAR is not the main content of this paper, we discuss it in the Appendix K. All proofs of theorems in this section are provided in Appendix F, Appendix G, Appendix H, Appendix I and Appendix J.
Definition 15 (History Aggregator for State (HAS)).
For any MDP M = ρ 0 , S , A , { T t } t = 0 , an HAS A S : = { A S , t } t = 0 is a series of maps in which A S , t : H t A ( H ) , ( t N ) where A ( H ) represents a set called the target state set of A S .
As the name implies, the HAS constructs the NMDP state by aggregating the MDP history. Before detailing our method, we first require that the aggregators be reversible.
Definition 16 (Reversibility of HAS on MDP).
An HAS A S = { A S , t } t = 0 on MDP M = ρ 0 , S , A , { T t } t = 0 is reversible iff there exists a series of maps, denoted as A S : = { A S , t } t = 0 , which satisfy:
A S , t ( { A S , τ ( h τ ) } τ = 0 t ) = s t , ( t N )
where h τ H τ , h 0 h 1 h t , s t = L S , t ( h t ) .
The reversibility condition of HAS ensures that a decision-making algorithm can reconstruct the original MDP state from the history of the NMDP. A reversible HAS-based transformation neither alters the transition dynamics of the original MDP nor increases its inherent complexity. Consequently, the performance upper bound for the NMDP is identical to that of the original MDP. Thus, once we know the best achievable performance of the original MDP, we can set the same expectations for the constructed NMDP. By ensuring that the transformation from the MDP to the NMDP does not increase the inherent difficulty of the original but only requires effective management of the NMDP’s history, we can more accurately evaluate a decision-making algorithm’s ability to handle non-Markovianity through encoding and memorization of NMDP’s history.
Noticing that the latest state extraction operators constitute reversible HAS, we have the following corollary.
Corollary 1.
The series of latest state extraction operators, L S : = { L S , t } t = 0 , constitutes a reversible HAS on MDP with a target state set identical to the state set.
When any reversible HAS is applied to an MDP, it generates an NMDP. The NMDP’s state set encompasses all aggregated histories of the original MDP. Its transition dynamics take the NMDP’s history as input, decode it into an MDP state, and then apply the MDP’s transition dynamics.
Definition 17 (Application of Reversible HAS to MDP).
The application of a reversible HAS A S = { A S , t } t = 0 to an MDP M = ρ 0 , S , A , { T t } t = 0 is an NMDP N = ρ 0 , S , A , { T t } t = 0 , A = A in which ρ 0 = ρ 0 A S , 0 ; S = A ( H ) , where H is the history set of M , H is the history set of N ;
T t : H t × A Δ S × R ( h t , a ) ( ( T t ( A S , t E S , 1 A ) ) ( h t , a ) ) G S , h t , 1 R
where G S , h t : S S s t + 1 A S , t + 1 E S ( h t ) , s t + 1 .
The decoding process, denoted as A S , t is the source of non-Markovianity. This is because, in the general case, decision-making algorithms have to remember the NMDP’s entire history to decode the MDP’s current state.
Although reversible HAS naturally induces functors in Fun ( M , N ) , the definition of reversible HAS alone does not directly produce implementations, necessitating further specification.
For simplicity and practicality in implementation, we restrict our construction to using states alone, not the entire history. Given this constraint, we examine two types of HAS constructions: one using just states, and the other relying on auxiliary sequences.

4.1. HAS Constructed Using Just States

One straightforward way to construct HAS using just states is introducing a binary operator on the state set.
Definition 18 (HAS Induced by Binary Operator).
The HAS B S : = { B S , t } t = 0 on MDP M = ρ 0 , S , A , { T t } t = 0 induced by a binary operator : S × S S is:
B S , t : H t S h t τ = 0 t s τ
where { s τ } τ = 0 t = E S ( h t ) , τ = 0 0 s τ : = s 0 , and τ = 0 k + 1 s τ : = ( τ = 0 k s τ ) s k + 1 , ( k [ 0 , t ) N ) .
According to the above definition, for the HAS induced by operator ⊗ to be reversible, it is sufficient for ⊗ to be a group operator, meaning ( S , ) forms a group. This approach is quite general since any state set can be extended to form a group, like a free group. Moreover, in practical problems, states are typically represented as vectors in R n , and R n forms a group under vector addition.
Theorem 2 (Reversibility of HAS Induced by Group Operator).
The HAS G S on MDP M = ρ 0 , S , A , { T t } t = 0 induced by binary operator is reversible if ( S , ) is a group.
Let G Fun ( M , N ) denote the functor induced by G S . The proof of Theorem 2 in the Appendix F shows that G generates an NMDP. Unlike non-Markov embedding, the HAS G S does introduce non-Markovianity. It transforms an MDP, where decisions rely only on the current state, into an NMDP that requires knowledge of both the current and previous one-step state for decision-making. However, this state dependency structure is inadequate. Later, we’ll show that repeated application of this HAS can yield a more complex state dependency structure.
Definition 19 (State Dependency Structure of NMDP History).
The state dependency structure D h t of a history h t = ( s 0 : t , a 0 : t 1 , r 0 : t 1 ) of NMDP N = ρ 0 , S , A , { T t } t = 0 is a subset of N
D h t : = i s S , a A , T t ( σ i ( h t , s ) , a ) T t ( h t , a )
where σ i ( h t , s ) = ( ( s 0 : i 1 , s , s i + 1 : t ) , a 0 : t 1 , r 0 : t 1 ) .
According to the above definition, i D h t implies that s i has an impact on the state transition. Replacing it leads to a change in the subsequent transition probabilities. The concept of state dependency structure can also be extended to MDPs by defining it in terms of the state dependency structure of the MDP’s non-Markov embedding. It has been observed that applying G once to an MDP can increase the number of aggregated histories required to reconstruct the original MDP state in the resulting NMDP, thereby expanding the cardinality of the state dependency structure. Consequently, we explore applying G multiple times to the MDP to generate NMDPs with more complex temporal dependencies. To facilitate the application of reversible HAS to NMDPs, and without significant loss of generality, we assume that the transition dynamics of the NMDP depend solely on the state component of the history. The extension required to apply the reversible HAS to the NMDP is presented in the Appendix L. With a slight abuse of notation, we let G Fun ( N , N ) also denote the functor induced by HAS.
Theorem 3 (Impact of G on State Dependency Structure).
For any MDP M = ρ 0 , S , A , { T t } t = 0 , if it is non-degenerate, then the functor G induced by some group operator on S ensures that the dependency structure D h t n of any history h t n H t n of G n ( M ) satisfies D h t n = [ t n , t ] N .
The significance of Theorem 3 lies in its provision of a general method for designing a transition mechanism for an NMDP that relies on the states of the previous n + 1 steps. Specifically, it is sufficient to apply G functor n times to a non-degenerate MDP.

4.2. HAS Constructed Using Auxiliary Sequences

Another approach to aggregating states is using auxiliary sequences to assign importance weights to these states. In this way, a binary operator is required to connect an auxiliary sequence with the sequence of states.
Definition 20 (HAS Induced by Auxiliary Sequences and Binary Operator).
The HAS W S : = { W S , t } t = 0 on MDP M = ρ 0 , S , A , { T t } t = 0 induced by a series of auxiliary sequences W : = { W t } t = 0 : = { { w τ t } τ = 0 t } t = 0 and a binary operator : W × E S ( H ) S is:
W S , t : H t S h t { w τ t } τ = 0 t { s τ } τ = 0 t
where { s τ } τ = 0 t = E S ( h t ) .
The binary operator ∗ does not specify how the auxiliary sequence elements interact with the state sequence elements. Therefore, we define two operators to determine this interaction, one operator · : t = 0 W t × S S to apply an item in the auxiliary sequence to a state, the other operator : S × S S to aggregate two states. Without too much loss of generality, we restrict our discussion to left R-modules, where ( S , ) forms an Abelian group, · is a scalar multiplication operator, and t = 0 W t becomes a unital ring with operators defined. We use R S to denote such an HAS.
Additionally, the correspondence between the elements of the auxiliary sequence and the elements of the state sequence needs to be specified. For the sake of simplicity in the subsequent discussion, we consider only two types of correspondence, where the auxiliary sequences are prefixes of a given sequence { w τ } τ = 0 : : ( { w τ } τ = 0 t , { s τ } τ = 0 t ) τ = 0 t ( w τ · s τ ) : ( { w τ } τ = 0 t , { s τ } τ = 0 t ) τ = 0 t ( w τ · s t τ ) . where is referred to as correlation operator, and is referred to as convolution operator.
We examine the reversibility of HAS in these two cases separately. For the correlation operator case, we have the following theorem:
Theorem 4 (Reversibility of HAS induced by Auxiliary Sequence and Correlation Operator).
The HAS R S : = { R S , t } t = 0 induced by prefixes of auxiliary sequence { w t } t = 0 and operator is reversible if each w t is invertible in the ring.
Based on the proof in the Appendix H, it is obvious that the correlation operator only results in each set of the dependency structure of the constructed NMDP having a potential of no more than 2, which is similar to the effect of a group operator. Therefore, we focus on discussing the properties of the convolution operator.
For the convolution operator case, we have the following theorem:
Theorem 5 (Reversibility of HAS induced by Auxiliary Sequence and Convolution Operator).
The HAS R S : = { R S , t } t = 0 induced by prefixes of auxiliary sequence { w t } t = 0 and operator is reversible if w 0 is invertible in the ring.
We use R Fun ( M , N ) to denote the functor induced by reversible R S and operator , then we have the following theorem about its impact on the state dependency structure of the NMDP.
Theorem 6 (Impact of R on State Dependency Structure).
For any MDP M = ρ 0 , S , A , { T t } t = 0 , if it is non-degenerate, then the functor R induced by prefixes of auxiliary sequence { w τ } τ = 0 and operator ensures that the dependency structure D h t of any history h t H t of R ( M ) satisfies D h t = { t τ ( w 1 ) 0 , τ 0 } , where w 1 is the inverse matrix of w in the ring, 0 is the zero element of the ring.
The proof of Theorem 6 indicates that it is possible to achieve any specific state dependency structure in the history of the constructed NMDP by modifying the elements of the upper triangular band matrix w 1 . This provides a general method for designing NMDPs with desired state dependency structures.

5. Experiments

Although the main contribution of this paper is theoretical, we have designed and implemented several highly versatile environment wrappers based on the two methods proposed in Section 4 for constructing functors in Fun ( M , N ) : the group-operator-based and the convolution-based method. These wrappers are implemented using a computationally efficient approach with a time complexity of O ( n ) and can be applied to environments that conform to the Gymnasium [20] interface.
We use the PPO [21] algorithm implemented in the Stable-Baselines3 library [22] and the LSTM-PPO algorithm of the Stable-Baselines3-Contrib library [22] as standard reinforcement learning algorithms. These algorithms are tested in Gymnasium environments wrapped with our wrappers, with reinforcement learning training experiments conducted using the framework provided by the RL-Baselines3-Zoo library [23].
We assume s 1 : = 0 , λ [ 0 , 1 ] , k t , s t R k , and employ the following functor to implement wrappers:
  • S induced by HAS S S , t : h t τ = 0 t s τ ;
  • D induced by HAS D S , t : h t s t s t 1 ;
  • S λ induced by HAS S S , t λ : h t τ = 0 t λ τ s t τ ;
  • D λ induced by HAS D S , t λ : h t s t λ s t 1 .
From the definitions of S , D , S λ , D λ , we can derive the state dependency structure of histories in the NMDP under their application. S , S λ introduce dependencies of s t , s t 1 , and D , D λ introduce dependencies of s 0 : t . The state dependency weights induced by S λ and D λ exhibit an exponential decay with respect to the temporal distance from the current time step, governed by the factor λ , while S and D introduce uniformly distributed dependency.
Our experiments use CartPole-v1 and Pendulum-v1 as the base MDP environments, and we employ the following functors to obtain the NMDP environments:
S n , D n   for   n { 0 , 1 , 2 , 3 , 4 , 5 }
S λ , D λ   for   λ { 0 5 , 1 5 , 2 5 , 3 5 , 4 5 , 5 5 }
All hyperparameters required for training were kept at their default settings from the RL-Baselines3-Zoo library, and the training process was initiated using the library’s provided command-line instructions. Each combination of environment, wrapper, and algorithm was trained 3 times, 10 6 timesteps for each time, evaluated every 2 × 10 5 timesteps, and the checkpoints with the best average episode reward were selected.
Theoretically, an increase in n of S n and D n or λ of S λ and D λ makes the non-Markov environment more challenging for RL algorithms to solve, as it introduces more complex temporal dependencies. As shown in Figure 1, the results of our experiments also indicate this property: the average episode reward, plotted as a function of n or λ , generally shows a declining trend for each combination of environment, algorithm, and wrapper.
Figure 1. Experimental results for each combination of environment, algorithm, and wrapper. (a) CartPole-v1 with S n , D n wrappers; (b) CartPole-v1 with S λ , D λ wrappers; (c) Pendulum-v1 with S n , D n wrappers; (d) Pendulum-v1 with S λ , D λ wrappers; The x-axis represents the wrapper parameter, while the y-axis shows the average episode reward. Lines of different colors indicate different combinations of algorithms and wrapper types.
Another conclusion drawn from the experimental results is that, for any given combination of environment and algorithm, the performance degradation caused by increasing λ from 0 to 1 is comparable to the degradation resulting from increasing n from 0 to 1. This observation is consistent with our theoretical analysis, which shows that increasing λ from 0 to 1 progressively introduces a greater dependence on previous states, eventually matching the dependence introduced by a wrapper with n = 1 .
By comparing the performance of the PPO and LSTM-PPO algorithms in environments wrapped with varying degrees of dependency complexity, we observe that LSTM-PPO outperforms PPO when the dependencies are more complex. This is due to LSTM-PPO’s ability to recall past states, which also aligns with our intuition.

5.1. Comparative Analysis of the Proposed Framework

To systematically illustrate the advantages of our proposed framework and how it addresses the limitations of existing studies, we provide a comparative analysis in Table 2. Our approach, grounded in category theory and reversible HAS, offers a unified, flexible, and theoretically sound methodology for constructing non-Markovian decision processes, overcoming the ad-hoc, information-lossy, and unsystematic nature of prior methods.
Table 2. Comparison between existing studies and the proposed framework on constructing non-Markovian decision processes.
As demonstrated in Table 2, our framework not only overcomes key weaknesses in prior art but also provides a flexible, theoretically grounded, and practical toolkit for constructing non-Markovian decision problems, thereby facilitating more rigorous and comparable evaluation of decision-making algorithms.

5.2. Practical Implications and Target Audience

The proposed framework and experimental results are designed to serve a broad spectrum of researchers and practitioners working on decision-making under temporal dependencies. Specifically, the following groups are poised to benefit most from our work:
  • Reinforcement Learning Researchers studying non-Markovian environments, memory-based architectures, or partial observability can use our HAS-based construction method to generate benchmark environments with controllable and reversible temporal dependencies. This allows for systematic ablation studies on how different dependency structures affect algorithm performance, without confounding factors such as information loss or altered task difficulty.
  • Algorithm Developers aiming to evaluate the robustness of RL algorithms (e.g., PPO, LSTM-based agents) in non-Markovian settings can adopt our Gymnasium-compatible wrappers to seamlessly convert existing Markovian benchmarks into non-Markovian variants. Our results provide a clear reference: algorithms with memory mechanisms (like LSTM-PPO) consistently outperform memory-less counterparts as dependency complexity increases, underscoring the importance of architectural choices in such settings.
  • Decision System Designers in Applied Fields (e.g., robotics, healthcare, finance) where real-world dynamics often exhibit non-Markovian characteristics can leverage our framework to “stress-test” their policies in progressively more realistic environments. By tuning parameters such as n in S n or λ in S λ , they can simulate varying degrees of historical influence, thus identifying the memory capacity required for robust decision-making in their specific domain.
In summary, our work provides not only a theoretical foundation but also a practical toolkit for constructing, analyzing, and benchmarking decision processes beyond the Markovian assumption, thereby supporting more rigorous and generalizable progress in algorithmic decision-making.

6. Summary and Future Work

We propose a general and effective method to construct NMDPs from MDPs using techniques from category theory and algebra. Our method provides a comprehensive way to evaluate decision-making, especially RL algorithms’ ability to handle non-Markovianity through encoding and memorization.
Theoretical analysis demonstrates that our method possesses strong expressive power and can represent a wide variety of temporal state dependency structures. Using this theoretical framework, we transformed classical Markovian environments into non-Markovian ones and tested them with both PPO algorithms, with and without LSTM. This validation confirms our method’s effectiveness in introducing varying degrees of non-Markovian characteristics into Markovian environments.
The examples tested in our experiments represent only a small subset of the cases within the theoretical framework. The functor forms that exhibit desirable properties through our theory are highly diverse, extending beyond those tested. This is due to our proofs being conducted within abstract algebraic structures, which encompass numerous notable specific cases.
Our study also has limitations that warrant further investigation. For instance, we did not explore the introduction of randomness into HAS using random sequences or mappings. Additionally, we did not address the theory of HAR, which remains relevant for reward shaping. Moreover, our theoretical analysis is restricted to reversible HAS, and we have not developed a theory for non-reversible cases. For example, a common method to create non-Markovian environments is by obscuring information in the observations of an MDP to transform it into a POMDP. Combining this method with our approach and exploring their combined expressive power presents a promising avenue for future research.
In future work, we also plan to leverage the HAS framework and Gymnasium-compatible wrappers presented here to establish an open-source benchmark suite for non-Markovian decision processes. This suite will facilitate systematic, reproducible comparisons of various methods, including Reward Machines, Regular Decision Processes, and POMDP conversions, against our HAS-based construction, empirically validating its advantages in generating environments with controllable dependencies and no inherent information loss.

Author Contributions

Conceptualization, methodology, formal analysis, writing: Y.W.; experimental validation, review and editing: L.L.; supervision, project administration, review and editing: W.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The original contributions presented in the study are included in the article, further inquiries can be directed to the corresponding author.

Acknowledgments

During the preparation of this manuscript, the author(s) used DeepSeek V3.1-Terminus for the purposes of manuscript editing. The authors have reviewed and edited the output and take full responsibility for the content of this publication.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
RLReinforcement Learning
PPOProximal Policy Optimization algorithm
MDPMarkov Decision Process
NMDPNon-Markovian Decision Process
HASHistory Aggregator for State
RMReward Machine
RDPRegular Decision Process
MABMultiarmed Bandit
POMDPPartially Observable Markov Decision Process
HARHistory Aggregator for Reward
LSTMLong-Short Term Memory

Appendix A. Proof of Well-Definedness of MDP Category

Lemma A1.
MDP Category M is well-defined.
Proof. 
It is sufficient to prove that the composition of morphisms remains a morphism.
For any MDP M , M , M M and any morphism: ϕ : M M , ϕ : M M , by definition of composition of MDP category we have
ϕ ϕ = ( ϕ S ϕ S , ϕ A ϕ A , ϕ R ϕ R )
Since
ρ 0 = ρ 0 ϕ S
ρ 0 = ρ 0 ϕ S
we have
ρ 0 = ( ρ 0 ϕ S ) ϕ S = ρ 0 ( ϕ S ϕ S ) = ρ 0 ( ϕ ϕ ) S
Similarly, since
T t ( s , a ) = ( ( T t ( ϕ S , ϕ A ) ) ( s , a ) ) ( ϕ S , ϕ R )
T t ( s , a ) = ( ( T t ( ϕ S , ϕ A ) ) ( s , a ) ) ( ϕ S , ϕ R )
take ( s , a ) = ( ϕ S , ϕ A ) ( s , a ) , we have
T t ( s , a ) = ( ( T t ( ϕ S , ϕ A ) ) ( s , a ) ) ( ϕ S , ϕ R )
= ( T t ( ( ϕ S , ϕ A ) ( s , a ) ) ) ( ϕ S , ϕ R )
= ( T t ( s , a ) ) ( ϕ S , ϕ R )
= ( ( ( T t ( ϕ S , ϕ A ) ) ( s , a ) ) ( ϕ S , ϕ R ) ) ( ϕ S , ϕ R )
= ( ( T t ( ϕ S , ϕ A ) ) ( s , a ) ) ( ( ϕ ϕ ) S , ( ϕ ϕ ) R )
= ( ( T t ( ϕ S , ϕ A ) ) ( ( ϕ S , ϕ A ) ( s , a ) ) ) ( ( ϕ ϕ ) S , ( ϕ ϕ ) R )
= ( ( T t ( ( ϕ ϕ ) S , ( ϕ ϕ ) A ) ) ( s , a ) ) ( ( ϕ ϕ ) S , ( ϕ ϕ ) R )
therefore ϕ ϕ is still a morphism, i.e., M is a well-defined category. □

Appendix B. Proof of Well-Definedness of NMDP Category

Lemma A2.
NMDP Category N is well-defined.
Proof. 
It is sufficient to prove that the composition of morphisms remains a morphism.
For any NMDP N , N , N N and any morphism: ψ : N N , ψ : N N , by definition of composition of NMDP category we have
ψ ψ = ( ψ S ψ S , ψ A ψ A , ψ R ψ R )
Since
ρ 0 = ρ 0 ψ S
ρ 0 = ρ 0 ψ S
we have
ρ 0 = ( ρ 0 ψ S ) ψ S = ρ 0 ( ψ S ψ S ) = ρ 0 ( ψ ψ ) S
similarly, we have
T t ( h t , a ) = ( ( T t ( ψ H t , ψ A ) ) ( h t , a ) ) ( ψ S , ψ R )
T t ( h t , a ) = ( ( T t ( ψ H t , ψ A ) ) ( h t , a ) ) ( ψ S , ψ R )
take ( h t , a ) = ( ψ H t , ψ A ) ( h t , a ) , we have
T t ( h t , a ) = ( ( T t ( ψ H t , ψ A ) ) ( h t , a ) ) ( ψ S , ψ R )
= ( T t ( ( ψ H t , ψ A ) ( h t , a ) ) ) ( ψ S , ψ R )
= ( T t ( h t , a ) ) ( ψ S , ψ R )
= ( ( ( T t ( ψ H t , ψ A ) ) ( h t , a ) ) ( ψ S , ψ R ) ) ( ψ S , ψ R )
= ( ( T t ( ψ H t , ψ A ) ) ( h t , a ) ) ( ( ψ ψ ) S , ( ψ ψ ) R )
= ( ( T t ( ψ H t , ψ A ) ) ( ( ψ H t , ψ A ) ( h t , a ) ) ) ( ( ψ ψ ) S , ( ψ ψ ) R )
= ( ( T t ( ψ H t ψ H t , ( ψ ψ ) A ) ) ( h t , a ) ) ( ( ψ ψ ) S , ( ψ ψ ) R )
since
ψ H t = ( ψ S t + 1 , ψ A t , ψ R t )
ψ H t = ( ψ S t + 1 , ψ A t , ψ R t )
we have
ψ H t ψ H t = ( ψ S t + 1 , ψ A t , ψ R t ) ( ψ S t + 1 , ψ A t , ψ R t )
= ( ψ S t + 1 ψ S t + 1 , ψ A t ψ A t , ψ R t ψ R t )
= ( ( ψ ψ ) S t + 1 , ( ψ ψ ) A t , ( ψ ψ ) R t )
= ( ψ ψ ) H t
therefore
T t ( h t , a ) = ( ( T t ( ( ψ ψ ) H t , ( ψ ψ ) A ) ) ( h t , a ) ) ( ( ψ ψ ) S , ( ψ ψ ) R )
which means ψ ψ is still a morphism, i.e., N is a well-defined category. □

Appendix C. Proof of Well-Definedness of Non-Markov Embedding as a Functor

Lemma A3.
Non-Markov embedding N is a well-defined functor from M to N if M , M M , ϕ M ( M , M ) , N ( ϕ ) = ϕ .
Proof. 
For any M = ρ 0 , S , A , { T t } t = 0 , M = ρ 0 , S , A , { T t } t = 0 , M = ρ 0 , S , A , { T t } t = 0 M and any morphism ϕ M ( M , M ) , ϕ M ( M , M ) , denote N : = N ( M ) = ρ 0 , S , A , { J t } t = 0 and N : = N ( M ) = ρ 0 , S , A , { J t } t = 0 .
If the condition ϕ , N ( ϕ ) = ϕ holds, then
N ( 1 M ) = 1 M = ( 1 S , 1 A , 1 R ) = 1 N ( M )
and
N ( ϕ ϕ ) = ϕ ϕ = N ( ϕ ) N ( ϕ )
which means the identity morphisms and associativity of morphisms in M is preserved by N .
Therefore, for the well-definedness of N , we only need to prove that the condition ϕ , N ( ϕ ) = ϕ is compatible with the action of N on o b ( M ) which is given by the definition of N , i.e., N ( ϕ ) = ϕ N ( N , N ) .
Since N does nothing to ρ 0 , ρ 0 ; S , S ; A , A , we only need to prove that the condition is compatible with the action of N on T t , T t .
By the definition of morphisms in M , we have
T t ( s , a ) = ( ( T t ( ϕ S , ϕ A ) ) ( s , a ) ) ( ϕ S , ϕ R )
By the definition of N , we have
J t ( h t , a ) = ( T t ( L S , t , 1 A ) ) ( h t , a )
J t ( h t , a ) = ( T t ( L S , t , 1 A ) ) ( h t , a )
denote s : = L S , t ( h t ) , s : = L S , t ( h t ) then
J t ( h t , a ) = ( T t ( L S , t , 1 A ) ) ( h t , a )
= T t ( ( L S , t , 1 A ) ( h t , a ) )
= T t ( s , a )
= ( ( T t ( ϕ S , ϕ A ) ) ( s , a ) ) ( ϕ S , ϕ R )
= ( T t ( ( ϕ S , ϕ A ) ( s , a ) ) ) ( ϕ S , ϕ R )
= ( T t ( s , a ) ) ( ϕ S , ϕ R )
= ( T t ( ( L S , t , 1 A ) ( h t , a ) ) ) ( ϕ S , ϕ R )
= ( ( T t ( L S , t , 1 A ) ) ( h t , a ) ) ( ϕ S , ϕ R )
= ( J t ( h t , a ) ) ( ϕ S , ϕ R )
= ( J t ( ( ϕ H t , ϕ A ) ( h t , a ) ) ) ( ϕ S , ϕ R )
= ( ( J t ( ϕ H t , ϕ A ) ) ( h t , a ) ) ( ϕ S , ϕ R )
therefore, by definition of morphisms in N , ϕ N ( N , N ) , which means ϕ , N ( ϕ ) = ϕ is compatible with the action of N on T t , T t , i.e., N is a well-defined functor from M to N . □

Appendix D. Proof of Well-Definedness of Markov Abstraction as a Functor

Lemma A4.
Markov abstraction M is a well-defined functor from N to M if N , N N , ψ = ( ψ S , ψ A , ψ R ) N ( N , N ) , M ( ψ ) = ( ψ H , ψ A , ψ R ) , where
H : = t = 0 H t = t = 0 S t + 1 × A t × R t
H : = t = 0 H t = t = 0 S t + 1 × A t × R t
and t N
ψ H : H H ( s 0 : t , a 0 : t 1 , r 0 : t 1 ) ψ H t ( s 0 : t , a 0 : t 1 , r 0 : t 1 )
Proof. 
For any N = ρ 0 , S , A , { J t } t = 0 , N = ρ 0 , S , A , { J t } t = 0 , N = ρ 0 , S , A , { J t } t = 0 N and any morphism ψ N ( N , N ) , ψ N ( N , N ) , denote M : = M ( N ) = ρ 0 , H , A , { T t } t = 0 and M : = M ( N ) = ρ 0 , H , A , { T t } t = 0 , where H : = t = 0 H t = t = 0 S t + 1 × A t × R t , H : = t = 0 H t = t = 0 S t + 1 × A t × R t .
If the condition ψ , M ( ψ ) = ( ψ H , ψ A , ψ R ) holds, then
M ( 1 N ) = 1 N = ( 1 H , 1 A , 1 R ) = 1 M ( N )
and
M ( ψ ψ ) = M ( ( ψ ψ ) S , ( ψ ψ ) A , ( ψ ψ ) R )
= ( ( ψ ψ ) H , ( ψ ψ ) A , ( ψ ψ ) R )
= ( ψ H ψ H , ψ A ψ A , ψ R ψ R )
= ( ψ H , ψ A , ψ R ) ( ψ H , ψ A , ψ R )
= M ( ψ ) M ( ψ )
which means the identity morphisms and associativity of morphisms in N is preserved by M .
Therefore, for the well-definedness of M , we only need to prove that the condition ψ , M ( ψ ) = ( ψ H , ψ A , ψ R ) is compatible with the action of M on o b ( N ) which is given by the definition of M , i.e., M ( ψ ) = ( ψ H , ψ A , ψ R ) M ( M , M ) .
Since M does nothing to ρ 0 , ρ 0 ; A , A , we only need to prove that the condition is compatible with the action of M on S , S ; J t , J t .
For any s S , let s = ψ S ( s ) S . and h t = ( s 0 : t , a 0 : t 1 , r 0 : t 1 ) H , if i , s i = ψ S ( s i ) , a i = ψ A ( a i ) , r i = ψ R ( r i ) , then h t = ( s 0 : t , a 0 : t 1 , r 0 : t 1 ) H .
We have
h t = ( s 0 : t , a 0 : t 1 , r 0 : t 1 )
= ( ψ S t + 1 ( s 0 : t ) , ψ A t ( a 0 : t 1 ) , ψ R t ( r 0 : t 1 ) )
= ( ψ S t + 1 , ψ A t , ψ R t ) ( s 0 : t , a 0 : t 1 , r 0 : t 1 )
= ψ H ( h t )
therefore the condition is compatible with the action of M on S , S .
By the definition of morphisms in N , we have
J t ( h t , a ) = ( ( J t ( ψ H t , ψ A ) ) ( h t , a ) ) ( ψ S , ψ R )
By the definition of M we have
T t ( h t , a ) = ( J t ( h t , a ) ) ( L S , t + 1 , 1 R )
T t ( h t , a ) = ( J t ( h t , a ) ) ( L S , t + 1 , 1 R )
For any h t + 1 : = ( s 0 : t + 1 , a 0 : t , r 0 : t ) H t + 1 H , we have
( ψ S L S , t + 1 ) ( h t + 1 ) = ψ S ( s t + 1 )
and
( L S , t + 1 ψ H ) ( h t + 1 ) = L S , t + 1 ( ψ H t + 1 ( h t + 1 ) )
= L S , t + 1 ( ψ S t + 2 ( s 0 : t + 1 ) , ψ A t + 1 ( a 0 : t ) , ψ R t + 1 ( r 0 : t ) )
= ψ S ( s t + 1 )
thus ψ S L S , t + 1 = L S , t + 1 ψ H , which implies that
T t ( h t , a ) = ( J t ( h t , a ) ) ( L S , t + 1 , 1 R )
= ( ( J t ( ψ H t , ψ A ) ) ( h t , a ) ) ( ψ S , ψ R ) ( L S , t + 1 , 1 R )
= ( ( J t ( ψ H t , ψ A ) ) ( h t , a ) ) ( ψ S L S , t + 1 , ψ R )
= ( ( J t ( ψ H t , ψ A ) ) ( h t , a ) ) ( L S , t + 1 ψ H , 1 R ψ R )
= ( ( ( J t ( ψ H t , ψ A ) ) ( h t , a ) ) ( L S , t + 1 , 1 R ) ) ( ψ H , ψ R )
= ( ( J t ( ( ψ H t , ψ A ) ( h t , a ) ) ) ( L S , t + 1 , 1 R ) ) ( ψ H , ψ R )
= ( ( J t ( h t , a ) ) ( L S , t + 1 , 1 R ) ) ( ψ H , ψ R )
= ( T t ( h t , a ) ) ( ψ H , ψ R )
= ( T t ( ( ψ H , ψ A ) ( h t , a ) ) ) ( ψ H , ψ R )
= ( ( T t ( ψ H , ψ A ) ) ( h t , a ) ) ( ψ H , ψ R )
therefore, by definition of morphisms in M , ( ψ H , ψ A , ψ R ) M ( M , M ) , which means ψ , M ( ψ ) = ( ψ H , ψ A , ψ R ) is compatible with the action of M on J t , J t , i.e., M is a well-defined functor from N to M . □

Appendix E. Proof of Theorem 1

Definition A1 (Isomorphism).
A morphism f : A B in a category A is an isomorphism if there exists a map g : B A in A such that g f = 1 A , f g = 1 B .
Definition A2 (Natural Transformation).
Let A and B be categories and let A G F B be functors. A natural transformation α : F G is a family F ( A ) α A G ( A ) A A of morphisms in B such that for every morphism A f A in A , the square
F ( A ) F ( f ) F A α A α A G ( A ) G ( f ) G A
commutes. The maps α A are called the components of α.
Definition A3 (Functor Category).
Let A and B be categories. Functor category Fun ( A , B ) is a category whose objects are all the functors from A to B and morphisms are all the natural transformations between these functors.
Definition A4 (Natural Isomorphism).
Let A and B be categories. A natural isomorphism between functors F and G from A to B is an isomorphism in category Fun ( A , B ) . Functors F , G Fun ( A , B ) are isomorphic (denoted as F G ) if there exists a natural isomorphism between them.
Definition A5 (Category Equivalence).
A equivalence between categories A and B consists of a pair of functors together with natural isomorphisms η : 1 A G F , ϵ : F G 1 B . If there exists an equivalence between A and B , we say that A and B are equivalent through F and G .
Category M and N are equivalent through functor M and N , i.e., M N 1 M , N M 1 N .
Proof. 
For any
M = ρ 0 , S , A , { T t } t = 0 M
where
T t : ( s t , a t ) ( ( s t + 1 , r t ) P M t ( s t , a t ; s t + 1 , r t ) )
we have
( M N ) ( M ) = ρ 0 , S , A , { T t } t = 0
where
ρ 0 = ρ 0 , S = H , A = A
T t : ( h t , a t ) ( ( h t + 1 , r t ) P M t ( s t , a t ; s t + 1 , r t ) )
h t : = ( { h τ } τ = 0 t , { a τ } τ = 0 t 1 , { r τ } τ = 0 t 1 )
h t : = ( { s τ } τ = 0 t , { a τ } τ = 0 t 1 , { r τ } τ = 0 t 1 )
therefore, we can reconstruct the representation of T t using T t without loss of information and vice versa,
( T t ( s t , a t ) ) ( s t + 1 , r t ) = ( T t ( L S , t 2 ( s t ) , a t ) ) ( L S , t + 1 2 ( s t + 1 ) , r t )
( T t ( h t , a t ) ) ( h t + 1 , r t ) = ( T t ( L S , t 2 ( h t ) , a t ) ) ( L S , t + 1 2 ( h t + 1 ) , r t )
which means M N 1 M .
Similarly, for any
N ρ 0 , S , A , { J t } t = 0 N
where
J t : ( h t , a t ) ( ( s t + 1 , r t ) P N t ( h t , a t ; s t + 1 , r t ) )
we have
( N M ) ( N ) = ρ 0 , S , A , { J t } t = 0
where
ρ 0 = ρ 0 , S = H , A = A
J t : ( h t , a t ) ( ( h t + 1 , r t ) P N t ( h t , a t ; s t + 1 , r t ) )
h t : = ( { h τ } τ = 0 t , { a τ } τ = 0 t 1 , { r τ } τ = 0 t 1 )
h t : = ( { s τ } τ = 0 t , { a τ } τ = 0 t 1 , { r τ } τ = 0 t 1 )
therefore we can reconstruct the representation of J t using J t without loss of information and vice versa,
( J t ( h t , a t ) ) ( s t + 1 , r t ) = ( J t ( L S , t 1 ( h t ) , a t ) ) ( L S , t + 1 1 ( s t + 1 ) , r t )
( J t ( h t , a t ) ) ( h t + 1 , r t ) = ( J t ( L S , t ( h t ) , a t ) ) ( L S , t + 1 ( h t + 1 ) , r t )
which means N M 1 N . □

Appendix F. Proof of Theorem 2

The HAS G S on MDP M = ρ 0 , S , A , { T t } t = 0 induced by binary operator ⊗ is reversible if ( S , ) is a group.
Proof. 
Define G S as follows which satisfy the reversibility condition of G S
G S , t ( { G S , τ ( h τ ) } τ = 0 t ) : = ( G S , t 1 ( h t 1 ) ) 1 G S , t ( h t ) = s t
Note: Actually, the condition that ( S , ) forms a group can be relaxed to ( S , ) forms a group where S S .

Appendix G. Proof of Theorem 3

For any MDP M = ρ 0 , S , A , { T t } t = 0 , if it is non-degenerate, then the functor G induced by some group operator on S ensures that the dependency structure D h t n of any history h t n H t n of G n ( M ) satisfies D h t n = [ t n , t ] N .
Proof. 
Based on the closure property of the group operator ⊗, we repeatedly apply G to MDP N 0 : = ρ 0 , S , A , { T t } t = 0 to acquire a series of NMDPs { N i } i = 1 n : = { ρ 0 , S , A , { T t i } t = 0 } i = 1 n .
M N 0 G N 1 G N 2 G G N n N
Consider history h t i H N i , ( i [ 0 , n ] N ) with E S ( h t i ) = s 0 : t i . By the definition of G we have
{ G S , τ ( h τ i ) } τ = 0 t = { s τ i + 1 } τ = 0 t = E S ( h t i + 1 )
and
( G S , τ ( h τ i ) ) 1 G S , τ + 1 ( h τ + 1 i ) τ = 0 t 1 = s τ + 1 i τ = 0 t 1
substituting Equation (A1) into Equation (A2) yields
s τ + 1 i = ( s τ i + 1 ) 1 s τ + 1 i + 1
Starting from s t 0 , repeatedly applying Equation (A3) by substituting the left side into the right side yields an expression of s t 0 in terms of s t n , s t 1 n , , s t n n :
s t 0 = ( s t 1 1 ) 1 s t 1 = ( ( s t 2 2 ) 1 s t 1 2 ) 1 ( ( s t 1 2 ) 1 s t 2 ) = ( s t 1 2 ) 1 s t 2 2 ( s t 1 2 ) 1 s t 2 = ( ( s t 2 3 ) 1 s t 1 3 ) 1 ( ( s t 3 3 ) 1 s t 2 3 ) ( ( s t 2 3 ) 1 s t 1 3 ) 1 ( ( s t 1 3 ) 1 s t 3 ) = ( s t 1 3 ) 1 s t 2 3 ( s t 3 3 ) 1 s t 2 3 ( s t 1 3 ) 1 s t 2 3 ( s t 1 3 ) 1 s t 3 =
By mathematical induction, it can be shown that
s t 0 = i = 1 2 n ( s t i n ) 2 χ 2 Z ( i ) 1
where { t i } i = 1 2 n [ t n , t ] Z , s t i n : = e , ( t i < 0 ) , e is the unit element of the group.
Because s t 0 has the above form, it is sufficient to specify the group operator as the multiplication in the free group to obtain the theorem. □
Note: Free group is not the only form in which ( S , ) can be. For example, the theorem still holds when the group is ( R k , + ) , k N + .

Appendix H. Proof of Theorem 4

The HAS R S : = { R S , t } t = 0 induced by prefixes of auxiliary sequence { w t } t = 0 and operator is reversible if w 0 is invertible in the ring.
Proof. 
Define R S as follows which satisfy the reversibility condition of R S if w t is inversible.
R S , t ( { R S , τ ( h τ ) } τ = 0 t ) : = w t 1 · ( R S , t ( h t ) ( R S , t 1 ( h t 1 ) ) ) = s t

Appendix I. Proof of Theorem 5

The HAS R S : = { R S , t } t = 0 induced by prefixes of auxiliary sequence { w t } t = 0 and operator is reversible if w 0 is invertible in the ring.
Proof. 
By the definition of convolution operator , we have
R S , τ ( h τ ) = i = 0 τ w i · s τ i
the following equation comes from taking τ [ 0 , t ] N
w 0 w 1 w 2 w t 0 w 0 w 1 w t 1 0 0 w 0 w t 2 0 0 0 w 0 · s t s t 1 s t 2 s 0 = R S , t ( h t ) R S , t 1 ( h t 1 ) R S , t 2 ( h t 2 ) R S , 0 ( h 0 ) w · s = r
If w 0 is invertible in the ring, the Gaussian elimination method can be used to solve Equation (A5) and obtain the expression for s t , which also means the matrix w is invertible in the ring. □

Appendix J. Proof of Theorem 6

For any MDP M = ρ 0 , S , A , { T t } t = 0 , if it is non-degenerate, then the functor R induced by prefixes of auxiliary sequence { w τ } τ = 0 and operator ensures that the dependency structure D h t of any history h t H t of R ( M ) satisfies D h t = { t τ ( w 1 ) 0 , τ 0 } , where w 1 is the inverse matrix of w in the ring, 0 is the zero element of the ring.
Proof. 
As is proved in Theorem 5, s = w 1 r , where
w 1 = w 0 1 w 0 1 · w 1 · w 0 1 0 w 0 1 0 0 w 0 1 w 0 1 · w 1 · w 0 1 0 0 0 w 0 1
is an upper-triangular matrix, therefore
s t = τ = 0 t ( w 1 ) 0 , τ · R S , t τ ( h t τ )
If ( w 1 ) 0 , τ is not zero, then there exists some aggregated state s t τ R ( H ) that will change s t when using it to replace R S , t τ ( h t τ ) in Equation (A7), which means t τ D h t . □

Appendix K. History Aggregator for Reward (HAR)

Unlike HAS, which introduces non-Markovianity into the MDP’s transition dynamics, HAR does so in the MDP’s reward mechanisms. HAR is similar to reward shaping. However, instead of simplifying RL training as reward shaping does, it is used to construct NMDPs with non-Markovian reward mechanisms.
Definition A6 (History Aggregator for Reward (HAR)).
For any MDP M = ρ 0 , S , A , { T t } t = 0 , an HAR A R : = { A R , t } t = 0 is a series of maps in which A R , t : H t + 1 R , ( t N ) .
Definition A7 (Reversibility of HAR on MDP).
An HAR A R = { A R , t } t = 0 on MDP M = ρ 0 , S , A , { T t } t = 0 is reversible iff there exists a series of maps denoted as A R : = { A R , t } t = 0 which satisfy:
A R , t ( { A R , τ ( h τ + 1 ) } τ = 0 t ) = r t , ( t N )
where h τ H τ , h 1 h 2 h t + 1 , r t = L R , t ( h t + 1 ) .
Definition A8 (Application of Reversible HAR to MDP).
The application of a reversible HAR A R = { A R , t } t = 0 to an MDP M = ρ 0 , S , A , { T t } t = 0 is an NMDP N = ρ 0 , S , A , { T t } t = 0 , ρ 0 = ρ , S = S , A = A in which:
T t : H t × A Δ S × R ( h t , a ) ( ( T t ( L S , t , 1 A ) ) ( h t , a ) ) 1 S , G R , h t
where G R , h t : R R r t A R , t E R ( h t ) , r t .
Corollary A1.
The series of latest reward extraction operators, L R : = { L R , t } t = 0 , constitutes a reversible HAR on MDP.

Appendix L. Extending Reversible HAS to Be Applicable on NMDP

  • HAS: Although HAS was previously described as a structure established on MDP, due to the formal similarity between MDP and NMDP, we can directly replace all occurrences of “MDP” in this definition with “MDP or NMDP”. This still constitutes a valid definition.
  • Reversibility of HAS: Unlike HAS on MDP, to ensure that the target NMDP can utilize the transition function from the original NMDP, it must be possible to reconstruct the complete state sequence from the aggregated history sequence, rather than just the current state. Therefore, a reverse A S = { A S , t } t = 0 of an HAS A S = { A S , t } t = 0 on NMDP N = ρ 0 , S , A , { T t } t = 0 should satisfy:
    A S , t ( { A S , τ ( h τ ) } τ = 0 ) = h ^ t E S 1 ( E S ( h t ) ) H t , ( t N )
  • Application of Reversible HAS: The application of reversible HAS on NMDP is similar to that on MDP, with G S , h t replaced by the following:
    G S , h t : S S s t + 1 L S , t + 1 A S , t + 1 E S ( h t ) , s t + 1
    The use of L S , t + 1 is to extract the latest state from the history returned by A S , t + 1 , according to the definition of reversed HAS on NMDP.
  • HAS Induced by Binary Operator: Similar to extending the concept of HAS from MDP to NMDP, in this definition, “MDP” can also be replaced with “MDP or NMDP”, which still constitutes a valid definition.

References

  1. Whitehead, S.D.; Lin, L.J. Reinforcement learning of non-Markov decision processes. Artif. Intell. 1995, 73, 271–306. [Google Scholar] [CrossRef] [Scilit]
  2. de Vega, I.; Alonso, D. Dynamics of non-Markovian open quantum systems. Rev. Mod. Phys. 2017, 89, 015001. [Google Scholar] [CrossRef] [Scilit]
  3. Gupta, G.; Yin, C.; Deshmukh, J.V.; Bogdan, P. Non-markovian reinforcement learning using fractional dynamics. In Proceedings of the 2021 60th IEEE Conference on Decision and Control (CDC), Austin, TX, USA, 14–17 December 2021; IEEE: Piscataway, NJ, USA, 2021; pp. 1542–1547. [Google Scholar]
  4. Majeed, S.J.; Hutter, M. On Q-learning Convergence for Non-Markov Decision Processes. In Proceedings of the International Joint Conference on Artificial Intelligence, Stockholm, Sweden, 13–19 July 2018; Volume 18, pp. 2546–2552. [Google Scholar]
  5. Ronca, A.; Licks, G.P.; De Giacomo, G. Markov abstractions for PAC reinforcement learning in non-markov decision processes. arXiv 2022, arXiv:2205.01053. [Google Scholar] [CrossRef] [Scilit]
  6. Hutter, M. Feature reinforcement learning: Part I. unstructured MDPs. J. Artif. Gen. Intell. 2009, 1, 3. [Google Scholar] [CrossRef] [Scilit]
  7. Maillard, O.A.; Ryabko, D.; Munos, R. Selecting the state-representation in reinforcement learning. Adv. Neural Inf. Process. Syst. 2011, 24, 2627–2635. [Google Scholar]
  8. Veness, J.; Ng, K.S.; Hutter, M.; Uther, W.; Silver, D. A monte-carlo aixi approximation. J. Artif. Intell. Res. 2011, 40, 95–142. [Google Scholar] [CrossRef] [Scilit]
  9. Nguyen, P.; Maillard, O.A.; Ryabko, D.; Ortner, R. Competing with an infinite set of models in reinforcement learning. In Proceedings of the Artificial Intelligence and Statistics, Scottsdale, AZ, USA, 29 April–1 May 2013; PMLR: Cambridge, MA, USA, 2013; pp. 463–471. [Google Scholar]
  10. Lattimore, T.; Hutter, M.; Sunehag, P. The sample-complexity of general reinforcement learning. In Proceedings of the International Conference on Machine Learning, Atlanta, GA, USA, 16–21 June 2013; PMLR: Cambridge, MA, USA, 2013; pp. 28–36. [Google Scholar]
  11. Rens, G.; Raskin, J.F. Learning non-Markovian reward models in MDPs. arXiv 2020, arXiv:2001.09293. [Google Scholar] [CrossRef] [Scilit]
  12. Camacho, A.; Icarte, R.T.; Klassen, T.Q.; Valenzano, R.A.; McIlraith, S.A. LTL and Beyond: Formal Languages for Reward Function Specification in Reinforcement Learning. In Proceedings of the International Joint Conference on Artificial Intelligence, Macao, China, 10–16 August 2019; Volume 19, pp. 6065–6073. [Google Scholar]
  13. Abadi, E.; Brafman, R.I. Learning and solving regular decision processes. arXiv 2020, arXiv:2003.01008. [Google Scholar] [CrossRef] [Scilit]
  14. Brafman, R.I.; De Giacomo, G. Regular Decision Processes: A Model for Non-Markovian Domains. In Proceedings of the International Joint Conference on Artificial Intelligence, Macao, China, 10–16 August 2019; pp. 5516–5522. [Google Scholar]
  15. Gaon, M.; Brafman, R. Reinforcement learning with non-markovian rewards. In Proceedings of the AAAI Conference on Artificial Intelligence, New York, NY, USA, 7–12 February 2020; Volume 34, pp. 3980–3987. [Google Scholar]
  16. Dohmen, T.; Topper, N.; Atia, G.; Beckus, A.; Trivedi, A.; Velasquez, A. Inferring probabilistic reward machines from non-markovian reward signals for reinforcement learning. In Proceedings of the International Conference on Automated Planning and Scheduling, Singapore, 13–24 June 2022; Volume 32, pp. 574–582. [Google Scholar]
  17. Qin, A.; Gao, F.; Li, Q.; Zhu, S.C.; Xie, S. Learning non-markovian decision-making from state-only sequences. Adv. Neural Inf. Process. Syst. 2024, 36, 6596–6618. [Google Scholar]
  18. Chandak, S.; Shah, P.; Borkar, V.S.; Dodhia, P. Reinforcement learning in non-markovian environments. Syst. Control Lett. 2024, 185, 105751. [Google Scholar] [CrossRef] [Scilit]
  19. Leinster, T. Basic Category Theory; Cambridge University Press: Cambridge, UK, 2014; Volume 143. [Google Scholar]
  20. Towers, M.; Kwiatkowski, A.; Terry, J.; Balis, J.U.; De Cola, G.; Deleu, T.; Goulão, M.; Kallinteris, A.; Krimmel, M.; KG, A.; et al. Gymnasium: A standard interface for reinforcement learning environments. arXiv 2024, arXiv:2407.17032. [Google Scholar] [CrossRef] [Scilit]
  21. Schulman, J.; Wolski, F.; Dhariwal, P.; Radford, A.; Klimov, O. Proximal policy optimization algorithms. arXiv 2017, arXiv:1707.06347. [Google Scholar] [CrossRef] [Scilit]
  22. Raffin, A.; Hill, A.; Gleave, A.; Kanervisto, A.; Ernestus, M.; Dormann, N. Stable-Baselines3: Reliable Reinforcement Learning Implementations. J. Mach. Learn. Res. 2021, 22, 1–8. [Google Scholar]
  23. Raffin, A. RL Baselines3 Zoo. 2020. Available online: https://github.com/DLR-RM/rl-baselines3-zoo (accessed on 1 November 2025).
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.