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 * 00011 * License to use, copy, modify, sell and/or distribute this software 00012 * and its documentation for any purpose is hereby granted without 00013 * royalty, subject to the terms and conditions defined in the \ref 00014 * LICENSE file provided with this distribution. 00015 * 00016 * <hr> 00017 * 00018 * CLASS: ArrayProofRules 00019 * 00020 * 00021 * Description: TRUSTED implementation of array proof rules. DO 00022 * NOT use this file in any DP code, use the exported API in 00023 * array_proof_rules.h instead. 00024 * 00025 */ 00026 /*****************************************************************************/ 00027 #ifndef _cvc3__theory_array__array_theorem_producer_h_ 00028 #define _cvc3__theory_array__array_theorem_producer_h_ 00029 00030 #include "array_proof_rules.h" 00031 #include "theorem_producer.h" 00032 00033 namespace CVC3 { 00034 00035 class TheoryArray; 00036 00037 class ArrayTheoremProducer: public ArrayProofRules, public TheoremProducer { 00038 private: 00039 TheoryArray* d_theoryArray; 00040 00041 public: 00042 // Constructor 00043 ArrayTheoremProducer(TheoryArray* theoryArray); 00044 00045 //////////////////////////////////////////////////////////////////// 00046 // Proof rules 00047 //////////////////////////////////////////////////////////////////// 00048 00049 // ==> 00050 // write(store, index_0, v_0, index_1, v_1, ..., index_n, v_n) = store IFF 00051 // 00052 // read(store, index_n) = v_n & 00053 // index_{n-1} != index_n -> read(store, index_{n-1}) = v_{n-1} & 00054 // (index_{n-2} != index_{n-1} & index_{n-2} != index_n) -> read(store, index_{n-2}) = v_{n-2} & 00055 // ... 00056 // (index_1 != index_2 & ... & index_1 != index_n) -> read(store, index_1) = v_1 00057 // (index_0 != index_1 & index_0 != index_2 & ... & index_0 != index_n) -> read(store, index_0) = v_0 00058 Theorem rewriteSameStore(const Expr& e, int n); 00059 00060 // ==> write(store, index, value) = write(...) IFF 00061 // store = write(write(...), index, read(store, index)) & 00062 // value = read(write(...), index) 00063 Theorem rewriteWriteWrite(const Expr& e); 00064 00065 // ==> read(write(store, index1, value), index2) = 00066 // ite(index1 = index2, value, read(store, index2)) 00067 Theorem rewriteReadWrite(const Expr& e); 00068 00069 // e = read(write(store, index1, value), index2): 00070 // ==> ite(index1 = index2, 00071 // read(write(store, index1, value), index2) = value, 00072 // read(write(store, index1, value), index2) = read(store, index2)) 00073 Theorem rewriteReadWrite2(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 Theorem liftReadIte(const Expr& e); 00092 00093 // a /= b |- exists i. a[i] /= b[i] 00094 Theorem arrayNotEq(const Theorem& e); 00095 00096 }; // end of class ArrayTheoremProducer 00097 00098 } // end of namespace CVC3 00099 00100 #endif