00001 /*****************************************************************************/ 00002 /*! 00003 * \file array_theorem_producer.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: TRUSTED implementation of array proof rules. DO 00030 * NOT use this file in any DP code, use the exported API in 00031 * array_proof_rules.h instead. 00032 * 00033 */ 00034 /*****************************************************************************/ 00035 #ifndef _cvcl__theory_array__array_theorem_producer_h_ 00036 #define _cvcl__theory_array__array_theorem_producer_h_ 00037 00038 #include "array_proof_rules.h" 00039 #include "theorem_producer.h" 00040 00041 namespace CVCL { 00042 00043 00044 class ArrayTheoremProducer: public ArrayProofRules, public TheoremProducer { 00045 private: 00046 // Inserting flea proof arguments for a canonical sum 00047 public: 00048 // Constructor 00049 ArrayTheoremProducer(TheoremManager* tm) : TheoremProducer(tm) { } 00050 00051 //////////////////////////////////////////////////////////////////// 00052 // Proof rules 00053 //////////////////////////////////////////////////////////////////// 00054 00055 // ==> 00056 // write(store, index_0, v_0, index_1, v_1, ..., index_n, v_n) = store IFF 00057 // 00058 // read(store, index_n) = v_n & 00059 // index_{n-1} != index_n -> read(store, index_{n-1}) = v_{n-1} & 00060 // (index_{n-2} != index_{n-1} & index_{n-2} != index_n) -> read(store, index_{n-2}) = v_{n-2} & 00061 // ... 00062 // (index_1 != index_2 & ... & index_1 != index_n) -> read(store, index_1) = v_1 00063 // (index_0 != index_1 & index_0 != index_2 & ... & index_0 != index_n) -> read(store, index_0) = v_0 00064 Theorem rewriteSameStore(const Expr& e, int n); 00065 00066 // ==> write(store, index, value) = write(...) IFF 00067 // store = write(write(...), index, read(store, index)) & 00068 // value = read(write(...), index) 00069 Theorem rewriteWriteWrite(const Expr& e); 00070 00071 // ==> read(write(store, index1, value), index2) = 00072 // ite(index1 = index2, value, read(store, index2)) 00073 Theorem rewriteReadWrite(const Expr& e); 00074 00075 // value = read(store, index) ==> 00076 // write(store, index, value) = store 00077 Theorem rewriteRedundantWrite1(const Theorem& v_eq_r, 00078 const Expr& write); 00079 00080 // ==> 00081 // write(write(store, index, v1), index, v2) = write(store, index, v2) 00082 Theorem rewriteRedundantWrite2(const Expr& e); 00083 00084 // ==> 00085 // write(write(store, index1, v1), index2, v2) = 00086 // write(write(store, index2, v2), index1, ite(index1 = index2, v2, v1)) 00087 Theorem interchangeIndices(const Expr& e); 00088 // Beta reduction of array literal: |- (array x. f(x))[arg] = f(arg) 00089 Theorem readArrayLiteral(const Expr& e); 00090 00091 }; // end of class ArrayTheoremProducer 00092 00093 } // end of namespace CVCL 00094 00095 #endif