• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
        • Syntax-for-tools
        • Atc
        • Language
        • Representation
        • Transformation-tools
          • Simpadd0
            • Simpadd0-implementation
            • Simpadd0-expr-option
            • Simpadd0-structdeclor-list
            • Simpadd0-structdecl-list
            • Simpadd0-spec/qual-list
            • Simpadd0-param-declon-list
            • Simpadd0-initdeclor-list
            • Simpadd0-dirabsdeclor-option
            • Simpadd0-dirabsdeclor
            • Simpadd0-desiniter-list
            • Simpadd0-absdeclor-option
            • Simpadd0-strunispec
            • Simpadd0-structdeclor
            • Simpadd0-structdecl
            • Simpadd0-statassert
            • Simpadd0-spec/qual
            • Simpadd0-param-declor
            • Simpadd0-param-declon
            • Simpadd0-member-designor
            • Simpadd0-initer-option
            • Simpadd0-initdeclor
            • Simpadd0-genassoc-list
            • Simpadd0-genassoc
            • Simpadd0-expr
            • Simpadd0-enumspec
            • Simpadd0-enumer-list
            • Simpadd0-dirdeclor
            • Simpadd0-desiniter
            • Simpadd0-designor-list
            • Simpadd0-designor
            • Simpadd0-declor-option
            • Simpadd0-decl-spec-list
            • Simpadd0-decl-spec
            • Simpadd0-decl-list
            • Simpadd0-const-expr-option
            • Simpadd0-const-expr
            • Simpadd0-block-item-list
            • Simpadd0-align-spec
            • Simpadd0-absdeclor
            • Simpadd0-type-spec
            • Simpadd0-tyname
            • Simpadd0-stmt
            • Simpadd0-label
            • Simpadd0-initer
            • Simpadd0-expr-list
            • Simpadd0-enumer
            • Simpadd0-declor
            • Simpadd0-decl
            • Simpadd0-block-item
          • Deftrans
          • Splitgso
          • Constant-propagation
          • Split-fn
          • Copy-fn
          • Specialize
          • Split-all-gso
          • Rename
          • Utilities
        • Insertion-sort
        • Pack
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
      • Riscv
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
      • Zcash
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Poseidon
      • Where-do-i-place-my-book
      • Axe
      • Bigmems
      • Builtins
      • Execloader
      • Aleo
      • Solidity
      • Paco
      • Concurrent-programs
      • Bls12-377-curves
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Transformation-tools

Simpadd0

A transformation to simplify E + 0 to E.

Introduction

This is a simple proof-of-concept transformation, which replaces expressions of the form E + 0 with E, when E is an expression that our current c$::validator annotates as having type int, and 0 is the octal constant for zero without other leading zeros and without suffixes.

The transformation also generates proofs of equivalence between old (original) and new (transformed) constructs, for a subset of the constructs. In particular, the transformation generates equivalence proofs for C functions of a certain form, detailed below.

General Form

(simpadd0 const-old
          const-new
  )

Inputs

const-old

Specifies the code to the transformed.

This must be a symbol that names an existing ACL2 constant that contains a validated translation unit ensemble, i.e. a value of type transunit-ensemble resulting from validation, and in particular containing validation information. This constant could result from c$::input-files, or from some other transformation.

In the rest of this documentation page, we refer to this constant as *old*.

const-new

Specifies the name of the constant for the transformed code.

This must be a symbol that is valid name for a new ACL2 constant.

In the rest of this documentation page, we refer to this constant as *new*.

Generated Events

*new*

The named constant containing the result of the transformation. This is a translation unit ensemble that is the same as the one in *old*, except that every occurrence of an expression of the form E + 0, when E is an expression that our current c$::validator annotates as having type int, and 0 is the octal constant for zero without other leading zeros and without suffixes, is turned into just the expression E.

The file paths that are the keys of translation unit map are unchanged by the transformation.

Equivalence theorems.

One theorem is generated for every function definition in *old* that has all int parameters and whose body consists of a single return statement with an expression consisting of int constants, function parameters, the unary operators that do not involve pointers (i.e. +, -, ~, !), and the binary operators that are pure and strict (i.e. *, /, %, +, -, <<, >>, <, >, <=, >=, ==, !=, &, ^, |). Note that the transformed function definition in *new* satisfies the same restrictions.

These theorems are proved by proving a sequence of theorems, in a bottom-up fashion, for the sub-constructs of the functions. Theorems for sub-constructs in the supported subset of C are also generated for functions that are not in the subset.

The generated theorems are designed to always prove. It is a bug in the transformation if a generated theorem fails to prove.

The generated theorems have names of the form *new*-thm-<i>, where <i> are increasing positive integers.

Subtopics

Simpadd0-implementation
Implementation of simpadd0.
Simpadd0-expr-option
Transform an optional expression.
Simpadd0-structdeclor-list
Transform a list of structure declarators.
Simpadd0-structdecl-list
Transform a list of structure declarations.
Simpadd0-spec/qual-list
Transform a list of type specifiers and qualifiers.
Simpadd0-param-declon-list
Transform a list of parameter declarations.
Simpadd0-initdeclor-list
Transform a list of initializer declarators.
Simpadd0-dirabsdeclor-option
Transform an optional direct abstract declarator.
Simpadd0-dirabsdeclor
Transform a direct abstract declarator.
Simpadd0-desiniter-list
Transform a list of initializers with optional designations.
Simpadd0-absdeclor-option
Transform an optional abstract declarator.
Simpadd0-strunispec
Transform a structure or union specifier.
Simpadd0-structdeclor
Transform a structure declarator.
Simpadd0-structdecl
Transform a structure declaration.
Simpadd0-statassert
Transform an static assertion declaration.
Simpadd0-spec/qual
Transform a type specifier or qualifier.
Simpadd0-param-declor
Transform a parameter declarator.
Simpadd0-param-declon
Transform a parameter declaration.
Simpadd0-member-designor
Transform a member designator.
Simpadd0-initer-option
Transform an optional initializer.
Simpadd0-initdeclor
Transform an initializer declarator.
Simpadd0-genassoc-list
Transform a list of generic associations.
Simpadd0-genassoc
Transform a generic association.
Simpadd0-expr
Transform an expression.
Simpadd0-enumspec
Transform an enumeration specifier.
Simpadd0-enumer-list
Transform a list of enumerators.
Simpadd0-dirdeclor
Transform a direct declarator.
Simpadd0-desiniter
Transform an initializer with optional designations.
Simpadd0-designor-list
Transform a list of designators.
Simpadd0-designor
Transform a designator.
Simpadd0-declor-option
Transform an optional declarator.
Simpadd0-decl-spec-list
Transform a list of declaration specifiers.
Simpadd0-decl-spec
Transform a declaration specifier.
Simpadd0-decl-list
Transform a list of declarations.
Simpadd0-const-expr-option
Transform an optional constant expression.
Simpadd0-const-expr
Transform a constant expression.
Simpadd0-block-item-list
Transform a list of block items.
Simpadd0-align-spec
Transform an alignment specifier.
Simpadd0-absdeclor
Transform an abstract declarator.
Simpadd0-type-spec
Transform a type specifier.
Simpadd0-tyname
Transform a type name.
Simpadd0-stmt
Transform a statement.
Simpadd0-label
Transform a label.
Simpadd0-initer
Transform an initializer.
Simpadd0-expr-list
Transform a list of expressions.
Simpadd0-enumer
Transform an enumerator.
Simpadd0-declor
Transform a declarator.
Simpadd0-decl
Transform a declaration.
Simpadd0-block-item
Transform a block item.