# #include "accanon.h"

This page has information from files accanon.h and accanon.c.

## Contents

- Public Routines
- Public Definitions
- Introduction

## Public Routines in File accanon.c

#### Index

ac_canonical | check_ac_canonical | flatten |

#### Details

    void ac_canonical(Term t, int bit);

This routine transforms a term into AC canonical form, which means that all AC subterms are right associated and sorted. The routine term_compare_ncv() is used to compare AC arguments, and the order is CONSTANT < COMPLEX < VARIABLE; within type, the order is by VARNUM and lexigocgaphic by SYMNUM.

Terms can be marked as fully reduced (which implies AC canonical). The argument "bit" tells which term bit is used for the mark (bit=-1 means to ignore marks). If such a term is found, it is skipped. Also, we make sure that any transformed terms are not marked (they will be AC canonical, but they might not be reduced).

    int check_ac_canonical(Term t);

This Boolean routine simply checks if a term is AC canonical. It should only be used if you suspect something is wrong, because it is inefficient (it copies the term, calls ac_canonical() on the copy, then does term_ident() with the original term).

    void flatten(Term t, Term *a, int *ip);

This routine

## Public Definitions in File accanon.h

    /* If you get an error message "flatten, too many arguments", increase
     * the following symbol (2500 is enough for the dem_alu problem.)
     */

    #define MAX_ACM_ARGS 2500

## Introduction