Driven by expressiveness commonalities of Python and our Python-based embedded logic-based language Natlog, we design high-level interaction patterns between equivalent language constructs and data types on the two sides. By directly connecting generators and backtracking, nested tuples and terms, coroutines and first-class logic engines, reflection and meta-interpretation, we enable logic-based language constructs to access the full power of the Python ecosystem. We show the effectiveness of our design via Natlog apps working as orchestrators for JAX and Pytorch pipelines and as DCG-driven GPT3 and DALL.E prompt generators. Keyphrases: embedding of logic programming in the Python ecosystem, high-level inter-paradigm data exchanges, coroutining with logic engines, logic-based neuro-symbolic computing, logic grammars as prompt-generators for Large Language Models, logic-based neural network configuration and training.
翻译:受Python及其嵌入式逻辑语言Natlog表达共性的驱动,我们设计了两种语言之间等价语言结构与数据类型的高层次交互模式。通过直接连接生成器与回溯机制、嵌套元组与项、协程与一级逻辑引擎、反射与元解释,我们使基于逻辑的语言结构能够访问Python生态系统的全部能力。我们通过Natlog应用展示了该设计的有效性:这些应用可作为JAX和PyTorch流水线的编排器,以及基于定子短语语法(DCG)的GPT3和DALL.E提示生成器。关键词:逻辑编程在Python生态系统中的嵌入,高层次跨范式数据交换,逻辑引擎协程化,基于逻辑的神经符号计算,逻辑语法作为大语言模型的提示生成器,基于逻辑的神经网络配置与训练。