Erlang's dynamic typing discipline can lead to runtime errors that persist even after process restarts. Some of these runtime errors could be prevented through static type checking. While Erlang provides a type specification language, the compiler does not enforce these types, thereby limiting their role to documentation purposes. Type checking Erlang code is challenging due to language features such as dynamic type tests, subtyping, equi-recursive types, polymorphism, intersection types in signatures, and untagged union types. This work presents a set-theoretic type system for Erlang which captures the core features of Erlang's existing type language. The formal type system guarantees type soundness, and ensures that type checking remains decidable. Additionally, an implementation of a type checker is provided, supporting all features of the Erlang type language and most term-level language constructs. A case study with modules from Erlang's standard library, an external project, and the type checker itself demonstrates its effectiveness in verifying real-world Erlang code.
This paper studies obfuscation techniques for Erlang programs at the source, abstract syntax tree, BEAM assembly, and BEAM bytecode levels. We focus on transformations that complicate reverse engineering, decompilation, and recompilation while remaining grounded in the actual behavior of the Erlang compiler, validator, loader, and virtual machine. The paper categorizes opcode-level dependency tricks, receive-based loop encodings, irregular control-flow constructions, mutability-oriented performance obfuscation, and self-modifying code enabled by dynamic module loading. A recurring theme is that effective obfuscation in BEAM often arises not from arbitrary corruption, but from exploiting representational gaps between high-level Erlang semantics and the lower-level execution model accepted by the toolchain and runtime.
We study a time-changed variant of the Erlang queue by taking the first hitting time of a mixed stable subordinator as the time-changing component. We call it the mixed time-changed Erlang queue. We derive the system of fractional differential equations that governs its state probabilities. The explicit expressions for the state probabilities of mixed time-changed Erlang queue and their Laplace transform are derived. Equivalently, it is represented in terms of phases and its mean queue length is obtained. Also, some distributional properties of the mixed time-changed Erlang queue such as the distribution of its inter-arrival times, inter-phase times, service times and busy period are derived. Later, its conditional waiting time is discussed and two plots of sample paths simulation are presented.
We prove that finite multivariate Erlang mixture densities with a common rate parameter are dense in the class of probability densities on $\mathbb{R}_{+}^{d}$ that belong to $L^{p}$, for every dimension $d\in\mathbb{N}$ and every $1\le p<\infty$. The argument is constructive: the one-dimensional Szász--Mirakjan--Kantorovich operator yields Erlang mixture approximations, and its tensor product yields multivariate approximants with a common scale. We then obtain several quantitative consequences. These include compact-set uniform approximation bounds and, under local Hölder conditions of order $α\in(0,1]$, rates of order $n^{-α/2}$ as the common scale $1/n$ tends to zero, whole-domain convergence in weighted sup norms, weighted and unweighted $L^{p}$ rates, and explicit rates for finite mixtures indexed by the number of mixture components. In particular, if the approximating density is required to have at most $K$ mixture components, then on fixed compact cubes we obtain an algebraic rate of order $K^{-α/(2d)}$; in global weighted sup norms we obtain the explicit algebraic component-count rate $K^{-α/[2d(2d+α)]}$; and for $1<p<\infty$ we obtain corresponding weighted $L^{p}
We study the transmission eigenvalues of monitored Haar products \[ B_L=(PS_L)(PS_{L-1})\cdots(PS_1), \] where the $S_i$ are independent Haar unitaries and $P$ is a deterministic projection. For fixed $L$, we prove that the empirical eigenvalue distribution of $B_L^\dagger B_L$ converges to $ν_c^{\boxtimes L}$, where $ν_c=(1-c)δ_1+cδ_0$. We then take the free small-loss limit and identify the limiting law by \[ S_{μ_τ}(z)=\exp\left(\fracτ{1+z}\right). \] Lagrange inversion gives explicit Erlang-type moments, explaining the polynomials appearing in Beenakker's recursion. We also record spectral consequences, including the atom $μ_τ(\{1\})=(1-τ)_+$ and the real branch point $τ\mathrm{e}^{1-τ}$, and formulate the diagonal scaling $L\simτN$, $c=1/N$, as a quantitative convergence problem supported by low-order moment checks.
We introduce and study a queue with the Erlang service system and whose arrivals are governed by a counting process in which there is a possibility of finitely many arrivals in an infinitesimal time interval. We call it the Erlang queue with multiple arrivals. Some of its distributional properties are obtained that includes the state-phase probabilities, the mean queue length and the distribution of busy period etc. Also, we study a time-changed variant of it by subordinating it with an independent inverse stable subordinator where we obtain its state probabilities and the mean queue length.
Erlang is a functional programming language with dynamic typing. The language offers great flexibility for destructing values through pattern matching and dynamic type tests. Erlang also comes with a type language supporting parametric polymorphism, equi-recursive types, as well as union and a limited form of intersection types. However, type signatures only serve as documentation, there is no check that a function body conforms to its signature. Set-theoretic types and semantic subtyping fit Erlang's feature set very well. They allow expressing nearly all constructs of its type language and provide means for statically checking type signatures. This article brings set-theoretic types to Erlang and demonstrates how existing Erlang code can be statically typechecked without or with only minor modifications to the code. Further, the article formalizes the main ingredients of the type system in a small core calculus, reports on an implementation of the system, and compares it with other static typecheckers for Erlang.
In this paper we will construct a set-theoretic model of types featuring type variables, base types, set-theoretic types and map types. Syntax of map types spans all the map types available in Erlang. The model of types is used to define a semantic subtyping relation based on set containment. The novelty of this work is the definition of subtyping over parameteric map types.
Distributed actor languages are an effective means of constructing scalable reliable systems, and the Erlang programming language has a well-established and influential model. While Erlang model conceptually provides reliable scalability, it has some inherent scalability limits and these force developers to depart from the model at scale. This article establishes the scalability limits of Erlang systems, and reports the work to improve the language scalability. We systematically study the scalability limits of Erlang and address the issues at the virtual machine (VM), language, and tool levels. More specifically: (1) We have evolved the Erlang VM so that it can work effectively in large scale single-host multicore and NUMA architectures. We have made important architectural improvements to the Erlang/OTP. (2) We have designed and implemented Scalable Distributed (SD) Erlang libraries to address language-level scalability issues, and provided and validated a set of semantics for the new language constructs. (3) To make large Erlang systems easier to deploy, monitor, and debug we have developed and made open source releases of five complementary tools, some specific to SD Erlang. Thr
This paper explores the optimal investment problem of a renewal risk model with generalized Erlang distributed interarrival times. The phases of the Erlang interarrival time is assumed to be observable. The price of the risky asset is driven by the constant elasticity of variance model (CEV) and the insurer aims to maximize the exponential utility of the terminal wealth by asset allocation. By solving the corresponding Hamilton-Jacobi-Bellman (HJB) equation, we establish the concavity of the value function and derive an explicit expression for the optimal investment policy when the interest rate is zero. When the interest rate is nonzero, we obtain an explicit form of the optimal investment strategy, along with a semi-explicit expression of the value function, whose concavity is also rigorously proven.
In this paper, we introduce and study a time-changed variant of the Erlang queue with multiple arrivals where the time-changing component used is the first hitting time of a tempered stable subordinator. The system of fractional difference-differential equations that governs its state probabilities is derived which is solved to obtain their explicit expressions. An equivalent representation in terms of phases and the mean queue length is obtained. For a particular case, the distribution of inter-arrival times, inter-phase times, sojourn times, busy period and that of conditional waiting times are derived.
We consider the class of Erlang mixtures for the task of density estimation on the positive real line when the only available information is given as local moments, a histogram with potentially higher order moments in some bins. By construction, the obtained moment problem is ill-posed and requires regularization. Several penalties can be used for such a task, such as a lasso penalty for sparsity of the representation, but we focus here on a simplified roughness penalty from the P-splines literature. We show that the corresponding hyperparameter can be selected without cross-validation through the computation of the so-called effective dimension of the estimator, which makes the estimator practical and adapted to these summarized information settings. The flexibility of the local moments representations allows interesting additions such as the enforcement of Value-at-Risk and Tail Value-at-Risk constraints on the resulting estimator, making the procedure suitable for the estimation of heavy-tailed densities.
The functional programming language Erlang is well-suited for concurrent and distributed applications. Numerical computing, however, is not seen as one of its strengths. The recent introduction of Federated Learning, a concept according to which client devices are leveraged for decentralized machine learning tasks, while a central server updates and distributes a global model, provided the motivation for exploring how well Erlang is suited to that problem. We present ffl-erl, a framework for Federated Learning, written in Erlang, and explore how well it performs in two scenarios: one in which the entire system has been written in Erlang, and another in which Erlang is relegated to coordinating client processes that rely on performing numerical computations in the programming language C. There is a concurrent as well as a distributed implementation of each case. Erlang incurs a performance penalty, but for certain use cases this may not be detrimental, considering the trade-off between conciseness of the language and speed of development (Erlang) versus performance (C). Thus, Erlang may be a viable alternative to C for some practical machine learning tasks.
In this paper, we propose a general approach for approximate simulation and analysis of delay differential equations (DDEs) with distributed time delays based on methods for ordinary differential equations (ODEs). The key innovation is that we 1) propose an Erlang mixture approximation of the kernel in the DDEs and 2) use the linear chain trick to transform the resulting approximate DDEs to ODEs. Furthermore, we prove that the approximation converges for continuous and bounded kernels and for specific choices of the coefficients if the number of terms increases sufficiently fast. We show that the approximate ODEs can be used to assess the stability of the steady states of the original DDEs and that the solution to the ODEs converges if the kernel is also exponentially bounded. Additionally, we propose an approach based on bisection and least-squares estimation for determining optimal parameter values in the approximation. Finally, we present numerical examples that demonstrate the accuracy and convergence rate obtained with the optimal parameters and the efficacy of the proposed approach for bifurcation analysis and Monte Carlo simulation. The numerical examples involve a modified
Brand and Zafiropulo's notion of Communicating Finite-State Machines (CFSMs) provides a succinct and powerful model of message-passing concurrency, based around channels. However, a major variant of message-passing concurrency is not readily captured by CFSMs: the actor model. In this work, we define a variant of CFSMs, called Communicating Actor Automata, to capture the actor model of concurrency as provided by Erlang: with mailboxes, from which messages are received according to repeated application of pattern matching. Furthermore, this variant of CFSMs supports dynamic process topologies, capturing common programming idioms in the context of actor-based message-passing concurrency. This gives a new basis for modelling, specifying, and verifying Erlang programs. We also consider a class of CAAs that give rise to freedom from race conditions.
In order to reason about the behaviour of programs described in a programming language, a mathematically rigorous definition of that language is needed. In this paper, we present a machine-checked formalisation of concurrent Core Erlang (a subset of Erlang) based on our previous formalisations of its sequential sublanguage. We define a modular, frame stack semantics, show how program evaluation is carried out with it, and prove a number of properties (e.g. determinism, confluence). Finally, we define program equivalence based on bisimulations and prove that side-effect-free evaluation is a bisimulation. This research is part of a wider project that aims to verify refactorings to prove that particular program code transformations preserve program behaviour.
With the development of information technology, requirements for data flow have become diverse. When multi-type data flow (MDF) is used, games, videos, calls, etc. are all requirements. There may be a constant switch between these requirements, and also multiple requirements at the same time. Therefore, the demands of users change over time, which makes traditional teletraffic analysis not directly applicable. This paper proposes probabilistic models for the requirement of MDF, and analyzes in three states: non-tolerance, tolerance and delay. When the requirement random variables are co-distributed with respect to time, we prove the practicability of the Erlang Multirate Loss Model (EMLM) from a mathematical perspective by discretizing time and error analysis. An algorithm of pre-allocating resources is given to guild the construction of base resources.
We present a small-step, frame stack style, semantics for sequential Core Erlang, a dynamically typed, impure functional programming language. The semantics and the properties that we prove are machine-checked with the Coq proof assistant. We improve on previous work by including exceptions and exception handling, as well as built-in data types and functions. Based on the semantics, we define multiple concepts of program equivalence (contextual, CIU equivalence, and equivalence based on logical relations) and prove that the definitions are all equivalent. Using this we are able to give a correctness criterion for refactorings by means of contextually equivalent symbolic expression pairs, which is one of the main motivations of this work.
In this work, we present an alternative distribution layer for Erlang, named Partisan. Partisan is a topology-agnostic distributed programming model and distribution layer that supports several network topologies for different application scenarios: full mesh, peer-to-peer, client-server, and publish-subscribe. Partisan allows application developers to specify the network topology at runtime, rather than encoding topology-specific concerns into application code. Partisan additionally adds support for more channels, enabling users to distribute messages over multiple channels, sometimes in parallel. We implement and evaluate Partisan in the Erlang programming language and use it in the evaluation of three scenarios. The first scenario compares the raw performance between Distributed Erlang and Partisan, and shows that Partisan performs on par with or better than Distributed Erlang. The second scenario demonstrates that distributing traffic over multiple connections enables Partisan to perform up to 18x better under normal conditions, and up to 30x better in situations with network congestion and high concurrency. The third scenario demonstrates, using existing applications, that con
Dynamically typed languages, like Erlang, allow developers to quickly write programs without explicitly providing any type information on expressions or function definitions. However, this feature makes those languages less reliable than statically typed languages, where many runtime errors can be detected at compile time. In this paper, we present a preliminary work on a tool that, by using the well-known techniques of metaprogramming and symbolic execution, can be used to perform bounded verification of Erlang programs. In particular, by using Constraint Logic Programming, we develop an interpreter that, given an Erlang program and a symbolic input for that program, returns answer constraints that represent sets of concrete data for which the Erlang program generates a runtime error.