records_theorem_producer.h

Go to the documentation of this file.
00001 /*****************************************************************************/
00002 /*!
00003  * \file records_theorem_producer.h
00004  * 
00005  * Author: Daniel Wichs
00006  * 
00007  * Created: Jul 22 22:59:07 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  */
00027 /*****************************************************************************/
00028 #ifndef _CVC_lite__records_theorem_producer_h_
00029 #define _CVC_lite__records_theorem_producer_h_
00030 
00031 #include "records_proof_rules.h"
00032 #include "theorem_producer.h"
00033 #include "theory_records.h"
00034 
00035 namespace CVCL {
00036   
00037   class RecordsTheoremProducer: public RecordsProofRules,
00038     public TheoremProducer {
00039       TheoryRecords* d_theoryRecords;
00040 
00041     public:
00042     // Constructor
00043       RecordsTheoremProducer(TheoremManager* tm, TheoryRecords* t):
00044         TheoremProducer(tm), d_theoryRecords(t) { }
00045       Theorem rewriteLitSelect(const Expr &e);
00046       Theorem rewriteUpdateSelect(const Expr& e);
00047       Theorem rewriteLitUpdate(const Expr& e);
00048       Theorem expandEq(const Theorem& eqThrm);
00049       Theorem expandNeq(const Theorem& neqThrm);
00050       Theorem expandRecord(const Expr& e);
00051       Theorem expandTuple(const Expr& e);
00052 
00053       // Expr creation functions
00054       //! Test whether expr is a record type
00055       bool isRecordType(const Expr& e)
00056         { return d_theoryRecords->isRecordType(e); }
00057       //! Test whether Type is a record type
00058       bool isRecordType(const Type& t)
00059         { return d_theoryRecords->isRecordType(t); }
00060       //! Test whether expr is a record select/update subclass
00061       bool isRecordAccess(const Expr& e)
00062         { return d_theoryRecords->isRecordAccess(e); }
00063       //! Create a record literal
00064       Expr recordExpr(const std::vector<std::string>& fields,
00065                       const std::vector<Expr>& kids)
00066         { return d_theoryRecords->recordExpr(fields, kids); }
00067       //! Create a record literal
00068       Expr recordExpr(const std::vector<Expr>& fields,
00069                       const std::vector<Expr>& kids)
00070         { return d_theoryRecords->recordExpr(fields, kids); }
00071       //! Create a record type
00072       Type recordType(const std::vector<std::string>& fields,
00073                       const std::vector<Type>& types)
00074         { return d_theoryRecords->recordType(fields, types); }
00075       //! Create a record type (field types are given as a vector of Expr)
00076       Type recordType(const std::vector<std::string>& fields,
00077                       const std::vector<Expr>& types)
00078         { return d_theoryRecords->recordType(fields, types); }
00079       //! Create a record field select expression
00080       Expr recordSelect(const Expr& r, const std::string& field)
00081         { return d_theoryRecords->recordSelect(r, field); }
00082       //! Create a record field update expression
00083       Expr recordUpdate(const Expr& r, const std::string& field,
00084                         const Expr& val)
00085         { return d_theoryRecords->recordUpdate(r, field, val); }
00086       //! Get the list of fields from a record literal
00087       const std::vector<Expr>& getFields(const Expr& r)
00088         { return d_theoryRecords->getFields(r); }
00089       //! Get the i-th field name from the record literal or type
00090       const std::string& getField(const Expr& e, int i)
00091         { return d_theoryRecords->getField(e, i); }
00092       //! Get the field index in the record literal or type
00093       /*! The field must be present in the record; otherwise it's an error. */
00094       int getFieldIndex(const Expr& e, const std::string& field)
00095         { return d_theoryRecords->getFieldIndex(e, field); }
00096       //! Get the field name from the record select and update expressions
00097       const std::string& getField(const Expr& e)
00098         { return d_theoryRecords->getField(e); }
00099       //! Create a tuple literal
00100       Expr tupleExpr(const std::vector<Expr>& kids)
00101         { return d_theoryRecords->tupleExpr(kids); }
00102       //! Create a tuple type
00103       Type tupleType(const std::vector<Type>& types)
00104         { return d_theoryRecords->tupleType(types); }
00105       //! Create a tuple type (types of components are given as Exprs)
00106       Type tupleType(const std::vector<Expr>& types)
00107         { return d_theoryRecords->tupleType(types); }
00108       //! Create a tuple index selector expression
00109       Expr tupleSelect(const Expr& tup, int i)
00110         { return d_theoryRecords->tupleSelect(tup, i); }
00111       //! Create a tuple index update expression
00112       Expr tupleUpdate(const Expr& tup, int i, const Expr& val)
00113         { return d_theoryRecords->tupleUpdate(tup, i, val); }
00114       //! Get the index from the tuple select and update expressions
00115       int getIndex(const Expr& e)
00116         { return d_theoryRecords->getIndex(e); }
00117       //! Test whether expr is a tuple select/update subclass
00118       bool isTupleAccess(const Expr& e)
00119         { return d_theoryRecords->isTupleAccess(e); }
00120     };
00121 
00122 } 
00123 
00124 #endif

Generated on Thu Apr 13 16:57:32 2006 for CVC Lite by  doxygen 1.4.4