Skip to main content
QUICK REVIEW

[Paper Review] On Formal Reasoning on the Semantics of PLC using Coq

Jan Olaf Blech, Sidi Ould Biha|arXiv (Cornell University)|Jan 14, 2013
Formal Methods in VerificationComputer Science13 references7 citations
TL;DR

This paper presents a formal verification framework for Programmable Logic Controllers (PLCs) using the Coq proof assistant, targeting the IEC 61131-3 standard's IL, SFC, LD, and FBD languages. It formalizes semantics for these languages, enables automatic SFC-to-Coq code generation, and proves safety properties in a case study, demonstrating a certified approach to PLC verification with reusable semantics and tooling for industrial applications.

ABSTRACT

Programmable Logic Controllers (PLC) and its programming standard IEC 61131-3 are widely used in embedded systems for the industrial automation domain. We propose a framework for the formal treatment of PLC based on the IEC 61131-3 standard. A PLC system description typically combines code written in different languages that are defined in IEC 61131-3. For the top-level specification we regard the Sequential Function Charts (SFC) language, a graphical high-level language that allows to describe the main control-flow of the system. In addition to this, we describe the Instruction List (IL) language -- an assembly like language -- and two other graphical languages: Ladder Diagrams (LD) and Function Block Diagrams (FBD). IL, LD, and FBD are used to describe more low level structures of a PLC. We formalize the semantics of these languages and describe and prove relations between them. Formalization and associated proofs are carried out using the proof assistant Coq. In addition to this, we present work on a tool for automatically generating SFC representations from a graphical description -- the IL and LD languages can be handled in Coq directly -- and its usage for verification purposes. We sketch possible usages of our formal framework, and present an example application for a PLC in a project demonstrator and prove safety properties.

Motivation & Objective

  • To establish a formally verified, reusable semantics for key IEC 61131-3 PLC programming languages, including IL, SFC, LD, and FBD.
  • To develop a toolchain that automatically generates Coq-usable representations and proofs from graphical SFC descriptions.
  • To enable formal verification of safety properties in PLC programs using interactive theorem proving in Coq.
  • To support the long-term goal of building a certified compiler for PLC code, integrating with existing certified compilation stacks.

Proposed method

  • Formalization of IL, SFC, LD, and FBD semantics using the Coq proof assistant and the SSReflect extension.
  • Use of Coq's extraction mechanism to generate certified interpreters or compilers from formalized semantics.
  • Design and implementation of a tool that transforms graphical SFC diagrams into equivalent Coq specifications and associated theorems.
  • Leveraging Coq’s support for inductive types, dependent types, and decidable equality to model PLC data types and control flow.
  • Application of standard proof techniques in Coq to verify safety properties on a real-world PLC-based sorting machine demonstrator.
  • Integration of formal semantics with the CertPLC tool for automated proof generation and verification.

Experimental results

Research questions

  • RQ1How can the semantics of multiple IEC 61131-3 PLC programming languages be formally and uniformly modeled in a proof assistant?
  • RQ2Can a tool automatically generate formally verified Coq representations from graphical SFC specifications?
  • RQ3What are the practical benefits of using interactive theorem proving in Coq for verifying safety properties in industrial PLC systems?
  • RQ4How can formal semantics of IL, LD, and SFC be related and proven consistent within a single verification framework?
  • RQ5What is the feasibility and scalability of applying this formal framework to real industrial PLC applications?

Key findings

  • The authors successfully formalized the semantics of IL, SFC, LD, and a high-level abstraction of FBD in Coq, enabling formal reasoning over PLC programs.
  • A tool was developed that automatically generates Coq-usable SFC representations and associated theorems from graphical SFC input, reducing manual specification effort.
  • The framework enabled the verification of safety properties in a real industrial demonstrator for a sorting machine, demonstrating practical applicability.
  • The formalization supports code extraction, paving the way for a certified compiler from PLC IL to C using the CompCert stack.
  • The approach provides a reusable, formally grounded foundation for PLC verification, with potential for integration into development environments like EasyLab.
  • The work demonstrates that interactive theorem proving in Coq is viable for industrial PLC verification, offering stronger guarantees than model checking in some scenarios.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.