{"title":"Towards a type-based abstract semantics for Python","authors":"Andrei Nacu","doi":"10.1016/j.jlamp.2024.101032","DOIUrl":"10.1016/j.jlamp.2024.101032","url":null,"abstract":"<div><div>Python is a high-level programming language that is strongly, but dynamically typed. In this paper, we propose a type inference framework to compute specifications for Python functions in isolation. To achieve this, we aim to use an abstract-interpretation-based data flow analysis to infer variable types on a subset of Python programs that use built-in types, operators and functions. To evaluate the expressions found in every program point, specifications for the encountered operations and functions are required. We propose a method for extracting these specifications from the Typeshed project, which contains a set of annotations for built-in and popular third-party libraries. These specifications will be used then to extend the proposed type inference to large Python programs.</div></div>","PeriodicalId":48797,"journal":{"name":"Journal of Logical and Algebraic Methods in Programming","volume":"143 ","pages":"Article 101032"},"PeriodicalIF":0.7,"publicationDate":"2025-02-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"143170705","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"数学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"OA","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Open compliance in multiparty sessions with partial typing","authors":"Franco Barbanera , Viviana Bono , Mariangiola Dezani-Ciancaglini","doi":"10.1016/j.jlamp.2025.101046","DOIUrl":"10.1016/j.jlamp.2025.101046","url":null,"abstract":"<div><div>Multiparty sessions are a foundational model for distributed entities interacting through message passing. Communication is disciplined by global types: well-typed sessions are lock-free and their participants do follow the described protocols. A key issue is the composition of well-typed sessions, that we face via the <em>participants-as-interfaces</em> approach. We study session composition when a client session is connected to compliant server sessions, where compliance is naturally biased towards the client. We prove that a unique session can be constructed by transforming the interface participants of the client and the servers into gateways (that is, forwarders), if the sessions are well-typed and the compliance relation can be proved. The obtained session has a global type that can be derived from the global types of the composing sessions and the proof of compliance among the client and the servers. A novelty of our approach is that in the composition we only ensure Lock-freedom for the client session, disregarding this property for the server sessions, via a partial typing system. This choice strongly simplifies the construction of the gateways. We consider the present study as a further step toward a theory of <em>Open</em> MultiParty Session Types.</div></div>","PeriodicalId":48797,"journal":{"name":"Journal of Logical and Algebraic Methods in Programming","volume":"144 ","pages":"Article 101046"},"PeriodicalIF":0.7,"publicationDate":"2025-01-31","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"143092824","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"数学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"OA","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"A nesting-preserving transformation of SIMP programs into logically constrained term rewrite systems","authors":"Naoki Nishida, Misaki Kojima , Ayuka Matsumi","doi":"10.1016/j.jlamp.2025.101045","DOIUrl":"10.1016/j.jlamp.2025.101045","url":null,"abstract":"<div><div>In the last decade, several transformations of an imperative program into a logically constrained term rewrite system (LCTRS, for short) have been investigated and extended. They do not preserve the nesting of statements, generating rewrite rules like transition systems, while function calls are represented by the nesting of function symbols. Structural features of the original program must often be useful in analyzing the transformed LCTRS. To use such features, we have to know how to transform the program into the LCTRS by keeping the correspondence between statements in the program and the introduced auxiliary function symbols in the LCTRS, or by transforming the LCTRS into a control flow graph to, e.g., recover loop information. In this paper, we propose a nesting-preserving transformation of a SIMP program (a C-like integer program) into an LCTRS. The transformation is mostly based on previous work and introduces the nesting of function symbols that correspond to the nesting of statements in the original program. To be more precise, we propose a construction of a tree homomorphism which is used as a post-process of the transformation in previous work, i.e., which is applied to the LCTRS obtained from the program. As a correctness statement for the nesting-preserving transformation, we show that the tree homomorphism is sound and complete for the reduction of the LCTRS.</div></div>","PeriodicalId":48797,"journal":{"name":"Journal of Logical and Algebraic Methods in Programming","volume":"144 ","pages":"Article 101045"},"PeriodicalIF":0.7,"publicationDate":"2025-01-28","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"143092825","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"数学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Inductive reasoning with equality predicates, contextual rewriting and variant-based simplification","authors":"José Meseguer","doi":"10.1016/j.jlamp.2025.101036","DOIUrl":"10.1016/j.jlamp.2025.101036","url":null,"abstract":"<div><div>An inductive inference system for proving validity of formulas in the initial algebra <span><math><msub><mrow><mi>T</mi></mrow><mrow><mi>E</mi></mrow></msub></math></span> of an order-sorted equational theory <span><math><mi>E</mi></math></span> is presented. It has 21 inference rules. Only 9 of them require user interaction; the remaining 12 can be automated as <em>simplification rules</em>. In this way, a substantial fraction of the proof effort can be automated. Other rules can be automated by tactics. The inference rules are based on advanced equational reasoning techniques, including: equational proof search, equationally defined equality predicates, narrowing, constructor variant unification, variant satisfiability, order-sorted congruence closure, contextual rewriting, ordered rewriting, and recursive path orderings. All these techniques work modulo axioms <em>B</em>, for <em>B</em> any combination of associativity and/or commutativity and/or identity axioms. Most of these inference rules have already been implemented in Maude's <strong>NuITP</strong> inductive theorem prover.</div></div>","PeriodicalId":48797,"journal":{"name":"Journal of Logical and Algebraic Methods in Programming","volume":"144 ","pages":"Article 101036"},"PeriodicalIF":0.7,"publicationDate":"2025-01-16","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"143092826","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"数学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Ignacio Ballesteros , Clara Benac-Earle , Julio Mariño , Lars-Åke Fredlund , Ángel Herranz
{"title":"Generation of algebraic data type values using evolutionary algorithms","authors":"Ignacio Ballesteros , Clara Benac-Earle , Julio Mariño , Lars-Åke Fredlund , Ángel Herranz","doi":"10.1016/j.jlamp.2024.101022","DOIUrl":"10.1016/j.jlamp.2024.101022","url":null,"abstract":"<div><div>Automatic data generation is a key component of automated software testing. Random generation of test input data can uncover some bugs in software, but its effectiveness decreases when those inputs must satisfy complex properties in order to be meaningful. In this work, we study an evolutionary approach to generate values that can be encoded as algebraic data types plus additional properties. First, the approach is illustrated with the generation of sorted lists. Then, we generalize the technique to arbitrary algebraic data type definitions. Finally, we consider the problem of constrained data types where the data must satisfy some nontrivial property, using the well-known example of red-black trees for our experiments. This example will allow us to introduce the main principles of evolutionary algorithms and how these principles can be applied to obtain valid, nontrivial samples of a given data structure. Our experiments have revealed that this evolutionary approach is able to improve diversity, and increase the size of valid generated values with respect to simple random sampling techniques.</div></div>","PeriodicalId":48797,"journal":{"name":"Journal of Logical and Algebraic Methods in Programming","volume":"143 ","pages":"Article 101022"},"PeriodicalIF":0.7,"publicationDate":"2024-11-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142701496","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"数学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Alexandre Madeira , José Nuno Oliveira , José Proença , Renato Neves
{"title":"Logic and Calculi for All on the occasion of Luís Barbosa’s 60th birthday","authors":"Alexandre Madeira , José Nuno Oliveira , José Proença , Renato Neves","doi":"10.1016/j.jlamp.2024.101023","DOIUrl":"10.1016/j.jlamp.2024.101023","url":null,"abstract":"","PeriodicalId":48797,"journal":{"name":"Journal of Logical and Algebraic Methods in Programming","volume":"143 ","pages":"Article 101023"},"PeriodicalIF":0.7,"publicationDate":"2024-11-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142745024","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"数学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"First order Büchi automata and their application to verification of LTL specifications","authors":"Wenhui Zhang","doi":"10.1016/j.jlamp.2024.101021","DOIUrl":"10.1016/j.jlamp.2024.101021","url":null,"abstract":"<div><div>Büchi automata have applications in formal verification, e.g., in deciding whether a system satisfies given properties. We provide a definition of Büchi automata based on first order logics for representing infinite state systems, and investigate rules for proving emptiness and non-emptiness of such automata. We then apply these rules to solve the problem of verifying correctness of concurrent transition systems, leading to a relatively complete approach for proving and disproving LTL (Linear Temporal Logic) specifications. This approach overcomes weaknesses of existing work based on well-founded sets in the sense that the relative completeness does not depend on additional specification for ensuring progress of non-stuttering transitions. On the practical aspect, we provide a set of examples with an experimental verification condition generation tool to demonstrate the potential applicability of the approach for the verification of concurrent systems.</div></div>","PeriodicalId":48797,"journal":{"name":"Journal of Logical and Algebraic Methods in Programming","volume":"142 ","pages":"Article 101021"},"PeriodicalIF":0.7,"publicationDate":"2024-10-15","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142446083","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"数学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Tuning similarity-based fuzzy logic programs","authors":"Ginés Moreno, José A. Riaza","doi":"10.1016/j.jlamp.2024.101020","DOIUrl":"10.1016/j.jlamp.2024.101020","url":null,"abstract":"<div><div>We have recently designed a symbolic extension of <span>FASILL</span> (acronym of “Fuzzy Aggregators and Similarity Into a Logic Language”), where some truth degrees, similarity annotations and fuzzy connectives can be left unknown, so that the user can easily see the impact of their possible values at execution time. By extending our previous results in the development of tuning techniques not dealing yet with similarity relations, in this work we automatically tune <span>FASILL</span> programs by appropriately substituting the symbolic constants appearing on their rules and similarity relations with the concrete values that best satisfy the user's preferences. Firstly, we have formally proved two theoretical results with different levels of generality/practicability for tuning programs in a safe and effective way. Regarding efficiency, we have drastically reduced the exponential complexity of the tuning algorithms by splitting the initial set of symbolic constants in disjoint sets and using thresholding techniques. These effects have been evidenced by several experiments and benchmarks developed with the online tool we provide to verify in practice the high performance of the improved system.</div></div>","PeriodicalId":48797,"journal":{"name":"Journal of Logical and Algebraic Methods in Programming","volume":"142 ","pages":"Article 101020"},"PeriodicalIF":0.7,"publicationDate":"2024-10-11","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142432865","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"数学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"OA","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Luis Eduardo Bueso de Barrio, Lars-Åke Fredlund, Ángel Herranz, Julio Mariño, Clara Benac Earle
{"title":"Executable contracts for Elixir","authors":"Luis Eduardo Bueso de Barrio, Lars-Åke Fredlund, Ángel Herranz, Julio Mariño, Clara Benac Earle","doi":"10.1016/j.jlamp.2024.101019","DOIUrl":"10.1016/j.jlamp.2024.101019","url":null,"abstract":"<div><div>This article presents the design of a library for attaching and checking executable contracts to code written in the Elixir programming language. In addition to classical contract constructs such as preconditions and postconditions, the library allows specifying exceptional behaviour (i.e., which exceptions are thrown and under which conditions), detecting non-termination issues in recursive functions by specifying a strictly decreasing order in function arguments, and associating timers with function calls to detect slow computations. The library also focuses on language-specific features, enabling the association of contracts with the reception of messages sent by processes and the attachment of constraints to variable names (useful due to variable shadowing in Elixir). Moreover, stateful contracts (i.e., with a model state) permit specifying the behaviour of stateful APIs whose operations can be linearized. Using the stateful contracts, a monitor can be employed to check that the observed state can be explained in terms of possible linearizations.</div></div>","PeriodicalId":48797,"journal":{"name":"Journal of Logical and Algebraic Methods in Programming","volume":"142 ","pages":"Article 101019"},"PeriodicalIF":0.7,"publicationDate":"2024-10-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142424083","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"数学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Partially typed multiparty sessions with internal delegation","authors":"Franco Barbanera , Viviana Bono , Mariangiola Dezani-Ciancaglini","doi":"10.1016/j.jlamp.2024.101018","DOIUrl":"10.1016/j.jlamp.2024.101018","url":null,"abstract":"<div><div>A multiparty session formalises a set of concurrent communicating participants. The possibility for a participant to delegate some interactions to another participant is crucial for the expressivity of multiparty sessions. We propose the first type system for multiparty sessions with delegation where some communications between participants can be ignored. This allows us to type some sessions with global types representing interesting protocols, which have no type in the standard type systems. Our type system enjoys Subject Reduction, Session Fidelity and <em>partial</em> Lock-freedom. The last property ensures the absence of <em>locks</em> for participants with non-ignored communications. A sound and complete type inference algorithm is also discussed.</div></div>","PeriodicalId":48797,"journal":{"name":"Journal of Logical and Algebraic Methods in Programming","volume":"142 ","pages":"Article 101018"},"PeriodicalIF":0.7,"publicationDate":"2024-09-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142322690","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"数学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"OA","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}