00001 /*****************************************************************************/ 00002 /*! 00003 * \file array_proof_rules.h 00004 * 00005 * Author: Clark Barrett 5/29/2003 00006 * 00007 * Created: May 29 19:16:33 GMT 2003 00008 * 00009 * <hr> 00010 * Copyright (C) 2003 by the Board of Trustees of Leland Stanford 00011 * Junior University and by New York University. 00012 * 00013 * License to use, copy, modify, sell and/or distribute this software 00014 * and its documentation for any purpose is hereby granted without 00015 * royalty, subject to the terms and conditions defined in the \ref 00016 * LICENSE file provided with this distribution. In particular: 00017 * 00018 * - The above copyright notice and this permission notice must appear 00019 * in all copies of the software and related documentation. 00020 * 00021 * - THE SOFTWARE IS PROVIDED "AS-IS", WITHOUT ANY WARRANTIES, 00022 * EXPRESSED OR IMPLIED. USE IT AT YOUR OWN RISK. 00023 * 00024 * <hr> 00025 * 00026 * CLASS: ArrayProofRules 00027 * 00028 * 00029 * Description: Array proof rules. 00030 */ 00031 /*****************************************************************************/ 00032 00033 #ifndef _cvcl__theory_array__array_proof_rules_h_ 00034 #define _cvcl__theory_array__array_proof_rules_h_ 00035 00036 namespace CVCL { 00037 00038 class Theorem; 00039 class Expr; 00040 00041 class ArrayProofRules { 00042 public: 00043 // Destructor 00044 virtual ~ArrayProofRules() { } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Proof rules 00048 //////////////////////////////////////////////////////////////////// 00049 00050 // ==> 00051 // write(store, index_0, v_0, index_1, v_1, ..., index_n, v_n) = store IFF 00052 // 00053 // read(store, index_n) = v_n & 00054 // index_{n-1} != index_n -> read(store, index_{n-1}) = v_{n-1} & 00055 // (index_{n-2} != index_{n-1} & index_{n-2} != index_n) -> read(store, index_{n-2}) = v_{n-2} & 00056 // ... 00057 // (index_1 != index_2 & ... & index_1 != index_n) -> read(store, index_1) = v_1 00058 // (index_0 != index_1 & index_0 != index_2 & ... & index_0 != index_n) -> read(store, index_0) = v_0 00059 virtual Theorem rewriteSameStore(const Expr& e, int n) = 0; 00060 00061 // ==> write(store, index, value) = write(...) IFF 00062 // store = write(write(...), index, read(store, index)) & 00063 // value = read(write(...), index) 00064 virtual Theorem rewriteWriteWrite(const Expr& e) = 0; 00065 00066 // ==> read(write(store, index1, value), index2) = 00067 // ite(index1 = index2, value, read(store, index2)) 00068 virtual Theorem rewriteReadWrite(const Expr& e) = 0; 00069 00070 // value = read(store, index) ==> 00071 // write(store, index, value) = store 00072 virtual Theorem rewriteRedundantWrite1(const Theorem& v_eq_r, 00073 const Expr& write) = 0; 00074 00075 // ==> 00076 // write(write(store, index, v1), index, v2) = write(store, index, v2) 00077 virtual Theorem rewriteRedundantWrite2(const Expr& e) = 0; 00078 00079 // ==> 00080 // write(write(store, index1, v1), index2, v2) = 00081 // write(write(store, index2, v2), index1, ite(index1 = index2, v2, v1)) 00082 virtual Theorem interchangeIndices(const Expr& e) = 0; 00083 //! Beta reduction of array literal: |- (array x. f(x))[arg] = f(arg) 00084 virtual Theorem readArrayLiteral(const Expr& e) = 0; 00085 00086 }; // end of class ArrayProofRules 00087 00088 } // end of namespace CVCL 00089 00090 #endif