The Proof is in the Pudding: Using Automated Theorem Proving to Generate Cooking Recipes

Louis Mahon, Carl VogelarXiv 2022

Abstract

This paper presents FASTFOOD, a rule-based Natural Language Generation (NLG) program for cooking recipes. Recipes are generated by using an Automated Theorem Proving (ATP) procedure to select the ingredients and instructions, with ingredients corresponding to axioms and instructions to implications. FASTFOOD also contains a temporal optimization module which can rearrange the recipe to make it more time-efficient for the user, e.g. the recipe specifies to chop the vegetables while the rice is boiling. The system is described in detail, using a framework which divides Natural Language Generation into 4 phases: content production, content selection, content organisation and content realisation. A comparison is then made with similar existing systems and techniques.

Introduction

In the field of computational linguistics, most research regarding culinary data focuses on Natural Language Understanding (NLU)—the extraction of information from existing recipes to populate databases. This paper explores the inverse: Natural Language Generation (NLG).

Generating recipes presents a unique challenge due to the "transitory ontology" of cooking. Unlike many domains where entities remain constant, cooking involves ingredients that are modified (peeled), transformed (chopped), and merged into collective entities (stews). Standard NLP methods that track persistent discourse referents struggle when objects fundamentally change state. The FASTFOOD system addresses this by modeling cooking as a formal logical process, deriving coherent and time-efficient instructions from base ingredients and actions.

The FASTFOOD Framework

FASTFOOD operates through a four-phase pipeline to transform raw data into a structured recipe.

1. Content Production

The system utilizes "intensional" production rather than a static database. It defines Food Classes (nouns) and Cooking Actions (verbs), establishing compatibility rules (e.g., one can chop a potato but not coconut milk). This allows the system to recursively generate a database of over 400 possible "processes"—the logical transitions from one ingredient state to another.

2. Content Selection: Recipes as Proofs

The core of the system treats a desired dish as a logical formula to be proven. Available ingredients are treated as axioms, and cooking processes function as rules of inference (implications). Using a backwards-chaining Automated Theorem Proving (ATP) algorithm, the system starts with the final dish and looks for a process that outputs it. It then identifies the necessary inputs for that process, repeating the search until it reaches the raw ingredients available in the user's supplies.

3. Content Organization and Temporal Optimization

Once the steps are selected, they are organized into a Directed Acyclic Graph (DAG) of dependencies. To enhance utility, FASTFOOD employs a "Concurrent Compression" algorithm. By distinguishing between "active time" (e.g., chopping) and "passive time" (e.g., boiling), the system identifies opportunities to perform independent tasks simultaneously. This allows the generator to produce instructions such as "While the lentils boil, chop the onions," minimizing the total duration of the recipe.

4. Content Realization

In the final phase, the optimized plan is mapped to natural language templates. This stage converts the logical proof and temporal schedule into the final human-readable text.

Key Results and Evaluation

The system was evaluated using a case study for generating a Vegetable Dahl recipe. The system analyzed 40 permissible orderings of the necessary cooking steps to find the most efficient path.

  • Efficiency Gains: An unoptimized linear plan for the Dahl required 3840 seconds. The temporally optimized plan reduced this to 3180 seconds (53 minutes), a significant improvement in user experience achieved by utilizing passive boiling time for preparation tasks.
  • Comparative Performance: When compared to the landmark EPICURE system (1990), FASTFOOD demonstrated superior "strategic" planning (deciding what to include and how to optimize it), though it was noted to be "tactically" weaker in terms of the naturalness of its generated language.

Limitations and Future Work

While FASTFOOD provides a robust logical framework for recipe generation, several areas for improvement remain:

  • Quantities: The current iteration does not handle specific measurements (e.g., "two carrots").
  • Linguistic Nuance: The realization phase is template-based, resulting in somewhat robotic phrasing.
  • Knowledge Engineering: The system currently requires manual encoding of food classes and their properties.

Future research directions include integrating the system with computer vision for ingredient recognition and connecting the temporal optimizer to smart kitchen appliances to guide the cooking process in real-time.

Summary updated

BibTeX
@misc{mahon2022proof,
  author = {Louis Mahon and Carl Vogel},
  title = {{The Proof is in the Pudding: Using Automated Theorem Proving to Generate Cooking Recipes}},
  year = {2022},
  eprint = {2203.02683},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.02683},
}
Figure