sbv-7.13/0000755000000000000000000000000013405536617010436 5ustar0000000000000000sbv-7.13/CHANGES.md0000644000000000000000000027356113405536617012046 0ustar0000000000000000* Hackage: * GitHub: * Latest Hackage released version: 7.13, 2018-12-16 ### Version 7.13, 2018-12-16 * Generalize the types of `bminimum` and `bmaximum` by removing the `Num` constraint. * Change the type of `observe` from: `SymWord a => String -> SBV a -> Symbolic ()` to `SymWord a => String -> SBV a -> SBV a`. This allows for more concise observables, like this: prove $ \x -> observe "lhs" (x+x) .== observe "rhs" (2*x+1) Falsifiable. Counter-example: s0 = 0 :: Integer lhs = 0 :: Integer rhs = 1 :: Integer * Add `Data.SBV.Tools.Range` module which defines `ranges` and `rangesWith` functions: They compute the satisfying contiguous ranges for predicates with a single variable. See `Data.SBV.Tools.Range` for examples. * Add `Data.SBV.Tools.BoundedFix` module, which defines the operator `bfix` that can be used as a bounded fixed-point operator for use in bounded-model-checking like algorithms. See `Data.SBV.Tools.BoundedFix` for some example use cases. * Fix list-element extraction code, which asserted too strong a constraint. See issue #421 for details. Thanks to Joel Burget for reporting. * New bounded list functions: `breverse`, `bsort`, `bfoldrM`, `bfoldlM`, and `bmapM`. Contributed by Joel Burget. * Add two new puzzle examples: * `Documentation.SBV.Examples.Puzzles.LadyAndTigers` * `Documentation.SBV.Examples.Puzzles.Garden` ### Version 7.12, 2018-09-23 * Modifications to make SBV compile with GHC 8.6.1. (SBV should now compile fine with all versions of GHC since 8.0.1; and possibly earlier. Please report if you are using a version in this range and have issues.) * Improve the BoundedMutex example to show a non-fair trace. See "Documentation/SBV/Examples/Lists/BoundedMutex.hs". * Improve Haddock documentation links throughout. ### Version 7.11, 2018-09-20 * Add support for symbolic lists. (That is, arbitrary but fixed length symbolic lists of integers, floats, reals, etc. Nested lists are allowed as well.) This is building on top of Joel Burget's initial work for supporting symbolic strings and sequences, as supported by Z3. Note that the list theory solvers are incomplete, so some queries might receive an unknown answer. See "Documentation/SBV/Examples/Lists/Fibonacci.hs" for an example, and the module "Data.SBV.List" for details. * A new module 'Data.SBV.List.Bounded' provides extra functions to manipulate lists with given concrete bounds. Note that SMT solvers cannot deal with recursive functions/inductive proofs in general, so the utilities in this file can come in handy when expressing bounded-model-checking style algorithms. See "Documentation/SBV/Examples/Lists/BoundedMutex.hs" for a simple mutex algorithm proof. * Remove dependency on data-binary-ieee754 package; which is no longer supported. ### Version 7.10, 2018-07-20 * [BACKWARDS COMPATIBILITY] '==' and '/=' now always throw an error instead of only throwing an error for non-concrete values. https://github.com/LeventErkok/sbv/issues/301 * [BACKWARDS COMPATIBILITY] Array declarations are reworked to take an initial value. The call 'newArray' now accepts an optional default value, which itself can be symbolic. If provided, the array will return the given value for all reads from uninitialized locations. If not given, then reads from unwritten locations produce uninterpreted constants. The behavior of 'SFunArray' and 'SArray' is exactly the same in this regard. Note that this is a backwards-compatibility breaking change, as you need to pass a 'Nothing' argument to 'newArray' to get the old behavior. (Solver note: If you use 'SFunArray', then defaults are fully supported by SBV since these are internally handled, concrete or symbolic. If you use 'SArray', which gets translated to SMTLib, then MathSAT and Z3 supports default values with both concrete and symbolic cases, CVC4 only supports if they are constants. Boolector and Yices don't support default values at this point in time, and ABC doesn't support arrays at all.) * [BACKWARDS COMPATIBILITY] SMTException type has been renamed to SBVException. SBV now throws this exception in more cases to aid in building tools on top of SBV that might want to deal with exceptions in different ways. (Previously, we used to call 'error' instead.) * [BACKWARDS COMPATIBILITY] Rename 'assertSoft' to 'assertWithPenalty', which better reflects the nature of this function. Also add extra checks to warn the user if optimization constraints are present in a regular sat/prove call. * Implement 'softConstrain': Similar to 'constrain', except the solver is free to leave it unsatisfied (i.e., leave it false) if necessary to find a satisfying solution. Useful in modeling conditions that are "nice-to-have" but not "required." Note that this is similar to 'assertWithPenalty', except it works in non-optimization contexts. See "Documentation.SBV.Examples.Misc.SoftConstrain" for a simple example. * Add 'CheckedArithmetic' class, which provides bit-vector arithmetic operations that do automatic underflow/overflow checking. The operations follow their regular counter-parts, with an exclamation mark added at the end: +!, -!, *!, /!. There is also negateChecked, for the same function on unary negation. If you program using these functions, then you can call 'safe' on the resulting programs to make sure these operations never cause underflow and overflow conditions. * Similar to above, add 'sFromIntegralChecked', providing overflow/underflow checks for cast operations. * Add "Documentation.SBV.Examples.BitPrecise.BrokenSearch" module to show the use of overflow checking utilities, using the classic broken binary search example from http://ai.googleblog.com/2006/06/extra-extra-read-all-about-it-nearly.html * Fix an issue where SBV was not sending array declarations to the SMT-solver if there were no explicit constraints. Thanks to Oliver Charles for reporting. * Rework 'SFunArray' implementation, addressing performance issues. We now carefully memoize elements as we do the look-ups. This addresses several perfomance issues that came up; hopefully providing some relief. The function 'mkSFunArray' is also removed, which used to lift Haskell functions to such arrays, often used to implement initial values. Now, if a read is done on an unwritten element of 'SFunArray' we get an uninterpreted constant. This is inline with how 'SArray' works, and is consistent. The old 'SFunArray' implementation based on functions is no longer available, though it is easy to implement it in user-space if needed. Please get in contact if this proves to be an issue. * Add 'freshArray' to allow for creation of existential fresh arrays in the query mode. This is similar to 'newArray' which works in the Symbolic mode, and is analogous to 'freshVar'. Most users shouldn't need this as 'newArray' calls should suffice. Only use if you need a brand new array after switching to query mode. * SBV now rejects queries if universally quantified inputs are present. Previously these were allowed to go through, but in general skolemization makes the corresponding variables unusable in the query context. See http://github.com/LeventErkok/sbv/issues/407 for details. If you have an actual use case for such a feature, please get in touch. Thanks to Brian Schroeder for reporting this anomaly. * Export 'addSValOptGoal' from 'Data.SBV.Internals', to help with 'Metric' class instantiations. Requested by Dan Rosen. * Export 'registerKind' from 'Data.SBV.Internals', to help with custom array declarations. Thanks to Brian Schroeder for the patch. * If an asynchronous exception is caught, SBV now throws it back without further processing. (For instance, if the backend solver gets killed. Previously we were turning these into synchronous errors.) Thanks to Oliver Charles for pointing out this corner case. ### Version 7.9, 2018-06-15 * Add support for bit-vector arithmetic underflow/overflow detection. The new 'ArithmeticOverflow' class captures conditions under which addition, subtraction, multiplication, division, and negation can underflow/overflow for both signed and unsigned bit-vector values. The implementation is based on http://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/z3prefix.pdf, and can be used to detect overflow caused bugs in machine arithmetic. See "Data.SBV.Tools.Overflow" for details. * Add 'sFromIntegralO', which is the overflow/underflow detecting variant of 'sFromIntegral'. This function returns (along with the converted result), a pair of booleans showing whether the conversion underflowed or overflowed. * Change the function 'getUnknownReason' to return a proper data-type ('SMTReasonUnknown') as opposed to a mere string. This is at the query level. Similarly, change `Unknown` result to return the same data-type at the sat/prove level. * Interpolants: With Z3 4.8.0 release, Z3 folks have dropped support for producing interpolants. If you need interpolants, you will have to use the MathSAT backend now. Also, the MathSAT API is slightly different from how Z3 supported interpolants as well, which means your old code will need some modifications. See the example in Documentation.SBV.Examples.Queries.Interpolants for the new usage. * Add 'constrainWithAttribute' call, which can be used to attach arbitrary attribute to a constraint. Main use case is in interpolant generation with MathSAT. * C code generation: SBV now spits out linker flag -lm if needed. Thanks to Matt Peddie for reporting. * Code reorg: Simplify constant mapping table, by properly accounting for negative-zero floats. * Export 'sexprToVal' for the class SMTValue, which allows for custom definitions of value extractions. Thanks to Brian Schroeder for the patch. * Export 'Logic' directly from Data.SBV. (Previously was from Control.) * Fix a long standing issue (ever since we introduced queries) where 'sAssert' calls were run in the context of the final output boolean, which is simply the wrong thing to do. ### Version 7.8, Released 2018-05-18 * Fix printing of min-bounds for signed 32/64 bit numbers in C code generation: These are tricky since C does not allow -min_value as a valid literal! Instead we use the macros provided in stdint.h. Thanks to Matt Peddie for reporting this corner case. * Fix translation of the "abs" function in C code generation, making sure we use the correct variant. Thanks to Matt Peddie for reporting. * Fix handling of tables and arrays in pushed-contexts. Previously, we used initializers to get table/array values stored properly. However, this trick does not work if we are in a pushed-context; since a pop can forget the corresponding assignments. SBV now handles this corner case properly, by using tracker assertions to keep track of what array values must be restored at each pop. Thanks to Martin Brain on the SMTLib mailing list for the suggestion. (See https://github.com/LeventErkok/sbv/issues/374 for details.) * Fix corner case in ite branch equality with float/double arguments, where we were previously confusing +/-0 as equal to each other. Thanks to Matt Peddie for reporting. * Add a call 'cgOverwriteFiles', which suppresses code-generation prompts for overwriting files and quiets the prompts during code generation. Thanks to Matt Peddie for the suggestion. * Add support for uninterpreted function introductions in the query mode. Previously, this was only allowed before the query started, now we fully support uninterpreted functions in all modes. * New example: Documentation/SBV/Examples/Puzzles/HexPuzzle.hs, showing how to code cover properties using SBV, using a form of bounded model checking. ### Version 7.7, Released 2018-04-29 * Add support for Symbolic characters ('SChar') and strings ('SString'.) Thanks to Joel Burget for the initial implementation. The 'SChar' type currently corresponds to the Latin-1 character set, and is thus a subset of the Haskell 'Char' type. This is due to the current limitations in SMT-solvers. However, there is a pending SMTLib proposal to support unicode, and SBV will track these changes to have full unicode support: For further details see: http://smtlib.cs.uiowa.edu/theories-UnicodeStrings.shtml The 'SString' type is the type of symbolic strings, consisting of characters from the Latin-1 character set currently, just like the planned 'SChar' improvements. Note that an 'SString' is *not* simply a list of 'SChar' values: It is a symbolic type of its own and is processed as a single item. Conversions from list of characters is possible (via the 'implode' function). In the other direction, one cannot generally 'explode' a string, since it may be of arbitrary length and thus we would not know what concrete list to map it to. This is a bit unlike Haskell, but the differences dissipate quickly in general, and the power of being able to deal with a string as a symbolic entity on its own opens up many verification possibilities. Note that currently only Z3 and CVC4 has support for this logic, and they do differ in some details. Various character/string operations are supported, including length, concatenation, regular-expression matching, substrig operations, recognizers, etc. If you use this logic, you are likely to find bugs in solvers themselves as support is rather new: Please report. * If unsat-core extraction is enabled, SBV now returns the unsat-core directly with in a solver result. Thanks to Ara Adkins for the suggestion. * Add 'observe'. This function allows internal expressions to be given values, which will be part of the satisfyin model or the counter-example upon model construction. Useful for tracking expected/returned values. Also works with quickCheck. * Revamp Haddock documentation, hopefully easier to follow now. * Slightly modify the generated-C headers by removing whitespace. This allows for certain "lint" rules to pass when SBV generated code is used in conjunction with a larger code base. Thanks to Greg Horn for the pull request. * Improve implementation of 'svExp' to match that of '.^', making it more defined when the exponent is constant. Thanks to Brian Huffman for the patch. * Export the underlying polynomial representation for algorithmic reals from the Internals module for further user processing. Thanks to Jan Path for the patch. ### Version 7.6, Released 2018-03-18 * GHC 8.4.1 compatibility: Work around compilation issues. SBV now compiles cleanly with GHC 8.4.1. * Define and export sWordN, sWordN_, sIntN_, from the Dynamic interface, which simplifies creation of variables of arbitrary bit sizes. These are similar to sWord8, sInt8, etc.; except they create dynamic counterparts that can be of arbitrary bit size. ### Version 7.5, Released 2018-01-13 * Remove obsolote references to tactics in a few haddock comments. Thanks to Matthew Pickering for reporting. * Added logic Logic_NONE, to be used in cases where SBV should not try to set the logic. This is useful when there is no viable value to set, and the back-end solver doesn't understand the SMT-Lib convention of using "ALL" as the logic name. (One example of this is the Yices solver.) * SBV now returns SMTException (instead of just calling error) in case the backend solver responds with error message. The type SMTException can be caught by the user programs, and it includes many fields as an indication of what went wrong. (The command sent, what was expected, what was seen, etc.) Note that if this exception is ever caught, the backend solver is no longer alive: You should either just throw it, or perform proper clean-up on your user code as required to set up a new context. The provided show instance formats the exception nicely for display purposes. See https://github.com/LeventErkok/sbv/issues/335 for details and thanks to Brian Huffman for reporting. * SIntegral class now has Integral as a super-class, which ensures the base-type it's used at is Integral. This was already true for all instances, so we are just making it more explicit. * Improve the implementation of .^ (exponentiation) to cover more cases, in particular signed exponents are now OK so long as they are concrete and positive, following Haskell convention. * Removed the 'FromBits' class. Its functionality is now merged with the new 'SFiniteBits' class, see below. * Introduce 'SFiniteBits' class, which only incorporates finite-words in it, i.e., SWord/SInt for 8-16-32-64. In particular it leaves out SInteger, SFloat, SDouble, and SReal. Important in recognizing bit-vectors of finite size, essentially. Here are the methods: class (SymWord a, Num a, Bits a) => SFiniteBits a where sFiniteBitSize :: SBV a -> Int -- ^ Bit size lsb :: SBV a -> SBool -- ^ Least significant bit of a word, always stored at index 0. msb :: SBV a -> SBool -- ^ Most significant bit of a word, always stored at the last position. blastBE :: SBV a -> [SBool] -- ^ Big-endian blasting of a word into its bits. Also see the 'FromBits' class. blastLE :: SBV a -> [SBool] -- ^ Little-endian blasting of a word into its bits. Also see the 'FromBits' class. fromBitsBE :: [SBool] -> SBV a -- ^ Reconstruct from given bits, given in little-endian fromBitsLE :: [SBool] -> SBV a -- ^ Reconstruct from given bits, given in little-endian sTestBit :: SBV a -> Int -> SBool -- ^ Replacement for 'testBit', returning 'SBool' instead of 'Bool' sExtractBits :: SBV a -> [Int] -> [SBool] -- ^ Variant of 'sTestBit', where we want to extract multiple bit positions. sPopCount :: SBV a -> SWord8 -- ^ Variant of 'popCount', returning a symbolic value. setBitTo :: SBV a -> Int -> SBool -> SBV a -- ^ A combo of 'setBit' and 'clearBit', when the bit to be set is symbolic. fullAdder :: SBV a -> SBV a -> (SBool, SBV a) -- ^ Full adder, returns carry-out from the addition. Only for unsigned quantities. fullMultiplier :: SBV a -> SBV a -> (SBV a, SBV a) -- ^ Full multipler, returns both high and low-order bits. Only for unsigned quantities. sCountLeadingZeros :: SBV a -> SWord8 -- ^ Count leading zeros in a word, big-endian interpretation sCountTrailingZeros :: SBV a -> SWord8 -- ^ Count trailing zeros in a word, big-endian interpretation Note that the functions 'sFiniteBitSize', 'sCountLeadingZeros', and 'sCountTrailingZeros' are new. Others have existed in SBV before, we are just grouping them together now in this new class. * Tightened certain signatures where SBV was too liberal, using the SFiniteBits class. New signatures are: sSignedShiftArithRight :: (SFiniteBits a, SIntegral b) => SBV a -> SBV b -> SBV a crc :: (SFiniteBits a, SFiniteBits b) => Int -> SBV a -> SBV b -> SBV b readSTree :: (SFiniteBits i, SymWord e) => STree i e -> SBV i -> SBV e writeSTree :: (SFiniteBits i, SymWord e) => STree i e -> SBV i -> SBV e -> STree i e Thanks to Thomas DuBuisson for reporting. ### Version 7.4, 2017-11-03 * Export queryDebug from the Control module, allowing custom queries to print debugging messages with the verbose flag is set. * Relax value-parsing to allow for non-standard output from solvers. For instance, MathSAT/Yices prints reals as integers when they do not have a fraction. We now support such cases, relaxing the standard slightly. Thanks to Geoffrey Ramseyer for reporting. * Fix optimization routines when applied to signed-bitvector goals. Thanks to Anders Kaseorg for reporting. Since SMT-Lib does not distinguish between signed and unsigned bit-vectors, we have to be careful when expressing goals that are over signed values. See https://github.com/LeventErkok/sbv/issues/333 for details. ### Version 7.3, 2017-09-06 * Query mode: Add support for arrays in query mode. Thanks to Brad Hardy for providing the use-case and debugging help. * Query mode: Add support for tables. (As used by 'select' calls.) ### Version 7.2, 2017-08-29 * Reworked implementation of shifts and rotates: When a signed quantity was being shifted right by more than its size, SBV used to return 0. Robert Dockins pointed out that the correct answer is actually -1 in such cases. The new implementation merges the dynamic and typed interfaces, and drops support for non-constant shifts of unbounded integers, which is not supported by SMTLib. Thanks to Robert for reporting the issue and identifying the root cause. * Rework how quantifiers are handled: We now generate separate asserts for prefix-existentials. This allows for better (smaller) quantified code, while preserving semantics. * Rework the interaction between quantifiers and optimization routines. Optimization routines now properly handle quantified formulas, so long as the quantified metric does not involve any universal quantification itself. Thanks to Matthew Danish for reporting the issue. * Development/Infrastructure: Lots of work around the continuous integration for SBV. We now build/test on Linux/Mac/Windows on every commit. Thanks to Travis/Appveyor for providing free remote infrastructure. There are still gotchas and some reductions in tests due to host capacity issues. If you would like to be involved and improve the test suite, please get in touch! ### Version 7.1, 2017-07-29 * Add support for 'getInterpolant' in Query mode. * Support for SMT-results that can contain multi-line strings, which is rare but it does happen. Previously SBV incorrectly interpreted such responses to be erroneous. * Many improvements to build infrastructure and code clean-up. * Fix a bug in the implementation of `svSetBit`. Thanks to Robert Dockins for the report. ### Version 7.0, 2017-07-19 * NB. SBV now requires GHC >= 8.0.1 to compile. If you are stuck with an older version of GHC, please get in contact. * This is a major rewrite of the internals of SBV, and is a backwards compatibility breaking release. While we kept the top-level and most commonly used APIs the same (both types and semantics), much of the internals and advanced features have been rewritten to move SBV to a new model of execution: SBV no longer runs your program symbolically and calls the SMT solver afterwards. Instead, the interaction with the solver happens interleaved with the actual program execution. The motivation is to allow the end-users to send/receive arbitrary SMTLib commands to the solver, instead of the cooked-up recipes. SBV still provides all the recipes for its existing functionality, but users can now interact with the solver directly. See the module "Data.SBV.Control" for the main API, together with the new functions 'runSMT' and 'runSMTWith'. * The 'Tactic' based solver control (introduced in v6.0) is completely removed, and is replaced by the above described mechanism which gives the user a lot of flexibility instead. Use queries for anything that required a tactic before. * The call 'allSat' has been reworked so it performs only one call to the underlying solver and repeatedly issues check-sat to get new assignments. This differs from the previous implementation where we spun off a new call to the executable for each successive model. While this is more efficient and much more preferable, it also means that the results are no longer lazily computed: If there is an infinite number of solutions (or a very large number), you can no longer merely do a 'take' on the result. While this is inconvenient, it fits better with our new methodology of query based interaction. Note that the old behavior can be modeled, if required, by the user; by explicitly interleaving the calls to 'sat.' Furthermore, we now provide a new configuration parameter named 'allSatMaxModelCount' which can be used to limit the number models we seek. The default is to get all models, however long that might take. * The Bridge modules (`Data.SBV.Bridge.Yices`, `Data.SBV.Bridge.Z3`) etc. are all removed. The bridge functionality was hardly used, where different solvers were much easier to access using the `with` functions. (Such as `proveWith`, `satWith` etc.) This should result in no loss of functionality, except for occasional explicit mention of solvers in your code, if you were using bridge modules to start with. * Optimization routines have been changed to take a priority as an argument, (i.e., Lexicographic, Independent, etc.). The old method of supplying the priority via tactics is no longer supported. * Pareto-front extraction has been reworked, reflecting the changes in Z3 for this functionality. Since pareto-fronts can be infinite in number, the user is now allowed to specify a "limit" to stop the solver from querying ad infinitum. If the limit is not specified, then sbv will query till it exhausts all the pareto-fronts, or till it runs out of memory in case there is an infinite number of them. * Extraction of unsat-cores has changed. To use this feature, we now use custom queries. See "Data.SBV.Examples.Misc.UnsatCore" for an example. Old style of unsat-core extraction is no longer supported. * The 'timing' option of SMTConfig has been reworked. Since we now start the solver immediately, it is no longer sensible to distinguish between "SBV" time, "translation" time etc. Instead, we print one simple "Elapsed" time if requested. If you need a detailed timing analysis, use the new 'transcript' option to SMTConfig: It will produce a file with precise timing intervals for each command issued to help you figure out how long each step took. * The following functions have been reworked, so they now also return the time-elapsed for each solver: satWithAll :: Provable a => [SMTConfig] -> a -> IO [(Solver, NominalDiffTime, SatResult)] satWithAny :: Provable a => [SMTConfig] -> a -> IO (Solver, NominalDiffTime, SatResult) proveWithAll :: Provable a => [SMTConfig] -> a -> IO [(Solver, NominalDiffTime, ThmResult)] proveWithAny :: Provable a => [SMTConfig] -> a -> IO (Solver, NominalDiffTime, ThmResult) * Changed the way `satWithAny` and `proveWithAny` works. Previously, these two functions ran multiple solvers, and took the result of the first one to finish, killing all the others. In addition, they *waited* for the still-running solvers to finish cleaning-up, as sending a 'ThreadKilled' is usually not instantaneous. Furthermore, a solver might simply take its time! We now send the interrupt but do not wait for the process to actually terminate. In rare occasions this could create zombie processes if you use a solver that is not cooperating, but we have seen not insignificant speed-ups for regular usage due to ThreadKilled wait times being rather long. * Configuration option `useLogic` is removed. If required, this should be done by a call to the new 'setLogic' function: setLogic QF_NRA * Configuration option `timeOut` is removed. This was rarely used, and the solver support was rather sketchy. We now have a better mechanism in the query mode for timeouts, where it really matters. Please get in touch if you relied on this old mechanism. Correspondingly, the functions `isTheorem`, `isSatisfiable`, `isTheoremWith` and `isSatisfiableWith` had their time-out arguments removed and return types simplified. * The function 'isSatisfiableInCurrentPath' is removed. Proper queries should be used for what this function tentatively attempted to provide. Please get in touch if you relied on this function and want to restructure your code to use proper queries. * Configuration option 'smtFile' is removed. Instead use 'transcript' now, which provides a much more detailed output that is directly loadable to a solver and has an accurate account of precisely what SBV sent. * Enumerations are now much easier to use symbolically, with the addition of the template-haskell splice mkSymbolicEnumeration. See "Data/SBV/Examples/Misc/Enumerate.hs" for an example. * Thanks to Kanishka Azimi, our external test suite is now run by Tasty! Kanishka modernized the test suite, and reworked the infrastructure that was showing its age. Thanks! * The function pConstrain and the Data.SBV.Tools.ExpectedValue are removed. Probabilistic constraints were rarely used, and if necessary can be implemented outside of SBV. If you were using this feature, please get in contact. * SArray and SFunArray has been reworked, and they no longer take and initial value. Similarly resetArray has been removed, as it did not really do what it advertised. If an initial value is needed, it is best to code this explicitly in your model. ### Version 6.1, 2017-05-26 * Add support for unsat-core extraction. To use this feature, use the `namedConstraint` function: namedConstraint :: String -> SBool -> Symbolic () to associate a label to a constrain or a boolean term that can later be labeled by the backend solver as belonging to the unsat-core. Unsat-cores are not enabled by default since they can be expensive; to use: satWith z3{getUnsatCore=True} $ do ... In the programmatic API, the function: extractUnsatCore :: Modelable a => a -> Maybe [String] can be used to programmatically extract the unsat-core. Note that backend solvers will only include the named expressions in the unsat-core, i.e., any unnamed yet part-of-the-core-unsat expressions will be missing; as speculated in the SMT-Lib document itself. Currently, Z3, MathSAT, and CVC4 backends support unsat-cores. (Thanks to Rohit Ramesh for the suggestion leading to this feature.) * Added function `distinct`, which returns true if all the elements of the given list are different. This function replaces the old `allDifferent` function, which is now removed. The difference is that `distinct` will produce much better code for SMT-Lib. If you used `allDifferent` before, simply replacing it with `distinct` should work. * Add support for pseudo-boolean operations: pbAtMost :: [SBool] -> Int -> SBool pbAtLeast :: [SBool] -> Int -> SBool pbExactly :: [SBool] -> Int -> SBool pbLe :: [(Int, SBool)] -> Int -> SBool pbGe :: [(Int, SBool)] -> Int -> SBool pbEq :: [(Int, SBool)] -> Int -> SBool pbMutexed :: [SBool] -> SBool pbStronglyMutexed :: [SBool] -> SBool These functions, while can be directly coded in SBV, produce better translations to SMTLib for more efficient solving of cardinality constraints. Currently, only Z3 supports pseudo-booleans directly. For all other solvers, SBV will translate these to equivalent terms that do not require special functions. * The function getModel has been renamed to getAssignment. (The former name is now available as a query command.) * Export `SolverCapabilities` from `Data.SBV.Internals`, in case users want access. * Move code-generation facilities to `Data.SBV.Tools.CodeGen`, no longer exporting the relevant functions directly from `Data.SBV`. This could break existing code, but the fix should be as simple as `import Data.SBV.Tools.CodeGen`. * Move the following two functions to `Data.SBV.Internals`: compileToSMTLib generateSMTBenchmarks If you use them, please `import Data.SBV.Internals`. * Reorganized `EqSymbolic` and `EqOrd` classes to collect some of the similarly named function together. Users should see no impact due to this change. ### Version 6.0, 2017-05-07 * This is a backwards compatibility breaking release, hence the major version bump from 5.15 to 6.0: - Most of existing code should work with no changes. - Old code relying on some features might require extra imports, since we no longer export some functionality directly from `Data.SBV`. This was done in order to reduce the number of exported items to avoid extra clutter. - Old optimization features are removed, as the new and much improved capabilities should be used instead. * The next two bullets cover new features in SBV regarding optimization, based on the capabilities of the z3 SMT solver. With this release SBV gains the capability optimize objectives, and solve MaxSAT problems; by appropriately employing the corresponding capabilities in z3. A good review of these features as implemented by Z3, and thus what is available in SBV is given in this paper: http://www.easychair.org/publications/download/Z_-_Maximal_Satisfaction_with_Z3 * SBV now allows for real or integral valued metrics. Goals can be lexicographically (default), independently, or pareto-front optimized. Currently, only the z3 backend supports optimization routines. Optimization can be done over bit-vector, real, and integer goals. The relevant functions are: - `minimize`: Minimize a given arithmetic goal - `maximize`: Minimize a given arithmetic goal For instance, a call of the form minimize "name-of-goal" $ x + 2*y Minimizes the arithmetic goal x+2*y, where x and y can be bit-vectors, reals, or integers. Such goals will be lexicographically optimized, i.e., in the order given. If there are multiple goals, then user can also ask for independent optimization results, or pareto-fronts. Once the objectives are given, a top level call to `optimize` (similar to `prove` and `sat`) performs the optimization. * SBV now implements soft-asserts. A soft assertion is a hint to the SMT solver that we would like a particular condition to hold if *possible*. That is, if there is a solution satisfying it, then we would like it to hold. However, if the set of constraints is unsatisfiable, then a soft-assertion can be violated by incurring a user-given numeric penalty to satisfy the remaining constraints. The solver then tries to minimize the penalty, i.e., satisfy as many of the soft-asserts as possible such that the total penalty for those that are not satisfied is minimized. Note that `assertSoft` works well with optimization goals (minimize/maximize etc.), and are most useful when we are optimizing a metric and thus some of the constraints can be relaxed with a penalty to obtain a good solution. * SBV no longer provides the old optimization routines, based on iterative and quantifier based methods. Those methods were rarely used, and are now superseded by the above mechanism. If the old code is needed, please contact for help: They can be resurrected in your own code if absolutely necessary. * (NB. This feature is deprecated in 7.0, see above for its replacement.) SBV now implements tactics, which allow the user to navigate the proof process. This is an advanced feature that most users will have no need of, but can become handy when dealing with complicated problems. Users can, for instance, implement case-splitting in a proof to guide the underlying solver through. Here is the list of tactics implemented: - `CaseSplit` : Case-split, with implicit coverage. Bool says whether we should be verbose. - `CheckCaseVacuity` : Should the case-splits be checked for vacuity? (Default: True.) - `ParallelCase` : Run case-splits in parallel. (Default: Sequential.) - `CheckConstrVacuity`: Should constraints be checked for vacuity? (Default: False.) - `StopAfter` : Time-out given to solver, in seconds. - `CheckUsing` : Invoke with check-sat-using command, instead of check-sat - `UseLogic` : Use this logic, a custom one can be specified too - `UseSolver` : Use this solver (z3, yices, etc.) - `OptimizePriority` : Specify priority for optimization: Lexicographic (default), Independent, or Pareto. * Name-space clean-up. The following modules are no longer automatically exported from Data.SBV: - `Data.SBV.Tools.ExpectedValue` (computing with expected values) - `Data.SBV.Tools.GenTest` (test case generation) - `Data.SBV.Tools.Polynomial` (polynomial arithmetic, CRCs etc.) - `Data.SBV.Tools.STree` (full symbolic binary trees) To use the functionality of these modules, users must now explicitly import the corresponding module. Not other changes should be needed other than the explicit import. * Changed the signatures of: isSatisfiableInCurrentPath :: SBool -> Symbolic Bool svIsSatisfiableInCurrentPath :: SVal -> Symbolic Bool to: isSatisfiableInCurrentPath :: SBool -> Symbolic (Maybe SatResult) svIsSatisfiableInCurrentPath :: SVal -> Symbolic (Maybe SatResult) which returns the result in case of SAT. This is more useful than before. This is backwards-compatibility breaking, but is more useful. (Requested by Jared Ziegler.) * Add instance `Provable (Symbolic ())`, which simply stands for returning true for proof/sat purposes. This allows for simpler coding, as constrain/minimize/maximize calls (which return unit) can now be directly sat/prove processed, without needing a final call to return at the end. * Add type synonym `Goal` (for `Symbolic ()`), in order to simplify type signatures * SBV now properly adds check-sat commands and other directives in debugging output. * New examples: - Data.SBV.Examples.Optimization.LinearOpt: Simple linear-optimization example. - Data.SBV.Examples.Optimization.Production: Scheduling machines in a shop - Data.SBV.Examples.Optimization.VM: Scheduling virtual-machines in a data-center ### Version 5.15, 2017-01-30 * Bump up dependency on CrackNum >= 1.9, to get access to hexadecimal floats. * Improve time/tracking-print code. Thanks to Iavor Diatchki for the patch. ### Version 5.14, 2017-01-12 * Bump up QuickCheck dependency to >= 2.9.2 to avoid the following quick-check bug , which transitively impacted the quick-check as implemented by SBV. * Generalize casts between integral-floats, using the rounding mode round-nearest-ties-to-even. Previously calls to sFromIntegral did not support conversion to floats since it needed a rounding mode. But it does make sense to support them with the default mode. If a different mode is needed, use the function 'toSFloat' as before, which takes an explicit rounding mode. ### Version 5.13, 2016-10-29 * Fix broken links, thanks to Stephan Renatus for the patch. * Code generation: Create directory path if it does not exist. Thanks to Robert Dockins for the patch. * Generalize the type of sFromIntegral, dropping the Bits requirement. In turn, this allowed us to remove sIntegerToSReal, since sFromIntegral can be used instead. * Add support for sRealToSInteger. (Essentially the floor function for SReal.) * Several space-leaks fixed for better performance. Patch contributed by Robert Dockins. * Improved Random instance for Rational. Thanks to Joe Leslie-Hurd for the idea. ### Version 5.12, 2016-06-06 * Fix GHC8.0 compliation issues, and warning clean-up. Thanks to Adam Foltzer for the bulk of the work and Tom Sydney Kerckhove for the initial patch for 8.0 compatibility. * Minor fix to printing models with floats when the base is 2/16, making sure the alignment is done properly accommodating for the crackNum output. * Wait for external process to die on exception, to avoid spawning zombies. Thanks to Daniel Wagner for the patch. * Fix hash-consed arrays: Previously we were caching based only on elements, which is not sufficient as you can have conflicts differing only on the address type, but same contents. Thanks to Brian Huffman for reporting and the corresponding patch. ### Version 5.11, 2016-01-15 * Fix documentation issue; no functional changes ### Version 5.10, 2016-01-14 * Documentation: Fix a bunch of dead http links. Thanks to Andres Sicard-Ramirez for reporting. * Additions to the Dynamic API: * svSetBit : set a given bit * svBlastLE, svBlastBE : Bit-blast to big/little endian * svWordFromLE, svWordFromBE: Unblast from big/little endian * svAddConstant : Add a constant to an SVal * svIncrement, svDecrement : Add/subtract 1 from an SVal ### Version 5.9, 2016-01-05 * Default definition for 'symbolicMerge', which allows types that are instances of 'Generic' to have an automatically derivable merge (i.e., ite) instance. Thanks to Christian Conkle for the patch. * Add support for "non-model-vars," where we can now tell SBV not to take into account certain variables from a model-building perspective. This comes handy in doing an `allSat` calls where there might be witness variables that we do not care the uniqueness for. See "Data/SBV/Examples/Misc/Auxiliary.hs" for an example, and the discussion in https://github.com/LeventErkok/sbv/issues/208 for motivation. * Yices interface: If Reals are used, then pick the logic QF_UFLRA, instead of QF_AUFLIA. Unfortunately, logic selection remains tricky since the SMTLib story for logic selection is rather messy. Other solvers are not impacted by this change. ### Version 5.8, 2016-01-01 * Fix some typos * Add 'svEnumFromThenTo' to the Dynamic interface, allowing dynamic construction of [x, y .. z] and [x .. y] when the involved values are concrete. * Add 'svExp' to the Dynamic interface, implementing exponentiation ### Version 5.7, 2015-12-21 * Export `HasKind(..)` from the Dynamic interface. Thanks to Adam Foltzer for the patch. * More careful handling of SMT-Lib reserved names. * Update tested version of MathSAT to 5.3.9 * Generalize `sShiftLeft`/`sShiftRight`/`sRotateLeft`/`sRotateRight` to work with signed shift/rotate amounts, where negative values revert the direction. Similar generalizations are also done for the dynamic variants. ### Version 5.6, 2015-12-06 * Minor changes to how we print models: * Align by the type * Always print the type (previously we were skipping for Bool) * Rework how SBV properties are quick-checked; much more usable and robust * Provide a function `sbvQuickCheck`, which is essentially the same as quickCheck, except it also returns a boolean. Useful for the programmable API. (The dynamic version is called `svQuickCheck`.) * Several changes/additions in support of the sbvPlugin development: * Data.SBV.Dynamic: Define/export `svFloat`/`svDouble`/`sReal`/`sNumerator`/`sDenominator` * Data.SBV.Internals: Export constructors of `Result`, `SMTModel`, and the function `showModel` * Simplify how Uninterpreted-types are internally represented. ### Version 5.5, 2015-11-10 * This is essentially the same release as 5.4 below, except to allow SBV compile with GHC 7.8 series. Thanks to Adam Foltzer for the patch. ### Version 5.4, 2015-11-09 * Add 'sAssert', which allows users to pepper their code with boolean conditions, much like the usual ASSERT calls. Note that the semantics of an 'sAssert' is that it is a NOOP, i.e., it simply returns its final argument. Use in coordination with 'safe' and 'safeWith', see below. * Implement 'safe' and 'safeWith', which statically determine all calls to 'sAssert' being safe to execute. Any violations will be flagged. * SBV->C: Translate 'sAssert' calls to dynamic checks in the generated C code. If this is not desired, use the 'cgIgnoreSAssert' function to turn it off. * Add 'isSafe': Which converts a 'SafeResult' to a 'Bool', when we are only interested in a boolean result. * Add Data/SBV/Examples/Misc/NoDiv0 to demonstrate the use of the 'safe' function. ### Version 5.3, 2015-10-20 * Main point of this release to make SBV compile with GHC 7.8 again, to accommodate mainly for Cryptol. As Cryptol moves to GHC >= 7.10, we intend to remove the "compatibility" changes again. Thanks to Adam Foltzer for the patch. * Minor mods to how bitvector equality/inequality are translated to SMTLib. No user visible impact. ### Version 5.2, 2015-10-12 * Regression on 5.1: Fix a minor bug in base 2/16 printing where uninterpreted constants were not handled correctly. ### Version 5.1, 2015-10-10 * fpMin, fpMax: If these functions receive +0/-0 as their two arguments, i.e., both zeros but alternating signs in any order, then SMTLib requires the output to be nondeterministicly chosen. Previously, we fixed this result as +0 following the interpretation in Z3, but Z3 recently changed and now incorporates the nondeterministic output. SBV similarly changed to allow for non-determinism here. * Change the types of the following Floating-point operations: * sFloatAsSWord32, sFloatAsSWord32, blastSFloat, blastSDouble These were previously coded as relations, since NaN values were not representable in the target domain uniquely. While it was OK, it was hard to use them. We now simply implement these as functions, and they are underspecified if the inputs are NaNs: In those cases, we simply get a symbolic output. The new types are: * sFloatAsSWord32 :: SFloat -> SWord32 * sDoubleAsSWord64 :: SDouble -> SWord64 * blastSFloat :: SFloat -> (SBool, [SBool], [SBool]) * blastSDouble :: SDouble -> (SBool, [SBool], [SBool]) * MathSAT backend: Use the SMTLib interpretation of fp.min/fp.max by passing the "-theory.fp.minmax_zero_mode=4" argument explicitly. * Fix a bug in hash-consing of floating-point constants, where we were confusing +0 and -0 since we were using them as keys into the map though they compare equal. We now explicitly keep track of the negative-zero status to make sure this confusion does not arise. Note that this bug only exhibited itself in rare occurrences of both constants being present in a benchmark; a true corner case. Note that @NaN@ values are also interesting in this context: Since NaN /= NaN, we never hash-cons floating point constants that have the value NaN. But that is actually OK; it is a bit wasteful in case you have a lot of NaN constants around, but there is no soundness issue: We just waste a little bit of space. * Remove the functions `allSatWithAny` and `allSatWithAll`. These two variants do *not* make sense when run with multiple solvers, as they internally sequentialize the solutions due to the nature of `allSat`. Not really needed anyhow; so removed. The variants `satWithAny/All` and `proveWithAny/All` are still available. * Export SMTLibVersion from the library, forgotten export needed by Cryptol. Thanks to Adam Foltzer for the patch. * Slightly modify model-outputs so the variables are aligned vertically. (Only matters if we have model-variable names that are of differing length.) * Move to Travis-CI "docker" based infrastructure for builds * Enable local builds to use the Herbie plugin. Currently SBV does not have any expressions that can benefit from Herbie, but it is nice to have this support in general. ### Version 5.0, 2015-09-22 * Note: This is a backwards-compatibility breaking release, see below for details. * SBV now requires GHC 7.10.1 or newer to be compiled, taking advantage of newer features/bug-fixes in GHC. If you really need SBV to compile with older GHCs, please get in touch. * SBV no longer supports SMTLib1. We now exclusively use SMTLib2 for communicating with backend solvers. Strictly speaking, this means some loss in functionality: Uninterpreted-function models that we supported via Yices-1 are no longer available. In practice this facility was not really used, and required a very old version of Yices that was no longer supported by SRI and has lacked in other features. So, in reality this change should hardly matter for end-users. * Added function "label", which is useful in emitting comments around expressions. It is essentially a no-op, but does generate a comment with the given text in the SMT-Lib and C output, for diagnostic purposes. * Added "sFromIntegral": Conversions from all integral types (SInteger, SWord/SInts) between each other. Similar to the "fromIntegral" function of Haskell. These generate simple casts when used in code-generation to C, and thus are very efficient. * SBV no longer supports the functions sBranch/sAssert, as we realized these functions can cause soundness issues under certain conditions. While the triggering scenarios are not common use-cases for these functions, we are opting for safety, and thus removing support. See http://github.com/LeventErkok/sbv/issues/180 for details; and see below for the new function 'isSatisfiableInCurrentPath'. * A new function 'isSatisfiableInCurrentPath' is added, which checks for satisfiability during a symbolic simulation run. This function can be used as the basis of sBranch/sAssert like functionality if needed. The difference is that this is a much lower level call, and also exposes the fact that the result is in the 'Symbolic' monad (which avoids the soundness issue). Of course, the new type makes it less useful as it will not be a drop-in replacement for if-then-else like structure. Intended to be used by tools built on top of SBV, as opposed to end-users. * SBV no longer implements the 'SignCast' class, as its functionality is replaced by the 'sFromIntegral' function. Programs using the functions 'signCast' and 'unsignCast' should simply replace both with calls to 'sFromIntegral'. (Note that extra type-annotations might be necessary, similar to the uses of the 'fromIntegral' function in Haskell.) * Backend solver related changes: * Yices: Upgraded to work with Yices release 2.4.1. Note that earlier versions of Yices are *not* supported. * Boolector: Upgraded to work with new Boolector release 2.0.7. Note that earlier versions of Boolector are *not* supported. * MathSAT: Upgraded to work with latest release 5.3.7. Note that earlier versions of MathSAT are *not* supported (due to a buffering issue in MathSAT itself.) * MathSAT: Enabled floating-point support in MathSAT. * New examples: * Add Data.SBV.Examples.Puzzles.Birthday, which solves the Cheryl-Birthday problem that went viral in April 2015. Turns out really easy to solve for SMT, but the formalization of the problem is still interesting as an exercise in formal reasoning. * Add Data.SBV.Examples.Puzzles.SendMoreMoney, which solves the classic send + more = money problem. Really a trivial example, but included since it is pretty much the hello-world for basic constraint solving. * Add Data.SBV.Examples.Puzzles.Fish, which solves a typical logic puzzle; finding the unique solution to a set of assertions made about a bunch of people, their pets, beverage choices, etc. Not particularly interesting, but could be fun to play around with for modeling purposes. * Add Data.SBV.Examples.BitPrecise.MultMask, which demonstrates the use of the bitvector solver to an interesting bit-shuffling problem. * Rework floating-point arithmetic, and add missing floating-point operations: * fpRem : remainder * fpRoundToIntegral: truncating round * fpMin : min * fpMax : max * fpIsEqualObject : FP equality as object (i.e., NaN equals NaN, +0 does not equal -0, etc.) This brings SBV up-to par with everything supported by the SMT-Lib FP theory. * Add the IEEEFloatConvertable class, which provides conversions to/from Floats and other types. (i.e., value conversions from all other types to Floats and Doubles; and back.) * Add SWord32/SWord64 to/from SFloat/SDouble conversions, as bit-pattern reinterpretation; using the IEEE754 interchange format. The functions are: sWord32AsSFloat, sWord64AsSDouble, sFloatAsSWord32, sDoubleAsSWord64. Note that the sWord32AsSFloat and sWord64ToSDouble are regular functions, but sFloatToSWord32 and sDoubleToSWord64 are "relations", since NaN values are not uniquely convertable. * Add 'sExtractBits', which takes a list of indices to extract bits from, essentially equivalent to 'map sTestBit'. * Rename a set of symbolic functions for consistency. Here are the old/new names: * sbvTestBit --> sTestBit * sbvPopCount --> sPopCount * sbvShiftLeft --> sShiftLeft * sbvShiftRight --> sShiftRight * sbvRotateLeft --> sRotateLeft * sbvRotateRight --> sRotateRight * sbvSignedShiftArithRight --> sSignedShiftArithRight * Rename all FP recognizers to be in sync with FP operations. Here are the old/new names: * isNormalFP --> fpIsNormal * isSubnormalFP --> fpIsSubnormal * isZeroFP --> fpIsZero * isInfiniteFP --> fpIsInfinite * isNaNFP --> fpIsNaN * isNegativeFP --> fpIsNegative * isPositiveFP --> fpIsPositive * isNegativeZeroFP --> fpIsNegativeZero * isPositiveZeroFP --> fpIsPositiveZero * isPointFP --> fpIsPoint * Lots of other work around floating-point, test cases, reorg, etc. * Introduce shorter variants for rounding modes: sRNE, sRNA, sRTP, sRTN, sRTZ; aliases for sRoundNearestTiesToEven, sRoundNearestTiesToAway, sRoundTowardPositive, sRoundTowardNegative, and sRoundTowardZero; respectively. ### Version 4.4, 2015-04-13 * Hook-up crackNum package; so counter-examples involving floats and doubles can be printed in detail when the printBase is chosen to be 2 or 16. (With base 10, we still get the simple output.) ``` Prelude Data.SBV> satWith z3{printBase=2} $ \x -> x .== (2::SFloat) Satisfiable. Model: s0 = 2.0 :: Float 3 2 1 0 1 09876543 21098765432109876543210 S ---E8--- ----------F23---------- Binary: 0 10000000 00000000000000000000000 Hex: 4000 0000 Precision: SP Sign: Positive Exponent: 1 (Stored: 128, Bias: 127) Value: +2.0 (NORMAL) ``` * Change how we print type info; for models insted of SType just print Type (i.e., for SWord8, instead print Word8) which makes more sense and is more consistent. This change should be mostly relevant as how we see the counter-example output. * Fix long standing bug #75, where we now support arrays with Boolean source/targets. This is not a very commonly used case, but by letting the solver pick the logic, we now allow arrays to be uniformly supported. ### Version 4.3, 2015-04-10 * Introduce Data.SBV.Dynamic, by Brian Huffman. This is mostly an internal reorg of the SBV codebase, and end-users should not be impacted by the changes. The introduction of the Dynamic SBV variant (i.e., one that does not mandate a phantom type as in "SBV Word8" etc. allows library writers more flexibility as they deal with arbitrary bit-vector sizes. The main customer of these changes are the Cryptol language and the associated toolset, but other developers building on top of SBV can find it useful as well. NB: The "strongly-typed" aspect of SBV is still the main way end-users should interact with SBV, and nothing changed in that respect! * Add symbolic variants of floating-point rounding-modes for convenience * Rename toSReal to sIntegerToSReal, which captures the intent more clearly * Code clean-up: remove mbMinBound/mbMaxBound thus allowing less calls to unliteral. Contributed by Brian Huffman. * Introduce FP conversion functions: * Between SReal and SFloat/SDouble * fpToSReal * sRealToSFloat * sRealToSDouble * Between SWord32 and SFloat * sWord32ToSFloat * sFloatToSWord32 * Between SWord64 and SDouble. (Relational, due to non-unique NaNs) * sWord64ToSDouble * sDoubleToSWord64 * From float to sign/exponent/mantissa fields: (Relational, due to non-unique NaNs) * blastSFloat * blastSDouble * Rework floating point classifiers. Remove isSNaN and isFPPoint (both renamed), and add the following new recognizers: * isNormalFP * isSubnormalFP * isZeroFP * isInfiniteFP * isNaNFP * isNegativeFP * isPositiveFP * isNegativeZeroFP * isPositiveZeroFP * isPointFP (corresponds to a real number, i.e., neither NaN nor infinity) * Re-implement sbvTestBit, by Brian Huffman. This version is much faster at large word sizes, as it avoids the costly mask generation. * Code changes to suppress warnings with GHC7.10. General clean-up. ### Version 4.2, 2015-03-17 * Add exponentiation (.^). Thanks to Daniel Wagner for contributing the code! * Better handling of SBV_$SOLVER_OPTIONS, in particular keeping track of proper quoting in environment variables. Thanks to Adam Foltzer for the patch! * Silence some hlint/ghci warnings. Thanks to Trevor Elliott for the patch! * Haddock documentation fixes, improvements, etc. * Change ABC default option string to %blast; "&sweep -C 5000; &syn4; &cec -s -m -C 2000" which seems to give good results. Use SBV_ABC_OPTIONS environment variable (or via abc.rc file and a combination of SBV_ABC_OPTIONS) to experiment. ### Version 4.1, 2015-03-06 * Add support for the ABC solver from Berkeley. Thanks to Adam Foltzer for the required infrastructure! See: http://www.eecs.berkeley.edu/~alanmi/abc/ And Alan Mishchenko for adding infrastructure to ABC to work with SBV. * Upgrade the Boolector connection to use a SMT-Lib2 based interaction. NB. You need at least Boolector 2.0.6 installed! * Tracking changes in the SMT-Lib floating-point theory. If you are using symbolic floating-point types (i.e., SFloat and SDouble), then you should upgrade to this version and also get a very latest (unstable) Z3 release. See http://smtlib.cs.uiowa.edu/theories-FloatingPoint.shtml for details. * Introduce a new class, 'RoundingFloat', which supports floating-point operations with arbitrary rounding-modes. Note that Haskell only allows RoundNearestTiesToAway, but with SBV, we get all 5 IEEE754 rounding-modes and all the basic operations ('fpAdd', 'fpMul', 'fpDiv', etc.) with these modes. * Allow Floating-Point RoundingMode to be symbolic as well * Improve the example "Data/SBV/Examples/Misc/Floating.hs" to include rounding-mode based addition example. * Changes required to make SBV compile with GHC 7.10; mostly around instance NFData declarations. Thanks to Iavor Diatchki for the patch. * Export a few extra symbols from the Internals module (mainly for Cryptol usage.) ### Version 4.0, 2015-01-22 This release mainly contains contributions from Brian Huffman, allowing end-users to define new symbolic types, such as Word4, that SBV does not natively support. When GHC gets type-level literals, we shall most likely incorporate arbitrary bit-sized vectors and ints using this mechanism, but in the interim, this release provides a means for the users to introduce individual instances. * Modifications to support arbitrary bit-sized vectors; These changes have been contributed by Brian Huffman of Galois.. Thanks Brian. * A new example "Data/SBV/Examples/Misc/Word4.hs" showing how users can add new symbolic types. * Support for rotate-left/rotate-right with variable rotation amounts. (From Brian Huffman.) ### Version 3.5, 2015-01-15 This release is mainly adding support for enumerated types in Haskell being translated to their symbolic counterparts; instead of going completely uninterpreted. * Keep track of data-type details for uninterpreted sorts. * Rework the U2Bridge example to use enumerated types. * The "Uninterpreted" name no longer makes sense with this change, so rework the relevant names to ensure proper internal naming. * Add Data/SBV/Examples/Misc/Enumerate.hs as an example for demonstrating how enumerations are translated. * Fix a long-standing bug in the implementation of select when translated as SMT-Lib tables. (Github issue #103.) Thanks to Brian Huffman for reporting. ### Version 3.4, 2014-12-21 * This release is mainly addressing floating-point changes in SMT-Lib. * Track changes in the QF_FPA logic standard; new constants and alike. If you are using the floating-point logic, then you need a relatively new version of Z3 installed (4.3.3 or newer). * Add unary-negation as an explicit operator. Previously, we merely used the "0-x" semantics; but with floating point, this does not hold as 0-0 is 0, and is not -0! (Note that negative-zero is a valid floating point value, that is different than positive-zero; yet it compares equal to it. Sigh..) * Similarly, add abs as a native method; to make sure we map it to fp.abs for floating point values. * Test suite improvements ### Version 3.3, 2014-12-05 * Implement 'safe' and 'safeWith', which statically determine all calls to 'sAssert' being safe to execute. This way, users can pepper their programs with liberal calls to 'sAssert' and check they are all safe in one go without further worry. * Robustify the interface to external solvers, by making sure we catch cases where the external solver might exist but not be runnable (library dependency missing, for example). It is impossible to be absolutely foolproof, but we now catch a few more cases and fail gracefully. ### Version 3.2, 2014-11-18 * Implement 'sAssert'. This adds conditional symbolic simulation, by ensuring arbitrary boolean conditions hold during simulation; similar to ASSERT calls in other languages. Note that failures will be detected at symbolic-simulation time, i.e., each assert will generate a call to the external solver to ensure that the condition is never violated. If violation is possible the user will get an error, indicating the failure conditions. * Also implement 'sAssertCont' which allows for a programmatic way to extract/display results for consumers of 'sAssert'. While the latter simply calls 'error' in case of an assertion violation, the 'sAssertCont' variant takes a continuation which can be used to program how the results should be interpreted/displayed. (This is useful for libraries built on top of SBV.) Note that the type of the continuation is such that execution should still stop, i.e., once an assertion violation is detected, symbolic simulation will never continue. * Rework/simplify the 'Mergeable' class to make sure 'sBranch' is sufficiently lazy in case of structural merges. The original implementation was only lazy at the Word instance, but not at lists/tuples etc. Thanks to Brian Huffman for reporting this bug. * Add a few constant-folding optimizations for 'sDiv' and 'sRem' * Boolector: Modify output parser to conform to the new Boolector output format. This means that you need at least v2.0.0 of Boolector installed if you want to use that particular solver. * Fix long-standing translation bug regarding boolean Ord class comparisons. (i.e., 'False > True' etc.) While Haskell allows for this, SMT-Lib does not; and hence we have to be careful in translating. Thanks to Brian Huffman for reporting. * C code generation: Correctly translate square-root and fusedMA functions to C. ### Version 3.1, 2014-07-12 NB: GHC 7.8.1 and 7.8.2 has a serious bug that causes SBV to crash under heavy/repeated calls. The bug is addressed in GHC 7.8.3; so upgrading to GHC 7.8.3 is essential for using SBV! New features/bug-fixes in v3.1: * Using multiple-SMT solvers in parallel: * Added functions that let the user run multiple solvers, using asynchronous threads. All results can be obtained (proveWithAll, proveWithAny, satWithAll), or SBV can return the fastest result (satWithAny, allSatWithAll, allSatWithAny). These functions are good for playing with multiple-solvers, especially on machines with multiple-cores. * Add function: sbvAvailableSolvers; which returns the list of solvers currently available, as installed on the machine we are running. (Not the list that SBV supports, but those that are actually available at run-time.) This function is useful with the multi-solve API. * Implement sBranch: * sBranch is a variant of 'ite' that consults the external SMT solver to see if a given branch condition is satisfiable before evaluating it. This can make certain otherwise recursive and thus not-symbolically-terminating inputs amenable to symbolic simulation, if termination can be established this way. Needless to say, this problem is always decidable as far as SBV programs are concerned, but it does not mean the decision procedure is cheap! Use with care. * sBranchTimeOut config parameter can be used to curtail long runs when sBranch is used. Of course, if time-out happens, SBV will assume the branch is feasible, in which case symbolic-termination may come back to bite you.) * New API: * Add predicate 'isSNaN' which allows testing 'SFloat'/'SDouble' values for nan-ness. This is similar to the Prelude function 'isNaN', except the Prelude version requires a RealFrac instance, which unfortunately is not currently implementable for cases. (Requires trigonometric functions etc.) Thus, we provide 'isSNaN' separately (along with the already existing 'isFPPoint') to simplify reasoning with floating-point. * Examples: * Add Data/SBV/Examples/Misc/SBranch.hs, to illustrate the use of sBranch. * Bug fixes: * Fix pipe-blocking issue, which exhibited itself in the presence of large numbers of variables (> 10K or so). See github issue #86. Thanks to Philipp Meyer for the fine report. * Misc: * Add missing SFloat/SDouble instances for SatModel class * Explicitly support KBool as a kind, separating it from "KUnbounded False 1". Thanks to Brian Huffman for contributing the changes. This should have no user-visible impact, but comes in handy for internal reasons. ### Version 3.0, 2014-02-16 * Support for floating-point numbers: * Preliminary support for IEEE-floating point arithmetic, introducing the types `SFloat` and `SDouble`. The support is still quite new, and Z3 is the only solver that currently features a solver for this logic. Likely to have bugs, both at the SBV level, and at the Z3 level; so any bug reports are welcome! * New backend solvers: * SBV now supports MathSAT from Fondazione Bruno Kessler and DISI-University of Trento. See: http://mathsat.fbk.eu/ * Support all-sat calls in the presence of uninterpreted sorts: * Implement better support for `allSat` in the presence of uninterpreted sorts. Previously, SBV simply rejected running `allSat` queries in the presence of uninterpreted sorts, since it was not possible to generate a refuting model. The model returned by the SMT solver is simply not usable, since it names constants that is not visible in a subsequent run. Eric Seidel came up with the idea that we can actually compute equivalence classes based on a produced model, and assert the constraint that the new model should disallow the previously found equivalence classes instead. The idea seems to work well in practice, and there is also an example program demonstrating the functionality: Examples/Uninterpreted/UISortAllSat.hs * Programmable model extraction improvements: * Add functions `getModelDictionary` and `getModelDictionaries`, which provide low-level access to models returned from SMT solvers. Former for `sat` and `prove` calls, latter for `allSat` calls. Together with the exported utils from the `Data.SBV.Internals` module, this should allow for expert users to dissect the models returned and do fancier programming on top of SBV. * Add `getModelValue`, `getModelValues`, `getModelUninterpretedValue`, and `getModelUninterpretedValues`; which further aid in model value extraction. * Other: * Allow users to specify the SMT-Lib logic to use, if necessary. SBV will still pick the logic automatically, but users can now override that choice. Comes in handy when playing with custom logics. * Bug fixes: * Address allsat-laziness issue (#78 in github issue tracker). Essentially, simplify how all-sat is called so we can avoid calling the solver for solutions that are not needed. Thanks to Eric Seidel for reporting. * Examples: * Add Data/SBV/Examples/Misc/ModelExtract.hs as a simple example for programmable model extraction and usage. * Add Data/SBV/Examples/Misc/Floating.hs for some FP examples. * Use the AUFLIA logic in Examples.Existentials.Diophantine which helps z3 complete the proof quickly. (The BV logics take too long for this problem.) ### Version 2.10, 2013-03-22 * Add support for the Boolector SMT solver * See: http://fmv.jku.at/boolector/ * Use `import Data.SBV.Bridge.Boolector` to use Boolector from SBV * Boolector supports QF_BV (with an without arrays). In the last SMT-Lib competition it won both bit-vector categories. It is definitely worth trying it out for bitvector problems. * Changes to the library: * Generalize types of `allDifferent` and `allEqual` to take arbitrary EqSymbolic values. (Previously was just over SBV values.) * Add `inRange` predicate, which checks if a value is bounded within two others. * Add `sElem` predicate, which checks for symbolic membership * Add `fullAdder`: Returns the carry-over as a separate boolean bit. * Add `fullMultiplier`: Returns both the lower and higher bits resulting from multiplication. * Use the SMT-Lib Bool sort to represent SBool, instead of bit-vectors of length 1. While this is an under-the-hood mechanism that should be user-transparent, it turns out that one can no longer write axioms that return booleans in a direct way due to this translation. This change makes it easier to write axioms that utilize booleans as there is now a 1-to-1 match. (Suggested by Thomas DuBuisson.) * Solvers changes: * Z3: Update to the new parameter naming schema of Z3. This implies that you need to have a really recent version of Z3 installed, something in the Z3-4.3 series. * Examples: * Add Examples/Uninterpreted/Shannon.hs: Demonstrating Shannon expansion, boolean derivatives, etc. * Bug-fixes: * Gracefully handle the case if the backend-SMT solver does not put anything in stdout. (Reported by Thomas DuBuisson.) * Handle uninterpreted sort values, if they happen to be only created via function calls, as opposed to being inputs. (Reported by Thomas DuBuisson.) ### Version 2.9, 2013-01-02 * Add support for the CVC4 SMT solver from Stanford: NB. Z3 remains the default solver for SBV. To use CVC4, use the *With variants of the interface (i.e., proveWith, satWith, ..) by passing cvc4 as the solver argument. (Similarly, use 'yices' as the argument for the *With functions for invoking yices.) * Latest release of Yices calls the SMT-Lib based solver executable yices-smt. Updated the default value of the executable to have this name for ease of use. * Add an extra boolean flag to compileToSMTLib and generateSMTBenchmarks functions to control if the translation should keep the query as is (for SAT cases), or negate it (for PROVE cases). Previously, this value was hard-coded to do the PROVE case only. * Add bridge modules, to simplify use of different solvers. You can now say: import Data.SBV.Bridge.CVC4 import Data.SBV.Bridge.Yices import Data.SBV.Bridge.Z3 to pick the appropriate default solver. if you simply 'import Data.SBV', then you will get the default SMT solver, which is currently Z3. The value 'defaultSMTSolver' refers to z3 (currently), and 'sbvCurrentSolver' refers to the chosen solver as determined by the imported module. (The latter is useful for modifying options to the SMT solver in an solver-agnostic way.) * Various improvements to Z3 model parsing routines. * New web page for SBV: http://leventerkok.github.com/sbv/ is now online. ### Version 2.8, 2012-11-29 * Rename the SNum class to SIntegral, and make it index over regular types. This makes it much more useful, simplifying coding of polymorphic symbolic functions over integral types, which is the common case. * Add the functions: * sbvShiftLeft * sbvShiftRight which can accommodate unsigned symbolic shift amounts. Note that one cannot use the Haskell shiftL/shiftR functions from the Bits class since they are hard-wired to take 'Int' values as the shift amounts only. * Add a new function 'sbvArithShiftRight', which is the same as a shift-right, except it uses the MSB of the input as the bit to fill in (instead of always filling in with 0 bits). Note that this is the same as shiftRight for signed values, but differs from a shiftRight when the input is unsigned. (There is no Haskell analogue of this function, as Haskell shiftR is always arithmetic for signed types and logical for unsigned ones.) This variant is designed for use cases when one uses the underlying unsigned SMT-Lib representation to implement custom signed operations, for instance. * Several typo fixes. ### Version 2.7, 2012-10-21 * Add missing QuickCheck instance for SReal * When dealing with concrete SReals, make sure to operate only on exact algebraic reals on the Haskell side, leaving true algebraic reals (i.e., those that are roots of polynomials that cannot be expressed as a rational) symbolic. This avoids issues with functions that we cannot implement directly on the Haskell side, like exact square-roots. * Documentation tweaks, typo fixes etc. * Rename BVDivisible class to SDivisible; since SInteger is also an instance of this class, and SDivisible is a more appropriate name to start with. Also add sQuot and sRem methods; along with sDivMod, sDiv, and sMod, with usual semantics. * Improve test suite, adding many constant-folding tests and start using cabal based tests (--enable-tests option.) ### Versions 2.4, 2.5, and 2.6: Around mid October 2012 * Workaround issues related hackage compilation, in particular to the problem with the new containers package release, which does provide an NFData instance for sequences. * Add explicit Num requirements when necessary, as the Bits class no longer does this. * Remove dependency on the hackage package strict-concurrency, as hackage can no longer compile it due to some dependency mismatch. * Add forgotten Real class instance for the type 'AlgReal' * Stop putting bounds on hackage dependencies, as they cause more trouble then they actually help. (See the discussion here: .) ### Version 2.3, 2012-07-20 * Maintenance release, no new features. * Tweak cabal dependencies to avoid using packages that are newer than those that come with ghc-7.4.2. Apparently this is a no-no that breaks many things, see the discussion in this thread: http://www.haskell.org/pipermail/haskell-cafe/2012-July/102352.html In particular, the use of containers >= 0.5 is *not* OK until we have a version of GHC that comes with that version. ### Version 2.2, 2012-07-17 * Maintenance release, no new features. * Update cabal dependencies, in particular fix the regression with respect to latest version of the containers package. ### Version 2.1, 2012-05-24 * Library: * Add support for uninterpreted sorts, together with user defined domain axioms. See Data.SBV.Examples.Uninterpreted.Sort and Data.SBV.Examples.Uninterpreted.Deduce for basic examples of this feature. * Add support for C code-generation with SReals. The user picks one of 3 possible C types for the SReal type: CgFloat, CgDouble or CgLongDouble, using the function cgSRealType. Naturally, the resulting C program will suffer a loss of precision, as it will be subject to IEE-754 rounding as implied by the underlying type. * Add toSReal :: SInteger -> SReal, which can be used to promote symbolic integers to reals. Comes handy in mixed integer/real computations. * Examples: * Recast the dog-cat-mouse example to use the solver over reals. * Add Data.SBV.Examples.Uninterpreted.Sort, and Data.SBV.Examples.Uninterpreted.Deduce for illustrating uninterpreted sorts and axioms. ### Version 2.0, 2012-05-10 This is a major release of SBV, adding support for symbolic algebraic reals: SReal. See http://en.wikipedia.org/wiki/Algebraic_number for details. In brief, algebraic reals are solutions to univariate polynomials with rational coefficients. The arithmetic on algebraic reals is precise, with no approximation errors. Note that algebraic reals are a proper subset of all reals, in particular transcendental numbers are not representable in this way. (For instance, "sqrt 2" is algebraic, but pi, e are not.) However, algebraic reals is a superset of rationals, so SBV now also supports symbolic rationals as well. You *should* use Z3 v4.0 when working with real numbers. While the interface will work with older versions of Z3 (or other SMT solvers in general), it uses Z3 root-obj construct to retrieve and query algebraic reals. While SReal values have infinite precision, printing such values is not trivial since we might need an infinite number of digits if the result happens to be irrational. The user controls printing precision, by specifying how many digits after the decimal point should be printed. The default number of decimal digits to print is 10. (See the 'printRealPrec' field of SMT-solver configuration.) The acronym SBV used to stand for Symbolic Bit Vectors. However, SBV has grown beyond bit-vectors, especially with the addition of support for SInteger and SReal types and other code-generation utilities. Therefore, "SMT Based Verification" is now a better fit for the expansion of the acronym SBV. Other notable changes in the library: * Add functions s[TYPE] and s[TYPE]s for each symbolic type we support (i.e., sBool, sBools, sWord8, sWord8s, etc.), to create symbolic variables of the right kind. Strictly speaking these are just synonyms for 'free' and 'mapM free' (plural versions), so they are not adding any additional power. Except, they are specialized at their respective types, and might be easier to remember. * Add function solve, which is merely a synonym for (return . bAnd), but it simplifies expressing problems. * Add class SNum, which simplifies writing polymorphic code over symbolic values * Increase haddock coverage metrics * Major code refactoring around symbolic kinds * SMTLib2: Emit ":produce-models" call before setting the logic, as required by the SMT-Lib2 standard. [Patch provided by arrowdodger on github, thanks!] Bugs fixed: * [Performance] Use a much simpler default definition for "select": While the older version (based on binary search on the bits of the indexer) was correct, it created unnecessarily big expressions. Since SBV does not have a notion of concrete subwords, the binary-search trick was not bringing any advantage in any case. Instead, we now simply use a linear walk over the elements. Examples: * Change dog-cat-mouse example to use SInteger for the counts * Add merge-sort example: Data.SBV.Examples.BitPrecise.MergeSort * Add diophantine solver example: Data.SBV.Examples.Existentials.Diophantine ### Version 1.4, 2012-05-10 * Interim release for test purposes ### Version 1.3, 2012-02-25 * Workaround cabal/hackage issue, functionally the same as release 1.2 below ### Version 1.2, 2012-02-25 Library: * Add a hook so users can add custom script segments for SMT solvers. The new "solverTweaks" field in the SMTConfig data-type can be used for this purpose. The need for this came about due to the need to workaround a Z3 v3.2 issue detailed below: http://stackoverflow.com/questions/9426420/soundness-issue-with-integer-bv-mixed-benchmarks As a consequence, mixed Integer/BV problems can cause soundness issues in Z3 and does in SBV. Unfortunately, it is too severe for SBV to add the workaround option, as it slows down the solver as a side effect as well. Thus, we are making this optionally available if/when needed. (Note that the work-around should not be necessary with Z3 v3.3; which is not released yet.) * Other minor clean-up ### Version 1.1, 2012-02-14 Library: * Rename bitValue to sbvTestBit * Add sbvPopCount * Add a custom implementation of 'popCount' for the Bits class instance of SBV (GHC >= 7.4.1 only) * Add 'sbvCheckSolverInstallation', which can be used to check that the given solver is installed and good to go. * Add 'generateSMTBenchmarks', simplifying the generation of SMTLib benchmarks for offline sharing. ### Version 1.0, 2012-02-13 Library: * Z3 is now the "default" SMT solver. Yices is still available, but has to be specifically selected. (Use satWith, allSatWith, proveWith, etc.) * Better handling of the pConstrain probability threshold for test case generation and quickCheck purposes. * Add 'renderTest', which accompanies 'genTest' to render test vectors as Haskell/C/Forte program segments. * Add 'expectedValue' which can compute the expected value of a symbolic value under the given constraints. Useful for statistical analysis and probability computations. * When saturating provable values, use forAll_ for proofs and forSome_ for sat/allSat. (Previously we were allways using forAll_, which is not incorrect but less intuitive.) * add function: extractModels :: SatModel a => AllSatResult -> [a] which simplifies accessing allSat results greatly. Code-generation: * add "cgGenerateMakefile" which allows the user to choose if SBV should generate a Makefile. (default: True) Other * Changes to make it compile with GHC 7.4.1. ### Version 0.9.24, 2011-12-28 Library: * Add "forSome," analogous to "forAll." (The name "exists" would've been better, but it's already taken.) This is not as useful as one might think as forAll and forSome do not nest, as an inner application of one pushes its argument to a Predicate, making the outer one useless, but it is nonetheless useful by itself. * Add a "Modelable" class, which simplifies model extraction. * Add support for quick-check at the "Symbolic SBool" level. Previously SBV only allowed functions returning SBool to be quick-checked, which forced a certain style of coding. In particular with the addition of quantifiers, the new coding style mostly puts the top-level expressions in the Symbolic monad, which were not quick-checkable before. With new support, the quickCheck, prove, sat, and allSat commands are all interchangeable with obvious meanings. * Add support for concrete test case generation, see the genTest function. * Improve optimize routines and add support for iterative optimization. * Add "constrain", simplifying conjunctive constraints, especially useful for adding constraints at variable generation time via forall/exists. Note that the interpretation of such constraints is different for genTest and quickCheck functions, where constraints will be used for appropriately filtering acceptable test values in those two cases. * Add "pConstrain", which probabilistically adds constraints. This is useful for quickCheck and genTest functions for filtering acceptable test values. (Calls to pConstrain will be rejected for sat/prove calls.) * Add "isVacuous" which can be used to check that the constraints added via constrain are satisfiable. This is useful to prevent vacuous passes, i.e., when a proof is not just passing because the constraints imposed are inconsistent. (Also added accompanying isVacuousWith.) * Add "free" and "free_", analogous to "forall/forall_" and "exists/exists_" The difference is that free behaves universally in a proof context, while it behaves existentially in a sat context. This allows us to express properties more succinctly, since the intended semantics is usually this way depending on the context. (i.e., in a proof, we want our variables universal, in a sat call existential.) Of course, exists/forall are still available when mixed quantifiers are needed, or when the user wants to be explicit about the quantifiers. Examples * Add Data/SBV/Examples/Puzzles/Coins.hs. (Shows the usage of "constrain".) Dependencies * Bump up random package dependency to 1.0.1.1 (from 1.0.0.2) Internal * Major reorganization of files to and build infrastructure to decrease build times and better layout * Get rid of custom Setup.hs, just use simple build. The extra work was not worth the complexity. ### Version 0.9.23, 2011-12-05 Library: * Add support for SInteger, the type of signed unbounded integer values. SBV can now prove theorems about unbounded numbers, following the semantics of Haskell Integer type. (Requires z3 to be used as the backend solver.) * Add functions 'optimize', 'maximize', and 'minimize' that can be used to find optimal solutions to given constraints with respect to a given cost function. * Add 'cgUninterpret', which simplifies code generation when we want to use an alternate definition in the target language (i.e., C). This is important for efficient code generation, when we want to take advantage of native libraries available in the target platform. Other: * Change getModel to return a tuple in the success case, where the first component is a boolean indicating whether the model is "potential." This is used to indicate that the solver actually returned "unknown" for the problem and the model might therefore be bogus. Note that we did not need this before since we only supported bounded bit-vectors, which has a decidable theory. With the addition of unbounded Integers and quantifiers, the solvers can now return unknown. This should still be rare in practice, but can happen with the use of non-linear constructs. (i.e., multiplication of two variables.) ### Version 0.9.22, 2011-11-13 The major change in this release is the support for quantifiers. The SBV library *no* longer assumes all variables are universals in a proof, (and correspondingly existential in a sat) call. Instead, the user marks free-variables appropriately using forall/exists functions, and the solver translates them accordingly. Note that this is a non-backwards compatible change in sat calls, as the semantics of formulas is essentially changing. While this is unfortunate, it is more uniform and simpler to understand in general. This release also adds support for the Z3 solver, which is the main SMT-solver used for solving formulas involving quantifiers. More formally, we use the new AUFBV/ABV/UFBV logics when quantifiers are involved. Also, the communication with Z3 is now done via SMT-Lib2 format. Eventually the SMTLib1 connection will be severed. The other main change is the support for C code generation with uninterpreted functions enabling users to interface with external C functions defined elsewhere. See below for details. Other changes: Code: * Change getModel, so it returns an Either value to indicate something went wrong; instead of throwing an error * Add support for computing CRCs directly (without needing polynomial division). Code generation: * Add "cgGenerateDriver" function, which can be used to turn on/off driver program generation. Default is to generate a driver. (Issue "cgGenerateDriver False" to skip the driver.) For a library, a driver will be generated if any of the constituent parts has a driver. Otherwise it will be skipped. * Fix a bug in C code generation where "Not" over booleans were incorrectly getting translated due to need for masking. * Add support for compilation with uninterpreted functions. Users can now specify the corresponding C code and SBV will simply call the "native" functions instead of generating it. This enables interfacing with other C programs. See the functions: cgAddPrototype, cgAddDecl, cgAddLDFlags Examples: * Add CRC polynomial generation example via existentials * Add USB CRC code generation example, both via polynomials and using the internal CRC functionality ### Version 0.9.21, 2011-08-05 Code generation: * Allow for inclusion of user makefiles * Allow for CCFLAGS to be set by the user * Other minor clean-up ### Version 0.9.20, 2011-06-05 Regression on 0.9.19; add missing file to cabal ### Version 0.9.19, 2011-06-05 * Add SignCast class for conversion between signed/unsigned quantities for same-sized bit-vectors * Add full-binary trees that can be indexed symbolically (STree). The advantage of this type is that the reads and writes take logarithmic time. Suitable for implementing faster symbolic look-up. * Expose HasSignAndSize class through Data.SBV.Internals * Many minor improvements, file re-orgs Examples: * Add sentence-counting example * Add an implementation of RC4 ### Version 0.9.18, 2011-04-07 Code: * Re-engineer code-generation, and compilation to C. In particular, allow arrays of inputs to be specified, both as function arguments and output reference values. * Add support for generation of generation of C-libraries, allowing code generation for a set of functions that work together. Examples: * Update code-generation examples to use the new API. * Include a library-generation example for doing 128-bit AES encryption ### Version 0.9.17, 2011-03-29 Code: * Simplify and reorganize the test suite Examples: * Improve AES decryption example, by using table-lookups in InvMixColumns. ### Version 0.9.16, 2011-03-28 Code: * Further optimizations on Bits instance of SBV Examples: * Add AES algorithm as an example, showing how encryption algorithms are particularly suitable for use with the code-generator ### Version 0.9.15, 2011-03-24 Bug fixes: * Fix rotateL/rotateR instances on concrete words. Previous versions was bogus since it relied on the Integer instance, which does the wrong thing after normalization. * Fix conversion of signed numbers from bits, previous version did not handle twos complement layout correctly Testing: * Add a sleuth of concrete test cases on arithmetic to catch bugs. (There are many of them, ~30K, but they run quickly.) ### Version 0.9.14, 2011-03-19 * Re-implement sharing using Stable names, inspired by the Data.Reify techniques. This avoids tricks with unsafe memory stashing, and hence is safe. Thus, issues with respect to CAFs are now resolved. ### Version 0.9.13, 2011-03-16 Bug fixes: * Make sure SBool short-cut evaluations are done as early as possible, as these help with coding recursion-depth based algorithms, when dealing with symbolic termination issues. Examples: * Add fibonacci code-generation example, original code by Lee Pike. * Add a GCD code-generation/verification example ### Version 0.9.12, 2011-03-10 New features: * Add support for compilation to C * Add a mechanism for offline saving of SMT-Lib files Bug fixes: * Output naming bug, reported by Josef Svenningsson * Specification bug in Legatos multiplier example ### Version 0.9.11, 2011-02-16 * Make ghc-7.0 happy, minor re-org on the cabal file/Setup.hs ### Version 0.9.10, 2011-02-15 * Integrate commits from Iavor: Generalize SBVs to keep track the integer directly without resorting to different leaf types * Remove the unnecessary CLC instruction from the Legato example * More tests ### Version 0.9.9, 2011-01-23 * Support for user-defined SMT-Lib axioms to be specified for uninterpreted constants/functions * Move to using doctest style inline tests ### Version 0.9.8, 2011-01-22 * Better support for uninterpreted-functions * Support counter-examples with SArrays * Ladner-Fischer scheme example * Documentation updates ### Version 0.9.7, 2011-01-18 * First stable public hackage release ### Versions 0.0.0 - 0.9.6, Mid 2010 through early 2011 * Basic infrastructure, design exploration sbv-7.13/COPYRIGHT0000644000000000000000000000024713405536617011734 0ustar0000000000000000Copyright (c) 2010-2018, Levent Erkok (erkokl@gmail.com) All rights reserved. The sbv library is distributed with the BSD3 license. See the LICENSE file for details. sbv-7.13/INSTALL0000644000000000000000000000067213405536617011474 0ustar0000000000000000The sbv library can be installed simply by issuing cabal install like this: cabal install sbv SBV relies on an external SMT solver to be installed. We currently support ABC, Boolector, CVC4, MathSAT, Yices, and Z3. We recommend installing the freely available z3 SMT solver from Microsoft, the default solver used by SBV. You can get it from . Please make sure that the "z3" executable is in your path. sbv-7.13/LICENSE0000644000000000000000000000303713405536617011446 0ustar0000000000000000SBV: SMT Based Verification in Haskell Copyright (c) 2010-2018, Levent Erkok (erkokl@gmail.com) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the developer (Levent Erkok) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LEVENT ERKOK BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. sbv-7.13/README.md0000644000000000000000000000151113405536617011713 0ustar0000000000000000## SBV: SMT Based Verification in Haskell [![Hackage version](http://img.shields.io/hackage/v/sbv.svg?label=Hackage)](http://hackage.haskell.org/package/sbv) Please see: http://leventerkok.github.io/sbv/ ### Build Status - Linux: - GHC 8.2.2 [![Build1][3]][1] - GHC 8.4.3 [![Build1][4]][1] - Mac OSX: - GHC 8.4.3 [![Build1][5]][1] - Windows: - GHC 8.4.3 [![Build5][6]][2] [1]: https://travis-ci.org/LeventErkok/sbv [2]: https://ci.appveyor.com/project/LeventErkok/sbv [3]: https://travis-matrix-badges.herokuapp.com/repos/LeventErkok/sbv/branches/master/1 [4]: https://travis-matrix-badges.herokuapp.com/repos/LeventErkok/sbv/branches/master/2 [5]: https://travis-matrix-badges.herokuapp.com/repos/LeventErkok/sbv/branches/master/3 [6]: https://ci.appveyor.com/api/projects/status/github/LeventErkok/sbv?svg=true sbv-7.13/sbv.cabal0000644000000000000000000003246113405536617012222 0ustar0000000000000000Name: sbv Version: 7.13 Category: Formal Methods, Theorem Provers, Bit vectors, Symbolic Computation, Math, SMT Synopsis: SMT Based Verification: Symbolic Haskell theorem prover using SMT solving. Description: Express properties about Haskell programs and automatically prove them using SMT (Satisfiability Modulo Theories) solvers. . For details, please see: Copyright: Levent Erkok, 2010-2018 License: BSD3 License-file: LICENSE Stability: Experimental Author: Levent Erkok Homepage: http://leventerkok.github.com/sbv/ Bug-reports: http://github.com/LeventErkok/sbv/issues Maintainer: Levent Erkok (erkokl@gmail.com) Build-Type: Simple Cabal-Version: 1.14 Data-Files: SBVTestSuite/GoldFiles/*.gold Extra-Source-Files: INSTALL, README.md, COPYRIGHT, CHANGES.md source-repository head type: git location: git://github.com/LeventErkok/sbv.git Library default-language: Haskell2010 ghc-options : -Wall other-extensions: BangPatterns DefaultSignatures DeriveAnyClass DeriveDataTypeable FlexibleContexts FlexibleInstances FunctionalDependencies GeneralizedNewtypeDeriving MultiParamTypeClasses OverlappingInstances ParallelListComp PatternGuards Rank2Types RankNTypes ScopedTypeVariables StandaloneDeriving TemplateHaskell TupleSections TypeOperators TypeSynonymInstances Build-Depends : base >= 4.9 && < 5 , crackNum >= 2.3 , ghc, QuickCheck, template-haskell , array, async, containers, deepseq, directory, filepath, time , pretty, process, mtl, random, syb , generic-deriving Exposed-modules : Data.SBV , Data.SBV.Control , Data.SBV.Dynamic , Data.SBV.Internals , Data.SBV.List , Data.SBV.List.Bounded , Data.SBV.String , Data.SBV.Char , Data.SBV.RegExp , Data.SBV.Tools.CodeGen , Data.SBV.Tools.GenTest , Data.SBV.Tools.Overflow , Data.SBV.Tools.Polynomial , Data.SBV.Tools.Range , Data.SBV.Tools.BoundedFix , Data.SBV.Tools.STree , Documentation.SBV.Examples.BitPrecise.BitTricks , Documentation.SBV.Examples.BitPrecise.BrokenSearch , Documentation.SBV.Examples.BitPrecise.Legato , Documentation.SBV.Examples.BitPrecise.MergeSort , Documentation.SBV.Examples.BitPrecise.MultMask , Documentation.SBV.Examples.BitPrecise.PrefixSum , Documentation.SBV.Examples.CodeGeneration.AddSub , Documentation.SBV.Examples.CodeGeneration.CRC_USB5 , Documentation.SBV.Examples.CodeGeneration.Fibonacci , Documentation.SBV.Examples.CodeGeneration.GCD , Documentation.SBV.Examples.CodeGeneration.PopulationCount , Documentation.SBV.Examples.CodeGeneration.Uninterpreted , Documentation.SBV.Examples.Crypto.AES , Documentation.SBV.Examples.Crypto.RC4 , Documentation.SBV.Examples.Existentials.CRCPolynomial , Documentation.SBV.Examples.Existentials.Diophantine , Documentation.SBV.Examples.Lists.Fibonacci , Documentation.SBV.Examples.Lists.Nested , Documentation.SBV.Examples.Lists.BoundedMutex , Documentation.SBV.Examples.Misc.Enumerate , Documentation.SBV.Examples.Misc.Floating , Documentation.SBV.Examples.Misc.ModelExtract , Documentation.SBV.Examples.Misc.Auxiliary , Documentation.SBV.Examples.Misc.NoDiv0 , Documentation.SBV.Examples.Misc.Polynomials , Documentation.SBV.Examples.Misc.SoftConstrain , Documentation.SBV.Examples.Misc.Word4 , Documentation.SBV.Examples.Optimization.LinearOpt , Documentation.SBV.Examples.Optimization.Production , Documentation.SBV.Examples.Optimization.VM , Documentation.SBV.Examples.Optimization.ExtField , Documentation.SBV.Examples.Puzzles.Birthday , Documentation.SBV.Examples.Puzzles.Coins , Documentation.SBV.Examples.Puzzles.Counts , Documentation.SBV.Examples.Puzzles.DogCatMouse , Documentation.SBV.Examples.Puzzles.Euler185 , Documentation.SBV.Examples.Puzzles.Fish , Documentation.SBV.Examples.Puzzles.Garden , Documentation.SBV.Examples.Puzzles.HexPuzzle , Documentation.SBV.Examples.Puzzles.LadyAndTigers , Documentation.SBV.Examples.Puzzles.MagicSquare , Documentation.SBV.Examples.Puzzles.NQueens , Documentation.SBV.Examples.Puzzles.SendMoreMoney , Documentation.SBV.Examples.Puzzles.Sudoku , Documentation.SBV.Examples.Puzzles.U2Bridge , Documentation.SBV.Examples.Queries.AllSat , Documentation.SBV.Examples.Queries.UnsatCore , Documentation.SBV.Examples.Queries.FourFours , Documentation.SBV.Examples.Queries.GuessNumber , Documentation.SBV.Examples.Queries.CaseSplit , Documentation.SBV.Examples.Queries.Enums , Documentation.SBV.Examples.Queries.Interpolants , Documentation.SBV.Examples.Strings.RegexCrossword , Documentation.SBV.Examples.Strings.SQLInjection , Documentation.SBV.Examples.Uninterpreted.AUF , Documentation.SBV.Examples.Uninterpreted.Deduce , Documentation.SBV.Examples.Uninterpreted.Function , Documentation.SBV.Examples.Uninterpreted.Shannon , Documentation.SBV.Examples.Uninterpreted.Sort , Documentation.SBV.Examples.Uninterpreted.UISortAllSat Other-modules : Data.SBV.Core.AlgReals , Data.SBV.Core.Concrete , Data.SBV.Core.Data , Data.SBV.Core.Kind , Data.SBV.Core.Model , Data.SBV.Core.Operations , Data.SBV.Core.Floating , Data.SBV.Core.Splittable , Data.SBV.Core.Symbolic , Data.SBV.Control.Query , Data.SBV.Control.Types , Data.SBV.Control.Utils , Data.SBV.Compilers.C , Data.SBV.Compilers.CodeGen , Data.SBV.SMT.SMT , Data.SBV.SMT.SMTLib , Data.SBV.SMT.SMTLib2 , Data.SBV.SMT.SMTLibNames , Data.SBV.SMT.Utils , Data.SBV.Provers.Prover , Data.SBV.Provers.Boolector , Data.SBV.Provers.CVC4 , Data.SBV.Provers.Yices , Data.SBV.Provers.Z3 , Data.SBV.Provers.MathSAT , Data.SBV.Provers.ABC , Data.SBV.Utils.Boolean , Data.SBV.Utils.Numeric , Data.SBV.Utils.TDiff , Data.SBV.Utils.Lib , Data.SBV.Utils.PrettyNum , Data.SBV.Utils.SExpr Test-Suite SBVTest type : exitcode-stdio-1.0 default-language: Haskell2010 ghc-options : -Wall -with-rtsopts=-K64m other-extensions: DeriveAnyClass , DeriveDataTypeable , Rank2Types , ScopedTypeVariables Build-depends : base >= 4.9, filepath, syb, crackNum >= 2.3 , sbv, directory, random, mtl, containers , template-haskell, bytestring, tasty, tasty-golden, tasty-hunit, tasty-quickcheck, QuickCheck Hs-Source-Dirs : SBVTestSuite main-is : SBVTest.hs Other-modules : Utils.SBVTestFramework , TestSuite.Arrays.InitVals , TestSuite.Arrays.Memory , TestSuite.Arrays.Query , TestSuite.Basics.AllSat , TestSuite.Basics.ArithNoSolver , TestSuite.Basics.ArithSolver , TestSuite.Basics.Assert , TestSuite.Basics.BasicTests , TestSuite.Basics.BoundedList , TestSuite.Basics.Exceptions , TestSuite.Basics.GenBenchmark , TestSuite.Basics.Higher , TestSuite.Basics.Index , TestSuite.Basics.IteTest , TestSuite.Basics.ProofTests , TestSuite.Basics.PseudoBoolean , TestSuite.Basics.QRem , TestSuite.Basics.Quantifiers , TestSuite.Basics.Recursive , TestSuite.Basics.SmallShifts , TestSuite.Basics.SquashReals , TestSuite.Basics.String , TestSuite.Basics.List , TestSuite.Basics.TOut , TestSuite.BitPrecise.BitTricks , TestSuite.BitPrecise.Legato , TestSuite.BitPrecise.MergeSort , TestSuite.BitPrecise.PrefixSum , TestSuite.CodeGeneration.AddSub , TestSuite.CodeGeneration.CgTests , TestSuite.CodeGeneration.CRC_USB5 , TestSuite.CodeGeneration.Fibonacci , TestSuite.CodeGeneration.Floats , TestSuite.CodeGeneration.GCD , TestSuite.CodeGeneration.PopulationCount , TestSuite.CodeGeneration.Uninterpreted , TestSuite.CRC.CCITT , TestSuite.CRC.CCITT_Unidir , TestSuite.CRC.GenPoly , TestSuite.CRC.Parity , TestSuite.CRC.USB5 , TestSuite.Crypto.AES , TestSuite.Crypto.RC4 , TestSuite.Existentials.CRCPolynomial , TestSuite.GenTest.GenTests , TestSuite.Optimization.AssertWithPenalty , TestSuite.Optimization.Basics , TestSuite.Optimization.Combined , TestSuite.Optimization.ExtensionField , TestSuite.Optimization.Quantified , TestSuite.Optimization.Reals , TestSuite.Optimization.NoOpt , TestSuite.Overflows.Arithmetic , TestSuite.Overflows.Casts , TestSuite.Polynomials.Polynomials , TestSuite.Puzzles.Coins , TestSuite.Puzzles.Counts , TestSuite.Puzzles.DogCatMouse , TestSuite.Puzzles.Euler185 , TestSuite.Puzzles.MagicSquare , TestSuite.Puzzles.NQueens , TestSuite.Puzzles.PowerSet , TestSuite.Puzzles.Sudoku , TestSuite.Puzzles.Temperature , TestSuite.Puzzles.U2Bridge , TestSuite.Queries.BasicQuery , TestSuite.Queries.BadOption , TestSuite.Queries.Enums , TestSuite.Queries.FreshVars , TestSuite.Queries.Int_ABC , TestSuite.Queries.Int_Boolector , TestSuite.Queries.Int_CVC4 , TestSuite.Queries.Int_Mathsat , TestSuite.Queries.Int_Yices , TestSuite.Queries.Int_Z3 , TestSuite.Queries.Interpolants , TestSuite.Queries.Lists , TestSuite.Queries.Strings , TestSuite.Queries.Uninterpreted , TestSuite.QuickCheck.QC , TestSuite.Uninterpreted.AUF , TestSuite.Uninterpreted.Axioms , TestSuite.Uninterpreted.Function , TestSuite.Uninterpreted.Sort , TestSuite.Uninterpreted.Uninterpreted Test-Suite SBVDocTest Build-Depends: base, directory, filepath, random , doctest, Glob, bytestring, tasty, tasty-golden, tasty-hunit, tasty-quickcheck, mtl, QuickCheck, random , sbv default-language: Haskell2010 Hs-Source-Dirs : SBVTestSuite main-is: SBVDocTest.hs Other-modules : Utils.SBVTestFramework type: exitcode-stdio-1.0 Test-Suite SBVHLint build-depends: base, directory, filepath, random , hlint, bytestring, tasty, tasty-golden, tasty-hunit, tasty-quickcheck, mtl, QuickCheck , sbv default-language: Haskell2010 hs-source-dirs: SBVTestSuite Other-modules : Utils.SBVTestFramework main-is: SBVHLint.hs type: exitcode-stdio-1.0 sbv-7.13/Setup.hs0000644000000000000000000000071413405536617012074 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Main -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Setup module for the sbv library ----------------------------------------------------------------------------- {-# OPTIONS_GHC -Wall #-} module Main(main) where import Distribution.Simple main :: IO () main = defaultMain sbv-7.13/Data/0000755000000000000000000000000013405536617011307 5ustar0000000000000000sbv-7.13/Data/SBV.hs0000644000000000000000000012532313405536617012303 0ustar0000000000000000--------------------------------------------------------------------------------- -- | -- Module : Data.SBV -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- (The sbv library is hosted at . -- Comments, bug reports, and patches are always welcome.) -- -- SBV: SMT Based Verification -- -- Express properties about Haskell programs and automatically prove -- them using SMT solvers. -- -- >>> prove $ \x -> x `shiftL` 2 .== 4 * (x :: SWord8) -- Q.E.D. -- -- >>> prove $ \x -> x `shiftL` 2 .== 2 * (x :: SWord8) -- Falsifiable. Counter-example: -- s0 = 64 :: Word8 -- -- The function 'prove' has the following type: -- -- @ -- 'prove' :: 'Provable' a => a -> 'IO' 'ThmResult' -- @ -- -- The class 'Provable' comes with instances for n-ary predicates, for arbitrary n. -- The predicates are just regular Haskell functions over symbolic types listed below. -- Functions for checking satisfiability ('sat' and 'allSat') are also -- provided. -- -- The sbv library introduces the following symbolic types: -- -- * 'SBool': Symbolic Booleans (bits). -- -- * 'SWord8', 'SWord16', 'SWord32', 'SWord64': Symbolic Words (unsigned). -- -- * 'SInt8', 'SInt16', 'SInt32', 'SInt64': Symbolic Ints (signed). -- -- * 'SInteger': Unbounded signed integers. -- -- * 'SReal': Algebraic-real numbers -- -- * 'SFloat': IEEE-754 single-precision floating point values -- -- * 'SDouble': IEEE-754 double-precision floating point values -- -- * 'SChar', 'SString', 'RegExp': Characters, strings and regular expressions -- -- * 'SList': Symbolic lists (which can be nested) -- -- * 'SArray', 'SFunArray': Flat arrays of symbolic values. -- -- * Symbolic polynomials over GF(2^n), polynomial arithmetic, and CRCs. -- -- * Uninterpreted constants and functions over symbolic values, with user -- defined SMT-Lib axioms. -- -- * Uninterpreted sorts, and proofs over such sorts, potentially with axioms. -- -- The user can construct ordinary Haskell programs using these types, which behave -- very similar to their concrete counterparts. In particular these types belong to the -- standard classes 'Num', 'Bits', custom versions of 'Eq' ('EqSymbolic') -- and 'Ord' ('OrdSymbolic'), along with several other custom classes for simplifying -- programming with symbolic values. The framework takes full advantage of Haskell's type -- inference to avoid many common mistakes. -- -- Furthermore, predicates (i.e., functions that return 'SBool') built out of -- these types can also be: -- -- * proven correct via an external SMT solver (the 'prove' function) -- -- * checked for satisfiability (the 'sat', 'allSat' functions) -- -- * used in synthesis (the `sat` function with existentials) -- -- * quick-checked -- -- If a predicate is not valid, 'prove' will return a counterexample: An -- assignment to inputs such that the predicate fails. The 'sat' function will -- return a satisfying assignment, if there is one. The 'allSat' function returns -- all satisfying assignments. -- -- The sbv library uses third-party SMT solvers via the standard SMT-Lib interface: -- -- -- The SBV library is designed to work with any SMT-Lib compliant SMT-solver. -- Currently, we support the following SMT-Solvers out-of-the box: -- -- * ABC from University of Berkeley: -- -- * CVC4 from Stanford: -- -- * Boolector from Johannes Kepler University: -- -- * MathSAT from Fondazione Bruno Kessler and DISI-University of Trento: -- -- * Yices from SRI: -- -- * Z3 from Microsoft: -- -- SBV requires recent versions of these solvers; please see the file -- @SMTSolverVersions.md@ in the source distribution for specifics. -- -- SBV also allows calling these solvers in parallel, either getting results from multiple solvers -- or returning the fastest one. (See 'proveWithAll', 'proveWithAny', etc.) -- -- Support for other compliant solvers can be added relatively easily, please -- get in touch if there is a solver you'd like to see included. --------------------------------------------------------------------------------- {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.SBV ( -- $progIntro -- * Symbolic types -- ** Booleans SBool, oneIf -- *** The Boolean class , Boolean(..) -- *** Logical operations , bAnd, bOr, bAny, bAll -- ** Bit-vectors -- *** Unsigned bit-vectors , SWord8, SWord16, SWord32, SWord64 -- *** Signed bit-vectors , SInt8, SInt16, SInt32, SInt64 -- ** Unbounded integers -- $unboundedLimitations , SInteger -- ** Floating point numbers -- $floatingPoints , SFloat, SDouble -- ** Algebraic reals -- $algReals , SReal, AlgReal, sRealToSInteger -- ** Characters, Strings and Regular Expressions -- $strings , SChar, SString -- ** Symbolic lists -- $lists , SList -- * Arrays of symbolic values , SymArray(newArray_, newArray, readArray, writeArray), SArray, SFunArray -- * Creating symbolic values -- ** Single value -- $createSym , sBool, sWord8, sWord16, sWord32, sWord64, sInt8, sInt16, sInt32, sInt64, sInteger, sReal, sFloat, sDouble, sChar, sString, sList -- ** List of values -- $createSyms , sBools, sWord8s, sWord16s, sWord32s, sWord64s, sInt8s, sInt16s, sInt32s, sInt64s, sIntegers, sReals, sFloats, sDoubles, sChars, sStrings, sLists -- * Symbolic Equality and Comparisons , EqSymbolic(..), OrdSymbolic(..), Equality(..) -- * Conditionals: Mergeable values , Mergeable(..), ite, iteLazy -- * Symbolic integral numbers , SIntegral -- * Division and Modulus , SDivisible(..) -- * Bit-vector operations -- ** Conversions , sFromIntegral -- ** Shifts and rotates -- $shiftRotate , sShiftLeft, sShiftRight, sRotateLeft, sRotateRight, sSignedShiftArithRight -- ** Finite bit-vector operations , SFiniteBits(..) -- ** Splitting, joining, and extending , Splittable(..) -- ** Exponentiation , (.^) -- * IEEE-floating point numbers , IEEEFloating(..), RoundingMode(..), SRoundingMode, nan, infinity, sNaN, sInfinity -- ** Rounding modes , sRoundNearestTiesToEven, sRoundNearestTiesToAway, sRoundTowardPositive, sRoundTowardNegative, sRoundTowardZero, sRNE, sRNA, sRTP, sRTN, sRTZ -- ** Conversion to/from floats , IEEEFloatConvertable(..) -- ** Bit-pattern conversions , sFloatAsSWord32, sWord32AsSFloat, sDoubleAsSWord64, sWord64AsSDouble, blastSFloat, blastSDouble -- * Enumerations -- $enumerations , mkSymbolicEnumeration -- * Uninterpreted sorts, constants, and functions -- $uninterpreted , Uninterpreted(..), addAxiom -- * Properties, proofs, and satisfiability -- $proveIntro -- $noteOnNestedQuantifiers -- $multiIntro , Predicate, Goal, Provable(..), solve -- * Constraints -- $constrainIntro -- ** General constraints -- $generalConstraints , constrain, softConstrain -- ** Constraint Vacuity -- $constraintVacuity -- ** Named constraints and attributes -- $namedConstraints , namedConstraint, constrainWithAttribute -- ** Unsat cores -- $unsatCores -- ** Cardinality constraints -- $cardIntro , pbAtMost, pbAtLeast, pbExactly, pbLe, pbGe, pbEq, pbMutexed, pbStronglyMutexed -- * Checking safety -- $safeIntro , sAssert, isSafe, SExecutable(..) -- * Quick-checking , sbvQuickCheck -- * Optimization -- $optiIntro -- ** Multiple optimization goals -- $multiOpt , OptimizeStyle(..) -- ** Objectives , Objective(..), Metric(..) -- ** Soft assertions -- $softAssertions , assertWithPenalty , Penalty(..) -- ** Field extensions -- | If an optimization results in an infinity/epsilon value, the returned `CW` value will be in the corresponding extension field. , ExtCW(..), GeneralizedCW(..) -- * Model extraction -- $modelExtraction -- ** Inspecting proof results -- $resultTypes , ThmResult(..), SatResult(..), AllSatResult(..), SafeResult(..), OptimizeResult(..), SMTResult(..), SMTReasonUnknown(..) -- ** Observing expressions -- $observeInternal , observe -- ** Programmable model extraction -- $programmableExtraction , SatModel(..), Modelable(..), displayModels, extractModels , getModelDictionaries, getModelValues, getModelUninterpretedValues -- * SMT Interface , SMTConfig(..), Timing(..), SMTLibVersion(..), Solver(..), SMTSolver(..) -- ** Controlling verbosity -- $verbosity -- ** Solvers , boolector, cvc4, yices, z3, mathSAT, abc -- ** Configurations , defaultSolverConfig, defaultSMTCfg, sbvCheckSolverInstallation, sbvAvailableSolvers , setLogic, Logic(..), setOption, setInfo, setTimeOut -- ** SBV exceptions , SBVException(..) -- * Abstract SBV type , SBV, HasKind(..), Kind(..), SymWord(..) , Symbolic, label, output, runSMT, runSMTWith -- * Module exports -- $moduleExportIntro , module Data.Bits , module Data.Word , module Data.Int , module Data.Ratio ) where import Control.Monad (filterM) import qualified Control.Exception as C import Data.SBV.Core.AlgReals import Data.SBV.Core.Data import Data.SBV.Core.Model import Data.SBV.Core.Floating import Data.SBV.Core.Splittable import Data.SBV.Provers.Prover import Data.SBV.Utils.Boolean import Data.SBV.Utils.TDiff (Timing(..)) import Data.Bits import Data.Int import Data.Ratio import Data.Word import qualified Language.Haskell.TH as TH import Data.Generics import Data.SBV.SMT.Utils (SBVException(..)) import Data.SBV.Control.Utils (SMTValue (..)) import Data.SBV.Control.Types (SMTReasonUnknown(..), Logic(..)) -- | Form the symbolic conjunction of a given list of boolean conditions. Useful in expressing -- problems with constraints, like the following: -- -- @ -- sat $ do [x, y, z] <- sIntegers [\"x\", \"y\", \"z\"] -- solve [x .> 5, y + z .< x] -- @ solve :: [SBool] -> Symbolic SBool solve = return . bAnd -- | Check whether the given solver is installed and is ready to go. This call does a -- simple call to the solver to ensure all is well. sbvCheckSolverInstallation :: SMTConfig -> IO Bool sbvCheckSolverInstallation cfg = check `C.catch` (\(_ :: C.SomeException) -> return False) where check = do ThmResult r <- proveWith cfg $ \x -> (x+x) .== ((x*2) :: SWord8) case r of Unsatisfiable{} -> return True _ -> return False -- | The default configs corresponding to supported SMT solvers defaultSolverConfig :: Solver -> SMTConfig defaultSolverConfig Z3 = z3 defaultSolverConfig Yices = yices defaultSolverConfig Boolector = boolector defaultSolverConfig CVC4 = cvc4 defaultSolverConfig MathSAT = mathSAT defaultSolverConfig ABC = abc -- | Return the known available solver configs, installed on your machine. sbvAvailableSolvers :: IO [SMTConfig] sbvAvailableSolvers = filterM sbvCheckSolverInstallation (map defaultSolverConfig [minBound .. maxBound]) -- If we get a program producing nothing (i.e., Symbolic ()), pretend it simply returns True. -- This is useful since min/max calls and constraints will provide the context instance Provable Goal where forAll_ a = forAll_ ((a >> return true) :: Predicate) forAll ns a = forAll ns ((a >> return true) :: Predicate) forSome_ a = forSome_ ((a >> return true) :: Predicate) forSome ns a = forSome ns ((a >> return true) :: Predicate) -- | Equality as a proof method. Allows for -- very concise construction of equivalence proofs, which is very typical in -- bit-precise proofs. infix 4 === class Equality a where (===) :: a -> a -> IO ThmResult instance {-# OVERLAPPABLE #-} (SymWord a, EqSymbolic z) => Equality (SBV a -> z) where k === l = prove $ \a -> k a .== l a instance {-# OVERLAPPABLE #-} (SymWord a, SymWord b, EqSymbolic z) => Equality (SBV a -> SBV b -> z) where k === l = prove $ \a b -> k a b .== l a b instance {-# OVERLAPPABLE #-} (SymWord a, SymWord b, EqSymbolic z) => Equality ((SBV a, SBV b) -> z) where k === l = prove $ \a b -> k (a, b) .== l (a, b) instance {-# OVERLAPPABLE #-} (SymWord a, SymWord b, SymWord c, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> z) where k === l = prove $ \a b c -> k a b c .== l a b c instance {-# OVERLAPPABLE #-} (SymWord a, SymWord b, SymWord c, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c) -> z) where k === l = prove $ \a b c -> k (a, b, c) .== l (a, b, c) instance {-# OVERLAPPABLE #-} (SymWord a, SymWord b, SymWord c, SymWord d, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> z) where k === l = prove $ \a b c d -> k a b c d .== l a b c d instance {-# OVERLAPPABLE #-} (SymWord a, SymWord b, SymWord c, SymWord d, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d) -> z) where k === l = prove $ \a b c d -> k (a, b, c, d) .== l (a, b, c, d) instance {-# OVERLAPPABLE #-} (SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> z) where k === l = prove $ \a b c d e -> k a b c d e .== l a b c d e instance {-# OVERLAPPABLE #-} (SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d, SBV e) -> z) where k === l = prove $ \a b c d e -> k (a, b, c, d, e) .== l (a, b, c, d, e) instance {-# OVERLAPPABLE #-} (SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> z) where k === l = prove $ \a b c d e f -> k a b c d e f .== l a b c d e f instance {-# OVERLAPPABLE #-} (SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> z) where k === l = prove $ \a b c d e f -> k (a, b, c, d, e, f) .== l (a, b, c, d, e, f) instance {-# OVERLAPPABLE #-} (SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SymWord g, EqSymbolic z) => Equality (SBV a -> SBV b -> SBV c -> SBV d -> SBV e -> SBV f -> SBV g -> z) where k === l = prove $ \a b c d e f g -> k a b c d e f g .== l a b c d e f g instance {-# OVERLAPPABLE #-} (SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SymWord g, EqSymbolic z) => Equality ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> z) where k === l = prove $ \a b c d e f g -> k (a, b, c, d, e, f, g) .== l (a, b, c, d, e, f, g) -- | Make an enumeration a symbolic type. mkSymbolicEnumeration :: TH.Name -> TH.Q [TH.Dec] mkSymbolicEnumeration typeName = do let typeCon = TH.conT typeName [d| deriving instance Eq $(typeCon) deriving instance Show $(typeCon) deriving instance Ord $(typeCon) deriving instance Read $(typeCon) deriving instance Data $(typeCon) deriving instance SymWord $(typeCon) deriving instance HasKind $(typeCon) deriving instance SMTValue $(typeCon) deriving instance SatModel $(typeCon) |] -- Haddock section documentation {- $progIntro The SBV library is really two things: * A framework for writing symbolic programs in Haskell, i.e., programs operating on symbolic values along with the usual concrete counterparts. * A framework for proving properties of such programs using SMT solvers. The programming goal of SBV is to provide a /seamless/ experience, i.e., let people program in the usual Haskell style without distractions of symbolic coding. While Haskell helps in some aspects (the 'Num' and 'Bits' classes simplify coding), it makes life harder in others. For instance, @if-then-else@ only takes 'Bool' as a test in Haskell, and comparisons ('>' etc.) only return 'Bool's. Clearly we would like these values to be symbolic (i.e., 'SBool'), thus stopping us from using some native Haskell constructs. When symbolic versions of operators are needed, they are typically obtained by prepending a dot, for instance '==' becomes '.=='. Care has been taken to make the transition painless. In particular, any Haskell program you build out of symbolic components is fully concretely executable within Haskell, without the need for any custom interpreters. (They are truly Haskell programs, not AST's built out of pieces of syntax.) This provides for an integrated feel of the system, one of the original design goals for SBV. Incremental query mode: SBV provides a wide variety of ways to utilize SMT-solvers, without requiring the user to deal with the solvers themselves. While this mode is convenient, advanced users might need access to the underlying solver at a lower level. For such use cases, SBV allows users to have an interactive session: The user can issue commands to the solver, inspect the values/results, and formulate new constraints. This advanced feature is available through the "Data.SBV.Control" module, where most SMTLib features are made available via a typed-API. -} {- $proveIntro The SBV library provides a "push-button" verification system via automated SMT solving. The design goal is to let SMT solvers be used without any knowledge of how SMT solvers work or how different logics operate. The details are hidden behind the SBV framework, providing Haskell programmers with a clean API that is unencumbered by the details of individual solvers. To that end, we use the SMT-Lib standard () to communicate with arbitrary SMT solvers. -} {- $multiIntro === Using multiple solvers On a multi-core machine, it might be desirable to try a given property using multiple SMT solvers, using parallel threads. Even with machines with single-cores, threading can be helpful if you want to try out multiple-solvers but do not know which one would work the best for the problem at hand ahead of time. SBV allows proving/satisfiability-checking with multiple backends at the same time. Each function comes in two variants, one that returns the results from all solvers, the other that returns the fastest one. The @All@ variants, (i.e., 'proveWithAll', 'satWithAll') run all solvers and return all the results. SBV internally makes sure that the result is lazily generated; so, the order of solvers given does not matter. In other words, the order of results will follow the order of the solvers as they finish, not as given by the user. These variants are useful when you want to make sure multiple-solvers agree (or disagree!) on a given problem. The @Any@ variants, (i.e., 'proveWithAny', 'satWithAny') will run all the solvers in parallel, and return the results of the first one finishing. The other threads will then be killed. These variants are useful when you do not care if the solvers produce the same result, but rather want to get the solution as quickly as possible, taking advantage of modern many-core machines. Note that the function 'sbvAvailableSolvers' will return all the installed solvers, which can be used as the first argument to all these functions, if you simply want to try all available solvers on a machine. -} {- $safeIntro The 'sAssert' function allows users to introduce invariants to make sure certain properties hold at all times. This is another mechanism to provide further documentation/contract info into SBV code. The functions 'safe' and 'safeWith' can be used to statically discharge these proof assumptions. If a violation is found, SBV will print a model showing which inputs lead to the invariant being violated. Here's a simple example. Let's assume we have a function that does subtraction, and requires its first argument to be larger than the second: >>> let sub x y = sAssert Nothing "sub: x >= y must hold!" (x .>= y) (x - y) Clearly, this function is not safe, as there's nothing that stops us from passing it a larger second argument. We can use 'safe' to statically see if such a violation is possible before we use this function elsewhere. >>> safe (sub :: SInt8 -> SInt8 -> SInt8) [sub: x >= y must hold!: Violated. Model: s0 = 6 :: Int8 s1 = 8 :: Int8] What happens if we make sure to arrange for this invariant? Consider this version: >>> let safeSub x y = ite (x .>= y) (sub x y) 0 Clearly, @safeSub@ must be safe. And indeed, SBV can prove that: >>> safe (safeSub :: SInt8 -> SInt8 -> SInt8) [sub: x >= y must hold!: No violations detected] Note how we used @sub@ and @safeSub@ polymorphically. We only need to monomorphise our types when a proof attempt is done, as we did in the 'safe' calls. If required, the user can pass a @CallStack@ through the first argument to 'sAssert', which will be used by SBV to print a diagnostic info to pinpoint the failure. Also see "Documentation.SBV.Examples.Misc.NoDiv0" for the classic div-by-zero example. -} {- $optiIntro SBV can optimize metric functions, i.e., those that generate both bounded @SIntN@, @SWordN@, and unbounded 'SInteger' types, along with those produce 'SReal's. That is, it can find models satisfying all the constraints while minimizing or maximizing user given metrics. Currently, optimization requires the use of the z3 SMT solver as the backend, and a good review of these features is given in this paper: . Goals can be lexicographically (default), independently, or pareto-front optimized. The relevant functions are: * 'minimize': Minimize a given arithmetic goal * 'maximize': Minimize a given arithmetic goal Goals can be optimized at a regular or an extended value: An extended value is either positive or negative infinity (for unbounded integers and reals) or positive or negative epsilon differential from a real value (for reals). For instance, a call of the form @ 'minimize' "name-of-goal" $ x + 2*y @ minimizes the arithmetic goal @x+2*y@, where @x@ and @y@ can be signed\/unsigned bit-vectors, reals, or integers. == A simple example Here's an optimization example in action: >>> optimize Lexicographic $ \x y -> minimize "goal" (x+2*(y::SInteger)) Optimal in an extension field: goal = -oo :: Integer We will describe the role of the constructor 'Lexicographic' shortly. Of course, this becomes more useful when the result is not in an extension field: >>> :{ optimize Lexicographic $ do x <- sInteger "x" y <- sInteger "y" constrain $ x .> 0 constrain $ x .< 6 constrain $ y .> 2 constrain $ y .< 12 minimize "goal" $ x + 2 * y :} Optimal model: x = 1 :: Integer y = 3 :: Integer goal = 7 :: Integer As usual, the programmatic API can be used to extract the values of objectives and model-values ('getModelObjectives', 'getModelAssignment', etc.) to access these values and program with them further. The following examples illustrate the use of basic optimization routines: * "Documentation.SBV.Examples.Optimization.LinearOpt": Simple linear-optimization example. * "Documentation.SBV.Examples.Optimization.Production": Scheduling machines in a shop * "Documentation.SBV.Examples.Optimization.VM": Scheduling virtual-machines in a data-center -} {- $multiOpt Multiple goals can be specified, using the same syntax. In this case, the user gets to pick what style of optimization to perform, by passing the relevant 'OptimizeStyle' as the first argument to 'optimize'. * ['Lexicographic']. The solver will optimize the goals in the given order, optimizing the latter ones under the model that optimizes the previous ones. * ['Independent']. The solver will optimize the goals independently of each other. In this case the user will be presented a model for each goal given. * ['Pareto']. Finally, the user can query for pareto-fronts. A pareto front is an model such that no goal can be made "better" without making some other goal "worse." Pareto fronts only make sense when the objectives are bounded. If there are unbounded objective values, then the backend solver can loop infinitely. (This is what z3 does currently.) If you are not sure the objectives are bounded, you should first use 'Independent' mode to ensure the objectives are bounded, and then switch to pareto-mode to extract them further. The optional number argument to 'Pareto' specifies the maximum number of pareto-fronts the user is asking to get. If 'Nothing', SBV will query for all pareto-fronts. Note that pareto-fronts can be really large, so if 'Nothing' is used, there is a potential for waiting indefinitely for the SBV-solver interaction to finish. (If you suspect this might be the case, run in 'verbose' mode to see the interaction and put a limiting factor appropriately.) -} {- $softAssertions Related to optimization, SBV implements soft-asserts via 'assertWithPenalty' calls. A soft assertion is a hint to the SMT solver that we would like a particular condition to hold if **possible*. That is, if there is a solution satisfying it, then we would like it to hold, but it can be violated if there is no way to satisfy it. Each soft-assertion can be associated with a numeric penalty for not satisfying it, hence turning it into an optimization problem. Note that 'assertWithPenalty' works well with optimization goals ('minimize'/'maximize' etc.), and are most useful when we are optimizing a metric and thus some of the constraints can be relaxed with a penalty to obtain a good solution. Again see for a good overview of the features in Z3 that SBV is providing the bridge for. A soft assertion can be specified in one of the following three main ways: @ 'assertWithPenalty' "bounded_x" (x .< 5) 'DefaultPenalty' 'assertWithPenalty' "bounded_x" (x .< 5) ('Penalty' 2.3 Nothing) 'assertWithPenalty' "bounded_x" (x .< 5) ('Penalty' 4.7 (Just "group-1")) @ In the first form, we are saying that the constraint @x .< 5@ must be satisfied, if possible, but if this constraint can not be satisfied to find a model, it can be violated with the default penalty of 1. In the second case, we are associating a penalty value of @2.3@. Finally in the third case, we are also associating this constraint with a group. The group name is only needed if we have classes of soft-constraints that should be considered together. -} {- $modelExtraction The default 'Show' instances for prover calls provide all the counter-example information in a human-readable form and should be sufficient for most casual uses of sbv. However, tools built on top of sbv will inevitably need to look into the constructed models more deeply, programmatically extracting their results and performing actions based on them. The API provided in this section aims at simplifying this task. -} {- $resultTypes 'ThmResult', 'SatResult', and 'AllSatResult' are simple newtype wrappers over 'SMTResult'. Their main purpose is so that we can provide custom 'Show' instances to print results accordingly. -} {- $programmableExtraction While default 'Show' instances are sufficient for most use cases, it is sometimes desirable (especially for library construction) that the SMT-models are reinterpreted in terms of domain types. Programmable extraction allows getting arbitrarily typed models out of SMT models. -} {- $moduleExportIntro The SBV library exports the following modules wholesale, as user programs will have to import these modules to make any sensible use of the SBV functionality. -} {- $createSym These functions simplify declaring symbolic variables of various types. Strictly speaking, they are just synonyms for 'free' (specialized at the given type), but they might be easier to use. -} {- $createSyms These functions simplify declaring a sequence symbolic variables of various types. Strictly speaking, they are just synonyms for 'mapM' 'free' (specialized at the given type), but they might be easier to use. -} {- $unboundedLimitations The SBV library supports unbounded signed integers with the type 'SInteger', which are not subject to overflow/underflow as it is the case with the bounded types, such as 'SWord8', 'SInt16', etc. However, some bit-vector based operations are /not/ supported for the 'SInteger' type while in the verification mode. That is, you can use these operations on 'SInteger' values during normal programming/simulation. but the SMT translation will not support these operations since there corresponding operations are not supported in SMT-Lib. Note that this should rarely be a problem in practice, as these operations are mostly meaningful on fixed-size bit-vectors. The operations that are restricted to bounded word/int sizes are: * Rotations and shifts: 'rotateL', 'rotateR', 'shiftL', 'shiftR' * Bitwise logical ops: '.&.', '.|.', 'xor', 'complement' * Extraction and concatenation: 'split', '#', and 'extend' (see the 'Splittable' class) Usual arithmetic ('+', '-', '*', 'sQuotRem', 'sQuot', 'sRem', 'sDivMod', 'sDiv', 'sMod') and logical operations ('.<', '.<=', '.>', '.>=', '.==', './=') operations are supported for 'SInteger' fully, both in programming and verification modes. -} {- $algReals Algebraic reals are roots of single-variable polynomials with rational coefficients. (See .) Note that algebraic reals are infinite precision numbers, but they do not cover all /real/ numbers. (In particular, they cannot represent transcendentals.) Some irrational numbers are algebraic (such as @sqrt 2@), while others are not (such as pi and e). SBV can deal with real numbers just fine, since the theory of reals is decidable. (See .) In addition, by leveraging backend solver capabilities, SBV can also represent and solve non-linear equations involving real-variables. (For instance, the Z3 SMT solver, supports polynomial constraints on reals starting with v4.0.) -} {- $floatingPoints Floating point numbers are defined by the IEEE-754 standard; and correspond to Haskell's 'Float' and 'Double' types. For SMT support with floating-point numbers, see the paper by Rummer and Wahl: . -} {- $strings Support for characters, strings, and regular expressions (intial version contributed by Joel Burget) adds support for QF_S logic, described here: and here: . Note that this logic is still not part of official SMTLib (as of March 2018), so it should be considered experimental. See "Data.SBV.Char", "Data.SBV.String", "Data.SBV.RegExp" for related functions. -} {- $lists Support for symbolic lists (intial version contributed by Joel Burget) adds support for sequence support, described here: . Note that this logic is still not part of official SMTLib (as of March 2018), so it should be considered experimental. See "Data.SBV.List" for related functions. -} {- $shiftRotate Symbolic words (both signed and unsigned) are an instance of Haskell's 'Bits' class, so regular bitwise operations are automatically available for them. Shifts and rotates, however, require specialized type-signatures since Haskell insists on an 'Int' second argument for them. -} {- $constrainIntro A constraint is a means for restricting the input domain of a formula. Here's a simple example: @ do x <- 'exists' \"x\" y <- 'exists' \"y\" 'constrain' $ x .> y 'constrain' $ x + y .>= 12 'constrain' $ y .>= 3 ... @ The first constraint requires @x@ to be larger than @y@. The scond one says that sum of @x@ and @y@ must be at least @12@, and the final one says that @y@ to be at least @3@. Constraints provide an easy way to assert additional properties on the input domain, right at the point of the introduction of variables. Note that the proper reading of a constraint depends on the context: * In a 'sat' (or 'allSat') call: The constraint added is asserted conjunctively. That is, the resulting satisfying model (if any) will always satisfy all the constraints given. * In a 'prove' call: In this case, the constraint acts as an implication. The property is proved under the assumption that the constraint holds. In other words, the constraint says that we only care about the input space that satisfies the constraint. * In a @quickCheck@ call: The constraint acts as a filter for @quickCheck@; if the constraint does not hold, then the input value is considered to be irrelevant and is skipped. Note that this is similar to 'prove', but is stronger: We do not accept a test case to be valid just because the constraints fail on them, although semantically the implication does hold. We simply skip that test case as a /bad/ test vector. * In a 'Data.SBV.Tools.GenTest.genTest' call: Similar to @quickCheck@ and 'prove': If a constraint does not hold, the input value is ignored and is not included in the test set. -} {- $generalConstraints A good use case (in fact the motivating use case) for 'constrain' is attaching a constraint to a 'forall' or 'exists' variable at the time of its creation. Also, the conjunctive semantics for 'sat' and the implicative semantics for 'prove' simplify programming by choosing the correct interpretation automatically. However, one should be aware of the semantic difference. For instance, in the presence of constraints, formulas that are /provable/ are not necessarily /satisfiable/. To wit, consider: @ do x <- 'exists' \"x\" 'constrain' $ x .< x return $ x .< (x :: 'SWord8') @ This predicate is unsatisfiable since no element of 'SWord8' is less than itself. But it's (vacuously) true, since it excludes the entire domain of values, thus making the proof trivial. Hence, this predicate is provable, but is not satisfiable. To make sure the given constraints are not vacuous, the functions 'isVacuous' (and 'isVacuousWith') can be used. Also note that this semantics imply that test case generation ('Data.SBV.Tools.GenTest.genTest') and quick-check can take arbitrarily long in the presence of constraints, if the random input values generated rarely satisfy the constraints. (As an extreme case, consider @'constrain' 'false'@.) -} {- $constraintVacuity When adding constraints, one has to be careful about making sure they are not inconsistent. The function 'isVacuous' can be use for this purpose. Here is an example. Consider the following predicate: >>> let pred = do { x <- free "x"; constrain $ x .< x; return $ x .>= (5 :: SWord8) } This predicate asserts that all 8-bit values are larger than 5, subject to the constraint that the values considered satisfy @x .< x@, i.e., they are less than themselves. Since there are no values that satisfy this constraint, the proof will pass vacuously: >>> prove pred Q.E.D. We can use 'isVacuous' to make sure to see that the pass was vacuous: >>> isVacuous pred True While the above example is trivial, things can get complicated if there are multiple constraints with non-straightforward relations; so if constraints are used one should make sure to check the predicate is not vacuously true. Here's an example that is not vacuous: >>> let pred' = do { x <- free "x"; constrain $ x .> 6; return $ x .>= (5 :: SWord8) } This time the proof passes as expected: >>> prove pred' Q.E.D. And the proof is not vacuous: >>> isVacuous pred' False -} {- $namedConstraints Constraints can be given names: @ 'namedConstraint' "a is at least 5" $ a .>= 5@ Similarly, arbitrary term attributes can also be associated: @ 'constrainWithAttribute' [(":solver-specific-attribute", "value")] $ a .>= 5@ Note that a 'namedConstraint' is equivalent to a 'constrainWithAttribute' call, setting the `":named"' attribute. -} {- $unsatCores Named constraints are useful when used in conjunction with 'Data.SBV.Control.getUnsatCore' function where the backend solver can be queried to obtain an unsat core in case the constraints are unsatisfiable. See 'Data.SBV.Control.getUnsatCore' for details and "Documentation.SBV.Examples.Queries.UnsatCore" for an example use case. -} {- $uninterpreted Users can introduce new uninterpreted sorts simply by defining a data-type in Haskell and registering it as such. The following example demonstrates: @ data B = B () deriving (Eq, Ord, Show, Read, Data, SymWord, HasKind, SatModel) @ (Note that you'll also need to use the language pragmas @DeriveDataTypeable@, @DeriveAnyClass@, and import @Data.Generics@ for the above to work.) This is all it takes to introduce @B@ as an uninterpreted sort in SBV, which makes the type @SBV B@ automagically become available as the type of symbolic values that ranges over @B@ values. Note that the @()@ argument is important to distinguish it from enumerations, which will be translated to proper SMT data-types. Uninterpreted functions over both uninterpreted and regular sorts can be declared using the facilities introduced by the 'Data.SBV.Core.Model.Uninterpreted' class. -} {- $enumerations If the uninterpreted sort definition takes the form of an enumeration (i.e., a simple data type with all nullary constructors), then SBV will actually translate that as just such a data-type to SMT-Lib, and will use the constructors as the inhabitants of the said sort. A simple example is: @ data X = A | B | C mkSymbolicEnumeration ''X @ Note the magic incantation @mkSymbolicEnumeration ''X@. For this to work, you need to have the following options turned on: > LANGUAGE TemplateHaskell > LANGUAGE StandaloneDeriving > LANGUAGE DeriveDataTypeable > LANGUAGE DeriveAnyClass Now, the user can define @ type SX = SBV X @ and treat @SX@ as a regular symbolic type ranging over the values @A@, @B@, and @C@. Such values can be compared for equality, and with the usual other comparison operators, such as @.==@, @./=@, @.>@, @.>=@, @<@, and @<=@. Note that in this latter case the type is no longer uninterpreted, but is properly represented as a simple enumeration of the said elements. A simple query would look like: @ allSat $ \x -> x .== (x :: SX) @ which would list all three elements of this domain as satisfying solutions. @ Solution #1: s0 = A :: X Solution #2: s0 = B :: X Solution #3: s0 = C :: X Found 3 different solutions. @ Note that the result is properly typed as @X@ elements; these are not mere strings. So, in a 'getModelAssignment' scenario, the user can recover actual elements of the domain and program further with those values as usual. See "Documentation.SBV.Examples.Misc.Enumerate" for an extended example on how to use symbolic enumerations. -} {- $noteOnNestedQuantifiers === A note on reasoning in the presence of quantifers Note that SBV allows reasoning with quantifiers: Inputs can be existentially or universally quantified. Predicates can be built with arbitrary nesting of such quantifiers as well. However, SBV always /assumes/ that the input is in prenex-normal form: . That is, all the input declarations are treated as happening at the beginning of a predicate, followed by the actual formula. Unfortunately, the way predicates are written can be misleading at times, since symbolic inputs can be created at arbitrary points; interleaving them with other code. The rule is simple, however: All inputs are assumed at the top, in the order declared, regardless of their quantifiers. SBV will apply skolemization to get rid of existentials before sending predicates to backend solvers. However, if you do want nested quantification, you will manually have to first convert to prenex-normal form (which produces an equisatisfiable but not necessarily equivalent formula), and code that explicitly in SBV. See for a detailed discussion of this issue. -} {- $cardIntro A pseudo-boolean function () is a function from booleans to reals, basically treating 'True' as @1@ and 'False' as @0@. They are typically expressed in polynomial form. Such functions can be used to express cardinality constraints, where we want to /count/ how many things satisfy a certain condition. One can code such constraints using regular SBV programming: Simply walk over the booleans and the corresponding coefficients, and assert the required relation. For instance: > [b0, b1, b2, b3] `pbAtMost` 2 is precisely equivalent to: > sum (map (\b -> ite b 1 0) [b0, b1, b2, b3]) .<= 2 and they both express that at most /two/ of @b0@, @b1@, @b2@, and @b3@ can be 'true'. However, the equivalent forms give rise to long formulas and the cardinality constraint can get lost in the translation. The idea here is that if you use these functions instead, SBV will produce better translations to SMTLib for more efficient solving of cardinality constraints, assuming the backend solver supports them. Currently, only Z3 supports pseudo-booleans directly. For all other solvers, SBV will translate these to equivalent terms that do not require special functions. -} {- $verbosity SBV provides various levels of verbosity to aid in debugging, by using the 'SMTConfig' fields: * ['verbose'] Print on stdout a shortened account of what is sent/received. This is specifically trimmed to reduce noise and is good for quick debugging. The output is not supposed to be machine-readable. * ['redirectVerbose'] Send the verbose output to a file. Note that you still have to set `verbose=True` for redirection to take effect. Otherwise, the output is the same as what you would see in `verbose`. * ['transcript'] Produce a file that is valid SMTLib2 format, containing everything sent and received. In particular, one can directly feed this file to the SMT-solver outside of the SBV since it is machine-readable. This is good for offline analysis situations, where you want to have a full account of what happened. For instance, it will print time-stamps at every interaction point, so you can see how long each command took. -} {- $observeInternal The 'observe' command can be used to trace values of arbitrary expressions during a 'sat', 'prove', or perhaps more importantly, in a @quickCheck@ call. This is useful for, for instance, recording expected/obtained expressions as a symbolic program is executing. >>> :{ prove $ do a1 <- free "i1" a2 <- free "i2" let spec, res :: SWord8 spec = a1 + a2 res = ite (a1 .== 12 &&& a2 .== 22) -- insert a malicious bug! 1 (a1 + a2) return $ observe "Expected" spec .== observe "Result" res :} Falsifiable. Counter-example: i1 = 12 :: Word8 i2 = 22 :: Word8 Expected = 34 :: Word8 Result = 1 :: Word8 -} {-# ANN module ("HLint: ignore Use import/export shortcut" :: String) #-} sbv-7.13/Data/SBV/0000755000000000000000000000000013405536617011741 5ustar0000000000000000sbv-7.13/Data/SBV/Char.hs0000644000000000000000000002572513405536617013165 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Char -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- A collection of character utilities, follows the namings -- in "Data.Char" and is intended to be imported qualified. -- Also, it is recommended you use the @OverloadedStrings@ -- extension to allow literal strings to be used as -- symbolic-strings when working with symbolic characters -- and strings. -- -- Note that currently 'SChar' type only covers Latin1 (i.e., the first 256 -- characters), as opposed to Haskell's Unicode character support. However, -- there is a pending SMTLib proposal to extend this set to Unicode, at -- which point we will update these functions to match the implementations. -- For details, see: ----------------------------------------------------------------------------- {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE OverloadedStrings #-} module Data.SBV.Char ( -- * Occurrence in a string elem, notElem -- * Conversion to\/from 'SInteger' , ord, chr -- * Conversion to upper\/lower case , toLower, toUpper -- * Converting digits to ints and back , digitToInt, intToDigit -- * Character classification , isControl, isSpace, isLower, isUpper, isAlpha, isAlphaNum, isPrint, isDigit, isOctDigit, isHexDigit, isLetter, isMark, isNumber, isPunctuation, isSymbol, isSeparator -- * Subranges , isAscii, isLatin1, isAsciiLetter, isAsciiUpper, isAsciiLower ) where import Prelude hiding (elem, notElem) import qualified Prelude as P import Data.SBV.Core.Data import Data.SBV.Core.Model import Data.SBV.Utils.Boolean import qualified Data.Char as C import Data.SBV.String (isInfixOf, singleton) -- For doctest use only -- -- $setup -- >>> import Data.SBV.Provers.Prover (prove, sat) -- >>> :set -XOverloadedStrings -- | Is the character in the string? -- -- >>> :set -XOverloadedStrings -- >>> prove $ \c -> c `elem` singleton c -- Q.E.D. -- >>> prove $ \c -> bnot (c `elem` "") -- Q.E.D. elem :: SChar -> SString -> SBool c `elem` s | Just cs <- unliteral s, Just cc <- unliteral c = literal (cc `P.elem` cs) | Just cs <- unliteral s -- If only the second string is concrete, element-wise checking is still much better! = bAny (c .==) $ map literal cs | True = singleton c `isInfixOf` s -- | Is the character not in the string? -- -- >>> prove $ \c s -> c `elem` s <=> bnot (c `notElem` s) -- Q.E.D. notElem :: SChar -> SString -> SBool c `notElem` s = bnot (c `elem` s) -- | The 'ord' of a character. ord :: SChar -> SInteger ord c | Just cc <- unliteral c = literal (fromIntegral (C.ord cc)) | True = SBV $ SVal kTo $ Right $ cache r where kFrom = KBounded False 8 kTo = KUnbounded r st = do csw <- sbvToSW st c newExpr st kTo (SBVApp (KindCast kFrom kTo) [csw]) -- | Conversion from an integer to a character. -- -- >>> prove $ \x -> 0 .<= x &&& x .< 256 ==> ord (chr x) .== x -- Q.E.D. -- >>> prove $ \x -> chr (ord x) .== x -- Q.E.D. chr :: SInteger -> SChar chr w | Just cw <- unliteral w = literal (C.chr (fromIntegral cw)) | True = SBV $ SVal KChar $ Right $ cache r where w8 :: SWord8 w8 = sFromIntegral w r st = do SW _ n <- sbvToSW st w8 return $ SW KChar n -- | Convert to lower-case. -- -- >>> prove $ \c -> toLower (toLower c) .== toLower c -- Q.E.D. -- >>> prove $ \c -> isLower c ==> toLower (toUpper c) .== c -- Q.E.D. toLower :: SChar -> SChar toLower c = ite (isUpper c) (chr (ord c + 32)) c -- | Convert to upper-case. N.B. There are three special cases! -- -- * The character \223 is special. It corresponds to the German Eszett, it is considered lower-case, -- and furthermore it's upper-case maps back to itself within our character-set. So, we leave it -- untouched. -- -- * The character \181 maps to upper-case \924, which is beyond our character set. We leave it -- untouched. (This is the A with an acute accent.) -- -- * The character \255 maps to upper-case \376, which is beyond our character set. We leave it -- untouched. (This is the non-breaking space character.) -- -- >>> prove $ \c -> toUpper (toUpper c) .== toUpper c -- Q.E.D. -- >>> prove $ \c -> isUpper c ==> toUpper (toLower c) .== c -- Q.E.D. toUpper :: SChar -> SChar toUpper c = ite (isLower c &&& c `notElem` "\181\223\255") (chr (ord c - 32)) c -- | Convert a digit to an integer. Works for hexadecimal digits too. If the input isn't a digit, -- then return -1. -- -- >>> prove $ \c -> isDigit c ||| isHexDigit c ==> digitToInt c .>= 0 &&& digitToInt c .<= 15 -- Q.E.D. -- >>> prove $ \c -> bnot (isDigit c ||| isHexDigit c) ==> digitToInt c .== -1 -- Q.E.D. digitToInt :: SChar -> SInteger digitToInt c = ite (uc `elem` "0123456789") (sFromIntegral (o - ord (literal '0'))) $ ite (uc `elem` "ABCDEF") (sFromIntegral (o - ord (literal 'A') + 10)) $ -1 where uc = toUpper c o = ord uc -- | Convert an an integer to a digit, inverse of 'digitToInt'. If the integer is out of -- bounds, we return the arbitrarily chosen space character. Note that for hexadecimal -- letters, we return the corresponding lowercase letter. -- -- >>> prove $ \i -> i .>= 0 &&& i .<= 15 ==> digitToInt (intToDigit i) .== i -- Q.E.D. -- >>> prove $ \i -> i .< 0 ||| i .> 15 ==> digitToInt (intToDigit i) .== -1 -- Q.E.D. -- >>> prove $ \c -> digitToInt c .== -1 <=> intToDigit (digitToInt c) .== literal ' ' -- Q.E.D. intToDigit :: SInteger -> SChar intToDigit i = ite (i .>= 0 &&& i .<= 9) (chr (sFromIntegral i + ord (literal '0'))) $ ite (i .>= 10 &&& i .<= 15) (chr (sFromIntegral i + ord (literal 'a') - 10)) $ literal ' ' -- | Is this a control character? Control characters are essentially the non-printing characters. isControl :: SChar -> SBool isControl = (`elem` controls) where controls = "\NUL\SOH\STX\ETX\EOT\ENQ\ACK\a\b\t\n\v\f\r\SO\SI\DLE\DC1\DC2\DC3\DC4\NAK\SYN\ETB\CAN\EM\SUB\ESC\FS\GS\RS\US\DEL\128\129\130\131\132\133\134\135\136\137\138\139\140\141\142\143\144\145\146\147\148\149\150\151\152\153\154\155\156\157\158\159" -- | Is this white-space? That is, one of "\t\n\v\f\r \160". isSpace :: SChar -> SBool isSpace = (`elem` spaces) where spaces = "\t\n\v\f\r \160" -- | Is this a lower-case character? -- -- >>> prove $ \c -> isUpper c ==> isLower (toLower c) -- Q.E.D. isLower :: SChar -> SBool isLower = (`elem` lower) where lower = "abcdefghijklmnopqrstuvwxyz\181\223\224\225\226\227\228\229\230\231\232\233\234\235\236\237\238\239\240\241\242\243\244\245\246\248\249\250\251\252\253\254\255" -- | Is this an upper-case character? -- -- >>> prove $ \c -> bnot (isLower c &&& isUpper c) -- Q.E.D. isUpper :: SChar -> SBool isUpper = (`elem` upper) where upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\192\193\194\195\196\197\198\199\200\201\202\203\204\205\206\207\208\209\210\211\212\213\214\216\217\218\219\220\221\222" -- | Is this an alphabet character? That is lower-case, upper-case and title-case letters, plus letters of caseless scripts and modifiers letters. isAlpha :: SChar -> SBool isAlpha = (`elem` alpha) where alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\170\181\186\192\193\194\195\196\197\198\199\200\201\202\203\204\205\206\207\208\209\210\211\212\213\214\216\217\218\219\220\221\222\223\224\225\226\227\228\229\230\231\232\233\234\235\236\237\238\239\240\241\242\243\244\245\246\248\249\250\251\252\253\254\255" -- | Is this an 'isAlpha' or 'isNumber'. -- -- >>> prove $ \c -> isAlphaNum c <=> isAlpha c ||| isNumber c -- Q.E.D. isAlphaNum :: SChar -> SBool isAlphaNum c = isAlpha c ||| isNumber c -- | Is this a printable character? Essentially the complement of 'isControl', with one -- exception. The Latin-1 character \173 is neither control nor printable. Go figure. -- -- >>> prove $ \c -> c .== literal '\173' ||| isControl c <=> bnot (isPrint c) -- Q.E.D. isPrint :: SChar -> SBool isPrint c = c ./= literal '\173' &&& bnot (isControl c) -- | Is this an ASCII digit, i.e., one of @0@..@9@. Note that this is a subset of 'isNumber' -- -- >>> prove $ \c -> isDigit c ==> isNumber c -- Q.E.D. isDigit :: SChar -> SBool isDigit = (`elem` "0123456789") -- | Is this an Octal digit, i.e., one of @0@..@7@. -- -- >>> prove $ \c -> isOctDigit c ==> isDigit c -- Q.E.D. isOctDigit :: SChar -> SBool isOctDigit = (`elem` "01234567") -- | Is this a Hex digit, i.e, one of @0@..@9@, @a@..@f@, @A@..@F@. -- -- >>> prove $ \c -> isHexDigit c ==> isAlphaNum c -- Q.E.D. isHexDigit :: SChar -> SBool isHexDigit = (`elem` "0123456789abcdefABCDEF") -- | Is this an alphabet character. Note that this function is equivalent to 'isAlpha'. -- -- >>> prove $ \c -> isLetter c <=> isAlpha c -- Q.E.D. isLetter :: SChar -> SBool isLetter = isAlpha -- | Is this a mark? Note that the Latin-1 subset doesn't have any marks; so this function -- is simply constant false for the time being. -- -- >>> prove $ bnot . isMark -- Q.E.D. isMark :: SChar -> SBool isMark = const false -- | Is this a number character? Note that this set contains not only the digits, but also -- the codes for a few numeric looking characters like 1/2 etc. Use 'isDigit' for the digits @0@ through @9@. isNumber :: SChar -> SBool isNumber = (`elem` "0123456789\178\179\185\188\189\190") -- | Is this a punctuation mark? isPunctuation :: SChar -> SBool isPunctuation = (`elem` "!\"#%&'()*,-./:;?@[\\]_{}\161\167\171\182\183\187\191") -- | Is this a symbol? isSymbol :: SChar -> SBool isSymbol = (`elem` "$+<=>^`|~\162\163\164\165\166\168\169\172\174\175\176\177\180\184\215\247") -- | Is this a separator? -- -- >>> prove $ \c -> isSeparator c ==> isSpace c -- Q.E.D. isSeparator :: SChar -> SBool isSeparator = (`elem` " \160") -- | Is this an ASCII character, i.e., the first 128 characters. isAscii :: SChar -> SBool isAscii c = ord c .< 128 -- | Is this a Latin1 character? Note that this function is always true since 'SChar' corresponds -- precisely to Latin1 for the time being. -- -- >>> prove isLatin1 -- Q.E.D. isLatin1 :: SChar -> SBool isLatin1 = const true -- | Is this an ASCII letter? -- -- >>> prove $ \c -> isAsciiLetter c <=> isAsciiUpper c ||| isAsciiLower c -- Q.E.D. isAsciiLetter :: SChar -> SBool isAsciiLetter c = isAsciiUpper c ||| isAsciiLower c -- | Is this an ASCII Upper-case letter? i.e., @A@ thru @Z@ -- -- >>> prove $ \c -> isAsciiUpper c <=> ord c .>= ord (literal 'A') &&& ord c .<= ord (literal 'Z') -- Q.E.D. -- >>> prove $ \c -> isAsciiUpper c <=> isAscii c &&& isUpper c -- Q.E.D. isAsciiUpper :: SChar -> SBool isAsciiUpper = (`elem` literal ['A' .. 'Z']) -- | Is this an ASCII Lower-case letter? i.e., @a@ thru @z@ -- -- >>> prove $ \c -> isAsciiLower c <=> ord c .>= ord (literal 'a') &&& ord c .<= ord (literal 'z') -- Q.E.D. -- >>> prove $ \c -> isAsciiLower c <=> isAscii c &&& isLower c -- Q.E.D. isAsciiLower :: SChar -> SBool isAsciiLower = (`elem` literal ['a' .. 'z']) sbv-7.13/Data/SBV/Control.hs0000644000000000000000000001251713405536617013723 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Control -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Control sublanguage for interacting with SMT solvers. ----------------------------------------------------------------------------- {-# LANGUAGE NamedFieldPuns #-} module Data.SBV.Control ( -- $queryIntro -- * User queries Query, query -- * Create a fresh variable , freshVar_, freshVar -- * Create a fresh array , freshArray_, freshArray -- * Checking satisfiability , CheckSatResult(..), checkSat, checkSatUsing, checkSatAssuming, checkSatAssumingWithUnsatisfiableSet -- * Querying the solver -- ** Extracting values , SMTValue(..), getValue, getUninterpretedValue, getModel, getAssignment, getSMTResult, getUnknownReason -- ** Extracting the unsat core , getUnsatCore -- ** Extracting a proof , getProof -- ** Extracting interpolants , getInterpolant -- ** Extracting assertions , getAssertions -- * Getting solver information , SMTInfoFlag(..), SMTErrorBehavior(..), SMTInfoResponse(..) , getInfo, getOption -- * Entering and exiting assertion stack , getAssertionStackDepth, push, pop, inNewAssertionStack -- * Higher level tactics , caseSplit -- * Resetting the solver state , resetAssertions -- * Constructing assignments , (|->) -- * Terminating the query , mkSMTResult , exit -- * Controlling the solver behavior , ignoreExitCode, timeout -- * Miscellaneous , queryDebug , echo , io -- * Solver options , SMTOption(..) ) where import Data.SBV.Core.Data (SMTConfig(..)) import Data.SBV.Core.Symbolic (Query, Symbolic, Query(..), QueryContext(..)) import Data.SBV.Control.Query import Data.SBV.Control.Utils (SMTValue(..), queryDebug, executeQuery) -- | Run a custom query query :: Query a -> Symbolic a query = executeQuery QueryExternal {- $queryIntro In certain cases, the user might want to take over the communication with the solver, programmatically querying the engine and issuing commands accordingly. Queries can be extremely powerful as they allow direct control of the solver. Here's a simple example: @ module Test where import Data.SBV import Data.SBV.Control -- queries require this module to be imported! test :: Symbolic (Maybe (Integer, Integer)) test = do x <- sInteger "x" -- a free variable named "x" y <- sInteger "y" -- a free variable named "y" -- require the sum to be 10 constrain $ x + y .== 10 -- Go into the Query mode query $ do -- Query the solver: Are the constraints satisfiable? cs <- checkSat case cs of Unk -> error "Solver said unknown!" Unsat -> return Nothing -- no solution! Sat -> -- Query the values: do xv <- getValue x yv <- getValue y io $ putStrLn $ "Solver returned: " ++ show (xv, yv) -- We can now add new constraints, -- Or perform arbitrary computations and tell -- the solver anything we want! constrain $ x .> literal xv + literal yv -- call checkSat again csNew <- checkSat case csNew of Unk -> error "Solver said unknown!" Unsat -> return Nothing Sat -> do xv2 <- getValue x yv2 <- getValue y return $ Just (xv2, yv2) @ Note the type of @test@: it returns an optional pair of integers in the 'Symbolic' monad. We turn it into an IO value with the 'Data.SBV.Control.runSMT' function: (There's also 'Data.SBV.Control.runSMTWith' that uses a user specified solver instead of the default.) @ pair :: IO (Maybe (Integer, Integer)) pair = runSMT test @ When run, this can return: @ *Test> pair Solver returned: (10,0) Just (11,-1) @ demonstrating that the user has full contact with the solver and can guide it as the program executes. SBV provides access to many SMTLib features in the query mode, as exported from this very module. For other examples see: - "Documentation.SBV.Examples.Queries.AllSat": Simulating SBV's 'Data.SBV.allSat' using queries. - "Documentation.SBV.Examples.Queries.CaseSplit": Performing a case-split during a query. - "Documentation.SBV.Examples.Queries.Enums": Using enumerations in queries. - "Documentation.SBV.Examples.Queries.FourFours": Solution to a fun arithmetic puzzle, coded using queries. - "Documentation.SBV.Examples.Queries.GuessNumber": The famous number guessing game. - "Documentation.SBV.Examples.Queries.UnsatCore": Extracting unsat-cores using queries. - "Documentation.SBV.Examples.Queries.Interpolants": Extracting interpolants using queries. -} sbv-7.13/Data/SBV/Dynamic.hs0000644000000000000000000002061313405536617013663 0ustar0000000000000000--------------------------------------------------------------------------------- -- | -- Module : Data.SBV.Dynamic -- Copyright : (c) Brian Huffman -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Dynamically typed low-level API to the SBV library, for users who -- want to generate symbolic values at run-time. Note that with this -- API it is possible to create terms that are not type correct; use -- at your own risk! --------------------------------------------------------------------------------- module Data.SBV.Dynamic ( -- * Programming with symbolic values -- ** Symbolic types -- *** Abstract symbolic value type SVal , HasKind(..), Kind(..), CW(..), CWVal(..), cwToBool -- *** SMT Arrays of symbolic values , SArr, readSArr, writeSArr, mergeSArr, newSArr, eqSArr -- *** Functional arrays of symbolic values , SFunArr, readSFunArr, writeSFunArr, mergeSFunArr, newSFunArr -- ** Creating a symbolic variable , Symbolic , Quantifier(..) , svMkSymVar , sWordN, sWordN_, sIntN, sIntN_ -- ** Operations on symbolic values -- *** Boolean literals , svTrue, svFalse, svBool, svAsBool -- *** Integer literals , svInteger, svAsInteger -- *** Float literals , svFloat, svDouble -- *** Algebraic reals (only from rationals) , svReal, svNumerator, svDenominator -- *** Symbolic equality , svEqual, svNotEqual -- *** Constructing concrete lists , svEnumFromThenTo -- *** Symbolic ordering , svLessThan, svGreaterThan, svLessEq, svGreaterEq -- *** Arithmetic operations , svPlus, svTimes, svMinus, svUNeg, svAbs , svDivide, svQuot, svRem, svQuotRem, svExp , svAddConstant, svIncrement, svDecrement -- *** Logical operations , svAnd, svOr, svXOr, svNot , svShl, svShr, svRol, svRor -- *** Splitting, joining, and extending , svExtract, svJoin -- *** Sign-casting , svSign, svUnsign -- *** Numeric conversions , svFromIntegral -- *** Indexed lookups , svSelect -- *** Word-level operations , svToWord1, svFromWord1, svTestBit, svSetBit , svShiftLeft, svShiftRight , svRotateLeft, svRotateRight , svWordFromBE, svWordFromLE , svBlastLE, svBlastBE -- ** Conditionals: Mergeable values , svIte, svLazyIte, svSymbolicMerge -- * Uninterpreted sorts, constants, and functions , svUninterpreted -- * Properties, proofs, and satisfiability -- ** Proving properties , proveWith -- ** Checking satisfiability , satWith, allSatWith -- ** Checking safety , safeWith -- * Proving properties using multiple solvers , proveWithAll, proveWithAny, satWithAll, satWithAny -- * Quick-check , svQuickCheck -- * Model extraction -- ** Inspecting proof results , ThmResult(..), SatResult(..), AllSatResult(..), SafeResult(..), OptimizeResult(..), SMTResult(..) -- ** Programmable model extraction , genParse, getModelAssignment, getModelDictionary -- * SMT Interface: Configurations and solvers , SMTConfig(..), SMTLibVersion(..), Solver(..), SMTSolver(..), boolector, cvc4, yices, z3, mathSAT, abc, defaultSolverConfig, defaultSMTCfg, sbvCheckSolverInstallation, sbvAvailableSolvers -- * Symbolic computations , outputSVal -- * Code generation from symbolic programs , SBVCodeGen -- ** Setting code-generation options , cgPerformRTCs, cgSetDriverValues, cgGenerateDriver, cgGenerateMakefile -- ** Designating inputs , svCgInput, svCgInputArr -- ** Designating outputs , svCgOutput, svCgOutputArr -- ** Designating return values , svCgReturn, svCgReturnArr -- ** Code generation with uninterpreted functions , cgAddPrototype, cgAddDecl, cgAddLDFlags, cgIgnoreSAssert -- ** Code generation with 'Data.SBV.SInteger' and 'Data.SBV.SReal' types , cgIntegerSize, cgSRealType, CgSRealType(..) -- ** Compilation to C , compileToC, compileToCLib -- ** Compilation to SMTLib , generateSMTBenchmark ) where import Data.Map.Strict (Map) import Data.SBV.Core.Kind import Data.SBV.Core.Concrete import Data.SBV.Core.Symbolic import Data.SBV.Core.Operations import Data.SBV.Compilers.CodeGen ( SBVCodeGen , svCgInput, svCgInputArr , svCgOutput, svCgOutputArr , svCgReturn, svCgReturnArr , cgPerformRTCs, cgSetDriverValues, cgGenerateDriver, cgGenerateMakefile , cgAddPrototype, cgAddDecl, cgAddLDFlags, cgIgnoreSAssert , cgIntegerSize, cgSRealType, CgSRealType(..) ) import Data.SBV.Compilers.C (compileToC, compileToCLib) import Data.SBV.Provers.Prover (boolector, cvc4, yices, z3, mathSAT, abc, defaultSMTCfg) import Data.SBV.SMT.SMT (ThmResult(..), SatResult(..), SafeResult(..), OptimizeResult(..), AllSatResult(..), genParse) import Data.SBV (sbvCheckSolverInstallation, defaultSolverConfig, sbvAvailableSolvers) import qualified Data.SBV as SBV (SBool, proveWithAll, proveWithAny, satWithAll, satWithAny) import qualified Data.SBV.Core.Data as SBV (SBV(..)) import qualified Data.SBV.Core.Model as SBV (sbvQuickCheck) import qualified Data.SBV.Provers.Prover as SBV (proveWith, satWith, safeWith, allSatWith, generateSMTBenchmark) import qualified Data.SBV.SMT.SMT as SBV (Modelable(getModelAssignment, getModelDictionary)) import Data.Time (NominalDiffTime) -- | Dynamic variant of quick-check svQuickCheck :: Symbolic SVal -> IO Bool svQuickCheck = SBV.sbvQuickCheck . fmap toSBool toSBool :: SVal -> SBV.SBool toSBool = SBV.SBV -- | Create SMT-Lib benchmarks. The first argument is the basename of the file, we will automatically -- add ".smt2" per SMT-Lib2 convention. The 'Bool' argument controls whether this is a SAT instance, i.e., -- translate the query directly, or a PROVE instance, i.e., translate the negated query. generateSMTBenchmark :: Bool -> Symbolic SVal -> IO String generateSMTBenchmark isSat s = SBV.generateSMTBenchmark isSat (fmap toSBool s) -- | Proves the predicate using the given SMT-solver proveWith :: SMTConfig -> Symbolic SVal -> IO ThmResult proveWith cfg s = SBV.proveWith cfg (fmap toSBool s) -- | Find a satisfying assignment using the given SMT-solver satWith :: SMTConfig -> Symbolic SVal -> IO SatResult satWith cfg s = SBV.satWith cfg (fmap toSBool s) -- | Check safety using the given SMT-solver safeWith :: SMTConfig -> Symbolic SVal -> IO [SafeResult] safeWith cfg s = SBV.safeWith cfg (fmap toSBool s) -- | Find all satisfying assignments using the given SMT-solver allSatWith :: SMTConfig -> Symbolic SVal -> IO AllSatResult allSatWith cfg s = SBV.allSatWith cfg (fmap toSBool s) -- | Prove a property with multiple solvers, running them in separate threads. The -- results will be returned in the order produced. proveWithAll :: [SMTConfig] -> Symbolic SVal -> IO [(Solver, NominalDiffTime, ThmResult)] proveWithAll cfgs s = SBV.proveWithAll cfgs (fmap toSBool s) -- | Prove a property with multiple solvers, running them in separate -- threads. Only the result of the first one to finish will be -- returned, remaining threads will be killed. proveWithAny :: [SMTConfig] -> Symbolic SVal -> IO (Solver, NominalDiffTime, ThmResult) proveWithAny cfgs s = SBV.proveWithAny cfgs (fmap toSBool s) -- | Find a satisfying assignment to a property with multiple solvers, -- running them in separate threads. The results will be returned in -- the order produced. satWithAll :: [SMTConfig] -> Symbolic SVal -> IO [(Solver, NominalDiffTime, SatResult)] satWithAll cfgs s = SBV.satWithAll cfgs (fmap toSBool s) -- | Find a satisfying assignment to a property with multiple solvers, -- running them in separate threads. Only the result of the first one -- to finish will be returned, remaining threads will be killed. satWithAny :: [SMTConfig] -> Symbolic SVal -> IO (Solver, NominalDiffTime, SatResult) satWithAny cfgs s = SBV.satWithAny cfgs (fmap toSBool s) -- | Extract a model, the result is a tuple where the first argument (if True) -- indicates whether the model was "probable". (i.e., if the solver returned unknown.) getModelAssignment :: SMTResult -> Either String (Bool, [CW]) getModelAssignment = SBV.getModelAssignment -- | Extract a model dictionary. Extract a dictionary mapping the variables to -- their respective values as returned by the SMT solver. Also see `Data.SBV.SMT.getModelDictionaries`. getModelDictionary :: SMTResult -> Map String CW getModelDictionary = SBV.getModelDictionary sbv-7.13/Data/SBV/Internals.hs0000644000000000000000000000722313405536617014240 0ustar0000000000000000--------------------------------------------------------------------------------- -- | -- Module : Data.SBV.Internals -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Low level functions to access the SBV infrastructure, for developers who -- want to build further tools on top of SBV. End-users of the library -- should not need to use this module. --------------------------------------------------------------------------------- module Data.SBV.Internals ( -- * Running symbolic programs /manually/ Result(..), SBVRunMode(..), IStage(..) -- * Solver capabilities , SolverCapabilities(..) -- * Internal structures useful for low-level programming , module Data.SBV.Core.Data -- * Operations useful for instantiating SBV type classes , genLiteral, genFromCW, CW(..), genMkSymVar, genParse, showModel, SMTModel(..), liftQRem, liftDMod, registerKind -- * Compilation to C, extras , compileToC', compileToCLib' -- * Code generation primitives , module Data.SBV.Compilers.CodeGen -- * Various math utilities around floats , module Data.SBV.Utils.Numeric -- * Pretty number printing , module Data.SBV.Utils.PrettyNum -- * Timing computations , module Data.SBV.Utils.TDiff -- * Coordinating with the solver -- $coordinateSolverInfo , sendStringToSolver, sendRequestToSolver, retrieveResponseFromSolver -- * Defining new metrics , addSValOptGoal ) where import Data.SBV.Core.Data import Data.SBV.Core.Model (genLiteral, genFromCW, genMkSymVar, liftQRem, liftDMod) import Data.SBV.Core.Symbolic (IStage(..), addSValOptGoal, registerKind) import Data.SBV.Compilers.C (compileToC', compileToCLib') import Data.SBV.Compilers.CodeGen import Data.SBV.SMT.SMT (genParse, showModel) import Data.SBV.Utils.Numeric import Data.SBV.Utils.TDiff import Data.SBV.Utils.PrettyNum import qualified Data.SBV.Control.Utils as Query -- | Send an arbitrary string to the solver in a query. -- Note that this is inherently dangerous as it can put the solver in an arbitrary -- state and confuse SBV. If you use this feature, you are on your own! sendStringToSolver :: String -> Query () sendStringToSolver = Query.send False -- | Retrieve multiple responses from the solver, until it responds with a user given -- tag that we shall arrange for internally. The optional timeout is in milliseconds. -- If the time-out is exceeded, then we will raise an error. Note that this is inherently -- dangerous as it can put the solver in an arbitrary state and confuse SBV. If you use this -- feature, you are on your own! retrieveResponseFromSolver :: String -> Maybe Int -> Query [String] retrieveResponseFromSolver = Query.retrieveResponse -- | Send an arbitrary string to the solver in a query, and return a response. -- Note that this is inherently dangerous as it can put the solver in an arbitrary -- state and confuse SBV. sendRequestToSolver :: String -> Query String sendRequestToSolver = Query.ask {- $coordinateSolverInfo In rare cases it might be necessary to send an arbitrary string down to the solver. Needless to say, this should be avoided if at all possible. Users should prefer the provided API. If you do find yourself needing 'Data.SBV.Control.Utils.send' and 'Data.SBV.Control.Utils.ask' directly, please get in touch to see if SBV can support a typed API for your use case. Similarly, the function 'retrieveResponseFromSolver' might occasionally be necessary to clean-up the communication buffer. We would like to hear if you do need these functions regularly so we can provide better support. -} {-# ANN module ("HLint: ignore Use import/export shortcut" :: String) #-} sbv-7.13/Data/SBV/List.hs0000644000000000000000000003604313405536617013216 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.List -- Copyright : (c) Joel Burget, Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- A collection of list utilities, useful when working with symbolic lists. -- To the extent possible, the functions in this module follow those of "Data.List" -- so importing qualified is the recommended workflow. Also, it is recommended -- you use the @OverloadedLists@ extension to allow literal lists to -- be used as symbolic-lists. ----------------------------------------------------------------------------- {-# LANGUAGE Rank2Types #-} {-# LANGUAGE OverloadedLists #-} {-# LANGUAGE ScopedTypeVariables #-} module Data.SBV.List ( -- * Length, emptiness length, null -- * Deconstructing/Reconstructing , head, tail, uncons, init, singleton, listToListAt, elemAt, (.!!), implode, concat, (.:), (.++) -- * Containment , isInfixOf, isSuffixOf, isPrefixOf -- * Sublists , take, drop, subList, replace, indexOf, offsetIndexOf ) where import Prelude hiding (head, tail, init, length, take, drop, concat, null) import qualified Prelude as P import Data.SBV.Core.Data hiding (StrOp(..)) import Data.SBV.Core.Model import Data.SBV.Utils.Boolean ((==>)) import Data.List (genericLength, genericIndex, genericDrop, genericTake) import qualified Data.List as L (tails, isSuffixOf, isPrefixOf, isInfixOf) -- For doctest use only -- -- $setup -- >>> import Data.SBV.Provers.Prover (prove, sat) -- >>> import Data.SBV.Utils.Boolean ((&&&), bnot, (<=>)) -- >>> import Data.Int -- >>> import Data.Word -- >>> :set -XOverloadedLists -- >>> :set -XScopedTypeVariables -- | Length of a list. -- -- >>> sat $ \(l :: SList Word16) -> length l .== 2 -- Satisfiable. Model: -- s0 = [0,0] :: [SWord16] -- >>> sat $ \(l :: SList Word16) -> length l .< 0 -- Unsatisfiable -- >>> prove $ \(l1 :: SList Word16) (l2 :: SList Word16) -> length l1 + length l2 .== length (l1 .++ l2) -- Q.E.D. length :: SymWord a => SList a -> SInteger length = lift1 SeqLen (Just (fromIntegral . P.length)) -- | @`null` s@ is True iff the list is empty -- -- >>> prove $ \(l :: SList Word16) -> null l <=> length l .== 0 -- Q.E.D. -- >>> prove $ \(l :: SList Word16) -> null l <=> l .== [] -- Q.E.D. null :: SymWord a => SList a -> SBool null l | Just cs <- unliteral l = literal (P.null cs) | True = l .== literal [] -- | @`head`@ returns the first element of a list. Unspecified if the list is empty. -- -- >>> prove $ \c -> head (singleton c) .== (c :: SInteger) -- Q.E.D. head :: SymWord a => SList a -> SBV a head = (`elemAt` 0) -- | @`tail`@ returns the tail of a list. Unspecified if the list is empty. -- -- >>> prove $ \(h :: SInteger) t -> tail (singleton h .++ t) .== t -- Q.E.D. -- >>> prove $ \(l :: SList Integer) -> length l .> 0 ==> length (tail l) .== length l - 1 -- Q.E.D. -- >>> prove $ \(l :: SList Integer) -> bnot (null l) ==> singleton (head l) .++ tail l .== l -- Q.E.D. tail :: SymWord a => SList a -> SList a tail l | Just (_:cs) <- unliteral l = literal cs | True = subList l 1 (length l - 1) -- | @`uncons` returns the pair of the head and tail. Unspecified if the list is empty. uncons :: SymWord a => SList a -> (SBV a, SList a) uncons l = (head l, tail l) -- | @`init`@ returns all but the last element of the list. Unspecified if the list is empty. -- -- >>> prove $ \(h :: SInteger) t -> init (t .++ singleton h) .== t -- Q.E.D. init :: SymWord a => SList a -> SList a init l | Just cs@(_:_) <- unliteral l = literal $ P.init cs | True = subList l 0 (length l - 1) -- | @`singleton` x@ is the list of length 1 that contains the only value @x@. -- -- >>> prove $ \(x :: SInteger) -> head (singleton x) .== x -- Q.E.D. -- >>> prove $ \(x :: SInteger) -> length (singleton x) .== 1 -- Q.E.D. singleton :: SymWord a => SBV a -> SList a singleton = lift1 SeqUnit (Just (: [])) -- | @`listToListAt` l offset@. List of length 1 at @offset@ in @l@. Unspecified if -- index is out of bounds. -- -- >>> prove $ \(l1 :: SList Integer) l2 -> listToListAt (l1 .++ l2) (length l1) .== listToListAt l2 0 -- Q.E.D. -- >>> sat $ \(l :: SList Word16) -> length l .>= 2 &&& listToListAt l 0 ./= listToListAt l (length l - 1) -- Satisfiable. Model: -- s0 = [0,0,32] :: [SWord16] listToListAt :: SymWord a => SList a -> SInteger -> SList a listToListAt s offset = subList s offset 1 -- | @`elemAt` l i@ is the value stored at location @i@. Unspecified if -- index is out of bounds. -- -- >>> prove $ \i -> i .>= 0 &&& i .<= 4 ==> [1,1,1,1,1] `elemAt` i .== (1::SInteger) -- Q.E.D. -- >>> prove $ \(l :: SList Integer) i e -> l `elemAt` i .== e ==> indexOf l (singleton e) .<= i -- Q.E.D. elemAt :: forall a. SymWord a => SList a -> SInteger -> SBV a elemAt l i | Just xs <- unliteral l, Just ci <- unliteral i, ci >= 0, ci < genericLength xs, let x = xs `genericIndex` ci = literal x | True = SBV (SVal kElem (Right (cache (y (l `listToListAt` i))))) where kElem = kindOf (undefined :: a) kSeq = KList kElem -- This is trickier than it needs to be, but necessary since there's -- no SMTLib function to extract the element from a list. Instead, -- we form a singleton list, and assert that it is equivalent to -- the extracted value. See y si st = do e <- internalVariable st kElem es <- newExpr st kSeq (SBVApp (SeqOp SeqUnit) [e]) let esSBV = SBV (SVal kSeq (Right (cache (\_ -> return es)))) internalConstraint st False [] $ unSBV $ length l .> i ==> esSBV .== si return e -- | Short cut for 'elemAt' (.!!) :: SymWord a => SList a -> SInteger -> SBV a (.!!) = elemAt -- | @`implode` es@ is the list of length @|es|@ containing precisely those -- elements. Note that there is no corresponding function @explode@, since -- we wouldn't know the length of a symbolic list. -- -- >>> prove $ \(e1 :: SInteger) e2 e3 -> length (implode [e1, e2, e3]) .== 3 -- Q.E.D. -- >>> prove $ \(e1 :: SInteger) e2 e3 -> map (elemAt (implode [e1, e2, e3])) (map literal [0 .. 2]) .== [e1, e2, e3] -- Q.E.D. implode :: SymWord a => [SBV a] -> SList a implode = foldr ((.++) . singleton) (literal []) -- | Concatenate two lists. See also `.++`. concat :: SymWord a => SList a -> SList a -> SList a concat x y | isConcretelyEmpty x = y | isConcretelyEmpty y = x | True = lift2 SeqConcat (Just (++)) x y -- | Prepend an element, the traditional @cons@. infixr 5 .: (.:) :: SymWord a => SBV a -> SList a -> SList a a .: as = singleton a .++ as -- | Short cut for `concat`. -- -- >>> sat $ \x y z -> length x .== 5 &&& length y .== 1 &&& x .++ y .++ z .== [1 .. 12] -- Satisfiable. Model: -- s0 = [1,2,3,4,5] :: [SInteger] -- s1 = [6] :: [SInteger] -- s2 = [7,8,9,10,11,12] :: [SInteger] infixr 5 .++ (.++) :: SymWord a => SList a -> SList a -> SList a (.++) = concat -- | @`isInfixOf` sub l@. Does @l@ contain the subsequence @sub@? -- -- >>> prove $ \(l1 :: SList Integer) l2 l3 -> l2 `isInfixOf` (l1 .++ l2 .++ l3) -- Q.E.D. -- >>> prove $ \(l1 :: SList Integer) l2 -> l1 `isInfixOf` l2 &&& l2 `isInfixOf` l1 <=> l1 .== l2 -- Q.E.D. isInfixOf :: SymWord a => SList a -> SList a -> SBool sub `isInfixOf` l | isConcretelyEmpty sub = literal True | True = lift2 SeqContains (Just (flip L.isInfixOf)) l sub -- NB. flip, since `SeqContains` takes args in rev order! -- | @`isPrefixOf` pre l@. Is @pre@ a prefix of @l@? -- -- >>> prove $ \(l1 :: SList Integer) l2 -> l1 `isPrefixOf` (l1 .++ l2) -- Q.E.D. -- >>> prove $ \(l1 :: SList Integer) l2 -> l1 `isPrefixOf` l2 ==> subList l2 0 (length l1) .== l1 -- Q.E.D. isPrefixOf :: SymWord a => SList a -> SList a -> SBool pre `isPrefixOf` l | isConcretelyEmpty pre = literal True | True = lift2 SeqPrefixOf (Just L.isPrefixOf) pre l -- | @`isSuffixOf` suf l@. Is @suf@ a suffix of @l@? -- -- >>> prove $ \(l1 :: SList Word16) l2 -> l2 `isSuffixOf` (l1 .++ l2) -- Q.E.D. -- >>> prove $ \(l1 :: SList Word16) l2 -> l1 `isSuffixOf` l2 ==> subList l2 (length l2 - length l1) (length l1) .== l1 -- Q.E.D. isSuffixOf :: SymWord a => SList a -> SList a -> SBool suf `isSuffixOf` l | isConcretelyEmpty suf = literal True | True = lift2 SeqSuffixOf (Just L.isSuffixOf) suf l -- | @`take` len l@. Corresponds to Haskell's `take` on symbolic lists. -- -- >>> prove $ \(l :: SList Integer) i -> i .>= 0 ==> length (take i l) .<= i -- Q.E.D. take :: SymWord a => SInteger -> SList a -> SList a take i l = ite (i .<= 0) (literal []) $ ite (i .>= length l) l $ subList l 0 i -- | @`drop` len s@. Corresponds to Haskell's `drop` on symbolic-lists. -- -- >>> prove $ \(l :: SList Word16) i -> length (drop i l) .<= length l -- Q.E.D. -- >>> prove $ \(l :: SList Word16) i -> take i l .++ drop i l .== l -- Q.E.D. drop :: SymWord a => SInteger -> SList a -> SList a drop i s = ite (i .>= ls) (literal []) $ ite (i .<= 0) s $ subList s i (ls - i) where ls = length s -- | @`subList` s offset len@ is the sublist of @s@ at offset @offset@ with length @len@. -- This function is under-specified when the offset is outside the range of positions in @s@ or @len@ -- is negative or @offset+len@ exceeds the length of @s@. -- -- >>> prove $ \(l :: SList Integer) i -> i .>= 0 &&& i .< length l ==> subList l 0 i .++ subList l i (length l - i) .== l -- Q.E.D. -- >>> sat $ \i j -> subList [1..5] i j .== ([2..4] :: SList Integer) -- Satisfiable. Model: -- s0 = 1 :: Integer -- s1 = 3 :: Integer -- >>> sat $ \i j -> subList [1..5] i j .== ([6..7] :: SList Integer) -- Unsatisfiable subList :: SymWord a => SList a -> SInteger -> SInteger -> SList a subList l offset len | Just c <- unliteral l -- a constant list , Just o <- unliteral offset -- a constant offset , Just sz <- unliteral len -- a constant length , let lc = genericLength c -- length of the list , let valid x = x >= 0 && x <= lc -- predicate that checks valid point , valid o -- offset is valid , sz >= 0 -- length is not-negative , valid $ o + sz -- we don't overrun = literal $ genericTake sz $ genericDrop o c | True -- either symbolic, or something is out-of-bounds = lift3 SeqSubseq Nothing l offset len -- | @`replace` l src dst@. Replace the first occurrence of @src@ by @dst@ in @s@ -- -- >>> prove $ \l -> replace [1..5] l [6..10] .== [6..10] ==> l .== ([1..5] :: SList Word8) -- Q.E.D. -- >>> prove $ \(l1 :: SList Integer) l2 l3 -> length l2 .> length l1 ==> replace l1 l2 l3 .== l1 -- Q.E.D. replace :: SymWord a => SList a -> SList a -> SList a -> SList a replace l src dst | Just b <- unliteral src, P.null b -- If src is null, simply prepend = dst .++ l | Just a <- unliteral l , Just b <- unliteral src , Just c <- unliteral dst = literal $ walk a b c | True = lift3 SeqReplace Nothing l src dst where walk haystack needle newNeedle = go haystack -- note that needle is guaranteed non-empty here. where go [] = [] go i@(c:cs) | needle `L.isPrefixOf` i = newNeedle ++ genericDrop (genericLength needle :: Integer) i | True = c : go cs -- | @`indexOf` l sub@. Retrieves first position of @sub@ in @l@, @-1@ if there are no occurrences. -- Equivalent to @`offsetIndexOf` l sub 0@. -- -- >>> prove $ \(l :: SList Int8) i -> i .> 0 &&& i .< length l ==> indexOf l (subList l i 1) .<= i -- Q.E.D. -- >>> prove $ \(l :: SList Word16) i -> i .> 0 &&& i .< length l ==> indexOf l (subList l i 1) .== i -- Falsifiable. Counter-example: -- s0 = [32,0,0] :: [SWord16] -- s1 = 2 :: Integer -- >>> prove $ \(l1 :: SList Word16) l2 -> length l2 .> length l1 ==> indexOf l1 l2 .== -1 -- Q.E.D. indexOf :: SymWord a => SList a -> SList a -> SInteger indexOf s sub = offsetIndexOf s sub 0 -- | @`offsetIndexOf` l sub offset@. Retrieves first position of @sub@ at or -- after @offset@ in @l@, @-1@ if there are no occurrences. -- -- >>> prove $ \(l :: SList Int8) sub -> offsetIndexOf l sub 0 .== indexOf l sub -- Q.E.D. -- >>> prove $ \(l :: SList Int8) sub i -> i .>= length l &&& length sub .> 0 ==> offsetIndexOf l sub i .== -1 -- Q.E.D. -- >>> prove $ \(l :: SList Int8) sub i -> i .> length l ==> offsetIndexOf l sub i .== -1 -- Q.E.D. offsetIndexOf :: SymWord a => SList a -> SList a -> SInteger -> SInteger offsetIndexOf s sub offset | Just c <- unliteral s -- a constant list , Just n <- unliteral sub -- a constant search pattern , Just o <- unliteral offset -- at a constant offset , o >= 0, o <= genericLength c -- offset is good = case [i | (i, t) <- zip [o ..] (L.tails (genericDrop o c)), n `L.isPrefixOf` t] of (i:_) -> literal i _ -> -1 | True = lift3 SeqIndexOf Nothing s sub offset -- | Lift a unary operator over lists. lift1 :: forall a b. (SymWord a, SymWord b) => SeqOp -> Maybe (a -> b) -> SBV a -> SBV b lift1 w mbOp a | Just cv <- concEval1 mbOp a = cv | True = SBV $ SVal k $ Right $ cache r where k = kindOf (undefined :: b) r st = do swa <- sbvToSW st a newExpr st k (SBVApp (SeqOp w) [swa]) -- | Lift a binary operator over lists. lift2 :: forall a b c. (SymWord a, SymWord b, SymWord c) => SeqOp -> Maybe (a -> b -> c) -> SBV a -> SBV b -> SBV c lift2 w mbOp a b | Just cv <- concEval2 mbOp a b = cv | True = SBV $ SVal k $ Right $ cache r where k = kindOf (undefined :: c) r st = do swa <- sbvToSW st a swb <- sbvToSW st b newExpr st k (SBVApp (SeqOp w) [swa, swb]) -- | Lift a ternary operator over lists. lift3 :: forall a b c d. (SymWord a, SymWord b, SymWord c, SymWord d) => SeqOp -> Maybe (a -> b -> c -> d) -> SBV a -> SBV b -> SBV c -> SBV d lift3 w mbOp a b c | Just cv <- concEval3 mbOp a b c = cv | True = SBV $ SVal k $ Right $ cache r where k = kindOf (undefined :: d) r st = do swa <- sbvToSW st a swb <- sbvToSW st b swc <- sbvToSW st c newExpr st k (SBVApp (SeqOp w) [swa, swb, swc]) -- | Concrete evaluation for unary ops concEval1 :: (SymWord a, SymWord b) => Maybe (a -> b) -> SBV a -> Maybe (SBV b) concEval1 mbOp a = literal <$> (mbOp <*> unliteral a) -- | Concrete evaluation for binary ops concEval2 :: (SymWord a, SymWord b, SymWord c) => Maybe (a -> b -> c) -> SBV a -> SBV b -> Maybe (SBV c) concEval2 mbOp a b = literal <$> (mbOp <*> unliteral a <*> unliteral b) -- | Concrete evaluation for ternary ops concEval3 :: (SymWord a, SymWord b, SymWord c, SymWord d) => Maybe (a -> b -> c -> d) -> SBV a -> SBV b -> SBV c -> Maybe (SBV d) concEval3 mbOp a b c = literal <$> (mbOp <*> unliteral a <*> unliteral b <*> unliteral c) -- | Is the list concretely known empty? isConcretelyEmpty :: SymWord a => SList a -> Bool isConcretelyEmpty sl | Just l <- unliteral sl = P.null l | True = False sbv-7.13/Data/SBV/RegExp.hs0000644000000000000000000002607613405536617013502 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.RegExp -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- A collection of regular-expression related utilities. The recommended -- workflow is to import this module qualified as the names of the functions -- are specificly chosen to be common identifiers. Also, it is recommended -- you use the @OverloadedStrings@ extension to allow literal strings to be -- used as symbolic-strings and regular-expressions when working with -- this module. ----------------------------------------------------------------------------- {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE OverloadedStrings #-} module Data.SBV.RegExp ( -- * Regular expressions RegExp(..) -- * Matching -- $matching , RegExpMatchable(..) -- * Constructing regular expressions -- ** Literals , exactly -- ** A class of characters , oneOf -- ** Spaces , newline, whiteSpaceNoNewLine, whiteSpace -- ** Separators , tab, punctuation -- ** Letters , asciiLetter, asciiLower, asciiUpper -- ** Digits , digit, octDigit, hexDigit -- ** Numbers , decimal, octal, hexadecimal, floating -- ** Identifiers , identifier ) where import Prelude hiding (length, take, elem, notElem, head) import Data.SBV.Core.Data import Data.SBV.Core.Model () -- instances only import Data.SBV.String import qualified Data.Char as C -- For testing only import Data.SBV.Char -- For doctest use only -- -- $setup -- >>> import Prelude hiding (length, take, elem, notElem, head) -- >>> import Data.SBV.Provers.Prover (prove, sat) -- >>> import Data.SBV.Utils.Boolean ((<=>), (==>), bAny, (&&&), (|||), bnot) -- >>> import Data.SBV.Core.Model -- >>> :set -XOverloadedStrings -- >>> :set -XScopedTypeVariables -- | Matchable class. Things we can match against a 'RegExp'. -- (TODO: Currently SBV does *not* optimize this call if the input is a concrete string or -- a character, but rather directly calls down to the solver. We might want to perform the -- operation on the Haskell side for performance reasons, should this become important.) -- -- For instance, you can generate valid-looking phone numbers like this: -- -- >>> :set -XOverloadedStrings -- >>> let dig09 = Range '0' '9' -- >>> let dig19 = Range '1' '9' -- >>> let pre = dig19 * Loop 2 2 dig09 -- >>> let post = dig19 * Loop 3 3 dig09 -- >>> let phone = pre * "-" * post -- >>> sat $ \s -> (s :: SString) `match` phone -- Satisfiable. Model: -- s0 = "224-4222" :: String class RegExpMatchable a where -- | @`match` s r@ checks whether @s@ is in the language generated by @r@. match :: a -> RegExp -> SBool -- | Matching a character simply means the singleton string matches the regex. instance RegExpMatchable SChar where match = match . singleton -- | Matching symbolic strings. instance RegExpMatchable SString where match s r = lift1 (StrInRe r) opt s where -- TODO: Replace this with a function that concretely evaluates the string against the -- reg-exp, possible future work. But probably there isn't enough ROI. opt :: Maybe (String -> Bool) opt = Nothing -- | A literal regular-expression, matching the given string exactly. Note that -- with @OverloadedStrings@ extension, you can simply use a Haskell -- string to mean the same thing, so this function is rarely needed. -- -- >>> prove $ \(s :: SString) -> s `match` exactly "LITERAL" <=> s .== "LITERAL" -- Q.E.D. exactly :: String -> RegExp exactly = Literal -- | Helper to define a character class. -- -- >>> prove $ \(c :: SChar) -> c `match` oneOf "ABCD" <=> bAny (c .==) (map literal "ABCD") -- Q.E.D. oneOf :: String -> RegExp oneOf xs = Union [exactly [x] | x <- xs] -- | Recognize a newline. Also includes carriage-return and form-feed. -- -- >>> newline -- (re.union (str.to.re "\n") (str.to.re "\r") (str.to.re "\f")) -- >>> prove $ \c -> c `match` newline ==> isSpace c -- Q.E.D. newline :: RegExp newline = oneOf "\n\r\f" -- | Recognize a tab. -- -- >>> tab -- (str.to.re "\x09") -- >>> prove $ \c -> c `match` tab ==> c .== literal '\t' -- Q.E.D. tab :: RegExp tab = oneOf "\t" -- | Recognize white-space, but without a new line. -- -- >>> whiteSpaceNoNewLine -- (re.union (str.to.re "\x09") (re.union (str.to.re "\v") (str.to.re "\xa0") (str.to.re " "))) -- >>> prove $ \c -> c `match` whiteSpaceNoNewLine ==> c `match` whiteSpace &&& c ./= literal '\n' -- Q.E.D. whiteSpaceNoNewLine :: RegExp whiteSpaceNoNewLine = tab + oneOf "\v\160 " -- | Recognize white space. -- -- >>> prove $ \c -> c `match` whiteSpace ==> isSpace c -- Q.E.D. whiteSpace :: RegExp whiteSpace = newline + whiteSpaceNoNewLine -- | Recognize a punctuation character. Anything that satisfies the predicate 'isPunctuation' will -- be accepted. (TODO: Will need modification when we move to unicode.) -- -- >>> prove $ \c -> c `match` punctuation ==> isPunctuation c -- Q.E.D. punctuation :: RegExp punctuation = oneOf $ filter C.isPunctuation $ map C.chr [0..255] -- | Recognize an alphabet letter, i.e., @A@..@Z@, @a@..@z@. -- -- >>> asciiLetter -- (re.union (re.range "a" "z") (re.range "A" "Z")) -- >>> prove $ \c -> c `match` asciiLetter <=> toUpper c `match` asciiLetter -- Q.E.D. -- >>> prove $ \c -> c `match` asciiLetter <=> toLower c `match` asciiLetter -- Q.E.D. asciiLetter :: RegExp asciiLetter = asciiLower + asciiUpper -- | Recognize an ASCII lower case letter -- -- >>> asciiLower -- (re.range "a" "z") -- >>> prove $ \c -> (c :: SChar) `match` asciiLower ==> c `match` asciiLetter -- Q.E.D. -- >>> prove $ \c -> c `match` asciiLower ==> toUpper c `match` asciiUpper -- Q.E.D. -- >>> prove $ \c -> c `match` asciiLetter ==> toLower c `match` asciiLower -- Q.E.D. asciiLower :: RegExp asciiLower = Range 'a' 'z' -- | Recognize an upper case letter -- -- >>> asciiUpper -- (re.range "A" "Z") -- >>> prove $ \c -> (c :: SChar) `match` asciiUpper ==> c `match` asciiLetter -- Q.E.D. -- >>> prove $ \c -> c `match` asciiUpper ==> toLower c `match` asciiLower -- Q.E.D. -- >>> prove $ \c -> c `match` asciiLetter ==> toUpper c `match` asciiUpper -- Q.E.D. asciiUpper :: RegExp asciiUpper = Range 'A' 'Z' -- | Recognize a digit. One of @0@..@9@. -- -- >>> digit -- (re.range "0" "9") -- >>> prove $ \c -> c `match` digit <=> let v = digitToInt c in 0 .<= v &&& v .< 10 -- Q.E.D. digit :: RegExp digit = Range '0' '9' -- | Recognize an octal digit. One of @0@..@7@. -- -- >>> octDigit -- (re.range "0" "7") -- >>> prove $ \c -> c `match` octDigit <=> let v = digitToInt c in 0 .<= v &&& v .< 8 -- Q.E.D. -- >>> prove $ \(c :: SChar) -> c `match` octDigit ==> c `match` digit -- Q.E.D. octDigit :: RegExp octDigit = Range '0' '7' -- | Recognize a hexadecimal digit. One of @0@..@9@, @a@..@f@, @A@..@F@. -- -- >>> hexDigit -- (re.union (re.range "0" "9") (re.range "a" "f") (re.range "A" "F")) -- >>> prove $ \c -> c `match` hexDigit <=> let v = digitToInt c in 0 .<= v &&& v .< 16 -- Q.E.D. -- >>> prove $ \(c :: SChar) -> c `match` digit ==> c `match` hexDigit -- Q.E.D. hexDigit :: RegExp hexDigit = digit + Range 'a' 'f' + Range 'A' 'F' -- | Recognize a decimal number. -- -- >>> decimal -- (re.+ (re.range "0" "9")) -- >>> prove $ \s -> (s::SString) `match` decimal ==> bnot (s `match` KStar asciiLetter) -- Q.E.D. decimal :: RegExp decimal = KPlus digit -- | Recognize an octal number. Must have a prefix of the form @0o@\/@0O@. -- -- >>> octal -- (re.++ (re.union (str.to.re "0o") (str.to.re "0O")) (re.+ (re.range "0" "7"))) -- >>> prove $ \s -> s `match` octal ==> bAny (.== take 2 s) ["0o", "0O"] -- Q.E.D. octal :: RegExp octal = ("0o" + "0O") * KPlus octDigit -- | Recognize a hexadecimal number. Must have a prefix of the form @0x@\/@0X@. -- -- >>> hexadecimal -- (re.++ (re.union (str.to.re "0x") (str.to.re "0X")) (re.+ (re.union (re.range "0" "9") (re.range "a" "f") (re.range "A" "F")))) -- >>> prove $ \s -> s `match` hexadecimal ==> bAny (.== take 2 s) ["0x", "0X"] -- Q.E.D. hexadecimal :: RegExp hexadecimal = ("0x" + "0X") * KPlus hexDigit -- | Recognize a floating point number. The exponent part is optional if a fraction -- is present. The exponent may or may not have a sign. -- -- >>> prove $ \s -> s `match` floating ==> length s .>= 3 -- Q.E.D. floating :: RegExp floating = withFraction + withoutFraction where withFraction = decimal * "." * decimal * Opt expt withoutFraction = decimal * expt expt = ("e" + "E") * Opt (oneOf "+-") * decimal -- | For the purposes of this regular expression, an identifier consists of a letter -- followed by zero or more letters, digits, underscores, and single quotes. The first -- letter must be lowercase. -- -- >>> prove $ \s -> s `match` identifier ==> isAsciiLower (head s) -- Q.E.D. -- >>> prove $ \s -> s `match` identifier ==> length s .>= 1 -- Q.E.D. identifier :: RegExp identifier = asciiLower * KStar (asciiLetter + digit + "_" + "'") -- | Lift a unary operator over strings. lift1 :: forall a b. (SymWord a, SymWord b) => StrOp -> Maybe (a -> b) -> SBV a -> SBV b lift1 w mbOp a | Just cv <- concEval1 mbOp a = cv | True = SBV $ SVal k $ Right $ cache r where k = kindOf (undefined :: b) r st = do swa <- sbvToSW st a newExpr st k (SBVApp (StrOp w) [swa]) -- | Concrete evaluation for unary ops concEval1 :: (SymWord a, SymWord b) => Maybe (a -> b) -> SBV a -> Maybe (SBV b) concEval1 mbOp a = literal <$> (mbOp <*> unliteral a) -- | Quiet GHC about testing only imports __unused :: a __unused = undefined isSpace length take elem notElem head {- $matching A symbolic string or a character ('SString' or 'SChar') can be matched against a regular-expression. Note that the regular-expression itself is not a symbolic object: It's a fully concrete representation, as captured by the 'RegExp' class. The 'RegExp' class is an instance of the @IsString@ class, which makes writing literal matches easier. The 'RegExp' type also has a (somewhat degenerate) 'Num' instance: Concatenation corresponds to multiplication, union corresponds to addition, and @0@ corresponds to the empty language. Note that since `match` is a method of 'RegExpMatchable' class, both 'SChar' and 'SString' can be used as an argument for matching. In practice, this means you might have to disambiguate with a type-ascription if it is not deducible from context. >>> prove $ \s -> (s :: SString) `match` "hello" <=> s .== "hello" Q.E.D. >>> prove $ \s -> s `match` Loop 2 5 "xyz" ==> length s .>= 6 Q.E.D. >>> prove $ \s -> s `match` Loop 2 5 "xyz" ==> length s .<= 15 Q.E.D. >>> prove $ \s -> match s (Loop 2 5 "xyz") ==> length s .>= 7 Falsifiable. Counter-example: s0 = "xyzxyz" :: String >>> prove $ \s -> (s :: SString) `match` "hello" ==> s `match` ("hello" + "world") Q.E.D. >>> prove $ \s -> bnot $ (s::SString) `match` ("so close" * 0) Q.E.D. >>> prove $ \c -> (c :: SChar) `match` oneOf "abcd" ==> ord c .>= ord (literal 'a') &&& ord c .<= ord (literal 'd') Q.E.D. -} sbv-7.13/Data/SBV/String.hs0000644000000000000000000003626113405536617013553 0ustar0000000000000000{-# LANGUAGE Rank2Types #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} ----------------------------------------------------------------------------- -- | -- Module : Data.SBV.String -- Copyright : (c) Joel Burget, Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- A collection of string/character utilities, useful when working -- with symbolic strings. To the extent possible, the functions -- in this module follow those of "Data.List" so importing qualified -- is the recommended workflow. Also, it is recommended you use the -- @OverloadedStrings@ extension to allow literal strings to be -- used as symbolic-strings. ----------------------------------------------------------------------------- module Data.SBV.String ( -- * Length, emptiness length, null -- * Deconstructing/Reconstructing , head, tail, init, singleton, strToStrAt, strToCharAt, (.!!), implode, concat, (.:), (.++) -- * Containment , isInfixOf, isSuffixOf, isPrefixOf -- * Substrings , take, drop, subStr, replace, indexOf, offsetIndexOf -- * Conversion to\/from naturals , strToNat, natToStr ) where import Prelude hiding (head, tail, init, length, take, drop, concat, null) import qualified Prelude as P import Data.SBV.Core.Data hiding (SeqOp(..)) import Data.SBV.Core.Model import Data.SBV.Utils.Boolean ((==>)) import qualified Data.Char as C import Data.List (genericLength, genericIndex, genericDrop, genericTake) import qualified Data.List as L (tails, isSuffixOf, isPrefixOf, isInfixOf) -- For doctest use only -- -- $setup -- >>> import Data.SBV.Provers.Prover (prove, sat) -- >>> import Data.SBV.Utils.Boolean ((&&&), bnot, (<=>)) -- >>> :set -XOverloadedStrings -- | Length of a string. -- -- >>> sat $ \s -> length s .== 2 -- Satisfiable. Model: -- s0 = "\NUL\NUL" :: String -- >>> sat $ \s -> length s .< 0 -- Unsatisfiable -- >>> prove $ \s1 s2 -> length s1 + length s2 .== length (s1 .++ s2) -- Q.E.D. length :: SString -> SInteger length = lift1 StrLen (Just (fromIntegral . P.length)) -- | @`null` s@ is True iff the string is empty -- -- >>> prove $ \s -> null s <=> length s .== 0 -- Q.E.D. -- >>> prove $ \s -> null s <=> s .== "" -- Q.E.D. null :: SString -> SBool null s | Just cs <- unliteral s = literal (P.null cs) | True = s .== literal "" -- | @`head`@ returns the head of a string. Unspecified if the string is empty. -- -- >>> prove $ \c -> head (singleton c) .== c -- Q.E.D. head :: SString -> SChar head = (`strToCharAt` 0) -- | @`tail`@ returns the tail of a string. Unspecified if the string is empty. -- -- >>> prove $ \h s -> tail (singleton h .++ s) .== s -- Q.E.D. -- >>> prove $ \s -> length s .> 0 ==> length (tail s) .== length s - 1 -- Q.E.D. -- >>> prove $ \s -> bnot (null s) ==> singleton (head s) .++ tail s .== s -- Q.E.D. tail :: SString -> SString tail s | Just (_:cs) <- unliteral s = literal cs | True = subStr s 1 (length s - 1) -- | @`init`@ returns all but the last element of the list. Unspecified if the string is empty. -- -- >>> prove $ \c t -> init (t .++ singleton c) .== t -- Q.E.D. init :: SString -> SString init s | Just cs@(_:_) <- unliteral s = literal $ P.init cs | True = subStr s 0 (length s - 1) -- | @`singleton` c@ is the string of length 1 that contains the only character -- whose value is the 8-bit value @c@. -- -- >>> prove $ \c -> c .== literal 'A' ==> singleton c .== "A" -- Q.E.D. -- >>> prove $ \c -> length (singleton c) .== 1 -- Q.E.D. singleton :: SChar -> SString singleton = lift1 StrUnit (Just wrap) where wrap c = [c] -- | @`strToStrAt` s offset@. Substring of length 1 at @offset@ in @s@. Unspecified if -- offset is out of bounds. -- -- >>> prove $ \s1 s2 -> strToStrAt (s1 .++ s2) (length s1) .== strToStrAt s2 0 -- Q.E.D. -- >>> sat $ \s -> length s .>= 2 &&& strToStrAt s 0 ./= strToStrAt s (length s - 1) -- Satisfiable. Model: -- s0 = "\NUL\NUL\128" :: String strToStrAt :: SString -> SInteger -> SString strToStrAt s offset = subStr s offset 1 -- | @`strToCharAt` s i@ is the 8-bit value stored at location @i@. Unspecified if -- index is out of bounds. -- -- >>> prove $ \i -> i .>= 0 &&& i .<= 4 ==> "AAAAA" `strToCharAt` i .== literal 'A' -- Q.E.D. -- >>> prove $ \s i c -> s `strToCharAt` i .== c ==> indexOf s (singleton c) .<= i -- Q.E.D. strToCharAt :: SString -> SInteger -> SChar strToCharAt s i | Just cs <- unliteral s, Just ci <- unliteral i, ci >= 0, ci < genericLength cs, let c = C.ord (cs `genericIndex` ci) = literal (C.chr c) | True = SBV (SVal w8 (Right (cache (y (s `strToStrAt` i))))) where w8 = KBounded False 8 -- This is trickier than it needs to be, but necessary since there's -- no SMTLib function to extract the character from a string. Instead, -- we form a singleton string, and assert that it is equivalent to -- the extracted value. See y si st = do c <- internalVariable st w8 cs <- newExpr st KString (SBVApp (StrOp StrUnit) [c]) let csSBV = SBV (SVal KString (Right (cache (\_ -> return cs)))) internalConstraint st False [] $ unSBV $ length s .> i ==> csSBV .== si return c -- | Short cut for 'strToCharAt' (.!!) :: SString -> SInteger -> SChar (.!!) = strToCharAt -- | @`implode` cs@ is the string of length @|cs|@ containing precisely those -- characters. Note that there is no corresponding function @explode@, since -- we wouldn't know the length of a symbolic string. -- -- >>> prove $ \c1 c2 c3 -> length (implode [c1, c2, c3]) .== 3 -- Q.E.D. -- >>> prove $ \c1 c2 c3 -> map (strToCharAt (implode [c1, c2, c3])) (map literal [0 .. 2]) .== [c1, c2, c3] -- Q.E.D. implode :: [SChar] -> SString implode = foldr ((.++) . singleton) "" -- | Prepend an element, the traditional @cons@. infixr 5 .: (.:) :: SChar -> SString -> SString c .: cs = singleton c .++ cs -- | Concatenate two strings. See also `.++`. concat :: SString -> SString -> SString concat x y | isConcretelyEmpty x = y | isConcretelyEmpty y = x | True = lift2 StrConcat (Just (++)) x y -- | Short cut for `concat`. -- -- >>> sat $ \x y z -> length x .== 5 &&& length y .== 1 &&& x .++ y .++ z .== "Hello world!" -- Satisfiable. Model: -- s0 = "Hello" :: String -- s1 = " " :: String -- s2 = "world!" :: String infixr 5 .++ (.++) :: SString -> SString -> SString (.++) = concat -- | @`isInfixOf` sub s@. Does @s@ contain the substring @sub@? -- -- >>> prove $ \s1 s2 s3 -> s2 `isInfixOf` (s1 .++ s2 .++ s3) -- Q.E.D. -- >>> prove $ \s1 s2 -> s1 `isInfixOf` s2 &&& s2 `isInfixOf` s1 <=> s1 .== s2 -- Q.E.D. isInfixOf :: SString -> SString -> SBool sub `isInfixOf` s | isConcretelyEmpty sub = literal True | True = lift2 StrContains (Just (flip L.isInfixOf)) s sub -- NB. flip, since `StrContains` takes args in rev order! -- | @`isPrefixOf` pre s@. Is @pre@ a prefix of @s@? -- -- >>> prove $ \s1 s2 -> s1 `isPrefixOf` (s1 .++ s2) -- Q.E.D. -- >>> prove $ \s1 s2 -> s1 `isPrefixOf` s2 ==> subStr s2 0 (length s1) .== s1 -- Q.E.D. isPrefixOf :: SString -> SString -> SBool pre `isPrefixOf` s | isConcretelyEmpty pre = literal True | True = lift2 StrPrefixOf (Just L.isPrefixOf) pre s -- | @`isSuffixOf` suf s@. Is @suf@ a suffix of @s@? -- -- >>> prove $ \s1 s2 -> s2 `isSuffixOf` (s1 .++ s2) -- Q.E.D. -- >>> prove $ \s1 s2 -> s1 `isSuffixOf` s2 ==> subStr s2 (length s2 - length s1) (length s1) .== s1 -- Q.E.D. isSuffixOf :: SString -> SString -> SBool suf `isSuffixOf` s | isConcretelyEmpty suf = literal True | True = lift2 StrSuffixOf (Just L.isSuffixOf) suf s -- | @`take` len s@. Corresponds to Haskell's `take` on symbolic-strings. -- -- >>> prove $ \s i -> i .>= 0 ==> length (take i s) .<= i -- Q.E.D. take :: SInteger -> SString -> SString take i s = ite (i .<= 0) (literal "") $ ite (i .>= length s) s $ subStr s 0 i -- | @`drop` len s@. Corresponds to Haskell's `drop` on symbolic-strings. -- -- >>> prove $ \s i -> length (drop i s) .<= length s -- Q.E.D. -- >>> prove $ \s i -> take i s .++ drop i s .== s -- Q.E.D. drop :: SInteger -> SString -> SString drop i s = ite (i .>= ls) (literal "") $ ite (i .<= 0) s $ subStr s i (ls - i) where ls = length s -- | @`subStr` s offset len@ is the substring of @s@ at offset @offset@ with length @len@. -- This function is under-specified when the offset is outside the range of positions in @s@ or @len@ -- is negative or @offset+len@ exceeds the length of @s@. -- -- >>> prove $ \s i -> i .>= 0 &&& i .< length s ==> subStr s 0 i .++ subStr s i (length s - i) .== s -- Q.E.D. -- >>> sat $ \i j -> subStr "hello" i j .== "ell" -- Satisfiable. Model: -- s0 = 1 :: Integer -- s1 = 3 :: Integer -- >>> sat $ \i j -> subStr "hell" i j .== "no" -- Unsatisfiable subStr :: SString -> SInteger -> SInteger -> SString subStr s offset len | Just c <- unliteral s -- a constant string , Just o <- unliteral offset -- a constant offset , Just l <- unliteral len -- a constant length , let lc = genericLength c -- length of the string , let valid x = x >= 0 && x <= lc -- predicate that checks valid point , valid o -- offset is valid , l >= 0 -- length is not-negative , valid $ o + l -- we don't overrun = literal $ genericTake l $ genericDrop o c | True -- either symbolic, or something is out-of-bounds = lift3 StrSubstr Nothing s offset len -- | @`replace` s src dst@. Replace the first occurrence of @src@ by @dst@ in @s@ -- -- >>> prove $ \s -> replace "hello" s "world" .== "world" ==> s .== "hello" -- Q.E.D. -- >>> prove $ \s1 s2 s3 -> length s2 .> length s1 ==> replace s1 s2 s3 .== s1 -- Q.E.D. replace :: SString -> SString -> SString -> SString replace s src dst | Just b <- unliteral src, P.null b -- If src is null, simply prepend = dst .++ s | Just a <- unliteral s , Just b <- unliteral src , Just c <- unliteral dst = literal $ walk a b c | True = lift3 StrReplace Nothing s src dst where walk haystack needle newNeedle = go haystack -- note that needle is guaranteed non-empty here. where go [] = [] go i@(c:cs) | needle `L.isPrefixOf` i = newNeedle ++ genericDrop (genericLength needle :: Integer) i | True = c : go cs -- | @`indexOf` s sub@. Retrieves first position of @sub@ in @s@, @-1@ if there are no occurrences. -- Equivalent to @`offsetIndexOf` s sub 0@. -- -- >>> prove $ \s i -> i .> 0 &&& i .< length s ==> indexOf s (subStr s i 1) .<= i -- Q.E.D. -- >>> prove $ \s i -> i .> 0 &&& i .< length s ==> indexOf s (subStr s i 1) .== i -- Falsifiable. Counter-example: -- s0 = " \NUL\NUL\NUL\NUL\NUL" :: String -- s1 = 3 :: Integer -- >>> prove $ \s1 s2 -> length s2 .> length s1 ==> indexOf s1 s2 .== -1 -- Q.E.D. indexOf :: SString -> SString -> SInteger indexOf s sub = offsetIndexOf s sub 0 -- | @`offsetIndexOf` s sub offset@. Retrieves first position of @sub@ at or -- after @offset@ in @s@, @-1@ if there are no occurrences. -- -- >>> prove $ \s sub -> offsetIndexOf s sub 0 .== indexOf s sub -- Q.E.D. -- >>> prove $ \s sub i -> i .>= length s &&& length sub .> 0 ==> offsetIndexOf s sub i .== -1 -- Q.E.D. -- >>> prove $ \s sub i -> i .> length s ==> offsetIndexOf s sub i .== -1 -- Q.E.D. offsetIndexOf :: SString -> SString -> SInteger -> SInteger offsetIndexOf s sub offset | Just c <- unliteral s -- a constant string , Just n <- unliteral sub -- a constant search pattern , Just o <- unliteral offset -- at a constant offset , o >= 0, o <= genericLength c -- offset is good = case [i | (i, t) <- zip [o ..] (L.tails (genericDrop o c)), n `L.isPrefixOf` t] of (i:_) -> literal i _ -> -1 | True = lift3 StrIndexOf Nothing s sub offset -- | @`strToNat` s@. Retrieve integer encoded by string @s@ (ground rewriting only). -- Note that by definition this function only works when @s@ only contains digits, -- that is, if it encodes a natural number. Otherwise, it returns '-1'. -- See for details. -- -- >>> prove $ \s -> let n = strToNat s in n .>= 0 &&& n .< 10 ==> length s .== 1 -- Q.E.D. strToNat :: SString -> SInteger strToNat s | Just a <- unliteral s = if all C.isDigit a && not (P.null a) then literal (read a) else -1 | True = lift1 StrStrToNat Nothing s -- | @`natToStr` i@. Retrieve string encoded by integer @i@ (ground rewriting only). -- Again, only naturals are supported, any input that is not a natural number -- produces empty string, even though we take an integer as an argument. -- See for details. -- -- >>> prove $ \i -> length (natToStr i) .== 3 ==> i .<= 999 -- Q.E.D. natToStr :: SInteger -> SString natToStr i | Just v <- unliteral i = literal $ if v >= 0 then show v else "" | True = lift1 StrNatToStr Nothing i -- | Lift a unary operator over strings. lift1 :: forall a b. (SymWord a, SymWord b) => StrOp -> Maybe (a -> b) -> SBV a -> SBV b lift1 w mbOp a | Just cv <- concEval1 mbOp a = cv | True = SBV $ SVal k $ Right $ cache r where k = kindOf (undefined :: b) r st = do swa <- sbvToSW st a newExpr st k (SBVApp (StrOp w) [swa]) -- | Lift a binary operator over strings. lift2 :: forall a b c. (SymWord a, SymWord b, SymWord c) => StrOp -> Maybe (a -> b -> c) -> SBV a -> SBV b -> SBV c lift2 w mbOp a b | Just cv <- concEval2 mbOp a b = cv | True = SBV $ SVal k $ Right $ cache r where k = kindOf (undefined :: c) r st = do swa <- sbvToSW st a swb <- sbvToSW st b newExpr st k (SBVApp (StrOp w) [swa, swb]) -- | Lift a ternary operator over strings. lift3 :: forall a b c d. (SymWord a, SymWord b, SymWord c, SymWord d) => StrOp -> Maybe (a -> b -> c -> d) -> SBV a -> SBV b -> SBV c -> SBV d lift3 w mbOp a b c | Just cv <- concEval3 mbOp a b c = cv | True = SBV $ SVal k $ Right $ cache r where k = kindOf (undefined :: d) r st = do swa <- sbvToSW st a swb <- sbvToSW st b swc <- sbvToSW st c newExpr st k (SBVApp (StrOp w) [swa, swb, swc]) -- | Concrete evaluation for unary ops concEval1 :: (SymWord a, SymWord b) => Maybe (a -> b) -> SBV a -> Maybe (SBV b) concEval1 mbOp a = literal <$> (mbOp <*> unliteral a) -- | Concrete evaluation for binary ops concEval2 :: (SymWord a, SymWord b, SymWord c) => Maybe (a -> b -> c) -> SBV a -> SBV b -> Maybe (SBV c) concEval2 mbOp a b = literal <$> (mbOp <*> unliteral a <*> unliteral b) -- | Concrete evaluation for ternary ops concEval3 :: (SymWord a, SymWord b, SymWord c, SymWord d) => Maybe (a -> b -> c -> d) -> SBV a -> SBV b -> SBV c -> Maybe (SBV d) concEval3 mbOp a b c = literal <$> (mbOp <*> unliteral a <*> unliteral b <*> unliteral c) -- | Is the string concretely known empty? isConcretelyEmpty :: SString -> Bool isConcretelyEmpty ss | Just s <- unliteral ss = P.null s | True = False sbv-7.13/Data/SBV/Compilers/0000755000000000000000000000000013405536617013676 5ustar0000000000000000sbv-7.13/Data/SBV/Compilers/C.hs0000644000000000000000000015756613405536617014440 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Compilers.C -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Compilation of symbolic programs to C ----------------------------------------------------------------------------- {-# LANGUAGE CPP #-} {-# LANGUAGE PatternGuards #-} module Data.SBV.Compilers.C(compileToC, compileToCLib, compileToC', compileToCLib') where import Control.DeepSeq (rnf) import Data.Char (isSpace) import Data.List (nub, intercalate, intersperse) import Data.Maybe (isJust, isNothing, fromJust) import qualified Data.Foldable as F (toList) import qualified Data.Set as Set (member, union, unions, empty, toList, singleton, fromList) import System.FilePath (takeBaseName, replaceExtension) import System.Random -- Work around the fact that GHC 8.4.1 started exporting <>.. Hmm.. import Text.PrettyPrint.HughesPJ import qualified Text.PrettyPrint.HughesPJ as P ((<>)) import Data.SBV.Core.Data import Data.SBV.Compilers.CodeGen import Data.SBV.Utils.PrettyNum (chex, showCFloat, showCDouble) import GHC.Stack --------------------------------------------------------------------------- -- * API --------------------------------------------------------------------------- -- | Given a symbolic computation, render it as an equivalent collection of files -- that make up a C program: -- -- * The first argument is the directory name under which the files will be saved. To save -- files in the current directory pass @'Just' \".\"@. Use 'Nothing' for printing to stdout. -- -- * The second argument is the name of the C function to generate. -- -- * The final argument is the function to be compiled. -- -- Compilation will also generate a @Makefile@, a header file, and a driver (test) program, etc. compileToC :: Maybe FilePath -> String -> SBVCodeGen () -> IO () compileToC mbDirName nm f = compileToC' nm f >>= renderCgPgmBundle mbDirName -- | Lower level version of 'compileToC', producing a 'CgPgmBundle' compileToC' :: String -> SBVCodeGen () -> IO (CgConfig, CgPgmBundle) compileToC' nm f = do rands <- randoms `fmap` newStdGen codeGen SBVToC (defaultCgConfig { cgDriverVals = rands }) nm f -- | Create code to generate a library archive (.a) from given symbolic functions. Useful when generating code -- from multiple functions that work together as a library. -- -- * The first argument is the directory name under which the files will be saved. To save -- files in the current directory pass @'Just' \".\"@. Use 'Nothing' for printing to stdout. -- -- * The second argument is the name of the archive to generate. -- -- * The third argument is the list of functions to include, in the form of function-name/code pairs, similar -- to the second and third arguments of 'compileToC', except in a list. compileToCLib :: Maybe FilePath -> String -> [(String, SBVCodeGen ())] -> IO () compileToCLib mbDirName libName comps = compileToCLib' libName comps >>= renderCgPgmBundle mbDirName -- | Lower level version of 'compileToCLib', producing a 'CgPgmBundle' compileToCLib' :: String -> [(String, SBVCodeGen ())] -> IO (CgConfig, CgPgmBundle) compileToCLib' libName comps = mergeToLib libName `fmap` mapM (uncurry compileToC') comps --------------------------------------------------------------------------- -- * Implementation --------------------------------------------------------------------------- -- token for the target language data SBVToC = SBVToC instance CgTarget SBVToC where targetName _ = "C" translate _ = cgen -- Unexpected input, or things we will probably never support die :: String -> a die msg = error $ "SBV->C: Unexpected: " ++ msg -- Unsupported features, or features TBD tbd :: String -> a tbd msg = error $ "SBV->C: Not yet supported: " ++ msg cgen :: CgConfig -> String -> CgState -> Result -> CgPgmBundle cgen cfg nm st sbvProg -- we rnf the main pg and the sig to make sure any exceptions in type conversion pop-out early enough -- this is purely cosmetic, of course.. = rnf (render sig) `seq` rnf (render (vcat body)) `seq` result where result = CgPgmBundle bundleKind $ filt [ ("Makefile", (CgMakefile flags, [genMake (cgGenDriver cfg) nm nmd flags])) , (nm ++ ".h", (CgHeader [sig], [genHeader bundleKind nm [sig] extProtos])) , (nmd ++ ".c", (CgDriver, genDriver cfg randVals nm ins outs mbRet)) , (nm ++ ".c", (CgSource, body)) ] (body, flagsNeeded) = genCProg cfg nm sig sbvProg ins outs mbRet extDecls bundleKind = (cgInteger cfg, cgReal cfg) randVals = cgDriverVals cfg filt xs = [c | c@(_, (k, _)) <- xs, need k] where need k | isCgDriver k = cgGenDriver cfg | isCgMakefile k = cgGenMakefile cfg | True = True nmd = nm ++ "_driver" sig = pprCFunHeader nm ins outs mbRet ins = cgInputs st outs = cgOutputs st mbRet = case cgReturns st of [] -> Nothing [CgAtomic o] -> Just o [CgArray _] -> tbd "Non-atomic return values" _ -> tbd "Multiple return values" extProtos = case cgPrototypes st of [] -> empty xs -> vcat $ text "/* User given prototypes: */" : map text xs extDecls = case cgDecls st of [] -> empty xs -> vcat $ text "/* User given declarations: */" : map text xs flags = flagsNeeded ++ cgLDFlags st -- | Pretty print a functions type. If there is only one output, we compile it -- as a function that returns that value. Otherwise, we compile it as a void function -- that takes return values as pointers to be updated. pprCFunHeader :: String -> [(String, CgVal)] -> [(String, CgVal)] -> Maybe SW -> Doc pprCFunHeader fn ins outs mbRet = retType <+> text fn P.<> parens (fsep (punctuate comma (map mkParam ins ++ map mkPParam outs))) where retType = case mbRet of Nothing -> text "void" Just sw -> pprCWord False sw mkParam, mkPParam :: (String, CgVal) -> Doc mkParam (n, CgAtomic sw) = pprCWord True sw <+> text n mkParam (_, CgArray []) = die "mkParam: CgArray with no elements!" mkParam (n, CgArray (sw:_)) = pprCWord True sw <+> text "*" P.<> text n mkPParam (n, CgAtomic sw) = pprCWord False sw <+> text "*" P.<> text n mkPParam (_, CgArray []) = die "mPkParam: CgArray with no elements!" mkPParam (n, CgArray (sw:_)) = pprCWord False sw <+> text "*" P.<> text n -- | Renders as "const SWord8 s0", etc. the first parameter is the width of the typefield declSW :: Int -> SW -> Doc declSW w sw = text "const" <+> pad (showCType sw) <+> text (show sw) where pad s = text $ s ++ replicate (w - length s) ' ' -- | Return the proper declaration and the result as a pair. No consts declSWNoConst :: Int -> SW -> (Doc, Doc) declSWNoConst w sw = (text " " <+> pad (showCType sw), text (show sw)) where pad s = text $ s ++ replicate (w - length s) ' ' -- | Renders as "s0", etc, or the corresponding constant showSW :: CgConfig -> [(SW, CW)] -> SW -> Doc showSW cfg consts sw | sw == falseSW = text "false" | sw == trueSW = text "true" | Just cw <- sw `lookup` consts = mkConst cfg cw | True = text $ show sw -- | Words as it would map to a C word pprCWord :: HasKind a => Bool -> a -> Doc pprCWord cnst v = (if cnst then text "const" else empty) <+> text (showCType v) -- | Almost a "show", but map "SWord1" to "SBool" -- which is used for extracting one-bit words. showCType :: HasKind a => a -> String showCType i = case kindOf i of KBounded False 1 -> "SBool" k -> show k -- | The printf specifier for the type specifier :: CgConfig -> SW -> Doc specifier cfg sw = case kindOf sw of KBool -> spec (False, 1) KBounded b i -> spec (b, i) KUnbounded -> spec (True, fromJust (cgInteger cfg)) KReal -> specF (fromJust (cgReal cfg)) KFloat -> specF CgFloat KDouble -> specF CgDouble KString -> text "%s" KChar -> text "%c" KList k -> die $ "list sort: " ++ show k KUserSort s _ -> die $ "uninterpreted sort: " ++ s where spec :: (Bool, Int) -> Doc spec (False, 1) = text "%d" spec (False, 8) = text "%\"PRIu8\"" spec (True, 8) = text "%\"PRId8\"" spec (False, 16) = text "0x%04\"PRIx16\"U" spec (True, 16) = text "%\"PRId16\"" spec (False, 32) = text "0x%08\"PRIx32\"UL" spec (True, 32) = text "%\"PRId32\"L" spec (False, 64) = text "0x%016\"PRIx64\"ULL" spec (True, 64) = text "%\"PRId64\"LL" spec (s, sz) = die $ "Format specifier at type " ++ (if s then "SInt" else "SWord") ++ show sz specF :: CgSRealType -> Doc specF CgFloat = text "%.6g" -- float.h: __FLT_DIG__ specF CgDouble = text "%.15g" -- float.h: __DBL_DIG__ specF CgLongDouble = text "%Lf" -- | Make a constant value of the given type. We don't check for out of bounds here, as it should not be needed. -- There are many options here, using binary, decimal, etc. We simply use decimal for values 8-bits or less, -- and hex otherwise. mkConst :: CgConfig -> CW -> Doc mkConst cfg (CW KReal (CWAlgReal (AlgRational _ r))) = double (fromRational r :: Double) P.<> sRealSuffix (fromJust (cgReal cfg)) where sRealSuffix CgFloat = text "F" sRealSuffix CgDouble = empty sRealSuffix CgLongDouble = text "L" mkConst cfg (CW KUnbounded (CWInteger i)) = showSizedConst i (True, fromJust (cgInteger cfg)) mkConst _ (CW (KBounded sg sz) (CWInteger i)) = showSizedConst i (sg, sz) mkConst _ (CW KBool (CWInteger i)) = showSizedConst i (False, 1) mkConst _ (CW KFloat (CWFloat f)) = text $ showCFloat f mkConst _ (CW KDouble (CWDouble d)) = text $ showCDouble d mkConst _ (CW KString (CWString s)) = text $ show s mkConst _ (CW KChar (CWChar c)) = text $ show c mkConst _ cw = die $ "mkConst: " ++ show cw showSizedConst :: Integer -> (Bool, Int) -> Doc showSizedConst i (False, 1) = text (if i == 0 then "false" else "true") showSizedConst i (False, 8) = integer i showSizedConst i (True, 8) = integer i showSizedConst i t@(False, 16) = text $ chex False True t i showSizedConst i t@(True, 16) = text $ chex False True t i showSizedConst i t@(False, 32) = text $ chex False True t i showSizedConst i t@(True, 32) = text $ chex False True t i showSizedConst i t@(False, 64) = text $ chex False True t i showSizedConst i t@(True, 64) = text $ chex False True t i showSizedConst i (True, 1) = die $ "Signed 1-bit value " ++ show i showSizedConst i (s, sz) = die $ "Constant " ++ show i ++ " at type " ++ (if s then "SInt" else "SWord") ++ show sz -- | Generate a makefile. The first argument is True if we have a driver. genMake :: Bool -> String -> String -> [String] -> Doc genMake ifdr fn dn ldFlags = foldr1 ($$) [l | (True, l) <- lns] where ifld = not (null ldFlags) ld | ifld = text "${LDFLAGS}" | True = empty lns = [ (True, text "# Makefile for" <+> nm P.<> text ". Automatically generated by SBV. Do not edit!") , (True, text "") , (True, text "# include any user-defined .mk file in the current directory.") , (True, text "-include *.mk") , (True, text "") , (True, text "CC?=gcc") , (True, text "CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer") , (ifld, text "LDFLAGS?=" P.<> text (unwords ldFlags)) , (True, text "") , (ifdr, text "all:" <+> nmd) , (ifdr, text "") , (True, nmo P.<> text (": " ++ ppSameLine (hsep [nmc, nmh]))) , (True, text "\t${CC} ${CCFLAGS}" <+> text "-c $< -o $@") , (True, text "") , (ifdr, nmdo P.<> text ":" <+> nmdc) , (ifdr, text "\t${CC} ${CCFLAGS}" <+> text "-c $< -o $@") , (ifdr, text "") , (ifdr, nmd P.<> text (": " ++ ppSameLine (hsep [nmo, nmdo]))) , (ifdr, text "\t${CC} ${CCFLAGS}" <+> text "$^ -o $@" <+> ld) , (ifdr, text "") , (True, text "clean:") , (True, text "\trm -f *.o") , (True, text "") , (ifdr, text "veryclean: clean") , (ifdr, text "\trm -f" <+> nmd) , (ifdr, text "") ] nm = text fn nmd = text dn nmh = nm P.<> text ".h" nmc = nm P.<> text ".c" nmo = nm P.<> text ".o" nmdc = nmd P.<> text ".c" nmdo = nmd P.<> text ".o" -- | Generate the header genHeader :: (Maybe Int, Maybe CgSRealType) -> String -> [Doc] -> Doc -> Doc genHeader (ik, rk) fn sigs protos = text "/* Header file for" <+> nm P.<> text ". Automatically generated by SBV. Do not edit! */" $$ text "" $$ text "#ifndef" <+> tag $$ text "#define" <+> tag $$ text "" $$ text "#include " $$ text "#include " $$ text "#include " $$ text "#include " $$ text "#include " $$ text "#include " $$ text "#include " $$ text "" $$ text "/* The boolean type */" $$ text "typedef bool SBool;" $$ text "" $$ text "/* The float type */" $$ text "typedef float SFloat;" $$ text "" $$ text "/* The double type */" $$ text "typedef double SDouble;" $$ text "" $$ text "/* Unsigned bit-vectors */" $$ text "typedef uint8_t SWord8;" $$ text "typedef uint16_t SWord16;" $$ text "typedef uint32_t SWord32;" $$ text "typedef uint64_t SWord64;" $$ text "" $$ text "/* Signed bit-vectors */" $$ text "typedef int8_t SInt8;" $$ text "typedef int16_t SInt16;" $$ text "typedef int32_t SInt32;" $$ text "typedef int64_t SInt64;" $$ text "" $$ imapping $$ rmapping $$ text ("/* Entry point prototype" ++ plu ++ ": */") $$ vcat (map (P.<> semi) sigs) $$ text "" $$ protos $$ text "#endif /*" <+> tag <+> text "*/" $$ text "" where nm = text fn tag = text "__" P.<> nm P.<> text "__HEADER_INCLUDED__" plu = if length sigs /= 1 then "s" else "" imapping = case ik of Nothing -> empty Just i -> text "/* User requested mapping for SInteger. */" $$ text "/* NB. Loss of precision: Target type is subject to modular arithmetic. */" $$ text ("typedef SInt" ++ show i ++ " SInteger;") $$ text "" rmapping = case rk of Nothing -> empty Just t -> text "/* User requested mapping for SReal. */" $$ text "/* NB. Loss of precision: Target type is subject to rounding. */" $$ text ("typedef " ++ show t ++ " SReal;") $$ text "" sepIf :: Bool -> Doc sepIf b = if b then text "" else empty -- | Generate an example driver program genDriver :: CgConfig -> [Integer] -> String -> [(String, CgVal)] -> [(String, CgVal)] -> Maybe SW -> [Doc] genDriver cfg randVals fn inps outs mbRet = [pre, header, body, post] where pre = text "/* Example driver program for" <+> nm P.<> text ". */" $$ text "/* Automatically generated by SBV. Edit as you see fit! */" $$ text "" $$ text "#include " header = text "#include" <+> doubleQuotes (nm P.<> text ".h") $$ text "" $$ text "int main(void)" $$ text "{" body = text "" $$ nest 2 ( vcat (map mkInp pairedInputs) $$ vcat (map mkOut outs) $$ sepIf (not (null [() | (_, _, CgArray{}) <- pairedInputs]) || not (null outs)) $$ call $$ text "" $$ (case mbRet of Just sw -> text "printf" P.<> parens (printQuotes (fcall <+> text "=" <+> specifier cfg sw P.<> text "\\n") P.<> comma <+> resultVar) P.<> semi Nothing -> text "printf" P.<> parens (printQuotes (fcall <+> text "->\\n")) P.<> semi) $$ vcat (map display outs) ) post = text "" $+$ nest 2 (text "return 0" P.<> semi) $$ text "}" $$ text "" nm = text fn pairedInputs = matchRands (map abs randVals) inps matchRands _ [] = [] matchRands [] _ = die "Run out of driver values!" matchRands (r:rs) ((n, CgAtomic sw) : cs) = ([mkRVal sw r], n, CgAtomic sw) : matchRands rs cs matchRands _ ((n, CgArray []) : _ ) = die $ "Unsupported empty array input " ++ show n matchRands rs ((n, a@(CgArray sws@(sw:_))) : cs) | length frs /= l = die "Run out of driver values!" | True = (map (mkRVal sw) frs, n, a) : matchRands srs cs where l = length sws (frs, srs) = splitAt l rs mkRVal sw r = mkConst cfg $ mkConstCW (kindOf sw) r mkInp (_, _, CgAtomic{}) = empty -- constant, no need to declare mkInp (_, n, CgArray []) = die $ "Unsupported empty array value for " ++ show n mkInp (vs, n, CgArray sws@(sw:_)) = pprCWord True sw <+> text n P.<> brackets (int (length sws)) <+> text "= {" $$ nest 4 (fsep (punctuate comma (align vs))) $$ text "};" $$ text "" $$ text "printf" P.<> parens (printQuotes (text "Contents of input array" <+> text n P.<> text ":\\n")) P.<> semi $$ display (n, CgArray sws) $$ text "" mkOut (v, CgAtomic sw) = pprCWord False sw <+> text v P.<> semi mkOut (v, CgArray []) = die $ "Unsupported empty array value for " ++ show v mkOut (v, CgArray sws@(sw:_)) = pprCWord False sw <+> text v P.<> brackets (int (length sws)) P.<> semi resultVar = text "__result" call = case mbRet of Nothing -> fcall P.<> semi Just sw -> pprCWord True sw <+> resultVar <+> text "=" <+> fcall P.<> semi fcall = nm P.<> parens (fsep (punctuate comma (map mkCVal pairedInputs ++ map mkOVal outs))) mkCVal ([v], _, CgAtomic{}) = v mkCVal (vs, n, CgAtomic{}) = die $ "Unexpected driver value computed for " ++ show n ++ render (hcat vs) mkCVal (_, n, CgArray{}) = text n mkOVal (n, CgAtomic{}) = text "&" P.<> text n mkOVal (n, CgArray{}) = text n display (n, CgAtomic sw) = text "printf" P.<> parens (printQuotes (text " " <+> text n <+> text "=" <+> specifier cfg sw P.<> text "\\n") P.<> comma <+> text n) P.<> semi display (n, CgArray []) = die $ "Unsupported empty array value for " ++ show n display (n, CgArray sws@(sw:_)) = text "int" <+> nctr P.<> semi $$ text "for(" P.<> nctr <+> text "= 0;" <+> nctr <+> text "<" <+> int (length sws) <+> text "; ++" P.<> nctr P.<> text ")" $$ nest 2 (text "printf" P.<> parens (printQuotes (text " " <+> entrySpec <+> text "=" <+> spec P.<> text "\\n") P.<> comma <+> nctr <+> comma P.<> entry) P.<> semi) where nctr = text n P.<> text "_ctr" entry = text n P.<> text "[" P.<> nctr P.<> text "]" entrySpec = text n P.<> text "[%d]" spec = specifier cfg sw -- | Generate the C program genCProg :: CgConfig -> String -> Doc -> Result -> [(String, CgVal)] -> [(String, CgVal)] -> Maybe SW -> Doc -> ([Doc], [String]) genCProg cfg fn proto (Result kindInfo _tvals _ovals cgs ins preConsts tbls arrs _uis _axioms (SBVPgm asgns) cstrs origAsserts _) inVars outVars mbRet extDecls | isNothing (cgInteger cfg) && KUnbounded `Set.member` kindInfo = error $ "SBV->C: Unbounded integers are not supported by the C compiler." ++ "\nUse 'cgIntegerSize' to specify a fixed size for SInteger representation." | KString `Set.member` kindInfo = error "SBV->C: Strings are currently not supported by the C compiler. Please get in touch if you'd like support for this feature!" | KChar `Set.member` kindInfo = error "SBV->C: Characters are currently not supported by the C compiler. Please get in touch if you'd like support for this feature!" | isNothing (cgReal cfg) && KReal `Set.member` kindInfo = error $ "SBV->C: SReal values are not supported by the C compiler." ++ "\nUse 'cgSRealType' to specify a custom type for SReal representation." | not (null usorts) = error $ "SBV->C: Cannot compile functions with uninterpreted sorts: " ++ intercalate ", " usorts | not (null cstrs) = tbd "Explicit constraints" | not (null arrs) = tbd "User specified arrays" | needsExistentials (map fst (fst ins)) = error "SBV->C: Cannot compile functions with existentially quantified variables." | True = ([pre, header, post], flagsNeeded) where asserts | cgIgnoreAsserts cfg = [] | True = origAsserts usorts = [s | KUserSort s _ <- Set.toList kindInfo, s /= "RoundingMode"] -- No support for any sorts other than RoundingMode! pre = text "/* File:" <+> doubleQuotes (nm P.<> text ".c") P.<> text ". Automatically generated by SBV. Do not edit! */" $$ text "" header = text "#include" <+> doubleQuotes (nm P.<> text ".h") post = text "" $$ vcat (map codeSeg cgs) $$ extDecls $$ proto $$ text "{" $$ text "" $$ nest 2 ( vcat (concatMap (genIO True . (\v -> (isAlive v, v))) inVars) $$ vcat (merge (map genTbl tbls) (map genAsgn assignments) (map genAssert asserts)) $$ sepIf (not (null assignments) || not (null tbls)) $$ vcat (concatMap (genIO False) (zip (repeat True) outVars)) $$ maybe empty mkRet mbRet ) $$ text "}" $$ text "" nm = text fn assignments = F.toList asgns -- Do we need any linker flags for C? flagsNeeded = nub $ concatMap (getLDFlag . opRes) assignments where opRes (sw, SBVApp o _) = (o, kindOf sw) codeSeg (fnm, ls) = text "/* User specified custom code for" <+> doubleQuotes (text fnm) <+> text "*/" $$ vcat (map text ls) $$ text "" typeWidth = getMax 0 $ [len (kindOf s) | (s, _) <- assignments] ++ [len (kindOf s) | (_, (s, _)) <- fst ins] where len KReal{} = 5 len KFloat{} = 6 -- SFloat len KDouble{} = 7 -- SDouble len KString{} = 7 -- SString len KChar{} = 5 -- SChar len KUnbounded{} = 8 len KBool = 5 -- SBool len (KBounded False n) = 5 + length (show n) -- SWordN len (KBounded True n) = 4 + length (show n) -- SIntN len (KList s) = die $ "List sort: " ++ show s len (KUserSort s _) = die $ "Uninterpreted sort: " ++ s getMax 8 _ = 8 -- 8 is the max we can get with SInteger, so don't bother looking any further getMax m [] = m getMax m (x:xs) = getMax (m `max` x) xs consts = (falseSW, falseCW) : (trueSW, trueCW) : preConsts isConst s = isJust (lookup s consts) -- TODO: The following is brittle. We should really have a function elsewhere -- that walks the SBVExprs and collects the SWs together. usedVariables = Set.unions (retSWs : map usedCgVal outVars ++ map usedAsgn assignments) where retSWs = maybe Set.empty Set.singleton mbRet usedCgVal (_, CgAtomic s) = Set.singleton s usedCgVal (_, CgArray ss) = Set.fromList ss usedAsgn (_, SBVApp o ss) = Set.union (opSWs o) (Set.fromList ss) opSWs (LkUp _ a b) = Set.fromList [a, b] opSWs (IEEEFP (FP_Cast _ _ s)) = Set.singleton s opSWs _ = Set.empty isAlive :: (String, CgVal) -> Bool isAlive (_, CgAtomic sw) = sw `Set.member` usedVariables isAlive (_, _) = True genIO :: Bool -> (Bool, (String, CgVal)) -> [Doc] genIO True (alive, (cNm, CgAtomic sw)) = [declSW typeWidth sw <+> text "=" <+> text cNm P.<> semi | alive] genIO False (alive, (cNm, CgAtomic sw)) = [text "*" P.<> text cNm <+> text "=" <+> showSW cfg consts sw P.<> semi | alive] genIO isInp (_, (cNm, CgArray sws)) = zipWith genElt sws [(0::Int)..] where genElt sw i | isInp = declSW typeWidth sw <+> text "=" <+> text entry P.<> semi | True = text entry <+> text "=" <+> showSW cfg consts sw P.<> semi where entry = cNm ++ "[" ++ show i ++ "]" mkRet sw = text "return" <+> showSW cfg consts sw P.<> semi genTbl :: ((Int, Kind, Kind), [SW]) -> (Int, Doc) genTbl ((i, _, k), elts) = (location, static <+> text "const" <+> text (show k) <+> text ("table" ++ show i) P.<> text "[] = {" $$ nest 4 (fsep (punctuate comma (align (map (showSW cfg consts) elts)))) $$ text "};") where static = if location == -1 then text "static" else empty location = maximum (-1 : map getNodeId elts) getNodeId s@(SW _ (NodeId n)) | isConst s = -1 | True = n genAsgn :: (SW, SBVExpr) -> (Int, Doc) genAsgn (sw, n) = (getNodeId sw, ppExpr cfg consts n (declSW typeWidth sw) (declSWNoConst typeWidth sw) P.<> semi) -- merge tables intermixed with assignments and assertions, paying attention to putting tables as -- early as possible and tables right after.. Note that the assignment list (second argument) is sorted on its order merge :: [(Int, Doc)] -> [(Int, Doc)] -> [(Int, Doc)] -> [Doc] merge tables asgnments asrts = map snd $ merge2 asrts (merge2 tables asgnments) where merge2 [] as = as merge2 ts [] = ts merge2 ts@((i, t):trest) as@((i', a):arest) | i < i' = (i, t) : merge2 trest as | True = (i', a) : merge2 ts arest genAssert (msg, cs, sw) = (getNodeId sw, doc) where doc = text "/* ASSERTION:" <+> text msg $$ maybe empty (vcat . map text) (locInfo (getCallStack `fmap` cs)) $$ text " */" $$ text "if" P.<> parens (showSW cfg consts sw) $$ text "{" $+$ nest 2 (vcat [errOut, text "exit(-1);"]) $$ text "}" $$ text "" errOut = text $ "fprintf(stderr, \"%s:%d:ASSERTION FAILED: " ++ msg ++ "\\n\", __FILE__, __LINE__);" locInfo (Just ps) = let loc (f, sl) = concat [srcLocFile sl, ":", show (srcLocStartLine sl), ":", show (srcLocStartCol sl), ":", f ] in case map loc ps of [] -> Nothing (f:rs) -> Just $ (" * SOURCE : " ++ f) : map (" * " ++) rs locInfo _ = Nothing handlePB :: PBOp -> [Doc] -> Doc handlePB o args = case o of PB_AtMost k -> addIf (repeat 1) <+> text "<=" <+> int k PB_AtLeast k -> addIf (repeat 1) <+> text ">=" <+> int k PB_Exactly k -> addIf (repeat 1) <+> text "==" <+> int k PB_Le cs k -> addIf cs <+> text "<=" <+> int k PB_Ge cs k -> addIf cs <+> text ">=" <+> int k PB_Eq cs k -> addIf cs <+> text "==" <+> int k where addIf :: [Int] -> Doc addIf cs = parens $ fsep $ intersperse (text "+") [parens (a <+> text "?" <+> int c <+> text ":" <+> int 0) | (a, c) <- zip args cs] handleIEEE :: FPOp -> [(SW, CW)] -> [(SW, Doc)] -> Doc -> Doc handleIEEE w consts as var = cvt w where same f = (f, f) named fnm dnm f = (f fnm, f dnm) castToUnsigned f to = parens (text "!isnan" P.<> parens a <+> text "&&" <+> text "signbit" P.<> parens a) <+> text "?" <+> cvt1 <+> text ":" <+> cvt2 where [a] = map snd fpArgs absA = text (if f == KFloat then "fabsf" else "fabs") P.<> parens a cvt1 = parens (text "-" <+> parens (parens (text (show to)) <+> absA)) cvt2 = parens (parens (text (show to)) <+> a) cvt (FP_Cast f to m) = case checkRM (m `lookup` consts) of Nothing -> if f `elem` [KFloat, KDouble] && not (hasSign to) then castToUnsigned f to else cast $ \[a] -> parens (text (show to)) <+> a Just (Left msg) -> die msg Just (Right msg) -> tbd msg cvt (FP_Reinterpret f t) = case (f, t) of (KBounded False 32, KFloat) -> cast $ cpy "sizeof(SFloat)" (KBounded False 64, KDouble) -> cast $ cpy "sizeof(SDouble)" (KFloat, KBounded False 32) -> cast $ cpy "sizeof(SWord32)" (KDouble, KBounded False 64) -> cast $ cpy "sizeof(SWord64)" _ -> die $ "Reinterpretation from : " ++ show f ++ " to " ++ show t where cpy sz = \[a] -> let alhs = text "&" P.<> var arhs = text "&" P.<> a in text "memcpy" P.<> parens (fsep (punctuate comma [alhs, arhs, text sz])) cvt FP_Abs = dispatch $ named "fabsf" "fabs" $ \nm _ [a] -> text nm P.<> parens a cvt FP_Neg = dispatch $ same $ \_ [a] -> text "-" P.<> a cvt FP_Add = dispatch $ same $ \_ [a, b] -> a <+> text "+" <+> b cvt FP_Sub = dispatch $ same $ \_ [a, b] -> a <+> text "-" <+> b cvt FP_Mul = dispatch $ same $ \_ [a, b] -> a <+> text "*" <+> b cvt FP_Div = dispatch $ same $ \_ [a, b] -> a <+> text "/" <+> b cvt FP_FMA = dispatch $ named "fmaf" "fma" $ \nm _ [a, b, c] -> text nm P.<> parens (fsep (punctuate comma [a, b, c])) cvt FP_Sqrt = dispatch $ named "sqrtf" "sqrt" $ \nm _ [a] -> text nm P.<> parens a cvt FP_Rem = dispatch $ named "fmodf" "fmod" $ \nm _ [a, b] -> text nm P.<> parens (fsep (punctuate comma [a, b])) cvt FP_RoundToIntegral = dispatch $ named "rintf" "rint" $ \nm _ [a] -> text nm P.<> parens a cvt FP_Min = dispatch $ named "fminf" "fmin" $ \nm k [a, b] -> wrapMinMax k a b (text nm P.<> parens (fsep (punctuate comma [a, b]))) cvt FP_Max = dispatch $ named "fmaxf" "fmax" $ \nm k [a, b] -> wrapMinMax k a b (text nm P.<> parens (fsep (punctuate comma [a, b]))) cvt FP_ObjEqual = let mkIte x y z = x <+> text "?" <+> y <+> text ":" <+> z chkNaN x = text "isnan" P.<> parens x signbit x = text "signbit" P.<> parens x eq x y = parens (x <+> text "==" <+> y) eqZero x = eq x (text "0") negZero x = parens (signbit x <+> text "&&" <+> eqZero x) in dispatch $ same $ \_ [a, b] -> mkIte (chkNaN a) (chkNaN b) (mkIte (negZero a) (negZero b) (mkIte (negZero b) (negZero a) (eq a b))) cvt FP_IsNormal = dispatch $ same $ \_ [a] -> text "isnormal" P.<> parens a cvt FP_IsSubnormal = dispatch $ same $ \_ [a] -> text "FP_SUBNORMAL == fpclassify" P.<> parens a cvt FP_IsZero = dispatch $ same $ \_ [a] -> text "FP_ZERO == fpclassify" P.<> parens a cvt FP_IsInfinite = dispatch $ same $ \_ [a] -> text "isinf" P.<> parens a cvt FP_IsNaN = dispatch $ same $ \_ [a] -> text "isnan" P.<> parens a cvt FP_IsNegative = dispatch $ same $ \_ [a] -> text "!isnan" P.<> parens a <+> text "&&" <+> text "signbit" P.<> parens a cvt FP_IsPositive = dispatch $ same $ \_ [a] -> text "!isnan" P.<> parens a <+> text "&&" <+> text "!signbit" P.<> parens a -- grab the rounding-mode, if present, and make sure it's RoundNearestTiesToEven. Otherwise skip. fpArgs = case as of [] -> [] ((m, _):args) -> case kindOf m of KUserSort "RoundingMode" _ -> case checkRM (m `lookup` consts) of Nothing -> args Just (Left msg) -> die msg Just (Right msg) -> tbd msg _ -> as -- Check that the RM is RoundNearestTiesToEven. -- If we start supporting other rounding-modes, this would be the point where we'd insert the rounding-mode set/reset code -- instead of merely returning OK or not checkRM (Just cv@(CW (KUserSort "RoundingMode" _) v)) = case v of CWUserSort (_, "RoundNearestTiesToEven") -> Nothing CWUserSort (_, s) -> Just (Right $ "handleIEEE: Unsupported rounding-mode: " ++ show s ++ " for: " ++ show w) _ -> Just (Left $ "handleIEEE: Unexpected value for rounding-mode: " ++ show cv ++ " for: " ++ show w) checkRM (Just cv) = Just (Left $ "handleIEEE: Expected rounding-mode, but got: " ++ show cv ++ " for: " ++ show w) checkRM Nothing = Just (Right $ "handleIEEE: Non-constant rounding-mode for: " ++ show w) pickOp _ [] = die $ "Cannot determine float/double kind for op: " ++ show w pickOp (fOp, dOp) args@((a,_):_) = case kindOf a of KFloat -> fOp KFloat (map snd args) KDouble -> dOp KDouble (map snd args) k -> die $ "handleIEEE: Expected double/float args, but got: " ++ show k ++ " for: " ++ show w dispatch (fOp, dOp) = pickOp (fOp, dOp) fpArgs cast f = f (map snd fpArgs) -- In SMT-Lib, fpMin/fpMax is underspecified when given +0/-0 as the two arguments. (In any order.) -- In C, the second argument is returned. (I think, might depend on the architecture, optimizations etc.). -- We'll translate it so that we deterministically return +0. -- There's really no good choice here. wrapMinMax k a b s = parens cond <+> text "?" <+> zero <+> text ":" <+> s where zero = text $ if k == KFloat then showCFloat 0 else showCDouble 0 cond = parens (text "FP_ZERO == fpclassify" P.<> parens a) -- a is zero <+> text "&&" <+> parens (text "FP_ZERO == fpclassify" P.<> parens b) -- b is zero <+> text "&&" <+> parens (text "signbit" P.<> parens a <+> text "!=" <+> text "signbit" P.<> parens b) -- a and b differ in sign ppExpr :: CgConfig -> [(SW, CW)] -> SBVExpr -> Doc -> (Doc, Doc) -> Doc ppExpr cfg consts (SBVApp op opArgs) lhs (typ, var) | doNotAssign op = typ <+> var P.<> semi <+> rhs | True = lhs <+> text "=" <+> rhs where doNotAssign (IEEEFP FP_Reinterpret{}) = True -- generates a memcpy instead; no simple assignment doNotAssign _ = False -- generates simple assignment rhs = p op (map (showSW cfg consts) opArgs) rtc = cgRTC cfg cBinOps = [ (Plus, "+"), (Times, "*"), (Minus, "-") , (Equal, "=="), (NotEqual, "!="), (LessThan, "<"), (GreaterThan, ">"), (LessEq, "<="), (GreaterEq, ">=") , (And, "&"), (Or, "|"), (XOr, "^") ] -- see if we can find a constant shift; makes the output way more readable getShiftAmnt def [_, sw] = case sw `lookup` consts of Just (CW _ (CWInteger i)) -> integer i _ -> def getShiftAmnt def _ = def p :: Op -> [Doc] -> Doc p (ArrRead _) _ = tbd "User specified arrays (ArrRead)" p (ArrEq _ _) _ = tbd "User specified arrays (ArrEq)" p (Label s) [a] = a <+> text "/*" <+> text s <+> text "*/" p (IEEEFP w) as = handleIEEE w consts (zip opArgs as) var p (PseudoBoolean pb) as = handlePB pb as p (OverflowOp o) _ = tbd $ "Overflow operations" ++ show o p (KindCast _ to) [a] = parens (text (show to)) <+> a p (Uninterpreted s) [] = text "/* Uninterpreted constant */" <+> text s p (Uninterpreted s) as = text "/* Uninterpreted function */" <+> text s P.<> parens (fsep (punctuate comma as)) p (Extract i j) [a] = extract i j (head opArgs) a p Join [a, b] = join (let (s1 : s2 : _) = opArgs in (s1, s2, a, b)) p (Rol i) [a] = rotate True i a (head opArgs) p (Ror i) [a] = rotate False i a (head opArgs) p Shl [a, i] = shift True (getShiftAmnt i opArgs) a -- The order of i/a being reversed here is p Shr [a, i] = shift False (getShiftAmnt i opArgs) a -- intentional and historical (from the days when Shl/Shr had a constant parameter.) p Not [a] = case kindOf (head opArgs) of -- be careful about booleans, bitwise complement is not correct for them! KBool -> text "!" P.<> a _ -> text "~" P.<> a p Ite [a, b, c] = a <+> text "?" <+> b <+> text ":" <+> c p (LkUp (t, k, _, len) ind def) [] | not rtc = lkUp -- ignore run-time-checks per user request | needsCheckL && needsCheckR = cndLkUp checkBoth | needsCheckL = cndLkUp checkLeft | needsCheckR = cndLkUp checkRight | True = lkUp where [index, defVal] = map (showSW cfg consts) [ind, def] lkUp = text "table" P.<> int t P.<> brackets (showSW cfg consts ind) cndLkUp cnd = cnd <+> text "?" <+> defVal <+> text ":" <+> lkUp checkLeft = index <+> text "< 0" checkRight = index <+> text ">=" <+> int len checkBoth = parens (checkLeft <+> text "||" <+> checkRight) canOverflow True sz = (2::Integer)^(sz-1)-1 >= fromIntegral len canOverflow False sz = (2::Integer)^sz -1 >= fromIntegral len (needsCheckL, needsCheckR) = case k of KBool -> (False, canOverflow False (1::Int)) KBounded sg sz -> (sg, canOverflow sg sz) KReal -> die "array index with real value" KFloat -> die "array index with float value" KDouble -> die "array index with double value" KString -> die "array index with string value" KChar -> die "array index with character value" KUnbounded -> case cgInteger cfg of Nothing -> (True, True) -- won't matter, it'll be rejected later Just i -> (True, canOverflow True i) KList s -> die $ "List sort " ++ show s KUserSort s _ -> die $ "Uninterpreted sort: " ++ s -- Div/Rem should be careful on 0, in the SBV world x `div` 0 is 0, x `rem` 0 is x -- NB: Quot is supposed to truncate toward 0; Not clear to me if C guarantees this behavior. -- Brief googling suggests C99 does indeed truncate toward 0, but other C compilers might differ. p Quot [a, b] = let k = kindOf (head opArgs) z = mkConst cfg $ mkConstCW k (0::Integer) in protectDiv0 k "/" z a b p Rem [a, b] = protectDiv0 (kindOf (head opArgs)) "%" a a b p UNeg [a] = parens (text "-" <+> a) p Abs [a] = let f KFloat = text "fabsf" P.<> parens a f KDouble = text "fabs" P.<> parens a f (KBounded False _) = text "/* unsigned, skipping call to abs */" <+> a f (KBounded True 32) = text "labs" P.<> parens a f (KBounded True 64) = text "llabs" P.<> parens a f KUnbounded = case cgInteger cfg of Nothing -> f $ KBounded True 32 -- won't matter, it'll be rejected later Just i -> f $ KBounded True i f KReal = case cgReal cfg of Nothing -> f KDouble -- won't matter, it'll be rejected later Just CgFloat -> f KFloat Just CgDouble -> f KDouble Just CgLongDouble -> text "fabsl" P.<> parens a f _ = text "abs" P.<> parens a in f (kindOf (head opArgs)) -- for And/Or, translate to boolean versions if on boolean kind p And [a, b] | kindOf (head opArgs) == KBool = a <+> text "&&" <+> b p Or [a, b] | kindOf (head opArgs) == KBool = a <+> text "||" <+> b p o [a, b] | Just co <- lookup o cBinOps = a <+> text co <+> b p NotEqual xs = mkDistinct xs p o args = die $ "Received operator " ++ show o ++ " applied to " ++ show args -- generate a pairwise inequality check mkDistinct args = fsep $ andAll $ walk args where walk [] = [] walk (e:es) = map (pair e) es ++ walk es pair e1 e2 = parens (e1 <+> text "!=" <+> e2) -- like punctuate, but more spacing andAll [] = [] andAll (d:ds) = go d ds where go d' [] = [d'] go d' (e:es) = (d' <+> text "&&") : go e es -- Div0 needs to protect, but only when the arguments are not float/double. (Div by 0 for those are well defined to be Inf/NaN etc.) protectDiv0 k divOp def a b = case k of KFloat -> res KDouble -> res _ -> wrap where res = a <+> text divOp <+> b wrap = parens (b <+> text "== 0") <+> text "?" <+> def <+> text ":" <+> parens res shift toLeft i a = a <+> text cop <+> i where cop | toLeft = "<<" | True = ">>" rotate toLeft i a s | i < 0 = rotate (not toLeft) (-i) a s | i == 0 = a | True = case kindOf s of KBounded True _ -> tbd $ "Rotation of signed quantities: " ++ show (toLeft, i, s) KBounded False sz | i >= sz -> rotate toLeft (i `mod` sz) a s KBounded False sz -> parens (a <+> text cop <+> int i) <+> text "|" <+> parens (a <+> text cop' <+> int (sz - i)) KUnbounded -> shift toLeft (int i) a -- For SInteger, rotate is the same as shift in Haskell _ -> tbd $ "Rotation for unbounded quantity: " ++ show (toLeft, i, s) where (cop, cop') | toLeft = ("<<", ">>") | True = (">>", "<<") -- TBD: below we only support the values for extract that are "easy" to implement. These should cover -- almost all instances actually generated by SBV, however. extract hi lo i a -- Isolate the bit-extraction case | hi == lo, KBounded _ sz <- kindOf i, hi < sz, hi >= 0 = if hi == 0 then text "(SBool)" <+> parens (a <+> text "& 1") else text "(SBool)" <+> parens (parens (a <+> text ">>" <+> int hi) <+> text "& 1") extract hi lo i a = case (hi, lo, kindOf i) of (63, 32, KBounded False 64) -> text "(SWord32)" <+> parens (a <+> text ">> 32") (31, 0, KBounded False 64) -> text "(SWord32)" <+> a (31, 16, KBounded False 32) -> text "(SWord16)" <+> parens (a <+> text ">> 16") (15, 0, KBounded False 32) -> text "(SWord16)" <+> a (15, 8, KBounded False 16) -> text "(SWord8)" <+> parens (a <+> text ">> 8") ( 7, 0, KBounded False 16) -> text "(SWord8)" <+> a (63, 0, KBounded False 64) -> text "(SInt64)" <+> a (63, 0, KBounded True 64) -> text "(SWord64)" <+> a (31, 0, KBounded False 32) -> text "(SInt32)" <+> a (31, 0, KBounded True 32) -> text "(SWord32)" <+> a (15, 0, KBounded False 16) -> text "(SInt16)" <+> a (15, 0, KBounded True 16) -> text "(SWord16)" <+> a ( 7, 0, KBounded False 8) -> text "(SInt8)" <+> a ( 7, 0, KBounded True 8) -> text "(SWord8)" <+> a ( _, _, k ) -> tbd $ "extract with " ++ show (hi, lo, k, i) -- TBD: ditto here for join, just like extract above join (i, j, a, b) = case (kindOf i, kindOf j) of (KBounded False 8, KBounded False 8) -> parens (parens (text "(SWord16)" <+> a) <+> text "<< 8") <+> text "|" <+> parens (text "(SWord16)" <+> b) (KBounded False 16, KBounded False 16) -> parens (parens (text "(SWord32)" <+> a) <+> text "<< 16") <+> text "|" <+> parens (text "(SWord32)" <+> b) (KBounded False 32, KBounded False 32) -> parens (parens (text "(SWord64)" <+> a) <+> text "<< 32") <+> text "|" <+> parens (text "(SWord64)" <+> b) (k1, k2) -> tbd $ "join with " ++ show ((k1, i), (k2, j)) -- same as doubleQuotes, except we have to make sure there are no line breaks.. -- Otherwise breaks the generated code.. sigh printQuotes :: Doc -> Doc printQuotes d = text $ '"' : ppSameLine d ++ "\"" -- Remove newlines.. Useful when generating Makefile and such ppSameLine :: Doc -> String ppSameLine = trim . render where trim "" = "" trim ('\n':cs) = ' ' : trim (dropWhile isSpace cs) trim (c:cs) = c : trim cs -- Align a bunch of docs to occupy the exact same length by padding in the left by space -- this is ugly and inefficient, but easy to code.. align :: [Doc] -> [Doc] align ds = map (text . pad) ss where ss = map render ds l = maximum (0 : map length ss) pad s = replicate (l - length s) ' ' ++ s -- | Merge a bunch of bundles to generate code for a library. For the final -- config, we simply return the first config we receive, or the default if none. mergeToLib :: String -> [(CgConfig, CgPgmBundle)] -> (CgConfig, CgPgmBundle) mergeToLib libName cfgBundles | length nubKinds /= 1 = error $ "Cannot merge programs with differing SInteger/SReal mappings. Received the following kinds:\n" ++ unlines (map show nubKinds) | True = (finalCfg, CgPgmBundle bundleKind $ sources ++ libHeader : [libDriver | anyDriver] ++ [libMake | anyMake]) where bundles = map snd cfgBundles kinds = [k | CgPgmBundle k _ <- bundles] nubKinds = nub kinds bundleKind = head nubKinds files = concat [fs | CgPgmBundle _ fs <- bundles] sigs = concat [ss | (_, (CgHeader ss, _)) <- files] anyMake = not (null [() | (_, (CgMakefile{}, _)) <- files]) drivers = [ds | (_, (CgDriver, ds)) <- files] anyDriver = not (null drivers) mkFlags = nub (concat [xs | (_, (CgMakefile xs, _)) <- files]) sources = [(f, (CgSource, [pre, libHInclude, post])) | (f, (CgSource, [pre, _, post])) <- files] sourceNms = map fst sources libHeader = (libName ++ ".h", (CgHeader sigs, [genHeader bundleKind libName sigs empty])) libHInclude = text "#include" <+> text (show (libName ++ ".h")) libMake = ("Makefile", (CgMakefile mkFlags, [genLibMake anyDriver libName sourceNms mkFlags])) libDriver = (libName ++ "_driver.c", (CgDriver, mergeDrivers libName libHInclude (zip (map takeBaseName sourceNms) drivers))) finalCfg = case cfgBundles of [] -> defaultCgConfig ((c, _):_) -> c -- | Create a Makefile for the library genLibMake :: Bool -> String -> [String] -> [String] -> Doc genLibMake ifdr libName fs ldFlags = foldr1 ($$) [l | (True, l) <- lns] where ifld = not (null ldFlags) ld | ifld = text "${LDFLAGS}" | True = empty lns = [ (True, text "# Makefile for" <+> nm P.<> text ". Automatically generated by SBV. Do not edit!") , (True, text "") , (True, text "# include any user-defined .mk file in the current directory.") , (True, text "-include *.mk") , (True, text "") , (True, text "CC?=gcc") , (True, text "CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer") , (ifld, text "LDFLAGS?=" P.<> text (unwords ldFlags)) , (True, text "AR?=ar") , (True, text "ARFLAGS?=cr") , (True, text "") , (not ifdr, text ("all: " ++ liba)) , (ifdr, text ("all: " ++ unwords [liba, libd])) , (True, text "") , (True, text liba P.<> text (": " ++ unwords os)) , (True, text "\t${AR} ${ARFLAGS} $@ $^") , (True, text "") , (ifdr, text libd P.<> text (": " ++ unwords [libd ++ ".c", libh])) , (ifdr, text ("\t${CC} ${CCFLAGS} $< -o $@ " ++ liba) <+> ld) , (ifdr, text "") , (True, vcat (zipWith mkObj os fs)) , (True, text "clean:") , (True, text "\trm -f *.o") , (True, text "") , (True, text "veryclean: clean") , (not ifdr, text "\trm -f" <+> text liba) , (ifdr, text "\trm -f" <+> text (unwords [liba, libd])) , (True, text "") ] nm = text libName liba = libName ++ ".a" libh = libName ++ ".h" libd = libName ++ "_driver" os = map (`replaceExtension` ".o") fs mkObj o f = text o P.<> text (": " ++ unwords [f, libh]) $$ text "\t${CC} ${CCFLAGS} -c $< -o $@" $$ text "" -- | Create a driver for a library mergeDrivers :: String -> Doc -> [(FilePath, [Doc])] -> [Doc] mergeDrivers libName inc ds = pre : concatMap mkDFun ds ++ [callDrivers (map fst ds)] where pre = text "/* Example driver program for" <+> text libName P.<> text ". */" $$ text "/* Automatically generated by SBV. Edit as you see fit! */" $$ text "" $$ text "#include " $$ inc mkDFun (f, [_pre, _header, body, _post]) = [header, body, post] where header = text "" $$ text ("void " ++ f ++ "_driver(void)") $$ text "{" post = text "}" mkDFun (f, _) = die $ "mergeDrivers: non-conforming driver program for " ++ show f callDrivers fs = text "" $$ text "int main(void)" $$ text "{" $+$ nest 2 (vcat (map call fs)) $$ nest 2 (text "return 0;") $$ text "}" call f = text psep $$ text ptag $$ text psep $$ text (f ++ "_driver();") $$ text "" where tag = "** Driver run for " ++ f ++ ":" ptag = "printf(\"" ++ tag ++ "\\n\");" lsep = replicate (length tag) '=' psep = "printf(\"" ++ lsep ++ "\\n\");" -- Does this operation with this result kind require an LD flag? getLDFlag :: (Op, Kind) -> [String] getLDFlag (o, k) = flag o where math = ["-lm"] flag (IEEEFP FP_Cast{}) = math flag (IEEEFP fop) | fop `elem` requiresMath = math flag Abs | k `elem` [KFloat, KDouble, KReal] = math flag _ = [] requiresMath = [ FP_Abs , FP_FMA , FP_Sqrt , FP_Rem , FP_Min , FP_Max , FP_RoundToIntegral , FP_ObjEqual , FP_IsSubnormal , FP_IsInfinite , FP_IsNaN , FP_IsNegative , FP_IsPositive , FP_IsNormal , FP_IsZero ] {-# ANN module ("HLint: ignore Redundant lambda" :: String) #-} sbv-7.13/Data/SBV/Compilers/CodeGen.hs0000644000000000000000000004340713405536617015546 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Compilers.CodeGen -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Code generation utilities ----------------------------------------------------------------------------- {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} module Data.SBV.Compilers.CodeGen ( -- * The codegen monad SBVCodeGen(..), cgSym -- * Specifying inputs, SBV variants , cgInput, cgInputArr , cgOutput, cgOutputArr , cgReturn, cgReturnArr -- * Specifying inputs, SVal variants , svCgInput, svCgInputArr , svCgOutput, svCgOutputArr , svCgReturn, svCgReturnArr -- * Settings , cgPerformRTCs, cgSetDriverValues , cgAddPrototype, cgAddDecl, cgAddLDFlags, cgIgnoreSAssert, cgOverwriteFiles , cgIntegerSize, cgSRealType, CgSRealType(..) -- * Infrastructure , CgTarget(..), CgConfig(..), CgState(..), CgPgmBundle(..), CgPgmKind(..), CgVal(..) , defaultCgConfig, initCgState, isCgDriver, isCgMakefile -- * Generating collateral , cgGenerateDriver, cgGenerateMakefile, codeGen, renderCgPgmBundle ) where import Control.Monad (filterM, replicateM, unless) import Control.Monad.Reader (ask) import Control.Monad.Trans (MonadIO, lift, liftIO) import Control.Monad.State.Lazy (MonadState, StateT(..), modify') import Data.Char (toLower, isSpace) import Data.List (nub, isPrefixOf, intercalate, (\\)) import System.Directory (createDirectoryIfMissing, doesDirectoryExist, doesFileExist) import System.FilePath (()) import System.IO (hFlush, stdout) import Text.PrettyPrint.HughesPJ (Doc, vcat) import qualified Text.PrettyPrint.HughesPJ as P (render) import Data.SBV.Core.Data import Data.SBV.Core.Symbolic (svToSymSW, svMkSymVar, outputSVal) #if MIN_VERSION_base(4,11,0) import Control.Monad.Fail as Fail #endif -- | Abstract over code generation for different languages class CgTarget a where targetName :: a -> String translate :: a -> CgConfig -> String -> CgState -> Result -> CgPgmBundle -- | Options for code-generation. data CgConfig = CgConfig { cgRTC :: Bool -- ^ If 'True', perform run-time-checks for index-out-of-bounds or shifting-by-large values etc. , cgInteger :: Maybe Int -- ^ Bit-size to use for representing SInteger (if any) , cgReal :: Maybe CgSRealType -- ^ Type to use for representing SReal (if any) , cgDriverVals :: [Integer] -- ^ Values to use for the driver program generated, useful for generating non-random drivers. , cgGenDriver :: Bool -- ^ If 'True', will generate a driver program , cgGenMakefile :: Bool -- ^ If 'True', will generate a makefile , cgIgnoreAsserts :: Bool -- ^ If 'True', will ignore 'Data.SBV.sAssert' calls , cgOverwriteGenerated :: Bool -- ^ If 'True', will overwrite the generated files without prompting. } -- | Default options for code generation. The run-time checks are turned-off, and the driver values are completely random. defaultCgConfig :: CgConfig defaultCgConfig = CgConfig { cgRTC = False , cgInteger = Nothing , cgReal = Nothing , cgDriverVals = [] , cgGenDriver = True , cgGenMakefile = True , cgIgnoreAsserts = False , cgOverwriteGenerated = False } -- | Abstraction of target language values data CgVal = CgAtomic SW | CgArray [SW] -- | Code-generation state data CgState = CgState { cgInputs :: [(String, CgVal)] , cgOutputs :: [(String, CgVal)] , cgReturns :: [CgVal] , cgPrototypes :: [String] -- extra stuff that goes into the header , cgDecls :: [String] -- extra stuff that goes into the top of the file , cgLDFlags :: [String] -- extra options that go to the linker , cgFinalConfig :: CgConfig } -- | Initial configuration for code-generation initCgState :: CgState initCgState = CgState { cgInputs = [] , cgOutputs = [] , cgReturns = [] , cgPrototypes = [] , cgDecls = [] , cgLDFlags = [] , cgFinalConfig = defaultCgConfig } -- | The code-generation monad. Allows for precise layout of input values -- reference parameters (for returning composite values in languages such as C), -- and return values. newtype SBVCodeGen a = SBVCodeGen (StateT CgState Symbolic a) deriving ( Applicative, Functor, Monad, MonadIO, MonadState CgState #if MIN_VERSION_base(4,11,0) , Fail.MonadFail #endif ) -- | Reach into symbolic monad from code-generation cgSym :: Symbolic a -> SBVCodeGen a cgSym = SBVCodeGen . lift -- | Reach into symbolic monad and output a value. Returns the corresponding SW cgSBVToSW :: SBV a -> SBVCodeGen SW cgSBVToSW = cgSym . sbvToSymSW -- | Sets RTC (run-time-checks) for index-out-of-bounds, shift-with-large value etc. on/off. Default: 'False'. cgPerformRTCs :: Bool -> SBVCodeGen () cgPerformRTCs b = modify' (\s -> s { cgFinalConfig = (cgFinalConfig s) { cgRTC = b } }) -- | Sets number of bits to be used for representing the 'SInteger' type in the generated C code. -- The argument must be one of @8@, @16@, @32@, or @64@. Note that this is essentially unsafe as -- the semantics of unbounded Haskell integers becomes reduced to the corresponding bit size, as -- typical in most C implementations. cgIntegerSize :: Int -> SBVCodeGen () cgIntegerSize i | i `notElem` [8, 16, 32, 64] = error $ "SBV.cgIntegerSize: Argument must be one of 8, 16, 32, or 64. Received: " ++ show i | True = modify' (\s -> s { cgFinalConfig = (cgFinalConfig s) { cgInteger = Just i }}) -- | Possible mappings for the 'SReal' type when translated to C. Used in conjunction -- with the function 'cgSRealType'. Note that the particular characteristics of the -- mapped types depend on the platform and the compiler used for compiling the generated -- C program. See for details. data CgSRealType = CgFloat -- ^ @float@ | CgDouble -- ^ @double@ | CgLongDouble -- ^ @long double@ deriving Eq -- 'Show' instance for 'cgSRealType' displays values as they would be used in a C program instance Show CgSRealType where show CgFloat = "float" show CgDouble = "double" show CgLongDouble = "long double" -- | Sets the C type to be used for representing the 'SReal' type in the generated C code. -- The setting can be one of C's @"float"@, @"double"@, or @"long double"@, types, depending -- on the precision needed. Note that this is essentially unsafe as the semantics of -- infinite precision SReal values becomes reduced to the corresponding floating point type in -- C, and hence it is subject to rounding errors. cgSRealType :: CgSRealType -> SBVCodeGen () cgSRealType rt = modify' (\s -> s {cgFinalConfig = (cgFinalConfig s) { cgReal = Just rt }}) -- | Should we generate a driver program? Default: 'True'. When a library is generated, it will have -- a driver if any of the contituent functions has a driver. (See 'Data.SBV.Tools.CodeGen.compileToCLib'.) cgGenerateDriver :: Bool -> SBVCodeGen () cgGenerateDriver b = modify' (\s -> s { cgFinalConfig = (cgFinalConfig s) { cgGenDriver = b } }) -- | Should we generate a Makefile? Default: 'True'. cgGenerateMakefile :: Bool -> SBVCodeGen () cgGenerateMakefile b = modify' (\s -> s { cgFinalConfig = (cgFinalConfig s) { cgGenMakefile = b } }) -- | Sets driver program run time values, useful for generating programs with fixed drivers for testing. Default: None, i.e., use random values. cgSetDriverValues :: [Integer] -> SBVCodeGen () cgSetDriverValues vs = modify' (\s -> s { cgFinalConfig = (cgFinalConfig s) { cgDriverVals = vs } }) -- | Ignore assertions (those generated by 'Data.SBV.sAssert' calls) in the generated C code cgIgnoreSAssert :: Bool -> SBVCodeGen () cgIgnoreSAssert b = modify' (\s -> s { cgFinalConfig = (cgFinalConfig s) { cgIgnoreAsserts = b } }) -- | Adds the given lines to the header file generated, useful for generating programs with uninterpreted functions. cgAddPrototype :: [String] -> SBVCodeGen () cgAddPrototype ss = modify' (\s -> let old = cgPrototypes s new = if null old then ss else old ++ [""] ++ ss in s { cgPrototypes = new }) -- | If passed 'True', then we will not ask the user if we're overwriting files as we generate -- the C code. Otherwise, we'll prompt. cgOverwriteFiles :: Bool -> SBVCodeGen () cgOverwriteFiles b = modify' (\s -> s { cgFinalConfig = (cgFinalConfig s) { cgOverwriteGenerated = b } }) -- | Adds the given lines to the program file generated, useful for generating programs with uninterpreted functions. cgAddDecl :: [String] -> SBVCodeGen () cgAddDecl ss = modify' (\s -> s { cgDecls = cgDecls s ++ ss }) -- | Adds the given words to the compiler options in the generated Makefile, useful for linking extra stuff in. cgAddLDFlags :: [String] -> SBVCodeGen () cgAddLDFlags ss = modify' (\s -> s { cgLDFlags = cgLDFlags s ++ ss }) -- | Creates an atomic input in the generated code. svCgInput :: Kind -> String -> SBVCodeGen SVal svCgInput k nm = do r <- cgSym (ask >>= liftIO . svMkSymVar (Just ALL) k Nothing) sw <- cgSym (svToSymSW r) modify' (\s -> s { cgInputs = (nm, CgAtomic sw) : cgInputs s }) return r -- | Creates an array input in the generated code. svCgInputArr :: Kind -> Int -> String -> SBVCodeGen [SVal] svCgInputArr k sz nm | sz < 1 = error $ "SBV.cgInputArr: Array inputs must have at least one element, given " ++ show sz ++ " for " ++ show nm | True = do rs <- cgSym $ ask >>= liftIO . replicateM sz . svMkSymVar (Just ALL) k Nothing sws <- cgSym $ mapM svToSymSW rs modify' (\s -> s { cgInputs = (nm, CgArray sws) : cgInputs s }) return rs -- | Creates an atomic output in the generated code. svCgOutput :: String -> SVal -> SBVCodeGen () svCgOutput nm v = do _ <- cgSym (outputSVal v) sw <- cgSym (svToSymSW v) modify' (\s -> s { cgOutputs = (nm, CgAtomic sw) : cgOutputs s }) -- | Creates an array output in the generated code. svCgOutputArr :: String -> [SVal] -> SBVCodeGen () svCgOutputArr nm vs | sz < 1 = error $ "SBV.cgOutputArr: Array outputs must have at least one element, received " ++ show sz ++ " for " ++ show nm | True = do _ <- cgSym (mapM outputSVal vs) sws <- cgSym (mapM svToSymSW vs) modify' (\s -> s { cgOutputs = (nm, CgArray sws) : cgOutputs s }) where sz = length vs -- | Creates a returned (unnamed) value in the generated code. svCgReturn :: SVal -> SBVCodeGen () svCgReturn v = do _ <- cgSym (outputSVal v) sw <- cgSym (svToSymSW v) modify' (\s -> s { cgReturns = CgAtomic sw : cgReturns s }) -- | Creates a returned (unnamed) array value in the generated code. svCgReturnArr :: [SVal] -> SBVCodeGen () svCgReturnArr vs | sz < 1 = error $ "SBV.cgReturnArr: Array returns must have at least one element, received " ++ show sz | True = do _ <- cgSym (mapM outputSVal vs) sws <- cgSym (mapM svToSymSW vs) modify' (\s -> s { cgReturns = CgArray sws : cgReturns s }) where sz = length vs -- | Creates an atomic input in the generated code. cgInput :: SymWord a => String -> SBVCodeGen (SBV a) cgInput nm = do r <- cgSym forall_ sw <- cgSBVToSW r modify' (\s -> s { cgInputs = (nm, CgAtomic sw) : cgInputs s }) return r -- | Creates an array input in the generated code. cgInputArr :: SymWord a => Int -> String -> SBVCodeGen [SBV a] cgInputArr sz nm | sz < 1 = error $ "SBV.cgInputArr: Array inputs must have at least one element, given " ++ show sz ++ " for " ++ show nm | True = do rs <- cgSym $ mapM (const forall_) [1..sz] sws <- mapM cgSBVToSW rs modify' (\s -> s { cgInputs = (nm, CgArray sws) : cgInputs s }) return rs -- | Creates an atomic output in the generated code. cgOutput :: String -> SBV a -> SBVCodeGen () cgOutput nm v = do _ <- cgSym (output v) sw <- cgSBVToSW v modify' (\s -> s { cgOutputs = (nm, CgAtomic sw) : cgOutputs s }) -- | Creates an array output in the generated code. cgOutputArr :: SymWord a => String -> [SBV a] -> SBVCodeGen () cgOutputArr nm vs | sz < 1 = error $ "SBV.cgOutputArr: Array outputs must have at least one element, received " ++ show sz ++ " for " ++ show nm | True = do _ <- cgSym (mapM output vs) sws <- mapM cgSBVToSW vs modify' (\s -> s { cgOutputs = (nm, CgArray sws) : cgOutputs s }) where sz = length vs -- | Creates a returned (unnamed) value in the generated code. cgReturn :: SBV a -> SBVCodeGen () cgReturn v = do _ <- cgSym (output v) sw <- cgSBVToSW v modify' (\s -> s { cgReturns = CgAtomic sw : cgReturns s }) -- | Creates a returned (unnamed) array value in the generated code. cgReturnArr :: SymWord a => [SBV a] -> SBVCodeGen () cgReturnArr vs | sz < 1 = error $ "SBV.cgReturnArr: Array returns must have at least one element, received " ++ show sz | True = do _ <- cgSym (mapM output vs) sws <- mapM cgSBVToSW vs modify' (\s -> s { cgReturns = CgArray sws : cgReturns s }) where sz = length vs -- | Representation of a collection of generated programs. data CgPgmBundle = CgPgmBundle (Maybe Int, Maybe CgSRealType) [(FilePath, (CgPgmKind, [Doc]))] -- | Different kinds of "files" we can produce. Currently this is quite "C" specific. data CgPgmKind = CgMakefile [String] -- list of flags to pass to linker | CgHeader [Doc] | CgSource | CgDriver -- | Is this a driver program? isCgDriver :: CgPgmKind -> Bool isCgDriver CgDriver = True isCgDriver _ = False -- | Is this a make file? isCgMakefile :: CgPgmKind -> Bool isCgMakefile CgMakefile{} = True isCgMakefile _ = False -- A simple way to print bundles, mostly for debugging purposes. instance Show CgPgmBundle where show (CgPgmBundle _ fs) = intercalate "\n" $ map showFile fs where showFile :: (FilePath, (CgPgmKind, [Doc])) -> String showFile (f, (_, ds)) = "== BEGIN: " ++ show f ++ " ================\n" ++ render' (vcat ds) ++ "== END: " ++ show f ++ " ==================" -- | Generate code for a symbolic program, returning a Code-gen bundle, i.e., collection -- of makefiles, source code, headers, etc. codeGen :: CgTarget l => l -> CgConfig -> String -> SBVCodeGen () -> IO (CgConfig, CgPgmBundle) codeGen l cgConfig nm (SBVCodeGen comp) = do (((), st'), res) <- runSymbolic CodeGen $ runStateT comp initCgState { cgFinalConfig = cgConfig } let st = st' { cgInputs = reverse (cgInputs st') , cgOutputs = reverse (cgOutputs st') } allNamedVars = map fst (cgInputs st ++ cgOutputs st) dupNames = allNamedVars \\ nub allNamedVars unless (null dupNames) $ error $ "SBV.codeGen: " ++ show nm ++ " has following argument names duplicated: " ++ unwords dupNames return (cgFinalConfig st, translate l (cgFinalConfig st) nm st res) -- | Render a code-gen bundle to a directory or to stdout renderCgPgmBundle :: Maybe FilePath -> (CgConfig, CgPgmBundle) -> IO () renderCgPgmBundle Nothing (_ , bundle) = print bundle renderCgPgmBundle (Just dirName) (cfg, CgPgmBundle _ files) = do b <- doesDirectoryExist dirName unless b $ do unless overWrite $ putStrLn $ "Creating directory " ++ show dirName ++ ".." createDirectoryIfMissing True dirName dups <- filterM (\fn -> doesFileExist (dirName fn)) (map fst files) goOn <- case (overWrite, dups) of (True, _) -> return True (_, []) -> return True _ -> do putStrLn $ "Code generation would overwrite the following " ++ (if length dups == 1 then "file:" else "files:") mapM_ (\fn -> putStrLn ('\t' : fn)) dups putStr "Continue? [yn] " hFlush stdout resp <- getLine return $ map toLower resp `isPrefixOf` "yes" if goOn then do mapM_ renderFile files unless overWrite $ putStrLn "Done." else putStrLn "Aborting." where overWrite = cgOverwriteGenerated cfg renderFile (f, (_, ds)) = do let fn = dirName f unless overWrite $ putStrLn $ "Generating: " ++ show fn ++ ".." writeFile fn (render' (vcat ds)) -- | An alternative to Pretty's @render@, which might have "leading" white-space in empty lines. This version -- eliminates such whitespace. render' :: Doc -> String render' = unlines . map clean . lines . P.render where clean x | all isSpace x = "" | True = x sbv-7.13/Data/SBV/Control/0000755000000000000000000000000013405536617013361 5ustar0000000000000000sbv-7.13/Data/SBV/Control/Query.hs0000644000000000000000000013260513405536617015031 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Control.Query -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Querying a solver interactively. ----------------------------------------------------------------------------- {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE Rank2Types #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.SBV.Control.Query ( send, ask, retrieveResponse , CheckSatResult(..), checkSat, checkSatUsing, checkSatAssuming, checkSatAssumingWithUnsatisfiableSet , getUnsatCore, getProof, getInterpolant, getAssignment, getOption, freshVar, freshVar_, freshArray, freshArray_, push, pop, getAssertionStackDepth , inNewAssertionStack, echo, caseSplit, resetAssertions, exit, getAssertions, getValue, getUninterpretedValue, getModel, getSMTResult , getLexicographicOptResults, getIndependentOptResults, getParetoOptResults, getAllSatResult, getUnknownReason , SMTOption(..), SMTInfoFlag(..), SMTErrorBehavior(..), SMTReasonUnknown(..), SMTInfoResponse(..), getInfo , Logic(..), Assignment(..) , ignoreExitCode, timeout , (|->) , mkSMTResult , io ) where import Control.Monad (unless, when, zipWithM) import Control.Monad.State.Lazy (get) import Data.IORef (readIORef) import qualified Data.Map.Strict as M import qualified Data.IntMap.Strict as IM import Data.Char (toLower) import Data.List (unzip3, intercalate, nubBy, sortBy) import Data.Maybe (listToMaybe, catMaybes) import Data.Function (on) import Data.SBV.Core.Data import Data.SBV.Core.Symbolic (QueryState(..), Query(..), SMTModel(..), SMTResult(..), State(..), incrementInternalCounter) import Data.SBV.Utils.SExpr import Data.SBV.Utils.Boolean import Data.SBV.Control.Types import Data.SBV.Control.Utils -- | An Assignment of a model binding data Assignment = Assign SVal CW -- Remove one pair of surrounding 'c's, if present noSurrounding :: Char -> String -> String noSurrounding c (c':cs@(_:_)) | c == c' && c == last cs = init cs noSurrounding _ s = s -- Remove a pair of surrounding quotes unQuote :: String -> String unQuote = noSurrounding '"' -- Remove a pair of surrounding bars unBar :: String -> String unBar = noSurrounding '|' -- Is this a string? If so, return it, otherwise fail in the Maybe monad. fromECon :: SExpr -> Maybe String fromECon (ECon s) = Just s fromECon _ = Nothing -- Collect strings appearing, used in 'getOption' only stringsOf :: SExpr -> [String] stringsOf (ECon s) = [s] stringsOf (ENum (i, _)) = [show i] stringsOf (EReal r) = [show r] stringsOf (EFloat f) = [show f] stringsOf (EDouble d) = [show d] stringsOf (EApp ss) = concatMap stringsOf ss -- Sort of a light-hearted show for SExprs, for better consumption at the user level. serialize :: Bool -> SExpr -> String serialize removeQuotes = go where go (ECon s) = if removeQuotes then unQuote s else s go (ENum (i, _)) = shNN i go (EReal r) = shNN r go (EFloat f) = shNN f go (EDouble d) = shNN d go (EApp [x]) = go x go (EApp ss) = "(" ++ unwords (map go ss) ++ ")" -- be careful with negative number printing in SMT-Lib.. shNN :: (Show a, Num a, Ord a) => a -> String shNN i | i < 0 = "(- " ++ show (-i) ++ ")" | True = show i -- | Ask solver for info. getInfo :: SMTInfoFlag -> Query SMTInfoResponse getInfo flag = do let cmd = "(get-info " ++ show flag ++ ")" bad = unexpected "getInfo" cmd "a valid get-info response" Nothing isAllStatistics AllStatistics = True isAllStatistics _ = False isAllStat = isAllStatistics flag grabAllStat k v = (render k, render v) -- we're trying to do our best to get key-value pairs here, but this -- is necessarily a half-hearted attempt. grabAllStats (EApp xs) = walk xs where walk [] = [] walk [t] = [grabAllStat t (ECon "")] walk (t : v : rest) = grabAllStat t v : walk rest grabAllStats o = [grabAllStat o (ECon "")] r <- ask cmd parse r bad $ \pe -> if isAllStat then return $ Resp_AllStatistics $ grabAllStats pe else case pe of ECon "unsupported" -> return Resp_Unsupported EApp [ECon ":assertion-stack-levels", ENum (i, _)] -> return $ Resp_AssertionStackLevels i EApp (ECon ":authors" : ns) -> return $ Resp_Authors (map render ns) EApp [ECon ":error-behavior", ECon "immediate-exit"] -> return $ Resp_Error ErrorImmediateExit EApp [ECon ":error-behavior", ECon "continued-execution"] -> return $ Resp_Error ErrorContinuedExecution EApp (ECon ":name" : o) -> return $ Resp_Name (render (EApp o)) EApp (ECon ":reason-unknown" : o) -> return $ Resp_ReasonUnknown (unk o) EApp (ECon ":version" : o) -> return $ Resp_Version (render (EApp o)) EApp (ECon s : o) -> return $ Resp_InfoKeyword s (map render o) _ -> bad r Nothing where render = serialize True unk [ECon s] | Just d <- getUR s = d unk o = UnknownOther (render (EApp o)) getUR s = map toLower (unQuote s) `lookup` [(map toLower k, d) | (k, d) <- unknownReasons] -- As specified in Section 4.1 of the SMTLib document. Note that we're adding the -- extra timeout as it is useful in this context. unknownReasons = [ ("memout", UnknownMemOut) , ("incomplete", UnknownIncomplete) , ("timeout", UnknownTimeOut) ] -- | Retrieve the value of an 'SMTOption.' The curious function argument is on purpose here, -- simply pass the constructor name. Example: the call @'getOption' 'ProduceUnsatCores'@ will return -- either @Nothing@ or @Just (ProduceUnsatCores True)@ or @Just (ProduceUnsatCores False)@. -- -- Result will be 'Nothing' if the solver does not support this option. getOption :: (a -> SMTOption) -> Query (Maybe SMTOption) getOption f = case f undefined of DiagnosticOutputChannel{} -> askFor "DiagnosticOutputChannel" ":diagnostic-output-channel" $ string DiagnosticOutputChannel ProduceAssertions{} -> askFor "ProduceAssertions" ":produce-assertions" $ bool ProduceAssertions ProduceAssignments{} -> askFor "ProduceAssignments" ":produce-assignments" $ bool ProduceAssignments ProduceProofs{} -> askFor "ProduceProofs" ":produce-proofs" $ bool ProduceProofs ProduceInterpolants{} -> askFor "ProduceInterpolants" ":produce-interpolants" $ bool ProduceInterpolants ProduceUnsatAssumptions{} -> askFor "ProduceUnsatAssumptions" ":produce-unsat-assumptions" $ bool ProduceUnsatAssumptions ProduceUnsatCores{} -> askFor "ProduceUnsatCores" ":produce-unsat-cores" $ bool ProduceUnsatCores RandomSeed{} -> askFor "RandomSeed" ":random-seed" $ integer RandomSeed ReproducibleResourceLimit{} -> askFor "ReproducibleResourceLimit" ":reproducible-resource-limit" $ integer ReproducibleResourceLimit SMTVerbosity{} -> askFor "SMTVerbosity" ":verbosity" $ integer SMTVerbosity OptionKeyword nm _ -> askFor ("OptionKeyword" ++ nm) nm $ stringList (OptionKeyword nm) SetLogic{} -> error "Data.SBV.Query: SMTLib does not allow querying value of the logic!" -- Not to be confused by getInfo, which is totally irrelevant! SetInfo{} -> error "Data.SBV.Query: SMTLib does not allow querying value of meta-info!" where askFor sbvName smtLibName continue = do let cmd = "(get-option " ++ smtLibName ++ ")" bad = unexpected ("getOption " ++ sbvName) cmd "a valid option value" Nothing r <- ask cmd parse r bad $ \case ECon "unsupported" -> return Nothing e -> continue e (bad r) string c (ECon s) _ = return $ Just $ c s string _ e k = k $ Just ["Expected string, but got: " ++ show (serialize False e)] bool c (ENum (0, _)) _ = return $ Just $ c False bool c (ENum (1, _)) _ = return $ Just $ c True bool _ e k = k $ Just ["Expected boolean, but got: " ++ show (serialize False e)] integer c (ENum (i, _)) _ = return $ Just $ c i integer _ e k = k $ Just ["Expected integer, but got: " ++ show (serialize False e)] -- free format, really stringList c e _ = return $ Just $ c $ stringsOf e -- | Get the reason unknown. Only internally used. getUnknownReason :: Query SMTReasonUnknown getUnknownReason = do ru <- getInfo ReasonUnknown case ru of Resp_Unsupported -> return $ UnknownOther "Solver responded: Unsupported." Resp_ReasonUnknown r -> return r -- Shouldn't happen, but just in case: _ -> error $ "Unexpected reason value received: " ++ show ru -- | Issue check-sat and get an SMT Result out. getSMTResult :: Query SMTResult getSMTResult = do cfg <- getConfig cs <- checkSat case cs of Unsat -> Unsatisfiable cfg <$> getUnsatCoreIfRequested Sat -> Satisfiable cfg <$> getModel Unk -> Unknown cfg <$> getUnknownReason -- | Classify a model based on whether it has unbound objectives or not. classifyModel :: SMTConfig -> SMTModel -> SMTResult classifyModel cfg m = case filter (not . isRegularCW . snd) (modelObjectives m) of [] -> Satisfiable cfg m _ -> SatExtField cfg m -- | Issue check-sat and get results of a lexicographic optimization. getLexicographicOptResults :: Query SMTResult getLexicographicOptResults = do cfg <- getConfig cs <- checkSat case cs of Unsat -> Unsatisfiable cfg <$> getUnsatCoreIfRequested Sat -> classifyModel cfg <$> getModelWithObjectives Unk -> Unknown cfg <$> getUnknownReason where getModelWithObjectives = do objectiveValues <- getObjectiveValues m <- getModel return m {modelObjectives = objectiveValues} -- | Issue check-sat and get results of an independent (boxed) optimization. getIndependentOptResults :: [String] -> Query [(String, SMTResult)] getIndependentOptResults objNames = do cfg <- getConfig cs <- checkSat case cs of Unsat -> getUnsatCoreIfRequested >>= \mbUC -> return [(nm, Unsatisfiable cfg mbUC) | nm <- objNames] Sat -> continue (classifyModel cfg) Unk -> do ur <- Unknown cfg <$> getUnknownReason return [(nm, ur) | nm <- objNames] where continue classify = do objectiveValues <- getObjectiveValues nms <- zipWithM getIndependentResult [0..] objNames return [(n, classify (m {modelObjectives = objectiveValues})) | (n, m) <- nms] getIndependentResult :: Int -> String -> Query (String, SMTModel) getIndependentResult i s = do m <- getModelAtIndex (Just i) return (s, m) -- | Construct a pareto-front optimization result getParetoOptResults :: Maybe Int -> Query (Bool, [SMTResult]) getParetoOptResults (Just i) | i <= 0 = return (True, []) getParetoOptResults mbN = do cfg <- getConfig cs <- checkSat case cs of Unsat -> return (False, []) Sat -> continue (classifyModel cfg) Unk -> do ur <- getUnknownReason return (False, [ProofError cfg [show ur]]) where continue classify = do m <- getModel (limReached, fronts) <- getParetoFronts (subtract 1 <$> mbN) [m] return (limReached, reverse (map classify fronts)) getParetoFronts :: Maybe Int -> [SMTModel] -> Query (Bool, [SMTModel]) getParetoFronts (Just i) sofar | i <= 0 = return (True, sofar) getParetoFronts mbi sofar = do cs <- checkSat let more = getModel >>= \m -> getParetoFronts (subtract 1 <$> mbi) (m : sofar) case cs of Unsat -> return (False, sofar) Sat -> more Unk -> more -- | Collect model values. It is implicitly assumed that we are in a check-sat -- context. See 'getSMTResult' for a variant that issues a check-sat first and -- returns an 'SMTResult'. getModel :: Query SMTModel getModel = getModelAtIndex Nothing -- | Get a model stored at an index. This is likely very Z3 specific! getModelAtIndex :: Maybe Int -> Query SMTModel getModelAtIndex mbi = do State{runMode} <- get cfg <- getConfig inps <- getQuantifiedInputs obsvs <- getObservables rm <- io $ readIORef runMode let vars :: [NamedSymVar] vars = case rm of m@CodeGen -> error $ "SBV.getModel: Model is not available in mode: " ++ show m m@Concrete -> error $ "SBV.getModel: Model is not available in mode: " ++ show m SMTMode _ isSAT _ -> -- for "sat", display the prefix existentials. for "proof", display the prefix universals let allModelInputs = if isSAT then takeWhile ((/= ALL) . fst) inps else takeWhile ((== ALL) . fst) inps -- are we inside a quantifier insideQuantifier = length allModelInputs < length inps -- observables are only meaningful if we're not in a quantified context allPrefixObservables | insideQuantifier = [] | True = [(EX, (sw, nm)) | (nm, sw) <- obsvs] sortByNodeId :: [NamedSymVar] -> [NamedSymVar] sortByNodeId = sortBy (compare `on` (\(SW _ n, _) -> n)) in sortByNodeId [nv | (_, nv@(_, n)) <- allModelInputs ++ allPrefixObservables, not (isNonModelVar cfg n)] assocs <- mapM (\(sw, n) -> (n, ) <$> getValueCW mbi sw) vars return SMTModel { modelObjectives = [] , modelAssocs = assocs } -- | Just after a check-sat is issued, collect objective values. Used -- internally only, not exposed to the user. getObjectiveValues :: Query [(String, GeneralizedCW)] getObjectiveValues = do let cmd = "(get-objectives)" bad = unexpected "getObjectiveValues" cmd "a list of objective values" Nothing r <- ask cmd inputs <- map snd <$> getQuantifiedInputs parse r bad $ \case EApp (ECon "objectives" : es) -> catMaybes <$> mapM (getObjValue (bad r) inputs) es _ -> bad r Nothing where -- | Parse an objective value out. getObjValue :: (forall a. Maybe [String] -> Query a) -> [NamedSymVar] -> SExpr -> Query (Maybe (String, GeneralizedCW)) getObjValue bailOut inputs expr = case expr of EApp [_] -> return Nothing -- Happens when a soft-assertion has no associated group. EApp [ECon nm, v] -> locate nm v Nothing -- Regular case EApp [EApp [ECon "bvadd", ECon nm, ENum (a, _)], v] -> locate nm v (Just a) -- Happens when we "adjust" a signed-bounded objective _ -> dontUnderstand (show expr) where locate nm v mbAdjust = case listToMaybe [p | p@(sw, _) <- inputs, show sw == nm] of Nothing -> return Nothing -- Happens when the soft assertion has a group-id that's not one of the input names Just (sw, actualName) -> grab sw v >>= \val -> return $ Just (actualName, signAdjust mbAdjust val) dontUnderstand s = bailOut $ Just [ "Unable to understand solver output." , "While trying to process: " ++ s ] signAdjust :: Maybe Integer -> GeneralizedCW -> GeneralizedCW signAdjust Nothing v = v signAdjust (Just adj) e = goG e where goG :: GeneralizedCW -> GeneralizedCW goG (ExtendedCW ecw) = ExtendedCW $ goE ecw goG (RegularCW cw) = RegularCW $ go cw goE :: ExtCW -> ExtCW goE (Infinite k) = Infinite k goE (Epsilon k) = Epsilon k goE (Interval lo hi) = Interval (goE lo) (goE hi) goE (BoundedCW cw) = BoundedCW (go cw) goE (AddExtCW a b) = AddExtCW (goE a) (goE b) goE (MulExtCW a b) = MulExtCW (goE a) (goE b) go :: CW -> CW go cw = case (kindOf cw, cwVal cw) of (k@(KBounded True _), CWInteger v) -> normCW $ CW k (CWInteger (v - adj)) _ -> error $ "SBV.getObjValue: Unexpected cw received! " ++ show cw grab :: SW -> SExpr -> Query GeneralizedCW grab s topExpr | Just v <- recoverKindedValue k topExpr = return $ RegularCW v | True = ExtendedCW <$> cvt (simplify topExpr) where k = kindOf s -- Convert to an extended expression. Hopefully complete! cvt :: SExpr -> Query ExtCW cvt (ECon "oo") = return $ Infinite k cvt (ECon "epsilon") = return $ Epsilon k cvt (EApp [ECon "interval", x, y]) = Interval <$> cvt x <*> cvt y cvt (ENum (i, _)) = return $ BoundedCW $ mkConstCW k i cvt (EReal r) = return $ BoundedCW $ CW k $ CWAlgReal r cvt (EFloat f) = return $ BoundedCW $ CW k $ CWFloat f cvt (EDouble d) = return $ BoundedCW $ CW k $ CWDouble d cvt (EApp [ECon "+", x, y]) = AddExtCW <$> cvt x <*> cvt y cvt (EApp [ECon "*", x, y]) = MulExtCW <$> cvt x <*> cvt y -- Nothing else should show up, hopefully! cvt e = dontUnderstand (show e) -- drop the pesky to_real's that Z3 produces.. Cool but useless. simplify :: SExpr -> SExpr simplify (EApp [ECon "to_real", n]) = n simplify (EApp xs) = EApp (map simplify xs) simplify e = e -- | Check for satisfiability, under the given conditions. Similar to 'Data.SBV.Control.checkSat' except it allows making -- further assumptions as captured by the first argument of booleans. (Also see 'checkSatAssumingWithUnsatisfiableSet' -- for a variant that returns the subset of the given assumptions that led to the 'Unsat' conclusion.) checkSatAssuming :: [SBool] -> Query CheckSatResult checkSatAssuming sBools = fst <$> checkSatAssumingHelper False sBools -- | Check for satisfiability, under the given conditions. Returns the unsatisfiable -- set of assumptions. Similar to 'Data.SBV.Control.checkSat' except it allows making further assumptions -- as captured by the first argument of booleans. If the result is 'Unsat', the user will -- also receive a subset of the given assumptions that led to the 'Unsat' conclusion. Note -- that while this set will be a subset of the inputs, it is not necessarily guaranteed to be minimal. -- -- You must have arranged for the production of unsat assumptions -- first via -- -- @ -- 'setOption' $ 'ProduceUnsatAssumptions' 'True' -- @ -- -- for this call to not error out! -- -- Usage note: 'getUnsatCore' is usually easier to use than 'checkSatAssumingWithUnsatisfiableSet', as it -- allows the use of named assertions, as obtained by 'namedConstraint'. If 'getUnsatCore' -- fills your needs, you should definitely prefer it over 'checkSatAssumingWithUnsatisfiableSet'. checkSatAssumingWithUnsatisfiableSet :: [SBool] -> Query (CheckSatResult, Maybe [SBool]) checkSatAssumingWithUnsatisfiableSet = checkSatAssumingHelper True -- | Helper for the two variants of checkSatAssuming we have. Internal only. checkSatAssumingHelper :: Bool -> [SBool] -> Query (CheckSatResult, Maybe [SBool]) checkSatAssumingHelper getAssumptions sBools = do -- sigh.. SMT-Lib requires the values to be literals only. So, create proxies. let mkAssumption st = do swsOriginal <- mapM (\sb -> do sw <- sbvToSW st sb return (sw, sb)) sBools -- drop duplicates and trues let swbs = [p | p@(sw, _) <- nubBy ((==) `on` fst) swsOriginal, sw /= trueSW] -- get a unique proxy name for each uniqueSWBs <- mapM (\(sw, sb) -> do unique <- incrementInternalCounter st return (sw, (unique, sb))) swbs let translate (sw, (unique, sb)) = (nm, decls, (proxy, sb)) where nm = show sw proxy = "__assumption_proxy_" ++ nm ++ "_" ++ show unique decls = [ "(declare-const " ++ proxy ++ " Bool)" , "(assert (= " ++ proxy ++ " " ++ nm ++ "))" ] return $ map translate uniqueSWBs assumptions <- inNewContext mkAssumption let (origNames, declss, proxyMap) = unzip3 assumptions let cmd = "(check-sat-assuming (" ++ unwords (map fst proxyMap) ++ "))" bad = unexpected "checkSatAssuming" cmd "one of sat/unsat/unknown" $ Just [ "Make sure you use:" , "" , " setOption $ ProduceUnsatAssumptions True" , "" , "to tell the solver to produce unsat assumptions." ] mapM_ (send True) $ concat declss r <- ask cmd let grabUnsat | getAssumptions = do as <- getUnsatAssumptions origNames proxyMap return (Unsat, Just as) | True = return (Unsat, Nothing) parse r bad $ \case ECon "sat" -> return (Sat, Nothing) ECon "unsat" -> grabUnsat ECon "unknown" -> return (Unk, Nothing) _ -> bad r Nothing -- | The current assertion stack depth, i.e., #push - #pops after start. Always non-negative. getAssertionStackDepth :: Query Int getAssertionStackDepth = queryAssertionStackDepth <$> getQueryState -- | Upon a pop, we need to restore all arrays and tables. See: http://github.com/LeventErkok/sbv/issues/374 restoreTablesAndArrays :: Query () restoreTablesAndArrays = do st <- get qs <- getQueryState case queryTblArrPreserveIndex qs of Nothing -> return () Just (tc, ac) -> do tCount <- M.size <$> (io . readIORef) (rtblMap st) aCount <- IM.size <$> (io . readIORef) (rArrayMap st) let tInits = [ "table" ++ show i ++ "_initializer" | i <- [tc .. tCount - 1]] aInits = [ "array_" ++ show i ++ "_initializer" | i <- [ac .. aCount - 1]] inits = tInits ++ aInits case inits of [] -> return () -- Nothing to do [x] -> send True $ "(assert " ++ x ++ ")" xs -> send True $ "(assert (and " ++ unwords xs ++ "))" -- | Upon a push, record the cut-off point for table and array restoration, if we haven't already recordTablesAndArrayCutOff :: Query () recordTablesAndArrayCutOff = do st <- get qs <- getQueryState case queryTblArrPreserveIndex qs of Just _ -> return () -- already recorded, nothing to do Nothing -> do tCount <- M.size <$> (io . readIORef) (rtblMap st) aCount <- IM.size <$> (io . readIORef) (rArrayMap st) modifyQueryState $ \s -> s {queryTblArrPreserveIndex = Just (tCount, aCount)} -- | Run the query in a new assertion stack. That is, we push the context, run the query -- commands, and pop it back. inNewAssertionStack :: Query a -> Query a inNewAssertionStack q = do push 1 r <- q pop 1 return r -- | Push the context, entering a new one. Pushes multiple levels if /n/ > 1. push :: Int -> Query () push i | i <= 0 = error $ "Data.SBV: push requires a strictly positive level argument, received: " ++ show i | True = do depth <- getAssertionStackDepth send True $ "(push " ++ show i ++ ")" recordTablesAndArrayCutOff modifyQueryState $ \s -> s{queryAssertionStackDepth = depth + i} -- | Pop the context, exiting a new one. Pops multiple levels if /n/ > 1. It's an error to pop levels that don't exist. pop :: Int -> Query () pop i | i <= 0 = error $ "Data.SBV: pop requires a strictly positive level argument, received: " ++ show i | True = do depth <- getAssertionStackDepth if i > depth then error $ "Data.SBV: Illegally trying to pop " ++ shl i ++ ", at current level: " ++ show depth else do QueryState{queryConfig} <- getQueryState if not (supportsGlobalDecls (capabilities (solver queryConfig))) then error $ unlines [ "" , "*** Data.SBV: Backend solver does not support global-declarations." , "*** Hence, calls to 'pop' are not supported." , "***" , "*** Request this as a feature for the underlying solver!" ] else do send True $ "(pop " ++ show i ++ ")" restoreTablesAndArrays modifyQueryState $ \s -> s{queryAssertionStackDepth = depth - i} where shl 1 = "one level" shl n = show n ++ " levels" -- | Search for a result via a sequence of case-splits, guided by the user. If one of -- the conditions lead to a satisfiable result, returns @Just@ that result. If none of them -- do, returns @Nothing@. Note that we automatically generate a coverage case and search -- for it automatically as well. In that latter case, the string returned will be "Coverage". -- The first argument controls printing progress messages See "Documentation.SBV.Examples.Queries.CaseSplit" -- for an example use case. caseSplit :: Bool -> [(String, SBool)] -> Query (Maybe (String, SMTResult)) caseSplit printCases cases = do cfg <- getConfig go cfg (cases ++ [("Coverage", bnot (bOr (map snd cases)))]) where msg = when printCases . io . putStrLn go _ [] = return Nothing go cfg ((n,c):ncs) = do let notify s = msg $ "Case " ++ n ++ ": " ++ s notify "Starting" r <- checkSatAssuming [c] case r of Unsat -> do notify "Unsatisfiable" go cfg ncs Sat -> do notify "Satisfiable" res <- Satisfiable cfg <$> getModel return $ Just (n, res) Unk -> do notify "Unknown" res <- Unknown cfg <$> getUnknownReason return $ Just (n, res) -- | Reset the solver, by forgetting all the assertions. However, bindings are kept as is, -- as opposed to a full reset of the solver. Use this variant to clean-up the solver -- state while leaving the bindings intact. Pops all assertion levels. Declarations and -- definitions resulting from the 'Data.SBV.setLogic' command are unaffected. Note that SBV -- implicitly uses global-declarations, so bindings will remain intact. resetAssertions :: Query () resetAssertions = do send True "(reset-assertions)" modifyQueryState $ \s -> s{queryAssertionStackDepth = 0} -- | Echo a string. Note that the echoing is done by the solver, not by SBV. echo :: String -> Query () echo s = do let cmd = "(echo \"" ++ concatMap sanitize s ++ "\")" -- we send the command, but otherwise ignore the response -- note that 'send True/False' would be incorrect here. 'send True' would -- require a success response. 'send False' would fail to consume the -- output. But 'ask' does the right thing! It gets "some" response, -- and forgets about it immediately. _ <- ask cmd return () where sanitize '"' = "\"\"" -- quotes need to be duplicated sanitize c = [c] -- | Exit the solver. This action will cause the solver to terminate. Needless to say, -- trying to communicate with the solver after issuing "exit" will simply fail. exit :: Query () exit = do send True "(exit)" modifyQueryState $ \s -> s{queryAssertionStackDepth = 0} -- | Retrieve the unsat-core. Note you must have arranged for -- unsat cores to be produced first via -- -- @ -- 'setOption' $ 'ProduceUnsatCores' 'True' -- @ -- -- for this call to not error out! -- -- NB. There is no notion of a minimal unsat-core, in case unsatisfiability can be derived -- in multiple ways. Furthermore, Z3 does not guarantee that the generated unsat -- core does not have any redundant assertions either, as doing so can incur a performance penalty. -- (There might be assertions in the set that is not needed.) To ensure all the assertions -- in the core are relevant, use: -- -- @ -- 'setOption' $ 'OptionKeyword' ":smt.core.minimize" ["true"] -- @ -- -- Note that this only works with Z3. getUnsatCore :: Query [String] getUnsatCore = do let cmd = "(get-unsat-core)" bad = unexpected "getUnsatCore" cmd "an unsat-core response" $ Just [ "Make sure you use:" , "" , " setOption $ ProduceUnsatCores True" , "" , "so the solver will be ready to compute unsat cores," , "and that there is a model by first issuing a 'checkSat' call." , "" , "If using z3, you might also optionally want to set:" , "" , " setOption $ OptionKeyword \":smt.core.minimize\" [\"true\"]" , "" , "to make sure the unsat core doesn't have irrelevant entries," , "though this might incur a performance penalty." ] r <- ask cmd parse r bad $ \case EApp es | Just xs <- mapM fromECon es -> return $ map unBar xs _ -> bad r Nothing -- | Retrieve the unsat core if it was asked for in the configuration getUnsatCoreIfRequested :: Query (Maybe [String]) getUnsatCoreIfRequested = do cfg <- getConfig if or [b | ProduceUnsatCores b <- solverSetOptions cfg] then Just <$> getUnsatCore else return Nothing -- | Retrieve the proof. Note you must have arranged for -- proofs to be produced first via -- -- @ -- 'setOption' $ 'ProduceProofs' 'True' -- @ -- -- for this call to not error out! -- -- A proof is simply a 'String', as returned by the solver. In the future, SBV might -- provide a better datatype, depending on the use cases. Please get in touch if you -- use this function and can suggest a better API. getProof :: Query String getProof = do let cmd = "(get-proof)" bad = unexpected "getProof" cmd "a get-proof response" $ Just [ "Make sure you use:" , "" , " setOption $ ProduceProofs True" , "" , "to make sure the solver is ready for producing proofs," , "and that there is a proof by first issuing a 'checkSat' call." ] r <- ask cmd -- we only care about the fact that we can parse the output, so the -- result of parsing is ignored. parse r bad $ \_ -> return r -- | Retrieve an interpolant after an 'Unsat' result is obtained. Note you must have arranged for -- interpolants to be produced first via -- -- @ -- 'setOption' $ 'ProduceInterpolants' 'True' -- @ -- -- for this call to not error out! -- -- To get an interpolant for a pair of formulas @A@ and @B@, use a 'constrainWithAttribute' call to attach -- interplation groups to @A@ and @B@. Then call 'getInterpolant' @[\"A\"]@, assuming those are the names -- you gave to the formulas in the @A@ group. -- -- An interpolant for @A@ and @B@ is a formula @I@ such that: -- -- @ -- A ==> I -- and B ==> not I -- @ -- -- That is, it's evidence that @A@ and @B@ cannot be true together -- since @A@ implies @I@ but @B@ implies @not I@; establishing that @A@ and @B@ cannot -- be satisfied at the same time. Furthermore, @I@ will have only the symbols that are common -- to @A@ and @B@. -- -- N.B. As of Z3 version 4.8.0; Z3 no longer supports interpolants. Use the MathSAT backend for extracting -- interpolants. See "Documentation.SBV.Examples.Queries.Interpolants" for an example. getInterpolant :: [String] -> Query String getInterpolant fs | null fs = error "SBV.getInterpolant requires at least one marked constraint, received none!" | True = do let bar s = '|' : s ++ "|" cmd = "(get-interpolant (" ++ unwords (map bar fs) ++ "))" bad = unexpected "getInterpolant" cmd "a get-interpolant response" $ Just [ "Make sure you use:" , "" , " setOption $ ProduceInterpolants True" , "" , "to make sure the solver is ready for producing interpolants," , "and that you have used the proper attributes using the" , "constrainWithAttribute function." ] r <- ask cmd parse r bad $ \e -> return $ serialize False e -- | Retrieve assertions. Note you must have arranged for -- assertions to be available first via -- -- @ -- 'setOption' $ 'ProduceAssertions' 'True' -- @ -- -- for this call to not error out! -- -- Note that the set of assertions returned is merely a list of strings, just like the -- case for 'getProof'. In the future, SBV might provide a better datatype, depending -- on the use cases. Please get in touch if you use this function and can suggest -- a better API. getAssertions :: Query [String] getAssertions = do let cmd = "(get-assertions)" bad = unexpected "getAssertions" cmd "a get-assertions response" $ Just [ "Make sure you use:" , "" , " setOption $ ProduceAssertions True" , "" , "to make sure the solver is ready for producing assertions." ] render = serialize False r <- ask cmd parse r bad $ \pe -> case pe of EApp xs -> return $ map render xs _ -> return [render pe] -- | Retrieve the assignment. This is a lightweight version of 'getValue', where the -- solver returns the truth value for all named subterms of type 'Bool'. -- -- You must have first arranged for assignments to be produced via -- -- @ -- 'setOption' $ 'ProduceAssignments' 'True' -- @ -- -- for this call to not error out! getAssignment :: Query [(String, Bool)] getAssignment = do let cmd = "(get-assignment)" bad = unexpected "getAssignment" cmd "a get-assignment response" $ Just [ "Make sure you use:" , "" , " setOption $ ProduceAssignments True" , "" , "to make sure the solver is ready for producing assignments," , "and that there is a model by first issuing a 'checkSat' call." ] -- we're expecting boolean assignment to labels, essentially grab (EApp [ECon s, ENum (0, _)]) = Just (unQuote s, False) grab (EApp [ECon s, ENum (1, _)]) = Just (unQuote s, True) grab _ = Nothing r <- ask cmd parse r bad $ \case EApp ps | Just vs <- mapM grab ps -> return vs _ -> bad r Nothing -- | Make an assignment. The type 'Assignment' is abstract, the result is typically passed -- to 'mkSMTResult': -- -- @ mkSMTResult [ a |-> 332 -- , b |-> 2.3 -- , c |-> True -- ] -- @ -- -- End users should use 'getModel' for automatically constructing models from the current solver state. -- However, an explicit 'Assignment' might be handy in complex scenarios where a model needs to be -- created manually. infix 1 |-> (|->) :: SymWord a => SBV a -> a -> Assignment SBV a |-> v = case literal v of SBV (SVal _ (Left cw)) -> Assign a cw r -> error $ "Data.SBV: Impossible happened in |->: Cannot construct a CW with literal: " ++ show r -- | Produce the query result from an assignment. mkSMTResult :: [Assignment] -> Query SMTResult mkSMTResult asgns = do QueryState{queryConfig} <- getQueryState inps <- getQuantifiedInputs let grabValues st = do let extract (Assign s n) = sbvToSW st (SBV s) >>= \sw -> return (sw, n) modelAssignment <- mapM extract asgns -- sanity checks -- - All existentials should be given a value -- - No duplicates -- - No bindings to vars that are not inputs let userSS = map fst modelAssignment missing, extra, dup :: [String] missing = [n | (EX, (s, n)) <- inps, s `notElem` userSS] extra = [show s | s <- userSS, s `notElem` map (fst . snd) inps] dup = let walk [] = [] walk (n:ns) | n `elem` ns = show n : walk (filter (/= n) ns) | True = walk ns in walk userSS unless (null (missing ++ extra ++ dup)) $ do let misTag = "*** Missing inputs" dupTag = "*** Duplicate bindings" extTag = "*** Extra bindings" maxLen = maximum $ 0 : [length misTag | not (null missing)] ++ [length extTag | not (null extra)] ++ [length dupTag | not (null dup)] align s = s ++ replicate (maxLen - length s) ' ' ++ ": " error $ unlines $ ["" , "*** Data.SBV: Query model construction has a faulty assignment." , "***" ] ++ [ align misTag ++ intercalate ", " missing | not (null missing)] ++ [ align extTag ++ intercalate ", " extra | not (null extra) ] ++ [ align dupTag ++ intercalate ", " dup | not (null dup) ] ++ [ "***" , "*** Data.SBV: Check your query result construction!" ] let findName s = case [nm | (_, (i, nm)) <- inps, s == i] of [nm] -> nm [] -> error "*** Data.SBV: Impossible happened: Cannot find " ++ show s ++ " in the input list" nms -> error $ unlines [ "" , "*** Data.SBV: Impossible happened: Multiple matches for: " ++ show s , "*** Candidates: " ++ unwords nms ] return [(findName s, n) | (s, n) <- modelAssignment] assocs <- inNewContext grabValues let m = SMTModel { modelObjectives = [] , modelAssocs = assocs } return $ Satisfiable queryConfig m sbv-7.13/Data/SBV/Control/Types.hs0000644000000000000000000002732413405536617015031 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Control.Types -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Types related to interactive queries ----------------------------------------------------------------------------- {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveAnyClass #-} module Data.SBV.Control.Types ( CheckSatResult(..) , Logic(..) , SMTOption(..), isStartModeOption, setSMTOption , SMTInfoFlag(..) , SMTErrorBehavior(..) , SMTReasonUnknown(..) , SMTInfoResponse(..) ) where import Generics.Deriving.Base (Generic) import Generics.Deriving.Show (GShow, gshow) import Control.DeepSeq (NFData(..)) -- | Result of a 'Data.SBV.Control.checkSat' or 'Data.SBV.Control.checkSatAssuming' call. data CheckSatResult = Sat -- ^ Satisfiable: A model is available, which can be queried with 'Data.SBV.Control.getValue'. | Unsat -- ^ Unsatisfiable: No model is available. Unsat cores might be obtained via 'Data.SBV.Control.getUnsatCore'. | Unk -- ^ Unknown: Use 'Data.SBV.Control.getUnknownReason' to obtain an explanation why this might be the case. deriving (Eq, Show) -- | Collectable information from the solver. data SMTInfoFlag = AllStatistics | AssertionStackLevels | Authors | ErrorBehavior | Name | ReasonUnknown | Version | InfoKeyword String -- | Behavior of the solver for errors. data SMTErrorBehavior = ErrorImmediateExit | ErrorContinuedExecution deriving Show -- | Reason for reporting unknown. data SMTReasonUnknown = UnknownMemOut | UnknownIncomplete | UnknownTimeOut | UnknownOther String deriving (Generic, NFData) -- | Show instance for unknown instance Show SMTReasonUnknown where show UnknownMemOut = "memout" show UnknownIncomplete = "incomplete" show UnknownTimeOut = "timeout" show (UnknownOther s) = s -- | Collectable information from the solver. data SMTInfoResponse = Resp_Unsupported | Resp_AllStatistics [(String, String)] | Resp_AssertionStackLevels Integer | Resp_Authors [String] | Resp_Error SMTErrorBehavior | Resp_Name String | Resp_ReasonUnknown SMTReasonUnknown | Resp_Version String | Resp_InfoKeyword String [String] deriving Show -- Show instance for SMTInfoFlag maintains smt-lib format per the SMTLib2 standard document. instance Show SMTInfoFlag where show AllStatistics = ":all-statistics" show AssertionStackLevels = ":assertion-stack-levels" show Authors = ":authors" show ErrorBehavior = ":error-behavior" show Name = ":name" show ReasonUnknown = ":reason-unknown" show Version = ":version" show (InfoKeyword s) = s -- | Option values that can be set in the solver, following the SMTLib specification . -- -- Note that not all solvers may support all of these! -- -- Furthermore, SBV doesn't support the following options allowed by SMTLib. -- -- * @:interactive-mode@ (Deprecated in SMTLib, use 'ProduceAssertions' instead.) -- * @:print-success@ (SBV critically needs this to be True in query mode.) -- * @:produce-models@ (SBV always sets this option so it can extract models.) -- * @:regular-output-channel@ (SBV always requires regular output to come on stdout for query purposes.) -- * @:global-declarations@ (SBV always uses global declarations since definitions are accumulative.) -- -- Note that 'SetLogic' and 'SetInfo' are, strictly speaking, not SMTLib options. However, we treat it as such here -- uniformly, as it fits better with how options work. data SMTOption = DiagnosticOutputChannel FilePath | ProduceAssertions Bool | ProduceAssignments Bool | ProduceProofs Bool | ProduceInterpolants Bool | ProduceUnsatAssumptions Bool | ProduceUnsatCores Bool | RandomSeed Integer | ReproducibleResourceLimit Integer | SMTVerbosity Integer | OptionKeyword String [String] | SetLogic Logic | SetInfo String [String] deriving (Show, Generic, NFData) -- | Can this command only be run at the very beginning? If 'True' then -- we will reject setting these options in the query mode. Note that this -- classification follows the SMTLib document. isStartModeOption :: SMTOption -> Bool isStartModeOption DiagnosticOutputChannel{} = False isStartModeOption ProduceAssertions{} = True isStartModeOption ProduceAssignments{} = True isStartModeOption ProduceProofs{} = True isStartModeOption ProduceInterpolants{} = True isStartModeOption ProduceUnsatAssumptions{} = True isStartModeOption ProduceUnsatCores{} = True isStartModeOption RandomSeed{} = True isStartModeOption ReproducibleResourceLimit{} = False isStartModeOption SMTVerbosity{} = False isStartModeOption OptionKeyword{} = True -- Conservative. isStartModeOption SetLogic{} = True isStartModeOption SetInfo{} = False -- SMTLib's True/False is spelled differently than Haskell's. smtBool :: Bool -> String smtBool True = "true" smtBool False = "false" -- | Translate an option setting to SMTLib. Note the SetLogic/SetInfo discrepancy. setSMTOption :: SMTOption -> String setSMTOption = cvt where cvt (DiagnosticOutputChannel f) = opt [":diagnostic-output-channel", show f] cvt (ProduceAssertions b) = opt [":produce-assertions", smtBool b] cvt (ProduceAssignments b) = opt [":produce-assignments", smtBool b] cvt (ProduceProofs b) = opt [":produce-proofs", smtBool b] cvt (ProduceInterpolants b) = opt [":produce-interpolants", smtBool b] cvt (ProduceUnsatAssumptions b) = opt [":produce-unsat-assumptions", smtBool b] cvt (ProduceUnsatCores b) = opt [":produce-unsat-cores", smtBool b] cvt (RandomSeed i) = opt [":random-seed", show i] cvt (ReproducibleResourceLimit i) = opt [":reproducible-resource-limit", show i] cvt (SMTVerbosity i) = opt [":verbosity", show i] cvt (OptionKeyword k as) = opt (k : as) cvt (SetLogic l) = logic l cvt (SetInfo k as) = info (k : as) opt xs = "(set-option " ++ unwords xs ++ ")" info xs = "(set-info " ++ unwords xs ++ ")" logic Logic_NONE = "; NB. not setting the logic per user request of Logic_NONE" logic l = "(set-logic " ++ show l ++ ")" -- | SMT-Lib logics. If left unspecified SBV will pick the logic based on what it determines is needed. However, the -- user can override this choice using a call to 'Data.SBV.setLogic' This is especially handy if one is experimenting with custom -- logics that might be supported on new solvers. See for the official list. data Logic = AUFLIA -- ^ Formulas over the theory of linear integer arithmetic and arrays extended with free sort and function symbols but restricted to arrays with integer indices and values. | AUFLIRA -- ^ Linear formulas with free sort and function symbols over one- and two-dimentional arrays of integer index and real value. | AUFNIRA -- ^ Formulas with free function and predicate symbols over a theory of arrays of arrays of integer index and real value. | LRA -- ^ Linear formulas in linear real arithmetic. | QF_ABV -- ^ Quantifier-free formulas over the theory of bitvectors and bitvector arrays. | QF_AUFBV -- ^ Quantifier-free formulas over the theory of bitvectors and bitvector arrays extended with free sort and function symbols. | QF_AUFLIA -- ^ Quantifier-free linear formulas over the theory of integer arrays extended with free sort and function symbols. | QF_AX -- ^ Quantifier-free formulas over the theory of arrays with extensionality. | QF_BV -- ^ Quantifier-free formulas over the theory of fixed-size bitvectors. | QF_IDL -- ^ Difference Logic over the integers. Boolean combinations of inequations of the form x - y < b where x and y are integer variables and b is an integer constant. | QF_LIA -- ^ Unquantified linear integer arithmetic. In essence, Boolean combinations of inequations between linear polynomials over integer variables. | QF_LRA -- ^ Unquantified linear real arithmetic. In essence, Boolean combinations of inequations between linear polynomials over real variables. | QF_NIA -- ^ Quantifier-free integer arithmetic. | QF_NRA -- ^ Quantifier-free real arithmetic. | QF_RDL -- ^ Difference Logic over the reals. In essence, Boolean combinations of inequations of the form x - y < b where x and y are real variables and b is a rational constant. | QF_UF -- ^ Unquantified formulas built over a signature of uninterpreted (i.e., free) sort and function symbols. | QF_UFBV -- ^ Unquantified formulas over bitvectors with uninterpreted sort function and symbols. | QF_UFIDL -- ^ Difference Logic over the integers (in essence) but with uninterpreted sort and function symbols. | QF_UFLIA -- ^ Unquantified linear integer arithmetic with uninterpreted sort and function symbols. | QF_UFLRA -- ^ Unquantified linear real arithmetic with uninterpreted sort and function symbols. | QF_UFNRA -- ^ Unquantified non-linear real arithmetic with uninterpreted sort and function symbols. | QF_UFNIRA -- ^ Unquantified non-linear real integer arithmetic with uninterpreted sort and function symbols. | UFLRA -- ^ Linear real arithmetic with uninterpreted sort and function symbols. | UFNIA -- ^ Non-linear integer arithmetic with uninterpreted sort and function symbols. | QF_FPBV -- ^ Quantifier-free formulas over the theory of floating point numbers, arrays, and bit-vectors. | QF_FP -- ^ Quantifier-free formulas over the theory of floating point numbers. | QF_FD -- ^ Quantifier-free finite domains. | QF_S -- ^ Quantifier-free formulas over the theory of strings. | Logic_ALL -- ^ The catch-all value. | Logic_NONE -- ^ Use this value when you want SBV to simply not set the logic. | CustomLogic String -- ^ In case you need a really custom string! deriving (Generic, NFData) -- The show instance is "almost" the derived one, but not quite! instance GShow Logic instance Show Logic where show Logic_ALL = "ALL" show (CustomLogic l) = l show l = gshow l {-# ANN type SMTInfoResponse ("HLint: ignore Use camelCase" :: String) #-} {-# ANN type Logic ("HLint: ignore Use camelCase" :: String) #-} sbv-7.13/Data/SBV/Control/Utils.hs0000644000000000000000000013644113405536617015026 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Control.Utils -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Query related utils. ----------------------------------------------------------------------------- {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE FlexibleInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.SBV.Control.Utils ( io , ask, send, getValue, getUninterpretedValue, getValueCW, getUnsatAssumptions, SMTValue(..) , getQueryState, modifyQueryState, getConfig, getObjectives, getSBVAssertions, getSBVPgm, getQuantifiedInputs, getObservables , checkSat, checkSatUsing, getAllSatResult , inNewContext, freshVar, freshVar_, freshArray, freshArray_ , parse , unexpected , timeout , queryDebug , retrieveResponse , recoverKindedValue , runProofOn , executeQuery ) where import Data.Maybe (isJust) import Data.List (sortBy, sortOn, elemIndex, partition, groupBy, tails, intercalate) import Data.Char (isPunctuation, isSpace, chr, ord) import Data.Function (on) import Data.Typeable (Typeable) import Data.Int import Data.Word import qualified Data.Map.Strict as Map import qualified Data.IntMap.Strict as IMap import qualified Control.Monad.Reader as R (ask) import Control.Monad (unless) import Control.Monad.State.Lazy (get, liftIO) import Control.Monad.State (evalStateT) import Data.IORef (readIORef, writeIORef) import Data.Time (getZonedTime) import Data.SBV.Core.Data ( SW(..), CW(..), SBV, AlgReal, sbvToSW, kindOf, Kind(..) , HasKind(..), mkConstCW, CWVal(..), SMTResult(..) , NamedSymVar, SMTConfig(..), Query, SMTModel(..) , QueryState(..), SVal(..), Quantifier(..), cache , newExpr, SBVExpr(..), Op(..), FPOp(..), SBV(..), SymArray(..) , SolverContext(..), SBool, Objective(..), SolverCapabilities(..), capabilities , Result(..), SMTProblem(..), trueSW, SymWord(..), SBVPgm(..), SMTSolver(..), SBVRunMode(..) ) import Data.SBV.Core.Symbolic ( IncState(..), withNewIncState, State(..), svToSW, Symbolic , QueryContext(..) , registerLabel, svMkSymVar , isSafetyCheckingIStage, isSetupIStage, isRunIStage, IStage(..), Query(..) , extractSymbolicSimulationState ) import Data.SBV.Core.AlgReals (mergeAlgReals) import Data.SBV.Core.Operations (svNot, svNotEqual, svOr) import Data.SBV.SMT.SMTLib (toIncSMTLib, toSMTLib) import Data.SBV.SMT.Utils (showTimeoutValue, addAnnotations, alignPlain, debug, mergeSExpr, SBVException(..)) import Data.SBV.Utils.Lib (qfsToString, isKString) import Data.SBV.Utils.SExpr import Data.SBV.Control.Types import qualified Data.Set as Set (toList) import qualified Control.Exception as C import GHC.Stack import Unsafe.Coerce (unsafeCoerce) -- Only used safely! -- | 'Query' as a 'SolverContext'. instance SolverContext Query where constrain = addQueryConstraint False [] softConstrain = addQueryConstraint True [] namedConstraint nm = addQueryConstraint False [(":named", nm)] constrainWithAttribute = addQueryConstraint False setOption o | isStartModeOption o = error $ unlines [ "" , "*** Data.SBV: '" ++ show o ++ "' can only be set at start-up time." , "*** Hint: Move the call to 'setOption' before the query." ] | True = send True $ setSMTOption o -- | Adding a constraint, possibly with attributes and possibly soft. Only used internally. -- Use 'constrain' and 'namedConstraint' from user programs. addQueryConstraint :: Bool -> [(String, String)] -> SBool -> Query () addQueryConstraint isSoft atts b = do sw <- inNewContext (\st -> do mapM_ (registerLabel "Constraint" st) [nm | (":named", nm) <- atts] sbvToSW st b) send True $ "(" ++ asrt ++ " " ++ addAnnotations atts (show sw) ++ ")" where asrt | isSoft = "assert-soft" | True = "assert" -- | Get the current configuration getConfig :: Query SMTConfig getConfig = queryConfig <$> getQueryState -- | Get the objectives getObjectives :: Query [Objective (SW, SW)] getObjectives = do State{rOptGoals} <- get io $ reverse <$> readIORef rOptGoals -- | Get the program getSBVPgm :: Query SBVPgm getSBVPgm = do State{spgm} <- get io $ readIORef spgm -- | Get the assertions put in via 'Data.SBV.sAssert' getSBVAssertions :: Query [(String, Maybe CallStack, SW)] getSBVAssertions = do State{rAsserts} <- get io $ reverse <$> readIORef rAsserts -- | Perform an arbitrary IO action. io :: IO a -> Query a io = liftIO -- | Sync-up the external solver with new context we have generated syncUpSolver :: Bool -> IncState -> Query () syncUpSolver afterAPush is = do cfg <- getConfig ls <- io $ do let swap (a, b) = (b, a) cmp (a, _) (b, _) = a `compare` b arrange (i, (at, rt, es)) = ((i, at, rt), es) inps <- reverse <$> readIORef (rNewInps is) ks <- readIORef (rNewKinds is) cnsts <- sortBy cmp . map swap . Map.toList <$> readIORef (rNewConsts is) arrs <- IMap.toAscList <$> readIORef (rNewArrs is) tbls <- map arrange . sortBy cmp . map swap . Map.toList <$> readIORef (rNewTbls is) uis <- Map.toAscList <$> readIORef (rNewUIs is) as <- readIORef (rNewAsgns is) return $ toIncSMTLib afterAPush cfg inps ks cnsts arrs tbls uis as cfg mapM_ (send True) $ mergeSExpr ls -- | Retrieve the query context getQueryState :: Query QueryState getQueryState = do state <- get mbQS <- io $ readIORef (queryState state) case mbQS of Nothing -> error $ unlines [ "" , "*** Data.SBV: Impossible happened: Query context required in a non-query mode." , "Please report this as a bug!" ] Just qs -> return qs -- | Modify the query state modifyQueryState :: (QueryState -> QueryState) -> Query () modifyQueryState f = do state <- get mbQS <- io $ readIORef (queryState state) case mbQS of Nothing -> error $ unlines [ "" , "*** Data.SBV: Impossible happened: Query context required in a non-query mode." , "Please report this as a bug!" ] Just qs -> let fqs = f qs in fqs `seq` io $ writeIORef (queryState state) $ Just fqs -- | Execute in a new incremental context inNewContext :: (State -> IO a) -> Query a inNewContext act = do st <- get (is, r) <- io $ withNewIncState st act mbQS <- io . readIORef . queryState $ st let afterAPush = case mbQS of Nothing -> False Just qs -> isJust (queryTblArrPreserveIndex qs) syncUpSolver afterAPush is return r -- | Similar to 'freshVar', except creates unnamed variable. freshVar_ :: forall a. SymWord a => Query (SBV a) freshVar_ = inNewContext $ fmap SBV . svMkSymVar (Just EX) k Nothing where k = kindOf (undefined :: a) -- | Create a fresh variable in query mode. You should prefer -- creating input variables using 'Data.SBV.sBool', 'Data.SBV.sInt32', etc., which act -- as primary inputs to the model and can be existential or universal. -- Use 'freshVar' only in query mode for anonymous temporary variables. -- Such variables are always existential. Note that 'freshVar' should hardly be -- needed: Your input variables and symbolic expressions should suffice for -- most major use cases. freshVar :: forall a. SymWord a => String -> Query (SBV a) freshVar nm = inNewContext $ fmap SBV . svMkSymVar (Just EX) k (Just nm) where k = kindOf (undefined :: a) -- | Similar to 'freshArray', except creates unnamed array. freshArray_ :: (SymArray array, HasKind a, HasKind b) => Maybe (SBV b) -> Query (array a b) freshArray_ = mkFreshArray Nothing -- | Create a fresh array in query mode. Again, you should prefer -- creating arrays before the queries start using 'newArray', but this -- method can come in handy in occasional cases where you need a new array -- after you start the query based interaction. freshArray :: (SymArray array, HasKind a, HasKind b) => String -> Maybe (SBV b) -> Query (array a b) freshArray nm = mkFreshArray (Just nm) -- | Creating arrays, internal use only. mkFreshArray :: (SymArray array, HasKind a, HasKind b) => Maybe String -> Maybe (SBV b) -> Query (array a b) mkFreshArray mbNm mbVal = inNewContext $ newArrayInState mbNm mbVal -- | If 'verbose' is 'True', print the message, useful for debugging messages -- in custom queries. Note that 'redirectVerbose' will be respected: If a -- file redirection is given, the output will go to the file. queryDebug :: [String] -> Query () queryDebug msgs = do QueryState{queryConfig} <- getQueryState io $ debug queryConfig msgs -- | Send a string to the solver, and return the response ask :: String -> Query String ask s = do QueryState{queryAsk, queryTimeOutValue} <- getQueryState case queryTimeOutValue of Nothing -> queryDebug ["[SEND] " `alignPlain` s] Just i -> queryDebug ["[SEND, TimeOut: " ++ showTimeoutValue i ++ "] " `alignPlain` s] r <- io $ queryAsk queryTimeOutValue s queryDebug ["[RECV] " `alignPlain` r] return r -- | Send a string to the solver, and return the response. Except, if the response -- is one of the "ignore" ones, keep querying. askIgnoring :: String -> [String] -> Query String askIgnoring s ignoreList = do QueryState{queryAsk, queryRetrieveResponse, queryTimeOutValue} <- getQueryState case queryTimeOutValue of Nothing -> queryDebug ["[SEND] " `alignPlain` s] Just i -> queryDebug ["[SEND, TimeOut: " ++ showTimeoutValue i ++ "] " `alignPlain` s] r <- io $ queryAsk queryTimeOutValue s queryDebug ["[RECV] " `alignPlain` r] let loop currentResponse | currentResponse `notElem` ignoreList = return currentResponse | True = do queryDebug ["[WARN] Previous response is explicitly ignored, beware!"] newResponse <- io $ queryRetrieveResponse queryTimeOutValue queryDebug ["[RECV] " `alignPlain` newResponse] loop newResponse loop r -- | Send a string to the solver. If the first argument is 'True', we will require -- a "success" response as well. Otherwise, we'll fire and forget. send :: Bool -> String -> Query () send requireSuccess s = do QueryState{queryAsk, querySend, queryConfig, queryTimeOutValue} <- getQueryState if requireSuccess && supportsCustomQueries (capabilities (solver queryConfig)) then do r <- io $ queryAsk queryTimeOutValue s case words r of ["success"] -> queryDebug ["[GOOD] " `alignPlain` s] _ -> do case queryTimeOutValue of Nothing -> queryDebug ["[FAIL] " `alignPlain` s] Just i -> queryDebug [("[FAIL, TimeOut: " ++ showTimeoutValue i ++ "] ") `alignPlain` s] let cmd = case words (dropWhile (\c -> isSpace c || isPunctuation c) s) of (c:_) -> c _ -> "Command" unexpected cmd s "success" Nothing r Nothing else io $ querySend queryTimeOutValue s -- fire and forget. if you use this, you're on your own! -- | Retrieve a responses from the solver until it produces a synchronization tag. We make the tag -- unique by attaching a time stamp, so no need to worry about getting the wrong tag unless it happens -- in the very same picosecond! We return multiple valid s-expressions till the solver responds with the tag. -- Should only be used for internal tasks or when we want to synchronize communications, and not on a -- regular basis! Use 'send'/'ask' for that purpose. This comes in handy, however, when solvers respond -- multiple times as in optimization for instance, where we both get a check-sat answer and some objective values. retrieveResponse :: String -> Maybe Int -> Query [String] retrieveResponse userTag mbTo = do ts <- io (show <$> getZonedTime) let synchTag = show $ userTag ++ " (at: " ++ ts ++ ")" cmd = "(echo " ++ synchTag ++ ")" queryDebug ["[SYNC] Attempting to synchronize with tag: " ++ synchTag] send False cmd QueryState{queryRetrieveResponse} <- getQueryState let loop sofar = do s <- io $ queryRetrieveResponse mbTo -- strictly speaking SMTLib requires solvers to print quotes around -- echo'ed strings, but they don't always do. Accommodate for that -- here, though I wish we didn't have to. if s == synchTag || show s == synchTag then do queryDebug ["[SYNC] Synchronization achieved using tag: " ++ synchTag] return $ reverse sofar else do queryDebug ["[RECV] " `alignPlain` s] loop (s : sofar) loop [] -- | A class which allows for sexpr-conversion to values class SMTValue a where sexprToVal :: SExpr -> Maybe a default sexprToVal :: Read a => SExpr -> Maybe a sexprToVal (ECon c) = case reads c of [(v, "")] -> Just v _ -> Nothing sexprToVal _ = Nothing -- | Integral values are easy to convert: fromIntegralToVal :: Integral a => SExpr -> Maybe a fromIntegralToVal (ENum (i, _)) = Just $ fromIntegral i fromIntegralToVal _ = Nothing instance SMTValue Int8 where sexprToVal = fromIntegralToVal instance SMTValue Int16 where sexprToVal = fromIntegralToVal instance SMTValue Int32 where sexprToVal = fromIntegralToVal instance SMTValue Int64 where sexprToVal = fromIntegralToVal instance SMTValue Word8 where sexprToVal = fromIntegralToVal instance SMTValue Word16 where sexprToVal = fromIntegralToVal instance SMTValue Word32 where sexprToVal = fromIntegralToVal instance SMTValue Word64 where sexprToVal = fromIntegralToVal instance SMTValue Integer where sexprToVal = fromIntegralToVal instance SMTValue Float where sexprToVal (EFloat f) = Just f sexprToVal (ENum (v, _)) = Just (fromIntegral v) sexprToVal _ = Nothing instance SMTValue Double where sexprToVal (EDouble f) = Just f sexprToVal (ENum (v, _)) = Just (fromIntegral v) sexprToVal _ = Nothing instance SMTValue Bool where sexprToVal (ENum (1, _)) = Just True sexprToVal (ENum (0, _)) = Just False sexprToVal _ = Nothing instance SMTValue AlgReal where sexprToVal (EReal a) = Just a sexprToVal (ENum (v, _)) = Just (fromIntegral v) sexprToVal _ = Nothing instance SMTValue Char where sexprToVal (ENum (i, _)) = Just (chr (fromIntegral i)) sexprToVal _ = Nothing instance (SMTValue a, Typeable a) => SMTValue [a] where -- NB. The conflation of String/[Char] forces us to have this bastard case here -- with unsafeCoerce to cast back to a regular string. This is unfortunate, -- and the ice is thin here. But it works, and is much better than a plethora -- of overlapping instances. Sigh. sexprToVal (ECon s) | isKString (undefined :: [a]) && length s >= 2 && head s == '"' && last s == '"' = Just $ map unsafeCoerce s' | True = Just $ map (unsafeCoerce . c2w8) s' where s' = qfsToString (tail (init s)) c2w8 :: Char -> Word8 c2w8 = fromIntegral . ord -- Otherwise we have a good old sequence, just parse it simply: sexprToVal (EApp [ECon "seq.++", l, r]) = do l' <- sexprToVal l r' <- sexprToVal r return $ l' ++ r' sexprToVal (EApp [ECon "seq.unit", a]) = do a' <- sexprToVal a return [a'] sexprToVal (EApp [ECon "as", ECon "seq.empty", _]) = return [] sexprToVal _ = Nothing -- | Get the value of a term. getValue :: SMTValue a => SBV a -> Query a getValue s = do sw <- inNewContext (`sbvToSW` s) let nm = show sw cmd = "(get-value (" ++ nm ++ "))" bad = unexpected "getValue" cmd "a model value" Nothing r <- ask cmd parse r bad $ \case EApp [EApp [ECon o, v]] | o == show sw -> case sexprToVal v of Nothing -> bad r Nothing Just c -> return c _ -> bad r Nothing -- | Get the value of an uninterpreted sort, as a String getUninterpretedValue :: HasKind a => SBV a -> Query String getUninterpretedValue s = case kindOf s of KUserSort _ (Left _) -> do sw <- inNewContext (`sbvToSW` s) let nm = show sw cmd = "(get-value (" ++ nm ++ "))" bad = unexpected "getValue" cmd "a model value" Nothing r <- ask cmd parse r bad $ \case EApp [EApp [ECon o, ECon v]] | o == show sw -> return v _ -> bad r Nothing k -> error $ unlines ["" , "*** SBV.getUninterpretedValue: Called on an 'interpreted' kind" , "*** " , "*** Kind: " ++ show k , "*** Hint: Use 'getValue' to extract value for interpreted kinds." , "*** " , "*** Only truly uninterpreted sorts should be used with 'getUninterpretedValue.'" ] -- | Get the value of a term, but in CW form. Used internally. The model-index, in particular is extremely Z3 specific! getValueCWHelper :: Maybe Int -> SW -> Query CW getValueCWHelper mbi s = do let nm = show s k = kindOf s modelIndex = case mbi of Nothing -> "" Just i -> " :model_index " ++ show i cmd = "(get-value (" ++ nm ++ ")" ++ modelIndex ++ ")" bad = unexpected "getModel" cmd ("a value binding for kind: " ++ show k) Nothing r <- ask cmd parse r bad $ \case EApp [EApp [ECon v, val]] | v == nm -> case recoverKindedValue (kindOf s) val of Just cw -> return cw Nothing -> bad r Nothing _ -> bad r Nothing -- | Recover a given solver-printed value with a possible interpretation recoverKindedValue :: Kind -> SExpr -> Maybe CW recoverKindedValue k e = case e of ENum i | isIntegralLike -> Just $ mkConstCW k (fst i) ENum i | isChar k -> Just $ CW KChar (CWChar (chr (fromIntegral (fst i)))) EReal i | isReal k -> Just $ CW KReal (CWAlgReal i) EFloat i | isFloat k -> Just $ CW KFloat (CWFloat i) EDouble i | isDouble k -> Just $ CW KDouble (CWDouble i) ECon s | isString k -> Just $ CW KString (CWString (interpretString s)) ECon s | isUninterpreted k -> Just $ CW k (CWUserSort (getUIIndex k s, s)) _ | isList k -> Just $ CW k (CWList (interpretList e)) _ -> Nothing where isIntegralLike = or [f k | f <- [isBoolean, isBounded, isInteger, isReal, isFloat, isDouble]] getUIIndex (KUserSort _ (Right xs)) i = i `elemIndex` xs getUIIndex _ _ = Nothing stringLike xs = length xs >= 2 && head xs == '"' && last xs == '"' -- Make sure strings are really strings interpretString xs | not (stringLike xs) = error $ "Expected a string constant with quotes, received: <" ++ xs ++ ">" | True = qfsToString $ tail (init xs) isStringSequence (KList (KBounded _ 8)) = True isStringSequence _ = False -- Lists are tricky since z3 prints the 8-bit variants as strings. See: interpretList (ECon s) | isStringSequence k && stringLike s = map (CWInteger . fromIntegral . ord) $ interpretString s interpretList topExpr = walk topExpr where walk (EApp [ECon "as", ECon "seq.empty", _]) = [] walk (EApp [ECon "seq.unit", v]) = case recoverKindedValue ek v of Just w -> [cwVal w] Nothing -> error $ "Cannot parse a sequence item of kind " ++ show ek ++ " from: " ++ show v ++ extra v walk (EApp [ECon "seq.++", pre, post]) = walk pre ++ walk post walk cur = error $ "Expected a sequence constant, but received: " ++ show cur ++ extra cur extra cur | show cur == t = "" | True = "\nWhile parsing: " ++ t where t = show topExpr ek = case k of KList ik -> ik _ -> error $ "Impossible: Expected a sequence kind, bug got: " ++ show k -- | Get the value of a term. If the kind is Real and solver supports decimal approximations, -- we will "squash" the representations. getValueCW :: Maybe Int -> SW -> Query CW getValueCW mbi s | kindOf s /= KReal = getValueCWHelper mbi s | True = do cfg <- getConfig if not (supportsApproxReals (capabilities (solver cfg))) then getValueCWHelper mbi s else do send True "(set-option :pp.decimal false)" rep1 <- getValueCWHelper mbi s send True "(set-option :pp.decimal true)" send True $ "(set-option :pp.decimal_precision " ++ show (printRealPrec cfg) ++ ")" rep2 <- getValueCWHelper mbi s let bad = unexpected "getValueCW" "get-value" ("a real-valued binding for " ++ show s) Nothing (show (rep1, rep2)) Nothing case (rep1, rep2) of (CW KReal (CWAlgReal a), CW KReal (CWAlgReal b)) -> return $ CW KReal (CWAlgReal (mergeAlgReals ("Cannot merge real-values for " ++ show s) a b)) _ -> bad -- | Check for satisfiability. checkSat :: Query CheckSatResult checkSat = do cfg <- getConfig checkSatUsing $ satCmd cfg -- | Check for satisfiability with a custom check-sat-using command. checkSatUsing :: String -> Query CheckSatResult checkSatUsing cmd = do let bad = unexpected "checkSat" cmd "one of sat/unsat/unknown" Nothing -- Sigh.. Ignore some of the pesky warnings. We only do it as an exception here. ignoreList = ["WARNING: optimization with quantified constraints is not supported"] r <- askIgnoring cmd ignoreList parse r bad $ \case ECon "sat" -> return Sat ECon "unsat" -> return Unsat ECon "unknown" -> return Unk _ -> bad r Nothing -- | What are the top level inputs? Trackers are returned as top level existentials getQuantifiedInputs :: Query [(Quantifier, NamedSymVar)] getQuantifiedInputs = do State{rinps} <- get (rQinps, rTrackers) <- liftIO $ readIORef rinps let qinps = reverse rQinps trackers = map (EX,) $ reverse rTrackers -- separate the existential prefix, which will go first (preQs, postQs) = span (\(q, _) -> q == EX) qinps return $ preQs ++ trackers ++ postQs -- | Get observables, i.e., those explicitly labeled by the user with a call to 'Data.SBV.observe'. getObservables :: Query [(String, SW)] getObservables = do State{rObservables} <- get rObs <- liftIO $ readIORef rObservables return $ reverse rObs -- | Repeatedly issue check-sat, after refuting the previous model. -- The bool is true if the model is unique upto prefix existentials. getAllSatResult :: Query (Bool, Bool, [SMTResult]) getAllSatResult = do queryDebug ["*** Checking Satisfiability, all solutions.."] cfg <- getConfig State{rUsedKinds} <- get ki <- liftIO $ readIORef rUsedKinds qinps <- getQuantifiedInputs let usorts = [s | us@(KUserSort s _) <- Set.toList ki, isFree us] unless (null usorts) $ queryDebug [ "*** SBV.allSat: Uninterpreted sorts present: " ++ unwords usorts , "*** SBV will use equivalence classes to generate all-satisfying instances." ] let vars :: [(SVal, NamedSymVar)] vars = let allModelInputs = takeWhile ((/= ALL) . fst) qinps sortByNodeId :: [NamedSymVar] -> [NamedSymVar] sortByNodeId = sortBy (compare `on` (\(SW _ n, _) -> n)) mkSVal :: NamedSymVar -> (SVal, NamedSymVar) mkSVal nm@(sw, _) = (SVal (kindOf sw) (Right (cache (const (return sw)))), nm) in map mkSVal $ sortByNodeId [nv | (_, nv@(_, n)) <- allModelInputs, not (isNonModelVar cfg n)] -- If we have any universals, then the solutions are unique upto prefix existentials. w = ALL `elem` map fst qinps (sc, ms) <- loop vars cfg return (sc, w, reverse ms) where isFree (KUserSort _ (Left _)) = True isFree _ = False loop vars cfg = go (1::Int) [] where go :: Int -> [SMTResult] -> Query (Bool, [SMTResult]) go !cnt sofar | Just maxModels <- allSatMaxModelCount cfg, cnt > maxModels = do queryDebug ["*** Maximum model count request of " ++ show maxModels ++ " reached, stopping the search."] return (True, sofar) | True = do queryDebug ["Looking for solution " ++ show cnt] cs <- checkSat case cs of Unsat -> return (False, sofar) Unk -> do queryDebug ["*** Solver returned unknown, terminating query."] return (False, sofar) Sat -> do assocs <- mapM (\(sval, (sw, n)) -> do cw <- getValueCW Nothing sw return (n, (sval, cw))) vars let m = Satisfiable cfg SMTModel { modelObjectives = [] , modelAssocs = [(n, cw) | (n, (_, cw)) <- assocs] } (interpreteds, uninterpreteds) = partition (not . isFree . kindOf . fst) (map snd assocs) -- For each "interpreted" variable, figure out the model equivalence -- NB. When the kind is floating, we *have* to be careful, since +/- zero, and NaN's -- and equality don't get along! interpretedEqs :: [SVal] interpretedEqs = [mkNotEq (kindOf sv) sv (SVal (kindOf sv) (Left cw)) | (sv, cw) <- interpreteds] where mkNotEq k a b | isDouble k || isFloat k = svNot (a `fpNotEq` b) | True = a `svNotEqual` b fpNotEq a b = SVal KBool $ Right $ cache r where r st = do swa <- svToSW st a swb <- svToSW st b newExpr st KBool (SBVApp (IEEEFP FP_ObjEqual) [swa, swb]) -- For each "uninterpreted" variable, use equivalence class uninterpretedEqs :: [SVal] uninterpretedEqs = concatMap pwDistinct -- Assert that they are pairwise distinct . filter (\l -> length l > 1) -- Only need this class if it has at least two members . map (map fst) -- throw away values, we only need svals . groupBy ((==) `on` snd) -- make sure they belong to the same sort and have the same value . sortOn snd -- sort them according to their CW (i.e., sort/value) $ uninterpreteds where pwDistinct :: [SVal] -> [SVal] pwDistinct ss = [x `svNotEqual` y | (x:ys) <- tails ss, y <- ys] eqs = interpretedEqs ++ uninterpretedEqs disallow = case eqs of [] -> Nothing _ -> Just $ SBV $ foldr1 svOr eqs let resultsSoFar = m : sofar -- make sure there's some var. This happens! 'allSat true' is the pathetic example. case disallow of Nothing -> return (False, resultsSoFar) Just d -> do constrain d go (cnt+1) resultsSoFar -- | Retrieve the set of unsatisfiable assumptions, following a call to 'Data.SBV.Control.checkSatAssumingWithUnsatisfiableSet'. Note that -- this function isn't exported to the user, but rather used internally. The user simple calls 'Data.SBV.Control.checkSatAssumingWithUnsatisfiableSet'. getUnsatAssumptions :: [String] -> [(String, a)] -> Query [a] getUnsatAssumptions originals proxyMap = do let cmd = "(get-unsat-assumptions)" bad = unexpected "getUnsatAssumptions" cmd "a list of unsatisfiable assumptions" $ Just [ "Make sure you use:" , "" , " setOption $ ProduceUnsatAssumptions True" , "" , "to make sure the solver is ready for producing unsat assumptions," , "and that there is a model by first issuing a 'checkSat' call." ] fromECon (ECon s) = Just s fromECon _ = Nothing r <- ask cmd -- If unsat-cores are enabled, z3 might end-up printing an assumption that wasn't -- in the original list of assumptions for `check-sat-assuming`. So, we walk over -- and ignore those that weren't in the original list, and put a warning for those -- we couldn't find. let walk [] sofar = return $ reverse sofar walk (a:as) sofar = case a `lookup` proxyMap of Just v -> walk as (v:sofar) Nothing -> do queryDebug [ "*** In call to 'getUnsatAssumptions'" , "***" , "*** Unexpected assumption named: " ++ show a , "*** Was expecting one of : " ++ show originals , "***" , "*** This can happen if unsat-cores are also enabled. Ignoring." ] walk as sofar parse r bad $ \case EApp es | Just xs <- mapM fromECon es -> walk xs [] _ -> bad r Nothing -- | Timeout a query action, typically a command call to the underlying SMT solver. -- The duration is in microseconds (@1\/10^6@ seconds). If the duration -- is negative, then no timeout is imposed. When specifying long timeouts, be careful not to exceed -- @maxBound :: Int@. (On a 64 bit machine, this bound is practically infinite. But on a 32 bit -- machine, it corresponds to about 36 minutes!) -- -- Semantics: The call @timeout n q@ causes the timeout value to be applied to all interactive calls that take place -- as we execute the query @q@. That is, each call that happens during the execution of @q@ gets a separate -- time-out value, as opposed to one timeout value that limits the whole query. This is typically the intended behavior. -- It is advisible to apply this combinator to calls that involve a single call to the solver for -- finer control, as opposed to an entire set of interactions. However, different use cases might call for different scenarios. -- -- If the solver responds within the time-out specified, then we continue as usual. However, if the backend solver times-out -- using this mechanism, there is no telling what the state of the solver will be. Thus, we raise an error in this case. timeout :: Int -> Query a -> Query a timeout n q = do modifyQueryState (\qs -> qs {queryTimeOutValue = Just n}) r <- q modifyQueryState (\qs -> qs {queryTimeOutValue = Nothing}) return r -- | Bail out if a parse goes bad parse :: String -> (String -> Maybe [String] -> a) -> (SExpr -> a) -> a parse r fCont sCont = case parseSExpr r of Left e -> fCont r (Just [e]) Right res -> sCont res -- | Bail out if we don't get what we expected unexpected :: String -> String -> String -> Maybe [String] -> String -> Maybe [String] -> Query a unexpected ctx sent expected mbHint received mbReason = do -- empty the response channel first extras <- retrieveResponse "terminating upon unexpected response" (Just 5000000) cfg <- getConfig let exc = SBVException { sbvExceptionDescription = "Unexpected response from the solver, context: " ++ ctx , sbvExceptionSent = Just sent , sbvExceptionExpected = Just expected , sbvExceptionReceived = Just received , sbvExceptionStdOut = Just $ unlines extras , sbvExceptionStdErr = Nothing , sbvExceptionExitCode = Nothing , sbvExceptionConfig = cfg , sbvExceptionReason = mbReason , sbvExceptionHint = mbHint } io $ C.throwIO exc -- | Convert a query result to an SMT Problem runProofOn :: SBVRunMode -> [String] -> Result -> SMTProblem runProofOn rm comments res@(Result ki _qcInfo _observables _codeSegs is consts tbls arrs uis axs pgm cstrs _assertions outputs) = let (config, isSat, isSafe, isSetup) = case rm of SMTMode stage s c -> (c, s, isSafetyCheckingIStage stage, isSetupIStage stage) _ -> error $ "runProofOn: Unexpected run mode: " ++ show rm flipQ (ALL, x) = (EX, x) flipQ (EX, x) = (ALL, x) skolemize :: [(Quantifier, NamedSymVar)] -> [Either SW (SW, [SW])] skolemize quants = go quants ([], []) where go [] (_, sofar) = reverse sofar go ((ALL, (v, _)):rest) (us, sofar) = go rest (v:us, Left v : sofar) go ((EX, (v, _)):rest) (us, sofar) = go rest (us, Right (v, reverse us) : sofar) qinps = if isSat then fst is else map flipQ (fst is) skolemMap = skolemize qinps o | isSafe = trueSW | True = case outputs of [] | isSetup -> trueSW [so] -> case so of SW KBool _ -> so _ -> error $ unlines [ "Impossible happened, non-boolean output: " ++ show so , "Detected while generating the trace:\n" ++ show res ] os -> error $ unlines [ "User error: Multiple output values detected: " ++ show os , "Detected while generating the trace:\n" ++ show res , "*** Check calls to \"output\", they are typically not needed!" ] in SMTProblem { smtLibPgm = toSMTLib config ki isSat comments is skolemMap consts tbls arrs uis axs pgm cstrs o } -- | Execute a query executeQuery :: QueryContext -> Query a -> Symbolic a executeQuery queryContext (Query userQuery) = do st <- R.ask rm <- liftIO $ readIORef (runMode st) -- If we're doing an external query, then we cannot allow quantifiers to be present. Why? -- Consider: -- -- issue = do x :: SBool <- forall_ -- y :: SBool <- exists_ -- constrain y -- query $ do checkSat -- (,) <$> getValue x <*> getValue y -- -- This is the (simplified/annotated SMTLib we would generate:) -- -- (declare-fun s1 (Bool) Bool) ; s1 is the function that corresponds to the skolemized 'y' -- (assert (forall ((s0 Bool)) ; s0 is 'x' -- (s1 s0))) ; s1 applied to s0 is the actual 'y' -- (check-sat) -- (get-value (s0)) ; s0 simply not visible here -- (get-value (s1)) ; s1 is visible, but only via 's1 s0', so it is also not available. -- -- And that would be terrible! The scoping rules of our "quantified" variables and how they map to -- SMTLib is just not compatible. This is a historical design issue, but too late at this point. (We -- should've never allowed general quantification like this, but only in limited contexts.) -- -- So, we check if this is an external-query, and if there are quantified variables. If so, we -- cowardly refuse to continue. For details, see: () <- liftIO $ case queryContext of QueryInternal -> return () -- we're good, internal usages don't mess with scopes QueryExternal -> do (userInps, _) <- readIORef (rinps st) let badInps = reverse [n | (ALL, (_, n)) <- userInps] case badInps of [] -> return () _ -> let plu | length badInps > 1 = "s require" | True = " requires" in error $ unlines [ "" , "*** Data.SBV: Unsupported query call in the presence of quantified inputs." , "***" , "*** The following variable" ++ plu ++ " explicit quantification: " , "***" , "*** " ++ intercalate ", " badInps , "***" , "*** While quantification and queries can co-exist in principle, SBV currently" , "*** does not support this scenario. Avoid using quantifiers with user queries" , "*** if possible. Please do get in touch if your use case does require such" , "*** a feature to see how we can accommodate such scenarios." ] case rm of -- Transitioning from setup SMTMode stage isSAT cfg | not (isRunIStage stage) -> liftIO $ do let backend = engine (solver cfg) res <- extractSymbolicSimulationState st setOpts <- reverse <$> readIORef (rSMTOptions st) let SMTProblem{smtLibPgm} = runProofOn rm [] res cfg' = cfg { solverSetOptions = solverSetOptions cfg ++ setOpts } pgm = smtLibPgm cfg' writeIORef (runMode st) $ SMTMode IRun isSAT cfg backend cfg' st (show pgm) $ evalStateT userQuery -- Already in a query, in theory we can just continue, but that causes use-case issues -- so we reject it. TODO: Review if we should actually support this. The issue arises with -- expressions like this: -- -- In the following t0's output doesn't get recorded, as the output call is too late when we get -- here. (The output field isn't "incremental.") So, t0/t1 behave differently! -- -- t0 = satWith z3{verbose=True, transcript=Just "t.smt2"} $ query (return (false::SBool)) -- t1 = satWith z3{verbose=True, transcript=Just "t.smt2"} $ ((return (false::SBool)) :: Predicate) -- -- Also, not at all clear what it means to go in an out of query mode: -- -- r = runSMTWith z3{verbose=True} $ do -- a' <- sInteger "a" -- -- (a, av) <- query $ do _ <- checkSat -- av <- getValue a' -- return (a', av) -- -- liftIO $ putStrLn $ "Got: " ++ show av -- -- constrain $ a .> literal av + 1 -- Cant' do this since we're "out" of query. Sigh. -- -- bv <- query $ do constrain $ a .> literal av + 1 -- _ <- checkSat -- getValue a -- -- return $ a' .== a' + 1 -- -- This would be one possible implementation, alas it has the problems above: -- -- SMTMode IRun _ _ -> liftIO $ evalStateT userQuery st -- -- So, we just reject it. SMTMode IRun _ _ -> error $ unlines [ "" , "*** Data.SBV: Unsupported nested query is detected." , "***" , "*** Please group your queries into one block. Note that this" , "*** can also arise if you have a call to 'query' not within 'runSMT'" , "*** For instance, within 'sat'/'prove' calls with custom user queries." , "*** The solution is to do the sat/prove part in the query directly." , "***" , "*** While multiple/nested queries should not be necessary in general," , "*** please do get in touch if your use case does require such a feature," , "*** to see how we can accommodate such scenarios." ] -- Otherwise choke! m -> error $ unlines [ "" , "*** Data.SBV: Invalid query call." , "***" , "*** Current mode: " ++ show m , "***" , "*** Query calls are only valid within runSMT/runSMTWith calls" ] {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/Data/SBV/Core/0000755000000000000000000000000013405536617012631 5ustar0000000000000000sbv-7.13/Data/SBV/Core/AlgReals.hs0000644000000000000000000002717413405536617014672 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Core.AlgReals -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Algrebraic reals in Haskell. ----------------------------------------------------------------------------- {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeSynonymInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.SBV.Core.AlgReals ( AlgReal(..) , AlgRealPoly(..) , mkPolyReal , algRealToSMTLib2 , algRealToHaskell , mergeAlgReals , isExactRational , algRealStructuralEqual , algRealStructuralCompare) where import Data.List (sortBy, isPrefixOf, partition) import Data.Ratio ((%), numerator, denominator) import Data.Function (on) import System.Random import Test.QuickCheck (Arbitrary(..)) -- | Algebraic reals. Note that the representation is left abstract. We represent -- rational results explicitly, while the roots-of-polynomials are represented -- implicitly by their defining equation data AlgReal = AlgRational Bool Rational -- ^ bool says it's exact (i.e., SMT-solver did not return it with ? at the end.) | AlgPolyRoot (Integer, AlgRealPoly) (Maybe String) -- ^ which root of this polynomial and an approximate decimal representation with given precision, if available -- | Check wheter a given argument is an exact rational isExactRational :: AlgReal -> Bool isExactRational (AlgRational True _) = True isExactRational _ = False -- | A univariate polynomial, represented simply as a -- coefficient list. For instance, "5x^3 + 2x - 5" is -- represented as [(5, 3), (2, 1), (-5, 0)] newtype AlgRealPoly = AlgRealPoly [(Integer, Integer)] deriving (Eq, Ord) -- | Construct a poly-root real with a given approximate value (either as a decimal, or polynomial-root) mkPolyReal :: Either (Bool, String) (Integer, [(Integer, Integer)]) -> AlgReal mkPolyReal (Left (exact, str)) = case (str, break (== '.') str) of ("", (_, _)) -> AlgRational exact 0 (_, (x, '.':y)) -> AlgRational exact (read (x++y) % (10 ^ length y)) (_, (x, _)) -> AlgRational exact (read x % 1) mkPolyReal (Right (k, coeffs)) = AlgPolyRoot (k, AlgRealPoly (normalize coeffs)) Nothing where normalize :: [(Integer, Integer)] -> [(Integer, Integer)] normalize = merge . sortBy (flip compare `on` snd) merge [] = [] merge [x] = [x] merge ((a, b):r@((c, d):xs)) | b == d = merge ((a+c, b):xs) | True = (a, b) : merge r instance Show AlgRealPoly where show (AlgRealPoly xs) = chkEmpty (join (concat [term p | p@(_, x) <- xs, x /= 0])) ++ " = " ++ show c where c = -1 * head ([k | (k, 0) <- xs] ++ [0]) term ( 0, _) = [] term ( 1, 1) = [ "x"] term ( 1, p) = [ "x^" ++ show p] term (-1, 1) = ["-x"] term (-1, p) = ["-x^" ++ show p] term (k, 1) = [show k ++ "x"] term (k, p) = [show k ++ "x^" ++ show p] join [] = "" join (k:ks) = k ++ s ++ join ks where s = case ks of [] -> "" (y:_) | "-" `isPrefixOf` y -> "" | "+" `isPrefixOf` y -> "" | True -> "+" chkEmpty s = if null s then "0" else s instance Show AlgReal where show (AlgRational exact a) = showRat exact a show (AlgPolyRoot (i, p) mbApprox) = "root(" ++ show i ++ ", " ++ show p ++ ")" ++ maybe "" app mbApprox where app v | last v == '?' = " = " ++ init v ++ "..." | True = " = " ++ v -- lift unary op through an exact rational, otherwise bail lift1 :: String -> (Rational -> Rational) -> AlgReal -> AlgReal lift1 _ o (AlgRational e a) = AlgRational e (o a) lift1 nm _ a = error $ "AlgReal." ++ nm ++ ": unsupported argument: " ++ show a -- lift binary op through exact rationals, otherwise bail lift2 :: String -> (Rational -> Rational -> Rational) -> AlgReal -> AlgReal -> AlgReal lift2 _ o (AlgRational True a) (AlgRational True b) = AlgRational True (a `o` b) lift2 nm _ a b = error $ "AlgReal." ++ nm ++ ": unsupported arguments: " ++ show (a, b) -- The idea in the instances below is that we will fully support operations -- on "AlgRational" AlgReals, but leave everything else undefined. When we are -- on the Haskell side, the AlgReal's are *not* reachable. They only represent -- return values from SMT solvers, which we should *not* need to manipulate. instance Eq AlgReal where AlgRational True a == AlgRational True b = a == b a == b = error $ "AlgReal.==: unsupported arguments: " ++ show (a, b) instance Ord AlgReal where AlgRational True a `compare` AlgRational True b = a `compare` b a `compare` b = error $ "AlgReal.compare: unsupported arguments: " ++ show (a, b) -- | Structural equality for AlgReal; used when constants are Map keys algRealStructuralEqual :: AlgReal -> AlgReal -> Bool AlgRational a b `algRealStructuralEqual` AlgRational c d = (a, b) == (c, d) AlgPolyRoot a b `algRealStructuralEqual` AlgPolyRoot c d = (a, b) == (c, d) _ `algRealStructuralEqual` _ = False -- | Structural comparisons for AlgReal; used when constants are Map keys algRealStructuralCompare :: AlgReal -> AlgReal -> Ordering AlgRational a b `algRealStructuralCompare` AlgRational c d = (a, b) `compare` (c, d) AlgRational _ _ `algRealStructuralCompare` AlgPolyRoot _ _ = LT AlgPolyRoot _ _ `algRealStructuralCompare` AlgRational _ _ = GT AlgPolyRoot a b `algRealStructuralCompare` AlgPolyRoot c d = (a, b) `compare` (c, d) instance Num AlgReal where (+) = lift2 "+" (+) (*) = lift2 "*" (*) (-) = lift2 "-" (-) negate = lift1 "negate" negate abs = lift1 "abs" abs signum = lift1 "signum" signum fromInteger = AlgRational True . fromInteger -- | NB: Following the other types we have, we require `a/0` to be `0` for all a. instance Fractional AlgReal where (AlgRational True _) / (AlgRational True b) | b == 0 = 0 a / b = lift2 "/" (/) a b fromRational = AlgRational True instance Real AlgReal where toRational (AlgRational True v) = v toRational x = error $ "AlgReal.toRational: Argument cannot be represented as a rational value: " ++ algRealToHaskell x instance Random Rational where random g = (a % b', g'') where (a, g') = random g (b, g'') = random g' b' = if 0 < b then b else 1 - b -- ensures 0 < b randomR (l, h) g = (r * d + l, g'') where (b, g') = random g b' = if 0 < b then b else 1 - b -- ensures 0 < b (a, g'') = randomR (0, b') g' r = a % b' d = h - l instance Random AlgReal where random g = let (a, g') = random g in (AlgRational True a, g') randomR (AlgRational True l, AlgRational True h) g = let (a, g') = randomR (l, h) g in (AlgRational True a, g') randomR lh _ = error $ "AlgReal.randomR: unsupported bounds: " ++ show lh -- | Render an 'AlgReal' as an SMTLib2 value. Only supports rationals for the time being. algRealToSMTLib2 :: AlgReal -> String algRealToSMTLib2 (AlgRational True r) | m == 0 = "0.0" | m < 0 = "(- (/ " ++ show (abs m) ++ ".0 " ++ show n ++ ".0))" | True = "(/ " ++ show m ++ ".0 " ++ show n ++ ".0)" where (m, n) = (numerator r, denominator r) algRealToSMTLib2 r@(AlgRational False _) = error $ "SBV: Unexpected inexact rational to be converted to SMTLib2: " ++ show r algRealToSMTLib2 (AlgPolyRoot (i, AlgRealPoly xs) _) = "(root-obj (+ " ++ unwords (concatMap term xs) ++ ") " ++ show i ++ ")" where term (0, _) = [] term (k, 0) = [coeff k] term (1, 1) = ["x"] term (1, p) = ["(^ x " ++ show p ++ ")"] term (k, 1) = ["(* " ++ coeff k ++ " x)"] term (k, p) = ["(* " ++ coeff k ++ " (^ x " ++ show p ++ "))"] coeff n | n < 0 = "(- " ++ show (abs n) ++ ")" | True = show n -- | Render an 'AlgReal' as a Haskell value. Only supports rationals, since there is no corresponding -- standard Haskell type that can represent root-of-polynomial variety. algRealToHaskell :: AlgReal -> String algRealToHaskell (AlgRational True r) = "((" ++ show r ++ ") :: Rational)" algRealToHaskell r = error $ "SBV.algRealToHaskell: Unsupported argument: " ++ show r -- Try to show a rational precisely if we can, with finite number of -- digits. Otherwise, show it as a rational value. showRat :: Bool -> Rational -> String showRat exact r = p $ case f25 (denominator r) [] of Nothing -> show r -- bail out, not precisely representable with finite digits Just (noOfZeros, num) -> let present = length num in neg $ case noOfZeros `compare` present of LT -> let (b, a) = splitAt (present - noOfZeros) num in b ++ "." ++ if null a then "0" else a EQ -> "0." ++ num GT -> "0." ++ replicate (noOfZeros - present) '0' ++ num where p = if exact then id else (++ "...") neg = if r < 0 then ('-':) else id -- factor a number in 2's and 5's if possible -- If so, it'll return the number of digits after the zero -- to reach the next power of 10, and the numerator value scaled -- appropriately and shown as a string f25 :: Integer -> [Integer] -> Maybe (Int, String) f25 1 sofar = let (ts, fs) = partition (== 2) sofar [lts, lfs] = map length [ts, fs] noOfZeros = lts `max` lfs in Just (noOfZeros, show (abs (numerator r) * factor ts fs)) f25 v sofar = let (q2, r2) = v `quotRem` 2 (q5, r5) = v `quotRem` 5 in case (r2, r5) of (0, _) -> f25 q2 (2 : sofar) (_, 0) -> f25 q5 (5 : sofar) _ -> Nothing -- compute the next power of 10 we need to get to factor [] fs = product [2 | _ <- fs] factor ts [] = product [5 | _ <- ts] factor (_:ts) (_:fs) = factor ts fs -- | Merge the representation of two algebraic reals, one assumed to be -- in polynomial form, the other in decimal. Arguments can be the same -- kind, so long as they are both rationals and equivalent; if not there -- must be one that is precise. It's an error to pass anything -- else to this function! (Used in reconstructing SMT counter-example values with reals). mergeAlgReals :: String -> AlgReal -> AlgReal -> AlgReal mergeAlgReals _ f@(AlgRational exact r) (AlgPolyRoot kp Nothing) | exact = f | True = AlgPolyRoot kp (Just (showRat False r)) mergeAlgReals _ (AlgPolyRoot kp Nothing) f@(AlgRational exact r) | exact = f | True = AlgPolyRoot kp (Just (showRat False r)) mergeAlgReals _ f@(AlgRational e1 r1) s@(AlgRational e2 r2) | (e1, r1) == (e2, r2) = f | e1 = f | e2 = s mergeAlgReals m _ _ = error m -- Quickcheck instance instance Arbitrary AlgReal where arbitrary = AlgRational True `fmap` arbitrary sbv-7.13/Data/SBV/Core/Concrete.hs0000644000000000000000000003631713405536617014741 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Core.Concrete -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Operations on concrete values ----------------------------------------------------------------------------- module Data.SBV.Core.Concrete ( module Data.SBV.Core.Concrete ) where import Control.Monad (replicateM) import Data.Bits import System.Random (randomIO, randomRIO) import Data.Char (chr) import Data.List (isPrefixOf, intercalate) import Data.SBV.Core.Kind import Data.SBV.Core.AlgReals import Data.SBV.Utils.Numeric (fpIsEqualObjectH, fpCompareObjectH) -- | A constant value data CWVal = CWAlgReal !AlgReal -- ^ algebraic real | CWInteger !Integer -- ^ bit-vector/unbounded integer | CWFloat !Float -- ^ float | CWDouble !Double -- ^ double | CWChar !Char -- ^ character | CWString !String -- ^ string | CWList ![CWVal] -- ^ list | CWUserSort !(Maybe Int, String) -- ^ value of an uninterpreted/user kind. The Maybe Int shows index position for enumerations -- | Assing a rank to CW Values, this is structural and helps with ordering cwRank :: CWVal -> Int cwRank CWAlgReal {} = 0 cwRank CWInteger {} = 1 cwRank CWFloat {} = 2 cwRank CWDouble {} = 3 cwRank CWChar {} = 4 cwRank CWString {} = 5 cwRank CWList {} = 6 cwRank CWUserSort {} = 7 -- | Eq instance for CWVal. Note that we cannot simply derive Eq/Ord, since CWAlgReal doesn't have proper -- instances for these when values are infinitely precise reals. However, we do -- need a structural eq/ord for Map indexes; so define custom ones here: instance Eq CWVal where CWAlgReal a == CWAlgReal b = a `algRealStructuralEqual` b CWInteger a == CWInteger b = a == b CWFloat a == CWFloat b = a `fpIsEqualObjectH` b -- We don't want +0/-0 to be confused; and also we want NaN = NaN here! CWDouble a == CWDouble b = a `fpIsEqualObjectH` b -- ditto CWChar a == CWChar b = a == b CWString a == CWString b = a == b CWList a == CWList b = a == b CWUserSort a == CWUserSort b = a == b _ == _ = False -- | Ord instance for CWVal. Same comments as the 'Eq' instance why this cannot be derived. instance Ord CWVal where CWAlgReal a `compare` CWAlgReal b = a `algRealStructuralCompare` b CWInteger a `compare` CWInteger b = a `compare` b CWFloat a `compare` CWFloat b = a `fpCompareObjectH` b CWDouble a `compare` CWDouble b = a `fpCompareObjectH` b CWChar a `compare` CWChar b = a `compare` b CWString a `compare` CWString b = a `compare` b CWList a `compare` CWList b = a `compare` b CWUserSort a `compare` CWUserSort b = a `compare` b a `compare` b = cwRank a `compare` cwRank b -- | 'CW' represents a concrete word of a fixed size: -- For signed words, the most significant digit is considered to be the sign. data CW = CW { _cwKind :: !Kind , cwVal :: !CWVal } deriving (Eq, Ord) -- | A generalized CW allows for expressions involving infinite and epsilon values/intervals Used in optimization problems. data GeneralizedCW = ExtendedCW ExtCW | RegularCW CW -- | A simple expression type over extendent values, covering infinity, epsilon and intervals. data ExtCW = Infinite Kind -- infinity | Epsilon Kind -- epsilon | Interval ExtCW ExtCW -- closed interval | BoundedCW CW -- a bounded value (i.e., neither infinity, nor epsilon). Note that this cannot appear at top, but can appear as a sub-expr. | AddExtCW ExtCW ExtCW -- addition | MulExtCW ExtCW ExtCW -- multiplication -- | Kind instance for Extended CW instance HasKind ExtCW where kindOf (Infinite k) = k kindOf (Epsilon k) = k kindOf (Interval l _) = kindOf l kindOf (BoundedCW c) = kindOf c kindOf (AddExtCW l _) = kindOf l kindOf (MulExtCW l _) = kindOf l -- | Show instance, shows with the kind instance Show ExtCW where show = showExtCW True -- | Show an extended CW, with kind if required showExtCW :: Bool -> ExtCW -> String showExtCW = go False where go parens shk extCW = case extCW of Infinite{} -> withKind False "oo" Epsilon{} -> withKind False "epsilon" Interval l u -> withKind True $ '[' : showExtCW False l ++ " .. " ++ showExtCW False u ++ "]" BoundedCW c -> showCW shk c AddExtCW l r -> par $ withKind False $ add (go True False l) (go True False r) -- a few niceties here to grok -oo and -epsilon MulExtCW (BoundedCW (CW KUnbounded (CWInteger (-1)))) Infinite{} -> withKind False "-oo" MulExtCW (BoundedCW (CW KReal (CWAlgReal (-1)))) Infinite{} -> withKind False "-oo" MulExtCW (BoundedCW (CW KUnbounded (CWInteger (-1)))) Epsilon{} -> withKind False "-epsilon" MulExtCW (BoundedCW (CW KReal (CWAlgReal (-1)))) Epsilon{} -> withKind False "-epsilon" MulExtCW l r -> par $ withKind False $ mul (go True False l) (go True False r) where par v | parens = '(' : v ++ ")" | True = v withKind isInterval v | not shk = v | isInterval = v ++ " :: [" ++ showBaseKind (kindOf extCW) ++ "]" | True = v ++ " :: " ++ showBaseKind (kindOf extCW) add :: String -> String -> String add n v | "-" `isPrefixOf` v = n ++ " - " ++ tail v | True = n ++ " + " ++ v mul :: String -> String -> String mul n v = n ++ " * " ++ v -- | Is this a regular CW? isRegularCW :: GeneralizedCW -> Bool isRegularCW RegularCW{} = True isRegularCW ExtendedCW{} = False -- | 'Kind' instance for CW instance HasKind CW where kindOf (CW k _) = k -- | 'Kind' instance for generalized CW instance HasKind GeneralizedCW where kindOf (ExtendedCW e) = kindOf e kindOf (RegularCW c) = kindOf c -- | Are two CW's of the same type? cwSameType :: CW -> CW -> Bool cwSameType x y = kindOf x == kindOf y -- | Convert a CW to a Haskell boolean (NB. Assumes input is well-kinded) cwToBool :: CW -> Bool cwToBool x = cwVal x /= CWInteger 0 -- | Normalize a CW. Essentially performs modular arithmetic to make sure the -- value can fit in the given bit-size. Note that this is rather tricky for -- negative values, due to asymmetry. (i.e., an 8-bit negative number represents -- values in the range -128 to 127; thus we have to be careful on the negative side.) normCW :: CW -> CW normCW c@(CW (KBounded signed sz) (CWInteger v)) = c { cwVal = CWInteger norm } where norm | sz == 0 = 0 | signed = let rg = 2 ^ (sz - 1) in case divMod v rg of (a, b) | even a -> b (_, b) -> b - rg | True = v `mod` (2 ^ sz) normCW c@(CW KBool (CWInteger v)) = c { cwVal = CWInteger (v .&. 1) } normCW c = c -- | Constant False as a CW. We represent it using the integer value 0. falseCW :: CW falseCW = CW KBool (CWInteger 0) -- | Constant True as a CW. We represent it using the integer value 1. trueCW :: CW trueCW = CW KBool (CWInteger 1) -- | Lift a unary function through a CW liftCW :: (AlgReal -> b) -> (Integer -> b) -> (Float -> b) -> (Double -> b) -> (Char -> b) -> (String -> b) -> ((Maybe Int, String) -> b) -> ([CWVal] -> b) -> CW -> b liftCW f _ _ _ _ _ _ _ (CW _ (CWAlgReal v)) = f v liftCW _ f _ _ _ _ _ _ (CW _ (CWInteger v)) = f v liftCW _ _ f _ _ _ _ _ (CW _ (CWFloat v)) = f v liftCW _ _ _ f _ _ _ _ (CW _ (CWDouble v)) = f v liftCW _ _ _ _ f _ _ _ (CW _ (CWChar v)) = f v liftCW _ _ _ _ _ f _ _ (CW _ (CWString v)) = f v liftCW _ _ _ _ _ _ f _ (CW _ (CWUserSort v)) = f v liftCW _ _ _ _ _ _ _ f (CW _ (CWList v)) = f v -- | Lift a binary function through a CW liftCW2 :: (AlgReal -> AlgReal -> b) -> (Integer -> Integer -> b) -> (Float -> Float -> b) -> (Double -> Double -> b) -> (Char -> Char -> b) -> (String -> String -> b) -> ([CWVal] -> [CWVal] -> b) -> ((Maybe Int, String) -> (Maybe Int, String) -> b) -> CW -> CW -> b liftCW2 r i f d c s u v x y = case (cwVal x, cwVal y) of (CWAlgReal a, CWAlgReal b) -> r a b (CWInteger a, CWInteger b) -> i a b (CWFloat a, CWFloat b) -> f a b (CWDouble a, CWDouble b) -> d a b (CWChar a, CWChar b) -> c a b (CWString a, CWString b) -> s a b (CWList a, CWList b) -> u a b (CWUserSort a, CWUserSort b) -> v a b _ -> error $ "SBV.liftCW2: impossible, incompatible args received: " ++ show (x, y) -- | Map a unary function through a CW. mapCW :: (AlgReal -> AlgReal) -> (Integer -> Integer) -> (Float -> Float) -> (Double -> Double) -> (Char -> Char) -> (String -> String) -> ((Maybe Int, String) -> (Maybe Int, String)) -> CW -> CW mapCW r i f d c s u x = normCW $ CW (kindOf x) $ case cwVal x of CWAlgReal a -> CWAlgReal (r a) CWInteger a -> CWInteger (i a) CWFloat a -> CWFloat (f a) CWDouble a -> CWDouble (d a) CWChar a -> CWChar (c a) CWString a -> CWString (s a) CWUserSort a -> CWUserSort (u a) CWList{} -> error "Data.SBV.mapCW: Unexpected call through mapCW with lists!" -- | Map a binary function through a CW. mapCW2 :: (AlgReal -> AlgReal -> AlgReal) -> (Integer -> Integer -> Integer) -> (Float -> Float -> Float) -> (Double -> Double -> Double) -> (Char -> Char -> Char) -> (String -> String -> String) -> ((Maybe Int, String) -> (Maybe Int, String) -> (Maybe Int, String)) -> CW -> CW -> CW mapCW2 r i f d c s u x y = case (cwSameType x y, cwVal x, cwVal y) of (True, CWAlgReal a, CWAlgReal b) -> normCW $ CW (kindOf x) (CWAlgReal (r a b)) (True, CWInteger a, CWInteger b) -> normCW $ CW (kindOf x) (CWInteger (i a b)) (True, CWFloat a, CWFloat b) -> normCW $ CW (kindOf x) (CWFloat (f a b)) (True, CWDouble a, CWDouble b) -> normCW $ CW (kindOf x) (CWDouble (d a b)) (True, CWChar a, CWChar b) -> normCW $ CW (kindOf x) (CWChar (c a b)) (True, CWString a, CWString b) -> normCW $ CW (kindOf x) (CWString (s a b)) (True, CWUserSort a, CWUserSort b) -> normCW $ CW (kindOf x) (CWUserSort (u a b)) (True, CWList{}, CWList{}) -> error "Data.SBV.mapCW2: Unexpected call through mapCW2 with lists!" _ -> error $ "SBV.mapCW2: impossible, incompatible args received: " ++ show (x, y) -- | Show instance for 'CW'. instance Show CW where show = showCW True -- | Show instance for Generalized 'CW' instance Show GeneralizedCW where show (ExtendedCW k) = showExtCW True k show (RegularCW c) = showCW True c -- | Show a CW, with kind info if bool is True showCW :: Bool -> CW -> String showCW shk w | isBoolean w = show (cwToBool w) ++ (if shk then " :: Bool" else "") showCW shk w = liftCW show show show show show show snd shL w ++ kInfo where kInfo | shk = " :: " ++ showBaseKind (kindOf w) | True = "" shL xs = "[" ++ intercalate "," (map (showCW False . CW ke) xs) ++ "]" where ke = case kindOf w of KList k -> k kw -> error $ "Data.SBV.showCW: Impossible happened, expected list, got: " ++ show kw -- | A version of show for kinds that says Bool instead of SBool showBaseKind :: Kind -> String showBaseKind k@KUserSort {} = show k -- Leave user-sorts untouched! showBaseKind k = case show k of ('S':sk) -> sk s -> s -- | Create a constant word from an integral. mkConstCW :: Integral a => Kind -> a -> CW mkConstCW KBool a = normCW $ CW KBool (CWInteger (toInteger a)) mkConstCW k@KBounded{} a = normCW $ CW k (CWInteger (toInteger a)) mkConstCW KUnbounded a = normCW $ CW KUnbounded (CWInteger (toInteger a)) mkConstCW KReal a = normCW $ CW KReal (CWAlgReal (fromInteger (toInteger a))) mkConstCW KFloat a = normCW $ CW KFloat (CWFloat (fromInteger (toInteger a))) mkConstCW KDouble a = normCW $ CW KDouble (CWDouble (fromInteger (toInteger a))) mkConstCW KChar a = error $ "Unexpected call to mkConstCW (Char) with value: " ++ show (toInteger a) mkConstCW KString a = error $ "Unexpected call to mkConstCW (String) with value: " ++ show (toInteger a) mkConstCW k@KList{} a = error $ "Unexpected call to mkConstCW (" ++ show k ++ ") with value: " ++ show (toInteger a) mkConstCW (KUserSort s _) a = error $ "Unexpected call to mkConstCW with uninterpreted kind: " ++ s ++ " with value: " ++ show (toInteger a) -- | Generate a random constant value ('CWVal') of the correct kind. randomCWVal :: Kind -> IO CWVal randomCWVal k = case k of KBool -> CWInteger <$> randomRIO (0, 1) KBounded s w -> CWInteger <$> randomRIO (bounds s w) KUnbounded -> CWInteger <$> randomIO KReal -> CWAlgReal <$> randomIO KFloat -> CWFloat <$> randomIO KDouble -> CWDouble <$> randomIO -- TODO: KString/KChar currently only go for 0..255; include unicode? KString -> do l <- randomRIO (0, 100) CWString <$> replicateM l (chr <$> randomRIO (0, 255)) KChar -> CWChar . chr <$> randomRIO (0, 255) KUserSort s _ -> error $ "Unexpected call to randomCWVal with uninterpreted kind: " ++ s KList ek -> do l <- randomRIO (0, 100) CWList <$> replicateM l (randomCWVal ek) where bounds :: Bool -> Int -> (Integer, Integer) bounds False w = (0, 2^w - 1) bounds True w = (-x, x-1) where x = 2^(w-1) -- | Generate a random constant value ('CW') of the correct kind. randomCW :: Kind -> IO CW randomCW k = CW k <$> randomCWVal k sbv-7.13/Data/SBV/Core/Data.hs0000644000000000000000000006106113405536617014042 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Core.Data -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Internal data-structures for the sbv library ----------------------------------------------------------------------------- {-# LANGUAGE CPP #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE InstanceSigs #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} module Data.SBV.Core.Data ( SBool, SWord8, SWord16, SWord32, SWord64 , SInt8, SInt16, SInt32, SInt64, SInteger, SReal, SFloat, SDouble, SChar, SString, SList , nan, infinity, sNaN, sInfinity, RoundingMode(..), SRoundingMode , sRoundNearestTiesToEven, sRoundNearestTiesToAway, sRoundTowardPositive, sRoundTowardNegative, sRoundTowardZero , sRNE, sRNA, sRTP, sRTN, sRTZ , SymWord(..) , CW(..), CWVal(..), AlgReal(..), AlgRealPoly, ExtCW(..), GeneralizedCW(..), isRegularCW, cwSameType, cwToBool , mkConstCW ,liftCW2, mapCW, mapCW2 , SW(..), trueSW, falseSW, trueCW, falseCW, normCW , SVal(..) , SBV(..), NodeId(..), mkSymSBV , ArrayContext(..), ArrayInfo, SymArray(..), SFunArray(..), SArray(..) , sbvToSW, sbvToSymSW, forceSWArg , SBVExpr(..), newExpr , cache, Cached, uncache, uncacheAI, HasKind(..) , Op(..), PBOp(..), FPOp(..), StrOp(..), SeqOp(..), RegExp(..), NamedSymVar, getTableIndex , SBVPgm(..), Symbolic, runSymbolic, State, getPathCondition, extendPathCondition , inSMTMode, SBVRunMode(..), Kind(..), Outputtable(..), Result(..) , SolverContext(..), internalVariable, internalConstraint, isCodeGenMode , SBVType(..), newUninterpreted, addAxiom , Quantifier(..), needsExistentials , SMTLibPgm(..), SMTLibVersion(..), smtLibVersionExtension, smtLibReservedNames , SolverCapabilities(..) , extractSymbolicSimulationState , SMTScript(..), Solver(..), SMTSolver(..), SMTResult(..), SMTModel(..), SMTConfig(..) , OptimizeStyle(..), Penalty(..), Objective(..) , QueryState(..), Query(..), SMTProblem(..) ) where import GHC.Generics (Generic) import GHC.Exts (IsList(..)) import Control.DeepSeq (NFData(..)) import Control.Monad.Reader (ask) import Control.Monad.Trans (liftIO) import Data.Int (Int8, Int16, Int32, Int64) import Data.Word (Word8, Word16, Word32, Word64) import Data.List (elemIndex) import Data.Maybe (fromMaybe) import Data.Typeable (Typeable) import qualified Data.Generics as G (Data(..)) import System.Random import Data.SBV.Core.AlgReals import Data.SBV.Core.Kind import Data.SBV.Core.Concrete import Data.SBV.Core.Symbolic import Data.SBV.Core.Operations import Data.SBV.Control.Types import Data.SBV.SMT.SMTLibNames import Data.SBV.Utils.Lib import Data.SBV.Utils.Boolean -- | Get the current path condition getPathCondition :: State -> SBool getPathCondition st = SBV (getSValPathCondition st) -- | Extend the path condition with the given test value. extendPathCondition :: State -> (SBool -> SBool) -> State extendPathCondition st f = extendSValPathCondition st (unSBV . f . SBV) -- | The "Symbolic" value. The parameter @a@ is phantom, but is -- extremely important in keeping the user interface strongly typed. newtype SBV a = SBV { unSBV :: SVal } deriving (Generic, NFData) -- | A symbolic boolean/bit type SBool = SBV Bool -- | 8-bit unsigned symbolic value type SWord8 = SBV Word8 -- | 16-bit unsigned symbolic value type SWord16 = SBV Word16 -- | 32-bit unsigned symbolic value type SWord32 = SBV Word32 -- | 64-bit unsigned symbolic value type SWord64 = SBV Word64 -- | 8-bit signed symbolic value, 2's complement representation type SInt8 = SBV Int8 -- | 16-bit signed symbolic value, 2's complement representation type SInt16 = SBV Int16 -- | 32-bit signed symbolic value, 2's complement representation type SInt32 = SBV Int32 -- | 64-bit signed symbolic value, 2's complement representation type SInt64 = SBV Int64 -- | Infinite precision signed symbolic value type SInteger = SBV Integer -- | Infinite precision symbolic algebraic real value type SReal = SBV AlgReal -- | IEEE-754 single-precision floating point numbers type SFloat = SBV Float -- | IEEE-754 double-precision floating point numbers type SDouble = SBV Double -- | A symbolic character. Note that, as far as SBV's symbolic strings are concerned, a character -- is currently an 8-bit unsigned value, corresponding to the ISO-8859-1 (Latin-1) character -- set: . A Haskell 'Char', on the other hand, is based -- on unicode. Therefore, there isn't a 1-1 correspondence between a Haskell character and an SBV -- character for the time being. This limitation is due to the SMT-solvers only supporting this -- particular subset. However, there is a pending proposal to add support for unicode, and SBV -- will track these changes to have full unicode support as solvers become available. For -- details, see: type SChar = SBV Char -- | A symbolic string. Note that a symbolic string is /not/ a list of symbolic characters, -- that is, it is not the case that @SString = [SChar]@, unlike what one might expect following -- Haskell strings. An 'SString' is a symbolic value of its own, of possibly arbitrary but finite length, -- and internally processed as one unit as opposed to a fixed-length list of characters. type SString = SBV String -- | A symbolic list of items. Note that a symbolic list is /not/ a list of symbolic items, -- that is, it is not the case that @SList a = [a]@, unlike what one might expect following -- haskell lists\/sequences. An 'SList' is a symbolic value of its own, of possibly arbitrary but finite -- length, and internally processed as one unit as opposed to a fixed-length list of items. -- Note that lists can be nested, i.e., we do allow lists of lists of ... items. type SList a = SBV [a] -- | IsList instance allows list literals to be written compactly. instance SymWord [a] => IsList (SList a) where type Item (SList a) = a fromList = literal toList x = fromMaybe (error "IsList.toList used in a symbolic context!") (unliteral x) -- | Not-A-Number for 'Double' and 'Float'. Surprisingly, Haskell -- Prelude doesn't have this value defined, so we provide it here. nan :: Floating a => a nan = 0/0 -- | Infinity for 'Double' and 'Float'. Surprisingly, Haskell -- Prelude doesn't have this value defined, so we provide it here. infinity :: Floating a => a infinity = 1/0 -- | Symbolic variant of Not-A-Number. This value will inhabit both -- 'SDouble' and 'SFloat'. sNaN :: (Floating a, SymWord a) => SBV a sNaN = literal nan -- | Symbolic variant of infinity. This value will inhabit both -- 'SDouble' and 'SFloat'. sInfinity :: (Floating a, SymWord a) => SBV a sInfinity = literal infinity -- | Internal representation of a symbolic simulation result newtype SMTProblem = SMTProblem {smtLibPgm :: SMTConfig -> SMTLibPgm} -- ^ SMTLib representation, given the config -- Boolean combinators instance Boolean SBool where true = SBV (svBool True) false = SBV (svBool False) bnot (SBV b) = SBV (svNot b) SBV a &&& SBV b = SBV (svAnd a b) SBV a ||| SBV b = SBV (svOr a b) SBV a <+> SBV b = SBV (svXOr a b) -- | 'RoundingMode' can be used symbolically instance SymWord RoundingMode -- | The symbolic variant of 'RoundingMode' type SRoundingMode = SBV RoundingMode -- | Symbolic variant of 'RoundNearestTiesToEven' sRoundNearestTiesToEven :: SRoundingMode sRoundNearestTiesToEven = literal RoundNearestTiesToEven -- | Symbolic variant of 'RoundNearestTiesToAway' sRoundNearestTiesToAway :: SRoundingMode sRoundNearestTiesToAway = literal RoundNearestTiesToAway -- | Symbolic variant of 'RoundTowardPositive' sRoundTowardPositive :: SRoundingMode sRoundTowardPositive = literal RoundTowardPositive -- | Symbolic variant of 'RoundTowardNegative' sRoundTowardNegative :: SRoundingMode sRoundTowardNegative = literal RoundTowardNegative -- | Symbolic variant of 'RoundTowardZero' sRoundTowardZero :: SRoundingMode sRoundTowardZero = literal RoundTowardZero -- | Alias for 'sRoundNearestTiesToEven' sRNE :: SRoundingMode sRNE = sRoundNearestTiesToEven -- | Alias for 'sRoundNearestTiesToAway' sRNA :: SRoundingMode sRNA = sRoundNearestTiesToAway -- | Alias for 'sRoundTowardPositive' sRTP :: SRoundingMode sRTP = sRoundTowardPositive -- | Alias for 'sRoundTowardNegative' sRTN :: SRoundingMode sRTN = sRoundTowardNegative -- | Alias for 'sRoundTowardZero' sRTZ :: SRoundingMode sRTZ = sRoundTowardZero -- | A 'Show' instance is not particularly "desirable," when the value is symbolic, -- but we do need this instance as otherwise we cannot simply evaluate Haskell functions -- that return symbolic values and have their constant values printed easily! instance Show (SBV a) where show (SBV sv) = show sv -- | This instance is only defined so that we can define an instance for -- 'Data.Bits.Bits'. '==' and '/=' simply throw an error. Use -- 'Data.SBV.EqSymbolic' instead. instance Eq (SBV a) where SBV a == SBV b = a == b SBV a /= SBV b = a /= b instance HasKind (SBV a) where kindOf (SBV (SVal k _)) = k -- | Convert a symbolic value to a symbolic-word sbvToSW :: State -> SBV a -> IO SW sbvToSW st (SBV s) = svToSW st s ------------------------------------------------------------------------- -- * Symbolic Computations ------------------------------------------------------------------------- -- | Create a symbolic variable. mkSymSBV :: forall a. Maybe Quantifier -> Kind -> Maybe String -> Symbolic (SBV a) mkSymSBV mbQ k mbNm = SBV <$> (ask >>= liftIO . svMkSymVar mbQ k mbNm) -- | Convert a symbolic value to an SW, inside the Symbolic monad sbvToSymSW :: SBV a -> Symbolic SW sbvToSymSW sbv = do st <- ask liftIO $ sbvToSW st sbv -- | Actions we can do in a context: Either at problem description -- time or while we are dynamically querying. 'Symbolic' and 'Query' are -- two instances of this class. Note that we use this mechanism -- internally and do not export it from SBV. class SolverContext m where -- | Add a constraint, any satisfying instance must satisfy this condition constrain :: SBool -> m () -- | Add a soft constraint. The solver will try to satisfy this condition if possible, but won't if it cannot softConstrain :: SBool -> m () -- | Add a named constraint. The name is used in unsat-core extraction. namedConstraint :: String -> SBool -> m () -- | Add a constraint, with arbitrary attributes. Used in interpolant generation. constrainWithAttribute :: [(String, String)] -> SBool -> m () -- | Set info. Example: @setInfo ":status" ["unsat"]@. setInfo :: String -> [String] -> m () -- | Set an option. setOption :: SMTOption -> m () -- | Set the logic. setLogic :: Logic -> m () -- | Set a solver time-out value, in milli-seconds. This function -- essentially translates to the SMTLib call @(set-info :timeout val)@, -- and your backend solver may or may not support it! The amount given -- is in milliseconds. Also see the function 'Data.SBV.Control.timeOut' for finer level -- control of time-outs, directly from SBV. setTimeOut :: Integer -> m () -- time-out, logic, and info are simply options in our implementation, so default implementation suffices setTimeOut t = setOption $ OptionKeyword ":timeout" [show t] setLogic = setOption . SetLogic setInfo k = setOption . SetInfo k -- | A class representing what can be returned from a symbolic computation. class Outputtable a where -- | Mark an interim result as an output. Useful when constructing Symbolic programs -- that return multiple values, or when the result is programmatically computed. output :: a -> Symbolic a instance Outputtable (SBV a) where output i = do outputSVal (unSBV i) return i instance Outputtable a => Outputtable [a] where output = mapM output instance Outputtable () where output = return instance (Outputtable a, Outputtable b) => Outputtable (a, b) where output = mlift2 (,) output output instance (Outputtable a, Outputtable b, Outputtable c) => Outputtable (a, b, c) where output = mlift3 (,,) output output output instance (Outputtable a, Outputtable b, Outputtable c, Outputtable d) => Outputtable (a, b, c, d) where output = mlift4 (,,,) output output output output instance (Outputtable a, Outputtable b, Outputtable c, Outputtable d, Outputtable e) => Outputtable (a, b, c, d, e) where output = mlift5 (,,,,) output output output output output instance (Outputtable a, Outputtable b, Outputtable c, Outputtable d, Outputtable e, Outputtable f) => Outputtable (a, b, c, d, e, f) where output = mlift6 (,,,,,) output output output output output output instance (Outputtable a, Outputtable b, Outputtable c, Outputtable d, Outputtable e, Outputtable f, Outputtable g) => Outputtable (a, b, c, d, e, f, g) where output = mlift7 (,,,,,,) output output output output output output output instance (Outputtable a, Outputtable b, Outputtable c, Outputtable d, Outputtable e, Outputtable f, Outputtable g, Outputtable h) => Outputtable (a, b, c, d, e, f, g, h) where output = mlift8 (,,,,,,,) output output output output output output output output ------------------------------------------------------------------------------- -- * Symbolic Words ------------------------------------------------------------------------------- -- | A 'SymWord' is a potential symbolic bitvector that can be created instances of -- to be fed to a symbolic program. Note that these methods are typically not needed -- in casual uses with 'Data.SBV.prove', 'Data.SBV.sat', 'Data.SBV.allSat' etc, as -- default instances automatically provide the necessary bits. class (HasKind a, Ord a, Typeable a) => SymWord a where -- | Create a user named input (universal) forall :: String -> Symbolic (SBV a) -- | Create an automatically named input forall_ :: Symbolic (SBV a) -- | Get a bunch of new words mkForallVars :: Int -> Symbolic [SBV a] -- | Create an existential variable exists :: String -> Symbolic (SBV a) -- | Create an automatically named existential variable exists_ :: Symbolic (SBV a) -- | Create a bunch of existentials mkExistVars :: Int -> Symbolic [SBV a] -- | Create a free variable, universal in a proof, existential in sat free :: String -> Symbolic (SBV a) -- | Create an unnamed free variable, universal in proof, existential in sat free_ :: Symbolic (SBV a) -- | Create a bunch of free vars mkFreeVars :: Int -> Symbolic [SBV a] -- | Similar to free; Just a more convenient name symbolic :: String -> Symbolic (SBV a) -- | Similar to mkFreeVars; but automatically gives names based on the strings symbolics :: [String] -> Symbolic [SBV a] -- | Turn a literal constant to symbolic literal :: a -> SBV a -- | Extract a literal, if the value is concrete unliteral :: SBV a -> Maybe a -- | Extract a literal, from a CW representation fromCW :: CW -> a -- | Is the symbolic word concrete? isConcrete :: SBV a -> Bool -- | Is the symbolic word really symbolic? isSymbolic :: SBV a -> Bool -- | Does it concretely satisfy the given predicate? isConcretely :: SBV a -> (a -> Bool) -> Bool -- | One stop allocator mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV a) -- minimal complete definition:: Nothing. -- Giving no instances is ok when defining an uninterpreted/enumerated sort, but otherwise you really -- want to define: literal, fromCW, mkSymWord forall = mkSymWord (Just ALL) . Just forall_ = mkSymWord (Just ALL) Nothing exists = mkSymWord (Just EX) . Just exists_ = mkSymWord (Just EX) Nothing free = mkSymWord Nothing . Just free_ = mkSymWord Nothing Nothing mkForallVars n = mapM (const forall_) [1 .. n] mkExistVars n = mapM (const exists_) [1 .. n] mkFreeVars n = mapM (const free_) [1 .. n] symbolic = free symbolics = mapM symbolic unliteral (SBV (SVal _ (Left c))) = Just $ fromCW c unliteral _ = Nothing isConcrete (SBV (SVal _ (Left _))) = True isConcrete _ = False isSymbolic = not . isConcrete isConcretely s p | Just i <- unliteral s = p i | True = False default literal :: Show a => a -> SBV a literal x = let k@(KUserSort _ conts) = kindOf x sx = show x mbIdx = case conts of Right xs -> sx `elemIndex` xs _ -> Nothing in SBV $ SVal k (Left (CW k (CWUserSort (mbIdx, sx)))) default fromCW :: Read a => CW -> a fromCW (CW _ (CWUserSort (_, s))) = read s fromCW cw = error $ "Cannot convert CW " ++ show cw ++ " to kind " ++ show (kindOf (undefined :: a)) default mkSymWord :: (Read a, G.Data a) => Maybe Quantifier -> Maybe String -> Symbolic (SBV a) mkSymWord mbQ mbNm = SBV <$> (ask >>= liftIO . svMkSymVar mbQ k mbNm) where k = constructUKind (undefined :: a) instance (Random a, SymWord a) => Random (SBV a) where randomR (l, h) g = case (unliteral l, unliteral h) of (Just lb, Just hb) -> let (v, g') = randomR (lb, hb) g in (literal (v :: a), g') _ -> error "SBV.Random: Cannot generate random values with symbolic bounds" random g = let (v, g') = random g in (literal (v :: a) , g') --------------------------------------------------------------------------------- -- * Symbolic Arrays --------------------------------------------------------------------------------- -- | Flat arrays of symbolic values -- An @array a b@ is an array indexed by the type @'SBV' a@, with elements of type @'SBV' b@. -- -- If a default value is supplied, then all the array elements will be initialized to this value. -- Otherwise, they will be left unspecified, i.e., a read from an unwritten location will produce -- an uninterpreted constant. -- -- While it's certainly possible for user to create instances of 'SymArray', the -- 'SArray' and 'SFunArray' instances already provided should cover most use cases -- in practice. Note that there are a few differences between these two models in -- terms of use models: -- -- * 'SArray' produces SMTLib arrays, and requires a solver that understands the -- array theory. 'SFunArray' is internally handled, and thus can be used with -- any solver. (Note that all solvers except 'Data.SBV.abc' support arrays, so this isn't -- a big decision factor.) -- -- * For both arrays, if a default value is supplied, then reading from uninitialized -- cell will return that value. If the default is not given, then reading from -- uninitialized cells is still OK for both arrays, and will produce an uninterpreted -- constant in both cases. -- -- * Only 'SArray' supports checking equality of arrays. (That is, checking if an entire -- array is equivalent to another.) 'SFunArray's cannot be checked for equality. In general, -- checking wholesale equality of arrays is a difficult decision problem and should be -- avoided if possible. -- -- * Only 'SFunArray' supports compilation to C. Programs using 'SArray' will not be -- accepted by the C-code generator. -- -- * You cannot use quickcheck on programs that contain these arrays. (Neither 'SArray' -- nor 'SFunArray'.) -- -- * With 'SArray', SBV transfers all array-processing to the SMT-solver. So, it can generate -- programs more quickly, but they might end up being too hard for the solver to handle. With -- 'SFunArray', SBV only generates code for individual elements and the array itself never -- shows up in the resulting SMTLib program. This puts more onus on the SBV side and might -- have some performance impacts, but it might generate problems that are easier for the SMT -- solvers to handle. -- -- As a rule of thumb, try 'SArray' first. These should generate compact code. However, if -- the backend solver has hard time solving the generated problems, switch to -- 'SFunArray'. If you still have issues, please report so we can see what the problem might be! class SymArray array where -- | Create a new anonymous array, possibly with a default initial value. newArray_ :: (HasKind a, HasKind b) => Maybe (SBV b) -> Symbolic (array a b) -- | Create a named new array, possibly with a default initial value. newArray :: (HasKind a, HasKind b) => String -> Maybe (SBV b) -> Symbolic (array a b) -- | Read the array element at @a@ readArray :: array a b -> SBV a -> SBV b -- | Update the element at @a@ to be @b@ writeArray :: SymWord b => array a b -> SBV a -> SBV b -> array a b -- | Merge two given arrays on the symbolic condition -- Intuitively: @mergeArrays cond a b = if cond then a else b@. -- Merging pushes the if-then-else choice down on to elements mergeArrays :: SymWord b => SBV Bool -> array a b -> array a b -> array a b -- | Internal function, not exported to the user newArrayInState :: (HasKind a, HasKind b) => Maybe String -> Maybe (SBV b) -> State -> IO (array a b) {-# MINIMAL readArray, writeArray, mergeArrays, newArrayInState #-} newArray_ mbVal = ask >>= liftIO . newArrayInState Nothing mbVal newArray nm mbVal = ask >>= liftIO . newArrayInState (Just nm) mbVal -- | Arrays implemented in terms of SMT-arrays: -- -- * Maps directly to SMT-lib arrays -- -- * Reading from an unintialized value is OK. If the default value is given in 'newArray', it will -- be the result. Otherwise, the read yields an uninterpreted constant. -- -- * Can check for equality of these arrays -- -- * Cannot be used in code-generation (i.e., compilation to C) -- -- * Cannot quick-check theorems using @SArray@ values -- -- * Typically slower as it heavily relies on SMT-solving for the array theory newtype SArray a b = SArray { unSArray :: SArr } instance (HasKind a, HasKind b) => Show (SArray a b) where show SArray{} = "SArray<" ++ showType (undefined :: a) ++ ":" ++ showType (undefined :: b) ++ ">" instance SymArray SArray where readArray (SArray arr) (SBV a) = SBV (readSArr arr a) writeArray (SArray arr) (SBV a) (SBV b) = SArray (writeSArr arr a b) mergeArrays (SBV t) (SArray a) (SArray b) = SArray (mergeSArr t a b) newArrayInState :: forall a b. (HasKind a, HasKind b) => Maybe String -> Maybe (SBV b) -> State -> IO (SArray a b) newArrayInState mbNm mbVal st = do mapM_ (registerKind st) [aknd, bknd] SArray <$> newSArr st (aknd, bknd) (mkNm mbNm) (unSBV <$> mbVal) where mkNm Nothing t = "array_" ++ show t mkNm (Just nm) _ = nm aknd = kindOf (undefined :: a) bknd = kindOf (undefined :: b) -- | Arrays implemented internally, without translating to SMT-Lib functions: -- -- * Internally handled by the library and not mapped to SMT-Lib, hence can -- be used with solvers that don't support arrays. (Such as abc.) -- -- * Reading from an unintialized value is OK. If the default value is given in 'newArray', it will -- be the result. Otherwise, the read yields an uninterpreted constant. -- -- * Cannot check for equality of arrays. -- -- * Can be used in code-generation (i.e., compilation to C). -- -- * Can not quick-check theorems using @SFunArray@ values -- -- * Typically faster as it gets compiled away during translation. newtype SFunArray a b = SFunArray { unSFunArray :: SFunArr } instance (HasKind a, HasKind b) => Show (SFunArray a b) where show SFunArray{} = "SFunArray<" ++ showType (undefined :: a) ++ ":" ++ showType (undefined :: b) ++ ">" instance SymArray SFunArray where readArray (SFunArray arr) (SBV a) = SBV (readSFunArr arr a) writeArray (SFunArray arr) (SBV a) (SBV b) = SFunArray (writeSFunArr arr a b) mergeArrays (SBV t) (SFunArray a) (SFunArray b) = SFunArray (mergeSFunArr t a b) newArrayInState :: forall a b. (HasKind a, HasKind b) => Maybe String -> Maybe (SBV b) -> State -> IO (SFunArray a b) newArrayInState mbNm mbVal st = do mapM_ (registerKind st) [aknd, bknd] SFunArray <$> newSFunArr st (aknd, bknd) (mkNm mbNm) (unSBV <$> mbVal) where mkNm Nothing t = "funArray_" ++ show t mkNm (Just nm) _ = nm aknd = kindOf (undefined :: a) bknd = kindOf (undefined :: b) sbv-7.13/Data/SBV/Core/Floating.hs0000644000000000000000000005442413405536617014741 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Core.Floating -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Implementation of floating-point operations mapping to SMT-Lib2 floats ----------------------------------------------------------------------------- {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} module Data.SBV.Core.Floating ( IEEEFloating(..), IEEEFloatConvertable(..) , sFloatAsSWord32, sDoubleAsSWord64, sWord32AsSFloat, sWord64AsSDouble , blastSFloat, blastSDouble ) where import qualified Data.Numbers.CrackNum as CN (wordToFloat, wordToDouble, floatToWord, doubleToWord) import Data.Int (Int8, Int16, Int32, Int64) import Data.Word (Word8, Word16, Word32, Word64) import Data.SBV.Core.Data import Data.SBV.Core.Model import Data.SBV.Core.AlgReals (isExactRational) import Data.SBV.Utils.Boolean import Data.SBV.Utils.Numeric -- | A class of floating-point (IEEE754) operations, some of -- which behave differently based on rounding modes. Note that unless -- the rounding mode is concretely RoundNearestTiesToEven, we will -- not concretely evaluate these, but rather pass down to the SMT solver. class (SymWord a, RealFloat a) => IEEEFloating a where -- | Compute the floating point absolute value. fpAbs :: SBV a -> SBV a -- | Compute the unary negation. Note that @0 - x@ is not equivalent to @-x@ for floating-point, since @-0@ and @0@ are different. fpNeg :: SBV a -> SBV a -- | Add two floating point values, using the given rounding mode fpAdd :: SRoundingMode -> SBV a -> SBV a -> SBV a -- | Subtract two floating point values, using the given rounding mode fpSub :: SRoundingMode -> SBV a -> SBV a -> SBV a -- | Multiply two floating point values, using the given rounding mode fpMul :: SRoundingMode -> SBV a -> SBV a -> SBV a -- | Divide two floating point values, using the given rounding mode fpDiv :: SRoundingMode -> SBV a -> SBV a -> SBV a -- | Fused-multiply-add three floating point values, using the given rounding mode. @fpFMA x y z = x*y+z@ but with only -- one rounding done for the whole operation; not two. Note that we will never concretely evaluate this function since -- Haskell lacks an FMA implementation. fpFMA :: SRoundingMode -> SBV a -> SBV a -> SBV a -> SBV a -- | Compute the square-root of a float, using the given rounding mode fpSqrt :: SRoundingMode -> SBV a -> SBV a -- | Compute the remainder: @x - y * n@, where @n@ is the truncated integer nearest to x/y. The rounding mode -- is implicitly assumed to be @RoundNearestTiesToEven@. fpRem :: SBV a -> SBV a -> SBV a -- | Round to the nearest integral value, using the given rounding mode. fpRoundToIntegral :: SRoundingMode -> SBV a -> SBV a -- | Compute the minimum of two floats, respects @infinity@ and @NaN@ values fpMin :: SBV a -> SBV a -> SBV a -- | Compute the maximum of two floats, respects @infinity@ and @NaN@ values fpMax :: SBV a -> SBV a -> SBV a -- | Are the two given floats exactly the same. That is, @NaN@ will compare equal to itself, @+0@ will /not/ compare -- equal to @-0@ etc. This is the object level equality, as opposed to the semantic equality. (For the latter, just use '.=='.) fpIsEqualObject :: SBV a -> SBV a -> SBool -- | Is the floating-point number a normal value. (i.e., not denormalized.) fpIsNormal :: SBV a -> SBool -- | Is the floating-point number a subnormal value. (Also known as denormal.) fpIsSubnormal :: SBV a -> SBool -- | Is the floating-point number 0? (Note that both +0 and -0 will satisfy this predicate.) fpIsZero :: SBV a -> SBool -- | Is the floating-point number infinity? (Note that both +oo and -oo will satisfy this predicate.) fpIsInfinite :: SBV a -> SBool -- | Is the floating-point number a NaN value? fpIsNaN :: SBV a -> SBool -- | Is the floating-point number negative? Note that -0 satisfies this predicate but +0 does not. fpIsNegative :: SBV a -> SBool -- | Is the floating-point number positive? Note that +0 satisfies this predicate but -0 does not. fpIsPositive :: SBV a -> SBool -- | Is the floating point number -0? fpIsNegativeZero :: SBV a -> SBool -- | Is the floating point number +0? fpIsPositiveZero :: SBV a -> SBool -- | Is the floating-point number a regular floating point, i.e., not NaN, nor +oo, nor -oo. Normals or denormals are allowed. fpIsPoint :: SBV a -> SBool -- Default definitions. Minimal complete definition: None! All should be taken care by defaults -- Note that we never evaluate FMA concretely, as there's no fma operator in Haskell fpAbs = lift1 FP_Abs (Just abs) Nothing fpNeg = lift1 FP_Neg (Just negate) Nothing fpAdd = lift2 FP_Add (Just (+)) . Just fpSub = lift2 FP_Sub (Just (-)) . Just fpMul = lift2 FP_Mul (Just (*)) . Just fpDiv = lift2 FP_Div (Just (/)) . Just fpFMA = lift3 FP_FMA Nothing . Just fpSqrt = lift1 FP_Sqrt (Just sqrt) . Just fpRem = lift2 FP_Rem (Just fpRemH) Nothing fpRoundToIntegral = lift1 FP_RoundToIntegral (Just fpRoundToIntegralH) . Just fpMin = liftMM FP_Min (Just fpMinH) Nothing fpMax = liftMM FP_Max (Just fpMaxH) Nothing fpIsEqualObject = lift2B FP_ObjEqual (Just fpIsEqualObjectH) Nothing fpIsNormal = lift1B FP_IsNormal fpIsNormalizedH fpIsSubnormal = lift1B FP_IsSubnormal isDenormalized fpIsZero = lift1B FP_IsZero (== 0) fpIsInfinite = lift1B FP_IsInfinite isInfinite fpIsNaN = lift1B FP_IsNaN isNaN fpIsNegative = lift1B FP_IsNegative (\x -> x < 0 || isNegativeZero x) fpIsPositive = lift1B FP_IsPositive (\x -> x >= 0 && not (isNegativeZero x)) fpIsNegativeZero x = fpIsZero x &&& fpIsNegative x fpIsPositiveZero x = fpIsZero x &&& fpIsPositive x fpIsPoint x = bnot (fpIsNaN x ||| fpIsInfinite x) -- | SFloat instance instance IEEEFloating Float -- | SDouble instance instance IEEEFloating Double -- | Capture convertability from/to FloatingPoint representations -- NB. 'fromSFloat' and 'fromSDouble' are underspecified when given -- when given a @NaN@, @+oo@, or @-oo@ value that cannot be represented -- in the target domain. For these inputs, we define the result to be +0, arbitrarily. class IEEEFloatConvertable a where fromSFloat :: SRoundingMode -> SFloat -> SBV a toSFloat :: SRoundingMode -> SBV a -> SFloat fromSDouble :: SRoundingMode -> SDouble -> SBV a toSDouble :: SRoundingMode -> SBV a -> SDouble -- | A generic converter that will work for most of our instances. (But not all!) genericFPConverter :: forall a r. (SymWord a, HasKind r, SymWord r, Num r) => Maybe (a -> Bool) -> Maybe (SBV a -> SBool) -> (a -> r) -> SRoundingMode -> SBV a -> SBV r genericFPConverter mbConcreteOK mbSymbolicOK converter rm f | Just w <- unliteral f, Just RoundNearestTiesToEven <- unliteral rm, check w = literal $ converter w | Just symCheck <- mbSymbolicOK = ite (symCheck f) result (literal 0) | True = result where result = SBV (SVal kTo (Right (cache y))) check w = maybe True ($ w) mbConcreteOK kFrom = kindOf f kTo = kindOf (undefined :: r) y st = do msw <- sbvToSW st rm xsw <- sbvToSW st f newExpr st kTo (SBVApp (IEEEFP (FP_Cast kFrom kTo msw)) [xsw]) -- | Check that a given float is a point ptCheck :: IEEEFloating a => Maybe (SBV a -> SBool) ptCheck = Just fpIsPoint instance IEEEFloatConvertable Int8 where fromSFloat = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Float -> Integer)) toSFloat = genericFPConverter Nothing Nothing (fromRational . fromIntegral) fromSDouble = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Double -> Integer)) toSDouble = genericFPConverter Nothing Nothing (fromRational . fromIntegral) instance IEEEFloatConvertable Int16 where fromSFloat = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Float -> Integer)) toSFloat = genericFPConverter Nothing Nothing (fromRational . fromIntegral) fromSDouble = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Double -> Integer)) toSDouble = genericFPConverter Nothing Nothing (fromRational . fromIntegral) instance IEEEFloatConvertable Int32 where fromSFloat = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Float -> Integer)) toSFloat = genericFPConverter Nothing Nothing (fromRational . fromIntegral) fromSDouble = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Double -> Integer)) toSDouble = genericFPConverter Nothing Nothing (fromRational . fromIntegral) instance IEEEFloatConvertable Int64 where fromSFloat = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Float -> Integer)) toSFloat = genericFPConverter Nothing Nothing (fromRational . fromIntegral) fromSDouble = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Double -> Integer)) toSDouble = genericFPConverter Nothing Nothing (fromRational . fromIntegral) instance IEEEFloatConvertable Word8 where fromSFloat = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Float -> Integer)) toSFloat = genericFPConverter Nothing Nothing (fromRational . fromIntegral) fromSDouble = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Double -> Integer)) toSDouble = genericFPConverter Nothing Nothing (fromRational . fromIntegral) instance IEEEFloatConvertable Word16 where fromSFloat = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Float -> Integer)) toSFloat = genericFPConverter Nothing Nothing (fromRational . fromIntegral) fromSDouble = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Double -> Integer)) toSDouble = genericFPConverter Nothing Nothing (fromRational . fromIntegral) instance IEEEFloatConvertable Word32 where fromSFloat = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Float -> Integer)) toSFloat = genericFPConverter Nothing Nothing (fromRational . fromIntegral) fromSDouble = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Double -> Integer)) toSDouble = genericFPConverter Nothing Nothing (fromRational . fromIntegral) instance IEEEFloatConvertable Word64 where fromSFloat = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Float -> Integer)) toSFloat = genericFPConverter Nothing Nothing (fromRational . fromIntegral) fromSDouble = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Double -> Integer)) toSDouble = genericFPConverter Nothing Nothing (fromRational . fromIntegral) instance IEEEFloatConvertable Float where fromSFloat _ f = f toSFloat _ f = f fromSDouble = genericFPConverter Nothing Nothing fp2fp toSDouble = genericFPConverter Nothing Nothing fp2fp instance IEEEFloatConvertable Double where fromSFloat = genericFPConverter Nothing Nothing fp2fp toSFloat = genericFPConverter Nothing Nothing fp2fp fromSDouble _ d = d toSDouble _ d = d instance IEEEFloatConvertable Integer where fromSFloat = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Float -> Integer)) toSFloat = genericFPConverter Nothing Nothing (fromRational . fromIntegral) fromSDouble = genericFPConverter Nothing ptCheck (fromIntegral . (fpRound0 :: Double -> Integer)) toSDouble = genericFPConverter Nothing Nothing (fromRational . fromIntegral) -- For AlgReal; be careful to only process exact rationals concretely instance IEEEFloatConvertable AlgReal where fromSFloat = genericFPConverter Nothing ptCheck (fromRational . fpRatio0) toSFloat = genericFPConverter (Just isExactRational) Nothing (fromRational . toRational) fromSDouble = genericFPConverter Nothing ptCheck (fromRational . fpRatio0) toSDouble = genericFPConverter (Just isExactRational) Nothing (fromRational . toRational) -- | Concretely evaluate one arg function, if rounding mode is RoundNearestTiesToEven and we have enough concrete data concEval1 :: SymWord a => Maybe (a -> a) -> Maybe SRoundingMode -> SBV a -> Maybe (SBV a) concEval1 mbOp mbRm a = do op <- mbOp v <- unliteral a case unliteral =<< mbRm of Nothing -> (Just . literal) (op v) Just RoundNearestTiesToEven -> (Just . literal) (op v) _ -> Nothing -- | Concretely evaluate two arg function, if rounding mode is RoundNearestTiesToEven and we have enough concrete data concEval2 :: SymWord a => Maybe (a -> a -> a) -> Maybe SRoundingMode -> SBV a -> SBV a -> Maybe (SBV a) concEval2 mbOp mbRm a b = do op <- mbOp v1 <- unliteral a v2 <- unliteral b case unliteral =<< mbRm of Nothing -> (Just . literal) (v1 `op` v2) Just RoundNearestTiesToEven -> (Just . literal) (v1 `op` v2) _ -> Nothing -- | Concretely evaluate a bool producing two arg function, if rounding mode is RoundNearestTiesToEven and we have enough concrete data concEval2B :: SymWord a => Maybe (a -> a -> Bool) -> Maybe SRoundingMode -> SBV a -> SBV a -> Maybe SBool concEval2B mbOp mbRm a b = do op <- mbOp v1 <- unliteral a v2 <- unliteral b case unliteral =<< mbRm of Nothing -> (Just . literal) (v1 `op` v2) Just RoundNearestTiesToEven -> (Just . literal) (v1 `op` v2) _ -> Nothing -- | Concretely evaluate two arg function, if rounding mode is RoundNearestTiesToEven and we have enough concrete data concEval3 :: SymWord a => Maybe (a -> a -> a -> a) -> Maybe SRoundingMode -> SBV a -> SBV a -> SBV a -> Maybe (SBV a) concEval3 mbOp mbRm a b c = do op <- mbOp v1 <- unliteral a v2 <- unliteral b v3 <- unliteral c case unliteral =<< mbRm of Nothing -> (Just . literal) (op v1 v2 v3) Just RoundNearestTiesToEven -> (Just . literal) (op v1 v2 v3) _ -> Nothing -- | Add the converted rounding mode if given as an argument addRM :: State -> Maybe SRoundingMode -> [SW] -> IO [SW] addRM _ Nothing as = return as addRM st (Just rm) as = do swm <- sbvToSW st rm return (swm : as) -- | Lift a 1 arg FP-op lift1 :: SymWord a => FPOp -> Maybe (a -> a) -> Maybe SRoundingMode -> SBV a -> SBV a lift1 w mbOp mbRm a | Just cv <- concEval1 mbOp mbRm a = cv | True = SBV $ SVal k $ Right $ cache r where k = kindOf a r st = do swa <- sbvToSW st a args <- addRM st mbRm [swa] newExpr st k (SBVApp (IEEEFP w) args) -- | Lift an FP predicate lift1B :: SymWord a => FPOp -> (a -> Bool) -> SBV a -> SBool lift1B w f a | Just v <- unliteral a = literal $ f v | True = SBV $ SVal KBool $ Right $ cache r where r st = do swa <- sbvToSW st a newExpr st KBool (SBVApp (IEEEFP w) [swa]) -- | Lift a 2 arg FP-op lift2 :: SymWord a => FPOp -> Maybe (a -> a -> a) -> Maybe SRoundingMode -> SBV a -> SBV a -> SBV a lift2 w mbOp mbRm a b | Just cv <- concEval2 mbOp mbRm a b = cv | True = SBV $ SVal k $ Right $ cache r where k = kindOf a r st = do swa <- sbvToSW st a swb <- sbvToSW st b args <- addRM st mbRm [swa, swb] newExpr st k (SBVApp (IEEEFP w) args) -- | Lift min/max: Note that we protect against constant folding if args are alternating sign 0's, since -- SMTLib is deliberately nondeterministic in this case liftMM :: (SymWord a, RealFloat a) => FPOp -> Maybe (a -> a -> a) -> Maybe SRoundingMode -> SBV a -> SBV a -> SBV a liftMM w mbOp mbRm a b | Just v1 <- unliteral a , Just v2 <- unliteral b , not ((isN0 v1 && isP0 v2) || (isP0 v1 && isN0 v2)) -- If not +0/-0 or -0/+0 , Just cv <- concEval2 mbOp mbRm a b = cv | True = SBV $ SVal k $ Right $ cache r where isN0 = isNegativeZero isP0 x = x == 0 && not (isN0 x) k = kindOf a r st = do swa <- sbvToSW st a swb <- sbvToSW st b args <- addRM st mbRm [swa, swb] newExpr st k (SBVApp (IEEEFP w) args) -- | Lift a 2 arg FP-op, producing bool lift2B :: SymWord a => FPOp -> Maybe (a -> a -> Bool) -> Maybe SRoundingMode -> SBV a -> SBV a -> SBool lift2B w mbOp mbRm a b | Just cv <- concEval2B mbOp mbRm a b = cv | True = SBV $ SVal KBool $ Right $ cache r where r st = do swa <- sbvToSW st a swb <- sbvToSW st b args <- addRM st mbRm [swa, swb] newExpr st KBool (SBVApp (IEEEFP w) args) -- | Lift a 3 arg FP-op lift3 :: SymWord a => FPOp -> Maybe (a -> a -> a -> a) -> Maybe SRoundingMode -> SBV a -> SBV a -> SBV a -> SBV a lift3 w mbOp mbRm a b c | Just cv <- concEval3 mbOp mbRm a b c = cv | True = SBV $ SVal k $ Right $ cache r where k = kindOf a r st = do swa <- sbvToSW st a swb <- sbvToSW st b swc <- sbvToSW st c args <- addRM st mbRm [swa, swb, swc] newExpr st k (SBVApp (IEEEFP w) args) -- | Convert an 'SFloat' to an 'SWord32', preserving the bit-correspondence. Note that since the -- representation for @NaN@s are not unique, this function will return a symbolic value when given a -- concrete @NaN@. -- -- Implementation note: Since there's no corresponding function in SMTLib for conversion to -- bit-representation due to partiality, we use a translation trick by allocating a new word variable, -- converting it to float, and requiring it to be equivalent to the input. In code-generation mode, we simply map -- it to a simple conversion. sFloatAsSWord32 :: SFloat -> SWord32 sFloatAsSWord32 fVal | Just f <- unliteral fVal, not (isNaN f) = literal (CN.floatToWord f) | True = SBV (SVal w32 (Right (cache y))) where w32 = KBounded False 32 y st = do cg <- isCodeGenMode st if cg then do f <- sbvToSW st fVal newExpr st w32 (SBVApp (IEEEFP (FP_Reinterpret KFloat w32)) [f]) else do n <- internalVariable st w32 ysw <- newExpr st KFloat (SBVApp (IEEEFP (FP_Reinterpret w32 KFloat)) [n]) internalConstraint st False [] $ unSBV $ fVal `fpIsEqualObject` SBV (SVal KFloat (Right (cache (\_ -> return ysw)))) return n -- | Convert an 'SDouble' to an 'SWord64', preserving the bit-correspondence. Note that since the -- representation for @NaN@s are not unique, this function will return a symbolic value when given a -- concrete @NaN@. -- -- See the implementation note for 'sFloatAsSWord32', as it applies here as well. sDoubleAsSWord64 :: SDouble -> SWord64 sDoubleAsSWord64 fVal | Just f <- unliteral fVal, not (isNaN f) = literal (CN.doubleToWord f) | True = SBV (SVal w64 (Right (cache y))) where w64 = KBounded False 64 y st = do cg <- isCodeGenMode st if cg then do f <- sbvToSW st fVal newExpr st w64 (SBVApp (IEEEFP (FP_Reinterpret KDouble w64)) [f]) else do n <- internalVariable st w64 ysw <- newExpr st KDouble (SBVApp (IEEEFP (FP_Reinterpret w64 KDouble)) [n]) internalConstraint st False [] $ unSBV $ fVal `fpIsEqualObject` SBV (SVal KDouble (Right (cache (\_ -> return ysw)))) return n -- | Extract the sign\/exponent\/mantissa of a single-precision float. The output will have -- 8 bits in the second argument for exponent, and 23 in the third for the mantissa. blastSFloat :: SFloat -> (SBool, [SBool], [SBool]) blastSFloat = extract . sFloatAsSWord32 where extract x = (sTestBit x 31, sExtractBits x [30, 29 .. 23], sExtractBits x [22, 21 .. 0]) -- | Extract the sign\/exponent\/mantissa of a single-precision float. The output will have -- 11 bits in the second argument for exponent, and 52 in the third for the mantissa. blastSDouble :: SDouble -> (SBool, [SBool], [SBool]) blastSDouble = extract . sDoubleAsSWord64 where extract x = (sTestBit x 63, sExtractBits x [62, 61 .. 52], sExtractBits x [51, 50 .. 0]) -- | Reinterpret the bits in a 32-bit word as a single-precision floating point number sWord32AsSFloat :: SWord32 -> SFloat sWord32AsSFloat fVal | Just f <- unliteral fVal = literal $ CN.wordToFloat f | True = SBV (SVal KFloat (Right (cache y))) where y st = do xsw <- sbvToSW st fVal newExpr st KFloat (SBVApp (IEEEFP (FP_Reinterpret (kindOf fVal) KFloat)) [xsw]) -- | Reinterpret the bits in a 32-bit word as a single-precision floating point number sWord64AsSDouble :: SWord64 -> SDouble sWord64AsSDouble dVal | Just d <- unliteral dVal = literal $ CN.wordToDouble d | True = SBV (SVal KDouble (Right (cache y))) where y st = do xsw <- sbvToSW st dVal newExpr st KDouble (SBVApp (IEEEFP (FP_Reinterpret (kindOf dVal) KDouble)) [xsw]) {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/Data/SBV/Core/Kind.hs0000644000000000000000000002075013405536617014056 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Core.Kind -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Internal data-structures for the sbv library ----------------------------------------------------------------------------- {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeSynonymInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.SBV.Core.Kind (Kind(..), HasKind(..), constructUKind, smtType) where import qualified Data.Generics as G (Data(..), DataType, dataTypeName, dataTypeOf, tyconUQname, dataTypeConstrs, constrFields) import Data.Int import Data.Word import Data.SBV.Core.AlgReals import Data.List (isPrefixOf, intercalate) import Data.Typeable (Typeable) import Data.SBV.Utils.Lib (isKString) -- | Kind of symbolic value data Kind = KBool | KBounded !Bool !Int | KUnbounded | KReal | KUserSort String (Either String [String]) -- name. Left: uninterpreted. Right: enum constructors. | KFloat | KDouble | KChar | KString | KList Kind deriving (Eq, Ord) -- | The interesting about the show instance is that it can tell apart two kinds nicely; since it conveniently -- ignores the enumeration constructors. Also, when we construct a 'KUserSort', we make sure we don't use any of -- the reserved names; see 'constructUKind' for details. instance Show Kind where show KBool = "SBool" show (KBounded False n) = "SWord" ++ show n show (KBounded True n) = "SInt" ++ show n show KUnbounded = "SInteger" show KReal = "SReal" show (KUserSort s _) = s show KFloat = "SFloat" show KDouble = "SDouble" show KString = "SString" show KChar = "SChar" show (KList e) = "[" ++ show e ++ "]" -- | How the type maps to SMT land smtType :: Kind -> String smtType KBool = "Bool" smtType (KBounded _ sz) = "(_ BitVec " ++ show sz ++ ")" smtType KUnbounded = "Int" smtType KReal = "Real" smtType KFloat = "(_ FloatingPoint 8 24)" smtType KDouble = "(_ FloatingPoint 11 53)" smtType KString = "String" smtType KChar = "(_ BitVec 8)" smtType (KList k) = "(Seq " ++ smtType k ++ ")" smtType (KUserSort s _) = s instance Eq G.DataType where a == b = G.tyconUQname (G.dataTypeName a) == G.tyconUQname (G.dataTypeName b) instance Ord G.DataType where a `compare` b = G.tyconUQname (G.dataTypeName a) `compare` G.tyconUQname (G.dataTypeName b) -- | Does this kind represent a signed quantity? kindHasSign :: Kind -> Bool kindHasSign k = case k of KBool -> False KBounded b _ -> b KUnbounded -> True KReal -> True KFloat -> True KDouble -> True KUserSort{} -> False KString -> False KChar -> False KList{} -> False -- | Construct an uninterpreted/enumerated kind from a piece of data; we distinguish simple enumerations as those -- are mapped to proper SMT-Lib2 data-types; while others go completely uninterpreted constructUKind :: forall a. (Read a, G.Data a) => a -> Kind constructUKind a | any (`isPrefixOf` sortName) badPrefixes = error $ "Data.SBV: Cannot construct user-sort with name: " ++ show sortName ++ ": Must not start with any of " ++ intercalate ", " badPrefixes | True = KUserSort sortName mbEnumFields where -- make sure we don't step on ourselves: badPrefixes = ["SBool", "SWord", "SInt", "SInteger", "SReal", "SFloat", "SDouble", "SString", "SChar", "["] dataType = G.dataTypeOf a sortName = G.tyconUQname . G.dataTypeName $ dataType constrs = G.dataTypeConstrs dataType isEnumeration = not (null constrs) && all (null . G.constrFields) constrs mbEnumFields | isEnumeration = check constrs [] | True = Left $ sortName ++ " is not a finite non-empty enumeration" check [] sofar = Right $ reverse sofar check (c:cs) sofar = case checkConstr c of Nothing -> check cs (show c : sofar) Just s -> Left $ sortName ++ "." ++ show c ++ ": " ++ s checkConstr c = case (reads (show c) :: [(a, String)]) of ((_, "") : _) -> Nothing _ -> Just "not a nullary constructor" -- | A class for capturing values that have a sign and a size (finite or infinite) -- minimal complete definition: kindOf, unless you can take advantage of the default -- signature: This class can be automatically derived for data-types that have -- a 'G.Data' instance; this is useful for creating uninterpreted sorts. So, in -- reality, end users should almost never need to define any methods. class HasKind a where kindOf :: a -> Kind hasSign :: a -> Bool intSizeOf :: a -> Int isBoolean :: a -> Bool isBounded :: a -> Bool -- NB. This really means word/int; i.e., Real/Float will test False isReal :: a -> Bool isFloat :: a -> Bool isDouble :: a -> Bool isInteger :: a -> Bool isUninterpreted :: a -> Bool isChar :: a -> Bool isString :: a -> Bool isList :: a -> Bool showType :: a -> String -- defaults hasSign x = kindHasSign (kindOf x) intSizeOf x = case kindOf x of KBool -> error "SBV.HasKind.intSizeOf((S)Bool)" KBounded _ s -> s KUnbounded -> error "SBV.HasKind.intSizeOf((S)Integer)" KReal -> error "SBV.HasKind.intSizeOf((S)Real)" KFloat -> error "SBV.HasKind.intSizeOf((S)Float)" KDouble -> error "SBV.HasKind.intSizeOf((S)Double)" KUserSort s _ -> error $ "SBV.HasKind.intSizeOf: Uninterpreted sort: " ++ s KString -> error "SBV.HasKind.intSizeOf((S)Double)" KChar -> error "SBV.HasKind.intSizeOf((S)Char)" KList ek -> error $ "SBV.HasKind.intSizeOf((S)List)" ++ show ek isBoolean x | KBool{} <- kindOf x = True | True = False isBounded x | KBounded{} <- kindOf x = True | True = False isReal x | KReal{} <- kindOf x = True | True = False isFloat x | KFloat{} <- kindOf x = True | True = False isDouble x | KDouble{} <- kindOf x = True | True = False isInteger x | KUnbounded{} <- kindOf x = True | True = False isUninterpreted x | KUserSort{} <- kindOf x = True | True = False isString x | KString{} <- kindOf x = True | True = False isChar x | KChar{} <- kindOf x = True | True = False isList x | KList{} <- kindOf x = True | True = False showType = show . kindOf -- default signature for uninterpreted/enumerated kinds default kindOf :: (Read a, G.Data a) => a -> Kind kindOf = constructUKind instance HasKind Bool where kindOf _ = KBool instance HasKind Int8 where kindOf _ = KBounded True 8 instance HasKind Word8 where kindOf _ = KBounded False 8 instance HasKind Int16 where kindOf _ = KBounded True 16 instance HasKind Word16 where kindOf _ = KBounded False 16 instance HasKind Int32 where kindOf _ = KBounded True 32 instance HasKind Word32 where kindOf _ = KBounded False 32 instance HasKind Int64 where kindOf _ = KBounded True 64 instance HasKind Word64 where kindOf _ = KBounded False 64 instance HasKind Integer where kindOf _ = KUnbounded instance HasKind AlgReal where kindOf _ = KReal instance HasKind Float where kindOf _ = KFloat instance HasKind Double where kindOf _ = KDouble instance HasKind Char where kindOf _ = KChar instance (Typeable a, HasKind a) => HasKind [a] where kindOf _ | isKString (undefined :: [a]) = KString | True = KList (kindOf (undefined :: a)) instance HasKind Kind where kindOf = id sbv-7.13/Data/SBV/Core/Model.hs0000644000000000000000000025765613405536617014252 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Core.Model -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Instance declarations for our symbolic world ----------------------------------------------------------------------------- {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeSynonymInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.SBV.Core.Model ( Mergeable(..), EqSymbolic(..), OrdSymbolic(..), SDivisible(..), Uninterpreted(..), Metric(..), assertWithPenalty, SIntegral, SFiniteBits(..) , ite, iteLazy, sFromIntegral, sShiftLeft, sShiftRight, sRotateLeft, sRotateRight, sSignedShiftArithRight, (.^) , oneIf, genVar, genVar_, forall, forall_, exists, exists_ , pbAtMost, pbAtLeast, pbExactly, pbLe, pbGe, pbEq, pbMutexed, pbStronglyMutexed , sBool, sBools, sWord8, sWord8s, sWord16, sWord16s, sWord32 , sWord32s, sWord64, sWord64s, sInt8, sInt8s, sInt16, sInt16s, sInt32, sInt32s, sInt64 , sInt64s, sInteger, sIntegers, sReal, sReals, sFloat, sFloats, sDouble, sDoubles, sChar, sChars, sString, sStrings, sList, sLists , slet , sRealToSInteger, label, observe , sAssert , liftQRem, liftDMod, symbolicMergeWithKind , genLiteral, genFromCW, genMkSymVar , sbvQuickCheck ) where import Control.Applicative (ZipList(ZipList)) import Control.Monad (when, unless, mplus) import GHC.Generics (U1(..), M1(..), (:*:)(..), K1(..)) import qualified GHC.Generics as G import GHC.Stack import Data.Array (Array, Ix, listArray, elems, bounds, rangeSize) import Data.Bits (Bits(..)) import Data.Char (toLower, isDigit) import Data.Int (Int8, Int16, Int32, Int64) import Data.List (genericLength, genericIndex, genericTake, unzip4, unzip5, unzip6, unzip7, intercalate, isPrefixOf) import Data.Maybe (fromMaybe) import Data.String (IsString(..)) import Data.Word (Word8, Word16, Word32, Word64) import Data.Dynamic (fromDynamic, toDyn) import Test.QuickCheck (Testable(..), Arbitrary(..)) import qualified Test.QuickCheck.Test as QC (isSuccess) import qualified Test.QuickCheck as QC (quickCheckResult, counterexample) import qualified Test.QuickCheck.Monadic as QC (monadicIO, run, assert, pre, monitor) import Data.SBV.Core.AlgReals import Data.SBV.Core.Data import Data.SBV.Core.Symbolic import Data.SBV.Core.Operations import Data.SBV.Provers.Prover (defaultSMTCfg, SafeResult(..)) import Data.SBV.SMT.SMT (showModel) import Data.SBV.Utils.Boolean import Data.SBV.Utils.Lib (isKString) -- Symbolic-Word class instances -- | Generate a finite symbolic bitvector, named genVar :: Maybe Quantifier -> Kind -> String -> Symbolic (SBV a) genVar q k = mkSymSBV q k . Just -- | Generate a finite symbolic bitvector, unnamed genVar_ :: Maybe Quantifier -> Kind -> Symbolic (SBV a) genVar_ q k = mkSymSBV q k Nothing -- | Generate a finite constant bitvector genLiteral :: Integral a => Kind -> a -> SBV b genLiteral k = SBV . SVal k . Left . mkConstCW k -- | Convert a constant to an integral value genFromCW :: Integral a => CW -> a genFromCW (CW _ (CWInteger x)) = fromInteger x genFromCW c = error $ "genFromCW: Unsupported non-integral value: " ++ show c -- | Generically make a symbolic var genMkSymVar :: Kind -> Maybe Quantifier -> Maybe String -> Symbolic (SBV a) genMkSymVar k mbq Nothing = genVar_ mbq k genMkSymVar k mbq (Just s) = genVar mbq k s -- | Base type of () allows simple construction for uninterpreted types. instance SymWord () instance HasKind () instance SymWord Bool where mkSymWord = genMkSymVar KBool literal x = SBV (svBool x) fromCW = cwToBool instance SymWord Word8 where mkSymWord = genMkSymVar (KBounded False 8) literal = genLiteral (KBounded False 8) fromCW = genFromCW instance SymWord Int8 where mkSymWord = genMkSymVar (KBounded True 8) literal = genLiteral (KBounded True 8) fromCW = genFromCW instance SymWord Word16 where mkSymWord = genMkSymVar (KBounded False 16) literal = genLiteral (KBounded False 16) fromCW = genFromCW instance SymWord Int16 where mkSymWord = genMkSymVar (KBounded True 16) literal = genLiteral (KBounded True 16) fromCW = genFromCW instance SymWord Word32 where mkSymWord = genMkSymVar (KBounded False 32) literal = genLiteral (KBounded False 32) fromCW = genFromCW instance SymWord Int32 where mkSymWord = genMkSymVar (KBounded True 32) literal = genLiteral (KBounded True 32) fromCW = genFromCW instance SymWord Word64 where mkSymWord = genMkSymVar (KBounded False 64) literal = genLiteral (KBounded False 64) fromCW = genFromCW instance SymWord Int64 where mkSymWord = genMkSymVar (KBounded True 64) literal = genLiteral (KBounded True 64) fromCW = genFromCW instance SymWord Integer where mkSymWord = genMkSymVar KUnbounded literal = SBV . SVal KUnbounded . Left . mkConstCW KUnbounded fromCW = genFromCW instance SymWord AlgReal where mkSymWord = genMkSymVar KReal literal = SBV . SVal KReal . Left . CW KReal . CWAlgReal fromCW (CW _ (CWAlgReal a)) = a fromCW c = error $ "SymWord.AlgReal: Unexpected non-real value: " ++ show c -- AlgReal needs its own definition of isConcretely -- to make sure we avoid using unimplementable Haskell functions isConcretely (SBV (SVal KReal (Left (CW KReal (CWAlgReal v))))) p | isExactRational v = p v isConcretely _ _ = False instance SymWord Float where mkSymWord = genMkSymVar KFloat literal = SBV . SVal KFloat . Left . CW KFloat . CWFloat fromCW (CW _ (CWFloat a)) = a fromCW c = error $ "SymWord.Float: Unexpected non-float value: " ++ show c -- For Float, we conservatively return 'False' for isConcretely. The reason is that -- this function is used for optimizations when only one of the argument is concrete, -- and in the presence of NaN's it would be incorrect to do any optimization isConcretely _ _ = False instance SymWord Double where mkSymWord = genMkSymVar KDouble literal = SBV . SVal KDouble . Left . CW KDouble . CWDouble fromCW (CW _ (CWDouble a)) = a fromCW c = error $ "SymWord.Double: Unexpected non-double value: " ++ show c -- For Double, we conservatively return 'False' for isConcretely. The reason is that -- this function is used for optimizations when only one of the argument is concrete, -- and in the presence of NaN's it would be incorrect to do any optimization isConcretely _ _ = False instance SymWord Char where mkSymWord = genMkSymVar KChar literal c = SBV . SVal KChar . Left . CW KChar $ CWChar c fromCW (CW _ (CWChar a)) = a fromCW c = error $ "SymWord.String: Unexpected non-char value: " ++ show c instance SymWord a => SymWord [a] where mkSymWord | isKString (undefined :: [a]) = genMkSymVar KString | True = genMkSymVar (KList (kindOf (undefined :: a))) literal as | isKString (undefined :: [a]) = case fromDynamic (toDyn as) of Just s -> SBV . SVal KString . Left . CW KString . CWString $ s Nothing -> error "SString: Cannot construct literal string!" | True = let k = KList (kindOf (undefined :: a)) toCWVal a = case literal a of SBV (SVal _ (Left (CW _ cwval))) -> cwval _ -> error "SymWord.Sequence: could not produce a concrete word for value" in SBV $ SVal k $ Left $ CW k $ CWList $ map toCWVal as fromCW (CW _ (CWString a)) = fromMaybe (error "SString: Cannot extract a literal string!") (fromDynamic (toDyn a)) fromCW (CW _ (CWList a)) = fromCW . CW (kindOf (undefined :: a)) <$> a fromCW c = error $ "SymWord.fromCW: Unexpected non-list value: " ++ show c instance IsString SString where fromString = literal ------------------------------------------------------------------------------------ -- * Smart constructors for creating symbolic values. These are not strictly -- necessary, as they are mere aliases for 'symbolic' and 'symbolics', but -- they nonetheless make programming easier. ------------------------------------------------------------------------------------ -- | Declare an 'SBool' sBool :: String -> Symbolic SBool sBool = symbolic -- | Declare a list of 'SBool's sBools :: [String] -> Symbolic [SBool] sBools = symbolics -- | Declare an 'SWord8' sWord8 :: String -> Symbolic SWord8 sWord8 = symbolic -- | Declare a list of 'SWord8's sWord8s :: [String] -> Symbolic [SWord8] sWord8s = symbolics -- | Declare an 'SWord16' sWord16 :: String -> Symbolic SWord16 sWord16 = symbolic -- | Declare a list of 'SWord16's sWord16s :: [String] -> Symbolic [SWord16] sWord16s = symbolics -- | Declare an 'SWord32' sWord32 :: String -> Symbolic SWord32 sWord32 = symbolic -- | Declare a list of 'SWord32's sWord32s :: [String] -> Symbolic [SWord32] sWord32s = symbolics -- | Declare an 'SWord64' sWord64 :: String -> Symbolic SWord64 sWord64 = symbolic -- | Declare a list of 'SWord64's sWord64s :: [String] -> Symbolic [SWord64] sWord64s = symbolics -- | Declare an 'SInt8' sInt8 :: String -> Symbolic SInt8 sInt8 = symbolic -- | Declare a list of 'SInt8's sInt8s :: [String] -> Symbolic [SInt8] sInt8s = symbolics -- | Declare an 'SInt16' sInt16 :: String -> Symbolic SInt16 sInt16 = symbolic -- | Declare a list of 'SInt16's sInt16s :: [String] -> Symbolic [SInt16] sInt16s = symbolics -- | Declare an 'SInt32' sInt32 :: String -> Symbolic SInt32 sInt32 = symbolic -- | Declare a list of 'SInt32's sInt32s :: [String] -> Symbolic [SInt32] sInt32s = symbolics -- | Declare an 'SInt64' sInt64 :: String -> Symbolic SInt64 sInt64 = symbolic -- | Declare a list of 'SInt64's sInt64s :: [String] -> Symbolic [SInt64] sInt64s = symbolics -- | Declare an 'SInteger' sInteger:: String -> Symbolic SInteger sInteger = symbolic -- | Declare a list of 'SInteger's sIntegers :: [String] -> Symbolic [SInteger] sIntegers = symbolics -- | Declare an 'SReal' sReal:: String -> Symbolic SReal sReal = symbolic -- | Declare a list of 'SReal's sReals :: [String] -> Symbolic [SReal] sReals = symbolics -- | Declare an 'SFloat' sFloat :: String -> Symbolic SFloat sFloat = symbolic -- | Declare a list of 'SFloat's sFloats :: [String] -> Symbolic [SFloat] sFloats = symbolics -- | Declare an 'SDouble' sDouble :: String -> Symbolic SDouble sDouble = symbolic -- | Declare a list of 'SDouble's sDoubles :: [String] -> Symbolic [SDouble] sDoubles = symbolics -- | Declare an 'SChar' sChar :: String -> Symbolic SChar sChar = symbolic -- | Declare an 'SString' sString :: String -> Symbolic SString sString = symbolic -- | Declare a list of 'SChar's sChars :: [String] -> Symbolic [SChar] sChars = symbolics -- | Declare a list of 'SString's sStrings :: [String] -> Symbolic [SString] sStrings = symbolics -- | Declare an 'SList' sList :: forall a. SymWord a => String -> Symbolic (SList a) sList = symbolic -- | Declare a list of 'SList's sLists :: forall a. SymWord a => [String] -> Symbolic [SList a] sLists = symbolics -- | Convert an SReal to an SInteger. That is, it computes the -- largest integer @n@ that satisfies @sIntegerToSReal n <= r@ -- essentially giving us the @floor@. -- -- For instance, @1.3@ will be @1@, but @-1.3@ will be @-2@. sRealToSInteger :: SReal -> SInteger sRealToSInteger x | Just i <- unliteral x, isExactRational i = literal $ floor (toRational i) | True = SBV (SVal KUnbounded (Right (cache y))) where y st = do xsw <- sbvToSW st x newExpr st KUnbounded (SBVApp (KindCast KReal KUnbounded) [xsw]) -- | label: Label the result of an expression. This is essentially a no-op, but useful as it generates a comment in the generated C/SMT-Lib code. -- Note that if the argument is a constant, then the label is dropped completely, per the usual constant folding strategy. Compare this to 'observe' -- which is good for printing counter-examples. label :: SymWord a => String -> SBV a -> SBV a label m x | Just _ <- unliteral x = x | True = SBV $ SVal k $ Right $ cache r where k = kindOf x r st = do xsw <- sbvToSW st x newExpr st k (SBVApp (Label m) [xsw]) -- | Observe the value of an expression. Such values are useful in model construction, as they are printed part of a satisfying model, or a -- counter-example. The same works for quick-check as well. Useful when we want to see intermediate values, or expected/obtained -- pairs in a particular run. Note that an observed expression is always symbolic, i.e., it won't be constant folded. Compare this to 'label' -- which is used for putting a label in the generated SMTLib-C code. observe :: SymWord a => String -> SBV a -> SBV a observe m x | null m = error "SBV.observe: Bad empty name!" | map toLower m `elem` smtLibReservedNames = error $ "SBV.observe: The name chosen is reserved, please change it!: " ++ show m | "s" `isPrefixOf` m && all isDigit (drop 1 m) = error $ "SBV.observe: Names of the form sXXX are internal to SBV, please use a different name: " ++ show m | True = SBV $ SVal k $ Right $ cache r where k = kindOf x r st = do xsw <- sbvToSW st x recordObservable st m xsw return xsw -- | Symbolic Equality. Note that we can't use Haskell's 'Eq' class since Haskell insists on returning Bool -- Comparing symbolic values will necessarily return a symbolic value. infix 4 .==, ./= class EqSymbolic a where -- | Symbolic equality. (.==) :: a -> a -> SBool -- | Symbolic inequality. (./=) :: a -> a -> SBool -- | Returns (symbolic) true if all the elements of the given list are different. distinct :: [a] -> SBool -- | Returns (symbolic) true if all the elements of the given list are the same. allEqual :: [a] -> SBool -- | Symbolic membership test. sElem :: a -> [a] -> SBool {-# MINIMAL (.==) #-} x ./= y = bnot (x .== y) allEqual [] = true allEqual (x:xs) = bAll (x .==) xs -- Default implementation of distinct. Note that we override -- this method for the base types to generate better code. distinct [] = true distinct (x:xs) = bAll (x ./=) xs &&& distinct xs sElem x xs = bAny (.== x) xs -- | Symbolic Comparisons. Similar to 'Eq', we cannot implement Haskell's 'Ord' class -- since there is no way to return an 'Ordering' value from a symbolic comparison. -- Furthermore, 'OrdSymbolic' requires 'Mergeable' to implement if-then-else, for the -- benefit of implementing symbolic versions of 'max' and 'min' functions. infix 4 .<, .<=, .>, .>= class (Mergeable a, EqSymbolic a) => OrdSymbolic a where -- | Symbolic less than. (.<) :: a -> a -> SBool -- | Symbolic less than or equal to. (.<=) :: a -> a -> SBool -- | Symbolic greater than. (.>) :: a -> a -> SBool -- | Symbolic greater than or equal to. (.>=) :: a -> a -> SBool -- | Symbolic minimum. smin :: a -> a -> a -- | Symbolic maximum. smax :: a -> a -> a -- | Is the value withing the allowed /inclusive/ range? inRange :: a -> (a, a) -> SBool {-# MINIMAL (.<) #-} a .<= b = a .< b ||| a .== b a .> b = b .< a a .>= b = b .<= a a `smin` b = ite (a .<= b) a b a `smax` b = ite (a .<= b) b a inRange x (y, z) = x .>= y &&& x .<= z {- We can't have a generic instance of the form: instance Eq a => EqSymbolic a where x .== y = if x == y then true else false even if we're willing to allow Flexible/undecidable instances.. This is because if we allow this it would imply EqSymbolic (SBV a); since (SBV a) has to be Eq as it must be a Num. But this wouldn't be the right choice obviously; as the Eq instance is bogus for SBV for natural reasons.. -} instance EqSymbolic (SBV a) where SBV x .== SBV y = SBV (svEqual x y) SBV x ./= SBV y = SBV (svNotEqual x y) -- Custom version of distinct that generates better code for base types distinct [] = true distinct [_] = true distinct xs | all isConc xs = checkDiff xs | True = SBV (SVal KBool (Right (cache r))) where r st = do xsw <- mapM (sbvToSW st) xs newExpr st KBool (SBVApp NotEqual xsw) -- We call this in case all are concrete, which will -- reduce to a constant and generate no code at all! -- Note that this is essentially the same as the default -- definition, which unfortunately we can no longer call! checkDiff [] = true checkDiff (a:as) = bAll (a ./=) as &&& checkDiff as -- Sigh, we can't use isConcrete since that requires SymWord -- constraint that we don't have here. (To support SBools.) isConc (SBV (SVal _ (Left _))) = True isConc _ = False instance SymWord a => OrdSymbolic (SBV a) where SBV x .< SBV y = SBV (svLessThan x y) SBV x .<= SBV y = SBV (svLessEq x y) SBV x .> SBV y = SBV (svGreaterThan x y) SBV x .>= SBV y = SBV (svGreaterEq x y) -- Bool instance EqSymbolic Bool where x .== y = if x == y then true else false -- Lists instance EqSymbolic a => EqSymbolic [a] where [] .== [] = true (x:xs) .== (y:ys) = x .== y &&& xs .== ys _ .== _ = false instance OrdSymbolic a => OrdSymbolic [a] where [] .< [] = false [] .< _ = true _ .< [] = false (x:xs) .< (y:ys) = x .< y ||| (x .== y &&& xs .< ys) -- Maybe instance EqSymbolic a => EqSymbolic (Maybe a) where Nothing .== Nothing = true Just a .== Just b = a .== b _ .== _ = false instance (OrdSymbolic a) => OrdSymbolic (Maybe a) where Nothing .< Nothing = false Nothing .< _ = true Just _ .< Nothing = false Just a .< Just b = a .< b -- Either instance (EqSymbolic a, EqSymbolic b) => EqSymbolic (Either a b) where Left a .== Left b = a .== b Right a .== Right b = a .== b _ .== _ = false instance (OrdSymbolic a, OrdSymbolic b) => OrdSymbolic (Either a b) where Left a .< Left b = a .< b Left _ .< Right _ = true Right _ .< Left _ = false Right a .< Right b = a .< b -- 2-Tuple instance (EqSymbolic a, EqSymbolic b) => EqSymbolic (a, b) where (a0, b0) .== (a1, b1) = a0 .== a1 &&& b0 .== b1 instance (OrdSymbolic a, OrdSymbolic b) => OrdSymbolic (a, b) where (a0, b0) .< (a1, b1) = a0 .< a1 ||| (a0 .== a1 &&& b0 .< b1) -- 3-Tuple instance (EqSymbolic a, EqSymbolic b, EqSymbolic c) => EqSymbolic (a, b, c) where (a0, b0, c0) .== (a1, b1, c1) = (a0, b0) .== (a1, b1) &&& c0 .== c1 instance (OrdSymbolic a, OrdSymbolic b, OrdSymbolic c) => OrdSymbolic (a, b, c) where (a0, b0, c0) .< (a1, b1, c1) = (a0, b0) .< (a1, b1) ||| ((a0, b0) .== (a1, b1) &&& c0 .< c1) -- 4-Tuple instance (EqSymbolic a, EqSymbolic b, EqSymbolic c, EqSymbolic d) => EqSymbolic (a, b, c, d) where (a0, b0, c0, d0) .== (a1, b1, c1, d1) = (a0, b0, c0) .== (a1, b1, c1) &&& d0 .== d1 instance (OrdSymbolic a, OrdSymbolic b, OrdSymbolic c, OrdSymbolic d) => OrdSymbolic (a, b, c, d) where (a0, b0, c0, d0) .< (a1, b1, c1, d1) = (a0, b0, c0) .< (a1, b1, c1) ||| ((a0, b0, c0) .== (a1, b1, c1) &&& d0 .< d1) -- 5-Tuple instance (EqSymbolic a, EqSymbolic b, EqSymbolic c, EqSymbolic d, EqSymbolic e) => EqSymbolic (a, b, c, d, e) where (a0, b0, c0, d0, e0) .== (a1, b1, c1, d1, e1) = (a0, b0, c0, d0) .== (a1, b1, c1, d1) &&& e0 .== e1 instance (OrdSymbolic a, OrdSymbolic b, OrdSymbolic c, OrdSymbolic d, OrdSymbolic e) => OrdSymbolic (a, b, c, d, e) where (a0, b0, c0, d0, e0) .< (a1, b1, c1, d1, e1) = (a0, b0, c0, d0) .< (a1, b1, c1, d1) ||| ((a0, b0, c0, d0) .== (a1, b1, c1, d1) &&& e0 .< e1) -- 6-Tuple instance (EqSymbolic a, EqSymbolic b, EqSymbolic c, EqSymbolic d, EqSymbolic e, EqSymbolic f) => EqSymbolic (a, b, c, d, e, f) where (a0, b0, c0, d0, e0, f0) .== (a1, b1, c1, d1, e1, f1) = (a0, b0, c0, d0, e0) .== (a1, b1, c1, d1, e1) &&& f0 .== f1 instance (OrdSymbolic a, OrdSymbolic b, OrdSymbolic c, OrdSymbolic d, OrdSymbolic e, OrdSymbolic f) => OrdSymbolic (a, b, c, d, e, f) where (a0, b0, c0, d0, e0, f0) .< (a1, b1, c1, d1, e1, f1) = (a0, b0, c0, d0, e0) .< (a1, b1, c1, d1, e1) ||| ((a0, b0, c0, d0, e0) .== (a1, b1, c1, d1, e1) &&& f0 .< f1) -- 7-Tuple instance (EqSymbolic a, EqSymbolic b, EqSymbolic c, EqSymbolic d, EqSymbolic e, EqSymbolic f, EqSymbolic g) => EqSymbolic (a, b, c, d, e, f, g) where (a0, b0, c0, d0, e0, f0, g0) .== (a1, b1, c1, d1, e1, f1, g1) = (a0, b0, c0, d0, e0, f0) .== (a1, b1, c1, d1, e1, f1) &&& g0 .== g1 instance (OrdSymbolic a, OrdSymbolic b, OrdSymbolic c, OrdSymbolic d, OrdSymbolic e, OrdSymbolic f, OrdSymbolic g) => OrdSymbolic (a, b, c, d, e, f, g) where (a0, b0, c0, d0, e0, f0, g0) .< (a1, b1, c1, d1, e1, f1, g1) = (a0, b0, c0, d0, e0, f0) .< (a1, b1, c1, d1, e1, f1) ||| ((a0, b0, c0, d0, e0, f0) .== (a1, b1, c1, d1, e1, f1) &&& g0 .< g1) -- | Symbolic Numbers. This is a simple class that simply incorporates all number like -- base types together, simplifying writing polymorphic type-signatures that work for all -- symbolic numbers, such as 'SWord8', 'SInt8' etc. For instance, we can write a generic -- list-minimum function as follows: -- -- @ -- mm :: SIntegral a => [SBV a] -> SBV a -- mm = foldr1 (\a b -> ite (a .<= b) a b) -- @ -- -- It is similar to the standard 'Integral' class, except ranging over symbolic instances. class (SymWord a, Num a, Bits a, Integral a) => SIntegral a -- 'SIntegral' Instances, skips Real/Float/Bool instance SIntegral Word8 instance SIntegral Word16 instance SIntegral Word32 instance SIntegral Word64 instance SIntegral Int8 instance SIntegral Int16 instance SIntegral Int32 instance SIntegral Int64 instance SIntegral Integer -- | Finite bit-length symbolic values. Essentially the same as 'SIntegral', but further leaves out 'Integer'. Loosely -- based on Haskell's @FiniteBits@ class, but with more methods defined and structured differently to fit into the -- symbolic world view. Minimal complete definition: 'sFiniteBitSize'. class (SymWord a, Num a, Bits a) => SFiniteBits a where -- | Bit size. sFiniteBitSize :: SBV a -> Int -- | Least significant bit of a word, always stored at index 0. lsb :: SBV a -> SBool -- | Most significant bit of a word, always stored at the last position. msb :: SBV a -> SBool -- | Big-endian blasting of a word into its bits. blastBE :: SBV a -> [SBool] -- | Little-endian blasting of a word into its bits. blastLE :: SBV a -> [SBool] -- | Reconstruct from given bits, given in little-endian. fromBitsBE :: [SBool] -> SBV a -- | Reconstruct from given bits, given in little-endian. fromBitsLE :: [SBool] -> SBV a -- | Replacement for 'testBit', returning 'SBool' instead of 'Bool'. sTestBit :: SBV a -> Int -> SBool -- | Variant of 'sTestBit', where we want to extract multiple bit positions. sExtractBits :: SBV a -> [Int] -> [SBool] -- | Variant of 'popCount', returning a symbolic value. sPopCount :: SBV a -> SWord8 -- | A combo of 'setBit' and 'clearBit', when the bit to be set is symbolic. setBitTo :: SBV a -> Int -> SBool -> SBV a -- | Full adder, returns carry-out from the addition. Only for unsigned quantities. fullAdder :: SBV a -> SBV a -> (SBool, SBV a) -- | Full multipler, returns both high and low-order bits. Only for unsigned quantities. fullMultiplier :: SBV a -> SBV a -> (SBV a, SBV a) -- | Count leading zeros in a word, big-endian interpretation. sCountLeadingZeros :: SBV a -> SWord8 -- | Count trailing zeros in a word, big-endian interpretation. sCountTrailingZeros :: SBV a -> SWord8 -- Default implementations lsb (SBV v) = SBV (svTestBit v 0) msb x = sTestBit x (sFiniteBitSize x - 1) blastBE = reverse . blastLE blastLE x = map (sTestBit x) [0 .. intSizeOf x - 1] fromBitsBE = fromBitsLE . reverse fromBitsLE bs | length bs /= w = error $ "SBV.SFiniteBits.fromBitsLE/BE: Expected: " ++ show w ++ " bits, received: " ++ show (length bs) | True = result where w = sFiniteBitSize result result = go 0 0 bs go !acc _ [] = acc go !acc !i (x:xs) = go (ite x (setBit acc i) acc) (i+1) xs sTestBit (SBV x) i = SBV (svTestBit x i) sExtractBits x = map (sTestBit x) -- NB. 'sPopCount' returns an 'SWord8', which can overflow when used on quantities that have -- more than 255 bits. For the regular interface, this suffices for all types we support. -- For the Dynamic interface, if we ever implement this, this will fail for bit-vectors -- larger than that many bits. The alternative would be to return SInteger here, but that -- seems a total overkill for most use cases. If such is required, users are encouraged -- to define their own variants, which is rather easy. sPopCount x | isConcrete x = go 0 x | True = sum [ite b 1 0 | b <- blastLE x] where -- concrete case go !c 0 = c go !c w = go (c+1) (w .&. (w-1)) setBitTo x i b = ite b (setBit x i) (clearBit x i) fullAdder a b | isSigned a = error "fullAdder: only works on unsigned numbers" | True = (a .> s ||| b .> s, s) where s = a + b -- N.B. The higher-order bits are determined using a simple shift-add multiplier, -- thus involving bit-blasting. It'd be naive to expect SMT solvers to deal efficiently -- with properties involving this function, at least with the current state of the art. fullMultiplier a b | isSigned a = error "fullMultiplier: only works on unsigned numbers" | True = (go (sFiniteBitSize a) 0 a, a*b) where go 0 p _ = p go n p x = let (c, p') = ite (lsb x) (fullAdder p b) (false, p) (o, p'') = shiftIn c p' (_, x') = shiftIn o x in go (n-1) p'' x' shiftIn k v = (lsb v, mask .|. (v `shiftR` 1)) where mask = ite k (bit (sFiniteBitSize v - 1)) 0 -- See the note for 'sPopCount' for a comment on why we return 'SWord8' sCountLeadingZeros x = fromIntegral m - go m where m = sFiniteBitSize x - 1 -- NB. When i is 0 below, which happens when x is 0 as we count all the way down, -- we return -1, which is equal to 2^n-1, giving us: n-1-(2^n-1) = n-2^n = n, as required, i.e., the bit-size. go :: Int -> SWord8 go i | i < 0 = i8 | True = ite (sTestBit x i) i8 (go (i-1)) where i8 = literal (fromIntegral i :: Word8) -- See the note for 'sPopCount' for a comment on why we return 'SWord8' sCountTrailingZeros x = go 0 where m = sFiniteBitSize x go :: Int -> SWord8 go i | i >= m = i8 | True = ite (sTestBit x i) i8 (go (i+1)) where i8 = literal (fromIntegral i :: Word8) -- 'SIntegral' Instances, skips Real/Float/Bool/Integer instance SFiniteBits Word8 where sFiniteBitSize _ = 8 instance SFiniteBits Word16 where sFiniteBitSize _ = 16 instance SFiniteBits Word32 where sFiniteBitSize _ = 32 instance SFiniteBits Word64 where sFiniteBitSize _ = 64 instance SFiniteBits Int8 where sFiniteBitSize _ = 8 instance SFiniteBits Int16 where sFiniteBitSize _ = 16 instance SFiniteBits Int32 where sFiniteBitSize _ = 32 instance SFiniteBits Int64 where sFiniteBitSize _ = 64 -- | Returns 1 if the boolean is true, otherwise 0. oneIf :: (Num a, SymWord a) => SBool -> SBV a oneIf t = ite t 1 0 -- | Lift a pseudo-boolean op, performing checks liftPB :: String -> PBOp -> [SBool] -> SBool liftPB w o xs | Just e <- check o = error $ "SBV." ++ w ++ ": " ++ e | True = result where check (PB_AtMost k) = pos k check (PB_AtLeast k) = pos k check (PB_Exactly k) = pos k check (PB_Le cs k) = pos k `mplus` match cs check (PB_Ge cs k) = pos k `mplus` match cs check (PB_Eq cs k) = pos k `mplus` match cs pos k | k < 0 = Just $ "comparison value must be positive, received: " ++ show k | True = Nothing match cs | any (< 0) cs = Just $ "coefficients must be non-negative. Received: " ++ show cs | lxs /= lcs = Just $ "coefficient length must match number of arguments. Received: " ++ show (lcs, lxs) | True = Nothing where lxs = length xs lcs = length cs result = SBV (SVal KBool (Right (cache r))) r st = do xsw <- mapM (sbvToSW st) xs -- PseudoBoolean's implicitly require support for integers, so make sure to register that kind! registerKind st KUnbounded newExpr st KBool (SBVApp (PseudoBoolean o) xsw) -- | 'true' if at most @k@ of the input arguments are 'true' pbAtMost :: [SBool] -> Int -> SBool pbAtMost xs k | k < 0 = error $ "SBV.pbAtMost: Non-negative value required, received: " ++ show k | all isConcrete xs = literal $ sum (map (pbToInteger "pbAtMost" 1) xs) <= fromIntegral k | True = liftPB "pbAtMost" (PB_AtMost k) xs -- | 'true' if at least @k@ of the input arguments are 'true' pbAtLeast :: [SBool] -> Int -> SBool pbAtLeast xs k | k < 0 = error $ "SBV.pbAtLeast: Non-negative value required, received: " ++ show k | all isConcrete xs = literal $ sum (map (pbToInteger "pbAtLeast" 1) xs) >= fromIntegral k | True = liftPB "pbAtLeast" (PB_AtLeast k) xs -- | 'true' if exactly @k@ of the input arguments are 'true' pbExactly :: [SBool] -> Int -> SBool pbExactly xs k | k < 0 = error $ "SBV.pbExactly: Non-negative value required, received: " ++ show k | all isConcrete xs = literal $ sum (map (pbToInteger "pbExactly" 1) xs) == fromIntegral k | True = liftPB "pbExactly" (PB_Exactly k) xs -- | 'true' if the sum of coefficients for 'true' elements is at most @k@. Generalizes 'pbAtMost'. pbLe :: [(Int, SBool)] -> Int -> SBool pbLe xs k | k < 0 = error $ "SBV.pbLe: Non-negative value required, received: " ++ show k | all isConcrete (map snd xs) = literal $ sum [pbToInteger "pbLe" c b | (c, b) <- xs] <= fromIntegral k | True = liftPB "pbLe" (PB_Le (map fst xs) k) (map snd xs) -- | 'true' if the sum of coefficients for 'true' elements is at least @k@. Generalizes 'pbAtLeast'. pbGe :: [(Int, SBool)] -> Int -> SBool pbGe xs k | k < 0 = error $ "SBV.pbGe: Non-negative value required, received: " ++ show k | all isConcrete (map snd xs) = literal $ sum [pbToInteger "pbGe" c b | (c, b) <- xs] >= fromIntegral k | True = liftPB "pbGe" (PB_Ge (map fst xs) k) (map snd xs) -- | 'true' if the sum of coefficients for 'true' elements is exactly least @k@. Useful for coding -- /exactly K-of-N/ constraints, and in particular mutex constraints. pbEq :: [(Int, SBool)] -> Int -> SBool pbEq xs k | k < 0 = error $ "SBV.pbEq: Non-negative value required, received: " ++ show k | all isConcrete (map snd xs) = literal $ sum [pbToInteger "pbEq" c b | (c, b) <- xs] == fromIntegral k | True = liftPB "pbEq" (PB_Eq (map fst xs) k) (map snd xs) -- | 'true' if there is at most one set bit pbMutexed :: [SBool] -> SBool pbMutexed xs = pbAtMost xs 1 -- | 'true' if there is exactly one set bit pbStronglyMutexed :: [SBool] -> SBool pbStronglyMutexed xs = pbExactly xs 1 -- | Convert a concrete pseudo-boolean to given int; converting to integer pbToInteger :: String -> Int -> SBool -> Integer pbToInteger w c b | c < 0 = error $ "SBV." ++ w ++ ": Non-negative coefficient required, received: " ++ show c | Just v <- unliteral b = if v then fromIntegral c else 0 | True = error $ "SBV.pbToInteger: Received a symbolic boolean: " ++ show (c, b) -- | Predicate for optimizing word operations like (+) and (*). isConcreteZero :: SBV a -> Bool isConcreteZero (SBV (SVal _ (Left (CW _ (CWInteger n))))) = n == 0 isConcreteZero (SBV (SVal KReal (Left (CW KReal (CWAlgReal v))))) = isExactRational v && v == 0 isConcreteZero _ = False -- | Predicate for optimizing word operations like (+) and (*). isConcreteOne :: SBV a -> Bool isConcreteOne (SBV (SVal _ (Left (CW _ (CWInteger 1))))) = True isConcreteOne (SBV (SVal KReal (Left (CW KReal (CWAlgReal v))))) = isExactRational v && v == 1 isConcreteOne _ = False -- Num instance for symbolic words. instance (Ord a, Num a, SymWord a) => Num (SBV a) where fromInteger = literal . fromIntegral SBV x + SBV y = SBV (svPlus x y) SBV x * SBV y = SBV (svTimes x y) SBV x - SBV y = SBV (svMinus x y) -- Abs is problematic for floating point, due to -0; case, so we carefully shuttle it down -- to the solver to avoid the can of worms. (Alternative would be to do an if-then-else here.) abs (SBV x) = SBV (svAbs x) signum a -- NB. The following "carefully" tests the number for == 0, as Float/Double's NaN and +/-0 -- cases would cause trouble with explicit equality tests. | hasSign a = ite (a .> z) i $ ite (a .< z) (negate i) a | True = ite (a .> z) i a where z = genLiteral (kindOf a) (0::Integer) i = genLiteral (kindOf a) (1::Integer) -- negate is tricky because on double/float -0 is different than 0; so we cannot -- just rely on the default definition; which would be 0-0, which is not -0! negate (SBV x) = SBV (svUNeg x) -- | Symbolic exponentiation using bit blasting and repeated squaring. -- -- N.B. The exponent must be unsigned/bounded if symbolic. Signed exponents will be rejected. (.^) :: (Mergeable b, Num b, SIntegral e) => b -> SBV e -> b b .^ e | isConcrete e, Just (x :: Integer) <- unliteral (sFromIntegral e) = if x >= 0 then let go n v | n == 0 = 1 | even n = go (n `div` 2) (v * v) | True = v * go (n `div` 2) (v * v) in go x b else error $ "(.^): exponentiation: negative exponent: " ++ show x | not (isBounded e) || isSigned e = error $ "(.^): exponentiation only works with unsigned bounded symbolic exponents, kind: " ++ show (kindOf e) | True = -- NB. We can't simply use sTestBit and blastLE since they have SFiniteBit requirement -- but we want to have SIntegral here only. let SBV expt = e expBit i = SBV (svTestBit expt i) blasted = map expBit [0 .. intSizeOf e - 1] in product $ zipWith (\use n -> ite use n 1) blasted (iterate (\x -> x*x) b) instance (SymWord a, Fractional a) => Fractional (SBV a) where fromRational = literal . fromRational SBV x / sy@(SBV y) | div0 = ite (sy .== 0) 0 res | True = res where res = SBV (svDivide x y) -- Identify those kinds where we have a div-0 equals 0 exception div0 = case kindOf sy of KFloat -> False KDouble -> False KReal -> True -- Following two cases should not happen since these types should *not* be instances of Fractional k@KBounded{} -> error $ "Unexpected Fractional case for: " ++ show k k@KUnbounded -> error $ "Unexpected Fractional case for: " ++ show k k@KBool -> error $ "Unexpected Fractional case for: " ++ show k k@KString -> error $ "Unexpected Fractional case for: " ++ show k k@KChar -> error $ "Unexpected Fractional case for: " ++ show k k@KList{} -> error $ "Unexpected Fractional case for: " ++ show k k@KUserSort{} -> error $ "Unexpected Fractional case for: " ++ show k -- | Define Floating instance on SBV's; only for base types that are already floating; i.e., SFloat and SDouble -- Note that most of the fields are "undefined" for symbolic values, we add methods as they are supported by SMTLib. -- Currently, the only symbolicly available function in this class is sqrt. instance (SymWord a, Fractional a, Floating a) => Floating (SBV a) where pi = literal pi exp = lift1FNS "exp" exp log = lift1FNS "log" log sqrt = lift1F FP_Sqrt sqrt sin = lift1FNS "sin" sin cos = lift1FNS "cos" cos tan = lift1FNS "tan" tan asin = lift1FNS "asin" asin acos = lift1FNS "acos" acos atan = lift1FNS "atan" atan sinh = lift1FNS "sinh" sinh cosh = lift1FNS "cosh" cosh tanh = lift1FNS "tanh" tanh asinh = lift1FNS "asinh" asinh acosh = lift1FNS "acosh" acosh atanh = lift1FNS "atanh" atanh (**) = lift2FNS "**" (**) logBase = lift2FNS "logBase" logBase -- | Lift a 1 arg FP-op, using sRNE default lift1F :: SymWord a => FPOp -> (a -> a) -> SBV a -> SBV a lift1F w op a | Just v <- unliteral a = literal $ op v | True = SBV $ SVal k $ Right $ cache r where k = kindOf a r st = do swa <- sbvToSW st a swm <- sbvToSW st sRNE newExpr st k (SBVApp (IEEEFP w) [swm, swa]) -- | Lift a float/double unary function, only over constants lift1FNS :: (SymWord a, Floating a) => String -> (a -> a) -> SBV a -> SBV a lift1FNS nm f sv | Just v <- unliteral sv = literal $ f v | True = error $ "SBV." ++ nm ++ ": not supported for symbolic values of type " ++ show (kindOf sv) -- | Lift a float/double binary function, only over constants lift2FNS :: (SymWord a, Floating a) => String -> (a -> a -> a) -> SBV a -> SBV a -> SBV a lift2FNS nm f sv1 sv2 | Just v1 <- unliteral sv1 , Just v2 <- unliteral sv2 = literal $ f v1 v2 | True = error $ "SBV." ++ nm ++ ": not supported for symbolic values of type " ++ show (kindOf sv1) -- NB. In the optimizations below, use of -1 is valid as -- -1 has all bits set to True for both signed and unsigned values -- | Using 'popCount' or 'testBit' on non-concrete values will result in an -- error. Use 'sPopCount' or 'sTestBit' instead. instance (Num a, Bits a, SymWord a) => Bits (SBV a) where SBV x .&. SBV y = SBV (svAnd x y) SBV x .|. SBV y = SBV (svOr x y) SBV x `xor` SBV y = SBV (svXOr x y) complement (SBV x) = SBV (svNot x) bitSize x = intSizeOf x bitSizeMaybe x = Just $ intSizeOf x isSigned x = hasSign x bit i = 1 `shiftL` i setBit x i = x .|. genLiteral (kindOf x) (bit i :: Integer) clearBit x i = x .&. genLiteral (kindOf x) (complement (bit i) :: Integer) complementBit x i = x `xor` genLiteral (kindOf x) (bit i :: Integer) shiftL (SBV x) i = SBV (svShl x i) shiftR (SBV x) i = SBV (svShr x i) rotateL (SBV x) i = SBV (svRol x i) rotateR (SBV x) i = SBV (svRor x i) -- NB. testBit is *not* implementable on non-concrete symbolic words x `testBit` i | SBV (SVal _ (Left (CW _ (CWInteger n)))) <- x = testBit n i | True = error $ "SBV.testBit: Called on symbolic value: " ++ show x ++ ". Use sTestBit instead." -- NB. popCount is *not* implementable on non-concrete symbolic words popCount x | SBV (SVal _ (Left (CW (KBounded _ w) (CWInteger n)))) <- x = popCount (n .&. (bit w - 1)) | True = error $ "SBV.popCount: Called on symbolic value: " ++ show x ++ ". Use sPopCount instead." -- | Conversion between integral-symbolic values, akin to Haskell's `fromIntegral` sFromIntegral :: forall a b. (Integral a, HasKind a, Num a, SymWord a, HasKind b, Num b, SymWord b) => SBV a -> SBV b sFromIntegral x | isReal x = error "SBV.sFromIntegral: Called on a real value" -- can't really happen due to types, but being overcautious | Just v <- unliteral x = literal (fromIntegral v) | True = result where result = SBV (SVal kTo (Right (cache y))) kFrom = kindOf x kTo = kindOf (undefined :: b) y st = do xsw <- sbvToSW st x newExpr st kTo (SBVApp (KindCast kFrom kTo) [xsw]) -- | Lift a binary operation thru it's dynamic counterpart. Note that -- we still want the actual functions here as differ in their type -- compared to their dynamic counterparts, but the implementations -- are the same. liftViaSVal :: (SVal -> SVal -> SVal) -> SBV a -> SBV b -> SBV c liftViaSVal f (SBV a) (SBV b) = SBV $ f a b -- | Generalization of 'shiftL', when the shift-amount is symbolic. Since Haskell's -- 'shiftL' only takes an 'Int' as the shift amount, it cannot be used when we have -- a symbolic amount to shift with. sShiftLeft :: (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a sShiftLeft = liftViaSVal svShiftLeft -- | Generalization of 'shiftR', when the shift-amount is symbolic. Since Haskell's -- 'shiftR' only takes an 'Int' as the shift amount, it cannot be used when we have -- a symbolic amount to shift with. -- -- NB. If the shiftee is signed, then this is an arithmetic shift; otherwise it's logical, -- following the usual Haskell convention. See 'sSignedShiftArithRight' for a variant -- that explicitly uses the msb as the sign bit, even for unsigned underlying types. sShiftRight :: (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a sShiftRight = liftViaSVal svShiftRight -- | Arithmetic shift-right with a symbolic unsigned shift amount. This is equivalent -- to 'sShiftRight' when the argument is signed. However, if the argument is unsigned, -- then it explicitly treats its msb as a sign-bit, and uses it as the bit that -- gets shifted in. Useful when using the underlying unsigned bit representation to implement -- custom signed operations. Note that there is no direct Haskell analogue of this function. sSignedShiftArithRight:: (SFiniteBits a, SIntegral b) => SBV a -> SBV b -> SBV a sSignedShiftArithRight x i | isSigned i = error "sSignedShiftArithRight: shift amount should be unsigned" | isSigned x = ssa x i | True = ite (msb x) (complement (ssa (complement x) i)) (ssa x i) where ssa = liftViaSVal svShiftRight -- | Generalization of 'rotateL', when the shift-amount is symbolic. Since Haskell's -- 'rotateL' only takes an 'Int' as the shift amount, it cannot be used when we have -- a symbolic amount to shift with. The first argument should be a bounded quantity. sRotateLeft :: (SIntegral a, SIntegral b, SDivisible (SBV b)) => SBV a -> SBV b -> SBV a sRotateLeft = liftViaSVal svRotateLeft -- | Generalization of 'rotateR', when the shift-amount is symbolic. Since Haskell's -- 'rotateR' only takes an 'Int' as the shift amount, it cannot be used when we have -- a symbolic amount to shift with. The first argument should be a bounded quantity. sRotateRight :: (SIntegral a, SIntegral b, SDivisible (SBV b)) => SBV a -> SBV b -> SBV a sRotateRight = liftViaSVal svRotateRight -- Enum instance. These instances are suitable for use with concrete values, -- and will be less useful for symbolic values around. Note that `fromEnum` requires -- a concrete argument for obvious reasons. Other variants (succ, pred, [x..]) etc are similarly -- limited. While symbolic variants can be defined for many of these, they will just diverge -- as final sizes cannot be determined statically. instance (Show a, Bounded a, Integral a, Num a, SymWord a) => Enum (SBV a) where succ x | v == (maxBound :: a) = error $ "Enum.succ{" ++ showType x ++ "}: tried to take `succ' of maxBound" | True = fromIntegral $ v + 1 where v = enumCvt "succ" x pred x | v == (minBound :: a) = error $ "Enum.pred{" ++ showType x ++ "}: tried to take `pred' of minBound" | True = fromIntegral $ v - 1 where v = enumCvt "pred" x toEnum x | xi < fromIntegral (minBound :: a) || xi > fromIntegral (maxBound :: a) = error $ "Enum.toEnum{" ++ showType r ++ "}: " ++ show x ++ " is out-of-bounds " ++ show (minBound :: a, maxBound :: a) | True = r where xi :: Integer xi = fromIntegral x r :: SBV a r = fromIntegral x fromEnum x | r < fromIntegral (minBound :: Int) || r > fromIntegral (maxBound :: Int) = error $ "Enum.fromEnum{" ++ showType x ++ "}: value " ++ show r ++ " is outside of Int's bounds " ++ show (minBound :: Int, maxBound :: Int) | True = fromIntegral r where r :: Integer r = enumCvt "fromEnum" x enumFrom x = map fromIntegral [xi .. fromIntegral (maxBound :: a)] where xi :: Integer xi = enumCvt "enumFrom" x enumFromThen x y | yi >= xi = map fromIntegral [xi, yi .. fromIntegral (maxBound :: a)] | True = map fromIntegral [xi, yi .. fromIntegral (minBound :: a)] where xi, yi :: Integer xi = enumCvt "enumFromThen.x" x yi = enumCvt "enumFromThen.y" y enumFromThenTo x y z = map fromIntegral [xi, yi .. zi] where xi, yi, zi :: Integer xi = enumCvt "enumFromThenTo.x" x yi = enumCvt "enumFromThenTo.y" y zi = enumCvt "enumFromThenTo.z" z -- | Helper function for use in enum operations enumCvt :: (SymWord a, Integral a, Num b) => String -> SBV a -> b enumCvt w x = case unliteral x of Nothing -> error $ "Enum." ++ w ++ "{" ++ showType x ++ "}: Called on symbolic value " ++ show x Just v -> fromIntegral v -- | The 'SDivisible' class captures the essence of division. -- Unfortunately we cannot use Haskell's 'Integral' class since the 'Real' -- and 'Enum' superclasses are not implementable for symbolic bit-vectors. -- However, 'quotRem' and 'divMod' both make perfect sense, and the 'SDivisible' class captures -- this operation. One issue is how division by 0 behaves. The verification -- technology requires total functions, and there are several design choices -- here. We follow Isabelle/HOL approach of assigning the value 0 for division -- by 0. Therefore, we impose the following pair of laws: -- -- @ -- x `sQuotRem` 0 = (0, x) -- x `sDivMod` 0 = (0, x) -- @ -- -- Note that our instances implement this law even when @x@ is @0@ itself. -- -- NB. 'quot' truncates toward zero, while 'div' truncates toward negative infinity. -- -- Minimal complete definition: 'sQuotRem', 'sDivMod' class SDivisible a where sQuotRem :: a -> a -> (a, a) sDivMod :: a -> a -> (a, a) sQuot :: a -> a -> a sRem :: a -> a -> a sDiv :: a -> a -> a sMod :: a -> a -> a x `sQuot` y = fst $ x `sQuotRem` y x `sRem` y = snd $ x `sQuotRem` y x `sDiv` y = fst $ x `sDivMod` y x `sMod` y = snd $ x `sDivMod` y instance SDivisible Word64 where sQuotRem x 0 = (0, x) sQuotRem x y = x `quotRem` y sDivMod x 0 = (0, x) sDivMod x y = x `divMod` y instance SDivisible Int64 where sQuotRem x 0 = (0, x) sQuotRem x y = x `quotRem` y sDivMod x 0 = (0, x) sDivMod x y = x `divMod` y instance SDivisible Word32 where sQuotRem x 0 = (0, x) sQuotRem x y = x `quotRem` y sDivMod x 0 = (0, x) sDivMod x y = x `divMod` y instance SDivisible Int32 where sQuotRem x 0 = (0, x) sQuotRem x y = x `quotRem` y sDivMod x 0 = (0, x) sDivMod x y = x `divMod` y instance SDivisible Word16 where sQuotRem x 0 = (0, x) sQuotRem x y = x `quotRem` y sDivMod x 0 = (0, x) sDivMod x y = x `divMod` y instance SDivisible Int16 where sQuotRem x 0 = (0, x) sQuotRem x y = x `quotRem` y sDivMod x 0 = (0, x) sDivMod x y = x `divMod` y instance SDivisible Word8 where sQuotRem x 0 = (0, x) sQuotRem x y = x `quotRem` y sDivMod x 0 = (0, x) sDivMod x y = x `divMod` y instance SDivisible Int8 where sQuotRem x 0 = (0, x) sQuotRem x y = x `quotRem` y sDivMod x 0 = (0, x) sDivMod x y = x `divMod` y instance SDivisible Integer where sQuotRem x 0 = (0, x) sQuotRem x y = x `quotRem` y sDivMod x 0 = (0, x) sDivMod x y = x `divMod` y instance SDivisible CW where sQuotRem a b | CWInteger x <- cwVal a, CWInteger y <- cwVal b = let (r1, r2) = sQuotRem x y in (normCW a{ cwVal = CWInteger r1 }, normCW b{ cwVal = CWInteger r2 }) sQuotRem a b = error $ "SBV.sQuotRem: impossible, unexpected args received: " ++ show (a, b) sDivMod a b | CWInteger x <- cwVal a, CWInteger y <- cwVal b = let (r1, r2) = sDivMod x y in (normCW a { cwVal = CWInteger r1 }, normCW b { cwVal = CWInteger r2 }) sDivMod a b = error $ "SBV.sDivMod: impossible, unexpected args received: " ++ show (a, b) instance SDivisible SWord64 where sQuotRem = liftQRem sDivMod = liftDMod instance SDivisible SInt64 where sQuotRem = liftQRem sDivMod = liftDMod instance SDivisible SWord32 where sQuotRem = liftQRem sDivMod = liftDMod instance SDivisible SInt32 where sQuotRem = liftQRem sDivMod = liftDMod instance SDivisible SWord16 where sQuotRem = liftQRem sDivMod = liftDMod instance SDivisible SInt16 where sQuotRem = liftQRem sDivMod = liftDMod instance SDivisible SWord8 where sQuotRem = liftQRem sDivMod = liftDMod instance SDivisible SInt8 where sQuotRem = liftQRem sDivMod = liftDMod -- | Lift 'quotRem' to symbolic words. Division by 0 is defined s.t. @x/0 = 0@; which -- holds even when @x@ is @0@ itself. liftQRem :: SymWord a => SBV a -> SBV a -> (SBV a, SBV a) liftQRem x y | isConcreteZero x = (x, x) | isConcreteOne y = (x, z) {------------------------------- - N.B. The seemingly innocuous variant when y == -1 only holds if the type is signed; - and also is problematic around the minBound.. So, we refrain from that optimization | isConcreteOnes y = (-x, z) --------------------------------} | True = ite (y .== z) (z, x) (qr x y) where qr (SBV (SVal sgnsz (Left a))) (SBV (SVal _ (Left b))) = let (q, r) = sQuotRem a b in (SBV (SVal sgnsz (Left q)), SBV (SVal sgnsz (Left r))) qr a@(SBV (SVal sgnsz _)) b = (SBV (SVal sgnsz (Right (cache (mk Quot)))), SBV (SVal sgnsz (Right (cache (mk Rem))))) where mk o st = do sw1 <- sbvToSW st a sw2 <- sbvToSW st b mkSymOp o st sgnsz sw1 sw2 z = genLiteral (kindOf x) (0::Integer) -- | Lift 'divMod' to symbolic words. Division by 0 is defined s.t. @x/0 = 0@; which -- holds even when @x@ is @0@ itself. Essentially, this is conversion from quotRem -- (truncate to 0) to divMod (truncate towards negative infinity) liftDMod :: (SymWord a, Num a, SDivisible (SBV a)) => SBV a -> SBV a -> (SBV a, SBV a) liftDMod x y | isConcreteZero x = (x, x) | isConcreteOne y = (x, z) {------------------------------- - N.B. The seemingly innocuous variant when y == -1 only holds if the type is signed; - and also is problematic around the minBound.. So, we refrain from that optimization | isConcreteOnes y = (-x, z) --------------------------------} | True = ite (y .== z) (z, x) $ ite (signum r .== negate (signum y)) (q-i, r+y) qr where qr@(q, r) = x `sQuotRem` y z = genLiteral (kindOf x) (0::Integer) i = genLiteral (kindOf x) (1::Integer) -- SInteger instance for quotRem/divMod are tricky! -- SMT-Lib only has Euclidean operations, but Haskell -- uses "truncate to 0" for quotRem, and "truncate to negative infinity" for divMod. -- So, we cannot just use the above liftings directly. instance SDivisible SInteger where sDivMod = liftDMod sQuotRem x y | not (isSymbolic x || isSymbolic y) = liftQRem x y | True = ite (y .== 0) (0, x) (qE+i, rE-i*y) where (qE, rE) = liftQRem x y -- for integers, this is euclidean due to SMTLib semantics i = ite (x .>= 0 ||| rE .== 0) 0 $ ite (y .> 0) 1 (-1) -- Quickcheck interface instance (SymWord a, Arbitrary a) => Arbitrary (SBV a) where arbitrary = literal `fmap` arbitrary -- | Symbolic conditionals are modeled by the 'Mergeable' class, describing -- how to merge the results of an if-then-else call with a symbolic test. SBV -- provides all basic types as instances of this class, so users only need -- to declare instances for custom data-types of their programs as needed. -- -- A 'Mergeable' instance may be automatically derived for a custom data-type -- with a single constructor where the type of each field is an instance of -- 'Mergeable', such as a record of symbolic values. Users only need to add -- 'G.Generic' and 'Mergeable' to the @deriving@ clause for the data-type. See -- 'Documentation.SBV.Examples.Puzzles.U2Bridge.Status' for an example and an -- illustration of what the instance would look like if written by hand. -- -- The function 'select' is a total-indexing function out of a list of choices -- with a default value, simulating array/list indexing. It's an n-way generalization -- of the 'ite' function. -- -- Minimal complete definition: None, if the type is instance of @Generic@. Otherwise -- 'symbolicMerge'. Note that most types subject to merging are likely to be -- trivial instances of @Generic@. class Mergeable a where -- | Merge two values based on the condition. The first argument states -- whether we force the then-and-else branches before the merging, at the -- word level. This is an efficiency concern; one that we'd rather not -- make but unfortunately necessary for getting symbolic simulation -- working efficiently. symbolicMerge :: Bool -> SBool -> a -> a -> a -- | Total indexing operation. @select xs default index@ is intuitively -- the same as @xs !! index@, except it evaluates to @default@ if @index@ -- underflows/overflows. select :: (SymWord b, Num b) => [a] -> a -> SBV b -> a -- NB. Earlier implementation of select used the binary-search trick -- on the index to chop down the search space. While that is a good trick -- in general, it doesn't work for SBV since we do not have any notion of -- "concrete" subwords: If an index is symbolic, then all its bits are -- symbolic as well. So, the binary search only pays off only if the indexed -- list is really humongous, which is not very common in general. (Also, -- for the case when the list is bit-vectors, we use SMT tables anyhow.) select xs err ind | isReal ind = bad "real" | isFloat ind = bad "float" | isDouble ind = bad "double" | hasSign ind = ite (ind .< 0) err (walk xs ind err) | True = walk xs ind err where bad w = error $ "SBV.select: unsupported " ++ w ++ " valued select/index expression" walk [] _ acc = acc walk (e:es) i acc = walk es (i-1) (ite (i .== 0) e acc) -- Default implementation for 'symbolicMerge' if the type is 'Generic' default symbolicMerge :: (G.Generic a, GMergeable (G.Rep a)) => Bool -> SBool -> a -> a -> a symbolicMerge = symbolicMergeDefault -- | If-then-else. This is by definition 'symbolicMerge' with both -- branches forced. This is typically the desired behavior, but also -- see 'iteLazy' should you need more laziness. ite :: Mergeable a => SBool -> a -> a -> a ite t a b | Just r <- unliteral t = if r then a else b | True = symbolicMerge True t a b -- | A Lazy version of ite, which does not force its arguments. This might -- cause issues for symbolic simulation with large thunks around, so use with -- care. iteLazy :: Mergeable a => SBool -> a -> a -> a iteLazy t a b | Just r <- unliteral t = if r then a else b | True = symbolicMerge False t a b -- | Symbolic assert. Check that the given boolean condition is always true in the given path. The -- optional first argument can be used to provide call-stack info via GHC's location facilities. sAssert :: Maybe CallStack -> String -> SBool -> SBV a -> SBV a sAssert cs msg cond x | Just mustHold <- unliteral cond = if mustHold then x else error $ show $ SafeResult ((locInfo . getCallStack) `fmap` cs, msg, Satisfiable defaultSMTCfg (SMTModel [] [])) | True = SBV $ SVal k $ Right $ cache r where k = kindOf x r st = do xsw <- sbvToSW st x let pc = getPathCondition st -- We're checking if there are any cases where the path-condition holds, but not the condition -- Any violations of this, should be signaled, i.e., whenever the following formula is satisfiable mustNeverHappen = pc &&& bnot cond cnd <- sbvToSW st mustNeverHappen addAssertion st cs msg cnd return xsw locInfo ps = intercalate ",\n " (map loc ps) where loc (f, sl) = concat [srcLocFile sl, ":", show (srcLocStartLine sl), ":", show (srcLocStartCol sl), ":", f] -- | Merge two symbolic values, at kind @k@, possibly @force@'ing the branches to make -- sure they do not evaluate to the same result. This should only be used for internal purposes; -- as default definitions provided should suffice in many cases. (i.e., End users should -- only need to define 'symbolicMerge' when needed; which should be rare to start with.) symbolicMergeWithKind :: Kind -> Bool -> SBool -> SBV a -> SBV a -> SBV a symbolicMergeWithKind k force (SBV t) (SBV a) (SBV b) = SBV (svSymbolicMerge k force t a b) instance SymWord a => Mergeable (SBV a) where symbolicMerge force t x y -- Carefully use the kindOf instance to avoid strictness issues. | force = symbolicMergeWithKind (kindOf x) True t x y | True = symbolicMergeWithKind (kindOf (undefined :: a)) False t x y -- Custom version of select that translates to SMT-Lib tables at the base type of words select xs err ind | SBV (SVal _ (Left c)) <- ind = case cwVal c of CWInteger i -> if i < 0 || i >= genericLength xs then err else xs `genericIndex` i _ -> error $ "SBV.select: unsupported " ++ show (kindOf ind) ++ " valued select/index expression" select xsOrig err ind = xs `seq` SBV (SVal kElt (Right (cache r))) where kInd = kindOf ind kElt = kindOf err -- Based on the index size, we need to limit the elements. For instance if the index is 8 bits, but there -- are 257 elements, that last element will never be used and we can chop it of.. xs = case kindOf ind of KBounded False i -> genericTake ((2::Integer) ^ (fromIntegral i :: Integer)) xsOrig KBounded True i -> genericTake ((2::Integer) ^ (fromIntegral (i-1) :: Integer)) xsOrig KUnbounded -> xsOrig _ -> error $ "SBV.select: unsupported " ++ show (kindOf ind) ++ " valued select/index expression" r st = do sws <- mapM (sbvToSW st) xs swe <- sbvToSW st err if all (== swe) sws -- off-chance that all elts are the same. Note that this also correctly covers the case when list is empty. then return swe else do idx <- getTableIndex st kInd kElt sws swi <- sbvToSW st ind let len = length xs -- NB. No need to worry here that the index might be < 0; as the SMTLib translation takes care of that automatically newExpr st kElt (SBVApp (LkUp (idx, kInd, kElt, len) swi swe) []) -- Unit instance Mergeable () where symbolicMerge _ _ _ _ = () select _ _ _ = () -- Mergeable instances for List/Maybe/Either/Array are useful, but can -- throw exceptions if there is no structural matching of the results -- It's a question whether we should really keep them.. -- Lists instance Mergeable a => Mergeable [a] where symbolicMerge f t xs ys | lxs == lys = zipWith (symbolicMerge f t) xs ys | True = error $ "SBV.Mergeable.List: No least-upper-bound for lists of differing size " ++ show (lxs, lys) where (lxs, lys) = (length xs, length ys) -- ZipList instance Mergeable a => Mergeable (ZipList a) where symbolicMerge force test (ZipList xs) (ZipList ys) = ZipList (symbolicMerge force test xs ys) -- Maybe instance Mergeable a => Mergeable (Maybe a) where symbolicMerge _ _ Nothing Nothing = Nothing symbolicMerge f t (Just a) (Just b) = Just $ symbolicMerge f t a b symbolicMerge _ _ a b = error $ "SBV.Mergeable.Maybe: No least-upper-bound for " ++ show (k a, k b) where k Nothing = "Nothing" k _ = "Just" -- Either instance (Mergeable a, Mergeable b) => Mergeable (Either a b) where symbolicMerge f t (Left a) (Left b) = Left $ symbolicMerge f t a b symbolicMerge f t (Right a) (Right b) = Right $ symbolicMerge f t a b symbolicMerge _ _ a b = error $ "SBV.Mergeable.Either: No least-upper-bound for " ++ show (k a, k b) where k (Left _) = "Left" k (Right _) = "Right" -- Arrays instance (Ix a, Mergeable b) => Mergeable (Array a b) where symbolicMerge f t a b | ba == bb = listArray ba (zipWith (symbolicMerge f t) (elems a) (elems b)) | True = error $ "SBV.Mergeable.Array: No least-upper-bound for rangeSizes" ++ show (k ba, k bb) where [ba, bb] = map bounds [a, b] k = rangeSize -- Functions instance Mergeable b => Mergeable (a -> b) where symbolicMerge f t g h x = symbolicMerge f t (g x) (h x) {- Following definition, while correct, is utterly inefficient. Since the application is delayed, this hangs on to the inner list and all the impending merges, even when ind is concrete. Thus, it's much better to simply use the default definition for the function case. -} -- select xs err ind = \x -> select (map ($ x) xs) (err x) ind -- 2-Tuple instance (Mergeable a, Mergeable b) => Mergeable (a, b) where symbolicMerge f t (i0, i1) (j0, j1) = (i i0 j0, i i1 j1) where i a b = symbolicMerge f t a b select xs (err1, err2) ind = (select as err1 ind, select bs err2 ind) where (as, bs) = unzip xs -- 3-Tuple instance (Mergeable a, Mergeable b, Mergeable c) => Mergeable (a, b, c) where symbolicMerge f t (i0, i1, i2) (j0, j1, j2) = (i i0 j0, i i1 j1, i i2 j2) where i a b = symbolicMerge f t a b select xs (err1, err2, err3) ind = (select as err1 ind, select bs err2 ind, select cs err3 ind) where (as, bs, cs) = unzip3 xs -- 4-Tuple instance (Mergeable a, Mergeable b, Mergeable c, Mergeable d) => Mergeable (a, b, c, d) where symbolicMerge f t (i0, i1, i2, i3) (j0, j1, j2, j3) = (i i0 j0, i i1 j1, i i2 j2, i i3 j3) where i a b = symbolicMerge f t a b select xs (err1, err2, err3, err4) ind = (select as err1 ind, select bs err2 ind, select cs err3 ind, select ds err4 ind) where (as, bs, cs, ds) = unzip4 xs -- 5-Tuple instance (Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e) => Mergeable (a, b, c, d, e) where symbolicMerge f t (i0, i1, i2, i3, i4) (j0, j1, j2, j3, j4) = (i i0 j0, i i1 j1, i i2 j2, i i3 j3, i i4 j4) where i a b = symbolicMerge f t a b select xs (err1, err2, err3, err4, err5) ind = (select as err1 ind, select bs err2 ind, select cs err3 ind, select ds err4 ind, select es err5 ind) where (as, bs, cs, ds, es) = unzip5 xs -- 6-Tuple instance (Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f) => Mergeable (a, b, c, d, e, f) where symbolicMerge f t (i0, i1, i2, i3, i4, i5) (j0, j1, j2, j3, j4, j5) = (i i0 j0, i i1 j1, i i2 j2, i i3 j3, i i4 j4, i i5 j5) where i a b = symbolicMerge f t a b select xs (err1, err2, err3, err4, err5, err6) ind = (select as err1 ind, select bs err2 ind, select cs err3 ind, select ds err4 ind, select es err5 ind, select fs err6 ind) where (as, bs, cs, ds, es, fs) = unzip6 xs -- 7-Tuple instance (Mergeable a, Mergeable b, Mergeable c, Mergeable d, Mergeable e, Mergeable f, Mergeable g) => Mergeable (a, b, c, d, e, f, g) where symbolicMerge f t (i0, i1, i2, i3, i4, i5, i6) (j0, j1, j2, j3, j4, j5, j6) = (i i0 j0, i i1 j1, i i2 j2, i i3 j3, i i4 j4, i i5 j5, i i6 j6) where i a b = symbolicMerge f t a b select xs (err1, err2, err3, err4, err5, err6, err7) ind = (select as err1 ind, select bs err2 ind, select cs err3 ind, select ds err4 ind, select es err5 ind, select fs err6 ind, select gs err7 ind) where (as, bs, cs, ds, es, fs, gs) = unzip7 xs -- Arbitrary product types, using GHC.Generics -- -- NB: Because of the way GHC.Generics works, the implementation of -- symbolicMerge' is recursive. The derived instance for @data T a = T a a a a@ -- resembles that for (a, (a, (a, a))), not the flat 4-tuple (a, a, a, a). This -- difference should have no effect in practice. Note also that, unlike the -- hand-rolled tuple instances, the generic instance does not provide a custom -- 'select' implementation, and so does not benefit from the SMT-table -- implementation in the 'SBV a' instance. -- | Not exported. Symbolic merge using the generic representation provided by -- 'G.Generics'. symbolicMergeDefault :: (G.Generic a, GMergeable (G.Rep a)) => Bool -> SBool -> a -> a -> a symbolicMergeDefault force t x y = G.to $ symbolicMerge' force t (G.from x) (G.from y) -- | Not exported. Used only in 'symbolicMergeDefault'. Instances are provided for -- the generic representations of product types where each element is Mergeable. class GMergeable f where symbolicMerge' :: Bool -> SBool -> f a -> f a -> f a instance GMergeable U1 where symbolicMerge' _ _ _ _ = U1 instance (Mergeable c) => GMergeable (K1 i c) where symbolicMerge' force t (K1 x) (K1 y) = K1 $ symbolicMerge force t x y instance (GMergeable f) => GMergeable (M1 i c f) where symbolicMerge' force t (M1 x) (M1 y) = M1 $ symbolicMerge' force t x y instance (GMergeable f, GMergeable g) => GMergeable (f :*: g) where symbolicMerge' force t (x1 :*: y1) (x2 :*: y2) = symbolicMerge' force t x1 x2 :*: symbolicMerge' force t y1 y2 -- Bounded instances instance (SymWord a, Bounded a) => Bounded (SBV a) where minBound = literal minBound maxBound = literal maxBound -- Arrays -- SArrays are both "EqSymbolic" and "Mergeable" instance EqSymbolic (SArray a b) where SArray a .== SArray b = SBV (a `eqSArr` b) -- When merging arrays; we'll ignore the force argument. This is arguably -- the right thing to do as we've too many things and likely we want to keep it efficient. instance SymWord b => Mergeable (SArray a b) where symbolicMerge _ = mergeArrays -- When merging arrays; we'll ignore the force argument. This is arguably -- the right thing to do as we've too many things and likely we want to keep it efficient. instance SymWord b => Mergeable (SFunArray a b) where symbolicMerge _ = mergeArrays -- | Uninterpreted constants and functions. An uninterpreted constant is -- a value that is indexed by its name. The only property the prover assumes -- about these values are that they are equivalent to themselves; i.e., (for -- functions) they return the same results when applied to same arguments. -- We support uninterpreted-functions as a general means of black-box'ing -- operations that are /irrelevant/ for the purposes of the proof; i.e., when -- the proofs can be performed without any knowledge about the function itself. -- -- Minimal complete definition: 'sbvUninterpret'. However, most instances in -- practice are already provided by SBV, so end-users should not need to define their -- own instances. class Uninterpreted a where -- | Uninterpret a value, receiving an object that can be used instead. Use this version -- when you do not need to add an axiom about this value. uninterpret :: String -> a -- | Uninterpret a value, only for the purposes of code-generation. For execution -- and verification the value is used as is. For code-generation, the alternate -- definition is used. This is useful when we want to take advantage of native -- libraries on the target languages. cgUninterpret :: String -> [String] -> a -> a -- | Most generalized form of uninterpretation, this function should not be needed -- by end-user-code, but is rather useful for the library development. sbvUninterpret :: Maybe ([String], a) -> String -> a {-# MINIMAL sbvUninterpret #-} -- defaults: uninterpret = sbvUninterpret Nothing cgUninterpret nm code v = sbvUninterpret (Just (code, v)) nm -- Plain constants instance HasKind a => Uninterpreted (SBV a) where sbvUninterpret mbCgData nm | Just (_, v) <- mbCgData = v | True = SBV $ SVal ka $ Right $ cache result where ka = kindOf (undefined :: a) result st = do isSMT <- inSMTMode st case (isSMT, mbCgData) of (True, Just (_, v)) -> sbvToSW st v _ -> do newUninterpreted st nm (SBVType [ka]) (fst `fmap` mbCgData) newExpr st ka $ SBVApp (Uninterpreted nm) [] -- Functions of one argument instance (SymWord b, HasKind a) => Uninterpreted (SBV b -> SBV a) where sbvUninterpret mbCgData nm = f where f arg0 | Just (_, v) <- mbCgData, isConcrete arg0 = v arg0 | True = SBV $ SVal ka $ Right $ cache result where ka = kindOf (undefined :: a) kb = kindOf (undefined :: b) result st = do isSMT <- inSMTMode st case (isSMT, mbCgData) of (True, Just (_, v)) -> sbvToSW st (v arg0) _ -> do newUninterpreted st nm (SBVType [kb, ka]) (fst `fmap` mbCgData) sw0 <- sbvToSW st arg0 mapM_ forceSWArg [sw0] newExpr st ka $ SBVApp (Uninterpreted nm) [sw0] -- Functions of two arguments instance (SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV c -> SBV b -> SBV a) where sbvUninterpret mbCgData nm = f where f arg0 arg1 | Just (_, v) <- mbCgData, isConcrete arg0, isConcrete arg1 = v arg0 arg1 | True = SBV $ SVal ka $ Right $ cache result where ka = kindOf (undefined :: a) kb = kindOf (undefined :: b) kc = kindOf (undefined :: c) result st = do isSMT <- inSMTMode st case (isSMT, mbCgData) of (True, Just (_, v)) -> sbvToSW st (v arg0 arg1) _ -> do newUninterpreted st nm (SBVType [kc, kb, ka]) (fst `fmap` mbCgData) sw0 <- sbvToSW st arg0 sw1 <- sbvToSW st arg1 mapM_ forceSWArg [sw0, sw1] newExpr st ka $ SBVApp (Uninterpreted nm) [sw0, sw1] -- Functions of three arguments instance (SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV d -> SBV c -> SBV b -> SBV a) where sbvUninterpret mbCgData nm = f where f arg0 arg1 arg2 | Just (_, v) <- mbCgData, isConcrete arg0, isConcrete arg1, isConcrete arg2 = v arg0 arg1 arg2 | True = SBV $ SVal ka $ Right $ cache result where ka = kindOf (undefined :: a) kb = kindOf (undefined :: b) kc = kindOf (undefined :: c) kd = kindOf (undefined :: d) result st = do isSMT <- inSMTMode st case (isSMT, mbCgData) of (True, Just (_, v)) -> sbvToSW st (v arg0 arg1 arg2) _ -> do newUninterpreted st nm (SBVType [kd, kc, kb, ka]) (fst `fmap` mbCgData) sw0 <- sbvToSW st arg0 sw1 <- sbvToSW st arg1 sw2 <- sbvToSW st arg2 mapM_ forceSWArg [sw0, sw1, sw2] newExpr st ka $ SBVApp (Uninterpreted nm) [sw0, sw1, sw2] -- Functions of four arguments instance (SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV e -> SBV d -> SBV c -> SBV b -> SBV a) where sbvUninterpret mbCgData nm = f where f arg0 arg1 arg2 arg3 | Just (_, v) <- mbCgData, isConcrete arg0, isConcrete arg1, isConcrete arg2, isConcrete arg3 = v arg0 arg1 arg2 arg3 | True = SBV $ SVal ka $ Right $ cache result where ka = kindOf (undefined :: a) kb = kindOf (undefined :: b) kc = kindOf (undefined :: c) kd = kindOf (undefined :: d) ke = kindOf (undefined :: e) result st = do isSMT <- inSMTMode st case (isSMT, mbCgData) of (True, Just (_, v)) -> sbvToSW st (v arg0 arg1 arg2 arg3) _ -> do newUninterpreted st nm (SBVType [ke, kd, kc, kb, ka]) (fst `fmap` mbCgData) sw0 <- sbvToSW st arg0 sw1 <- sbvToSW st arg1 sw2 <- sbvToSW st arg2 sw3 <- sbvToSW st arg3 mapM_ forceSWArg [sw0, sw1, sw2, sw3] newExpr st ka $ SBVApp (Uninterpreted nm) [sw0, sw1, sw2, sw3] -- Functions of five arguments instance (SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) where sbvUninterpret mbCgData nm = f where f arg0 arg1 arg2 arg3 arg4 | Just (_, v) <- mbCgData, isConcrete arg0, isConcrete arg1, isConcrete arg2, isConcrete arg3, isConcrete arg4 = v arg0 arg1 arg2 arg3 arg4 | True = SBV $ SVal ka $ Right $ cache result where ka = kindOf (undefined :: a) kb = kindOf (undefined :: b) kc = kindOf (undefined :: c) kd = kindOf (undefined :: d) ke = kindOf (undefined :: e) kf = kindOf (undefined :: f) result st = do isSMT <- inSMTMode st case (isSMT, mbCgData) of (True, Just (_, v)) -> sbvToSW st (v arg0 arg1 arg2 arg3 arg4) _ -> do newUninterpreted st nm (SBVType [kf, ke, kd, kc, kb, ka]) (fst `fmap` mbCgData) sw0 <- sbvToSW st arg0 sw1 <- sbvToSW st arg1 sw2 <- sbvToSW st arg2 sw3 <- sbvToSW st arg3 sw4 <- sbvToSW st arg4 mapM_ forceSWArg [sw0, sw1, sw2, sw3, sw4] newExpr st ka $ SBVApp (Uninterpreted nm) [sw0, sw1, sw2, sw3, sw4] -- Functions of six arguments instance (SymWord g, SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) where sbvUninterpret mbCgData nm = f where f arg0 arg1 arg2 arg3 arg4 arg5 | Just (_, v) <- mbCgData, isConcrete arg0, isConcrete arg1, isConcrete arg2, isConcrete arg3, isConcrete arg4, isConcrete arg5 = v arg0 arg1 arg2 arg3 arg4 arg5 | True = SBV $ SVal ka $ Right $ cache result where ka = kindOf (undefined :: a) kb = kindOf (undefined :: b) kc = kindOf (undefined :: c) kd = kindOf (undefined :: d) ke = kindOf (undefined :: e) kf = kindOf (undefined :: f) kg = kindOf (undefined :: g) result st = do isSMT <- inSMTMode st case (isSMT, mbCgData) of (True, Just (_, v)) -> sbvToSW st (v arg0 arg1 arg2 arg3 arg4 arg5) _ -> do newUninterpreted st nm (SBVType [kg, kf, ke, kd, kc, kb, ka]) (fst `fmap` mbCgData) sw0 <- sbvToSW st arg0 sw1 <- sbvToSW st arg1 sw2 <- sbvToSW st arg2 sw3 <- sbvToSW st arg3 sw4 <- sbvToSW st arg4 sw5 <- sbvToSW st arg5 mapM_ forceSWArg [sw0, sw1, sw2, sw3, sw4, sw5] newExpr st ka $ SBVApp (Uninterpreted nm) [sw0, sw1, sw2, sw3, sw4, sw5] -- Functions of seven arguments instance (SymWord h, SymWord g, SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted (SBV h -> SBV g -> SBV f -> SBV e -> SBV d -> SBV c -> SBV b -> SBV a) where sbvUninterpret mbCgData nm = f where f arg0 arg1 arg2 arg3 arg4 arg5 arg6 | Just (_, v) <- mbCgData, isConcrete arg0, isConcrete arg1, isConcrete arg2, isConcrete arg3, isConcrete arg4, isConcrete arg5, isConcrete arg6 = v arg0 arg1 arg2 arg3 arg4 arg5 arg6 | True = SBV $ SVal ka $ Right $ cache result where ka = kindOf (undefined :: a) kb = kindOf (undefined :: b) kc = kindOf (undefined :: c) kd = kindOf (undefined :: d) ke = kindOf (undefined :: e) kf = kindOf (undefined :: f) kg = kindOf (undefined :: g) kh = kindOf (undefined :: h) result st = do isSMT <- inSMTMode st case (isSMT, mbCgData) of (True, Just (_, v)) -> sbvToSW st (v arg0 arg1 arg2 arg3 arg4 arg5 arg6) _ -> do newUninterpreted st nm (SBVType [kh, kg, kf, ke, kd, kc, kb, ka]) (fst `fmap` mbCgData) sw0 <- sbvToSW st arg0 sw1 <- sbvToSW st arg1 sw2 <- sbvToSW st arg2 sw3 <- sbvToSW st arg3 sw4 <- sbvToSW st arg4 sw5 <- sbvToSW st arg5 sw6 <- sbvToSW st arg6 mapM_ forceSWArg [sw0, sw1, sw2, sw3, sw4, sw5, sw6] newExpr st ka $ SBVApp (Uninterpreted nm) [sw0, sw1, sw2, sw3, sw4, sw5, sw6] -- Uncurried functions of two arguments instance (SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV c, SBV b) -> SBV a) where sbvUninterpret mbCgData nm = let f = sbvUninterpret (uc2 `fmap` mbCgData) nm in uncurry f where uc2 (cs, fn) = (cs, curry fn) -- Uncurried functions of three arguments instance (SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV d, SBV c, SBV b) -> SBV a) where sbvUninterpret mbCgData nm = let f = sbvUninterpret (uc3 `fmap` mbCgData) nm in \(arg0, arg1, arg2) -> f arg0 arg1 arg2 where uc3 (cs, fn) = (cs, \a b c -> fn (a, b, c)) -- Uncurried functions of four arguments instance (SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV e, SBV d, SBV c, SBV b) -> SBV a) where sbvUninterpret mbCgData nm = let f = sbvUninterpret (uc4 `fmap` mbCgData) nm in \(arg0, arg1, arg2, arg3) -> f arg0 arg1 arg2 arg3 where uc4 (cs, fn) = (cs, \a b c d -> fn (a, b, c, d)) -- Uncurried functions of five arguments instance (SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) where sbvUninterpret mbCgData nm = let f = sbvUninterpret (uc5 `fmap` mbCgData) nm in \(arg0, arg1, arg2, arg3, arg4) -> f arg0 arg1 arg2 arg3 arg4 where uc5 (cs, fn) = (cs, \a b c d e -> fn (a, b, c, d, e)) -- Uncurried functions of six arguments instance (SymWord g, SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) where sbvUninterpret mbCgData nm = let f = sbvUninterpret (uc6 `fmap` mbCgData) nm in \(arg0, arg1, arg2, arg3, arg4, arg5) -> f arg0 arg1 arg2 arg3 arg4 arg5 where uc6 (cs, fn) = (cs, \a b c d e f -> fn (a, b, c, d, e, f)) -- Uncurried functions of seven arguments instance (SymWord h, SymWord g, SymWord f, SymWord e, SymWord d, SymWord c, SymWord b, HasKind a) => Uninterpreted ((SBV h, SBV g, SBV f, SBV e, SBV d, SBV c, SBV b) -> SBV a) where sbvUninterpret mbCgData nm = let f = sbvUninterpret (uc7 `fmap` mbCgData) nm in \(arg0, arg1, arg2, arg3, arg4, arg5, arg6) -> f arg0 arg1 arg2 arg3 arg4 arg5 arg6 where uc7 (cs, fn) = (cs, \a b c d e f g -> fn (a, b, c, d, e, f, g)) -- | Symbolic computations provide a context for writing symbolic programs. instance SolverContext Symbolic where constrain (SBV c) = imposeConstraint False [] c softConstrain (SBV c) = imposeConstraint True [] c namedConstraint nm (SBV c) = imposeConstraint False [(":named", nm)] c constrainWithAttribute atts (SBV c) = imposeConstraint False atts c setOption o = addNewSMTOption o -- | Introduce a soft assertion, with an optional penalty assertWithPenalty :: String -> SBool -> Penalty -> Symbolic () assertWithPenalty nm o p = addSValOptGoal $ unSBV `fmap` AssertWithPenalty nm o p -- | Class of metrics we can optimize for. Currently, -- bounded signed/unsigned bit-vectors, unbounded integers, -- and algebraic reals can be optimized. (But not, say, SFloat, SDouble, or SBool.) -- Minimal complete definition: minimize/maximize. -- -- A good reference on these features is given in the following paper: -- . class Metric a where -- | Minimize a named metric minimize :: String -> a -> Symbolic () -- | Maximize a named metric maximize :: String -> a -> Symbolic () instance Metric SWord8 where minimize nm o = addSValOptGoal (unSBV `fmap` Minimize nm o); maximize nm o = addSValOptGoal (unSBV `fmap` Maximize nm o) instance Metric SWord16 where minimize nm o = addSValOptGoal (unSBV `fmap` Minimize nm o); maximize nm o = addSValOptGoal (unSBV `fmap` Maximize nm o) instance Metric SWord32 where minimize nm o = addSValOptGoal (unSBV `fmap` Minimize nm o); maximize nm o = addSValOptGoal (unSBV `fmap` Maximize nm o) instance Metric SWord64 where minimize nm o = addSValOptGoal (unSBV `fmap` Minimize nm o); maximize nm o = addSValOptGoal (unSBV `fmap` Maximize nm o) instance Metric SInt8 where minimize nm o = addSValOptGoal (unSBV `fmap` Minimize nm o); maximize nm o = addSValOptGoal (unSBV `fmap` Maximize nm o) instance Metric SInt16 where minimize nm o = addSValOptGoal (unSBV `fmap` Minimize nm o); maximize nm o = addSValOptGoal (unSBV `fmap` Maximize nm o) instance Metric SInt32 where minimize nm o = addSValOptGoal (unSBV `fmap` Minimize nm o); maximize nm o = addSValOptGoal (unSBV `fmap` Maximize nm o) instance Metric SInt64 where minimize nm o = addSValOptGoal (unSBV `fmap` Minimize nm o); maximize nm o = addSValOptGoal (unSBV `fmap` Maximize nm o) instance Metric SInteger where minimize nm o = addSValOptGoal (unSBV `fmap` Minimize nm o); maximize nm o = addSValOptGoal (unSBV `fmap` Maximize nm o) instance Metric SReal where minimize nm o = addSValOptGoal (unSBV `fmap` Minimize nm o); maximize nm o = addSValOptGoal (unSBV `fmap` Maximize nm o) -- Quickcheck interface on symbolic-booleans.. instance Testable SBool where property (SBV (SVal _ (Left b))) = property (cwToBool b) property _ = error "Quick-check: Constant folding produced a symbolic value! Perhaps used a non-reducible expression? Please report!" instance Testable (Symbolic SBool) where property prop = QC.monadicIO $ do (cond, r, modelVals) <- QC.run test QC.pre cond unless (r || null modelVals) $ QC.monitor (QC.counterexample (complain modelVals)) QC.assert r where test = do (r, Result{resTraces=tvals, resObservables=ovals, resConsts=cs, resConstraints=cstrs, resUIConsts=unints}) <- runSymbolic Concrete prop let cval = fromMaybe (error "Cannot quick-check in the presence of uninterpeted constants!") . (`lookup` cs) cond = and [cwToBool (cval v) | (False, _, v) <- cstrs] -- Only pick-up "hard" constraints, as indicated by False in the fist component getObservable (nm, v) = case v `lookup` cs of Just cw -> (nm, cw) Nothing -> error $ "Quick-check: Observable " ++ nm ++ " did not reduce to a constant!" case map fst unints of [] -> case unliteral r of Nothing -> noQC [show r] Just b -> return (cond, b, tvals ++ map getObservable ovals) us -> noQC us complain qcInfo = showModel defaultSMTCfg (SMTModel [] qcInfo) noQC us = error $ "Cannot quick-check in the presence of uninterpreted constants: " ++ intercalate ", " us -- | Quick check an SBV property. Note that a regular @quickCheck@ call will work just as -- well. Use this variant if you want to receive the boolean result. sbvQuickCheck :: Symbolic SBool -> IO Bool sbvQuickCheck prop = QC.isSuccess `fmap` QC.quickCheckResult prop -- Quickcheck interface on dynamically-typed values. A run-time check -- ensures that the value has boolean type. instance Testable (Symbolic SVal) where property m = property $ do s <- m when (kindOf s /= KBool) $ error "Cannot quickcheck non-boolean value" return (SBV s :: SBool) -- | Explicit sharing combinator. The SBV library has internal caching/hash-consing mechanisms -- built in, based on Andy Gill's type-safe obervable sharing technique (see: ). -- However, there might be times where being explicit on the sharing can help, especially in experimental code. The 'slet' combinator -- ensures that its first argument is computed once and passed on to its continuation, explicitly indicating the intent of sharing. Most -- use cases of the SBV library should simply use Haskell's @let@ construct for this purpose. slet :: forall a b. (HasKind a, HasKind b) => SBV a -> (SBV a -> SBV b) -> SBV b slet x f = SBV $ SVal k $ Right $ cache r where k = kindOf (undefined :: b) r st = do xsw <- sbvToSW st x let xsbv = SBV $ SVal (kindOf x) (Right (cache (const (return xsw)))) res = f xsbv sbvToSW st res {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} {-# ANN module ("HLint: ignore Eta reduce" :: String) #-} sbv-7.13/Data/SBV/Core/Operations.hs0000644000000000000000000020012513405536617015310 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Core.Operations -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Constructors and basic operations on symbolic values ----------------------------------------------------------------------------- {-# LANGUAGE BangPatterns #-} module Data.SBV.Core.Operations ( -- ** Basic constructors svTrue, svFalse, svBool , svInteger, svFloat, svDouble, svReal, svEnumFromThenTo, svString, svChar -- ** Basic destructors , svAsBool, svAsInteger, svNumerator, svDenominator -- ** Basic operations , svPlus, svTimes, svMinus, svUNeg, svAbs , svDivide, svQuot, svRem, svQuotRem , svEqual, svNotEqual , svLessThan, svGreaterThan, svLessEq, svGreaterEq , svAnd, svOr, svXOr, svNot , svShl, svShr, svRol, svRor , svExtract, svJoin , svIte, svLazyIte, svSymbolicMerge , svSelect , svSign, svUnsign, svSetBit, svWordFromBE, svWordFromLE , svExp, svFromIntegral -- ** Overflows , svMkOverflow -- ** Derived operations , svToWord1, svFromWord1, svTestBit , svShiftLeft, svShiftRight , svRotateLeft, svRotateRight , svBlastLE, svBlastBE , svAddConstant, svIncrement, svDecrement -- ** Basic array operations , SArr, readSArr, writeSArr, mergeSArr, newSArr, eqSArr , SFunArr(..), readSFunArr, writeSFunArr, mergeSFunArr, newSFunArr -- Utils , mkSymOp ) where import Data.Bits (Bits(..)) import Data.List (genericIndex, genericLength, genericTake) import qualified Data.IORef as R (modifyIORef', newIORef, readIORef) import qualified Data.Map.Strict as Map (toList, fromList, lookup) import qualified Data.IntMap.Strict as IMap (IntMap, empty, toAscList, fromAscList, lookup, size, insert) import Data.SBV.Core.AlgReals import Data.SBV.Core.Kind import Data.SBV.Core.Concrete import Data.SBV.Core.Symbolic import Data.Ratio -------------------------------------------------------------------------------- -- Basic constructors -- | Boolean True. svTrue :: SVal svTrue = SVal KBool (Left trueCW) -- | Boolean False. svFalse :: SVal svFalse = SVal KBool (Left falseCW) -- | Convert from a Boolean. svBool :: Bool -> SVal svBool b = if b then svTrue else svFalse -- | Convert from an Integer. svInteger :: Kind -> Integer -> SVal svInteger k n = SVal k (Left $! mkConstCW k n) -- | Convert from a Float svFloat :: Float -> SVal svFloat f = SVal KFloat (Left $! CW KFloat (CWFloat f)) -- | Convert from a Float svDouble :: Double -> SVal svDouble d = SVal KDouble (Left $! CW KDouble (CWDouble d)) -- | Convert from a String svString :: String -> SVal svString s = SVal KString (Left $! CW KString (CWString s)) -- | Convert from a Char svChar :: Char -> SVal svChar c = SVal KChar (Left $! CW KChar (CWChar c)) -- | Convert from a Rational svReal :: Rational -> SVal svReal d = SVal KReal (Left $! CW KReal (CWAlgReal (fromRational d))) -------------------------------------------------------------------------------- -- Basic destructors -- | Extract a bool, by properly interpreting the integer stored. svAsBool :: SVal -> Maybe Bool svAsBool (SVal _ (Left cw)) = Just (cwToBool cw) svAsBool _ = Nothing -- | Extract an integer from a concrete value. svAsInteger :: SVal -> Maybe Integer svAsInteger (SVal _ (Left (CW _ (CWInteger n)))) = Just n svAsInteger _ = Nothing -- | Grab the numerator of an SReal, if available svNumerator :: SVal -> Maybe Integer svNumerator (SVal KReal (Left (CW KReal (CWAlgReal (AlgRational True r))))) = Just $ numerator r svNumerator _ = Nothing -- | Grab the denominator of an SReal, if available svDenominator :: SVal -> Maybe Integer svDenominator (SVal KReal (Left (CW KReal (CWAlgReal (AlgRational True r))))) = Just $ denominator r svDenominator _ = Nothing ------------------------------------------------------------------------------------- -- | Constructing [x, y, .. z] and [x .. y]. Only works when all arguments are concrete and integral and the result is guaranteed finite -- Note that the it isn't "obviously" clear why the following works; after all we're doing the construction over Integer's and mapping -- it back to other types such as SIntN/SWordN. The reason is that the values we receive are guaranteed to be in their domains; and thus -- the lifting to Integers preserves the bounds; and then going back is just fine. So, things like @[1, 5 .. 200] :: [SInt8]@ work just -- fine (end evaluate to empty list), since we see @[1, 5 .. -56]@ in the @Integer@ domain. Also note the explicit check for @s /= f@ -- below to make sure we don't stutter and produce an infinite list. svEnumFromThenTo :: SVal -> Maybe SVal -> SVal -> Maybe [SVal] svEnumFromThenTo bf mbs bt | Just bs <- mbs, Just f <- svAsInteger bf, Just s <- svAsInteger bs, Just t <- svAsInteger bt, s /= f = Just $ map (svInteger (kindOf bf)) [f, s .. t] | Nothing <- mbs, Just f <- svAsInteger bf, Just t <- svAsInteger bt = Just $ map (svInteger (kindOf bf)) [f .. t] | True = Nothing ------------------------------------------------------------------------------------- -- Basic operations -- | Addition. svPlus :: SVal -> SVal -> SVal svPlus x y | isConcreteZero x = y | isConcreteZero y = x | True = liftSym2 (mkSymOp Plus) rationalCheck (+) (+) (+) (+) x y -- | Multiplication. svTimes :: SVal -> SVal -> SVal svTimes x y | isConcreteZero x = x | isConcreteZero y = y | isConcreteOne x = y | isConcreteOne y = x | True = liftSym2 (mkSymOp Times) rationalCheck (*) (*) (*) (*) x y -- | Subtraction. svMinus :: SVal -> SVal -> SVal svMinus x y | isConcreteZero y = x | True = liftSym2 (mkSymOp Minus) rationalCheck (-) (-) (-) (-) x y -- | Unary minus. svUNeg :: SVal -> SVal svUNeg = liftSym1 (mkSymOp1 UNeg) negate negate negate negate -- | Absolute value. svAbs :: SVal -> SVal svAbs = liftSym1 (mkSymOp1 Abs) abs abs abs abs -- | Division. svDivide :: SVal -> SVal -> SVal svDivide = liftSym2 (mkSymOp Quot) rationalCheck (/) idiv (/) (/) where idiv x 0 = x idiv x y = x `div` y -- | Exponentiation. svExp :: SVal -> SVal -> SVal svExp b e | Just x <- svAsInteger e = if x >= 0 then let go n v | n == 0 = one | even n = go (n `div` 2) (svTimes v v) | True = svTimes v $ go (n `div` 2) (svTimes v v) in go x b else error $ "svExp: exponentiation: negative exponent: " ++ show x | not (isBounded e) || hasSign e = error $ "svExp: exponentiation only works with unsigned bounded symbolic exponents, kind: " ++ show (kindOf e) | True = prod $ zipWith (\use n -> svIte use n one) (svBlastLE e) (iterate (\x -> svTimes x x) b) where prod = foldr svTimes one one = svInteger (kindOf b) 1 -- | Bit-blast: Little-endian. Assumes the input is a bit-vector. svBlastLE :: SVal -> [SVal] svBlastLE x = map (svTestBit x) [0 .. intSizeOf x - 1] -- | Set a given bit at index svSetBit :: SVal -> Int -> SVal svSetBit x i = x `svOr` svInteger (kindOf x) (bit i :: Integer) -- | Bit-blast: Big-endian. Assumes the input is a bit-vector. svBlastBE :: SVal -> [SVal] svBlastBE = reverse . svBlastLE -- | Un-bit-blast from big-endian representation to a word of the right size. -- The input is assumed to be unsigned. svWordFromLE :: [SVal] -> SVal svWordFromLE bs = go zero 0 bs where zero = svInteger (KBounded False (length bs)) 0 go !acc _ [] = acc go !acc !i (x:xs) = go (svIte x (svSetBit acc i) acc) (i+1) xs -- | Un-bit-blast from little-endian representation to a word of the right size. -- The input is assumed to be unsigned. svWordFromBE :: [SVal] -> SVal svWordFromBE = svWordFromLE . reverse -- | Add a constant value: svAddConstant :: Integral a => SVal -> a -> SVal svAddConstant x i = x `svPlus` svInteger (kindOf x) (fromIntegral i) -- | Increment: svIncrement :: SVal -> SVal svIncrement x = svAddConstant x (1::Integer) -- | Decrement: svDecrement :: SVal -> SVal svDecrement x = svAddConstant x (-1 :: Integer) -- | Quotient: Overloaded operation whose meaning depends on the kind at which -- it is used: For unbounded integers, it corresponds to the SMT-Lib -- "div" operator ("Euclidean" division, which always has a -- non-negative remainder). For unsigned bitvectors, it is "bvudiv"; -- and for signed bitvectors it is "bvsdiv", which rounds toward zero. -- Division by 0 is defined s.t. @x/0 = 0@, which holds even when @x@ itself is @0@. svQuot :: SVal -> SVal -> SVal svQuot x y | isConcreteZero x = x | isConcreteZero y = svInteger (kindOf x) 0 | isConcreteOne y = x | True = liftSym2 (mkSymOp Quot) nonzeroCheck (noReal "quot") quot' (noFloat "quot") (noDouble "quot") x y where quot' a b | kindOf x == KUnbounded = div a (abs b) * signum b | otherwise = quot a b -- | Remainder: Overloaded operation whose meaning depends on the kind at which -- it is used: For unbounded integers, it corresponds to the SMT-Lib -- "mod" operator (always non-negative). For unsigned bitvectors, it -- is "bvurem"; and for signed bitvectors it is "bvsrem", which rounds -- toward zero (sign of remainder matches that of @x@). Division by 0 is -- defined s.t. @x/0 = 0@, which holds even when @x@ itself is @0@. svRem :: SVal -> SVal -> SVal svRem x y | isConcreteZero x = x | isConcreteZero y = x | isConcreteOne y = svInteger (kindOf x) 0 | True = liftSym2 (mkSymOp Rem) nonzeroCheck (noReal "rem") rem' (noFloat "rem") (noDouble "rem") x y where rem' a b | kindOf x == KUnbounded = mod a (abs b) | otherwise = rem a b -- | Combination of quot and rem svQuotRem :: SVal -> SVal -> (SVal, SVal) svQuotRem x y = (x `svQuot` y, x `svRem` y) -- | Optimize away x == true and x /= false to x; otherwise just do eqOpt eqOptBool :: Op -> SW -> SW -> SW -> Maybe SW eqOptBool op w x y | k == KBool && op == Equal && x == trueSW = Just y -- true .== y --> y | k == KBool && op == Equal && y == trueSW = Just x -- x .== true --> x | k == KBool && op == NotEqual && x == falseSW = Just y -- false ./= y --> y | k == KBool && op == NotEqual && y == falseSW = Just x -- x ./= false --> x | True = eqOpt w x y -- fallback where k = swKind x -- | Equality. svEqual :: SVal -> SVal -> SVal svEqual = liftSym2B (mkSymOpSC (eqOptBool Equal trueSW) Equal) rationalCheck (==) (==) (==) (==) (==) (==) (==) (==) -- | Inequality. svNotEqual :: SVal -> SVal -> SVal svNotEqual = liftSym2B (mkSymOpSC (eqOptBool NotEqual falseSW) NotEqual) rationalCheck (/=) (/=) (/=) (/=) (/=) (/=) (/=) (/=) -- | Less than. svLessThan :: SVal -> SVal -> SVal svLessThan x y | isConcreteMax x = svFalse | isConcreteMin y = svFalse | True = liftSym2B (mkSymOpSC (eqOpt falseSW) LessThan) rationalCheck (<) (<) (<) (<) (<) (<) (<) (uiLift "<" (<)) x y -- | Greater than. svGreaterThan :: SVal -> SVal -> SVal svGreaterThan x y | isConcreteMin x = svFalse | isConcreteMax y = svFalse | True = liftSym2B (mkSymOpSC (eqOpt falseSW) GreaterThan) rationalCheck (>) (>) (>) (>) (>) (>) (>) (uiLift ">" (>)) x y -- | Less than or equal to. svLessEq :: SVal -> SVal -> SVal svLessEq x y | isConcreteMin x = svTrue | isConcreteMax y = svTrue | True = liftSym2B (mkSymOpSC (eqOpt trueSW) LessEq) rationalCheck (<=) (<=) (<=) (<=) (<=) (<=) (<=) (uiLift "<=" (<=)) x y -- | Greater than or equal to. svGreaterEq :: SVal -> SVal -> SVal svGreaterEq x y | isConcreteMax x = svTrue | isConcreteMin y = svTrue | True = liftSym2B (mkSymOpSC (eqOpt trueSW) GreaterEq) rationalCheck (>=) (>=) (>=) (>=) (>=) (>=) (>=) (uiLift ">=" (>=)) x y -- | Bitwise and. svAnd :: SVal -> SVal -> SVal svAnd x y | isConcreteZero x = x | isConcreteOnes x = y | isConcreteZero y = y | isConcreteOnes y = x | True = liftSym2 (mkSymOpSC opt And) (const (const True)) (noReal ".&.") (.&.) (noFloat ".&.") (noDouble ".&.") x y where opt a b | a == falseSW || b == falseSW = Just falseSW | a == trueSW = Just b | b == trueSW = Just a | True = Nothing -- | Bitwise or. svOr :: SVal -> SVal -> SVal svOr x y | isConcreteZero x = y | isConcreteOnes x = x | isConcreteZero y = x | isConcreteOnes y = y | True = liftSym2 (mkSymOpSC opt Or) (const (const True)) (noReal ".|.") (.|.) (noFloat ".|.") (noDouble ".|.") x y where opt a b | a == trueSW || b == trueSW = Just trueSW | a == falseSW = Just b | b == falseSW = Just a | True = Nothing -- | Bitwise xor. svXOr :: SVal -> SVal -> SVal svXOr x y | isConcreteZero x = y | isConcreteOnes x = svNot y | isConcreteZero y = x | isConcreteOnes y = svNot x | True = liftSym2 (mkSymOpSC opt XOr) (const (const True)) (noReal "xor") xor (noFloat "xor") (noDouble "xor") x y where opt a b | a == b && swKind a == KBool = Just falseSW | a == falseSW = Just b | b == falseSW = Just a | True = Nothing -- | Bitwise complement. svNot :: SVal -> SVal svNot = liftSym1 (mkSymOp1SC opt Not) (noRealUnary "complement") complement (noFloatUnary "complement") (noDoubleUnary "complement") where opt a | a == falseSW = Just trueSW | a == trueSW = Just falseSW | True = Nothing -- | Shift left by a constant amount. Translates to the "bvshl" -- operation in SMT-Lib. svShl :: SVal -> Int -> SVal svShl x i | i <= 0 = x | isBounded x, i >= intSizeOf x = svInteger k 0 | True = x `svShiftLeft` svInteger k (fromIntegral i) where k = kindOf x -- | Shift right by a constant amount. Translates to either "bvlshr" -- (logical shift right) or "bvashr" (arithmetic shift right) in -- SMT-Lib, depending on whether @x@ is a signed bitvector. svShr :: SVal -> Int -> SVal svShr x i | i <= 0 = x | isBounded x, i >= intSizeOf x = if not (hasSign x) then z else svIte (x `svLessThan` z) neg1 z | True = x `svShiftRight` svInteger k (fromIntegral i) where k = kindOf x z = svInteger k 0 neg1 = svInteger k (-1) -- | Rotate-left, by a constant svRol :: SVal -> Int -> SVal svRol x i | i <= 0 = x | True = case kindOf x of KBounded _ sz -> liftSym1 (mkSymOp1 (Rol (i `mod` sz))) (noRealUnary "rotateL") (rot True sz i) (noFloatUnary "rotateL") (noDoubleUnary "rotateL") x _ -> svShl x i -- for unbounded Integers, rotateL is the same as shiftL in Haskell -- | Rotate-right, by a constant svRor :: SVal -> Int -> SVal svRor x i | i <= 0 = x | True = case kindOf x of KBounded _ sz -> liftSym1 (mkSymOp1 (Ror (i `mod` sz))) (noRealUnary "rotateR") (rot False sz i) (noFloatUnary "rotateR") (noDoubleUnary "rotateR") x _ -> svShr x i -- for unbounded integers, rotateR is the same as shiftR in Haskell -- | Generic rotation. Since the underlying representation is just Integers, rotations has to be -- careful on the bit-size. rot :: Bool -> Int -> Int -> Integer -> Integer rot toLeft sz amt x | sz < 2 = x | True = norm x y' `shiftL` y .|. norm (x `shiftR` y') y where (y, y') | toLeft = (amt `mod` sz, sz - y) | True = (sz - y', amt `mod` sz) norm v s = v .&. ((1 `shiftL` s) - 1) -- | Extract bit-sequences. svExtract :: Int -> Int -> SVal -> SVal svExtract i j x@(SVal (KBounded s _) _) | i < j = SVal k (Left $! CW k (CWInteger 0)) | SVal _ (Left (CW _ (CWInteger v))) <- x = SVal k (Left $! normCW (CW k (CWInteger (v `shiftR` j)))) | True = SVal k (Right (cache y)) where k = KBounded s (i - j + 1) y st = do sw <- svToSW st x newExpr st k (SBVApp (Extract i j) [sw]) svExtract _ _ _ = error "extract: non-bitvector type" -- | Join two words, by concataneting svJoin :: SVal -> SVal -> SVal svJoin x@(SVal (KBounded s i) a) y@(SVal (KBounded _ j) b) | i == 0 = y | j == 0 = x | Left (CW _ (CWInteger m)) <- a, Left (CW _ (CWInteger n)) <- b = SVal k (Left $! CW k (CWInteger (m `shiftL` j .|. n))) | True = SVal k (Right (cache z)) where k = KBounded s (i + j) z st = do xsw <- svToSW st x ysw <- svToSW st y newExpr st k (SBVApp Join [xsw, ysw]) svJoin _ _ = error "svJoin: non-bitvector type" -- | If-then-else. This one will force branches. svIte :: SVal -> SVal -> SVal -> SVal svIte t a b = svSymbolicMerge (kindOf a) True t a b -- | Lazy If-then-else. This one will delay forcing the branches unless it's really necessary. svLazyIte :: Kind -> SVal -> SVal -> SVal -> SVal svLazyIte k t a b = svSymbolicMerge k False t a b -- | Merge two symbolic values, at kind @k@, possibly @force@'ing the branches to make -- sure they do not evaluate to the same result. svSymbolicMerge :: Kind -> Bool -> SVal -> SVal -> SVal -> SVal svSymbolicMerge k force t a b | Just r <- svAsBool t = if r then a else b | force, rationalSBVCheck a b, sameResult a b = a | True = SVal k $ Right $ cache c where sameResult (SVal _ (Left c1)) (SVal _ (Left c2)) = c1 == c2 sameResult _ _ = False c st = do swt <- svToSW st t case () of () | swt == trueSW -> svToSW st a -- these two cases should never be needed as we expect symbolicMerge to be () | swt == falseSW -> svToSW st b -- called with symbolic tests, but just in case.. () -> do {- It is tempting to record the choice of the test expression here as we branch down to the 'then' and 'else' branches. That is, when we evaluate 'a', we can make use of the fact that the test expression is True, and similarly we can use the fact that it is False when b is evaluated. In certain cases this can cut down on symbolic simulation significantly, for instance if repetitive decisions are made in a recursive loop. Unfortunately, the implementation of this idea is quite tricky, due to our sharing based implementation. As the 'then' branch is evaluated, we will create many expressions that are likely going to be "reused" when the 'else' branch is executed. But, it would be *dead wrong* to share those values, as they were "cached" under the incorrect assumptions. To wit, consider the following: foo x y = ite (y .== 0) k (k+1) where k = ite (y .== 0) x (x+1) When we reduce the 'then' branch of the first ite, we'd record the assumption that y is 0. But while reducing the 'then' branch, we'd like to share @k@, which would evaluate (correctly) to @x@ under the given assumption. When we backtrack and evaluate the 'else' branch of the first ite, we'd see @k@ is needed again, and we'd look it up from our sharing map to find (incorrectly) that its value is @x@, which was stored there under the assumption that y was 0, which no longer holds. Clearly, this is unsound. A sound implementation would have to precisely track which assumptions were active at the time expressions get shared. That is, in the above example, we should record that the value of @k@ was cached under the assumption that @y@ is 0. While sound, this approach unfortunately leads to significant loss of valid sharing when the value itself had nothing to do with the assumption itself. To wit, consider: foo x y = ite (y .== 0) k (k+1) where k = x+5 If we tracked the assumptions, we would recompute @k@ twice, since the branch assumptions would differ. Clearly, there is no need to re-compute @k@ in this case since its value is independent of @y@. Note that the whole SBV performance story is based on agressive sharing, and losing that would have other significant ramifications. The "proper" solution would be to track, with each shared computation, precisely which assumptions it actually *depends* on, rather than blindly recording all the assumptions present at that time. SBV's symbolic simulation engine clearly has all the info needed to do this properly, but the implementation is not straightforward at all. For each subexpression, we would need to chase down its dependencies transitively, which can require a lot of scanning of the generated program causing major slow-down; thus potentially defeating the whole purpose of sharing in the first place. Design choice: Keep it simple, and simply do not track the assumption at all. This will maximize sharing, at the cost of evaluating unreachable branches. I think the simplicity is more important at this point than efficiency. Also note that the user can avoid most such issues by properly combining if-then-else's with common conditions together. That is, the first program above should be written like this: foo x y = ite (y .== 0) x (x+2) In general, the following transformations should be done whenever possible: ite e1 (ite e1 e2 e3) e4 --> ite e1 e2 e4 ite e1 e2 (ite e1 e3 e4) --> ite e1 e2 e4 This is in accordance with the general rule-of-thumb stating conditionals should be avoided as much as possible. However, we might prefer the following: ite e1 (f e2 e4) (f e3 e5) --> f (ite e1 e2 e3) (ite e1 e4 e5) especially if this expression happens to be inside 'f's body itself (i.e., when f is recursive), since it reduces the number of recursive calls. Clearly, programming with symbolic simulation in mind is another kind of beast alltogether. -} let sta = st `extendSValPathCondition` svAnd t let stb = st `extendSValPathCondition` svAnd (svNot t) swa <- svToSW sta a -- evaluate 'then' branch swb <- svToSW stb b -- evaluate 'else' branch case () of -- merge: () | swa == swb -> return swa () | swa == trueSW && swb == falseSW -> return swt () | swa == falseSW && swb == trueSW -> newExpr st k (SBVApp Not [swt]) () -> newExpr st k (SBVApp Ite [swt, swa, swb]) -- | Total indexing operation. @svSelect xs default index@ is -- intuitively the same as @xs !! index@, except it evaluates to -- @default@ if @index@ overflows. Translates to SMT-Lib tables. svSelect :: [SVal] -> SVal -> SVal -> SVal svSelect xs err ind | SVal _ (Left c) <- ind = case cwVal c of CWInteger i -> if i < 0 || i >= genericLength xs then err else xs `genericIndex` i _ -> error $ "SBV.select: unsupported " ++ show (kindOf ind) ++ " valued select/index expression" svSelect xsOrig err ind = xs `seq` SVal kElt (Right (cache r)) where kInd = kindOf ind kElt = kindOf err -- Based on the index size, we need to limit the elements. For -- instance if the index is 8 bits, but there are 257 elements, -- that last element will never be used and we can chop it off. xs = case kInd of KBounded False i -> genericTake ((2::Integer) ^ i) xsOrig KBounded True i -> genericTake ((2::Integer) ^ (i-1)) xsOrig KUnbounded -> xsOrig _ -> error $ "SBV.select: unsupported " ++ show kInd ++ " valued select/index expression" r st = do sws <- mapM (svToSW st) xs swe <- svToSW st err if all (== swe) sws -- off-chance that all elts are the same then return swe else do idx <- getTableIndex st kInd kElt sws swi <- svToSW st ind let len = length xs -- NB. No need to worry here that the index -- might be < 0; as the SMTLib translation -- takes care of that automatically newExpr st kElt (SBVApp (LkUp (idx, kInd, kElt, len) swi swe) []) svChangeSign :: Bool -> SVal -> SVal svChangeSign s x | Just n <- svAsInteger x = svInteger k n | True = SVal k (Right (cache y)) where k = KBounded s (intSizeOf x) y st = do xsw <- svToSW st x newExpr st k (SBVApp (Extract (intSizeOf x - 1) 0) [xsw]) -- | Convert a symbolic bitvector from unsigned to signed. svSign :: SVal -> SVal svSign = svChangeSign True -- | Convert a symbolic bitvector from signed to unsigned. svUnsign :: SVal -> SVal svUnsign = svChangeSign False -- | Convert a symbolic bitvector from one integral kind to another. svFromIntegral :: Kind -> SVal -> SVal svFromIntegral kTo x | Just v <- svAsInteger x = svInteger kTo v | True = result where result = SVal kTo (Right (cache y)) kFrom = kindOf x y st = do xsw <- svToSW st x newExpr st kTo (SBVApp (KindCast kFrom kTo) [xsw]) -------------------------------------------------------------------------------- -- Derived operations -- | Convert an SVal from kind Bool to an unsigned bitvector of size 1. svToWord1 :: SVal -> SVal svToWord1 b = svSymbolicMerge k True b (svInteger k 1) (svInteger k 0) where k = KBounded False 1 -- | Convert an SVal from a bitvector of size 1 (signed or unsigned) to kind Bool. svFromWord1 :: SVal -> SVal svFromWord1 x = svNotEqual x (svInteger k 0) where k = kindOf x -- | Test the value of a bit. Note that we do an extract here -- as opposed to masking and checking against zero, as we found -- extraction to be much faster with large bit-vectors. svTestBit :: SVal -> Int -> SVal svTestBit x i | i < intSizeOf x = svFromWord1 (svExtract i i x) | True = svFalse -- | Generalization of 'svShl', where the shift-amount is symbolic. svShiftLeft :: SVal -> SVal -> SVal svShiftLeft = svShift True -- | Generalization of 'svShr', where the shift-amount is symbolic. -- -- NB. If the shiftee is signed, then this is an arithmetic shift; -- otherwise it's logical. svShiftRight :: SVal -> SVal -> SVal svShiftRight = svShift False -- | Generic shifting of bounded quantities. The shift amount must be non-negative and within the bounds of the argument -- for bit vectors. For negative shift amounts, the result is returned unchanged. For overshifts, left-shift produces 0, -- right shift produces 0 or -1 depending on the result being signed. svShift :: Bool -> SVal -> SVal -> SVal svShift toLeft x i | Just r <- constFoldValue = r | cannotOverShift = svIte (i `svLessThan` svInteger ki 0) -- Negative shift, no change x regularShiftValue | True = svIte (i `svLessThan` svInteger ki 0) -- Negative shift, no change x $ svIte (i `svGreaterEq` svInteger ki (fromIntegral (intSizeOf x))) -- Overshift, by at least the bit-width of x overShiftValue regularShiftValue where nm | toLeft = "shiftLeft" | True = "shiftRight" kx = kindOf x ki = kindOf i -- Constant fold the result if possible. If either quantity is unbounded, then we only support constants -- as there's no easy/meaningful way to map this combo to SMTLib. Should be rarely needed, if ever! -- We also perform basic sanity check here so that if we go past here, we know we have bitvectors only. constFoldValue | Just iv <- getConst i, iv == 0 = Just x | Just xv <- getConst x, xv == 0 = Just x | Just xv <- getConst x, Just iv <- getConst i = Just $ SVal kx . Left $! normCW $ CW kx (CWInteger (xv `opC` shiftAmount iv)) | isInteger x || isInteger i = bailOut $ "Not yet implemented unbounded/non-constants shifts for " ++ show (kx, ki) ++ ", please file a request!" | not (isBounded x && isBounded i) = bailOut $ "Unexpected kinds: " ++ show (kx, ki) | True = Nothing where bailOut m = error $ "SBV." ++ nm ++ ": " ++ m getConst (SVal _ (Left (CW _ (CWInteger val)))) = Just val getConst _ = Nothing opC | toLeft = shiftL | True = shiftR -- like fromIntegral, but more paranoid shiftAmount :: Integer -> Int shiftAmount iv | iv <= 0 = 0 | isInteger i, iv > fromIntegral (maxBound :: Int) = bailOut $ "Unsupported constant unbounded shift with amount: " ++ show iv | isInteger x = fromIntegral iv | iv >= fromIntegral ub = ub | not (isBounded x && isBounded i) = bailOut $ "Unsupported kinds: " ++ show (kx, ki) | True = fromIntegral iv where ub = intSizeOf x -- Overshift is not possible if the bit-size of x won't even fit into the bit-vector size -- of i. Note that this is a *necessary* check, Consider for instance if we're shifting a -- 32-bit value using a 1-bit shift amount (which can happen if the value is 1 with minimal -- shift widths). We would compare 1 >= 32, but stuffing 32 into bit-vector of size 1 would -- overflow. See http://github.com/LeventErkok/sbv/issues/323 for this case. Thus, we -- make sure that the bit-vector would fit as a value. cannotOverShift = maxRepresentable <= fromIntegral (intSizeOf x) where maxRepresentable :: Integer maxRepresentable | hasSign i = bit (intSizeOf i - 1) - 1 | True = bit (intSizeOf i ) - 1 -- An overshift occurs if we're shifting by more than or equal to the bit-width of x -- For shift-left: this value is always 0 -- For shift-right: -- If x is unsigned: 0 -- If x is signed and is less than 0, then -1 else 0 overShiftValue | toLeft = zx | hasSign x = svIte (x `svLessThan` zx) neg1 zx | True = zx where zx = svInteger kx 0 neg1 = svInteger kx (-1) -- Regular shift, we know that the shift value fits into the bit-width of x, since it's between 0 and sizeOf x. So, we can just -- turn it into a properly sized argument and ship it to SMTLib regularShiftValue = SVal kx $ Right $ cache result where result st = do sw1 <- svToSW st x sw2 <- svToSW st i let op | toLeft = Shl | True = Shr adjustedShift <- if kx == ki then return sw2 else newExpr st kx (SBVApp (KindCast ki kx) [sw2]) newExpr st kx (SBVApp op [sw1, adjustedShift]) -- | Generalization of 'svRol', where the rotation amount is symbolic. -- If the first argument is not bounded, then the this is the same as shift. svRotateLeft :: SVal -> SVal -> SVal svRotateLeft x i | not (isBounded x) = svShiftLeft x i | isBounded i && bit si <= toInteger sx -- wrap-around not possible = svIte (svLessThan i zi) (svSelect [x `svRor` k | k <- [0 .. bit si - 1]] z (svUNeg i)) (svSelect [x `svRol` k | k <- [0 .. bit si - 1]] z i) | True = svIte (svLessThan i zi) (svSelect [x `svRor` k | k <- [0 .. sx - 1]] z (svUNeg i `svRem` n)) (svSelect [x `svRol` k | k <- [0 .. sx - 1]] z ( i `svRem` n)) where sx = intSizeOf x si = intSizeOf i z = svInteger (kindOf x) 0 zi = svInteger (kindOf i) 0 n = svInteger (kindOf i) (toInteger sx) -- | Generalization of 'svRor', where the rotation amount is symbolic. -- If the first argument is not bounded, then the this is the same as shift. svRotateRight :: SVal -> SVal -> SVal svRotateRight x i | not (isBounded x) = svShiftRight x i | isBounded i && bit si <= toInteger sx -- wrap-around not possible = svIte (svLessThan i zi) (svSelect [x `svRol` k | k <- [0 .. bit si - 1]] z (svUNeg i)) (svSelect [x `svRor` k | k <- [0 .. bit si - 1]] z i) | True = svIte (svLessThan i zi) (svSelect [x `svRol` k | k <- [0 .. sx - 1]] z (svUNeg i `svRem` n)) (svSelect [x `svRor` k | k <- [0 .. sx - 1]] z ( i `svRem` n)) where sx = intSizeOf x si = intSizeOf i z = svInteger (kindOf x) 0 zi = svInteger (kindOf i) 0 n = svInteger (kindOf i) (toInteger sx) -------------------------------------------------------------------------------- -- | Overflow detection. svMkOverflow :: OvOp -> SVal -> SVal -> SVal svMkOverflow o x y = SVal KBool (Right (cache r)) where r st = do sx <- svToSW st x sy <- svToSW st y newExpr st KBool $ SBVApp (OverflowOp o) [sx, sy] --------------------------------------------------------------------------------- -- * Symbolic Arrays --------------------------------------------------------------------------------- -- | Arrays in terms of SMT-Lib arrays data SArr = SArr (Kind, Kind) (Cached ArrayIndex) -- | Read the array element at @a@ readSArr :: SArr -> SVal -> SVal readSArr (SArr (_, bk) f) a = SVal bk $ Right $ cache r where r st = do arr <- uncacheAI f st i <- svToSW st a newExpr st bk (SBVApp (ArrRead arr) [i]) -- | Update the element at @a@ to be @b@ writeSArr :: SArr -> SVal -> SVal -> SArr writeSArr (SArr ainfo f) a b = SArr ainfo $ cache g where g st = do arr <- uncacheAI f st addr <- svToSW st a val <- svToSW st b amap <- R.readIORef (rArrayMap st) let j = ArrayIndex $ IMap.size amap upd = IMap.insert (unArrayIndex j) ("array_" ++ show j, ainfo, ArrayMutate arr addr val) j `seq` modifyState st rArrayMap upd $ modifyIncState st rNewArrs upd return j -- | Merge two given arrays on the symbolic condition -- Intuitively: @mergeArrays cond a b = if cond then a else b@. -- Merging pushes the if-then-else choice down on to elements mergeSArr :: SVal -> SArr -> SArr -> SArr mergeSArr t (SArr ainfo a) (SArr _ b) = SArr ainfo $ cache h where h st = do ai <- uncacheAI a st bi <- uncacheAI b st ts <- svToSW st t amap <- R.readIORef (rArrayMap st) let k = ArrayIndex $ IMap.size amap upd = IMap.insert (unArrayIndex k) ("array_" ++ show k, ainfo, ArrayMerge ts ai bi) k `seq` modifyState st rArrayMap upd $ modifyIncState st rNewArrs upd return k -- | Create a named new array newSArr :: State -> (Kind, Kind) -> (Int -> String) -> Maybe SVal -> IO SArr newSArr st ainfo mkNm mbDef = do amap <- R.readIORef $ rArrayMap st mbSWDef <- case mbDef of Nothing -> return Nothing Just sv -> Just <$> svToSW st sv let i = ArrayIndex $ IMap.size amap nm = mkNm (unArrayIndex i) upd = IMap.insert (unArrayIndex i) (nm, ainfo, ArrayFree mbSWDef) registerLabel "SArray declaration" st nm modifyState st rArrayMap upd $ modifyIncState st rNewArrs upd return $ SArr ainfo $ cache $ const $ return i -- | Compare two arrays for equality eqSArr :: SArr -> SArr -> SVal eqSArr (SArr _ a) (SArr _ b) = SVal KBool $ Right $ cache c where c st = do ai <- uncacheAI a st bi <- uncacheAI b st newExpr st KBool (SBVApp (ArrEq ai bi) []) -- | Arrays managed internally data SFunArr = SFunArr (Kind, Kind) (Cached FArrayIndex) -- | Convert a node-id to an SVal nodeIdToSVal :: Kind -> Int -> SVal nodeIdToSVal k i = swToSVal $ SW k (NodeId i) -- | Convert an SW to an SVal swToSVal :: SW -> SVal swToSVal sw@(SW k _) = SVal k $ Right $ cache $ const $ return sw -- | A variant of SVal equality, but taking into account of constants -- NB. The rationalCheck is paranid perhaps, but is necessary in case -- we have some funky polynomial roots in there. We do allow for -- floating-points here though. Why? Because the Eq instance of CW -- does the right thing by using object equality. (i.e., it does -- the right thing for NaN/+0/-0 etc.) A straightforward equality -- here would be wrong for floats! svEqualWithConsts :: (SVal, Maybe CW) -> (SVal, Maybe CW) -> SVal svEqualWithConsts sv1 sv2 = case (grabCW sv1, grabCW sv2) of (Just cw, Just cw') | rationalCheck cw cw' -> if cw == cw' then svTrue else svFalse _ -> fst sv1 `svEqual` fst sv2 where grabCW (_, Just cw) = Just cw grabCW (SVal _ (Left cw), _ ) = Just cw grabCW _ = Nothing -- | Read the array element at @a@. For efficiency purposes, we create a memo-table -- as we go along, as otherwise we suffer significant performance penalties. See: -- and -- . readSFunArr :: SFunArr -> SVal -> SVal readSFunArr (SFunArr (ak, bk) f) address | kindOf address /= ak = error $ "Data.SBV.readSFunArr: Impossible happened, accesing with address type: " ++ show (kindOf address) ++ ", expected: " ++ show ak | True = SVal bk $ Right $ cache r where r st = do fArrayIndex <- uncacheFAI f st fArrMap <- R.readIORef (rFArrayMap st) constMap <- R.readIORef (rconstMap st) let consts = Map.fromList [(i, cw) | (cw, SW _ (NodeId i)) <- Map.toList constMap] case unFArrayIndex fArrayIndex `IMap.lookup` fArrMap of Nothing -> error $ "Data.SBV.readSFunArr: Impossible happened while trying to access SFunArray, can't find index: " ++ show fArrayIndex Just (uninitializedRead, rCache) -> do memoTable <- R.readIORef rCache SW _ (NodeId addressNodeId) <- svToSW st address -- If we hit the cache, return the result right away. If we miss, we need to -- walk through each element to "merge" all possible reads as we do not know -- whether the symbolic access may end up the same as one of the earlier ones -- in the cache. case addressNodeId `IMap.lookup` memoTable of Just v -> return v -- cache hit! Nothing -> -- cache miss; walk down the cache items to form the chain of reads: do let aInfo = (address, addressNodeId `Map.lookup` consts) find :: [(Int, SW)] -> SVal find [] = uninitializedRead address find ((i, v) : ivs) = svIte (svEqualWithConsts (nodeIdToSVal ak i, i `Map.lookup` consts) aInfo) (swToSVal v) (find ivs) finalValue = find (IMap.toAscList memoTable) finalSW <- svToSW st finalValue -- Cache the result, so next time we can retrieve it faster if we look it up with the same address! -- The following line is really the whole point of having caching in SFunArray! R.modifyIORef' rCache (IMap.insert addressNodeId finalSW) return finalSW -- | Update the element at @address@ to be @b@ writeSFunArr :: SFunArr -> SVal -> SVal -> SFunArr writeSFunArr (SFunArr (ak, bk) f) address b | kindOf address /= ak = error $ "Data.SBV.writeSFunArr: Impossible happened, accesing with address type: " ++ show (kindOf address) ++ ", expected: " ++ show ak | kindOf b /= bk = error $ "Data.SBV.writeSFunArr: Impossible happened, accesing with address type: " ++ show (kindOf b) ++ ", expected: " ++ show bk | True = SFunArr (ak, bk) $ cache g where g st = do fArrayIndex <- uncacheFAI f st fArrMap <- R.readIORef (rFArrayMap st) constMap <- R.readIORef (rconstMap st) let consts = Map.fromList [(i, cw) | (cw, SW _ (NodeId i)) <- Map.toList constMap] case unFArrayIndex fArrayIndex `IMap.lookup` fArrMap of Nothing -> error $ "Data.SBV.writeSFunArr: Impossible happened while trying to access SFunArray, can't find index: " ++ show fArrayIndex Just (aUi, rCache) -> do memoTable <- R.readIORef rCache SW _ (NodeId addressNodeId) <- svToSW st address val <- svToSW st b -- There are three cases: -- -- (1) We hit the cache, and old value is the same as new: No write necessary, just return the array -- (2) We hit the cache, values are different. Simply insert, overriding the old-memo table location -- (3) We miss the cache: Now we have to walk through all accesses and update the memo table accordingly. -- Why? Just because we missed the cache doesn't mean that it's not there with a different "symbolic" -- address. So, we have to walk through and update each entry in case the address matches. -- -- Below, we determine which case we're in and then insert the value at the end and continue cont <- case addressNodeId `IMap.lookup` memoTable of Just oldVal -- Cache hit | val == oldVal -> return $ Left fArrayIndex -- Case 1 | True -> return $ Right memoTable -- Case 2 Nothing -> do -- Cache miss let aInfo = (address, addressNodeId `Map.lookup` consts) -- NB. The order of modifications here is important as we -- keep the keys in ascending order. (Since we'll call fromAscList later on.) walk :: [(Int, SW)] -> [(Int, SW)] -> IO [(Int, SW)] walk [] sofar = return $ reverse sofar walk ((i, s):iss) sofar = modify i s >>= \s' -> walk iss ((i, s') : sofar) -- At the cached address i, currently storing value s. Conditionally update it to `b` (new value) -- if the addresses match. Otherwise keep it the same. modify :: Int -> SW -> IO SW modify i s = svToSW st $ svIte (svEqualWithConsts (nodeIdToSVal ak i, i `Map.lookup` consts) aInfo) b (swToSVal s) Right . IMap.fromAscList <$> walk (IMap.toAscList memoTable) [] case cont of Left j -> return j -- There was a hit, and value was unchanged, nothing to do Right mt -> do -- There was a hit, and the value was different; or there was a miss. Insert the new value -- and create a new array. Note that we keep the aUi the same: Just because we modified -- an array, it doesn't mean we change the uninitialized reads: they still come from the same place. -- newMemoTable <- R.newIORef $ IMap.insert addressNodeId val mt let j = FArrayIndex $ IMap.size fArrMap upd = IMap.insert (unFArrayIndex j) (aUi, newMemoTable) j `seq` modifyState st rFArrayMap upd (return ()) return j -- | Merge two given arrays on the symbolic condition -- Intuitively: @mergeArrays cond a b = if cond then a else b@. -- Merging pushes the if-then-else choice down on to elements mergeSFunArr :: SVal -> SFunArr -> SFunArr -> SFunArr mergeSFunArr t array1@(SFunArr ainfo@(sourceKind, targetKind) a) array2@(SFunArr binfo b) | ainfo /= binfo = error $ "Data.SBV.mergeSFunArr: Impossible happened, merging incompatbile arrays: " ++ show (ainfo, binfo) | Just test <- svAsBool t = if test then array1 else array2 | True = SFunArr ainfo $ cache c where c st = do ai <- uncacheFAI a st bi <- uncacheFAI b st constMap <- R.readIORef (rconstMap st) let consts = Map.fromList [(i, cw) | (cw, SW _ (NodeId i)) <- Map.toList constMap] -- Catch the degenerate case of merging an array with itself. One -- can argue this is pointless, but actually it comes up when one -- is merging composite structures (through a Mergeable class instance) -- that has an array component that didn't change. So, pays off in practice! if unFArrayIndex ai == unFArrayIndex bi then return ai -- merging with itself, noop else do fArrMap <- R.readIORef (rFArrayMap st) case (unFArrayIndex ai `IMap.lookup` fArrMap, unFArrayIndex bi `IMap.lookup` fArrMap) of (Nothing, _) -> error $ "Data.SBV.mergeSFunArr: Impossible happened while trying to access SFunArray, can't find index: " ++ show ai (_, Nothing) -> error $ "Data.SBV.mergeSFunArr: Impossible happened while trying to access SFunArray, can't find index: " ++ show bi (Just (aUi, raCache), Just (bUi, rbCache)) -> do -- This is where the complication happens. We need to merge the caches. If the same -- key appears in both, then that's the easy case: Just merge the entries. But if -- a key only appears in one but not the other? Just like in the read/write cases, -- we have to consider the possibility that the missing key can be any one of the -- other elements in the cache. So, for each non-matching key in either memo-table, -- we traverse the other and create a chain of look-up values. aMemo <- R.readIORef raCache bMemo <- R.readIORef rbCache let aMemoT = IMap.toAscList aMemo bMemoT = IMap.toAscList bMemo -- gen takes a uninitialized-read creator, a key, and the choices from the "other" -- cache that this key may map to. And creates a new SW that corresponds to the -- merged value: gen :: (SVal -> SVal) -> Int -> [(Int, SW)] -> IO SW gen mk k choices = svToSW st $ walk choices where kInfo = (nodeIdToSVal sourceKind k, k `Map.lookup` consts) walk :: [(Int, SW)] -> SVal walk [] = mk (fst kInfo) walk ((i, v) : ivs) = svIte (svEqualWithConsts (nodeIdToSVal sourceKind i, i `Map.lookup` consts) kInfo) (swToSVal v) (walk ivs) -- Insert into an existing map the new key value by merging according to the test fill :: Int -> SW -> SW -> IMap.IntMap SW -> IO (IMap.IntMap SW) fill k (SW _ (NodeId ni1)) (SW _ (NodeId ni2)) m = do v <- svToSW st (svIte t sval1 sval2) return $ IMap.insert k v m where sval1 = nodeIdToSVal targetKind ni1 sval2 = nodeIdToSVal targetKind ni2 -- Walk down the memo-tables in tandem. If we find a common key: Simply fill it in. If we find -- a key only in one, generate the corresponding read from the other cache, and do the fill. merge [] [] sofar = return sofar merge ((k1, v1) : as) [] sofar = gen bUi k1 bMemoT >>= \v2 -> fill k1 v1 v2 sofar >>= merge as [] merge [] ((k2, v2) : bs) sofar = gen aUi k2 aMemoT >>= \v1 -> fill k2 v1 v2 sofar >>= merge [] bs merge ass@((k1, v1) : as) bss@((k2, v2) : bs) sofar | k1 < k2 = gen bUi k1 bMemoT >>= \nv2 -> fill k1 v1 nv2 sofar >>= merge as bss | k1 > k2 = gen aUi k2 aMemoT >>= \nv1 -> fill k2 nv1 v2 sofar >>= merge ass bs | True = fill k1 v1 v2 sofar >>= merge as bs mergedMap <- merge aMemoT bMemoT IMap.empty memoMerged <- R.newIORef mergedMap -- Craft a new uninitializer. Note that we do *not* create a new initializer here, -- but simply merge the two initializers which will inherit their original unread -- references should the test be a constant. let mkUninitialized i = svIte t (aUi i) (bUi i) -- Add it to our collection: let j = FArrayIndex $ IMap.size fArrMap upd = IMap.insert (unFArrayIndex j) (mkUninitialized, memoMerged) j `seq` modifyState st rFArrayMap upd (return ()) return j -- | Create a named new array newSFunArr :: State -> (Kind, Kind) -> (Int -> String) -> Maybe SVal -> IO SFunArr newSFunArr st (ak, bk) mkNm mbDef = do fArrMap <- R.readIORef (rFArrayMap st) memoTable <- R.newIORef IMap.empty let j = FArrayIndex $ IMap.size fArrMap nm = mkNm (unFArrayIndex j) mkUninitialized i = case mbDef of Just def -> def _ -> svUninterpreted bk (nm ++ "_uninitializedRead") Nothing [i] upd = IMap.insert (unFArrayIndex j) (mkUninitialized, memoTable) registerLabel "SFunArray declaration" st nm j `seq` modifyState st rFArrayMap upd (return ()) return $ SFunArr (ak, bk) $ cache $ const $ return j -------------------------------------------------------------------------------- -- Utility functions noUnint :: (Maybe Int, String) -> a noUnint x = error $ "Unexpected operation called on uninterpreted/enumerated value: " ++ show x noUnint2 :: (Maybe Int, String) -> (Maybe Int, String) -> a noUnint2 x y = error $ "Unexpected binary operation called on uninterpreted/enumerated values: " ++ show (x, y) noCharLift :: Char -> a noCharLift x = error $ "Unexpected operation called on char: " ++ show x noStringLift :: String -> a noStringLift x = error $ "Unexpected operation called on string: " ++ show x noCharLift2 :: Char -> Char -> a noCharLift2 x y = error $ "Unexpected binary operation called on chars: " ++ show (x, y) noStringLift2 :: String -> String -> a noStringLift2 x y = error $ "Unexpected binary operation called on strings: " ++ show (x, y) liftSym1 :: (State -> Kind -> SW -> IO SW) -> (AlgReal -> AlgReal) -> (Integer -> Integer) -> (Float -> Float) -> (Double -> Double) -> SVal -> SVal liftSym1 _ opCR opCI opCF opCD (SVal k (Left a)) = SVal k . Left $! mapCW opCR opCI opCF opCD noCharLift noStringLift noUnint a liftSym1 opS _ _ _ _ a@(SVal k _) = SVal k $ Right $ cache c where c st = do swa <- svToSW st a opS st k swa {- A note on constant folding. There are cases where we miss out on certain constant foldings. On May 8 2018, Matt Peddie pointed this out, as the C code he was getting had redundancies. I was aware that could be missing constant foldings due to missed out optimizations, or some other code snafu, but till Matt pointed it out I haven't realized that we could be hiding constants inside an if-then-else. The example is: proveWith z3{verbose=True} $ \x -> 0 .< ite (x .== (x::SWord8)) 1 (2::SWord8) If you try this, you'll see that it generates (shortened): (define-fun s1 () (_ BitVec 8) #x00) (define-fun s2 () (_ BitVec 8) #x01) (define-fun s3 () Bool (bvult s1 s2)) But clearly we have all the info for s3 to be computed! The issue here is that the reduction of @x .== x@ to @true@ happens after we start computing the if-then-else, hence we are already committed to an SW at that point. The call to ite eventually recognizes this, but at that point it picks up the now constants from SW's, missing the constant folding opportunity. We can fix this, by looking up the constants table in liftSW2, like this: liftSW2 :: (CW -> CW -> Bool) -> (CW -> CW -> CW) -> (State -> Kind -> SW -> SW -> IO SW) -> Kind -> SVal -> SVal -> Cached SW liftSW2 okCW opCW opS k a b = cache c where c st = do sw1 <- svToSW st a sw2 <- svToSW st b cmap <- readIORef (rconstMap st) let cw1 = [cw | ((_, cw), sw) <- M.toList cmap, sw == sw1] cw2 = [cw | ((_, cw), sw) <- M.toList cmap, sw == sw2] case (cw1, cw2) of ([x], [y]) | okCW x y -> newConst st $ opCW x y _ -> opS st k sw1 sw2 (with obvious modifications to call sites to get the proper arguments.) But this means that we have to grab the constant list for every symbolicly lifted operation, also do the same for other places, etc.; for the rare opportunity of catching a @x .== x@ optimization. Even then, the constants for the branches would still be generated. (i.e., in the above example we would still generate @s1@ and @s2@, but would skip @s3@.) It seems to me that the price to pay is rather high, as this is hardly the most common case; so we're opting here to ignore these cases. See http://github.com/LeventErkok/sbv/issues/379 for some further discussion. -} liftSW2 :: (State -> Kind -> SW -> SW -> IO SW) -> Kind -> SVal -> SVal -> Cached SW liftSW2 opS k a b = cache c where c st = do sw1 <- svToSW st a sw2 <- svToSW st b opS st k sw1 sw2 liftSym2 :: (State -> Kind -> SW -> SW -> IO SW) -> (CW -> CW -> Bool) -> (AlgReal -> AlgReal -> AlgReal) -> (Integer -> Integer -> Integer) -> (Float -> Float -> Float) -> (Double -> Double -> Double) -> SVal -> SVal -> SVal liftSym2 _ okCW opCR opCI opCF opCD (SVal k (Left a)) (SVal _ (Left b)) | okCW a b = SVal k . Left $! mapCW2 opCR opCI opCF opCD noCharLift2 noStringLift2 noUnint2 a b liftSym2 opS _ _ _ _ _ a@(SVal k _) b = SVal k $ Right $ liftSW2 opS k a b liftSym2B :: (State -> Kind -> SW -> SW -> IO SW) -> (CW -> CW -> Bool) -> (AlgReal -> AlgReal -> Bool) -> (Integer -> Integer -> Bool) -> (Float -> Float -> Bool) -> (Double -> Double -> Bool) -> (Char -> Char -> Bool) -> (String -> String -> Bool) -> ([CWVal] -> [CWVal] -> Bool) -> ((Maybe Int, String) -> (Maybe Int, String) -> Bool) -> SVal -> SVal -> SVal liftSym2B _ okCW opCR opCI opCF opCD opCC opCS opCSeq opUI (SVal _ (Left a)) (SVal _ (Left b)) | okCW a b = svBool (liftCW2 opCR opCI opCF opCD opCC opCS opCSeq opUI a b) liftSym2B opS _ _ _ _ _ _ _ _ _ a b = SVal KBool $ Right $ liftSW2 opS KBool a b -- | Create a symbolic two argument operation; with shortcut optimizations mkSymOpSC :: (SW -> SW -> Maybe SW) -> Op -> State -> Kind -> SW -> SW -> IO SW mkSymOpSC shortCut op st k a b = maybe (newExpr st k (SBVApp op [a, b])) return (shortCut a b) -- | Create a symbolic two argument operation; no shortcut optimizations mkSymOp :: Op -> State -> Kind -> SW -> SW -> IO SW mkSymOp = mkSymOpSC (const (const Nothing)) mkSymOp1SC :: (SW -> Maybe SW) -> Op -> State -> Kind -> SW -> IO SW mkSymOp1SC shortCut op st k a = maybe (newExpr st k (SBVApp op [a])) return (shortCut a) mkSymOp1 :: Op -> State -> Kind -> SW -> IO SW mkSymOp1 = mkSymOp1SC (const Nothing) -- | eqOpt says the references are to the same SW, thus we can optimize. Note that -- we explicitly disallow KFloat/KDouble here. Why? Because it's *NOT* true that -- NaN == NaN, NaN >= NaN, and so-forth. So, we have to make sure we don't optimize -- floats and doubles, in case the argument turns out to be NaN. eqOpt :: SW -> SW -> SW -> Maybe SW eqOpt w x y = case swKind x of KFloat -> Nothing KDouble -> Nothing _ -> if x == y then Just w else Nothing -- For uninterpreted/enumerated values, we carefully lift through the constructor index for comparisons: uiLift :: String -> (Int -> Int -> Bool) -> (Maybe Int, String) -> (Maybe Int, String) -> Bool uiLift _ cmp (Just i, _) (Just j, _) = i `cmp` j uiLift w _ a b = error $ "Data.SBV.Core.Operations: Impossible happened while trying to lift " ++ w ++ " over " ++ show (a, b) -- | Predicate for optimizing word operations like (+) and (*). -- NB. We specifically do *not* match for Double/Float; because -- FP-arithmetic doesn't obey traditional rules. For instance, -- 0 * x = 0 fails if x happens to be NaN or +/- Infinity. So, -- we merely return False when given a floating-point value here. isConcreteZero :: SVal -> Bool isConcreteZero (SVal _ (Left (CW _ (CWInteger n)))) = n == 0 isConcreteZero (SVal KReal (Left (CW KReal (CWAlgReal v)))) = isExactRational v && v == 0 isConcreteZero _ = False -- | Predicate for optimizing word operations like (+) and (*). -- NB. See comment on 'isConcreteZero' for why we don't match -- for Float/Double values here. isConcreteOne :: SVal -> Bool isConcreteOne (SVal _ (Left (CW _ (CWInteger 1)))) = True isConcreteOne (SVal KReal (Left (CW KReal (CWAlgReal v)))) = isExactRational v && v == 1 isConcreteOne _ = False -- | Predicate for optimizing bitwise operations. The unbounded integer case of checking -- against -1 might look dubious, but that's how Haskell treats 'Integer' as a member -- of the Bits class, try @(-1 :: Integer) `testBit` i@ for any @i@ and you'll get 'True'. isConcreteOnes :: SVal -> Bool isConcreteOnes (SVal _ (Left (CW (KBounded b w) (CWInteger n)))) = n == if b then -1 else bit w - 1 isConcreteOnes (SVal _ (Left (CW KUnbounded (CWInteger n)))) = n == -1 -- see comment above isConcreteOnes (SVal _ (Left (CW KBool (CWInteger n)))) = n == 1 isConcreteOnes _ = False -- | Predicate for optimizing comparisons. isConcreteMax :: SVal -> Bool isConcreteMax (SVal _ (Left (CW (KBounded False w) (CWInteger n)))) = n == bit w - 1 isConcreteMax (SVal _ (Left (CW (KBounded True w) (CWInteger n)))) = n == bit (w - 1) - 1 isConcreteMax (SVal _ (Left (CW KBool (CWInteger n)))) = n == 1 isConcreteMax _ = False -- | Predicate for optimizing comparisons. isConcreteMin :: SVal -> Bool isConcreteMin (SVal _ (Left (CW (KBounded False _) (CWInteger n)))) = n == 0 isConcreteMin (SVal _ (Left (CW (KBounded True w) (CWInteger n)))) = n == - bit (w - 1) isConcreteMin (SVal _ (Left (CW KBool (CWInteger n)))) = n == 0 isConcreteMin _ = False -- | Most operations on concrete rationals require a compatibility check to avoid faulting -- on algebraic reals. rationalCheck :: CW -> CW -> Bool rationalCheck a b = case (cwVal a, cwVal b) of (CWAlgReal x, CWAlgReal y) -> isExactRational x && isExactRational y _ -> True -- | Quot/Rem operations require a nonzero check on the divisor. -- nonzeroCheck :: CW -> CW -> Bool nonzeroCheck _ b = cwVal b /= CWInteger 0 -- | Same as rationalCheck, except for SBV's rationalSBVCheck :: SVal -> SVal -> Bool rationalSBVCheck (SVal KReal (Left a)) (SVal KReal (Left b)) = rationalCheck a b rationalSBVCheck _ _ = True noReal :: String -> AlgReal -> AlgReal -> AlgReal noReal o a b = error $ "SBV.AlgReal." ++ o ++ ": Unexpected arguments: " ++ show (a, b) noFloat :: String -> Float -> Float -> Float noFloat o a b = error $ "SBV.Float." ++ o ++ ": Unexpected arguments: " ++ show (a, b) noDouble :: String -> Double -> Double -> Double noDouble o a b = error $ "SBV.Double." ++ o ++ ": Unexpected arguments: " ++ show (a, b) noRealUnary :: String -> AlgReal -> AlgReal noRealUnary o a = error $ "SBV.AlgReal." ++ o ++ ": Unexpected argument: " ++ show a noFloatUnary :: String -> Float -> Float noFloatUnary o a = error $ "SBV.Float." ++ o ++ ": Unexpected argument: " ++ show a noDoubleUnary :: String -> Double -> Double noDoubleUnary o a = error $ "SBV.Double." ++ o ++ ": Unexpected argument: " ++ show a {-# ANN svIte ("HLint: ignore Eta reduce" :: String) #-} {-# ANN svLazyIte ("HLint: ignore Eta reduce" :: String) #-} {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/Data/SBV/Core/Splittable.hs0000644000000000000000000000453713405536617015301 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Core.Splittable -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Implementation of bit-vector concatanetation and splits ----------------------------------------------------------------------------- {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE FlexibleInstances #-} module Data.SBV.Core.Splittable (Splittable(..)) where import Data.Bits (Bits(..)) import Data.Word (Word8, Word16, Word32, Word64) import Data.SBV.Core.Operations import Data.SBV.Core.Data import Data.SBV.Core.Model () -- instances only infixr 5 # -- | Splitting an @a@ into two @b@'s and joining back. -- Intuitively, @a@ is a larger bit-size word than @b@, typically double. -- The 'extend' operation captures embedding of a @b@ value into an @a@ -- without changing its semantic value. -- -- Minimal complete definition: All, no defaults. class Splittable a b | b -> a where split :: a -> (b, b) (#) :: b -> b -> a extend :: b -> a genSplit :: (Integral a, Num b) => Int -> a -> (b, b) genSplit ss x = (fromIntegral ((ix `shiftR` ss) .&. mask), fromIntegral (ix .&. mask)) where ix = toInteger x mask = 2 ^ ss - 1 genJoin :: (Integral b, Num a) => Int -> b -> b -> a genJoin ss x y = fromIntegral ((ix `shiftL` ss) .|. iy) where ix = toInteger x iy = toInteger y -- concrete instances instance Splittable Word64 Word32 where split = genSplit 32 (#) = genJoin 32 extend b = 0 # b instance Splittable Word32 Word16 where split = genSplit 16 (#) = genJoin 16 extend b = 0 # b instance Splittable Word16 Word8 where split = genSplit 8 (#) = genJoin 8 extend b = 0 # b -- symbolic instances instance Splittable SWord64 SWord32 where split (SBV x) = (SBV (svExtract 63 32 x), SBV (svExtract 31 0 x)) SBV a # SBV b = SBV (svJoin a b) extend b = 0 # b instance Splittable SWord32 SWord16 where split (SBV x) = (SBV (svExtract 31 16 x), SBV (svExtract 15 0 x)) SBV a # SBV b = SBV (svJoin a b) extend b = 0 # b instance Splittable SWord16 SWord8 where split (SBV x) = (SBV (svExtract 15 8 x), SBV (svExtract 7 0 x)) SBV a # SBV b = SBV (svJoin a b) extend b = 0 # b sbv-7.13/Data/SBV/Core/Symbolic.hs0000644000000000000000000022206313405536617014753 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Core.Symbolic -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Symbolic values ----------------------------------------------------------------------------- {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeSynonymInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.SBV.Core.Symbolic ( NodeId(..) , SW(..), swKind, trueSW, falseSW , Op(..), PBOp(..), OvOp(..), FPOp(..), StrOp(..), SeqOp(..), RegExp(..) , Quantifier(..), needsExistentials , RoundingMode(..) , SBVType(..), svUninterpreted, newUninterpreted, addAxiom , SVal(..) , svMkSymVar, sWordN, sWordN_, sIntN, sIntN_ , ArrayContext(..), ArrayInfo , svToSW, svToSymSW, forceSWArg , SBVExpr(..), newExpr, isCodeGenMode, isSafetyCheckingIStage, isRunIStage, isSetupIStage , Cached, cache, uncache, modifyState, modifyIncState , ArrayIndex(..), FArrayIndex(..), uncacheAI, uncacheFAI , NamedSymVar , getSValPathCondition, extendSValPathCondition , getTableIndex , SBVPgm(..), Symbolic, runSymbolic, State(..), withNewIncState, IncState(..), incrementInternalCounter , inSMTMode, SBVRunMode(..), IStage(..), Result(..) , registerKind, registerLabel, recordObservable , addAssertion, addNewSMTOption, imposeConstraint, internalConstraint, internalVariable , SMTLibPgm(..), SMTLibVersion(..), smtLibVersionExtension , SolverCapabilities(..) , extractSymbolicSimulationState , OptimizeStyle(..), Objective(..), Penalty(..), objectiveName, addSValOptGoal , Query(..), QueryState(..), QueryContext(..) , SMTScript(..), Solver(..), SMTSolver(..), SMTResult(..), SMTModel(..), SMTConfig(..), SMTEngine , outputSVal ) where import Control.Arrow (first, second, (***)) import Control.DeepSeq (NFData(..)) import Control.Monad (when, unless) import Control.Monad.Reader (MonadReader, ReaderT, ask, runReaderT) import Control.Monad.State.Lazy (MonadState, StateT(..)) import Control.Monad.Trans (MonadIO, liftIO) import Data.Char (isAlpha, isAlphaNum, toLower) import Data.IORef (IORef, newIORef, readIORef) import Data.List (intercalate, sortBy) import Data.Maybe (isJust, fromJust, fromMaybe, listToMaybe) import Data.String (IsString(fromString)) import Data.Time (getCurrentTime, UTCTime) import GHC.Stack import qualified Data.IORef as R (modifyIORef') import qualified Data.Generics as G (Data(..)) import qualified Data.IntMap.Strict as IMap (IntMap, empty, toAscList, lookup, insertWith) import qualified Data.Map.Strict as Map (Map, empty, toList, lookup, insert, size) import qualified Data.Set as Set (Set, empty, toList, insert, member) import qualified Data.Foldable as F (toList) import qualified Data.Sequence as S (Seq, empty, (|>)) import System.Mem.StableName import Data.SBV.Core.Kind import Data.SBV.Core.Concrete import Data.SBV.SMT.SMTLibNames import Data.SBV.Utils.TDiff (Timing) import Data.SBV.Utils.Lib (stringToQFS) import Data.SBV.Control.Types #if MIN_VERSION_base(4,11,0) import Control.Monad.Fail as Fail #endif -- | A symbolic node id newtype NodeId = NodeId Int deriving (Eq, Ord) -- | A symbolic word, tracking it's signedness and size. data SW = SW !Kind !NodeId deriving (Eq, Ord) instance HasKind SW where kindOf (SW k _) = k instance Show SW where show (SW _ (NodeId n)) | n < 0 = "s_" ++ show (abs n) | True = 's' : show n -- | Kind of a symbolic word. swKind :: SW -> Kind swKind (SW k _) = k -- | Forcing an argument; this is a necessary evil to make sure all the arguments -- to an uninterpreted function are evaluated before called; the semantics of uinterpreted -- functions is necessarily strict; deviating from Haskell's forceSWArg :: SW -> IO () forceSWArg (SW k n) = k `seq` n `seq` return () -- | Constant False as an SW. Note that this value always occupies slot -2. falseSW :: SW falseSW = SW KBool $ NodeId (-2) -- | Constant True as an SW. Note that this value always occupies slot -1. trueSW :: SW trueSW = SW KBool $ NodeId (-1) -- | Symbolic operations data Op = Plus | Times | Minus | UNeg | Abs | Quot | Rem | Equal | NotEqual | LessThan | GreaterThan | LessEq | GreaterEq | Ite | And | Or | XOr | Not | Shl | Shr | Rol Int | Ror Int | Extract Int Int -- Extract i j: extract bits i to j. Least significant bit is 0 (big-endian) | Join -- Concat two words to form a bigger one, in the order given | LkUp (Int, Kind, Kind, Int) !SW !SW -- (table-index, arg-type, res-type, length of the table) index out-of-bounds-value | ArrEq ArrayIndex ArrayIndex -- Array equality | ArrRead ArrayIndex | KindCast Kind Kind | Uninterpreted String | Label String -- Essentially no-op; useful for code generation to emit comments. | IEEEFP FPOp -- Floating-point ops, categorized separately | PseudoBoolean PBOp -- Pseudo-boolean ops, categorized separately | OverflowOp OvOp -- Overflow-ops, categorized separately | StrOp StrOp -- String ops, categorized separately | SeqOp SeqOp -- Sequence ops, categorized separately deriving (Eq, Ord) -- | Floating point operations data FPOp = FP_Cast Kind Kind SW -- From-Kind, To-Kind, RoundingMode. This is "value" conversion | FP_Reinterpret Kind Kind -- From-Kind, To-Kind. This is bit-reinterpretation using IEEE-754 interchange format | FP_Abs | FP_Neg | FP_Add | FP_Sub | FP_Mul | FP_Div | FP_FMA | FP_Sqrt | FP_Rem | FP_RoundToIntegral | FP_Min | FP_Max | FP_ObjEqual | FP_IsNormal | FP_IsSubnormal | FP_IsZero | FP_IsInfinite | FP_IsNaN | FP_IsNegative | FP_IsPositive deriving (Eq, Ord) -- Note that the show instance maps to the SMTLib names. We need to make sure -- this mapping stays correct through SMTLib changes. The only exception -- is FP_Cast; where we handle different source/origins explicitly later on. instance Show FPOp where show (FP_Cast f t r) = "(FP_Cast: " ++ show f ++ " -> " ++ show t ++ ", using RM [" ++ show r ++ "])" show (FP_Reinterpret f t) = case (f, t) of (KBounded False 32, KFloat) -> "(_ to_fp 8 24)" (KBounded False 64, KDouble) -> "(_ to_fp 11 53)" _ -> error $ "SBV.FP_Reinterpret: Unexpected conversion: " ++ show f ++ " to " ++ show t show FP_Abs = "fp.abs" show FP_Neg = "fp.neg" show FP_Add = "fp.add" show FP_Sub = "fp.sub" show FP_Mul = "fp.mul" show FP_Div = "fp.div" show FP_FMA = "fp.fma" show FP_Sqrt = "fp.sqrt" show FP_Rem = "fp.rem" show FP_RoundToIntegral = "fp.roundToIntegral" show FP_Min = "fp.min" show FP_Max = "fp.max" show FP_ObjEqual = "=" show FP_IsNormal = "fp.isNormal" show FP_IsSubnormal = "fp.isSubnormal" show FP_IsZero = "fp.isZero" show FP_IsInfinite = "fp.isInfinite" show FP_IsNaN = "fp.isNaN" show FP_IsNegative = "fp.isNegative" show FP_IsPositive = "fp.isPositive" -- | Pseudo-boolean operations data PBOp = PB_AtMost Int -- ^ At most k | PB_AtLeast Int -- ^ At least k | PB_Exactly Int -- ^ Exactly k | PB_Le [Int] Int -- ^ At most k, with coefficients given. Generalizes PB_AtMost | PB_Ge [Int] Int -- ^ At least k, with coefficients given. Generalizes PB_AtLeast | PB_Eq [Int] Int -- ^ Exactly k, with coefficients given. Generalized PB_Exactly deriving (Eq, Ord, Show) -- | Overflow operations data OvOp = Overflow_SMul_OVFL -- ^ Signed multiplication overflow | Overflow_SMul_UDFL -- ^ Signed multiplication underflow | Overflow_UMul_OVFL -- ^ Unsigned multiplication overflow deriving (Eq, Ord) -- | Show instance. It's important that these follow the internal z3 names instance Show OvOp where show Overflow_SMul_OVFL = "bvsmul_noovfl" show Overflow_SMul_UDFL = "bvsmul_noudfl" show Overflow_UMul_OVFL = "bvumul_noovfl" -- | String operations. Note that we do not define @StrAt@ as it translates to 'StrSubstr' trivially. data StrOp = StrConcat -- ^ Concatenation of one or more strings | StrLen -- ^ String length | StrUnit -- ^ Unit string | StrSubstr -- ^ Retrieves substring of @s@ at @offset@ | StrIndexOf -- ^ Retrieves first position of @sub@ in @s@, @-1@ if there are no occurrences | StrContains -- ^ Does @s@ contain the substring @sub@? | StrPrefixOf -- ^ Is @pre@ a prefix of @s@? | StrSuffixOf -- ^ Is @suf@ a suffix of @s@? | StrReplace -- ^ Replace the first occurrence of @src@ by @dst@ in @s@ | StrStrToNat -- ^ Retrieve integer encoded by string @s@ (ground rewriting only) | StrNatToStr -- ^ Retrieve string encoded by integer @i@ (ground rewriting only) | StrInRe RegExp -- ^ Check if string is in the regular expression deriving (Eq, Ord) -- | Regular expressions. Note that regular expressions themselves are -- concrete, but the 'Data.SBV.RegExp.match' function from the 'Data.SBV.RegExp.RegExpMatchable' class -- can check membership against a symbolic string/character. Also, we -- are preferring a datatype approach here, as opposed to coming up with -- some string-representation; there are way too many alternatives -- already so inventing one isn't a priority. Please get in touch if you -- would like a parser for this type as it might be easier to use. data RegExp = Literal String -- ^ Precisely match the given string | All -- ^ Accept every string | None -- ^ Accept no strings | Range Char Char -- ^ Accept range of characters | Conc [RegExp] -- ^ Concatenation | KStar RegExp -- ^ Kleene Star: Zero or more | KPlus RegExp -- ^ Kleene Plus: One or more | Opt RegExp -- ^ Zero or one | Loop Int Int RegExp -- ^ From @n@ repetitions to @m@ repetitions | Union [RegExp] -- ^ Union of regular expressions | Inter RegExp RegExp -- ^ Intersection of regular expressions deriving (Eq, Ord) -- | With overloaded strings, we can have direct literal regular expressions. instance IsString RegExp where fromString = Literal -- | Regular expressions as a 'Num' instance. Note that -- only `+` (union) and `*` (concatenation) make sense. instance Num RegExp where -- flatten the concats to make them simpler Conc xs * y = Conc (xs ++ [y]) x * Conc ys = Conc (x : ys) x * y = Conc [x, y] -- flatten the unions to make them simpler Union xs + y = Union (xs ++ [y]) x + Union ys = Union (x : ys) x + y = Union [x, y] abs = error "Num.RegExp: no abs method" signum = error "Num.RegExp: no signum method" fromInteger x | x == 0 = None | x == 1 = Literal "" -- Unit for concatenation is the empty string | True = error $ "Num.RegExp: Only 0 and 1 makes sense as a reg-exp, no meaning for: " ++ show x negate = error "Num.RegExp: no negate method" -- | Show instance for `RegExp`. The mapping is done so the outcome matches the -- SMTLib string reg-exp operations instance Show RegExp where show (Literal s) = "(str.to.re \"" ++ stringToQFS s ++ "\")" show All = "re.allchar" show None = "re.nostr" show (Range ch1 ch2) = "(re.range \"" ++ stringToQFS [ch1] ++ "\" \"" ++ stringToQFS [ch2] ++ "\")" show (Conc []) = show (1 :: Integer) show (Conc [x]) = show x show (Conc xs) = "(re.++ " ++ unwords (map show xs) ++ ")" show (KStar r) = "(re.* " ++ show r ++ ")" show (KPlus r) = "(re.+ " ++ show r ++ ")" show (Opt r) = "(re.opt " ++ show r ++ ")" show (Loop lo hi r) | lo >= 0, hi >= lo = "((_ re.loop " ++ show lo ++ " " ++ show hi ++ ") " ++ show r ++ ")" | True = error $ "Invalid regular-expression Loop with arguments: " ++ show (lo, hi) show (Inter r1 r2) = "(re.inter " ++ show r1 ++ " " ++ show r2 ++ ")" show (Union []) = "re.nostr" show (Union [x]) = show x show (Union xs) = "(re.union " ++ unwords (map show xs) ++ ")" -- | Show instance for @StrOp@. Note that the mapping here is -- important to match the SMTLib equivalents, see here: instance Show StrOp where show StrConcat = "str.++" show StrLen = "str.len" show StrUnit = "seq.unit" -- NB. The "seq" prefix is intentional; works uniformly. show StrSubstr = "str.substr" show StrIndexOf = "str.indexof" show StrContains = "str.contains" show StrPrefixOf = "str.prefixof" show StrSuffixOf = "str.suffixof" show StrReplace = "str.replace" show StrStrToNat = "str.to.int" -- NB. SMTLib uses "int" here though only nats are supported show StrNatToStr = "int.to.str" -- NB. SMTLib uses "int" here though only nats are supported -- Note the breakage here with respect to argument order. We fix this explicitly later. show (StrInRe s) = "str.in.re " ++ show s -- | Sequence operations. data SeqOp = SeqConcat -- ^ See StrConcat | SeqLen -- ^ See StrLen | SeqUnit -- ^ See StrUnit | SeqSubseq -- ^ See StrSubseq | SeqIndexOf -- ^ See StrIndexOf | SeqContains -- ^ See StrContains | SeqPrefixOf -- ^ See StrPrefixOf | SeqSuffixOf -- ^ See StrSuffixOf | SeqReplace -- ^ See StrReplace deriving (Eq, Ord) -- | Show instance for @SeqOp@. Again, mapping is important. instance Show SeqOp where show SeqConcat = "seq.++" show SeqLen = "seq.len" show SeqUnit = "seq.unit" show SeqSubseq = "seq.extract" show SeqIndexOf = "seq.indexof" show SeqContains = "seq.contains" show SeqPrefixOf = "seq.prefixof" show SeqSuffixOf = "seq.suffixof" show SeqReplace = "seq.replace" -- Show instance for 'Op'. Note that this is largely for debugging purposes, not used -- for being read by any tool. instance Show Op where show Shl = "<<" show Shr = ">>" show (Rol i) = "<<<" ++ show i show (Ror i) = ">>>" ++ show i show (Extract i j) = "choose [" ++ show i ++ ":" ++ show j ++ "]" show (LkUp (ti, at, rt, l) i e) = "lookup(" ++ tinfo ++ ", " ++ show i ++ ", " ++ show e ++ ")" where tinfo = "table" ++ show ti ++ "(" ++ show at ++ " -> " ++ show rt ++ ", " ++ show l ++ ")" show (ArrEq i j) = "array_" ++ show i ++ " == array_" ++ show j show (ArrRead i) = "select array_" ++ show i show (KindCast fr to) = "cast_" ++ show fr ++ "_" ++ show to show (Uninterpreted i) = "[uninterpreted] " ++ i show (Label s) = "[label] " ++ s show (IEEEFP w) = show w show (PseudoBoolean p) = show p show (OverflowOp o) = show o show (StrOp s) = show s show (SeqOp s) = show s show op | Just s <- op `lookup` syms = s | True = error "impossible happened; can't find op!" where syms = [ (Plus, "+"), (Times, "*"), (Minus, "-"), (UNeg, "-"), (Abs, "abs") , (Quot, "quot") , (Rem, "rem") , (Equal, "=="), (NotEqual, "/=") , (LessThan, "<"), (GreaterThan, ">"), (LessEq, "<="), (GreaterEq, ">=") , (Ite, "if_then_else") , (And, "&"), (Or, "|"), (XOr, "^"), (Not, "~") , (Join, "#") ] -- | Quantifiers: forall or exists. Note that we allow -- arbitrary nestings. data Quantifier = ALL | EX deriving Eq -- | Are there any existential quantifiers? needsExistentials :: [Quantifier] -> Bool needsExistentials = (EX `elem`) -- | A simple type for SBV computations, used mainly for uninterpreted constants. -- We keep track of the signedness/size of the arguments. A non-function will -- have just one entry in the list. newtype SBVType = SBVType [Kind] deriving (Eq, Ord) instance Show SBVType where show (SBVType []) = error "SBV: internal error, empty SBVType" show (SBVType xs) = intercalate " -> " $ map show xs -- | A symbolic expression data SBVExpr = SBVApp !Op ![SW] deriving (Eq, Ord) -- | To improve hash-consing, take advantage of commutative operators by -- reordering their arguments. reorder :: SBVExpr -> SBVExpr reorder s = case s of SBVApp op [a, b] | isCommutative op && a > b -> SBVApp op [b, a] _ -> s where isCommutative :: Op -> Bool isCommutative o = o `elem` [Plus, Times, Equal, NotEqual, And, Or, XOr] -- Show instance for 'SBVExpr'. Again, only for debugging purposes. instance Show SBVExpr where show (SBVApp Ite [t, a, b]) = unwords ["if", show t, "then", show a, "else", show b] show (SBVApp Shl [a, i]) = unwords [show a, "<<", show i] show (SBVApp Shr [a, i]) = unwords [show a, ">>", show i] show (SBVApp (Rol i) [a]) = unwords [show a, "<<<", show i] show (SBVApp (Ror i) [a]) = unwords [show a, ">>>", show i] show (SBVApp (PseudoBoolean pb) args) = unwords (show pb : map show args) show (SBVApp (OverflowOp op) args) = unwords (show op : map show args) show (SBVApp op [a, b]) = unwords [show a, show op, show b] show (SBVApp op args) = unwords (show op : map show args) -- | A program is a sequence of assignments newtype SBVPgm = SBVPgm {pgmAssignments :: S.Seq (SW, SBVExpr)} -- | 'NamedSymVar' pairs symbolic words and user given/automatically generated names type NamedSymVar = (SW, String) -- | Style of optimization. Note that in the pareto case the user is allowed -- to specify a max number of fronts to query the solver for, since there might -- potentially be an infinite number of them and there is no way to know exactly -- how many ahead of time. If 'Nothing' is given, SBV will possibly loop forever -- if the number is really infinite. data OptimizeStyle = Lexicographic -- ^ Objectives are optimized in the order given, earlier objectives have higher priority. | Independent -- ^ Each objective is optimized independently. | Pareto (Maybe Int) -- ^ Objectives are optimized according to pareto front: That is, no objective can be made better without making some other worse. deriving (Eq, Show) -- | Penalty for a soft-assertion. The default penalty is @1@, with all soft-assertions belonging -- to the same objective goal. A positive weight and an optional group can be provided by using -- the 'Penalty' constructor. data Penalty = DefaultPenalty -- ^ Default: Penalty of @1@ and no group attached | Penalty Rational (Maybe String) -- ^ Penalty with a weight and an optional group deriving Show -- | Objective of optimization. We can minimize, maximize, or give a soft assertion with a penalty -- for not satisfying it. data Objective a = Minimize String a -- ^ Minimize this metric | Maximize String a -- ^ Maximize this metric | AssertWithPenalty String a Penalty -- ^ A soft assertion, with an associated penalty deriving (Show, Functor) -- | The name of the objective objectiveName :: Objective a -> String objectiveName (Minimize s _) = s objectiveName (Maximize s _) = s objectiveName (AssertWithPenalty s _ _) = s -- | The state we keep track of as we interact with the solver data QueryState = QueryState { queryAsk :: Maybe Int -> String -> IO String , querySend :: Maybe Int -> String -> IO () , queryRetrieveResponse :: Maybe Int -> IO String , queryConfig :: SMTConfig , queryTerminate :: IO () , queryTimeOutValue :: Maybe Int , queryAssertionStackDepth :: Int , queryTblArrPreserveIndex :: Maybe (Int, Int) } -- | A query is a user-guided mechanism to directly communicate and extract results from the solver. newtype Query a = Query (StateT State IO a) deriving (Applicative, Functor, Monad, MonadIO, MonadState State) instance NFData OptimizeStyle where rnf x = x `seq` () instance NFData Penalty where rnf DefaultPenalty = () rnf (Penalty p mbs) = rnf p `seq` rnf mbs `seq` () instance NFData a => NFData (Objective a) where rnf (Minimize s a) = rnf s `seq` rnf a `seq` () rnf (Maximize s a) = rnf s `seq` rnf a `seq` () rnf (AssertWithPenalty s a p) = rnf s `seq` rnf a `seq` rnf p `seq` () -- | Result of running a symbolic computation data Result = Result { reskinds :: Set.Set Kind -- ^ kinds used in the program , resTraces :: [(String, CW)] -- ^ quick-check counter-example information (if any) , resObservables :: [(String, SW)] -- ^ observable expressions (part of the model) , resUISegs :: [(String, [String])] -- ^ uninterpeted code segments , resInputs :: ([(Quantifier, NamedSymVar)], [NamedSymVar]) -- ^ inputs (possibly existential) + tracker vars , resConsts :: [(SW, CW)] -- ^ constants , resTables :: [((Int, Kind, Kind), [SW])] -- ^ tables (automatically constructed) (tableno, index-type, result-type) elts , resArrays :: [(Int, ArrayInfo)] -- ^ arrays (user specified) , resUIConsts :: [(String, SBVType)] -- ^ uninterpreted constants , resAxioms :: [(String, [String])] -- ^ axioms , resAsgns :: SBVPgm -- ^ assignments , resConstraints :: [(Bool, [(String, String)], SW)] -- ^ additional constraints (boolean) , resAssertions :: [(String, Maybe CallStack, SW)] -- ^ assertions , resOutputs :: [SW] -- ^ outputs } -- Show instance for 'Result'. Only for debugging purposes. instance Show Result where -- If there's nothing interesting going on, just print the constant. Note that the -- definiton of interesting here is rather subjective; but essentially if we reduced -- the result to a single constant already, without any reference to anything. show Result{resConsts=cs, resOutputs=[r]} | Just c <- r `lookup` cs = show c show (Result kinds _ _ cgs is cs ts as uis axs xs cstrs asserts os) = intercalate "\n" $ (if null usorts then [] else "SORTS" : map (" " ++) usorts) ++ ["INPUTS"] ++ map shn (fst is) ++ (if null (snd is) then [] else "TRACKER VARS" : map (shn . (EX,)) (snd is)) ++ ["CONSTANTS"] ++ map shc cs ++ ["TABLES"] ++ map sht ts ++ ["ARRAYS"] ++ map sha as ++ ["UNINTERPRETED CONSTANTS"] ++ map shui uis ++ ["USER GIVEN CODE SEGMENTS"] ++ concatMap shcg cgs ++ ["AXIOMS"] ++ map shax axs ++ ["DEFINE"] ++ map (\(s, e) -> " " ++ shs s ++ " = " ++ show e) (F.toList (pgmAssignments xs)) ++ ["CONSTRAINTS"] ++ map ((" " ++) . shCstr) cstrs ++ ["ASSERTIONS"] ++ map ((" "++) . shAssert) asserts ++ ["OUTPUTS"] ++ sh2 os where sh2 :: Show a => [a] -> [String] sh2 = map ((" "++) . show) usorts = [sh s t | KUserSort s t <- Set.toList kinds] where sh s (Left _) = s sh s (Right es) = s ++ " (" ++ intercalate ", " es ++ ")" shs sw = show sw ++ " :: " ++ show (swKind sw) sht ((i, at, rt), es) = " Table " ++ show i ++ " : " ++ show at ++ "->" ++ show rt ++ " = " ++ show es shc (sw, cw) = " " ++ show sw ++ " = " ++ show cw shcg (s, ss) = ("Variable: " ++ s) : map (" " ++) ss shn (q, (sw, nm)) = " " ++ ni ++ " :: " ++ show (swKind sw) ++ ex ++ alias where ni = show sw ex | q == ALL = "" | True = ", existential" alias | ni == nm = "" | True = ", aliasing " ++ show nm sha (i, (nm, (ai, bi), ctx)) = " " ++ ni ++ " :: " ++ show ai ++ " -> " ++ show bi ++ alias ++ "\n Context: " ++ show ctx where ni = "array_" ++ show i alias | ni == nm = "" | True = ", aliasing " ++ show nm shui (nm, t) = " [uninterpreted] " ++ nm ++ " :: " ++ show t shax (nm, ss) = " -- user defined axiom: " ++ nm ++ "\n " ++ intercalate "\n " ss shCstr (isSoft, [], c) = soft isSoft ++ show c shCstr (isSoft, [(":named", nm)], c) = soft isSoft ++ nm ++ ": " ++ show c shCstr (isSoft, attrs, c) = soft isSoft ++ show c ++ " (attributes: " ++ show attrs ++ ")" soft True = "[SOFT] " soft False = "" shAssert (nm, stk, p) = " -- assertion: " ++ nm ++ " " ++ maybe "[No location]" #if MIN_VERSION_base(4,9,0) prettyCallStack #else showCallStack #endif stk ++ ": " ++ show p -- | The context of a symbolic array as created data ArrayContext = ArrayFree (Maybe SW) -- ^ A new array, the contents are initialized with the given value, if any | ArrayMutate ArrayIndex SW SW -- ^ An array created by mutating another array at a given cell | ArrayMerge SW ArrayIndex ArrayIndex -- ^ An array created by symbolically merging two other arrays instance Show ArrayContext where show (ArrayFree Nothing) = " initialized with random elements" show (ArrayFree (Just sw)) = " initialized with " ++ show sw show (ArrayMutate i a b) = " cloned from array_" ++ show i ++ " with " ++ show a ++ " :: " ++ show (swKind a) ++ " |-> " ++ show b ++ " :: " ++ show (swKind b) show (ArrayMerge s i j) = " merged arrays " ++ show i ++ " and " ++ show j ++ " on condition " ++ show s -- | Expression map, used for hash-consing type ExprMap = Map.Map SBVExpr SW -- | Constants are stored in a map, for hash-consing. type CnstMap = Map.Map CW SW -- | Kinds used in the program; used for determining the final SMT-Lib logic to pick type KindSet = Set.Set Kind -- | Tables generated during a symbolic run type TableMap = Map.Map (Kind, Kind, [SW]) Int -- | Representation for symbolic arrays type ArrayInfo = (String, (Kind, Kind), ArrayContext) -- | SMT Arrays generated during a symbolic run type ArrayMap = IMap.IntMap ArrayInfo -- | Functional Arrays generated during a symbolic run type FArrayMap = IMap.IntMap (SVal -> SVal, IORef (IMap.IntMap SW)) -- | Uninterpreted-constants generated during a symbolic run type UIMap = Map.Map String SBVType -- | Code-segments for Uninterpreted-constants, as given by the user type CgMap = Map.Map String [String] -- | Cached values, implementing sharing type Cache a = IMap.IntMap [(StableName (State -> IO a), a)] -- | Stage of an interactive run data IStage = ISetup -- Before we initiate contact. | ISafe -- In the context of a safe/safeWith call | IRun -- After the contact is started -- | Are we cecking safety isSafetyCheckingIStage :: IStage -> Bool isSafetyCheckingIStage s = case s of ISetup -> False ISafe -> True IRun -> False -- | Are we in setup? isSetupIStage :: IStage -> Bool isSetupIStage s = case s of ISetup -> True ISafe -> False IRun -> True -- | Are we in a run? isRunIStage :: IStage -> Bool isRunIStage s = case s of ISetup -> False ISafe -> False IRun -> True -- | Different means of running a symbolic piece of code data SBVRunMode = SMTMode IStage Bool SMTConfig -- ^ In regular mode, with a stage. Bool is True if this is SAT. | CodeGen -- ^ Code generation mode. | Concrete -- ^ Concrete simulation mode. -- Show instance for SBVRunMode; debugging purposes only instance Show SBVRunMode where show (SMTMode ISetup True _) = "Satisfiability setup" show (SMTMode ISafe True _) = "Safety setup" show (SMTMode IRun True _) = "Satisfiability" show (SMTMode ISetup False _) = "Proof setup" show (SMTMode ISafe False _) = error "ISafe-False is not an expected/supported combination for SBVRunMode!" show (SMTMode IRun False _) = "Proof" show CodeGen = "Code generation" show Concrete = "Concrete evaluation" -- | Is this a CodeGen run? (i.e., generating code) isCodeGenMode :: State -> IO Bool isCodeGenMode State{runMode} = do rm <- readIORef runMode return $ case rm of Concrete{} -> False SMTMode{} -> False CodeGen -> True -- | The state in query mode, i.e., additional context data IncState = IncState { rNewInps :: IORef [NamedSymVar] -- always existential! , rNewKinds :: IORef KindSet , rNewConsts :: IORef CnstMap , rNewArrs :: IORef ArrayMap , rNewTbls :: IORef TableMap , rNewUIs :: IORef UIMap , rNewAsgns :: IORef SBVPgm } -- | Get a new IncState newIncState :: IO IncState newIncState = do is <- newIORef [] ks <- newIORef Set.empty nc <- newIORef Map.empty am <- newIORef IMap.empty tm <- newIORef Map.empty ui <- newIORef Map.empty pgm <- newIORef (SBVPgm S.empty) return IncState { rNewInps = is , rNewKinds = ks , rNewConsts = nc , rNewArrs = am , rNewTbls = tm , rNewUIs = ui , rNewAsgns = pgm } -- | Get a new IncState withNewIncState :: State -> (State -> IO a) -> IO (IncState, a) withNewIncState st cont = do is <- newIncState R.modifyIORef' (rIncState st) (const is) r <- cont st finalIncState <- readIORef (rIncState st) return (finalIncState, r) -- | The state of the symbolic interpreter data State = State { pathCond :: SVal -- ^ kind KBool , startTime :: UTCTime , runMode :: IORef SBVRunMode , rIncState :: IORef IncState , rCInfo :: IORef [(String, CW)] , rObservables :: IORef [(String, SW)] , rctr :: IORef Int , rUsedKinds :: IORef KindSet , rUsedLbls :: IORef (Set.Set String) , rinps :: IORef ([(Quantifier, NamedSymVar)], [NamedSymVar]) -- User defined, and internal existential , rConstraints :: IORef [(Bool, [(String, String)], SW)] , routs :: IORef [SW] , rtblMap :: IORef TableMap , spgm :: IORef SBVPgm , rconstMap :: IORef CnstMap , rexprMap :: IORef ExprMap , rArrayMap :: IORef ArrayMap , rFArrayMap :: IORef FArrayMap , rUIMap :: IORef UIMap , rCgMap :: IORef CgMap , raxioms :: IORef [(String, [String])] , rSMTOptions :: IORef [SMTOption] , rOptGoals :: IORef [Objective (SW, SW)] , rAsserts :: IORef [(String, Maybe CallStack, SW)] , rSWCache :: IORef (Cache SW) , rAICache :: IORef (Cache ArrayIndex) , rFAICache :: IORef (Cache FArrayIndex) , queryState :: IORef (Maybe QueryState) } -- NFData is a bit of a lie, but it's sufficient, most of the content is iorefs that we don't want to touch instance NFData State where rnf State{} = () -- | Get the current path condition getSValPathCondition :: State -> SVal getSValPathCondition = pathCond -- | Extend the path condition with the given test value. extendSValPathCondition :: State -> (SVal -> SVal) -> State extendSValPathCondition st f = st{pathCond = f (pathCond st)} -- | Are we running in proof mode? inSMTMode :: State -> IO Bool inSMTMode State{runMode} = do rm <- readIORef runMode return $ case rm of CodeGen -> False Concrete{} -> False SMTMode{} -> True -- | The "Symbolic" value. Either a constant (@Left@) or a symbolic -- value (@Right Cached@). Note that caching is essential for making -- sure sharing is preserved. data SVal = SVal !Kind !(Either CW (Cached SW)) instance HasKind SVal where kindOf (SVal k _) = k -- Show instance for 'SVal'. Not particularly "desirable", but will do if needed -- NB. We do not show the type info on constant KBool values, since there's no -- implicit "fromBoolean" applied to Booleans in Haskell; and thus a statement -- of the form "True :: SBool" is just meaningless. (There should be a fromBoolean!) instance Show SVal where show (SVal KBool (Left c)) = showCW False c show (SVal k (Left c)) = showCW False c ++ " :: " ++ show k show (SVal k (Right _)) = " :: " ++ show k -- We really don't want an 'Eq' instance for 'SBV' or 'SVal'. As it really makes no sense. -- But since we do want the 'Bits' instance, we're forced to define equality. See -- . We simply error out. -- | This instance is only defined so that we can define an instance for -- 'Data.Bits.Bits'. '==' and '/=' simply throw an error. instance Eq SVal where a == b = error $ "Comparing symbolic bit-vectors; Use (.==) instead. Received: " ++ show (a, b) a /= b = error $ "Comparing symbolic bit-vectors; Use (./=) instead. Received: " ++ show (a, b) -- | Things we do not support in interactive mode, at least for now! noInteractive :: [String] -> a noInteractive ss = error $ unlines $ "" : "*** Data.SBV: Unsupported interactive/query mode feature." : map ("*** " ++) ss ++ ["*** Data.SBV: Please report this as a feature request!"] -- | Modification of the state, but carefully handling the interactive tasks. -- Note that the state is always updated regardless of the mode, but we get -- to also perform extra operation in interactive mode. (Typically error out, but also simply -- ignore if it has no impact.) modifyState :: State -> (State -> IORef a) -> (a -> a) -> IO () -> IO () modifyState st@State{runMode} field update interactiveUpdate = do R.modifyIORef' (field st) update rm <- readIORef runMode case rm of SMTMode IRun _ _ -> interactiveUpdate _ -> return () -- | Modify the incremental state modifyIncState :: State -> (IncState -> IORef a) -> (a -> a) -> IO () modifyIncState State{rIncState} field update = do incState <- readIORef rIncState R.modifyIORef' (field incState) update -- | Add an observable recordObservable :: State -> String -> SW -> IO () recordObservable st nm sw = modifyState st rObservables ((nm, sw):) (return ()) -- | Increment the variable counter incrementInternalCounter :: State -> IO Int incrementInternalCounter st = do ctr <- readIORef (rctr st) modifyState st rctr (+1) (return ()) return ctr -- | Uninterpreted constants and functions. An uninterpreted constant is -- a value that is indexed by its name. The only property the prover assumes -- about these values are that they are equivalent to themselves; i.e., (for -- functions) they return the same results when applied to same arguments. -- We support uninterpreted-functions as a general means of black-box'ing -- operations that are /irrelevant/ for the purposes of the proof; i.e., when -- the proofs can be performed without any knowledge about the function itself. svUninterpreted :: Kind -> String -> Maybe [String] -> [SVal] -> SVal svUninterpreted k nm code args = SVal k $ Right $ cache result where result st = do let ty = SBVType (map kindOf args ++ [k]) newUninterpreted st nm ty code sws <- mapM (svToSW st) args mapM_ forceSWArg sws newExpr st k $ SBVApp (Uninterpreted nm) sws -- | Create a new uninterpreted symbol, possibly with user given code newUninterpreted :: State -> String -> SBVType -> Maybe [String] -> IO () newUninterpreted st nm t mbCode | null nm || not enclosed && (not (isAlpha (head nm)) || not (all validChar (tail nm))) = error $ "Bad uninterpreted constant name: " ++ show nm ++ ". Must be a valid identifier." | True = do uiMap <- readIORef (rUIMap st) case nm `Map.lookup` uiMap of Just t' -> checkType t' (return ()) Nothing -> do modifyState st rUIMap (Map.insert nm t) $ modifyIncState st rNewUIs (\newUIs -> case nm `Map.lookup` newUIs of Just t' -> checkType t' newUIs Nothing -> Map.insert nm t newUIs) -- No need to record the code in interactive mode: CodeGen doesn't use interactive when (isJust mbCode) $ modifyState st rCgMap (Map.insert nm (fromJust mbCode)) (return ()) where checkType t' cont | t /= t' = error $ "Uninterpreted constant " ++ show nm ++ " used at incompatible types\n" ++ " Current type : " ++ show t ++ "\n" ++ " Previously used at: " ++ show t' | True = cont validChar x = isAlphaNum x || x `elem` "_" enclosed = head nm == '|' && last nm == '|' && length nm > 2 && not (any (`elem` "|\\") (tail (init nm))) -- | Add a new sAssert based constraint addAssertion :: State -> Maybe CallStack -> String -> SW -> IO () addAssertion st cs msg cond = modifyState st rAsserts ((msg, cs, cond):) $ noInteractive [ "Named assertions (sAssert):" , " Tag: " ++ msg , " Loc: " ++ maybe "Unknown" show cs ] -- | Create an internal variable, which acts as an input but isn't visible to the user. -- Such variables are existentially quantified in a SAT context, and universally quantified -- in a proof context. internalVariable :: State -> Kind -> IO SW internalVariable st k = do (sw, nm) <- newSW st k rm <- readIORef (runMode st) let q = case rm of SMTMode _ True _ -> EX SMTMode _ False _ -> ALL CodeGen -> ALL Concrete{} -> ALL modifyState st rinps (first ((:) (q, (sw, "__internal_sbv_" ++ nm)))) $ noInteractive [ "Internal variable creation:" , " Named: " ++ nm ] return sw {-# INLINE internalVariable #-} -- | Create a new SW newSW :: State -> Kind -> IO (SW, String) newSW st k = do ctr <- incrementInternalCounter st let sw = SW k (NodeId ctr) registerKind st k return (sw, 's' : show ctr) {-# INLINE newSW #-} -- | Register a new kind with the system, used for uninterpreted sorts. -- NB: Is it safe to have new kinds in query mode? It could be that -- the new kind might introduce a constraint that effects the logic. For -- instance, if we're seeing 'Double' for the first time and using a BV -- logic, then things would fall apart. But this should be rare, and hopefully -- the success-response checking mechanism will catch the rare cases where this -- is an issue. In either case, the user can always arrange for the right -- logic by calling 'Data.SBV.setLogic' appropriately, so it seems safe to just -- allow for this. registerKind :: State -> Kind -> IO () registerKind st k | KUserSort sortName _ <- k, map toLower sortName `elem` smtLibReservedNames = error $ "SBV: " ++ show sortName ++ " is a reserved sort; please use a different name." | True = do ks <- readIORef (rUsedKinds st) unless (k `Set.member` ks) $ modifyState st rUsedKinds (Set.insert k) $ modifyIncState st rNewKinds (Set.insert k) -- | Register a new label with the system, making sure they are unique and have no '|'s in them registerLabel :: String -> State -> String -> IO () registerLabel whence st nm | map toLower nm `elem` smtLibReservedNames = err "is a reserved string; please use a different name." | '|' `elem` nm = err "contains the character `|', which is not allowed!" | '\\' `elem` nm = err "contains the character `\', which is not allowed!" | True = do old <- readIORef $ rUsedLbls st if nm `Set.member` old then err "is used multiple times. Please do not use duplicate names!" else modifyState st rUsedLbls (Set.insert nm) (return ()) where err w = error $ "SBV (" ++ whence ++ "): " ++ show nm ++ " " ++ w -- | Create a new constant; hash-cons as necessary newConst :: State -> CW -> IO SW newConst st c = do constMap <- readIORef (rconstMap st) case c `Map.lookup` constMap of Just sw -> return sw Nothing -> do let k = kindOf c (sw, _) <- newSW st k let ins = Map.insert c sw modifyState st rconstMap ins $ modifyIncState st rNewConsts ins return sw {-# INLINE newConst #-} -- | Create a new table; hash-cons as necessary getTableIndex :: State -> Kind -> Kind -> [SW] -> IO Int getTableIndex st at rt elts = do let key = (at, rt, elts) tblMap <- readIORef (rtblMap st) case key `Map.lookup` tblMap of Just i -> return i _ -> do let i = Map.size tblMap upd = Map.insert key i modifyState st rtblMap upd $ modifyIncState st rNewTbls upd return i -- | Create a new expression; hash-cons as necessary newExpr :: State -> Kind -> SBVExpr -> IO SW newExpr st k app = do let e = reorder app exprMap <- readIORef (rexprMap st) case e `Map.lookup` exprMap of Just sw -> return sw Nothing -> do (sw, _) <- newSW st k let append (SBVPgm xs) = SBVPgm (xs S.|> (sw, e)) modifyState st spgm append $ modifyIncState st rNewAsgns append modifyState st rexprMap (Map.insert e sw) (return ()) return sw {-# INLINE newExpr #-} -- | Convert a symbolic value to a symbolic-word svToSW :: State -> SVal -> IO SW svToSW st (SVal _ (Left c)) = newConst st c svToSW st (SVal _ (Right f)) = uncache f st -- | Convert a symbolic value to an SW, inside the Symbolic monad svToSymSW :: SVal -> Symbolic SW svToSymSW sbv = do st <- ask liftIO $ svToSW st sbv ------------------------------------------------------------------------- -- * Symbolic Computations ------------------------------------------------------------------------- -- | A Symbolic computation. Represented by a reader monad carrying the -- state of the computation, layered on top of IO for creating unique -- references to hold onto intermediate results. newtype Symbolic a = Symbolic (ReaderT State IO a) deriving ( Applicative, Functor, Monad, MonadIO, MonadReader State #if MIN_VERSION_base(4,11,0) , Fail.MonadFail #endif ) -- | Create a symbolic value, based on the quantifier we have. If an -- explicit quantifier is given, we just use that. If not, then we -- pick the quantifier appropriately based on the run-mode. -- @randomCW@ is used for generating random values for this variable -- when used for @quickCheck@ or 'Data.SBV.Tools.GenTest.genTest' purposes. svMkSymVar :: Maybe Quantifier -> Kind -> Maybe String -> State -> IO SVal svMkSymVar = svMkSymVarGen False -- | Create an existentially quantified tracker variable svMkTrackerVar :: Kind -> String -> State -> IO SVal svMkTrackerVar k nm = svMkSymVarGen True (Just EX) k (Just nm) -- | Create an N-bit symbolic unsigned named variable sWordN :: Int -> String -> Symbolic SVal sWordN w nm = ask >>= liftIO . svMkSymVar Nothing (KBounded False w) (Just nm) -- | Create an N-bit symbolic unsigned unnamed variable sWordN_ :: Int -> Symbolic SVal sWordN_ w = ask >>= liftIO . svMkSymVar Nothing (KBounded False w) Nothing -- | Create an N-bit symbolic signed named variable sIntN :: Int -> String -> Symbolic SVal sIntN w nm = ask >>= liftIO . svMkSymVar Nothing (KBounded True w) (Just nm) -- | Create an N-bit symbolic signed unnamed variable sIntN_ :: Int -> Symbolic SVal sIntN_ w = ask >>= liftIO . svMkSymVar Nothing (KBounded True w) Nothing -- | Create a symbolic value, based on the quantifier we have. If an -- explicit quantifier is given, we just use that. If not, then we -- pick the quantifier appropriately based on the run-mode. -- @randomCW@ is used for generating random values for this variable -- when used for @quickCheck@ or 'Data.SBV.Tools.GenTest.genTest' purposes. svMkSymVarGen :: Bool -> Maybe Quantifier -> Kind -> Maybe String -> State -> IO SVal svMkSymVarGen isTracker mbQ k mbNm st = do rm <- readIORef (runMode st) let varInfo = case mbNm of Nothing -> ", of type " ++ show k Just nm -> ", while defining " ++ nm ++ " :: " ++ show k disallow what = error $ "Data.SBV: Unsupported: " ++ what ++ varInfo ++ " in mode: " ++ show rm noUI cont | isUninterpreted k = disallow "Uninterpreted sorts" | True = cont mkS q = do (sw, internalName) <- newSW st k let nm = fromMaybe internalName mbNm introduceUserName st isTracker nm k q sw mkC = do cw <- randomCW k do registerKind st k modifyState st rCInfo ((fromMaybe "_" mbNm, cw):) (return ()) return $ SVal k (Left cw) case (mbQ, rm) of (Just q, SMTMode{} ) -> mkS q (Nothing, SMTMode _ isSAT _) -> mkS (if isSAT then EX else ALL) (Just EX, CodeGen{}) -> disallow "Existentially quantified variables" (_ , CodeGen) -> noUI $ mkS ALL -- code generation, pick universal (Just EX, Concrete{}) -> disallow "Existentially quantified variables" (_ , Concrete{}) -> noUI mkC -- | Introduce a new user name. We die if repeated. introduceUserName :: State -> Bool -> String -> Kind -> Quantifier -> SW -> IO SVal introduceUserName st isTracker nm k q sw = do (is, ints) <- readIORef (rinps st) if nm `elem` [n | (_, (_, n)) <- is] ++ [n | (_, n) <- ints] then error $ "SBV: Repeated user given name: " ++ show nm ++ ". Please use unique names." else if isTracker && q == ALL then error $ "SBV: Impossible happened! A universally quantified tracker variable is being introduced: " ++ show nm else do let newInp olds = case q of EX -> (sw, nm) : olds ALL -> noInteractive [ "Adding a new universally quantified variable: " , " Name : " ++ show nm , " Kind : " ++ show k , " Quantifier: Universal" , " Node : " ++ show sw , "Only existential variables are supported in query mode." ] if isTracker then modifyState st rinps (second ((:) (sw, nm))) $ noInteractive ["Adding a new tracker variable in interactive mode: " ++ show nm] else modifyState st rinps (first ((:) (q, (sw, nm)))) $ modifyIncState st rNewInps newInp return $ SVal k $ Right $ cache (const (return sw)) -- | Add a user specified axiom to the generated SMT-Lib file. The first argument is a mere -- string, use for commenting purposes. The second argument is intended to hold the multiple-lines -- of the axiom text as expressed in SMT-Lib notation. Note that we perform no checks on the axiom -- itself, to see whether it's actually well-formed or is sensical by any means. -- A separate formalization of SMT-Lib would be very useful here. addAxiom :: String -> [String] -> Symbolic () addAxiom nm ax = do st <- ask liftIO $ modifyState st raxioms ((nm, ax) :) $ noInteractive [ "Adding a new axiom:" , " Named: " ++ show nm , " Axiom: " ++ unlines ax ] -- | Run a symbolic computation, and return a extra value paired up with the 'Result' runSymbolic :: SBVRunMode -> Symbolic a -> IO (a, Result) runSymbolic currentRunMode (Symbolic c) = do currTime <- getCurrentTime rm <- newIORef currentRunMode ctr <- newIORef (-2) -- start from -2; False and True will always occupy the first two elements cInfo <- newIORef [] observes <- newIORef [] pgm <- newIORef (SBVPgm S.empty) emap <- newIORef Map.empty cmap <- newIORef Map.empty inps <- newIORef ([], []) outs <- newIORef [] tables <- newIORef Map.empty arrays <- newIORef IMap.empty fArrays <- newIORef IMap.empty uis <- newIORef Map.empty cgs <- newIORef Map.empty axioms <- newIORef [] swCache <- newIORef IMap.empty aiCache <- newIORef IMap.empty faiCache <- newIORef IMap.empty usedKinds <- newIORef Set.empty usedLbls <- newIORef Set.empty cstrs <- newIORef [] smtOpts <- newIORef [] optGoals <- newIORef [] asserts <- newIORef [] istate <- newIORef =<< newIncState qstate <- newIORef Nothing let st = State { runMode = rm , startTime = currTime , pathCond = SVal KBool (Left trueCW) , rIncState = istate , rCInfo = cInfo , rObservables = observes , rctr = ctr , rUsedKinds = usedKinds , rUsedLbls = usedLbls , rinps = inps , routs = outs , rtblMap = tables , spgm = pgm , rconstMap = cmap , rArrayMap = arrays , rFArrayMap = fArrays , rexprMap = emap , rUIMap = uis , rCgMap = cgs , raxioms = axioms , rSWCache = swCache , rAICache = aiCache , rFAICache = faiCache , rConstraints = cstrs , rSMTOptions = smtOpts , rOptGoals = optGoals , rAsserts = asserts , queryState = qstate } _ <- newConst st falseCW -- s(-2) == falseSW _ <- newConst st trueCW -- s(-1) == trueSW r <- runReaderT c st res <- extractSymbolicSimulationState st -- Clean-up after ourselves qs <- readIORef qstate case qs of Nothing -> return () Just QueryState{queryTerminate} -> queryTerminate return (r, res) -- | Grab the program from a running symbolic simulation state. extractSymbolicSimulationState :: State -> IO Result extractSymbolicSimulationState st@State{ spgm=pgm, rinps=inps, routs=outs, rtblMap=tables, rArrayMap=arrays, rUIMap=uis, raxioms=axioms , rAsserts=asserts, rUsedKinds=usedKinds, rCgMap=cgs, rCInfo=cInfo, rConstraints=cstrs , rObservables=observes } = do SBVPgm rpgm <- readIORef pgm inpsO <- (reverse *** reverse) <$> readIORef inps outsO <- reverse <$> readIORef outs let swap (a, b) = (b, a) cmp (a, _) (b, _) = a `compare` b arrange (i, (at, rt, es)) = ((i, at, rt), es) cnsts <- sortBy cmp . map swap . Map.toList <$> readIORef (rconstMap st) tbls <- map arrange . sortBy cmp . map swap . Map.toList <$> readIORef tables arrs <- IMap.toAscList <$> readIORef arrays unint <- Map.toList <$> readIORef uis axs <- reverse <$> readIORef axioms knds <- readIORef usedKinds cgMap <- Map.toList <$> readIORef cgs traceVals <- reverse <$> readIORef cInfo observables <- reverse <$> readIORef observes extraCstrs <- reverse <$> readIORef cstrs assertions <- reverse <$> readIORef asserts return $ Result knds traceVals observables cgMap inpsO cnsts tbls arrs unint axs (SBVPgm rpgm) extraCstrs assertions outsO -- | Add a new option addNewSMTOption :: SMTOption -> Symbolic () addNewSMTOption o = do st <- ask liftIO $ modifyState st rSMTOptions (o:) (return ()) -- | Handling constraints imposeConstraint :: Bool -> [(String, String)] -> SVal -> Symbolic () imposeConstraint isSoft attrs c = do st <- ask rm <- liftIO $ readIORef (runMode st) case rm of CodeGen -> error "SBV: constraints are not allowed in code-generation" _ -> liftIO $ do mapM_ (registerLabel "Constraint" st) [nm | (":named", nm) <- attrs] internalConstraint st isSoft attrs c -- | Require a boolean condition to be true in the state. Only used for internal purposes. internalConstraint :: State -> Bool -> [(String, String)] -> SVal -> IO () internalConstraint st isSoft attrs b = do v <- svToSW st b modifyState st rConstraints ((isSoft, attrs, v):) $ noInteractive [ "Adding an internal " ++ soft ++ "constraint:" , " Named: " ++ fromMaybe "" (listToMaybe [nm | (":named", nm) <- attrs]) ] where soft | isSoft = "soft-" | True = "" -- | Add an optimization goal addSValOptGoal :: Objective SVal -> Symbolic () addSValOptGoal obj = do st <- ask -- create the tracking variable here for the metric let mkGoal nm orig = liftIO $ do origSW <- svToSW st orig track <- svMkTrackerVar (kindOf orig) nm st trackSW <- svToSW st track return (origSW, trackSW) let walk (Minimize nm v) = Minimize nm <$> mkGoal nm v walk (Maximize nm v) = Maximize nm <$> mkGoal nm v walk (AssertWithPenalty nm v mbP) = flip (AssertWithPenalty nm) mbP <$> mkGoal nm v obj' <- walk obj liftIO $ modifyState st rOptGoals (obj' :) $ noInteractive [ "Adding an optimization objective:" , " Objective: " ++ show obj ] -- | Mark an interim result as an output. Useful when constructing Symbolic programs -- that return multiple values, or when the result is programmatically computed. outputSVal :: SVal -> Symbolic () outputSVal (SVal _ (Left c)) = do st <- ask sw <- liftIO $ newConst st c liftIO $ modifyState st routs (sw:) (return ()) outputSVal (SVal _ (Right f)) = do st <- ask sw <- liftIO $ uncache f st liftIO $ modifyState st routs (sw:) (return ()) --------------------------------------------------------------------------------- -- * Cached values --------------------------------------------------------------------------------- -- | We implement a peculiar caching mechanism, applicable to the use case in -- implementation of SBV's. Whenever we do a state based computation, we do -- not want to keep on evaluating it in the then-current state. That will -- produce essentially a semantically equivalent value. Thus, we want to run -- it only once, and reuse that result, capturing the sharing at the Haskell -- level. This is similar to the "type-safe observable sharing" work, but also -- takes into the account of how symbolic simulation executes. -- -- See Andy Gill's type-safe obervable sharing trick for the inspiration behind -- this technique: -- -- Note that this is *not* a general memo utility! newtype Cached a = Cached (State -> IO a) -- | Cache a state-based computation cache :: (State -> IO a) -> Cached a cache = Cached -- | Uncache a previously cached computation uncache :: Cached SW -> State -> IO SW uncache = uncacheGen rSWCache -- | An SMT array index is simply an int value newtype ArrayIndex = ArrayIndex { unArrayIndex :: Int } deriving (Eq, Ord) -- | We simply show indexes as the underlying integer instance Show ArrayIndex where show (ArrayIndex i) = show i -- | A functional array index is simply an int value newtype FArrayIndex = FArrayIndex { unFArrayIndex :: Int } deriving (Eq, Ord) -- | We simply show indexes as the underlying integer instance Show FArrayIndex where show (FArrayIndex i) = show i -- | Uncache, retrieving SMT array indexes uncacheAI :: Cached ArrayIndex -> State -> IO ArrayIndex uncacheAI = uncacheGen rAICache -- | Uncache, retrieving Functional array indexes uncacheFAI :: Cached FArrayIndex -> State -> IO FArrayIndex uncacheFAI = uncacheGen rFAICache -- | Generic uncaching. Note that this is entirely safe, since we do it in the IO monad. uncacheGen :: (State -> IORef (Cache a)) -> Cached a -> State -> IO a uncacheGen getCache (Cached f) st = do let rCache = getCache st stored <- readIORef rCache sn <- f `seq` makeStableName f let h = hashStableName sn case maybe Nothing (sn `lookup`) (h `IMap.lookup` stored) of Just r -> return r Nothing -> do r <- f st r `seq` R.modifyIORef' rCache (IMap.insertWith (++) h [(sn, r)]) return r -- | Representation of SMTLib Program versions. As of June 2015, we're dropping support -- for SMTLib1, and supporting SMTLib2 only. We keep this data-type around in case -- SMTLib3 comes along and we want to support 2 and 3 simultaneously. data SMTLibVersion = SMTLib2 deriving (Bounded, Enum, Eq, Show) -- | The extension associated with the version smtLibVersionExtension :: SMTLibVersion -> String smtLibVersionExtension SMTLib2 = "smt2" -- | Representation of an SMT-Lib program. In between pre and post goes the refuted models data SMTLibPgm = SMTLibPgm SMTLibVersion [String] instance NFData SMTLibVersion where rnf a = a `seq` () instance NFData SMTLibPgm where rnf (SMTLibPgm v p) = rnf v `seq` rnf p `seq` () instance Show SMTLibPgm where show (SMTLibPgm _ pre) = intercalate "\n" pre -- Other Technicalities.. instance NFData CW where rnf (CW x y) = x `seq` y `seq` () instance NFData GeneralizedCW where rnf (ExtendedCW e) = e `seq` () rnf (RegularCW c) = c `seq` () #if MIN_VERSION_base(4,9,0) #else -- Can't really force this, but not a big deal instance NFData CallStack where rnf _ = () #endif instance NFData Result where rnf (Result kindInfo qcInfo obs cgs inps consts tbls arrs uis axs pgm cstr asserts outs) = rnf kindInfo `seq` rnf qcInfo `seq` rnf obs `seq` rnf cgs `seq` rnf inps `seq` rnf consts `seq` rnf tbls `seq` rnf arrs `seq` rnf uis `seq` rnf axs `seq` rnf pgm `seq` rnf cstr `seq` rnf asserts `seq` rnf outs instance NFData Kind where rnf a = seq a () instance NFData ArrayContext where rnf a = seq a () instance NFData SW where rnf a = seq a () instance NFData SBVExpr where rnf a = seq a () instance NFData Quantifier where rnf a = seq a () instance NFData SBVType where rnf a = seq a () instance NFData SBVPgm where rnf a = seq a () instance NFData (Cached a) where rnf (Cached f) = f `seq` () instance NFData SVal where rnf (SVal x y) = rnf x `seq` rnf y `seq` () instance NFData SMTResult where rnf Unsatisfiable{} = () rnf (Satisfiable _ xs) = rnf xs `seq` () rnf (SatExtField _ xs) = rnf xs `seq` () rnf (Unknown _ xs) = rnf xs `seq` () rnf (ProofError _ xs) = rnf xs `seq` () instance NFData SMTModel where rnf (SMTModel objs assocs) = rnf objs `seq` rnf assocs `seq` () instance NFData SMTScript where rnf (SMTScript b m) = rnf b `seq` rnf m `seq` () -- | Translation tricks needed for specific capabilities afforded by each solver data SolverCapabilities = SolverCapabilities { supportsQuantifiers :: Bool -- ^ Support for SMT-Lib2 style quantifiers? , supportsUninterpretedSorts :: Bool -- ^ Support for SMT-Lib2 style uninterpreted-sorts , supportsUnboundedInts :: Bool -- ^ Support for unbounded integers? , supportsReals :: Bool -- ^ Support for reals? , supportsApproxReals :: Bool -- ^ Supports printing of approximations of reals? , supportsIEEE754 :: Bool -- ^ Support for floating point numbers? , supportsOptimization :: Bool -- ^ Support for optimization routines? , supportsPseudoBooleans :: Bool -- ^ Support for pseudo-boolean operations? , supportsCustomQueries :: Bool -- ^ Support for interactive queries per SMT-Lib? , supportsGlobalDecls :: Bool -- ^ Support for global decls, needed for push-pop. , supportsFlattenedSequences :: Maybe [String] -- ^ Supports flattened sequence output, with given config lines } -- | Rounding mode to be used for the IEEE floating-point operations. -- Note that Haskell's default is 'RoundNearestTiesToEven'. If you use -- a different rounding mode, then the counter-examples you get may not -- match what you observe in Haskell. data RoundingMode = RoundNearestTiesToEven -- ^ Round to nearest representable floating point value. -- If precisely at half-way, pick the even number. -- (In this context, /even/ means the lowest-order bit is zero.) | RoundNearestTiesToAway -- ^ Round to nearest representable floating point value. -- If precisely at half-way, pick the number further away from 0. -- (That is, for positive values, pick the greater; for negative values, pick the smaller.) | RoundTowardPositive -- ^ Round towards positive infinity. (Also known as rounding-up or ceiling.) | RoundTowardNegative -- ^ Round towards negative infinity. (Also known as rounding-down or floor.) | RoundTowardZero -- ^ Round towards zero. (Also known as truncation.) deriving (Eq, Ord, Show, Read, G.Data, Bounded, Enum) -- | 'RoundingMode' kind instance HasKind RoundingMode -- | Solver configuration. See also 'Data.SBV.z3', 'Data.SBV.yices', 'Data.SBV.cvc4', 'Data.SBV.boolector', 'Data.SBV.mathSAT', etc. -- which are instantiations of this type for those solvers, with reasonable defaults. In particular, custom configuration can be -- created by varying those values. (Such as @z3{verbose=True}@.) -- -- Most fields are self explanatory. The notion of precision for printing algebraic reals stems from the fact that such values does -- not necessarily have finite decimal representations, and hence we have to stop printing at some depth. It is important to -- emphasize that such values always have infinite precision internally. The issue is merely with how we print such an infinite -- precision value on the screen. The field 'printRealPrec' controls the printing precision, by specifying the number of digits after -- the decimal point. The default value is 16, but it can be set to any positive integer. -- -- When printing, SBV will add the suffix @...@ at the and of a real-value, if the given bound is not sufficient to represent the real-value -- exactly. Otherwise, the number will be written out in standard decimal notation. Note that SBV will always print the whole value if it -- is precise (i.e., if it fits in a finite number of digits), regardless of the precision limit. The limit only applies if the representation -- of the real value is not finite, i.e., if it is not rational. -- -- The 'printBase' field can be used to print numbers in base 2, 10, or 16. If base 2 or 16 is used, then floating-point values will -- be printed in their internal memory-layout format as well, which can come in handy for bit-precise analysis. data SMTConfig = SMTConfig { verbose :: Bool -- ^ Debug mode , timing :: Timing -- ^ Print timing information on how long different phases took (construction, solving, etc.) , printBase :: Int -- ^ Print integral literals in this base (2, 10, and 16 are supported.) , printRealPrec :: Int -- ^ Print algebraic real values with this precision. (SReal, default: 16) , satCmd :: String -- ^ Usually "(check-sat)". However, users might tweak it based on solver characteristics. , allSatMaxModelCount :: Maybe Int -- ^ In an allSat call, return at most this many models. If nothing, return all. , isNonModelVar :: String -> Bool -- ^ When constructing a model, ignore variables whose name satisfy this predicate. (Default: (const False), i.e., don't ignore anything) , transcript :: Maybe FilePath -- ^ If Just, the entire interaction will be recorded as a playable file (for debugging purposes mostly) , smtLibVersion :: SMTLibVersion -- ^ What version of SMT-lib we use for the tool , solver :: SMTSolver -- ^ The actual SMT solver. , roundingMode :: RoundingMode -- ^ Rounding mode to use for floating-point conversions , solverSetOptions :: [SMTOption] -- ^ Options to set as we start the solver , ignoreExitCode :: Bool -- ^ If true, we shall ignore the exit code upon exit. Otherwise we require ExitSuccess. , redirectVerbose :: Maybe FilePath -- ^ Redirect the verbose output to this file if given. If Nothing, stdout is implied. } -- We're just seq'ing top-level here, it shouldn't really matter. (i.e., no need to go deeper.) instance NFData SMTConfig where rnf SMTConfig{} = () -- | A model, as returned by a solver data SMTModel = SMTModel { modelObjectives :: [(String, GeneralizedCW)] -- ^ Mapping of symbolic values to objective values. , modelAssocs :: [(String, CW)] -- ^ Mapping of symbolic values to constants. } deriving Show -- | The result of an SMT solver call. Each constructor is tagged with -- the 'SMTConfig' that created it so that further tools can inspect it -- and build layers of results, if needed. For ordinary uses of the library, -- this type should not be needed, instead use the accessor functions on -- it. (Custom Show instances and model extractors.) data SMTResult = Unsatisfiable SMTConfig (Maybe [String]) -- ^ Unsatisfiable. If unsat-cores are enabled, they will be returned in the second parameter. | Satisfiable SMTConfig SMTModel -- ^ Satisfiable with model | SatExtField SMTConfig SMTModel -- ^ Prover returned a model, but in an extension field containing Infinite/epsilon | Unknown SMTConfig SMTReasonUnknown -- ^ Prover returned unknown, with the given reason | ProofError SMTConfig [String] -- ^ Prover errored out -- | A script, to be passed to the solver. data SMTScript = SMTScript { scriptBody :: String -- ^ Initial feed , scriptModel :: [String] -- ^ Continuation script, to extract results } -- | An SMT engine type SMTEngine = forall res. SMTConfig -- ^ current configuration -> State -- ^ the state in which to run the engine -> String -- ^ program -> (State -> IO res) -- ^ continuation -> IO res -- | Solvers that SBV is aware of data Solver = Z3 | Yices | Boolector | CVC4 | MathSAT | ABC deriving (Show, Enum, Bounded) -- | An SMT solver data SMTSolver = SMTSolver { name :: Solver -- ^ The solver in use , executable :: String -- ^ The path to its executable , options :: SMTConfig -> [String] -- ^ Options to provide to the solver , engine :: SMTEngine -- ^ The solver engine, responsible for interpreting solver output , capabilities :: SolverCapabilities -- ^ Various capabilities of the solver } -- | Query execution context data QueryContext = QueryInternal -- ^ Triggered from inside SBV | QueryExternal -- ^ Triggered from user code {-# ANN type FPOp ("HLint: ignore Use camelCase" :: String) #-} {-# ANN type PBOp ("HLint: ignore Use camelCase" :: String) #-} {-# ANN type OvOp ("HLint: ignore Use camelCase" :: String) #-} sbv-7.13/Data/SBV/List/0000755000000000000000000000000013405536617012654 5ustar0000000000000000sbv-7.13/Data/SBV/List/Bounded.hs0000644000000000000000000001273313405536617014576 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.List.Bounded -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- A collection of bounded list utilities, useful when working with symbolic lists. -- These functions all take a concrete bound, and operate on the prefix of a symbolic -- list that is at most that long. Due to limitations on writing recursive functions -- over lists (the classic symbolic termination problem), we cannot write arbitrary -- recursive programs on symbolic lists. But most of the time all we need is a -- bounded prefix of this list, at which point these functions come in handy. ----------------------------------------------------------------------------- -- {-# LANGUAGE OverloadedLists #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} module Data.SBV.List.Bounded ( -- * General folds bfoldr, bfoldrM, bfoldl, bfoldlM -- * Map, filter, zipWith, elem , bmap, bmapM, bfilter, bzipWith, belem -- * Aggregates , bsum, bprod, band, bor, bany, ball, bmaximum, bminimum -- * Miscellaneous: Reverse and sort , breverse, bsort ) where import Data.SBV import Data.SBV.List ((.:), (.++)) import qualified Data.SBV.List as L -- | Case analysis on a symbolic list. (Not exported.) lcase :: (SymWord a, Mergeable b) => SList a -> b -> (SBV a -> SList a -> b) -> b lcase s e c = ite (L.null s) e (c (L.head s) (L.tail s)) -- | Bounded fold from the right. bfoldr :: (SymWord a, SymWord b) => Int -> (SBV a -> SBV b -> SBV b) -> SBV b -> SList a -> SBV b bfoldr cnt f b = go (cnt `max` 0) where go 0 _ = b go i s = lcase s b (\h t -> h `f` go (i-1) t) -- | Bounded monadic fold from the right. bfoldrM :: forall a b m. (SymWord a, SymWord b, Monad m, Mergeable (m (SBV b))) => Int -> (SBV a -> SBV b -> m (SBV b)) -> SBV b -> SList a -> m (SBV b) bfoldrM cnt f b = go (cnt `max` 0) where go :: Int -> SList a -> m (SBV b) go 0 _ = return b go i s = lcase s (return b) (\h t -> f h =<< go (i-1) t) -- | Bounded fold from the left. bfoldl :: (SymWord a, SymWord b) => Int -> (SBV b -> SBV a -> SBV b) -> SBV b -> SList a -> SBV b bfoldl cnt f = go (cnt `max` 0) where go 0 b _ = b go i b s = lcase s b (\h t -> go (i-1) (b `f` h) t) -- | Bounded monadic fold from the left. bfoldlM :: forall a b m. (SymWord a, SymWord b, Monad m, Mergeable (m (SBV b))) => Int -> (SBV b -> SBV a -> m (SBV b)) -> SBV b -> SList a -> m (SBV b) bfoldlM cnt f = go (cnt `max` 0) where go :: Int -> SBV b -> SList a -> m (SBV b) go 0 b _ = return b go i b s = lcase s (return b) (\h t -> do { fbh <- f b h; go (i-1) fbh t }) -- | Bounded sum. bsum :: (SymWord a, Num a) => Int -> SList a -> SBV a bsum i = bfoldl i (+) 0 -- | Bounded product. bprod :: (SymWord a, Num a) => Int -> SList a -> SBV a bprod i = bfoldl i (*) 1 -- | Bounded map. bmap :: (SymWord a, SymWord b) => Int -> (SBV a -> SBV b) -> SList a -> SList b bmap i f = bfoldr i (\x -> (f x .:)) [] -- | Bounded monadic map. bmapM :: (SymWord a, SymWord b, Monad m, Mergeable (m (SBV [b]))) => Int -> (SBV a -> m (SBV b)) -> SList a -> m (SList b) bmapM i f = bfoldrM i (\a bs -> (.:) <$> f a <*> pure bs) [] -- | Bounded filter. bfilter :: SymWord a => Int -> (SBV a -> SBool) -> SList a -> SList a bfilter i f = bfoldr i (\x y -> ite (f x) (x .: y) y) [] -- | Bounded logical and band :: Int -> SList Bool -> SBool band i = bfoldr i (&&&) (true :: SBool) -- | Bounded logical or bor :: Int -> SList Bool -> SBool bor i = bfoldr i (|||) (false :: SBool) -- | Bounded any bany :: SymWord a => Int -> (SBV a -> SBool) -> SList a -> SBool bany i f = bor i . bmap i f -- | Bounded all ball :: SymWord a => Int -> (SBV a -> SBool) -> SList a -> SBool ball i f = band i . bmap i f -- | Bounded maximum. Undefined if list is empty. bmaximum :: SymWord a => Int -> SList a -> SBV a bmaximum i l = bfoldl (i-1) smax (L.head l) (L.tail l) -- | Bounded minimum. Undefined if list is empty. bminimum :: SymWord a => Int -> SList a -> SBV a bminimum i l = bfoldl (i-1) smin (L.head l) (L.tail l) -- | Bounded zipWith bzipWith :: (SymWord a, SymWord b, SymWord c) => Int -> (SBV a -> SBV b -> SBV c) -> SList a -> SList b -> SList c bzipWith cnt f = go (cnt `max` 0) where go 0 _ _ = [] go i xs ys = ite (L.null xs ||| L.null ys) [] (f (L.head xs) (L.head ys) .: go (i-1) (L.tail xs) (L.tail ys)) -- | Bounded element check belem :: SymWord a => Int -> SBV a -> SList a -> SBool belem i e = bany i (e .==) -- | Bounded reverse breverse :: SymWord a => Int -> SList a -> SList a breverse cnt = bfoldr cnt (\a b -> b .++ L.singleton a) [] -- | Bounded paramorphism (not exported). bpara :: (SymWord a, SymWord b) => Int -> (SBV a -> SBV [a] -> SBV b -> SBV b) -> SBV b -> SList a -> SBV b bpara cnt f b = go (cnt `max` 0) where go 0 _ = b go i s = lcase s b (\h t -> f h t (go (i-1) t)) -- | Insert an element into a sorted list (not exported). binsert :: SymWord a => Int -> SBV a -> SList a -> SList a binsert cnt a = bpara cnt f (L.singleton a) where f sortedHd sortedTl sortedTl' = ite (a .< sortedHd) (a .: sortedHd .: sortedTl) (sortedHd .: sortedTl') -- | Bounded insertion sort bsort :: SymWord a => Int -> SList a -> SList a bsort cnt = bfoldr cnt (binsert cnt) [] sbv-7.13/Data/SBV/Provers/0000755000000000000000000000000013405536617013401 5ustar0000000000000000sbv-7.13/Data/SBV/Provers/ABC.hs0000644000000000000000000000361013405536617014322 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Provers.ABC -- Copyright : (c) Adam Foltzer -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- The connection to the ABC verification and synthesis tool ----------------------------------------------------------------------------- module Data.SBV.Provers.ABC(abc) where import Data.SBV.Core.Data import Data.SBV.SMT.SMT -- | The description of abc. The default executable is @\"abc\"@, -- which must be in your path. You can use the @SBV_ABC@ environment -- variable to point to the executable on your system. The default -- options are @-S \"%blast; &sweep -C 5000; &syn4; &cec -s -m -C 2000\"@. -- You can use the @SBV_ABC_OPTIONS@ environment variable to override the options. abc :: SMTSolver abc = SMTSolver { name = ABC , executable = "abc" , options = const ["-S", "%blast; &sweep -C 5000; &syn4; &cec -s -m -C 2000"] , engine = standardEngine "SBV_ABC" "SBV_ABC_OPTIONS" , capabilities = SolverCapabilities { supportsQuantifiers = False , supportsUninterpretedSorts = False , supportsUnboundedInts = False , supportsReals = False , supportsApproxReals = False , supportsIEEE754 = False , supportsOptimization = False , supportsPseudoBooleans = False , supportsCustomQueries = False , supportsGlobalDecls = False , supportsFlattenedSequences = Nothing } } sbv-7.13/Data/SBV/Provers/Boolector.hs0000644000000000000000000000364513405536617015675 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Provers.Boolector -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- The connection to the Boolector SMT solver ----------------------------------------------------------------------------- module Data.SBV.Provers.Boolector(boolector) where import Data.SBV.Core.Data import Data.SBV.SMT.SMT -- | The description of the Boolector SMT solver -- The default executable is @\"boolector\"@, which must be in your path. You can use the @SBV_BOOLECTOR@ environment variable to point to the executable on your system. -- The default options are @\"-m --smt2\"@. You can use the @SBV_BOOLECTOR_OPTIONS@ environment variable to override the options. boolector :: SMTSolver boolector = SMTSolver { name = Boolector , executable = "boolector" , options = const ["--smt2", "--smt2-model", "--no-exit-codes", "--incremental"] , engine = standardEngine "SBV_BOOLECTOR" "SBV_BOOLECTOR_OPTIONS" , capabilities = SolverCapabilities { supportsQuantifiers = False , supportsUninterpretedSorts = False , supportsUnboundedInts = False , supportsReals = False , supportsApproxReals = False , supportsIEEE754 = False , supportsOptimization = False , supportsPseudoBooleans = False , supportsCustomQueries = True , supportsGlobalDecls = False , supportsFlattenedSequences = Nothing } } sbv-7.13/Data/SBV/Provers/CVC4.hs0000644000000000000000000000372313405536617014441 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Provers.CVC4 -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- The connection to the CVC4 SMT solver ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module Data.SBV.Provers.CVC4(cvc4) where import Data.SBV.Core.Data import Data.SBV.SMT.SMT -- | The description of the CVC4 SMT solver -- The default executable is @\"cvc4\"@, which must be in your path. You can use the @SBV_CVC4@ environment variable to point to the executable on your system. -- The default options are @\"--lang smt\"@. You can use the @SBV_CVC4_OPTIONS@ environment variable to override the options. cvc4 :: SMTSolver cvc4 = SMTSolver { name = CVC4 , executable = "cvc4" , options = const ["--lang", "smt", "--incremental", "--interactive", "--no-interactive-prompt"] , engine = standardEngine "SBV_CVC4" "SBV_CVC4_OPTIONS" , capabilities = SolverCapabilities { supportsQuantifiers = True , supportsUninterpretedSorts = True , supportsUnboundedInts = True , supportsReals = True -- Not quite the same capability as Z3; but works more or less.. , supportsApproxReals = False , supportsIEEE754 = False , supportsOptimization = False , supportsPseudoBooleans = False , supportsCustomQueries = True , supportsGlobalDecls = True , supportsFlattenedSequences = Nothing } } sbv-7.13/Data/SBV/Provers/MathSAT.hs0000644000000000000000000000436613405536617015207 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Provers.MathSAT -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- The connection to the MathSAT SMT solver ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module Data.SBV.Provers.MathSAT(mathSAT) where import Data.SBV.Core.Data import Data.SBV.SMT.SMT import Data.SBV.Control.Types -- | The description of the MathSAT SMT solver -- The default executable is @\"mathsat\"@, which must be in your path. You can use the @SBV_MATHSAT@ environment variable to point to the executable on your system. -- The default options are @\"-input=smt2\"@. You can use the @SBV_MATHSAT_OPTIONS@ environment variable to override the options. mathSAT :: SMTSolver mathSAT = SMTSolver { name = MathSAT , executable = "mathsat" , options = modConfig ["-input=smt2", "-theory.fp.minmax_zero_mode=4"] , engine = standardEngine "SBV_MATHSAT" "SBV_MATHSAT_OPTIONS" , capabilities = SolverCapabilities { supportsQuantifiers = True , supportsUninterpretedSorts = True , supportsUnboundedInts = True , supportsReals = True , supportsApproxReals = False , supportsIEEE754 = True , supportsOptimization = False , supportsPseudoBooleans = False , supportsCustomQueries = True , supportsGlobalDecls = False , supportsFlattenedSequences = Nothing } } where -- If unsat cores are needed, MathSAT requires an explicit command-line argument modConfig :: [String] -> SMTConfig -> [String] modConfig opts cfg | or [b | ProduceUnsatCores b <- solverSetOptions cfg] = opts ++ ["-unsat_core_generation=3"] | True = opts sbv-7.13/Data/SBV/Provers/Prover.hs0000644000000000000000000011056513405536617015222 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Provers.Prover -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Provable abstraction and the connection to SMT solvers ----------------------------------------------------------------------------- {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeSynonymInstances #-} module Data.SBV.Provers.Prover ( SMTSolver(..), SMTConfig(..), Predicate, Provable(..), Goal , ThmResult(..), SatResult(..), AllSatResult(..), SafeResult(..), OptimizeResult(..), SMTResult(..) , SExecutable(..), isSafe , runSMT, runSMTWith , SatModel(..), Modelable(..), displayModels, extractModels , getModelDictionaries, getModelValues, getModelUninterpretedValues , boolector, cvc4, yices, z3, mathSAT, abc, defaultSMTCfg ) where import Control.Monad (when, unless) import Control.DeepSeq (rnf, NFData(..)) import Control.Concurrent.Async (async, waitAny, asyncThreadId, Async) import Control.Exception (finally, throwTo, AsyncException(ThreadKilled)) import System.IO.Unsafe (unsafeInterleaveIO) -- only used safely! import System.Directory (getCurrentDirectory) import Data.Time (getZonedTime, NominalDiffTime, UTCTime, getCurrentTime, diffUTCTime) import Data.List (intercalate, isPrefixOf, nub) import Data.Maybe (mapMaybe) import qualified Data.Map.Strict as M import qualified Data.Foldable as S (toList) import Data.SBV.Core.Data import Data.SBV.Core.Symbolic import Data.SBV.SMT.SMT import Data.SBV.Utils.TDiff import Data.SBV.Utils.PrettyNum import qualified Data.SBV.Control as Control import qualified Data.SBV.Control.Query as Control import qualified Data.SBV.Control.Utils as Control import GHC.Stack import qualified Data.SBV.Provers.Boolector as Boolector import qualified Data.SBV.Provers.CVC4 as CVC4 import qualified Data.SBV.Provers.Yices as Yices import qualified Data.SBV.Provers.Z3 as Z3 import qualified Data.SBV.Provers.MathSAT as MathSAT import qualified Data.SBV.Provers.ABC as ABC mkConfig :: SMTSolver -> SMTLibVersion -> [Control.SMTOption] -> SMTConfig mkConfig s smtVersion startOpts = SMTConfig { verbose = False , timing = NoTiming , printBase = 10 , printRealPrec = 16 , transcript = Nothing , solver = s , smtLibVersion = smtVersion , satCmd = "(check-sat)" , allSatMaxModelCount = Nothing -- i.e., return all satisfying models , isNonModelVar = const False -- i.e., everything is a model-variable by default , roundingMode = RoundNearestTiesToEven , solverSetOptions = startOpts , ignoreExitCode = False , redirectVerbose = Nothing } -- | If supported, this makes all output go to stdout, which works better with SBV -- Alas, not all solvers support it.. allOnStdOut :: Control.SMTOption allOnStdOut = Control.OptionKeyword ":diagnostic-output-channel" [show "stdout"] -- | Default configuration for the Boolector SMT solver boolector :: SMTConfig boolector = mkConfig Boolector.boolector SMTLib2 [] -- | Default configuration for the CVC4 SMT Solver. cvc4 :: SMTConfig cvc4 = mkConfig CVC4.cvc4 SMTLib2 [allOnStdOut] -- | Default configuration for the Yices SMT Solver. yices :: SMTConfig yices = mkConfig Yices.yices SMTLib2 [] -- | Default configuration for the Z3 SMT solver z3 :: SMTConfig z3 = mkConfig Z3.z3 SMTLib2 [ Control.OptionKeyword ":smtlib2_compliant" ["true"] , allOnStdOut ] -- | Default configuration for the MathSAT SMT solver mathSAT :: SMTConfig mathSAT = mkConfig MathSAT.mathSAT SMTLib2 [allOnStdOut] -- | Default configuration for the ABC synthesis and verification tool. abc :: SMTConfig abc = mkConfig ABC.abc SMTLib2 [allOnStdOut] -- | The default solver used by SBV. This is currently set to z3. defaultSMTCfg :: SMTConfig defaultSMTCfg = z3 -- | A predicate is a symbolic program that returns a (symbolic) boolean value. For all intents and -- purposes, it can be treated as an n-ary function from symbolic-values to a boolean. The 'Symbolic' -- monad captures the underlying representation, and can/should be ignored by the users of the library, -- unless you are building further utilities on top of SBV itself. Instead, simply use the 'Predicate' -- type when necessary. type Predicate = Symbolic SBool -- | A goal is a symbolic program that returns no values. The idea is that the constraints/min-max -- goals will serve as appropriate directives for sat/prove calls. type Goal = Symbolic () -- | A type @a@ is provable if we can turn it into a predicate. -- Note that a predicate can be made from a curried function of arbitrary arity, where -- each element is either a symbolic type or up-to a 7-tuple of symbolic-types. So -- predicates can be constructed from almost arbitrary Haskell functions that have arbitrary -- shapes. (See the instance declarations below.) class Provable a where -- | Turns a value into a universally quantified predicate, internally naming the inputs. -- In this case the sbv library will use names of the form @s1, s2@, etc. to name these variables -- Example: -- -- > forAll_ $ \(x::SWord8) y -> x `shiftL` 2 .== y -- -- is a predicate with two arguments, captured using an ordinary Haskell function. Internally, -- @x@ will be named @s0@ and @y@ will be named @s1@. forAll_ :: a -> Predicate -- | Turns a value into a predicate, allowing users to provide names for the inputs. -- If the user does not provide enough number of names for the variables, the remaining ones -- will be internally generated. Note that the names are only used for printing models and has no -- other significance; in particular, we do not check that they are unique. Example: -- -- > forAll ["x", "y"] $ \(x::SWord8) y -> x `shiftL` 2 .== y -- -- This is the same as above, except the variables will be named @x@ and @y@ respectively, -- simplifying the counter-examples when they are printed. forAll :: [String] -> a -> Predicate -- | Turns a value into an existentially quantified predicate. (Indeed, 'exists' would have been -- a better choice here for the name, but alas it's already taken.) forSome_ :: a -> Predicate -- | Version of 'forSome' that allows user defined names. forSome :: [String] -> a -> Predicate -- | Prove a predicate, using the default solver. prove :: a -> IO ThmResult prove = proveWith defaultSMTCfg -- | Prove the predicate using the given SMT-solver. proveWith :: SMTConfig -> a -> IO ThmResult proveWith = runWithQuery False $ checkNoOptimizations >> ThmResult <$> Control.getSMTResult -- | Find a satisfying assignment for a predicate, using the default solver. sat :: a -> IO SatResult sat = satWith defaultSMTCfg -- | Find a satisfying assignment using the given SMT-solver. satWith :: SMTConfig -> a -> IO SatResult satWith = runWithQuery True $ checkNoOptimizations >> SatResult <$> Control.getSMTResult -- | Find all satisfying assignments, using the default solver. See 'allSatWith' for details. allSat :: a -> IO AllSatResult allSat = allSatWith defaultSMTCfg -- | Return all satisfying assignments for a predicate, equivalent to @'allSatWith' 'defaultSMTCfg'@. -- Note that this call will block until all satisfying assignments are found. If you have a problem -- with infinitely many satisfying models (consider 'SInteger') or a very large number of them, you -- might have to wait for a long time. To avoid such cases, use the 'allSatMaxModelCount' parameter -- in the configuration. -- -- NB. Uninterpreted constant/function values and counter-examples for array values are ignored for -- the purposes of 'allSat'. That is, only the satisfying assignments modulo uninterpreted functions and -- array inputs will be returned. This is due to the limitation of not having a robust means of getting a -- function counter-example back from the SMT solver. -- Find all satisfying assignments using the given SMT-solver allSatWith :: SMTConfig -> a -> IO AllSatResult allSatWith = runWithQuery True $ checkNoOptimizations >> AllSatResult <$> Control.getAllSatResult -- | Optimize a given collection of `Objective`s optimize :: OptimizeStyle -> a -> IO OptimizeResult optimize = optimizeWith defaultSMTCfg -- | Optimizes the objectives using the given SMT-solver. optimizeWith :: SMTConfig -> OptimizeStyle -> a -> IO OptimizeResult optimizeWith config style = runWithQuery True opt config where opt = do objectives <- Control.getObjectives qinps <- Control.getQuantifiedInputs spgm <- Control.getSBVPgm when (null objectives) $ error $ unlines [ "" , "*** Data.SBV: Unsupported call to optimize when no objectives are present." , "*** Use \"sat\" for plain satisfaction" ] unless (supportsOptimization (capabilities (solver config))) $ error $ unlines [ "" , "*** Data.SBV: The backend solver " ++ show (name (solver config)) ++ "does not support optimization goals." , "*** Please use a solver that has support, such as z3" ] let universals = [s | (ALL, s) <- qinps] firstUniversal | null universals = error "Data.SBV: Impossible happened! Universal optimization with no universals!" | True = minimum (map (nodeId . fst) universals) nodeId (SW _ n) = n mappings :: M.Map SW SBVExpr mappings = M.fromList (S.toList (pgmAssignments spgm)) chaseUniversal entry = map snd $ go entry [] where go x sofar | nx >= firstUniversal = nub $ [unm | unm@(u, _) <- universals, nx >= nodeId u] ++ sofar | True = let oVars (LkUp _ a b) = [a, b] oVars (IEEEFP (FP_Cast _ _ o)) = [o] oVars _ = [] vars = case x `M.lookup` mappings of Nothing -> [] Just (SBVApp o ss) -> nub (oVars o ++ ss) in foldr go sofar vars where nx = nodeId x let needsUniversalOpt = let tag _ [] = Nothing tag nm xs = Just (nm, xs) needsUniversal (Maximize nm (x, _)) = tag nm (chaseUniversal x) needsUniversal (Minimize nm (x, _)) = tag nm (chaseUniversal x) needsUniversal (AssertWithPenalty nm (x, _) _) = tag nm (chaseUniversal x) in mapMaybe needsUniversal objectives unless (null universals || null needsUniversalOpt) $ let len = maximum $ 0 : [length nm | (nm, _) <- needsUniversalOpt] pad n = n ++ replicate (len - length n) ' ' in error $ unlines $ [ "" , "*** Data.SBV: Problem needs optimization of metric in the scope of universally quantified variable(s):" , "***" ] ++ [ "*** " ++ pad s ++ " [Depends on: " ++ intercalate ", " xs ++ "]" | (s, xs) <- needsUniversalOpt ] ++ [ "***" , "*** Optimization is only meaningful with existentially quantified metrics." ] let optimizerDirectives = concatMap minmax objectives ++ priority style where mkEq (x, y) = "(assert (= " ++ show x ++ " " ++ show y ++ "))" minmax (Minimize _ xy@(_, v)) = [mkEq xy, "(minimize " ++ signAdjust v (show v) ++ ")"] minmax (Maximize _ xy@(_, v)) = [mkEq xy, "(maximize " ++ signAdjust v (show v) ++ ")"] minmax (AssertWithPenalty nm xy@(_, v) mbp) = [mkEq xy, "(assert-soft " ++ signAdjust v (show v) ++ penalize mbp ++ ")"] where penalize DefaultPenalty = "" penalize (Penalty w mbGrp) | w <= 0 = error $ unlines [ "SBV.AssertWithPenalty: Goal " ++ show nm ++ " is assigned a non-positive penalty: " ++ shw , "All soft goals must have > 0 penalties associated." ] | True = " :weight " ++ shw ++ maybe "" group mbGrp where shw = show (fromRational w :: Double) group g = " :id " ++ g priority Lexicographic = [] -- default, no option needed priority Independent = ["(set-option :opt.priority box)"] priority (Pareto _) = ["(set-option :opt.priority pareto)"] -- if the goal is a signed-BV, then we need to add 2^{n-1} to the maximal value -- is properly placed in the correct range. See http://github.com/Z3Prover/z3/issues/1339 for -- details on why we have to do this: signAdjust :: SW -> String -> String signAdjust v o = case kindOf v of -- NB. The order we spit out the addition here (i.e., "bvadd v constant") -- is important as we parse it back in precisely that form when we -- get the objective. Don't change it! KBounded True sz -> "(bvadd " ++ o ++ " " ++ adjust sz ++ ")" _ -> o where adjust :: Int -> String adjust sz = cwToSMTLib RoundNearestTiesToEven -- rounding mode doesn't matter here, just pick one (mkConstCW (KBounded False sz) ((2::Integer)^(fromIntegral sz - (1::Integer)))) mapM_ (Control.send True) optimizerDirectives case style of Lexicographic -> LexicographicResult <$> Control.getLexicographicOptResults Independent -> IndependentResult <$> Control.getIndependentOptResults (map objectiveName objectives) Pareto mbN -> ParetoResult <$> Control.getParetoOptResults mbN -- | Check if the constraints given are consistent, using the default solver. isVacuous :: a -> IO Bool isVacuous = isVacuousWith defaultSMTCfg -- | Determine if the constraints are vacuous using the given SMT-solver. isVacuousWith :: SMTConfig -> a -> IO Bool isVacuousWith cfg a = -- NB. Can't call runWithQuery since last constraint would become the implication! fst <$> runSymbolic (SMTMode ISetup True cfg) (forSome_ a >> Control.query check) where check = do cs <- Control.checkSat case cs of Control.Unsat -> return True Control.Sat -> return False Control.Unk -> error "SBV: isVacuous: Solver returned unknown!" -- | Checks theoremhood using the default solver. isTheorem :: a -> IO Bool isTheorem = isTheoremWith defaultSMTCfg -- | Check whether a given property is a theorem. isTheoremWith :: SMTConfig -> a -> IO Bool isTheoremWith cfg p = do r <- proveWith cfg p case r of ThmResult Unsatisfiable{} -> return True ThmResult Satisfiable{} -> return False _ -> error $ "SBV.isTheorem: Received:\n" ++ show r -- | Checks satisfiability using the default solver. isSatisfiable :: a -> IO Bool isSatisfiable = isSatisfiableWith defaultSMTCfg -- | Check whether a given property is satisfiable. isSatisfiableWith :: SMTConfig -> a -> IO Bool isSatisfiableWith cfg p = do r <- satWith cfg p case r of SatResult Satisfiable{} -> return True SatResult Unsatisfiable{} -> return False _ -> error $ "SBV.isSatisfiable: Received: " ++ show r -- | Prove a property with multiple solvers, running them in separate threads. The -- results will be returned in the order produced. proveWithAll :: [SMTConfig] -> a -> IO [(Solver, NominalDiffTime, ThmResult)] proveWithAll = (`sbvWithAll` proveWith) -- | Prove a property with multiple solvers, running them in separate threads. Only -- the result of the first one to finish will be returned, remaining threads will be killed. -- Note that we send a @ThreadKilled@ to the losing processes, but we do *not* actually wait for them -- to finish. In rare cases this can lead to zombie processes. In previous experiments, we found -- that some processes take their time to terminate. So, this solution favors quick turnaround. proveWithAny :: [SMTConfig] -> a -> IO (Solver, NominalDiffTime, ThmResult) proveWithAny = (`sbvWithAny` proveWith) -- | Find a satisfying assignment to a property with multiple solvers, running them in separate threads. The -- results will be returned in the order produced. satWithAll :: [SMTConfig] -> a -> IO [(Solver, NominalDiffTime, SatResult)] satWithAll = (`sbvWithAll` satWith) -- | Find a satisfying assignment to a property with multiple solvers, running them in separate threads. Only -- the result of the first one to finish will be returned, remaining threads will be killed. -- Note that we send a @ThreadKilled@ to the losing processes, but we do *not* actually wait for them -- to finish. In rare cases this can lead to zombie processes. In previous experiments, we found -- that some processes take their time to terminate. So, this solution favors quick turnaround. satWithAny :: [SMTConfig] -> a -> IO (Solver, NominalDiffTime, SatResult) satWithAny = (`sbvWithAny` satWith) -- | Create an SMT-Lib2 benchmark. The 'Bool' argument controls whether this is a SAT instance, i.e., -- translate the query directly, or a PROVE instance, i.e., translate the negated query. generateSMTBenchmark :: Bool -> a -> IO String generateSMTBenchmark isSat a = do t <- getZonedTime let comments = ["Automatically created by SBV on " ++ show t] cfg = defaultSMTCfg { smtLibVersion = SMTLib2 } (_, res) <- runSymbolic (SMTMode ISetup isSat cfg) $ (if isSat then forSome_ else forAll_) a >>= output let SMTProblem{smtLibPgm} = Control.runProofOn (SMTMode IRun isSat cfg) comments res out = show (smtLibPgm cfg) return $ out ++ "\n(check-sat)\n" checkNoOptimizations :: Query () checkNoOptimizations = do objectives <- Control.getObjectives unless (null objectives) $ error $ unlines [ "" , "*** Data.SBV: Unsupported call sat/prove when optimization objectives are present." , "*** Use \"optimize\"/\"optimizeWith\" to calculate optimal satisfaction!" ] instance Provable Predicate where forAll_ = id forAll [] = id forAll xs = error $ "SBV.forAll: Extra unmapped name(s) in predicate construction: " ++ intercalate ", " xs forSome_ = id forSome [] = id forSome xs = error $ "SBV.forSome: Extra unmapped name(s) in predicate construction: " ++ intercalate ", " xs instance Provable SBool where forAll_ = return forAll _ = return forSome_ = return forSome _ = return {- -- The following works, but it lets us write properties that -- are not useful.. Such as: prove $ \x y -> (x::SInt8) == y -- Running that will throw an exception since Haskell's equality -- is not be supported by symbolic things. (Needs .==). instance Provable Bool where forAll_ x = forAll_ (if x then true else false :: SBool) forAll s x = forAll s (if x then true else false :: SBool) forSome_ x = forSome_ (if x then true else false :: SBool) forSome s x = forSome s (if x then true else false :: SBool) -} -- Functions instance (SymWord a, Provable p) => Provable (SBV a -> p) where forAll_ k = forall_ >>= \a -> forAll_ $ k a forAll (s:ss) k = forall s >>= \a -> forAll ss $ k a forAll [] k = forAll_ k forSome_ k = exists_ >>= \a -> forSome_ $ k a forSome (s:ss) k = exists s >>= \a -> forSome ss $ k a forSome [] k = forSome_ k -- SFunArrays (memory, functional representation), only supported universally for the time being instance (HasKind a, HasKind b, Provable p) => Provable (SArray a b -> p) where forAll_ k = newArray_ Nothing >>= \a -> forAll_ $ k a forAll (s:ss) k = newArray s Nothing >>= \a -> forAll ss $ k a forAll [] k = forAll_ k forSome_ _ = error "SBV.forSome.SFunArray: Existential arrays are not currently supported." forSome _ _ = error "SBV.forSome.SFunArray: Existential arrays are not currently supported." -- SArrays (memory, SMT-Lib notion of arrays), only supported universally for the time being instance (HasKind a, HasKind b, Provable p) => Provable (SFunArray a b -> p) where forAll_ k = newArray_ Nothing >>= \a -> forAll_ $ k a forAll (s:ss) k = newArray s Nothing >>= \a -> forAll ss $ k a forAll [] k = forAll_ k forSome_ _ = error "SBV.forSome.SArray: Existential arrays are not currently supported." forSome _ _ = error "SBV.forSome.SArray: Existential arrays are not currently supported." -- 2 Tuple instance (SymWord a, SymWord b, Provable p) => Provable ((SBV a, SBV b) -> p) where forAll_ k = forall_ >>= \a -> forAll_ $ \b -> k (a, b) forAll (s:ss) k = forall s >>= \a -> forAll ss $ \b -> k (a, b) forAll [] k = forAll_ k forSome_ k = exists_ >>= \a -> forSome_ $ \b -> k (a, b) forSome (s:ss) k = exists s >>= \a -> forSome ss $ \b -> k (a, b) forSome [] k = forSome_ k -- 3 Tuple instance (SymWord a, SymWord b, SymWord c, Provable p) => Provable ((SBV a, SBV b, SBV c) -> p) where forAll_ k = forall_ >>= \a -> forAll_ $ \b c -> k (a, b, c) forAll (s:ss) k = forall s >>= \a -> forAll ss $ \b c -> k (a, b, c) forAll [] k = forAll_ k forSome_ k = exists_ >>= \a -> forSome_ $ \b c -> k (a, b, c) forSome (s:ss) k = exists s >>= \a -> forSome ss $ \b c -> k (a, b, c) forSome [] k = forSome_ k -- 4 Tuple instance (SymWord a, SymWord b, SymWord c, SymWord d, Provable p) => Provable ((SBV a, SBV b, SBV c, SBV d) -> p) where forAll_ k = forall_ >>= \a -> forAll_ $ \b c d -> k (a, b, c, d) forAll (s:ss) k = forall s >>= \a -> forAll ss $ \b c d -> k (a, b, c, d) forAll [] k = forAll_ k forSome_ k = exists_ >>= \a -> forSome_ $ \b c d -> k (a, b, c, d) forSome (s:ss) k = exists s >>= \a -> forSome ss $ \b c d -> k (a, b, c, d) forSome [] k = forSome_ k -- 5 Tuple instance (SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, Provable p) => Provable ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) where forAll_ k = forall_ >>= \a -> forAll_ $ \b c d e -> k (a, b, c, d, e) forAll (s:ss) k = forall s >>= \a -> forAll ss $ \b c d e -> k (a, b, c, d, e) forAll [] k = forAll_ k forSome_ k = exists_ >>= \a -> forSome_ $ \b c d e -> k (a, b, c, d, e) forSome (s:ss) k = exists s >>= \a -> forSome ss $ \b c d e -> k (a, b, c, d, e) forSome [] k = forSome_ k -- 6 Tuple instance (SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, Provable p) => Provable ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) where forAll_ k = forall_ >>= \a -> forAll_ $ \b c d e f -> k (a, b, c, d, e, f) forAll (s:ss) k = forall s >>= \a -> forAll ss $ \b c d e f -> k (a, b, c, d, e, f) forAll [] k = forAll_ k forSome_ k = exists_ >>= \a -> forSome_ $ \b c d e f -> k (a, b, c, d, e, f) forSome (s:ss) k = exists s >>= \a -> forSome ss $ \b c d e f -> k (a, b, c, d, e, f) forSome [] k = forSome_ k -- 7 Tuple instance (SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SymWord g, Provable p) => Provable ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) where forAll_ k = forall_ >>= \a -> forAll_ $ \b c d e f g -> k (a, b, c, d, e, f, g) forAll (s:ss) k = forall s >>= \a -> forAll ss $ \b c d e f g -> k (a, b, c, d, e, f, g) forAll [] k = forAll_ k forSome_ k = exists_ >>= \a -> forSome_ $ \b c d e f g -> k (a, b, c, d, e, f, g) forSome (s:ss) k = exists s >>= \a -> forSome ss $ \b c d e f g -> k (a, b, c, d, e, f, g) forSome [] k = forSome_ k -- | Run an arbitrary symbolic computation, equivalent to @'runSMTWith' 'defaultSMTCfg'@ runSMT :: Symbolic a -> IO a runSMT = runSMTWith defaultSMTCfg -- | Runs an arbitrary symbolic computation, exposed to the user in SAT mode runSMTWith :: SMTConfig -> Symbolic a -> IO a runSMTWith cfg a = fst <$> runSymbolic (SMTMode ISetup True cfg) a -- | Runs with a query. runWithQuery :: Provable a => Bool -> Query b -> SMTConfig -> a -> IO b runWithQuery isSAT q cfg a = fst <$> runSymbolic (SMTMode ISetup isSAT cfg) comp where comp = do _ <- (if isSAT then forSome_ else forAll_) a >>= output Control.executeQuery QueryInternal q -- | Check if a safe-call was safe or not, turning a 'SafeResult' to a Bool. isSafe :: SafeResult -> Bool isSafe (SafeResult (_, _, result)) = case result of Unsatisfiable{} -> True Satisfiable{} -> False SatExtField{} -> False -- conservative Unknown{} -> False -- conservative ProofError{} -> False -- conservative -- | Perform an action asynchronously, returning results together with diff-time. runInThread :: NFData b => UTCTime -> (SMTConfig -> IO b) -> SMTConfig -> IO (Async (Solver, NominalDiffTime, b)) runInThread beginTime action config = async $ do result <- action config endTime <- rnf result `seq` getCurrentTime return (name (solver config), endTime `diffUTCTime` beginTime, result) -- | Perform action for all given configs, return the first one that wins. Note that we do -- not wait for the other asyncs to terminate; hopefully they'll do so quickly. sbvWithAny :: NFData b => [SMTConfig] -> (SMTConfig -> a -> IO b) -> a -> IO (Solver, NominalDiffTime, b) sbvWithAny [] _ _ = error "SBV.withAny: No solvers given!" sbvWithAny solvers what a = do beginTime <- getCurrentTime snd `fmap` (mapM (runInThread beginTime (`what` a)) solvers >>= waitAnyFastCancel) where -- Async's `waitAnyCancel` nicely blocks; so we use this variant to ignore the -- wait part for killed threads. waitAnyFastCancel asyncs = waitAny asyncs `finally` mapM_ cancelFast asyncs cancelFast other = throwTo (asyncThreadId other) ThreadKilled -- | Perform action for all given configs, return all the results. sbvWithAll :: NFData b => [SMTConfig] -> (SMTConfig -> a -> IO b) -> a -> IO [(Solver, NominalDiffTime, b)] sbvWithAll solvers what a = do beginTime <- getCurrentTime mapM (runInThread beginTime (`what` a)) solvers >>= (unsafeInterleaveIO . go) where go [] = return [] go as = do (d, r) <- waitAny as -- The following filter works because the Eq instance on Async -- checks the thread-id; so we know that we're removing the -- correct solver from the list. This also allows for -- running the same-solver (with different options), since -- they will get different thread-ids. rs <- unsafeInterleaveIO $ go (filter (/= d) as) return (r : rs) -- | Symbolically executable program fragments. This class is mainly used for 'safe' calls, and is sufficently populated internally to cover most use -- cases. Users can extend it as they wish to allow 'safe' checks for SBV programs that return/take types that are user-defined. class SExecutable a where sName_ :: a -> Symbolic () sName :: [String] -> a -> Symbolic () -- | Check safety using the default solver. safe :: a -> IO [SafeResult] safe = safeWith defaultSMTCfg -- | Check if any of the 'Data.SBV.sAssert' calls can be violated. safeWith :: SMTConfig -> a -> IO [SafeResult] safeWith cfg a = do cwd <- (++ "/") <$> getCurrentDirectory let mkRelative path | cwd `isPrefixOf` path = drop (length cwd) path | True = path fst <$> runSymbolic (SMTMode ISafe True cfg) (sName_ a >> check mkRelative) where check mkRelative = Control.query $ Control.getSBVAssertions >>= mapM (verify mkRelative) -- check that the cond is unsatisfiable. If satisfiable, that would -- indicate the assignment under which the 'Data.SBV.sAssert' would fail verify :: (FilePath -> FilePath) -> (String, Maybe CallStack, SW) -> Query SafeResult verify mkRelative (msg, cs, cond) = do let locInfo ps = let loc (f, sl) = concat [mkRelative (srcLocFile sl), ":", show (srcLocStartLine sl), ":", show (srcLocStartCol sl), ":", f] in intercalate ",\n " (map loc ps) location = (locInfo . getCallStack) `fmap` cs result <- do Control.push 1 Control.send True $ "(assert " ++ show cond ++ ")" r <- Control.getSMTResult Control.pop 1 return r return $ SafeResult (location, msg, result) instance NFData a => SExecutable (Symbolic a) where sName_ a = a >>= \r -> rnf r `seq` return () sName [] = sName_ sName xs = error $ "SBV.SExecutable.sName: Extra unmapped name(s): " ++ intercalate ", " xs instance SExecutable (SBV a) where sName_ v = sName_ (output v) sName xs v = sName xs (output v) -- Unit output instance SExecutable () where sName_ () = sName_ (output ()) sName xs () = sName xs (output ()) -- List output instance SExecutable [SBV a] where sName_ vs = sName_ (output vs) sName xs vs = sName xs (output vs) -- 2 Tuple output instance (NFData a, SymWord a, NFData b, SymWord b) => SExecutable (SBV a, SBV b) where sName_ (a, b) = sName_ (output a >> output b) sName _ = sName_ -- 3 Tuple output instance (NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c) => SExecutable (SBV a, SBV b, SBV c) where sName_ (a, b, c) = sName_ (output a >> output b >> output c) sName _ = sName_ -- 4 Tuple output instance (NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c, NFData d, SymWord d) => SExecutable (SBV a, SBV b, SBV c, SBV d) where sName_ (a, b, c, d) = sName_ (output a >> output b >> output c >> output c >> output d) sName _ = sName_ -- 5 Tuple output instance (NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c, NFData d, SymWord d, NFData e, SymWord e) => SExecutable (SBV a, SBV b, SBV c, SBV d, SBV e) where sName_ (a, b, c, d, e) = sName_ (output a >> output b >> output c >> output d >> output e) sName _ = sName_ -- 6 Tuple output instance (NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c, NFData d, SymWord d, NFData e, SymWord e, NFData f, SymWord f) => SExecutable (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) where sName_ (a, b, c, d, e, f) = sName_ (output a >> output b >> output c >> output d >> output e >> output f) sName _ = sName_ -- 7 Tuple output instance (NFData a, SymWord a, NFData b, SymWord b, NFData c, SymWord c, NFData d, SymWord d, NFData e, SymWord e, NFData f, SymWord f, NFData g, SymWord g) => SExecutable (SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) where sName_ (a, b, c, d, e, f, g) = sName_ (output a >> output b >> output c >> output d >> output e >> output f >> output g) sName _ = sName_ -- Functions instance (SymWord a, SExecutable p) => SExecutable (SBV a -> p) where sName_ k = exists_ >>= \a -> sName_ $ k a sName (s:ss) k = exists s >>= \a -> sName ss $ k a sName [] k = sName_ k -- 2 Tuple input instance (SymWord a, SymWord b, SExecutable p) => SExecutable ((SBV a, SBV b) -> p) where sName_ k = exists_ >>= \a -> sName_ $ \b -> k (a, b) sName (s:ss) k = exists s >>= \a -> sName ss $ \b -> k (a, b) sName [] k = sName_ k -- 3 Tuple input instance (SymWord a, SymWord b, SymWord c, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c) -> p) where sName_ k = exists_ >>= \a -> sName_ $ \b c -> k (a, b, c) sName (s:ss) k = exists s >>= \a -> sName ss $ \b c -> k (a, b, c) sName [] k = sName_ k -- 4 Tuple input instance (SymWord a, SymWord b, SymWord c, SymWord d, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c, SBV d) -> p) where sName_ k = exists_ >>= \a -> sName_ $ \b c d -> k (a, b, c, d) sName (s:ss) k = exists s >>= \a -> sName ss $ \b c d -> k (a, b, c, d) sName [] k = sName_ k -- 5 Tuple input instance (SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c, SBV d, SBV e) -> p) where sName_ k = exists_ >>= \a -> sName_ $ \b c d e -> k (a, b, c, d, e) sName (s:ss) k = exists s >>= \a -> sName ss $ \b c d e -> k (a, b, c, d, e) sName [] k = sName_ k -- 6 Tuple input instance (SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f) -> p) where sName_ k = exists_ >>= \a -> sName_ $ \b c d e f -> k (a, b, c, d, e, f) sName (s:ss) k = exists s >>= \a -> sName ss $ \b c d e f -> k (a, b, c, d, e, f) sName [] k = sName_ k -- 7 Tuple input instance (SymWord a, SymWord b, SymWord c, SymWord d, SymWord e, SymWord f, SymWord g, SExecutable p) => SExecutable ((SBV a, SBV b, SBV c, SBV d, SBV e, SBV f, SBV g) -> p) where sName_ k = exists_ >>= \a -> sName_ $ \b c d e f g -> k (a, b, c, d, e, f, g) sName (s:ss) k = exists s >>= \a -> sName ss $ \b c d e f g -> k (a, b, c, d, e, f, g) sName [] k = sName_ k {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/Data/SBV/Provers/Yices.hs0000644000000000000000000000355613405536617015022 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Provers.Yices -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- The connection to the Yices SMT solver ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module Data.SBV.Provers.Yices(yices) where import Data.SBV.Core.Data import Data.SBV.SMT.SMT -- | The description of the Yices SMT solver -- The default executable is @\"yices-smt2\"@, which must be in your path. You can use the @SBV_YICES@ environment variable to point to the executable on your system. -- SBV does not pass any arguments to yices. You can use the @SBV_YICES_OPTIONS@ environment variable to override the options. yices :: SMTSolver yices = SMTSolver { name = Yices , executable = "yices-smt2" , options = const ["--incremental"] , engine = standardEngine "SBV_YICES" "SBV_YICES_OPTIONS" , capabilities = SolverCapabilities { supportsQuantifiers = False , supportsUninterpretedSorts = True , supportsUnboundedInts = True , supportsReals = True , supportsApproxReals = False , supportsIEEE754 = False , supportsOptimization = False , supportsPseudoBooleans = False , supportsCustomQueries = True , supportsGlobalDecls = False , supportsFlattenedSequences = Nothing } } sbv-7.13/Data/SBV/Provers/Z3.hs0000644000000000000000000000420613405536617014233 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Provers.MathSAT -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- The connection to the MathSAT SMT solver ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module Data.SBV.Provers.Z3(z3) where import Data.SBV.Core.Data import Data.SBV.SMT.SMT -- | The description of the Z3 SMT solver. -- The default executable is @\"z3\"@, which must be in your path. You can use the @SBV_Z3@ environment variable to point to the executable on your system. -- The default options are @\"-nw -in -smt2\"@. You can use the @SBV_Z3_OPTIONS@ environment variable to override the options. z3 :: SMTSolver z3 = SMTSolver { name = Z3 , executable = "z3" , options = modConfig ["-nw", "-in", "-smt2"] , engine = standardEngine "SBV_Z3" "SBV_Z3_OPTIONS" , capabilities = SolverCapabilities { supportsQuantifiers = True , supportsUninterpretedSorts = True , supportsUnboundedInts = True , supportsReals = True , supportsApproxReals = True , supportsIEEE754 = True , supportsOptimization = True , supportsPseudoBooleans = True , supportsCustomQueries = True , supportsGlobalDecls = True , supportsFlattenedSequences = Just [ "(set-option :pp.max_depth 4294967295)" , "(set-option :pp.min_alias_size 4294967295)" ] } } where modConfig :: [String] -> SMTConfig -> [String] modConfig opts _cfg = opts sbv-7.13/Data/SBV/SMT/0000755000000000000000000000000013405536617012404 5ustar0000000000000000sbv-7.13/Data/SBV/SMT/SMT.hs0000644000000000000000000015356513405536617013422 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.SMT.SMT -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Abstraction of SMT solvers ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE NamedFieldPuns #-} module Data.SBV.SMT.SMT ( -- * Model extraction Modelable(..) , SatModel(..), genParse , extractModels, getModelValues , getModelDictionaries, getModelUninterpretedValues , displayModels, showModel -- * Standard prover engine , standardEngine -- * Results of various tasks , ThmResult(..) , SatResult(..) , AllSatResult(..) , SafeResult(..) , OptimizeResult(..) ) where import qualified Control.Exception as C import Control.Concurrent (newEmptyMVar, takeMVar, putMVar, forkIO) import Control.DeepSeq (NFData(..)) import Control.Monad (zipWithM) import Data.Char (isSpace) import Data.Maybe (fromMaybe, isJust) import Data.Int (Int8, Int16, Int32, Int64) import Data.List (intercalate, isPrefixOf) import Data.Word (Word8, Word16, Word32, Word64) import Data.IORef (readIORef, writeIORef) import Data.Time (getZonedTime, defaultTimeLocale, formatTime, diffUTCTime, getCurrentTime) import System.Directory (findExecutable) import System.Environment (getEnv) import System.Exit (ExitCode(..)) import System.IO (hClose, hFlush, hPutStrLn, hGetContents, hGetLine) import System.Process (runInteractiveProcess, waitForProcess, terminateProcess) import qualified Data.Map.Strict as M import Data.SBV.Core.AlgReals import Data.SBV.Core.Data import Data.SBV.Core.Symbolic (SMTEngine, State(..)) import Data.SBV.SMT.Utils (showTimeoutValue, alignPlain, debug, mergeSExpr, SBVException(..)) import Data.SBV.Utils.PrettyNum import Data.SBV.Utils.Lib (joinArgs, splitArgs) import Data.SBV.Utils.SExpr (parenDeficit) import Data.SBV.Utils.TDiff (Timing(..), showTDiff) import qualified System.Timeout as Timeout (timeout) -- | Extract the final configuration from a result resultConfig :: SMTResult -> SMTConfig resultConfig (Unsatisfiable c _) = c resultConfig (Satisfiable c _) = c resultConfig (SatExtField c _) = c resultConfig (Unknown c _) = c resultConfig (ProofError c _) = c -- | A 'Data.SBV.prove' call results in a 'ThmResult' newtype ThmResult = ThmResult SMTResult deriving NFData -- | A 'Data.SBV.sat' call results in a 'SatResult' -- The reason for having a separate 'SatResult' is to have a more meaningful 'Show' instance. newtype SatResult = SatResult SMTResult deriving NFData -- | An 'Data.SBV.allSat' call results in a 'AllSatResult'. The first boolean says whether we -- hit the max-model limit as we searched. The second boolean says whether -- there were prefix-existentials. newtype AllSatResult = AllSatResult (Bool, Bool, [SMTResult]) -- | A 'Data.SBV.safe' call results in a 'SafeResult' newtype SafeResult = SafeResult (Maybe String, String, SMTResult) -- | An 'Data.SBV.optimize' call results in a 'OptimizeResult'. In the 'ParetoResult' case, the boolean is 'True' -- if we reached pareto-query limit and so there might be more unqueried results remaining. If 'False', -- it means that we have all the pareto fronts returned. See the 'Pareto' 'OptimizeStyle' for details. data OptimizeResult = LexicographicResult SMTResult | ParetoResult (Bool, [SMTResult]) | IndependentResult [(String, SMTResult)] -- User friendly way of printing theorem results instance Show ThmResult where show (ThmResult r) = showSMTResult "Q.E.D." "Unknown" "Falsifiable" "Falsifiable. Counter-example:\n" "Falsifiable in an extension field:\n" r -- User friendly way of printing satisfiablity results instance Show SatResult where show (SatResult r) = showSMTResult "Unsatisfiable" "Unknown" "Satisfiable" "Satisfiable. Model:\n" "Satisfiable in an extension field. Model:\n" r -- User friendly way of printing safety results instance Show SafeResult where show (SafeResult (mbLoc, msg, r)) = showSMTResult (tag "No violations detected") (tag "Unknown") (tag "Violated") (tag "Violated. Model:\n") (tag "Violated in an extension field:\n") r where loc = maybe "" (++ ": ") mbLoc tag s = loc ++ msg ++ ": " ++ s -- The Show instance of AllSatResults. Note that we have to be careful in being lazy enough -- as the typical use case is to pull results out as they become available. instance Show AllSatResult where show (AllSatResult (l, e, xs)) = go (0::Int) xs where uniqueWarn | e = " (Unique up to prefix existentials.)" | True = "" go c (s:ss) = let c' = c+1 (ok, o) = sh c' s in c' `seq` if ok then o ++ "\n" ++ go c' ss else o go c [] = case (l, c) of (True, _) -> "Search stopped since model count request was reached." ++ uniqueWarn (False, 0) -> "No solutions found." (False, 1) -> "This is the only solution." ++ uniqueWarn (False, _) -> "Found " ++ show c ++ " different solutions." ++ uniqueWarn sh i c = (ok, showSMTResult "Unsatisfiable" "Unknown" ("Solution #" ++ show i ++ ":\nSatisfiable") ("Solution #" ++ show i ++ ":\n") ("Solution $" ++ show i ++ " in an extension field:\n") c) where ok = case c of Satisfiable{} -> True _ -> False -- Show instance for optimization results instance Show OptimizeResult where show res = case res of LexicographicResult r -> sh id r IndependentResult rs -> multi "objectives" (map (uncurry shI) rs) ParetoResult (False, [r]) -> sh (\s -> "Unique pareto front: " ++ s) r ParetoResult (False, rs) -> multi "pareto optimal values" (zipWith shP [(1::Int)..] rs) ParetoResult (True, rs) -> multi "pareto optimal values" (zipWith shP [(1::Int)..] rs) ++ "\n*** Note: Pareto-front extraction was terminated as requested by the user." ++ "\n*** There might be many other results!" where multi w [] = "There are no " ++ w ++ " to display models for." multi _ xs = intercalate "\n" xs shI n = sh (\s -> "Objective " ++ show n ++ ": " ++ s) shP i = sh (\s -> "Pareto front #" ++ show i ++ ": " ++ s) sh tag = showSMTResult (tag "Unsatisfiable.") (tag "Unknown.") (tag "Optimal with no assignments.") (tag "Optimal model:" ++ "\n") (tag "Optimal in an extension field:" ++ "\n") -- | Instances of 'SatModel' can be automatically extracted from models returned by the -- solvers. The idea is that the sbv infrastructure provides a stream of CW's (constant-words) -- coming from the solver, and the type @a@ is interpreted based on these constants. Many typical -- instances are already provided, so new instances can be declared with relative ease. -- -- Minimum complete definition: 'parseCWs' class SatModel a where -- | Given a sequence of constant-words, extract one instance of the type @a@, returning -- the remaining elements untouched. If the next element is not what's expected for this -- type you should return 'Nothing' parseCWs :: [CW] -> Maybe (a, [CW]) -- | Given a parsed model instance, transform it using @f@, and return the result. -- The default definition for this method should be sufficient in most use cases. cvtModel :: (a -> Maybe b) -> Maybe (a, [CW]) -> Maybe (b, [CW]) cvtModel f x = x >>= \(a, r) -> f a >>= \b -> return (b, r) default parseCWs :: Read a => [CW] -> Maybe (a, [CW]) parseCWs (CW _ (CWUserSort (_, s)) : r) = Just (read s, r) parseCWs _ = Nothing -- | Parse a signed/sized value from a sequence of CWs genParse :: Integral a => Kind -> [CW] -> Maybe (a, [CW]) genParse k (x@(CW _ (CWInteger i)):r) | kindOf x == k = Just (fromIntegral i, r) genParse _ _ = Nothing -- | Base case for 'SatModel' at unit type. Comes in handy if there are no real variables. instance SatModel () where parseCWs xs = return ((), xs) -- | 'Bool' as extracted from a model instance SatModel Bool where parseCWs xs = do (x, r) <- genParse KBool xs return ((x :: Integer) /= 0, r) -- | 'Word8' as extracted from a model instance SatModel Word8 where parseCWs = genParse (KBounded False 8) -- | 'Int8' as extracted from a model instance SatModel Int8 where parseCWs = genParse (KBounded True 8) -- | 'Word16' as extracted from a model instance SatModel Word16 where parseCWs = genParse (KBounded False 16) -- | 'Int16' as extracted from a model instance SatModel Int16 where parseCWs = genParse (KBounded True 16) -- | 'Word32' as extracted from a model instance SatModel Word32 where parseCWs = genParse (KBounded False 32) -- | 'Int32' as extracted from a model instance SatModel Int32 where parseCWs = genParse (KBounded True 32) -- | 'Word64' as extracted from a model instance SatModel Word64 where parseCWs = genParse (KBounded False 64) -- | 'Int64' as extracted from a model instance SatModel Int64 where parseCWs = genParse (KBounded True 64) -- | 'Integer' as extracted from a model instance SatModel Integer where parseCWs = genParse KUnbounded -- | 'AlgReal' as extracted from a model instance SatModel AlgReal where parseCWs (CW KReal (CWAlgReal i) : r) = Just (i, r) parseCWs _ = Nothing -- | 'Float' as extracted from a model instance SatModel Float where parseCWs (CW KFloat (CWFloat i) : r) = Just (i, r) parseCWs _ = Nothing -- | 'Double' as extracted from a model instance SatModel Double where parseCWs (CW KDouble (CWDouble i) : r) = Just (i, r) parseCWs _ = Nothing -- | @CW@ as extracted from a model; trivial definition instance SatModel CW where parseCWs (cw : r) = Just (cw, r) parseCWs [] = Nothing -- | A rounding mode, extracted from a model. (Default definition suffices) instance SatModel RoundingMode -- | A list of values as extracted from a model. When reading a list, we -- go as long as we can (maximal-munch). Note that this never fails, as -- we can always return the empty list! instance SatModel a => SatModel [a] where parseCWs [] = Just ([], []) parseCWs xs = case parseCWs xs of Just (a, ys) -> case parseCWs ys of Just (as, zs) -> Just (a:as, zs) Nothing -> Just ([], ys) Nothing -> Just ([], xs) -- | Tuples extracted from a model instance (SatModel a, SatModel b) => SatModel (a, b) where parseCWs as = do (a, bs) <- parseCWs as (b, cs) <- parseCWs bs return ((a, b), cs) -- | 3-Tuples extracted from a model instance (SatModel a, SatModel b, SatModel c) => SatModel (a, b, c) where parseCWs as = do (a, bs) <- parseCWs as ((b, c), ds) <- parseCWs bs return ((a, b, c), ds) -- | 4-Tuples extracted from a model instance (SatModel a, SatModel b, SatModel c, SatModel d) => SatModel (a, b, c, d) where parseCWs as = do (a, bs) <- parseCWs as ((b, c, d), es) <- parseCWs bs return ((a, b, c, d), es) -- | 5-Tuples extracted from a model instance (SatModel a, SatModel b, SatModel c, SatModel d, SatModel e) => SatModel (a, b, c, d, e) where parseCWs as = do (a, bs) <- parseCWs as ((b, c, d, e), fs) <- parseCWs bs return ((a, b, c, d, e), fs) -- | 6-Tuples extracted from a model instance (SatModel a, SatModel b, SatModel c, SatModel d, SatModel e, SatModel f) => SatModel (a, b, c, d, e, f) where parseCWs as = do (a, bs) <- parseCWs as ((b, c, d, e, f), gs) <- parseCWs bs return ((a, b, c, d, e, f), gs) -- | 7-Tuples extracted from a model instance (SatModel a, SatModel b, SatModel c, SatModel d, SatModel e, SatModel f, SatModel g) => SatModel (a, b, c, d, e, f, g) where parseCWs as = do (a, bs) <- parseCWs as ((b, c, d, e, f, g), hs) <- parseCWs bs return ((a, b, c, d, e, f, g), hs) -- | Various SMT results that we can extract models out of. class Modelable a where -- | Is there a model? modelExists :: a -> Bool -- | Extract assignments of a model, the result is a tuple where the first argument (if True) -- indicates whether the model was "probable". (i.e., if the solver returned unknown.) getModelAssignment :: SatModel b => a -> Either String (Bool, b) -- | Extract a model dictionary. Extract a dictionary mapping the variables to -- their respective values as returned by the SMT solver. Also see `getModelDictionaries`. getModelDictionary :: a -> M.Map String CW -- | Extract a model value for a given element. Also see `getModelValues`. getModelValue :: SymWord b => String -> a -> Maybe b getModelValue v r = fromCW `fmap` (v `M.lookup` getModelDictionary r) -- | Extract a representative name for the model value of an uninterpreted kind. -- This is supposed to correspond to the value as computed internally by the -- SMT solver; and is unportable from solver to solver. Also see `getModelUninterpretedValues`. getModelUninterpretedValue :: String -> a -> Maybe String getModelUninterpretedValue v r = case v `M.lookup` getModelDictionary r of Just (CW _ (CWUserSort (_, s))) -> Just s _ -> Nothing -- | A simpler variant of 'getModelAssignment' to get a model out without the fuss. extractModel :: SatModel b => a -> Maybe b extractModel a = case getModelAssignment a of Right (_, b) -> Just b _ -> Nothing -- | Extract model objective values, for all optimization goals. getModelObjectives :: a -> M.Map String GeneralizedCW -- | Extract the value of an objective getModelObjectiveValue :: String -> a -> Maybe GeneralizedCW getModelObjectiveValue v r = v `M.lookup` getModelObjectives r -- | Return all the models from an 'Data.SBV.allSat' call, similar to 'extractModel' but -- is suitable for the case of multiple results. extractModels :: SatModel a => AllSatResult -> [a] extractModels (AllSatResult (_, _, xs)) = [ms | Right (_, ms) <- map getModelAssignment xs] -- | Get dictionaries from an all-sat call. Similar to `getModelDictionary`. getModelDictionaries :: AllSatResult -> [M.Map String CW] getModelDictionaries (AllSatResult (_, _, xs)) = map getModelDictionary xs -- | Extract value of a variable from an all-sat call. Similar to `getModelValue`. getModelValues :: SymWord b => String -> AllSatResult -> [Maybe b] getModelValues s (AllSatResult (_, _, xs)) = map (s `getModelValue`) xs -- | Extract value of an uninterpreted variable from an all-sat call. Similar to `getModelUninterpretedValue`. getModelUninterpretedValues :: String -> AllSatResult -> [Maybe String] getModelUninterpretedValues s (AllSatResult (_, _, xs)) = map (s `getModelUninterpretedValue`) xs -- | 'ThmResult' as a generic model provider instance Modelable ThmResult where getModelAssignment (ThmResult r) = getModelAssignment r modelExists (ThmResult r) = modelExists r getModelDictionary (ThmResult r) = getModelDictionary r getModelObjectives (ThmResult r) = getModelObjectives r -- | 'SatResult' as a generic model provider instance Modelable SatResult where getModelAssignment (SatResult r) = getModelAssignment r modelExists (SatResult r) = modelExists r getModelDictionary (SatResult r) = getModelDictionary r getModelObjectives (SatResult r) = getModelObjectives r -- | 'SMTResult' as a generic model provider instance Modelable SMTResult where getModelAssignment (Unsatisfiable _ _) = Left "SBV.getModelAssignment: Unsatisfiable result" getModelAssignment (Satisfiable _ m) = Right (False, parseModelOut m) getModelAssignment (SatExtField _ _) = Left "SBV.getModelAssignment: The model is in an extension field" getModelAssignment (Unknown _ m) = Left $ "SBV.getModelAssignment: Solver state is unknown: " ++ show m getModelAssignment (ProofError _ s) = error $ unlines $ "Backend solver complains: " : s modelExists Satisfiable{} = True modelExists Unknown{} = False -- don't risk it modelExists _ = False getModelDictionary Unsatisfiable{} = M.empty getModelDictionary (Satisfiable _ m) = M.fromList (modelAssocs m) getModelDictionary SatExtField{} = M.empty getModelDictionary Unknown{} = M.empty getModelDictionary ProofError{} = M.empty getModelObjectives Unsatisfiable{} = M.empty getModelObjectives (Satisfiable _ m) = M.fromList (modelObjectives m) getModelObjectives (SatExtField _ m) = M.fromList (modelObjectives m) getModelObjectives Unknown{} = M.empty getModelObjectives ProofError{} = M.empty -- | Extract a model out, will throw error if parsing is unsuccessful parseModelOut :: SatModel a => SMTModel -> a parseModelOut m = case parseCWs [c | (_, c) <- modelAssocs m] of Just (x, []) -> x Just (_, ys) -> error $ "SBV.parseModelOut: Partially constructed model; remaining elements: " ++ show ys Nothing -> error $ "SBV.parseModelOut: Cannot construct a model from: " ++ show m -- | Given an 'Data.SBV.allSat' call, we typically want to iterate over it and print the results in sequence. The -- 'displayModels' function automates this task by calling @disp@ on each result, consecutively. The first -- 'Int' argument to @disp@ 'is the current model number. The second argument is a tuple, where the first -- element indicates whether the model is alleged (i.e., if the solver is not sure, returing Unknown) displayModels :: SatModel a => (Int -> (Bool, a) -> IO ()) -> AllSatResult -> IO Int displayModels disp (AllSatResult (_, _, ms)) = do inds <- zipWithM display [a | Right a <- map (getModelAssignment . SatResult) ms] [(1::Int)..] return $ last (0:inds) where display r i = disp i r >> return i -- | Show an SMTResult; generic version showSMTResult :: String -> String -> String -> String -> String -> SMTResult -> String showSMTResult unsatMsg unkMsg satMsg satMsgModel satExtMsg result = case result of Unsatisfiable _ uc -> unsatMsg ++ showUnsatCore uc Satisfiable _ (SMTModel _ []) -> satMsg Satisfiable _ m -> satMsgModel ++ showModel cfg m SatExtField _ (SMTModel b _) -> satExtMsg ++ showModelDictionary cfg b Unknown _ r -> unkMsg ++ ".\n" ++ " Reason: " `alignPlain` show r ProofError _ [] -> "*** An error occurred. No additional information available. Try running in verbose mode" ProofError _ ls -> "*** An error occurred.\n" ++ intercalate "\n" (map ("*** " ++) ls) where cfg = resultConfig result showUnsatCore Nothing = "" showUnsatCore (Just xs) = ". Unsat core:\n" ++ intercalate "\n" [" " ++ x | x <- xs] -- | Show a model in human readable form. Ignore bindings to those variables that start -- with "__internal_sbv_" and also those marked as "nonModelVar" in the config; as these are only for internal purposes showModel :: SMTConfig -> SMTModel -> String showModel cfg model = showModelDictionary cfg [(n, RegularCW c) | (n, c) <- modelAssocs model] -- | Show bindings in a generalized model dictionary, tabulated showModelDictionary :: SMTConfig -> [(String, GeneralizedCW)] -> String showModelDictionary cfg allVars | null allVars = "[There are no variables bound by the model.]" | null relevantVars = "[There are no model-variables bound by the model.]" | True = intercalate "\n" . display . map shM $ relevantVars where relevantVars = filter (not . ignore) allVars ignore (s, _) = "__internal_sbv_" `isPrefixOf` s || isNonModelVar cfg s shM (s, RegularCW v) = let vs = shCW cfg v in ((length s, s), (vlength vs, vs)) shM (s, other) = let vs = show other in ((length s, s), (vlength vs, vs)) display svs = map line svs where line ((_, s), (_, v)) = " " ++ right (nameWidth - length s) s ++ " = " ++ left (valWidth - lTrimRight (valPart v)) v nameWidth = maximum $ 0 : [l | ((l, _), _) <- svs] valWidth = maximum $ 0 : [l | (_, (l, _)) <- svs] right p s = s ++ replicate p ' ' left p s = replicate p ' ' ++ s vlength s = case dropWhile (/= ':') (reverse (takeWhile (/= '\n') s)) of (':':':':r) -> length (dropWhile isSpace r) _ -> length s -- conservative valPart "" = "" valPart (':':':':_) = "" valPart (x:xs) = x : valPart xs lTrimRight = length . dropWhile isSpace . reverse -- | Show a constant value, in the user-specified base shCW :: SMTConfig -> CW -> String shCW = sh . printBase where sh 2 = binS sh 10 = show sh 16 = hexS sh n = \w -> show w ++ " -- Ignoring unsupported printBase " ++ show n ++ ", use 2, 10, or 16." -- | Helper function to spin off to an SMT solver. pipeProcess :: SMTConfig -> State -> String -> [String] -> String -> (State -> IO a) -> IO a pipeProcess cfg ctx execName opts pgm continuation = do mbExecPath <- findExecutable execName case mbExecPath of Nothing -> error $ unlines [ "Unable to locate executable for " ++ show (name (solver cfg)) , "Executable specified: " ++ show execName ] Just execPath -> runSolver cfg ctx execPath opts pgm continuation `C.catches` [ C.Handler (\(e :: SBVException) -> C.throwIO e) , C.Handler (\(e :: C.ErrorCall) -> C.throwIO e) , C.Handler (\(e :: C.SomeException) -> handleAsync e $ error $ unlines [ "Failed to start the external solver:\n" ++ show e , "Make sure you can start " ++ show execPath , "from the command line without issues." ]) ] -- | A standard engine interface. Most solvers follow-suit here in how we "chat" to them.. standardEngine :: String -> String -> SMTEngine standardEngine envName envOptName cfg ctx pgm continuation = do execName <- getEnv envName `C.catch` (\(e :: C.SomeException) -> handleAsync e (return (executable (solver cfg)))) execOpts <- (splitArgs `fmap` getEnv envOptName) `C.catch` (\(e :: C.SomeException) -> handleAsync e (return (options (solver cfg) cfg))) let cfg' = cfg {solver = (solver cfg) {executable = execName, options = const execOpts}} standardSolver cfg' ctx pgm continuation -- | A standard solver interface. If the solver is SMT-Lib compliant, then this function should suffice in -- communicating with it. standardSolver :: SMTConfig -- ^ The currrent configuration -> State -- ^ Context in which we are running -> String -- ^ The program -> (State -> IO a) -- ^ The continuation -> IO a standardSolver config ctx pgm continuation = do let msg s = debug config ["** " ++ s] smtSolver= solver config exec = executable smtSolver opts = options smtSolver config msg $ "Calling: " ++ (exec ++ (if null opts then "" else " ") ++ joinArgs opts) rnf pgm `seq` pipeProcess config ctx exec opts pgm continuation -- | An internal type to track of solver interactions data SolverLine = SolverRegular String -- ^ All is well | SolverTimeout String -- ^ Timeout expired | SolverException String -- ^ Something else went wrong -- | A variant of @readProcessWithExitCode@; except it deals with SBV continuations runSolver :: SMTConfig -> State -> FilePath -> [String] -> String -> (State -> IO a) -> IO a runSolver cfg ctx execPath opts pgm continuation = do let nm = show (name (solver cfg)) msg = debug cfg . map ("*** " ++) (send, ask, getResponseFromSolver, terminateSolver, cleanUp, pid) <- do (inh, outh, errh, pid) <- runInteractiveProcess execPath opts Nothing Nothing let -- send a command down, but check that we're balanced in parens. If we aren't -- this is most likely an SBV bug. send :: Maybe Int -> String -> IO () send mbTimeOut command | parenDeficit command /= 0 = error $ unlines [ "" , "*** Data.SBV: Unbalanced input detected." , "***" , "*** Sending: " ++ command , "***" , "*** This is most likely an SBV bug. Please report!" ] | True = do hPutStrLn inh command hFlush inh recordTranscript (transcript cfg) $ Left (command, mbTimeOut) -- Send a line, get a whole s-expr. We ignore the pathetic case that there might be a string with an unbalanced parentheses in it in a response. ask :: Maybe Int -> String -> IO String ask mbTimeOut command = -- solvers don't respond to empty lines or comments; we just pass back -- success in these cases to keep the illusion of everything has a response let cmd = dropWhile isSpace command in if null cmd || ";" `isPrefixOf` cmd then return "success" else do send mbTimeOut command getResponseFromSolver (Just command) mbTimeOut -- Get a response from the solver, with an optional time-out on how long -- to wait. Note that there's *always* a time-out of 5 seconds once we get the -- first line of response, as while the solver might take it's time to respond, -- once it starts responding successive lines should come quickly. getResponseFromSolver :: Maybe String -> Maybe Int -> IO String getResponseFromSolver mbCommand mbTimeOut = do response <- go True 0 [] let collated = intercalate "\n" $ reverse response recordTranscript (transcript cfg) $ Right collated return collated where safeGetLine isFirst h = let timeOutToUse | isFirst = mbTimeOut | True = Just 5000000 timeOutMsg t | isFirst = "User specified timeout of " ++ showTimeoutValue t ++ " exceeded." | True = "A multiline complete response wasn't received before " ++ showTimeoutValue t ++ " exceeded." -- Like hGetLine, except it keeps getting lines if inside a string. getFullLine :: IO String getFullLine = intercalate "\n" . reverse <$> collect False [] where collect inString sofar = do ln <- hGetLine h let walk inside [] = inside walk inside ('"':cs) = walk (not inside) cs walk inside (_:cs) = walk inside cs stillInside = walk inString ln sofar' = ln : sofar if stillInside then collect True sofar' else return sofar' in case timeOutToUse of Nothing -> SolverRegular <$> getFullLine Just t -> do r <- Timeout.timeout t getFullLine case r of Just l -> return $ SolverRegular l Nothing -> return $ SolverTimeout $ timeOutMsg t go isFirst i sofar = do errln <- safeGetLine isFirst outh `C.catch` (\(e :: C.SomeException) -> handleAsync e (return (SolverException (show e)))) case errln of SolverRegular ln -> let need = i + parenDeficit ln -- make sure we get *something* empty = case dropWhile isSpace ln of [] -> True (';':_) -> True -- yes this does happen! I've seen z3 print out comments on stderr. _ -> False in case (empty, need <= 0) of (True, _) -> do debug cfg ["[SKIP] " `alignPlain` ln] go isFirst need sofar (False, False) -> go False need (ln:sofar) (False, True) -> return (ln:sofar) SolverException e -> do terminateProcess pid C.throwIO SBVException { sbvExceptionDescription = e , sbvExceptionSent = mbCommand , sbvExceptionExpected = Nothing , sbvExceptionReceived = Just $ unlines (reverse sofar) , sbvExceptionStdOut = Nothing , sbvExceptionStdErr = Nothing , sbvExceptionExitCode = Nothing , sbvExceptionConfig = cfg { solver = (solver cfg) { executable = execPath } } , sbvExceptionReason = Nothing , sbvExceptionHint = Nothing } SolverTimeout e -> do terminateProcess pid -- NB. Do not *wait* for the process, just quit. C.throwIO SBVException { sbvExceptionDescription = "Timeout! " ++ e , sbvExceptionSent = mbCommand , sbvExceptionExpected = Nothing , sbvExceptionReceived = Just $ unlines (reverse sofar) , sbvExceptionStdOut = Nothing , sbvExceptionStdErr = Nothing , sbvExceptionExitCode = Nothing , sbvExceptionConfig = cfg { solver = (solver cfg) { executable = execPath } } , sbvExceptionReason = Nothing , sbvExceptionHint = if not (verbose cfg) then Just ["Run with 'verbose=True' for further information"] else Nothing } terminateSolver = do hClose inh outMVar <- newEmptyMVar out <- hGetContents outh `C.catch` (\(e :: C.SomeException) -> handleAsync e (return (show e))) _ <- forkIO $ C.evaluate (length out) >> putMVar outMVar () err <- hGetContents errh `C.catch` (\(e :: C.SomeException) -> handleAsync e (return (show e))) _ <- forkIO $ C.evaluate (length err) >> putMVar outMVar () takeMVar outMVar takeMVar outMVar hClose outh `C.catch` (\(e :: C.SomeException) -> handleAsync e (return ())) hClose errh `C.catch` (\(e :: C.SomeException) -> handleAsync e (return ())) ex <- waitForProcess pid `C.catch` (\(e :: C.SomeException) -> handleAsync e (return (ExitFailure (-999)))) return (out, err, ex) cleanUp = do (out, err, ex) <- terminateSolver msg $ [ "Solver : " ++ nm , "Exit code: " ++ show ex ] ++ [ "Std-out : " ++ intercalate "\n " (lines out) | not (null out)] ++ [ "Std-err : " ++ intercalate "\n " (lines err) | not (null err)] case ex of ExitSuccess -> return () _ -> if ignoreExitCode cfg then msg ["Ignoring non-zero exit code of " ++ show ex ++ " per user request!"] else C.throwIO SBVException { sbvExceptionDescription = "Failed to complete the call to " ++ nm , sbvExceptionSent = Nothing , sbvExceptionExpected = Nothing , sbvExceptionReceived = Nothing , sbvExceptionStdOut = Just out , sbvExceptionStdErr = Just err , sbvExceptionExitCode = Just ex , sbvExceptionConfig = cfg { solver = (solver cfg) { executable = execPath } } , sbvExceptionReason = Nothing , sbvExceptionHint = if not (verbose cfg) then Just ["Run with 'verbose=True' for further information"] else Nothing } return (send, ask, getResponseFromSolver, terminateSolver, cleanUp, pid) let executeSolver = do let sendAndGetSuccess :: Maybe Int -> String -> IO () sendAndGetSuccess mbTimeOut l -- The pathetic case when the solver doesn't support queries, so we pretend it responded "success" -- Currently ABC is the only such solver. Filed a request for ABC at: http://bitbucket.org/alanmi/abc/issues/70/ | not (supportsCustomQueries (capabilities (solver cfg))) = do send mbTimeOut l debug cfg ["[ISSUE] " `alignPlain` l] | True = do r <- ask mbTimeOut l case words r of ["success"] -> debug cfg ["[GOOD] " `alignPlain` l] _ -> do debug cfg ["[FAIL] " `alignPlain` l] let isOption = "(set-option" `isPrefixOf` dropWhile isSpace l reason | isOption = [ "Backend solver reports it does not support this option." , "Check the spelling, and if correct please report this as a" , "bug/feature request with the solver!" ] | True = [ "Check solver response for further information. If your code is correct," , "please report this as an issue either with SBV or the solver itself!" ] -- put a sync point here before we die so we consume everything mbExtras <- (Right <$> getResponseFromSolver Nothing (Just 5000000)) `C.catch` (\(e :: C.SomeException) -> handleAsync e (return (Left (show e)))) -- Ignore any exceptions from last sync, pointless. let extras = case mbExtras of Left _ -> [] Right xs -> xs (outOrig, errOrig, ex) <- terminateSolver let out = intercalate "\n" . lines $ outOrig err = intercalate "\n" . lines $ errOrig exc = SBVException { sbvExceptionDescription = "Unexpected non-success response from " ++ nm , sbvExceptionSent = Just l , sbvExceptionExpected = Just "success" , sbvExceptionReceived = Just $ r ++ "\n" ++ extras , sbvExceptionStdOut = Just out , sbvExceptionStdErr = Just err , sbvExceptionExitCode = Just ex , sbvExceptionConfig = cfg { solver = (solver cfg) {executable = execPath } } , sbvExceptionReason = Just reason , sbvExceptionHint = Nothing } C.throwIO exc -- Mark in the log, mostly. sendAndGetSuccess Nothing "; Automatically generated by SBV. Do not edit." -- First check that the solver supports :print-success let backend = name $ solver cfg if not (supportsCustomQueries (capabilities (solver cfg))) then debug cfg ["** Skipping heart-beat for the solver " ++ show backend] else do let heartbeat = "(set-option :print-success true)" r <- ask (Just 5000000) heartbeat -- Give the solver 5s to respond, this should be plenty enough! case words r of ["success"] -> debug cfg ["[GOOD] " ++ heartbeat] ["unsupported"] -> error $ unlines [ "" , "*** Backend solver (" ++ show backend ++ ") does not support the command:" , "***" , "*** (set-option :print-success true)" , "***" , "*** SBV relies on this feature to coordinate communication!" , "*** Please request this as a feature!" ] _ -> error $ unlines [ "" , "*** Data.SBV: Failed to initiate contact with the solver!" , "***" , "*** Sent : " ++ heartbeat , "*** Expected: success" , "*** Received: " ++ r , "***" , "*** Try running in debug mode for further information." ] -- For push/pop support, we require :global-declarations to be true. But not all solvers -- support this. Issue it if supported. (If not, we'll reject pop calls.) if not (supportsGlobalDecls (capabilities (solver cfg))) then debug cfg [ "** Backend solver " ++ show backend ++ " does not support global decls." , "** Some incremental calls, such as pop, will be limited." ] else sendAndGetSuccess Nothing "(set-option :global-declarations true)" -- Now dump the program! mapM_ (sendAndGetSuccess Nothing) (mergeSExpr (lines pgm)) -- Prepare the query context and ship it off let qs = QueryState { queryAsk = ask , querySend = send , queryRetrieveResponse = getResponseFromSolver Nothing , queryConfig = cfg , queryTerminate = cleanUp , queryTimeOutValue = Nothing , queryAssertionStackDepth = 0 , queryTblArrPreserveIndex = Nothing } qsp = queryState ctx mbQS <- readIORef qsp case mbQS of Nothing -> writeIORef qsp (Just qs) Just _ -> error $ unlines [ "" , "Data.SBV: Impossible happened, query-state was already set." , "Please report this as a bug!" ] -- off we go! continuation ctx -- NB. Don't use 'bracket' here, as it wouldn't have access to the exception. let launchSolver = do startTranscript (transcript cfg) cfg r <- executeSolver finalizeTranscript (transcript cfg) Nothing recordEndTime cfg ctx return r launchSolver `C.catch` (\(e :: C.SomeException) -> handleAsync e $ do terminateProcess pid ec <- waitForProcess pid recordException (transcript cfg) (show e) finalizeTranscript (transcript cfg) (Just ec) recordEndTime cfg ctx C.throwIO e) -- | Compute and report the end time recordEndTime :: SMTConfig -> State -> IO () recordEndTime SMTConfig{timing} state = case timing of NoTiming -> return () PrintTiming -> do e <- elapsed putStrLn $ "*** SBV: Elapsed time: " ++ showTDiff e SaveTiming here -> writeIORef here =<< elapsed where elapsed = getCurrentTime >>= \end -> return $ diffUTCTime end (startTime state) -- | Start a transcript file, if requested. startTranscript :: Maybe FilePath -> SMTConfig -> IO () startTranscript Nothing _ = return () startTranscript (Just f) cfg = do ts <- show <$> getZonedTime mbExecPath <- findExecutable (executable (solver cfg)) writeFile f $ start ts mbExecPath where SMTSolver{name, options} = solver cfg start ts mbPath = unlines [ ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" , ";;; SBV: Starting at " ++ ts , ";;;" , ";;; Solver : " ++ show name , ";;; Executable: " ++ fromMaybe "Unable to locate the executable" mbPath , ";;; Options : " ++ unwords (options cfg) , ";;;" , ";;; This file is an auto-generated loadable SMT-Lib file." , ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" , "" ] -- | Finish up the transcript file. finalizeTranscript :: Maybe FilePath -> Maybe ExitCode -> IO () finalizeTranscript Nothing _ = return () finalizeTranscript (Just f) mbEC = do ts <- show <$> getZonedTime appendFile f $ end ts where end ts = unlines $ [ "" , ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" , ";;;" , ";;; SBV: Finished at " ++ ts ] ++ [ ";;;\n;;; Exit code: " ++ show ec | Just ec <- [mbEC] ] ++ [ ";;;" , ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" ] -- If requested, record in the transcript file recordTranscript :: Maybe FilePath -> Either (String, Maybe Int) String -> IO () recordTranscript Nothing _ = return () recordTranscript (Just f) m = do tsPre <- formatTime defaultTimeLocale "; [%T%Q" <$> getZonedTime let ts = take 15 $ tsPre ++ repeat '0' case m of Left (sent, mbTimeOut) -> appendFile f $ unlines $ (ts ++ "] " ++ to mbTimeOut ++ "Sending:") : lines sent Right recv -> appendFile f $ unlines $ case lines (dropWhile isSpace recv) of [] -> [ts ++ "] Received: "] -- can't really happen. [x] -> [ts ++ "] Received: " ++ x] xs -> (ts ++ "] Received: ") : map ("; " ++) xs where to Nothing = "" to (Just i) = "[Timeout: " ++ showTimeoutValue i ++ "] " {-# INLINE recordTranscript #-} -- Record the exception recordException :: Maybe FilePath -> String -> IO () recordException Nothing _ = return () recordException (Just f) m = do ts <- show <$> getZonedTime appendFile f $ exc ts where exc ts = unlines $ [ "" , ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" , ";;;" , ";;; SBV: Caught an exception at " ++ ts , ";;;" ] ++ [ ";;; " ++ l | l <- dropWhile null (lines m) ] ++ [ ";;;" , ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" ] -- We should not be catching/processing asynchronous exceptions. -- See http://github.com/LeventErkok/sbv/issues/410 handleAsync :: C.SomeException -> IO a -> IO a handleAsync e cont | isAsynchronous = C.throwIO e | True = cont where -- Stealing this definition from the asynchronous exceptions package to reduce dependencies isAsynchronous :: Bool isAsynchronous = isJust (C.fromException e :: Maybe C.AsyncException) || isJust (C.fromException e :: Maybe C.SomeAsyncException) sbv-7.13/Data/SBV/SMT/SMTLib.hs0000644000000000000000000000577613405536617014051 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.SMT.SMTLib -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Conversion of symbolic programs to SMTLib format ----------------------------------------------------------------------------- {-# LANGUAGE NamedFieldPuns #-} module Data.SBV.SMT.SMTLib ( SMTLibPgm , toSMTLib , toIncSMTLib ) where import qualified Data.Set as Set (member, toList) import Data.SBV.Core.Data import Data.SBV.SMT.Utils import qualified Data.SBV.SMT.SMTLib2 as SMT2 -- | Convert to SMT-Lib, in a full program context. toSMTLib :: SMTConfig -> SMTLibConverter SMTLibPgm toSMTLib SMTConfig{smtLibVersion} = case smtLibVersion of SMTLib2 -> toSMTLib2 -- | Convert to SMT-Lib, in an incremental query context. toIncSMTLib :: Bool -> SMTConfig -> SMTLibIncConverter [String] toIncSMTLib afterAPush SMTConfig{smtLibVersion} = case smtLibVersion of SMTLib2 -> toIncSMTLib2 afterAPush -- | Convert to SMTLib-2 format toSMTLib2 :: SMTLibConverter SMTLibPgm toSMTLib2 = cvt SMTLib2 where cvt v kindInfo isSat comments qinps skolemMap consts tbls arrs uis axs asgnsSeq cstrs out config | KUnbounded `Set.member` kindInfo && not (supportsUnboundedInts solverCaps) = unsupported "unbounded integers" | KReal `Set.member` kindInfo && not (supportsReals solverCaps) = unsupported "algebraic reals" | (needsFloats || needsDoubles) && not (supportsIEEE754 solverCaps) = unsupported "floating-point numbers" | needsQuantifiers && not (supportsQuantifiers solverCaps) = unsupported "quantifiers" | not (null sorts) && not (supportsUninterpretedSorts solverCaps) = unsupported "uninterpreted sorts" | True = SMTLibPgm v pgm where sorts = [s | KUserSort s _ <- Set.toList kindInfo] solverCaps = capabilities (solver config) unsupported w = error $ unlines [ "SBV: Given problem needs " ++ w , "*** Which is not supported by SBV for the chosen solver: " ++ show (name (solver config)) ] converter = case v of SMTLib2 -> SMT2.cvt pgm = converter kindInfo isSat comments qinps skolemMap consts tbls arrs uis axs asgnsSeq cstrs out config needsFloats = KFloat `Set.member` kindInfo needsDoubles = KDouble `Set.member` kindInfo needsQuantifiers | isSat = ALL `elem` quantifiers | True = EX `elem` quantifiers where quantifiers = map fst (fst qinps) -- | Convert to SMTLib-2 format toIncSMTLib2 :: Bool -> SMTLibIncConverter [String] toIncSMTLib2 = cvt SMTLib2 where cvt SMTLib2 = SMT2.cvtInc sbv-7.13/Data/SBV/SMT/SMTLib2.hs0000644000000000000000000014002713405536617014120 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.SMT.SMTLib2 -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Conversion of symbolic programs to SMTLib format, Using v2 of the standard ----------------------------------------------------------------------------- {-# LANGUAGE PatternGuards #-} module Data.SBV.SMT.SMTLib2(cvt, cvtInc) where import Data.Bits (bit) import Data.List (intercalate, partition, unzip3, nub) import Data.Maybe (listToMaybe, fromMaybe) import qualified Data.Foldable as F (toList) import qualified Data.Map.Strict as M import qualified Data.IntMap.Strict as IM import qualified Data.Set as Set import Data.SBV.Core.Data import Data.SBV.Core.Kind (smtType) import Data.SBV.SMT.Utils import Data.SBV.Control.Types import Data.SBV.Utils.PrettyNum (smtRoundingMode, cwToSMTLib) tbd :: String -> a tbd e = error $ "SBV.SMTLib2: Not-yet-supported: " ++ e -- | Translate a problem into an SMTLib2 script cvt :: SMTLibConverter [String] cvt kindInfo isSat comments (inputs, trackerVars) skolemInps consts tbls arrs uis axs (SBVPgm asgnsSeq) cstrs out cfg = pgm where hasInteger = KUnbounded `Set.member` kindInfo hasReal = KReal `Set.member` kindInfo hasFloat = KFloat `Set.member` kindInfo hasString = KString `Set.member` kindInfo hasChar = KChar `Set.member` kindInfo hasDouble = KDouble `Set.member` kindInfo hasBVs = hasChar || not (null [() | KBounded{} <- Set.toList kindInfo]) -- Remember, characters map to Word8 usorts = [(s, dt) | KUserSort s dt <- Set.toList kindInfo] hasNonBVArrays = (not . null) [() | (_, (_, (k1, k2), _)) <- arrs, not (isBounded k1 && isBounded k2)] hasArrayInits = (not . null) [() | (_, (_, _, ArrayFree (Just _))) <- arrs] hasList = any isList kindInfo rm = roundingMode cfg solverCaps = capabilities (solver cfg) -- Determining the logic is surprisingly tricky! logic -- user told us what to do: so just take it: | Just l <- case [l | SetLogic l <- solverSetOptions cfg] of [] -> Nothing [l] -> Just l ls -> error $ unlines [ "" , "*** Only one setOption call to 'setLogic' is allowed, found: " ++ show (length ls) , "*** " ++ unwords (map show ls) ] = case l of Logic_NONE -> ["; NB. Not setting the logic per user request of Logic_NONE"] _ -> ["(set-logic " ++ show l ++ ") ; NB. User specified."] -- Otherwise, we try to determine the most suitable logic. -- NB. This isn't really fool proof! -- we never set QF_S (ALL seems to work better in all cases) | hasArrayInits = ["(set-logic ALL)"] | hasString || hasList = ["(set-logic ALL)"] | hasDouble || hasFloat = if hasInteger || not (null foralls) then ["(set-logic ALL)"] else if hasBVs then ["(set-logic QF_FPBV)"] else ["(set-logic QF_FP)"] | hasInteger || hasReal || not (null usorts) || hasNonBVArrays = let why | hasInteger = "has unbounded values" | hasReal = "has algebraic reals" | not (null usorts) = "has user-defined sorts" | hasNonBVArrays = "has non-bitvector arrays" | True = "cannot determine the SMTLib-logic to use" in ["(set-logic ALL) ; " ++ why ++ ", using catch-all."] | True = ["(set-logic " ++ qs ++ as ++ ufs ++ "BV)"] where qs | null foralls && null axs = "QF_" -- axioms are likely to contain quantifiers | True = "" as | null arrs = "" | True = "A" ufs | null uis && null tbls = "" -- we represent tables as UFs | True = "UF" -- SBV always requires the production of models! getModels = "(set-option :produce-models true)" : concat [flattenConfig | hasList, Just flattenConfig <- [supportsFlattenedSequences solverCaps]] -- process all other settings we're given userSettings = concatMap opts $ solverSetOptions cfg where opts SetLogic{} = [] -- processed already opts o = [setSMTOption o] settings = userSettings -- NB. Make sure this comes first! ++ getModels ++ logic pgm = map ("; " ++) comments ++ settings ++ [ "; --- uninterpreted sorts ---" ] ++ concatMap declSort usorts ++ [ "; --- literal constants ---" ] ++ map (declConst cfg) consts ++ [ "; --- skolem constants ---" ] ++ [ "(declare-fun " ++ show s ++ " " ++ swFunType ss s ++ ")" ++ userName s | Right (s, ss) <- skolemInps] ++ [ "; --- optimization tracker variables ---" | not (null trackerVars) ] ++ [ "(declare-fun " ++ show s ++ " " ++ swFunType [] s ++ ") ; tracks " ++ nm | (s, nm) <- trackerVars] ++ [ "; --- constant tables ---" ] ++ concatMap (constTable False) constTables ++ [ "; --- skolemized tables ---" ] ++ map (skolemTable (unwords (map swType foralls))) skolemTables ++ [ "; --- arrays ---" ] ++ concat arrayConstants ++ [ "; --- uninterpreted constants ---" ] ++ concatMap declUI uis ++ [ "; --- user given axioms ---" ] ++ map declAx axs ++ [ "; --- formula ---" ] ++ map (declDef cfg skolemMap tableMap) preQuantifierAssigns ++ ["(assert (forall (" ++ intercalate "\n " ["(" ++ show s ++ " " ++ swType s ++ ")" | s <- foralls] ++ ")" | not (null foralls) ] ++ map mkAssign postQuantifierAssigns ++ concat arrayDelayeds ++ concat arraySetups ++ delayedAsserts delayedEqualities ++ finalAssert -- identify the assignments that can come before the first quantifier (preQuantifierAssigns, postQuantifierAssigns) | null foralls = ([], asgns) -- the apparent "switch" here is OK; rest of the code works correctly if there are no foralls. | True = span pre asgns where first = nodeId (minimum foralls) pre (s, _) = nodeId s < first nodeId (SW _ n) = n noOfCloseParens | null foralls = 0 | True = length postQuantifierAssigns + 2 + (if null delayedEqualities then 0 else 1) foralls = [s | Left s <- skolemInps] forallArgs = concatMap ((" " ++) . show) foralls (constTables, skolemTables) = ([(t, d) | (t, Left d) <- allTables], [(t, d) | (t, Right d) <- allTables]) allTables = [(t, genTableData rm skolemMap (not (null foralls), forallArgs) (map fst consts) t) | t <- tbls] (arrayConstants, arrayDelayeds, arraySetups) = unzip3 $ map (declArray cfg False (not (null foralls)) consts skolemMap) arrs delayedEqualities = concatMap snd skolemTables delayedAsserts [] = [] delayedAsserts ds@(deH : deTs) | null foralls = map (\s -> "(assert " ++ s ++ ")") ds | True = map letShift (("(and " ++ deH) : map (align 5) deTs) letShift = align 12 finalAssert | null foralls = map (\a -> "(assert " ++ uncurry addAnnotations a ++ ")") hardAsserts ++ map (\a -> "(assert-soft " ++ uncurry addAnnotations a ++ ")") softAsserts | not (null namedAsserts) = error $ intercalate "\n" [ "SBV: Constraints with attributes and quantifiers cannot be mixed!" , " Quantified variables: " ++ unwords (map show foralls) , " Named constraints : " ++ intercalate ", " (map show namedAsserts) ] | not (null softAsserts) = error $ intercalate "\n" [ "SBV: Soft constraints and quantifiers cannot be mixed!" , " Quantified variables: " ++ unwords (map show foralls) , " Soft constraints : " ++ intercalate ", " (map show softAsserts) ] | True = [impAlign (letShift combined) ++ replicate noOfCloseParens ')'] where namedAsserts = [findName attrs | (_, attrs, _) <- assertions, not (null attrs)] where findName attrs = fromMaybe "" (listToMaybe [nm | (":named", nm) <- attrs]) hardAsserts = [(attr, v) | (False, attr, v) <- assertions] softAsserts = [(attr, v) | (True, attr, v) <- assertions] combined = case map snd hardAsserts of [x] -> x xs -> "(and " ++ unwords xs ++ ")" impAlign s | null delayedEqualities = s | True = " " ++ s align n s = replicate n ' ' ++ s -- We have: -- - cstrs : Explicitly given constraints (via calls to constrain) -- - p1..pn : The path conditions in a case-split that led us here. This is given in a case-split. -- - c1..cm : All the other case-split constraints for the coverage case. This is in a case-coverage. -- if sat: -- -- we assert (cstrs /\ (p1 /\ p2 /\ ... /\ pn) /\ ~(c1 \/ c2 \/ .. \/ cm) /\ out) -- i.e., cstrs /\ p1 /\ p2 /\ ... /\ pn /\ ~c1 /\ ~c2 /\ ~c3 .. /\ ~cm /\ out -- if prove: -- -- we assert ~((cstrs /\ (p1 /\ p2 /\ .. /\ pn) /\ ~(c1 \/ c2 \/ .. \/ cm)) => out) -- i.e., cstrs /\ p1 /\ p2 /\ .. /\ pn /\ ~c1 /\ ~c2 /\ ~c3 .. /\ ~cm /\ ~out -- That is, we always assert all path constraints and path conditions AND -- -- negation of the output in a prove -- -- output itself in a sat assertions :: [(Bool, [(String, String)], String)] assertions | null finals = [(False, [], cvtSW skolemMap trueSW)] | True = finals where finals = cstrs' ++ maybe [] (\r -> [(False, [], r)]) mbO cstrs' = [(isSoft, attrs, c') | (isSoft, attrs, c) <- cstrs, Just c' <- [pos c]] mbO | isSat = pos out | True = neg out neg s | s == trueSW = Just $ cvtSW skolemMap falseSW | s == falseSW = Nothing | True = Just $ "(not " ++ cvtSW skolemMap s ++ ")" pos s | s == trueSW = Nothing | s == falseSW = Just $ cvtSW skolemMap falseSW | True = Just $ cvtSW skolemMap s skolemMap = M.fromList [(s, ss) | Right (s, ss) <- skolemInps, not (null ss)] tableMap = IM.fromList $ map mkConstTable constTables ++ map mkSkTable skolemTables where mkConstTable (((t, _, _), _), _) = (t, "table" ++ show t) mkSkTable (((t, _, _), _), _) = (t, "table" ++ show t ++ forallArgs) asgns = F.toList asgnsSeq mkAssign a | null foralls = declDef cfg skolemMap tableMap a | True = letShift (mkLet a) mkLet (s, SBVApp (Label m) [e]) = "(let ((" ++ show s ++ " " ++ cvtSW skolemMap e ++ ")) ; " ++ m mkLet (s, e) = "(let ((" ++ show s ++ " " ++ cvtExp solverCaps rm skolemMap tableMap e ++ "))" userName s = case s `lookup` map snd inputs of Just u | show s /= u -> " ; tracks user variable " ++ show u _ -> "" -- | Declare new sorts declSort :: (String, Either String [String]) -> [String] declSort (s, _) | s == "RoundingMode" -- built-in-sort; so don't declare. = [] declSort (s, Left r ) = ["(declare-sort " ++ s ++ " 0) ; N.B. Uninterpreted: " ++ r] declSort (s, Right fs) = [ "(declare-datatypes () ((" ++ s ++ " " ++ unwords (map (\c -> "(" ++ c ++ ")") fs) ++ ")))" , "(define-fun " ++ s ++ "_constrIndex ((x " ++ s ++ ")) Int" ] ++ [" " ++ body fs (0::Int)] ++ [")"] where body [] _ = "" body [_] i = show i body (c:cs) i = "(ite (= x " ++ c ++ ") " ++ show i ++ " " ++ body cs (i+1) ++ ")" -- | Convert in a query context cvtInc :: Bool -> SMTLibIncConverter [String] cvtInc afterAPush inps ks consts arrs tbls uis (SBVPgm asgnsSeq) cfg = -- sorts concatMap declSort [(s, dt) | KUserSort s dt <- Set.toList ks] -- constants ++ map (declConst cfg) consts -- inputs ++ map declInp inps -- arrays ++ concat arrayConstants -- uninterpreteds ++ concatMap declUI uis -- tables ++ concatMap (constTable afterAPush) allTables -- expressions ++ map (declDef cfg skolemMap tableMap) (F.toList asgnsSeq) -- delayed equalities ++ concat arrayDelayeds -- array setups ++ concat arraySetups where -- NB. The below setting of skolemMap to empty is OK, since we do -- not support queries in the context of skolemized variables skolemMap = M.empty rm = roundingMode cfg declInp (s, _) = "(declare-fun " ++ show s ++ " () " ++ swType s ++ ")" (arrayConstants, arrayDelayeds, arraySetups) = unzip3 $ map (declArray cfg afterAPush False consts skolemMap) arrs allTables = [(t, either id id (genTableData rm skolemMap (False, []) (map fst consts) t)) | t <- tbls] tableMap = IM.fromList $ map mkTable allTables where mkTable (((t, _, _), _), _) = (t, "table" ++ show t) declDef :: SMTConfig -> SkolemMap -> TableMap -> (SW, SBVExpr) -> String declDef cfg skolemMap tableMap (s, expr) = case expr of SBVApp (Label m) [e] -> defineFun (s, cvtSW skolemMap e) (Just m) e -> defineFun (s, cvtExp caps rm skolemMap tableMap e) Nothing where caps = capabilities (solver cfg) rm = roundingMode cfg defineFun :: (SW, String) -> Maybe String -> String defineFun (s, def) mbComment = "(define-fun " ++ varT ++ " " ++ def ++ ")" ++ cmnt where varT = show s ++ " " ++ swFunType [] s cmnt = maybe "" (" ; " ++) mbComment declConst :: SMTConfig -> (SW, CW) -> String declConst cfg (s, c) = defineFun (s, cvtCW (roundingMode cfg) c) Nothing declUI :: (String, SBVType) -> [String] declUI (i, t) = ["(declare-fun " ++ i ++ " " ++ cvtType t ++ ")"] -- NB. We perform no check to as to whether the axiom is meaningful in any way. declAx :: (String, [String]) -> String declAx (nm, ls) = (";; -- user given axiom: " ++ nm ++ "\n") ++ intercalate "\n" ls constTable :: Bool -> (((Int, Kind, Kind), [SW]), [String]) -> [String] constTable afterAPush (((i, ak, rk), _elts), is) = decl : zipWith wrap [(0::Int)..] is ++ setup where t = "table" ++ show i decl = "(declare-fun " ++ t ++ " (" ++ smtType ak ++ ") " ++ smtType rk ++ ")" -- Arrange for initializers mkInit idx = "table" ++ show i ++ "_initializer_" ++ show (idx :: Int) initializer = "table" ++ show i ++ "_initializer" wrap index s | afterAPush = "(define-fun " ++ mkInit index ++ " () Bool " ++ s ++ ")" | True = "(assert " ++ s ++ ")" lis = length is setup | not afterAPush = [] | lis == 0 = [ "(define-fun " ++ initializer ++ " () Bool true) ; no initializiation needed" ] | lis == 1 = [ "(define-fun " ++ initializer ++ " () Bool " ++ mkInit 0 ++ ")" , "(assert " ++ initializer ++ ")" ] | True = [ "(define-fun " ++ initializer ++ " () Bool (and " ++ unwords (map mkInit [0..lis - 1]) ++ "))" , "(assert " ++ initializer ++ ")" ] skolemTable :: String -> (((Int, Kind, Kind), [SW]), [String]) -> String skolemTable qsIn (((i, ak, rk), _elts), _) = decl where qs = if null qsIn then "" else qsIn ++ " " t = "table" ++ show i decl = "(declare-fun " ++ t ++ " (" ++ qs ++ smtType ak ++ ") " ++ smtType rk ++ ")" -- Left if all constants, Right if otherwise genTableData :: RoundingMode -> SkolemMap -> (Bool, String) -> [SW] -> ((Int, Kind, Kind), [SW]) -> Either [String] [String] genTableData rm skolemMap (_quantified, args) consts ((i, aknd, _), elts) | null post = Left (map (topLevel . snd) pre) | True = Right (map (nested . snd) (pre ++ post)) where ssw = cvtSW skolemMap (pre, post) = partition fst (zipWith mkElt elts [(0::Int)..]) t = "table" ++ show i mkElt x k = (isReady, (idx, ssw x)) where idx = cvtCW rm (mkConstCW aknd k) isReady = x `Set.member` constsSet topLevel (idx, v) = "(= (" ++ t ++ " " ++ idx ++ ") " ++ v ++ ")" nested (idx, v) = "(= (" ++ t ++ args ++ " " ++ idx ++ ") " ++ v ++ ")" constsSet = Set.fromList consts -- TODO: We currently do not support non-constant arrays when quantifiers are present, as -- we might have to skolemize those. Implement this properly. -- The difficulty is with the Mutate/Merge: We have to postpone an init if -- the components are themselves postponed, so this cannot be implemented as a simple map. declArray :: SMTConfig -> Bool -> Bool -> [(SW, CW)] -> SkolemMap -> (Int, ArrayInfo) -> ([String], [String], [String]) declArray cfg afterAPush quantified consts skolemMap (i, (_, (aKnd, bKnd), ctx)) = (adecl : zipWith wrap [(0::Int)..] (map snd pre), zipWith wrap [lpre..] (map snd post), setup) where constNames = map fst consts topLevel = not quantified || case ctx of ArrayFree mbi -> maybe True (`elem` constNames) mbi ArrayMutate _ a b -> all (`elem` constNames) [a, b] ArrayMerge c _ _ -> c `elem` constNames (pre, post) = partition fst ctxInfo nm = "array_" ++ show i ssw sw | topLevel || sw `elem` constNames = cvtSW skolemMap sw | True = tbd "Non-constant array initializer in a quantified context" atyp = "(Array " ++ smtType aKnd ++ " " ++ smtType bKnd ++ ")" adecl = case ctx of ArrayFree (Just v) -> "(define-fun " ++ nm ++ " () " ++ atyp ++ " ((as const " ++ atyp ++ ") " ++ constInit v ++ "))" _ -> "(declare-fun " ++ nm ++ " () " ++ atyp ++ ")" -- CVC4 chokes if the initializer is not a constant. (Z3 is ok with it.) So, print it as -- a constant if we have it in the constants; otherwise, we merely print it and hope for the best. constInit v = case v `lookup` consts of Nothing -> ssw v -- Z3 will work, CVC4 will choke. Others don't even support this. Just c -> cvtCW (roundingMode cfg) c -- Z3 and CVC4 will work. Other's don't support this. ctxInfo = case ctx of ArrayFree _ -> [] ArrayMutate j a b -> [(all (`elem` constNames) [a, b], "(= " ++ nm ++ " (store array_" ++ show j ++ " " ++ ssw a ++ " " ++ ssw b ++ "))")] ArrayMerge t j k -> [(t `elem` constNames, "(= " ++ nm ++ " (ite " ++ ssw t ++ " array_" ++ show j ++ " array_" ++ show k ++ "))")] -- Arrange for initializers mkInit idx = "array_" ++ show i ++ "_initializer_" ++ show (idx :: Int) initializer = "array_" ++ show i ++ "_initializer" wrap index s | afterAPush = "(define-fun " ++ mkInit index ++ " () Bool " ++ s ++ ")" | True = "(assert " ++ s ++ ")" lpre = length pre lAll = lpre + length post setup | not afterAPush = [] | lAll == 0 = [ "(define-fun " ++ initializer ++ " () Bool true) ; no initializiation needed" ] | lAll == 1 = [ "(define-fun " ++ initializer ++ " () Bool " ++ mkInit 0 ++ ")" , "(assert " ++ initializer ++ ")" ] | True = [ "(define-fun " ++ initializer ++ " () Bool (and " ++ unwords (map mkInit [0..lAll - 1]) ++ "))" , "(assert " ++ initializer ++ ")" ] swType :: SW -> String swType s = smtType (kindOf s) swFunType :: [SW] -> SW -> String swFunType ss s = "(" ++ unwords (map swType ss) ++ ") " ++ swType s cvtType :: SBVType -> String cvtType (SBVType []) = error "SBV.SMT.SMTLib2.cvtType: internal: received an empty type!" cvtType (SBVType xs) = "(" ++ unwords (map smtType body) ++ ") " ++ smtType ret where (body, ret) = (init xs, last xs) type SkolemMap = M.Map SW [SW] type TableMap = IM.IntMap String cvtSW :: SkolemMap -> SW -> String cvtSW skolemMap s | Just ss <- s `M.lookup` skolemMap = "(" ++ show s ++ concatMap ((" " ++) . show) ss ++ ")" | True = show s cvtCW :: RoundingMode -> CW -> String cvtCW = cwToSMTLib getTable :: TableMap -> Int -> String getTable m i | Just tn <- i `IM.lookup` m = tn | True = "table" ++ show i -- constant tables are always named this way cvtExp :: SolverCapabilities -> RoundingMode -> SkolemMap -> TableMap -> SBVExpr -> String cvtExp caps rm skolemMap tableMap expr@(SBVApp _ arguments) = sh expr where ssw = cvtSW skolemMap supportsPB = supportsPseudoBooleans caps bvOp = all isBounded arguments intOp = any isInteger arguments realOp = any isReal arguments doubleOp = any isDouble arguments floatOp = any isFloat arguments boolOp = all isBoolean arguments charOp = any isChar arguments stringOp = any isString arguments listOp = any isList arguments bad | intOp = error $ "SBV.SMTLib2: Unsupported operation on unbounded integers: " ++ show expr | True = error $ "SBV.SMTLib2: Unsupported operation on real values: " ++ show expr ensureBVOrBool = bvOp || boolOp || bad ensureBV = bvOp || bad addRM s = s ++ " " ++ smtRoundingMode rm -- lift a binary op lift2 o _ [x, y] = "(" ++ o ++ " " ++ x ++ " " ++ y ++ ")" lift2 o _ sbvs = error $ "SBV.SMTLib2.sh.lift2: Unexpected arguments: " ++ show (o, sbvs) -- lift an arbitrary arity operator liftN o _ xs = "(" ++ o ++ " " ++ unwords xs ++ ")" -- lift a binary operation with rounding-mode added; used for floating-point arithmetic lift2WM o fo | doubleOp || floatOp = lift2 (addRM fo) | True = lift2 o lift1FP o fo | doubleOp || floatOp = lift1 fo | True = lift1 o liftAbs sgned args | doubleOp || floatOp = lift1 "fp.abs" sgned args | intOp = lift1 "abs" sgned args | bvOp, sgned = mkAbs (head args) "bvslt" "bvneg" | bvOp = head args | True = mkAbs (head args) "<" "-" where mkAbs x cmp neg = "(ite " ++ ltz ++ " " ++ nx ++ " " ++ x ++ ")" where ltz = "(" ++ cmp ++ " " ++ x ++ " " ++ z ++ ")" nx = "(" ++ neg ++ " " ++ x ++ ")" z = cvtCW rm (mkConstCW (kindOf (head arguments)) (0::Integer)) lift2B bOp vOp | boolOp = lift2 bOp | True = lift2 vOp lift1B bOp vOp | boolOp = lift1 bOp | True = lift1 vOp eqBV = lift2 "=" neqBV = liftN "distinct" equal sgn sbvs | doubleOp = lift2 "fp.eq" sgn sbvs | floatOp = lift2 "fp.eq" sgn sbvs | True = lift2 "=" sgn sbvs notEqual sgn sbvs | doubleOp = liftP sbvs | floatOp = liftP sbvs | True = liftN "distinct" sgn sbvs where liftP [_, _] = "(not " ++ equal sgn sbvs ++ ")" liftP args = "(and " ++ unwords (walk args) ++ ")" walk [] = [] walk (e:es) = map (pair e) es ++ walk es pair e1 e2 = "(not (fp.eq " ++ e1 ++ " " ++ e2 ++ "))" lift2S oU oS sgn = lift2 (if sgn then oS else oU) sgn liftNS oU oS sgn = liftN (if sgn then oS else oU) sgn lift2Cmp o fo | doubleOp || floatOp = lift2 fo | True = lift2 o unintComp o [a, b] | KUserSort s (Right _) <- kindOf (head arguments) = let idx v = "(" ++ s ++ "_constrIndex " ++ v ++ ")" in "(" ++ o ++ " " ++ idx a ++ " " ++ idx b ++ ")" unintComp o sbvs = error $ "SBV.SMT.SMTLib2.sh.unintComp: Unexpected arguments: " ++ show (o, sbvs) -- NB. String comparisons are currently not supported by Z3; but will be with the new logic. stringCmp swap o [a, b] | KString <- kindOf (head arguments) = let [a1, a2] | swap = [b, a] | True = [a, b] in "(" ++ o ++ " " ++ a1 ++ " " ++ a2 ++ ")" stringCmp _ o sbvs = error $ "SBV.SMT.SMTLib2.sh.stringCmp: Unexpected arguments: " ++ show (o, sbvs) -- NB. Likewise for sequences seqCmp swap o [a, b] | KList{} <- kindOf (head arguments) = let [a1, a2] | swap = [b, a] | True = [a, b] in "(" ++ o ++ " " ++ a1 ++ " " ++ a2 ++ ")" seqCmp _ o sbvs = error $ "SBV.SMT.SMTLib2.sh.seqCmp: Unexpected arguments: " ++ show (o, sbvs) lift1 o _ [x] = "(" ++ o ++ " " ++ x ++ ")" lift1 o _ sbvs = error $ "SBV.SMT.SMTLib2.sh.lift1: Unexpected arguments: " ++ show (o, sbvs) sh (SBVApp Ite [a, b, c]) = "(ite " ++ ssw a ++ " " ++ ssw b ++ " " ++ ssw c ++ ")" sh (SBVApp (LkUp (t, aKnd, _, l) i e) []) | needsCheck = "(ite " ++ cond ++ ssw e ++ " " ++ lkUp ++ ")" | True = lkUp where needsCheck = case aKnd of KBool -> (2::Integer) > fromIntegral l KBounded _ n -> (2::Integer)^n > fromIntegral l KUnbounded -> True KReal -> error "SBV.SMT.SMTLib2.cvtExp: unexpected real valued index" KFloat -> error "SBV.SMT.SMTLib2.cvtExp: unexpected float valued index" KDouble -> error "SBV.SMT.SMTLib2.cvtExp: unexpected double valued index" KChar -> error "SBV.SMT.SMTLib2.cvtExp: unexpected char valued index" KString -> error "SBV.SMT.SMTLib2.cvtExp: unexpected string valued index" KList k -> error $ "SBV.SMT.SMTLib2.cvtExp: unexpected list valued: " ++ show k KUserSort s _ -> error $ "SBV.SMT.SMTLib2.cvtExp: unexpected uninterpreted valued index: " ++ s lkUp = "(" ++ getTable tableMap t ++ " " ++ ssw i ++ ")" cond | hasSign i = "(or " ++ le0 ++ " " ++ gtl ++ ") " | True = gtl ++ " " (less, leq) = case aKnd of KBool -> error "SBV.SMT.SMTLib2.cvtExp: unexpected boolean valued index" KBounded{} -> if hasSign i then ("bvslt", "bvsle") else ("bvult", "bvule") KUnbounded -> ("<", "<=") KReal -> ("<", "<=") KFloat -> ("fp.lt", "fp.leq") KDouble -> ("fp.lt", "fp.geq") KChar -> error "SBV.SMT.SMTLib2.cvtExp: unexpected string valued index" KString -> error "SBV.SMT.SMTLib2.cvtExp: unexpected string valued index" KList k -> error $ "SBV.SMT.SMTLib2.cvtExp: unexpected sequence valued index: " ++ show k KUserSort s _ -> error $ "SBV.SMT.SMTLib2.cvtExp: unexpected uninterpreted valued index: " ++ s mkCnst = cvtCW rm . mkConstCW (kindOf i) le0 = "(" ++ less ++ " " ++ ssw i ++ " " ++ mkCnst 0 ++ ")" gtl = "(" ++ leq ++ " " ++ mkCnst l ++ " " ++ ssw i ++ ")" sh (SBVApp (KindCast f t) [a]) = handleKindCast f t (ssw a) sh (SBVApp (ArrEq i j) []) = "(= array_" ++ show i ++ " array_" ++ show j ++")" sh (SBVApp (ArrRead i) [a]) = "(select array_" ++ show i ++ " " ++ ssw a ++ ")" sh (SBVApp (Uninterpreted nm) []) = nm sh (SBVApp (Uninterpreted nm) args) = "(" ++ nm ++ " " ++ unwords (map ssw args) ++ ")" sh (SBVApp (Extract i j) [a]) | ensureBV = "((_ extract " ++ show i ++ " " ++ show j ++ ") " ++ ssw a ++ ")" sh (SBVApp (Rol i) [a]) | bvOp = rot ssw "rotate_left" i a | True = bad sh (SBVApp (Ror i) [a]) | bvOp = rot ssw "rotate_right" i a | True = bad sh (SBVApp Shl [a, i]) | bvOp = shft ssw "bvshl" "bvshl" a i | True = bad sh (SBVApp Shr [a, i]) | bvOp = shft ssw "bvlshr" "bvashr" a i | True = bad sh (SBVApp op args) | Just f <- lookup op smtBVOpTable, ensureBVOrBool = f (any hasSign args) (map ssw args) where -- The first 4 operators below do make sense for Integer's in Haskell, but there's -- no obvious counterpart for them in the SMTLib translation. -- TODO: provide support for these. smtBVOpTable = [ (And, lift2B "and" "bvand") , (Or, lift2B "or" "bvor") , (XOr, lift2B "xor" "bvxor") , (Not, lift1B "not" "bvnot") , (Join, lift2 "concat") ] sh (SBVApp (Label _) [a]) = cvtSW skolemMap a -- This won't be reached; but just in case! sh (SBVApp (IEEEFP (FP_Cast kFrom kTo m)) args) = handleFPCast kFrom kTo (ssw m) (unwords (map ssw args)) sh (SBVApp (IEEEFP w ) args) = "(" ++ show w ++ " " ++ unwords (map ssw args) ++ ")" sh (SBVApp (PseudoBoolean pb) args) | supportsPB = handlePB pb args' | True = reducePB pb args' where args' = map ssw args -- NB: Z3 semantics have the predicates reversed: i.e., it returns true if overflow isn't possible. Hence the not. sh (SBVApp (OverflowOp op) args) = "(not (" ++ show op ++ " " ++ unwords (map ssw args) ++ "))" -- Note the unfortunate reversal in StrInRe.. sh (SBVApp (StrOp (StrInRe r)) args) = "(str.in.re " ++ unwords (map ssw args) ++ " " ++ show r ++ ")" sh (SBVApp (StrOp op) args) = "(" ++ show op ++ " " ++ unwords (map ssw args) ++ ")" sh (SBVApp (SeqOp op) args) = "(" ++ show op ++ " " ++ unwords (map ssw args) ++ ")" sh inp@(SBVApp op args) | intOp, Just f <- lookup op smtOpIntTable = f True (map ssw args) | boolOp, Just f <- lookup op boolComps = f (map ssw args) | bvOp, Just f <- lookup op smtOpBVTable = f (any hasSign args) (map ssw args) | realOp, Just f <- lookup op smtOpRealTable = f (any hasSign args) (map ssw args) | floatOp || doubleOp, Just f <- lookup op smtOpFloatDoubleTable = f (any hasSign args) (map ssw args) | charOp, Just f <- lookup op smtCharTable = f False (map ssw args) | stringOp, Just f <- lookup op smtStringTable = f (map ssw args) | listOp, Just f <- lookup op smtListTable = f (map ssw args) | Just f <- lookup op uninterpretedTable = f (map ssw args) | True = if not (null args) && isUninterpreted (head args) then error $ unlines [ "" , "*** Cannot translate operator : " ++ show op , "*** When applied to arguments of kind: " ++ intercalate ", " (nub (map (show . kindOf) args)) , "*** Found as part of the expression : " ++ show inp , "***" , "*** Note that uninterpreted kinds only support equality." , "*** If you believe this is in error, please report!" ] else error $ "SBV.SMT.SMTLib2.cvtExp.sh: impossible happened; can't translate: " ++ show inp where smtOpBVTable = [ (Plus, lift2 "bvadd") , (Minus, lift2 "bvsub") , (Times, lift2 "bvmul") , (UNeg, lift1B "not" "bvneg") , (Abs, liftAbs) , (Quot, lift2S "bvudiv" "bvsdiv") , (Rem, lift2S "bvurem" "bvsrem") , (Equal, eqBV) , (NotEqual, neqBV) , (LessThan, lift2S "bvult" "bvslt") , (GreaterThan, lift2S "bvugt" "bvsgt") , (LessEq, lift2S "bvule" "bvsle") , (GreaterEq, lift2S "bvuge" "bvsge") ] -- Boolean comparisons.. SMTLib's bool type doesn't do comparisons, but Haskell does.. Sigh boolComps = [ (LessThan, blt) , (GreaterThan, blt . swp) , (LessEq, blq) , (GreaterEq, blq . swp) ] where blt [x, y] = "(and (not " ++ x ++ ") " ++ y ++ ")" blt xs = error $ "SBV.SMT.SMTLib2.boolComps.blt: Impossible happened, incorrect arity (expected 2): " ++ show xs blq [x, y] = "(or (not " ++ x ++ ") " ++ y ++ ")" blq xs = error $ "SBV.SMT.SMTLib2.boolComps.blq: Impossible happened, incorrect arity (expected 2): " ++ show xs swp [x, y] = [y, x] swp xs = error $ "SBV.SMT.SMTLib2.boolComps.swp: Impossible happened, incorrect arity (expected 2): " ++ show xs smtOpRealTable = smtIntRealShared ++ [ (Quot, lift2WM "/" "fp.div") ] smtOpIntTable = smtIntRealShared ++ [ (Quot, lift2 "div") , (Rem, lift2 "mod") ] smtOpFloatDoubleTable = smtIntRealShared ++ [(Quot, lift2WM "/" "fp.div")] smtIntRealShared = [ (Plus, lift2WM "+" "fp.add") , (Minus, lift2WM "-" "fp.sub") , (Times, lift2WM "*" "fp.mul") , (UNeg, lift1FP "-" "fp.neg") , (Abs, liftAbs) , (Equal, equal) , (NotEqual, notEqual) , (LessThan, lift2Cmp "<" "fp.lt") , (GreaterThan, lift2Cmp ">" "fp.gt") , (LessEq, lift2Cmp "<=" "fp.leq") , (GreaterEq, lift2Cmp ">=" "fp.geq") ] -- equality and comparisons are the only thing that works on uninterpreted sorts and pretty much everything else uninterpretedTable = [ (Equal, lift2S "=" "=" True) , (NotEqual, liftNS "distinct" "distinct" True) , (LessThan, unintComp "<") , (GreaterThan, unintComp ">") , (LessEq, unintComp "<=") , (GreaterEq, unintComp ">=") ] -- For chars, the underlying type is currently SWord8, so we go with the regular bit-vector operations -- TODO: This will change when we move to unicode! smtCharTable = [ (Equal, eqBV) , (NotEqual, neqBV) , (LessThan, lift2S "bvult" (error "smtChar.<: did-not expect signed char here!")) , (GreaterThan, lift2S "bvugt" (error "smtChar.>: did-not expect signed char here!")) , (LessEq, lift2S "bvule" (error "smtChar.<=: did-not expect signed char here!")) , (GreaterEq, lift2S "bvuge" (error "smtChar.>=: did-not expect signed char here!")) ] -- For strings, equality and comparisons are the only operators -- TODO: The string comparison operators will most likely change with the new theory! smtStringTable = [ (Equal, lift2S "=" "=" True) , (NotEqual, liftNS "distinct" "distinct" True) , (LessThan, stringCmp False "str.<") , (GreaterThan, stringCmp True "str.<") , (LessEq, stringCmp False "str.<=") , (GreaterEq, stringCmp True "str.<=") ] -- For lists, equality is really the only operator -- Likewise here, things might change for comparisons smtListTable = [ (Equal, lift2S "=" "=" True) , (NotEqual, liftNS "distinct" "distinct" True) , (LessThan, seqCmp False "seq.<") , (GreaterThan, seqCmp True "seq.<") , (LessEq, seqCmp False "seq.<=") , (GreaterEq, seqCmp True "seq.<=") ] ----------------------------------------------------------------------------------------------- -- Casts supported by SMTLib. (From: ) -- ; from another floating point sort -- ((_ to_fp eb sb) RoundingMode (_ FloatingPoint mb nb) (_ FloatingPoint eb sb)) -- -- ; from real -- ((_ to_fp eb sb) RoundingMode Real (_ FloatingPoint eb sb)) -- -- ; from signed machine integer, represented as a 2's complement bit vector -- ((_ to_fp eb sb) RoundingMode (_ BitVec m) (_ FloatingPoint eb sb)) -- -- ; from unsigned machine integer, represented as bit vector -- ((_ to_fp_unsigned eb sb) RoundingMode (_ BitVec m) (_ FloatingPoint eb sb)) -- -- ; to unsigned machine integer, represented as a bit vector -- ((_ fp.to_ubv m) RoundingMode (_ FloatingPoint eb sb) (_ BitVec m)) -- -- ; to signed machine integer, represented as a 2's complement bit vector -- ((_ fp.to_sbv m) RoundingMode (_ FloatingPoint eb sb) (_ BitVec m)) -- -- ; to real -- (fp.to_real (_ FloatingPoint eb sb) Real) ----------------------------------------------------------------------------------------------- handleFPCast :: Kind -> Kind -> String -> String -> String handleFPCast kFrom kTo rm input | kFrom == kTo = input | True = "(" ++ cast kFrom kTo input ++ ")" where addRM a s = s ++ " " ++ rm ++ " " ++ a absRM a s = "ite (fp.isNegative " ++ a ++ ") (" ++ cvt1 ++ ") (" ++ cvt2 ++ ")" where cvt1 = "bvneg (" ++ s ++ " " ++ rm ++ " (fp.abs " ++ a ++ "))" cvt2 = s ++ " " ++ rm ++ " " ++ a -- To go and back from Ints, we detour through reals cast KUnbounded KFloat a = "(_ to_fp 8 24) " ++ rm ++ " (to_real " ++ a ++ ")" cast KUnbounded KDouble a = "(_ to_fp 11 53) " ++ rm ++ " (to_real " ++ a ++ ")" cast KFloat KUnbounded a = "to_int (fp.to_real " ++ a ++ ")" cast KDouble KUnbounded a = "to_int (fp.to_real " ++ a ++ ")" -- To float/double cast (KBounded False _) KFloat a = addRM a "(_ to_fp_unsigned 8 24)" cast (KBounded False _) KDouble a = addRM a "(_ to_fp_unsigned 11 53)" cast (KBounded True _) KFloat a = addRM a "(_ to_fp 8 24)" cast (KBounded True _) KDouble a = addRM a "(_ to_fp 11 53)" cast KReal KFloat a = addRM a "(_ to_fp 8 24)" cast KReal KDouble a = addRM a "(_ to_fp 11 53)" -- Between floats cast KFloat KFloat a = addRM a "(_ to_fp 8 24)" cast KFloat KDouble a = addRM a "(_ to_fp 11 53)" cast KDouble KFloat a = addRM a "(_ to_fp 8 24)" cast KDouble KDouble a = addRM a "(_ to_fp 11 53)" -- From float/double cast KFloat (KBounded False m) a = absRM a $ "(_ fp.to_ubv " ++ show m ++ ")" cast KDouble (KBounded False m) a = absRM a $ "(_ fp.to_ubv " ++ show m ++ ")" cast KFloat (KBounded True m) a = addRM a $ "(_ fp.to_sbv " ++ show m ++ ")" cast KDouble (KBounded True m) a = addRM a $ "(_ fp.to_sbv " ++ show m ++ ")" cast KFloat KReal a = "fp.to_real" ++ " " ++ a cast KDouble KReal a = "fp.to_real" ++ " " ++ a -- Nothing else should come up: cast f d _ = error $ "SBV.SMTLib2: Unexpected FPCast from: " ++ show f ++ " to " ++ show d rot :: (SW -> String) -> String -> Int -> SW -> String rot ssw o c x = "((_ " ++ o ++ " " ++ show c ++ ") " ++ ssw x ++ ")" shft :: (SW -> String) -> String -> String -> SW -> SW -> String shft ssw oW oS x c = "(" ++ o ++ " " ++ ssw x ++ " " ++ ssw c ++ ")" where o = if hasSign x then oS else oW -- Various casts handleKindCast :: Kind -> Kind -> String -> String handleKindCast kFrom kTo a | kFrom == kTo = a | True = case kFrom of KBounded s m -> case kTo of KBounded _ n -> fromBV (if s then signExtend else zeroExtend) m n KUnbounded -> b2i s m _ -> tryFPCast KUnbounded -> case kTo of KReal -> "(to_real " ++ a ++ ")" KBounded _ n -> i2b n _ -> tryFPCast KReal -> case kTo of KUnbounded -> "(to_int " ++ a ++ ")" _ -> tryFPCast _ -> tryFPCast where -- See if we can push this down to a float-cast, using sRNE. This happens if one of the kinds is a float/double. -- Otherwise complain tryFPCast | any (\k -> isFloat k || isDouble k) [kFrom, kTo] = handleFPCast kFrom kTo (smtRoundingMode RoundNearestTiesToEven) a | True = error $ "SBV.SMTLib2: Unexpected cast from: " ++ show kFrom ++ " to " ++ show kTo fromBV upConv m n | n > m = upConv (n - m) | m == n = a | True = extract (n - 1) -- NB. The following works regardless n < 0 or not, because the first thing we -- do is to compute "reduced" to bring it down to the correct range. It also works -- regardless were mapping to signed or unsigned bit-vector; because the representation -- is the same. -- -- NB2. (TODO) There is an SMTLib equivalent of this function, called int2bv. However, it -- used to be uninterpreted for a long time by Z3; though I think that got fixed. We -- might want to simply use that if it's reliably available across the board in solvers. i2b n = "(let (" ++ reduced ++ ") (let (" ++ defs ++ ") " ++ body ++ "))" where b i = show (bit i :: Integer) reduced = "(__a (mod " ++ a ++ " " ++ b n ++ "))" mkBit 0 = "(__a0 (ite (= (mod __a 2) 0) #b0 #b1))" mkBit i = "(__a" ++ show i ++ " (ite (= (mod (div __a " ++ b i ++ ") 2) 0) #b0 #b1))" defs = unwords (map mkBit [0 .. n - 1]) body = foldr1 (\c r -> "(concat " ++ c ++ " " ++ r ++ ")") ["__a" ++ show i | i <- [n-1, n-2 .. 0]] b2i s m | s = "(- " ++ val ++ " " ++ valIf (2^m) sign ++ ")" | True = val where valIf v b = "(ite (= " ++ b ++ " #b1) " ++ show (v::Integer) ++ " 0)" getBit i = "((_ extract " ++ show i ++ " " ++ show i ++ ") " ++ a ++ ")" bitVal i = valIf (2^i) (getBit i) val = "(+ " ++ unwords (map bitVal [0 .. m-1]) ++ ")" sign = getBit (m-1) signExtend i = "((_ sign_extend " ++ show i ++ ") " ++ a ++ ")" zeroExtend i = "((_ zero_extend " ++ show i ++ ") " ++ a ++ ")" extract i = "((_ extract " ++ show i ++ " 0) " ++ a ++ ")" -- Translation of pseudo-booleans, in case the solver supports them handlePB :: PBOp -> [String] -> String handlePB (PB_AtMost k) args = "((_ at-most " ++ show k ++ ") " ++ unwords args ++ ")" handlePB (PB_AtLeast k) args = "((_ at-least " ++ show k ++ ") " ++ unwords args ++ ")" handlePB (PB_Exactly k) args = "((_ pbeq " ++ unwords (map show (k : replicate (length args) 1)) ++ ") " ++ unwords args ++ ")" handlePB (PB_Eq cs k) args = "((_ pbeq " ++ unwords (map show (k : cs)) ++ ") " ++ unwords args ++ ")" handlePB (PB_Le cs k) args = "((_ pble " ++ unwords (map show (k : cs)) ++ ") " ++ unwords args ++ ")" handlePB (PB_Ge cs k) args = "((_ pbge " ++ unwords (map show (k : cs)) ++ ") " ++ unwords args ++ ")" -- Translation of pseudo-booleans, in case the solver does *not* support them reducePB :: PBOp -> [String] -> String reducePB op args = case op of PB_AtMost k -> "(<= " ++ addIf (repeat 1) ++ " " ++ show k ++ ")" PB_AtLeast k -> "(>= " ++ addIf (repeat 1) ++ " " ++ show k ++ ")" PB_Exactly k -> "(= " ++ addIf (repeat 1) ++ " " ++ show k ++ ")" PB_Le cs k -> "(<= " ++ addIf cs ++ " " ++ show k ++ ")" PB_Ge cs k -> "(>= " ++ addIf cs ++ " " ++ show k ++ ")" PB_Eq cs k -> "(= " ++ addIf cs ++ " " ++ show k ++ ")" where addIf :: [Int] -> String addIf cs = "(+ " ++ unwords ["(ite " ++ a ++ " " ++ show c ++ " 0)" | (a, c) <- zip args cs] ++ ")" sbv-7.13/Data/SBV/SMT/SMTLibNames.hs0000644000000000000000000000274613405536617015027 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.SMT.SMTLibNames -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- SMTLib Reserved names ----------------------------------------------------------------------------- module Data.SBV.SMT.SMTLibNames where import Data.Char (toLower) -- | Names reserved by SMTLib. This list is current as of Dec 6 2015; but of course -- there's no guarantee it'll stay that way. smtLibReservedNames :: [String] smtLibReservedNames = map (map toLower) [ "Int", "Real", "List", "Array", "Bool", "FP", "FloatingPoint", "fp", "String" , "!", "_", "as", "BINARY", "DECIMAL", "exists", "HEXADECIMAL", "forall", "let", "NUMERAL", "par", "STRING", "CHAR" , "assert", "check-sat", "check-sat-assuming", "declare-const", "declare-fun", "declare-sort", "define-fun", "define-fun-rec" , "define-sort", "echo", "exit", "get-assertions", "get-assignment", "get-info", "get-model", "get-option", "get-proof", "get-unsat-assumptions" , "get-unsat-core", "get-value", "pop", "push", "reset", "reset-assertions", "set-info", "set-logic", "set-option", "match" -- -- The following are most likely Z3 specific , "interval", "assert-soft" ] sbv-7.13/Data/SBV/SMT/Utils.hs0000644000000000000000000002265313405536617014050 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.SMT.Utils -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- A few internally used types/routines ----------------------------------------------------------------------------- {-# LANGUAGE NamedFieldPuns #-} module Data.SBV.SMT.Utils ( SMTLibConverter , SMTLibIncConverter , addAnnotations , showTimeoutValue , alignDiagnostic , alignPlain , debug , mergeSExpr , SBVException(..) ) where import qualified Control.Exception as C import Data.SBV.Core.Data import Data.SBV.Utils.Lib (joinArgs) import Data.List (intercalate) import qualified Data.Set as Set (Set) import System.Exit (ExitCode(..)) -- | An instance of SMT-Lib converter; instantiated for SMT-Lib v1 and v2. (And potentially for newer versions in the future.) type SMTLibConverter a = Set.Set Kind -- ^ Kinds used in the problem -> Bool -- ^ is this a sat problem? -> [String] -- ^ extra comments to place on top -> ([(Quantifier, NamedSymVar)], [NamedSymVar]) -- ^ inputs and aliasing names and trackers -> [Either SW (SW, [SW])] -- ^ skolemized inputs -> [(SW, CW)] -- ^ constants -> [((Int, Kind, Kind), [SW])] -- ^ auto-generated tables -> [(Int, ArrayInfo)] -- ^ user specified arrays -> [(String, SBVType)] -- ^ uninterpreted functions/constants -> [(String, [String])] -- ^ user given axioms -> SBVPgm -- ^ assignments -> [(Bool, [(String, String)], SW)] -- ^ extra constraints -> SW -- ^ output variable -> SMTConfig -- ^ configuration -> a -- | An instance of SMT-Lib converter; instantiated for SMT-Lib v1 and v2. (And potentially for newer versions in the future.) type SMTLibIncConverter a = [NamedSymVar] -- ^ inputs -> Set.Set Kind -- ^ Newly registered kinds -> [(SW, CW)] -- ^ constants -> [(Int, ArrayInfo)] -- ^ newly created arrays -> [((Int, Kind, Kind), [SW])] -- ^ newly created tables -> [(String, SBVType)] -- ^ newly created uninterpreted functions/constants -> SBVPgm -- ^ assignments -> SMTConfig -- ^ configuration -> a -- | Create an annotated term addAnnotations :: [(String, String)] -> String -> String addAnnotations [] x = x addAnnotations atts x = "(! " ++ x ++ " " ++ unwords (map mkAttr atts) ++ ")" where mkAttr (a, v) = a ++ " |" ++ concatMap sanitize v ++ "|" sanitize '|' = "_bar_" sanitize '\\' = "_backslash_" sanitize c = [c] -- | Show a millisecond time-out value somewhat nicely showTimeoutValue :: Int -> String showTimeoutValue i = case (i `quotRem` 1000000, i `quotRem` 500000) of ((s, 0), _) -> shows s "s" (_, (hs, 0)) -> shows (fromIntegral hs / (2::Float)) "s" _ -> shows i "ms" -- | Nicely align a potentially multi-line message with some tag, but prefix with three stars alignDiagnostic :: String -> String -> String alignDiagnostic = alignWithPrefix "*** " -- | Nicely align a potentially multi-line message with some tag, no prefix. alignPlain :: String -> String -> String alignPlain = alignWithPrefix "" -- | Align with some given prefix alignWithPrefix :: String -> String -> String -> String alignWithPrefix pre tag multi = intercalate "\n" $ zipWith (++) (tag : repeat (pre ++ replicate (length tag - length pre) ' ')) (filter (not . null) (lines multi)) -- | Diagnostic message when verbose debug :: SMTConfig -> [String] -> IO () debug cfg | not (verbose cfg) = const (return ()) | Just f <- redirectVerbose cfg = mapM_ (appendFile f . (++ "\n")) | True = mapM_ putStrLn -- | In case the SMT-Lib solver returns a response over multiple lines, compress them so we have -- each S-Expression spanning only a single line. mergeSExpr :: [String] -> [String] mergeSExpr [] = [] mergeSExpr (x:xs) | d == 0 = x : mergeSExpr xs | True = let (f, r) = grab d xs in unlines (x:f) : mergeSExpr r where d = parenDiff x parenDiff :: String -> Int parenDiff = go 0 where go i "" = i go i ('(':cs) = let i'= i+1 in i' `seq` go i' cs go i (')':cs) = let i'= i-1 in i' `seq` go i' cs go i ('"':cs) = go i (skipString cs) go i ('|':cs) = go i (skipBar cs) go i (_ :cs) = go i cs grab i ls | i <= 0 = ([], ls) grab _ [] = ([], []) grab i (l:ls) = let (a, b) = grab (i+parenDiff l) ls in (l:a, b) skipString ('"':'"':cs) = skipString cs skipString ('"':cs) = cs skipString (_:cs) = skipString cs skipString [] = [] -- Oh dear, line finished, but the string didn't. We're in trouble. Ignore! skipBar ('|':cs) = cs skipBar (_:cs) = skipBar cs skipBar [] = [] -- Oh dear, line finished, but the string didn't. We're in trouble. Ignore! -- | An exception thrown from SBV. If the solver ever responds with a non-success value for a command, -- SBV will throw an 'SBVException', it so the user can process it as required. The provided 'Show' instance -- will render the failure nicely. Note that if you ever catch this exception, the solver is no longer alive: -- You should either -- throw the exception up, or do other proper clean-up before continuing. data SBVException = SBVException { sbvExceptionDescription :: String , sbvExceptionSent :: Maybe String , sbvExceptionExpected :: Maybe String , sbvExceptionReceived :: Maybe String , sbvExceptionStdOut :: Maybe String , sbvExceptionStdErr :: Maybe String , sbvExceptionExitCode :: Maybe ExitCode , sbvExceptionConfig :: SMTConfig , sbvExceptionReason :: Maybe [String] , sbvExceptionHint :: Maybe [String] } -- | SBVExceptions are throwable. A simple "show" will render this exception nicely -- though of course you can inspect the individual fields as necessary. instance C.Exception SBVException -- | A fairly nice rendering of the exception, for display purposes. instance Show SBVException where show SBVException { sbvExceptionDescription , sbvExceptionSent , sbvExceptionExpected , sbvExceptionReceived , sbvExceptionStdOut , sbvExceptionStdErr , sbvExceptionExitCode , sbvExceptionConfig , sbvExceptionReason , sbvExceptionHint } = let grp1 = [ "" , "*** Data.SBV: " ++ sbvExceptionDescription ++ ":" ] grp2 = ["*** Sent : " `alignDiagnostic` snt | Just snt <- [sbvExceptionSent], not $ null snt ] ++ ["*** Expected : " `alignDiagnostic` excp | Just excp <- [sbvExceptionExpected], not $ null excp] ++ ["*** Received : " `alignDiagnostic` rcvd | Just rcvd <- [sbvExceptionReceived], not $ null rcvd] grp3 = ["*** Stdout : " `alignDiagnostic` out | Just out <- [sbvExceptionStdOut], not $ null out ] ++ ["*** Stderr : " `alignDiagnostic` err | Just err <- [sbvExceptionStdErr], not $ null err ] ++ ["*** Exit code : " `alignDiagnostic` show ec | Just ec <- [sbvExceptionExitCode] ] ++ ["*** Executable: " `alignDiagnostic` executable (solver sbvExceptionConfig) ] ++ ["*** Options : " `alignDiagnostic` joinArgs (options (solver sbvExceptionConfig) sbvExceptionConfig) ] grp4 = ["*** Reason : " `alignDiagnostic` unlines rsn | Just rsn <- [sbvExceptionReason]] ++ ["*** Hint : " `alignDiagnostic` unlines hnt | Just hnt <- [sbvExceptionHint ]] join [] = [] join [x] = x join (g:gs) = case join gs of [] -> g rest -> g ++ ["***"] ++ rest in unlines $ join [grp1, grp2, grp3, grp4] sbv-7.13/Data/SBV/Tools/0000755000000000000000000000000013405536617013041 5ustar0000000000000000sbv-7.13/Data/SBV/Tools/BoundedFix.hs0000644000000000000000000000621213405536617015425 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Tools.BoundedFix -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Bounded fixed-point unrolling. ----------------------------------------------------------------------------- {-# LANGUAGE FlexibleContexts #-} module Data.SBV.Tools.BoundedFix ( bfix ) where import Data.SBV -- Doctest only: -- $setup -- >>> bfac = bfix 10 "fac" fact where fact f n = ite (n .== 0) 1 ((n :: SInteger) * f (n-1)) -- | Bounded fixed-point operation. The call @bfix bnd nm f@ unrolls the recursion in @f@ at most -- @bnd@ times, and uninterprets the function (with the name @nm@) after the bound is reached. -- -- This combinator is handy for dealing with recursive definitions that are not symbolically terminating -- and when the property we are interested in does not require an infinite unrolling, or when we are happy -- with a bounded proof. In particular, this operator can be used as a basis of software-bounded model -- checking algorithms built on top of SBV. The bound can be successively refined in a CEGAR like loop -- as necessary, by analyzing the counter-examples and rejecting them if they are false-negatives. -- -- For instance, we can define the factorial function using the bounded fixed-point operator like this: -- -- @ -- bfac :: SInteger -> SInteger -- bfac = bfix 10 "fac" fact -- where fact f n = ite (n .== 0) 1 (n * f (n-1)) -- @ -- -- This definition unrolls the recursion in factorial at most 10 times before uninterpreting the result. -- We can now prove: -- -- >>> prove $ \n -> n .>= 1 &&& n .<= 9 ==> bfac n .== n * bfac (n-1) -- Q.E.D. -- -- And we would get a bogus counter-example if the proof of our property needs a larger bound: -- -- >>> prove $ \n -> n .== 10 ==> bfac n .== 3628800 -- Falsifiable. Counter-example: -- s0 = 10 :: Integer -- -- By design, if a function defined via `bfix` is given a concrete argument, it will unroll -- the recursion as much as necessary to complete the call (which can of course diverge). The bound -- only applies if the given argument is symbolic. This fact can be used to observe concrete -- values to see where the bounded-model-checking approach fails: -- -- >>> prove $ \n -> n .== 10 ==> observe "bfac_n" (bfac n) .== observe "bfac_10" (bfac 10) -- Falsifiable. Counter-example: -- s0 = 10 :: Integer -- bfac_n = 7257600 :: Integer -- bfac_10 = 3628800 :: Integer -- -- Here, we see that the SMT solver must have decided to assign the value @2@ in the final call just -- as it was reaching the base case, and thus got the final result incorrect. (Note -- that @7257600 = 2 * 3628800@.) A wrapper algorithm can then assert the actual value of -- @bfac 10@ here as an extra constraint and can search for "deeper bugs." bfix :: (SymWord a, Uninterpreted (SBV a -> r)) => Int -> String -> ((SBV a -> r) -> (SBV a -> r)) -> SBV a -> r bfix bound nm f x | isConcrete x = g x | True = unroll bound x where g = f g unroll 0 = uninterpret nm unroll i = f (unroll (i-1)) sbv-7.13/Data/SBV/Tools/CodeGen.hs0000644000000000000000000000527613405536617014713 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Tools.CodeGen -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Code-generation from SBV programs. ----------------------------------------------------------------------------- module Data.SBV.Tools.CodeGen ( -- * Code generation from symbolic programs -- $cCodeGeneration SBVCodeGen, cgSym -- ** Setting code-generation options , cgPerformRTCs, cgSetDriverValues, cgGenerateDriver, cgGenerateMakefile, cgOverwriteFiles -- ** Designating inputs , cgInput, cgInputArr -- ** Designating outputs , cgOutput, cgOutputArr -- ** Designating return values , cgReturn, cgReturnArr -- ** Code generation with uninterpreted functions , cgAddPrototype, cgAddDecl, cgAddLDFlags, cgIgnoreSAssert -- ** Code generation with 'Data.SBV.SInteger' and 'Data.SBV.SReal' types -- $unboundedCGen , cgIntegerSize, cgSRealType, CgSRealType(..) -- ** Compilation to C , compileToC, compileToCLib ) where import Data.SBV.Compilers.C import Data.SBV.Compilers.CodeGen {- $cCodeGeneration The SBV library can generate straight-line executable code in C. (While other target languages are certainly possible, currently only C is supported.) The generated code will perform no run-time memory-allocations, (no calls to @malloc@), so its memory usage can be predicted ahead of time. Also, the functions will execute precisely the same instructions in all calls, so they have predictable timing properties as well. The generated code has no loops or jumps, and is typically quite fast. While the generated code can be large due to complete unrolling, these characteristics make them suitable for use in hard real-time systems, as well as in traditional computing. -} {- $unboundedCGen The types 'Data.SBV.SInteger' and 'Data.SBV.SReal' are unbounded quantities that have no direct counterparts in the C language. Therefore, it is not possible to generate standard C code for SBV programs using these types, unless custom libraries are available. To overcome this, SBV allows the user to explicitly set what the corresponding types should be for these two cases, using the functions below. Note that while these mappings will produce valid C code, the resulting code will be subject to overflow/underflows for 'Data.SBV.SInteger', and rounding for 'Data.SBV.SReal', so there is an implicit loss of precision. If the user does /not/ specify these mappings, then SBV will refuse to compile programs that involve these types. -} sbv-7.13/Data/SBV/Tools/GenTest.hs0000644000000000000000000004345013405536617014754 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Tools.GenTest -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test generation from symbolic programs ----------------------------------------------------------------------------- module Data.SBV.Tools.GenTest ( -- * Test case generation genTest, TestVectors, getTestValues, renderTest, TestStyle(..) ) where import Data.Bits (testBit) import Data.Char (isAlpha, toUpper) import Data.Function (on) import Data.List (intercalate, groupBy) import Data.Maybe (fromMaybe) import Data.SBV.Core.AlgReals import Data.SBV.Core.Data import Data.SBV.Utils.PrettyNum -- | Type of test vectors (abstract) newtype TestVectors = TV [([CW], [CW])] -- | Retrieve the test vectors for further processing. This function -- is useful in cases where 'renderTest' is not sufficient and custom -- output (or further preprocessing) is needed. getTestValues :: TestVectors -> [([CW], [CW])] getTestValues (TV vs) = vs -- | Generate a set of concrete test values from a symbolic program. The output -- can be rendered as test vectors in different languages as necessary. Use the -- function 'output' call to indicate what fields should be in the test result. -- (Also see 'constrain' for filtering acceptable test values.) genTest :: Outputtable a => Int -> Symbolic a -> IO TestVectors genTest n m = gen 0 [] where gen i sofar | i == n = return $ TV $ reverse sofar | True = do t <- tc gen (i+1) (t:sofar) tc = do (_, Result {resTraces=tvals, resConsts=cs, resConstraints=cstrs, resOutputs=os}) <- runSymbolic Concrete (m >>= output) let cval = fromMaybe (error "Cannot generate tests in the presence of uninterpeted constants!") . (`lookup` cs) cond = and [cwToBool (cval v) | (False, _, v) <- cstrs] -- Only pick-up "hard" constraints, as indicated by False in the fist component if cond then return (map snd tvals, map cval os) else tc -- try again, with the same set of constraints -- | Test output style data TestStyle = Haskell String -- ^ As a Haskell value with given name | C String -- ^ As a C array of structs with given name | Forte String Bool ([Int], [Int]) -- ^ As a Forte/Verilog value with given name. -- If the boolean is True then vectors are blasted big-endian, otherwise little-endian -- The indices are the split points on bit-vectors for input and output values -- | Render the test as a Haskell value with the given name @n@. renderTest :: TestStyle -> TestVectors -> String renderTest (Haskell n) (TV vs) = haskell n vs renderTest (C n) (TV vs) = c n vs renderTest (Forte n b ss) (TV vs) = forte n b ss vs haskell :: String -> [([CW], [CW])] -> String haskell vname vs = intercalate "\n" $ [ "-- Automatically generated by SBV. Do not edit!" , "" , "module " ++ modName ++ "(" ++ n ++ ") where" , "" ] ++ imports ++ [ n ++ " :: " ++ getType vs , n ++ " = [ " ++ intercalate ("\n" ++ pad ++ ", ") (map mkLine vs), pad ++ "]" ] where n | null vname = "testVectors" | not (isAlpha (head vname)) = "tv" ++ vname | True = vname imports | null vs = [] | needsInt && needsWord = ["import Data.Int", "import Data.Word", ""] | needsInt = ["import Data.Int", ""] | needsWord = ["import Data.Word", ""] | needsRatio = ["import Data.Ratio"] | True = [] where ((is, os):_) = vs params = is ++ os needsInt = any isSW params needsWord = any isUW params needsRatio = any isR params isR cw = case kindOf cw of KReal -> True _ -> False isSW cw = case kindOf cw of KBounded True _ -> True _ -> False isUW cw = case kindOf cw of KBounded False sz -> sz > 1 _ -> False modName = let (f:r) = n in toUpper f : r pad = replicate (length n + 3) ' ' getType [] = "[a]" getType ((i, o):_) = "[(" ++ mapType typeOf i ++ ", " ++ mapType typeOf o ++ ")]" mkLine (i, o) = "(" ++ mapType valOf i ++ ", " ++ mapType valOf o ++ ")" mapType f cws = mkTuple $ map f $ groupBy ((==) `on` kindOf) cws mkTuple [x] = x mkTuple xs = "(" ++ intercalate ", " xs ++ ")" typeOf [] = "()" typeOf [x] = t x typeOf (x:_) = "[" ++ t x ++ "]" valOf [] = "()" valOf [x] = s x valOf xs = "[" ++ intercalate ", " (map s xs) ++ "]" t cw = case kindOf cw of KBool -> "Bool" KBounded False 8 -> "Word8" KBounded False 16 -> "Word16" KBounded False 32 -> "Word32" KBounded False 64 -> "Word64" KBounded True 8 -> "Int8" KBounded True 16 -> "Int16" KBounded True 32 -> "Int32" KBounded True 64 -> "Int64" KUnbounded -> "Integer" KFloat -> "Float" KDouble -> "Double" KChar -> error "SBV.renderTest: Unsupported char" KString -> error "SBV.renderTest: Unsupported string" KReal -> error $ "SBV.renderTest: Unsupported real valued test value: " ++ show cw KList es -> error $ "SBV.renderTest: Unsupported list valued test: [" ++ show es ++ "]" KUserSort us _ -> error $ "SBV.renderTest: Unsupported uninterpreted sort: " ++ us _ -> error $ "SBV.renderTest: Unexpected CW: " ++ show cw s cw = case kindOf cw of KBool -> take 5 (show (cwToBool cw) ++ repeat ' ') KBounded sgn sz -> let CWInteger w = cwVal cw in shex False True (sgn, sz) w KUnbounded -> let CWInteger w = cwVal cw in shexI False True w KFloat -> let CWFloat w = cwVal cw in showHFloat w KDouble -> let CWDouble w = cwVal cw in showHDouble w KChar -> error "SBV.renderTest: Unsupported char" KString -> error "SBV.renderTest: Unsupported string" KReal -> let CWAlgReal w = cwVal cw in algRealToHaskell w KList es -> error $ "SBV.renderTest: Unsupported list valued sort: [" ++ show es ++ "]" KUserSort us _ -> error $ "SBV.renderTest: Unsupported uninterpreted sort: " ++ us c :: String -> [([CW], [CW])] -> String c n vs = intercalate "\n" $ [ "/* Automatically generated by SBV. Do not edit! */" , "" , "#include " , "#include " , "#include " , "#include " , "#include " , "#include " , "" , "/* The boolean type */" , "typedef bool SBool;" , "" , "/* The float type */" , "typedef float SFloat;" , "" , "/* The double type */" , "typedef double SDouble;" , "" , "/* Unsigned bit-vectors */" , "typedef uint8_t SWord8;" , "typedef uint16_t SWord16;" , "typedef uint32_t SWord32;" , "typedef uint64_t SWord64;" , "" , "/* Signed bit-vectors */" , "typedef int8_t SInt8;" , "typedef int16_t SInt16;" , "typedef int32_t SInt32;" , "typedef int64_t SInt64;" , "" , "typedef struct {" , " struct {" ] ++ (if null vs then [] else zipWith (mkField "i") (fst (head vs)) [(0::Int)..]) ++ [ " } input;" , " struct {" ] ++ (if null vs then [] else zipWith (mkField "o") (snd (head vs)) [(0::Int)..]) ++ [ " } output;" , "} " ++ n ++ "TestVector;" , "" , n ++ "TestVector " ++ n ++ "[] = {" ] ++ [" " ++ intercalate "\n , " (map mkLine vs)] ++ [ "};" , "" , "int " ++ n ++ "Length = " ++ show (length vs) ++ ";" , "" , "/* Stub driver showing the test values, replace with code that uses the test vectors. */" , "int main(void)" , "{" , " int i;" , " for(i = 0; i < " ++ n ++ "Length; ++i)" , " {" , " " ++ outLine , " }" , "" , " return 0;" , "}" ] where mkField p cw i = " " ++ t ++ " " ++ p ++ show i ++ ";" where t = case kindOf cw of KBool -> "SBool" KBounded False 8 -> "SWord8" KBounded False 16 -> "SWord16" KBounded False 32 -> "SWord32" KBounded False 64 -> "SWord64" KBounded True 8 -> "SInt8" KBounded True 16 -> "SInt16" KBounded True 32 -> "SInt32" KBounded True 64 -> "SInt64" KFloat -> "SFloat" KDouble -> "SDouble" KChar -> error "SBV.renderTest: Unsupported char" KString -> error "SBV.renderTest: Unsupported string" KUnbounded -> error "SBV.renderTest: Unbounded integers are not supported when generating C test-cases." KReal -> error "SBV.renderTest: Real values are not supported when generating C test-cases." KUserSort us _ -> error $ "SBV.renderTest: Unsupported uninterpreted sort: " ++ us _ -> error $ "SBV.renderTest: Unexpected CW: " ++ show cw mkLine (is, os) = "{{" ++ intercalate ", " (map v is) ++ "}, {" ++ intercalate ", " (map v os) ++ "}}" v cw = case kindOf cw of KBool -> if cwToBool cw then "true " else "false" KBounded sgn sz -> let CWInteger w = cwVal cw in chex False True (sgn, sz) w KUnbounded -> let CWInteger w = cwVal cw in shexI False True w KFloat -> let CWFloat w = cwVal cw in showCFloat w KDouble -> let CWDouble w = cwVal cw in showCDouble w KChar -> error "SBV.renderTest: Unsupported char" KString -> error "SBV.renderTest: Unsupported string" k@KList{} -> error $ "SBV.renderTest: Unsupported list sort!" ++ show k KUserSort us _ -> error $ "SBV.renderTest: Unsupported uninterpreted sort: " ++ us KReal -> error "SBV.renderTest: Real values are not supported when generating C test-cases." outLine | null vs = "printf(\"\");" | True = "printf(\"%*d. " ++ fmtString ++ "\\n\", " ++ show (length (show (length vs - 1))) ++ ", i" ++ concatMap ("\n , " ++ ) (zipWith inp is [(0::Int)..] ++ zipWith out os [(0::Int)..]) ++ ");" where (is, os) = head vs inp cw i = mkBool cw (n ++ "[i].input.i" ++ show i) out cw i = mkBool cw (n ++ "[i].output.o" ++ show i) mkBool cw s = case kindOf cw of KBool -> "(" ++ s ++ " == true) ? \"true \" : \"false\"" _ -> s fmtString = unwords (map fmt is) ++ " -> " ++ unwords (map fmt os) fmt cw = case kindOf cw of KBool -> "%s" KBounded False 8 -> "0x%02\"PRIx8\"" KBounded False 16 -> "0x%04\"PRIx16\"U" KBounded False 32 -> "0x%08\"PRIx32\"UL" KBounded False 64 -> "0x%016\"PRIx64\"ULL" KBounded True 8 -> "%\"PRId8\"" KBounded True 16 -> "%\"PRId16\"" KBounded True 32 -> "%\"PRId32\"L" KBounded True 64 -> "%\"PRId64\"LL" KFloat -> "%f" KDouble -> "%f" KChar -> error "SBV.renderTest: Unsupported char" KString -> error "SBV.renderTest: Unsupported string" KUnbounded -> error "SBV.renderTest: Unsupported unbounded integers for C generation." KReal -> error "SBV.renderTest: Unsupported real valued values for C generation." _ -> error $ "SBV.renderTest: Unexpected CW: " ++ show cw forte :: String -> Bool -> ([Int], [Int]) -> [([CW], [CW])] -> String forte vname bigEndian ss vs = intercalate "\n" $ [ "// Automatically generated by SBV. Do not edit!" , "let " ++ n ++ " =" , " let c s = val [_, r] = str_split s \"'\" in " ++ blaster ] ++ [ " in [ " ++ intercalate "\n , " (map mkLine vs) , " ];" ] where n | null vname = "testVectors" | not (isAlpha (head vname)) = "tv" ++ vname | True = vname blaster | bigEndian = "map (\\s. s == \"1\") (explode (string_tl r))" | True = "rev (map (\\s. s == \"1\") (explode (string_tl r)))" toF True = '1' toF False = '0' blast cw = let noForte w = error "SBV.renderTest: " ++ w ++ " values are not supported when generating Forte test-cases." in case kindOf cw of KBool -> [toF (cwToBool cw)] KBounded False 8 -> xlt 8 (cwVal cw) KBounded False 16 -> xlt 16 (cwVal cw) KBounded False 32 -> xlt 32 (cwVal cw) KBounded False 64 -> xlt 64 (cwVal cw) KBounded True 8 -> xlt 8 (cwVal cw) KBounded True 16 -> xlt 16 (cwVal cw) KBounded True 32 -> xlt 32 (cwVal cw) KBounded True 64 -> xlt 64 (cwVal cw) KFloat -> noForte "Float" KDouble -> noForte "Double" KChar -> noForte "Char" KString -> noForte "String" KReal -> noForte "Real" KList ek -> noForte $ "List of " ++ show ek KUnbounded -> noForte "Unbounded integers" _ -> error $ "SBV.renderTest: Unexpected CW: " ++ show cw xlt s (CWInteger v) = [toF (testBit v i) | i <- [s-1, s-2 .. 0]] xlt _ (CWFloat r) = error $ "SBV.renderTest.Forte: Unexpected float value: " ++ show r xlt _ (CWDouble r) = error $ "SBV.renderTest.Forte: Unexpected double value: " ++ show r xlt _ (CWChar r) = error $ "SBV.renderTest.Forte: Unexpected char value: " ++ show r xlt _ (CWString r) = error $ "SBV.renderTest.Forte: Unexpected string value: " ++ show r xlt _ (CWAlgReal r) = error $ "SBV.renderTest.Forte: Unexpected real value: " ++ show r xlt _ CWList{} = error "SBV.renderTest.Forte: Unexpected list value!" xlt _ (CWUserSort r) = error $ "SBV.renderTest.Forte: Unexpected uninterpreted value: " ++ show r mkLine (i, o) = "(" ++ mkTuple (form (fst ss) (concatMap blast i)) ++ ", " ++ mkTuple (form (snd ss) (concatMap blast o)) ++ ")" mkTuple [] = "()" mkTuple [x] = x mkTuple xs = "(" ++ intercalate ", " xs ++ ")" form [] [] = [] form [] bs = error $ "SBV.renderTest: Mismatched index in stream, extra " ++ show (length bs) ++ " bit(s) remain." form (i:is) bs | length bs < i = error $ "SBV.renderTest: Mismatched index in stream, was looking for " ++ show i ++ " bit(s), but only " ++ show bs ++ " remains." | i == 1 = let b:r = bs v = if b == '1' then "T" else "F" in v : form is r | True = let (f, r) = splitAt i bs v = "c \"" ++ show i ++ "'b" ++ f ++ "\"" in v : form is r sbv-7.13/Data/SBV/Tools/Overflow.hs0000644000000000000000000005132413405536617015205 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Tools.Overflow -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Implementation of overflow detection functions. -- Based on: ----------------------------------------------------------------------------- {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ImplicitParams #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeSynonymInstances #-} module Data.SBV.Tools.Overflow ( -- * Arithmetic overflows ArithOverflow(..), CheckedArithmetic(..) -- * Cast overflows , sFromIntegralO, sFromIntegralChecked ) where import Data.SBV.Core.Data import Data.SBV.Core.Symbolic import Data.SBV.Core.Model import Data.SBV.Core.Operations import Data.SBV.Utils.Boolean import GHC.Stack import Data.Int import Data.Word -- Doctest only -- $setup -- >>> import Data.SBV.Provers.Prover (prove, allSat) -- >>> import Data.SBV.Utils.Boolean ((<=>)) -- | Detecting underflow/overflow conditions. For each function, -- the first result is the condition under which the computation -- underflows, and the second is the condition under which it -- overflows. class ArithOverflow a where -- | Bit-vector addition. Unsigned addition can only overflow. Signed addition can underflow and overflow. -- -- A tell tale sign of unsigned addition overflow is when the sum is less than minumum of the arguments. -- -- >>> prove $ \x y -> snd (bvAddO x (y::SWord16)) <=> x + y .< x `smin` y -- Q.E.D. bvAddO :: a -> a -> (SBool, SBool) -- | Bit-vector subtraction. Unsigned subtraction can only underflow. Signed subtraction can underflow and overflow. bvSubO :: a -> a -> (SBool, SBool) -- | Bit-vector multiplication. Unsigned multiplication can only overflow. Signed multiplication can underflow and overflow. bvMulO :: a -> a -> (SBool, SBool) -- | Same as 'bvMulO', except instead of doing the computation internally, it simply sends it off to z3 as a primitive. -- Obviously, only use if you have the z3 backend! Note that z3 provides this operation only when no logic is set, -- so make sure to call @setLogic Logic_NONE@ in your program! bvMulOFast :: a -> a -> (SBool, SBool) -- | Bit-vector division. Unsigned division neither underflows nor overflows. Signed division can only overflow. In fact, for each -- signed bitvector type, there's precisely one pair that overflows, when @x@ is @minBound@ and @y@ is @-1@: -- -- >>> allSat $ \x y -> snd (x `bvDivO` (y::SInt8)) -- Solution #1: -- s0 = -128 :: Int8 -- s1 = -1 :: Int8 -- This is the only solution. bvDivO :: a -> a -> (SBool, SBool) -- | Bit-vector negation. Unsigned negation neither underflows nor overflows. Signed negation can only overflow, when the argument is -- @minBound@: -- -- >>> prove $ \x -> x .== minBound <=> snd (bvNegO (x::SInt16)) -- Q.E.D. bvNegO :: a -> (SBool, SBool) instance ArithOverflow SWord8 where {bvAddO = l2 bvAddO; bvSubO = l2 bvSubO; bvMulO = l2 bvMulO; bvMulOFast = l2 bvMulOFast; bvDivO = l2 bvDivO; bvNegO = l1 bvNegO} instance ArithOverflow SWord16 where {bvAddO = l2 bvAddO; bvSubO = l2 bvSubO; bvMulO = l2 bvMulO; bvMulOFast = l2 bvMulOFast; bvDivO = l2 bvDivO; bvNegO = l1 bvNegO} instance ArithOverflow SWord32 where {bvAddO = l2 bvAddO; bvSubO = l2 bvSubO; bvMulO = l2 bvMulO; bvMulOFast = l2 bvMulOFast; bvDivO = l2 bvDivO; bvNegO = l1 bvNegO} instance ArithOverflow SWord64 where {bvAddO = l2 bvAddO; bvSubO = l2 bvSubO; bvMulO = l2 bvMulO; bvMulOFast = l2 bvMulOFast; bvDivO = l2 bvDivO; bvNegO = l1 bvNegO} instance ArithOverflow SInt8 where {bvAddO = l2 bvAddO; bvSubO = l2 bvSubO; bvMulO = l2 bvMulO; bvMulOFast = l2 bvMulOFast; bvDivO = l2 bvDivO; bvNegO = l1 bvNegO} instance ArithOverflow SInt16 where {bvAddO = l2 bvAddO; bvSubO = l2 bvSubO; bvMulO = l2 bvMulO; bvMulOFast = l2 bvMulOFast; bvDivO = l2 bvDivO; bvNegO = l1 bvNegO} instance ArithOverflow SInt32 where {bvAddO = l2 bvAddO; bvSubO = l2 bvSubO; bvMulO = l2 bvMulO; bvMulOFast = l2 bvMulOFast; bvDivO = l2 bvDivO; bvNegO = l1 bvNegO} instance ArithOverflow SInt64 where {bvAddO = l2 bvAddO; bvSubO = l2 bvSubO; bvMulO = l2 bvMulO; bvMulOFast = l2 bvMulOFast; bvDivO = l2 bvDivO; bvNegO = l1 bvNegO} instance ArithOverflow SVal where bvAddO = signPick2 bvuaddo bvsaddo bvSubO = signPick2 bvusubo bvssubo bvMulO = signPick2 bvumulo bvsmulo bvMulOFast = signPick2 bvumuloFast bvsmuloFast bvDivO = signPick2 bvudivo bvsdivo bvNegO = signPick1 bvunego bvsnego -- | A class of checked-arithmetic operations. These follow the usual arithmetic, -- except make calls to 'Data.SBV.sAssert' to ensure no overflow/underflow can occur. -- Use them in conjunction with 'Data.SBV.safe' to ensure no overflow can happen. class (ArithOverflow (SBV a), Num a, SymWord a) => CheckedArithmetic a where (+!) :: (?loc :: CallStack) => SBV a -> SBV a -> SBV a (-!) :: (?loc :: CallStack) => SBV a -> SBV a -> SBV a (*!) :: (?loc :: CallStack) => SBV a -> SBV a -> SBV a (/!) :: (?loc :: CallStack) => SBV a -> SBV a -> SBV a negateChecked :: (?loc :: CallStack) => SBV a -> SBV a infixl 6 +!, -! infixl 7 *!, /! instance CheckedArithmetic Word8 where (+!) = checkOp2 ?loc "addition" (+) bvAddO (-!) = checkOp2 ?loc "subtraction" (-) bvSubO (*!) = checkOp2 ?loc "multiplication" (*) bvMulO (/!) = checkOp2 ?loc "division" sDiv bvDivO negateChecked = checkOp1 ?loc "unary negation" negate bvNegO instance CheckedArithmetic Word16 where (+!) = checkOp2 ?loc "addition" (+) bvAddO (-!) = checkOp2 ?loc "subtraction" (-) bvSubO (*!) = checkOp2 ?loc "multiplication" (*) bvMulO (/!) = checkOp2 ?loc "division" sDiv bvDivO negateChecked = checkOp1 ?loc "unary negation" negate bvNegO instance CheckedArithmetic Word32 where (+!) = checkOp2 ?loc "addition" (+) bvAddO (-!) = checkOp2 ?loc "subtraction" (-) bvSubO (*!) = checkOp2 ?loc "multiplication" (*) bvMulO (/!) = checkOp2 ?loc "division" sDiv bvDivO negateChecked = checkOp1 ?loc "unary negation" negate bvNegO instance CheckedArithmetic Word64 where (+!) = checkOp2 ?loc "addition" (+) bvAddO (-!) = checkOp2 ?loc "subtraction" (-) bvSubO (*!) = checkOp2 ?loc "multiplication" (*) bvMulO (/!) = checkOp2 ?loc "division" sDiv bvDivO negateChecked = checkOp1 ?loc "unary negation" negate bvNegO instance CheckedArithmetic Int8 where (+!) = checkOp2 ?loc "addition" (+) bvAddO (-!) = checkOp2 ?loc "subtraction" (-) bvSubO (*!) = checkOp2 ?loc "multiplication" (*) bvMulO (/!) = checkOp2 ?loc "division" sDiv bvDivO negateChecked = checkOp1 ?loc "unary negation" negate bvNegO instance CheckedArithmetic Int16 where (+!) = checkOp2 ?loc "addition" (+) bvAddO (-!) = checkOp2 ?loc "subtraction" (-) bvSubO (*!) = checkOp2 ?loc "multiplication" (*) bvMulO (/!) = checkOp2 ?loc "division" sDiv bvDivO negateChecked = checkOp1 ?loc "unary negation" negate bvNegO instance CheckedArithmetic Int32 where (+!) = checkOp2 ?loc "addition" (+) bvAddO (-!) = checkOp2 ?loc "subtraction" (-) bvSubO (*!) = checkOp2 ?loc "multiplication" (*) bvMulO (/!) = checkOp2 ?loc "division" sDiv bvDivO negateChecked = checkOp1 ?loc "unary negation" negate bvNegO instance CheckedArithmetic Int64 where (+!) = checkOp2 ?loc "addition" (+) bvAddO (-!) = checkOp2 ?loc "subtraction" (-) bvSubO (*!) = checkOp2 ?loc "multiplication" (*) bvMulO (/!) = checkOp2 ?loc "division" sDiv bvDivO negateChecked = checkOp1 ?loc "unary negation" negate bvNegO -- | Zero-extend to given bits zx :: Int -> SVal -> SVal zx n a | n < sa = error $ "Data.SBV: Unexpected zero extension: from: " ++ show (intSizeOf a) ++ " to: " ++ show n | True = p `svJoin` a where sa = intSizeOf a s = hasSign a p = svInteger (KBounded s (n - sa)) 0 -- | Sign-extend to given bits. Note that we keep the signedness of the argument. sx :: Int -> SVal -> SVal sx n a | n < sa = error $ "Data.SBV: Unexpected sign extension: from: " ++ show (intSizeOf a) ++ " to: " ++ show n | True = p `svJoin` a where sa = intSizeOf a mk = svInteger $ KBounded (hasSign a) (n - sa) p = svIte (pos a) (mk 0) (mk (-1)) -- | Get the sign-bit signBit :: SVal -> SVal signBit x = x `svTestBit` (intSizeOf x - 1) -- | Is the sign-bit high? neg :: SVal -> SVal neg x = signBit x `svEqual` svTrue -- | Is the sign-bit low? pos :: SVal -> SVal pos x = signBit x `svEqual` svFalse -- | Do these have the same sign? sameSign :: SVal -> SVal -> SVal sameSign x y = (pos x `svAnd` pos y) `svOr` (neg x `svAnd` neg y) -- | Do these have opposing signs? diffSign :: SVal -> SVal -> SVal diffSign x y = svNot (sameSign x y) -- | Check all true svAll :: [SVal] -> SVal svAll = foldr svAnd svTrue -- | Are all the bits between a b (inclusive) zero? allZero :: Int -> Int -> SBV a -> SVal allZero m n (SBV x) | m >= sz || n < 0 || m < n = error $ "Data.SBV.Tools.Overflow.allZero: Received unexpected parameters: " ++ show (m, n, sz) | True = svAll [svTestBit x i `svEqual` svFalse | i <- [m, m-1 .. n]] where sz = intSizeOf x -- | Are all the bits between a b (inclusive) one? allOne :: Int -> Int -> SBV a -> SVal allOne m n (SBV x) | m >= sz || n < 0 || m < n = error $ "Data.SBV.Tools.Overflow.allOne: Received unexpected parameters: " ++ show (m, n, sz) | True = svAll [svTestBit x i `svEqual` svTrue | i <- [m, m-1 .. n]] where sz = intSizeOf x -- | Unsigned addition. Can only overflow. bvuaddo :: Int -> SVal -> SVal -> (SVal, SVal) bvuaddo n x y = (underflow, overflow) where underflow = svFalse n' = n+1 overflow = neg $ zx n' x `svPlus` zx n' y -- | Signed addition. bvsaddo :: Int -> SVal -> SVal -> (SVal, SVal) bvsaddo _n x y = (underflow, overflow) where underflow = svAll [neg x, neg y, pos (x `svPlus` y)] overflow = svAll [pos x, pos y, neg (x `svPlus` y)] -- | Unsigned subtraction. Can only underflow. bvusubo :: Int -> SVal -> SVal -> (SVal, SVal) bvusubo _n x y = (underflow, overflow) where underflow = y `svGreaterThan` x overflow = svFalse -- | Signed subtraction. bvssubo :: Int -> SVal -> SVal -> (SVal, SVal) bvssubo _n x y = (underflow, overflow) where underflow = svAll [neg x, pos y, pos (x `svMinus` y)] overflow = svAll [pos x, neg y, neg (x `svMinus` y)] -- | Unsigned multiplication. Can only overflow. bvumulo :: Int -> SVal -> SVal -> (SVal, SVal) bvumulo 0 _ _ = (svFalse, svFalse) bvumulo n x y = (underflow, overflow) where underflow = svFalse n1 = n+1 overflow1 = signBit $ zx n1 x `svTimes` zx n1 y -- From Z3 sources: -- -- expr_ref ovf(m()), v(m()), tmp(m()); -- ovf = m().mk_false(); -- v = m().mk_false(); -- for (unsigned i = 1; i < sz; ++i) { -- mk_or(ovf, a_bits[sz-i], ovf); -- mk_and(ovf, b_bits[i], tmp); -- mk_or(tmp, v, v); -- } -- overflow2 = v; -- overflow2 = go 1 svFalse svFalse where go i ovf v | i >= n = v | True = go (i+1) ovf' v' where ovf' = ovf `svOr` (x `svTestBit` (n-i)) tmp = ovf' `svAnd` (y `svTestBit` i) v' = tmp `svOr` v overflow = overflow1 `svOr` overflow2 -- | Signed multiplication. bvsmulo :: Int -> SVal -> SVal -> (SVal, SVal) bvsmulo 0 _ _ = (svFalse, svFalse) bvsmulo n x y = (underflow, overflow) where underflow = diffSign x y `svAnd` overflowPossible overflow = sameSign x y `svAnd` overflowPossible n1 = n+1 overflow1 = (xy1 `svTestBit` n) `svXOr` (xy1 `svTestBit` (n-1)) where xy1 = sx n1 x `svTimes` sx n1 y -- From Z3 sources: -- expr_ref v(m()), tmp(m()), a(m()), b(m()), a_acc(m()), sign(m()); -- a_acc = m().mk_false(); -- v = m().mk_false(); -- for (unsigned i = 1; i + 1 < sz; ++i) { -- mk_xor(b_bits[sz-1], b_bits[i], b); -- mk_xor(a_bits[sz-1], a_bits[sz-1-i], a); -- mk_or(a, a_acc, a_acc); -- mk_and(a_acc, b, tmp); -- mk_or(tmp, v, v); -- } -- overflow2 = v; overflow2 = go 1 svFalse svFalse where sY = signBit y sX = signBit x go i v a_acc | i + 1 >= n = v | True = go (i+1) v' a_acc' where b = sY `svXOr` (y `svTestBit` i) a = sX `svXOr` (x `svTestBit` (n-1-i)) a_acc' = a `svOr` a_acc tmp = a_acc' `svAnd` b v' = tmp `svOr` v overflowPossible = overflow1 `svOr` overflow2 -- | Is this a concrete value? known :: SVal -> Bool known (SVal _ (Left _)) = True known _ = False -- | Unsigned multiplication, fast version using z3 primitives. bvumuloFast :: Int -> SVal -> SVal -> (SVal, SVal) bvumuloFast n x y | known x && known y -- Not particularly fast, but avoids shipping of to the solver = bvumulo n x y | True = (underflow, overflow) where underflow = fst $ bvumulo n x y -- No internal version for underflow exists (because it can't underflow) overflow = svMkOverflow Overflow_UMul_OVFL x y -- | Signed multiplication, fast version using z3 primitives. bvsmuloFast :: Int -> SVal -> SVal -> (SVal, SVal) bvsmuloFast n x y | known x && known y -- Not particularly fast, but avoids shipping of to the solver = bvsmulo n x y | True = (underflow, overflow) where underflow = svMkOverflow Overflow_SMul_UDFL x y overflow = svMkOverflow Overflow_SMul_OVFL x y -- | Unsigned division. Neither underflows, nor overflows. bvudivo :: Int -> SVal -> SVal -> (SVal, SVal) bvudivo _ _ _ = (underflow, overflow) where underflow = svFalse overflow = svFalse -- | Signed division. Can only overflow. bvsdivo :: Int -> SVal -> SVal -> (SVal, SVal) bvsdivo n x y = (underflow, overflow) where underflow = svFalse ones = svInteger (KBounded True n) (-1) topSet = svInteger (KBounded True n) (2^(n-1)) overflow = svAll [x `svEqual` topSet, y `svEqual` ones] -- | Unsigned negation. Neither underflows, nor overflows. bvunego :: Int -> SVal -> (SVal, SVal) bvunego _ _ = (underflow, overflow) where underflow = svFalse overflow = svFalse -- | Signed negation. Can only overflow. bvsnego :: Int -> SVal -> (SVal, SVal) bvsnego n x = (underflow, overflow) where underflow = svFalse topSet = svInteger (KBounded True n) (2^(n-1)) overflow = x `svEqual` topSet -- | Detecting underflow/overflow conditions for casting between bit-vectors. The first output is the result, -- the second component itself is a pair with the first boolean indicating underflow and the second indicating overflow. -- -- >>> sFromIntegralO (256 :: SInt16) :: (SWord8, (SBool, SBool)) -- (0 :: SWord8,(False,True)) -- >>> sFromIntegralO (-2 :: SInt16) :: (SWord8, (SBool, SBool)) -- (254 :: SWord8,(True,False)) -- >>> sFromIntegralO (2 :: SInt16) :: (SWord8, (SBool, SBool)) -- (2 :: SWord8,(False,False)) -- >>> prove $ \x -> sFromIntegralO (x::SInt32) .== (sFromIntegral x :: SInteger, (false, false)) -- Q.E.D. -- -- As the last example shows, converting to `sInteger` never underflows or overflows for any value. sFromIntegralO :: forall a b. (Integral a, HasKind a, Num a, SymWord a, HasKind b, Num b, SymWord b) => SBV a -> (SBV b, (SBool, SBool)) sFromIntegralO x = case (kindOf x, kindOf (undefined :: b)) of (KBounded False n, KBounded False m) -> (res, u2u n m) (KBounded False n, KBounded True m) -> (res, u2s n m) (KBounded True n, KBounded False m) -> (res, s2u n m) (KBounded True n, KBounded True m) -> (res, s2s n m) (KUnbounded, KBounded s m) -> (res, checkBounds s m) (KBounded{}, KUnbounded) -> (res, (false, false)) (KUnbounded, KUnbounded) -> (res, (false, false)) (kFrom, kTo) -> error $ "sFromIntegralO: Expected bounded-BV types, received: " ++ show (kFrom, kTo) where res :: SBV b res = sFromIntegral x checkBounds :: Bool -> Int -> (SBool, SBool) checkBounds signed sz = (ix .< literal lb, ix .> literal ub) where ix :: SInteger ix = sFromIntegral x s :: Integer s = fromIntegral sz ub :: Integer ub | signed = 2^(s - 1) - 1 | True = 2^s - 1 lb :: Integer lb | signed = -ub-1 | True = 0 u2u :: Int -> Int -> (SBool, SBool) u2u n m = (underflow, overflow) where underflow = false overflow | n <= m = false | True = SBV $ svNot $ allZero (n-1) m x u2s :: Int -> Int -> (SBool, SBool) u2s n m = (underflow, overflow) where underflow = false overflow | m > n = false | True = SBV $ svNot $ allZero (n-1) (m-1) x s2u :: Int -> Int -> (SBool, SBool) s2u n m = (underflow, overflow) where underflow = SBV $ (unSBV x `svTestBit` (n-1)) `svEqual` svTrue overflow | m >= n - 1 = false | True = SBV $ svAll [(unSBV x `svTestBit` (n-1)) `svEqual` svFalse, svNot $ allZero (n-1) m x] s2s :: Int -> Int -> (SBool, SBool) s2s n m = (underflow, overflow) where underflow | m > n = false | True = SBV $ svAll [(unSBV x `svTestBit` (n-1)) `svEqual` svTrue, svNot $ allOne (n-1) (m-1) x] overflow | m > n = false | True = SBV $ svAll [(unSBV x `svTestBit` (n-1)) `svEqual` svFalse, svNot $ allZero (n-1) (m-1) x] -- | Version of 'sFromIntegral' that has calls to 'Data.SBV.sAssert' for checking no overflow/underflow can happen. Use it with a 'Data.SBV.safe' call. sFromIntegralChecked :: forall a b. (?loc :: CallStack, Integral a, HasKind a, HasKind b, Num a, SymWord a, HasKind b, Num b, SymWord b) => SBV a -> SBV b sFromIntegralChecked x = sAssert (Just ?loc) (msg "underflows") (bnot u) $ sAssert (Just ?loc) (msg "overflows") (bnot o) r where kFrom = show $ kindOf x kTo = show $ kindOf (undefined :: b) msg c = "Casting from " ++ kFrom ++ " to " ++ kTo ++ " " ++ c (r, (u, o)) = sFromIntegralO x -- Helpers l2 :: (SVal -> SVal -> (SBool, SBool)) -> SBV a -> SBV a -> (SBool, SBool) l2 f (SBV a) (SBV b) = f a b l1 :: (SVal -> (SBool, SBool)) -> SBV a -> (SBool, SBool) l1 f (SBV a) = f a signPick2 :: (Int -> SVal -> SVal -> (SVal, SVal)) -> (Int -> SVal -> SVal -> (SVal, SVal)) -> (SVal -> SVal -> (SBool, SBool)) signPick2 fu fs a b | hasSign a = let (u, o) = fs n a b in (SBV u, SBV o) | True = let (u, o) = fu n a b in (SBV u, SBV o) where n = intSizeOf a signPick1 :: (Int -> SVal -> (SVal, SVal)) -> (Int -> SVal -> (SVal, SVal)) -> (SVal -> (SBool, SBool)) signPick1 fu fs a | hasSign a = let (u, o) = fs n a in (SBV u, SBV o) | True = let (u, o) = fu n a in (SBV u, SBV o) where n = intSizeOf a checkOp1 :: HasKind a => CallStack -> String -> (a -> SBV b) -> (a -> (SBool, SBool)) -> a -> SBV b checkOp1 loc w op cop a = sAssert (Just loc) (msg "underflows") (bnot u) $ sAssert (Just loc) (msg "overflows") (bnot o) $ op a where k = show $ kindOf a msg c = k ++ " " ++ w ++ " " ++ c (u, o) = cop a checkOp2 :: HasKind a => CallStack -> String -> (a -> b -> SBV c) -> (a -> b -> (SBool, SBool)) -> a -> b -> SBV c checkOp2 loc w op cop a b = sAssert (Just loc) (msg "underflows") (bnot u) $ sAssert (Just loc) (msg "overflows") (bnot o) $ a `op` b where k = show $ kindOf a msg c = k ++ " " ++ w ++ " " ++ c (u, o) = a `cop` b sbv-7.13/Data/SBV/Tools/Polynomial.hs0000644000000000000000000002557313405536617015534 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Tools.Polynomials -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Implementation of polynomial arithmetic ----------------------------------------------------------------------------- {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TypeSynonymInstances #-} module Data.SBV.Tools.Polynomial ( -- * Polynomial arithmetic and CRCs Polynomial(..), crc, crcBV, ites, mdp, addPoly ) where import Data.Bits (Bits(..)) import Data.List (genericTake) import Data.Maybe (fromJust, fromMaybe) import Data.Word (Word8, Word16, Word32, Word64) import Data.SBV.Core.Data import Data.SBV.Core.Model import Data.SBV.Utils.Boolean -- | Implements polynomial addition, multiplication, division, and modulus operations -- over GF(2^n). NB. Similar to 'sQuotRem', division by @0@ is interpreted as follows: -- -- @x `pDivMod` 0 = (0, x)@ -- -- for all @x@ (including @0@) -- -- Minimal complete definition: 'pMult', 'pDivMod', 'showPolynomial' class (Num a, Bits a) => Polynomial a where -- | Given bit-positions to be set, create a polynomial -- For instance -- -- @polynomial [0, 1, 3] :: SWord8@ -- -- will evaluate to @11@, since it sets the bits @0@, @1@, and @3@. Mathematicans would write this polynomial -- as @x^3 + x + 1@. And in fact, 'showPoly' will show it like that. polynomial :: [Int] -> a -- | Add two polynomials in GF(2^n). pAdd :: a -> a -> a -- | Multiply two polynomials in GF(2^n), and reduce it by the irreducible specified by -- the polynomial as specified by coefficients of the third argument. Note that the third -- argument is specifically left in this form as it is usally in GF(2^(n+1)), which is not available in our -- formalism. (That is, we would need SWord9 for SWord8 multiplication, etc.) Also note that we do not -- support symbolic irreducibles, which is a minor shortcoming. (Most GF's will come with fixed irreducibles, -- so this should not be a problem in practice.) -- -- Passing [] for the third argument will multiply the polynomials and then ignore the higher bits that won't -- fit into the resulting size. pMult :: (a, a, [Int]) -> a -- | Divide two polynomials in GF(2^n), see above note for division by 0. pDiv :: a -> a -> a -- | Compute modulus of two polynomials in GF(2^n), see above note for modulus by 0. pMod :: a -> a -> a -- | Division and modulus packed together. pDivMod :: a -> a -> (a, a) -- | Display a polynomial like a mathematician would (over the monomial @x@), with a type. showPoly :: a -> String -- | Display a polynomial like a mathematician would (over the monomial @x@), the first argument -- controls if the final type is shown as well. showPolynomial :: Bool -> a -> String -- defaults.. Minumum complete definition: pMult, pDivMod, showPolynomial polynomial = foldr (flip setBit) 0 pAdd = xor pDiv x y = fst (pDivMod x y) pMod x y = snd (pDivMod x y) showPoly = showPolynomial False instance Polynomial Word8 where {showPolynomial = sp; pMult = lift polyMult; pDivMod = liftC polyDivMod} instance Polynomial Word16 where {showPolynomial = sp; pMult = lift polyMult; pDivMod = liftC polyDivMod} instance Polynomial Word32 where {showPolynomial = sp; pMult = lift polyMult; pDivMod = liftC polyDivMod} instance Polynomial Word64 where {showPolynomial = sp; pMult = lift polyMult; pDivMod = liftC polyDivMod} instance Polynomial SWord8 where {showPolynomial b = liftS (sp b); pMult = polyMult; pDivMod = polyDivMod} instance Polynomial SWord16 where {showPolynomial b = liftS (sp b); pMult = polyMult; pDivMod = polyDivMod} instance Polynomial SWord32 where {showPolynomial b = liftS (sp b); pMult = polyMult; pDivMod = polyDivMod} instance Polynomial SWord64 where {showPolynomial b = liftS (sp b); pMult = polyMult; pDivMod = polyDivMod} lift :: SymWord a => ((SBV a, SBV a, [Int]) -> SBV a) -> (a, a, [Int]) -> a lift f (x, y, z) = fromJust $ unliteral $ f (literal x, literal y, z) liftC :: SymWord a => (SBV a -> SBV a -> (SBV a, SBV a)) -> a -> a -> (a, a) liftC f x y = let (a, b) = f (literal x) (literal y) in (fromJust (unliteral a), fromJust (unliteral b)) liftS :: SymWord a => (a -> String) -> SBV a -> String liftS f s | Just x <- unliteral s = f x | True = show s -- | Pretty print as a polynomial sp :: Bits a => Bool -> a -> String sp st a | null cs = '0' : t | True = foldr (\x y -> sh x ++ " + " ++ y) (sh (last cs)) (init cs) ++ t where t | st = " :: GF(2^" ++ show n ++ ")" | True = "" n = fromMaybe (error "SBV.Polynomial.sp: Unexpected non-finite usage!") (bitSizeMaybe a) is = [n-1, n-2 .. 0] cs = map fst $ filter snd $ zip is (map (testBit a) is) sh 0 = "1" sh 1 = "x" sh i = "x^" ++ show i -- | Add two polynomials addPoly :: [SBool] -> [SBool] -> [SBool] addPoly xs [] = xs addPoly [] ys = ys addPoly (x:xs) (y:ys) = x <+> y : addPoly xs ys -- | Run down a boolean condition over two lists. Note that this is -- different than zipWith as shorter list is assumed to be filled with -- false at the end (i.e., zero-bits); which nicely pads it when -- considered as an unsigned number in little-endian form. ites :: SBool -> [SBool] -> [SBool] -> [SBool] ites s xs ys | Just t <- unliteral s = if t then xs else ys | True = go xs ys where go [] [] = [] go [] (b:bs) = ite s false b : go [] bs go (a:as) [] = ite s a false : go as [] go (a:as) (b:bs) = ite s a b : go as bs -- | Multiply two polynomials and reduce by the third (concrete) irreducible, given by its coefficients. -- See the remarks for the 'pMult' function for this design choice polyMult :: SFiniteBits a => (SBV a, SBV a, [Int]) -> SBV a polyMult (x, y, red) | isReal x = error $ "SBV.polyMult: Received a real value: " ++ show x | not (isBounded x) = error $ "SBV.polyMult: Received infinite precision value: " ++ show x | True = fromBitsLE $ genericTake sz $ r ++ repeat false where (_, r) = mdp ms rs ms = genericTake (2*sz) $ mul (blastLE x) (blastLE y) [] ++ repeat false rs = genericTake (2*sz) $ [if i `elem` red then true else false | i <- [0 .. foldr max 0 red] ] ++ repeat false sz = intSizeOf x mul _ [] ps = ps mul as (b:bs) ps = mul (false:as) bs (ites b (as `addPoly` ps) ps) polyDivMod :: SFiniteBits a => SBV a -> SBV a -> (SBV a, SBV a) polyDivMod x y | isReal x = error $ "SBV.polyDivMod: Received a real value: " ++ show x | not (isBounded x) = error $ "SBV.polyDivMod: Received infinite precision value: " ++ show x | True = ite (y .== 0) (0, x) (adjust d, adjust r) where adjust xs = fromBitsLE $ genericTake sz $ xs ++ repeat false sz = intSizeOf x (d, r) = mdp (blastLE x) (blastLE y) -- conservative over-approximation of the degree degree :: [SBool] -> Int degree xs = walk (length xs - 1) $ reverse xs where walk n [] = n walk n (b:bs) | Just t <- unliteral b = if t then n else walk (n-1) bs | True = n -- over-estimate -- | Compute modulus/remainder of polynomials on bit-vectors. mdp :: [SBool] -> [SBool] -> ([SBool], [SBool]) mdp xs ys = go (length ys - 1) (reverse ys) where degTop = degree xs go _ [] = error "SBV.Polynomial.mdp: Impossible happened; exhausted ys before hitting 0" go n (b:bs) | n == 0 = (reverse qs, rs) | True = let (rqs, rrs) = go (n-1) bs in (ites b (reverse qs) rqs, ites b rs rrs) where degQuot = degTop - n ys' = replicate degQuot false ++ ys (qs, rs) = divx (degQuot+1) degTop xs ys' -- return the element at index i; if not enough elements, return false -- N.B. equivalent to '(xs ++ repeat false) !! i', but more efficient idx :: [SBool] -> Int -> SBool idx [] _ = false idx (x:_) 0 = x idx (_:xs) i = idx xs (i-1) divx :: Int -> Int -> [SBool] -> [SBool] -> ([SBool], [SBool]) divx n _ xs _ | n <= 0 = ([], xs) divx n i xs ys' = (q:qs, rs) where q = xs `idx` i xs' = ites q (xs `addPoly` ys') xs (qs, rs) = divx (n-1) (i-1) xs' (tail ys') -- | Compute CRCs over bit-vectors. The call @crcBV n m p@ computes -- the CRC of the message @m@ with respect to polynomial @p@. The -- inputs are assumed to be blasted big-endian. The number -- @n@ specifies how many bits of CRC is needed. Note that @n@ -- is actually the degree of the polynomial @p@, and thus it seems -- redundant to pass it in. However, in a typical proof context, -- the polynomial can be symbolic, so we cannot compute the degree -- easily. While this can be worked-around by generating code that -- accounts for all possible degrees, the resulting code would -- be unnecessarily big and complicated, and much harder to reason -- with. (Also note that a CRC is just the remainder from the -- polynomial division, but this routine is much faster in practice.) -- -- NB. The @n@th bit of the polynomial @p@ /must/ be set for the CRC -- to be computed correctly. Note that the polynomial argument @p@ will -- not even have this bit present most of the time, as it will typically -- contain bits @0@ through @n-1@ as usual in the CRC literature. The higher -- order @n@th bit is simply assumed to be set, as it does not make -- sense to use a polynomial of a lesser degree. This is usually not a problem -- since CRC polynomials are designed and expressed this way. -- -- NB. The literature on CRC's has many variants on how CRC's are computed. -- We follow the following simple procedure: -- -- * Extend the message @m@ by adding @n@ 0 bits on the right -- -- * Divide the polynomial thus obtained by the @p@ -- -- * The remainder is the CRC value. -- -- There are many variants on final XOR's, reversed polynomials etc., so -- it is essential to double check you use the correct /algorithm/. crcBV :: Int -> [SBool] -> [SBool] -> [SBool] crcBV n m p = take n $ go (replicate n false) (m ++ replicate n false) where mask = drop (length p - n) p go c [] = c go c (b:bs) = go next bs where c' = drop 1 c ++ [b] next = ite (head c) (zipWith (<+>) c' mask) c' -- | Compute CRC's over polynomials, i.e., symbolic words. The first -- 'Int' argument plays the same role as the one in the 'crcBV' function. crc :: (SFiniteBits a, SFiniteBits b) => Int -> SBV a -> SBV b -> SBV b crc n m p | isReal m || isReal p = error $ "SBV.crc: Received a real value: " ++ show (m, p) | not (isBounded m) || not (isBounded p) = error $ "SBV.crc: Received an infinite precision value: " ++ show (m, p) | True = fromBitsBE $ replicate (sz - n) false ++ crcBV n (blastBE m) (blastBE p) where sz = intSizeOf p sbv-7.13/Data/SBV/Tools/Range.hs0000644000000000000000000001766613405536617014451 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Tools.Range -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Single variable valid range detection. ----------------------------------------------------------------------------- {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ScopedTypeVariables #-} module Data.SBV.Tools.Range ( -- * Boundaries and ranges Boundary(..), Range(..) -- * Computing valid ranges , ranges, rangesWith ) where import Data.SBV import Data.SBV.Control import Data.SBV.Internals hiding (Range) -- Doctest only -- $setup -- >>> :set -XScopedTypeVariables -- | A boundary value data Boundary a = Unbounded -- ^ Unbounded | Open a -- ^ Exclusive of the point | Closed a -- ^ Inclusive of the point -- | Is this a closed value? isClosed :: Boundary a -> Bool isClosed Unbounded = False isClosed (Open _) = False isClosed (Closed _) = True -- | A range is a pair of boundaries: Lower and upper bounds data Range a = Range (Boundary a) (Boundary a) -- | Show instance for 'Range' instance Show a => Show (Range a) where show (Range l u) = sh True l ++ "," ++ sh False u where sh onLeft b = case b of Unbounded | onLeft -> "(-oo" | True -> "oo)" Open v | onLeft -> "(" ++ show v | True -> show v ++ ")" Closed v | onLeft -> "[" ++ show v | True -> show v ++ "]" -- | Given a single predicate over a single variable, find the contiguous ranges over which the predicate -- is satisfied. SBV will make one call to the optimizer, and then as many calls to the solver as there are -- disjoint ranges that the predicate is satisfied over. (Linear in the number of ranges.) Note that the -- number of ranges is large, this can take a long time! Some examples: -- -- >>> ranges (\(_ :: SInteger) -> false) -- [] -- >>> ranges (\(_ :: SInteger) -> true) -- [(-oo,oo)] -- >>> ranges (\(x :: SInteger) -> bAnd [x .<= 120, x .>= -12, x ./= 3]) -- [[-12,3),(3,120]] -- >>> ranges (\(x :: SInteger) -> bAnd [x .<= 75, x .>= 5, x ./= 6, x ./= 67]) -- [[5,6),(6,67),(67,75]] -- >>> ranges (\(x :: SInteger) -> bAnd [x .<= 75, x ./= 3, x ./= 67]) -- [(-oo,3),(3,67),(67,75]] -- >>> ranges (\(x :: SReal) -> bAnd [x .> 3.2, x .< 12.7]) -- [(3.2,12.7)] -- >>> ranges (\(x :: SReal) -> bAnd [x .> 3.2, x .<= 12.7]) -- [(3.2,12.7]] -- >>> ranges (\(x :: SReal) -> bAnd [x .<= 12.7, x ./= 8]) -- [(-oo,8.0),(8.0,12.7]] -- >>> ranges (\(x :: SReal) -> bAnd [x .>= 12.7, x ./= 15]) -- [[12.7,15.0),(15.0,oo)] -- >>> ranges (\(x :: SInt8) -> bAnd [x .<= 7, x ./= 6]) -- [[-128,6),(6,7]] -- >>> ranges $ \x -> x .> (0::SReal) -- [(0.0,oo)] -- >>> ranges $ \x -> x .< (0::SReal) -- [(-oo,0.0)] ranges :: forall a. (Num a, SymWord a, SMTValue a, SatModel a, Metric (SBV a)) => (SBV a -> SBool) -> IO [Range a] ranges = rangesWith defaultSMTCfg -- | Compute ranges, using the given solver configuration. rangesWith :: forall a. (Num a, SymWord a, SMTValue a, SatModel a, Metric (SBV a)) => SMTConfig -> (SBV a -> SBool) -> IO [Range a] rangesWith cfg prop = do mbBounds <- getInitialBounds case mbBounds of Nothing -> return [] Just r -> search [r] [] where getInitialBounds :: IO (Maybe (Range a)) getInitialBounds = do let getGenVal :: GeneralizedCW -> Boundary a getGenVal (RegularCW cw) = Closed $ getRegVal cw getGenVal (ExtendedCW ecw) = getExtVal ecw getExtVal :: ExtCW -> Boundary a getExtVal (Infinite _) = Unbounded getExtVal (Epsilon k) = Open $ getRegVal (mkConstCW k (0::Integer)) getExtVal i@Interval{} = error $ unlines [ "*** Data.SBV.ranges.getExtVal: Unexpected interval bounds!" , "***" , "*** Found bound: " ++ show i , "*** Please report this as a bug!" ] getExtVal (BoundedCW cw) = Closed $ getRegVal cw getExtVal (AddExtCW a b) = getExtVal a `addBound` getExtVal b getExtVal (MulExtCW a b) = getExtVal a `mulBound` getExtVal b opBound :: (a -> a -> a) -> Boundary a -> Boundary a -> Boundary a opBound f x y = case (fromBound x, fromBound y, isClosed x && isClosed y) of (Just a, Just b, True) -> Closed $ a `f` b (Just a, Just b, False) -> Open $ a `f` b _ -> Unbounded where fromBound Unbounded = Nothing fromBound (Open a) = Just a fromBound (Closed a) = Just a addBound, mulBound :: Boundary a -> Boundary a -> Boundary a addBound = opBound (+) mulBound = opBound (*) getRegVal :: CW -> a getRegVal cw = case parseCWs [cw] of Just (v, []) -> v _ -> error $ "Data.SBV.interval.getRegVal: Cannot parse " ++ show cw IndependentResult m <- optimizeWith cfg Independent $ do x <- free_ constrain $ prop x minimize "min" x maximize "max" x case head (map snd m) of Unsatisfiable{} -> return Nothing Unknown{} -> error "Solver said Unknown!" ProofError{} -> error (show (IndependentResult m)) _ -> let Just (Just mi) = getModelObjectiveValue "min" `fmap` ("min" `lookup` m) Just (Just ma) = getModelObjectiveValue "max" `fmap` ("max" `lookup` m) in return $ Just $ Range (getGenVal mi) (getGenVal ma) bisect :: Range a -> IO (Maybe [Range a]) bisect (Range lo hi) = runSMTWith cfg $ do x <- free_ let restrict v open closed = case v of Unbounded -> true Open a -> x `open` literal a Closed a -> x `closed` literal a lower = restrict lo (.>) (.>=) upper = restrict hi (.<) (.<=) constrain $ lower &&& upper &&& bnot (prop x) query $ do cs <- checkSat case cs of Unsat -> return Nothing Unk -> error "Data.SBV.interval.bisect: Solver said unknown!" Sat -> do midV <- Open <$> getValue x return $ Just [Range lo midV, Range midV hi] search :: [Range a] -> [Range a] -> IO [Range a] search [] sofar = return $ reverse sofar search (c:cs) sofar = do mbCS <- bisect c case mbCS of Nothing -> search cs (c:sofar) Just xss -> search (xss ++ cs) sofar sbv-7.13/Data/SBV/Tools/STree.hs0000644000000000000000000000663413405536617014430 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Tools.STree -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Implementation of full-binary symbolic trees, providing logarithmic -- time access to elements. Both reads and writes are supported. ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} module Data.SBV.Tools.STree (STree, readSTree, writeSTree, mkSTree) where import Data.SBV.Core.Data import Data.SBV.Core.Model -- | A symbolic tree containing values of type e, indexed by -- elements of type i. Note that these are full-trees, and their -- their shapes remain constant. There is no API provided that -- can change the shape of the tree. These structures are useful -- when dealing with data-structures that are indexed with symbolic -- values where access time is important. 'STree' structures provide -- logarithmic time reads and writes. type STree i e = STreeInternal (SBV i) (SBV e) -- Internal representation, not exposed to the user data STreeInternal i e = SLeaf e -- NB. parameter 'i' is phantom | SBin (STreeInternal i e) (STreeInternal i e) deriving Show instance SymWord e => Mergeable (STree i e) where symbolicMerge f b (SLeaf i) (SLeaf j) = SLeaf (symbolicMerge f b i j) symbolicMerge f b (SBin l r) (SBin l' r') = SBin (symbolicMerge f b l l') (symbolicMerge f b r r') symbolicMerge _ _ _ _ = error "SBV.STree.symbolicMerge: Impossible happened while merging states" -- | Reading a value. We bit-blast the index and descend down the full tree -- according to bit-values. readSTree :: (SFiniteBits i, SymWord e) => STree i e -> SBV i -> SBV e readSTree s i = walk (blastBE i) s where walk [] (SLeaf v) = v walk (b:bs) (SBin l r) = ite b (walk bs r) (walk bs l) walk _ _ = error $ "SBV.STree.readSTree: Impossible happened while reading: " ++ show i -- | Writing a value, similar to how reads are done. The important thing is that the tree -- representation keeps updates to a minimum. writeSTree :: (SFiniteBits i, SymWord e) => STree i e -> SBV i -> SBV e -> STree i e writeSTree s i j = walk (blastBE i) s where walk [] _ = SLeaf j walk (b:bs) (SBin l r) = SBin (ite b l (walk bs l)) (ite b (walk bs r) r) walk _ _ = error $ "SBV.STree.writeSTree: Impossible happened while reading: " ++ show i -- | Construct the fully balanced initial tree using the given values. mkSTree :: forall i e. HasKind i => [SBV e] -> STree i e mkSTree ivals | isReal (undefined :: i) = error "SBV.STree.mkSTree: Cannot build a real-valued sized tree" | not (isBounded (undefined :: i)) = error "SBV.STree.mkSTree: Cannot build an infinitely large tree" | reqd /= given = error $ "SBV.STree.mkSTree: Required " ++ show reqd ++ " elements, received: " ++ show given | True = go ivals where reqd = 2 ^ intSizeOf (undefined :: i) given = length ivals go [] = error "SBV.STree.mkSTree: Impossible happened, ran out of elements" go [l] = SLeaf l go ns = let (l, r) = splitAt (length ns `div` 2) ns in SBin (go l) (go r) sbv-7.13/Data/SBV/Utils/0000755000000000000000000000000013405536617013041 5ustar0000000000000000sbv-7.13/Data/SBV/Utils/Boolean.hs0000644000000000000000000000423513405536617014760 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Utils.Boolean -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Abstraction of booleans. Unfortunately, Haskell makes Bool's very hard to -- work with, by making it a fixed-data type. This is our workaround ----------------------------------------------------------------------------- module Data.SBV.Utils.Boolean(Boolean(..), bAnd, bOr, bAny, bAll) where infixl 6 <+> -- xor infixr 3 &&&, ~& -- and, nand infixr 2 |||, ~| -- or, nor infixr 1 ==>, <=> -- implies, iff -- | The 'Boolean' class: a generalization of Haskell's 'Bool' type -- Haskell 'Bool' and SBV's 'Data.SBV.SBool' are instances of this class, unifying the treatment of boolean values. -- -- Minimal complete definition: 'true', 'bnot', '&&&' -- However, it's advisable to define 'false', and '|||' as well (typically), for clarity. class Boolean b where -- | logical true true :: b -- | logical false false :: b -- | complement bnot :: b -> b -- | and (&&&) :: b -> b -> b -- | or (|||) :: b -> b -> b -- | nand (~&) :: b -> b -> b -- | nor (~|) :: b -> b -> b -- | xor (<+>) :: b -> b -> b -- | implies (==>) :: b -> b -> b -- | equivalence (<=>) :: b -> b -> b -- | cast from Bool fromBool :: Bool -> b -- default definitions false = bnot true a ||| b = bnot (bnot a &&& bnot b) a ~& b = bnot (a &&& b) a ~| b = bnot (a ||| b) a <+> b = (a &&& bnot b) ||| (bnot a &&& b) a <=> b = (a &&& b) ||| (bnot a &&& bnot b) a ==> b = bnot a ||| b fromBool True = true fromBool False = false -- | Generalization of 'and' bAnd :: Boolean b => [b] -> b bAnd = foldr (&&&) true -- | Generalization of 'or' bOr :: Boolean b => [b] -> b bOr = foldr (|||) false -- | Generalization of 'any' bAny :: Boolean b => (a -> b) -> [a] -> b bAny f = bOr . map f -- | Generalization of 'all' bAll :: Boolean b => (a -> b) -> [a] -> b bAll f = bAnd . map f instance Boolean Bool where true = True false = False bnot = not (&&&) = (&&) (|||) = (||) sbv-7.13/Data/SBV/Utils/Lib.hs0000644000000000000000000001727713405536617014121 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Utils.Lib -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Misc helpers ----------------------------------------------------------------------------- {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} module Data.SBV.Utils.Lib ( mlift2, mlift3, mlift4, mlift5, mlift6, mlift7, mlift8 , joinArgs, splitArgs , stringToQFS, qfsToString , isKString ) where import Data.Char (isSpace, chr, ord) import Data.Dynamic (fromDynamic, toDyn, Typeable) import Data.Maybe (fromJust, isJust, isNothing) import Numeric (readHex, readOct, showHex) -- | We have a nasty issue with the usual String/List confusion in Haskell. However, we can -- do a simple dynamic trick to determine where we are. The ice is thin here, but it seems to work. isKString :: forall a. Typeable a => a -> Bool isKString _ = isJust (fromDynamic (toDyn (undefined :: a)) :: Maybe String) -- | Monadic lift over 2-tuples mlift2 :: Monad m => (a' -> b' -> r) -> (a -> m a') -> (b -> m b') -> (a, b) -> m r mlift2 k f g (a, b) = f a >>= \a' -> g b >>= \b' -> return $ k a' b' -- | Monadic lift over 3-tuples mlift3 :: Monad m => (a' -> b' -> c' -> r) -> (a -> m a') -> (b -> m b') -> (c -> m c') -> (a, b, c) -> m r mlift3 k f g h (a, b, c) = f a >>= \a' -> g b >>= \b' -> h c >>= \c' -> return $ k a' b' c' -- | Monadic lift over 4-tuples mlift4 :: Monad m => (a' -> b' -> c' -> d' -> r) -> (a -> m a') -> (b -> m b') -> (c -> m c') -> (d -> m d') -> (a, b, c, d) -> m r mlift4 k f g h i (a, b, c, d) = f a >>= \a' -> g b >>= \b' -> h c >>= \c' -> i d >>= \d' -> return $ k a' b' c' d' -- | Monadic lift over 5-tuples mlift5 :: Monad m => (a' -> b' -> c' -> d' -> e' -> r) -> (a -> m a') -> (b -> m b') -> (c -> m c') -> (d -> m d') -> (e -> m e') -> (a, b, c, d, e) -> m r mlift5 k f g h i j (a, b, c, d, e) = f a >>= \a' -> g b >>= \b' -> h c >>= \c' -> i d >>= \d' -> j e >>= \e' -> return $ k a' b' c' d' e' -- | Monadic lift over 6-tuples mlift6 :: Monad m => (a' -> b' -> c' -> d' -> e' -> f' -> r) -> (a -> m a') -> (b -> m b') -> (c -> m c') -> (d -> m d') -> (e -> m e') -> (f -> m f') -> (a, b, c, d, e, f) -> m r mlift6 k f g h i j l (a, b, c, d, e, y) = f a >>= \a' -> g b >>= \b' -> h c >>= \c' -> i d >>= \d' -> j e >>= \e' -> l y >>= \y' -> return $ k a' b' c' d' e' y' -- | Monadic lift over 7-tuples mlift7 :: Monad m => (a' -> b' -> c' -> d' -> e' -> f' -> g' -> r) -> (a -> m a') -> (b -> m b') -> (c -> m c') -> (d -> m d') -> (e -> m e') -> (f -> m f') -> (g -> m g') -> (a, b, c, d, e, f, g) -> m r mlift7 k f g h i j l m (a, b, c, d, e, y, z) = f a >>= \a' -> g b >>= \b' -> h c >>= \c' -> i d >>= \d' -> j e >>= \e' -> l y >>= \y' -> m z >>= \z' -> return $ k a' b' c' d' e' y' z' -- | Monadic lift over 8-tuples mlift8 :: Monad m => (a' -> b' -> c' -> d' -> e' -> f' -> g' -> h' -> r) -> (a -> m a') -> (b -> m b') -> (c -> m c') -> (d -> m d') -> (e -> m e') -> (f -> m f') -> (g -> m g') -> (h -> m h') -> (a, b, c, d, e, f, g, h) -> m r mlift8 k f g h i j l m n (a, b, c, d, e, y, z, w) = f a >>= \a' -> g b >>= \b' -> h c >>= \c' -> i d >>= \d' -> j e >>= \e' -> l y >>= \y' -> m z >>= \z' -> n w >>= \w' -> return $ k a' b' c' d' e' y' z' w' -- Command line argument parsing code courtesy of Neil Mitchell's cmdargs package: see -- -- | Given a sequence of arguments, join them together in a manner that could be used on -- the command line, giving preference to the Windows @cmd@ shell quoting conventions. -- -- For an alternative version, intended for actual running the result in a shell, see "System.Process.showCommandForUser" joinArgs :: [String] -> String joinArgs = unwords . map f where f x = q ++ g x ++ q where hasSpace = any isSpace x q = ['\"' | hasSpace || null x] g ('\\':'\"':xs) = '\\':'\\':'\\':'\"': g xs g "\\" | hasSpace = "\\\\" g ('\"':xs) = '\\':'\"': g xs g (x':xs) = x' : g xs g [] = [] data State = Init -- either I just started, or just emitted something | Norm -- I'm seeing characters | Quot -- I've seen a quote -- | Given a string, split into the available arguments. The inverse of 'joinArgs'. -- Courtesy of the cmdargs package. splitArgs :: String -> [String] splitArgs = join . f Init where -- Nothing is start a new string -- Just x is accumulate onto the existing string join :: [Maybe Char] -> [String] join [] = [] join xs = map fromJust a : join (drop 1 b) where (a,b) = break isNothing xs f Init (x:xs) | isSpace x = f Init xs f Init "\"\"" = [Nothing] f Init "\"" = [Nothing] f Init xs = f Norm xs f m ('\"':'\"':'\"':xs) = Just '\"' : f m xs f m ('\\':'\"':xs) = Just '\"' : f m xs f m ('\\':'\\':'\"':xs) = Just '\\' : f m ('\"':xs) f Norm ('\"':xs) = f Quot xs f Quot ('\"':'\"':xs) = Just '\"' : f Norm xs f Quot ('\"':xs) = f Norm xs f Norm (x:xs) | isSpace x = Nothing : f Init xs f m (x:xs) = Just x : f m xs f _ [] = [] -- | Given a QF_S string (i.e., one that works in the string theory), convert it to a Haskell equivalent qfsToString :: String -> String qfsToString = go where go "" = "" go ('\\':'n' : rest) = chr 10 : go rest go ('\\':'\\' : rest) = '\\' : go rest go ('\\':'v' : rest) = chr 11 : go rest go ('\\':'f' : rest) = chr 12 : go rest go ('\\':'r' : rest) = chr 13 : go rest go ('\\':'x':c1:c2 : rest) | [(v, "")] <- readHex [c1, c2] = chr v : go rest go ('\\':c1:c2:c3 : rest) | [(v, "")] <- readOct [c1, c2, c3] = chr v : go rest go (c : rest) = c : go rest -- | Given a Haskell, convert it to one that's understood by the QF_S logic -- TODO: This function will require mods with the new String logic; as escapes -- will completely be different! stringToQFS :: String -> String stringToQFS = concatMap cvt where -- strings are almost just show, but escapes are different. Sigh cvt c | 0 <= o && o < 32 = escapeTable !! o | c == '\\' = "\\\\" | c == '"' = "\"\"" | o >= 128 && o < 256 = "\\x" ++ showHex (ord c) "" | o > 256 = error $ "Data.SBV: stringToQFS: Haskell character: " ++ show c ++ " is not representable in QF_S" | True = [c] where o = ord c -- | First 32 values are coded in a custom way by Z3: escapeTable :: [String] escapeTable = [ "\\x00", "\\x01", "\\x02", "\\x03", "\\x04", "\\x05", "\\x06", "\\x07", "\\x08", "\\x09", "\\n", "\\v", "\\f", "\\r", "\\x0E", "\\x0F" , "\\x10", "\\x11", "\\x12", "\\x13", "\\x14", "\\x15", "\\x16", "\\x17", "\\x18", "\\x19", "\\x1A", "\\x1B", "\\x1C", "\\x1D", "\\x1E", "\\x1F" ] sbv-7.13/Data/SBV/Utils/Numeric.hs0000644000000000000000000001165413405536617015006 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Utils.Numeric -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Various number related utilities ----------------------------------------------------------------------------- module Data.SBV.Utils.Numeric where -- | A variant of round; except defaulting to 0 when fed NaN or Infinity fpRound0 :: (RealFloat a, Integral b) => a -> b fpRound0 x | isNaN x || isInfinite x = 0 | True = round x -- | A variant of toRational; except defaulting to 0 when fed NaN or Infinity fpRatio0 :: (RealFloat a) => a -> Rational fpRatio0 x | isNaN x || isInfinite x = 0 | True = toRational x -- | The SMT-Lib (in particular Z3) implementation for min/max for floats does not agree with -- Haskell's; and also it does not agree with what the hardware does. Sigh.. See: -- -- -- So, we codify here what the Z3 (SMTLib) is implementing for fpMax. -- The discrepancy with Haskell is that the NaN propagation doesn't work in Haskell -- The discrepancy with x86 is that given +0/-0, x86 returns the second argument; SMTLib is non-deterministic fpMaxH :: RealFloat a => a -> a -> a fpMaxH x y | isNaN x = y | isNaN y = x | (isN0 x && isP0 y) || (isN0 y && isP0 x) = error "fpMaxH: Called with alternating-sign 0's. Not supported" | x > y = x | True = y where isN0 = isNegativeZero isP0 a = a == 0 && not (isN0 a) -- | SMTLib compliant definition for 'Data.SBV.fpMin'. See the comments for 'Data.SBV.fpMax'. fpMinH :: RealFloat a => a -> a -> a fpMinH x y | isNaN x = y | isNaN y = x | (isN0 x && isP0 y) || (isN0 y && isP0 x) = error "fpMinH: Called with alternating-sign 0's. Not supported" | x < y = x | True = y where isN0 = isNegativeZero isP0 a = a == 0 && not (isN0 a) -- | Convert double to float and back. Essentially @fromRational . toRational@ -- except careful on NaN, Infinities, and -0. fp2fp :: (RealFloat a, RealFloat b) => a -> b fp2fp x | isNaN x = 0 / 0 | isInfinite x && x < 0 = -1 / 0 | isInfinite x = 1 / 0 | isNegativeZero x = negate 0 | True = fromRational (toRational x) -- | Compute the "floating-point" remainder function, the float/double value that -- remains from the division of @x@ and @y@. There are strict rules around 0's, Infinities, -- and NaN's as coded below, See , towards the -- end of section 4.c. fpRemH :: RealFloat a => a -> a -> a fpRemH x y | isInfinite x || isNaN x = 0 / 0 | y == 0 || isNaN y = 0 / 0 | isInfinite y = x | True = pSign (x - fromRational (fromInteger d * ry)) where rx, ry, rd :: Rational rx = toRational x ry = toRational y rd = rx / ry d :: Integer d = round rd -- If the result is 0, make sure we preserve the sign of x pSign r | r == 0 = if x < 0 || isNegativeZero x then -0.0 else 0.0 | True = r -- | Convert a float to the nearest integral representable in that type fpRoundToIntegralH :: RealFloat a => a -> a fpRoundToIntegralH x | isNaN x = x | x == 0 = x | isInfinite x = x | i == 0 = if x < 0 || isNegativeZero x then -0.0 else 0.0 | True = fromInteger i where i :: Integer i = round x -- | Check that two floats are the exact same values, i.e., +0/-0 does not -- compare equal, and NaN's compare equal to themselves. fpIsEqualObjectH :: RealFloat a => a -> a -> Bool fpIsEqualObjectH a b | isNaN a = isNaN b | isNegativeZero a = isNegativeZero b | isNegativeZero b = isNegativeZero a | True = a == b -- | Ordering for floats, avoiding the +0/-0/NaN issues. Note that this is -- essentially used for indexing into a map, so we need to be total. Thus, -- the order we pick is: -- NaN -oo -0 +0 +oo -- The placement of NaN here is questionable, but immaterial. fpCompareObjectH :: RealFloat a => a -> a -> Ordering fpCompareObjectH a b | a `fpIsEqualObjectH` b = EQ | isNaN a = LT | isNaN b = GT | isNegativeZero a, b == 0 = LT | isNegativeZero b, a == 0 = GT | True = a `compare` b -- | Check if a number is "normal." Note that +0/-0 is not considered a normal-number -- and also this is not simply the negation of isDenormalized! fpIsNormalizedH :: RealFloat a => a -> Bool fpIsNormalizedH x = not (isDenormalized x || isInfinite x || isNaN x || x == 0) sbv-7.13/Data/SBV/Utils/PrettyNum.hs0000644000000000000000000004075713405536617015361 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Utils.PrettyNum -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Number representations in hex/bin ----------------------------------------------------------------------------- {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeSynonymInstances #-} module Data.SBV.Utils.PrettyNum ( PrettyNum(..), readBin, shex, chex, shexI, sbin, sbinI , showCFloat, showCDouble, showHFloat, showHDouble , showSMTFloat, showSMTDouble, smtRoundingMode, cwToSMTLib, mkSkolemZero ) where import Data.Char (intToDigit, ord) import Data.Int (Int8, Int16, Int32, Int64) import Data.List (isPrefixOf) import Data.Maybe (fromJust, fromMaybe, listToMaybe) import Data.Ratio (numerator, denominator) import Data.Word (Word8, Word16, Word32, Word64) import Numeric (showIntAtBase, showHex, readInt) import Data.Numbers.CrackNum (floatToFP, doubleToFP) import Data.SBV.Core.Data import Data.SBV.Core.Kind (smtType) import Data.SBV.Core.AlgReals (algRealToSMTLib2) import Data.SBV.Utils.Lib (stringToQFS) -- | PrettyNum class captures printing of numbers in hex and binary formats; also supporting negative numbers. -- -- Minimal complete definition: 'hexS' and 'binS' class PrettyNum a where -- | Show a number in hexadecimal (starting with @0x@ and type.) hexS :: a -> String -- | Show a number in binary (starting with @0b@ and type.) binS :: a -> String -- | Show a number in hex, without prefix, or types. hex :: a -> String -- | Show a number in bin, without prefix, or types. bin :: a -> String -- Why not default methods? Because defaults need "Integral a" but Bool is not.. instance PrettyNum Bool where {hexS = show; binS = show; hex = show; bin = show} instance PrettyNum String where {hexS = show; binS = show; hex = show; bin = show} instance PrettyNum Word8 where {hexS = shex True True (False,8) ; binS = sbin True True (False,8) ; hex = shex False False (False,8) ; bin = sbin False False (False,8) ;} instance PrettyNum Int8 where {hexS = shex True True (True,8) ; binS = sbin True True (True,8) ; hex = shex False False (True,8) ; bin = sbin False False (True,8) ;} instance PrettyNum Word16 where {hexS = shex True True (False,16); binS = sbin True True (False,16); hex = shex False False (False,16); bin = sbin False False (False,16);} instance PrettyNum Int16 where {hexS = shex True True (True,16); binS = sbin True True (True,16) ; hex = shex False False (True,16); bin = sbin False False (True,16) ;} instance PrettyNum Word32 where {hexS = shex True True (False,32); binS = sbin True True (False,32); hex = shex False False (False,32); bin = sbin False False (False,32);} instance PrettyNum Int32 where {hexS = shex True True (True,32); binS = sbin True True (True,32) ; hex = shex False False (True,32); bin = sbin False False (True,32) ;} instance PrettyNum Word64 where {hexS = shex True True (False,64); binS = sbin True True (False,64); hex = shex False False (False,64); bin = sbin False False (False,64);} instance PrettyNum Int64 where {hexS = shex True True (True,64); binS = sbin True True (True,64) ; hex = shex False False (True,64); bin = sbin False False (True,64) ;} instance PrettyNum Integer where {hexS = shexI True True; binS = sbinI True True; hex = shexI False False; bin = sbinI False False;} instance PrettyNum CW where hexS cw | isUninterpreted cw = show cw ++ " :: " ++ show (kindOf cw) | isBoolean cw = hexS (cwToBool cw) ++ " :: Bool" | isFloat cw = let CWFloat f = cwVal cw in show f ++ " :: Float\n" ++ show (floatToFP f) | isDouble cw = let CWDouble d = cwVal cw in show d ++ " :: Double\n" ++ show (doubleToFP d) | isReal cw = let CWAlgReal w = cwVal cw in show w ++ " :: Real" | isString cw = let CWString s = cwVal cw in show s ++ " :: String" | not (isBounded cw) = let CWInteger w = cwVal cw in shexI True True w | True = let CWInteger w = cwVal cw in shex True True (hasSign cw, intSizeOf cw) w binS cw | isUninterpreted cw = show cw ++ " :: " ++ show (kindOf cw) | isBoolean cw = binS (cwToBool cw) ++ " :: Bool" | isFloat cw = let CWFloat f = cwVal cw in show f ++ " :: Float\n" ++ show (floatToFP f) | isDouble cw = let CWDouble d = cwVal cw in show d ++ " :: Double\n" ++ show (doubleToFP d) | isReal cw = let CWAlgReal w = cwVal cw in show w ++ " :: Real" | isString cw = let CWString s = cwVal cw in show s ++ " :: String" | not (isBounded cw) = let CWInteger w = cwVal cw in sbinI True True w | True = let CWInteger w = cwVal cw in sbin True True (hasSign cw, intSizeOf cw) w hex cw | isUninterpreted cw = show cw | isBoolean cw = hexS (cwToBool cw) ++ " :: Bool" | isFloat cw = let CWFloat f = cwVal cw in show f | isDouble cw = let CWDouble d = cwVal cw in show d | isReal cw = let CWAlgReal w = cwVal cw in show w | isString cw = let CWString s = cwVal cw in show s | not (isBounded cw) = let CWInteger w = cwVal cw in shexI False False w | True = let CWInteger w = cwVal cw in shex False False (hasSign cw, intSizeOf cw) w bin cw | isUninterpreted cw = show cw | isBoolean cw = binS (cwToBool cw) ++ " :: Bool" | isFloat cw = let CWFloat f = cwVal cw in show f | isDouble cw = let CWDouble d = cwVal cw in show d | isReal cw = let CWAlgReal w = cwVal cw in show w | isString cw = let CWString s = cwVal cw in show s | not (isBounded cw) = let CWInteger w = cwVal cw in sbinI False False w | True = let CWInteger w = cwVal cw in sbin False False (hasSign cw, intSizeOf cw) w instance (SymWord a, PrettyNum a) => PrettyNum (SBV a) where hexS s = maybe (show s) (hexS :: a -> String) $ unliteral s binS s = maybe (show s) (binS :: a -> String) $ unliteral s hex s = maybe (show s) (hex :: a -> String) $ unliteral s bin s = maybe (show s) (bin :: a -> String) $ unliteral s -- | Show as a hexadecimal value. First bool controls whether type info is printed -- while the second boolean controls wether 0x prefix is printed. The tuple is -- the signedness and the bit-length of the input. The length of the string -- will /not/ depend on the value, but rather the bit-length. shex :: (Show a, Integral a) => Bool -> Bool -> (Bool, Int) -> a -> String shex shType shPre (signed, size) a | a < 0 = "-" ++ pre ++ pad l (s16 (abs (fromIntegral a :: Integer))) ++ t | True = pre ++ pad l (s16 a) ++ t where t | shType = " :: " ++ (if signed then "Int" else "Word") ++ show size | True = "" pre | shPre = "0x" | True = "" l = (size + 3) `div` 4 -- | Show as hexadecimal, but for C programs. We have to be careful about -- printing min-bounds, since C does some funky casting, possibly losing -- the sign bit. In those cases, we use the defined constants in . -- We also properly append the necessary suffixes as needed. chex :: (Show a, Integral a) => Bool -> Bool -> (Bool, Int) -> a -> String chex shType shPre (signed, size) a | Just s <- (signed, size, fromIntegral a) `lookup` specials = s | True = shex shType shPre (signed, size) a ++ suffix where specials :: [((Bool, Int, Integer), String)] specials = [ ((True, 8, fromIntegral (minBound :: Int8)), "INT8_MIN" ) , ((True, 16, fromIntegral (minBound :: Int16)), "INT16_MIN") , ((True, 32, fromIntegral (minBound :: Int32)), "INT32_MIN") , ((True, 64, fromIntegral (minBound :: Int64)), "INT64_MIN") ] suffix = case (signed, size) of (False, 16) -> "U" (False, 32) -> "UL" (True, 32) -> "L" (False, 64) -> "ULL" (True, 64) -> "LL" _ -> "" -- | Show as a hexadecimal value, integer version. Almost the same as shex above -- except we don't have a bit-length so the length of the string will depend -- on the actual value. shexI :: Bool -> Bool -> Integer -> String shexI shType shPre a | a < 0 = "-" ++ pre ++ s16 (abs a) ++ t | True = pre ++ s16 a ++ t where t | shType = " :: Integer" | True = "" pre | shPre = "0x" | True = "" -- | Similar to 'shex'; except in binary. sbin :: (Show a, Integral a) => Bool -> Bool -> (Bool, Int) -> a -> String sbin shType shPre (signed,size) a | a < 0 = "-" ++ pre ++ pad size (s2 (abs (fromIntegral a :: Integer))) ++ t | True = pre ++ pad size (s2 a) ++ t where t | shType = " :: " ++ (if signed then "Int" else "Word") ++ show size | True = "" pre | shPre = "0b" | True = "" -- | Similar to 'shexI'; except in binary. sbinI :: Bool -> Bool -> Integer -> String sbinI shType shPre a | a < 0 = "-" ++ pre ++ s2 (abs a) ++ t | True = pre ++ s2 a ++ t where t | shType = " :: Integer" | True = "" pre | shPre = "0b" | True = "" -- | Pad a string to a given length. If the string is longer, then we don't drop anything. pad :: Int -> String -> String pad l s = replicate (l - length s) '0' ++ s -- | Binary printer s2 :: (Show a, Integral a) => a -> String s2 v = showIntAtBase 2 dig v "" where dig = fromJust . flip lookup [(0, '0'), (1, '1')] -- | Hex printer s16 :: (Show a, Integral a) => a -> String s16 v = showHex v "" -- | A more convenient interface for reading binary numbers, also supports negative numbers readBin :: Num a => String -> a readBin ('-':s) = -(readBin s) readBin s = case readInt 2 isDigit cvt s' of [(a, "")] -> a _ -> error $ "SBV.readBin: Cannot read a binary number from: " ++ show s where cvt c = ord c - ord '0' isDigit = (`elem` "01") s' | "0b" `isPrefixOf` s = drop 2 s | True = s -- | A version of show for floats that generates correct C literals for nan/infinite. NB. Requires "math.h" to be included. showCFloat :: Float -> String showCFloat f | isNaN f = "((float) NAN)" | isInfinite f, f < 0 = "((float) (-INFINITY))" | isInfinite f = "((float) INFINITY)" | True = show f ++ "F" -- | A version of show for doubles that generates correct C literals for nan/infinite. NB. Requires "math.h" to be included. showCDouble :: Double -> String showCDouble f | isNaN f = "((double) NAN)" | isInfinite f, f < 0 = "((double) (-INFINITY))" | isInfinite f = "((double) INFINITY)" | True = show f -- | A version of show for floats that generates correct Haskell literals for nan/infinite showHFloat :: Float -> String showHFloat f | isNaN f = "((0/0) :: Float)" | isInfinite f, f < 0 = "((-1/0) :: Float)" | isInfinite f = "((1/0) :: Float)" | True = show f -- | A version of show for doubles that generates correct Haskell literals for nan/infinite showHDouble :: Double -> String showHDouble d | isNaN d = "((0/0) :: Double)" | isInfinite d, d < 0 = "((-1/0) :: Double)" | isInfinite d = "((1/0) :: Double)" | True = show d -- | A version of show for floats that generates correct SMTLib literals using the rounding mode showSMTFloat :: RoundingMode -> Float -> String showSMTFloat rm f | isNaN f = as "NaN" | isInfinite f, f < 0 = as "-oo" | isInfinite f = as "+oo" | isNegativeZero f = as "-zero" | f == 0 = as "+zero" | True = "((_ to_fp 8 24) " ++ smtRoundingMode rm ++ " " ++ toSMTLibRational (toRational f) ++ ")" where as s = "(_ " ++ s ++ " 8 24)" -- | A version of show for doubles that generates correct SMTLib literals using the rounding mode showSMTDouble :: RoundingMode -> Double -> String showSMTDouble rm d | isNaN d = as "NaN" | isInfinite d, d < 0 = as "-oo" | isInfinite d = as "+oo" | isNegativeZero d = as "-zero" | d == 0 = as "+zero" | True = "((_ to_fp 11 53) " ++ smtRoundingMode rm ++ " " ++ toSMTLibRational (toRational d) ++ ")" where as s = "(_ " ++ s ++ " 11 53)" -- | Show a rational in SMTLib format toSMTLibRational :: Rational -> String toSMTLibRational r | n < 0 = "(- (/ " ++ show (abs n) ++ ".0 " ++ show d ++ ".0))" | True = "(/ " ++ show n ++ ".0 " ++ show d ++ ".0)" where n = numerator r d = denominator r -- | Convert a rounding mode to the format SMT-Lib2 understands. smtRoundingMode :: RoundingMode -> String smtRoundingMode RoundNearestTiesToEven = "roundNearestTiesToEven" smtRoundingMode RoundNearestTiesToAway = "roundNearestTiesToAway" smtRoundingMode RoundTowardPositive = "roundTowardPositive" smtRoundingMode RoundTowardNegative = "roundTowardNegative" smtRoundingMode RoundTowardZero = "roundTowardZero" -- | Convert a CW to an SMTLib2 compliant value cwToSMTLib :: RoundingMode -> CW -> String cwToSMTLib rm x | isBoolean x, CWInteger w <- cwVal x = if w == 0 then "false" else "true" | isUninterpreted x, CWUserSort (_, s) <- cwVal x = roundModeConvert s | isReal x, CWAlgReal r <- cwVal x = algRealToSMTLib2 r | isFloat x, CWFloat f <- cwVal x = showSMTFloat rm f | isDouble x, CWDouble d <- cwVal x = showSMTDouble rm d | not (isBounded x), CWInteger w <- cwVal x = if w >= 0 then show w else "(- " ++ show (abs w) ++ ")" | not (hasSign x) , CWInteger w <- cwVal x = smtLibHex (intSizeOf x) w -- signed numbers (with 2's complement representation) is problematic -- since there's no way to put a bvneg over a positive number to get minBound.. -- Hence, we punt and use binary notation in that particular case | hasSign x , CWInteger w <- cwVal x = if w == negate (2 ^ intSizeOf x) then mkMinBound (intSizeOf x) else negIf (w < 0) $ smtLibHex (intSizeOf x) (abs w) | isChar x , CWChar c <- cwVal x = smtLibHex 8 (fromIntegral (ord c)) | isString x , CWString s <- cwVal x = '\"' : stringToQFS s ++ "\"" | isList x , CWList xs <- cwVal x = smtLibSeq (kindOf x) xs | True = error $ "SBV.cvtCW: Impossible happened: Kind/Value disagreement on: " ++ show (kindOf x, x) where roundModeConvert s = fromMaybe s (listToMaybe [smtRoundingMode m | m <- [minBound .. maxBound] :: [RoundingMode], show m == s]) -- Carefully code hex numbers, SMTLib is picky about lengths of hex constants. For the time -- being, SBV only supports sizes that are multiples of 4, but the below code is more robust -- in case of future extensions to support arbitrary sizes. smtLibHex :: Int -> Integer -> String smtLibHex 1 v = "#b" ++ show v smtLibHex sz v | sz `mod` 4 == 0 = "#x" ++ pad (sz `div` 4) (showHex v "") | True = "#b" ++ pad sz (showBin v "") where showBin = showIntAtBase 2 intToDigit negIf :: Bool -> String -> String negIf True a = "(bvneg " ++ a ++ ")" negIf False a = a smtLibSeq :: Kind -> [CWVal] -> String smtLibSeq k [] = "(as seq.empty " ++ smtType k ++ ")" smtLibSeq (KList ek) xs = let mkSeq [e] = e mkSeq es = "(seq.++ " ++ unwords es ++ ")" mkUnit inner = "(seq.unit " ++ inner ++ ")" in mkSeq (mkUnit . cwToSMTLib rm . CW ek <$> xs) smtLibSeq k _ = error "SBV.cwToSMTLib: Impossible case (smtLibSeq), received kind: " ++ show k -- anamoly at the 2's complement min value! Have to use binary notation here -- as there is no positive value we can provide to make the bvneg work.. (see above) mkMinBound :: Int -> String mkMinBound i = "#b1" ++ replicate (i-1) '0' -- | Create a skolem 0 for the kind mkSkolemZero :: RoundingMode -> Kind -> String mkSkolemZero _ (KUserSort _ (Right (f:_))) = f mkSkolemZero _ (KUserSort s _) = error $ "SBV.mkSkolemZero: Unexpected uninterpreted sort: " ++ s mkSkolemZero rm k = cwToSMTLib rm (mkConstCW k (0::Integer)) sbv-7.13/Data/SBV/Utils/SExpr.hs0000644000000000000000000003334113405536617014442 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Utils.SExpr -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Parsing of S-expressions (mainly used for parsing SMT-Lib get-value output) ----------------------------------------------------------------------------- {-# LANGUAGE BangPatterns #-} module Data.SBV.Utils.SExpr (SExpr(..), parenDeficit, parseSExpr) where import Data.Bits (setBit, testBit) import Data.Word (Word32, Word64) import Data.Char (isDigit, ord, isSpace) import Data.List (isPrefixOf) import Data.Maybe (fromMaybe, listToMaybe) import Numeric (readInt, readDec, readHex, fromRat) import Data.SBV.Core.AlgReals import Data.SBV.Core.Data (nan, infinity, RoundingMode(..)) import Data.Numbers.CrackNum (wordToFloat, wordToDouble) -- | ADT S-Expression format, suitable for representing get-model output of SMT-Lib data SExpr = ECon String | ENum (Integer, Maybe Int) -- Second argument is how wide the field was in bits, if known. Useful in FP parsing. | EReal AlgReal | EFloat Float | EDouble Double | EApp [SExpr] deriving Show -- | Extremely simple minded tokenizer, good for our use model. tokenize :: String -> [String] tokenize inp = go inp [] where go "" sofar = reverse sofar go (c:cs) sofar | isSpace c = go (dropWhile isSpace cs) sofar go ('(':cs) sofar = go cs ("(" : sofar) go (')':cs) sofar = go cs (")" : sofar) go (':':':':cs) sofar = go cs ("::" : sofar) go (':':cs) sofar = case break (`elem` stopper) cs of (pre, rest) -> go rest ((':':pre) : sofar) go ('|':r) sofar = case span (/= '|') r of (pre, '|':rest) -> go rest (pre : sofar) (pre, rest) -> go rest (pre : sofar) go ('"':r) sofar = go rest (finalStr : sofar) where grabString [] acc = (reverse acc, []) -- Strictly speaking, this is the unterminated string case; but let's ignore grabString ('"' :'"':cs) acc = grabString cs ('"' :acc) grabString ('"':cs) acc = (reverse acc, cs) grabString (c:cs) acc = grabString cs (c:acc) (str, rest) = grabString r [] finalStr = '"' : str ++ "\"" go cs sofar = case span (`notElem` stopper) cs of (pre, post) -> go post (pre : sofar) -- characters that can stop the current token -- it is *crucial* that this list contains every character -- we can match in one of the previous cases! stopper = " \t\n():|\"" -- | The balance of parens in this string. If 0, this means it's a legit line! parenDeficit :: String -> Int parenDeficit = go 0 . tokenize where go :: Int -> [String] -> Int go !balance [] = balance go !balance ("(" : rest) = go (balance+1) rest go !balance (")" : rest) = go (balance-1) rest go !balance (_ : rest) = go balance rest -- | Parse a string into an SExpr, potentially failing with an error message parseSExpr :: String -> Either String SExpr parseSExpr inp = do (sexp, extras) <- parse inpToks if null extras then case sexp of EApp [ECon "error", ECon er] -> Left $ "Solver returned an error: " ++ er _ -> return sexp else die "Extra tokens after valid input" where inpToks = tokenize inp die w = fail $ "SBV.Provers.SExpr: Failed to parse S-Expr: " ++ w ++ "\n*** Input : <" ++ inp ++ ">" parse [] = die "ran out of tokens" parse ("(":toks) = do (f, r) <- parseApp toks [] f' <- cvt (EApp f) return (f', r) parse (")":_) = die "extra tokens after close paren" parse [tok] = do t <- pTok tok return (t, []) parse _ = die "ill-formed s-expr" parseApp [] _ = die "failed to grab s-expr application" parseApp (")":toks) sofar = return (reverse sofar, toks) parseApp ("(":toks) sofar = do (f, r) <- parse ("(":toks) parseApp r (f : sofar) parseApp (tok:toks) sofar = do t <- pTok tok parseApp toks (t : sofar) pTok "false" = return $ ENum (0, Nothing) pTok "true" = return $ ENum (1, Nothing) pTok ('0':'b':r) = mkNum (Just (length r)) $ readInt 2 (`elem` "01") (\c -> ord c - ord '0') r pTok ('b':'v':r) | not (null r) && all isDigit r = mkNum Nothing $ readDec (takeWhile (/= '[') r) pTok ('#':'b':r) = mkNum (Just (length r)) $ readInt 2 (`elem` "01") (\c -> ord c - ord '0') r pTok ('#':'x':r) = mkNum (Just (4 * length r)) $ readHex r pTok n | not (null n) && isDigit (head n) = if '.' `elem` n then getReal n else mkNum Nothing $ readDec n pTok n = return $ ECon (constantMap n) mkNum l [(n, "")] = return $ ENum (n, l) mkNum _ _ = die "cannot read number" getReal n = return $ EReal $ mkPolyReal (Left (exact, n')) where exact = not ("?" `isPrefixOf` reverse n) n' | exact = n | True = init n -- simplify numbers and root-obj values cvt (EApp [ECon "to_int", EReal a]) = return $ EReal a -- ignore the "casting" cvt (EApp [ECon "to_real", EReal a]) = return $ EReal a -- ignore the "casting" cvt (EApp [ECon "/", EReal a, EReal b]) = return $ EReal (a / b) cvt (EApp [ECon "/", EReal a, ENum b]) = return $ EReal (a / fromInteger (fst b)) cvt (EApp [ECon "/", ENum a, EReal b]) = return $ EReal (fromInteger (fst a) / b ) cvt (EApp [ECon "/", ENum a, ENum b]) = return $ EReal (fromInteger (fst a) / fromInteger (fst b)) cvt (EApp [ECon "-", EReal a]) = return $ EReal (-a) cvt (EApp [ECon "-", ENum a]) = return $ ENum (-(fst a), snd a) -- bit-vector value as CVC4 prints: (_ bv0 16) for instance cvt (EApp [ECon "_", ENum a, ENum _b]) = return $ ENum a cvt (EApp [ECon "root-obj", EApp (ECon "+":trms), ENum k]) = do ts <- mapM getCoeff trms return $ EReal $ mkPolyReal (Right (fst k, ts)) cvt (EApp [ECon "as", n, EApp [ECon "_", ECon "FloatingPoint", ENum (11, _), ENum (53, _)]]) = getDouble n cvt (EApp [ECon "as", n, EApp [ECon "_", ECon "FloatingPoint", ENum ( 8, _), ENum (24, _)]]) = getFloat n cvt (EApp [ECon "as", n, ECon "Float64"]) = getDouble n cvt (EApp [ECon "as", n, ECon "Float32"]) = getFloat n -- NB. Note the lengths on the mantissa for the following two are 23/52; not 24/53! cvt (EApp [ECon "fp", ENum (s, Just 1), ENum ( e, Just 8), ENum (m, Just 23)]) = return $ EFloat $ getTripleFloat s e m cvt (EApp [ECon "fp", ENum (s, Just 1), ENum ( e, Just 11), ENum (m, Just 52)]) = return $ EDouble $ getTripleDouble s e m cvt (EApp [ECon "_", ECon "NaN", ENum ( 8, _), ENum (24, _)]) = return $ EFloat nan cvt (EApp [ECon "_", ECon "NaN", ENum (11, _), ENum (53, _)]) = return $ EDouble nan cvt (EApp [ECon "_", ECon "+oo", ENum ( 8, _), ENum (24, _)]) = return $ EFloat infinity cvt (EApp [ECon "_", ECon "+oo", ENum (11, _), ENum (53, _)]) = return $ EDouble infinity cvt (EApp [ECon "_", ECon "-oo", ENum ( 8, _), ENum (24, _)]) = return $ EFloat (-infinity) cvt (EApp [ECon "_", ECon "-oo", ENum (11, _), ENum (53, _)]) = return $ EDouble (-infinity) cvt (EApp [ECon "_", ECon "+zero", ENum ( 8, _), ENum (24, _)]) = return $ EFloat 0 cvt (EApp [ECon "_", ECon "+zero", ENum (11, _), ENum (53, _)]) = return $ EDouble 0 cvt (EApp [ECon "_", ECon "-zero", ENum ( 8, _), ENum (24, _)]) = return $ EFloat (-0) cvt (EApp [ECon "_", ECon "-zero", ENum (11, _), ENum (53, _)]) = return $ EDouble (-0) cvt x = return x getCoeff (EApp [ECon "*", ENum k, EApp [ECon "^", ECon "x", ENum p]]) = return (fst k, fst p) -- kx^p getCoeff (EApp [ECon "*", ENum k, ECon "x" ] ) = return (fst k, 1) -- kx getCoeff ( EApp [ECon "^", ECon "x", ENum p] ) = return ( 1, fst p) -- x^p getCoeff ( ECon "x" ) = return ( 1, 1) -- x getCoeff ( ENum k ) = return (fst k, 0) -- k getCoeff x = die $ "Cannot parse a root-obj,\nProcessing term: " ++ show x getDouble (ECon s) = case (s, rdFP (dropWhile (== '+') s)) of ("plusInfinity", _ ) -> return $ EDouble infinity ("minusInfinity", _ ) -> return $ EDouble (-infinity) ("oo", _ ) -> return $ EDouble infinity ("-oo", _ ) -> return $ EDouble (-infinity) ("zero", _ ) -> return $ EDouble 0 ("-zero", _ ) -> return $ EDouble (-0) ("NaN", _ ) -> return $ EDouble nan (_, Just v) -> return $ EDouble v _ -> die $ "Cannot parse a double value from: " ++ s getDouble (EApp [_, s, _, _]) = getDouble s getDouble (EReal r) = return $ EDouble $ fromRat $ toRational r getDouble x = die $ "Cannot parse a double value from: " ++ show x getFloat (ECon s) = case (s, rdFP (dropWhile (== '+') s)) of ("plusInfinity", _ ) -> return $ EFloat infinity ("minusInfinity", _ ) -> return $ EFloat (-infinity) ("oo", _ ) -> return $ EFloat infinity ("-oo", _ ) -> return $ EFloat (-infinity) ("zero", _ ) -> return $ EFloat 0 ("-zero", _ ) -> return $ EFloat (-0) ("NaN", _ ) -> return $ EFloat nan (_, Just v) -> return $ EFloat v _ -> die $ "Cannot parse a float value from: " ++ s getFloat (EReal r) = return $ EFloat $ fromRat $ toRational r getFloat (EApp [_, s, _, _]) = getFloat s getFloat x = die $ "Cannot parse a float value from: " ++ show x -- | Parses the Z3 floating point formatted numbers like so: 1.321p5/1.2123e9 etc. rdFP :: (Read a, RealFloat a) => String -> Maybe a rdFP s = case break (`elem` "pe") s of (m, 'p':e) -> rd m >>= \m' -> rd e >>= \e' -> return $ m' * ( 2 ** e') (m, 'e':e) -> rd m >>= \m' -> rd e >>= \e' -> return $ m' * (10 ** e') (m, "") -> rd m _ -> Nothing where rd v = case reads v of [(n, "")] -> Just n _ -> Nothing -- | Convert an (s, e, m) triple to a float value getTripleFloat :: Integer -> Integer -> Integer -> Float getTripleFloat s e m = wordToFloat w32 where sign = [s == 1] expt = [e `testBit` i | i <- [ 7, 6 .. 0]] mantissa = [m `testBit` i | i <- [22, 21 .. 0]] positions = [i | (i, b) <- zip [31, 30 .. 0] (sign ++ expt ++ mantissa), b] w32 = foldr (flip setBit) (0::Word32) positions -- | Convert an (s, e, m) triple to a float value getTripleDouble :: Integer -> Integer -> Integer -> Double getTripleDouble s e m = wordToDouble w64 where sign = [s == 1] expt = [e `testBit` i | i <- [10, 9 .. 0]] mantissa = [m `testBit` i | i <- [51, 50 .. 0]] positions = [i | (i, b) <- zip [63, 62 .. 0] (sign ++ expt ++ mantissa), b] w64 = foldr (flip setBit) (0::Word64) positions -- | Special constants of SMTLib2 and their internal translation. Mainly -- rounding modes for now. constantMap :: String -> String constantMap n = fromMaybe n (listToMaybe [to | (from, to) <- special, n `elem` from]) where special = [ (["RNE", "roundNearestTiesToEven"], show RoundNearestTiesToEven) , (["RNA", "roundNearestTiesToAway"], show RoundNearestTiesToAway) , (["RTP", "roundTowardPositive"], show RoundTowardPositive) , (["RTN", "roundTowardNegative"], show RoundTowardNegative) , (["RTZ", "roundTowardZero"], show RoundTowardZero) ] sbv-7.13/Data/SBV/Utils/TDiff.hs0000644000000000000000000000374213405536617014377 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Utils.TDiff -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Runs an IO computation printing the time it took to run it ----------------------------------------------------------------------------- module Data.SBV.Utils.TDiff ( Timing(..) , showTDiff ) where import Data.Time (NominalDiffTime) import Data.IORef (IORef) import Data.List (intercalate) import Data.Ratio import GHC.Real (Ratio((:%))) import Numeric (showFFloat) -- | Specify how to save timing information, if at all. data Timing = NoTiming | PrintTiming | SaveTiming (IORef NominalDiffTime) -- | Show 'NominalDiffTime' in human readable form. 'NominalDiffTime' is -- essentially picoseconds (10^-12 seconds). We show it so that -- it's represented at the day:hour:minute:second.XXX granularity. showTDiff :: NominalDiffTime -> String showTDiff diff | denom /= 1 -- Should never happen! But just in case. = show diff | True = intercalate ":" fields where total, denom :: Integer total :% denom = (picoFactor % 1) * toRational diff -- there are 10^12 pico-seconds in a second picoFactor :: Integer picoFactor = (10 :: Integer) ^ (12 :: Integer) [s2p, m2s, h2m, d2h] = drop 1 $ scanl (*) 1 [picoFactor, 60, 60, 24] (days, days') = total `divMod` d2h (hours, hours') = days' `divMod` h2m (minutes, seconds') = hours' `divMod` m2s (seconds, picos) = seconds' `divMod` s2p secondsPicos = show seconds ++ dropWhile (/= '.') (showFFloat (Just 3) (fromIntegral picos * (10**(-12) :: Double)) "s") aboveSeconds = map (\(t, v) -> show v ++ [t]) $ dropWhile (\p -> snd p == 0) [('d', days), ('h', hours), ('m', minutes)] fields = aboveSeconds ++ [secondsPicos] sbv-7.13/Documentation/0000755000000000000000000000000013405536617013247 5ustar0000000000000000sbv-7.13/Documentation/SBV/0000755000000000000000000000000013405536617013701 5ustar0000000000000000sbv-7.13/Documentation/SBV/Examples/0000755000000000000000000000000013405536617015457 5ustar0000000000000000sbv-7.13/Documentation/SBV/Examples/BitPrecise/0000755000000000000000000000000013405536617017510 5ustar0000000000000000sbv-7.13/Documentation/SBV/Examples/BitPrecise/BitTricks.hs0000644000000000000000000000467413405536617021755 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.BitPrecise.BitTricks -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Checks the correctness of a few tricks from the large collection found in: -- ----------------------------------------------------------------------------- module Documentation.SBV.Examples.BitPrecise.BitTricks where import Data.SBV -- | Formalizes fastMinCorrect :: SInt32 -> SInt32 -> SBool fastMinCorrect x y = m .== fm where m = ite (x .< y) x y fm = y `xor` ((x `xor` y) .&. (-(oneIf (x .< y)))); -- | Formalizes fastMaxCorrect :: SInt32 -> SInt32 -> SBool fastMaxCorrect x y = m .== fm where m = ite (x .< y) y x fm = x `xor` ((x `xor` y) .&. (-(oneIf (x .< y)))); -- | Formalizes oppositeSignsCorrect :: SInt32 -> SInt32 -> SBool oppositeSignsCorrect x y = r .== os where r = (x .< 0 &&& y .>= 0) ||| (x .>= 0 &&& y .< 0) os = (x `xor` y) .< 0 -- | Formalizes conditionalSetClearCorrect :: SBool -> SWord32 -> SWord32 -> SBool conditionalSetClearCorrect f m w = r .== r' where r = ite f (w .|. m) (w .&. complement m) r' = w `xor` ((-(oneIf f) `xor` w) .&. m); -- | Formalizes powerOfTwoCorrect :: SWord32 -> SBool powerOfTwoCorrect v = f .== s where f = (v ./= 0) &&& ((v .&. (v-1)) .== 0); powers :: [Word32] powers = map ((2::Word32)^) [(0::Word32) .. 31] s = bAny (v .==) $ map literal powers -- | Collection of queries queries :: IO () queries = let check :: Provable a => String -> a -> IO () check w t = do putStr $ "Proving " ++ show w ++ ": " print =<< prove t in do check "Fast min " fastMinCorrect check "Fast max " fastMaxCorrect check "Opposite signs " oppositeSignsCorrect check "Conditional set/clear" conditionalSetClearCorrect check "PowerOfTwo " powerOfTwoCorrect sbv-7.13/Documentation/SBV/Examples/BitPrecise/BrokenSearch.hs0000644000000000000000000000767213405536617022426 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.BitPrecise.BrokenSearch -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- The classic "binary-searches are broken" example: -- ----------------------------------------------------------------------------- module Documentation.SBV.Examples.BitPrecise.BrokenSearch where import Data.SBV import Data.SBV.Tools.Overflow -- | Model the mid-point computation of the binary search, which is broken due to arithmetic overflow. -- Note how we use the overflow checking variants of the arithmetic operators. We have: -- -- >>> checkArithOverflow midPointBroken -- Documentation/SBV/Examples/BitPrecise/BrokenSearch.hs:33:28:+!: SInt32 addition overflows: Violated. Model: -- low = 2147483647 :: Int32 -- high = 2147483647 :: Int32 -- -- Indeed: -- -- >>> (2147483647 + 2147483647) `div` (2::Int32) -- -1 -- -- giving us a negative mid-point value! midPointBroken :: SInt32 -> SInt32 -> SInt32 midPointBroken low high = (low +! high) /! 2 -- | The correct version of how to compute the mid-point. As expected, this version doesn't have any -- underflow or overflow issues: -- -- >>> checkArithOverflow midPointFixed -- No violations detected. -- -- As expected, the value is computed correctly too: -- -- >>> checkCorrectMidValue midPointFixed -- Q.E.D. midPointFixed :: SInt32 -> SInt32 -> SInt32 midPointFixed low high = low +! ((high -! low) /! 2) -- | Show that the variant suggested by the blog post is good as well: -- -- @mid = ((unsigned int)low + (unsigned int)high) >> 1;@ -- -- In this case the overflow is eliminated by doing the computation at a wider -- range: -- -- >>> checkArithOverflow midPointAlternative -- No violations detected. -- -- And the value computed is indeed correct: -- -- >>> checkCorrectMidValue midPointAlternative -- Q.E.D. midPointAlternative :: SInt32 -> SInt32 -> SInt32 midPointAlternative low high = sFromIntegral ((low' +! high') `shiftR` 1) where low', high' :: SWord32 low' = sFromIntegralChecked low high' = sFromIntegralChecked high ------------------------------------------------------------------------------------- -- * Helpers ------------------------------------------------------------------------------------- -- | A helper predicate to check safety under the conditions that @low@ is at least 0 -- and @high@ is at least @low@. checkArithOverflow :: (SInt32 -> SInt32 -> SInt32) -> IO () checkArithOverflow f = do sr <- safe $ do low <- sInt32 "low" high <- sInt32 "high" constrain $ low .>= 0 constrain $ low .<= high output $ f low high case filter (not . isSafe) sr of [] -> putStrLn "No violations detected." xs -> mapM_ print xs -- | Another helper to show that the result is actually the correct value, if it was done over -- 64-bit integers, which is sufficiently large enough. checkCorrectMidValue :: (SInt32 -> SInt32 -> SInt32) -> IO ThmResult checkCorrectMidValue f = prove $ do low <- sInt32 "low" high <- sInt32 "high" constrain $ low .>= 0 constrain $ low .<= high let low', high' :: SInt64 low' = sFromIntegral low high' = sFromIntegral high mid' = (low' + high') `sDiv` 2 mid = f low high return $ sFromIntegral mid .== mid' sbv-7.13/Documentation/SBV/Examples/BitPrecise/Legato.hs0000644000000000000000000002741213405536617021265 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.BitPrecise.Legato -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- An encoding and correctness proof of Legato's multiplier in Haskell. Bill Legato came -- up with an interesting way to multiply two 8-bit numbers on Mostek, as described here: -- -- -- Here's Legato's algorithm, as coded in Mostek assembly: -- -- @ -- step1 : LDX #8 ; load X immediate with the integer 8 -- step2 : LDA #0 ; load A immediate with the integer 0 -- step3 : LOOP ROR F1 ; rotate F1 right circular through C -- step4 : BCC ZCOEF ; branch to ZCOEF if C = 0 -- step5 : CLC ; set C to 0 -- step6 : ADC F2 ; set A to A+F2+C and C to the carry -- step7 : ZCOEF ROR A ; rotate A right circular through C -- step8 : ROR LOW ; rotate LOW right circular through C -- step9 : DEX ; set X to X-1 -- step10: BNE LOOP ; branch to LOOP if Z = 0 -- @ -- -- This program came to be known as the Legato's challenge in the community, where -- the challenge was to prove that it indeed does perform multiplication. This file -- formalizes the Mostek architecture in Haskell and proves that Legato's algorithm -- is indeed correct. ----------------------------------------------------------------------------- {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveAnyClass #-} module Documentation.SBV.Examples.BitPrecise.Legato where import Data.Array (Array, Ix(..), (!), (//), array) import Data.SBV import Data.SBV.Tools.CodeGen import Data.SBV.Internals (Timing(PrintTiming)) import GHC.Generics (Generic) ------------------------------------------------------------------ -- * Mostek architecture ------------------------------------------------------------------ -- | We model only two registers of Mostek that is used in the above algorithm, can add more. data Register = RegX | RegA deriving (Eq, Ord, Ix, Bounded) -- | The carry flag ('FlagC') and the zero flag ('FlagZ') data Flag = FlagC | FlagZ deriving (Eq, Ord, Ix, Bounded) -- | Mostek was an 8-bit machine. type Value = SWord8 -- | Convenient synonym for symbolic machine bits. type Bit = SBool -- | Register bank type Registers = Array Register Value -- | Flag bank type Flags = Array Flag Bit -- | We have three memory locations, sufficient to model our problem data Location = F1 -- ^ multiplicand | F2 -- ^ multiplier | LO -- ^ low byte of the result gets stored here deriving (Eq, Ord, Ix, Bounded) -- | Memory is simply an array from locations to values type Memory = Array Location Value -- | Abstraction of the machine: The CPU consists of memory, registers, and flags. -- Unlike traditional hardware, we assume the program is stored in some other memory area that -- we need not model. (No self modifying programs!) -- -- 'Mostek' is equipped with an automatically derived 'Mergeable' instance -- because each field is 'Mergeable'. data Mostek = Mostek { memory :: Memory , registers :: Registers , flags :: Flags } deriving (Generic, Mergeable) -- | Given a machine state, compute a value out of it type Extract a = Mostek -> a -- | Programs are essentially state transformers (on the machine state) type Program = Mostek -> Mostek ------------------------------------------------------------------ -- * Low-level operations ------------------------------------------------------------------ -- | Get the value of a given register getReg :: Register -> Extract Value getReg r m = registers m ! r -- | Set the value of a given register setReg :: Register -> Value -> Program setReg r v m = m {registers = registers m // [(r, v)]} -- | Get the value of a flag getFlag :: Flag -> Extract Bit getFlag f m = flags m ! f -- | Set the value of a flag setFlag :: Flag -> Bit -> Program setFlag f b m = m {flags = flags m // [(f, b)]} -- | Read memory peek :: Location -> Extract Value peek a m = memory m ! a -- | Write to memory poke :: Location -> Value -> Program poke a v m = m {memory = memory m // [(a, v)]} -- | Checking overflow. In Legato's multipler the @ADC@ instruction -- needs to see if the expression x + y + c overflowed, as checked -- by this function. Note that we verify the correctness of this check -- separately below in `checkOverflowCorrect`. checkOverflow :: SWord8 -> SWord8 -> SBool -> SBool checkOverflow x y c = s .< x ||| s .< y ||| s' .< s where s = x + y s' = s + ite c 1 0 -- | Correctness theorem for our `checkOverflow` implementation. -- -- We have: -- -- >>> checkOverflowCorrect -- Q.E.D. checkOverflowCorrect :: IO ThmResult checkOverflowCorrect = checkOverflow === overflow where -- Reference spec for overflow. We do the addition -- using 16 bits and check that it's larger than 255 overflow :: SWord8 -> SWord8 -> SBool -> SBool overflow x y c = (0 # x) + (0 # y) + ite c 1 0 .> 255 ------------------------------------------------------------------ -- * Instruction set ------------------------------------------------------------------ -- | An instruction is modeled as a 'Program' transformer. We model -- mostek programs in direct continuation passing style. type Instruction = Program -> Program -- | LDX: Set register @X@ to value @v@ ldx :: Value -> Instruction ldx v k = k . setReg RegX v -- | LDA: Set register @A@ to value @v@ lda :: Value -> Instruction lda v k = k . setReg RegA v -- | CLC: Clear the carry flag clc :: Instruction clc k = k . setFlag FlagC false -- | ROR, memory version: Rotate the value at memory location @a@ -- to the right by 1 bit, using the carry flag as a transfer position. -- That is, the final bit of the memory location becomes the new carry -- and the carry moves over to the first bit. This very instruction -- is one of the reasons why Legato's multiplier is quite hard to understand -- and is typically presented as a verification challenge. rorM :: Location -> Instruction rorM a k m = k . setFlag FlagC c' . poke a v' $ m where v = peek a m c = getFlag FlagC m v' = setBitTo (v `rotateR` 1) 7 c c' = sTestBit v 0 -- | ROR, register version: Same as 'rorM', except through register @r@. rorR :: Register -> Instruction rorR r k m = k . setFlag FlagC c' . setReg r v' $ m where v = getReg r m c = getFlag FlagC m v' = setBitTo (v `rotateR` 1) 7 c c' = sTestBit v 0 -- | BCC: branch to label @l@ if the carry flag is false bcc :: Program -> Instruction bcc l k m = ite (c .== false) (l m) (k m) where c = getFlag FlagC m -- | ADC: Increment the value of register @A@ by the value of memory contents -- at location @a@, using the carry-bit as the carry-in for the addition. adc :: Location -> Instruction adc a k m = k . setFlag FlagZ (v' .== 0) . setFlag FlagC c' . setReg RegA v' $ m where v = peek a m ra = getReg RegA m c = getFlag FlagC m v' = v + ra + ite c 1 0 c' = checkOverflow v ra c -- | DEX: Decrement the value of register @X@ dex :: Instruction dex k m = k . setFlag FlagZ (x .== 0) . setReg RegX x $ m where x = getReg RegX m - 1 -- | BNE: Branch if the zero-flag is false bne :: Program -> Instruction bne l k m = ite (z .== false) (l m) (k m) where z = getFlag FlagZ m -- | The 'end' combinator "stops" our program, providing the final continuation -- that does nothing. end :: Program end = id ------------------------------------------------------------------ -- * Legato's algorithm in Haskell/SBV ------------------------------------------------------------------ -- | Multiplies the contents of @F1@ and @F2@, storing the low byte of the result -- in @LO@ and the high byte of it in register @A@. The implementation is a direct -- transliteration of Legato's algorithm given at the top, using our notation. legato :: Program legato = start where start = ldx 8 $ lda 0 $ loop loop = rorM F1 $ bcc zeroCoef $ clc $ adc F2 $ zeroCoef zeroCoef = rorR RegA $ rorM LO $ dex $ bne loop $ end ------------------------------------------------------------------ -- * Verification interface ------------------------------------------------------------------ -- | Given values for F1 and F2, @runLegato@ takes an arbitrary machine state @m@ and -- returns the high and low bytes of the multiplication. runLegato :: Mostek -> (Value, Value) runLegato m = (getReg RegA m', peek LO m') where m' = legato m -- | Helper synonym for capturing relevant bits of Mostek type InitVals = ( Value -- Contents of mem location F1 , Value -- Contents of mem location F2 , Value -- Contents of mem location LO , Value -- Content of Register X , Value -- Content of Register A , Bit -- Value of FlagC , Bit -- Value of FlagZ ) -- | Create an instance of the Mostek machine, initialized by the memory and the relevant -- values of the registers and the flags initMachine :: InitVals -> Mostek initMachine (f1, f2, lo, rx, ra, fc, fz) = Mostek { memory = array (minBound, maxBound) [(F1, f1), (F2, f2), (LO, lo)] , registers = array (minBound, maxBound) [(RegX, rx), (RegA, ra)] , flags = array (minBound, maxBound) [(FlagC, fc), (FlagZ, fz)] } -- | The correctness theorem. For all possible memory configurations, the factors (@x@ and @y@ below), the location -- of the low-byte result and the initial-values of registers and the flags, this function will return True only if -- running Legato's algorithm does indeed compute the product of @x@ and @y@ correctly. legatoIsCorrect :: InitVals -> SBool legatoIsCorrect initVals@(x, y, _, _, _, _, _) = result .== expected where (hi, lo) = runLegato (initMachine initVals) -- NB. perform the comparison over 16 bit values to avoid overflow! -- If Value changes to be something else, modify this accordingly. result, expected :: SWord16 result = 256 * (0 # hi) + (0 # lo) expected = (0 # x) * (0 # y) ------------------------------------------------------------------ -- * Verification ------------------------------------------------------------------ -- | The correctness theorem. correctnessTheorem :: IO ThmResult correctnessTheorem = proveWith defaultSMTCfg{timing = PrintTiming} $ do lo <- sWord8 "lo" x <- sWord8 "x" y <- sWord8 "y" regX <- sWord8 "regX" regA <- sWord8 "regA" flagC <- sBool "flagC" flagZ <- sBool "flagZ" return $ legatoIsCorrect (x, y, lo, regX, regA, flagC, flagZ) ------------------------------------------------------------------ -- * C Code generation ------------------------------------------------------------------ -- | Generate a C program that implements Legato's algorithm automatically. legatoInC :: IO () legatoInC = compileToC Nothing "runLegato" $ do x <- cgInput "x" y <- cgInput "y" let (hi, lo) = runLegato (initMachine (x, y, 0, 0, 0, false, false)) cgOutput "hi" hi cgOutput "lo" lo {-# ANN legato ("HLint: ignore Redundant $" :: String) #-} {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/Documentation/SBV/Examples/BitPrecise/MergeSort.hs0000644000000000000000000001014113405536617021750 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.BitPrecise.MergeSort -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Symbolic implementation of merge-sort and its correctness. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.BitPrecise.MergeSort where import Data.SBV import Data.SBV.Tools.CodeGen ----------------------------------------------------------------------------- -- * Implementing Merge-Sort ----------------------------------------------------------------------------- -- | Element type of lists we'd like to sort. For simplicity, we'll just -- use 'SWord8' here, but we can pick any symbolic type. type E = SWord8 -- | Merging two given sorted lists, preserving the order. merge :: [E] -> [E] -> [E] merge [] ys = ys merge xs [] = xs merge xs@(x:xr) ys@(y:yr) = ite (x .< y) (x : merge xr ys) (y : merge xs yr) -- | Simple merge-sort implementation. We simply divide the input list -- in two two halves so long as it has at least two elements, sort -- each half on its own, and then merge. mergeSort :: [E] -> [E] mergeSort [] = [] mergeSort [x] = [x] mergeSort xs = merge (mergeSort th) (mergeSort bh) where (th, bh) = splitAt (length xs `div` 2) xs ----------------------------------------------------------------------------- -- * Proving correctness -- ${props} ----------------------------------------------------------------------------- {- $props There are two main parts to proving that a sorting algorithm is correct: * Prove that the output is non-decreasing * Prove that the output is a permutation of the input -} -- | Check whether a given sequence is non-decreasing. nonDecreasing :: [E] -> SBool nonDecreasing [] = true nonDecreasing [_] = true nonDecreasing (a:b:xs) = a .<= b &&& nonDecreasing (b:xs) -- | Check whether two given sequences are permutations. We simply check that each sequence -- is a subset of the other, when considered as a set. The check is slightly complicated -- for the need to account for possibly duplicated elements. isPermutationOf :: [E] -> [E] -> SBool isPermutationOf as bs = go as (zip bs (repeat true)) &&& go bs (zip as (repeat true)) where go [] _ = true go (x:xs) ys = let (found, ys') = mark x ys in found &&& go xs ys' -- Go and mark off an instance of 'x' in the list, if possible. We keep track -- of unmarked elements by associating a boolean bit. Note that we have to -- keep the lists equal size for the recursive result to merge properly. mark _ [] = (false, []) mark x ((y,v):ys) = ite (v &&& x .== y) (true, (y, bnot v):ys) (let (r, ys') = mark x ys in (r, (y,v):ys')) -- | Asserting correctness of merge-sort for a list of the given size. Note that we can -- only check correctness for fixed-size lists. Also, the proof will get more and more -- complicated for the backend SMT solver as the list size increases. A value around -- 5 or 6 should be fairly easy to prove. For instance, we have: -- -- >>> correctness 5 -- Q.E.D. correctness :: Int -> IO ThmResult correctness n = prove $ do xs <- mkFreeVars n let ys = mergeSort xs return $ nonDecreasing ys &&& isPermutationOf xs ys ----------------------------------------------------------------------------- -- * Generating C code ----------------------------------------------------------------------------- -- | Generate C code for merge-sorting an array of size @n@. Again, we're restricted -- to fixed size inputs. While the output is not how one would code merge sort in C -- by hand, it's a faithful rendering of all the operations merge-sort would do as -- described by its Haskell counterpart. codeGen :: Int -> IO () codeGen n = compileToC (Just ("mergeSort" ++ show n)) "mergeSort" $ do xs <- cgInputArr n "xs" cgOutputArr "ys" (mergeSort xs) sbv-7.13/Documentation/SBV/Examples/BitPrecise/MultMask.hs0000644000000000000000000000401413405536617021600 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.BitPrecise.MultMask -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- An SBV solution to the bit-precise puzzle of shuffling the bits in a -- 64-bit word in a custom order. The idea is to take a 64-bit value: -- -- @1.......2.......3.......4.......5.......6.......7.......8.......@ -- -- And turn it into another 64-bit value, that looks like this: -- -- @12345678........................................................@ -- -- We do not care what happens to the bits that are represented by dots. The -- problem is to do this with one mask and one multiplication. -- -- Apparently this operation has several applications, including in programs -- that play chess of all things. We use SBV to find the appropriate mask and -- the multiplier. -- -- Note that this is an instance of the program synthesis problem, where -- we "fill in the blanks" given a certain skeleton that satisfy a certain -- property, using quantified formulas. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.BitPrecise.MultMask where import Data.SBV -- | Find the multiplier and the mask as described. We have: -- -- >>> maskAndMult -- Satisfiable. Model: -- mask = 0x8080808080808080 :: Word64 -- mult = 0x0002040810204081 :: Word64 -- -- That is, any 64 bit value masked by the first and multipled by the second -- value above will have its bits at positions @[7,15,23,31,39,47,55,63]@ moved -- to positions @[56,57,58,59,60,61,62,63]@ respectively. maskAndMult :: IO () maskAndMult = print =<< satWith z3{printBase=16} find where find = do mask <- exists "mask" mult <- exists "mult" inp <- forall "inp" let res = (mask .&. inp) * (mult :: SWord64) solve [inp `sExtractBits` [7, 15 .. 63] .== res `sExtractBits` [56 .. 63]] sbv-7.13/Documentation/SBV/Examples/BitPrecise/PrefixSum.hs0000644000000000000000000000733013405536617021771 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.BitPrecise.PrefixSum -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- The PrefixSum algorithm over power-lists and proof of -- the Ladner-Fischer implementation. -- See -- and . ----------------------------------------------------------------------------- {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} module Documentation.SBV.Examples.BitPrecise.PrefixSum where import Data.SBV ---------------------------------------------------------------------- -- * Formalizing power-lists ---------------------------------------------------------------------- -- | A poor man's representation of powerlists and -- basic operations on them: -- We merely represent power-lists by ordinary lists. type PowerList a = [a] -- | The tie operator, concatenation. tiePL :: PowerList a -> PowerList a -> PowerList a tiePL = (++) -- | The zip operator, zips the power-lists of the same size, returns -- a powerlist of double the size. zipPL :: PowerList a -> PowerList a -> PowerList a zipPL [] [] = [] zipPL (x:xs) (y:ys) = x : y : zipPL xs ys zipPL _ _ = error "zipPL: nonsimilar powerlists received" -- | Inverse of zipping. unzipPL :: PowerList a -> (PowerList a, PowerList a) unzipPL = unzip . chunk2 where chunk2 [] = [] chunk2 (x:y:xs) = (x,y) : chunk2 xs chunk2 _ = error "unzipPL: malformed powerlist" ---------------------------------------------------------------------- -- * Reference prefix-sum implementation ---------------------------------------------------------------------- -- | Reference prefix sum (@ps@) is simply Haskell's @scanl1@ function. ps :: (a, a -> a -> a) -> PowerList a -> PowerList a ps (_, f) = scanl1 f ---------------------------------------------------------------------- -- * The Ladner-Fischer parallel version ---------------------------------------------------------------------- -- | The Ladner-Fischer (@lf@) implementation of prefix-sum. See -- or pg. 16 of lf :: (a, a -> a -> a) -> PowerList a -> PowerList a lf _ [] = error "lf: malformed (empty) powerlist" lf _ [x] = [x] lf (zero, f) pl = zipPL (zipWith f (rsh lfpq) p) lfpq where (p, q) = unzipPL pl pq = zipWith f p q lfpq = lf (zero, f) pq rsh xs = zero : init xs ---------------------------------------------------------------------- -- * Sample proofs for concrete operators ---------------------------------------------------------------------- -- | Correctness theorem, for a powerlist of given size, an associative operator, and its left-unit element. flIsCorrect :: Int -> (forall a. (OrdSymbolic a, Num a, Bits a) => (a, a -> a -> a)) -> Symbolic SBool flIsCorrect n zf = do args :: PowerList SWord32 <- mkForallVars n return $ ps zf args .== lf zf args -- | Proves Ladner-Fischer is equivalent to reference specification for addition. -- @0@ is the left-unit element, and we use a power-list of size @8@. We have: -- -- >>> thm1 -- Q.E.D. thm1 :: IO ThmResult thm1 = prove $ flIsCorrect 8 (0, (+)) -- | Proves Ladner-Fischer is equivalent to reference specification for the function @max@. -- @0@ is the left-unit element, and we use a power-list of size @16@. We have: -- -- >>> thm2 -- Q.E.D. thm2 :: IO ThmResult thm2 = prove $ flIsCorrect 16 (0, smax) sbv-7.13/Documentation/SBV/Examples/CodeGeneration/0000755000000000000000000000000013405536617020345 5ustar0000000000000000sbv-7.13/Documentation/SBV/Examples/CodeGeneration/AddSub.hs0000644000000000000000000000774413405536617022057 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.CodeGeneration.AddSub -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Simple code generation example. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.CodeGeneration.AddSub where import Data.SBV import Data.SBV.Tools.CodeGen -- | Simple function that returns add/sum of args addSub :: SWord8 -> SWord8 -> (SWord8, SWord8) addSub x y = (x+y, x-y) -- | Generate C code for addSub. Here's the output showing the generated C code: -- -- >>> genAddSub -- == BEGIN: "Makefile" ================ -- # Makefile for addSub. Automatically generated by SBV. Do not edit! -- -- # include any user-defined .mk file in the current directory. -- -include *.mk -- -- CC?=gcc -- CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer -- -- all: addSub_driver -- -- addSub.o: addSub.c addSub.h -- ${CC} ${CCFLAGS} -c $< -o $@ -- -- addSub_driver.o: addSub_driver.c -- ${CC} ${CCFLAGS} -c $< -o $@ -- -- addSub_driver: addSub.o addSub_driver.o -- ${CC} ${CCFLAGS} $^ -o $@ -- -- clean: -- rm -f *.o -- -- veryclean: clean -- rm -f addSub_driver -- == END: "Makefile" ================== -- == BEGIN: "addSub.h" ================ -- /* Header file for addSub. Automatically generated by SBV. Do not edit! */ -- -- #ifndef __addSub__HEADER_INCLUDED__ -- #define __addSub__HEADER_INCLUDED__ -- -- #include -- #include -- #include -- #include -- #include -- #include -- #include -- -- /* The boolean type */ -- typedef bool SBool; -- -- /* The float type */ -- typedef float SFloat; -- -- /* The double type */ -- typedef double SDouble; -- -- /* Unsigned bit-vectors */ -- typedef uint8_t SWord8; -- typedef uint16_t SWord16; -- typedef uint32_t SWord32; -- typedef uint64_t SWord64; -- -- /* Signed bit-vectors */ -- typedef int8_t SInt8; -- typedef int16_t SInt16; -- typedef int32_t SInt32; -- typedef int64_t SInt64; -- -- /* Entry point prototype: */ -- void addSub(const SWord8 x, const SWord8 y, SWord8 *sum, -- SWord8 *dif); -- -- #endif /* __addSub__HEADER_INCLUDED__ */ -- == END: "addSub.h" ================== -- == BEGIN: "addSub_driver.c" ================ -- /* Example driver program for addSub. */ -- /* Automatically generated by SBV. Edit as you see fit! */ -- -- #include -- #include "addSub.h" -- -- int main(void) -- { -- SWord8 sum; -- SWord8 dif; -- -- addSub(132, 241, &sum, &dif); -- -- printf("addSub(132, 241, &sum, &dif) ->\n"); -- printf(" sum = %"PRIu8"\n", sum); -- printf(" dif = %"PRIu8"\n", dif); -- -- return 0; -- } -- == END: "addSub_driver.c" ================== -- == BEGIN: "addSub.c" ================ -- /* File: "addSub.c". Automatically generated by SBV. Do not edit! */ -- -- #include "addSub.h" -- -- void addSub(const SWord8 x, const SWord8 y, SWord8 *sum, -- SWord8 *dif) -- { -- const SWord8 s0 = x; -- const SWord8 s1 = y; -- const SWord8 s2 = s0 + s1; -- const SWord8 s3 = s0 - s1; -- -- *sum = s2; -- *dif = s3; -- } -- == END: "addSub.c" ================== -- genAddSub :: IO () genAddSub = compileToC outDir "addSub" $ do x <- cgInput "x" y <- cgInput "y" -- leave the cgDriverVals call out for generating a driver with random values cgSetDriverValues [132, 241] let (s, d) = addSub x y cgOutput "sum" s cgOutput "dif" d where -- use Just "dirName" for putting the output to the named directory -- otherwise, it'll go to standard output outDir = Nothing sbv-7.13/Documentation/SBV/Examples/CodeGeneration/CRC_USB5.hs0000644000000000000000000000711113405536617022106 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.CodeGeneration.CRC_USB5 -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Computing the CRC symbolically, using the USB polynomial. We also -- generating C code for it as well. This example demonstrates the -- use of the 'crcBV' function, along with how CRC's can be computed -- mathematically using polynomial division. While the results are the -- same (i.e., proven equivalent, see 'crcGood' below), the internal -- CRC implementation generates much better code, compare 'cg1' vs 'cg2' below. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.CodeGeneration.CRC_USB5 where import Data.SBV import Data.SBV.Tools.CodeGen import Data.SBV.Tools.Polynomial ----------------------------------------------------------------------------- -- * The USB polynomial ----------------------------------------------------------------------------- -- | The USB CRC polynomial: @x^5 + x^2 + 1@. -- Although this polynomial needs just 6 bits to represent (5 if higher -- order bit is implicitly assumed to be set), we'll simply use a 16 bit -- number for its representation to keep things simple for code generation -- purposes. usb5 :: SWord16 usb5 = polynomial [5, 2, 0] ----------------------------------------------------------------------------- -- * Computing CRCs ----------------------------------------------------------------------------- -- | Given an 11 bit message, compute the CRC of it using the USB polynomial, -- which is 5 bits, and then append it to the msg to get a 16-bit word. Again, -- the incoming 11-bits is represented as a 16-bit word, with 5 highest bits -- essentially ignored for input purposes. crcUSB :: SWord16 -> SWord16 crcUSB i = fromBitsBE (ib ++ cb) where ib = drop 5 (blastBE i) -- only the last 11 bits needed pb = drop 11 (blastBE usb5) -- only the last 5 bits needed cb = crcBV 5 ib pb -- | Alternate method for computing the CRC, /mathematically/. We shift -- the number to the left by 5, and then compute the remainder from the -- polynomial division by the USB polynomial. The result is then appended -- to the end of the message. crcUSB' :: SWord16 -> SWord16 crcUSB' i' = i .|. pMod i usb5 where i = i' `shiftL` 5 ----------------------------------------------------------------------------- -- * Correctness ----------------------------------------------------------------------------- -- | Prove that the custom 'crcBV' function is equivalent to the mathematical -- definition of CRC's for 11 bit messages. We have: -- -- >>> crcGood -- Q.E.D. crcGood :: IO ThmResult crcGood = prove $ \i -> crcUSB i .== crcUSB' i ----------------------------------------------------------------------------- -- * Code generation ----------------------------------------------------------------------------- -- | Generate a C function to compute the USB CRC, using the internal CRC -- function. cg1 :: IO () cg1 = compileToC (Just "crcUSB1") "crcUSB1" $ do msg <- cgInput "msg" cgOutput "crc" (crcUSB msg) -- | Generate a C function to compute the USB CRC, using the mathematical -- definition of the CRCs. While this version generates functionally eqivalent -- C code, it's less efficient; it has about 30% more code. So, the above -- version is preferable for code generation purposes. cg2 :: IO () cg2 = compileToC (Just "crcUSB2") "crcUSB2" $ do msg <- cgInput "msg" cgOutput "crc" (crcUSB' msg) sbv-7.13/Documentation/SBV/Examples/CodeGeneration/Fibonacci.hs0000644000000000000000000002071013405536617022556 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.CodeGeneration.Fibonacci -- Copyright : (c) Lee Pike, Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Computing Fibonacci numbers and generating C code. Inspired by Lee Pike's -- original implementation, modified for inclusion in the package. It illustrates -- symbolic termination issues one can have when working with recursive algorithms -- and how to deal with such, eventually generating good C code. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.CodeGeneration.Fibonacci where import Data.SBV import Data.SBV.Tools.CodeGen ----------------------------------------------------------------------------- -- * A naive implementation ----------------------------------------------------------------------------- -- | This is a naive implementation of fibonacci, and will work fine (albeit slow) -- for concrete inputs: -- -- >>> map fib0 [0..6] -- [0 :: SWord64,1 :: SWord64,1 :: SWord64,2 :: SWord64,3 :: SWord64,5 :: SWord64,8 :: SWord64] -- -- However, it is not suitable for doing proofs or generating code, as it is not -- symbolically terminating when it is called with a symbolic value @n@. When we -- recursively call @fib0@ on @n-1@ (or @n-2@), the test against @0@ will always -- explore both branches since the result will be symbolic, hence will not -- terminate. (An integrated theorem prover can establish termination -- after a certain number of unrollings, but this would be quite expensive to -- implement, and would be impractical.) fib0 :: SWord64 -> SWord64 fib0 n = ite (n .== 0 ||| n .== 1) n (fib0 (n-1) + fib0 (n-2)) ----------------------------------------------------------------------------- -- * Using a recursion depth, and accumulating parameters ----------------------------------------------------------------------------- {- $genLookup One way to deal with symbolic termination is to limit the number of recursive calls. In this version, we impose a limit on the index to the function, working correctly upto that limit. If we use a compile-time constant, then SBV's code generator can produce code as the unrolling will eventually stop. -} -- | The recursion-depth limited version of fibonacci. Limiting the maximum number to be 20, we can say: -- -- >>> map (fib1 20) [0..6] -- [0 :: SWord64,1 :: SWord64,1 :: SWord64,2 :: SWord64,3 :: SWord64,5 :: SWord64,8 :: SWord64] -- -- The function will work correctly, so long as the index we query is at most @top@, and otherwise -- will return the value at @top@. Note that we also use accumulating parameters here for efficiency, -- although this is orthogonal to the termination concern. -- -- A note on modular arithmetic: The 64-bit word we use to represent the values will of course -- eventually overflow, beware! Fibonacci is a fast growing function.. fib1 :: SWord64 -> SWord64 -> SWord64 fib1 top n = fib' 0 1 0 where fib' :: SWord64 -> SWord64 -> SWord64 -> SWord64 fib' prev' prev m = ite (m .== top ||| m .== n) -- did we reach recursion depth, or the index we're looking for prev' -- stop and return the result (fib' prev (prev' + prev) (m+1)) -- otherwise recurse -- | We can generate code for 'fib1' using the 'genFib1' action. Note that the -- generated code will grow larger as we pick larger values of @top@, but only linearly, -- thanks to the accumulating parameter trick used by 'fib1'. The following is an excerpt -- from the code generated for the call @genFib1 10@, where the code will work correctly -- for indexes up to 10: -- -- > SWord64 fib1(const SWord64 x) -- > { -- > const SWord64 s0 = x; -- > const SBool s2 = s0 == 0x0000000000000000ULL; -- > const SBool s4 = s0 == 0x0000000000000001ULL; -- > const SBool s6 = s0 == 0x0000000000000002ULL; -- > const SBool s8 = s0 == 0x0000000000000003ULL; -- > const SBool s10 = s0 == 0x0000000000000004ULL; -- > const SBool s12 = s0 == 0x0000000000000005ULL; -- > const SBool s14 = s0 == 0x0000000000000006ULL; -- > const SBool s17 = s0 == 0x0000000000000007ULL; -- > const SBool s19 = s0 == 0x0000000000000008ULL; -- > const SBool s22 = s0 == 0x0000000000000009ULL; -- > const SWord64 s25 = s22 ? 0x0000000000000022ULL : 0x0000000000000037ULL; -- > const SWord64 s26 = s19 ? 0x0000000000000015ULL : s25; -- > const SWord64 s27 = s17 ? 0x000000000000000dULL : s26; -- > const SWord64 s28 = s14 ? 0x0000000000000008ULL : s27; -- > const SWord64 s29 = s12 ? 0x0000000000000005ULL : s28; -- > const SWord64 s30 = s10 ? 0x0000000000000003ULL : s29; -- > const SWord64 s31 = s8 ? 0x0000000000000002ULL : s30; -- > const SWord64 s32 = s6 ? 0x0000000000000001ULL : s31; -- > const SWord64 s33 = s4 ? 0x0000000000000001ULL : s32; -- > const SWord64 s34 = s2 ? 0x0000000000000000ULL : s33; -- > -- > return s34; -- > } genFib1 :: SWord64 -> IO () genFib1 top = compileToC Nothing "fib1" $ do x <- cgInput "x" cgReturn $ fib1 top x ----------------------------------------------------------------------------- -- * Generating a look-up table ----------------------------------------------------------------------------- {- $genLookup While 'fib1' generates good C code, we can do much better by taking advantage of the inherent partial-evaluation capabilities of SBV to generate a look-up table, as follows. -} -- | Compute the fibonacci numbers statically at /code-generation/ time and -- put them in a table, accessed by the 'select' call. fib2 :: SWord64 -> SWord64 -> SWord64 fib2 top = select table 0 where table = map (fib1 top) [0 .. top] -- | Once we have 'fib2', we can generate the C code straightforwardly. Below -- is an excerpt from the code that SBV generates for the call @genFib2 64@. Note -- that this code is a constant-time look-up table implementation of fibonacci, -- with no run-time overhead. The index can be made arbitrarily large, -- naturally. (Note that this function returns @0@ if the index is larger -- than 64, as specified by the call to 'select' with default @0@.) -- -- > SWord64 fibLookup(const SWord64 x) -- > { -- > const SWord64 s0 = x; -- > static const SWord64 table0[] = { -- > 0x0000000000000000ULL, 0x0000000000000001ULL, -- > 0x0000000000000001ULL, 0x0000000000000002ULL, -- > 0x0000000000000003ULL, 0x0000000000000005ULL, -- > 0x0000000000000008ULL, 0x000000000000000dULL, -- > 0x0000000000000015ULL, 0x0000000000000022ULL, -- > 0x0000000000000037ULL, 0x0000000000000059ULL, -- > 0x0000000000000090ULL, 0x00000000000000e9ULL, -- > 0x0000000000000179ULL, 0x0000000000000262ULL, -- > 0x00000000000003dbULL, 0x000000000000063dULL, -- > 0x0000000000000a18ULL, 0x0000000000001055ULL, -- > 0x0000000000001a6dULL, 0x0000000000002ac2ULL, -- > 0x000000000000452fULL, 0x0000000000006ff1ULL, -- > 0x000000000000b520ULL, 0x0000000000012511ULL, -- > 0x000000000001da31ULL, 0x000000000002ff42ULL, -- > 0x000000000004d973ULL, 0x000000000007d8b5ULL, -- > 0x00000000000cb228ULL, 0x0000000000148addULL, -- > 0x0000000000213d05ULL, 0x000000000035c7e2ULL, -- > 0x00000000005704e7ULL, 0x00000000008cccc9ULL, -- > 0x0000000000e3d1b0ULL, 0x0000000001709e79ULL, -- > 0x0000000002547029ULL, 0x0000000003c50ea2ULL, -- > 0x0000000006197ecbULL, 0x0000000009de8d6dULL, -- > 0x000000000ff80c38ULL, 0x0000000019d699a5ULL, -- > 0x0000000029cea5ddULL, 0x0000000043a53f82ULL, -- > 0x000000006d73e55fULL, 0x00000000b11924e1ULL, -- > 0x000000011e8d0a40ULL, 0x00000001cfa62f21ULL, -- > 0x00000002ee333961ULL, 0x00000004bdd96882ULL, -- > 0x00000007ac0ca1e3ULL, 0x0000000c69e60a65ULL, -- > 0x0000001415f2ac48ULL, 0x000000207fd8b6adULL, -- > 0x0000003495cb62f5ULL, 0x0000005515a419a2ULL, -- > 0x00000089ab6f7c97ULL, 0x000000dec1139639ULL, -- > 0x000001686c8312d0ULL, 0x000002472d96a909ULL, -- > 0x000003af9a19bbd9ULL, 0x000005f6c7b064e2ULL, 0x000009a661ca20bbULL -- > }; -- > const SWord64 s65 = s0 >= 65 ? 0x0000000000000000ULL : table0[s0]; -- > -- > return s65; -- > } genFib2 :: SWord64 -> IO () genFib2 top = compileToC Nothing "fibLookup" $ do cgPerformRTCs True -- protect against potential overflow, our table is not big enough x <- cgInput "x" cgReturn $ fib2 top x sbv-7.13/Documentation/SBV/Examples/CodeGeneration/GCD.hs0000644000000000000000000001435413405536617021305 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.CodeGeneration.GCD -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Computing GCD symbolically, and generating C code for it. This example -- illustrates symbolic termination related issues when programming with -- SBV, when the termination of a recursive algorithm crucially depends -- on the value of a symbolic variable. The technique we use is to statically -- enforce termination by using a recursion depth counter. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.CodeGeneration.GCD where import Data.SBV import Data.SBV.Tools.CodeGen ----------------------------------------------------------------------------- -- * Computing GCD ----------------------------------------------------------------------------- -- | The symbolic GCD algorithm, over two 8-bit numbers. We define @sgcd a 0@ to -- be @a@ for all @a@, which implies @sgcd 0 0 = 0@. Note that this is essentially -- Euclid's algorithm, except with a recursion depth counter. We need the depth -- counter since the algorithm is not /symbolically terminating/, as we don't have -- a means of determining that the second argument (@b@) will eventually reach 0 in a symbolic -- context. Hence we stop after 12 iterations. Why 12? We've empirically determined that this -- algorithm will recurse at most 12 times for arbitrary 8-bit numbers. Of course, this is -- a claim that we shall prove below. sgcd :: SWord8 -> SWord8 -> SWord8 sgcd a b = go a b 12 where go :: SWord8 -> SWord8 -> SWord8 -> SWord8 go x y c = ite (c .== 0 ||| y .== 0) -- stop if y is 0, or if we reach the recursion depth x (go y y' (c-1)) where (_, y') = x `sQuotRem` y ----------------------------------------------------------------------------- -- * Verification ----------------------------------------------------------------------------- {- $VerificationIntro We prove that 'sgcd' does indeed compute the common divisor of the given numbers. Our predicate takes @x@, @y@, and @k@. We show that what 'sgcd' returns is indeed a common divisor, and it is at least as large as any given @k@, provided @k@ is a common divisor as well. -} -- | We have: -- -- >>> prove sgcdIsCorrect -- Q.E.D. sgcdIsCorrect :: SWord8 -> SWord8 -> SWord8 -> SBool sgcdIsCorrect x y k = ite (y .== 0) -- if y is 0 (k' .== x) -- then k' must be x, nothing else to prove by definition (isCommonDivisor k' &&& -- otherwise, k' is a common divisor and (isCommonDivisor k ==> k' .>= k)) -- if k is a common divisor as well, then k' is at least as large as k where k' = sgcd x y isCommonDivisor a = z1 .== 0 &&& z2 .== 0 where (_, z1) = x `sQuotRem` a (_, z2) = y `sQuotRem` a ----------------------------------------------------------------------------- -- * Code generation ----------------------------------------------------------------------------- {- $VerificationIntro Now that we have proof our 'sgcd' implementation is correct, we can go ahead and generate C code for it. -} -- | This call will generate the required C files. The following is the function -- body generated for 'sgcd'. (We are not showing the generated header, @Makefile@, -- and the driver programs for brevity.) Note that the generated function is -- a constant time algorithm for GCD. It is not necessarily fastest, but it will take -- precisely the same amount of time for all values of @x@ and @y@. -- -- > /* File: "sgcd.c". Automatically generated by SBV. Do not edit! */ -- > -- > #include -- > #include -- > #include -- > #include -- > #include -- > #include "sgcd.h" -- > -- > SWord8 sgcd(const SWord8 x, const SWord8 y) -- > { -- > const SWord8 s0 = x; -- > const SWord8 s1 = y; -- > const SBool s3 = s1 == 0; -- > const SWord8 s4 = (s1 == 0) ? s0 : (s0 % s1); -- > const SWord8 s5 = s3 ? s0 : s4; -- > const SBool s6 = 0 == s5; -- > const SWord8 s7 = (s5 == 0) ? s1 : (s1 % s5); -- > const SWord8 s8 = s6 ? s1 : s7; -- > const SBool s9 = 0 == s8; -- > const SWord8 s10 = (s8 == 0) ? s5 : (s5 % s8); -- > const SWord8 s11 = s9 ? s5 : s10; -- > const SBool s12 = 0 == s11; -- > const SWord8 s13 = (s11 == 0) ? s8 : (s8 % s11); -- > const SWord8 s14 = s12 ? s8 : s13; -- > const SBool s15 = 0 == s14; -- > const SWord8 s16 = (s14 == 0) ? s11 : (s11 % s14); -- > const SWord8 s17 = s15 ? s11 : s16; -- > const SBool s18 = 0 == s17; -- > const SWord8 s19 = (s17 == 0) ? s14 : (s14 % s17); -- > const SWord8 s20 = s18 ? s14 : s19; -- > const SBool s21 = 0 == s20; -- > const SWord8 s22 = (s20 == 0) ? s17 : (s17 % s20); -- > const SWord8 s23 = s21 ? s17 : s22; -- > const SBool s24 = 0 == s23; -- > const SWord8 s25 = (s23 == 0) ? s20 : (s20 % s23); -- > const SWord8 s26 = s24 ? s20 : s25; -- > const SBool s27 = 0 == s26; -- > const SWord8 s28 = (s26 == 0) ? s23 : (s23 % s26); -- > const SWord8 s29 = s27 ? s23 : s28; -- > const SBool s30 = 0 == s29; -- > const SWord8 s31 = (s29 == 0) ? s26 : (s26 % s29); -- > const SWord8 s32 = s30 ? s26 : s31; -- > const SBool s33 = 0 == s32; -- > const SWord8 s34 = (s32 == 0) ? s29 : (s29 % s32); -- > const SWord8 s35 = s33 ? s29 : s34; -- > const SBool s36 = 0 == s35; -- > const SWord8 s37 = s36 ? s32 : s35; -- > const SWord8 s38 = s33 ? s29 : s37; -- > const SWord8 s39 = s30 ? s26 : s38; -- > const SWord8 s40 = s27 ? s23 : s39; -- > const SWord8 s41 = s24 ? s20 : s40; -- > const SWord8 s42 = s21 ? s17 : s41; -- > const SWord8 s43 = s18 ? s14 : s42; -- > const SWord8 s44 = s15 ? s11 : s43; -- > const SWord8 s45 = s12 ? s8 : s44; -- > const SWord8 s46 = s9 ? s5 : s45; -- > const SWord8 s47 = s6 ? s1 : s46; -- > const SWord8 s48 = s3 ? s0 : s47; -- > -- > return s48; -- > } genGCDInC :: IO () genGCDInC = compileToC Nothing "sgcd" $ do x <- cgInput "x" y <- cgInput "y" cgReturn $ sgcd x y sbv-7.13/Documentation/SBV/Examples/CodeGeneration/PopulationCount.hs0000644000000000000000000002125713405536617024053 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.CodeGeneration.PopulationCount -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Computing population-counts (number of set bits) and automatically -- generating C code. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.CodeGeneration.PopulationCount where import Data.SBV import Data.SBV.Tools.CodeGen ----------------------------------------------------------------------------- -- * Reference: Slow but /obviously/ correct ----------------------------------------------------------------------------- -- | Given a 64-bit quantity, the simplest (and obvious) way to count the -- number of bits that are set in it is to simply walk through all the bits -- and add 1 to a running count. This is slow, as it requires 64 iterations, -- but is simple and easy to convince yourself that it is correct. For instance: -- -- >>> popCountSlow 0x0123456789ABCDEF -- 32 :: SWord8 popCountSlow :: SWord64 -> SWord8 popCountSlow inp = go inp 0 0 where go :: SWord64 -> Int -> SWord8 -> SWord8 go _ 64 c = c go x i c = go (x `shiftR` 1) (i+1) (ite (x .&. 1 .== 1) (c+1) c) ----------------------------------------------------------------------------- -- * Faster: Using a look-up table ----------------------------------------------------------------------------- -- | Faster version. This is essentially the same algorithm, except we -- go 8 bits at a time instead of one by one, by using a precomputed table -- of population-count values for each byte. This algorithm /loops/ only -- 8 times, and hence is at least 8 times more efficient. popCountFast :: SWord64 -> SWord8 popCountFast inp = go inp 0 0 where go :: SWord64 -> Int -> SWord8 -> SWord8 go _ 8 c = c go x i c = go (x `shiftR` 8) (i+1) (c + select pop8 0 (x .&. 0xff)) -- | Look-up table, containing population counts for all possible 8-bit -- value, from 0 to 255. Note that we do not \"hard-code\" the values, but -- merely use the slow version to compute them. pop8 :: [SWord8] pop8 = map popCountSlow [0 .. 255] ----------------------------------------------------------------------------- -- * Verification ----------------------------------------------------------------------------- {- $VerificationIntro We prove that `popCountFast` and `popCountSlow` are functionally equivalent. This is essential as we will automatically generate C code from `popCountFast`, and we would like to make sure that the fast version is correct with respect to the slower reference version. -} -- | States the correctness of faster population-count algorithm, with respect -- to the reference slow version. Turns out Z3's default solver is rather slow -- for this one, but there's a magic incantation to make it go fast. -- See for details. -- -- >>> let cmd = "(check-sat-using (then (using-params ackermannize_bv :div0_ackermann_limit 1000000) simplify bit-blast sat))" -- >>> proveWith z3{satCmd = cmd} fastPopCountIsCorrect -- Q.E.D. fastPopCountIsCorrect :: SWord64 -> SBool fastPopCountIsCorrect x = popCountFast x .== popCountSlow x ----------------------------------------------------------------------------- -- * Code generation ----------------------------------------------------------------------------- -- | Not only we can prove that faster version is correct, but we can also automatically -- generate C code to compute population-counts for us. This action will generate all the -- C files that you will need, including a driver program for test purposes. -- -- Below is the generated header file for `popCountFast`: -- -- >>> genPopCountInC -- == BEGIN: "Makefile" ================ -- # Makefile for popCount. Automatically generated by SBV. Do not edit! -- -- # include any user-defined .mk file in the current directory. -- -include *.mk -- -- CC?=gcc -- CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer -- -- all: popCount_driver -- -- popCount.o: popCount.c popCount.h -- ${CC} ${CCFLAGS} -c $< -o $@ -- -- popCount_driver.o: popCount_driver.c -- ${CC} ${CCFLAGS} -c $< -o $@ -- -- popCount_driver: popCount.o popCount_driver.o -- ${CC} ${CCFLAGS} $^ -o $@ -- -- clean: -- rm -f *.o -- -- veryclean: clean -- rm -f popCount_driver -- == END: "Makefile" ================== -- == BEGIN: "popCount.h" ================ -- /* Header file for popCount. Automatically generated by SBV. Do not edit! */ -- -- #ifndef __popCount__HEADER_INCLUDED__ -- #define __popCount__HEADER_INCLUDED__ -- -- #include -- #include -- #include -- #include -- #include -- #include -- #include -- -- /* The boolean type */ -- typedef bool SBool; -- -- /* The float type */ -- typedef float SFloat; -- -- /* The double type */ -- typedef double SDouble; -- -- /* Unsigned bit-vectors */ -- typedef uint8_t SWord8; -- typedef uint16_t SWord16; -- typedef uint32_t SWord32; -- typedef uint64_t SWord64; -- -- /* Signed bit-vectors */ -- typedef int8_t SInt8; -- typedef int16_t SInt16; -- typedef int32_t SInt32; -- typedef int64_t SInt64; -- -- /* Entry point prototype: */ -- SWord8 popCount(const SWord64 x); -- -- #endif /* __popCount__HEADER_INCLUDED__ */ -- == END: "popCount.h" ================== -- == BEGIN: "popCount_driver.c" ================ -- /* Example driver program for popCount. */ -- /* Automatically generated by SBV. Edit as you see fit! */ -- -- #include -- #include "popCount.h" -- -- int main(void) -- { -- const SWord8 __result = popCount(0x1b02e143e4f0e0e5ULL); -- -- printf("popCount(0x1b02e143e4f0e0e5ULL) = %"PRIu8"\n", __result); -- -- return 0; -- } -- == END: "popCount_driver.c" ================== -- == BEGIN: "popCount.c" ================ -- /* File: "popCount.c". Automatically generated by SBV. Do not edit! */ -- -- #include "popCount.h" -- -- SWord8 popCount(const SWord64 x) -- { -- const SWord64 s0 = x; -- static const SWord8 table0[] = { -- 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, -- 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, -- 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, -- 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, -- 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, -- 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, -- 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, -- 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, -- 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, -- 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, -- 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, -- 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 -- }; -- const SWord64 s11 = s0 & 0x00000000000000ffULL; -- const SWord8 s12 = table0[s11]; -- const SWord64 s14 = s0 >> 8; -- const SWord64 s15 = 0x00000000000000ffULL & s14; -- const SWord8 s16 = table0[s15]; -- const SWord8 s17 = s12 + s16; -- const SWord64 s18 = s14 >> 8; -- const SWord64 s19 = 0x00000000000000ffULL & s18; -- const SWord8 s20 = table0[s19]; -- const SWord8 s21 = s17 + s20; -- const SWord64 s22 = s18 >> 8; -- const SWord64 s23 = 0x00000000000000ffULL & s22; -- const SWord8 s24 = table0[s23]; -- const SWord8 s25 = s21 + s24; -- const SWord64 s26 = s22 >> 8; -- const SWord64 s27 = 0x00000000000000ffULL & s26; -- const SWord8 s28 = table0[s27]; -- const SWord8 s29 = s25 + s28; -- const SWord64 s30 = s26 >> 8; -- const SWord64 s31 = 0x00000000000000ffULL & s30; -- const SWord8 s32 = table0[s31]; -- const SWord8 s33 = s29 + s32; -- const SWord64 s34 = s30 >> 8; -- const SWord64 s35 = 0x00000000000000ffULL & s34; -- const SWord8 s36 = table0[s35]; -- const SWord8 s37 = s33 + s36; -- const SWord64 s38 = s34 >> 8; -- const SWord64 s39 = 0x00000000000000ffULL & s38; -- const SWord8 s40 = table0[s39]; -- const SWord8 s41 = s37 + s40; -- -- return s41; -- } -- == END: "popCount.c" ================== genPopCountInC :: IO () genPopCountInC = compileToC Nothing "popCount" $ do cgSetDriverValues [0x1b02e143e4f0e0e5] -- remove this line to get a random test value x <- cgInput "x" cgReturn $ popCountFast x sbv-7.13/Documentation/SBV/Examples/CodeGeneration/Uninterpreted.hs0000644000000000000000000000602213405536617023531 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.CodeGeneration.Uninterpreted -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates the use of uninterpreted functions for the purposes of -- code generation. This facility is important when we want to take -- advantage of native libraries in the target platform, or when we'd -- like to hand-generate code for certain functions for various -- purposes, such as efficiency, or reliability. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.CodeGeneration.Uninterpreted where import Data.Maybe (fromMaybe) import Data.SBV import Data.SBV.Tools.CodeGen -- | A definition of shiftLeft that can deal with variable length shifts. -- (Note that the ``shiftL`` method from the 'Bits' class requires an 'Int' shift -- amount.) Unfortunately, this'll generate rather clumsy C code due to the -- use of tables etc., so we uninterpret it for code generation purposes -- using the 'cgUninterpret' function. shiftLeft :: SWord32 -> SWord32 -> SWord32 shiftLeft = cgUninterpret "SBV_SHIFTLEFT" cCode hCode where -- the C code we'd like SBV to spit out when generating code. Note that this is -- arbitrary C code. In this case we just used a macro, but it could be a function, -- text that includes files etc. It should essentially bring the name SBV_SHIFTLEFT -- used above into scope when compiled. If no code is needed, one can also just -- provide the empty list for the same effect. Also see 'cgAddDecl', 'cgAddLDFlags', -- and 'cgAddPrototype' functions for further variations. cCode = ["#define SBV_SHIFTLEFT(x, y) ((x) << (y))"] -- the Haskell code we'd like SBV to use when running inside Haskell or when -- translated to SMTLib for verification purposes. This is good old Haskell -- code, as one would typically write. hCode x = select [x * literal (bit b) | b <- [0.. bs x - 1]] (literal 0) bs x = fromMaybe (error "SBV.Example.CodeGeneration.Uninterpreted.shiftLeft: Unexpected non-finite usage!") (bitSizeMaybe x) -- | Test function that uses shiftLeft defined above. When used as a normal Haskell function -- or in verification the definition is fully used, i.e., no uninterpretation happens. To wit, -- we have: -- -- >>> tstShiftLeft 3 4 5 -- 224 :: SWord32 -- -- >>> prove $ \x y -> tstShiftLeft x y 0 .== x + y -- Q.E.D. tstShiftLeft :: SWord32 -> SWord32 -> SWord32 -> SWord32 tstShiftLeft x y z = x `shiftLeft` z + y `shiftLeft` z -- | Generate C code for "tstShiftLeft". In this case, SBV will *use* the user given definition -- verbatim, instead of generating code for it. (Also see the functions 'cgAddDecl', 'cgAddLDFlags', -- and 'cgAddPrototype'.) genCCode :: IO () genCCode = compileToC Nothing "tst" $ do [x, y, z] <- cgInputArr 3 "vs" cgReturn $ tstShiftLeft x y z sbv-7.13/Documentation/SBV/Examples/Crypto/0000755000000000000000000000000013405536617016737 5ustar0000000000000000sbv-7.13/Documentation/SBV/Examples/Crypto/AES.hs0000644000000000000000000006461213405536617017714 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Crypto.AES -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- An implementation of AES (Advanced Encryption Standard), using SBV. -- For details on AES, see . -- -- We do a T-box implementation, which leads to good C code as we can take -- advantage of look-up tables. Note that we make virtually no attempt to -- optimize our Haskell code. The concern here is not with getting Haskell running -- fast at all. The idea is to program the T-Box implementation as naturally and clearly -- as possible in Haskell, and have SBV's code-generator generate fast C code automatically. -- Therefore, we merely use ordinary Haskell lists as our data-structures, and do not -- bother with any unboxing or strictness annotations. Thus, we achieve the separation -- of concerns: Correctness via clairty and simplicity and proofs on the Haskell side, -- performance by relying on SBV's code generator. If necessary, the generated code -- can be FFI'd back into Haskell to complete the loop. -- -- All 3 valid key sizes (128, 192, and 256) as required by the FIPS-197 standard -- are supported. ----------------------------------------------------------------------------- {-# LANGUAGE ParallelListComp #-} module Documentation.SBV.Examples.Crypto.AES where import Data.SBV import Data.SBV.Tools.CodeGen import Data.SBV.Tools.Polynomial import Data.List (transpose) import Data.Maybe (fromJust) import Numeric (showHex) ----------------------------------------------------------------------------- -- * Formalizing GF(2^8) ----------------------------------------------------------------------------- -- | An element of the Galois Field 2^8, which are essentially polynomials with -- maximum degree 7. They are conveniently represented as values between 0 and 255. type GF28 = SWord8 -- | Multiplication in GF(2^8). This is simple polynomial multipliation, followed -- by the irreducible polynomial @x^8+x^4+x^3+x^1+1@. We simply use the 'pMult' -- function exported by SBV to do the operation. gf28Mult :: GF28 -> GF28 -> GF28 gf28Mult x y = pMult (x, y, [8, 4, 3, 1, 0]) -- | Exponentiation by a constant in GF(2^8). The implementation uses the usual -- square-and-multiply trick to speed up the computation. gf28Pow :: GF28 -> Int -> GF28 gf28Pow n = pow where sq x = x `gf28Mult` x pow 0 = 1 pow i | odd i = n `gf28Mult` sq (pow (i `shiftR` 1)) | True = sq (pow (i `shiftR` 1)) -- | Computing inverses in GF(2^8). By the mathematical properties of GF(2^8) -- and the particular irreducible polynomial used @x^8+x^5+x^3+x^1+1@, it -- turns out that raising to the 254 power gives us the multiplicative inverse. -- Of course, we can prove this using SBV: -- -- >>> prove $ \x -> x ./= 0 ==> x `gf28Mult` gf28Inverse x .== 1 -- Q.E.D. -- -- Note that we exclude @0@ in our theorem, as it does not have a -- multiplicative inverse. gf28Inverse :: GF28 -> GF28 gf28Inverse x = x `gf28Pow` 254 ----------------------------------------------------------------------------- -- * Implementing AES ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -- ** Types and basic operations ----------------------------------------------------------------------------- -- | AES state. The state consists of four 32-bit words, each of which is in turn treated -- as four GF28's, i.e., 4 bytes. The T-Box implementation keeps the four-bytes together -- for efficient representation. type State = [SWord32] -- | The key, which can be 128, 192, or 256 bits. Represented as a sequence of 32-bit words. type Key = [SWord32] -- | The key schedule. AES executes in rounds, and it treats first and last round keys slightly -- differently than the middle ones. We reflect that choice by being explicit about it in our type. -- The length of the middle list of keys depends on the key-size, which in turn determines -- the number of rounds. type KS = (Key, [Key], Key) -- | Conversion from 32-bit words to 4 constituent bytes. toBytes :: SWord32 -> [GF28] toBytes x = [x1, x2, x3, x4] where (h, l) = split x (x1, x2) = split h (x3, x4) = split l -- | Conversion from 4 bytes, back to a 32-bit row, inverse of 'toBytes' above. We -- have the following simple theorems stating this relationship formally: -- -- >>> prove $ \a b c d -> toBytes (fromBytes [a, b, c, d]) .== [a, b, c, d] -- Q.E.D. -- -- >>> prove $ \r -> fromBytes (toBytes r) .== r -- Q.E.D. fromBytes :: [GF28] -> SWord32 fromBytes [x1, x2, x3, x4] = (x1 # x2) # (x3 # x4) fromBytes xs = error $ "fromBytes: Unexpected input: " ++ show xs -- | Rotating a state row by a fixed amount to the right. rotR :: [GF28] -> Int -> [GF28] rotR [a, b, c, d] 1 = [d, a, b, c] rotR [a, b, c, d] 2 = [c, d, a, b] rotR [a, b, c, d] 3 = [b, c, d, a] rotR xs i = error $ "rotR: Unexpected input: " ++ show (xs, i) ----------------------------------------------------------------------------- -- ** The key schedule ----------------------------------------------------------------------------- -- | Definition of round-constants, as specified in Section 5.2 of the AES standard. roundConstants :: [GF28] roundConstants = 0 : [ gf28Pow 2 (k-1) | k <- [1 .. ] ] -- | The @InvMixColumns@ transformation, as described in Section 5.3.3 of the standard. Note -- that this transformation is only used explicitly during key-expansion in the T-Box implementation -- of AES. invMixColumns :: State -> State invMixColumns state = map fromBytes $ transpose $ mmult (map toBytes state) where dot f = foldr1 xor . zipWith ($) f mmult n = [map (dot r) n | r <- [ [mE, mB, mD, m9] , [m9, mE, mB, mD] , [mD, m9, mE, mB] , [mB, mD, m9, mE] ]] -- table-lookup versions of gf28Mult with the constants used in invMixColumns mE = select mETable 0 mB = select mBTable 0 mD = select mDTable 0 m9 = select m9Table 0 mETable = map (gf28Mult 0xE) [0..255] mBTable = map (gf28Mult 0xB) [0..255] mDTable = map (gf28Mult 0xD) [0..255] m9Table = map (gf28Mult 0x9) [0..255] -- | Key expansion. Starting with the given key, returns an infinite sequence of -- words, as described by the AES standard, Section 5.2, Figure 11. keyExpansion :: Int -> Key -> [Key] keyExpansion nk key = chop4 keys where keys :: [SWord32] keys = key ++ [nextWord i prev old | i <- [nk ..] | prev <- drop (nk-1) keys | old <- keys] chop4 :: [a] -> [[a]] chop4 xs = let (f, r) = splitAt 4 xs in f : chop4 r nextWord :: Int -> SWord32 -> SWord32 -> SWord32 nextWord i prev old | i `mod` nk == 0 = old `xor` subWordRcon (prev `rotateL` 8) (roundConstants !! (i `div` nk)) | i `mod` nk == 4 && nk > 6 = old `xor` subWordRcon prev 0 | True = old `xor` prev subWordRcon :: SWord32 -> GF28 -> SWord32 subWordRcon w rc = fromBytes [a `xor` rc, b, c, d] where [a, b, c, d] = map sbox $ toBytes w ----------------------------------------------------------------------------- -- ** The S-box transformation ----------------------------------------------------------------------------- -- | The values of the AES S-box table. Note that we describe the S-box programmatically -- using the mathematical construction given in Section 5.1.1 of the standard. However, -- the code-generation will turn this into a mere look-up table, as it is just a -- constant table, all computation being done at \"compile-time\". sboxTable :: [GF28] sboxTable = [xformByte (gf28Inverse b) | b <- [0 .. 255]] where xformByte :: GF28 -> GF28 xformByte b = foldr xor 0x63 [b `rotateR` i | i <- [0, 4, 5, 6, 7]] -- | The sbox transformation. We simply select from the sbox table. Note that we -- are obliged to give a default value (here @0@) to be used if the index is out-of-bounds -- as required by SBV's 'select' function. However, that will never happen since -- the table has all 256 elements in it. sbox :: GF28 -> GF28 sbox = select sboxTable 0 ----------------------------------------------------------------------------- -- ** The inverse S-box transformation ----------------------------------------------------------------------------- -- | The values of the inverse S-box table. Again, the construction is programmatic. unSBoxTable :: [GF28] unSBoxTable = [gf28Inverse (xformByte b) | b <- [0 .. 255]] where xformByte :: GF28 -> GF28 xformByte b = foldr xor 0x05 [b `rotateR` i | i <- [2, 5, 7]] -- | The inverse s-box transformation. unSBox :: GF28 -> GF28 unSBox = select unSBoxTable 0 -- | Prove that the 'sbox' and 'unSBox' are inverses. We have: -- -- >>> prove sboxInverseCorrect -- Q.E.D. -- sboxInverseCorrect :: GF28 -> SBool sboxInverseCorrect x = unSBox (sbox x) .== x &&& sbox (unSBox x) .== x ----------------------------------------------------------------------------- -- ** AddRoundKey transformation ----------------------------------------------------------------------------- -- | Adding the round-key to the current state. We simply exploit the fact -- that addition is just xor in implementing this transformation. addRoundKey :: Key -> State -> State addRoundKey = zipWith xor ----------------------------------------------------------------------------- -- ** Tables for T-Box encryption ----------------------------------------------------------------------------- -- | T-box table generation function for encryption t0Func :: GF28 -> [GF28] t0Func a = [s `gf28Mult` 2, s, s, s `gf28Mult` 3] where s = sbox a -- | First look-up table used in encryption t0 :: GF28 -> SWord32 t0 = select t0Table 0 where t0Table = [fromBytes (t0Func a) | a <- [0..255]] -- | Second look-up table used in encryption t1 :: GF28 -> SWord32 t1 = select t1Table 0 where t1Table = [fromBytes (t0Func a `rotR` 1) | a <- [0..255]] -- | Third look-up table used in encryption t2 :: GF28 -> SWord32 t2 = select t2Table 0 where t2Table = [fromBytes (t0Func a `rotR` 2) | a <- [0..255]] -- | Fourth look-up table used in encryption t3 :: GF28 -> SWord32 t3 = select t3Table 0 where t3Table = [fromBytes (t0Func a `rotR` 3) | a <- [0..255]] ----------------------------------------------------------------------------- -- ** Tables for T-Box decryption ----------------------------------------------------------------------------- -- | T-box table generating function for decryption u0Func :: GF28 -> [GF28] u0Func a = [s `gf28Mult` 0xE, s `gf28Mult` 0x9, s `gf28Mult` 0xD, s `gf28Mult` 0xB] where s = unSBox a -- | First look-up table used in decryption u0 :: GF28 -> SWord32 u0 = select t0Table 0 where t0Table = [fromBytes (u0Func a) | a <- [0..255]] -- | Second look-up table used in decryption u1 :: GF28 -> SWord32 u1 = select t1Table 0 where t1Table = [fromBytes (u0Func a `rotR` 1) | a <- [0..255]] -- | Third look-up table used in decryption u2 :: GF28 -> SWord32 u2 = select t2Table 0 where t2Table = [fromBytes (u0Func a `rotR` 2) | a <- [0..255]] -- | Fourth look-up table used in decryption u3 :: GF28 -> SWord32 u3 = select t3Table 0 where t3Table = [fromBytes (u0Func a `rotR` 3) | a <- [0..255]] ----------------------------------------------------------------------------- -- ** AES rounds ----------------------------------------------------------------------------- -- | Generic round function. Given the function to perform one round, a key-schedule, -- and a starting state, it performs the AES rounds. doRounds :: (Bool -> State -> Key -> State) -> KS -> State -> State doRounds rnd (ikey, rkeys, fkey) sIn = rnd True (last rs) fkey where s0 = ikey `addRoundKey` sIn rs = s0 : [rnd False s k | s <- rs | k <- rkeys ] -- | One encryption round. The first argument indicates whether this is the final round -- or not, in which case the construction is slightly different. aesRound :: Bool -> State -> Key -> State aesRound isFinal s key = d `addRoundKey` key where d = map (f isFinal) [0..3] a = map toBytes s f True j = fromBytes [ sbox (a !! ((j+0) `mod` 4) !! 0) , sbox (a !! ((j+1) `mod` 4) !! 1) , sbox (a !! ((j+2) `mod` 4) !! 2) , sbox (a !! ((j+3) `mod` 4) !! 3) ] f False j = e0 `xor` e1 `xor` e2 `xor` e3 where e0 = t0 (a !! ((j+0) `mod` 4) !! 0) e1 = t1 (a !! ((j+1) `mod` 4) !! 1) e2 = t2 (a !! ((j+2) `mod` 4) !! 2) e3 = t3 (a !! ((j+3) `mod` 4) !! 3) -- | One decryption round. Similar to the encryption round, the first argument -- indicates whether this is the final round or not. aesInvRound :: Bool -> State -> Key -> State aesInvRound isFinal s key = d `addRoundKey` key where d = map (f isFinal) [0..3] a = map toBytes s f True j = fromBytes [ unSBox (a !! ((j+0) `mod` 4) !! 0) , unSBox (a !! ((j+3) `mod` 4) !! 1) , unSBox (a !! ((j+2) `mod` 4) !! 2) , unSBox (a !! ((j+1) `mod` 4) !! 3) ] f False j = e0 `xor` e1 `xor` e2 `xor` e3 where e0 = u0 (a !! ((j+0) `mod` 4) !! 0) e1 = u1 (a !! ((j+3) `mod` 4) !! 1) e2 = u2 (a !! ((j+2) `mod` 4) !! 2) e3 = u3 (a !! ((j+1) `mod` 4) !! 3) ----------------------------------------------------------------------------- -- * AES API ----------------------------------------------------------------------------- -- | Key schedule. Given a 128, 192, or 256 bit key, expand it to get key-schedules -- for encryption and decryption. The key is given as a sequence of 32-bit words. -- (4 elements for 128-bits, 6 for 192, and 8 for 256.) aesKeySchedule :: Key -> (KS, KS) aesKeySchedule key | nk `elem` [4, 6, 8] = (encKS, decKS) | True = error "aesKeySchedule: Invalid key size" where nk = length key nr = nk + 6 encKS@(f, m, l) = (head rKeys, take (nr-1) (tail rKeys), rKeys !! nr) decKS = (l, map invMixColumns (reverse m), f) rKeys = keyExpansion nk key -- | Block encryption. The first argument is the plain-text, which must have -- precisely 4 elements, for a total of 128-bits of input. The second -- argument is the key-schedule to be used, obtained by a call to 'aesKeySchedule'. -- The output will always have 4 32-bit words, which is the cipher-text. aesEncrypt :: [SWord32] -> KS -> [SWord32] aesEncrypt pt encKS | length pt == 4 = doRounds aesRound encKS pt | True = error "aesEncrypt: Invalid plain-text size" -- | Block decryption. The arguments are the same as in 'aesEncrypt', except -- the first argument is the cipher-text and the output is the corresponding -- plain-text. aesDecrypt :: [SWord32] -> KS -> [SWord32] aesDecrypt ct decKS | length ct == 4 = doRounds aesInvRound decKS ct | True = error "aesDecrypt: Invalid cipher-text size" ----------------------------------------------------------------------------- -- * Test vectors ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -- ** 128-bit enc/dec test ----------------------------------------------------------------------------- -- | 128-bit encryption test, from Appendix C.1 of the AES standard: -- -- >>> map hex8 t128Enc -- ["69c4e0d8","6a7b0430","d8cdb780","70b4c55a"] -- t128Enc :: [SWord32] t128Enc = aesEncrypt pt ks where pt = [0x00112233, 0x44556677, 0x8899aabb, 0xccddeeff] key = [0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f] (ks, _) = aesKeySchedule key -- | 128-bit decryption test, from Appendix C.1 of the AES standard: -- -- >>> map hex8 t128Dec -- ["00112233","44556677","8899aabb","ccddeeff"] -- t128Dec :: [SWord32] t128Dec = aesDecrypt ct ks where ct = [0x69c4e0d8, 0x6a7b0430, 0xd8cdb780, 0x70b4c55a] key = [0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f] (_, ks) = aesKeySchedule key ----------------------------------------------------------------------------- -- ** 192-bit enc/dec test ----------------------------------------------------------------------------- -- | 192-bit encryption test, from Appendix C.2 of the AES standard: -- -- >>> map hex8 t192Enc -- ["dda97ca4","864cdfe0","6eaf70a0","ec0d7191"] -- t192Enc :: [SWord32] t192Enc = aesEncrypt pt ks where pt = [0x00112233, 0x44556677, 0x8899aabb, 0xccddeeff] key = [0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f, 0x10111213, 0x14151617] (ks, _) = aesKeySchedule key -- | 192-bit decryption test, from Appendix C.2 of the AES standard: -- -- >>> map hex8 t192Dec -- ["00112233","44556677","8899aabb","ccddeeff"] -- t192Dec :: [SWord32] t192Dec = aesDecrypt ct ks where ct = [0xdda97ca4, 0x864cdfe0, 0x6eaf70a0, 0xec0d7191] key = [0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f, 0x10111213, 0x14151617] (_, ks) = aesKeySchedule key ----------------------------------------------------------------------------- -- ** 256-bit enc/dec test ----------------------------------------------------------------------------- -- | 256-bit encryption, from Appendix C.3 of the AES standard: -- -- >>> map hex8 t256Enc -- ["8ea2b7ca","516745bf","eafc4990","4b496089"] -- t256Enc :: [SWord32] t256Enc = aesEncrypt pt ks where pt = [0x00112233, 0x44556677, 0x8899aabb, 0xccddeeff] key = [0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f, 0x10111213, 0x14151617, 0x18191a1b, 0x1c1d1e1f] (ks, _) = aesKeySchedule key -- | 256-bit decryption, from Appendix C.3 of the AES standard: -- -- >>> map hex8 t256Dec -- ["00112233","44556677","8899aabb","ccddeeff"] -- t256Dec :: [SWord32] t256Dec = aesDecrypt ct ks where ct = [0x8ea2b7ca, 0x516745bf, 0xeafc4990, 0x4b496089] key = [0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f, 0x10111213, 0x14151617, 0x18191a1b, 0x1c1d1e1f] (_, ks) = aesKeySchedule key ----------------------------------------------------------------------------- -- * Verification -- ${verifIntro} ----------------------------------------------------------------------------- {- $verifIntro While SMT based technologies can prove correct many small properties fairly quickly, it would be naive for them to automatically verify that our AES implementation is correct. (By correct, we mean decryption follewed by encryption yielding the same result.) However, we can state this property precisely using SBV, and use quick-check to gain some confidence. -} -- | Correctness theorem for 128-bit AES. Ideally, we would run: -- -- @ -- prove aes128IsCorrect -- @ -- -- to get a proof automatically. Unfortunately, while SBV will successfully generate the proof -- obligation for this theorem and ship it to the SMT solver, it would be naive to expect the SMT-solver -- to finish that proof in any reasonable time with the currently available SMT solving technologies. -- Instead, we can issue: -- -- @ -- quickCheck aes128IsCorrect -- @ -- -- and get some degree of confidence in our code. Similar predicates can be easily constructed for 192, and -- 256 bit cases as well. aes128IsCorrect :: (SWord32, SWord32, SWord32, SWord32) -- ^ plain-text words -> (SWord32, SWord32, SWord32, SWord32) -- ^ key-words -> SBool -- ^ True if round-trip gives us plain-text back aes128IsCorrect (i0, i1, i2, i3) (k0, k1, k2, k3) = pt .== pt' where pt = [i0, i1, i2, i3] key = [k0, k1, k2, k3] (encKS, decKS) = aesKeySchedule key ct = aesEncrypt pt encKS pt' = aesDecrypt ct decKS ----------------------------------------------------------------------------- -- * Code generation -- ${codeGenIntro} ----------------------------------------------------------------------------- {- $codeGenIntro We have emphasized that our T-Box implementation in Haskell was guided by clarity and correctness, not performance. Indeed, our implementation is hardly the fastest AES implementation in Haskell. However, we can use it to automatically generate straight-line C-code that can run fairly fast. For the purposes of illustration, we only show here how to generate code for a 128-bit AES block-encrypt function, that takes 8 32-bit words as an argument. The first 4 are the 128-bit input, and the final four are the 128-bit key. The impact of this is that the generated function would expand the key for each block of encryption, a needless task unless we change the key in every block. In a more serios application, we would instead generate code for both the 'aesKeySchedule' and the 'aesEncrypt' functions, thus reusing the key-schedule over many applications of the encryption call. (Unfortunately doing this is rather cumbersome right now, since Haskell does not support fixed-size lists.) -} -- | Code generation for 128-bit AES encryption. -- -- The following sample from the generated code-lines show how T-Boxes are rendered as C arrays: -- -- @ -- static const SWord32 table1[] = { -- 0xc66363a5UL, 0xf87c7c84UL, 0xee777799UL, 0xf67b7b8dUL, -- 0xfff2f20dUL, 0xd66b6bbdUL, 0xde6f6fb1UL, 0x91c5c554UL, -- 0x60303050UL, 0x02010103UL, 0xce6767a9UL, 0x562b2b7dUL, -- 0xe7fefe19UL, 0xb5d7d762UL, 0x4dababe6UL, 0xec76769aUL, -- ... -- } -- @ -- -- The generated program has 5 tables (one sbox table, and 4-Tboxes), all converted to fast C arrays. Here -- is a sample of the generated straightline C-code: -- -- @ -- const SWord8 s1915 = (SWord8) s1912; -- const SWord8 s1916 = table0[s1915]; -- const SWord16 s1917 = (((SWord16) s1914) << 8) | ((SWord16) s1916); -- const SWord32 s1918 = (((SWord32) s1911) << 16) | ((SWord32) s1917); -- const SWord32 s1919 = s1844 ^ s1918; -- const SWord32 s1920 = s1903 ^ s1919; -- @ -- -- The GNU C-compiler does a fine job of optimizing this straightline code to generate a fairly efficient C implementation. cgAES128BlockEncrypt :: IO () cgAES128BlockEncrypt = compileToC Nothing "aes128BlockEncrypt" $ do pt <- cgInputArr 4 "pt" -- plain-text as an array of 4 Word32's key <- cgInputArr 4 "key" -- key as an array of 4 Word32s -- Use the test values from Appendix C.1 of the AES standard as the driver values cgSetDriverValues $ [0x00112233, 0x44556677, 0x8899aabb, 0xccddeeff] ++ [0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f] let (encKs, _) = aesKeySchedule key cgOutputArr "ct" $ aesEncrypt pt encKs ----------------------------------------------------------------------------- -- * C-library generation -- ${libraryIntro} ----------------------------------------------------------------------------- {- $libraryIntro The 'cgAES128BlockEncrypt' example shows how to generate code for 128-bit AES encryption. As the generated function performs encryption on a given block, it performs key expansion as necessary. However, this is not quite practical: We would like to expand the key only once, and encrypt the stream of plain-text blocks using the same expanded key (potentially using some crypto-mode), until we decide to change the key. In this section, we show how to use SBV to instead generate a library of functions that can be used in such a scenario. The generated library is a typical @.a@ archive, that can be linked using the C-compiler as usual. -} -- | Components of the AES-128 implementation that the library is generated from aes128LibComponents :: [(String, SBVCodeGen ())] aes128LibComponents = [ ("aes128KeySchedule", keySchedule) , ("aes128BlockEncrypt", enc128) , ("aes128BlockDecrypt", dec128) ] where -- key-schedule keySchedule = do key <- cgInputArr 4 "key" -- key let (encKS, decKS) = aesKeySchedule key cgOutputArr "encKS" (ksToXKey encKS) cgOutputArr "decKS" (ksToXKey decKS) -- encryption enc128 = do pt <- cgInputArr 4 "pt" -- plain-text xkey <- cgInputArr 44 "xkey" -- expanded key, for 128-bit AES, the key-expansion has 44 Word32's cgOutputArr "ct" $ aesEncrypt pt (xkeyToKS xkey) -- decryption dec128 = do pt <- cgInputArr 4 "ct" -- cipher-text xkey <- cgInputArr 44 "xkey" -- expanded key, for 128-bit AES, the key-expansion has 44 Word32's cgOutputArr "pt" $ aesDecrypt pt (xkeyToKS xkey) -- Transforming back and forth from our KS type to a flat array used by the generated C code -- Turn a series of expanded keys to our internal KS type xkeyToKS :: [SWord32] -> KS xkeyToKS xs = (f, m, l) where f = take 4 xs -- first round key m = chop4 (take 36 (drop 4 xs)) -- middle rounds l = drop 40 xs -- last round key -- Turn a KS to a series of expanded key words ksToXKey :: KS -> [SWord32] ksToXKey (f, m, l) = f ++ concat m ++ l -- chunk in fours. (This function must be in some standard library, where?) chop4 :: [a] -> [[a]] chop4 [] = [] chop4 xs = let (f, r) = splitAt 4 xs in f : chop4 r -- | Generate a C library, containing functions for performing 128-bit enc/dec/key-expansion. -- A note on performance: In a very rough speed test, the generated code was able to do -- 6.3 million block encryptions per second on a decent MacBook Pro. On the same machine, OpenSSL -- reports 8.2 million block encryptions per second. So, the generated code is about 25% slower -- as compared to the highly optimized OpenSSL implementation. (Note that the speed test was done -- somewhat simplistically, so these numbers should be considered very rough estimates.) cgAES128Library :: IO () cgAES128Library = compileToCLib Nothing "aes128Lib" aes128LibComponents -------------------------------------------------------------------------------------------- -- | For doctest purposes only hex8 :: (SymWord a, Show a, Integral a) => SBV a -> String hex8 v = replicate (8 - length s) '0' ++ s where s = flip showHex "" . fromJust . unliteral $ v {-# ANN aesRound ("HLint: ignore Use head" :: String) #-} {-# ANN aesInvRound ("HLint: ignore Use head" :: String) #-} sbv-7.13/Documentation/SBV/Examples/Crypto/RC4.hs0000644000000000000000000001376513405536617017677 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Crypto.RC4 -- Copyright : (c) Austin Seipp -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- An implementation of RC4 (AKA Rivest Cipher 4 or Alleged RC4/ARC4), -- using SBV. For information on RC4, see: . -- -- We make no effort to optimize the code, and instead focus on a clear -- implementation. In fact, the RC4 algorithm relies on in-place update of -- its state heavily for efficiency, and is therefore unsuitable for a purely -- functional implementation. ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module Documentation.SBV.Examples.Crypto.RC4 where import Data.Char (ord, chr) import Data.List (genericIndex) import Data.Maybe (fromJust) import Data.SBV import Data.SBV.Tools.STree import Numeric (showHex) ----------------------------------------------------------------------------- -- * Types ----------------------------------------------------------------------------- -- | RC4 State contains 256 8-bit values. We use the symbolically accessible -- full-binary type 'STree' to represent the state, since RC4 needs -- access to the array via a symbolic index and it's important to minimize access time. type S = STree Word8 Word8 -- | Construct the fully balanced initial tree, where the leaves are simply the numbers @0@ through @255@. initS :: S initS = mkSTree (map literal [0 .. 255]) -- | The key is a stream of 'Word8' values. type Key = [SWord8] -- | Represents the current state of the RC4 stream: it is the @S@ array -- along with the @i@ and @j@ index values used by the PRGA. type RC4 = (S, SWord8, SWord8) ----------------------------------------------------------------------------- -- * The PRGA ----------------------------------------------------------------------------- -- | Swaps two elements in the RC4 array. swap :: SWord8 -> SWord8 -> S -> S swap i j st = writeSTree (writeSTree st i stj) j sti where sti = readSTree st i stj = readSTree st j -- | Implements the PRGA used in RC4. We return the new state and the next key value generated. prga :: RC4 -> (SWord8, RC4) prga (st', i', j') = (readSTree st kInd, (st, i, j)) where i = i' + 1 j = j' + readSTree st' i st = swap i j st' kInd = readSTree st i + readSTree st j ----------------------------------------------------------------------------- -- * Key schedule ----------------------------------------------------------------------------- -- | Constructs the state to be used by the PRGA using the given key. initRC4 :: Key -> S initRC4 key | keyLength < 1 || keyLength > 256 = error $ "RC4 requires a key of length between 1 and 256, received: " ++ show keyLength | True = snd $ foldl mix (0, initS) [0..255] where keyLength = length key mix :: (SWord8, S) -> SWord8 -> (SWord8, S) mix (j', s) i = let j = j' + readSTree s i + genericIndex key (fromJust (unliteral i) `mod` fromIntegral keyLength) in (j, swap i j s) -- | The key-schedule. Note that this function returns an infinite list. keySchedule :: Key -> [SWord8] keySchedule key = genKeys (initRC4 key, 0, 0) where genKeys :: RC4 -> [SWord8] genKeys st = let (k, st') = prga st in k : genKeys st' -- | Generate a key-schedule from a given key-string. keyScheduleString :: String -> [SWord8] keyScheduleString = keySchedule . map (literal . fromIntegral . ord) ----------------------------------------------------------------------------- -- * Encryption and Decryption ----------------------------------------------------------------------------- -- | RC4 encryption. We generate key-words and xor it with the input. The -- following test-vectors are from Wikipedia : -- -- >>> concatMap hex2 $ encrypt "Key" "Plaintext" -- "bbf316e8d940af0ad3" -- -- >>> concatMap hex2 $ encrypt "Wiki" "pedia" -- "1021bf0420" -- -- >>> concatMap hex2 $ encrypt "Secret" "Attack at dawn" -- "45a01f645fc35b383552544b9bf5" encrypt :: String -> String -> [SWord8] encrypt key pt = zipWith xor (keyScheduleString key) (map cvt pt) where cvt = literal . fromIntegral . ord -- | RC4 decryption. Essentially the same as decryption. For the above test vectors we have: -- -- >>> decrypt "Key" [0xbb, 0xf3, 0x16, 0xe8, 0xd9, 0x40, 0xaf, 0x0a, 0xd3] -- "Plaintext" -- -- >>> decrypt "Wiki" [0x10, 0x21, 0xbf, 0x04, 0x20] -- "pedia" -- -- >>> decrypt "Secret" [0x45, 0xa0, 0x1f, 0x64, 0x5f, 0xc3, 0x5b, 0x38, 0x35, 0x52, 0x54, 0x4b, 0x9b, 0xf5] -- "Attack at dawn" decrypt :: String -> [SWord8] -> String decrypt key ct = map cvt $ zipWith xor (keyScheduleString key) ct where cvt = chr . fromIntegral . fromJust . unliteral ----------------------------------------------------------------------------- -- * Verification ----------------------------------------------------------------------------- -- | Prove that round-trip encryption/decryption leaves the plain-text unchanged. -- The theorem is stated parametrically over key and plain-text sizes. The expression -- performs the proof for a 40-bit key (5 bytes) and 40-bit plaintext (again 5 bytes). -- -- Note that this theorem is trivial to prove, since it is essentially establishing -- xor'in the same value twice leaves a word unchanged (i.e., @x `xor` y `xor` y = x@). -- However, the proof takes quite a while to complete, as it gives rise to a fairly -- large symbolic trace. rc4IsCorrect :: IO ThmResult rc4IsCorrect = prove $ do key <- mkForallVars 5 pt <- mkForallVars 5 let ks = keySchedule key ct = zipWith xor ks pt pt' = zipWith xor ks ct return $ pt .== pt' -------------------------------------------------------------------------------------------- -- | For doctest purposes only hex2 :: (SymWord a, Show a, Integral a) => SBV a -> String hex2 v = replicate (2 - length s) '0' ++ s where s = flip showHex "" . fromJust . unliteral $ v sbv-7.13/Documentation/SBV/Examples/Existentials/0000755000000000000000000000000013405536617020133 5ustar0000000000000000sbv-7.13/Documentation/SBV/Examples/Existentials/CRCPolynomial.hs0000644000000000000000000001124313405536617023143 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Existentials.CRCPolynomial -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- This program demonstrates the use of the existentials and the QBVF (quantified -- bit-vector solver). We generate CRC polynomials of degree 16 that can be used -- for messages of size 48-bits. The query finds all such polynomials that have hamming -- distance is at least 4. That is, if the CRC can't tell two different 48-bit messages -- apart, then they must differ in at least 4 bits. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Existentials.CRCPolynomial where import Data.SBV import Data.SBV.Tools.Polynomial ----------------------------------------------------------------------------- -- * Modeling 48 bit words ----------------------------------------------------------------------------- -- | SBV doesn't support 48 bit words natively. So, we represent them -- as a tuple, 32 high-bits and 16 low-bits. type SWord48 = (SWord32, SWord16) -- | Compute the 16 bit CRC of a 48 bit message, using the given polynomial crc_48_16 :: SWord48 -> SWord16 -> [SBool] crc_48_16 msg poly = crcBV 16 msgBits polyBits where (hi, lo) = msg msgBits = blastBE hi ++ blastBE lo polyBits = blastBE poly -- | Count the differing bits in the message and the corresponding CRC diffCount :: (SWord48, [SBool]) -> (SWord48, [SBool]) -> SWord8 diffCount ((h1, l1), crc1) ((h2, l2), crc2) = count xorBits where bits1 = blastBE h1 ++ blastBE l1 ++ crc1 bits2 = blastBE h2 ++ blastBE l2 ++ crc2 -- xor will give us a false if bits match, true if they differ xorBits = zipWith (<+>) bits1 bits2 count [] = 0 count (b:bs) = let r = count bs in ite b (1+r) r -- | Given a hamming distance value @hd@, 'crcGood' returns @true@ if -- the 16 bit polynomial can distinguish all messages that has at most -- @hd@ different bits. Note that we express this conversely: If the -- @sent@ and @received@ messages are different, then it must be the -- case that that must differ from each other (including CRCs), in -- more than @hd@ bits. crcGood :: SWord8 -> SWord16 -> SWord48 -> SWord48 -> SBool crcGood hd poly sent received = sent ./= received ==> diffCount (sent, crcSent) (received, crcReceived) .>= hd where crcSent = crc_48_16 sent poly crcReceived = crc_48_16 received poly -- | Generate good CRC polynomials for 48-bit words, given the hamming distance @hd@. genPoly :: SWord8 -> IO () genPoly hd = do res <- allSat $ do -- the polynomial is existentially specified p <- exists "polynomial" -- sent word, universal s <- do sh <- forall "sh" sl <- forall "sl" return (sh, sl) -- received word, universal r <- do rh <- forall "rh" rl <- forall "rl" return (rh, rl) -- assert that the polynomial @p@ is good. Note -- that we also supply the extra information that -- the least significant bit must be set in the -- polynomial, as all CRC polynomials have the "+1" -- term in them set. This simplifies the query. return $ sTestBit p 0 &&& crcGood hd p s r cnt <- displayModels disp res putStrLn $ "Found: " ++ show cnt ++ " polynomail(s)." where disp :: Int -> (Bool, Word16) -> IO () disp n (_, s) = putStrLn $ "Polynomial #" ++ show n ++ ". x^16 + " ++ showPolynomial False s -- | Find and display all degree 16 polynomials with hamming distance at least 4, for 48 bit messages. -- -- When run, this function prints: -- -- @ -- Polynomial #1. x^16 + x^2 + x + 1 -- Polynomial #2. x^16 + x^15 + x^2 + 1 -- Polynomial #3. x^16 + x^15 + x^2 + x + 1 -- Polynomial #4. x^16 + x^14 + x^10 + 1 -- Polynomial #5. x^16 + x^14 + x^9 + 1 -- ... -- @ -- -- Note that different runs can produce different results, depending on the random -- numbers used by the solver, solver version, etc. (Also, the solver will take some -- time to generate these results. On my machine, the first five polynomials were -- generated in about 5 minutes.) findHD4Polynomials :: IO () findHD4Polynomials = genPoly 4 {-# ANN crc_48_16 ("HLint: ignore Use camelCase" :: String) #-} sbv-7.13/Documentation/SBV/Examples/Existentials/Diophantine.hs0000644000000000000000000001513213405536617022733 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Existentials.Diophantine -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Finding minimal natural number solutions to linear Diophantine equations, -- using explicit quantification. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Existentials.Diophantine where import Data.SBV -------------------------------------------------------------------------------------------------- -- * Representing solutions -------------------------------------------------------------------------------------------------- -- | For a homogeneous problem, the solution is any linear combination of the resulting vectors. -- For a non-homogeneous problem, the solution is any linear combination of the vectors in the -- second component plus one of the vectors in the first component. data Solution = Homogeneous [[Integer]] | NonHomogeneous [[Integer]] [[Integer]] deriving Show -------------------------------------------------------------------------------------------------- -- * Solving diophantine equations -------------------------------------------------------------------------------------------------- -- | ldn: Solve a (L)inear (D)iophantine equation, returning minimal solutions over (N)aturals. -- The input is given as a rows of equations, with rhs values separated into a tuple. The first -- parameter limits the search to bound: In case there are too many solutions, you might want -- to limit your search space. ldn :: Maybe Int -> [([Integer], Integer)] -> IO Solution ldn mbLim problem = do solution <- basis mbLim (map (map literal) m) if homogeneous then return $ Homogeneous solution else do let ones = [xs | (1:xs) <- solution] zeros = [xs | (0:xs) <- solution] return $ NonHomogeneous ones zeros where rhs = map snd problem lhs = map fst problem homogeneous = all (== 0) rhs m | homogeneous = lhs | True = zipWith (\x y -> -x : y) rhs lhs -- | Find the basis solution. By definition, the basis has all non-trivial (i.e., non-0) solutions -- that cannot be written as the sum of two other solutions. We use the mathematically equivalent -- statement that a solution is in the basis if it's least according to the lexicographic -- order using the ordinary less-than relation. (NB. We explicitly tell z3 to use the logic -- AUFLIA for this problem, as the BV solver that is chosen automatically has a performance -- issue. See: .) basis :: Maybe Int -> [[SInteger]] -> IO [[Integer]] basis mbLim m = extractModels `fmap` allSatWith z3{allSatMaxModelCount = mbLim} cond where cond = do as <- mkExistVars n bs <- mkForallVars n -- Tell the solver to use this logic! setLogic AUFLIA return $ ok as &&& (ok bs ==> as .== bs ||| bnot (bs `less` as)) n = if null m then 0 else length (head m) ok xs = bAny (.> 0) xs &&& bAll (.>= 0) xs &&& bAnd [sum (zipWith (*) r xs) .== 0 | r <- m] as `less` bs = bAnd (zipWith (.<=) as bs) &&& bOr (zipWith (.<) as bs) -------------------------------------------------------------------------------------------------- -- * Examples -------------------------------------------------------------------------------------------------- -- | Solve the equation: -- -- @2x + y - z = 2@ -- -- We have: -- -- >>> test -- NonHomogeneous [[0,2,0],[1,0,0]] [[0,1,1],[1,0,2]] -- -- which means that the solutions are of the form: -- -- @(1, 0, 0) + k (0, 1, 1) + k' (1, 0, 2) = (1+k', k, k+2k')@ -- -- OR -- -- @(0, 2, 0) + k (0, 1, 1) + k' (1, 0, 2) = (k', 2+k, k+2k')@ -- -- for arbitrary @k@, @k'@. It's easy to see that these are really solutions -- to the equation given. It's harder to see that they cover all possibilities, -- but a moments thought reveals that is indeed the case. test :: IO Solution test = ldn Nothing [([2,1,-1], 2)] -- | A puzzle: Five sailors and a monkey escape from a naufrage and reach an island with -- coconuts. Before dawn, they gather a few of them and decide to sleep first and share -- the next day. At night, however, one of them awakes, counts the nuts, makes five parts, -- gives the remaining nut to the monkey, saves his share away, and sleeps. All other -- sailors do the same, one by one. When they all wake up in the morning, they again make 5 shares, -- and give the last remaining nut to the monkey. How many nuts were there at the beginning? -- -- We can model this as a series of diophantine equations: -- -- @ -- x_0 = 5 x_1 + 1 -- 4 x_1 = 5 x_2 + 1 -- 4 x_2 = 5 x_3 + 1 -- 4 x_3 = 5 x_4 + 1 -- 4 x_4 = 5 x_5 + 1 -- 4 x_5 = 5 x_6 + 1 -- @ -- -- We need to solve for x_0, over the naturals. We have: -- -- >>> sailors -- [15621,3124,2499,1999,1599,1279,1023] -- -- That is: -- -- @ -- * There was a total of 15621 coconuts -- * 1st sailor: 15621 = 3124*5+1, leaving 15621-3124-1 = 12496 -- * 2nd sailor: 12496 = 2499*5+1, leaving 12496-2499-1 = 9996 -- * 3rd sailor: 9996 = 1999*5+1, leaving 9996-1999-1 = 7996 -- * 4th sailor: 7996 = 1599*5+1, leaving 7996-1599-1 = 6396 -- * 5th sailor: 6396 = 1279*5+1, leaving 6396-1279-1 = 5116 -- * In the morning, they had: 5116 = 1023*5+1. -- @ -- -- Note that this is the minimum solution, that is, we are guaranteed that there's -- no solution with less number of coconuts. In fact, any member of @[15625*k-4 | k <- [1..]]@ -- is a solution, i.e., so are @31246@, @46871@, @62496@, @78121@, etc. -- -- Note that we iteratively deepen our search by requesting increasing number of -- solutions to avoid the all-sat pitfall. sailors :: IO [Integer] sailors = search 1 where search i = do soln <- ldn (Just i) [ ([1, -5, 0, 0, 0, 0, 0], 1) , ([0, 4, -5 , 0, 0, 0, 0], 1) , ([0, 0, 4, -5 , 0, 0, 0], 1) , ([0, 0, 0, 4, -5, 0, 0], 1) , ([0, 0, 0, 0, 4, -5, 0], 1) , ([0, 0, 0, 0, 0, 4, -5], 1) ] case soln of NonHomogeneous (xs:_) _ -> return xs _ -> search (i+1) sbv-7.13/Documentation/SBV/Examples/Lists/0000755000000000000000000000000013405536617016555 5ustar0000000000000000sbv-7.13/Documentation/SBV/Examples/Lists/BoundedMutex.hs0000644000000000000000000002117613405536617021523 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Lists.BoundedMutex -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates use of bounded list utilities, proving a simple -- mutex algorithm correct up to given bounds. ----------------------------------------------------------------------------- {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE OverloadedLists #-} module Documentation.SBV.Examples.Lists.BoundedMutex where import Data.SBV import Data.SBV.Control import Data.SBV.List ((.!!)) import qualified Data.SBV.List as L import qualified Data.SBV.List.Bounded as L -- | Each agent can be in one of the three states data State = Idle -- ^ Regular work | Ready -- ^ Intention to enter critical state | Critical -- ^ In the critical state -- | Make 'State' a symbolic enumeration mkSymbolicEnumeration ''State -- | The type synonym 'SState' is mnemonic for symbolic state. type SState = SBV State -- | Symbolic version of 'Idle' idle :: SState idle = literal Idle -- | Symbolic version of 'Ready' ready :: SState ready = literal Ready -- | Symbolic version of 'Critical' critical :: SState critical = literal Critical -- | A bounded mutex property holds for two sequences of state transitions, if they are not in -- their critical section at the same time up to that given bound. mutex :: Int -> SList State -> SList State -> SBool mutex i p1s p2s = L.band i $ L.bzipWith i (\p1 p2 -> p1 ./= critical ||| p2 ./= critical) p1s p2s -- | A sequence is valid upto a bound if it starts at 'Idle', and follows the mutex rules. That is: -- -- * From 'Idle' it can switch to 'Ready' or stay 'Idle' -- * From 'Ready' it can switch to 'Critical' if it's its turn -- * From 'Critical' it can either stay in 'Critical' or go back to 'Idle' -- -- The variable @me@ identifies the agent id. validSequence :: Int -> Integer -> SList Integer -> SList State -> SBool validSequence b me pturns proc = bAnd [ L.length proc .== fromIntegral b , idle .== L.head proc , check b pturns proc idle ] where check 0 _ _ _ = true check i ts ps prev = let (cur, rest) = L.uncons ps (turn, turns) = L.uncons ts ok = ite (prev .== idle) (cur `sElem` [idle, ready]) $ ite (prev .== ready &&& turn .== literal me) (cur `sElem` [critical]) $ ite (prev .== critical) (cur `sElem` [critical, idle]) $ (cur `sElem` [prev]) in ok &&& check (i-1) turns rest cur -- | The mutex algorithm, coded implicity as an assignment to turns. Turns start at @1@, and at each stage is either -- @1@ or @2@; giving preference to that process. The only condition is that if either process is in its critical -- section, then the turn value stays the same. Note that this is sufficient to satisfy safety (i.e., mutual -- exclusion), though it does not guarantee liveness. validTurns :: Int -> SList Integer -> SList State -> SList State -> SBool validTurns b turns process1 process2 = bAnd [ L.length turns .== fromIntegral b , 1 .== L.head turns , check b turns process1 process2 1 ] where check 0 _ _ _ _ = true check i ts proc1 proc2 prev = cur `sElem` [1, 2] &&& (p1 .== critical ||| p2 .== critical ==> cur .== prev) &&& check (i-1) rest p1s p2s cur where (cur, rest) = L.uncons ts (p1, p1s) = L.uncons proc1 (p2, p2s) = L.uncons proc2 -- | Check that we have the mutex property so long as 'validSequence' and 'validTurns' holds; i.e., -- so long as both the agents and the arbiter act according to the rules. The check is bounded up-to-the -- given concrete bound; so this is an example of a bounded-model-checking style proof. We have: -- -- >>> checkMutex 20 -- All is good! checkMutex :: Int -> IO () checkMutex b = runSMT $ do p1 :: SList State <- sList "p1" p2 :: SList State <- sList "p2" turns :: SList Integer <- sList "turns" -- Ensure that both sequences and the turns are valid constrain $ validSequence b 1 turns p1 constrain $ validSequence b 2 turns p2 constrain $ validTurns b turns p1 p2 -- Try to assert that mutex does not hold. If we get a -- counter example, we would've found a violation! constrain $ bnot $ mutex b p1 p2 query $ do cs <- checkSat case cs of Unk -> error "Solver said Unknown!" Unsat -> io . putStrLn $ "All is good!" Sat -> do io . putStrLn $ "Violation detected!" do p1V <- getValue p1 p2V <- getValue p2 ts <- getValue turns io . putStrLn $ "P1: " ++ show p1V io . putStrLn $ "P2: " ++ show p2V io . putStrLn $ "Ts: " ++ show ts -- | Our algorithm is correct, but it is not fair. It does not guarantee that a process that -- wants to enter its critical-section will always do so eventually. Demonstrate this by -- trying to show a bounded trace of length 10, such that the second process is ready but -- never transitions to critical. We have: -- -- > ghci> notFair 10 -- > Fairness is violated at bound: 10 -- > P1: [Idle,Idle,Ready,Critical,Idle,Idle,Ready,Critical,Idle,Idle] -- > P2: [Idle,Ready,Ready,Ready,Ready,Ready,Ready,Ready,Ready,Ready] -- > Ts: [1,2,1,1,1,1,1,1,1,1] -- -- As expected, P2 gets ready but never goes critical since the arbiter keeps picking -- P1 unfairly. (You might get a different trace depending on what z3 happens to produce!) -- -- Exercise for the reader: Change the 'validTurns' function so that it alternates the turns -- from the previous value if neither process is in critical. Show that this makes the 'notFair' -- function below no longer exhibits the issue. Is this sufficient? Concurrent programming is tricky! notFair :: Int -> IO () notFair b = runSMT $ do p1 :: SList State <- sList "p1" p2 :: SList State <- sList "p2" turns :: SList Integer <- sList "turns" -- Ensure that both sequences and the turns are valid constrain $ validSequence b 1 turns p1 constrain $ validSequence b 2 turns p2 constrain $ validTurns b turns p1 p2 -- Ensure that the second process becomes ready in the second cycle: constrain $ p2 .!! 1 .== ready -- Find a trace where p2 never goes critical -- counter example, we would've found a violation! constrain $ bnot $ L.belem b critical p2 query $ do cs <- checkSat case cs of Unk -> error "Solver said Unknown!" Unsat -> error "Solver couldn't find a violating trace!" Sat -> do io . putStrLn $ "Fairness is violated at bound: " ++ show b do p1V <- getValue p1 p2V <- getValue p2 ts <- getValue turns io . putStrLn $ "P1: " ++ show p1V io . putStrLn $ "P2: " ++ show p2V io . putStrLn $ "Ts: " ++ show ts {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/Documentation/SBV/Examples/Lists/Fibonacci.hs0000644000000000000000000000321013405536617020762 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Lists.Fibonacci -- Copyright : (c) Joel Burget -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Define the fibonacci sequence as an SBV symbolic list. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Lists.Fibonacci where import Data.SBV import Data.SBV.List ((.!!)) import qualified Data.SBV.List as L import Data.SBV.Control -- | Compute a prefix of the fibonacci numbers. We have: -- >>> mkFibs 10 -- [1,1,2,3,5,8,13,21,34,55] mkFibs :: Int -> IO [Integer] mkFibs n = take n <$> runSMT genFibs -- | Generate fibonacci numbers as a sequence. Note that we constrain only -- the first 200 entries. genFibs :: Symbolic [Integer] genFibs = do fibs <- sList "fibs" -- constrain the length constrain $ L.length fibs .== 200 -- Constrain first two elements constrain $ fibs .!! 0 .== 1 constrain $ fibs .!! 1 .== 1 -- Constrain an arbitrary element at index `i` let constr i = constrain $ fibs .!! i + fibs .!! (i+1) .== fibs .!! (i+2) -- Constrain the remaining elts mapM_ (constr . fromIntegral) [(0::Int) .. 197] query $ do cs <- checkSat case cs of Unk -> error "Solver returned unknown!" Unsat -> error "Solver couldn't generate the fibonacci sequence!" Sat -> getValue fibs sbv-7.13/Documentation/SBV/Examples/Lists/Nested.hs0000644000000000000000000000273013405536617020335 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Lists.Nested -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates nested lists ----------------------------------------------------------------------------- {-# LANGUAGE OverloadedLists #-} {-# LANGUAGE ScopedTypeVariables #-} module Documentation.SBV.Examples.Lists.Nested where import Data.SBV import Data.SBV.Control import Data.SBV.List ((.!!)) import qualified Data.SBV.List as L -- | Simple example demonstrating the use of nested lists. We have: -- -- >>> nestedExample -- [[1,2,3],[4,5,6,7],[8,9,10],[11,12,13]] nestedExample :: IO () nestedExample = runSMT $ do a :: SList [Integer] <- free "a" constrain $ a .!! 0 .== [1, 2, 3] constrain $ a .!! 1 .== [4, 5, 6, 7] constrain $ L.tail (L.tail a) .== [[8, 9, 10], [11, 12, 13]] constrain $ L.length a .== 4 query $ do cs <- checkSat case cs of Unk -> error "Solver said unknown!" Unsat -> io $ putStrLn "Unsat" Sat -> do v <- getValue a io $ print v sbv-7.13/Documentation/SBV/Examples/Misc/0000755000000000000000000000000013405536617016352 5ustar0000000000000000sbv-7.13/Documentation/SBV/Examples/Misc/Auxiliary.hs0000644000000000000000000000434313405536617020661 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Misc.Auxiliary -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates model construction with auxiliary variables. Sometimes we -- need to introduce a variable in our problem as an existential variable, -- but it's "internal" to the problem and we do not consider it as part of -- the solution. Also, in an `allSat` scenario, we may not care for models -- that only differ in these auxiliaries. SBV allows designating such variables -- as `isNonModelVar` so we can still use them like any other variable, but without -- considering them explicitly in model construction. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Misc.Auxiliary where import Data.SBV -- | A simple predicate, based on two variables @x@ and @y@, true when -- @0 <= x <= 1@ and @x - abs y@ is @0@. problem :: Predicate problem = do x <- free "x" y <- free "y" constrain $ x .>= 0 constrain $ x .<= 1 return $ x - abs y .== (0 :: SInteger) -- | Generate all satisfying assignments for our problem. We have: -- -- >>> allModels -- Solution #1: -- x = 0 :: Integer -- y = 0 :: Integer -- Solution #2: -- x = 1 :: Integer -- y = 1 :: Integer -- Solution #3: -- x = 1 :: Integer -- y = -1 :: Integer -- Found 3 different solutions. -- -- Note that solutions @2@ and @3@ share the value @x = 1@, since there are -- multiple values of @y@ that make this particular choice of @x@ satisfy our constraint. allModels :: IO AllSatResult allModels = allSat problem -- | Generate all satisfying assignments, but we first tell SBV that @y@ should not be considered -- as a model problem, i.e., it's auxiliary. We have: -- -- >>> modelsWithYAux -- Solution #1: -- x = 0 :: Integer -- Solution #2: -- x = 1 :: Integer -- Found 2 different solutions. -- -- Note that we now have only two solutions, one for each unique value of @x@ that satisfy our -- constraint. modelsWithYAux :: IO AllSatResult modelsWithYAux = allSatWith z3{isNonModelVar = (`elem` ["y"])} problem sbv-7.13/Documentation/SBV/Examples/Misc/Enumerate.hs0000644000000000000000000000465113405536617020641 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Misc.Enumerate -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates how enumerations can be translated to their SMT-Lib -- counterparts, without losing any information content. Also see -- "Documentation.SBV.Examples.Puzzles.U2Bridge" for a more detailed -- example involving enumerations. ----------------------------------------------------------------------------- {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE ScopedTypeVariables #-} module Documentation.SBV.Examples.Misc.Enumerate where import Data.SBV -- | A simple enumerated type, that we'd like to translate to SMT-Lib intact; -- i.e., this type will not be uninterpreted but rather preserved and will -- be just like any other symbolic type SBV provides. -- -- Also note that we need to have the following @LANGUAGE@ options defined: -- @TemplateHaskell@, @StandaloneDeriving@, @DeriveDataTypeable@, @DeriveAnyClass@ for -- this to work. data E = A | B | C -- | Make 'E' a symbolic value. mkSymbolicEnumeration ''E -- | Give a name to the symbolic variants of 'E', for convenience type SE = SBV E -- | Have the SMT solver enumerate the elements of the domain. We have: -- -- >>> elts -- Solution #1: -- s0 = B :: E -- Solution #2: -- s0 = A :: E -- Solution #3: -- s0 = C :: E -- Found 3 different solutions. elts :: IO AllSatResult elts = allSat $ \(x::SE) -> x .== x -- | Shows that if we require 4 distinct elements of the type 'E', we shall fail; as -- the domain only has three elements. We have: -- -- >>> four -- Unsatisfiable four :: IO SatResult four = sat $ \a b c (d::SE) -> distinct [a, b, c, d] -- | Enumerations are automatically ordered, so we can ask for the maximum -- element. Note the use of quantification. We have: -- -- >>> maxE -- Satisfiable. Model: -- maxE = C :: E maxE :: IO SatResult maxE = sat $ do mx <- exists "maxE" e <- forall "e" return $ mx .>= (e::SE) -- | Similarly, we get the minumum element. We have: -- -- >>> minE -- Satisfiable. Model: -- minE = A :: E minE :: IO SatResult minE = sat $ do mx <- exists "minE" e <- forall "e" return $ mx .<= (e::SE) sbv-7.13/Documentation/SBV/Examples/Misc/Floating.hs0000644000000000000000000001603713405536617020460 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Misc.Floating -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Several examples involving IEEE-754 floating point numbers, i.e., single -- precision 'Float' ('SFloat') and double precision 'Double' ('SDouble') types. -- -- Note that arithmetic with floating point is full of surprises; due to precision -- issues associativity of arithmetic operations typically do not hold. Also, -- the presence of @NaN@ is always something to look out for. ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module Documentation.SBV.Examples.Misc.Floating where import Data.SBV ----------------------------------------------------------------------------- -- * FP addition is not associative ----------------------------------------------------------------------------- -- | Prove that floating point addition is not associative. For illustration purposes, -- we will require one of the inputs to be a @NaN@. We have: -- -- >>> prove $ assocPlus (0/0) -- Falsifiable. Counter-example: -- s0 = 0.0 :: Float -- s1 = 0.0 :: Float -- -- Indeed: -- -- >>> let i = 0/0 :: Float -- >>> i + (0.0 + 0.0) -- NaN -- >>> ((i + 0.0) + 0.0) -- NaN -- -- But keep in mind that @NaN@ does not equal itself in the floating point world! We have: -- -- >>> let nan = 0/0 :: Float in nan == nan -- False assocPlus :: SFloat -> SFloat -> SFloat -> SBool assocPlus x y z = x + (y + z) .== (x + y) + z -- | Prove that addition is not associative, even if we ignore @NaN@/@Infinity@ values. -- To do this, we use the predicate 'fpIsPoint', which is true of a floating point -- number ('SFloat' or 'SDouble') if it is neither @NaN@ nor @Infinity@. (That is, it's a -- representable point in the real-number line.) -- -- We have: -- -- >>> assocPlusRegular -- Falsifiable. Counter-example: -- x = 3.7634227e-37 :: Float -- y = -3.7612938e-37 :: Float -- z = -1.1036833e-38 :: Float -- -- Indeed, we have: -- -- >>> let x = 3.7634227e-37 :: Float -- >>> let y = -3.7612938e-37 :: Float -- >>> let z = -1.1036833e-38 :: Float -- >>> x + (y + z) -- -1.0823943e-38 -- >>> (x + y) + z -- -1.0823947e-38 -- -- Note the difference between two additions! assocPlusRegular :: IO ThmResult assocPlusRegular = prove $ do [x, y, z] <- sFloats ["x", "y", "z"] let lhs = x+(y+z) rhs = (x+y)+z -- make sure we do not overflow at the intermediate points constrain $ fpIsPoint lhs constrain $ fpIsPoint rhs return $ lhs .== rhs ----------------------------------------------------------------------------- -- * FP addition by non-zero can result in no change ----------------------------------------------------------------------------- -- | Demonstrate that @a+b = a@ does not necessarily mean @b@ is @0@ in the floating point world, -- even when we disallow the obvious solution when @a@ and @b@ are @Infinity.@ -- We have: -- -- >>> nonZeroAddition -- Falsifiable. Counter-example: -- a = -4.611686e18 :: Float -- b = 1.3552526e-20 :: Float -- -- Indeed, we have: -- -- >>> (-4.611686e18 + 1.3552526e-20) == (-4.611686e18 :: Float) -- True -- -- But: -- -- >>> 1.3552526e-20 == (0 :: Float) -- False -- nonZeroAddition :: IO ThmResult nonZeroAddition = prove $ do [a, b] <- sFloats ["a", "b"] constrain $ fpIsPoint a constrain $ fpIsPoint b constrain $ a + b .== a return $ b .== 0 ----------------------------------------------------------------------------- -- * FP multiplicative inverses may not exist ----------------------------------------------------------------------------- -- | This example illustrates that @a * (1/a)@ does not necessarily equal @1@. Again, -- we protect against division by @0@ and @NaN@/@Infinity@. -- -- We have: -- -- >>> multInverse -- Falsifiable. Counter-example: -- a = 8.988465676670122e307 :: Double -- -- Indeed, we have: -- -- >>> let a = 8.988465676670122e307 :: Double -- >>> a * (1/a) -- 1.0000000000000002 multInverse :: IO ThmResult multInverse = prove $ do a <- sDouble "a" constrain $ fpIsPoint a constrain $ fpIsPoint (1/a) return $ a * (1/a) .== 1 ----------------------------------------------------------------------------- -- * Effect of rounding modes ----------------------------------------------------------------------------- -- | One interesting aspect of floating-point is that the chosen rounding-mode -- can effect the results of a computation if the exact result cannot be precisely -- represented. SBV exports the functions 'fpAdd', 'fpSub', 'fpMul', 'fpDiv', 'fpFMA' -- and 'fpSqrt' which allows users to specify the IEEE supported 'RoundingMode' for -- the operation. This example illustrates how SBV can be used to find rounding-modes -- where, for instance, addition can produce different results. We have: -- -- >>> roundingAdd -- Satisfiable. Model: -- rm = RoundTowardPositive :: RoundingMode -- x = 255.96877 :: Float -- y = 255.875 :: Float -- -- (Note that depending on your version of Z3, you might get a different result.) -- Unfortunately we can't directly validate this result at the Haskell level, as Haskell only supports -- 'RoundNearestTiesToEven'. We have: -- -- >>> 255.96877 + 255.875 :: Float -- 511.84375 -- -- While we cannot directly see the result when the mode is 'RoundTowardPositive' in Haskell, we can use -- SBV to provide us with that result thusly: -- -- >>> sat $ \z -> z .== fpAdd sRoundTowardPositive 255.96877 (255.875 :: SFloat) -- Satisfiable. Model: -- s0 = 511.84378 :: Float -- -- We can see why these two resuls are indeed different: The 'RoundTowardPositive' -- (which rounds towards positive-infinity) produces a larger result. Indeed, if we treat these numbers -- as 'Double' values, we get: -- -- >>> 255.96877 + 255.875 :: Double -- 511.84377 -- -- we see that the "more precise" result is larger than what the 'Float' value is, justifying the -- larger value with 'RoundTowardPositive'. A more detailed study is beyond our current scope, so we'll -- merely -- note that floating point representation and semantics is indeed a thorny -- subject, and point to as -- an excellent guide. roundingAdd :: IO SatResult roundingAdd = sat $ do m :: SRoundingMode <- free "rm" constrain $ m ./= literal RoundNearestTiesToEven x <- sFloat "x" y <- sFloat "y" let lhs = fpAdd m x y let rhs = x + y constrain $ fpIsPoint lhs constrain $ fpIsPoint rhs return $ lhs ./= rhs sbv-7.13/Documentation/SBV/Examples/Misc/ModelExtract.hs0000644000000000000000000000405413405536617021304 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Misc.ModelExtract -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates use of programmatic model extraction. When programming with -- SBV, we typically use `sat`/`allSat` calls to compute models automatically. -- In more advanced uses, however, the user might want to use programmable -- extraction features to do fancier programming. We demonstrate some of -- these utilities here. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Misc.ModelExtract where import Data.SBV -- | A simple function to generate a new integer value, that is not in the -- given set of values. We also require the value to be non-negative outside :: [Integer] -> IO SatResult outside disallow = sat $ do x <- sInteger "x" let notEq i = constrain $ x ./= literal i mapM_ notEq disallow return $ x .>= 0 -- | We now use "outside" repeatedly to generate 10 integers, such that we not only disallow -- previously generated elements, but also any value that differs from previous solutions -- by less than 5. Here, we use the `getModelValue` function. We could have also extracted the dictionary -- via `getModelDictionary` and did fancier programming as well, as necessary. We have: -- -- >>> genVals -- [45,40,35,30,25,20,15,10,5,0] genVals :: IO [Integer] genVals = go [] [] where go _ model | length model >= 10 = return model go disallow model = do res <- outside disallow -- Look up the value of "x" in the generated model -- Note that we simply get an integer here; but any -- SBV known type would be OK as well. case "x" `getModelValue` res of Just c -> go ([c-4 .. c+4] ++ disallow) (c : model) _ -> return model sbv-7.13/Documentation/SBV/Examples/Misc/NoDiv0.hs0000644000000000000000000000271713405536617020014 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Misc.NoDiv0 -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates SBV's assertion checking facilities ----------------------------------------------------------------------------- {-# LANGUAGE ImplicitParams #-} module Documentation.SBV.Examples.Misc.NoDiv0 where import Data.SBV import GHC.Stack -- | A simple variant of division, where we explicitly require the -- caller to make sure the divisor is not 0. checkedDiv :: (?loc :: CallStack) => SInt32 -> SInt32 -> SInt32 checkedDiv x y = sAssert (Just ?loc) "Divisor should not be 0" (y ./= 0) (x `sDiv` y) -- | Check whether an arbitrary call to 'checkedDiv' is safe. Clearly, we do not expect -- this to be safe: -- -- >>> test1 -- [Documentation/SBV/Examples/Misc/NoDiv0.hs:36:14:checkedDiv: Divisor should not be 0: Violated. Model: -- s0 = 0 :: Int32 -- s1 = 0 :: Int32] -- test1 :: IO [SafeResult] test1 = safe checkedDiv -- | Repeat the test, except this time we explicitly protect against the bad case. We have: -- -- >>> test2 -- [Documentation/SBV/Examples/Misc/NoDiv0.hs:44:41:checkedDiv: Divisor should not be 0: No violations detected] -- test2 :: IO [SafeResult] test2 = safe $ \x y -> ite (y .== 0) 3 (checkedDiv x y) sbv-7.13/Documentation/SBV/Examples/Misc/Polynomials.hs0000644000000000000000000000553013405536617021217 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Misc.Polynomials -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Simple usage of polynomials over GF(2^n), using Rijndael's -- finite field: -- -- The functions available are: -- -- [/pMult/] GF(2^n) Multiplication -- -- [/pDiv/] GF(2^n) Division -- -- [/pMod/] GF(2^n) Modulus -- -- [/pDivMod/] GF(2^n) Division/Modulus, packed together -- -- Note that addition in GF(2^n) is simply `xor`, so no custom function is provided. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Misc.Polynomials where import Data.SBV import Data.SBV.Tools.Polynomial -- | Helper synonym for representing GF(2^8); which are merely 8-bit unsigned words. Largest -- term in such a polynomial has degree 7. type GF28 = SWord8 -- | Multiplication in Rijndael's field; usual polynomial multiplication followed by reduction -- by the irreducible polynomial. The irreducible used by Rijndael's field is the polynomial -- @x^8 + x^4 + x^3 + x + 1@, which we write by giving it's /exponents/ in SBV. -- See: . -- Note that the irreducible itself is not in GF28! It has a degree of 8. -- -- NB. You can use the 'showPoly' function to print polynomials nicely, as a mathematician would write. gfMult :: GF28 -> GF28 -> GF28 a `gfMult` b = pMult (a, b, [8, 4, 3, 1, 0]) -- | States that the unit polynomial @1@, is the unit element multUnit :: GF28 -> SBool multUnit x = (x `gfMult` unit) .== x where unit = polynomial [0] -- x@0 -- | States that multiplication is commutative multComm :: GF28 -> GF28 -> SBool multComm x y = (x `gfMult` y) .== (y `gfMult` x) -- | States that multiplication is associative, note that associativity -- proofs are notoriously hard for SAT/SMT solvers multAssoc :: GF28 -> GF28 -> GF28 -> SBool multAssoc x y z = ((x `gfMult` y) `gfMult` z) .== (x `gfMult` (y `gfMult` z)) -- | States that the usual multiplication rule holds over GF(2^n) polynomials -- Checks: -- -- @ -- if (a, b) = x `pDivMod` y then x = y `pMult` a + b -- @ -- -- being careful about @y = 0@. When divisor is 0, then quotient is -- defined to be 0 and the remainder is the numerator. -- (Note that addition is simply `xor` in GF(2^8).) polyDivMod :: GF28 -> GF28 -> SBool polyDivMod x y = ite (y .== 0) ((0, x) .== (a, b)) (x .== (y `gfMult` a) `xor` b) where (a, b) = x `pDivMod` y -- | Queries testGF28 :: IO () testGF28 = do print =<< prove multUnit print =<< prove multComm -- print =<< prove multAssoc -- takes too long; see above note.. print =<< prove polyDivMod sbv-7.13/Documentation/SBV/Examples/Misc/SoftConstrain.hs0000644000000000000000000000340313405536617021502 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Misc.SoftConstrain -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates soft-constraints, i.e., those that the solver -- is free to leave unsatisfied. Solvers will try to satisfy -- this constraint, unless it is impossible to do so to get -- a model. Can be good in modeling default values, for instance. ----------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} module Documentation.SBV.Examples.Misc.SoftConstrain where import Data.SBV -- | Create two strings, requiring one to be a particular value, constraining the other -- to be different than another constant string. But also add soft constraints to -- indicate our preferences for each of these variables. We get: -- -- >>> example -- Satisfiable. Model: -- x = "x-must-really-be-hello" :: String -- y = "default-y-value" :: String -- -- Note how the value of @x@ is constrained properly and thus the default value -- doesn't kick in, but @y@ takes the default value since it is acceptable by -- all the other hard constraints. example :: IO SatResult example = sat $ do x <- sString "x" y <- sString "y" constrain $ x .== "x-must-really-be-hello" constrain $ y ./= "y-can-be-anything-but-hello" -- Now add soft-constraints to indicate our preference -- for what these variables should be: softConstrain $ x .== "default-x-value" softConstrain $ y .== "default-y-value" return (true :: SBool) sbv-7.13/Documentation/SBV/Examples/Misc/Word4.hs0000644000000000000000000001156413405536617017714 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Misc.Enumerate -- Copyright : (c) Brian Huffman -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates how new sizes of word/int types can be defined and -- used with SBV. ----------------------------------------------------------------------------- {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} module Documentation.SBV.Examples.Misc.Word4 where import GHC.Enum (boundedEnumFrom, boundedEnumFromThen, toEnumError, succError, predError) import Data.Bits import Data.Generics (Data, Typeable) import System.Random (Random(..)) import Data.SBV import Data.SBV.Internals -- | Word4 as a newtype. Invariant: @Word4 x@ should satisfy @x < 16@. newtype Word4 = Word4 Word8 deriving (Eq, Ord, Data, Typeable) -- | Smart constructor; simplifies conversion from Word8 word4 :: Word8 -> Word4 word4 x = Word4 (x .&. 0x0f) -- | Show instance instance Show Word4 where show (Word4 x) = show x -- | Read instance. We read as an 8-bit word, and coerce instance Read Word4 where readsPrec p s = [ (word4 x, s') | (x, s') <- readsPrec p s ] -- | Bounded instance; from 0 to 255 instance Bounded Word4 where minBound = Word4 0x00 maxBound = Word4 0x0f -- | Enum instance, trivial definitions. instance Enum Word4 where succ (Word4 x) = if x < 0x0f then Word4 (succ x) else succError "Word4" pred (Word4 x) = if x > 0x00 then Word4 (pred x) else predError "Word4" toEnum i | 0x00 <= i && i <= 0x0f = Word4 (toEnum i) | otherwise = toEnumError "Word4" i (Word4 0x00, Word4 0x0f) fromEnum (Word4 x) = fromEnum x -- Comprehensions enumFrom = boundedEnumFrom enumFromThen = boundedEnumFromThen enumFromTo (Word4 x) (Word4 y) = map Word4 (enumFromTo x y) enumFromThenTo (Word4 x) (Word4 y) (Word4 z) = map Word4 (enumFromThenTo x y z) -- | Num instance, merely lifts underlying 8-bit operation and casts back instance Num Word4 where Word4 x + Word4 y = word4 (x + y) Word4 x * Word4 y = word4 (x * y) Word4 x - Word4 y = word4 (x - y) negate (Word4 x) = word4 (negate x) abs (Word4 x) = Word4 x signum (Word4 x) = Word4 (if x == 0 then 0 else 1) fromInteger n = word4 (fromInteger n) -- | Real instance simply uses the Word8 instance instance Real Word4 where toRational (Word4 x) = toRational x -- | Integral instance, again using Word8 instance and casting. NB. we do -- not need to use the smart constructor here as neither the quotient nor -- the remainder can overflow a Word4. instance Integral Word4 where quotRem (Word4 x) (Word4 y) = (Word4 q, Word4 r) where (q, r) = quotRem x y toInteger (Word4 x) = toInteger x -- | Bits instance instance Bits Word4 where Word4 x .&. Word4 y = Word4 (x .&. y) Word4 x .|. Word4 y = Word4 (x .|. y) Word4 x `xor` Word4 y = Word4 (x `xor` y) complement (Word4 x) = Word4 (x `xor` 0x0f) Word4 x `shift` i = word4 (shift x i) Word4 x `shiftL` i = word4 (shiftL x i) Word4 x `shiftR` i = Word4 (shiftR x i) Word4 x `rotate` i = word4 (x `shiftL` k .|. x `shiftR` (4-k)) where k = i .&. 3 bitSize _ = 4 bitSizeMaybe _ = Just 4 isSigned _ = False testBit (Word4 x) = testBit x bit i = word4 (bit i) popCount (Word4 x) = popCount x -- | Random instance, used in quick-check instance Random Word4 where randomR (Word4 lo, Word4 hi) gen = (Word4 x, gen') where (x, gen') = randomR (lo, hi) gen random gen = (Word4 x, gen') where (x, gen') = randomR (0x00, 0x0f) gen -- | SWord4 type synonym type SWord4 = SBV Word4 -- | SymWord instance, allowing this type to be used in proofs/sat etc. instance SymWord Word4 where mkSymWord = genMkSymVar (KBounded False 4) literal = genLiteral (KBounded False 4) fromCW = genFromCW -- | HasKind instance; simply returning the underlying kind for the type instance HasKind Word4 where kindOf _ = KBounded False 4 -- | SatModel instance, merely uses the generic parsing method. instance SatModel Word4 where parseCWs = genParse (KBounded False 4) -- | SDvisible instance, using 0-extension instance SDivisible Word4 where sQuotRem x 0 = (0, x) sQuotRem x y = x `quotRem` y sDivMod x 0 = (0, x) sDivMod x y = x `divMod` y -- | SDvisible instance, using default methods instance SDivisible SWord4 where sQuotRem = liftQRem sDivMod = liftDMod -- | SIntegral instance, using default methods instance SIntegral Word4 -- | Joining/splitting to/from Word8 instance Splittable Word8 Word4 where split x = (Word4 (x `shiftR` 4), word4 x) Word4 x # Word4 y = (x `shiftL` 4) .|. y extend (Word4 x) = x sbv-7.13/Documentation/SBV/Examples/Optimization/0000755000000000000000000000000013405536617020145 5ustar0000000000000000sbv-7.13/Documentation/SBV/Examples/Optimization/ExtField.hs0000644000000000000000000000310613405536617022205 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Optimization.ExtField -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates the extension field (@oo@/@epsilon@) optimization results. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Optimization.ExtField where import Data.SBV -- | Optimization goals where min/max values might require assignments -- to values that are infinite (integer case), or infinite/epsion (real case). -- This simple example demostrates how SBV can be used to extract such values. -- -- We have: -- -- >>> optimize Independent problem -- Objective "one-x": Optimal in an extension field: -- one-x = oo :: Integer -- min_y = 7.0 + (2.0 * epsilon) :: Real -- min_z = 5.0 + epsilon :: Real -- Objective "min_y": Optimal in an extension field: -- one-x = oo :: Integer -- min_y = 7.0 + (2.0 * epsilon) :: Real -- min_z = 5.0 + epsilon :: Real -- Objective "min_z": Optimal in an extension field: -- one-x = oo :: Integer -- min_y = 7.0 + (2.0 * epsilon) :: Real -- min_z = 5.0 + epsilon :: Real problem :: Goal problem = do x <- sInteger "x" y <- sReal "y" z <- sReal "z" maximize "one-x" $ 1 - x constrain $ y .> 0 &&& z .> 5 minimize "min_y" $ 2+y+z minimize "min_z" z sbv-7.13/Documentation/SBV/Examples/Optimization/LinearOpt.hs0000644000000000000000000000231313405536617022375 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Optimization.LinearOpt -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Simple linear optimization example, as found in operations research texts. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Optimization.LinearOpt where import Data.SBV -- | Taken from -- -- * maximize 5x1 + 6x2 -- - subject to -- -- 1. x1 + x2 <= 10 -- 2. x1 - x2 >= 3 -- 3. 5x1 + 4x2 <= 35 -- 4. x1 >= 0 -- 5. x2 >= 0 -- -- >>> optimize Lexicographic problem -- Optimal model: -- x1 = 47 % 9 :: Real -- x2 = 20 % 9 :: Real -- goal = 355 % 9 :: Real problem :: Goal problem = do [x1, x2] <- mapM sReal ["x1", "x2"] constrain $ x1 + x2 .<= 10 constrain $ x1 - x2 .>= 3 constrain $ 5*x1 + 4*x2 .<= 35 constrain $ x1 .>= 0 constrain $ x2 .>= 0 maximize "goal" $ 5 * x1 + 6 * x2 sbv-7.13/Documentation/SBV/Examples/Optimization/Production.hs0000644000000000000000000000464413405536617022637 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Optimization.Production -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Solves a simple linear optimization problem ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Optimization.Production where import Data.SBV -- | Taken from -- -- A company makes two products (X and Y) using two machines (A and B). -- -- - Each unit of X that is produced requires 50 minutes processing time on machine -- A and 30 minutes processing time on machine B. -- -- - Each unit of Y that is produced requires 24 minutes processing time on machine -- A and 33 minutes processing time on machine B. -- -- - At the start of the current week there are 30 units of X and 90 units of Y in stock. -- Available processing time on machine A is forecast to be 40 hours and on machine B is -- forecast to be 35 hours. -- -- - The demand for X in the current week is forecast to be 75 units and for Y is forecast -- to be 95 units. -- -- - Company policy is to maximise the combined sum of the units of X and the units of Y -- in stock at the end of the week. -- -- How much of each product should we make in the current week? -- -- We have: -- -- >>> optimize Lexicographic production -- Optimal model: -- X = 45 :: Integer -- Y = 6 :: Integer -- stock = 1 :: Integer -- -- That is, we should produce 45 X's and 6 Y's, with the final maximum stock of just 1 expected! production :: Goal production = do x <- sInteger "X" -- Units of X produced y <- sInteger "Y" -- Units of X produced -- Amount of time on machine A and B let timeA = 50 * x + 24 * y timeB = 30 * x + 33 * y constrain $ timeA .<= 40 * 60 constrain $ timeB .<= 35 * 60 -- Amount of product we'll end up with let finalX = x + 30 finalY = y + 90 -- Make sure the demands are met: constrain $ finalX .>= 75 constrain $ finalY .>= 95 -- Policy: Maximize the final stock maximize "stock" $ (finalX - 75) + (finalY - 95) sbv-7.13/Documentation/SBV/Examples/Optimization/VM.hs0000644000000000000000000000536413405536617021033 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Optimization.VM -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Solves a VM allocation problem using optimization features ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Optimization.VM where import Data.SBV -- | The allocation problem. Inspired by: -- -- - We have three virtual machines (VMs) which require 100, 50 and 15 GB hard disk respectively. -- -- - There are three servers with capabilities 100, 75 and 200 GB in that order. -- -- - Find out a way to place VMs into servers in order to -- -- - Minimize the number of servers used -- -- - Minimize the operation cost (the servers have fixed daily costs 10, 5 and 20 USD respectively.) -- -- We have: -- -- >>> optimize Lexicographic allocate -- Optimal model: -- x11 = False :: Bool -- x12 = False :: Bool -- x13 = True :: Bool -- x21 = False :: Bool -- x22 = False :: Bool -- x23 = True :: Bool -- x31 = False :: Bool -- x32 = False :: Bool -- x33 = True :: Bool -- noOfServers = 1 :: Integer -- cost = 20 :: Integer -- -- That is, we should put all the jobs on the third server, for a total cost of 20. allocate :: Goal allocate = do -- xij means VM i is running on server j x1@[x11, x12, x13] <- sBools ["x11", "x12", "x13"] x2@[x21, x22, x23] <- sBools ["x21", "x22", "x23"] x3@[x31, x32, x33] <- sBools ["x31", "x32", "x33"] -- Each job runs on exactly one server constrain $ pbStronglyMutexed x1 constrain $ pbStronglyMutexed x2 constrain $ pbStronglyMutexed x3 let need :: [SBool] -> SInteger need rs = sum $ zipWith (\r c -> ite r c 0) rs [100, 50, 15] -- The capacity on each server is respected let capacity1 = need [x11, x21, x31] capacity2 = need [x12, x22, x32] capacity3 = need [x13, x23, x33] constrain $ capacity1 .<= 100 constrain $ capacity2 .<= 75 constrain $ capacity3 .<= 200 -- compute #of servers running: let y1 = bOr [x11, x21, x31] y2 = bOr [x12, x22, x32] y3 = bOr [x13, x23, x33] b2n b = ite b 1 0 let noOfServers = sum $ map b2n [y1, y2, y3] -- minimize # of servers minimize "noOfServers" (noOfServers :: SInteger) -- cost on each server let cost1 = ite y1 10 0 cost2 = ite y2 5 0 cost3 = ite y3 20 0 -- minimize the total cost minimize "cost" (cost1 + cost2 + cost3 :: SInteger) sbv-7.13/Documentation/SBV/Examples/Puzzles/0000755000000000000000000000000013405536617017133 5ustar0000000000000000sbv-7.13/Documentation/SBV/Examples/Puzzles/Birthday.hs0000644000000000000000000001355713405536617021250 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.Birthday -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- This is a formalization of the Cheryl's birthday problem, which went viral in April 2015. -- (See .) -- -- Here's the puzzle: -- -- @ -- Albert and Bernard just met Cheryl. “When’s your birthday?” Albert asked Cheryl. -- -- Cheryl thought a second and said, “I’m not going to tell you, but I’ll give you some clues.” She wrote down a list of 10 dates: -- -- May 15, May 16, May 19 -- June 17, June 18 -- July 14, July 16 -- August 14, August 15, August 17 -- -- “My birthday is one of these,” she said. -- -- Then Cheryl whispered in Albert’s ear the month — and only the month — of her birthday. To Bernard, she whispered the day, and only the day. -- “Can you figure it out now?” she asked Albert. -- -- Albert: I don’t know when your birthday is, but I know Bernard doesn’t know, either. -- Bernard: I didn’t know originally, but now I do. -- Albert: Well, now I know, too! -- -- When is Cheryl’s birthday? -- @ -- -- NB. Thanks to Amit Goel for suggesting the formalization strategy used in here. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Puzzles.Birthday where import Data.SBV ----------------------------------------------------------------------------------------------- -- * Types and values ----------------------------------------------------------------------------------------------- -- | Represent month by 8-bit words; We can also use an uninterpreted type, but numbers work well here. type Month = SWord8 -- | Represent day by 8-bit words; Again, an uninterpreted type would work as well. type Day = SWord8 -- | Months referenced in the problem. may, june, july, august :: SWord8 [may, june, july, august] = [5, 6, 7, 8] ----------------------------------------------------------------------------------------------- -- * Helper predicates ----------------------------------------------------------------------------------------------- -- | Check that a given month/day combo is a possible birth-date. valid :: Month -> Day -> SBool valid month day = (month, day) `sElem` candidates where candidates :: [(Month, Day)] candidates = [ ( may, 15), ( may, 16), ( may, 19) , ( june, 17), ( june, 18) , ( july, 14), ( july, 16) , (august, 14), (august, 15), (august, 17) ] -- | Assert that the given function holds for one of the possible days. existsDay :: (Day -> SBool) -> SBool existsDay f = bAny (f . literal) [14 .. 19] -- | Assert that the given function holds for all of the possible days. forallDay :: (Day -> SBool) -> SBool forallDay f = bAll (f . literal) [14 .. 19] -- | Assert that the given function holds for one of the possible months. existsMonth :: (Month -> SBool) -> SBool existsMonth f = bAny f [may .. august] -- | Assert that the given function holds for all of the possible months. forallMonth :: (Month -> SBool) -> SBool forallMonth f = bAll f [may .. august] ----------------------------------------------------------------------------------------------- -- * The puzzle ----------------------------------------------------------------------------------------------- -- | Encode the conversation as given in the puzzle. -- -- NB. Lee Pike pointed out that not all the constraints are actually necessary! (Private -- communication.) The puzzle still has a unique solution if the statements @a1@ and @b1@ -- (i.e., Albert and Bernard saying they themselves do not know the answer) are removed. -- To experiment you can simply comment out those statements and observe that there still -- is a unique solution. Thanks to Lee for pointing this out! In fact, it is instructive to -- assert the conversation line-by-line, and see how the search-space gets reduced in each -- step. puzzle :: Predicate puzzle = do birthDay <- exists "birthDay" birthMonth <- exists "birthMonth" -- Albert: I do not know let a1 m = existsDay $ \d1 -> existsDay $ \d2 -> d1 ./= d2 &&& valid m d1 &&& valid m d2 -- Albert: I know that Bernard doesn't know let a2 m = forallDay $ \d -> valid m d ==> existsMonth (\m1 -> existsMonth $ \m2 -> m1 ./= m2 &&& valid m1 d &&& valid m2 d) -- Bernard: I did not know let b1 d = existsMonth $ \m1 -> existsMonth $ \m2 -> m1 ./= m2 &&& valid m1 d &&& valid m2 d -- Bernard: But now I know let b2p m d = valid m d &&& a1 m &&& a2 m b2 d = forallMonth $ \m1 -> forallMonth $ \m2 -> (b2p m1 d &&& b2p m2 d) ==> m1 .== m2 -- Albert: Now I know too let a3p m d = valid m d &&& a1 m &&& a2 m &&& b1 d &&& b2 d a3 m = forallDay $ \d1 -> forallDay $ \d2 -> (a3p m d1 &&& a3p m d2) ==> d1 .== d2 -- Assert all the statements made: constrain $ a1 birthMonth constrain $ a2 birthMonth constrain $ b1 birthDay constrain $ b2 birthDay constrain $ a3 birthMonth -- Find a valid birth-day that satisfies the above constraints: return $ valid birthMonth birthDay -- | Find all solutions to the birthday problem. We have: -- -- >>> cheryl -- Solution #1: -- birthDay = 16 :: Word8 -- birthMonth = 7 :: Word8 -- This is the only solution. cheryl :: IO () cheryl = print =<< allSat puzzle sbv-7.13/Documentation/SBV/Examples/Puzzles/Coins.hs0000644000000000000000000000764713405536617020560 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.Coins -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Solves the following puzzle: -- -- @ -- You and a friend pass by a standard coin operated vending machine and you decide to get a candy bar. -- The price is US $0.95, but after checking your pockets you only have a dollar (US $1) and the machine -- only takes coins. You turn to your friend and have this conversation: -- you: Hey, do you have change for a dollar? -- friend: Let's see. I have 6 US coins but, although they add up to a US $1.15, I can't break a dollar. -- you: Huh? Can you make change for half a dollar? -- friend: No. -- you: How about a quarter? -- friend: Nope, and before you ask I cant make change for a dime or nickel either. -- you: Really? and these six coins are all US government coins currently in production? -- friend: Yes. -- you: Well can you just put your coins into the vending machine and buy me a candy bar, and I'll pay you back? -- friend: Sorry, I would like to but I cant with the coins I have. -- What coins are your friend holding? -- @ -- -- To be fair, the problem has no solution /mathematically/. But there is a solution when one takes into account that -- vending machines typically do not take the 50 cent coins! -- ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Puzzles.Coins where import Data.SBV -- | We will represent coins with 16-bit words (more than enough precision for coins). type Coin = SWord16 -- | Create a coin. The argument Int argument just used for naming the coin. Note that -- we constrain the value to be one of the valid U.S. coin values as we create it. mkCoin :: Int -> Symbolic Coin mkCoin i = do c <- exists $ 'c' : show i constrain $ bAny (.== c) [1, 5, 10, 25, 50, 100] return c -- | Return all combinations of a sequence of values. combinations :: [a] -> [[a]] combinations coins = concat [combs i coins | i <- [1 .. length coins]] where combs 0 _ = [[]] combs _ [] = [] combs k (x:xs) = map (x:) (combs (k-1) xs) ++ combs k xs -- | Constraint 1: Cannot make change for a dollar. c1 :: [Coin] -> SBool c1 xs = sum xs ./= 100 -- | Constraint 2: Cannot make change for half a dollar. c2 :: [Coin] -> SBool c2 xs = sum xs ./= 50 -- | Constraint 3: Cannot make change for a quarter. c3 :: [Coin] -> SBool c3 xs = sum xs ./= 25 -- | Constraint 4: Cannot make change for a dime. c4 :: [Coin] -> SBool c4 xs = sum xs ./= 10 -- | Constraint 5: Cannot make change for a nickel c5 :: [Coin] -> SBool c5 xs = sum xs ./= 5 -- | Constraint 6: Cannot buy the candy either. Here's where we need to have the extra knowledge -- that the vending machines do not take 50 cent coins. c6 :: [Coin] -> SBool c6 xs = sum (map val xs) ./= 95 where val x = ite (x .== 50) 0 x -- | Solve the puzzle. We have: -- -- >>> puzzle -- Satisfiable. Model: -- c1 = 50 :: Word16 -- c2 = 25 :: Word16 -- c3 = 10 :: Word16 -- c4 = 10 :: Word16 -- c5 = 10 :: Word16 -- c6 = 10 :: Word16 -- -- i.e., your friend has 4 dimes, a quarter, and a half dollar. puzzle :: IO SatResult puzzle = sat $ do cs <- mapM mkCoin [1..6] -- Assert each of the constraints for all combinations that has -- at least two coins (to make change) mapM_ constrain [c s | s <- combinations cs, length s >= 2, c <- [c1, c2, c3, c4, c5, c6]] -- the following constraint is not necessary for solving the puzzle -- however, it makes sure that the solution comes in decreasing value of coins, -- thus allowing the above test to succeed regardless of the solver used. constrain $ bAnd $ zipWith (.>=) cs (tail cs) -- assert that the sum must be 115 cents. return $ sum cs .== 115 sbv-7.13/Documentation/SBV/Examples/Puzzles/Counts.hs0000644000000000000000000000670513405536617020752 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.Counts -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Consider the sentence: -- -- @ -- In this sentence, the number of occurrences of 0 is _, of 1 is _, of 2 is _, -- of 3 is _, of 4 is _, of 5 is _, of 6 is _, of 7 is _, of 8 is _, and of 9 is _. -- @ -- -- The puzzle is to fill the blanks with numbers, such that the sentence -- will be correct. There are precisely two solutions to this puzzle, both of -- which are found by SBV successfully. -- -- References: -- -- * Douglas Hofstadter, Metamagical Themes, pg. 27. -- -- * -- ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Puzzles.Counts where import Data.SBV -- | We will assume each number can be represented by an 8-bit word, i.e., can be at most 128. type Count = SWord8 -- | Given a number, increment the count array depending on the digits of the number count :: Count -> [Count] -> [Count] count n cnts = ite (n .< 10) (upd n cnts) -- only one digit (ite (n .< 100) (upd d1 (upd d2 cnts)) -- two digits (upd d1 (upd d2 (upd d3 cnts)))) -- three digits where (r1, d1) = n `sQuotRem` 10 (d3, d2) = r1 `sQuotRem` 10 upd d = zipWith inc [0..] where inc i c = ite (i .== d) (c+1) c -- | Encoding of the puzzle. The solution is a sequence of 10 numbers -- for the occurrences of the digits such that if we count each digit, -- we find these numbers. puzzle :: [Count] -> SBool puzzle cnt = cnt .== last css where ones = replicate 10 1 -- all digits occur once to start with css = ones : zipWith count cnt css -- | Finds all two known solutions to this puzzle. We have: -- -- >>> counts -- Solution #1 -- In this sentence, the number of occurrences of 0 is 1, of 1 is 7, of 2 is 3, of 3 is 2, of 4 is 1, of 5 is 1, of 6 is 1, of 7 is 2, of 8 is 1, of 9 is 1. -- Solution #2 -- In this sentence, the number of occurrences of 0 is 1, of 1 is 11, of 2 is 2, of 3 is 1, of 4 is 1, of 5 is 1, of 6 is 1, of 7 is 1, of 8 is 1, of 9 is 1. -- Found: 2 solution(s). counts :: IO () counts = do res <- allSat $ puzzle `fmap` mkExistVars 10 cnt <- displayModels disp res putStrLn $ "Found: " ++ show cnt ++ " solution(s)." where disp n (_, s) = do putStrLn $ "Solution #" ++ show n dispSolution s dispSolution :: [Word8] -> IO () dispSolution ns = putStrLn soln where soln = "In this sentence, the number of occurrences" ++ " of 0 is " ++ show (ns !! 0) ++ ", of 1 is " ++ show (ns !! 1) ++ ", of 2 is " ++ show (ns !! 2) ++ ", of 3 is " ++ show (ns !! 3) ++ ", of 4 is " ++ show (ns !! 4) ++ ", of 5 is " ++ show (ns !! 5) ++ ", of 6 is " ++ show (ns !! 6) ++ ", of 7 is " ++ show (ns !! 7) ++ ", of 8 is " ++ show (ns !! 8) ++ ", of 9 is " ++ show (ns !! 9) ++ "." {-# ANN counts ("HLint: ignore Use head" :: String) #-} sbv-7.13/Documentation/SBV/Examples/Puzzles/DogCatMouse.hs0000644000000000000000000000273713405536617021652 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.DogCatMouse -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Puzzle: -- Spend exactly 100 dollars and buy exactly 100 animals. -- Dogs cost 15 dollars, cats cost 1 dollar, and mice cost 25 cents each. -- You have to buy at least one of each. -- How many of each should you buy? ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Puzzles.DogCatMouse where import Data.SBV -- | Prints the only solution: -- -- >>> puzzle -- Solution #1: -- dog = 3 :: Integer -- cat = 41 :: Integer -- mouse = 56 :: Integer -- This is the only solution. puzzle :: IO AllSatResult puzzle = allSat $ do [dog, cat, mouse] <- sIntegers ["dog", "cat", "mouse"] solve [ dog .>= 1 -- at least one dog , cat .>= 1 -- at least one cat , mouse .>= 1 -- at least one mouse , dog + cat + mouse .== 100 -- buy precisely 100 animals , 15 `per` dog + 1 `per` cat + 0.25 `per` mouse .== 100 -- spend exactly 100 dollars ] where p `per` q = p * (sFromIntegral q :: SReal) sbv-7.13/Documentation/SBV/Examples/Puzzles/Euler185.hs0000644000000000000000000000440413405536617021003 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.Euler185 -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- A solution to Project Euler problem #185: ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Puzzles.Euler185 where import Data.Char (ord) import Data.SBV -- | The given guesses and the correct digit counts, encoded as a simple list. guesses :: [(String, SWord8)] guesses = [ ("5616185650518293", 2), ("3847439647293047", 1), ("5855462940810587", 3) , ("9742855507068353", 3), ("4296849643607543", 3), ("3174248439465858", 1) , ("4513559094146117", 2), ("7890971548908067", 3), ("8157356344118483", 1) , ("2615250744386899", 2), ("8690095851526254", 3), ("6375711915077050", 1) , ("6913859173121360", 1), ("6442889055042768", 2), ("2321386104303845", 0) , ("2326509471271448", 2), ("5251583379644322", 2), ("1748270476758276", 3) , ("4895722652190306", 1), ("3041631117224635", 3), ("1841236454324589", 3) , ("2659862637316867", 2) ] -- | Encode the problem, note that we check digits are within 0-9 as -- we use 8-bit words to represent them. Otherwise, the constraints are simply -- generated by zipping the alleged solution with each guess, and making sure the -- number of matching digits match what's given in the problem statement. euler185 :: Symbolic SBool euler185 = do soln <- mkExistVars 16 return $ bAll digit soln &&& bAnd (map (genConstr soln) guesses) where genConstr a (b, c) = sum (zipWith eq a b) .== (c :: SWord8) digit x = (x :: SWord8) .>= 0 &&& x .<= 9 eq x y = ite (x .== fromIntegral (ord y - ord '0')) 1 0 -- | Print out the solution nicely. We have: -- -- >>> solveEuler185 -- 4640261571849533 -- Number of solutions: 1 solveEuler185 :: IO () solveEuler185 = do res <- allSat euler185 cnt <- displayModels disp res putStrLn $ "Number of solutions: " ++ show cnt where disp _ (_, ss) = putStrLn $ concatMap show (ss :: [Word8]) sbv-7.13/Documentation/SBV/Examples/Puzzles/Fish.hs0000644000000000000000000001105613405536617020363 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.Fish -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Solves the following logic puzzle: -- -- - The Briton lives in the red house. -- - The Swede keeps dogs as pets. -- - The Dane drinks tea. -- - The green house is left to the white house. -- - The owner of the green house drinks coffee. -- - The person who plays football rears birds. -- - The owner of the yellow house plays baseball. -- - The man living in the center house drinks milk. -- - The Norwegian lives in the first house. -- - The man who plays volleyball lives next to the one who keeps cats. -- - The man who keeps the horse lives next to the one who plays baseball. -- - The owner who plays tennis drinks beer. -- - The German plays hockey. -- - The Norwegian lives next to the blue house. -- - The man who plays volleyball has a neighbor who drinks water. -- -- Who owns the fish? ------------------------------------------------------------------------------ {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE ScopedTypeVariables #-} module Documentation.SBV.Examples.Puzzles.Fish where import Data.SBV -- | Colors of houses data Color = Red | Green | White | Yellow | Blue -- | Make 'Color' a symbolic value. mkSymbolicEnumeration ''Color -- | Nationalities of the occupants data Nationality = Briton | Dane | Swede | Norwegian | German -- | Make 'Nationality' a symbolic value. mkSymbolicEnumeration ''Nationality -- | Beverage choices data Beverage = Tea | Coffee | Milk | Beer | Water -- | Make 'Beverage' a symbolic value. mkSymbolicEnumeration ''Beverage -- | Pets they keep data Pet = Dog | Horse | Cat | Bird | Fish -- | Make 'Pet' a symbolic value. mkSymbolicEnumeration ''Pet -- | Sports they engage in data Sport = Football | Baseball | Volleyball | Hockey | Tennis -- | Make 'Sport' a symbolic value. mkSymbolicEnumeration ''Sport -- | We have: -- -- >>> fishOwner -- German -- -- It's not hard to modify this program to grab the values of all the assignments, i.e., the full -- solution to the puzzle. We leave that as an exercise to the interested reader! fishOwner :: IO () fishOwner = do vs <- getModelValues "fishOwner" `fmap` allSat puzzle case vs of [Just (v::Nationality)] -> print v [] -> error "no solution" _ -> error "no unique solution" where puzzle = do let c = uninterpret "color" n = uninterpret "nationality" b = uninterpret "beverage" p = uninterpret "pet" s = uninterpret "sport" let i `neighbor` j = i .== j+1 ||| j .== i+1 a `is` v = a .== literal v let fact0 = constrain fact1 f = do i <- free_ constrain $ 1 .<= i &&& i .<= (5 :: SInteger) constrain $ f i fact2 f = do i <- free_ j <- free_ constrain $ 1 .<= i &&& i .<= (5 :: SInteger) constrain $ 1 .<= j &&& j .<= 5 constrain $ i ./= j constrain $ f i j fact1 $ \i -> n i `is` Briton &&& c i `is` Red fact1 $ \i -> n i `is` Swede &&& p i `is` Dog fact1 $ \i -> n i `is` Dane &&& b i `is` Tea fact2 $ \i j -> c i `is` Green &&& c j `is` White &&& i .== j-1 fact1 $ \i -> c i `is` Green &&& b i `is` Coffee fact1 $ \i -> s i `is` Football &&& p i `is` Bird fact1 $ \i -> c i `is` Yellow &&& s i `is` Baseball fact0 $ b 3 `is` Milk fact0 $ n 1 `is` Norwegian fact2 $ \i j -> s i `is` Volleyball &&& p j `is` Cat &&& i `neighbor` j fact2 $ \i j -> p i `is` Horse &&& s j `is` Baseball &&& i `neighbor` j fact1 $ \i -> s i `is` Tennis &&& b i `is` Beer fact1 $ \i -> n i `is` German &&& s i `is` Hockey fact2 $ \i j -> n i `is` Norwegian &&& c j `is` Blue &&& i `neighbor` j fact2 $ \i j -> s i `is` Volleyball &&& b j `is` Water &&& i `neighbor` j ownsFish <- free "fishOwner" fact1 $ \i -> n i .== ownsFish &&& p i `is` Fish sbv-7.13/Documentation/SBV/Examples/Puzzles/Garden.hs0000644000000000000000000001025613405536617020673 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.Garden -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- The origin of this puzzle is Raymond Smullyan's "The Flower Garden" riddle: -- -- In a certain flower garden, each flower was either red, yellow, -- or blue, and all three colors were represented. A statistician -- once visited the garden and made the observation that whatever -- three flowers you picked, at least one of them was bound to be red. -- A second statistician visited the garden and made the observation -- that whatever three flowers you picked, at least one was bound to -- be yellow. -- -- Two logic students heard about this and got into an argument. -- The first student said: “It therefore follows that whatever -- three flowers you pick, at least one is bound to be blue, doesn’t -- it?” The second student said: “Of course not!” -- -- Which student was right, and why? -- -- We slightly modify the puzzle. Assuming the first student is right, we use -- SBV to show that the garden must contain exactly 3 flowers. In any other -- case, the second student would be right. ------------------------------------------------------------------------------ {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveAnyClass #-} module Documentation.SBV.Examples.Puzzles.Garden where import Data.SBV import Data.List(isSuffixOf) -- | Colors of the flowers data Color = Red | Yellow | Blue -- | Make 'Color' a symbolic value. mkSymbolicEnumeration ''Color -- | Represent flowers by symbolic integers type Flower = SInteger -- | The uninterpreted function 'col' assigns a color to each flower. col :: Flower -> SBV Color col = uninterpret "col" -- | Describe a valid pick of three flowers @i@, @j@, @k@, assuming -- we have @n@ flowers to start with. Essentially the numbers should -- be within bounds and distinct. validPick :: SInteger -> Flower -> Flower -> Flower -> SBool validPick n i j k = distinct [i, j, k] &&& bAll ok [i, j, k] where ok x = inRange x (1, n) -- | Count the number of flowers that occur in a given set of flowers. count :: Color -> [Flower] -> SInteger count c fs = sum [ite (col f .== literal c) 1 0 | f <- fs] -- | Smullyan's puzzle. puzzle :: Goal puzzle = do n <- sInteger "N" let valid = validPick n -- Declare three existential flowers. We name these with -- the suffix "_modelIgnore" as we don't consider variations -- on them to be interesting for model construction purposes. -- We'll use the 'isNonModelVar' parameter to ignore them -- for that purpose. ef1 <- exists "ef1_modelIgnore" ef2 <- exists "ef2_modelIgnore" ef3 <- exists "ef3_modelIgnore" -- Declare three universal flowers to aid in encoding the -- statements made by students. af1 <- forall "af1" af2 <- forall "af2" af3 <- forall "af3" -- Each color is represented: constrain $ valid ef1 ef2 ef3 constrain $ map col [ef1, ef2, ef3] .== map literal [Red, Yellow, Blue] -- Pick any three, at least one is Red constrain $ valid af1 af2 af3 ==> count Red [af1, af2, af3] .>= 1 -- Pick any three, at least one is Yellow constrain $ valid af1 af2 af3 ==> count Yellow [af1, af2, af3] .>= 1 -- Pick any three, at least one is Blue constrain $ valid af1 af2 af3 ==> count Blue [af1, af2, af3] .>= 1 -- | Solve the puzzle. We have: -- -- >>> flowerCount -- Solution #1: -- N = 3 :: Integer -- This is the only solution. (Unique up to prefix existentials.) -- -- So, a garden with 3 flowers is the only solution. (Note that we simply skip -- over the prefix existentials for model purposes here, as they don't represent -- a different solution.) flowerCount :: IO () flowerCount = print =<< allSatWith z3{isNonModelVar = ("_modelIgnore" `isSuffixOf`)} puzzle sbv-7.13/Documentation/SBV/Examples/Puzzles/HexPuzzle.hs0000644000000000000000000001432713405536617021434 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.HexPuzzle -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- A solution to the hexagon solver puzzle: -- In case the above URL goes dead, here's an ASCII rendering of the problem. -- -- We're given a board, with 19 hexagon cells. The cells are arranged as follows: -- -- @ -- 01 02 03 -- 04 05 06 07 -- 08 09 10 11 12 -- 13 14 15 16 -- 17 18 19 -- @ -- -- - Each cell has a color, one of @BLACK@, @BLUE@, @GREEN@, or @RED@. -- -- - At each step, you get to press one of the center buttons. That is, -- one of 5, 6, 9, 10, 11, 14, or 15. -- -- - Pressing a button that is currently colored @BLACK@ has no effect. -- -- - Otherwise (i.e., if the pressed button is not @BLACK@), then colors -- rotate clockwise around that button. For instance if you press 15 -- when it is not colored @BLACK@, then 11 moves to 16, 16 moves to 19, -- 19 moves to 18, 18 moves to 14, 14 moves to 10, and 10 moves to 11. -- -- - Note that by "move," we mean the colors move: We still refer to the buttons -- with the same number after a move. -- -- You are given an initial board coloring, and a final one. Your goal is -- to find a minimal sequence of button presses that will turn the original board -- to the final one. ----------------------------------------------------------------------------- {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE ScopedTypeVariables #-} module Documentation.SBV.Examples.Puzzles.HexPuzzle where import Data.SBV import Data.SBV.Control -- | Colors we're allowed data Color = Black | Blue | Green | Red -- | Make 'Color' a symbolic value. mkSymbolicEnumeration ''Color -- | Give symbolic colors a name for convenience. type SColor = SBV Color -- | Use 8-bit words for button numbers, even though we only have 1 to 19. type Button = Word8 -- | Symbolic version of button. type SButton = SBV Button -- | The grid is an array mapping each button to its color. type Grid = SFunArray Button Color -- | Given a button press, and the current grid, compute the next grid. -- If the button is "unpressable", i.e., if it is not one of the center -- buttons or it is currently colored black, we return the grid unchanged. next :: SButton -> Grid -> Grid next b g = ite (readArray g b .== literal Black) g $ ite (b .== 5) (rot [ 1, 2, 6, 10, 9, 4]) $ ite (b .== 6) (rot [ 2, 3, 7, 11, 10, 5]) $ ite (b .== 9) (rot [ 4, 5, 10, 14, 13, 8]) $ ite (b .== 10) (rot [ 5, 6, 11, 15, 14, 9]) $ ite (b .== 11) (rot [ 6, 7, 12, 16, 15, 10]) $ ite (b .== 14) (rot [ 9, 10, 15, 18, 17, 13]) $ ite (b .== 15) (rot [10, 11, 16, 19, 18, 14]) g where rot xs = foldr (\(i, c) a -> writeArray a (literal i) c) g (zip new cur) where cur = map (readArray g . literal) xs new = tail xs ++ [head xs] -- | Iteratively search at increasing depths of button-presses to see if we can -- transform from the initial board position to a final board position. search :: [Color] -> [Color] -> IO () search initial final = runSMT $ do emptyGrid :: Grid <- newArray "emptyGrid" (Just (literal Black)) let initGrid = foldr (\(i, c) a -> writeArray a (literal i) (literal c)) emptyGrid (zip [1..] initial) query $ loop (0 :: Int) initGrid [] where loop i g sofar = do io $ putStrLn $ "Searching at depth: " ++ show i -- Go into a new context, and see if we've reached a solution: push 1 constrain $ map (readArray g . literal) [1..19] .== map literal final cs <- checkSat case cs of Unk -> error $ "Solver said Unknown, depth: " ++ show i Unsat -> do -- It didn't work out. Pop and try again with one more move: pop 1 b <- freshVar ("press_" ++ show i) constrain $ b `sElem` map literal [5, 6, 9, 10, 11, 14, 15] loop (i+1) (next b g) (sofar ++ [b]) Sat -> do vs <- mapM getValue sofar io $ putStrLn $ "Found: " ++ show vs findOthers sofar vs findOthers vs = go where go curVals = do constrain $ bOr $ zipWith (\v c -> v ./= literal c) vs curVals cs <- checkSat case cs of Unk -> error "Unknown!" Unsat -> io $ putStrLn $ "There are no more solutions." Sat -> do newVals <- mapM getValue vs io $ putStrLn $ "Found: " ++ show newVals go newVals -- | A particular example run. We have: -- -- >>> example -- Searching at depth: 0 -- Searching at depth: 1 -- Searching at depth: 2 -- Searching at depth: 3 -- Searching at depth: 4 -- Searching at depth: 5 -- Searching at depth: 6 -- Found: [10,10,11,9,14,6] -- Found: [10,10,9,11,14,6] -- There are no more solutions. example :: IO () example = search initBoard finalBoard where initBoard = [Black, Black, Black, Red, Blue, Green, Red, Black, Green, Green, Green, Black, Red, Green, Green, Red, Black, Black, Black] finalBoard = [Black, Red, Black, Black, Green, Green, Black, Red, Green, Blue, Green, Red, Black, Green, Green, Black, Black, Red, Black] sbv-7.13/Documentation/SBV/Examples/Puzzles/LadyAndTigers.hs0000644000000000000000000000405613405536617022166 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.LadyAndTigers -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Puzzle: -- -- You are standing in front of three rooms and must choose one. In one room is a Lady -- (whom you could and wish to marry), in the other two rooms are tigers (that if you -- choose either of these rooms, the tiger invites you to breakfast – the problem is -- that you are the main course). Your job is to choose the room with the Lady. -- The signs on the doors are: -- -- * A Tiger is in this room -- * A Lady is in this room -- * A Tiger is in room two -- -- At most only 1 statement is true. Where’s the Lady? ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Puzzles.LadyAndTigers where import Data.SBV -- | Prints the only solution: -- -- >>> ladyAndTigers -- Solution #1: -- sign1 = False :: Bool -- sign2 = False :: Bool -- sign3 = True :: Bool -- tiger1 = False :: Bool -- tiger2 = True :: Bool -- tiger3 = True :: Bool -- This is the only solution. -- -- That is, the lady is in room 1, and only the third room's sign is true. ladyAndTigers :: IO AllSatResult ladyAndTigers = allSat $ do -- One boolean for each of the correctness of the signs [sign1, sign2, sign3] <- mapM sBool ["sign1", "sign2", "sign3"] -- One boolean for each of the presence of the tigers [tiger1, tiger2, tiger3] <- mapM sBool ["tiger1", "tiger2", "tiger3"] -- Room 1 sign: A Tiger is in this room constrain $ sign1 <=> tiger1 -- Room 2 sign: A Lady is in this room constrain $ sign2 <=> bnot tiger2 -- Room 3 sign: A Tiger is in room 2 constrain $ sign3 <=> tiger2 -- At most one sign is true constrain $ [sign1, sign2, sign3] `pbAtMost` 1 -- There are precisely two tigers constrain $ [tiger1, tiger2, tiger3] `pbExactly` 2 sbv-7.13/Documentation/SBV/Examples/Puzzles/MagicSquare.hs0000644000000000000000000000543413405536617021676 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.MagicSquare -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Solves the magic-square puzzle. An NxN magic square is one where all entries -- are filled with numbers from 1 to NxN such that sums of all rows, columns -- and diagonals is the same. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Puzzles.MagicSquare where import Data.List (genericLength, transpose) import Data.SBV -- | Use 32-bit words for elements. type Elem = SWord32 -- | A row is a list of elements type Row = [Elem] -- | The puzzle board is a list of rows type Board = [Row] -- | Checks that all elements in a list are within bounds check :: Elem -> Elem -> [Elem] -> SBool check low high = bAll $ \x -> x .>= low &&& x .<= high -- | Get the diagonal of a square matrix diag :: [[a]] -> [a] diag ((a:_):rs) = a : diag (map tail rs) diag _ = [] -- | Test if a given board is a magic square isMagic :: Board -> SBool isMagic rows = bAnd $ fromBool isSquare : allEqual (map sum items) : distinct (concat rows) : map chk items where items = d1 : d2 : rows ++ columns n = genericLength rows isSquare = all (\r -> genericLength r == n) rows columns = transpose rows d1 = diag rows d2 = diag (map reverse rows) chk = check (literal 1) (literal (n*n)) -- | Group a list of elements in the sublists of length @i@ chunk :: Int -> [a] -> [[a]] chunk _ [] = [] chunk i xs = let (f, r) = splitAt i xs in f : chunk i r -- | Given @n@, magic @n@ prints all solutions to the @nxn@ magic square problem magic :: Int -> IO () magic n | n < 0 = putStrLn $ "n must be non-negative, received: " ++ show n | True = do putStrLn $ "Finding all " ++ show n ++ "-magic squares.." res <- allSat $ (isMagic . chunk n) `fmap` mkExistVars n2 cnt <- displayModels disp res putStrLn $ "Found: " ++ show cnt ++ " solution(s)." where n2 = n * n disp i (_, model) | lmod /= n2 = error $ "Impossible! Backend solver returned " ++ show n ++ " values, was expecting: " ++ show lmod | True = do putStrLn $ "Solution #" ++ show i mapM_ printRow board putStrLn $ "Valid Check: " ++ show (isMagic sboard) putStrLn "Done." where lmod = length model board = chunk n model sboard = map (map literal) board sh2 z = let s = show z in if length s < 2 then ' ':s else s printRow r = putStr " " >> mapM_ (\x -> putStr (sh2 x ++ " ")) r >> putStrLn "" sbv-7.13/Documentation/SBV/Examples/Puzzles/NQueens.hs0000644000000000000000000000377613405536617021062 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.NQueens -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Solves the NQueens puzzle: ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Puzzles.NQueens where import Data.SBV -- | A solution is a sequence of row-numbers where queens should be placed type Solution = [SWord8] -- | Checks that a given solution of @n@-queens is valid, i.e., no queen -- captures any other. isValid :: Int -> Solution -> SBool isValid n s = bAll rangeFine s &&& distinct s &&& bAll checkDiag ijs where rangeFine x = x .>= 1 &&& x .<= fromIntegral n ijs = [(i, j) | i <- [1..n], j <- [i+1..n]] checkDiag (i, j) = diffR ./= diffC where qi = s !! (i-1) qj = s !! (j-1) diffR = ite (qi .>= qj) (qi-qj) (qj-qi) diffC = fromIntegral (j-i) -- | Given @n@, it solves the @n-queens@ puzzle, printing all possible solutions. nQueens :: Int -> IO () nQueens n | n < 0 = putStrLn $ "n must be non-negative, received: " ++ show n | True = do putStrLn $ "Finding all " ++ show n ++ "-queens solutions.." res <- allSat $ isValid n `fmap` mkExistVars n cnt <- displayModels disp res putStrLn $ "Found: " ++ show cnt ++ " solution(s)." where disp i (_, s) = do putStr $ "Solution #" ++ show i ++ ": " dispSolution s dispSolution :: [Word8] -> IO () dispSolution model | lmod /= n = error $ "Impossible! Backend solver returned " ++ show lmod ++ " values, was expecting: " ++ show n | True = do putStr $ show model putStrLn $ " (Valid: " ++ show (isValid n (map literal model)) ++ ")" where lmod = length model sbv-7.13/Documentation/SBV/Examples/Puzzles/SendMoreMoney.hs0000644000000000000000000000250313405536617022213 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.SendMoreMoney -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Solves the classic @send + more = money@ puzzle. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Puzzles.SendMoreMoney where import Data.SBV -- | Solve the puzzle. We have: -- -- >>> sendMoreMoney -- Solution #1: -- s = 9 :: Integer -- e = 5 :: Integer -- n = 6 :: Integer -- d = 7 :: Integer -- m = 1 :: Integer -- o = 0 :: Integer -- r = 8 :: Integer -- y = 2 :: Integer -- This is the only solution. -- -- That is: -- -- >>> 9567 + 1085 == 10652 -- True sendMoreMoney :: IO AllSatResult sendMoreMoney = allSat $ do ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"] let isDigit x = x .>= 0 &&& x .<= 9 val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1) send = val [s,e,n,d] more = val [m,o,r,e] money = val [m,o,n,e,y] constrain $ bAll isDigit ds constrain $ distinct ds constrain $ s ./= 0 &&& m ./= 0 solve [send + more .== money] sbv-7.13/Documentation/SBV/Examples/Puzzles/Sudoku.hs0000644000000000000000000002576113405536617020754 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.Sudoku -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- The Sudoku solver, quintessential SMT solver example! ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Puzzles.Sudoku where import Data.List (transpose) import Data.Maybe (fromJust) import Data.SBV ------------------------------------------------------------------- -- * Modeling Sudoku ------------------------------------------------------------------- -- | A row is a sequence of 8-bit words, too large indeed for representing 1-9, but does not harm type Row = [SWord8] -- | A Sudoku board is a sequence of 9 rows type Board = [Row] -- | Given a series of elements, make sure they are all different -- and they all are numbers between 1 and 9 check :: [SWord8] -> SBool check grp = bAnd $ distinct grp : map rangeFine grp where rangeFine x = x .> 0 &&& x .<= 9 -- | Given a full Sudoku board, check that it is valid valid :: Board -> SBool valid rows = bAnd $ literal sizesOK : map check (rows ++ columns ++ squares) where sizesOK = length rows == 9 && all (\r -> length r == 9) rows columns = transpose rows regions = transpose [chunk 3 row | row <- rows] squares = [concat sq | sq <- chunk 3 (concat regions)] chunk :: Int -> [a] -> [[a]] chunk _ [] = [] chunk i xs = let (f, r) = splitAt i xs in f : chunk i r -- | A puzzle is a pair: First is the number of missing elements, second -- is a function that given that many elements returns the final board. type Puzzle = (Int, [SWord8] -> Board) ------------------------------------------------------------------- -- * Solving Sudoku puzzles ------------------------------------------------------------------- -- | Solve a given puzzle and print the results sudoku :: Puzzle -> IO () sudoku p@(i, f) = do putStrLn "Solving the puzzle.." model <- getModelAssignment `fmap` sat ((valid . f) `fmap` mkExistVars i) case model of Right sln -> dispSolution p sln Left m -> putStrLn $ "Unsolvable puzzle: " ++ m -- | Helper function to display results nicely, not really needed, but helps presentation dispSolution :: Puzzle -> (Bool, [Word8]) -> IO () dispSolution (i, f) (_, fs) | lmod /= i = error $ "Impossible! Backend solver returned " ++ show lmod ++ " values, was expecting: " ++ show i | True = do putStrLn "Final board:" mapM_ printRow final putStrLn $ "Valid Check: " ++ show (valid final) putStrLn "Done." where lmod = length fs final = f (map literal fs) printRow r = putStr " " >> mapM_ (\x -> putStr (show (fromJust (unliteral x)) ++ " ")) r >> putStrLn "" -- | Find all solutions to a puzzle solveAll :: Puzzle -> IO () solveAll p@(i, f) = do putStrLn "Finding all solutions.." res <- allSat $ (valid . f) `fmap` mkExistVars i cnt <- displayModels disp res putStrLn $ "Found: " ++ show cnt ++ " solution(s)." where disp n s = do putStrLn $ "Solution #" ++ show n dispSolution p s ------------------------------------------------------------------- -- * Example boards ------------------------------------------------------------------- -- | Find an arbitrary good board puzzle0 :: Puzzle puzzle0 = (81, f) where f [ a1, a2, a3, a4, a5, a6, a7, a8, a9, b1, b2, b3, b4, b5, b6, b7, b8, b9, c1, c2, c3, c4, c5, c6, c7, c8, c9, d1, d2, d3, d4, d5, d6, d7, d8, d9, e1, e2, e3, e4, e5, e6, e7, e8, e9, f1, f2, f3, f4, f5, f6, f7, f8, f9, g1, g2, g3, g4, g5, g6, g7, g8, g9, h1, h2, h3, h4, h5, h6, h7, h8, h9, i1, i2, i3, i4, i5, i6, i7, i8, i9 ] = [ [a1, a2, a3, a4, a5, a6, a7, a8, a9], [b1, b2, b3, b4, b5, b6, b7, b8, b9], [c1, c2, c3, c4, c5, c6, c7, c8, c9], [d1, d2, d3, d4, d5, d6, d7, d8, d9], [e1, e2, e3, e4, e5, e6, e7, e8, e9], [f1, f2, f3, f4, f5, f6, f7, f8, f9], [g1, g2, g3, g4, g5, g6, g7, g8, g9], [h1, h2, h3, h4, h5, h6, h7, h8, h9], [i1, i2, i3, i4, i5, i6, i7, i8, i9] ] f _ = error "puzzle0 needs exactly 81 elements!" -- | A random puzzle, found on the internet.. puzzle1 :: Puzzle puzzle1 = (49, f) where f [ a1, a3, a4, a5, a6, a7, a9, b1, b2, b3, b7, b8, b9, c2, c4, c5, c6, c8, d3, d5, d7, e1, e2, e4, e5, e6, e8, e9, f3, f5, f7, g2, g4, g5, g6, g8, h1, h2, h3, h7, h8, h9, i1, i3, i4, i5, i6, i7, i9 ] = [ [a1, 6, a3, a4, a5, a6, a7, 1, a9], [b1, b2, b3, 6, 5, 1, b7, b8, b9], [ 1, c2, 7, c4, c5, c6, 6, c8, 2], [ 6, 2, d3, 3, d5, 5, d7, 9, 4], [e1, e2, 3, e4, e5, e6, 2, e8, e9], [ 4, 8, f3, 9, f5, 7, f7, 3, 6], [ 9, g2, 6, g4, g5, g6, 4, g8, 8], [h1, h2, h3, 7, 9, 4, h7, h8, h9], [i1, 5, i3, i4, i5, i6, i7, 7, i9] ] f _ = error "puzzle1 needs exactly 49 elements!" -- | Another random puzzle, found on the internet.. puzzle2 :: Puzzle puzzle2 = (55, f) where f [ a2, a4, a5, a6, a7, a9, b1, b2, b4, b7, b8, b9, c1, c3, c4, c5, c6, c7, c8, c9, d2, d3, d4, d8, d9, e1, e3, e5, e7, e9, f1, f2, f6, f7, f8, g1, g2, g3, g4, g5, g6, g7, g9, h1, h2, h3, h6, h8, h9, i1, i3, i4, i5, i6, i8 ] = [ [ 1, a2, 3, a4, a5, a6, a7, 8, a9], [b1, b2, 6, b4, 4, 8, b7, b8, b9], [c1, 4, c3, c4, c5, c6, c7, c8, c9], [ 2, d2, d3, d4, 9, 6, 1, d8, d9], [e1, 9, e3, 8, e5, 1, e7, 4, e9], [f1, f2, 4, 3, 2, f6, f7, f8, 8], [g1, g2, g3, g4, g5, g6, g7, 7, g9], [h1, h2, h3, 1, 5, h6, 4, h8, h9], [i1, 6, i3, i4, i5, i6, 2, i8, 3] ] f _ = error "puzzle2 needs exactly 55 elements!" -- | Another random puzzle, found on the internet.. puzzle3 :: Puzzle puzzle3 = (56, f) where f [ a2, a3, a4, a6, a8, a9, b2, b4, b5, b6, b7, b8, b9, c1, c2, c3, c4, c6, c7, c9, d1, d3, d5, d7, d9, e2, e3, e4, e6, e7, e8, f1, f3, f5, f7, f9, g1, g3, g4, g6, g7, g8, g9, h1, h2, h3, h4, h5, h6, h8, i1, i2, i4, i6, i7, i8 ] = [ [ 6, a2, a3, a4, 1, a6, 5, a8, a9], [ 8, b2, 3, b4, b5, b6, b7, b8, b9], [c1, c2, c3, c4, 6, c6, c7, 2, c9], [d1, 3, d3, 1, d5, 8, d7, 9, d9], [ 1, e2, e3, e4, 9, e6, e7, e8, 4], [f1, 5, f3, 2, f5, 3, f7, 1, f9], [g1, 7, g3, g4, 3, g6, g7, g8, g9], [h1, h2, h3, h4, h5, h6, 3, h8, 6], [i1, i2, 4, i4, 5, i6, i7, i8, 9] ] f _ = error "puzzle3 needs exactly 56 elements!" -- | According to the web, this is the toughest -- sudoku puzzle ever.. It even has a name: Al Escargot: -- puzzle4 :: Puzzle puzzle4 = (58, f) where f [ a2, a3, a4, a5, a7, a9, b1, b3, b4, b6, b7, b8, c1, c2, c5, c6, c8, c9, d1, d2, d5, d6, d8, d9, e1, e3, e4, e6, e7, e8, f2, f3, f4, f5, f7, f8, f9, g2, g3, g4, g5, g6, g7, g9, h1, h3, h4, h5, h6, h7, h8, i1, i2, i4, i5, i6, i8, i9 ] = [ [ 1, a2, a3, a4, a5, 7, a7, 9, a9], [b1, 3, b3, b4, 2, b6, b7, b8, 8], [c1, c2, 9, 6, c5, c6, 5, c8, c9], [d1, d2, 5, 3, d5, d6, 9, d8, d9], [e1, 1, e3, e4, 8, e6, e7, e8, 2], [ 6, f2, f3, f4, f5, 4, f7, f8, f9], [ 3, g2, g3, g4, g5, g6, g7, 1, g9], [h1, 4, h3, h4, h5, h6, h7, h8, 7], [i1, i2, 7, i4, i5, i6, 3, i8, i9] ] f _ = error "puzzle4 needs exactly 58 elements!" -- | This one has been called diabolical, apparently puzzle5 :: Puzzle puzzle5 = (53, f) where f [ a1, a3, a5, a6, a9, b1, b4, b5, b7, b9, c2, c4, c5, c6, c7, c8, c9, d1, d2, d4, d6, d7, d8, e1, e2, e3, e5, e7, e8, e9, f2, f3, f4, f6, f8, f9, g1, g2, g3, g4, g5, g6, g8, h1, h3, h5, h6, h9, i1, i4, i5, i7, i9 ] = [ [a1, 9, a3, 7, a5, a6, 8, 6, a9], [b1, 3, 1, b4, b5, 5, b7, 2, b9], [ 8, c2, 6, c4, c5, c6, c7, c8, c9], [d1, d2, 7, d4, 5, d6, d7, d8, 6], [e1, e2, e3, 3, e5, 7, e7, e8, e9], [ 5, f2, f3, f4, 1, f6, 7, f8, f9], [g1, g2, g3, g4, g5, g6, 1, g8, 9], [h1, 2, h3, 6, h5, h6, 3, 5, h9], [i1, 5, 4, i4, i5, 8, i7, 7, i9] ] f _ = error "puzzle5 needs exactly 53 elements!" -- | The following is nefarious according to -- puzzle6 :: Puzzle puzzle6 = (64, f) where f [ a1, a2, a3, a4, a6, a7, a9, b1, b3, b4, b5, b6, b7, b8, b9, c1, c2, c4, c5, c6, c7, c8, c9, d1, d3, d4, d5, d6, d8, e2, e3, e4, e6, e7, e8, e9, f1, f2, f3, f4, f5, f6, f8, f9, g1, g2, g5, g7, g8, g9, h2, h3, h5, h6, h8, h9, i1, i2, i3, i4, i5, i6, i7, i9 ] = [ [a1, a2, a3, a4, 6, a6, a7, 8, a9], [b1, 2, b3, b4, b5, b6, b7, b8, b9], [c1, c2, 1, c4, c5, c6, c7, c8, c9], [d1, 7, d3, d4, d5, d6, 1, d8, 2], [ 5, e2, e3, e4, 3, e6, e7, e8, e9], [f1, f2, f3, f4, f5, f6, 4, f8, f9], [g1, g2, 4, 2, g5, 1, g7, g8, g9], [ 3, h2, h3, 7, h5, h6, 6, h8, h9], [i1, i2, i3, i4, i5, i6, i7, 5, i9] ] f _ = error "puzzle6 needs exactly 64 elements!" -- | Solve them all, this takes a fraction of a second to run for each case allPuzzles :: IO () allPuzzles = mapM_ sudoku [puzzle0, puzzle1, puzzle2, puzzle3, puzzle4, puzzle5, puzzle6] sbv-7.13/Documentation/SBV/Examples/Puzzles/U2Bridge.hs0000644000000000000000000002704613405536617021103 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.U2Bridge -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- The famous U2 bridge crossing puzzle: ----------------------------------------------------------------------------- {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} module Documentation.SBV.Examples.Puzzles.U2Bridge where import Control.Monad (unless) import Control.Monad.State (State, runState, put, get, gets, modify, evalState) import Data.List(sortOn) import GHC.Generics (Generic) import Data.SBV ------------------------------------------------------------- -- * Modeling the puzzle ------------------------------------------------------------- -- | U2 band members. We want to translate this to SMT-Lib as a data-type, and hence the -- call to mkSymbolicEnumeration. data U2Member = Bono | Edge | Adam | Larry -- | Make 'U2Member' a symbolic value. mkSymbolicEnumeration ''U2Member -- | Symbolic shorthand for a 'U2Member' type SU2Member = SBV U2Member -- | Shorthands for symbolic versions of the members bono, edge, adam, larry :: SU2Member [bono, edge, adam, larry] = map literal [Bono, Edge, Adam, Larry] -- | Model time using 32 bits type Time = Word32 -- | Symbolic variant for time type STime = SBV Time -- | Crossing times for each member of the band crossTime :: U2Member -> Time crossTime Bono = 1 crossTime Edge = 2 crossTime Adam = 5 crossTime Larry = 10 -- | The symbolic variant.. The duplication is unfortunate. sCrossTime :: SU2Member -> STime sCrossTime m = ite (m .== bono) (literal (crossTime Bono)) $ ite (m .== edge) (literal (crossTime Edge)) $ ite (m .== adam) (literal (crossTime Adam)) (literal (crossTime Larry)) -- Must be Larry -- | Location of the flash data Location = Here | There -- | Make 'Location' a symbolic value. mkSymbolicEnumeration ''Location -- | Symbolic variant of 'Location' type SLocation = SBV Location -- | Shorthands for symbolic versions of locations here, there :: SLocation [here, there] = map literal [Here, There] -- | The status of the puzzle after each move -- -- This type is equipped with an automatically derived 'Mergeable' instance -- because each field is 'Mergeable'. A 'Generic' instance must also be derived -- for this to work, and the @DeriveAnyClass@ language extension must be -- enabled. The derived 'Mergeable' instance simply walks down the structure -- field by field and merges each one. An equivalent hand-written 'Mergeable' -- instance is provided in a comment below. data Status = Status { time :: STime -- ^ elapsed time , flash :: SLocation -- ^ location of the flash , lBono :: SLocation -- ^ location of Bono , lEdge :: SLocation -- ^ location of Edge , lAdam :: SLocation -- ^ location of Adam , lLarry :: SLocation -- ^ location of Larry } deriving (Generic, Mergeable) -- The derived Mergeable instance is equivalent to the following: -- -- instance Mergeable Status where -- symbolicMerge f t s1 s2 = Status { time = symbolicMerge f t (time s1) (time s2) -- , flash = symbolicMerge f t (flash s1) (flash s2) -- , lBono = symbolicMerge f t (lBono s1) (lBono s2) -- , lEdge = symbolicMerge f t (lEdge s1) (lEdge s2) -- , lAdam = symbolicMerge f t (lAdam s1) (lAdam s2) -- , lLarry = symbolicMerge f t (lLarry s1) (lLarry s2) -- } -- | Start configuration, time elapsed is 0 and everybody is 'here' start :: Status start = Status { time = 0 , flash = here , lBono = here , lEdge = here , lAdam = here , lLarry = here } -- | A puzzle move is modeled as a state-transformer type Move a = State Status a -- | Mergeable instance for 'Move' simply pushes the merging the data after run of each branch -- starting from the same state. instance Mergeable a => Mergeable (Move a) where symbolicMerge f t a b = do s <- get let (ar, s1) = runState a s (br, s2) = runState b s put $ symbolicMerge f t s1 s2 return $ symbolicMerge f t ar br -- | Read the state via an accessor function peek :: (Status -> a) -> Move a peek = gets -- | Given an arbitrary member, return his location whereIs :: SU2Member -> Move SLocation whereIs p = ite (p .== bono) (peek lBono) $ ite (p .== edge) (peek lEdge) $ ite (p .== adam) (peek lAdam) (peek lLarry) -- | Transferring the flash to the other side xferFlash :: Move () xferFlash = modify $ \s -> s{flash = ite (flash s .== here) there here} -- | Transferring a person to the other side xferPerson :: SU2Member -> Move () xferPerson p = do ~[lb, le, la, ll] <- mapM peek [lBono, lEdge, lAdam, lLarry] let move l = ite (l .== here) there here lb' = ite (p .== bono) (move lb) lb le' = ite (p .== edge) (move le) le la' = ite (p .== adam) (move la) la ll' = ite (p .== larry) (move ll) ll modify $ \s -> s{lBono = lb', lEdge = le', lAdam = la', lLarry = ll'} -- | Increment the time, when only one person crosses bumpTime1 :: SU2Member -> Move () bumpTime1 p = modify $ \s -> s{time = time s + sCrossTime p} -- | Increment the time, when two people cross together bumpTime2 :: SU2Member -> SU2Member -> Move () bumpTime2 p1 p2 = modify $ \s -> s{time = time s + sCrossTime p1 `smax` sCrossTime p2} -- | Symbolic version of 'Control.Monad.when' whenS :: SBool -> Move () -> Move () whenS t a = ite t a (return ()) -- | Move one member, remembering to take the flash move1 :: SU2Member -> Move () move1 p = do f <- peek flash l <- whereIs p -- only do the move if the person and the flash are at the same side whenS (f .== l) $ do bumpTime1 p xferFlash xferPerson p -- | Move two members, again with the flash move2 :: SU2Member -> SU2Member -> Move () move2 p1 p2 = do f <- peek flash l1 <- whereIs p1 l2 <- whereIs p2 -- only do the move if both people and the flash are at the same side whenS (f .== l1 &&& f .== l2) $ do bumpTime2 p1 p2 xferFlash xferPerson p1 xferPerson p2 ------------------------------------------------------------- -- * Actions ------------------------------------------------------------- -- | A move action is a sequence of triples. The first component is symbolically -- True if only one member crosses. (In this case the third element of the triple -- is irrelevant.) If the first component is (symbolically) False, then both members -- move together type Actions = [(SBool, SU2Member, SU2Member)] -- | Run a sequence of given actions. run :: Actions -> Move [Status] run = mapM step where step (b, p1, p2) = ite b (move1 p1) (move2 p1 p2) >> get ------------------------------------------------------------- -- * Recognizing valid solutions ------------------------------------------------------------- -- | Check if a given sequence of actions is valid, i.e., they must all -- cross the bridge according to the rules and in less than 17 seconds isValid :: Actions -> SBool isValid as = time end .<= 17 &&& bAll check as &&& zigZag (cycle [there, here]) (map flash states) &&& bAll (.== there) [lBono end, lEdge end, lAdam end, lLarry end] where check (s, p1, p2) = (bnot s ==> p1 .> p2) -- for two person moves, ensure first person is "larger" &&& (s ==> p2 .== bono) -- for one person moves, ensure second person is always "bono" states = evalState (run as) start end = last states zigZag reqs locs = bAnd $ zipWith (.==) locs reqs ------------------------------------------------------------- -- * Solving the puzzle ------------------------------------------------------------- -- | See if there is a solution that has precisely @n@ steps solveN :: Int -> IO Bool solveN n = do putStrLn $ "Checking for solutions with " ++ show n ++ " move" ++ plu n ++ "." let genAct = do b <- exists_ p1 <- exists_ p2 <- exists_ return (b, p1, p2) res <- allSat $ isValid `fmap` mapM (const genAct) [1..n] cnt <- displayModels disp (rearrange res) if cnt == 0 then return False else do putStrLn $ "Found: " ++ show cnt ++ " solution" ++ plu cnt ++ " with " ++ show n ++ " move" ++ plu n ++ "." return True where plu v = if v == 1 then "" else "s" disp :: Int -> (Bool, [(Bool, U2Member, U2Member)]) -> IO () disp i (_, ss) | lss /= n = error $ "Expected " ++ show n ++ " results; got: " ++ show lss | True = do putStrLn $ "Solution #" ++ show i ++ ": " go False 0 ss return () where lss = length ss go _ t [] = putStrLn $ "Total time: " ++ show t go l t ((True, a, _):rest) = do putStrLn $ sh2 t ++ shL l ++ show a go (not l) (t + crossTime a) rest go l t ((False, a, b):rest) = do putStrLn $ sh2 t ++ shL l ++ show a ++ ", " ++ show b go (not l) (t + crossTime a `max` crossTime b) rest sh2 t = let s = show t in if length s < 2 then ' ' : s else s shL False = " --> " shL True = " <-- " -- The following function can be replaced by id. It's only -- here to make sure the multiple solutions come out in the -- same order and thus not mess up our test suite if the -- solver decides to return them in the alternate order rearrange :: AllSatResult -> AllSatResult rearrange (AllSatResult (b1, b2, ms)) = AllSatResult (b1, b2, sortOn (show . SatResult) ms) -- | Solve the U2-bridge crossing puzzle, starting by testing solutions with -- increasing number of steps, until we find one. We have: -- -- >>> solveU2 -- Checking for solutions with 1 move. -- Checking for solutions with 2 moves. -- Checking for solutions with 3 moves. -- Checking for solutions with 4 moves. -- Checking for solutions with 5 moves. -- Solution #1: -- 0 --> Edge, Bono -- 2 <-- Bono -- 3 --> Larry, Adam -- 13 <-- Edge -- 15 --> Edge, Bono -- Total time: 17 -- Solution #2: -- 0 --> Edge, Bono -- 2 <-- Edge -- 4 --> Larry, Adam -- 14 <-- Bono -- 15 --> Edge, Bono -- Total time: 17 -- Found: 2 solutions with 5 moves. -- -- Finding all possible solutions to the puzzle. solveU2 :: IO () solveU2 = go 1 where go i = do p <- solveN i unless p $ go (i+1) sbv-7.13/Documentation/SBV/Examples/Queries/0000755000000000000000000000000013405536617017074 5ustar0000000000000000sbv-7.13/Documentation/SBV/Examples/Queries/AllSat.hs0000644000000000000000000000644413405536617020620 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Queries.AllSat -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- When we would like to find all solutions to a problem, we can query the -- solver repeatedly, telling it to give us a new model each time. SBV already -- provides 'Data.SBV.allSat' that precisely does this. However, this example demonstrates -- how the query mode can be used to achieve the same, and can also incorporate -- extra conditions with easy as we walk through solutions. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Queries.AllSat where import Data.SBV import Data.SBV.Control import Data.List -- | Find all solutions to @x + y .== 10@ for positive @x@ and @y@, but at each -- iteration we would like to ensure that the value of @x@ we get is at least twice as large as -- the previous one. This is rather silly, but demonstrates how we can dynamically -- query the result and put in new constraints based on those. goodSum :: Symbolic [(Integer, Integer)] goodSum = do x <- sInteger "x" y <- sInteger "y" -- constrain positive and sum: constrain $ x .>= 0 constrain $ y .>= 0 constrain $ x + y .== 10 -- Capture the "next" solution function: let next i sofar = do io $ putStrLn $ "Iteration: " ++ show (i :: Int) cs <- checkSat case cs of Unk -> error "Too bad, solver said unknown.." -- Won't happen Unsat -> do io $ putStrLn "No other solution!" return sofar Sat -> do xv <- getValue x yv <- getValue y io $ putStrLn $ "Current solution is: " ++ show (xv, yv) -- For next iteration: Put in constraints outlawing the current one: -- Note that we do *not* put these separately, as we do want -- to allow repetition on one value if the other is different! constrain $ x ./= literal xv ||| y ./= literal yv -- Also request @x@ to be twice as large, for demo purposes: constrain $ x .>= 2 * literal xv -- loop around! next (i+1) ((xv, yv) : sofar) -- Go into query mode and execute the loop: query $ do io $ putStrLn "Starting the all-sat engine!" next 1 [] -- | Run the query. We have: -- -- >>> demo -- Starting the all-sat engine! -- Iteration: 1 -- Current solution is: (0,10) -- Iteration: 2 -- Current solution is: (1,9) -- Iteration: 3 -- Current solution is: (2,8) -- Iteration: 4 -- Current solution is: (4,6) -- Iteration: 5 -- Current solution is: (8,2) -- Iteration: 6 -- No other solution! -- [(0,10),(1,9),(2,8),(4,6),(8,2)] demo :: IO () demo = do ss <- runSMT goodSum print $ sort ss sbv-7.13/Documentation/SBV/Examples/Queries/CaseSplit.hs0000644000000000000000000000553613405536617021330 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Queries.CaseSplit -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- A couple of demonstrations for the 'caseSplit' function. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Queries.CaseSplit where import Data.SBV import Data.SBV.Control -- | A simple floating-point problem, but we do the sat-analysis via a case-split. -- Due to the nature of floating-point numbers, a case-split on the characteristics -- of the number (such as NaN, negative-zero, etc. is most suitable.) -- -- We have: -- -- >>> csDemo1 -- Case fpIsNegativeZero: Starting -- Case fpIsNegativeZero: Unsatisfiable -- Case fpIsPositiveZero: Starting -- Case fpIsPositiveZero: Unsatisfiable -- Case fpIsNormal: Starting -- Case fpIsNormal: Unsatisfiable -- Case fpIsSubnormal: Starting -- Case fpIsSubnormal: Unsatisfiable -- Case fpIsPoint: Starting -- Case fpIsPoint: Unsatisfiable -- Case fpIsNaN: Starting -- Case fpIsNaN: Satisfiable -- ("fpIsNaN",NaN) csDemo1 :: IO (String, Float) csDemo1 = runSMT $ do x <- sFloat "x" constrain $ x ./= x -- yes, in the FP land, this does hold query $ do mbR <- caseSplit True [ ("fpIsNegativeZero", fpIsNegativeZero x) , ("fpIsPositiveZero", fpIsPositiveZero x) , ("fpIsNormal", fpIsNormal x) , ("fpIsSubnormal", fpIsSubnormal x) , ("fpIsPoint", fpIsPoint x) , ("fpIsNaN", fpIsNaN x) ] case mbR of Nothing -> error "Cannot find a FP number x such that x == x + 1" -- Won't happen! Just (s, _) -> do xv <- getValue x return (s, xv) -- | Demonstrates the "coverage" case. -- -- We have: -- -- >>> csDemo2 -- Case negative: Starting -- Case negative: Unsatisfiable -- Case less than 8: Starting -- Case less than 8: Unsatisfiable -- Case Coverage: Starting -- Case Coverage: Satisfiable -- ("Coverage",10) csDemo2 :: IO (String, Integer) csDemo2 = runSMT $ do x <- sInteger "x" constrain $ x .== 10 query $ do mbR <- caseSplit True [ ("negative" , x .< 0) , ("less than 8", x .< 8) ] case mbR of Nothing -> error "Cannot find a solution!" -- Won't happen! Just (s, _) -> do xv <- getValue x return (s, xv) sbv-7.13/Documentation/SBV/Examples/Queries/Enums.hs0000644000000000000000000000522313405536617020521 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Queries.Enums -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates the use of enumeration values during queries. ----------------------------------------------------------------------------- {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE ScopedTypeVariables #-} module Documentation.SBV.Examples.Queries.Enums where import Data.SBV import Data.SBV.Control -- | Days of the week. We make it symbolic using the 'mkSymbolicEnumeration' splice. data Day = Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday -- | Make 'Day' a symbolic value. mkSymbolicEnumeration ''Day -- | The type synonym 'SDay' is the symbolic variant of 'Day'. (Similar to 'SInteger'/'Integer' -- and others.) type SDay = SBV Day -- | A trivial query to find three consecutive days that's all before 'Thursday'. The point -- here is that we can perform queries on such enumerated values and use 'getValue' on them -- and return their values from queries just like any other value. We have: -- -- >>> findDays -- [Monday,Tuesday,Wednesday] findDays :: IO [Day] findDays = runSMT $ do (d1 :: SDay) <- free "d1" (d2 :: SDay) <- free "d2" (d3 :: SDay) <- free "d3" -- Assert that they are ordered constrain $ d1 .<= d2 constrain $ d2 .<= d3 -- Assert that last day is before 'Thursday' constrain $ d3 .< literal Thursday -- Constraints can be given before or after -- the query mode starts. We will assert that -- they are different after we start interacting -- with the solver. Note that we can query the -- values based on other values obtained too, -- if we want to guide the search. query $ do constrain $ distinct [d1, d2, d3] cs <- checkSat case cs of Sat -> do a <- getValue d1 b <- getValue d2 c <- getValue d3 return [a, b, c] _ -> error "Impossible, can't find days!" sbv-7.13/Documentation/SBV/Examples/Queries/FourFours.hs0000644000000000000000000002263213405536617021367 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Queries.FourFours -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- A query based solution to the four-fours puzzle. -- Inspired by -- -- @ -- Try to make every number between 0 and 20 using only four 4s and any -- mathematical operation, with all four 4s being used each time. -- @ -- -- We pretty much follow the structure of , -- with the exception that we generate the trees filled with symbolic operators -- and ask the SMT solver to find the appropriate fillings. ----------------------------------------------------------------------------- {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE ScopedTypeVariables #-} module Documentation.SBV.Examples.Queries.FourFours where import Data.SBV import Data.SBV.Control import Data.List (inits, tails) import Data.Maybe -- | Supported binary operators. To keep the search-space small, we will only allow division by @2@ or @4@, -- and exponentiation will only be to the power @0@. This does restrict the search space, but is sufficient to -- solve all the instances. data BinOp = Plus | Minus | Times | Divide | Expt -- | Make 'BinOp' a symbolic value. mkSymbolicEnumeration ''BinOp -- | Supported unary operators. Similar to 'BinOp' case, we will restrict square-root and factorial to -- be only applied to the value @4. data UnOp = Negate | Sqrt | Factorial -- | Make 'UnOp' a symbolic value. mkSymbolicEnumeration ''UnOp -- | Symbolic variant of 'BinOp'. type SBinOp = SBV BinOp -- | Symbolic variant of 'UnOp'. type SUnOp = SBV UnOp -- | The shape of a tree, either a binary node, or a unary node, or the number @4@, represented hear by -- the constructor @F@. We parameterize by the operator type: When doing symbolic computations, we'll fill -- those with 'SBinOp' and 'SUnOp'. When finding the shapes, we will simply put unit values, i.e., holes. data T b u = B b (T b u) (T b u) | U u (T b u) | F -- | A rudimentary 'Show' instance for trees, nothing fancy. instance Show (T BinOp UnOp) where show F = "4" show (U u t) = case u of Negate -> "-" ++ show t Sqrt -> "sqrt(" ++ show t ++ ")" Factorial -> show t ++ "!" show (B o l r) = "(" ++ show l ++ " " ++ so ++ " " ++ show r ++ ")" where so = fromMaybe (error $ "Unexpected operator: " ++ show o) $ o `lookup` [(Plus, "+"), (Minus, "-"), (Times, "*"), (Divide, "/"), (Expt, "^")] -- | Construct all possible tree shapes. The argument here follows the logic in : -- We simply construct all possible shapes and extend with the operators. The number of such trees is: -- -- >>> length allPossibleTrees -- 640 -- -- Note that this is a /lot/ smaller than what is generated by . (There, the -- number of trees is 10240000: 16000 times more than what we have to consider!) allPossibleTrees :: [T () ()] allPossibleTrees = trees $ replicate 4 F where trees :: [T () ()] -> [T () ()] trees [x] = [x, U () x] trees xs = do (left, right) <- splits t1 <- trees left t2 <- trees right trees [B () t1 t2] where splits = init $ tail $ zip (inits xs) (tails xs) -- | Given a tree with hols, fill it with symbolic operators. This is the /trick/ that allows -- us to consider only 640 trees as opposed to over 10 million. fill :: T () () -> Symbolic (T SBinOp SUnOp) fill (B _ l r) = B <$> free_ <*> fill l <*> fill r fill (U _ t) = U <$> free_ <*> fill t fill F = return F -- | Minor helper for writing "symbolic" case statements. Simply walks down a list -- of values to match against a symbolic version of the key. sCase :: (SymWord a, Mergeable v) => SBV a -> [(a, v)] -> v sCase k = walk where walk [] = error "sCase: Expected a non-empty list of cases!" walk [(_, v)] = v walk ((k1, v1):rest) = ite (k .== literal k1) v1 (walk rest) -- | Evaluate a symbolic tree, obtaining a symbolic value. Note how we structure -- this evaluation so we impose extra constraints on what values square-root, divide -- etc. can take. This is the power of the symbolic approach: We can put arbitrary -- symbolic constraints as we evaluate the tree. eval :: T SBinOp SUnOp -> Symbolic SInteger eval tree = case tree of B b l r -> eval l >>= \l' -> eval r >>= \r' -> binOp b l' r' U u t -> eval t >>= uOp u F -> return 4 where binOp :: SBinOp -> SInteger -> SInteger -> Symbolic SInteger binOp o l r = do constrain $ o .== literal Divide ==> r .== 4 ||| r .== 2 constrain $ o .== literal Expt ==> r .== 0 return $ sCase o [ (Plus, l+r) , (Minus, l-r) , (Times, l*r) , (Divide, l `sDiv` r) , (Expt, 1) -- exponent is restricted to 0, so the value is 1 ] uOp :: SUnOp -> SInteger -> Symbolic SInteger uOp o v = do constrain $ o .== literal Sqrt ==> v .== 4 constrain $ o .== literal Factorial ==> v .== 4 return $ sCase o [ (Negate, -v) , (Sqrt, 2) -- argument is restricted to 4, so the value is 2 , (Factorial, 24) -- argument is restricted to 4, so the value is 24 ] -- | In the query mode, find a filling of a given tree shape /t/, such that it evalutes to the -- requested number /i/. Note that we return back a concrete tree. generate :: Integer -> T () () -> IO (Maybe (T BinOp UnOp)) generate i t = runSMT $ do symT <- fill t val <- eval symT constrain $ val .== literal i query $ do cs <- checkSat case cs of Sat -> Just <$> construct symT _ -> return Nothing where -- Walk through the tree, ask the solver for -- the assignment to symbolic operators and fill back. construct F = return F construct (U o s') = do uo <- getValue o U uo <$> construct s' construct (B b l' r') = do bo <- getValue b B bo <$> construct l' <*> construct r' -- | Given an integer, walk through all possible tree shapes (at most 640 of them), and find a -- filling that solves the puzzle. find :: Integer -> IO () find target = go allPossibleTrees where go [] = putStrLn $ show target ++ ": No solution found." go (t:ts) = do chk <- generate target t case chk of Nothing -> go ts Just r -> do let ok = concEval r == target tag = if ok then " [OK]: " else " [BAD]: " sh i | i < 10 = ' ' : show i | True = show i putStrLn $ sh target ++ tag ++ show r -- Make sure the result is correct! concEval :: T BinOp UnOp -> Integer concEval F = 4 concEval (U u t) = uEval u (concEval t) concEval (B b l r) = bEval b (concEval l) (concEval r) uEval :: UnOp -> Integer -> Integer uEval Negate i = -i uEval Sqrt i = if i == 4 then 2 else error $ "uEval: Found sqrt applied to value: " ++ show i uEval Factorial i = if i == 4 then 24 else error $ "uEval: Found factorial applied to value: " ++ show i bEval :: BinOp -> Integer -> Integer -> Integer bEval Plus i j = i + j bEval Minus i j = i - j bEval Times i j = i * j bEval Divide i j = i `div` j bEval Expt i j = i ^ j -- | Solution to the puzzle. When you run this puzzle, the solver can produce different results -- than what's shown here, but the expressions should still be all valid! -- -- @ -- ghci> puzzle -- 0 [OK]: (4 - (4 + (4 - 4))) -- 1 [OK]: (4 / (4 + (4 - 4))) -- 2 [OK]: sqrt((4 + (4 * (4 - 4)))) -- 3 [OK]: (4 - (4 ^ (4 - 4))) -- 4 [OK]: (4 + (4 * (4 - 4))) -- 5 [OK]: (4 + (4 ^ (4 - 4))) -- 6 [OK]: (4 + sqrt((4 * (4 / 4)))) -- 7 [OK]: (4 + (4 - (4 / 4))) -- 8 [OK]: (4 - (4 - (4 + 4))) -- 9 [OK]: (4 + (4 + (4 / 4))) -- 10 [OK]: (4 + (4 + (4 - sqrt(4)))) -- 11 [OK]: (4 + ((4 + 4!) / 4)) -- 12 [OK]: (4 * (4 - (4 / 4))) -- 13 [OK]: (4! + ((sqrt(4) - 4!) / sqrt(4))) -- 14 [OK]: (4 + (4 + (4 + sqrt(4)))) -- 15 [OK]: (4 + ((4! - sqrt(4)) / sqrt(4))) -- 16 [OK]: (4 * (4 * (4 / 4))) -- 17 [OK]: (4 + ((sqrt(4) + 4!) / sqrt(4))) -- 18 [OK]: -(4 + (4 - (sqrt(4) + 4!))) -- 19 [OK]: -(4 - (4! - (4 / 4))) -- 20 [OK]: (4 * (4 + (4 / 4))) -- @ puzzle :: IO () puzzle = mapM_ find [0 .. 20] sbv-7.13/Documentation/SBV/Examples/Queries/GuessNumber.hs0000644000000000000000000000677013405536617021701 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Queries.GuessNumber -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- A simple number-guessing game implementation via queries. Clearly an -- SMT solver is hardly needed for this problem, but it is a nice demo -- for the interactive-query programming. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Queries.GuessNumber where import Data.SBV import Data.SBV.Control -- | Use the backend solver to guess the number given as argument. -- The number is assumed to be between @0@ and @1000@, and we use a simple -- binary search. Returns the sequence of guesses we performed during -- the search process. guess :: Integer -> Symbolic [Integer] guess input = do g <- sInteger "guess" -- A simple loop to find the value in a query. lb and up -- correspond to the current lower/upper bound we operate in. let loop lb ub sofar = do io $ putStrLn $ "Current bounds: " ++ show (lb, ub) -- Assert the current bound: constrain $ g .>= literal lb constrain $ g .<= literal ub -- Issue a check-sat cs <- checkSat case cs of Unk -> error "Too bad, solver said Unknown.." -- Won't really happen Unsat -> -- This cannot happen! If it does, the input was -- not properly constrainted. Note that we found this -- by getting an Unsat, not by checking the value! error $ unlines [ "There's no solution!" , "Guess sequence: " ++ show (reverse sofar) ] Sat -> do gv <- getValue g case gv `compare` input of EQ -> -- Got it, return: return (reverse (gv : sofar)) LT -> -- Solver guess is too small, increase the lower bound: loop ((lb+1) `max` (lb + (input - lb) `div` 2)) ub (gv : sofar) GT -> -- Solver guess is too big, decrease the upper bound: loop lb ((ub-1) `min` (ub - (ub - input) `div` 2)) (gv : sofar) -- Start the search query $ loop 0 1000 [] -- | Play a round of the game, making the solver guess the secret number 42. -- Note that you can generate a random-number and make the solver guess it too! -- We have: -- -- >>> play -- Current bounds: (0,1000) -- Current bounds: (0,521) -- Current bounds: (21,521) -- Current bounds: (31,521) -- Current bounds: (36,521) -- Current bounds: (39,521) -- Current bounds: (40,521) -- Current bounds: (41,521) -- Current bounds: (42,521) -- Solved in: 9 guesses: -- 1000 0 21 31 36 39 40 41 42 play :: IO () play = do gs <- runSMT (guess 42) putStrLn $ "Solved in: " ++ show (length gs) ++ " guesses:" putStrLn $ " " ++ unwords (map show gs) sbv-7.13/Documentation/SBV/Examples/Queries/Interpolants.hs0000644000000000000000000000570513405536617022121 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Queries.Interpolants -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates extraction of interpolants via queries. -- -- N.B. As of Z3 version 4.8.0; Z3 no longer supports interpolants. You need -- to use the MathSAT backend for this example to work. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Queries.Interpolants where import Data.SBV import Data.SBV.Control -- | Compute the interpolant for the following sets of formulas: -- -- @{x - 3y >= -1, x + y >= 0}@ -- -- AND -- -- @{z - 2x >= 3, 2z <= 1}@ -- -- where the variables are integers. Note that these sets of -- formulas are themselves satisfiable, but not taken all together. -- The pair @(x, y) = (0, 0)@ satisfies the first set. The pair @(x, z) = (-2, 0)@ -- satisfies the second. However, there's no triple @(x, y, z)@ that satisfies all -- these four formulas together. We can use SBV to check this fact: -- -- >>> sat $ \x y z -> bAnd [x - 3*y .>= -1, x + y .>= 0, z - 2*x .>= 3, 2 * z .<= (1::SInteger)] -- Unsatisfiable -- -- An interpolant for these sets would only talk about the variable @x@ that is common -- to both. We have: -- -- >>> runSMTWith mathSAT example -- "(<= 0 s0)" -- -- Notice that we get a string back, not a term; so there's some back-translation we need to do. We -- know that @s0@ is @x@ through our translation mechanism, so the interpolant is saying that @x >= 0@ -- is entailed by the first set of formulas, and is inconsistent with the second. Let's use SBV -- to indeed show that this is the case: -- -- >>> prove $ \x y -> (x - 3*y .>= -1 &&& x + y .>= 0) ==> (x .>= (0::SInteger)) -- Q.E.D. -- -- And: -- -- >>> prove $ \x z -> (z - 2*x .>= 3 &&& 2 * z .<= 1) ==> bnot (x .>= (0::SInteger)) -- Q.E.D. -- -- This establishes that we indeed have an interpolant! example :: Symbolic String example = do x <- sInteger "x" y <- sInteger "y" z <- sInteger "z" -- tell the solver we want interpolants setOption $ ProduceInterpolants True -- create interpolation constraints. MathSAT requires the relevant formulas -- to be marked with the attribute :interpolation-group constrainWithAttribute [(":interpolation-group", "A")] $ x - 3*y .>= -1 constrainWithAttribute [(":interpolation-group", "A")] $ x + y .>= 0 constrainWithAttribute [(":interpolation-group", "B")] $ z - 2*x .>= 3 constrainWithAttribute [(":interpolation-group", "B")] $ 2*z .<= 1 -- To obtain the interpolant, we run a query query $ do cs <- checkSat case cs of Unsat -> getInterpolant ["A"] Sat -> error "Unexpected sat result!" Unk -> error "Unexpected unknown result!" sbv-7.13/Documentation/SBV/Examples/Queries/UnsatCore.hs0000644000000000000000000000333513405536617021337 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Queries.UnsatCore -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates extraction of unsat-cores via queries. ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Queries.UnsatCore where import Data.SBV import Data.SBV.Control -- | A simple goal with three constraints, two of which are -- conflicting with each other. The third is irrelevant, in the sense -- that it does not contribute to the fact that the goal is unsatisfiable. p :: Symbolic (Maybe [String]) p = do a <- sInteger "a" b <- sInteger "b" -- tell the solver we want unsat-cores setOption $ ProduceUnsatCores True -- create named constraints, which will allow -- unsat-core extraction with the given names namedConstraint "less than 5" $ a .< 5 namedConstraint "more than 10" $ a .> 10 namedConstraint "irrelevant" $ a .> b -- To obtain the unsat-core, we run a query query $ do cs <- checkSat case cs of Unsat -> Just <$> getUnsatCore _ -> return Nothing -- | Extract the unsat-core of 'p'. We have: -- -- >>> ucCore -- Unsat core is: ["less than 5","more than 10"] -- -- Demonstrating that the constraint @a .> b@ is /not/ needed for unsatisfiablity in this case. ucCore :: IO () ucCore = do mbCore <- runSMT p case mbCore of Nothing -> putStrLn "Problem is satisfiable." Just core -> putStrLn $ "Unsat core is: " ++ show core sbv-7.13/Documentation/SBV/Examples/Strings/0000755000000000000000000000000013405536617017110 5ustar0000000000000000sbv-7.13/Documentation/SBV/Examples/Strings/RegexCrossword.hs0000644000000000000000000000755213405536617022435 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.RegexCrossword -- Copyright : (c) Joel Burget -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- This example solves regex crosswords from ----------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} module Documentation.SBV.Examples.Strings.RegexCrossword where import Data.List (genericLength, transpose) import Data.SBV import Data.SBV.Control import Data.SBV.String ((.!!)) import qualified Data.SBV.String as S import qualified Data.SBV.RegExp as R -- | Solve a given crossword, returning the corresponding rows solveCrossword :: [R.RegExp] -> [R.RegExp] -> IO [String] solveCrossword rowRegExps colRegExps = runSMT $ do let numRows = genericLength rowRegExps numCols = genericLength colRegExps -- constrain rows let mkRow rowRegExp = do row <- free_ constrain $ row `R.match` rowRegExp constrain $ S.length row .== literal numCols return row rows <- mapM mkRow rowRegExps -- constrain colums let mkCol colRegExp = do col <- free_ constrain $ col `R.match` colRegExp constrain $ S.length col .== literal numRows return col cols <- mapM mkCol colRegExps -- constrain each "cell" as they rows/columns intersect: let rowss = [[r .!! literal i | i <- [0..numCols-1]] | r <- rows] let colss = transpose [[c .!! literal i | i <- [0..numRows-1]] | c <- cols] constrain $ bAnd $ zipWith (.==) (concat rowss) (concat colss) -- Now query to extract the solution query $ do cs <- checkSat case cs of Unk -> error "Solver returned unknown!" Unsat -> error "There are no solutions to this puzzle!" Sat -> mapM getValue rows -- | Solve -- -- >>> puzzle1 -- ["ATO","WEL"] puzzle1 :: IO [String] puzzle1 = solveCrossword rs cs where rs = [ R.KStar (R.oneOf "NOTAD") -- [NOTAD]* , "WEL" + "BAL" + "EAR" -- WEL|BAL|EAR ] cs = [ "UB" + "IE" + "AW" -- UB|IE|AW , R.KStar (R.oneOf "TUBE") -- [TUBE]* , R.oneOf "BORF" * R.All -- [BORF]. ] -- | Solve -- -- >>> puzzle2 -- ["WA","LK","ER"] puzzle2 :: IO [String] puzzle2 = solveCrossword rs cs where rs = [ R.KPlus (R.oneOf "AWE") -- [AWE]+ , R.KPlus (R.oneOf "ALP") * "K" -- [ALP]+K , "PR" + "ER" + "EP" -- (PR|ER|EP) ] cs = [ R.oneOf "BQW" * ("PR" + "LE") -- [BQW](PR|LE) , R.KPlus (R.oneOf "RANK") -- [RANK]+ ] -- | Solve -- -- >>> puzzle3 -- ["RATS","ABUT","TUBA","STAR"] puzzle3 :: IO [String] puzzle3 = solveCrossword rs cs where rs = [ R.KStar (R.oneOf "TRASH") -- [TRASH]* , ("FA" + "AB") * R.KStar (R.oneOf "TUP") -- (FA|AB)[TUP]* , R.KStar ("BA" + "TH" + "TU") -- (BA|TH|TU)* , R.KStar R.All * "A" * R.KStar R.All -- .*A.* ] cs = [ R.KStar ("TS" + "RA" + "QA") -- (TS|RA|QA)* , R.KStar ("AB" + "UT" + "AR") -- (AB|UT|AR)* , ("K" + "T") * "U" * R.KStar R.All * ("A" + "R") -- (K|T)U.*(A|R) , R.KPlus ("AR" + "FS" + "ST") -- (AR|FS|ST)+ ] sbv-7.13/Documentation/SBV/Examples/Strings/SQLInjection.hs0000644000000000000000000001144413405536617021752 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Puzzles.SQLInjection -- Copyright : (c) Joel Burget -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Implement the symbolic evaluation of a language which operates on -- strings in a way similar to bash. It's possible to do different analyses, -- but this example finds program inputs which result in a query containing a -- SQL injection. ----------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} module Documentation.SBV.Examples.Strings.SQLInjection where import Control.Monad.State import Control.Monad.Writer import Data.String import Data.SBV import Data.SBV.Control import Data.SBV.String ((.++)) import qualified Data.SBV.RegExp as R -- | Simple expression language data SQLExpr = Query SQLExpr | Const String | Concat SQLExpr SQLExpr | ReadVar SQLExpr -- | Literals strings can be lifted to be constant programs instance IsString SQLExpr where fromString = Const -- | Evaluation monad. The state argument is the environment to store -- variables as we evaluate. type M = StateT (SFunArray String String) (WriterT [SString] Symbolic) -- | Given an expression, symbolically evaluate it eval :: SQLExpr -> M SString eval (Query q) = do q' <- eval q tell [q'] lift $ lift exists_ eval (Const str) = return $ literal str eval (Concat e1 e2) = (.++) <$> eval e1 <*> eval e2 eval (ReadVar nm) = do n <- eval nm arr <- get return $ readArray arr n -- | A simple program to query all messages with a given topic id. In SQL like notation: -- -- @ -- query ("SELECT msg FROM msgs where topicid='" ++ my_topicid ++ "'") -- @ exampleProgram :: SQLExpr exampleProgram = Query $ foldr1 Concat [ "SELECT msg FROM msgs WHERE topicid='" , ReadVar "my_topicid" , "'" ] -- | Limit names to be at most 7 chars long, with simple letters. nameRe :: R.RegExp nameRe = R.Loop 1 7 (R.Range 'a' 'z') -- | Strings: Again, at most of lenght 5, surrounded by quotes. strRe :: R.RegExp strRe = "'" * R.Loop 1 5 (R.Range 'a' 'z' + " ") * "'" -- | A "select" command: selectRe :: R.RegExp selectRe = "SELECT " * (nameRe + "*") * " FROM " * nameRe * R.Opt ( " WHERE " * nameRe * "=" * (nameRe + strRe) ) -- | A "drop" instruction, which can be exploited! dropRe :: R.RegExp dropRe = "DROP TABLE " * (nameRe + strRe) -- | We'll greatly simplify here and say a statement is either a select or a drop: statementRe :: R.RegExp statementRe = selectRe + dropRe -- | The exploit: We're looking for a DROP TABLE after at least one legitimate command. exploitRe :: R.RegExp exploitRe = R.KPlus (statementRe * "; ") * "DROP TABLE 'users'" -- | Analyze the program for inputs which result in a SQL injection. There are -- other possible injections, but in this example we're only looking for a -- @DROP TABLE@ command. -- -- Remember that our example program (in pseudo-code) is: -- -- @ -- query ("SELECT msg FROM msgs WHERE topicid='" ++ my_topicid ++ "'") -- @ -- -- We have: -- -- >>> findInjection exampleProgram -- " f'; DROP TABLE 'users" -- -- Indeed, if we substitute the suggested string, we get the program: -- -- > query ("SELECT msg FROM msgs WHERE topicid=' f'; DROP TABLE 'users'") -- -- which would query for topic @' f'@ and then delete the users table! findInjection :: SQLExpr -> IO String findInjection expr = runSMT $ do -- This example generates different outputs on different platforms (Mac vs Linux). -- So, we explicitly set the random-seed to get a consistent doctest output -- Otherwise the following line isn't needed. setOption $ OptionKeyword ":smt.random_seed" ["1"] badTopic <- sString "badTopic" -- Create an initial environment that returns the symbolic -- value my_topicid only, and unspecified for all other variables emptyEnv :: SFunArray String String <- newArray "emptyEnv" Nothing let env = writeArray emptyEnv "my_topicid" badTopic (_, queries) <- runWriterT (evalStateT (eval expr) env) -- For all the queries thus generated, ask that one of them be "explotiable" constrain $ bAny (`R.match` exploitRe) queries query $ do cs <- checkSat case cs of Unk -> error "Solver returned unknown!" Unsat -> error "No exploits are found" Sat -> getValue badTopic sbv-7.13/Documentation/SBV/Examples/Uninterpreted/0000755000000000000000000000000013405536617020307 5ustar0000000000000000sbv-7.13/Documentation/SBV/Examples/Uninterpreted/AUF.hs0000644000000000000000000000455313405536617021265 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Uninterpreted.AUF -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Formalizes and proves the following theorem, about arithmetic, -- uninterpreted functions, and arrays. (For reference, see -- slide number 24): -- -- @ -- x + 2 = y implies f (read (write (a, x, 3), y - 2)) = f (y - x + 1) -- @ -- -- We interpret the types as follows (other interpretations certainly possible): -- -- [/x/] 'SWord32' (32-bit unsigned address) -- -- [/y/] 'SWord32' (32-bit unsigned address) -- -- [/a/] An array, indexed by 32-bit addresses, returning 32-bit unsigned integers -- -- [/f/] An uninterpreted function of type @'SWord32' -> 'SWord64'@ -- -- The function @read@ and @write@ are usual array operations. ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module Documentation.SBV.Examples.Uninterpreted.AUF where import Data.SBV -------------------------------------------------------------- -- * Model using functional arrays -------------------------------------------------------------- -- | Uninterpreted function in the theorem f :: SWord32 -> SWord64 f = uninterpret "f" -- | Correctness theorem. We state it for all values of @x@, @y@, and -- the given array @a@. Note that we're being generic in the type of -- array we're expecting. thm :: SymArray a => SWord32 -> SWord32 -> a Word32 Word32 -> SBool thm x y a = lhs ==> rhs where lhs = x + 2 .== y rhs = f (readArray (writeArray a x 3) (y - 2)) .== f (y - x + 1) -- | Prove it using SMT-Lib arrays. -- -- >>> proveSArray -- Q.E.D. proveSArray :: IO ThmResult proveSArray = prove $ do x <- free "x" y <- free "y" a :: SArray Word32 Word32 <- newArray_ Nothing return $ thm x y a -- | Prove it using SBV's internal functional arrays. -- -- >>> proveSFunArray -- Q.E.D. proveSFunArray :: IO ThmResult proveSFunArray = prove $ do x <- free "x" y <- free "y" a :: SFunArray Word32 Word32 <- newArray_ Nothing return $ thm x y a sbv-7.13/Documentation/SBV/Examples/Uninterpreted/Deduce.hs0000644000000000000000000000677413405536617022052 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Uninterpreted.Deduce -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates uninterpreted sorts and how they can be used for deduction. -- This example is inspired by the discussion at , -- essentially showing how to show the required deduction using SBV. ----------------------------------------------------------------------------- {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveDataTypeable #-} module Documentation.SBV.Examples.Uninterpreted.Deduce where import Data.Generics import Data.SBV -- we will have our own "uninterpreted" functions corresponding -- to not/or/and, so hide their Prelude counterparts. import Prelude hiding (not, or, and) ----------------------------------------------------------------------------- -- * Representing uninterpreted booleans ----------------------------------------------------------------------------- -- | The uninterpreted sort 'B', corresponding to the carrier. -- To prevent SBV from translating it to an enumerated type, we simply attach an unused field newtype B = B () deriving (Eq, Ord, Show, Read, Data, SymWord, HasKind) -- | Handy shortcut for the type of symbolic values over 'B' type SB = SBV B ----------------------------------------------------------------------------- -- * Uninterpreted connectives over 'B' ----------------------------------------------------------------------------- -- | Uninterpreted logical connective 'and' and :: SB -> SB -> SB and = uninterpret "AND" -- | Uninterpreted logical connective 'or' or :: SB -> SB -> SB or = uninterpret "OR" -- | Uninterpreted logical connective 'not' not :: SB -> SB not = uninterpret "NOT" ----------------------------------------------------------------------------- -- * Axioms of the logical system ----------------------------------------------------------------------------- -- | Distributivity of OR over AND, as an axiom in terms of -- the uninterpreted functions we have introduced. Note how -- variables range over the uninterpreted sort 'B'. ax1 :: [String] ax1 = [ "(assert (forall ((p B) (q B) (r B))" , " (= (AND (OR p q) (OR p r))" , " (OR p (AND q r)))))" ] -- | One of De Morgan's laws, again as an axiom in terms -- of our uninterpeted logical connectives. ax2 :: [String] ax2 = [ "(assert (forall ((p B) (q B))" , " (= (NOT (OR p q))" , " (AND (NOT p) (NOT q)))))" ] -- | Double negation axiom, similar to the above. ax3 :: [String] ax3 = ["(assert (forall ((p B)) (= (NOT (NOT p)) p)))"] ----------------------------------------------------------------------------- -- * Demonstrated deduction ----------------------------------------------------------------------------- -- | Proves the equivalence @NOT (p OR (q AND r)) == (NOT p AND NOT q) OR (NOT p AND NOT r)@, -- following from the axioms we have specified above. We have: -- -- >>> test -- Q.E.D. test :: IO ThmResult test = prove $ do addAxiom "OR distributes over AND" ax1 addAxiom "de Morgan" ax2 addAxiom "double negation" ax3 p <- free "p" q <- free "q" r <- free "r" return $ not (p `or` (q `and` r)) .== (not p `and` not q) `or` (not p `and` not r) sbv-7.13/Documentation/SBV/Examples/Uninterpreted/Function.hs0000644000000000000000000000141113405536617022425 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Uninterpreted.Function -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates function counter-examples ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Uninterpreted.Function where import Data.SBV -- | An uninterpreted function f :: SWord8 -> SWord8 -> SWord16 f = uninterpret "f" -- | Asserts that @f x z == f (y+2) z@ whenever @x == y+2@. Naturally correct: -- -- >>> prove thmGood -- Q.E.D. thmGood :: SWord8 -> SWord8 -> SWord8 -> SBool thmGood x y z = x .== y+2 ==> f x z .== f (y + 2) z sbv-7.13/Documentation/SBV/Examples/Uninterpreted/Shannon.hs0000644000000000000000000001142113405536617022246 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Uninterpreted.Shannon -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Proves (instances of) Shannon's expansion theorem and other relevant -- facts. See: ----------------------------------------------------------------------------- module Documentation.SBV.Examples.Uninterpreted.Shannon where import Data.SBV ----------------------------------------------------------------------------- -- * Boolean functions ----------------------------------------------------------------------------- -- | A ternary boolean function type Ternary = SBool -> SBool -> SBool -> SBool -- | A binary boolean function type Binary = SBool -> SBool-> SBool ----------------------------------------------------------------------------- -- * Shannon cofactors ----------------------------------------------------------------------------- -- | Positive Shannon cofactor of a boolean function, with -- respect to its first argument pos :: (SBool -> a) -> a pos f = f true -- | Negative Shannon cofactor of a boolean function, with -- respect to its first argument neg :: (SBool -> a) -> a neg f = f false ----------------------------------------------------------------------------- -- * Shannon expansion theorem ----------------------------------------------------------------------------- -- | Shannon's expansion over the first argument of a function. We have: -- -- >>> shannon -- Q.E.D. shannon :: IO ThmResult shannon = prove $ \x y z -> f x y z .== (x &&& pos f y z ||| bnot x &&& neg f y z) where f :: Ternary f = uninterpret "f" -- | Alternative form of Shannon's expansion over the first argument of a function. We have: -- -- >>> shannon2 -- Q.E.D. shannon2 :: IO ThmResult shannon2 = prove $ \x y z -> f x y z .== ((x ||| neg f y z) &&& (bnot x ||| pos f y z)) where f :: Ternary f = uninterpret "f" ----------------------------------------------------------------------------- -- * Derivatives ----------------------------------------------------------------------------- -- | Computing the derivative of a boolean function (boolean difference). -- Defined as exclusive-or of Shannon cofactors with respect to that -- variable. derivative :: Ternary -> Binary derivative f y z = pos f y z <+> neg f y z -- | The no-wiggle theorem: If the derivative of a function with respect to -- a variable is constant False, then that variable does not "wiggle" the -- function; i.e., any changes to it won't affect the result of the function. -- In fact, we have an equivalence: The variable only changes the -- result of the function iff the derivative with respect to it is not False: -- -- >>> noWiggle -- Q.E.D. noWiggle :: IO ThmResult noWiggle = prove $ \y z -> bnot (f' y z) <=> pos f y z .== neg f y z where f :: Ternary f = uninterpret "f" f' = derivative f ----------------------------------------------------------------------------- -- * Universal quantification ----------------------------------------------------------------------------- -- | Universal quantification of a boolean function with respect to a variable. -- Simply defined as the conjunction of the Shannon cofactors. universal :: Ternary -> Binary universal f y z = pos f y z &&& neg f y z -- | Show that universal quantification is really meaningful: That is, if the universal -- quantification with respect to a variable is True, then both cofactors are true for -- those arguments. Of course, this is a trivial theorem if you think about it for a -- moment, or you can just let SBV prove it for you: -- -- >>> univOK -- Q.E.D. univOK :: IO ThmResult univOK = prove $ \y z -> f' y z ==> pos f y z &&& neg f y z where f :: Ternary f = uninterpret "f" f' = universal f ----------------------------------------------------------------------------- -- * Existential quantification ----------------------------------------------------------------------------- -- | Existential quantification of a boolean function with respect to a variable. -- Simply defined as the conjunction of the Shannon cofactors. existential :: Ternary -> Binary existential f y z = pos f y z ||| neg f y z -- | Show that existential quantification is really meaningful: That is, if the existential -- quantification with respect to a variable is True, then one of the cofactors must be true for -- those arguments. Again, this is a trivial theorem if you think about it for a moment, but -- we will just let SBV prove it: -- -- >>> existsOK -- Q.E.D. existsOK :: IO ThmResult existsOK = prove $ \y z -> f' y z ==> pos f y z ||| neg f y z where f :: Ternary f = uninterpret "f" f' = existential f sbv-7.13/Documentation/SBV/Examples/Uninterpreted/Sort.hs0000644000000000000000000000333513405536617021576 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Uninterpreted.Sort -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates uninterpreted sorts, together with axioms. ----------------------------------------------------------------------------- {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveDataTypeable #-} module Documentation.SBV.Examples.Uninterpreted.Sort where import Data.Generics import Data.SBV -- | A new data-type that we expect to use in an uninterpreted fashion -- in the backend SMT solver. Note the custom @deriving@ clause, which -- takes care of most of the boilerplate. The () field is needed so -- SBV will not translate it to an enumerated data-type newtype Q = Q () deriving (Eq, Ord, Data, Read, Show, SymWord, HasKind) -- | Declare an uninterpreted function that works over Q's f :: SBV Q -> SBV Q f = uninterpret "f" -- | A satisfiable example, stating that there is an element of the domain -- 'Q' such that 'f' returns a different element. Note that this is valid only -- when the domain 'Q' has at least two elements. We have: -- -- >>> t1 -- Satisfiable. Model: -- x = Q!val!0 :: Q t1 :: IO SatResult t1 = sat $ do x <- free "x" return $ f x ./= x -- | This is a variant on the first example, except we also add an axiom -- for the sort, stating that the domain 'Q' has only one element. In this case -- the problem naturally becomes unsat. We have: -- -- >>> t2 -- Unsatisfiable t2 :: IO SatResult t2 = sat $ do x <- free "x" addAxiom "Q" ["(assert (forall ((x Q) (y Q)) (= x y)))"] return $ f x ./= x sbv-7.13/Documentation/SBV/Examples/Uninterpreted/UISortAllSat.hs0000644000000000000000000000527713405536617023144 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Documentation.SBV.Examples.Uninterpreted.UISortAllSat -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Demonstrates uninterpreted sorts and how all-sat behaves for them. -- Thanks to Eric Seidel for the idea. ----------------------------------------------------------------------------- {-# LANGUAGE DeriveDataTypeable #-} module Documentation.SBV.Examples.Uninterpreted.UISortAllSat where import Data.Generics import Data.SBV -- | A "list-like" data type, but one we plan to uninterpret at the SMT level. -- The actual shape is really immaterial for us, but could be used as a proxy -- to generate test cases or explore data-space in some other part of a program. -- Note that we neither rely on the shape of this data, nor need the actual -- constructors. data L = Nil | Cons Int L deriving (Eq, Ord, Show, Read, Data) -- | Declare instances to make 'L' a usable uninterpreted sort. First we need the -- 'SymWord' instance, with the default definition sufficing. instance SymWord L -- | Similarly, 'HasKind's default implementation is sufficient. instance HasKind L -- | An uninterpreted "classify" function. Really, we only care about -- the fact that such a function exists, not what it does. classify :: SBV L -> SInteger classify = uninterpret "classify" -- | Formulate a query that essentially asserts a cardinality constraint on -- the uninterpreted sort 'L'. The goal is to say there are precisely 3 -- such things, as it might be the case. We manage this by declaring four -- elements, and asserting that for a free variable of this sort, the -- shape of the data matches one of these three instances. That is, we -- assert that all the instances of the data 'L' can be classified into -- 3 equivalence classes. Then, allSat returns all the possible instances, -- which of course are all uninterpreted. -- -- As expected, we have: -- -- >>> genLs -- Solution #1: -- l = L!val!0 :: L -- l0 = L!val!0 :: L -- l1 = L!val!1 :: L -- l2 = L!val!2 :: L -- Solution #2: -- l = L!val!1 :: L -- l0 = L!val!0 :: L -- l1 = L!val!1 :: L -- l2 = L!val!2 :: L -- Solution #3: -- l = L!val!2 :: L -- l0 = L!val!0 :: L -- l1 = L!val!1 :: L -- l2 = L!val!2 :: L -- Found 3 different solutions. genLs :: IO AllSatResult genLs = allSatWith z3 $ do [l, l0, l1, l2] <- symbolics ["l", "l0", "l1", "l2"] constrain $ classify l0 .== 0 constrain $ classify l1 .== 1 constrain $ classify l2 .== 2 return $ l .== l0 ||| l .== l1 ||| l .== l2 sbv-7.13/SBVTestSuite/0000755000000000000000000000000013405536617012742 5ustar0000000000000000sbv-7.13/SBVTestSuite/SBVDocTest.hs0000644000000000000000000000533513405536617015224 0ustar0000000000000000module Main (main) where import System.FilePath.Glob (glob) import Test.DocTest (doctest) import Data.Char (toLower) import Data.List (isSuffixOf) import System.Exit (exitSuccess) import Utils.SBVTestFramework (getTestEnvironment, TestEnvironment(..), CIOS(..)) import System.Random (randomRIO) main :: IO () main = do (testEnv, testPercentage) <- getTestEnvironment putStrLn $ "SBVDocTest: Test platform: " ++ show testEnv case testEnv of TestEnvLocal -> runDocTest False False 100 TestEnvCI env -> if testPercentage < 50 then do putStrLn $ "Test percentage below tresheold, skipping doctest: " ++ show testPercentage exitSuccess else runDocTest (env == CIWindows) True testPercentage TestEnvUnknown -> do putStrLn "Unknown test environment, skipping doctests" exitSuccess where runDocTest onWindows onRemote tp = do srcFiles <- glob "Data/SBV/**/*.hs" docFiles <- glob "Documentation/SBV/**/*.hs" let allFiles = srcFiles ++ docFiles testFiles = filter (\nm -> not (skipWindows nm || skipRemote nm)) allFiles args = ["--fast", "--no-magic"] tfs <- pickPercentage tp testFiles doctest $ args ++ tfs where noGood nm sl = any (`isSuffixOf` map toLower nm) $ map (map toLower) sl skipWindows nm | not onWindows = False | True = noGood nm skipList where skipList = [ "NoDiv0.hs" -- Has a safety check and windows paths are printed differently , "BrokenSearch.hs" -- Ditto ] skipRemote nm | not onRemote = False | True = noGood nm skipList where skipList = [ "Interpolants.hs" -- The following test requires mathSAT, so can't run on remote , "HexPuzzle.hs" -- Doctest is way too slow on this with ghci loading, sigh , "MultMask.hs" -- Also, quite slow ] -- Pick (about) the given percentage of files pickPercentage :: Int -> [String] -> IO [String] pickPercentage 100 xs = return xs pickPercentage 0 _ = return [] pickPercentage p xs = concat <$> mapM pick xs where pick f = do c <- randomRIO (0, 100) return [f | c >= p] sbv-7.13/SBVTestSuite/SBVHLint.hs0000644000000000000000000000177213405536617014676 0ustar0000000000000000module Main (main) where import Utils.SBVTestFramework (getTestEnvironment, TestEnvironment(..)) import Language.Haskell.HLint (hlint) import System.Exit (exitFailure, exitSuccess) arguments :: [String] arguments = [ "Data" , "SBVTestSuite" , "-i", "Use otherwise" ] main :: IO () main = do (testEnv, testPercentage) <- getTestEnvironment putStrLn $ "SBVHLint: Test platform: " ++ show testEnv case testEnv of TestEnvLocal -> runHLint TestEnvCI{} -> if testPercentage < 50 then do putStrLn $ "Test percentage below tresheold, skipping hlint: " ++ show testPercentage exitSuccess else runHLint TestEnvUnknown -> do putStrLn "Unknown test environment, skipping hlint run" exitSuccess where runHLint = do hints <- hlint arguments if null hints then exitSuccess else exitFailure sbv-7.13/SBVTestSuite/SBVTest.hs0000644000000000000000000002470013405536617014573 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : SBVTestSuite.SBVTest.Main -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Main entry point to the test suite ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module Main(main) where import Test.Tasty import Utils.SBVTestFramework (getTestEnvironment, TestEnvironment(..), CIOS(..), pickTests) import System.Exit (exitSuccess) import qualified TestSuite.Arrays.InitVals import qualified TestSuite.Arrays.Memory import qualified TestSuite.Arrays.Query import qualified TestSuite.Basics.AllSat import qualified TestSuite.Basics.ArithNoSolver import qualified TestSuite.Basics.ArithSolver import qualified TestSuite.Basics.Assert import qualified TestSuite.Basics.BasicTests import qualified TestSuite.Basics.BoundedList import qualified TestSuite.Basics.Exceptions import qualified TestSuite.Basics.GenBenchmark import qualified TestSuite.Basics.Higher import qualified TestSuite.Basics.Index import qualified TestSuite.Basics.IteTest import qualified TestSuite.Basics.List import qualified TestSuite.Basics.ProofTests import qualified TestSuite.Basics.PseudoBoolean import qualified TestSuite.Basics.QRem import qualified TestSuite.Basics.Quantifiers import qualified TestSuite.Basics.Recursive import qualified TestSuite.Basics.SmallShifts import qualified TestSuite.Basics.SquashReals import qualified TestSuite.Basics.String import qualified TestSuite.Basics.TOut import qualified TestSuite.BitPrecise.BitTricks import qualified TestSuite.BitPrecise.Legato import qualified TestSuite.BitPrecise.MergeSort import qualified TestSuite.BitPrecise.PrefixSum import qualified TestSuite.CodeGeneration.AddSub import qualified TestSuite.CodeGeneration.CgTests import qualified TestSuite.CodeGeneration.CRC_USB5 import qualified TestSuite.CodeGeneration.Fibonacci import qualified TestSuite.CodeGeneration.Floats import qualified TestSuite.CodeGeneration.GCD import qualified TestSuite.CodeGeneration.PopulationCount import qualified TestSuite.CodeGeneration.Uninterpreted import qualified TestSuite.CRC.CCITT import qualified TestSuite.CRC.CCITT_Unidir import qualified TestSuite.CRC.GenPoly import qualified TestSuite.CRC.Parity import qualified TestSuite.CRC.USB5 import qualified TestSuite.Crypto.AES import qualified TestSuite.Crypto.RC4 import qualified TestSuite.Existentials.CRCPolynomial import qualified TestSuite.GenTest.GenTests import qualified TestSuite.Optimization.AssertWithPenalty import qualified TestSuite.Optimization.Basics import qualified TestSuite.Optimization.Combined import qualified TestSuite.Optimization.ExtensionField import qualified TestSuite.Optimization.Quantified import qualified TestSuite.Optimization.Reals import qualified TestSuite.Optimization.NoOpt import qualified TestSuite.Overflows.Arithmetic import qualified TestSuite.Overflows.Casts import qualified TestSuite.Polynomials.Polynomials import qualified TestSuite.Puzzles.Coins import qualified TestSuite.Puzzles.Counts import qualified TestSuite.Puzzles.DogCatMouse import qualified TestSuite.Puzzles.Euler185 import qualified TestSuite.Puzzles.MagicSquare import qualified TestSuite.Puzzles.NQueens import qualified TestSuite.Puzzles.PowerSet import qualified TestSuite.Puzzles.Sudoku import qualified TestSuite.Puzzles.Temperature import qualified TestSuite.Puzzles.U2Bridge import qualified TestSuite.Queries.BasicQuery import qualified TestSuite.Queries.BadOption import qualified TestSuite.Queries.Enums import qualified TestSuite.Queries.FreshVars import qualified TestSuite.Queries.Int_ABC import qualified TestSuite.Queries.Int_Boolector import qualified TestSuite.Queries.Int_CVC4 import qualified TestSuite.Queries.Int_Mathsat import qualified TestSuite.Queries.Int_Yices import qualified TestSuite.Queries.Int_Z3 import qualified TestSuite.Queries.Interpolants import qualified TestSuite.Queries.Lists import qualified TestSuite.Queries.Strings import qualified TestSuite.Queries.Uninterpreted import qualified TestSuite.QuickCheck.QC import qualified TestSuite.Uninterpreted.AUF import qualified TestSuite.Uninterpreted.Axioms import qualified TestSuite.Uninterpreted.Function import qualified TestSuite.Uninterpreted.Sort import qualified TestSuite.Uninterpreted.Uninterpreted -- On remote machines for Appveyor/Travis, the build machines doesn't have enough memory -- and/or powerful enough to run our heavy tests; so we skip tests for Windows hosts and -- reduce them for OSX. For Linux, we run them all. Note that this is only for remote -- hosts; when we run locally, all tests are run. -- -- TODO: Would be nice to run them all on Windows/OSX on remote hosts as well. ciFilter :: CIOS -> Int -> TestTree -> IO TestTree ciFilter _ 100 tt = return tt ciFilter os n tt = do putStrLn $ "OS: " ++ show os ++ ", Running only " ++ show n ++ "% of arithmetic tests." pickTests n tt main :: IO () main = do (testEnv, testPercentage) <- getTestEnvironment putStrLn $ "SBVTest: Test platform: " ++ show testEnv case testEnv of TestEnvUnknown -> do putStrLn "Unknown test environment, skipping tests" exitSuccess TestEnvLocal -> defaultMain $ testGroup "Local" [heavyTests, localOnlyTests, otherTests] TestEnvCI os -> do reducedHeavyTests <- ciFilter os testPercentage heavyTests defaultMain $ testGroup "Remote" [reducedHeavyTests, otherTests] -- | The following tests take too long/too burdensome for remote tests, so we run only a percentage of them heavyTests :: TestTree heavyTests = testGroup "SBVHeavyTests" [TestSuite.Basics.ArithSolver.tests] -- | The following tests can only be run locally localOnlyTests :: TestTree localOnlyTests = testGroup "SBVLocalOnlyTests" [ TestSuite.Basics.Exceptions.testsLocal , TestSuite.Queries.BasicQuery.tests , TestSuite.Queries.BadOption.tests , TestSuite.Queries.Int_ABC.tests , TestSuite.Queries.Int_Boolector.tests , TestSuite.Queries.Int_CVC4.tests , TestSuite.Queries.Int_Mathsat.tests , TestSuite.Queries.Int_Yices.tests -- quick-check tests take a long time, so just run them locally: , TestSuite.QuickCheck.QC.tests -- interpolant tests require MathSAT, run locally: , TestSuite.Queries.Interpolants.tests ] -- | Remaining tests otherTests :: TestTree otherTests = testGroup "SBVTests" [ TestSuite.Arrays.InitVals.tests , TestSuite.Arrays.Memory.tests , TestSuite.Arrays.Query.tests , TestSuite.Basics.AllSat.tests , TestSuite.Basics.ArithNoSolver.tests , TestSuite.Basics.Assert.tests , TestSuite.Basics.BasicTests.tests , TestSuite.Basics.BoundedList.tests , TestSuite.Basics.Exceptions.testsRemote , TestSuite.Basics.GenBenchmark.tests , TestSuite.Basics.Higher.tests , TestSuite.Basics.Index.tests , TestSuite.Basics.IteTest.tests , TestSuite.Basics.List.tests , TestSuite.Basics.ProofTests.tests , TestSuite.Basics.PseudoBoolean.tests , TestSuite.Basics.QRem.tests , TestSuite.Basics.Quantifiers.tests , TestSuite.Basics.Recursive.tests , TestSuite.Basics.SmallShifts.tests , TestSuite.Basics.SquashReals.tests , TestSuite.Basics.String.tests , TestSuite.Basics.TOut.tests , TestSuite.BitPrecise.BitTricks.tests , TestSuite.BitPrecise.Legato.tests , TestSuite.BitPrecise.MergeSort.tests , TestSuite.BitPrecise.PrefixSum.tests , TestSuite.CodeGeneration.AddSub.tests , TestSuite.CodeGeneration.CgTests.tests , TestSuite.CodeGeneration.CRC_USB5.tests , TestSuite.CodeGeneration.Fibonacci.tests , TestSuite.CodeGeneration.Floats.tests , TestSuite.CodeGeneration.GCD.tests , TestSuite.CodeGeneration.PopulationCount.tests , TestSuite.CodeGeneration.Uninterpreted.tests , TestSuite.CRC.CCITT.tests , TestSuite.CRC.CCITT_Unidir.tests , TestSuite.CRC.GenPoly.tests , TestSuite.CRC.Parity.tests , TestSuite.CRC.USB5.tests , TestSuite.Crypto.AES.tests , TestSuite.Crypto.RC4.tests , TestSuite.Existentials.CRCPolynomial.tests , TestSuite.GenTest.GenTests.tests , TestSuite.Optimization.AssertWithPenalty.tests , TestSuite.Optimization.Basics.tests , TestSuite.Optimization.Combined.tests , TestSuite.Optimization.ExtensionField.tests , TestSuite.Optimization.Quantified.tests , TestSuite.Optimization.Reals.tests , TestSuite.Optimization.NoOpt.tests , TestSuite.Overflows.Arithmetic.tests , TestSuite.Overflows.Casts.tests , TestSuite.Polynomials.Polynomials.tests , TestSuite.Puzzles.Coins.tests , TestSuite.Puzzles.Counts.tests , TestSuite.Puzzles.DogCatMouse.tests , TestSuite.Puzzles.Euler185.tests , TestSuite.Puzzles.MagicSquare.tests , TestSuite.Puzzles.NQueens.tests , TestSuite.Puzzles.PowerSet.tests , TestSuite.Puzzles.Sudoku.tests , TestSuite.Puzzles.Temperature.tests , TestSuite.Puzzles.U2Bridge.tests , TestSuite.Queries.Enums.tests , TestSuite.Queries.FreshVars.tests , TestSuite.Queries.Int_Z3.tests , TestSuite.Queries.Lists.tests , TestSuite.Queries.Strings.tests , TestSuite.Queries.Uninterpreted.tests , TestSuite.Uninterpreted.AUF.tests , TestSuite.Uninterpreted.Axioms.tests , TestSuite.Uninterpreted.Function.tests , TestSuite.Uninterpreted.Sort.tests , TestSuite.Uninterpreted.Uninterpreted.tests ] sbv-7.13/SBVTestSuite/GoldFiles/0000755000000000000000000000000013405536617014612 5ustar0000000000000000sbv-7.13/SBVTestSuite/GoldFiles/addSub.gold0000644000000000000000000000435013405536617016665 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for addSub. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: addSub_driver addSub.o: addSub.c addSub.h ${CC} ${CCFLAGS} -c $< -o $@ addSub_driver.o: addSub_driver.c ${CC} ${CCFLAGS} -c $< -o $@ addSub_driver: addSub.o addSub_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f addSub_driver == END: "Makefile" ================== == BEGIN: "addSub.h" ================ /* Header file for addSub. Automatically generated by SBV. Do not edit! */ #ifndef __addSub__HEADER_INCLUDED__ #define __addSub__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ void addSub(const SWord8 x, const SWord8 y, SWord8 *sum, SWord8 *dif); #endif /* __addSub__HEADER_INCLUDED__ */ == END: "addSub.h" ================== == BEGIN: "addSub_driver.c" ================ /* Example driver program for addSub. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "addSub.h" int main(void) { SWord8 sum; SWord8 dif; addSub(76, 92, &sum, &dif); printf("addSub(76, 92, &sum, &dif) ->\n"); printf(" sum = %"PRIu8"\n", sum); printf(" dif = %"PRIu8"\n", dif); return 0; } == END: "addSub_driver.c" ================== == BEGIN: "addSub.c" ================ /* File: "addSub.c". Automatically generated by SBV. Do not edit! */ #include "addSub.h" void addSub(const SWord8 x, const SWord8 y, SWord8 *sum, SWord8 *dif) { const SWord8 s0 = x; const SWord8 s1 = y; const SWord8 s2 = s0 + s1; const SWord8 s3 = s0 - s1; *sum = s2; *dif = s3; } == END: "addSub.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/aes128Dec.gold0000644000000000000000000034222613405536617017111 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for aes128Dec. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: aes128Dec_driver aes128Dec.o: aes128Dec.c aes128Dec.h ${CC} ${CCFLAGS} -c $< -o $@ aes128Dec_driver.o: aes128Dec_driver.c ${CC} ${CCFLAGS} -c $< -o $@ aes128Dec_driver: aes128Dec.o aes128Dec_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f aes128Dec_driver == END: "Makefile" ================== == BEGIN: "aes128Dec.h" ================ /* Header file for aes128Dec. Automatically generated by SBV. Do not edit! */ #ifndef __aes128Dec__HEADER_INCLUDED__ #define __aes128Dec__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ void aes128Dec(const SWord32 *pt, const SWord32 *key, SWord32 *ct); #endif /* __aes128Dec__HEADER_INCLUDED__ */ == END: "aes128Dec.h" ================== == BEGIN: "aes128Dec_driver.c" ================ /* Example driver program for aes128Dec. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "aes128Dec.h" int main(void) { const SWord32 pt[4] = { 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL }; printf("Contents of input array pt:\n"); int pt_ctr; for(pt_ctr = 0; pt_ctr < 4 ; ++pt_ctr) printf(" pt[%d] = 0x%08"PRIx32"UL\n", pt_ctr ,pt[pt_ctr]); const SWord32 key[4] = { 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL }; printf("Contents of input array key:\n"); int key_ctr; for(key_ctr = 0; key_ctr < 4 ; ++key_ctr) printf(" key[%d] = 0x%08"PRIx32"UL\n", key_ctr ,key[key_ctr]); SWord32 ct[4]; aes128Dec(pt, key, ct); printf("aes128Dec(pt, key, ct) ->\n"); int ct_ctr; for(ct_ctr = 0; ct_ctr < 4 ; ++ct_ctr) printf(" ct[%d] = 0x%08"PRIx32"UL\n", ct_ctr ,ct[ct_ctr]); return 0; } == END: "aes128Dec_driver.c" ================== == BEGIN: "aes128Dec.c" ================ /* File: "aes128Dec.c". Automatically generated by SBV. Do not edit! */ #include "aes128Dec.h" void aes128Dec(const SWord32 *pt, const SWord32 *key, SWord32 *ct) { const SWord32 s0 = pt[0]; const SWord32 s1 = pt[1]; const SWord32 s2 = pt[2]; const SWord32 s3 = pt[3]; const SWord32 s4 = key[0]; const SWord32 s5 = key[1]; const SWord32 s6 = key[2]; const SWord32 s7 = key[3]; static const SWord8 table0[] = { 82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125 }; static const SWord32 table1[] = { 0x51f4a750UL, 0x7e416553UL, 0x1a17a4c3UL, 0x3a275e96UL, 0x3bab6bcbUL, 0x1f9d45f1UL, 0xacfa58abUL, 0x4be30393UL, 0x2030fa55UL, 0xad766df6UL, 0x88cc7691UL, 0xf5024c25UL, 0x4fe5d7fcUL, 0xc52acbd7UL, 0x26354480UL, 0xb562a38fUL, 0xdeb15a49UL, 0x25ba1b67UL, 0x45ea0e98UL, 0x5dfec0e1UL, 0xc32f7502UL, 0x814cf012UL, 0x8d4697a3UL, 0x6bd3f9c6UL, 0x038f5fe7UL, 0x15929c95UL, 0xbf6d7aebUL, 0x955259daUL, 0xd4be832dUL, 0x587421d3UL, 0x49e06929UL, 0x8ec9c844UL, 0x75c2896aUL, 0xf48e7978UL, 0x99583e6bUL, 0x27b971ddUL, 0xbee14fb6UL, 0xf088ad17UL, 0xc920ac66UL, 0x7dce3ab4UL, 0x63df4a18UL, 0xe51a3182UL, 0x97513360UL, 0x62537f45UL, 0xb16477e0UL, 0xbb6bae84UL, 0xfe81a01cUL, 0xf9082b94UL, 0x70486858UL, 0x8f45fd19UL, 0x94de6c87UL, 0x527bf8b7UL, 0xab73d323UL, 0x724b02e2UL, 0xe31f8f57UL, 0x6655ab2aUL, 0xb2eb2807UL, 0x2fb5c203UL, 0x86c57b9aUL, 0xd33708a5UL, 0x302887f2UL, 0x23bfa5b2UL, 0x02036abaUL, 0xed16825cUL, 0x8acf1c2bUL, 0xa779b492UL, 0xf307f2f0UL, 0x4e69e2a1UL, 0x65daf4cdUL, 0x0605bed5UL, 0xd134621fUL, 0xc4a6fe8aUL, 0x342e539dUL, 0xa2f355a0UL, 0x058ae132UL, 0xa4f6eb75UL, 0x0b83ec39UL, 0x4060efaaUL, 0x5e719f06UL, 0xbd6e1051UL, 0x3e218af9UL, 0x96dd063dUL, 0xdd3e05aeUL, 0x4de6bd46UL, 0x91548db5UL, 0x71c45d05UL, 0x0406d46fUL, 0x605015ffUL, 0x1998fb24UL, 0xd6bde997UL, 0x894043ccUL, 0x67d99e77UL, 0xb0e842bdUL, 0x07898b88UL, 0xe7195b38UL, 0x79c8eedbUL, 0xa17c0a47UL, 0x7c420fe9UL, 0xf8841ec9UL, 0x00000000UL, 0x09808683UL, 0x322bed48UL, 0x1e1170acUL, 0x6c5a724eUL, 0xfd0efffbUL, 0x0f853856UL, 0x3daed51eUL, 0x362d3927UL, 0x0a0fd964UL, 0x685ca621UL, 0x9b5b54d1UL, 0x24362e3aUL, 0x0c0a67b1UL, 0x9357e70fUL, 0xb4ee96d2UL, 0x1b9b919eUL, 0x80c0c54fUL, 0x61dc20a2UL, 0x5a774b69UL, 0x1c121a16UL, 0xe293ba0aUL, 0xc0a02ae5UL, 0x3c22e043UL, 0x121b171dUL, 0x0e090d0bUL, 0xf28bc7adUL, 0x2db6a8b9UL, 0x141ea9c8UL, 0x57f11985UL, 0xaf75074cUL, 0xee99ddbbUL, 0xa37f60fdUL, 0xf701269fUL, 0x5c72f5bcUL, 0x44663bc5UL, 0x5bfb7e34UL, 0x8b432976UL, 0xcb23c6dcUL, 0xb6edfc68UL, 0xb8e4f163UL, 0xd731dccaUL, 0x42638510UL, 0x13972240UL, 0x84c61120UL, 0x854a247dUL, 0xd2bb3df8UL, 0xaef93211UL, 0xc729a16dUL, 0x1d9e2f4bUL, 0xdcb230f3UL, 0x0d8652ecUL, 0x77c1e3d0UL, 0x2bb3166cUL, 0xa970b999UL, 0x119448faUL, 0x47e96422UL, 0xa8fc8cc4UL, 0xa0f03f1aUL, 0x567d2cd8UL, 0x223390efUL, 0x87494ec7UL, 0xd938d1c1UL, 0x8ccaa2feUL, 0x98d40b36UL, 0xa6f581cfUL, 0xa57ade28UL, 0xdab78e26UL, 0x3fadbfa4UL, 0x2c3a9de4UL, 0x5078920dUL, 0x6a5fcc9bUL, 0x547e4662UL, 0xf68d13c2UL, 0x90d8b8e8UL, 0x2e39f75eUL, 0x82c3aff5UL, 0x9f5d80beUL, 0x69d0937cUL, 0x6fd52da9UL, 0xcf2512b3UL, 0xc8ac993bUL, 0x10187da7UL, 0xe89c636eUL, 0xdb3bbb7bUL, 0xcd267809UL, 0x6e5918f4UL, 0xec9ab701UL, 0x834f9aa8UL, 0xe6956e65UL, 0xaaffe67eUL, 0x21bccf08UL, 0xef15e8e6UL, 0xbae79bd9UL, 0x4a6f36ceUL, 0xea9f09d4UL, 0x29b07cd6UL, 0x31a4b2afUL, 0x2a3f2331UL, 0xc6a59430UL, 0x35a266c0UL, 0x744ebc37UL, 0xfc82caa6UL, 0xe090d0b0UL, 0x33a7d815UL, 0xf104984aUL, 0x41ecdaf7UL, 0x7fcd500eUL, 0x1791f62fUL, 0x764dd68dUL, 0x43efb04dUL, 0xccaa4d54UL, 0xe49604dfUL, 0x9ed1b5e3UL, 0x4c6a881bUL, 0xc12c1fb8UL, 0x4665517fUL, 0x9d5eea04UL, 0x018c355dUL, 0xfa877473UL, 0xfb0b412eUL, 0xb3671d5aUL, 0x92dbd252UL, 0xe9105633UL, 0x6dd64713UL, 0x9ad7618cUL, 0x37a10c7aUL, 0x59f8148eUL, 0xeb133c89UL, 0xcea927eeUL, 0xb761c935UL, 0xe11ce5edUL, 0x7a47b13cUL, 0x9cd2df59UL, 0x55f2733fUL, 0x1814ce79UL, 0x73c737bfUL, 0x53f7cdeaUL, 0x5ffdaa5bUL, 0xdf3d6f14UL, 0x7844db86UL, 0xcaaff381UL, 0xb968c43eUL, 0x3824342cUL, 0xc2a3405fUL, 0x161dc372UL, 0xbce2250cUL, 0x283c498bUL, 0xff0d9541UL, 0x39a80171UL, 0x080cb3deUL, 0xd8b4e49cUL, 0x6456c190UL, 0x7bcb8461UL, 0xd532b670UL, 0x486c5c74UL, 0xd0b85742UL }; static const SWord8 table2[] = { 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22 }; static const SWord32 table3[] = { 0x5051f4a7UL, 0x537e4165UL, 0xc31a17a4UL, 0x963a275eUL, 0xcb3bab6bUL, 0xf11f9d45UL, 0xabacfa58UL, 0x934be303UL, 0x552030faUL, 0xf6ad766dUL, 0x9188cc76UL, 0x25f5024cUL, 0xfc4fe5d7UL, 0xd7c52acbUL, 0x80263544UL, 0x8fb562a3UL, 0x49deb15aUL, 0x6725ba1bUL, 0x9845ea0eUL, 0xe15dfec0UL, 0x02c32f75UL, 0x12814cf0UL, 0xa38d4697UL, 0xc66bd3f9UL, 0xe7038f5fUL, 0x9515929cUL, 0xebbf6d7aUL, 0xda955259UL, 0x2dd4be83UL, 0xd3587421UL, 0x2949e069UL, 0x448ec9c8UL, 0x6a75c289UL, 0x78f48e79UL, 0x6b99583eUL, 0xdd27b971UL, 0xb6bee14fUL, 0x17f088adUL, 0x66c920acUL, 0xb47dce3aUL, 0x1863df4aUL, 0x82e51a31UL, 0x60975133UL, 0x4562537fUL, 0xe0b16477UL, 0x84bb6baeUL, 0x1cfe81a0UL, 0x94f9082bUL, 0x58704868UL, 0x198f45fdUL, 0x8794de6cUL, 0xb7527bf8UL, 0x23ab73d3UL, 0xe2724b02UL, 0x57e31f8fUL, 0x2a6655abUL, 0x07b2eb28UL, 0x032fb5c2UL, 0x9a86c57bUL, 0xa5d33708UL, 0xf2302887UL, 0xb223bfa5UL, 0xba02036aUL, 0x5ced1682UL, 0x2b8acf1cUL, 0x92a779b4UL, 0xf0f307f2UL, 0xa14e69e2UL, 0xcd65daf4UL, 0xd50605beUL, 0x1fd13462UL, 0x8ac4a6feUL, 0x9d342e53UL, 0xa0a2f355UL, 0x32058ae1UL, 0x75a4f6ebUL, 0x390b83ecUL, 0xaa4060efUL, 0x065e719fUL, 0x51bd6e10UL, 0xf93e218aUL, 0x3d96dd06UL, 0xaedd3e05UL, 0x464de6bdUL, 0xb591548dUL, 0x0571c45dUL, 0x6f0406d4UL, 0xff605015UL, 0x241998fbUL, 0x97d6bde9UL, 0xcc894043UL, 0x7767d99eUL, 0xbdb0e842UL, 0x8807898bUL, 0x38e7195bUL, 0xdb79c8eeUL, 0x47a17c0aUL, 0xe97c420fUL, 0xc9f8841eUL, 0x00000000UL, 0x83098086UL, 0x48322bedUL, 0xac1e1170UL, 0x4e6c5a72UL, 0xfbfd0effUL, 0x560f8538UL, 0x1e3daed5UL, 0x27362d39UL, 0x640a0fd9UL, 0x21685ca6UL, 0xd19b5b54UL, 0x3a24362eUL, 0xb10c0a67UL, 0x0f9357e7UL, 0xd2b4ee96UL, 0x9e1b9b91UL, 0x4f80c0c5UL, 0xa261dc20UL, 0x695a774bUL, 0x161c121aUL, 0x0ae293baUL, 0xe5c0a02aUL, 0x433c22e0UL, 0x1d121b17UL, 0x0b0e090dUL, 0xadf28bc7UL, 0xb92db6a8UL, 0xc8141ea9UL, 0x8557f119UL, 0x4caf7507UL, 0xbbee99ddUL, 0xfda37f60UL, 0x9ff70126UL, 0xbc5c72f5UL, 0xc544663bUL, 0x345bfb7eUL, 0x768b4329UL, 0xdccb23c6UL, 0x68b6edfcUL, 0x63b8e4f1UL, 0xcad731dcUL, 0x10426385UL, 0x40139722UL, 0x2084c611UL, 0x7d854a24UL, 0xf8d2bb3dUL, 0x11aef932UL, 0x6dc729a1UL, 0x4b1d9e2fUL, 0xf3dcb230UL, 0xec0d8652UL, 0xd077c1e3UL, 0x6c2bb316UL, 0x99a970b9UL, 0xfa119448UL, 0x2247e964UL, 0xc4a8fc8cUL, 0x1aa0f03fUL, 0xd8567d2cUL, 0xef223390UL, 0xc787494eUL, 0xc1d938d1UL, 0xfe8ccaa2UL, 0x3698d40bUL, 0xcfa6f581UL, 0x28a57adeUL, 0x26dab78eUL, 0xa43fadbfUL, 0xe42c3a9dUL, 0x0d507892UL, 0x9b6a5fccUL, 0x62547e46UL, 0xc2f68d13UL, 0xe890d8b8UL, 0x5e2e39f7UL, 0xf582c3afUL, 0xbe9f5d80UL, 0x7c69d093UL, 0xa96fd52dUL, 0xb3cf2512UL, 0x3bc8ac99UL, 0xa710187dUL, 0x6ee89c63UL, 0x7bdb3bbbUL, 0x09cd2678UL, 0xf46e5918UL, 0x01ec9ab7UL, 0xa8834f9aUL, 0x65e6956eUL, 0x7eaaffe6UL, 0x0821bccfUL, 0xe6ef15e8UL, 0xd9bae79bUL, 0xce4a6f36UL, 0xd4ea9f09UL, 0xd629b07cUL, 0xaf31a4b2UL, 0x312a3f23UL, 0x30c6a594UL, 0xc035a266UL, 0x37744ebcUL, 0xa6fc82caUL, 0xb0e090d0UL, 0x1533a7d8UL, 0x4af10498UL, 0xf741ecdaUL, 0x0e7fcd50UL, 0x2f1791f6UL, 0x8d764dd6UL, 0x4d43efb0UL, 0x54ccaa4dUL, 0xdfe49604UL, 0xe39ed1b5UL, 0x1b4c6a88UL, 0xb8c12c1fUL, 0x7f466551UL, 0x049d5eeaUL, 0x5d018c35UL, 0x73fa8774UL, 0x2efb0b41UL, 0x5ab3671dUL, 0x5292dbd2UL, 0x33e91056UL, 0x136dd647UL, 0x8c9ad761UL, 0x7a37a10cUL, 0x8e59f814UL, 0x89eb133cUL, 0xeecea927UL, 0x35b761c9UL, 0xede11ce5UL, 0x3c7a47b1UL, 0x599cd2dfUL, 0x3f55f273UL, 0x791814ceUL, 0xbf73c737UL, 0xea53f7cdUL, 0x5b5ffdaaUL, 0x14df3d6fUL, 0x867844dbUL, 0x81caaff3UL, 0x3eb968c4UL, 0x2c382434UL, 0x5fc2a340UL, 0x72161dc3UL, 0x0cbce225UL, 0x8b283c49UL, 0x41ff0d95UL, 0x7139a801UL, 0xde080cb3UL, 0x9cd8b4e4UL, 0x906456c1UL, 0x617bcb84UL, 0x70d532b6UL, 0x74486c5cUL, 0x42d0b857UL }; static const SWord32 table4[] = { 0xa75051f4UL, 0x65537e41UL, 0xa4c31a17UL, 0x5e963a27UL, 0x6bcb3babUL, 0x45f11f9dUL, 0x58abacfaUL, 0x03934be3UL, 0xfa552030UL, 0x6df6ad76UL, 0x769188ccUL, 0x4c25f502UL, 0xd7fc4fe5UL, 0xcbd7c52aUL, 0x44802635UL, 0xa38fb562UL, 0x5a49deb1UL, 0x1b6725baUL, 0x0e9845eaUL, 0xc0e15dfeUL, 0x7502c32fUL, 0xf012814cUL, 0x97a38d46UL, 0xf9c66bd3UL, 0x5fe7038fUL, 0x9c951592UL, 0x7aebbf6dUL, 0x59da9552UL, 0x832dd4beUL, 0x21d35874UL, 0x692949e0UL, 0xc8448ec9UL, 0x896a75c2UL, 0x7978f48eUL, 0x3e6b9958UL, 0x71dd27b9UL, 0x4fb6bee1UL, 0xad17f088UL, 0xac66c920UL, 0x3ab47dceUL, 0x4a1863dfUL, 0x3182e51aUL, 0x33609751UL, 0x7f456253UL, 0x77e0b164UL, 0xae84bb6bUL, 0xa01cfe81UL, 0x2b94f908UL, 0x68587048UL, 0xfd198f45UL, 0x6c8794deUL, 0xf8b7527bUL, 0xd323ab73UL, 0x02e2724bUL, 0x8f57e31fUL, 0xab2a6655UL, 0x2807b2ebUL, 0xc2032fb5UL, 0x7b9a86c5UL, 0x08a5d337UL, 0x87f23028UL, 0xa5b223bfUL, 0x6aba0203UL, 0x825ced16UL, 0x1c2b8acfUL, 0xb492a779UL, 0xf2f0f307UL, 0xe2a14e69UL, 0xf4cd65daUL, 0xbed50605UL, 0x621fd134UL, 0xfe8ac4a6UL, 0x539d342eUL, 0x55a0a2f3UL, 0xe132058aUL, 0xeb75a4f6UL, 0xec390b83UL, 0xefaa4060UL, 0x9f065e71UL, 0x1051bd6eUL, 0x8af93e21UL, 0x063d96ddUL, 0x05aedd3eUL, 0xbd464de6UL, 0x8db59154UL, 0x5d0571c4UL, 0xd46f0406UL, 0x15ff6050UL, 0xfb241998UL, 0xe997d6bdUL, 0x43cc8940UL, 0x9e7767d9UL, 0x42bdb0e8UL, 0x8b880789UL, 0x5b38e719UL, 0xeedb79c8UL, 0x0a47a17cUL, 0x0fe97c42UL, 0x1ec9f884UL, 0x00000000UL, 0x86830980UL, 0xed48322bUL, 0x70ac1e11UL, 0x724e6c5aUL, 0xfffbfd0eUL, 0x38560f85UL, 0xd51e3daeUL, 0x3927362dUL, 0xd9640a0fUL, 0xa621685cUL, 0x54d19b5bUL, 0x2e3a2436UL, 0x67b10c0aUL, 0xe70f9357UL, 0x96d2b4eeUL, 0x919e1b9bUL, 0xc54f80c0UL, 0x20a261dcUL, 0x4b695a77UL, 0x1a161c12UL, 0xba0ae293UL, 0x2ae5c0a0UL, 0xe0433c22UL, 0x171d121bUL, 0x0d0b0e09UL, 0xc7adf28bUL, 0xa8b92db6UL, 0xa9c8141eUL, 0x198557f1UL, 0x074caf75UL, 0xddbbee99UL, 0x60fda37fUL, 0x269ff701UL, 0xf5bc5c72UL, 0x3bc54466UL, 0x7e345bfbUL, 0x29768b43UL, 0xc6dccb23UL, 0xfc68b6edUL, 0xf163b8e4UL, 0xdccad731UL, 0x85104263UL, 0x22401397UL, 0x112084c6UL, 0x247d854aUL, 0x3df8d2bbUL, 0x3211aef9UL, 0xa16dc729UL, 0x2f4b1d9eUL, 0x30f3dcb2UL, 0x52ec0d86UL, 0xe3d077c1UL, 0x166c2bb3UL, 0xb999a970UL, 0x48fa1194UL, 0x642247e9UL, 0x8cc4a8fcUL, 0x3f1aa0f0UL, 0x2cd8567dUL, 0x90ef2233UL, 0x4ec78749UL, 0xd1c1d938UL, 0xa2fe8ccaUL, 0x0b3698d4UL, 0x81cfa6f5UL, 0xde28a57aUL, 0x8e26dab7UL, 0xbfa43fadUL, 0x9de42c3aUL, 0x920d5078UL, 0xcc9b6a5fUL, 0x4662547eUL, 0x13c2f68dUL, 0xb8e890d8UL, 0xf75e2e39UL, 0xaff582c3UL, 0x80be9f5dUL, 0x937c69d0UL, 0x2da96fd5UL, 0x12b3cf25UL, 0x993bc8acUL, 0x7da71018UL, 0x636ee89cUL, 0xbb7bdb3bUL, 0x7809cd26UL, 0x18f46e59UL, 0xb701ec9aUL, 0x9aa8834fUL, 0x6e65e695UL, 0xe67eaaffUL, 0xcf0821bcUL, 0xe8e6ef15UL, 0x9bd9bae7UL, 0x36ce4a6fUL, 0x09d4ea9fUL, 0x7cd629b0UL, 0xb2af31a4UL, 0x23312a3fUL, 0x9430c6a5UL, 0x66c035a2UL, 0xbc37744eUL, 0xcaa6fc82UL, 0xd0b0e090UL, 0xd81533a7UL, 0x984af104UL, 0xdaf741ecUL, 0x500e7fcdUL, 0xf62f1791UL, 0xd68d764dUL, 0xb04d43efUL, 0x4d54ccaaUL, 0x04dfe496UL, 0xb5e39ed1UL, 0x881b4c6aUL, 0x1fb8c12cUL, 0x517f4665UL, 0xea049d5eUL, 0x355d018cUL, 0x7473fa87UL, 0x412efb0bUL, 0x1d5ab367UL, 0xd25292dbUL, 0x5633e910UL, 0x47136dd6UL, 0x618c9ad7UL, 0x0c7a37a1UL, 0x148e59f8UL, 0x3c89eb13UL, 0x27eecea9UL, 0xc935b761UL, 0xe5ede11cUL, 0xb13c7a47UL, 0xdf599cd2UL, 0x733f55f2UL, 0xce791814UL, 0x37bf73c7UL, 0xcdea53f7UL, 0xaa5b5ffdUL, 0x6f14df3dUL, 0xdb867844UL, 0xf381caafUL, 0xc43eb968UL, 0x342c3824UL, 0x405fc2a3UL, 0xc372161dUL, 0x250cbce2UL, 0x498b283cUL, 0x9541ff0dUL, 0x017139a8UL, 0xb3de080cUL, 0xe49cd8b4UL, 0xc1906456UL, 0x84617bcbUL, 0xb670d532UL, 0x5c74486cUL, 0x5742d0b8UL }; static const SWord32 table5[] = { 0xf4a75051UL, 0x4165537eUL, 0x17a4c31aUL, 0x275e963aUL, 0xab6bcb3bUL, 0x9d45f11fUL, 0xfa58abacUL, 0xe303934bUL, 0x30fa5520UL, 0x766df6adUL, 0xcc769188UL, 0x024c25f5UL, 0xe5d7fc4fUL, 0x2acbd7c5UL, 0x35448026UL, 0x62a38fb5UL, 0xb15a49deUL, 0xba1b6725UL, 0xea0e9845UL, 0xfec0e15dUL, 0x2f7502c3UL, 0x4cf01281UL, 0x4697a38dUL, 0xd3f9c66bUL, 0x8f5fe703UL, 0x929c9515UL, 0x6d7aebbfUL, 0x5259da95UL, 0xbe832dd4UL, 0x7421d358UL, 0xe0692949UL, 0xc9c8448eUL, 0xc2896a75UL, 0x8e7978f4UL, 0x583e6b99UL, 0xb971dd27UL, 0xe14fb6beUL, 0x88ad17f0UL, 0x20ac66c9UL, 0xce3ab47dUL, 0xdf4a1863UL, 0x1a3182e5UL, 0x51336097UL, 0x537f4562UL, 0x6477e0b1UL, 0x6bae84bbUL, 0x81a01cfeUL, 0x082b94f9UL, 0x48685870UL, 0x45fd198fUL, 0xde6c8794UL, 0x7bf8b752UL, 0x73d323abUL, 0x4b02e272UL, 0x1f8f57e3UL, 0x55ab2a66UL, 0xeb2807b2UL, 0xb5c2032fUL, 0xc57b9a86UL, 0x3708a5d3UL, 0x2887f230UL, 0xbfa5b223UL, 0x036aba02UL, 0x16825cedUL, 0xcf1c2b8aUL, 0x79b492a7UL, 0x07f2f0f3UL, 0x69e2a14eUL, 0xdaf4cd65UL, 0x05bed506UL, 0x34621fd1UL, 0xa6fe8ac4UL, 0x2e539d34UL, 0xf355a0a2UL, 0x8ae13205UL, 0xf6eb75a4UL, 0x83ec390bUL, 0x60efaa40UL, 0x719f065eUL, 0x6e1051bdUL, 0x218af93eUL, 0xdd063d96UL, 0x3e05aeddUL, 0xe6bd464dUL, 0x548db591UL, 0xc45d0571UL, 0x06d46f04UL, 0x5015ff60UL, 0x98fb2419UL, 0xbde997d6UL, 0x4043cc89UL, 0xd99e7767UL, 0xe842bdb0UL, 0x898b8807UL, 0x195b38e7UL, 0xc8eedb79UL, 0x7c0a47a1UL, 0x420fe97cUL, 0x841ec9f8UL, 0x00000000UL, 0x80868309UL, 0x2bed4832UL, 0x1170ac1eUL, 0x5a724e6cUL, 0x0efffbfdUL, 0x8538560fUL, 0xaed51e3dUL, 0x2d392736UL, 0x0fd9640aUL, 0x5ca62168UL, 0x5b54d19bUL, 0x362e3a24UL, 0x0a67b10cUL, 0x57e70f93UL, 0xee96d2b4UL, 0x9b919e1bUL, 0xc0c54f80UL, 0xdc20a261UL, 0x774b695aUL, 0x121a161cUL, 0x93ba0ae2UL, 0xa02ae5c0UL, 0x22e0433cUL, 0x1b171d12UL, 0x090d0b0eUL, 0x8bc7adf2UL, 0xb6a8b92dUL, 0x1ea9c814UL, 0xf1198557UL, 0x75074cafUL, 0x99ddbbeeUL, 0x7f60fda3UL, 0x01269ff7UL, 0x72f5bc5cUL, 0x663bc544UL, 0xfb7e345bUL, 0x4329768bUL, 0x23c6dccbUL, 0xedfc68b6UL, 0xe4f163b8UL, 0x31dccad7UL, 0x63851042UL, 0x97224013UL, 0xc6112084UL, 0x4a247d85UL, 0xbb3df8d2UL, 0xf93211aeUL, 0x29a16dc7UL, 0x9e2f4b1dUL, 0xb230f3dcUL, 0x8652ec0dUL, 0xc1e3d077UL, 0xb3166c2bUL, 0x70b999a9UL, 0x9448fa11UL, 0xe9642247UL, 0xfc8cc4a8UL, 0xf03f1aa0UL, 0x7d2cd856UL, 0x3390ef22UL, 0x494ec787UL, 0x38d1c1d9UL, 0xcaa2fe8cUL, 0xd40b3698UL, 0xf581cfa6UL, 0x7ade28a5UL, 0xb78e26daUL, 0xadbfa43fUL, 0x3a9de42cUL, 0x78920d50UL, 0x5fcc9b6aUL, 0x7e466254UL, 0x8d13c2f6UL, 0xd8b8e890UL, 0x39f75e2eUL, 0xc3aff582UL, 0x5d80be9fUL, 0xd0937c69UL, 0xd52da96fUL, 0x2512b3cfUL, 0xac993bc8UL, 0x187da710UL, 0x9c636ee8UL, 0x3bbb7bdbUL, 0x267809cdUL, 0x5918f46eUL, 0x9ab701ecUL, 0x4f9aa883UL, 0x956e65e6UL, 0xffe67eaaUL, 0xbccf0821UL, 0x15e8e6efUL, 0xe79bd9baUL, 0x6f36ce4aUL, 0x9f09d4eaUL, 0xb07cd629UL, 0xa4b2af31UL, 0x3f23312aUL, 0xa59430c6UL, 0xa266c035UL, 0x4ebc3774UL, 0x82caa6fcUL, 0x90d0b0e0UL, 0xa7d81533UL, 0x04984af1UL, 0xecdaf741UL, 0xcd500e7fUL, 0x91f62f17UL, 0x4dd68d76UL, 0xefb04d43UL, 0xaa4d54ccUL, 0x9604dfe4UL, 0xd1b5e39eUL, 0x6a881b4cUL, 0x2c1fb8c1UL, 0x65517f46UL, 0x5eea049dUL, 0x8c355d01UL, 0x877473faUL, 0x0b412efbUL, 0x671d5ab3UL, 0xdbd25292UL, 0x105633e9UL, 0xd647136dUL, 0xd7618c9aUL, 0xa10c7a37UL, 0xf8148e59UL, 0x133c89ebUL, 0xa927eeceUL, 0x61c935b7UL, 0x1ce5ede1UL, 0x47b13c7aUL, 0xd2df599cUL, 0xf2733f55UL, 0x14ce7918UL, 0xc737bf73UL, 0xf7cdea53UL, 0xfdaa5b5fUL, 0x3d6f14dfUL, 0x44db8678UL, 0xaff381caUL, 0x68c43eb9UL, 0x24342c38UL, 0xa3405fc2UL, 0x1dc37216UL, 0xe2250cbcUL, 0x3c498b28UL, 0x0d9541ffUL, 0xa8017139UL, 0x0cb3de08UL, 0xb4e49cd8UL, 0x56c19064UL, 0xcb84617bUL, 0x32b670d5UL, 0x6c5c7448UL, 0xb85742d0UL }; static const SWord8 table6[] = { 0, 14, 28, 18, 56, 54, 36, 42, 112, 126, 108, 98, 72, 70, 84, 90, 224, 238, 252, 242, 216, 214, 196, 202, 144, 158, 140, 130, 168, 166, 180, 186, 219, 213, 199, 201, 227, 237, 255, 241, 171, 165, 183, 185, 147, 157, 143, 129, 59, 53, 39, 41, 3, 13, 31, 17, 75, 69, 87, 89, 115, 125, 111, 97, 173, 163, 177, 191, 149, 155, 137, 135, 221, 211, 193, 207, 229, 235, 249, 247, 77, 67, 81, 95, 117, 123, 105, 103, 61, 51, 33, 47, 5, 11, 25, 23, 118, 120, 106, 100, 78, 64, 82, 92, 6, 8, 26, 20, 62, 48, 34, 44, 150, 152, 138, 132, 174, 160, 178, 188, 230, 232, 250, 244, 222, 208, 194, 204, 65, 79, 93, 83, 121, 119, 101, 107, 49, 63, 45, 35, 9, 7, 21, 27, 161, 175, 189, 179, 153, 151, 133, 139, 209, 223, 205, 195, 233, 231, 245, 251, 154, 148, 134, 136, 162, 172, 190, 176, 234, 228, 246, 248, 210, 220, 206, 192, 122, 116, 102, 104, 66, 76, 94, 80, 10, 4, 22, 24, 50, 60, 46, 32, 236, 226, 240, 254, 212, 218, 200, 198, 156, 146, 128, 142, 164, 170, 184, 182, 12, 2, 16, 30, 52, 58, 40, 38, 124, 114, 96, 110, 68, 74, 88, 86, 55, 57, 43, 37, 15, 1, 19, 29, 71, 73, 91, 85, 127, 113, 99, 109, 215, 217, 203, 197, 239, 225, 243, 253, 167, 169, 187, 181, 159, 145, 131, 141 }; static const SWord8 table7[] = { 0, 11, 22, 29, 44, 39, 58, 49, 88, 83, 78, 69, 116, 127, 98, 105, 176, 187, 166, 173, 156, 151, 138, 129, 232, 227, 254, 245, 196, 207, 210, 217, 123, 112, 109, 102, 87, 92, 65, 74, 35, 40, 53, 62, 15, 4, 25, 18, 203, 192, 221, 214, 231, 236, 241, 250, 147, 152, 133, 142, 191, 180, 169, 162, 246, 253, 224, 235, 218, 209, 204, 199, 174, 165, 184, 179, 130, 137, 148, 159, 70, 77, 80, 91, 106, 97, 124, 119, 30, 21, 8, 3, 50, 57, 36, 47, 141, 134, 155, 144, 161, 170, 183, 188, 213, 222, 195, 200, 249, 242, 239, 228, 61, 54, 43, 32, 17, 26, 7, 12, 101, 110, 115, 120, 73, 66, 95, 84, 247, 252, 225, 234, 219, 208, 205, 198, 175, 164, 185, 178, 131, 136, 149, 158, 71, 76, 81, 90, 107, 96, 125, 118, 31, 20, 9, 2, 51, 56, 37, 46, 140, 135, 154, 145, 160, 171, 182, 189, 212, 223, 194, 201, 248, 243, 238, 229, 60, 55, 42, 33, 16, 27, 6, 13, 100, 111, 114, 121, 72, 67, 94, 85, 1, 10, 23, 28, 45, 38, 59, 48, 89, 82, 79, 68, 117, 126, 99, 104, 177, 186, 167, 172, 157, 150, 139, 128, 233, 226, 255, 244, 197, 206, 211, 216, 122, 113, 108, 103, 86, 93, 64, 75, 34, 41, 52, 63, 14, 5, 24, 19, 202, 193, 220, 215, 230, 237, 240, 251, 146, 153, 132, 143, 190, 181, 168, 163 }; static const SWord8 table8[] = { 0, 13, 26, 23, 52, 57, 46, 35, 104, 101, 114, 127, 92, 81, 70, 75, 208, 221, 202, 199, 228, 233, 254, 243, 184, 181, 162, 175, 140, 129, 150, 155, 187, 182, 161, 172, 143, 130, 149, 152, 211, 222, 201, 196, 231, 234, 253, 240, 107, 102, 113, 124, 95, 82, 69, 72, 3, 14, 25, 20, 55, 58, 45, 32, 109, 96, 119, 122, 89, 84, 67, 78, 5, 8, 31, 18, 49, 60, 43, 38, 189, 176, 167, 170, 137, 132, 147, 158, 213, 216, 207, 194, 225, 236, 251, 246, 214, 219, 204, 193, 226, 239, 248, 245, 190, 179, 164, 169, 138, 135, 144, 157, 6, 11, 28, 17, 50, 63, 40, 37, 110, 99, 116, 121, 90, 87, 64, 77, 218, 215, 192, 205, 238, 227, 244, 249, 178, 191, 168, 165, 134, 139, 156, 145, 10, 7, 16, 29, 62, 51, 36, 41, 98, 111, 120, 117, 86, 91, 76, 65, 97, 108, 123, 118, 85, 88, 79, 66, 9, 4, 19, 30, 61, 48, 39, 42, 177, 188, 171, 166, 133, 136, 159, 146, 217, 212, 195, 206, 237, 224, 247, 250, 183, 186, 173, 160, 131, 142, 153, 148, 223, 210, 197, 200, 235, 230, 241, 252, 103, 106, 125, 112, 83, 94, 73, 68, 15, 2, 21, 24, 59, 54, 33, 44, 12, 1, 22, 27, 56, 53, 34, 47, 100, 105, 126, 115, 80, 93, 74, 71, 220, 209, 198, 203, 232, 229, 242, 255, 180, 185, 174, 163, 128, 141, 154, 151 }; static const SWord8 table9[] = { 0, 9, 18, 27, 36, 45, 54, 63, 72, 65, 90, 83, 108, 101, 126, 119, 144, 153, 130, 139, 180, 189, 166, 175, 216, 209, 202, 195, 252, 245, 238, 231, 59, 50, 41, 32, 31, 22, 13, 4, 115, 122, 97, 104, 87, 94, 69, 76, 171, 162, 185, 176, 143, 134, 157, 148, 227, 234, 241, 248, 199, 206, 213, 220, 118, 127, 100, 109, 82, 91, 64, 73, 62, 55, 44, 37, 26, 19, 8, 1, 230, 239, 244, 253, 194, 203, 208, 217, 174, 167, 188, 181, 138, 131, 152, 145, 77, 68, 95, 86, 105, 96, 123, 114, 5, 12, 23, 30, 33, 40, 51, 58, 221, 212, 207, 198, 249, 240, 235, 226, 149, 156, 135, 142, 177, 184, 163, 170, 236, 229, 254, 247, 200, 193, 218, 211, 164, 173, 182, 191, 128, 137, 146, 155, 124, 117, 110, 103, 88, 81, 74, 67, 52, 61, 38, 47, 16, 25, 2, 11, 215, 222, 197, 204, 243, 250, 225, 232, 159, 150, 141, 132, 187, 178, 169, 160, 71, 78, 85, 92, 99, 106, 113, 120, 15, 6, 29, 20, 43, 34, 57, 48, 154, 147, 136, 129, 190, 183, 172, 165, 210, 219, 192, 201, 246, 255, 228, 237, 10, 3, 24, 17, 46, 39, 60, 53, 66, 75, 80, 89, 102, 111, 116, 125, 161, 168, 179, 186, 133, 140, 151, 158, 233, 224, 251, 242, 205, 196, 223, 214, 49, 56, 35, 42, 21, 28, 7, 14, 121, 112, 107, 98, 93, 84, 79, 70 }; const SWord32 s520 = (s7 << 8) | (s7 >> 24); const SWord16 s521 = (SWord16) (s520 >> 16); const SWord8 s522 = (SWord8) (s521 >> 8); const SWord8 s523 = table2[s522]; const SWord8 s524 = 1 ^ s523; const SWord8 s525 = (SWord8) s521; const SWord8 s526 = table2[s525]; const SWord16 s527 = (((SWord16) s524) << 8) | ((SWord16) s526); const SWord16 s528 = (SWord16) s520; const SWord8 s529 = (SWord8) (s528 >> 8); const SWord8 s530 = table2[s529]; const SWord8 s531 = (SWord8) s528; const SWord8 s532 = table2[s531]; const SWord16 s533 = (((SWord16) s530) << 8) | ((SWord16) s532); const SWord32 s534 = (((SWord32) s527) << 16) | ((SWord32) s533); const SWord32 s535 = s4 ^ s534; const SWord32 s536 = s5 ^ s535; const SWord32 s537 = s6 ^ s536; const SWord32 s538 = s7 ^ s537; const SWord32 s539 = (s538 << 8) | (s538 >> 24); const SWord16 s540 = (SWord16) (s539 >> 16); const SWord8 s541 = (SWord8) (s540 >> 8); const SWord8 s542 = table2[s541]; const SWord8 s543 = 2 ^ s542; const SWord8 s544 = (SWord8) s540; const SWord8 s545 = table2[s544]; const SWord16 s546 = (((SWord16) s543) << 8) | ((SWord16) s545); const SWord16 s547 = (SWord16) s539; const SWord8 s548 = (SWord8) (s547 >> 8); const SWord8 s549 = table2[s548]; const SWord8 s550 = (SWord8) s547; const SWord8 s551 = table2[s550]; const SWord16 s552 = (((SWord16) s549) << 8) | ((SWord16) s551); const SWord32 s553 = (((SWord32) s546) << 16) | ((SWord32) s552); const SWord32 s554 = s535 ^ s553; const SWord32 s555 = s536 ^ s554; const SWord32 s556 = s537 ^ s555; const SWord32 s557 = s538 ^ s556; const SWord32 s558 = (s557 << 8) | (s557 >> 24); const SWord16 s559 = (SWord16) (s558 >> 16); const SWord8 s560 = (SWord8) (s559 >> 8); const SWord8 s561 = table2[s560]; const SWord8 s562 = 4 ^ s561; const SWord8 s563 = (SWord8) s559; const SWord8 s564 = table2[s563]; const SWord16 s565 = (((SWord16) s562) << 8) | ((SWord16) s564); const SWord16 s566 = (SWord16) s558; const SWord8 s567 = (SWord8) (s566 >> 8); const SWord8 s568 = table2[s567]; const SWord8 s569 = (SWord8) s566; const SWord8 s570 = table2[s569]; const SWord16 s571 = (((SWord16) s568) << 8) | ((SWord16) s570); const SWord32 s572 = (((SWord32) s565) << 16) | ((SWord32) s571); const SWord32 s573 = s554 ^ s572; const SWord32 s574 = s555 ^ s573; const SWord32 s575 = s556 ^ s574; const SWord32 s576 = s557 ^ s575; const SWord32 s577 = (s576 << 8) | (s576 >> 24); const SWord16 s578 = (SWord16) (s577 >> 16); const SWord8 s579 = (SWord8) (s578 >> 8); const SWord8 s580 = table2[s579]; const SWord8 s581 = 8 ^ s580; const SWord8 s582 = (SWord8) s578; const SWord8 s583 = table2[s582]; const SWord16 s584 = (((SWord16) s581) << 8) | ((SWord16) s583); const SWord16 s585 = (SWord16) s577; const SWord8 s586 = (SWord8) (s585 >> 8); const SWord8 s587 = table2[s586]; const SWord8 s588 = (SWord8) s585; const SWord8 s589 = table2[s588]; const SWord16 s590 = (((SWord16) s587) << 8) | ((SWord16) s589); const SWord32 s591 = (((SWord32) s584) << 16) | ((SWord32) s590); const SWord32 s592 = s573 ^ s591; const SWord32 s593 = s574 ^ s592; const SWord32 s594 = s575 ^ s593; const SWord32 s595 = s576 ^ s594; const SWord32 s596 = (s595 << 8) | (s595 >> 24); const SWord16 s597 = (SWord16) (s596 >> 16); const SWord8 s598 = (SWord8) (s597 >> 8); const SWord8 s599 = table2[s598]; const SWord8 s600 = 16 ^ s599; const SWord8 s601 = (SWord8) s597; const SWord8 s602 = table2[s601]; const SWord16 s603 = (((SWord16) s600) << 8) | ((SWord16) s602); const SWord16 s604 = (SWord16) s596; const SWord8 s605 = (SWord8) (s604 >> 8); const SWord8 s606 = table2[s605]; const SWord8 s607 = (SWord8) s604; const SWord8 s608 = table2[s607]; const SWord16 s609 = (((SWord16) s606) << 8) | ((SWord16) s608); const SWord32 s610 = (((SWord32) s603) << 16) | ((SWord32) s609); const SWord32 s611 = s592 ^ s610; const SWord32 s612 = s593 ^ s611; const SWord32 s613 = s594 ^ s612; const SWord32 s614 = s595 ^ s613; const SWord32 s615 = (s614 << 8) | (s614 >> 24); const SWord16 s616 = (SWord16) (s615 >> 16); const SWord8 s617 = (SWord8) (s616 >> 8); const SWord8 s618 = table2[s617]; const SWord8 s619 = 32 ^ s618; const SWord8 s620 = (SWord8) s616; const SWord8 s621 = table2[s620]; const SWord16 s622 = (((SWord16) s619) << 8) | ((SWord16) s621); const SWord16 s623 = (SWord16) s615; const SWord8 s624 = (SWord8) (s623 >> 8); const SWord8 s625 = table2[s624]; const SWord8 s626 = (SWord8) s623; const SWord8 s627 = table2[s626]; const SWord16 s628 = (((SWord16) s625) << 8) | ((SWord16) s627); const SWord32 s629 = (((SWord32) s622) << 16) | ((SWord32) s628); const SWord32 s630 = s611 ^ s629; const SWord32 s631 = s612 ^ s630; const SWord32 s632 = s613 ^ s631; const SWord32 s633 = s614 ^ s632; const SWord32 s634 = (s633 << 8) | (s633 >> 24); const SWord16 s635 = (SWord16) (s634 >> 16); const SWord8 s636 = (SWord8) (s635 >> 8); const SWord8 s637 = table2[s636]; const SWord8 s638 = 64 ^ s637; const SWord8 s639 = (SWord8) s635; const SWord8 s640 = table2[s639]; const SWord16 s641 = (((SWord16) s638) << 8) | ((SWord16) s640); const SWord16 s642 = (SWord16) s634; const SWord8 s643 = (SWord8) (s642 >> 8); const SWord8 s644 = table2[s643]; const SWord8 s645 = (SWord8) s642; const SWord8 s646 = table2[s645]; const SWord16 s647 = (((SWord16) s644) << 8) | ((SWord16) s646); const SWord32 s648 = (((SWord32) s641) << 16) | ((SWord32) s647); const SWord32 s649 = s630 ^ s648; const SWord32 s650 = s631 ^ s649; const SWord32 s651 = s632 ^ s650; const SWord32 s652 = s633 ^ s651; const SWord32 s653 = (s652 << 8) | (s652 >> 24); const SWord16 s654 = (SWord16) (s653 >> 16); const SWord8 s655 = (SWord8) (s654 >> 8); const SWord8 s656 = table2[s655]; const SWord8 s657 = 128 ^ s656; const SWord8 s658 = (SWord8) s654; const SWord8 s659 = table2[s658]; const SWord16 s660 = (((SWord16) s657) << 8) | ((SWord16) s659); const SWord16 s661 = (SWord16) s653; const SWord8 s662 = (SWord8) (s661 >> 8); const SWord8 s663 = table2[s662]; const SWord8 s664 = (SWord8) s661; const SWord8 s665 = table2[s664]; const SWord16 s666 = (((SWord16) s663) << 8) | ((SWord16) s665); const SWord32 s667 = (((SWord32) s660) << 16) | ((SWord32) s666); const SWord32 s668 = s649 ^ s667; const SWord32 s669 = s650 ^ s668; const SWord32 s670 = s651 ^ s669; const SWord32 s671 = s652 ^ s670; const SWord32 s672 = (s671 << 8) | (s671 >> 24); const SWord16 s673 = (SWord16) (s672 >> 16); const SWord8 s674 = (SWord8) (s673 >> 8); const SWord8 s675 = table2[s674]; const SWord8 s676 = 27 ^ s675; const SWord8 s677 = (SWord8) s673; const SWord8 s678 = table2[s677]; const SWord16 s679 = (((SWord16) s676) << 8) | ((SWord16) s678); const SWord16 s680 = (SWord16) s672; const SWord8 s681 = (SWord8) (s680 >> 8); const SWord8 s682 = table2[s681]; const SWord8 s683 = (SWord8) s680; const SWord8 s684 = table2[s683]; const SWord16 s685 = (((SWord16) s682) << 8) | ((SWord16) s684); const SWord32 s686 = (((SWord32) s679) << 16) | ((SWord32) s685); const SWord32 s687 = s668 ^ s686; const SWord32 s688 = s669 ^ s687; const SWord32 s689 = s670 ^ s688; const SWord32 s690 = s671 ^ s689; const SWord32 s691 = (s690 << 8) | (s690 >> 24); const SWord16 s692 = (SWord16) (s691 >> 16); const SWord8 s693 = (SWord8) (s692 >> 8); const SWord8 s694 = table2[s693]; const SWord8 s695 = 54 ^ s694; const SWord8 s696 = (SWord8) s692; const SWord8 s697 = table2[s696]; const SWord16 s698 = (((SWord16) s695) << 8) | ((SWord16) s697); const SWord16 s699 = (SWord16) s691; const SWord8 s700 = (SWord8) (s699 >> 8); const SWord8 s701 = table2[s700]; const SWord8 s702 = (SWord8) s699; const SWord8 s703 = table2[s702]; const SWord16 s704 = (((SWord16) s701) << 8) | ((SWord16) s703); const SWord32 s705 = (((SWord32) s698) << 16) | ((SWord32) s704); const SWord32 s706 = s687 ^ s705; const SWord32 s707 = s0 ^ s706; const SWord16 s708 = (SWord16) (s707 >> 16); const SWord8 s709 = (SWord8) (s708 >> 8); const SWord32 s710 = table1[s709]; const SWord32 s966 = s688 ^ s706; const SWord32 s967 = s689 ^ s966; const SWord32 s968 = s690 ^ s967; const SWord32 s969 = s3 ^ s968; const SWord16 s970 = (SWord16) (s969 >> 16); const SWord8 s971 = (SWord8) s970; const SWord32 s972 = table3[s971]; const SWord32 s973 = s710 ^ s972; const SWord32 s1229 = s2 ^ s967; const SWord16 s1230 = (SWord16) s1229; const SWord8 s1231 = (SWord8) (s1230 >> 8); const SWord32 s1232 = table4[s1231]; const SWord32 s1233 = s973 ^ s1232; const SWord32 s1489 = s1 ^ s966; const SWord16 s1490 = (SWord16) s1489; const SWord8 s1491 = (SWord8) s1490; const SWord32 s1492 = table5[s1491]; const SWord32 s1493 = s1233 ^ s1492; const SWord16 s1494 = (SWord16) (s687 >> 16); const SWord8 s1495 = (SWord8) (s1494 >> 8); const SWord8 s1496 = table6[s1495]; const SWord8 s1497 = (SWord8) s1494; const SWord8 s1498 = table7[s1497]; const SWord16 s1499 = (SWord16) s687; const SWord8 s1500 = (SWord8) (s1499 >> 8); const SWord8 s1501 = table8[s1500]; const SWord8 s1502 = (SWord8) s1499; const SWord8 s1503 = table9[s1502]; const SWord8 s1504 = s1501 ^ s1503; const SWord8 s1505 = s1498 ^ s1504; const SWord8 s1506 = s1496 ^ s1505; const SWord8 s1507 = table9[s1495]; const SWord8 s1508 = table6[s1497]; const SWord8 s1509 = table7[s1500]; const SWord8 s1510 = table8[s1502]; const SWord8 s1511 = s1509 ^ s1510; const SWord8 s1512 = s1508 ^ s1511; const SWord8 s1513 = s1507 ^ s1512; const SWord16 s1514 = (((SWord16) s1506) << 8) | ((SWord16) s1513); const SWord8 s1515 = table8[s1495]; const SWord8 s1516 = table9[s1497]; const SWord8 s1517 = table6[s1500]; const SWord8 s1518 = table7[s1502]; const SWord8 s1519 = s1517 ^ s1518; const SWord8 s1520 = s1516 ^ s1519; const SWord8 s1521 = s1515 ^ s1520; const SWord8 s1522 = table7[s1495]; const SWord8 s1523 = table8[s1497]; const SWord8 s1524 = table9[s1500]; const SWord8 s1525 = table6[s1502]; const SWord8 s1526 = s1524 ^ s1525; const SWord8 s1527 = s1523 ^ s1526; const SWord8 s1528 = s1522 ^ s1527; const SWord16 s1529 = (((SWord16) s1521) << 8) | ((SWord16) s1528); const SWord32 s1530 = (((SWord32) s1514) << 16) | ((SWord32) s1529); const SWord32 s1531 = s1493 ^ s1530; const SWord16 s1532 = (SWord16) (s1531 >> 16); const SWord8 s1533 = (SWord8) (s1532 >> 8); const SWord32 s1534 = table1[s1533]; const SWord8 s1535 = (SWord8) (s970 >> 8); const SWord32 s1536 = table1[s1535]; const SWord16 s1537 = (SWord16) (s1229 >> 16); const SWord8 s1538 = (SWord8) s1537; const SWord32 s1539 = table3[s1538]; const SWord32 s1540 = s1536 ^ s1539; const SWord8 s1541 = (SWord8) (s1490 >> 8); const SWord32 s1542 = table4[s1541]; const SWord32 s1543 = s1540 ^ s1542; const SWord16 s1544 = (SWord16) s707; const SWord8 s1545 = (SWord8) s1544; const SWord32 s1546 = table5[s1545]; const SWord32 s1547 = s1543 ^ s1546; const SWord16 s1548 = (SWord16) (s690 >> 16); const SWord8 s1549 = (SWord8) (s1548 >> 8); const SWord8 s1550 = table6[s1549]; const SWord8 s1551 = (SWord8) s1548; const SWord8 s1552 = table7[s1551]; const SWord16 s1553 = (SWord16) s690; const SWord8 s1554 = (SWord8) (s1553 >> 8); const SWord8 s1555 = table8[s1554]; const SWord8 s1556 = (SWord8) s1553; const SWord8 s1557 = table9[s1556]; const SWord8 s1558 = s1555 ^ s1557; const SWord8 s1559 = s1552 ^ s1558; const SWord8 s1560 = s1550 ^ s1559; const SWord8 s1561 = table9[s1549]; const SWord8 s1562 = table6[s1551]; const SWord8 s1563 = table7[s1554]; const SWord8 s1564 = table8[s1556]; const SWord8 s1565 = s1563 ^ s1564; const SWord8 s1566 = s1562 ^ s1565; const SWord8 s1567 = s1561 ^ s1566; const SWord16 s1568 = (((SWord16) s1560) << 8) | ((SWord16) s1567); const SWord8 s1569 = table8[s1549]; const SWord8 s1570 = table9[s1551]; const SWord8 s1571 = table6[s1554]; const SWord8 s1572 = table7[s1556]; const SWord8 s1573 = s1571 ^ s1572; const SWord8 s1574 = s1570 ^ s1573; const SWord8 s1575 = s1569 ^ s1574; const SWord8 s1576 = table7[s1549]; const SWord8 s1577 = table8[s1551]; const SWord8 s1578 = table9[s1554]; const SWord8 s1579 = table6[s1556]; const SWord8 s1580 = s1578 ^ s1579; const SWord8 s1581 = s1577 ^ s1580; const SWord8 s1582 = s1576 ^ s1581; const SWord16 s1583 = (((SWord16) s1575) << 8) | ((SWord16) s1582); const SWord32 s1584 = (((SWord32) s1568) << 16) | ((SWord32) s1583); const SWord32 s1585 = s1547 ^ s1584; const SWord16 s1586 = (SWord16) (s1585 >> 16); const SWord8 s1587 = (SWord8) s1586; const SWord32 s1588 = table3[s1587]; const SWord32 s1589 = s1534 ^ s1588; const SWord8 s1590 = (SWord8) (s1537 >> 8); const SWord32 s1591 = table1[s1590]; const SWord16 s1592 = (SWord16) (s1489 >> 16); const SWord8 s1593 = (SWord8) s1592; const SWord32 s1594 = table3[s1593]; const SWord32 s1595 = s1591 ^ s1594; const SWord8 s1596 = (SWord8) (s1544 >> 8); const SWord32 s1597 = table4[s1596]; const SWord32 s1598 = s1595 ^ s1597; const SWord16 s1599 = (SWord16) s969; const SWord8 s1600 = (SWord8) s1599; const SWord32 s1601 = table5[s1600]; const SWord32 s1602 = s1598 ^ s1601; const SWord16 s1603 = (SWord16) (s689 >> 16); const SWord8 s1604 = (SWord8) (s1603 >> 8); const SWord8 s1605 = table6[s1604]; const SWord8 s1606 = (SWord8) s1603; const SWord8 s1607 = table7[s1606]; const SWord16 s1608 = (SWord16) s689; const SWord8 s1609 = (SWord8) (s1608 >> 8); const SWord8 s1610 = table8[s1609]; const SWord8 s1611 = (SWord8) s1608; const SWord8 s1612 = table9[s1611]; const SWord8 s1613 = s1610 ^ s1612; const SWord8 s1614 = s1607 ^ s1613; const SWord8 s1615 = s1605 ^ s1614; const SWord8 s1616 = table9[s1604]; const SWord8 s1617 = table6[s1606]; const SWord8 s1618 = table7[s1609]; const SWord8 s1619 = table8[s1611]; const SWord8 s1620 = s1618 ^ s1619; const SWord8 s1621 = s1617 ^ s1620; const SWord8 s1622 = s1616 ^ s1621; const SWord16 s1623 = (((SWord16) s1615) << 8) | ((SWord16) s1622); const SWord8 s1624 = table8[s1604]; const SWord8 s1625 = table9[s1606]; const SWord8 s1626 = table6[s1609]; const SWord8 s1627 = table7[s1611]; const SWord8 s1628 = s1626 ^ s1627; const SWord8 s1629 = s1625 ^ s1628; const SWord8 s1630 = s1624 ^ s1629; const SWord8 s1631 = table7[s1604]; const SWord8 s1632 = table8[s1606]; const SWord8 s1633 = table9[s1609]; const SWord8 s1634 = table6[s1611]; const SWord8 s1635 = s1633 ^ s1634; const SWord8 s1636 = s1632 ^ s1635; const SWord8 s1637 = s1631 ^ s1636; const SWord16 s1638 = (((SWord16) s1630) << 8) | ((SWord16) s1637); const SWord32 s1639 = (((SWord32) s1623) << 16) | ((SWord32) s1638); const SWord32 s1640 = s1602 ^ s1639; const SWord16 s1641 = (SWord16) s1640; const SWord8 s1642 = (SWord8) (s1641 >> 8); const SWord32 s1643 = table4[s1642]; const SWord32 s1644 = s1589 ^ s1643; const SWord8 s1645 = (SWord8) (s1592 >> 8); const SWord32 s1646 = table1[s1645]; const SWord8 s1647 = (SWord8) s708; const SWord32 s1648 = table3[s1647]; const SWord32 s1649 = s1646 ^ s1648; const SWord8 s1650 = (SWord8) (s1599 >> 8); const SWord32 s1651 = table4[s1650]; const SWord32 s1652 = s1649 ^ s1651; const SWord8 s1653 = (SWord8) s1230; const SWord32 s1654 = table5[s1653]; const SWord32 s1655 = s1652 ^ s1654; const SWord16 s1656 = (SWord16) (s688 >> 16); const SWord8 s1657 = (SWord8) (s1656 >> 8); const SWord8 s1658 = table6[s1657]; const SWord8 s1659 = (SWord8) s1656; const SWord8 s1660 = table7[s1659]; const SWord16 s1661 = (SWord16) s688; const SWord8 s1662 = (SWord8) (s1661 >> 8); const SWord8 s1663 = table8[s1662]; const SWord8 s1664 = (SWord8) s1661; const SWord8 s1665 = table9[s1664]; const SWord8 s1666 = s1663 ^ s1665; const SWord8 s1667 = s1660 ^ s1666; const SWord8 s1668 = s1658 ^ s1667; const SWord8 s1669 = table9[s1657]; const SWord8 s1670 = table6[s1659]; const SWord8 s1671 = table7[s1662]; const SWord8 s1672 = table8[s1664]; const SWord8 s1673 = s1671 ^ s1672; const SWord8 s1674 = s1670 ^ s1673; const SWord8 s1675 = s1669 ^ s1674; const SWord16 s1676 = (((SWord16) s1668) << 8) | ((SWord16) s1675); const SWord8 s1677 = table8[s1657]; const SWord8 s1678 = table9[s1659]; const SWord8 s1679 = table6[s1662]; const SWord8 s1680 = table7[s1664]; const SWord8 s1681 = s1679 ^ s1680; const SWord8 s1682 = s1678 ^ s1681; const SWord8 s1683 = s1677 ^ s1682; const SWord8 s1684 = table7[s1657]; const SWord8 s1685 = table8[s1659]; const SWord8 s1686 = table9[s1662]; const SWord8 s1687 = table6[s1664]; const SWord8 s1688 = s1686 ^ s1687; const SWord8 s1689 = s1685 ^ s1688; const SWord8 s1690 = s1684 ^ s1689; const SWord16 s1691 = (((SWord16) s1683) << 8) | ((SWord16) s1690); const SWord32 s1692 = (((SWord32) s1676) << 16) | ((SWord32) s1691); const SWord32 s1693 = s1655 ^ s1692; const SWord16 s1694 = (SWord16) s1693; const SWord8 s1695 = (SWord8) s1694; const SWord32 s1696 = table5[s1695]; const SWord32 s1697 = s1644 ^ s1696; const SWord16 s1698 = (SWord16) (s668 >> 16); const SWord8 s1699 = (SWord8) (s1698 >> 8); const SWord8 s1700 = table6[s1699]; const SWord8 s1701 = (SWord8) s1698; const SWord8 s1702 = table7[s1701]; const SWord16 s1703 = (SWord16) s668; const SWord8 s1704 = (SWord8) (s1703 >> 8); const SWord8 s1705 = table8[s1704]; const SWord8 s1706 = (SWord8) s1703; const SWord8 s1707 = table9[s1706]; const SWord8 s1708 = s1705 ^ s1707; const SWord8 s1709 = s1702 ^ s1708; const SWord8 s1710 = s1700 ^ s1709; const SWord8 s1711 = table9[s1699]; const SWord8 s1712 = table6[s1701]; const SWord8 s1713 = table7[s1704]; const SWord8 s1714 = table8[s1706]; const SWord8 s1715 = s1713 ^ s1714; const SWord8 s1716 = s1712 ^ s1715; const SWord8 s1717 = s1711 ^ s1716; const SWord16 s1718 = (((SWord16) s1710) << 8) | ((SWord16) s1717); const SWord8 s1719 = table8[s1699]; const SWord8 s1720 = table9[s1701]; const SWord8 s1721 = table6[s1704]; const SWord8 s1722 = table7[s1706]; const SWord8 s1723 = s1721 ^ s1722; const SWord8 s1724 = s1720 ^ s1723; const SWord8 s1725 = s1719 ^ s1724; const SWord8 s1726 = table7[s1699]; const SWord8 s1727 = table8[s1701]; const SWord8 s1728 = table9[s1704]; const SWord8 s1729 = table6[s1706]; const SWord8 s1730 = s1728 ^ s1729; const SWord8 s1731 = s1727 ^ s1730; const SWord8 s1732 = s1726 ^ s1731; const SWord16 s1733 = (((SWord16) s1725) << 8) | ((SWord16) s1732); const SWord32 s1734 = (((SWord32) s1718) << 16) | ((SWord32) s1733); const SWord32 s1735 = s1697 ^ s1734; const SWord16 s1736 = (SWord16) (s1735 >> 16); const SWord8 s1737 = (SWord8) (s1736 >> 8); const SWord32 s1738 = table1[s1737]; const SWord8 s1739 = (SWord8) (s1586 >> 8); const SWord32 s1740 = table1[s1739]; const SWord16 s1741 = (SWord16) (s1640 >> 16); const SWord8 s1742 = (SWord8) s1741; const SWord32 s1743 = table3[s1742]; const SWord32 s1744 = s1740 ^ s1743; const SWord8 s1745 = (SWord8) (s1694 >> 8); const SWord32 s1746 = table4[s1745]; const SWord32 s1747 = s1744 ^ s1746; const SWord16 s1748 = (SWord16) s1531; const SWord8 s1749 = (SWord8) s1748; const SWord32 s1750 = table5[s1749]; const SWord32 s1751 = s1747 ^ s1750; const SWord16 s1752 = (SWord16) (s671 >> 16); const SWord8 s1753 = (SWord8) (s1752 >> 8); const SWord8 s1754 = table6[s1753]; const SWord8 s1755 = (SWord8) s1752; const SWord8 s1756 = table7[s1755]; const SWord16 s1757 = (SWord16) s671; const SWord8 s1758 = (SWord8) (s1757 >> 8); const SWord8 s1759 = table8[s1758]; const SWord8 s1760 = (SWord8) s1757; const SWord8 s1761 = table9[s1760]; const SWord8 s1762 = s1759 ^ s1761; const SWord8 s1763 = s1756 ^ s1762; const SWord8 s1764 = s1754 ^ s1763; const SWord8 s1765 = table9[s1753]; const SWord8 s1766 = table6[s1755]; const SWord8 s1767 = table7[s1758]; const SWord8 s1768 = table8[s1760]; const SWord8 s1769 = s1767 ^ s1768; const SWord8 s1770 = s1766 ^ s1769; const SWord8 s1771 = s1765 ^ s1770; const SWord16 s1772 = (((SWord16) s1764) << 8) | ((SWord16) s1771); const SWord8 s1773 = table8[s1753]; const SWord8 s1774 = table9[s1755]; const SWord8 s1775 = table6[s1758]; const SWord8 s1776 = table7[s1760]; const SWord8 s1777 = s1775 ^ s1776; const SWord8 s1778 = s1774 ^ s1777; const SWord8 s1779 = s1773 ^ s1778; const SWord8 s1780 = table7[s1753]; const SWord8 s1781 = table8[s1755]; const SWord8 s1782 = table9[s1758]; const SWord8 s1783 = table6[s1760]; const SWord8 s1784 = s1782 ^ s1783; const SWord8 s1785 = s1781 ^ s1784; const SWord8 s1786 = s1780 ^ s1785; const SWord16 s1787 = (((SWord16) s1779) << 8) | ((SWord16) s1786); const SWord32 s1788 = (((SWord32) s1772) << 16) | ((SWord32) s1787); const SWord32 s1789 = s1751 ^ s1788; const SWord16 s1790 = (SWord16) (s1789 >> 16); const SWord8 s1791 = (SWord8) s1790; const SWord32 s1792 = table3[s1791]; const SWord32 s1793 = s1738 ^ s1792; const SWord8 s1794 = (SWord8) (s1741 >> 8); const SWord32 s1795 = table1[s1794]; const SWord16 s1796 = (SWord16) (s1693 >> 16); const SWord8 s1797 = (SWord8) s1796; const SWord32 s1798 = table3[s1797]; const SWord32 s1799 = s1795 ^ s1798; const SWord8 s1800 = (SWord8) (s1748 >> 8); const SWord32 s1801 = table4[s1800]; const SWord32 s1802 = s1799 ^ s1801; const SWord16 s1803 = (SWord16) s1585; const SWord8 s1804 = (SWord8) s1803; const SWord32 s1805 = table5[s1804]; const SWord32 s1806 = s1802 ^ s1805; const SWord16 s1807 = (SWord16) (s670 >> 16); const SWord8 s1808 = (SWord8) (s1807 >> 8); const SWord8 s1809 = table6[s1808]; const SWord8 s1810 = (SWord8) s1807; const SWord8 s1811 = table7[s1810]; const SWord16 s1812 = (SWord16) s670; const SWord8 s1813 = (SWord8) (s1812 >> 8); const SWord8 s1814 = table8[s1813]; const SWord8 s1815 = (SWord8) s1812; const SWord8 s1816 = table9[s1815]; const SWord8 s1817 = s1814 ^ s1816; const SWord8 s1818 = s1811 ^ s1817; const SWord8 s1819 = s1809 ^ s1818; const SWord8 s1820 = table9[s1808]; const SWord8 s1821 = table6[s1810]; const SWord8 s1822 = table7[s1813]; const SWord8 s1823 = table8[s1815]; const SWord8 s1824 = s1822 ^ s1823; const SWord8 s1825 = s1821 ^ s1824; const SWord8 s1826 = s1820 ^ s1825; const SWord16 s1827 = (((SWord16) s1819) << 8) | ((SWord16) s1826); const SWord8 s1828 = table8[s1808]; const SWord8 s1829 = table9[s1810]; const SWord8 s1830 = table6[s1813]; const SWord8 s1831 = table7[s1815]; const SWord8 s1832 = s1830 ^ s1831; const SWord8 s1833 = s1829 ^ s1832; const SWord8 s1834 = s1828 ^ s1833; const SWord8 s1835 = table7[s1808]; const SWord8 s1836 = table8[s1810]; const SWord8 s1837 = table9[s1813]; const SWord8 s1838 = table6[s1815]; const SWord8 s1839 = s1837 ^ s1838; const SWord8 s1840 = s1836 ^ s1839; const SWord8 s1841 = s1835 ^ s1840; const SWord16 s1842 = (((SWord16) s1834) << 8) | ((SWord16) s1841); const SWord32 s1843 = (((SWord32) s1827) << 16) | ((SWord32) s1842); const SWord32 s1844 = s1806 ^ s1843; const SWord16 s1845 = (SWord16) s1844; const SWord8 s1846 = (SWord8) (s1845 >> 8); const SWord32 s1847 = table4[s1846]; const SWord32 s1848 = s1793 ^ s1847; const SWord8 s1849 = (SWord8) (s1796 >> 8); const SWord32 s1850 = table1[s1849]; const SWord8 s1851 = (SWord8) s1532; const SWord32 s1852 = table3[s1851]; const SWord32 s1853 = s1850 ^ s1852; const SWord8 s1854 = (SWord8) (s1803 >> 8); const SWord32 s1855 = table4[s1854]; const SWord32 s1856 = s1853 ^ s1855; const SWord8 s1857 = (SWord8) s1641; const SWord32 s1858 = table5[s1857]; const SWord32 s1859 = s1856 ^ s1858; const SWord16 s1860 = (SWord16) (s669 >> 16); const SWord8 s1861 = (SWord8) (s1860 >> 8); const SWord8 s1862 = table6[s1861]; const SWord8 s1863 = (SWord8) s1860; const SWord8 s1864 = table7[s1863]; const SWord16 s1865 = (SWord16) s669; const SWord8 s1866 = (SWord8) (s1865 >> 8); const SWord8 s1867 = table8[s1866]; const SWord8 s1868 = (SWord8) s1865; const SWord8 s1869 = table9[s1868]; const SWord8 s1870 = s1867 ^ s1869; const SWord8 s1871 = s1864 ^ s1870; const SWord8 s1872 = s1862 ^ s1871; const SWord8 s1873 = table9[s1861]; const SWord8 s1874 = table6[s1863]; const SWord8 s1875 = table7[s1866]; const SWord8 s1876 = table8[s1868]; const SWord8 s1877 = s1875 ^ s1876; const SWord8 s1878 = s1874 ^ s1877; const SWord8 s1879 = s1873 ^ s1878; const SWord16 s1880 = (((SWord16) s1872) << 8) | ((SWord16) s1879); const SWord8 s1881 = table8[s1861]; const SWord8 s1882 = table9[s1863]; const SWord8 s1883 = table6[s1866]; const SWord8 s1884 = table7[s1868]; const SWord8 s1885 = s1883 ^ s1884; const SWord8 s1886 = s1882 ^ s1885; const SWord8 s1887 = s1881 ^ s1886; const SWord8 s1888 = table7[s1861]; const SWord8 s1889 = table8[s1863]; const SWord8 s1890 = table9[s1866]; const SWord8 s1891 = table6[s1868]; const SWord8 s1892 = s1890 ^ s1891; const SWord8 s1893 = s1889 ^ s1892; const SWord8 s1894 = s1888 ^ s1893; const SWord16 s1895 = (((SWord16) s1887) << 8) | ((SWord16) s1894); const SWord32 s1896 = (((SWord32) s1880) << 16) | ((SWord32) s1895); const SWord32 s1897 = s1859 ^ s1896; const SWord16 s1898 = (SWord16) s1897; const SWord8 s1899 = (SWord8) s1898; const SWord32 s1900 = table5[s1899]; const SWord32 s1901 = s1848 ^ s1900; const SWord16 s1902 = (SWord16) (s649 >> 16); const SWord8 s1903 = (SWord8) (s1902 >> 8); const SWord8 s1904 = table6[s1903]; const SWord8 s1905 = (SWord8) s1902; const SWord8 s1906 = table7[s1905]; const SWord16 s1907 = (SWord16) s649; const SWord8 s1908 = (SWord8) (s1907 >> 8); const SWord8 s1909 = table8[s1908]; const SWord8 s1910 = (SWord8) s1907; const SWord8 s1911 = table9[s1910]; const SWord8 s1912 = s1909 ^ s1911; const SWord8 s1913 = s1906 ^ s1912; const SWord8 s1914 = s1904 ^ s1913; const SWord8 s1915 = table9[s1903]; const SWord8 s1916 = table6[s1905]; const SWord8 s1917 = table7[s1908]; const SWord8 s1918 = table8[s1910]; const SWord8 s1919 = s1917 ^ s1918; const SWord8 s1920 = s1916 ^ s1919; const SWord8 s1921 = s1915 ^ s1920; const SWord16 s1922 = (((SWord16) s1914) << 8) | ((SWord16) s1921); const SWord8 s1923 = table8[s1903]; const SWord8 s1924 = table9[s1905]; const SWord8 s1925 = table6[s1908]; const SWord8 s1926 = table7[s1910]; const SWord8 s1927 = s1925 ^ s1926; const SWord8 s1928 = s1924 ^ s1927; const SWord8 s1929 = s1923 ^ s1928; const SWord8 s1930 = table7[s1903]; const SWord8 s1931 = table8[s1905]; const SWord8 s1932 = table9[s1908]; const SWord8 s1933 = table6[s1910]; const SWord8 s1934 = s1932 ^ s1933; const SWord8 s1935 = s1931 ^ s1934; const SWord8 s1936 = s1930 ^ s1935; const SWord16 s1937 = (((SWord16) s1929) << 8) | ((SWord16) s1936); const SWord32 s1938 = (((SWord32) s1922) << 16) | ((SWord32) s1937); const SWord32 s1939 = s1901 ^ s1938; const SWord16 s1940 = (SWord16) (s1939 >> 16); const SWord8 s1941 = (SWord8) (s1940 >> 8); const SWord32 s1942 = table1[s1941]; const SWord8 s1943 = (SWord8) (s1790 >> 8); const SWord32 s1944 = table1[s1943]; const SWord16 s1945 = (SWord16) (s1844 >> 16); const SWord8 s1946 = (SWord8) s1945; const SWord32 s1947 = table3[s1946]; const SWord32 s1948 = s1944 ^ s1947; const SWord8 s1949 = (SWord8) (s1898 >> 8); const SWord32 s1950 = table4[s1949]; const SWord32 s1951 = s1948 ^ s1950; const SWord16 s1952 = (SWord16) s1735; const SWord8 s1953 = (SWord8) s1952; const SWord32 s1954 = table5[s1953]; const SWord32 s1955 = s1951 ^ s1954; const SWord16 s1956 = (SWord16) (s652 >> 16); const SWord8 s1957 = (SWord8) (s1956 >> 8); const SWord8 s1958 = table6[s1957]; const SWord8 s1959 = (SWord8) s1956; const SWord8 s1960 = table7[s1959]; const SWord16 s1961 = (SWord16) s652; const SWord8 s1962 = (SWord8) (s1961 >> 8); const SWord8 s1963 = table8[s1962]; const SWord8 s1964 = (SWord8) s1961; const SWord8 s1965 = table9[s1964]; const SWord8 s1966 = s1963 ^ s1965; const SWord8 s1967 = s1960 ^ s1966; const SWord8 s1968 = s1958 ^ s1967; const SWord8 s1969 = table9[s1957]; const SWord8 s1970 = table6[s1959]; const SWord8 s1971 = table7[s1962]; const SWord8 s1972 = table8[s1964]; const SWord8 s1973 = s1971 ^ s1972; const SWord8 s1974 = s1970 ^ s1973; const SWord8 s1975 = s1969 ^ s1974; const SWord16 s1976 = (((SWord16) s1968) << 8) | ((SWord16) s1975); const SWord8 s1977 = table8[s1957]; const SWord8 s1978 = table9[s1959]; const SWord8 s1979 = table6[s1962]; const SWord8 s1980 = table7[s1964]; const SWord8 s1981 = s1979 ^ s1980; const SWord8 s1982 = s1978 ^ s1981; const SWord8 s1983 = s1977 ^ s1982; const SWord8 s1984 = table7[s1957]; const SWord8 s1985 = table8[s1959]; const SWord8 s1986 = table9[s1962]; const SWord8 s1987 = table6[s1964]; const SWord8 s1988 = s1986 ^ s1987; const SWord8 s1989 = s1985 ^ s1988; const SWord8 s1990 = s1984 ^ s1989; const SWord16 s1991 = (((SWord16) s1983) << 8) | ((SWord16) s1990); const SWord32 s1992 = (((SWord32) s1976) << 16) | ((SWord32) s1991); const SWord32 s1993 = s1955 ^ s1992; const SWord16 s1994 = (SWord16) (s1993 >> 16); const SWord8 s1995 = (SWord8) s1994; const SWord32 s1996 = table3[s1995]; const SWord32 s1997 = s1942 ^ s1996; const SWord8 s1998 = (SWord8) (s1945 >> 8); const SWord32 s1999 = table1[s1998]; const SWord16 s2000 = (SWord16) (s1897 >> 16); const SWord8 s2001 = (SWord8) s2000; const SWord32 s2002 = table3[s2001]; const SWord32 s2003 = s1999 ^ s2002; const SWord8 s2004 = (SWord8) (s1952 >> 8); const SWord32 s2005 = table4[s2004]; const SWord32 s2006 = s2003 ^ s2005; const SWord16 s2007 = (SWord16) s1789; const SWord8 s2008 = (SWord8) s2007; const SWord32 s2009 = table5[s2008]; const SWord32 s2010 = s2006 ^ s2009; const SWord16 s2011 = (SWord16) (s651 >> 16); const SWord8 s2012 = (SWord8) (s2011 >> 8); const SWord8 s2013 = table6[s2012]; const SWord8 s2014 = (SWord8) s2011; const SWord8 s2015 = table7[s2014]; const SWord16 s2016 = (SWord16) s651; const SWord8 s2017 = (SWord8) (s2016 >> 8); const SWord8 s2018 = table8[s2017]; const SWord8 s2019 = (SWord8) s2016; const SWord8 s2020 = table9[s2019]; const SWord8 s2021 = s2018 ^ s2020; const SWord8 s2022 = s2015 ^ s2021; const SWord8 s2023 = s2013 ^ s2022; const SWord8 s2024 = table9[s2012]; const SWord8 s2025 = table6[s2014]; const SWord8 s2026 = table7[s2017]; const SWord8 s2027 = table8[s2019]; const SWord8 s2028 = s2026 ^ s2027; const SWord8 s2029 = s2025 ^ s2028; const SWord8 s2030 = s2024 ^ s2029; const SWord16 s2031 = (((SWord16) s2023) << 8) | ((SWord16) s2030); const SWord8 s2032 = table8[s2012]; const SWord8 s2033 = table9[s2014]; const SWord8 s2034 = table6[s2017]; const SWord8 s2035 = table7[s2019]; const SWord8 s2036 = s2034 ^ s2035; const SWord8 s2037 = s2033 ^ s2036; const SWord8 s2038 = s2032 ^ s2037; const SWord8 s2039 = table7[s2012]; const SWord8 s2040 = table8[s2014]; const SWord8 s2041 = table9[s2017]; const SWord8 s2042 = table6[s2019]; const SWord8 s2043 = s2041 ^ s2042; const SWord8 s2044 = s2040 ^ s2043; const SWord8 s2045 = s2039 ^ s2044; const SWord16 s2046 = (((SWord16) s2038) << 8) | ((SWord16) s2045); const SWord32 s2047 = (((SWord32) s2031) << 16) | ((SWord32) s2046); const SWord32 s2048 = s2010 ^ s2047; const SWord16 s2049 = (SWord16) s2048; const SWord8 s2050 = (SWord8) (s2049 >> 8); const SWord32 s2051 = table4[s2050]; const SWord32 s2052 = s1997 ^ s2051; const SWord8 s2053 = (SWord8) (s2000 >> 8); const SWord32 s2054 = table1[s2053]; const SWord8 s2055 = (SWord8) s1736; const SWord32 s2056 = table3[s2055]; const SWord32 s2057 = s2054 ^ s2056; const SWord8 s2058 = (SWord8) (s2007 >> 8); const SWord32 s2059 = table4[s2058]; const SWord32 s2060 = s2057 ^ s2059; const SWord8 s2061 = (SWord8) s1845; const SWord32 s2062 = table5[s2061]; const SWord32 s2063 = s2060 ^ s2062; const SWord16 s2064 = (SWord16) (s650 >> 16); const SWord8 s2065 = (SWord8) (s2064 >> 8); const SWord8 s2066 = table6[s2065]; const SWord8 s2067 = (SWord8) s2064; const SWord8 s2068 = table7[s2067]; const SWord16 s2069 = (SWord16) s650; const SWord8 s2070 = (SWord8) (s2069 >> 8); const SWord8 s2071 = table8[s2070]; const SWord8 s2072 = (SWord8) s2069; const SWord8 s2073 = table9[s2072]; const SWord8 s2074 = s2071 ^ s2073; const SWord8 s2075 = s2068 ^ s2074; const SWord8 s2076 = s2066 ^ s2075; const SWord8 s2077 = table9[s2065]; const SWord8 s2078 = table6[s2067]; const SWord8 s2079 = table7[s2070]; const SWord8 s2080 = table8[s2072]; const SWord8 s2081 = s2079 ^ s2080; const SWord8 s2082 = s2078 ^ s2081; const SWord8 s2083 = s2077 ^ s2082; const SWord16 s2084 = (((SWord16) s2076) << 8) | ((SWord16) s2083); const SWord8 s2085 = table8[s2065]; const SWord8 s2086 = table9[s2067]; const SWord8 s2087 = table6[s2070]; const SWord8 s2088 = table7[s2072]; const SWord8 s2089 = s2087 ^ s2088; const SWord8 s2090 = s2086 ^ s2089; const SWord8 s2091 = s2085 ^ s2090; const SWord8 s2092 = table7[s2065]; const SWord8 s2093 = table8[s2067]; const SWord8 s2094 = table9[s2070]; const SWord8 s2095 = table6[s2072]; const SWord8 s2096 = s2094 ^ s2095; const SWord8 s2097 = s2093 ^ s2096; const SWord8 s2098 = s2092 ^ s2097; const SWord16 s2099 = (((SWord16) s2091) << 8) | ((SWord16) s2098); const SWord32 s2100 = (((SWord32) s2084) << 16) | ((SWord32) s2099); const SWord32 s2101 = s2063 ^ s2100; const SWord16 s2102 = (SWord16) s2101; const SWord8 s2103 = (SWord8) s2102; const SWord32 s2104 = table5[s2103]; const SWord32 s2105 = s2052 ^ s2104; const SWord16 s2106 = (SWord16) (s630 >> 16); const SWord8 s2107 = (SWord8) (s2106 >> 8); const SWord8 s2108 = table6[s2107]; const SWord8 s2109 = (SWord8) s2106; const SWord8 s2110 = table7[s2109]; const SWord16 s2111 = (SWord16) s630; const SWord8 s2112 = (SWord8) (s2111 >> 8); const SWord8 s2113 = table8[s2112]; const SWord8 s2114 = (SWord8) s2111; const SWord8 s2115 = table9[s2114]; const SWord8 s2116 = s2113 ^ s2115; const SWord8 s2117 = s2110 ^ s2116; const SWord8 s2118 = s2108 ^ s2117; const SWord8 s2119 = table9[s2107]; const SWord8 s2120 = table6[s2109]; const SWord8 s2121 = table7[s2112]; const SWord8 s2122 = table8[s2114]; const SWord8 s2123 = s2121 ^ s2122; const SWord8 s2124 = s2120 ^ s2123; const SWord8 s2125 = s2119 ^ s2124; const SWord16 s2126 = (((SWord16) s2118) << 8) | ((SWord16) s2125); const SWord8 s2127 = table8[s2107]; const SWord8 s2128 = table9[s2109]; const SWord8 s2129 = table6[s2112]; const SWord8 s2130 = table7[s2114]; const SWord8 s2131 = s2129 ^ s2130; const SWord8 s2132 = s2128 ^ s2131; const SWord8 s2133 = s2127 ^ s2132; const SWord8 s2134 = table7[s2107]; const SWord8 s2135 = table8[s2109]; const SWord8 s2136 = table9[s2112]; const SWord8 s2137 = table6[s2114]; const SWord8 s2138 = s2136 ^ s2137; const SWord8 s2139 = s2135 ^ s2138; const SWord8 s2140 = s2134 ^ s2139; const SWord16 s2141 = (((SWord16) s2133) << 8) | ((SWord16) s2140); const SWord32 s2142 = (((SWord32) s2126) << 16) | ((SWord32) s2141); const SWord32 s2143 = s2105 ^ s2142; const SWord16 s2144 = (SWord16) (s2143 >> 16); const SWord8 s2145 = (SWord8) (s2144 >> 8); const SWord32 s2146 = table1[s2145]; const SWord8 s2147 = (SWord8) (s1994 >> 8); const SWord32 s2148 = table1[s2147]; const SWord16 s2149 = (SWord16) (s2048 >> 16); const SWord8 s2150 = (SWord8) s2149; const SWord32 s2151 = table3[s2150]; const SWord32 s2152 = s2148 ^ s2151; const SWord8 s2153 = (SWord8) (s2102 >> 8); const SWord32 s2154 = table4[s2153]; const SWord32 s2155 = s2152 ^ s2154; const SWord16 s2156 = (SWord16) s1939; const SWord8 s2157 = (SWord8) s2156; const SWord32 s2158 = table5[s2157]; const SWord32 s2159 = s2155 ^ s2158; const SWord16 s2160 = (SWord16) (s633 >> 16); const SWord8 s2161 = (SWord8) (s2160 >> 8); const SWord8 s2162 = table6[s2161]; const SWord8 s2163 = (SWord8) s2160; const SWord8 s2164 = table7[s2163]; const SWord16 s2165 = (SWord16) s633; const SWord8 s2166 = (SWord8) (s2165 >> 8); const SWord8 s2167 = table8[s2166]; const SWord8 s2168 = (SWord8) s2165; const SWord8 s2169 = table9[s2168]; const SWord8 s2170 = s2167 ^ s2169; const SWord8 s2171 = s2164 ^ s2170; const SWord8 s2172 = s2162 ^ s2171; const SWord8 s2173 = table9[s2161]; const SWord8 s2174 = table6[s2163]; const SWord8 s2175 = table7[s2166]; const SWord8 s2176 = table8[s2168]; const SWord8 s2177 = s2175 ^ s2176; const SWord8 s2178 = s2174 ^ s2177; const SWord8 s2179 = s2173 ^ s2178; const SWord16 s2180 = (((SWord16) s2172) << 8) | ((SWord16) s2179); const SWord8 s2181 = table8[s2161]; const SWord8 s2182 = table9[s2163]; const SWord8 s2183 = table6[s2166]; const SWord8 s2184 = table7[s2168]; const SWord8 s2185 = s2183 ^ s2184; const SWord8 s2186 = s2182 ^ s2185; const SWord8 s2187 = s2181 ^ s2186; const SWord8 s2188 = table7[s2161]; const SWord8 s2189 = table8[s2163]; const SWord8 s2190 = table9[s2166]; const SWord8 s2191 = table6[s2168]; const SWord8 s2192 = s2190 ^ s2191; const SWord8 s2193 = s2189 ^ s2192; const SWord8 s2194 = s2188 ^ s2193; const SWord16 s2195 = (((SWord16) s2187) << 8) | ((SWord16) s2194); const SWord32 s2196 = (((SWord32) s2180) << 16) | ((SWord32) s2195); const SWord32 s2197 = s2159 ^ s2196; const SWord16 s2198 = (SWord16) (s2197 >> 16); const SWord8 s2199 = (SWord8) s2198; const SWord32 s2200 = table3[s2199]; const SWord32 s2201 = s2146 ^ s2200; const SWord8 s2202 = (SWord8) (s2149 >> 8); const SWord32 s2203 = table1[s2202]; const SWord16 s2204 = (SWord16) (s2101 >> 16); const SWord8 s2205 = (SWord8) s2204; const SWord32 s2206 = table3[s2205]; const SWord32 s2207 = s2203 ^ s2206; const SWord8 s2208 = (SWord8) (s2156 >> 8); const SWord32 s2209 = table4[s2208]; const SWord32 s2210 = s2207 ^ s2209; const SWord16 s2211 = (SWord16) s1993; const SWord8 s2212 = (SWord8) s2211; const SWord32 s2213 = table5[s2212]; const SWord32 s2214 = s2210 ^ s2213; const SWord16 s2215 = (SWord16) (s632 >> 16); const SWord8 s2216 = (SWord8) (s2215 >> 8); const SWord8 s2217 = table6[s2216]; const SWord8 s2218 = (SWord8) s2215; const SWord8 s2219 = table7[s2218]; const SWord16 s2220 = (SWord16) s632; const SWord8 s2221 = (SWord8) (s2220 >> 8); const SWord8 s2222 = table8[s2221]; const SWord8 s2223 = (SWord8) s2220; const SWord8 s2224 = table9[s2223]; const SWord8 s2225 = s2222 ^ s2224; const SWord8 s2226 = s2219 ^ s2225; const SWord8 s2227 = s2217 ^ s2226; const SWord8 s2228 = table9[s2216]; const SWord8 s2229 = table6[s2218]; const SWord8 s2230 = table7[s2221]; const SWord8 s2231 = table8[s2223]; const SWord8 s2232 = s2230 ^ s2231; const SWord8 s2233 = s2229 ^ s2232; const SWord8 s2234 = s2228 ^ s2233; const SWord16 s2235 = (((SWord16) s2227) << 8) | ((SWord16) s2234); const SWord8 s2236 = table8[s2216]; const SWord8 s2237 = table9[s2218]; const SWord8 s2238 = table6[s2221]; const SWord8 s2239 = table7[s2223]; const SWord8 s2240 = s2238 ^ s2239; const SWord8 s2241 = s2237 ^ s2240; const SWord8 s2242 = s2236 ^ s2241; const SWord8 s2243 = table7[s2216]; const SWord8 s2244 = table8[s2218]; const SWord8 s2245 = table9[s2221]; const SWord8 s2246 = table6[s2223]; const SWord8 s2247 = s2245 ^ s2246; const SWord8 s2248 = s2244 ^ s2247; const SWord8 s2249 = s2243 ^ s2248; const SWord16 s2250 = (((SWord16) s2242) << 8) | ((SWord16) s2249); const SWord32 s2251 = (((SWord32) s2235) << 16) | ((SWord32) s2250); const SWord32 s2252 = s2214 ^ s2251; const SWord16 s2253 = (SWord16) s2252; const SWord8 s2254 = (SWord8) (s2253 >> 8); const SWord32 s2255 = table4[s2254]; const SWord32 s2256 = s2201 ^ s2255; const SWord8 s2257 = (SWord8) (s2204 >> 8); const SWord32 s2258 = table1[s2257]; const SWord8 s2259 = (SWord8) s1940; const SWord32 s2260 = table3[s2259]; const SWord32 s2261 = s2258 ^ s2260; const SWord8 s2262 = (SWord8) (s2211 >> 8); const SWord32 s2263 = table4[s2262]; const SWord32 s2264 = s2261 ^ s2263; const SWord8 s2265 = (SWord8) s2049; const SWord32 s2266 = table5[s2265]; const SWord32 s2267 = s2264 ^ s2266; const SWord16 s2268 = (SWord16) (s631 >> 16); const SWord8 s2269 = (SWord8) (s2268 >> 8); const SWord8 s2270 = table6[s2269]; const SWord8 s2271 = (SWord8) s2268; const SWord8 s2272 = table7[s2271]; const SWord16 s2273 = (SWord16) s631; const SWord8 s2274 = (SWord8) (s2273 >> 8); const SWord8 s2275 = table8[s2274]; const SWord8 s2276 = (SWord8) s2273; const SWord8 s2277 = table9[s2276]; const SWord8 s2278 = s2275 ^ s2277; const SWord8 s2279 = s2272 ^ s2278; const SWord8 s2280 = s2270 ^ s2279; const SWord8 s2281 = table9[s2269]; const SWord8 s2282 = table6[s2271]; const SWord8 s2283 = table7[s2274]; const SWord8 s2284 = table8[s2276]; const SWord8 s2285 = s2283 ^ s2284; const SWord8 s2286 = s2282 ^ s2285; const SWord8 s2287 = s2281 ^ s2286; const SWord16 s2288 = (((SWord16) s2280) << 8) | ((SWord16) s2287); const SWord8 s2289 = table8[s2269]; const SWord8 s2290 = table9[s2271]; const SWord8 s2291 = table6[s2274]; const SWord8 s2292 = table7[s2276]; const SWord8 s2293 = s2291 ^ s2292; const SWord8 s2294 = s2290 ^ s2293; const SWord8 s2295 = s2289 ^ s2294; const SWord8 s2296 = table7[s2269]; const SWord8 s2297 = table8[s2271]; const SWord8 s2298 = table9[s2274]; const SWord8 s2299 = table6[s2276]; const SWord8 s2300 = s2298 ^ s2299; const SWord8 s2301 = s2297 ^ s2300; const SWord8 s2302 = s2296 ^ s2301; const SWord16 s2303 = (((SWord16) s2295) << 8) | ((SWord16) s2302); const SWord32 s2304 = (((SWord32) s2288) << 16) | ((SWord32) s2303); const SWord32 s2305 = s2267 ^ s2304; const SWord16 s2306 = (SWord16) s2305; const SWord8 s2307 = (SWord8) s2306; const SWord32 s2308 = table5[s2307]; const SWord32 s2309 = s2256 ^ s2308; const SWord16 s2310 = (SWord16) (s611 >> 16); const SWord8 s2311 = (SWord8) (s2310 >> 8); const SWord8 s2312 = table6[s2311]; const SWord8 s2313 = (SWord8) s2310; const SWord8 s2314 = table7[s2313]; const SWord16 s2315 = (SWord16) s611; const SWord8 s2316 = (SWord8) (s2315 >> 8); const SWord8 s2317 = table8[s2316]; const SWord8 s2318 = (SWord8) s2315; const SWord8 s2319 = table9[s2318]; const SWord8 s2320 = s2317 ^ s2319; const SWord8 s2321 = s2314 ^ s2320; const SWord8 s2322 = s2312 ^ s2321; const SWord8 s2323 = table9[s2311]; const SWord8 s2324 = table6[s2313]; const SWord8 s2325 = table7[s2316]; const SWord8 s2326 = table8[s2318]; const SWord8 s2327 = s2325 ^ s2326; const SWord8 s2328 = s2324 ^ s2327; const SWord8 s2329 = s2323 ^ s2328; const SWord16 s2330 = (((SWord16) s2322) << 8) | ((SWord16) s2329); const SWord8 s2331 = table8[s2311]; const SWord8 s2332 = table9[s2313]; const SWord8 s2333 = table6[s2316]; const SWord8 s2334 = table7[s2318]; const SWord8 s2335 = s2333 ^ s2334; const SWord8 s2336 = s2332 ^ s2335; const SWord8 s2337 = s2331 ^ s2336; const SWord8 s2338 = table7[s2311]; const SWord8 s2339 = table8[s2313]; const SWord8 s2340 = table9[s2316]; const SWord8 s2341 = table6[s2318]; const SWord8 s2342 = s2340 ^ s2341; const SWord8 s2343 = s2339 ^ s2342; const SWord8 s2344 = s2338 ^ s2343; const SWord16 s2345 = (((SWord16) s2337) << 8) | ((SWord16) s2344); const SWord32 s2346 = (((SWord32) s2330) << 16) | ((SWord32) s2345); const SWord32 s2347 = s2309 ^ s2346; const SWord16 s2348 = (SWord16) (s2347 >> 16); const SWord8 s2349 = (SWord8) (s2348 >> 8); const SWord32 s2350 = table1[s2349]; const SWord8 s2351 = (SWord8) (s2198 >> 8); const SWord32 s2352 = table1[s2351]; const SWord16 s2353 = (SWord16) (s2252 >> 16); const SWord8 s2354 = (SWord8) s2353; const SWord32 s2355 = table3[s2354]; const SWord32 s2356 = s2352 ^ s2355; const SWord8 s2357 = (SWord8) (s2306 >> 8); const SWord32 s2358 = table4[s2357]; const SWord32 s2359 = s2356 ^ s2358; const SWord16 s2360 = (SWord16) s2143; const SWord8 s2361 = (SWord8) s2360; const SWord32 s2362 = table5[s2361]; const SWord32 s2363 = s2359 ^ s2362; const SWord16 s2364 = (SWord16) (s614 >> 16); const SWord8 s2365 = (SWord8) (s2364 >> 8); const SWord8 s2366 = table6[s2365]; const SWord8 s2367 = (SWord8) s2364; const SWord8 s2368 = table7[s2367]; const SWord16 s2369 = (SWord16) s614; const SWord8 s2370 = (SWord8) (s2369 >> 8); const SWord8 s2371 = table8[s2370]; const SWord8 s2372 = (SWord8) s2369; const SWord8 s2373 = table9[s2372]; const SWord8 s2374 = s2371 ^ s2373; const SWord8 s2375 = s2368 ^ s2374; const SWord8 s2376 = s2366 ^ s2375; const SWord8 s2377 = table9[s2365]; const SWord8 s2378 = table6[s2367]; const SWord8 s2379 = table7[s2370]; const SWord8 s2380 = table8[s2372]; const SWord8 s2381 = s2379 ^ s2380; const SWord8 s2382 = s2378 ^ s2381; const SWord8 s2383 = s2377 ^ s2382; const SWord16 s2384 = (((SWord16) s2376) << 8) | ((SWord16) s2383); const SWord8 s2385 = table8[s2365]; const SWord8 s2386 = table9[s2367]; const SWord8 s2387 = table6[s2370]; const SWord8 s2388 = table7[s2372]; const SWord8 s2389 = s2387 ^ s2388; const SWord8 s2390 = s2386 ^ s2389; const SWord8 s2391 = s2385 ^ s2390; const SWord8 s2392 = table7[s2365]; const SWord8 s2393 = table8[s2367]; const SWord8 s2394 = table9[s2370]; const SWord8 s2395 = table6[s2372]; const SWord8 s2396 = s2394 ^ s2395; const SWord8 s2397 = s2393 ^ s2396; const SWord8 s2398 = s2392 ^ s2397; const SWord16 s2399 = (((SWord16) s2391) << 8) | ((SWord16) s2398); const SWord32 s2400 = (((SWord32) s2384) << 16) | ((SWord32) s2399); const SWord32 s2401 = s2363 ^ s2400; const SWord16 s2402 = (SWord16) (s2401 >> 16); const SWord8 s2403 = (SWord8) s2402; const SWord32 s2404 = table3[s2403]; const SWord32 s2405 = s2350 ^ s2404; const SWord8 s2406 = (SWord8) (s2353 >> 8); const SWord32 s2407 = table1[s2406]; const SWord16 s2408 = (SWord16) (s2305 >> 16); const SWord8 s2409 = (SWord8) s2408; const SWord32 s2410 = table3[s2409]; const SWord32 s2411 = s2407 ^ s2410; const SWord8 s2412 = (SWord8) (s2360 >> 8); const SWord32 s2413 = table4[s2412]; const SWord32 s2414 = s2411 ^ s2413; const SWord16 s2415 = (SWord16) s2197; const SWord8 s2416 = (SWord8) s2415; const SWord32 s2417 = table5[s2416]; const SWord32 s2418 = s2414 ^ s2417; const SWord16 s2419 = (SWord16) (s613 >> 16); const SWord8 s2420 = (SWord8) (s2419 >> 8); const SWord8 s2421 = table6[s2420]; const SWord8 s2422 = (SWord8) s2419; const SWord8 s2423 = table7[s2422]; const SWord16 s2424 = (SWord16) s613; const SWord8 s2425 = (SWord8) (s2424 >> 8); const SWord8 s2426 = table8[s2425]; const SWord8 s2427 = (SWord8) s2424; const SWord8 s2428 = table9[s2427]; const SWord8 s2429 = s2426 ^ s2428; const SWord8 s2430 = s2423 ^ s2429; const SWord8 s2431 = s2421 ^ s2430; const SWord8 s2432 = table9[s2420]; const SWord8 s2433 = table6[s2422]; const SWord8 s2434 = table7[s2425]; const SWord8 s2435 = table8[s2427]; const SWord8 s2436 = s2434 ^ s2435; const SWord8 s2437 = s2433 ^ s2436; const SWord8 s2438 = s2432 ^ s2437; const SWord16 s2439 = (((SWord16) s2431) << 8) | ((SWord16) s2438); const SWord8 s2440 = table8[s2420]; const SWord8 s2441 = table9[s2422]; const SWord8 s2442 = table6[s2425]; const SWord8 s2443 = table7[s2427]; const SWord8 s2444 = s2442 ^ s2443; const SWord8 s2445 = s2441 ^ s2444; const SWord8 s2446 = s2440 ^ s2445; const SWord8 s2447 = table7[s2420]; const SWord8 s2448 = table8[s2422]; const SWord8 s2449 = table9[s2425]; const SWord8 s2450 = table6[s2427]; const SWord8 s2451 = s2449 ^ s2450; const SWord8 s2452 = s2448 ^ s2451; const SWord8 s2453 = s2447 ^ s2452; const SWord16 s2454 = (((SWord16) s2446) << 8) | ((SWord16) s2453); const SWord32 s2455 = (((SWord32) s2439) << 16) | ((SWord32) s2454); const SWord32 s2456 = s2418 ^ s2455; const SWord16 s2457 = (SWord16) s2456; const SWord8 s2458 = (SWord8) (s2457 >> 8); const SWord32 s2459 = table4[s2458]; const SWord32 s2460 = s2405 ^ s2459; const SWord8 s2461 = (SWord8) (s2408 >> 8); const SWord32 s2462 = table1[s2461]; const SWord8 s2463 = (SWord8) s2144; const SWord32 s2464 = table3[s2463]; const SWord32 s2465 = s2462 ^ s2464; const SWord8 s2466 = (SWord8) (s2415 >> 8); const SWord32 s2467 = table4[s2466]; const SWord32 s2468 = s2465 ^ s2467; const SWord8 s2469 = (SWord8) s2253; const SWord32 s2470 = table5[s2469]; const SWord32 s2471 = s2468 ^ s2470; const SWord16 s2472 = (SWord16) (s612 >> 16); const SWord8 s2473 = (SWord8) (s2472 >> 8); const SWord8 s2474 = table6[s2473]; const SWord8 s2475 = (SWord8) s2472; const SWord8 s2476 = table7[s2475]; const SWord16 s2477 = (SWord16) s612; const SWord8 s2478 = (SWord8) (s2477 >> 8); const SWord8 s2479 = table8[s2478]; const SWord8 s2480 = (SWord8) s2477; const SWord8 s2481 = table9[s2480]; const SWord8 s2482 = s2479 ^ s2481; const SWord8 s2483 = s2476 ^ s2482; const SWord8 s2484 = s2474 ^ s2483; const SWord8 s2485 = table9[s2473]; const SWord8 s2486 = table6[s2475]; const SWord8 s2487 = table7[s2478]; const SWord8 s2488 = table8[s2480]; const SWord8 s2489 = s2487 ^ s2488; const SWord8 s2490 = s2486 ^ s2489; const SWord8 s2491 = s2485 ^ s2490; const SWord16 s2492 = (((SWord16) s2484) << 8) | ((SWord16) s2491); const SWord8 s2493 = table8[s2473]; const SWord8 s2494 = table9[s2475]; const SWord8 s2495 = table6[s2478]; const SWord8 s2496 = table7[s2480]; const SWord8 s2497 = s2495 ^ s2496; const SWord8 s2498 = s2494 ^ s2497; const SWord8 s2499 = s2493 ^ s2498; const SWord8 s2500 = table7[s2473]; const SWord8 s2501 = table8[s2475]; const SWord8 s2502 = table9[s2478]; const SWord8 s2503 = table6[s2480]; const SWord8 s2504 = s2502 ^ s2503; const SWord8 s2505 = s2501 ^ s2504; const SWord8 s2506 = s2500 ^ s2505; const SWord16 s2507 = (((SWord16) s2499) << 8) | ((SWord16) s2506); const SWord32 s2508 = (((SWord32) s2492) << 16) | ((SWord32) s2507); const SWord32 s2509 = s2471 ^ s2508; const SWord16 s2510 = (SWord16) s2509; const SWord8 s2511 = (SWord8) s2510; const SWord32 s2512 = table5[s2511]; const SWord32 s2513 = s2460 ^ s2512; const SWord16 s2514 = (SWord16) (s592 >> 16); const SWord8 s2515 = (SWord8) (s2514 >> 8); const SWord8 s2516 = table6[s2515]; const SWord8 s2517 = (SWord8) s2514; const SWord8 s2518 = table7[s2517]; const SWord16 s2519 = (SWord16) s592; const SWord8 s2520 = (SWord8) (s2519 >> 8); const SWord8 s2521 = table8[s2520]; const SWord8 s2522 = (SWord8) s2519; const SWord8 s2523 = table9[s2522]; const SWord8 s2524 = s2521 ^ s2523; const SWord8 s2525 = s2518 ^ s2524; const SWord8 s2526 = s2516 ^ s2525; const SWord8 s2527 = table9[s2515]; const SWord8 s2528 = table6[s2517]; const SWord8 s2529 = table7[s2520]; const SWord8 s2530 = table8[s2522]; const SWord8 s2531 = s2529 ^ s2530; const SWord8 s2532 = s2528 ^ s2531; const SWord8 s2533 = s2527 ^ s2532; const SWord16 s2534 = (((SWord16) s2526) << 8) | ((SWord16) s2533); const SWord8 s2535 = table8[s2515]; const SWord8 s2536 = table9[s2517]; const SWord8 s2537 = table6[s2520]; const SWord8 s2538 = table7[s2522]; const SWord8 s2539 = s2537 ^ s2538; const SWord8 s2540 = s2536 ^ s2539; const SWord8 s2541 = s2535 ^ s2540; const SWord8 s2542 = table7[s2515]; const SWord8 s2543 = table8[s2517]; const SWord8 s2544 = table9[s2520]; const SWord8 s2545 = table6[s2522]; const SWord8 s2546 = s2544 ^ s2545; const SWord8 s2547 = s2543 ^ s2546; const SWord8 s2548 = s2542 ^ s2547; const SWord16 s2549 = (((SWord16) s2541) << 8) | ((SWord16) s2548); const SWord32 s2550 = (((SWord32) s2534) << 16) | ((SWord32) s2549); const SWord32 s2551 = s2513 ^ s2550; const SWord16 s2552 = (SWord16) (s2551 >> 16); const SWord8 s2553 = (SWord8) (s2552 >> 8); const SWord32 s2554 = table1[s2553]; const SWord8 s2555 = (SWord8) (s2402 >> 8); const SWord32 s2556 = table1[s2555]; const SWord16 s2557 = (SWord16) (s2456 >> 16); const SWord8 s2558 = (SWord8) s2557; const SWord32 s2559 = table3[s2558]; const SWord32 s2560 = s2556 ^ s2559; const SWord8 s2561 = (SWord8) (s2510 >> 8); const SWord32 s2562 = table4[s2561]; const SWord32 s2563 = s2560 ^ s2562; const SWord16 s2564 = (SWord16) s2347; const SWord8 s2565 = (SWord8) s2564; const SWord32 s2566 = table5[s2565]; const SWord32 s2567 = s2563 ^ s2566; const SWord16 s2568 = (SWord16) (s595 >> 16); const SWord8 s2569 = (SWord8) (s2568 >> 8); const SWord8 s2570 = table6[s2569]; const SWord8 s2571 = (SWord8) s2568; const SWord8 s2572 = table7[s2571]; const SWord16 s2573 = (SWord16) s595; const SWord8 s2574 = (SWord8) (s2573 >> 8); const SWord8 s2575 = table8[s2574]; const SWord8 s2576 = (SWord8) s2573; const SWord8 s2577 = table9[s2576]; const SWord8 s2578 = s2575 ^ s2577; const SWord8 s2579 = s2572 ^ s2578; const SWord8 s2580 = s2570 ^ s2579; const SWord8 s2581 = table9[s2569]; const SWord8 s2582 = table6[s2571]; const SWord8 s2583 = table7[s2574]; const SWord8 s2584 = table8[s2576]; const SWord8 s2585 = s2583 ^ s2584; const SWord8 s2586 = s2582 ^ s2585; const SWord8 s2587 = s2581 ^ s2586; const SWord16 s2588 = (((SWord16) s2580) << 8) | ((SWord16) s2587); const SWord8 s2589 = table8[s2569]; const SWord8 s2590 = table9[s2571]; const SWord8 s2591 = table6[s2574]; const SWord8 s2592 = table7[s2576]; const SWord8 s2593 = s2591 ^ s2592; const SWord8 s2594 = s2590 ^ s2593; const SWord8 s2595 = s2589 ^ s2594; const SWord8 s2596 = table7[s2569]; const SWord8 s2597 = table8[s2571]; const SWord8 s2598 = table9[s2574]; const SWord8 s2599 = table6[s2576]; const SWord8 s2600 = s2598 ^ s2599; const SWord8 s2601 = s2597 ^ s2600; const SWord8 s2602 = s2596 ^ s2601; const SWord16 s2603 = (((SWord16) s2595) << 8) | ((SWord16) s2602); const SWord32 s2604 = (((SWord32) s2588) << 16) | ((SWord32) s2603); const SWord32 s2605 = s2567 ^ s2604; const SWord16 s2606 = (SWord16) (s2605 >> 16); const SWord8 s2607 = (SWord8) s2606; const SWord32 s2608 = table3[s2607]; const SWord32 s2609 = s2554 ^ s2608; const SWord8 s2610 = (SWord8) (s2557 >> 8); const SWord32 s2611 = table1[s2610]; const SWord16 s2612 = (SWord16) (s2509 >> 16); const SWord8 s2613 = (SWord8) s2612; const SWord32 s2614 = table3[s2613]; const SWord32 s2615 = s2611 ^ s2614; const SWord8 s2616 = (SWord8) (s2564 >> 8); const SWord32 s2617 = table4[s2616]; const SWord32 s2618 = s2615 ^ s2617; const SWord16 s2619 = (SWord16) s2401; const SWord8 s2620 = (SWord8) s2619; const SWord32 s2621 = table5[s2620]; const SWord32 s2622 = s2618 ^ s2621; const SWord16 s2623 = (SWord16) (s594 >> 16); const SWord8 s2624 = (SWord8) (s2623 >> 8); const SWord8 s2625 = table6[s2624]; const SWord8 s2626 = (SWord8) s2623; const SWord8 s2627 = table7[s2626]; const SWord16 s2628 = (SWord16) s594; const SWord8 s2629 = (SWord8) (s2628 >> 8); const SWord8 s2630 = table8[s2629]; const SWord8 s2631 = (SWord8) s2628; const SWord8 s2632 = table9[s2631]; const SWord8 s2633 = s2630 ^ s2632; const SWord8 s2634 = s2627 ^ s2633; const SWord8 s2635 = s2625 ^ s2634; const SWord8 s2636 = table9[s2624]; const SWord8 s2637 = table6[s2626]; const SWord8 s2638 = table7[s2629]; const SWord8 s2639 = table8[s2631]; const SWord8 s2640 = s2638 ^ s2639; const SWord8 s2641 = s2637 ^ s2640; const SWord8 s2642 = s2636 ^ s2641; const SWord16 s2643 = (((SWord16) s2635) << 8) | ((SWord16) s2642); const SWord8 s2644 = table8[s2624]; const SWord8 s2645 = table9[s2626]; const SWord8 s2646 = table6[s2629]; const SWord8 s2647 = table7[s2631]; const SWord8 s2648 = s2646 ^ s2647; const SWord8 s2649 = s2645 ^ s2648; const SWord8 s2650 = s2644 ^ s2649; const SWord8 s2651 = table7[s2624]; const SWord8 s2652 = table8[s2626]; const SWord8 s2653 = table9[s2629]; const SWord8 s2654 = table6[s2631]; const SWord8 s2655 = s2653 ^ s2654; const SWord8 s2656 = s2652 ^ s2655; const SWord8 s2657 = s2651 ^ s2656; const SWord16 s2658 = (((SWord16) s2650) << 8) | ((SWord16) s2657); const SWord32 s2659 = (((SWord32) s2643) << 16) | ((SWord32) s2658); const SWord32 s2660 = s2622 ^ s2659; const SWord16 s2661 = (SWord16) s2660; const SWord8 s2662 = (SWord8) (s2661 >> 8); const SWord32 s2663 = table4[s2662]; const SWord32 s2664 = s2609 ^ s2663; const SWord8 s2665 = (SWord8) (s2612 >> 8); const SWord32 s2666 = table1[s2665]; const SWord8 s2667 = (SWord8) s2348; const SWord32 s2668 = table3[s2667]; const SWord32 s2669 = s2666 ^ s2668; const SWord8 s2670 = (SWord8) (s2619 >> 8); const SWord32 s2671 = table4[s2670]; const SWord32 s2672 = s2669 ^ s2671; const SWord8 s2673 = (SWord8) s2457; const SWord32 s2674 = table5[s2673]; const SWord32 s2675 = s2672 ^ s2674; const SWord16 s2676 = (SWord16) (s593 >> 16); const SWord8 s2677 = (SWord8) (s2676 >> 8); const SWord8 s2678 = table6[s2677]; const SWord8 s2679 = (SWord8) s2676; const SWord8 s2680 = table7[s2679]; const SWord16 s2681 = (SWord16) s593; const SWord8 s2682 = (SWord8) (s2681 >> 8); const SWord8 s2683 = table8[s2682]; const SWord8 s2684 = (SWord8) s2681; const SWord8 s2685 = table9[s2684]; const SWord8 s2686 = s2683 ^ s2685; const SWord8 s2687 = s2680 ^ s2686; const SWord8 s2688 = s2678 ^ s2687; const SWord8 s2689 = table9[s2677]; const SWord8 s2690 = table6[s2679]; const SWord8 s2691 = table7[s2682]; const SWord8 s2692 = table8[s2684]; const SWord8 s2693 = s2691 ^ s2692; const SWord8 s2694 = s2690 ^ s2693; const SWord8 s2695 = s2689 ^ s2694; const SWord16 s2696 = (((SWord16) s2688) << 8) | ((SWord16) s2695); const SWord8 s2697 = table8[s2677]; const SWord8 s2698 = table9[s2679]; const SWord8 s2699 = table6[s2682]; const SWord8 s2700 = table7[s2684]; const SWord8 s2701 = s2699 ^ s2700; const SWord8 s2702 = s2698 ^ s2701; const SWord8 s2703 = s2697 ^ s2702; const SWord8 s2704 = table7[s2677]; const SWord8 s2705 = table8[s2679]; const SWord8 s2706 = table9[s2682]; const SWord8 s2707 = table6[s2684]; const SWord8 s2708 = s2706 ^ s2707; const SWord8 s2709 = s2705 ^ s2708; const SWord8 s2710 = s2704 ^ s2709; const SWord16 s2711 = (((SWord16) s2703) << 8) | ((SWord16) s2710); const SWord32 s2712 = (((SWord32) s2696) << 16) | ((SWord32) s2711); const SWord32 s2713 = s2675 ^ s2712; const SWord16 s2714 = (SWord16) s2713; const SWord8 s2715 = (SWord8) s2714; const SWord32 s2716 = table5[s2715]; const SWord32 s2717 = s2664 ^ s2716; const SWord16 s2718 = (SWord16) (s573 >> 16); const SWord8 s2719 = (SWord8) (s2718 >> 8); const SWord8 s2720 = table6[s2719]; const SWord8 s2721 = (SWord8) s2718; const SWord8 s2722 = table7[s2721]; const SWord16 s2723 = (SWord16) s573; const SWord8 s2724 = (SWord8) (s2723 >> 8); const SWord8 s2725 = table8[s2724]; const SWord8 s2726 = (SWord8) s2723; const SWord8 s2727 = table9[s2726]; const SWord8 s2728 = s2725 ^ s2727; const SWord8 s2729 = s2722 ^ s2728; const SWord8 s2730 = s2720 ^ s2729; const SWord8 s2731 = table9[s2719]; const SWord8 s2732 = table6[s2721]; const SWord8 s2733 = table7[s2724]; const SWord8 s2734 = table8[s2726]; const SWord8 s2735 = s2733 ^ s2734; const SWord8 s2736 = s2732 ^ s2735; const SWord8 s2737 = s2731 ^ s2736; const SWord16 s2738 = (((SWord16) s2730) << 8) | ((SWord16) s2737); const SWord8 s2739 = table8[s2719]; const SWord8 s2740 = table9[s2721]; const SWord8 s2741 = table6[s2724]; const SWord8 s2742 = table7[s2726]; const SWord8 s2743 = s2741 ^ s2742; const SWord8 s2744 = s2740 ^ s2743; const SWord8 s2745 = s2739 ^ s2744; const SWord8 s2746 = table7[s2719]; const SWord8 s2747 = table8[s2721]; const SWord8 s2748 = table9[s2724]; const SWord8 s2749 = table6[s2726]; const SWord8 s2750 = s2748 ^ s2749; const SWord8 s2751 = s2747 ^ s2750; const SWord8 s2752 = s2746 ^ s2751; const SWord16 s2753 = (((SWord16) s2745) << 8) | ((SWord16) s2752); const SWord32 s2754 = (((SWord32) s2738) << 16) | ((SWord32) s2753); const SWord32 s2755 = s2717 ^ s2754; const SWord16 s2756 = (SWord16) (s2755 >> 16); const SWord8 s2757 = (SWord8) (s2756 >> 8); const SWord32 s2758 = table1[s2757]; const SWord8 s2759 = (SWord8) (s2606 >> 8); const SWord32 s2760 = table1[s2759]; const SWord16 s2761 = (SWord16) (s2660 >> 16); const SWord8 s2762 = (SWord8) s2761; const SWord32 s2763 = table3[s2762]; const SWord32 s2764 = s2760 ^ s2763; const SWord8 s2765 = (SWord8) (s2714 >> 8); const SWord32 s2766 = table4[s2765]; const SWord32 s2767 = s2764 ^ s2766; const SWord16 s2768 = (SWord16) s2551; const SWord8 s2769 = (SWord8) s2768; const SWord32 s2770 = table5[s2769]; const SWord32 s2771 = s2767 ^ s2770; const SWord16 s2772 = (SWord16) (s576 >> 16); const SWord8 s2773 = (SWord8) (s2772 >> 8); const SWord8 s2774 = table6[s2773]; const SWord8 s2775 = (SWord8) s2772; const SWord8 s2776 = table7[s2775]; const SWord16 s2777 = (SWord16) s576; const SWord8 s2778 = (SWord8) (s2777 >> 8); const SWord8 s2779 = table8[s2778]; const SWord8 s2780 = (SWord8) s2777; const SWord8 s2781 = table9[s2780]; const SWord8 s2782 = s2779 ^ s2781; const SWord8 s2783 = s2776 ^ s2782; const SWord8 s2784 = s2774 ^ s2783; const SWord8 s2785 = table9[s2773]; const SWord8 s2786 = table6[s2775]; const SWord8 s2787 = table7[s2778]; const SWord8 s2788 = table8[s2780]; const SWord8 s2789 = s2787 ^ s2788; const SWord8 s2790 = s2786 ^ s2789; const SWord8 s2791 = s2785 ^ s2790; const SWord16 s2792 = (((SWord16) s2784) << 8) | ((SWord16) s2791); const SWord8 s2793 = table8[s2773]; const SWord8 s2794 = table9[s2775]; const SWord8 s2795 = table6[s2778]; const SWord8 s2796 = table7[s2780]; const SWord8 s2797 = s2795 ^ s2796; const SWord8 s2798 = s2794 ^ s2797; const SWord8 s2799 = s2793 ^ s2798; const SWord8 s2800 = table7[s2773]; const SWord8 s2801 = table8[s2775]; const SWord8 s2802 = table9[s2778]; const SWord8 s2803 = table6[s2780]; const SWord8 s2804 = s2802 ^ s2803; const SWord8 s2805 = s2801 ^ s2804; const SWord8 s2806 = s2800 ^ s2805; const SWord16 s2807 = (((SWord16) s2799) << 8) | ((SWord16) s2806); const SWord32 s2808 = (((SWord32) s2792) << 16) | ((SWord32) s2807); const SWord32 s2809 = s2771 ^ s2808; const SWord16 s2810 = (SWord16) (s2809 >> 16); const SWord8 s2811 = (SWord8) s2810; const SWord32 s2812 = table3[s2811]; const SWord32 s2813 = s2758 ^ s2812; const SWord8 s2814 = (SWord8) (s2761 >> 8); const SWord32 s2815 = table1[s2814]; const SWord16 s2816 = (SWord16) (s2713 >> 16); const SWord8 s2817 = (SWord8) s2816; const SWord32 s2818 = table3[s2817]; const SWord32 s2819 = s2815 ^ s2818; const SWord8 s2820 = (SWord8) (s2768 >> 8); const SWord32 s2821 = table4[s2820]; const SWord32 s2822 = s2819 ^ s2821; const SWord16 s2823 = (SWord16) s2605; const SWord8 s2824 = (SWord8) s2823; const SWord32 s2825 = table5[s2824]; const SWord32 s2826 = s2822 ^ s2825; const SWord16 s2827 = (SWord16) (s575 >> 16); const SWord8 s2828 = (SWord8) (s2827 >> 8); const SWord8 s2829 = table6[s2828]; const SWord8 s2830 = (SWord8) s2827; const SWord8 s2831 = table7[s2830]; const SWord16 s2832 = (SWord16) s575; const SWord8 s2833 = (SWord8) (s2832 >> 8); const SWord8 s2834 = table8[s2833]; const SWord8 s2835 = (SWord8) s2832; const SWord8 s2836 = table9[s2835]; const SWord8 s2837 = s2834 ^ s2836; const SWord8 s2838 = s2831 ^ s2837; const SWord8 s2839 = s2829 ^ s2838; const SWord8 s2840 = table9[s2828]; const SWord8 s2841 = table6[s2830]; const SWord8 s2842 = table7[s2833]; const SWord8 s2843 = table8[s2835]; const SWord8 s2844 = s2842 ^ s2843; const SWord8 s2845 = s2841 ^ s2844; const SWord8 s2846 = s2840 ^ s2845; const SWord16 s2847 = (((SWord16) s2839) << 8) | ((SWord16) s2846); const SWord8 s2848 = table8[s2828]; const SWord8 s2849 = table9[s2830]; const SWord8 s2850 = table6[s2833]; const SWord8 s2851 = table7[s2835]; const SWord8 s2852 = s2850 ^ s2851; const SWord8 s2853 = s2849 ^ s2852; const SWord8 s2854 = s2848 ^ s2853; const SWord8 s2855 = table7[s2828]; const SWord8 s2856 = table8[s2830]; const SWord8 s2857 = table9[s2833]; const SWord8 s2858 = table6[s2835]; const SWord8 s2859 = s2857 ^ s2858; const SWord8 s2860 = s2856 ^ s2859; const SWord8 s2861 = s2855 ^ s2860; const SWord16 s2862 = (((SWord16) s2854) << 8) | ((SWord16) s2861); const SWord32 s2863 = (((SWord32) s2847) << 16) | ((SWord32) s2862); const SWord32 s2864 = s2826 ^ s2863; const SWord16 s2865 = (SWord16) s2864; const SWord8 s2866 = (SWord8) (s2865 >> 8); const SWord32 s2867 = table4[s2866]; const SWord32 s2868 = s2813 ^ s2867; const SWord8 s2869 = (SWord8) (s2816 >> 8); const SWord32 s2870 = table1[s2869]; const SWord8 s2871 = (SWord8) s2552; const SWord32 s2872 = table3[s2871]; const SWord32 s2873 = s2870 ^ s2872; const SWord8 s2874 = (SWord8) (s2823 >> 8); const SWord32 s2875 = table4[s2874]; const SWord32 s2876 = s2873 ^ s2875; const SWord8 s2877 = (SWord8) s2661; const SWord32 s2878 = table5[s2877]; const SWord32 s2879 = s2876 ^ s2878; const SWord16 s2880 = (SWord16) (s574 >> 16); const SWord8 s2881 = (SWord8) (s2880 >> 8); const SWord8 s2882 = table6[s2881]; const SWord8 s2883 = (SWord8) s2880; const SWord8 s2884 = table7[s2883]; const SWord16 s2885 = (SWord16) s574; const SWord8 s2886 = (SWord8) (s2885 >> 8); const SWord8 s2887 = table8[s2886]; const SWord8 s2888 = (SWord8) s2885; const SWord8 s2889 = table9[s2888]; const SWord8 s2890 = s2887 ^ s2889; const SWord8 s2891 = s2884 ^ s2890; const SWord8 s2892 = s2882 ^ s2891; const SWord8 s2893 = table9[s2881]; const SWord8 s2894 = table6[s2883]; const SWord8 s2895 = table7[s2886]; const SWord8 s2896 = table8[s2888]; const SWord8 s2897 = s2895 ^ s2896; const SWord8 s2898 = s2894 ^ s2897; const SWord8 s2899 = s2893 ^ s2898; const SWord16 s2900 = (((SWord16) s2892) << 8) | ((SWord16) s2899); const SWord8 s2901 = table8[s2881]; const SWord8 s2902 = table9[s2883]; const SWord8 s2903 = table6[s2886]; const SWord8 s2904 = table7[s2888]; const SWord8 s2905 = s2903 ^ s2904; const SWord8 s2906 = s2902 ^ s2905; const SWord8 s2907 = s2901 ^ s2906; const SWord8 s2908 = table7[s2881]; const SWord8 s2909 = table8[s2883]; const SWord8 s2910 = table9[s2886]; const SWord8 s2911 = table6[s2888]; const SWord8 s2912 = s2910 ^ s2911; const SWord8 s2913 = s2909 ^ s2912; const SWord8 s2914 = s2908 ^ s2913; const SWord16 s2915 = (((SWord16) s2907) << 8) | ((SWord16) s2914); const SWord32 s2916 = (((SWord32) s2900) << 16) | ((SWord32) s2915); const SWord32 s2917 = s2879 ^ s2916; const SWord16 s2918 = (SWord16) s2917; const SWord8 s2919 = (SWord8) s2918; const SWord32 s2920 = table5[s2919]; const SWord32 s2921 = s2868 ^ s2920; const SWord16 s2922 = (SWord16) (s554 >> 16); const SWord8 s2923 = (SWord8) (s2922 >> 8); const SWord8 s2924 = table6[s2923]; const SWord8 s2925 = (SWord8) s2922; const SWord8 s2926 = table7[s2925]; const SWord16 s2927 = (SWord16) s554; const SWord8 s2928 = (SWord8) (s2927 >> 8); const SWord8 s2929 = table8[s2928]; const SWord8 s2930 = (SWord8) s2927; const SWord8 s2931 = table9[s2930]; const SWord8 s2932 = s2929 ^ s2931; const SWord8 s2933 = s2926 ^ s2932; const SWord8 s2934 = s2924 ^ s2933; const SWord8 s2935 = table9[s2923]; const SWord8 s2936 = table6[s2925]; const SWord8 s2937 = table7[s2928]; const SWord8 s2938 = table8[s2930]; const SWord8 s2939 = s2937 ^ s2938; const SWord8 s2940 = s2936 ^ s2939; const SWord8 s2941 = s2935 ^ s2940; const SWord16 s2942 = (((SWord16) s2934) << 8) | ((SWord16) s2941); const SWord8 s2943 = table8[s2923]; const SWord8 s2944 = table9[s2925]; const SWord8 s2945 = table6[s2928]; const SWord8 s2946 = table7[s2930]; const SWord8 s2947 = s2945 ^ s2946; const SWord8 s2948 = s2944 ^ s2947; const SWord8 s2949 = s2943 ^ s2948; const SWord8 s2950 = table7[s2923]; const SWord8 s2951 = table8[s2925]; const SWord8 s2952 = table9[s2928]; const SWord8 s2953 = table6[s2930]; const SWord8 s2954 = s2952 ^ s2953; const SWord8 s2955 = s2951 ^ s2954; const SWord8 s2956 = s2950 ^ s2955; const SWord16 s2957 = (((SWord16) s2949) << 8) | ((SWord16) s2956); const SWord32 s2958 = (((SWord32) s2942) << 16) | ((SWord32) s2957); const SWord32 s2959 = s2921 ^ s2958; const SWord16 s2960 = (SWord16) (s2959 >> 16); const SWord8 s2961 = (SWord8) (s2960 >> 8); const SWord32 s2962 = table1[s2961]; const SWord8 s2963 = (SWord8) (s2810 >> 8); const SWord32 s2964 = table1[s2963]; const SWord16 s2965 = (SWord16) (s2864 >> 16); const SWord8 s2966 = (SWord8) s2965; const SWord32 s2967 = table3[s2966]; const SWord32 s2968 = s2964 ^ s2967; const SWord8 s2969 = (SWord8) (s2918 >> 8); const SWord32 s2970 = table4[s2969]; const SWord32 s2971 = s2968 ^ s2970; const SWord16 s2972 = (SWord16) s2755; const SWord8 s2973 = (SWord8) s2972; const SWord32 s2974 = table5[s2973]; const SWord32 s2975 = s2971 ^ s2974; const SWord16 s2976 = (SWord16) (s557 >> 16); const SWord8 s2977 = (SWord8) (s2976 >> 8); const SWord8 s2978 = table6[s2977]; const SWord8 s2979 = (SWord8) s2976; const SWord8 s2980 = table7[s2979]; const SWord16 s2981 = (SWord16) s557; const SWord8 s2982 = (SWord8) (s2981 >> 8); const SWord8 s2983 = table8[s2982]; const SWord8 s2984 = (SWord8) s2981; const SWord8 s2985 = table9[s2984]; const SWord8 s2986 = s2983 ^ s2985; const SWord8 s2987 = s2980 ^ s2986; const SWord8 s2988 = s2978 ^ s2987; const SWord8 s2989 = table9[s2977]; const SWord8 s2990 = table6[s2979]; const SWord8 s2991 = table7[s2982]; const SWord8 s2992 = table8[s2984]; const SWord8 s2993 = s2991 ^ s2992; const SWord8 s2994 = s2990 ^ s2993; const SWord8 s2995 = s2989 ^ s2994; const SWord16 s2996 = (((SWord16) s2988) << 8) | ((SWord16) s2995); const SWord8 s2997 = table8[s2977]; const SWord8 s2998 = table9[s2979]; const SWord8 s2999 = table6[s2982]; const SWord8 s3000 = table7[s2984]; const SWord8 s3001 = s2999 ^ s3000; const SWord8 s3002 = s2998 ^ s3001; const SWord8 s3003 = s2997 ^ s3002; const SWord8 s3004 = table7[s2977]; const SWord8 s3005 = table8[s2979]; const SWord8 s3006 = table9[s2982]; const SWord8 s3007 = table6[s2984]; const SWord8 s3008 = s3006 ^ s3007; const SWord8 s3009 = s3005 ^ s3008; const SWord8 s3010 = s3004 ^ s3009; const SWord16 s3011 = (((SWord16) s3003) << 8) | ((SWord16) s3010); const SWord32 s3012 = (((SWord32) s2996) << 16) | ((SWord32) s3011); const SWord32 s3013 = s2975 ^ s3012; const SWord16 s3014 = (SWord16) (s3013 >> 16); const SWord8 s3015 = (SWord8) s3014; const SWord32 s3016 = table3[s3015]; const SWord32 s3017 = s2962 ^ s3016; const SWord8 s3018 = (SWord8) (s2965 >> 8); const SWord32 s3019 = table1[s3018]; const SWord16 s3020 = (SWord16) (s2917 >> 16); const SWord8 s3021 = (SWord8) s3020; const SWord32 s3022 = table3[s3021]; const SWord32 s3023 = s3019 ^ s3022; const SWord8 s3024 = (SWord8) (s2972 >> 8); const SWord32 s3025 = table4[s3024]; const SWord32 s3026 = s3023 ^ s3025; const SWord16 s3027 = (SWord16) s2809; const SWord8 s3028 = (SWord8) s3027; const SWord32 s3029 = table5[s3028]; const SWord32 s3030 = s3026 ^ s3029; const SWord16 s3031 = (SWord16) (s556 >> 16); const SWord8 s3032 = (SWord8) (s3031 >> 8); const SWord8 s3033 = table6[s3032]; const SWord8 s3034 = (SWord8) s3031; const SWord8 s3035 = table7[s3034]; const SWord16 s3036 = (SWord16) s556; const SWord8 s3037 = (SWord8) (s3036 >> 8); const SWord8 s3038 = table8[s3037]; const SWord8 s3039 = (SWord8) s3036; const SWord8 s3040 = table9[s3039]; const SWord8 s3041 = s3038 ^ s3040; const SWord8 s3042 = s3035 ^ s3041; const SWord8 s3043 = s3033 ^ s3042; const SWord8 s3044 = table9[s3032]; const SWord8 s3045 = table6[s3034]; const SWord8 s3046 = table7[s3037]; const SWord8 s3047 = table8[s3039]; const SWord8 s3048 = s3046 ^ s3047; const SWord8 s3049 = s3045 ^ s3048; const SWord8 s3050 = s3044 ^ s3049; const SWord16 s3051 = (((SWord16) s3043) << 8) | ((SWord16) s3050); const SWord8 s3052 = table8[s3032]; const SWord8 s3053 = table9[s3034]; const SWord8 s3054 = table6[s3037]; const SWord8 s3055 = table7[s3039]; const SWord8 s3056 = s3054 ^ s3055; const SWord8 s3057 = s3053 ^ s3056; const SWord8 s3058 = s3052 ^ s3057; const SWord8 s3059 = table7[s3032]; const SWord8 s3060 = table8[s3034]; const SWord8 s3061 = table9[s3037]; const SWord8 s3062 = table6[s3039]; const SWord8 s3063 = s3061 ^ s3062; const SWord8 s3064 = s3060 ^ s3063; const SWord8 s3065 = s3059 ^ s3064; const SWord16 s3066 = (((SWord16) s3058) << 8) | ((SWord16) s3065); const SWord32 s3067 = (((SWord32) s3051) << 16) | ((SWord32) s3066); const SWord32 s3068 = s3030 ^ s3067; const SWord16 s3069 = (SWord16) s3068; const SWord8 s3070 = (SWord8) (s3069 >> 8); const SWord32 s3071 = table4[s3070]; const SWord32 s3072 = s3017 ^ s3071; const SWord8 s3073 = (SWord8) (s3020 >> 8); const SWord32 s3074 = table1[s3073]; const SWord8 s3075 = (SWord8) s2756; const SWord32 s3076 = table3[s3075]; const SWord32 s3077 = s3074 ^ s3076; const SWord8 s3078 = (SWord8) (s3027 >> 8); const SWord32 s3079 = table4[s3078]; const SWord32 s3080 = s3077 ^ s3079; const SWord8 s3081 = (SWord8) s2865; const SWord32 s3082 = table5[s3081]; const SWord32 s3083 = s3080 ^ s3082; const SWord16 s3084 = (SWord16) (s555 >> 16); const SWord8 s3085 = (SWord8) (s3084 >> 8); const SWord8 s3086 = table6[s3085]; const SWord8 s3087 = (SWord8) s3084; const SWord8 s3088 = table7[s3087]; const SWord16 s3089 = (SWord16) s555; const SWord8 s3090 = (SWord8) (s3089 >> 8); const SWord8 s3091 = table8[s3090]; const SWord8 s3092 = (SWord8) s3089; const SWord8 s3093 = table9[s3092]; const SWord8 s3094 = s3091 ^ s3093; const SWord8 s3095 = s3088 ^ s3094; const SWord8 s3096 = s3086 ^ s3095; const SWord8 s3097 = table9[s3085]; const SWord8 s3098 = table6[s3087]; const SWord8 s3099 = table7[s3090]; const SWord8 s3100 = table8[s3092]; const SWord8 s3101 = s3099 ^ s3100; const SWord8 s3102 = s3098 ^ s3101; const SWord8 s3103 = s3097 ^ s3102; const SWord16 s3104 = (((SWord16) s3096) << 8) | ((SWord16) s3103); const SWord8 s3105 = table8[s3085]; const SWord8 s3106 = table9[s3087]; const SWord8 s3107 = table6[s3090]; const SWord8 s3108 = table7[s3092]; const SWord8 s3109 = s3107 ^ s3108; const SWord8 s3110 = s3106 ^ s3109; const SWord8 s3111 = s3105 ^ s3110; const SWord8 s3112 = table7[s3085]; const SWord8 s3113 = table8[s3087]; const SWord8 s3114 = table9[s3090]; const SWord8 s3115 = table6[s3092]; const SWord8 s3116 = s3114 ^ s3115; const SWord8 s3117 = s3113 ^ s3116; const SWord8 s3118 = s3112 ^ s3117; const SWord16 s3119 = (((SWord16) s3111) << 8) | ((SWord16) s3118); const SWord32 s3120 = (((SWord32) s3104) << 16) | ((SWord32) s3119); const SWord32 s3121 = s3083 ^ s3120; const SWord16 s3122 = (SWord16) s3121; const SWord8 s3123 = (SWord8) s3122; const SWord32 s3124 = table5[s3123]; const SWord32 s3125 = s3072 ^ s3124; const SWord16 s3126 = (SWord16) (s535 >> 16); const SWord8 s3127 = (SWord8) (s3126 >> 8); const SWord8 s3128 = table6[s3127]; const SWord8 s3129 = (SWord8) s3126; const SWord8 s3130 = table7[s3129]; const SWord16 s3131 = (SWord16) s535; const SWord8 s3132 = (SWord8) (s3131 >> 8); const SWord8 s3133 = table8[s3132]; const SWord8 s3134 = (SWord8) s3131; const SWord8 s3135 = table9[s3134]; const SWord8 s3136 = s3133 ^ s3135; const SWord8 s3137 = s3130 ^ s3136; const SWord8 s3138 = s3128 ^ s3137; const SWord8 s3139 = table9[s3127]; const SWord8 s3140 = table6[s3129]; const SWord8 s3141 = table7[s3132]; const SWord8 s3142 = table8[s3134]; const SWord8 s3143 = s3141 ^ s3142; const SWord8 s3144 = s3140 ^ s3143; const SWord8 s3145 = s3139 ^ s3144; const SWord16 s3146 = (((SWord16) s3138) << 8) | ((SWord16) s3145); const SWord8 s3147 = table8[s3127]; const SWord8 s3148 = table9[s3129]; const SWord8 s3149 = table6[s3132]; const SWord8 s3150 = table7[s3134]; const SWord8 s3151 = s3149 ^ s3150; const SWord8 s3152 = s3148 ^ s3151; const SWord8 s3153 = s3147 ^ s3152; const SWord8 s3154 = table7[s3127]; const SWord8 s3155 = table8[s3129]; const SWord8 s3156 = table9[s3132]; const SWord8 s3157 = table6[s3134]; const SWord8 s3158 = s3156 ^ s3157; const SWord8 s3159 = s3155 ^ s3158; const SWord8 s3160 = s3154 ^ s3159; const SWord16 s3161 = (((SWord16) s3153) << 8) | ((SWord16) s3160); const SWord32 s3162 = (((SWord32) s3146) << 16) | ((SWord32) s3161); const SWord32 s3163 = s3125 ^ s3162; const SWord16 s3164 = (SWord16) (s3163 >> 16); const SWord8 s3165 = (SWord8) (s3164 >> 8); const SWord8 s3166 = table0[s3165]; const SWord8 s3167 = (SWord8) (s3014 >> 8); const SWord32 s3168 = table1[s3167]; const SWord16 s3169 = (SWord16) (s3068 >> 16); const SWord8 s3170 = (SWord8) s3169; const SWord32 s3171 = table3[s3170]; const SWord32 s3172 = s3168 ^ s3171; const SWord8 s3173 = (SWord8) (s3122 >> 8); const SWord32 s3174 = table4[s3173]; const SWord32 s3175 = s3172 ^ s3174; const SWord16 s3176 = (SWord16) s2959; const SWord8 s3177 = (SWord8) s3176; const SWord32 s3178 = table5[s3177]; const SWord32 s3179 = s3175 ^ s3178; const SWord16 s3180 = (SWord16) (s538 >> 16); const SWord8 s3181 = (SWord8) (s3180 >> 8); const SWord8 s3182 = table6[s3181]; const SWord8 s3183 = (SWord8) s3180; const SWord8 s3184 = table7[s3183]; const SWord16 s3185 = (SWord16) s538; const SWord8 s3186 = (SWord8) (s3185 >> 8); const SWord8 s3187 = table8[s3186]; const SWord8 s3188 = (SWord8) s3185; const SWord8 s3189 = table9[s3188]; const SWord8 s3190 = s3187 ^ s3189; const SWord8 s3191 = s3184 ^ s3190; const SWord8 s3192 = s3182 ^ s3191; const SWord8 s3193 = table9[s3181]; const SWord8 s3194 = table6[s3183]; const SWord8 s3195 = table7[s3186]; const SWord8 s3196 = table8[s3188]; const SWord8 s3197 = s3195 ^ s3196; const SWord8 s3198 = s3194 ^ s3197; const SWord8 s3199 = s3193 ^ s3198; const SWord16 s3200 = (((SWord16) s3192) << 8) | ((SWord16) s3199); const SWord8 s3201 = table8[s3181]; const SWord8 s3202 = table9[s3183]; const SWord8 s3203 = table6[s3186]; const SWord8 s3204 = table7[s3188]; const SWord8 s3205 = s3203 ^ s3204; const SWord8 s3206 = s3202 ^ s3205; const SWord8 s3207 = s3201 ^ s3206; const SWord8 s3208 = table7[s3181]; const SWord8 s3209 = table8[s3183]; const SWord8 s3210 = table9[s3186]; const SWord8 s3211 = table6[s3188]; const SWord8 s3212 = s3210 ^ s3211; const SWord8 s3213 = s3209 ^ s3212; const SWord8 s3214 = s3208 ^ s3213; const SWord16 s3215 = (((SWord16) s3207) << 8) | ((SWord16) s3214); const SWord32 s3216 = (((SWord32) s3200) << 16) | ((SWord32) s3215); const SWord32 s3217 = s3179 ^ s3216; const SWord16 s3218 = (SWord16) (s3217 >> 16); const SWord8 s3219 = (SWord8) s3218; const SWord8 s3220 = table0[s3219]; const SWord16 s3221 = (((SWord16) s3166) << 8) | ((SWord16) s3220); const SWord8 s3222 = (SWord8) (s3169 >> 8); const SWord32 s3223 = table1[s3222]; const SWord16 s3224 = (SWord16) (s3121 >> 16); const SWord8 s3225 = (SWord8) s3224; const SWord32 s3226 = table3[s3225]; const SWord32 s3227 = s3223 ^ s3226; const SWord8 s3228 = (SWord8) (s3176 >> 8); const SWord32 s3229 = table4[s3228]; const SWord32 s3230 = s3227 ^ s3229; const SWord16 s3231 = (SWord16) s3013; const SWord8 s3232 = (SWord8) s3231; const SWord32 s3233 = table5[s3232]; const SWord32 s3234 = s3230 ^ s3233; const SWord16 s3235 = (SWord16) (s537 >> 16); const SWord8 s3236 = (SWord8) (s3235 >> 8); const SWord8 s3237 = table6[s3236]; const SWord8 s3238 = (SWord8) s3235; const SWord8 s3239 = table7[s3238]; const SWord16 s3240 = (SWord16) s537; const SWord8 s3241 = (SWord8) (s3240 >> 8); const SWord8 s3242 = table8[s3241]; const SWord8 s3243 = (SWord8) s3240; const SWord8 s3244 = table9[s3243]; const SWord8 s3245 = s3242 ^ s3244; const SWord8 s3246 = s3239 ^ s3245; const SWord8 s3247 = s3237 ^ s3246; const SWord8 s3248 = table9[s3236]; const SWord8 s3249 = table6[s3238]; const SWord8 s3250 = table7[s3241]; const SWord8 s3251 = table8[s3243]; const SWord8 s3252 = s3250 ^ s3251; const SWord8 s3253 = s3249 ^ s3252; const SWord8 s3254 = s3248 ^ s3253; const SWord16 s3255 = (((SWord16) s3247) << 8) | ((SWord16) s3254); const SWord8 s3256 = table8[s3236]; const SWord8 s3257 = table9[s3238]; const SWord8 s3258 = table6[s3241]; const SWord8 s3259 = table7[s3243]; const SWord8 s3260 = s3258 ^ s3259; const SWord8 s3261 = s3257 ^ s3260; const SWord8 s3262 = s3256 ^ s3261; const SWord8 s3263 = table7[s3236]; const SWord8 s3264 = table8[s3238]; const SWord8 s3265 = table9[s3241]; const SWord8 s3266 = table6[s3243]; const SWord8 s3267 = s3265 ^ s3266; const SWord8 s3268 = s3264 ^ s3267; const SWord8 s3269 = s3263 ^ s3268; const SWord16 s3270 = (((SWord16) s3262) << 8) | ((SWord16) s3269); const SWord32 s3271 = (((SWord32) s3255) << 16) | ((SWord32) s3270); const SWord32 s3272 = s3234 ^ s3271; const SWord16 s3273 = (SWord16) s3272; const SWord8 s3274 = (SWord8) (s3273 >> 8); const SWord8 s3275 = table0[s3274]; const SWord8 s3276 = (SWord8) (s3224 >> 8); const SWord32 s3277 = table1[s3276]; const SWord8 s3278 = (SWord8) s2960; const SWord32 s3279 = table3[s3278]; const SWord32 s3280 = s3277 ^ s3279; const SWord8 s3281 = (SWord8) (s3231 >> 8); const SWord32 s3282 = table4[s3281]; const SWord32 s3283 = s3280 ^ s3282; const SWord8 s3284 = (SWord8) s3069; const SWord32 s3285 = table5[s3284]; const SWord32 s3286 = s3283 ^ s3285; const SWord16 s3287 = (SWord16) (s536 >> 16); const SWord8 s3288 = (SWord8) (s3287 >> 8); const SWord8 s3289 = table6[s3288]; const SWord8 s3290 = (SWord8) s3287; const SWord8 s3291 = table7[s3290]; const SWord16 s3292 = (SWord16) s536; const SWord8 s3293 = (SWord8) (s3292 >> 8); const SWord8 s3294 = table8[s3293]; const SWord8 s3295 = (SWord8) s3292; const SWord8 s3296 = table9[s3295]; const SWord8 s3297 = s3294 ^ s3296; const SWord8 s3298 = s3291 ^ s3297; const SWord8 s3299 = s3289 ^ s3298; const SWord8 s3300 = table9[s3288]; const SWord8 s3301 = table6[s3290]; const SWord8 s3302 = table7[s3293]; const SWord8 s3303 = table8[s3295]; const SWord8 s3304 = s3302 ^ s3303; const SWord8 s3305 = s3301 ^ s3304; const SWord8 s3306 = s3300 ^ s3305; const SWord16 s3307 = (((SWord16) s3299) << 8) | ((SWord16) s3306); const SWord8 s3308 = table8[s3288]; const SWord8 s3309 = table9[s3290]; const SWord8 s3310 = table6[s3293]; const SWord8 s3311 = table7[s3295]; const SWord8 s3312 = s3310 ^ s3311; const SWord8 s3313 = s3309 ^ s3312; const SWord8 s3314 = s3308 ^ s3313; const SWord8 s3315 = table7[s3288]; const SWord8 s3316 = table8[s3290]; const SWord8 s3317 = table9[s3293]; const SWord8 s3318 = table6[s3295]; const SWord8 s3319 = s3317 ^ s3318; const SWord8 s3320 = s3316 ^ s3319; const SWord8 s3321 = s3315 ^ s3320; const SWord16 s3322 = (((SWord16) s3314) << 8) | ((SWord16) s3321); const SWord32 s3323 = (((SWord32) s3307) << 16) | ((SWord32) s3322); const SWord32 s3324 = s3286 ^ s3323; const SWord16 s3325 = (SWord16) s3324; const SWord8 s3326 = (SWord8) s3325; const SWord8 s3327 = table0[s3326]; const SWord16 s3328 = (((SWord16) s3275) << 8) | ((SWord16) s3327); const SWord32 s3329 = (((SWord32) s3221) << 16) | ((SWord32) s3328); const SWord32 s3330 = s4 ^ s3329; const SWord16 s3331 = (SWord16) (s3324 >> 16); const SWord8 s3332 = (SWord8) (s3331 >> 8); const SWord8 s3333 = table0[s3332]; const SWord8 s3334 = (SWord8) s3164; const SWord8 s3335 = table0[s3334]; const SWord16 s3336 = (((SWord16) s3333) << 8) | ((SWord16) s3335); const SWord16 s3337 = (SWord16) s3217; const SWord8 s3338 = (SWord8) (s3337 >> 8); const SWord8 s3339 = table0[s3338]; const SWord8 s3340 = (SWord8) s3273; const SWord8 s3341 = table0[s3340]; const SWord16 s3342 = (((SWord16) s3339) << 8) | ((SWord16) s3341); const SWord32 s3343 = (((SWord32) s3336) << 16) | ((SWord32) s3342); const SWord32 s3344 = s5 ^ s3343; const SWord16 s3345 = (SWord16) (s3272 >> 16); const SWord8 s3346 = (SWord8) (s3345 >> 8); const SWord8 s3347 = table0[s3346]; const SWord8 s3348 = (SWord8) s3331; const SWord8 s3349 = table0[s3348]; const SWord16 s3350 = (((SWord16) s3347) << 8) | ((SWord16) s3349); const SWord16 s3351 = (SWord16) s3163; const SWord8 s3352 = (SWord8) (s3351 >> 8); const SWord8 s3353 = table0[s3352]; const SWord8 s3354 = (SWord8) s3337; const SWord8 s3355 = table0[s3354]; const SWord16 s3356 = (((SWord16) s3353) << 8) | ((SWord16) s3355); const SWord32 s3357 = (((SWord32) s3350) << 16) | ((SWord32) s3356); const SWord32 s3358 = s6 ^ s3357; const SWord8 s3359 = (SWord8) (s3218 >> 8); const SWord8 s3360 = table0[s3359]; const SWord8 s3361 = (SWord8) s3345; const SWord8 s3362 = table0[s3361]; const SWord16 s3363 = (((SWord16) s3360) << 8) | ((SWord16) s3362); const SWord8 s3364 = (SWord8) (s3325 >> 8); const SWord8 s3365 = table0[s3364]; const SWord8 s3366 = (SWord8) s3351; const SWord8 s3367 = table0[s3366]; const SWord16 s3368 = (((SWord16) s3365) << 8) | ((SWord16) s3367); const SWord32 s3369 = (((SWord32) s3363) << 16) | ((SWord32) s3368); const SWord32 s3370 = s7 ^ s3369; ct[0] = s3330; ct[1] = s3344; ct[2] = s3358; ct[3] = s3370; } == END: "aes128Dec.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/aes128Enc.gold0000644000000000000000000014706113405536617017123 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for aes128Enc. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: aes128Enc_driver aes128Enc.o: aes128Enc.c aes128Enc.h ${CC} ${CCFLAGS} -c $< -o $@ aes128Enc_driver.o: aes128Enc_driver.c ${CC} ${CCFLAGS} -c $< -o $@ aes128Enc_driver: aes128Enc.o aes128Enc_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f aes128Enc_driver == END: "Makefile" ================== == BEGIN: "aes128Enc.h" ================ /* Header file for aes128Enc. Automatically generated by SBV. Do not edit! */ #ifndef __aes128Enc__HEADER_INCLUDED__ #define __aes128Enc__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ void aes128Enc(const SWord32 *pt, const SWord32 *key, SWord32 *ct); #endif /* __aes128Enc__HEADER_INCLUDED__ */ == END: "aes128Enc.h" ================== == BEGIN: "aes128Enc_driver.c" ================ /* Example driver program for aes128Enc. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "aes128Enc.h" int main(void) { const SWord32 pt[4] = { 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL }; printf("Contents of input array pt:\n"); int pt_ctr; for(pt_ctr = 0; pt_ctr < 4 ; ++pt_ctr) printf(" pt[%d] = 0x%08"PRIx32"UL\n", pt_ctr ,pt[pt_ctr]); const SWord32 key[4] = { 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL }; printf("Contents of input array key:\n"); int key_ctr; for(key_ctr = 0; key_ctr < 4 ; ++key_ctr) printf(" key[%d] = 0x%08"PRIx32"UL\n", key_ctr ,key[key_ctr]); SWord32 ct[4]; aes128Enc(pt, key, ct); printf("aes128Enc(pt, key, ct) ->\n"); int ct_ctr; for(ct_ctr = 0; ct_ctr < 4 ; ++ct_ctr) printf(" ct[%d] = 0x%08"PRIx32"UL\n", ct_ctr ,ct[ct_ctr]); return 0; } == END: "aes128Enc_driver.c" ================== == BEGIN: "aes128Enc.c" ================ /* File: "aes128Enc.c". Automatically generated by SBV. Do not edit! */ #include "aes128Enc.h" void aes128Enc(const SWord32 *pt, const SWord32 *key, SWord32 *ct) { const SWord32 s0 = pt[0]; const SWord32 s1 = pt[1]; const SWord32 s2 = pt[2]; const SWord32 s3 = pt[3]; const SWord32 s4 = key[0]; const SWord32 s5 = key[1]; const SWord32 s6 = key[2]; const SWord32 s7 = key[3]; static const SWord8 table0[] = { 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22 }; static const SWord32 table1[] = { 0xc66363a5UL, 0xf87c7c84UL, 0xee777799UL, 0xf67b7b8dUL, 0xfff2f20dUL, 0xd66b6bbdUL, 0xde6f6fb1UL, 0x91c5c554UL, 0x60303050UL, 0x02010103UL, 0xce6767a9UL, 0x562b2b7dUL, 0xe7fefe19UL, 0xb5d7d762UL, 0x4dababe6UL, 0xec76769aUL, 0x8fcaca45UL, 0x1f82829dUL, 0x89c9c940UL, 0xfa7d7d87UL, 0xeffafa15UL, 0xb25959ebUL, 0x8e4747c9UL, 0xfbf0f00bUL, 0x41adadecUL, 0xb3d4d467UL, 0x5fa2a2fdUL, 0x45afafeaUL, 0x239c9cbfUL, 0x53a4a4f7UL, 0xe4727296UL, 0x9bc0c05bUL, 0x75b7b7c2UL, 0xe1fdfd1cUL, 0x3d9393aeUL, 0x4c26266aUL, 0x6c36365aUL, 0x7e3f3f41UL, 0xf5f7f702UL, 0x83cccc4fUL, 0x6834345cUL, 0x51a5a5f4UL, 0xd1e5e534UL, 0xf9f1f108UL, 0xe2717193UL, 0xabd8d873UL, 0x62313153UL, 0x2a15153fUL, 0x0804040cUL, 0x95c7c752UL, 0x46232365UL, 0x9dc3c35eUL, 0x30181828UL, 0x379696a1UL, 0x0a05050fUL, 0x2f9a9ab5UL, 0x0e070709UL, 0x24121236UL, 0x1b80809bUL, 0xdfe2e23dUL, 0xcdebeb26UL, 0x4e272769UL, 0x7fb2b2cdUL, 0xea75759fUL, 0x1209091bUL, 0x1d83839eUL, 0x582c2c74UL, 0x341a1a2eUL, 0x361b1b2dUL, 0xdc6e6eb2UL, 0xb45a5aeeUL, 0x5ba0a0fbUL, 0xa45252f6UL, 0x763b3b4dUL, 0xb7d6d661UL, 0x7db3b3ceUL, 0x5229297bUL, 0xdde3e33eUL, 0x5e2f2f71UL, 0x13848497UL, 0xa65353f5UL, 0xb9d1d168UL, 0x00000000UL, 0xc1eded2cUL, 0x40202060UL, 0xe3fcfc1fUL, 0x79b1b1c8UL, 0xb65b5bedUL, 0xd46a6abeUL, 0x8dcbcb46UL, 0x67bebed9UL, 0x7239394bUL, 0x944a4adeUL, 0x984c4cd4UL, 0xb05858e8UL, 0x85cfcf4aUL, 0xbbd0d06bUL, 0xc5efef2aUL, 0x4faaaae5UL, 0xedfbfb16UL, 0x864343c5UL, 0x9a4d4dd7UL, 0x66333355UL, 0x11858594UL, 0x8a4545cfUL, 0xe9f9f910UL, 0x04020206UL, 0xfe7f7f81UL, 0xa05050f0UL, 0x783c3c44UL, 0x259f9fbaUL, 0x4ba8a8e3UL, 0xa25151f3UL, 0x5da3a3feUL, 0x804040c0UL, 0x058f8f8aUL, 0x3f9292adUL, 0x219d9dbcUL, 0x70383848UL, 0xf1f5f504UL, 0x63bcbcdfUL, 0x77b6b6c1UL, 0xafdada75UL, 0x42212163UL, 0x20101030UL, 0xe5ffff1aUL, 0xfdf3f30eUL, 0xbfd2d26dUL, 0x81cdcd4cUL, 0x180c0c14UL, 0x26131335UL, 0xc3ecec2fUL, 0xbe5f5fe1UL, 0x359797a2UL, 0x884444ccUL, 0x2e171739UL, 0x93c4c457UL, 0x55a7a7f2UL, 0xfc7e7e82UL, 0x7a3d3d47UL, 0xc86464acUL, 0xba5d5de7UL, 0x3219192bUL, 0xe6737395UL, 0xc06060a0UL, 0x19818198UL, 0x9e4f4fd1UL, 0xa3dcdc7fUL, 0x44222266UL, 0x542a2a7eUL, 0x3b9090abUL, 0x0b888883UL, 0x8c4646caUL, 0xc7eeee29UL, 0x6bb8b8d3UL, 0x2814143cUL, 0xa7dede79UL, 0xbc5e5ee2UL, 0x160b0b1dUL, 0xaddbdb76UL, 0xdbe0e03bUL, 0x64323256UL, 0x743a3a4eUL, 0x140a0a1eUL, 0x924949dbUL, 0x0c06060aUL, 0x4824246cUL, 0xb85c5ce4UL, 0x9fc2c25dUL, 0xbdd3d36eUL, 0x43acacefUL, 0xc46262a6UL, 0x399191a8UL, 0x319595a4UL, 0xd3e4e437UL, 0xf279798bUL, 0xd5e7e732UL, 0x8bc8c843UL, 0x6e373759UL, 0xda6d6db7UL, 0x018d8d8cUL, 0xb1d5d564UL, 0x9c4e4ed2UL, 0x49a9a9e0UL, 0xd86c6cb4UL, 0xac5656faUL, 0xf3f4f407UL, 0xcfeaea25UL, 0xca6565afUL, 0xf47a7a8eUL, 0x47aeaee9UL, 0x10080818UL, 0x6fbabad5UL, 0xf0787888UL, 0x4a25256fUL, 0x5c2e2e72UL, 0x381c1c24UL, 0x57a6a6f1UL, 0x73b4b4c7UL, 0x97c6c651UL, 0xcbe8e823UL, 0xa1dddd7cUL, 0xe874749cUL, 0x3e1f1f21UL, 0x964b4bddUL, 0x61bdbddcUL, 0x0d8b8b86UL, 0x0f8a8a85UL, 0xe0707090UL, 0x7c3e3e42UL, 0x71b5b5c4UL, 0xcc6666aaUL, 0x904848d8UL, 0x06030305UL, 0xf7f6f601UL, 0x1c0e0e12UL, 0xc26161a3UL, 0x6a35355fUL, 0xae5757f9UL, 0x69b9b9d0UL, 0x17868691UL, 0x99c1c158UL, 0x3a1d1d27UL, 0x279e9eb9UL, 0xd9e1e138UL, 0xebf8f813UL, 0x2b9898b3UL, 0x22111133UL, 0xd26969bbUL, 0xa9d9d970UL, 0x078e8e89UL, 0x339494a7UL, 0x2d9b9bb6UL, 0x3c1e1e22UL, 0x15878792UL, 0xc9e9e920UL, 0x87cece49UL, 0xaa5555ffUL, 0x50282878UL, 0xa5dfdf7aUL, 0x038c8c8fUL, 0x59a1a1f8UL, 0x09898980UL, 0x1a0d0d17UL, 0x65bfbfdaUL, 0xd7e6e631UL, 0x844242c6UL, 0xd06868b8UL, 0x824141c3UL, 0x299999b0UL, 0x5a2d2d77UL, 0x1e0f0f11UL, 0x7bb0b0cbUL, 0xa85454fcUL, 0x6dbbbbd6UL, 0x2c16163aUL }; static const SWord32 table2[] = { 0xa5c66363UL, 0x84f87c7cUL, 0x99ee7777UL, 0x8df67b7bUL, 0x0dfff2f2UL, 0xbdd66b6bUL, 0xb1de6f6fUL, 0x5491c5c5UL, 0x50603030UL, 0x03020101UL, 0xa9ce6767UL, 0x7d562b2bUL, 0x19e7fefeUL, 0x62b5d7d7UL, 0xe64dababUL, 0x9aec7676UL, 0x458fcacaUL, 0x9d1f8282UL, 0x4089c9c9UL, 0x87fa7d7dUL, 0x15effafaUL, 0xebb25959UL, 0xc98e4747UL, 0x0bfbf0f0UL, 0xec41adadUL, 0x67b3d4d4UL, 0xfd5fa2a2UL, 0xea45afafUL, 0xbf239c9cUL, 0xf753a4a4UL, 0x96e47272UL, 0x5b9bc0c0UL, 0xc275b7b7UL, 0x1ce1fdfdUL, 0xae3d9393UL, 0x6a4c2626UL, 0x5a6c3636UL, 0x417e3f3fUL, 0x02f5f7f7UL, 0x4f83ccccUL, 0x5c683434UL, 0xf451a5a5UL, 0x34d1e5e5UL, 0x08f9f1f1UL, 0x93e27171UL, 0x73abd8d8UL, 0x53623131UL, 0x3f2a1515UL, 0x0c080404UL, 0x5295c7c7UL, 0x65462323UL, 0x5e9dc3c3UL, 0x28301818UL, 0xa1379696UL, 0x0f0a0505UL, 0xb52f9a9aUL, 0x090e0707UL, 0x36241212UL, 0x9b1b8080UL, 0x3ddfe2e2UL, 0x26cdebebUL, 0x694e2727UL, 0xcd7fb2b2UL, 0x9fea7575UL, 0x1b120909UL, 0x9e1d8383UL, 0x74582c2cUL, 0x2e341a1aUL, 0x2d361b1bUL, 0xb2dc6e6eUL, 0xeeb45a5aUL, 0xfb5ba0a0UL, 0xf6a45252UL, 0x4d763b3bUL, 0x61b7d6d6UL, 0xce7db3b3UL, 0x7b522929UL, 0x3edde3e3UL, 0x715e2f2fUL, 0x97138484UL, 0xf5a65353UL, 0x68b9d1d1UL, 0x00000000UL, 0x2cc1ededUL, 0x60402020UL, 0x1fe3fcfcUL, 0xc879b1b1UL, 0xedb65b5bUL, 0xbed46a6aUL, 0x468dcbcbUL, 0xd967bebeUL, 0x4b723939UL, 0xde944a4aUL, 0xd4984c4cUL, 0xe8b05858UL, 0x4a85cfcfUL, 0x6bbbd0d0UL, 0x2ac5efefUL, 0xe54faaaaUL, 0x16edfbfbUL, 0xc5864343UL, 0xd79a4d4dUL, 0x55663333UL, 0x94118585UL, 0xcf8a4545UL, 0x10e9f9f9UL, 0x06040202UL, 0x81fe7f7fUL, 0xf0a05050UL, 0x44783c3cUL, 0xba259f9fUL, 0xe34ba8a8UL, 0xf3a25151UL, 0xfe5da3a3UL, 0xc0804040UL, 0x8a058f8fUL, 0xad3f9292UL, 0xbc219d9dUL, 0x48703838UL, 0x04f1f5f5UL, 0xdf63bcbcUL, 0xc177b6b6UL, 0x75afdadaUL, 0x63422121UL, 0x30201010UL, 0x1ae5ffffUL, 0x0efdf3f3UL, 0x6dbfd2d2UL, 0x4c81cdcdUL, 0x14180c0cUL, 0x35261313UL, 0x2fc3ececUL, 0xe1be5f5fUL, 0xa2359797UL, 0xcc884444UL, 0x392e1717UL, 0x5793c4c4UL, 0xf255a7a7UL, 0x82fc7e7eUL, 0x477a3d3dUL, 0xacc86464UL, 0xe7ba5d5dUL, 0x2b321919UL, 0x95e67373UL, 0xa0c06060UL, 0x98198181UL, 0xd19e4f4fUL, 0x7fa3dcdcUL, 0x66442222UL, 0x7e542a2aUL, 0xab3b9090UL, 0x830b8888UL, 0xca8c4646UL, 0x29c7eeeeUL, 0xd36bb8b8UL, 0x3c281414UL, 0x79a7dedeUL, 0xe2bc5e5eUL, 0x1d160b0bUL, 0x76addbdbUL, 0x3bdbe0e0UL, 0x56643232UL, 0x4e743a3aUL, 0x1e140a0aUL, 0xdb924949UL, 0x0a0c0606UL, 0x6c482424UL, 0xe4b85c5cUL, 0x5d9fc2c2UL, 0x6ebdd3d3UL, 0xef43acacUL, 0xa6c46262UL, 0xa8399191UL, 0xa4319595UL, 0x37d3e4e4UL, 0x8bf27979UL, 0x32d5e7e7UL, 0x438bc8c8UL, 0x596e3737UL, 0xb7da6d6dUL, 0x8c018d8dUL, 0x64b1d5d5UL, 0xd29c4e4eUL, 0xe049a9a9UL, 0xb4d86c6cUL, 0xfaac5656UL, 0x07f3f4f4UL, 0x25cfeaeaUL, 0xafca6565UL, 0x8ef47a7aUL, 0xe947aeaeUL, 0x18100808UL, 0xd56fbabaUL, 0x88f07878UL, 0x6f4a2525UL, 0x725c2e2eUL, 0x24381c1cUL, 0xf157a6a6UL, 0xc773b4b4UL, 0x5197c6c6UL, 0x23cbe8e8UL, 0x7ca1ddddUL, 0x9ce87474UL, 0x213e1f1fUL, 0xdd964b4bUL, 0xdc61bdbdUL, 0x860d8b8bUL, 0x850f8a8aUL, 0x90e07070UL, 0x427c3e3eUL, 0xc471b5b5UL, 0xaacc6666UL, 0xd8904848UL, 0x05060303UL, 0x01f7f6f6UL, 0x121c0e0eUL, 0xa3c26161UL, 0x5f6a3535UL, 0xf9ae5757UL, 0xd069b9b9UL, 0x91178686UL, 0x5899c1c1UL, 0x273a1d1dUL, 0xb9279e9eUL, 0x38d9e1e1UL, 0x13ebf8f8UL, 0xb32b9898UL, 0x33221111UL, 0xbbd26969UL, 0x70a9d9d9UL, 0x89078e8eUL, 0xa7339494UL, 0xb62d9b9bUL, 0x223c1e1eUL, 0x92158787UL, 0x20c9e9e9UL, 0x4987ceceUL, 0xffaa5555UL, 0x78502828UL, 0x7aa5dfdfUL, 0x8f038c8cUL, 0xf859a1a1UL, 0x80098989UL, 0x171a0d0dUL, 0xda65bfbfUL, 0x31d7e6e6UL, 0xc6844242UL, 0xb8d06868UL, 0xc3824141UL, 0xb0299999UL, 0x775a2d2dUL, 0x111e0f0fUL, 0xcb7bb0b0UL, 0xfca85454UL, 0xd66dbbbbUL, 0x3a2c1616UL }; static const SWord32 table3[] = { 0x63a5c663UL, 0x7c84f87cUL, 0x7799ee77UL, 0x7b8df67bUL, 0xf20dfff2UL, 0x6bbdd66bUL, 0x6fb1de6fUL, 0xc55491c5UL, 0x30506030UL, 0x01030201UL, 0x67a9ce67UL, 0x2b7d562bUL, 0xfe19e7feUL, 0xd762b5d7UL, 0xabe64dabUL, 0x769aec76UL, 0xca458fcaUL, 0x829d1f82UL, 0xc94089c9UL, 0x7d87fa7dUL, 0xfa15effaUL, 0x59ebb259UL, 0x47c98e47UL, 0xf00bfbf0UL, 0xadec41adUL, 0xd467b3d4UL, 0xa2fd5fa2UL, 0xafea45afUL, 0x9cbf239cUL, 0xa4f753a4UL, 0x7296e472UL, 0xc05b9bc0UL, 0xb7c275b7UL, 0xfd1ce1fdUL, 0x93ae3d93UL, 0x266a4c26UL, 0x365a6c36UL, 0x3f417e3fUL, 0xf702f5f7UL, 0xcc4f83ccUL, 0x345c6834UL, 0xa5f451a5UL, 0xe534d1e5UL, 0xf108f9f1UL, 0x7193e271UL, 0xd873abd8UL, 0x31536231UL, 0x153f2a15UL, 0x040c0804UL, 0xc75295c7UL, 0x23654623UL, 0xc35e9dc3UL, 0x18283018UL, 0x96a13796UL, 0x050f0a05UL, 0x9ab52f9aUL, 0x07090e07UL, 0x12362412UL, 0x809b1b80UL, 0xe23ddfe2UL, 0xeb26cdebUL, 0x27694e27UL, 0xb2cd7fb2UL, 0x759fea75UL, 0x091b1209UL, 0x839e1d83UL, 0x2c74582cUL, 0x1a2e341aUL, 0x1b2d361bUL, 0x6eb2dc6eUL, 0x5aeeb45aUL, 0xa0fb5ba0UL, 0x52f6a452UL, 0x3b4d763bUL, 0xd661b7d6UL, 0xb3ce7db3UL, 0x297b5229UL, 0xe33edde3UL, 0x2f715e2fUL, 0x84971384UL, 0x53f5a653UL, 0xd168b9d1UL, 0x00000000UL, 0xed2cc1edUL, 0x20604020UL, 0xfc1fe3fcUL, 0xb1c879b1UL, 0x5bedb65bUL, 0x6abed46aUL, 0xcb468dcbUL, 0xbed967beUL, 0x394b7239UL, 0x4ade944aUL, 0x4cd4984cUL, 0x58e8b058UL, 0xcf4a85cfUL, 0xd06bbbd0UL, 0xef2ac5efUL, 0xaae54faaUL, 0xfb16edfbUL, 0x43c58643UL, 0x4dd79a4dUL, 0x33556633UL, 0x85941185UL, 0x45cf8a45UL, 0xf910e9f9UL, 0x02060402UL, 0x7f81fe7fUL, 0x50f0a050UL, 0x3c44783cUL, 0x9fba259fUL, 0xa8e34ba8UL, 0x51f3a251UL, 0xa3fe5da3UL, 0x40c08040UL, 0x8f8a058fUL, 0x92ad3f92UL, 0x9dbc219dUL, 0x38487038UL, 0xf504f1f5UL, 0xbcdf63bcUL, 0xb6c177b6UL, 0xda75afdaUL, 0x21634221UL, 0x10302010UL, 0xff1ae5ffUL, 0xf30efdf3UL, 0xd26dbfd2UL, 0xcd4c81cdUL, 0x0c14180cUL, 0x13352613UL, 0xec2fc3ecUL, 0x5fe1be5fUL, 0x97a23597UL, 0x44cc8844UL, 0x17392e17UL, 0xc45793c4UL, 0xa7f255a7UL, 0x7e82fc7eUL, 0x3d477a3dUL, 0x64acc864UL, 0x5de7ba5dUL, 0x192b3219UL, 0x7395e673UL, 0x60a0c060UL, 0x81981981UL, 0x4fd19e4fUL, 0xdc7fa3dcUL, 0x22664422UL, 0x2a7e542aUL, 0x90ab3b90UL, 0x88830b88UL, 0x46ca8c46UL, 0xee29c7eeUL, 0xb8d36bb8UL, 0x143c2814UL, 0xde79a7deUL, 0x5ee2bc5eUL, 0x0b1d160bUL, 0xdb76addbUL, 0xe03bdbe0UL, 0x32566432UL, 0x3a4e743aUL, 0x0a1e140aUL, 0x49db9249UL, 0x060a0c06UL, 0x246c4824UL, 0x5ce4b85cUL, 0xc25d9fc2UL, 0xd36ebdd3UL, 0xacef43acUL, 0x62a6c462UL, 0x91a83991UL, 0x95a43195UL, 0xe437d3e4UL, 0x798bf279UL, 0xe732d5e7UL, 0xc8438bc8UL, 0x37596e37UL, 0x6db7da6dUL, 0x8d8c018dUL, 0xd564b1d5UL, 0x4ed29c4eUL, 0xa9e049a9UL, 0x6cb4d86cUL, 0x56faac56UL, 0xf407f3f4UL, 0xea25cfeaUL, 0x65afca65UL, 0x7a8ef47aUL, 0xaee947aeUL, 0x08181008UL, 0xbad56fbaUL, 0x7888f078UL, 0x256f4a25UL, 0x2e725c2eUL, 0x1c24381cUL, 0xa6f157a6UL, 0xb4c773b4UL, 0xc65197c6UL, 0xe823cbe8UL, 0xdd7ca1ddUL, 0x749ce874UL, 0x1f213e1fUL, 0x4bdd964bUL, 0xbddc61bdUL, 0x8b860d8bUL, 0x8a850f8aUL, 0x7090e070UL, 0x3e427c3eUL, 0xb5c471b5UL, 0x66aacc66UL, 0x48d89048UL, 0x03050603UL, 0xf601f7f6UL, 0x0e121c0eUL, 0x61a3c261UL, 0x355f6a35UL, 0x57f9ae57UL, 0xb9d069b9UL, 0x86911786UL, 0xc15899c1UL, 0x1d273a1dUL, 0x9eb9279eUL, 0xe138d9e1UL, 0xf813ebf8UL, 0x98b32b98UL, 0x11332211UL, 0x69bbd269UL, 0xd970a9d9UL, 0x8e89078eUL, 0x94a73394UL, 0x9bb62d9bUL, 0x1e223c1eUL, 0x87921587UL, 0xe920c9e9UL, 0xce4987ceUL, 0x55ffaa55UL, 0x28785028UL, 0xdf7aa5dfUL, 0x8c8f038cUL, 0xa1f859a1UL, 0x89800989UL, 0x0d171a0dUL, 0xbfda65bfUL, 0xe631d7e6UL, 0x42c68442UL, 0x68b8d068UL, 0x41c38241UL, 0x99b02999UL, 0x2d775a2dUL, 0x0f111e0fUL, 0xb0cb7bb0UL, 0x54fca854UL, 0xbbd66dbbUL, 0x163a2c16UL }; static const SWord32 table4[] = { 0x6363a5c6UL, 0x7c7c84f8UL, 0x777799eeUL, 0x7b7b8df6UL, 0xf2f20dffUL, 0x6b6bbdd6UL, 0x6f6fb1deUL, 0xc5c55491UL, 0x30305060UL, 0x01010302UL, 0x6767a9ceUL, 0x2b2b7d56UL, 0xfefe19e7UL, 0xd7d762b5UL, 0xababe64dUL, 0x76769aecUL, 0xcaca458fUL, 0x82829d1fUL, 0xc9c94089UL, 0x7d7d87faUL, 0xfafa15efUL, 0x5959ebb2UL, 0x4747c98eUL, 0xf0f00bfbUL, 0xadadec41UL, 0xd4d467b3UL, 0xa2a2fd5fUL, 0xafafea45UL, 0x9c9cbf23UL, 0xa4a4f753UL, 0x727296e4UL, 0xc0c05b9bUL, 0xb7b7c275UL, 0xfdfd1ce1UL, 0x9393ae3dUL, 0x26266a4cUL, 0x36365a6cUL, 0x3f3f417eUL, 0xf7f702f5UL, 0xcccc4f83UL, 0x34345c68UL, 0xa5a5f451UL, 0xe5e534d1UL, 0xf1f108f9UL, 0x717193e2UL, 0xd8d873abUL, 0x31315362UL, 0x15153f2aUL, 0x04040c08UL, 0xc7c75295UL, 0x23236546UL, 0xc3c35e9dUL, 0x18182830UL, 0x9696a137UL, 0x05050f0aUL, 0x9a9ab52fUL, 0x0707090eUL, 0x12123624UL, 0x80809b1bUL, 0xe2e23ddfUL, 0xebeb26cdUL, 0x2727694eUL, 0xb2b2cd7fUL, 0x75759feaUL, 0x09091b12UL, 0x83839e1dUL, 0x2c2c7458UL, 0x1a1a2e34UL, 0x1b1b2d36UL, 0x6e6eb2dcUL, 0x5a5aeeb4UL, 0xa0a0fb5bUL, 0x5252f6a4UL, 0x3b3b4d76UL, 0xd6d661b7UL, 0xb3b3ce7dUL, 0x29297b52UL, 0xe3e33eddUL, 0x2f2f715eUL, 0x84849713UL, 0x5353f5a6UL, 0xd1d168b9UL, 0x00000000UL, 0xeded2cc1UL, 0x20206040UL, 0xfcfc1fe3UL, 0xb1b1c879UL, 0x5b5bedb6UL, 0x6a6abed4UL, 0xcbcb468dUL, 0xbebed967UL, 0x39394b72UL, 0x4a4ade94UL, 0x4c4cd498UL, 0x5858e8b0UL, 0xcfcf4a85UL, 0xd0d06bbbUL, 0xefef2ac5UL, 0xaaaae54fUL, 0xfbfb16edUL, 0x4343c586UL, 0x4d4dd79aUL, 0x33335566UL, 0x85859411UL, 0x4545cf8aUL, 0xf9f910e9UL, 0x02020604UL, 0x7f7f81feUL, 0x5050f0a0UL, 0x3c3c4478UL, 0x9f9fba25UL, 0xa8a8e34bUL, 0x5151f3a2UL, 0xa3a3fe5dUL, 0x4040c080UL, 0x8f8f8a05UL, 0x9292ad3fUL, 0x9d9dbc21UL, 0x38384870UL, 0xf5f504f1UL, 0xbcbcdf63UL, 0xb6b6c177UL, 0xdada75afUL, 0x21216342UL, 0x10103020UL, 0xffff1ae5UL, 0xf3f30efdUL, 0xd2d26dbfUL, 0xcdcd4c81UL, 0x0c0c1418UL, 0x13133526UL, 0xecec2fc3UL, 0x5f5fe1beUL, 0x9797a235UL, 0x4444cc88UL, 0x1717392eUL, 0xc4c45793UL, 0xa7a7f255UL, 0x7e7e82fcUL, 0x3d3d477aUL, 0x6464acc8UL, 0x5d5de7baUL, 0x19192b32UL, 0x737395e6UL, 0x6060a0c0UL, 0x81819819UL, 0x4f4fd19eUL, 0xdcdc7fa3UL, 0x22226644UL, 0x2a2a7e54UL, 0x9090ab3bUL, 0x8888830bUL, 0x4646ca8cUL, 0xeeee29c7UL, 0xb8b8d36bUL, 0x14143c28UL, 0xdede79a7UL, 0x5e5ee2bcUL, 0x0b0b1d16UL, 0xdbdb76adUL, 0xe0e03bdbUL, 0x32325664UL, 0x3a3a4e74UL, 0x0a0a1e14UL, 0x4949db92UL, 0x06060a0cUL, 0x24246c48UL, 0x5c5ce4b8UL, 0xc2c25d9fUL, 0xd3d36ebdUL, 0xacacef43UL, 0x6262a6c4UL, 0x9191a839UL, 0x9595a431UL, 0xe4e437d3UL, 0x79798bf2UL, 0xe7e732d5UL, 0xc8c8438bUL, 0x3737596eUL, 0x6d6db7daUL, 0x8d8d8c01UL, 0xd5d564b1UL, 0x4e4ed29cUL, 0xa9a9e049UL, 0x6c6cb4d8UL, 0x5656faacUL, 0xf4f407f3UL, 0xeaea25cfUL, 0x6565afcaUL, 0x7a7a8ef4UL, 0xaeaee947UL, 0x08081810UL, 0xbabad56fUL, 0x787888f0UL, 0x25256f4aUL, 0x2e2e725cUL, 0x1c1c2438UL, 0xa6a6f157UL, 0xb4b4c773UL, 0xc6c65197UL, 0xe8e823cbUL, 0xdddd7ca1UL, 0x74749ce8UL, 0x1f1f213eUL, 0x4b4bdd96UL, 0xbdbddc61UL, 0x8b8b860dUL, 0x8a8a850fUL, 0x707090e0UL, 0x3e3e427cUL, 0xb5b5c471UL, 0x6666aaccUL, 0x4848d890UL, 0x03030506UL, 0xf6f601f7UL, 0x0e0e121cUL, 0x6161a3c2UL, 0x35355f6aUL, 0x5757f9aeUL, 0xb9b9d069UL, 0x86869117UL, 0xc1c15899UL, 0x1d1d273aUL, 0x9e9eb927UL, 0xe1e138d9UL, 0xf8f813ebUL, 0x9898b32bUL, 0x11113322UL, 0x6969bbd2UL, 0xd9d970a9UL, 0x8e8e8907UL, 0x9494a733UL, 0x9b9bb62dUL, 0x1e1e223cUL, 0x87879215UL, 0xe9e920c9UL, 0xcece4987UL, 0x5555ffaaUL, 0x28287850UL, 0xdfdf7aa5UL, 0x8c8c8f03UL, 0xa1a1f859UL, 0x89898009UL, 0x0d0d171aUL, 0xbfbfda65UL, 0xe6e631d7UL, 0x4242c684UL, 0x6868b8d0UL, 0x4141c382UL, 0x9999b029UL, 0x2d2d775aUL, 0x0f0f111eUL, 0xb0b0cb7bUL, 0x5454fca8UL, 0xbbbbd66dUL, 0x16163a2cUL }; const SWord32 s520 = s0 ^ s4; const SWord16 s521 = (SWord16) (s520 >> 16); const SWord8 s522 = (SWord8) (s521 >> 8); const SWord32 s523 = table1[s522]; const SWord32 s779 = s1 ^ s5; const SWord16 s780 = (SWord16) (s779 >> 16); const SWord8 s781 = (SWord8) s780; const SWord32 s782 = table2[s781]; const SWord32 s783 = s523 ^ s782; const SWord32 s1039 = s2 ^ s6; const SWord16 s1040 = (SWord16) s1039; const SWord8 s1041 = (SWord8) (s1040 >> 8); const SWord32 s1042 = table3[s1041]; const SWord32 s1043 = s783 ^ s1042; const SWord32 s1299 = s3 ^ s7; const SWord16 s1300 = (SWord16) s1299; const SWord8 s1301 = (SWord8) s1300; const SWord32 s1302 = table4[s1301]; const SWord32 s1303 = s1043 ^ s1302; const SWord32 s1304 = (s7 << 8) | (s7 >> 24); const SWord16 s1305 = (SWord16) (s1304 >> 16); const SWord8 s1306 = (SWord8) (s1305 >> 8); const SWord8 s1307 = table0[s1306]; const SWord8 s1308 = 1 ^ s1307; const SWord8 s1309 = (SWord8) s1305; const SWord8 s1310 = table0[s1309]; const SWord16 s1311 = (((SWord16) s1308) << 8) | ((SWord16) s1310); const SWord16 s1312 = (SWord16) s1304; const SWord8 s1313 = (SWord8) (s1312 >> 8); const SWord8 s1314 = table0[s1313]; const SWord8 s1315 = (SWord8) s1312; const SWord8 s1316 = table0[s1315]; const SWord16 s1317 = (((SWord16) s1314) << 8) | ((SWord16) s1316); const SWord32 s1318 = (((SWord32) s1311) << 16) | ((SWord32) s1317); const SWord32 s1319 = s4 ^ s1318; const SWord32 s1320 = s1303 ^ s1319; const SWord16 s1321 = (SWord16) (s1320 >> 16); const SWord8 s1322 = (SWord8) (s1321 >> 8); const SWord32 s1323 = table1[s1322]; const SWord8 s1324 = (SWord8) (s780 >> 8); const SWord32 s1325 = table1[s1324]; const SWord16 s1326 = (SWord16) (s1039 >> 16); const SWord8 s1327 = (SWord8) s1326; const SWord32 s1328 = table2[s1327]; const SWord32 s1329 = s1325 ^ s1328; const SWord8 s1330 = (SWord8) (s1300 >> 8); const SWord32 s1331 = table3[s1330]; const SWord32 s1332 = s1329 ^ s1331; const SWord16 s1333 = (SWord16) s520; const SWord8 s1334 = (SWord8) s1333; const SWord32 s1335 = table4[s1334]; const SWord32 s1336 = s1332 ^ s1335; const SWord32 s1337 = s5 ^ s1319; const SWord32 s1338 = s1336 ^ s1337; const SWord16 s1339 = (SWord16) (s1338 >> 16); const SWord8 s1340 = (SWord8) s1339; const SWord32 s1341 = table2[s1340]; const SWord32 s1342 = s1323 ^ s1341; const SWord8 s1343 = (SWord8) (s1326 >> 8); const SWord32 s1344 = table1[s1343]; const SWord16 s1345 = (SWord16) (s1299 >> 16); const SWord8 s1346 = (SWord8) s1345; const SWord32 s1347 = table2[s1346]; const SWord32 s1348 = s1344 ^ s1347; const SWord8 s1349 = (SWord8) (s1333 >> 8); const SWord32 s1350 = table3[s1349]; const SWord32 s1351 = s1348 ^ s1350; const SWord16 s1352 = (SWord16) s779; const SWord8 s1353 = (SWord8) s1352; const SWord32 s1354 = table4[s1353]; const SWord32 s1355 = s1351 ^ s1354; const SWord32 s1356 = s6 ^ s1337; const SWord32 s1357 = s1355 ^ s1356; const SWord16 s1358 = (SWord16) s1357; const SWord8 s1359 = (SWord8) (s1358 >> 8); const SWord32 s1360 = table3[s1359]; const SWord32 s1361 = s1342 ^ s1360; const SWord8 s1362 = (SWord8) (s1345 >> 8); const SWord32 s1363 = table1[s1362]; const SWord8 s1364 = (SWord8) s521; const SWord32 s1365 = table2[s1364]; const SWord32 s1366 = s1363 ^ s1365; const SWord8 s1367 = (SWord8) (s1352 >> 8); const SWord32 s1368 = table3[s1367]; const SWord32 s1369 = s1366 ^ s1368; const SWord8 s1370 = (SWord8) s1040; const SWord32 s1371 = table4[s1370]; const SWord32 s1372 = s1369 ^ s1371; const SWord32 s1373 = s7 ^ s1356; const SWord32 s1374 = s1372 ^ s1373; const SWord16 s1375 = (SWord16) s1374; const SWord8 s1376 = (SWord8) s1375; const SWord32 s1377 = table4[s1376]; const SWord32 s1378 = s1361 ^ s1377; const SWord32 s1379 = (s1373 << 8) | (s1373 >> 24); const SWord16 s1380 = (SWord16) (s1379 >> 16); const SWord8 s1381 = (SWord8) (s1380 >> 8); const SWord8 s1382 = table0[s1381]; const SWord8 s1383 = 2 ^ s1382; const SWord8 s1384 = (SWord8) s1380; const SWord8 s1385 = table0[s1384]; const SWord16 s1386 = (((SWord16) s1383) << 8) | ((SWord16) s1385); const SWord16 s1387 = (SWord16) s1379; const SWord8 s1388 = (SWord8) (s1387 >> 8); const SWord8 s1389 = table0[s1388]; const SWord8 s1390 = (SWord8) s1387; const SWord8 s1391 = table0[s1390]; const SWord16 s1392 = (((SWord16) s1389) << 8) | ((SWord16) s1391); const SWord32 s1393 = (((SWord32) s1386) << 16) | ((SWord32) s1392); const SWord32 s1394 = s1319 ^ s1393; const SWord32 s1395 = s1378 ^ s1394; const SWord16 s1396 = (SWord16) (s1395 >> 16); const SWord8 s1397 = (SWord8) (s1396 >> 8); const SWord32 s1398 = table1[s1397]; const SWord8 s1399 = (SWord8) (s1339 >> 8); const SWord32 s1400 = table1[s1399]; const SWord16 s1401 = (SWord16) (s1357 >> 16); const SWord8 s1402 = (SWord8) s1401; const SWord32 s1403 = table2[s1402]; const SWord32 s1404 = s1400 ^ s1403; const SWord8 s1405 = (SWord8) (s1375 >> 8); const SWord32 s1406 = table3[s1405]; const SWord32 s1407 = s1404 ^ s1406; const SWord16 s1408 = (SWord16) s1320; const SWord8 s1409 = (SWord8) s1408; const SWord32 s1410 = table4[s1409]; const SWord32 s1411 = s1407 ^ s1410; const SWord32 s1412 = s1337 ^ s1394; const SWord32 s1413 = s1411 ^ s1412; const SWord16 s1414 = (SWord16) (s1413 >> 16); const SWord8 s1415 = (SWord8) s1414; const SWord32 s1416 = table2[s1415]; const SWord32 s1417 = s1398 ^ s1416; const SWord8 s1418 = (SWord8) (s1401 >> 8); const SWord32 s1419 = table1[s1418]; const SWord16 s1420 = (SWord16) (s1374 >> 16); const SWord8 s1421 = (SWord8) s1420; const SWord32 s1422 = table2[s1421]; const SWord32 s1423 = s1419 ^ s1422; const SWord8 s1424 = (SWord8) (s1408 >> 8); const SWord32 s1425 = table3[s1424]; const SWord32 s1426 = s1423 ^ s1425; const SWord16 s1427 = (SWord16) s1338; const SWord8 s1428 = (SWord8) s1427; const SWord32 s1429 = table4[s1428]; const SWord32 s1430 = s1426 ^ s1429; const SWord32 s1431 = s1356 ^ s1412; const SWord32 s1432 = s1430 ^ s1431; const SWord16 s1433 = (SWord16) s1432; const SWord8 s1434 = (SWord8) (s1433 >> 8); const SWord32 s1435 = table3[s1434]; const SWord32 s1436 = s1417 ^ s1435; const SWord8 s1437 = (SWord8) (s1420 >> 8); const SWord32 s1438 = table1[s1437]; const SWord8 s1439 = (SWord8) s1321; const SWord32 s1440 = table2[s1439]; const SWord32 s1441 = s1438 ^ s1440; const SWord8 s1442 = (SWord8) (s1427 >> 8); const SWord32 s1443 = table3[s1442]; const SWord32 s1444 = s1441 ^ s1443; const SWord8 s1445 = (SWord8) s1358; const SWord32 s1446 = table4[s1445]; const SWord32 s1447 = s1444 ^ s1446; const SWord32 s1448 = s1373 ^ s1431; const SWord32 s1449 = s1447 ^ s1448; const SWord16 s1450 = (SWord16) s1449; const SWord8 s1451 = (SWord8) s1450; const SWord32 s1452 = table4[s1451]; const SWord32 s1453 = s1436 ^ s1452; const SWord32 s1454 = (s1448 << 8) | (s1448 >> 24); const SWord16 s1455 = (SWord16) (s1454 >> 16); const SWord8 s1456 = (SWord8) (s1455 >> 8); const SWord8 s1457 = table0[s1456]; const SWord8 s1458 = 4 ^ s1457; const SWord8 s1459 = (SWord8) s1455; const SWord8 s1460 = table0[s1459]; const SWord16 s1461 = (((SWord16) s1458) << 8) | ((SWord16) s1460); const SWord16 s1462 = (SWord16) s1454; const SWord8 s1463 = (SWord8) (s1462 >> 8); const SWord8 s1464 = table0[s1463]; const SWord8 s1465 = (SWord8) s1462; const SWord8 s1466 = table0[s1465]; const SWord16 s1467 = (((SWord16) s1464) << 8) | ((SWord16) s1466); const SWord32 s1468 = (((SWord32) s1461) << 16) | ((SWord32) s1467); const SWord32 s1469 = s1394 ^ s1468; const SWord32 s1470 = s1453 ^ s1469; const SWord16 s1471 = (SWord16) (s1470 >> 16); const SWord8 s1472 = (SWord8) (s1471 >> 8); const SWord32 s1473 = table1[s1472]; const SWord8 s1474 = (SWord8) (s1414 >> 8); const SWord32 s1475 = table1[s1474]; const SWord16 s1476 = (SWord16) (s1432 >> 16); const SWord8 s1477 = (SWord8) s1476; const SWord32 s1478 = table2[s1477]; const SWord32 s1479 = s1475 ^ s1478; const SWord8 s1480 = (SWord8) (s1450 >> 8); const SWord32 s1481 = table3[s1480]; const SWord32 s1482 = s1479 ^ s1481; const SWord16 s1483 = (SWord16) s1395; const SWord8 s1484 = (SWord8) s1483; const SWord32 s1485 = table4[s1484]; const SWord32 s1486 = s1482 ^ s1485; const SWord32 s1487 = s1412 ^ s1469; const SWord32 s1488 = s1486 ^ s1487; const SWord16 s1489 = (SWord16) (s1488 >> 16); const SWord8 s1490 = (SWord8) s1489; const SWord32 s1491 = table2[s1490]; const SWord32 s1492 = s1473 ^ s1491; const SWord8 s1493 = (SWord8) (s1476 >> 8); const SWord32 s1494 = table1[s1493]; const SWord16 s1495 = (SWord16) (s1449 >> 16); const SWord8 s1496 = (SWord8) s1495; const SWord32 s1497 = table2[s1496]; const SWord32 s1498 = s1494 ^ s1497; const SWord8 s1499 = (SWord8) (s1483 >> 8); const SWord32 s1500 = table3[s1499]; const SWord32 s1501 = s1498 ^ s1500; const SWord16 s1502 = (SWord16) s1413; const SWord8 s1503 = (SWord8) s1502; const SWord32 s1504 = table4[s1503]; const SWord32 s1505 = s1501 ^ s1504; const SWord32 s1506 = s1431 ^ s1487; const SWord32 s1507 = s1505 ^ s1506; const SWord16 s1508 = (SWord16) s1507; const SWord8 s1509 = (SWord8) (s1508 >> 8); const SWord32 s1510 = table3[s1509]; const SWord32 s1511 = s1492 ^ s1510; const SWord8 s1512 = (SWord8) (s1495 >> 8); const SWord32 s1513 = table1[s1512]; const SWord8 s1514 = (SWord8) s1396; const SWord32 s1515 = table2[s1514]; const SWord32 s1516 = s1513 ^ s1515; const SWord8 s1517 = (SWord8) (s1502 >> 8); const SWord32 s1518 = table3[s1517]; const SWord32 s1519 = s1516 ^ s1518; const SWord8 s1520 = (SWord8) s1433; const SWord32 s1521 = table4[s1520]; const SWord32 s1522 = s1519 ^ s1521; const SWord32 s1523 = s1448 ^ s1506; const SWord32 s1524 = s1522 ^ s1523; const SWord16 s1525 = (SWord16) s1524; const SWord8 s1526 = (SWord8) s1525; const SWord32 s1527 = table4[s1526]; const SWord32 s1528 = s1511 ^ s1527; const SWord32 s1529 = (s1523 << 8) | (s1523 >> 24); const SWord16 s1530 = (SWord16) (s1529 >> 16); const SWord8 s1531 = (SWord8) (s1530 >> 8); const SWord8 s1532 = table0[s1531]; const SWord8 s1533 = 8 ^ s1532; const SWord8 s1534 = (SWord8) s1530; const SWord8 s1535 = table0[s1534]; const SWord16 s1536 = (((SWord16) s1533) << 8) | ((SWord16) s1535); const SWord16 s1537 = (SWord16) s1529; const SWord8 s1538 = (SWord8) (s1537 >> 8); const SWord8 s1539 = table0[s1538]; const SWord8 s1540 = (SWord8) s1537; const SWord8 s1541 = table0[s1540]; const SWord16 s1542 = (((SWord16) s1539) << 8) | ((SWord16) s1541); const SWord32 s1543 = (((SWord32) s1536) << 16) | ((SWord32) s1542); const SWord32 s1544 = s1469 ^ s1543; const SWord32 s1545 = s1528 ^ s1544; const SWord16 s1546 = (SWord16) (s1545 >> 16); const SWord8 s1547 = (SWord8) (s1546 >> 8); const SWord32 s1548 = table1[s1547]; const SWord8 s1549 = (SWord8) (s1489 >> 8); const SWord32 s1550 = table1[s1549]; const SWord16 s1551 = (SWord16) (s1507 >> 16); const SWord8 s1552 = (SWord8) s1551; const SWord32 s1553 = table2[s1552]; const SWord32 s1554 = s1550 ^ s1553; const SWord8 s1555 = (SWord8) (s1525 >> 8); const SWord32 s1556 = table3[s1555]; const SWord32 s1557 = s1554 ^ s1556; const SWord16 s1558 = (SWord16) s1470; const SWord8 s1559 = (SWord8) s1558; const SWord32 s1560 = table4[s1559]; const SWord32 s1561 = s1557 ^ s1560; const SWord32 s1562 = s1487 ^ s1544; const SWord32 s1563 = s1561 ^ s1562; const SWord16 s1564 = (SWord16) (s1563 >> 16); const SWord8 s1565 = (SWord8) s1564; const SWord32 s1566 = table2[s1565]; const SWord32 s1567 = s1548 ^ s1566; const SWord8 s1568 = (SWord8) (s1551 >> 8); const SWord32 s1569 = table1[s1568]; const SWord16 s1570 = (SWord16) (s1524 >> 16); const SWord8 s1571 = (SWord8) s1570; const SWord32 s1572 = table2[s1571]; const SWord32 s1573 = s1569 ^ s1572; const SWord8 s1574 = (SWord8) (s1558 >> 8); const SWord32 s1575 = table3[s1574]; const SWord32 s1576 = s1573 ^ s1575; const SWord16 s1577 = (SWord16) s1488; const SWord8 s1578 = (SWord8) s1577; const SWord32 s1579 = table4[s1578]; const SWord32 s1580 = s1576 ^ s1579; const SWord32 s1581 = s1506 ^ s1562; const SWord32 s1582 = s1580 ^ s1581; const SWord16 s1583 = (SWord16) s1582; const SWord8 s1584 = (SWord8) (s1583 >> 8); const SWord32 s1585 = table3[s1584]; const SWord32 s1586 = s1567 ^ s1585; const SWord8 s1587 = (SWord8) (s1570 >> 8); const SWord32 s1588 = table1[s1587]; const SWord8 s1589 = (SWord8) s1471; const SWord32 s1590 = table2[s1589]; const SWord32 s1591 = s1588 ^ s1590; const SWord8 s1592 = (SWord8) (s1577 >> 8); const SWord32 s1593 = table3[s1592]; const SWord32 s1594 = s1591 ^ s1593; const SWord8 s1595 = (SWord8) s1508; const SWord32 s1596 = table4[s1595]; const SWord32 s1597 = s1594 ^ s1596; const SWord32 s1598 = s1523 ^ s1581; const SWord32 s1599 = s1597 ^ s1598; const SWord16 s1600 = (SWord16) s1599; const SWord8 s1601 = (SWord8) s1600; const SWord32 s1602 = table4[s1601]; const SWord32 s1603 = s1586 ^ s1602; const SWord32 s1604 = (s1598 << 8) | (s1598 >> 24); const SWord16 s1605 = (SWord16) (s1604 >> 16); const SWord8 s1606 = (SWord8) (s1605 >> 8); const SWord8 s1607 = table0[s1606]; const SWord8 s1608 = 16 ^ s1607; const SWord8 s1609 = (SWord8) s1605; const SWord8 s1610 = table0[s1609]; const SWord16 s1611 = (((SWord16) s1608) << 8) | ((SWord16) s1610); const SWord16 s1612 = (SWord16) s1604; const SWord8 s1613 = (SWord8) (s1612 >> 8); const SWord8 s1614 = table0[s1613]; const SWord8 s1615 = (SWord8) s1612; const SWord8 s1616 = table0[s1615]; const SWord16 s1617 = (((SWord16) s1614) << 8) | ((SWord16) s1616); const SWord32 s1618 = (((SWord32) s1611) << 16) | ((SWord32) s1617); const SWord32 s1619 = s1544 ^ s1618; const SWord32 s1620 = s1603 ^ s1619; const SWord16 s1621 = (SWord16) (s1620 >> 16); const SWord8 s1622 = (SWord8) (s1621 >> 8); const SWord32 s1623 = table1[s1622]; const SWord8 s1624 = (SWord8) (s1564 >> 8); const SWord32 s1625 = table1[s1624]; const SWord16 s1626 = (SWord16) (s1582 >> 16); const SWord8 s1627 = (SWord8) s1626; const SWord32 s1628 = table2[s1627]; const SWord32 s1629 = s1625 ^ s1628; const SWord8 s1630 = (SWord8) (s1600 >> 8); const SWord32 s1631 = table3[s1630]; const SWord32 s1632 = s1629 ^ s1631; const SWord16 s1633 = (SWord16) s1545; const SWord8 s1634 = (SWord8) s1633; const SWord32 s1635 = table4[s1634]; const SWord32 s1636 = s1632 ^ s1635; const SWord32 s1637 = s1562 ^ s1619; const SWord32 s1638 = s1636 ^ s1637; const SWord16 s1639 = (SWord16) (s1638 >> 16); const SWord8 s1640 = (SWord8) s1639; const SWord32 s1641 = table2[s1640]; const SWord32 s1642 = s1623 ^ s1641; const SWord8 s1643 = (SWord8) (s1626 >> 8); const SWord32 s1644 = table1[s1643]; const SWord16 s1645 = (SWord16) (s1599 >> 16); const SWord8 s1646 = (SWord8) s1645; const SWord32 s1647 = table2[s1646]; const SWord32 s1648 = s1644 ^ s1647; const SWord8 s1649 = (SWord8) (s1633 >> 8); const SWord32 s1650 = table3[s1649]; const SWord32 s1651 = s1648 ^ s1650; const SWord16 s1652 = (SWord16) s1563; const SWord8 s1653 = (SWord8) s1652; const SWord32 s1654 = table4[s1653]; const SWord32 s1655 = s1651 ^ s1654; const SWord32 s1656 = s1581 ^ s1637; const SWord32 s1657 = s1655 ^ s1656; const SWord16 s1658 = (SWord16) s1657; const SWord8 s1659 = (SWord8) (s1658 >> 8); const SWord32 s1660 = table3[s1659]; const SWord32 s1661 = s1642 ^ s1660; const SWord8 s1662 = (SWord8) (s1645 >> 8); const SWord32 s1663 = table1[s1662]; const SWord8 s1664 = (SWord8) s1546; const SWord32 s1665 = table2[s1664]; const SWord32 s1666 = s1663 ^ s1665; const SWord8 s1667 = (SWord8) (s1652 >> 8); const SWord32 s1668 = table3[s1667]; const SWord32 s1669 = s1666 ^ s1668; const SWord8 s1670 = (SWord8) s1583; const SWord32 s1671 = table4[s1670]; const SWord32 s1672 = s1669 ^ s1671; const SWord32 s1673 = s1598 ^ s1656; const SWord32 s1674 = s1672 ^ s1673; const SWord16 s1675 = (SWord16) s1674; const SWord8 s1676 = (SWord8) s1675; const SWord32 s1677 = table4[s1676]; const SWord32 s1678 = s1661 ^ s1677; const SWord32 s1679 = (s1673 << 8) | (s1673 >> 24); const SWord16 s1680 = (SWord16) (s1679 >> 16); const SWord8 s1681 = (SWord8) (s1680 >> 8); const SWord8 s1682 = table0[s1681]; const SWord8 s1683 = 32 ^ s1682; const SWord8 s1684 = (SWord8) s1680; const SWord8 s1685 = table0[s1684]; const SWord16 s1686 = (((SWord16) s1683) << 8) | ((SWord16) s1685); const SWord16 s1687 = (SWord16) s1679; const SWord8 s1688 = (SWord8) (s1687 >> 8); const SWord8 s1689 = table0[s1688]; const SWord8 s1690 = (SWord8) s1687; const SWord8 s1691 = table0[s1690]; const SWord16 s1692 = (((SWord16) s1689) << 8) | ((SWord16) s1691); const SWord32 s1693 = (((SWord32) s1686) << 16) | ((SWord32) s1692); const SWord32 s1694 = s1619 ^ s1693; const SWord32 s1695 = s1678 ^ s1694; const SWord16 s1696 = (SWord16) (s1695 >> 16); const SWord8 s1697 = (SWord8) (s1696 >> 8); const SWord32 s1698 = table1[s1697]; const SWord8 s1699 = (SWord8) (s1639 >> 8); const SWord32 s1700 = table1[s1699]; const SWord16 s1701 = (SWord16) (s1657 >> 16); const SWord8 s1702 = (SWord8) s1701; const SWord32 s1703 = table2[s1702]; const SWord32 s1704 = s1700 ^ s1703; const SWord8 s1705 = (SWord8) (s1675 >> 8); const SWord32 s1706 = table3[s1705]; const SWord32 s1707 = s1704 ^ s1706; const SWord16 s1708 = (SWord16) s1620; const SWord8 s1709 = (SWord8) s1708; const SWord32 s1710 = table4[s1709]; const SWord32 s1711 = s1707 ^ s1710; const SWord32 s1712 = s1637 ^ s1694; const SWord32 s1713 = s1711 ^ s1712; const SWord16 s1714 = (SWord16) (s1713 >> 16); const SWord8 s1715 = (SWord8) s1714; const SWord32 s1716 = table2[s1715]; const SWord32 s1717 = s1698 ^ s1716; const SWord8 s1718 = (SWord8) (s1701 >> 8); const SWord32 s1719 = table1[s1718]; const SWord16 s1720 = (SWord16) (s1674 >> 16); const SWord8 s1721 = (SWord8) s1720; const SWord32 s1722 = table2[s1721]; const SWord32 s1723 = s1719 ^ s1722; const SWord8 s1724 = (SWord8) (s1708 >> 8); const SWord32 s1725 = table3[s1724]; const SWord32 s1726 = s1723 ^ s1725; const SWord16 s1727 = (SWord16) s1638; const SWord8 s1728 = (SWord8) s1727; const SWord32 s1729 = table4[s1728]; const SWord32 s1730 = s1726 ^ s1729; const SWord32 s1731 = s1656 ^ s1712; const SWord32 s1732 = s1730 ^ s1731; const SWord16 s1733 = (SWord16) s1732; const SWord8 s1734 = (SWord8) (s1733 >> 8); const SWord32 s1735 = table3[s1734]; const SWord32 s1736 = s1717 ^ s1735; const SWord8 s1737 = (SWord8) (s1720 >> 8); const SWord32 s1738 = table1[s1737]; const SWord8 s1739 = (SWord8) s1621; const SWord32 s1740 = table2[s1739]; const SWord32 s1741 = s1738 ^ s1740; const SWord8 s1742 = (SWord8) (s1727 >> 8); const SWord32 s1743 = table3[s1742]; const SWord32 s1744 = s1741 ^ s1743; const SWord8 s1745 = (SWord8) s1658; const SWord32 s1746 = table4[s1745]; const SWord32 s1747 = s1744 ^ s1746; const SWord32 s1748 = s1673 ^ s1731; const SWord32 s1749 = s1747 ^ s1748; const SWord16 s1750 = (SWord16) s1749; const SWord8 s1751 = (SWord8) s1750; const SWord32 s1752 = table4[s1751]; const SWord32 s1753 = s1736 ^ s1752; const SWord32 s1754 = (s1748 << 8) | (s1748 >> 24); const SWord16 s1755 = (SWord16) (s1754 >> 16); const SWord8 s1756 = (SWord8) (s1755 >> 8); const SWord8 s1757 = table0[s1756]; const SWord8 s1758 = 64 ^ s1757; const SWord8 s1759 = (SWord8) s1755; const SWord8 s1760 = table0[s1759]; const SWord16 s1761 = (((SWord16) s1758) << 8) | ((SWord16) s1760); const SWord16 s1762 = (SWord16) s1754; const SWord8 s1763 = (SWord8) (s1762 >> 8); const SWord8 s1764 = table0[s1763]; const SWord8 s1765 = (SWord8) s1762; const SWord8 s1766 = table0[s1765]; const SWord16 s1767 = (((SWord16) s1764) << 8) | ((SWord16) s1766); const SWord32 s1768 = (((SWord32) s1761) << 16) | ((SWord32) s1767); const SWord32 s1769 = s1694 ^ s1768; const SWord32 s1770 = s1753 ^ s1769; const SWord16 s1771 = (SWord16) (s1770 >> 16); const SWord8 s1772 = (SWord8) (s1771 >> 8); const SWord32 s1773 = table1[s1772]; const SWord8 s1774 = (SWord8) (s1714 >> 8); const SWord32 s1775 = table1[s1774]; const SWord16 s1776 = (SWord16) (s1732 >> 16); const SWord8 s1777 = (SWord8) s1776; const SWord32 s1778 = table2[s1777]; const SWord32 s1779 = s1775 ^ s1778; const SWord8 s1780 = (SWord8) (s1750 >> 8); const SWord32 s1781 = table3[s1780]; const SWord32 s1782 = s1779 ^ s1781; const SWord16 s1783 = (SWord16) s1695; const SWord8 s1784 = (SWord8) s1783; const SWord32 s1785 = table4[s1784]; const SWord32 s1786 = s1782 ^ s1785; const SWord32 s1787 = s1712 ^ s1769; const SWord32 s1788 = s1786 ^ s1787; const SWord16 s1789 = (SWord16) (s1788 >> 16); const SWord8 s1790 = (SWord8) s1789; const SWord32 s1791 = table2[s1790]; const SWord32 s1792 = s1773 ^ s1791; const SWord8 s1793 = (SWord8) (s1776 >> 8); const SWord32 s1794 = table1[s1793]; const SWord16 s1795 = (SWord16) (s1749 >> 16); const SWord8 s1796 = (SWord8) s1795; const SWord32 s1797 = table2[s1796]; const SWord32 s1798 = s1794 ^ s1797; const SWord8 s1799 = (SWord8) (s1783 >> 8); const SWord32 s1800 = table3[s1799]; const SWord32 s1801 = s1798 ^ s1800; const SWord16 s1802 = (SWord16) s1713; const SWord8 s1803 = (SWord8) s1802; const SWord32 s1804 = table4[s1803]; const SWord32 s1805 = s1801 ^ s1804; const SWord32 s1806 = s1731 ^ s1787; const SWord32 s1807 = s1805 ^ s1806; const SWord16 s1808 = (SWord16) s1807; const SWord8 s1809 = (SWord8) (s1808 >> 8); const SWord32 s1810 = table3[s1809]; const SWord32 s1811 = s1792 ^ s1810; const SWord8 s1812 = (SWord8) (s1795 >> 8); const SWord32 s1813 = table1[s1812]; const SWord8 s1814 = (SWord8) s1696; const SWord32 s1815 = table2[s1814]; const SWord32 s1816 = s1813 ^ s1815; const SWord8 s1817 = (SWord8) (s1802 >> 8); const SWord32 s1818 = table3[s1817]; const SWord32 s1819 = s1816 ^ s1818; const SWord8 s1820 = (SWord8) s1733; const SWord32 s1821 = table4[s1820]; const SWord32 s1822 = s1819 ^ s1821; const SWord32 s1823 = s1748 ^ s1806; const SWord32 s1824 = s1822 ^ s1823; const SWord16 s1825 = (SWord16) s1824; const SWord8 s1826 = (SWord8) s1825; const SWord32 s1827 = table4[s1826]; const SWord32 s1828 = s1811 ^ s1827; const SWord32 s1829 = (s1823 << 8) | (s1823 >> 24); const SWord16 s1830 = (SWord16) (s1829 >> 16); const SWord8 s1831 = (SWord8) (s1830 >> 8); const SWord8 s1832 = table0[s1831]; const SWord8 s1833 = 128 ^ s1832; const SWord8 s1834 = (SWord8) s1830; const SWord8 s1835 = table0[s1834]; const SWord16 s1836 = (((SWord16) s1833) << 8) | ((SWord16) s1835); const SWord16 s1837 = (SWord16) s1829; const SWord8 s1838 = (SWord8) (s1837 >> 8); const SWord8 s1839 = table0[s1838]; const SWord8 s1840 = (SWord8) s1837; const SWord8 s1841 = table0[s1840]; const SWord16 s1842 = (((SWord16) s1839) << 8) | ((SWord16) s1841); const SWord32 s1843 = (((SWord32) s1836) << 16) | ((SWord32) s1842); const SWord32 s1844 = s1769 ^ s1843; const SWord32 s1845 = s1828 ^ s1844; const SWord16 s1846 = (SWord16) (s1845 >> 16); const SWord8 s1847 = (SWord8) (s1846 >> 8); const SWord32 s1848 = table1[s1847]; const SWord8 s1849 = (SWord8) (s1789 >> 8); const SWord32 s1850 = table1[s1849]; const SWord16 s1851 = (SWord16) (s1807 >> 16); const SWord8 s1852 = (SWord8) s1851; const SWord32 s1853 = table2[s1852]; const SWord32 s1854 = s1850 ^ s1853; const SWord8 s1855 = (SWord8) (s1825 >> 8); const SWord32 s1856 = table3[s1855]; const SWord32 s1857 = s1854 ^ s1856; const SWord16 s1858 = (SWord16) s1770; const SWord8 s1859 = (SWord8) s1858; const SWord32 s1860 = table4[s1859]; const SWord32 s1861 = s1857 ^ s1860; const SWord32 s1862 = s1787 ^ s1844; const SWord32 s1863 = s1861 ^ s1862; const SWord16 s1864 = (SWord16) (s1863 >> 16); const SWord8 s1865 = (SWord8) s1864; const SWord32 s1866 = table2[s1865]; const SWord32 s1867 = s1848 ^ s1866; const SWord8 s1868 = (SWord8) (s1851 >> 8); const SWord32 s1869 = table1[s1868]; const SWord16 s1870 = (SWord16) (s1824 >> 16); const SWord8 s1871 = (SWord8) s1870; const SWord32 s1872 = table2[s1871]; const SWord32 s1873 = s1869 ^ s1872; const SWord8 s1874 = (SWord8) (s1858 >> 8); const SWord32 s1875 = table3[s1874]; const SWord32 s1876 = s1873 ^ s1875; const SWord16 s1877 = (SWord16) s1788; const SWord8 s1878 = (SWord8) s1877; const SWord32 s1879 = table4[s1878]; const SWord32 s1880 = s1876 ^ s1879; const SWord32 s1881 = s1806 ^ s1862; const SWord32 s1882 = s1880 ^ s1881; const SWord16 s1883 = (SWord16) s1882; const SWord8 s1884 = (SWord8) (s1883 >> 8); const SWord32 s1885 = table3[s1884]; const SWord32 s1886 = s1867 ^ s1885; const SWord8 s1887 = (SWord8) (s1870 >> 8); const SWord32 s1888 = table1[s1887]; const SWord8 s1889 = (SWord8) s1771; const SWord32 s1890 = table2[s1889]; const SWord32 s1891 = s1888 ^ s1890; const SWord8 s1892 = (SWord8) (s1877 >> 8); const SWord32 s1893 = table3[s1892]; const SWord32 s1894 = s1891 ^ s1893; const SWord8 s1895 = (SWord8) s1808; const SWord32 s1896 = table4[s1895]; const SWord32 s1897 = s1894 ^ s1896; const SWord32 s1898 = s1823 ^ s1881; const SWord32 s1899 = s1897 ^ s1898; const SWord16 s1900 = (SWord16) s1899; const SWord8 s1901 = (SWord8) s1900; const SWord32 s1902 = table4[s1901]; const SWord32 s1903 = s1886 ^ s1902; const SWord32 s1904 = (s1898 << 8) | (s1898 >> 24); const SWord16 s1905 = (SWord16) (s1904 >> 16); const SWord8 s1906 = (SWord8) (s1905 >> 8); const SWord8 s1907 = table0[s1906]; const SWord8 s1908 = 27 ^ s1907; const SWord8 s1909 = (SWord8) s1905; const SWord8 s1910 = table0[s1909]; const SWord16 s1911 = (((SWord16) s1908) << 8) | ((SWord16) s1910); const SWord16 s1912 = (SWord16) s1904; const SWord8 s1913 = (SWord8) (s1912 >> 8); const SWord8 s1914 = table0[s1913]; const SWord8 s1915 = (SWord8) s1912; const SWord8 s1916 = table0[s1915]; const SWord16 s1917 = (((SWord16) s1914) << 8) | ((SWord16) s1916); const SWord32 s1918 = (((SWord32) s1911) << 16) | ((SWord32) s1917); const SWord32 s1919 = s1844 ^ s1918; const SWord32 s1920 = s1903 ^ s1919; const SWord16 s1921 = (SWord16) (s1920 >> 16); const SWord8 s1922 = (SWord8) (s1921 >> 8); const SWord8 s1923 = table0[s1922]; const SWord8 s1924 = (SWord8) (s1864 >> 8); const SWord32 s1925 = table1[s1924]; const SWord16 s1926 = (SWord16) (s1882 >> 16); const SWord8 s1927 = (SWord8) s1926; const SWord32 s1928 = table2[s1927]; const SWord32 s1929 = s1925 ^ s1928; const SWord8 s1930 = (SWord8) (s1900 >> 8); const SWord32 s1931 = table3[s1930]; const SWord32 s1932 = s1929 ^ s1931; const SWord16 s1933 = (SWord16) s1845; const SWord8 s1934 = (SWord8) s1933; const SWord32 s1935 = table4[s1934]; const SWord32 s1936 = s1932 ^ s1935; const SWord32 s1937 = s1862 ^ s1919; const SWord32 s1938 = s1936 ^ s1937; const SWord16 s1939 = (SWord16) (s1938 >> 16); const SWord8 s1940 = (SWord8) s1939; const SWord8 s1941 = table0[s1940]; const SWord16 s1942 = (((SWord16) s1923) << 8) | ((SWord16) s1941); const SWord8 s1943 = (SWord8) (s1926 >> 8); const SWord32 s1944 = table1[s1943]; const SWord16 s1945 = (SWord16) (s1899 >> 16); const SWord8 s1946 = (SWord8) s1945; const SWord32 s1947 = table2[s1946]; const SWord32 s1948 = s1944 ^ s1947; const SWord8 s1949 = (SWord8) (s1933 >> 8); const SWord32 s1950 = table3[s1949]; const SWord32 s1951 = s1948 ^ s1950; const SWord16 s1952 = (SWord16) s1863; const SWord8 s1953 = (SWord8) s1952; const SWord32 s1954 = table4[s1953]; const SWord32 s1955 = s1951 ^ s1954; const SWord32 s1956 = s1881 ^ s1937; const SWord32 s1957 = s1955 ^ s1956; const SWord16 s1958 = (SWord16) s1957; const SWord8 s1959 = (SWord8) (s1958 >> 8); const SWord8 s1960 = table0[s1959]; const SWord8 s1961 = (SWord8) (s1945 >> 8); const SWord32 s1962 = table1[s1961]; const SWord8 s1963 = (SWord8) s1846; const SWord32 s1964 = table2[s1963]; const SWord32 s1965 = s1962 ^ s1964; const SWord8 s1966 = (SWord8) (s1952 >> 8); const SWord32 s1967 = table3[s1966]; const SWord32 s1968 = s1965 ^ s1967; const SWord8 s1969 = (SWord8) s1883; const SWord32 s1970 = table4[s1969]; const SWord32 s1971 = s1968 ^ s1970; const SWord32 s1972 = s1898 ^ s1956; const SWord32 s1973 = s1971 ^ s1972; const SWord16 s1974 = (SWord16) s1973; const SWord8 s1975 = (SWord8) s1974; const SWord8 s1976 = table0[s1975]; const SWord16 s1977 = (((SWord16) s1960) << 8) | ((SWord16) s1976); const SWord32 s1978 = (((SWord32) s1942) << 16) | ((SWord32) s1977); const SWord32 s1979 = (s1972 << 8) | (s1972 >> 24); const SWord16 s1980 = (SWord16) (s1979 >> 16); const SWord8 s1981 = (SWord8) (s1980 >> 8); const SWord8 s1982 = table0[s1981]; const SWord8 s1983 = 54 ^ s1982; const SWord8 s1984 = (SWord8) s1980; const SWord8 s1985 = table0[s1984]; const SWord16 s1986 = (((SWord16) s1983) << 8) | ((SWord16) s1985); const SWord16 s1987 = (SWord16) s1979; const SWord8 s1988 = (SWord8) (s1987 >> 8); const SWord8 s1989 = table0[s1988]; const SWord8 s1990 = (SWord8) s1987; const SWord8 s1991 = table0[s1990]; const SWord16 s1992 = (((SWord16) s1989) << 8) | ((SWord16) s1991); const SWord32 s1993 = (((SWord32) s1986) << 16) | ((SWord32) s1992); const SWord32 s1994 = s1919 ^ s1993; const SWord32 s1995 = s1978 ^ s1994; const SWord8 s1996 = (SWord8) (s1939 >> 8); const SWord8 s1997 = table0[s1996]; const SWord16 s1998 = (SWord16) (s1957 >> 16); const SWord8 s1999 = (SWord8) s1998; const SWord8 s2000 = table0[s1999]; const SWord16 s2001 = (((SWord16) s1997) << 8) | ((SWord16) s2000); const SWord8 s2002 = (SWord8) (s1974 >> 8); const SWord8 s2003 = table0[s2002]; const SWord16 s2004 = (SWord16) s1920; const SWord8 s2005 = (SWord8) s2004; const SWord8 s2006 = table0[s2005]; const SWord16 s2007 = (((SWord16) s2003) << 8) | ((SWord16) s2006); const SWord32 s2008 = (((SWord32) s2001) << 16) | ((SWord32) s2007); const SWord32 s2009 = s1937 ^ s1994; const SWord32 s2010 = s2008 ^ s2009; const SWord8 s2011 = (SWord8) (s1998 >> 8); const SWord8 s2012 = table0[s2011]; const SWord16 s2013 = (SWord16) (s1973 >> 16); const SWord8 s2014 = (SWord8) s2013; const SWord8 s2015 = table0[s2014]; const SWord16 s2016 = (((SWord16) s2012) << 8) | ((SWord16) s2015); const SWord8 s2017 = (SWord8) (s2004 >> 8); const SWord8 s2018 = table0[s2017]; const SWord16 s2019 = (SWord16) s1938; const SWord8 s2020 = (SWord8) s2019; const SWord8 s2021 = table0[s2020]; const SWord16 s2022 = (((SWord16) s2018) << 8) | ((SWord16) s2021); const SWord32 s2023 = (((SWord32) s2016) << 16) | ((SWord32) s2022); const SWord32 s2024 = s1956 ^ s2009; const SWord32 s2025 = s2023 ^ s2024; const SWord8 s2026 = (SWord8) (s2013 >> 8); const SWord8 s2027 = table0[s2026]; const SWord8 s2028 = (SWord8) s1921; const SWord8 s2029 = table0[s2028]; const SWord16 s2030 = (((SWord16) s2027) << 8) | ((SWord16) s2029); const SWord8 s2031 = (SWord8) (s2019 >> 8); const SWord8 s2032 = table0[s2031]; const SWord8 s2033 = (SWord8) s1958; const SWord8 s2034 = table0[s2033]; const SWord16 s2035 = (((SWord16) s2032) << 8) | ((SWord16) s2034); const SWord32 s2036 = (((SWord32) s2030) << 16) | ((SWord32) s2035); const SWord32 s2037 = s1972 ^ s2024; const SWord32 s2038 = s2036 ^ s2037; ct[0] = s1995; ct[1] = s2010; ct[2] = s2025; ct[3] = s2038; } == END: "aes128Enc.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/aes128Lib.gold0000644000000000000000000050155613405536617017127 0ustar0000000000000000== BEGIN: "aes128KeySchedule.c" ================ /* File: "aes128KeySchedule.c". Automatically generated by SBV. Do not edit! */ #include "aes128Lib.h" void aes128KeySchedule(const SWord32 *key, SWord32 *encKS, SWord32 *decKS) { const SWord32 s0 = key[0]; const SWord32 s1 = key[1]; const SWord32 s2 = key[2]; const SWord32 s3 = key[3]; static const SWord8 table0[] = { 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22 }; static const SWord8 table1[] = { 0, 14, 28, 18, 56, 54, 36, 42, 112, 126, 108, 98, 72, 70, 84, 90, 224, 238, 252, 242, 216, 214, 196, 202, 144, 158, 140, 130, 168, 166, 180, 186, 219, 213, 199, 201, 227, 237, 255, 241, 171, 165, 183, 185, 147, 157, 143, 129, 59, 53, 39, 41, 3, 13, 31, 17, 75, 69, 87, 89, 115, 125, 111, 97, 173, 163, 177, 191, 149, 155, 137, 135, 221, 211, 193, 207, 229, 235, 249, 247, 77, 67, 81, 95, 117, 123, 105, 103, 61, 51, 33, 47, 5, 11, 25, 23, 118, 120, 106, 100, 78, 64, 82, 92, 6, 8, 26, 20, 62, 48, 34, 44, 150, 152, 138, 132, 174, 160, 178, 188, 230, 232, 250, 244, 222, 208, 194, 204, 65, 79, 93, 83, 121, 119, 101, 107, 49, 63, 45, 35, 9, 7, 21, 27, 161, 175, 189, 179, 153, 151, 133, 139, 209, 223, 205, 195, 233, 231, 245, 251, 154, 148, 134, 136, 162, 172, 190, 176, 234, 228, 246, 248, 210, 220, 206, 192, 122, 116, 102, 104, 66, 76, 94, 80, 10, 4, 22, 24, 50, 60, 46, 32, 236, 226, 240, 254, 212, 218, 200, 198, 156, 146, 128, 142, 164, 170, 184, 182, 12, 2, 16, 30, 52, 58, 40, 38, 124, 114, 96, 110, 68, 74, 88, 86, 55, 57, 43, 37, 15, 1, 19, 29, 71, 73, 91, 85, 127, 113, 99, 109, 215, 217, 203, 197, 239, 225, 243, 253, 167, 169, 187, 181, 159, 145, 131, 141 }; static const SWord8 table2[] = { 0, 11, 22, 29, 44, 39, 58, 49, 88, 83, 78, 69, 116, 127, 98, 105, 176, 187, 166, 173, 156, 151, 138, 129, 232, 227, 254, 245, 196, 207, 210, 217, 123, 112, 109, 102, 87, 92, 65, 74, 35, 40, 53, 62, 15, 4, 25, 18, 203, 192, 221, 214, 231, 236, 241, 250, 147, 152, 133, 142, 191, 180, 169, 162, 246, 253, 224, 235, 218, 209, 204, 199, 174, 165, 184, 179, 130, 137, 148, 159, 70, 77, 80, 91, 106, 97, 124, 119, 30, 21, 8, 3, 50, 57, 36, 47, 141, 134, 155, 144, 161, 170, 183, 188, 213, 222, 195, 200, 249, 242, 239, 228, 61, 54, 43, 32, 17, 26, 7, 12, 101, 110, 115, 120, 73, 66, 95, 84, 247, 252, 225, 234, 219, 208, 205, 198, 175, 164, 185, 178, 131, 136, 149, 158, 71, 76, 81, 90, 107, 96, 125, 118, 31, 20, 9, 2, 51, 56, 37, 46, 140, 135, 154, 145, 160, 171, 182, 189, 212, 223, 194, 201, 248, 243, 238, 229, 60, 55, 42, 33, 16, 27, 6, 13, 100, 111, 114, 121, 72, 67, 94, 85, 1, 10, 23, 28, 45, 38, 59, 48, 89, 82, 79, 68, 117, 126, 99, 104, 177, 186, 167, 172, 157, 150, 139, 128, 233, 226, 255, 244, 197, 206, 211, 216, 122, 113, 108, 103, 86, 93, 64, 75, 34, 41, 52, 63, 14, 5, 24, 19, 202, 193, 220, 215, 230, 237, 240, 251, 146, 153, 132, 143, 190, 181, 168, 163 }; static const SWord8 table3[] = { 0, 13, 26, 23, 52, 57, 46, 35, 104, 101, 114, 127, 92, 81, 70, 75, 208, 221, 202, 199, 228, 233, 254, 243, 184, 181, 162, 175, 140, 129, 150, 155, 187, 182, 161, 172, 143, 130, 149, 152, 211, 222, 201, 196, 231, 234, 253, 240, 107, 102, 113, 124, 95, 82, 69, 72, 3, 14, 25, 20, 55, 58, 45, 32, 109, 96, 119, 122, 89, 84, 67, 78, 5, 8, 31, 18, 49, 60, 43, 38, 189, 176, 167, 170, 137, 132, 147, 158, 213, 216, 207, 194, 225, 236, 251, 246, 214, 219, 204, 193, 226, 239, 248, 245, 190, 179, 164, 169, 138, 135, 144, 157, 6, 11, 28, 17, 50, 63, 40, 37, 110, 99, 116, 121, 90, 87, 64, 77, 218, 215, 192, 205, 238, 227, 244, 249, 178, 191, 168, 165, 134, 139, 156, 145, 10, 7, 16, 29, 62, 51, 36, 41, 98, 111, 120, 117, 86, 91, 76, 65, 97, 108, 123, 118, 85, 88, 79, 66, 9, 4, 19, 30, 61, 48, 39, 42, 177, 188, 171, 166, 133, 136, 159, 146, 217, 212, 195, 206, 237, 224, 247, 250, 183, 186, 173, 160, 131, 142, 153, 148, 223, 210, 197, 200, 235, 230, 241, 252, 103, 106, 125, 112, 83, 94, 73, 68, 15, 2, 21, 24, 59, 54, 33, 44, 12, 1, 22, 27, 56, 53, 34, 47, 100, 105, 126, 115, 80, 93, 74, 71, 220, 209, 198, 203, 232, 229, 242, 255, 180, 185, 174, 163, 128, 141, 154, 151 }; static const SWord8 table4[] = { 0, 9, 18, 27, 36, 45, 54, 63, 72, 65, 90, 83, 108, 101, 126, 119, 144, 153, 130, 139, 180, 189, 166, 175, 216, 209, 202, 195, 252, 245, 238, 231, 59, 50, 41, 32, 31, 22, 13, 4, 115, 122, 97, 104, 87, 94, 69, 76, 171, 162, 185, 176, 143, 134, 157, 148, 227, 234, 241, 248, 199, 206, 213, 220, 118, 127, 100, 109, 82, 91, 64, 73, 62, 55, 44, 37, 26, 19, 8, 1, 230, 239, 244, 253, 194, 203, 208, 217, 174, 167, 188, 181, 138, 131, 152, 145, 77, 68, 95, 86, 105, 96, 123, 114, 5, 12, 23, 30, 33, 40, 51, 58, 221, 212, 207, 198, 249, 240, 235, 226, 149, 156, 135, 142, 177, 184, 163, 170, 236, 229, 254, 247, 200, 193, 218, 211, 164, 173, 182, 191, 128, 137, 146, 155, 124, 117, 110, 103, 88, 81, 74, 67, 52, 61, 38, 47, 16, 25, 2, 11, 215, 222, 197, 204, 243, 250, 225, 232, 159, 150, 141, 132, 187, 178, 169, 160, 71, 78, 85, 92, 99, 106, 113, 120, 15, 6, 29, 20, 43, 34, 57, 48, 154, 147, 136, 129, 190, 183, 172, 165, 210, 219, 192, 201, 246, 255, 228, 237, 10, 3, 24, 17, 46, 39, 60, 53, 66, 75, 80, 89, 102, 111, 116, 125, 161, 168, 179, 186, 133, 140, 151, 158, 233, 224, 251, 242, 205, 196, 223, 214, 49, 56, 35, 42, 21, 28, 7, 14, 121, 112, 107, 98, 93, 84, 79, 70 }; const SWord32 s260 = (s3 << 8) | (s3 >> 24); const SWord16 s261 = (SWord16) (s260 >> 16); const SWord8 s262 = (SWord8) (s261 >> 8); const SWord8 s263 = table0[s262]; const SWord8 s264 = 1 ^ s263; const SWord8 s265 = (SWord8) s261; const SWord8 s266 = table0[s265]; const SWord16 s267 = (((SWord16) s264) << 8) | ((SWord16) s266); const SWord16 s268 = (SWord16) s260; const SWord8 s269 = (SWord8) (s268 >> 8); const SWord8 s270 = table0[s269]; const SWord8 s271 = (SWord8) s268; const SWord8 s272 = table0[s271]; const SWord16 s273 = (((SWord16) s270) << 8) | ((SWord16) s272); const SWord32 s274 = (((SWord32) s267) << 16) | ((SWord32) s273); const SWord32 s275 = s0 ^ s274; const SWord32 s276 = s1 ^ s275; const SWord32 s277 = s2 ^ s276; const SWord32 s278 = s3 ^ s277; const SWord32 s279 = (s278 << 8) | (s278 >> 24); const SWord16 s280 = (SWord16) (s279 >> 16); const SWord8 s281 = (SWord8) (s280 >> 8); const SWord8 s282 = table0[s281]; const SWord8 s283 = 2 ^ s282; const SWord8 s284 = (SWord8) s280; const SWord8 s285 = table0[s284]; const SWord16 s286 = (((SWord16) s283) << 8) | ((SWord16) s285); const SWord16 s287 = (SWord16) s279; const SWord8 s288 = (SWord8) (s287 >> 8); const SWord8 s289 = table0[s288]; const SWord8 s290 = (SWord8) s287; const SWord8 s291 = table0[s290]; const SWord16 s292 = (((SWord16) s289) << 8) | ((SWord16) s291); const SWord32 s293 = (((SWord32) s286) << 16) | ((SWord32) s292); const SWord32 s294 = s275 ^ s293; const SWord32 s295 = s276 ^ s294; const SWord32 s296 = s277 ^ s295; const SWord32 s297 = s278 ^ s296; const SWord32 s298 = (s297 << 8) | (s297 >> 24); const SWord16 s299 = (SWord16) (s298 >> 16); const SWord8 s300 = (SWord8) (s299 >> 8); const SWord8 s301 = table0[s300]; const SWord8 s302 = 4 ^ s301; const SWord8 s303 = (SWord8) s299; const SWord8 s304 = table0[s303]; const SWord16 s305 = (((SWord16) s302) << 8) | ((SWord16) s304); const SWord16 s306 = (SWord16) s298; const SWord8 s307 = (SWord8) (s306 >> 8); const SWord8 s308 = table0[s307]; const SWord8 s309 = (SWord8) s306; const SWord8 s310 = table0[s309]; const SWord16 s311 = (((SWord16) s308) << 8) | ((SWord16) s310); const SWord32 s312 = (((SWord32) s305) << 16) | ((SWord32) s311); const SWord32 s313 = s294 ^ s312; const SWord32 s314 = s295 ^ s313; const SWord32 s315 = s296 ^ s314; const SWord32 s316 = s297 ^ s315; const SWord32 s317 = (s316 << 8) | (s316 >> 24); const SWord16 s318 = (SWord16) (s317 >> 16); const SWord8 s319 = (SWord8) (s318 >> 8); const SWord8 s320 = table0[s319]; const SWord8 s321 = 8 ^ s320; const SWord8 s322 = (SWord8) s318; const SWord8 s323 = table0[s322]; const SWord16 s324 = (((SWord16) s321) << 8) | ((SWord16) s323); const SWord16 s325 = (SWord16) s317; const SWord8 s326 = (SWord8) (s325 >> 8); const SWord8 s327 = table0[s326]; const SWord8 s328 = (SWord8) s325; const SWord8 s329 = table0[s328]; const SWord16 s330 = (((SWord16) s327) << 8) | ((SWord16) s329); const SWord32 s331 = (((SWord32) s324) << 16) | ((SWord32) s330); const SWord32 s332 = s313 ^ s331; const SWord32 s333 = s314 ^ s332; const SWord32 s334 = s315 ^ s333; const SWord32 s335 = s316 ^ s334; const SWord32 s336 = (s335 << 8) | (s335 >> 24); const SWord16 s337 = (SWord16) (s336 >> 16); const SWord8 s338 = (SWord8) (s337 >> 8); const SWord8 s339 = table0[s338]; const SWord8 s340 = 16 ^ s339; const SWord8 s341 = (SWord8) s337; const SWord8 s342 = table0[s341]; const SWord16 s343 = (((SWord16) s340) << 8) | ((SWord16) s342); const SWord16 s344 = (SWord16) s336; const SWord8 s345 = (SWord8) (s344 >> 8); const SWord8 s346 = table0[s345]; const SWord8 s347 = (SWord8) s344; const SWord8 s348 = table0[s347]; const SWord16 s349 = (((SWord16) s346) << 8) | ((SWord16) s348); const SWord32 s350 = (((SWord32) s343) << 16) | ((SWord32) s349); const SWord32 s351 = s332 ^ s350; const SWord32 s352 = s333 ^ s351; const SWord32 s353 = s334 ^ s352; const SWord32 s354 = s335 ^ s353; const SWord32 s355 = (s354 << 8) | (s354 >> 24); const SWord16 s356 = (SWord16) (s355 >> 16); const SWord8 s357 = (SWord8) (s356 >> 8); const SWord8 s358 = table0[s357]; const SWord8 s359 = 32 ^ s358; const SWord8 s360 = (SWord8) s356; const SWord8 s361 = table0[s360]; const SWord16 s362 = (((SWord16) s359) << 8) | ((SWord16) s361); const SWord16 s363 = (SWord16) s355; const SWord8 s364 = (SWord8) (s363 >> 8); const SWord8 s365 = table0[s364]; const SWord8 s366 = (SWord8) s363; const SWord8 s367 = table0[s366]; const SWord16 s368 = (((SWord16) s365) << 8) | ((SWord16) s367); const SWord32 s369 = (((SWord32) s362) << 16) | ((SWord32) s368); const SWord32 s370 = s351 ^ s369; const SWord32 s371 = s352 ^ s370; const SWord32 s372 = s353 ^ s371; const SWord32 s373 = s354 ^ s372; const SWord32 s374 = (s373 << 8) | (s373 >> 24); const SWord16 s375 = (SWord16) (s374 >> 16); const SWord8 s376 = (SWord8) (s375 >> 8); const SWord8 s377 = table0[s376]; const SWord8 s378 = 64 ^ s377; const SWord8 s379 = (SWord8) s375; const SWord8 s380 = table0[s379]; const SWord16 s381 = (((SWord16) s378) << 8) | ((SWord16) s380); const SWord16 s382 = (SWord16) s374; const SWord8 s383 = (SWord8) (s382 >> 8); const SWord8 s384 = table0[s383]; const SWord8 s385 = (SWord8) s382; const SWord8 s386 = table0[s385]; const SWord16 s387 = (((SWord16) s384) << 8) | ((SWord16) s386); const SWord32 s388 = (((SWord32) s381) << 16) | ((SWord32) s387); const SWord32 s389 = s370 ^ s388; const SWord32 s390 = s371 ^ s389; const SWord32 s391 = s372 ^ s390; const SWord32 s392 = s373 ^ s391; const SWord32 s393 = (s392 << 8) | (s392 >> 24); const SWord16 s394 = (SWord16) (s393 >> 16); const SWord8 s395 = (SWord8) (s394 >> 8); const SWord8 s396 = table0[s395]; const SWord8 s397 = 128 ^ s396; const SWord8 s398 = (SWord8) s394; const SWord8 s399 = table0[s398]; const SWord16 s400 = (((SWord16) s397) << 8) | ((SWord16) s399); const SWord16 s401 = (SWord16) s393; const SWord8 s402 = (SWord8) (s401 >> 8); const SWord8 s403 = table0[s402]; const SWord8 s404 = (SWord8) s401; const SWord8 s405 = table0[s404]; const SWord16 s406 = (((SWord16) s403) << 8) | ((SWord16) s405); const SWord32 s407 = (((SWord32) s400) << 16) | ((SWord32) s406); const SWord32 s408 = s389 ^ s407; const SWord32 s409 = s390 ^ s408; const SWord32 s410 = s391 ^ s409; const SWord32 s411 = s392 ^ s410; const SWord32 s412 = (s411 << 8) | (s411 >> 24); const SWord16 s413 = (SWord16) (s412 >> 16); const SWord8 s414 = (SWord8) (s413 >> 8); const SWord8 s415 = table0[s414]; const SWord8 s416 = 27 ^ s415; const SWord8 s417 = (SWord8) s413; const SWord8 s418 = table0[s417]; const SWord16 s419 = (((SWord16) s416) << 8) | ((SWord16) s418); const SWord16 s420 = (SWord16) s412; const SWord8 s421 = (SWord8) (s420 >> 8); const SWord8 s422 = table0[s421]; const SWord8 s423 = (SWord8) s420; const SWord8 s424 = table0[s423]; const SWord16 s425 = (((SWord16) s422) << 8) | ((SWord16) s424); const SWord32 s426 = (((SWord32) s419) << 16) | ((SWord32) s425); const SWord32 s427 = s408 ^ s426; const SWord32 s428 = s409 ^ s427; const SWord32 s429 = s410 ^ s428; const SWord32 s430 = s411 ^ s429; const SWord32 s431 = (s430 << 8) | (s430 >> 24); const SWord16 s432 = (SWord16) (s431 >> 16); const SWord8 s433 = (SWord8) (s432 >> 8); const SWord8 s434 = table0[s433]; const SWord8 s435 = 54 ^ s434; const SWord8 s436 = (SWord8) s432; const SWord8 s437 = table0[s436]; const SWord16 s438 = (((SWord16) s435) << 8) | ((SWord16) s437); const SWord16 s439 = (SWord16) s431; const SWord8 s440 = (SWord8) (s439 >> 8); const SWord8 s441 = table0[s440]; const SWord8 s442 = (SWord8) s439; const SWord8 s443 = table0[s442]; const SWord16 s444 = (((SWord16) s441) << 8) | ((SWord16) s443); const SWord32 s445 = (((SWord32) s438) << 16) | ((SWord32) s444); const SWord32 s446 = s427 ^ s445; const SWord32 s447 = s428 ^ s446; const SWord32 s448 = s429 ^ s447; const SWord32 s449 = s430 ^ s448; const SWord16 s450 = (SWord16) (s427 >> 16); const SWord8 s451 = (SWord8) (s450 >> 8); const SWord8 s452 = table1[s451]; const SWord8 s453 = (SWord8) s450; const SWord8 s454 = table2[s453]; const SWord16 s455 = (SWord16) s427; const SWord8 s456 = (SWord8) (s455 >> 8); const SWord8 s457 = table3[s456]; const SWord8 s458 = (SWord8) s455; const SWord8 s459 = table4[s458]; const SWord8 s460 = s457 ^ s459; const SWord8 s461 = s454 ^ s460; const SWord8 s462 = s452 ^ s461; const SWord8 s463 = table4[s451]; const SWord8 s464 = table1[s453]; const SWord8 s465 = table2[s456]; const SWord8 s466 = table3[s458]; const SWord8 s467 = s465 ^ s466; const SWord8 s468 = s464 ^ s467; const SWord8 s469 = s463 ^ s468; const SWord16 s470 = (((SWord16) s462) << 8) | ((SWord16) s469); const SWord8 s471 = table3[s451]; const SWord8 s472 = table4[s453]; const SWord8 s473 = table1[s456]; const SWord8 s474 = table2[s458]; const SWord8 s475 = s473 ^ s474; const SWord8 s476 = s472 ^ s475; const SWord8 s477 = s471 ^ s476; const SWord8 s478 = table2[s451]; const SWord8 s479 = table3[s453]; const SWord8 s480 = table4[s456]; const SWord8 s481 = table1[s458]; const SWord8 s482 = s480 ^ s481; const SWord8 s483 = s479 ^ s482; const SWord8 s484 = s478 ^ s483; const SWord16 s485 = (((SWord16) s477) << 8) | ((SWord16) s484); const SWord32 s486 = (((SWord32) s470) << 16) | ((SWord32) s485); const SWord16 s487 = (SWord16) (s428 >> 16); const SWord8 s488 = (SWord8) (s487 >> 8); const SWord8 s489 = table1[s488]; const SWord8 s490 = (SWord8) s487; const SWord8 s491 = table2[s490]; const SWord16 s492 = (SWord16) s428; const SWord8 s493 = (SWord8) (s492 >> 8); const SWord8 s494 = table3[s493]; const SWord8 s495 = (SWord8) s492; const SWord8 s496 = table4[s495]; const SWord8 s497 = s494 ^ s496; const SWord8 s498 = s491 ^ s497; const SWord8 s499 = s489 ^ s498; const SWord8 s500 = table4[s488]; const SWord8 s501 = table1[s490]; const SWord8 s502 = table2[s493]; const SWord8 s503 = table3[s495]; const SWord8 s504 = s502 ^ s503; const SWord8 s505 = s501 ^ s504; const SWord8 s506 = s500 ^ s505; const SWord16 s507 = (((SWord16) s499) << 8) | ((SWord16) s506); const SWord8 s508 = table3[s488]; const SWord8 s509 = table4[s490]; const SWord8 s510 = table1[s493]; const SWord8 s511 = table2[s495]; const SWord8 s512 = s510 ^ s511; const SWord8 s513 = s509 ^ s512; const SWord8 s514 = s508 ^ s513; const SWord8 s515 = table2[s488]; const SWord8 s516 = table3[s490]; const SWord8 s517 = table4[s493]; const SWord8 s518 = table1[s495]; const SWord8 s519 = s517 ^ s518; const SWord8 s520 = s516 ^ s519; const SWord8 s521 = s515 ^ s520; const SWord16 s522 = (((SWord16) s514) << 8) | ((SWord16) s521); const SWord32 s523 = (((SWord32) s507) << 16) | ((SWord32) s522); const SWord16 s524 = (SWord16) (s429 >> 16); const SWord8 s525 = (SWord8) (s524 >> 8); const SWord8 s526 = table1[s525]; const SWord8 s527 = (SWord8) s524; const SWord8 s528 = table2[s527]; const SWord16 s529 = (SWord16) s429; const SWord8 s530 = (SWord8) (s529 >> 8); const SWord8 s531 = table3[s530]; const SWord8 s532 = (SWord8) s529; const SWord8 s533 = table4[s532]; const SWord8 s534 = s531 ^ s533; const SWord8 s535 = s528 ^ s534; const SWord8 s536 = s526 ^ s535; const SWord8 s537 = table4[s525]; const SWord8 s538 = table1[s527]; const SWord8 s539 = table2[s530]; const SWord8 s540 = table3[s532]; const SWord8 s541 = s539 ^ s540; const SWord8 s542 = s538 ^ s541; const SWord8 s543 = s537 ^ s542; const SWord16 s544 = (((SWord16) s536) << 8) | ((SWord16) s543); const SWord8 s545 = table3[s525]; const SWord8 s546 = table4[s527]; const SWord8 s547 = table1[s530]; const SWord8 s548 = table2[s532]; const SWord8 s549 = s547 ^ s548; const SWord8 s550 = s546 ^ s549; const SWord8 s551 = s545 ^ s550; const SWord8 s552 = table2[s525]; const SWord8 s553 = table3[s527]; const SWord8 s554 = table4[s530]; const SWord8 s555 = table1[s532]; const SWord8 s556 = s554 ^ s555; const SWord8 s557 = s553 ^ s556; const SWord8 s558 = s552 ^ s557; const SWord16 s559 = (((SWord16) s551) << 8) | ((SWord16) s558); const SWord32 s560 = (((SWord32) s544) << 16) | ((SWord32) s559); const SWord16 s561 = (SWord16) (s430 >> 16); const SWord8 s562 = (SWord8) (s561 >> 8); const SWord8 s563 = table1[s562]; const SWord8 s564 = (SWord8) s561; const SWord8 s565 = table2[s564]; const SWord16 s566 = (SWord16) s430; const SWord8 s567 = (SWord8) (s566 >> 8); const SWord8 s568 = table3[s567]; const SWord8 s569 = (SWord8) s566; const SWord8 s570 = table4[s569]; const SWord8 s571 = s568 ^ s570; const SWord8 s572 = s565 ^ s571; const SWord8 s573 = s563 ^ s572; const SWord8 s574 = table4[s562]; const SWord8 s575 = table1[s564]; const SWord8 s576 = table2[s567]; const SWord8 s577 = table3[s569]; const SWord8 s578 = s576 ^ s577; const SWord8 s579 = s575 ^ s578; const SWord8 s580 = s574 ^ s579; const SWord16 s581 = (((SWord16) s573) << 8) | ((SWord16) s580); const SWord8 s582 = table3[s562]; const SWord8 s583 = table4[s564]; const SWord8 s584 = table1[s567]; const SWord8 s585 = table2[s569]; const SWord8 s586 = s584 ^ s585; const SWord8 s587 = s583 ^ s586; const SWord8 s588 = s582 ^ s587; const SWord8 s589 = table2[s562]; const SWord8 s590 = table3[s564]; const SWord8 s591 = table4[s567]; const SWord8 s592 = table1[s569]; const SWord8 s593 = s591 ^ s592; const SWord8 s594 = s590 ^ s593; const SWord8 s595 = s589 ^ s594; const SWord16 s596 = (((SWord16) s588) << 8) | ((SWord16) s595); const SWord32 s597 = (((SWord32) s581) << 16) | ((SWord32) s596); const SWord16 s598 = (SWord16) (s408 >> 16); const SWord8 s599 = (SWord8) (s598 >> 8); const SWord8 s600 = table1[s599]; const SWord8 s601 = (SWord8) s598; const SWord8 s602 = table2[s601]; const SWord16 s603 = (SWord16) s408; const SWord8 s604 = (SWord8) (s603 >> 8); const SWord8 s605 = table3[s604]; const SWord8 s606 = (SWord8) s603; const SWord8 s607 = table4[s606]; const SWord8 s608 = s605 ^ s607; const SWord8 s609 = s602 ^ s608; const SWord8 s610 = s600 ^ s609; const SWord8 s611 = table4[s599]; const SWord8 s612 = table1[s601]; const SWord8 s613 = table2[s604]; const SWord8 s614 = table3[s606]; const SWord8 s615 = s613 ^ s614; const SWord8 s616 = s612 ^ s615; const SWord8 s617 = s611 ^ s616; const SWord16 s618 = (((SWord16) s610) << 8) | ((SWord16) s617); const SWord8 s619 = table3[s599]; const SWord8 s620 = table4[s601]; const SWord8 s621 = table1[s604]; const SWord8 s622 = table2[s606]; const SWord8 s623 = s621 ^ s622; const SWord8 s624 = s620 ^ s623; const SWord8 s625 = s619 ^ s624; const SWord8 s626 = table2[s599]; const SWord8 s627 = table3[s601]; const SWord8 s628 = table4[s604]; const SWord8 s629 = table1[s606]; const SWord8 s630 = s628 ^ s629; const SWord8 s631 = s627 ^ s630; const SWord8 s632 = s626 ^ s631; const SWord16 s633 = (((SWord16) s625) << 8) | ((SWord16) s632); const SWord32 s634 = (((SWord32) s618) << 16) | ((SWord32) s633); const SWord16 s635 = (SWord16) (s409 >> 16); const SWord8 s636 = (SWord8) (s635 >> 8); const SWord8 s637 = table1[s636]; const SWord8 s638 = (SWord8) s635; const SWord8 s639 = table2[s638]; const SWord16 s640 = (SWord16) s409; const SWord8 s641 = (SWord8) (s640 >> 8); const SWord8 s642 = table3[s641]; const SWord8 s643 = (SWord8) s640; const SWord8 s644 = table4[s643]; const SWord8 s645 = s642 ^ s644; const SWord8 s646 = s639 ^ s645; const SWord8 s647 = s637 ^ s646; const SWord8 s648 = table4[s636]; const SWord8 s649 = table1[s638]; const SWord8 s650 = table2[s641]; const SWord8 s651 = table3[s643]; const SWord8 s652 = s650 ^ s651; const SWord8 s653 = s649 ^ s652; const SWord8 s654 = s648 ^ s653; const SWord16 s655 = (((SWord16) s647) << 8) | ((SWord16) s654); const SWord8 s656 = table3[s636]; const SWord8 s657 = table4[s638]; const SWord8 s658 = table1[s641]; const SWord8 s659 = table2[s643]; const SWord8 s660 = s658 ^ s659; const SWord8 s661 = s657 ^ s660; const SWord8 s662 = s656 ^ s661; const SWord8 s663 = table2[s636]; const SWord8 s664 = table3[s638]; const SWord8 s665 = table4[s641]; const SWord8 s666 = table1[s643]; const SWord8 s667 = s665 ^ s666; const SWord8 s668 = s664 ^ s667; const SWord8 s669 = s663 ^ s668; const SWord16 s670 = (((SWord16) s662) << 8) | ((SWord16) s669); const SWord32 s671 = (((SWord32) s655) << 16) | ((SWord32) s670); const SWord16 s672 = (SWord16) (s410 >> 16); const SWord8 s673 = (SWord8) (s672 >> 8); const SWord8 s674 = table1[s673]; const SWord8 s675 = (SWord8) s672; const SWord8 s676 = table2[s675]; const SWord16 s677 = (SWord16) s410; const SWord8 s678 = (SWord8) (s677 >> 8); const SWord8 s679 = table3[s678]; const SWord8 s680 = (SWord8) s677; const SWord8 s681 = table4[s680]; const SWord8 s682 = s679 ^ s681; const SWord8 s683 = s676 ^ s682; const SWord8 s684 = s674 ^ s683; const SWord8 s685 = table4[s673]; const SWord8 s686 = table1[s675]; const SWord8 s687 = table2[s678]; const SWord8 s688 = table3[s680]; const SWord8 s689 = s687 ^ s688; const SWord8 s690 = s686 ^ s689; const SWord8 s691 = s685 ^ s690; const SWord16 s692 = (((SWord16) s684) << 8) | ((SWord16) s691); const SWord8 s693 = table3[s673]; const SWord8 s694 = table4[s675]; const SWord8 s695 = table1[s678]; const SWord8 s696 = table2[s680]; const SWord8 s697 = s695 ^ s696; const SWord8 s698 = s694 ^ s697; const SWord8 s699 = s693 ^ s698; const SWord8 s700 = table2[s673]; const SWord8 s701 = table3[s675]; const SWord8 s702 = table4[s678]; const SWord8 s703 = table1[s680]; const SWord8 s704 = s702 ^ s703; const SWord8 s705 = s701 ^ s704; const SWord8 s706 = s700 ^ s705; const SWord16 s707 = (((SWord16) s699) << 8) | ((SWord16) s706); const SWord32 s708 = (((SWord32) s692) << 16) | ((SWord32) s707); const SWord16 s709 = (SWord16) (s411 >> 16); const SWord8 s710 = (SWord8) (s709 >> 8); const SWord8 s711 = table1[s710]; const SWord8 s712 = (SWord8) s709; const SWord8 s713 = table2[s712]; const SWord16 s714 = (SWord16) s411; const SWord8 s715 = (SWord8) (s714 >> 8); const SWord8 s716 = table3[s715]; const SWord8 s717 = (SWord8) s714; const SWord8 s718 = table4[s717]; const SWord8 s719 = s716 ^ s718; const SWord8 s720 = s713 ^ s719; const SWord8 s721 = s711 ^ s720; const SWord8 s722 = table4[s710]; const SWord8 s723 = table1[s712]; const SWord8 s724 = table2[s715]; const SWord8 s725 = table3[s717]; const SWord8 s726 = s724 ^ s725; const SWord8 s727 = s723 ^ s726; const SWord8 s728 = s722 ^ s727; const SWord16 s729 = (((SWord16) s721) << 8) | ((SWord16) s728); const SWord8 s730 = table3[s710]; const SWord8 s731 = table4[s712]; const SWord8 s732 = table1[s715]; const SWord8 s733 = table2[s717]; const SWord8 s734 = s732 ^ s733; const SWord8 s735 = s731 ^ s734; const SWord8 s736 = s730 ^ s735; const SWord8 s737 = table2[s710]; const SWord8 s738 = table3[s712]; const SWord8 s739 = table4[s715]; const SWord8 s740 = table1[s717]; const SWord8 s741 = s739 ^ s740; const SWord8 s742 = s738 ^ s741; const SWord8 s743 = s737 ^ s742; const SWord16 s744 = (((SWord16) s736) << 8) | ((SWord16) s743); const SWord32 s745 = (((SWord32) s729) << 16) | ((SWord32) s744); const SWord16 s746 = (SWord16) (s389 >> 16); const SWord8 s747 = (SWord8) (s746 >> 8); const SWord8 s748 = table1[s747]; const SWord8 s749 = (SWord8) s746; const SWord8 s750 = table2[s749]; const SWord16 s751 = (SWord16) s389; const SWord8 s752 = (SWord8) (s751 >> 8); const SWord8 s753 = table3[s752]; const SWord8 s754 = (SWord8) s751; const SWord8 s755 = table4[s754]; const SWord8 s756 = s753 ^ s755; const SWord8 s757 = s750 ^ s756; const SWord8 s758 = s748 ^ s757; const SWord8 s759 = table4[s747]; const SWord8 s760 = table1[s749]; const SWord8 s761 = table2[s752]; const SWord8 s762 = table3[s754]; const SWord8 s763 = s761 ^ s762; const SWord8 s764 = s760 ^ s763; const SWord8 s765 = s759 ^ s764; const SWord16 s766 = (((SWord16) s758) << 8) | ((SWord16) s765); const SWord8 s767 = table3[s747]; const SWord8 s768 = table4[s749]; const SWord8 s769 = table1[s752]; const SWord8 s770 = table2[s754]; const SWord8 s771 = s769 ^ s770; const SWord8 s772 = s768 ^ s771; const SWord8 s773 = s767 ^ s772; const SWord8 s774 = table2[s747]; const SWord8 s775 = table3[s749]; const SWord8 s776 = table4[s752]; const SWord8 s777 = table1[s754]; const SWord8 s778 = s776 ^ s777; const SWord8 s779 = s775 ^ s778; const SWord8 s780 = s774 ^ s779; const SWord16 s781 = (((SWord16) s773) << 8) | ((SWord16) s780); const SWord32 s782 = (((SWord32) s766) << 16) | ((SWord32) s781); const SWord16 s783 = (SWord16) (s390 >> 16); const SWord8 s784 = (SWord8) (s783 >> 8); const SWord8 s785 = table1[s784]; const SWord8 s786 = (SWord8) s783; const SWord8 s787 = table2[s786]; const SWord16 s788 = (SWord16) s390; const SWord8 s789 = (SWord8) (s788 >> 8); const SWord8 s790 = table3[s789]; const SWord8 s791 = (SWord8) s788; const SWord8 s792 = table4[s791]; const SWord8 s793 = s790 ^ s792; const SWord8 s794 = s787 ^ s793; const SWord8 s795 = s785 ^ s794; const SWord8 s796 = table4[s784]; const SWord8 s797 = table1[s786]; const SWord8 s798 = table2[s789]; const SWord8 s799 = table3[s791]; const SWord8 s800 = s798 ^ s799; const SWord8 s801 = s797 ^ s800; const SWord8 s802 = s796 ^ s801; const SWord16 s803 = (((SWord16) s795) << 8) | ((SWord16) s802); const SWord8 s804 = table3[s784]; const SWord8 s805 = table4[s786]; const SWord8 s806 = table1[s789]; const SWord8 s807 = table2[s791]; const SWord8 s808 = s806 ^ s807; const SWord8 s809 = s805 ^ s808; const SWord8 s810 = s804 ^ s809; const SWord8 s811 = table2[s784]; const SWord8 s812 = table3[s786]; const SWord8 s813 = table4[s789]; const SWord8 s814 = table1[s791]; const SWord8 s815 = s813 ^ s814; const SWord8 s816 = s812 ^ s815; const SWord8 s817 = s811 ^ s816; const SWord16 s818 = (((SWord16) s810) << 8) | ((SWord16) s817); const SWord32 s819 = (((SWord32) s803) << 16) | ((SWord32) s818); const SWord16 s820 = (SWord16) (s391 >> 16); const SWord8 s821 = (SWord8) (s820 >> 8); const SWord8 s822 = table1[s821]; const SWord8 s823 = (SWord8) s820; const SWord8 s824 = table2[s823]; const SWord16 s825 = (SWord16) s391; const SWord8 s826 = (SWord8) (s825 >> 8); const SWord8 s827 = table3[s826]; const SWord8 s828 = (SWord8) s825; const SWord8 s829 = table4[s828]; const SWord8 s830 = s827 ^ s829; const SWord8 s831 = s824 ^ s830; const SWord8 s832 = s822 ^ s831; const SWord8 s833 = table4[s821]; const SWord8 s834 = table1[s823]; const SWord8 s835 = table2[s826]; const SWord8 s836 = table3[s828]; const SWord8 s837 = s835 ^ s836; const SWord8 s838 = s834 ^ s837; const SWord8 s839 = s833 ^ s838; const SWord16 s840 = (((SWord16) s832) << 8) | ((SWord16) s839); const SWord8 s841 = table3[s821]; const SWord8 s842 = table4[s823]; const SWord8 s843 = table1[s826]; const SWord8 s844 = table2[s828]; const SWord8 s845 = s843 ^ s844; const SWord8 s846 = s842 ^ s845; const SWord8 s847 = s841 ^ s846; const SWord8 s848 = table2[s821]; const SWord8 s849 = table3[s823]; const SWord8 s850 = table4[s826]; const SWord8 s851 = table1[s828]; const SWord8 s852 = s850 ^ s851; const SWord8 s853 = s849 ^ s852; const SWord8 s854 = s848 ^ s853; const SWord16 s855 = (((SWord16) s847) << 8) | ((SWord16) s854); const SWord32 s856 = (((SWord32) s840) << 16) | ((SWord32) s855); const SWord16 s857 = (SWord16) (s392 >> 16); const SWord8 s858 = (SWord8) (s857 >> 8); const SWord8 s859 = table1[s858]; const SWord8 s860 = (SWord8) s857; const SWord8 s861 = table2[s860]; const SWord16 s862 = (SWord16) s392; const SWord8 s863 = (SWord8) (s862 >> 8); const SWord8 s864 = table3[s863]; const SWord8 s865 = (SWord8) s862; const SWord8 s866 = table4[s865]; const SWord8 s867 = s864 ^ s866; const SWord8 s868 = s861 ^ s867; const SWord8 s869 = s859 ^ s868; const SWord8 s870 = table4[s858]; const SWord8 s871 = table1[s860]; const SWord8 s872 = table2[s863]; const SWord8 s873 = table3[s865]; const SWord8 s874 = s872 ^ s873; const SWord8 s875 = s871 ^ s874; const SWord8 s876 = s870 ^ s875; const SWord16 s877 = (((SWord16) s869) << 8) | ((SWord16) s876); const SWord8 s878 = table3[s858]; const SWord8 s879 = table4[s860]; const SWord8 s880 = table1[s863]; const SWord8 s881 = table2[s865]; const SWord8 s882 = s880 ^ s881; const SWord8 s883 = s879 ^ s882; const SWord8 s884 = s878 ^ s883; const SWord8 s885 = table2[s858]; const SWord8 s886 = table3[s860]; const SWord8 s887 = table4[s863]; const SWord8 s888 = table1[s865]; const SWord8 s889 = s887 ^ s888; const SWord8 s890 = s886 ^ s889; const SWord8 s891 = s885 ^ s890; const SWord16 s892 = (((SWord16) s884) << 8) | ((SWord16) s891); const SWord32 s893 = (((SWord32) s877) << 16) | ((SWord32) s892); const SWord16 s894 = (SWord16) (s370 >> 16); const SWord8 s895 = (SWord8) (s894 >> 8); const SWord8 s896 = table1[s895]; const SWord8 s897 = (SWord8) s894; const SWord8 s898 = table2[s897]; const SWord16 s899 = (SWord16) s370; const SWord8 s900 = (SWord8) (s899 >> 8); const SWord8 s901 = table3[s900]; const SWord8 s902 = (SWord8) s899; const SWord8 s903 = table4[s902]; const SWord8 s904 = s901 ^ s903; const SWord8 s905 = s898 ^ s904; const SWord8 s906 = s896 ^ s905; const SWord8 s907 = table4[s895]; const SWord8 s908 = table1[s897]; const SWord8 s909 = table2[s900]; const SWord8 s910 = table3[s902]; const SWord8 s911 = s909 ^ s910; const SWord8 s912 = s908 ^ s911; const SWord8 s913 = s907 ^ s912; const SWord16 s914 = (((SWord16) s906) << 8) | ((SWord16) s913); const SWord8 s915 = table3[s895]; const SWord8 s916 = table4[s897]; const SWord8 s917 = table1[s900]; const SWord8 s918 = table2[s902]; const SWord8 s919 = s917 ^ s918; const SWord8 s920 = s916 ^ s919; const SWord8 s921 = s915 ^ s920; const SWord8 s922 = table2[s895]; const SWord8 s923 = table3[s897]; const SWord8 s924 = table4[s900]; const SWord8 s925 = table1[s902]; const SWord8 s926 = s924 ^ s925; const SWord8 s927 = s923 ^ s926; const SWord8 s928 = s922 ^ s927; const SWord16 s929 = (((SWord16) s921) << 8) | ((SWord16) s928); const SWord32 s930 = (((SWord32) s914) << 16) | ((SWord32) s929); const SWord16 s931 = (SWord16) (s371 >> 16); const SWord8 s932 = (SWord8) (s931 >> 8); const SWord8 s933 = table1[s932]; const SWord8 s934 = (SWord8) s931; const SWord8 s935 = table2[s934]; const SWord16 s936 = (SWord16) s371; const SWord8 s937 = (SWord8) (s936 >> 8); const SWord8 s938 = table3[s937]; const SWord8 s939 = (SWord8) s936; const SWord8 s940 = table4[s939]; const SWord8 s941 = s938 ^ s940; const SWord8 s942 = s935 ^ s941; const SWord8 s943 = s933 ^ s942; const SWord8 s944 = table4[s932]; const SWord8 s945 = table1[s934]; const SWord8 s946 = table2[s937]; const SWord8 s947 = table3[s939]; const SWord8 s948 = s946 ^ s947; const SWord8 s949 = s945 ^ s948; const SWord8 s950 = s944 ^ s949; const SWord16 s951 = (((SWord16) s943) << 8) | ((SWord16) s950); const SWord8 s952 = table3[s932]; const SWord8 s953 = table4[s934]; const SWord8 s954 = table1[s937]; const SWord8 s955 = table2[s939]; const SWord8 s956 = s954 ^ s955; const SWord8 s957 = s953 ^ s956; const SWord8 s958 = s952 ^ s957; const SWord8 s959 = table2[s932]; const SWord8 s960 = table3[s934]; const SWord8 s961 = table4[s937]; const SWord8 s962 = table1[s939]; const SWord8 s963 = s961 ^ s962; const SWord8 s964 = s960 ^ s963; const SWord8 s965 = s959 ^ s964; const SWord16 s966 = (((SWord16) s958) << 8) | ((SWord16) s965); const SWord32 s967 = (((SWord32) s951) << 16) | ((SWord32) s966); const SWord16 s968 = (SWord16) (s372 >> 16); const SWord8 s969 = (SWord8) (s968 >> 8); const SWord8 s970 = table1[s969]; const SWord8 s971 = (SWord8) s968; const SWord8 s972 = table2[s971]; const SWord16 s973 = (SWord16) s372; const SWord8 s974 = (SWord8) (s973 >> 8); const SWord8 s975 = table3[s974]; const SWord8 s976 = (SWord8) s973; const SWord8 s977 = table4[s976]; const SWord8 s978 = s975 ^ s977; const SWord8 s979 = s972 ^ s978; const SWord8 s980 = s970 ^ s979; const SWord8 s981 = table4[s969]; const SWord8 s982 = table1[s971]; const SWord8 s983 = table2[s974]; const SWord8 s984 = table3[s976]; const SWord8 s985 = s983 ^ s984; const SWord8 s986 = s982 ^ s985; const SWord8 s987 = s981 ^ s986; const SWord16 s988 = (((SWord16) s980) << 8) | ((SWord16) s987); const SWord8 s989 = table3[s969]; const SWord8 s990 = table4[s971]; const SWord8 s991 = table1[s974]; const SWord8 s992 = table2[s976]; const SWord8 s993 = s991 ^ s992; const SWord8 s994 = s990 ^ s993; const SWord8 s995 = s989 ^ s994; const SWord8 s996 = table2[s969]; const SWord8 s997 = table3[s971]; const SWord8 s998 = table4[s974]; const SWord8 s999 = table1[s976]; const SWord8 s1000 = s998 ^ s999; const SWord8 s1001 = s997 ^ s1000; const SWord8 s1002 = s996 ^ s1001; const SWord16 s1003 = (((SWord16) s995) << 8) | ((SWord16) s1002); const SWord32 s1004 = (((SWord32) s988) << 16) | ((SWord32) s1003); const SWord16 s1005 = (SWord16) (s373 >> 16); const SWord8 s1006 = (SWord8) (s1005 >> 8); const SWord8 s1007 = table1[s1006]; const SWord8 s1008 = (SWord8) s1005; const SWord8 s1009 = table2[s1008]; const SWord16 s1010 = (SWord16) s373; const SWord8 s1011 = (SWord8) (s1010 >> 8); const SWord8 s1012 = table3[s1011]; const SWord8 s1013 = (SWord8) s1010; const SWord8 s1014 = table4[s1013]; const SWord8 s1015 = s1012 ^ s1014; const SWord8 s1016 = s1009 ^ s1015; const SWord8 s1017 = s1007 ^ s1016; const SWord8 s1018 = table4[s1006]; const SWord8 s1019 = table1[s1008]; const SWord8 s1020 = table2[s1011]; const SWord8 s1021 = table3[s1013]; const SWord8 s1022 = s1020 ^ s1021; const SWord8 s1023 = s1019 ^ s1022; const SWord8 s1024 = s1018 ^ s1023; const SWord16 s1025 = (((SWord16) s1017) << 8) | ((SWord16) s1024); const SWord8 s1026 = table3[s1006]; const SWord8 s1027 = table4[s1008]; const SWord8 s1028 = table1[s1011]; const SWord8 s1029 = table2[s1013]; const SWord8 s1030 = s1028 ^ s1029; const SWord8 s1031 = s1027 ^ s1030; const SWord8 s1032 = s1026 ^ s1031; const SWord8 s1033 = table2[s1006]; const SWord8 s1034 = table3[s1008]; const SWord8 s1035 = table4[s1011]; const SWord8 s1036 = table1[s1013]; const SWord8 s1037 = s1035 ^ s1036; const SWord8 s1038 = s1034 ^ s1037; const SWord8 s1039 = s1033 ^ s1038; const SWord16 s1040 = (((SWord16) s1032) << 8) | ((SWord16) s1039); const SWord32 s1041 = (((SWord32) s1025) << 16) | ((SWord32) s1040); const SWord16 s1042 = (SWord16) (s351 >> 16); const SWord8 s1043 = (SWord8) (s1042 >> 8); const SWord8 s1044 = table1[s1043]; const SWord8 s1045 = (SWord8) s1042; const SWord8 s1046 = table2[s1045]; const SWord16 s1047 = (SWord16) s351; const SWord8 s1048 = (SWord8) (s1047 >> 8); const SWord8 s1049 = table3[s1048]; const SWord8 s1050 = (SWord8) s1047; const SWord8 s1051 = table4[s1050]; const SWord8 s1052 = s1049 ^ s1051; const SWord8 s1053 = s1046 ^ s1052; const SWord8 s1054 = s1044 ^ s1053; const SWord8 s1055 = table4[s1043]; const SWord8 s1056 = table1[s1045]; const SWord8 s1057 = table2[s1048]; const SWord8 s1058 = table3[s1050]; const SWord8 s1059 = s1057 ^ s1058; const SWord8 s1060 = s1056 ^ s1059; const SWord8 s1061 = s1055 ^ s1060; const SWord16 s1062 = (((SWord16) s1054) << 8) | ((SWord16) s1061); const SWord8 s1063 = table3[s1043]; const SWord8 s1064 = table4[s1045]; const SWord8 s1065 = table1[s1048]; const SWord8 s1066 = table2[s1050]; const SWord8 s1067 = s1065 ^ s1066; const SWord8 s1068 = s1064 ^ s1067; const SWord8 s1069 = s1063 ^ s1068; const SWord8 s1070 = table2[s1043]; const SWord8 s1071 = table3[s1045]; const SWord8 s1072 = table4[s1048]; const SWord8 s1073 = table1[s1050]; const SWord8 s1074 = s1072 ^ s1073; const SWord8 s1075 = s1071 ^ s1074; const SWord8 s1076 = s1070 ^ s1075; const SWord16 s1077 = (((SWord16) s1069) << 8) | ((SWord16) s1076); const SWord32 s1078 = (((SWord32) s1062) << 16) | ((SWord32) s1077); const SWord16 s1079 = (SWord16) (s352 >> 16); const SWord8 s1080 = (SWord8) (s1079 >> 8); const SWord8 s1081 = table1[s1080]; const SWord8 s1082 = (SWord8) s1079; const SWord8 s1083 = table2[s1082]; const SWord16 s1084 = (SWord16) s352; const SWord8 s1085 = (SWord8) (s1084 >> 8); const SWord8 s1086 = table3[s1085]; const SWord8 s1087 = (SWord8) s1084; const SWord8 s1088 = table4[s1087]; const SWord8 s1089 = s1086 ^ s1088; const SWord8 s1090 = s1083 ^ s1089; const SWord8 s1091 = s1081 ^ s1090; const SWord8 s1092 = table4[s1080]; const SWord8 s1093 = table1[s1082]; const SWord8 s1094 = table2[s1085]; const SWord8 s1095 = table3[s1087]; const SWord8 s1096 = s1094 ^ s1095; const SWord8 s1097 = s1093 ^ s1096; const SWord8 s1098 = s1092 ^ s1097; const SWord16 s1099 = (((SWord16) s1091) << 8) | ((SWord16) s1098); const SWord8 s1100 = table3[s1080]; const SWord8 s1101 = table4[s1082]; const SWord8 s1102 = table1[s1085]; const SWord8 s1103 = table2[s1087]; const SWord8 s1104 = s1102 ^ s1103; const SWord8 s1105 = s1101 ^ s1104; const SWord8 s1106 = s1100 ^ s1105; const SWord8 s1107 = table2[s1080]; const SWord8 s1108 = table3[s1082]; const SWord8 s1109 = table4[s1085]; const SWord8 s1110 = table1[s1087]; const SWord8 s1111 = s1109 ^ s1110; const SWord8 s1112 = s1108 ^ s1111; const SWord8 s1113 = s1107 ^ s1112; const SWord16 s1114 = (((SWord16) s1106) << 8) | ((SWord16) s1113); const SWord32 s1115 = (((SWord32) s1099) << 16) | ((SWord32) s1114); const SWord16 s1116 = (SWord16) (s353 >> 16); const SWord8 s1117 = (SWord8) (s1116 >> 8); const SWord8 s1118 = table1[s1117]; const SWord8 s1119 = (SWord8) s1116; const SWord8 s1120 = table2[s1119]; const SWord16 s1121 = (SWord16) s353; const SWord8 s1122 = (SWord8) (s1121 >> 8); const SWord8 s1123 = table3[s1122]; const SWord8 s1124 = (SWord8) s1121; const SWord8 s1125 = table4[s1124]; const SWord8 s1126 = s1123 ^ s1125; const SWord8 s1127 = s1120 ^ s1126; const SWord8 s1128 = s1118 ^ s1127; const SWord8 s1129 = table4[s1117]; const SWord8 s1130 = table1[s1119]; const SWord8 s1131 = table2[s1122]; const SWord8 s1132 = table3[s1124]; const SWord8 s1133 = s1131 ^ s1132; const SWord8 s1134 = s1130 ^ s1133; const SWord8 s1135 = s1129 ^ s1134; const SWord16 s1136 = (((SWord16) s1128) << 8) | ((SWord16) s1135); const SWord8 s1137 = table3[s1117]; const SWord8 s1138 = table4[s1119]; const SWord8 s1139 = table1[s1122]; const SWord8 s1140 = table2[s1124]; const SWord8 s1141 = s1139 ^ s1140; const SWord8 s1142 = s1138 ^ s1141; const SWord8 s1143 = s1137 ^ s1142; const SWord8 s1144 = table2[s1117]; const SWord8 s1145 = table3[s1119]; const SWord8 s1146 = table4[s1122]; const SWord8 s1147 = table1[s1124]; const SWord8 s1148 = s1146 ^ s1147; const SWord8 s1149 = s1145 ^ s1148; const SWord8 s1150 = s1144 ^ s1149; const SWord16 s1151 = (((SWord16) s1143) << 8) | ((SWord16) s1150); const SWord32 s1152 = (((SWord32) s1136) << 16) | ((SWord32) s1151); const SWord16 s1153 = (SWord16) (s354 >> 16); const SWord8 s1154 = (SWord8) (s1153 >> 8); const SWord8 s1155 = table1[s1154]; const SWord8 s1156 = (SWord8) s1153; const SWord8 s1157 = table2[s1156]; const SWord16 s1158 = (SWord16) s354; const SWord8 s1159 = (SWord8) (s1158 >> 8); const SWord8 s1160 = table3[s1159]; const SWord8 s1161 = (SWord8) s1158; const SWord8 s1162 = table4[s1161]; const SWord8 s1163 = s1160 ^ s1162; const SWord8 s1164 = s1157 ^ s1163; const SWord8 s1165 = s1155 ^ s1164; const SWord8 s1166 = table4[s1154]; const SWord8 s1167 = table1[s1156]; const SWord8 s1168 = table2[s1159]; const SWord8 s1169 = table3[s1161]; const SWord8 s1170 = s1168 ^ s1169; const SWord8 s1171 = s1167 ^ s1170; const SWord8 s1172 = s1166 ^ s1171; const SWord16 s1173 = (((SWord16) s1165) << 8) | ((SWord16) s1172); const SWord8 s1174 = table3[s1154]; const SWord8 s1175 = table4[s1156]; const SWord8 s1176 = table1[s1159]; const SWord8 s1177 = table2[s1161]; const SWord8 s1178 = s1176 ^ s1177; const SWord8 s1179 = s1175 ^ s1178; const SWord8 s1180 = s1174 ^ s1179; const SWord8 s1181 = table2[s1154]; const SWord8 s1182 = table3[s1156]; const SWord8 s1183 = table4[s1159]; const SWord8 s1184 = table1[s1161]; const SWord8 s1185 = s1183 ^ s1184; const SWord8 s1186 = s1182 ^ s1185; const SWord8 s1187 = s1181 ^ s1186; const SWord16 s1188 = (((SWord16) s1180) << 8) | ((SWord16) s1187); const SWord32 s1189 = (((SWord32) s1173) << 16) | ((SWord32) s1188); const SWord16 s1190 = (SWord16) (s332 >> 16); const SWord8 s1191 = (SWord8) (s1190 >> 8); const SWord8 s1192 = table1[s1191]; const SWord8 s1193 = (SWord8) s1190; const SWord8 s1194 = table2[s1193]; const SWord16 s1195 = (SWord16) s332; const SWord8 s1196 = (SWord8) (s1195 >> 8); const SWord8 s1197 = table3[s1196]; const SWord8 s1198 = (SWord8) s1195; const SWord8 s1199 = table4[s1198]; const SWord8 s1200 = s1197 ^ s1199; const SWord8 s1201 = s1194 ^ s1200; const SWord8 s1202 = s1192 ^ s1201; const SWord8 s1203 = table4[s1191]; const SWord8 s1204 = table1[s1193]; const SWord8 s1205 = table2[s1196]; const SWord8 s1206 = table3[s1198]; const SWord8 s1207 = s1205 ^ s1206; const SWord8 s1208 = s1204 ^ s1207; const SWord8 s1209 = s1203 ^ s1208; const SWord16 s1210 = (((SWord16) s1202) << 8) | ((SWord16) s1209); const SWord8 s1211 = table3[s1191]; const SWord8 s1212 = table4[s1193]; const SWord8 s1213 = table1[s1196]; const SWord8 s1214 = table2[s1198]; const SWord8 s1215 = s1213 ^ s1214; const SWord8 s1216 = s1212 ^ s1215; const SWord8 s1217 = s1211 ^ s1216; const SWord8 s1218 = table2[s1191]; const SWord8 s1219 = table3[s1193]; const SWord8 s1220 = table4[s1196]; const SWord8 s1221 = table1[s1198]; const SWord8 s1222 = s1220 ^ s1221; const SWord8 s1223 = s1219 ^ s1222; const SWord8 s1224 = s1218 ^ s1223; const SWord16 s1225 = (((SWord16) s1217) << 8) | ((SWord16) s1224); const SWord32 s1226 = (((SWord32) s1210) << 16) | ((SWord32) s1225); const SWord16 s1227 = (SWord16) (s333 >> 16); const SWord8 s1228 = (SWord8) (s1227 >> 8); const SWord8 s1229 = table1[s1228]; const SWord8 s1230 = (SWord8) s1227; const SWord8 s1231 = table2[s1230]; const SWord16 s1232 = (SWord16) s333; const SWord8 s1233 = (SWord8) (s1232 >> 8); const SWord8 s1234 = table3[s1233]; const SWord8 s1235 = (SWord8) s1232; const SWord8 s1236 = table4[s1235]; const SWord8 s1237 = s1234 ^ s1236; const SWord8 s1238 = s1231 ^ s1237; const SWord8 s1239 = s1229 ^ s1238; const SWord8 s1240 = table4[s1228]; const SWord8 s1241 = table1[s1230]; const SWord8 s1242 = table2[s1233]; const SWord8 s1243 = table3[s1235]; const SWord8 s1244 = s1242 ^ s1243; const SWord8 s1245 = s1241 ^ s1244; const SWord8 s1246 = s1240 ^ s1245; const SWord16 s1247 = (((SWord16) s1239) << 8) | ((SWord16) s1246); const SWord8 s1248 = table3[s1228]; const SWord8 s1249 = table4[s1230]; const SWord8 s1250 = table1[s1233]; const SWord8 s1251 = table2[s1235]; const SWord8 s1252 = s1250 ^ s1251; const SWord8 s1253 = s1249 ^ s1252; const SWord8 s1254 = s1248 ^ s1253; const SWord8 s1255 = table2[s1228]; const SWord8 s1256 = table3[s1230]; const SWord8 s1257 = table4[s1233]; const SWord8 s1258 = table1[s1235]; const SWord8 s1259 = s1257 ^ s1258; const SWord8 s1260 = s1256 ^ s1259; const SWord8 s1261 = s1255 ^ s1260; const SWord16 s1262 = (((SWord16) s1254) << 8) | ((SWord16) s1261); const SWord32 s1263 = (((SWord32) s1247) << 16) | ((SWord32) s1262); const SWord16 s1264 = (SWord16) (s334 >> 16); const SWord8 s1265 = (SWord8) (s1264 >> 8); const SWord8 s1266 = table1[s1265]; const SWord8 s1267 = (SWord8) s1264; const SWord8 s1268 = table2[s1267]; const SWord16 s1269 = (SWord16) s334; const SWord8 s1270 = (SWord8) (s1269 >> 8); const SWord8 s1271 = table3[s1270]; const SWord8 s1272 = (SWord8) s1269; const SWord8 s1273 = table4[s1272]; const SWord8 s1274 = s1271 ^ s1273; const SWord8 s1275 = s1268 ^ s1274; const SWord8 s1276 = s1266 ^ s1275; const SWord8 s1277 = table4[s1265]; const SWord8 s1278 = table1[s1267]; const SWord8 s1279 = table2[s1270]; const SWord8 s1280 = table3[s1272]; const SWord8 s1281 = s1279 ^ s1280; const SWord8 s1282 = s1278 ^ s1281; const SWord8 s1283 = s1277 ^ s1282; const SWord16 s1284 = (((SWord16) s1276) << 8) | ((SWord16) s1283); const SWord8 s1285 = table3[s1265]; const SWord8 s1286 = table4[s1267]; const SWord8 s1287 = table1[s1270]; const SWord8 s1288 = table2[s1272]; const SWord8 s1289 = s1287 ^ s1288; const SWord8 s1290 = s1286 ^ s1289; const SWord8 s1291 = s1285 ^ s1290; const SWord8 s1292 = table2[s1265]; const SWord8 s1293 = table3[s1267]; const SWord8 s1294 = table4[s1270]; const SWord8 s1295 = table1[s1272]; const SWord8 s1296 = s1294 ^ s1295; const SWord8 s1297 = s1293 ^ s1296; const SWord8 s1298 = s1292 ^ s1297; const SWord16 s1299 = (((SWord16) s1291) << 8) | ((SWord16) s1298); const SWord32 s1300 = (((SWord32) s1284) << 16) | ((SWord32) s1299); const SWord16 s1301 = (SWord16) (s335 >> 16); const SWord8 s1302 = (SWord8) (s1301 >> 8); const SWord8 s1303 = table1[s1302]; const SWord8 s1304 = (SWord8) s1301; const SWord8 s1305 = table2[s1304]; const SWord16 s1306 = (SWord16) s335; const SWord8 s1307 = (SWord8) (s1306 >> 8); const SWord8 s1308 = table3[s1307]; const SWord8 s1309 = (SWord8) s1306; const SWord8 s1310 = table4[s1309]; const SWord8 s1311 = s1308 ^ s1310; const SWord8 s1312 = s1305 ^ s1311; const SWord8 s1313 = s1303 ^ s1312; const SWord8 s1314 = table4[s1302]; const SWord8 s1315 = table1[s1304]; const SWord8 s1316 = table2[s1307]; const SWord8 s1317 = table3[s1309]; const SWord8 s1318 = s1316 ^ s1317; const SWord8 s1319 = s1315 ^ s1318; const SWord8 s1320 = s1314 ^ s1319; const SWord16 s1321 = (((SWord16) s1313) << 8) | ((SWord16) s1320); const SWord8 s1322 = table3[s1302]; const SWord8 s1323 = table4[s1304]; const SWord8 s1324 = table1[s1307]; const SWord8 s1325 = table2[s1309]; const SWord8 s1326 = s1324 ^ s1325; const SWord8 s1327 = s1323 ^ s1326; const SWord8 s1328 = s1322 ^ s1327; const SWord8 s1329 = table2[s1302]; const SWord8 s1330 = table3[s1304]; const SWord8 s1331 = table4[s1307]; const SWord8 s1332 = table1[s1309]; const SWord8 s1333 = s1331 ^ s1332; const SWord8 s1334 = s1330 ^ s1333; const SWord8 s1335 = s1329 ^ s1334; const SWord16 s1336 = (((SWord16) s1328) << 8) | ((SWord16) s1335); const SWord32 s1337 = (((SWord32) s1321) << 16) | ((SWord32) s1336); const SWord16 s1338 = (SWord16) (s313 >> 16); const SWord8 s1339 = (SWord8) (s1338 >> 8); const SWord8 s1340 = table1[s1339]; const SWord8 s1341 = (SWord8) s1338; const SWord8 s1342 = table2[s1341]; const SWord16 s1343 = (SWord16) s313; const SWord8 s1344 = (SWord8) (s1343 >> 8); const SWord8 s1345 = table3[s1344]; const SWord8 s1346 = (SWord8) s1343; const SWord8 s1347 = table4[s1346]; const SWord8 s1348 = s1345 ^ s1347; const SWord8 s1349 = s1342 ^ s1348; const SWord8 s1350 = s1340 ^ s1349; const SWord8 s1351 = table4[s1339]; const SWord8 s1352 = table1[s1341]; const SWord8 s1353 = table2[s1344]; const SWord8 s1354 = table3[s1346]; const SWord8 s1355 = s1353 ^ s1354; const SWord8 s1356 = s1352 ^ s1355; const SWord8 s1357 = s1351 ^ s1356; const SWord16 s1358 = (((SWord16) s1350) << 8) | ((SWord16) s1357); const SWord8 s1359 = table3[s1339]; const SWord8 s1360 = table4[s1341]; const SWord8 s1361 = table1[s1344]; const SWord8 s1362 = table2[s1346]; const SWord8 s1363 = s1361 ^ s1362; const SWord8 s1364 = s1360 ^ s1363; const SWord8 s1365 = s1359 ^ s1364; const SWord8 s1366 = table2[s1339]; const SWord8 s1367 = table3[s1341]; const SWord8 s1368 = table4[s1344]; const SWord8 s1369 = table1[s1346]; const SWord8 s1370 = s1368 ^ s1369; const SWord8 s1371 = s1367 ^ s1370; const SWord8 s1372 = s1366 ^ s1371; const SWord16 s1373 = (((SWord16) s1365) << 8) | ((SWord16) s1372); const SWord32 s1374 = (((SWord32) s1358) << 16) | ((SWord32) s1373); const SWord16 s1375 = (SWord16) (s314 >> 16); const SWord8 s1376 = (SWord8) (s1375 >> 8); const SWord8 s1377 = table1[s1376]; const SWord8 s1378 = (SWord8) s1375; const SWord8 s1379 = table2[s1378]; const SWord16 s1380 = (SWord16) s314; const SWord8 s1381 = (SWord8) (s1380 >> 8); const SWord8 s1382 = table3[s1381]; const SWord8 s1383 = (SWord8) s1380; const SWord8 s1384 = table4[s1383]; const SWord8 s1385 = s1382 ^ s1384; const SWord8 s1386 = s1379 ^ s1385; const SWord8 s1387 = s1377 ^ s1386; const SWord8 s1388 = table4[s1376]; const SWord8 s1389 = table1[s1378]; const SWord8 s1390 = table2[s1381]; const SWord8 s1391 = table3[s1383]; const SWord8 s1392 = s1390 ^ s1391; const SWord8 s1393 = s1389 ^ s1392; const SWord8 s1394 = s1388 ^ s1393; const SWord16 s1395 = (((SWord16) s1387) << 8) | ((SWord16) s1394); const SWord8 s1396 = table3[s1376]; const SWord8 s1397 = table4[s1378]; const SWord8 s1398 = table1[s1381]; const SWord8 s1399 = table2[s1383]; const SWord8 s1400 = s1398 ^ s1399; const SWord8 s1401 = s1397 ^ s1400; const SWord8 s1402 = s1396 ^ s1401; const SWord8 s1403 = table2[s1376]; const SWord8 s1404 = table3[s1378]; const SWord8 s1405 = table4[s1381]; const SWord8 s1406 = table1[s1383]; const SWord8 s1407 = s1405 ^ s1406; const SWord8 s1408 = s1404 ^ s1407; const SWord8 s1409 = s1403 ^ s1408; const SWord16 s1410 = (((SWord16) s1402) << 8) | ((SWord16) s1409); const SWord32 s1411 = (((SWord32) s1395) << 16) | ((SWord32) s1410); const SWord16 s1412 = (SWord16) (s315 >> 16); const SWord8 s1413 = (SWord8) (s1412 >> 8); const SWord8 s1414 = table1[s1413]; const SWord8 s1415 = (SWord8) s1412; const SWord8 s1416 = table2[s1415]; const SWord16 s1417 = (SWord16) s315; const SWord8 s1418 = (SWord8) (s1417 >> 8); const SWord8 s1419 = table3[s1418]; const SWord8 s1420 = (SWord8) s1417; const SWord8 s1421 = table4[s1420]; const SWord8 s1422 = s1419 ^ s1421; const SWord8 s1423 = s1416 ^ s1422; const SWord8 s1424 = s1414 ^ s1423; const SWord8 s1425 = table4[s1413]; const SWord8 s1426 = table1[s1415]; const SWord8 s1427 = table2[s1418]; const SWord8 s1428 = table3[s1420]; const SWord8 s1429 = s1427 ^ s1428; const SWord8 s1430 = s1426 ^ s1429; const SWord8 s1431 = s1425 ^ s1430; const SWord16 s1432 = (((SWord16) s1424) << 8) | ((SWord16) s1431); const SWord8 s1433 = table3[s1413]; const SWord8 s1434 = table4[s1415]; const SWord8 s1435 = table1[s1418]; const SWord8 s1436 = table2[s1420]; const SWord8 s1437 = s1435 ^ s1436; const SWord8 s1438 = s1434 ^ s1437; const SWord8 s1439 = s1433 ^ s1438; const SWord8 s1440 = table2[s1413]; const SWord8 s1441 = table3[s1415]; const SWord8 s1442 = table4[s1418]; const SWord8 s1443 = table1[s1420]; const SWord8 s1444 = s1442 ^ s1443; const SWord8 s1445 = s1441 ^ s1444; const SWord8 s1446 = s1440 ^ s1445; const SWord16 s1447 = (((SWord16) s1439) << 8) | ((SWord16) s1446); const SWord32 s1448 = (((SWord32) s1432) << 16) | ((SWord32) s1447); const SWord16 s1449 = (SWord16) (s316 >> 16); const SWord8 s1450 = (SWord8) (s1449 >> 8); const SWord8 s1451 = table1[s1450]; const SWord8 s1452 = (SWord8) s1449; const SWord8 s1453 = table2[s1452]; const SWord16 s1454 = (SWord16) s316; const SWord8 s1455 = (SWord8) (s1454 >> 8); const SWord8 s1456 = table3[s1455]; const SWord8 s1457 = (SWord8) s1454; const SWord8 s1458 = table4[s1457]; const SWord8 s1459 = s1456 ^ s1458; const SWord8 s1460 = s1453 ^ s1459; const SWord8 s1461 = s1451 ^ s1460; const SWord8 s1462 = table4[s1450]; const SWord8 s1463 = table1[s1452]; const SWord8 s1464 = table2[s1455]; const SWord8 s1465 = table3[s1457]; const SWord8 s1466 = s1464 ^ s1465; const SWord8 s1467 = s1463 ^ s1466; const SWord8 s1468 = s1462 ^ s1467; const SWord16 s1469 = (((SWord16) s1461) << 8) | ((SWord16) s1468); const SWord8 s1470 = table3[s1450]; const SWord8 s1471 = table4[s1452]; const SWord8 s1472 = table1[s1455]; const SWord8 s1473 = table2[s1457]; const SWord8 s1474 = s1472 ^ s1473; const SWord8 s1475 = s1471 ^ s1474; const SWord8 s1476 = s1470 ^ s1475; const SWord8 s1477 = table2[s1450]; const SWord8 s1478 = table3[s1452]; const SWord8 s1479 = table4[s1455]; const SWord8 s1480 = table1[s1457]; const SWord8 s1481 = s1479 ^ s1480; const SWord8 s1482 = s1478 ^ s1481; const SWord8 s1483 = s1477 ^ s1482; const SWord16 s1484 = (((SWord16) s1476) << 8) | ((SWord16) s1483); const SWord32 s1485 = (((SWord32) s1469) << 16) | ((SWord32) s1484); const SWord16 s1486 = (SWord16) (s294 >> 16); const SWord8 s1487 = (SWord8) (s1486 >> 8); const SWord8 s1488 = table1[s1487]; const SWord8 s1489 = (SWord8) s1486; const SWord8 s1490 = table2[s1489]; const SWord16 s1491 = (SWord16) s294; const SWord8 s1492 = (SWord8) (s1491 >> 8); const SWord8 s1493 = table3[s1492]; const SWord8 s1494 = (SWord8) s1491; const SWord8 s1495 = table4[s1494]; const SWord8 s1496 = s1493 ^ s1495; const SWord8 s1497 = s1490 ^ s1496; const SWord8 s1498 = s1488 ^ s1497; const SWord8 s1499 = table4[s1487]; const SWord8 s1500 = table1[s1489]; const SWord8 s1501 = table2[s1492]; const SWord8 s1502 = table3[s1494]; const SWord8 s1503 = s1501 ^ s1502; const SWord8 s1504 = s1500 ^ s1503; const SWord8 s1505 = s1499 ^ s1504; const SWord16 s1506 = (((SWord16) s1498) << 8) | ((SWord16) s1505); const SWord8 s1507 = table3[s1487]; const SWord8 s1508 = table4[s1489]; const SWord8 s1509 = table1[s1492]; const SWord8 s1510 = table2[s1494]; const SWord8 s1511 = s1509 ^ s1510; const SWord8 s1512 = s1508 ^ s1511; const SWord8 s1513 = s1507 ^ s1512; const SWord8 s1514 = table2[s1487]; const SWord8 s1515 = table3[s1489]; const SWord8 s1516 = table4[s1492]; const SWord8 s1517 = table1[s1494]; const SWord8 s1518 = s1516 ^ s1517; const SWord8 s1519 = s1515 ^ s1518; const SWord8 s1520 = s1514 ^ s1519; const SWord16 s1521 = (((SWord16) s1513) << 8) | ((SWord16) s1520); const SWord32 s1522 = (((SWord32) s1506) << 16) | ((SWord32) s1521); const SWord16 s1523 = (SWord16) (s295 >> 16); const SWord8 s1524 = (SWord8) (s1523 >> 8); const SWord8 s1525 = table1[s1524]; const SWord8 s1526 = (SWord8) s1523; const SWord8 s1527 = table2[s1526]; const SWord16 s1528 = (SWord16) s295; const SWord8 s1529 = (SWord8) (s1528 >> 8); const SWord8 s1530 = table3[s1529]; const SWord8 s1531 = (SWord8) s1528; const SWord8 s1532 = table4[s1531]; const SWord8 s1533 = s1530 ^ s1532; const SWord8 s1534 = s1527 ^ s1533; const SWord8 s1535 = s1525 ^ s1534; const SWord8 s1536 = table4[s1524]; const SWord8 s1537 = table1[s1526]; const SWord8 s1538 = table2[s1529]; const SWord8 s1539 = table3[s1531]; const SWord8 s1540 = s1538 ^ s1539; const SWord8 s1541 = s1537 ^ s1540; const SWord8 s1542 = s1536 ^ s1541; const SWord16 s1543 = (((SWord16) s1535) << 8) | ((SWord16) s1542); const SWord8 s1544 = table3[s1524]; const SWord8 s1545 = table4[s1526]; const SWord8 s1546 = table1[s1529]; const SWord8 s1547 = table2[s1531]; const SWord8 s1548 = s1546 ^ s1547; const SWord8 s1549 = s1545 ^ s1548; const SWord8 s1550 = s1544 ^ s1549; const SWord8 s1551 = table2[s1524]; const SWord8 s1552 = table3[s1526]; const SWord8 s1553 = table4[s1529]; const SWord8 s1554 = table1[s1531]; const SWord8 s1555 = s1553 ^ s1554; const SWord8 s1556 = s1552 ^ s1555; const SWord8 s1557 = s1551 ^ s1556; const SWord16 s1558 = (((SWord16) s1550) << 8) | ((SWord16) s1557); const SWord32 s1559 = (((SWord32) s1543) << 16) | ((SWord32) s1558); const SWord16 s1560 = (SWord16) (s296 >> 16); const SWord8 s1561 = (SWord8) (s1560 >> 8); const SWord8 s1562 = table1[s1561]; const SWord8 s1563 = (SWord8) s1560; const SWord8 s1564 = table2[s1563]; const SWord16 s1565 = (SWord16) s296; const SWord8 s1566 = (SWord8) (s1565 >> 8); const SWord8 s1567 = table3[s1566]; const SWord8 s1568 = (SWord8) s1565; const SWord8 s1569 = table4[s1568]; const SWord8 s1570 = s1567 ^ s1569; const SWord8 s1571 = s1564 ^ s1570; const SWord8 s1572 = s1562 ^ s1571; const SWord8 s1573 = table4[s1561]; const SWord8 s1574 = table1[s1563]; const SWord8 s1575 = table2[s1566]; const SWord8 s1576 = table3[s1568]; const SWord8 s1577 = s1575 ^ s1576; const SWord8 s1578 = s1574 ^ s1577; const SWord8 s1579 = s1573 ^ s1578; const SWord16 s1580 = (((SWord16) s1572) << 8) | ((SWord16) s1579); const SWord8 s1581 = table3[s1561]; const SWord8 s1582 = table4[s1563]; const SWord8 s1583 = table1[s1566]; const SWord8 s1584 = table2[s1568]; const SWord8 s1585 = s1583 ^ s1584; const SWord8 s1586 = s1582 ^ s1585; const SWord8 s1587 = s1581 ^ s1586; const SWord8 s1588 = table2[s1561]; const SWord8 s1589 = table3[s1563]; const SWord8 s1590 = table4[s1566]; const SWord8 s1591 = table1[s1568]; const SWord8 s1592 = s1590 ^ s1591; const SWord8 s1593 = s1589 ^ s1592; const SWord8 s1594 = s1588 ^ s1593; const SWord16 s1595 = (((SWord16) s1587) << 8) | ((SWord16) s1594); const SWord32 s1596 = (((SWord32) s1580) << 16) | ((SWord32) s1595); const SWord16 s1597 = (SWord16) (s297 >> 16); const SWord8 s1598 = (SWord8) (s1597 >> 8); const SWord8 s1599 = table1[s1598]; const SWord8 s1600 = (SWord8) s1597; const SWord8 s1601 = table2[s1600]; const SWord16 s1602 = (SWord16) s297; const SWord8 s1603 = (SWord8) (s1602 >> 8); const SWord8 s1604 = table3[s1603]; const SWord8 s1605 = (SWord8) s1602; const SWord8 s1606 = table4[s1605]; const SWord8 s1607 = s1604 ^ s1606; const SWord8 s1608 = s1601 ^ s1607; const SWord8 s1609 = s1599 ^ s1608; const SWord8 s1610 = table4[s1598]; const SWord8 s1611 = table1[s1600]; const SWord8 s1612 = table2[s1603]; const SWord8 s1613 = table3[s1605]; const SWord8 s1614 = s1612 ^ s1613; const SWord8 s1615 = s1611 ^ s1614; const SWord8 s1616 = s1610 ^ s1615; const SWord16 s1617 = (((SWord16) s1609) << 8) | ((SWord16) s1616); const SWord8 s1618 = table3[s1598]; const SWord8 s1619 = table4[s1600]; const SWord8 s1620 = table1[s1603]; const SWord8 s1621 = table2[s1605]; const SWord8 s1622 = s1620 ^ s1621; const SWord8 s1623 = s1619 ^ s1622; const SWord8 s1624 = s1618 ^ s1623; const SWord8 s1625 = table2[s1598]; const SWord8 s1626 = table3[s1600]; const SWord8 s1627 = table4[s1603]; const SWord8 s1628 = table1[s1605]; const SWord8 s1629 = s1627 ^ s1628; const SWord8 s1630 = s1626 ^ s1629; const SWord8 s1631 = s1625 ^ s1630; const SWord16 s1632 = (((SWord16) s1624) << 8) | ((SWord16) s1631); const SWord32 s1633 = (((SWord32) s1617) << 16) | ((SWord32) s1632); const SWord16 s1634 = (SWord16) (s275 >> 16); const SWord8 s1635 = (SWord8) (s1634 >> 8); const SWord8 s1636 = table1[s1635]; const SWord8 s1637 = (SWord8) s1634; const SWord8 s1638 = table2[s1637]; const SWord16 s1639 = (SWord16) s275; const SWord8 s1640 = (SWord8) (s1639 >> 8); const SWord8 s1641 = table3[s1640]; const SWord8 s1642 = (SWord8) s1639; const SWord8 s1643 = table4[s1642]; const SWord8 s1644 = s1641 ^ s1643; const SWord8 s1645 = s1638 ^ s1644; const SWord8 s1646 = s1636 ^ s1645; const SWord8 s1647 = table4[s1635]; const SWord8 s1648 = table1[s1637]; const SWord8 s1649 = table2[s1640]; const SWord8 s1650 = table3[s1642]; const SWord8 s1651 = s1649 ^ s1650; const SWord8 s1652 = s1648 ^ s1651; const SWord8 s1653 = s1647 ^ s1652; const SWord16 s1654 = (((SWord16) s1646) << 8) | ((SWord16) s1653); const SWord8 s1655 = table3[s1635]; const SWord8 s1656 = table4[s1637]; const SWord8 s1657 = table1[s1640]; const SWord8 s1658 = table2[s1642]; const SWord8 s1659 = s1657 ^ s1658; const SWord8 s1660 = s1656 ^ s1659; const SWord8 s1661 = s1655 ^ s1660; const SWord8 s1662 = table2[s1635]; const SWord8 s1663 = table3[s1637]; const SWord8 s1664 = table4[s1640]; const SWord8 s1665 = table1[s1642]; const SWord8 s1666 = s1664 ^ s1665; const SWord8 s1667 = s1663 ^ s1666; const SWord8 s1668 = s1662 ^ s1667; const SWord16 s1669 = (((SWord16) s1661) << 8) | ((SWord16) s1668); const SWord32 s1670 = (((SWord32) s1654) << 16) | ((SWord32) s1669); const SWord16 s1671 = (SWord16) (s276 >> 16); const SWord8 s1672 = (SWord8) (s1671 >> 8); const SWord8 s1673 = table1[s1672]; const SWord8 s1674 = (SWord8) s1671; const SWord8 s1675 = table2[s1674]; const SWord16 s1676 = (SWord16) s276; const SWord8 s1677 = (SWord8) (s1676 >> 8); const SWord8 s1678 = table3[s1677]; const SWord8 s1679 = (SWord8) s1676; const SWord8 s1680 = table4[s1679]; const SWord8 s1681 = s1678 ^ s1680; const SWord8 s1682 = s1675 ^ s1681; const SWord8 s1683 = s1673 ^ s1682; const SWord8 s1684 = table4[s1672]; const SWord8 s1685 = table1[s1674]; const SWord8 s1686 = table2[s1677]; const SWord8 s1687 = table3[s1679]; const SWord8 s1688 = s1686 ^ s1687; const SWord8 s1689 = s1685 ^ s1688; const SWord8 s1690 = s1684 ^ s1689; const SWord16 s1691 = (((SWord16) s1683) << 8) | ((SWord16) s1690); const SWord8 s1692 = table3[s1672]; const SWord8 s1693 = table4[s1674]; const SWord8 s1694 = table1[s1677]; const SWord8 s1695 = table2[s1679]; const SWord8 s1696 = s1694 ^ s1695; const SWord8 s1697 = s1693 ^ s1696; const SWord8 s1698 = s1692 ^ s1697; const SWord8 s1699 = table2[s1672]; const SWord8 s1700 = table3[s1674]; const SWord8 s1701 = table4[s1677]; const SWord8 s1702 = table1[s1679]; const SWord8 s1703 = s1701 ^ s1702; const SWord8 s1704 = s1700 ^ s1703; const SWord8 s1705 = s1699 ^ s1704; const SWord16 s1706 = (((SWord16) s1698) << 8) | ((SWord16) s1705); const SWord32 s1707 = (((SWord32) s1691) << 16) | ((SWord32) s1706); const SWord16 s1708 = (SWord16) (s277 >> 16); const SWord8 s1709 = (SWord8) (s1708 >> 8); const SWord8 s1710 = table1[s1709]; const SWord8 s1711 = (SWord8) s1708; const SWord8 s1712 = table2[s1711]; const SWord16 s1713 = (SWord16) s277; const SWord8 s1714 = (SWord8) (s1713 >> 8); const SWord8 s1715 = table3[s1714]; const SWord8 s1716 = (SWord8) s1713; const SWord8 s1717 = table4[s1716]; const SWord8 s1718 = s1715 ^ s1717; const SWord8 s1719 = s1712 ^ s1718; const SWord8 s1720 = s1710 ^ s1719; const SWord8 s1721 = table4[s1709]; const SWord8 s1722 = table1[s1711]; const SWord8 s1723 = table2[s1714]; const SWord8 s1724 = table3[s1716]; const SWord8 s1725 = s1723 ^ s1724; const SWord8 s1726 = s1722 ^ s1725; const SWord8 s1727 = s1721 ^ s1726; const SWord16 s1728 = (((SWord16) s1720) << 8) | ((SWord16) s1727); const SWord8 s1729 = table3[s1709]; const SWord8 s1730 = table4[s1711]; const SWord8 s1731 = table1[s1714]; const SWord8 s1732 = table2[s1716]; const SWord8 s1733 = s1731 ^ s1732; const SWord8 s1734 = s1730 ^ s1733; const SWord8 s1735 = s1729 ^ s1734; const SWord8 s1736 = table2[s1709]; const SWord8 s1737 = table3[s1711]; const SWord8 s1738 = table4[s1714]; const SWord8 s1739 = table1[s1716]; const SWord8 s1740 = s1738 ^ s1739; const SWord8 s1741 = s1737 ^ s1740; const SWord8 s1742 = s1736 ^ s1741; const SWord16 s1743 = (((SWord16) s1735) << 8) | ((SWord16) s1742); const SWord32 s1744 = (((SWord32) s1728) << 16) | ((SWord32) s1743); const SWord16 s1745 = (SWord16) (s278 >> 16); const SWord8 s1746 = (SWord8) (s1745 >> 8); const SWord8 s1747 = table1[s1746]; const SWord8 s1748 = (SWord8) s1745; const SWord8 s1749 = table2[s1748]; const SWord16 s1750 = (SWord16) s278; const SWord8 s1751 = (SWord8) (s1750 >> 8); const SWord8 s1752 = table3[s1751]; const SWord8 s1753 = (SWord8) s1750; const SWord8 s1754 = table4[s1753]; const SWord8 s1755 = s1752 ^ s1754; const SWord8 s1756 = s1749 ^ s1755; const SWord8 s1757 = s1747 ^ s1756; const SWord8 s1758 = table4[s1746]; const SWord8 s1759 = table1[s1748]; const SWord8 s1760 = table2[s1751]; const SWord8 s1761 = table3[s1753]; const SWord8 s1762 = s1760 ^ s1761; const SWord8 s1763 = s1759 ^ s1762; const SWord8 s1764 = s1758 ^ s1763; const SWord16 s1765 = (((SWord16) s1757) << 8) | ((SWord16) s1764); const SWord8 s1766 = table3[s1746]; const SWord8 s1767 = table4[s1748]; const SWord8 s1768 = table1[s1751]; const SWord8 s1769 = table2[s1753]; const SWord8 s1770 = s1768 ^ s1769; const SWord8 s1771 = s1767 ^ s1770; const SWord8 s1772 = s1766 ^ s1771; const SWord8 s1773 = table2[s1746]; const SWord8 s1774 = table3[s1748]; const SWord8 s1775 = table4[s1751]; const SWord8 s1776 = table1[s1753]; const SWord8 s1777 = s1775 ^ s1776; const SWord8 s1778 = s1774 ^ s1777; const SWord8 s1779 = s1773 ^ s1778; const SWord16 s1780 = (((SWord16) s1772) << 8) | ((SWord16) s1779); const SWord32 s1781 = (((SWord32) s1765) << 16) | ((SWord32) s1780); encKS[0] = s0; encKS[1] = s1; encKS[2] = s2; encKS[3] = s3; encKS[4] = s275; encKS[5] = s276; encKS[6] = s277; encKS[7] = s278; encKS[8] = s294; encKS[9] = s295; encKS[10] = s296; encKS[11] = s297; encKS[12] = s313; encKS[13] = s314; encKS[14] = s315; encKS[15] = s316; encKS[16] = s332; encKS[17] = s333; encKS[18] = s334; encKS[19] = s335; encKS[20] = s351; encKS[21] = s352; encKS[22] = s353; encKS[23] = s354; encKS[24] = s370; encKS[25] = s371; encKS[26] = s372; encKS[27] = s373; encKS[28] = s389; encKS[29] = s390; encKS[30] = s391; encKS[31] = s392; encKS[32] = s408; encKS[33] = s409; encKS[34] = s410; encKS[35] = s411; encKS[36] = s427; encKS[37] = s428; encKS[38] = s429; encKS[39] = s430; encKS[40] = s446; encKS[41] = s447; encKS[42] = s448; encKS[43] = s449; decKS[0] = s446; decKS[1] = s447; decKS[2] = s448; decKS[3] = s449; decKS[4] = s486; decKS[5] = s523; decKS[6] = s560; decKS[7] = s597; decKS[8] = s634; decKS[9] = s671; decKS[10] = s708; decKS[11] = s745; decKS[12] = s782; decKS[13] = s819; decKS[14] = s856; decKS[15] = s893; decKS[16] = s930; decKS[17] = s967; decKS[18] = s1004; decKS[19] = s1041; decKS[20] = s1078; decKS[21] = s1115; decKS[22] = s1152; decKS[23] = s1189; decKS[24] = s1226; decKS[25] = s1263; decKS[26] = s1300; decKS[27] = s1337; decKS[28] = s1374; decKS[29] = s1411; decKS[30] = s1448; decKS[31] = s1485; decKS[32] = s1522; decKS[33] = s1559; decKS[34] = s1596; decKS[35] = s1633; decKS[36] = s1670; decKS[37] = s1707; decKS[38] = s1744; decKS[39] = s1781; decKS[40] = s0; decKS[41] = s1; decKS[42] = s2; decKS[43] = s3; } == END: "aes128KeySchedule.c" ================== == BEGIN: "aes128BlockEncrypt.c" ================ /* File: "aes128BlockEncrypt.c". Automatically generated by SBV. Do not edit! */ #include "aes128Lib.h" void aes128BlockEncrypt(const SWord32 *pt, const SWord32 *xkey, SWord32 *ct) { const SWord32 s0 = pt[0]; const SWord32 s1 = pt[1]; const SWord32 s2 = pt[2]; const SWord32 s3 = pt[3]; const SWord32 s4 = xkey[0]; const SWord32 s5 = xkey[1]; const SWord32 s6 = xkey[2]; const SWord32 s7 = xkey[3]; const SWord32 s8 = xkey[4]; const SWord32 s9 = xkey[5]; const SWord32 s10 = xkey[6]; const SWord32 s11 = xkey[7]; const SWord32 s12 = xkey[8]; const SWord32 s13 = xkey[9]; const SWord32 s14 = xkey[10]; const SWord32 s15 = xkey[11]; const SWord32 s16 = xkey[12]; const SWord32 s17 = xkey[13]; const SWord32 s18 = xkey[14]; const SWord32 s19 = xkey[15]; const SWord32 s20 = xkey[16]; const SWord32 s21 = xkey[17]; const SWord32 s22 = xkey[18]; const SWord32 s23 = xkey[19]; const SWord32 s24 = xkey[20]; const SWord32 s25 = xkey[21]; const SWord32 s26 = xkey[22]; const SWord32 s27 = xkey[23]; const SWord32 s28 = xkey[24]; const SWord32 s29 = xkey[25]; const SWord32 s30 = xkey[26]; const SWord32 s31 = xkey[27]; const SWord32 s32 = xkey[28]; const SWord32 s33 = xkey[29]; const SWord32 s34 = xkey[30]; const SWord32 s35 = xkey[31]; const SWord32 s36 = xkey[32]; const SWord32 s37 = xkey[33]; const SWord32 s38 = xkey[34]; const SWord32 s39 = xkey[35]; const SWord32 s40 = xkey[36]; const SWord32 s41 = xkey[37]; const SWord32 s42 = xkey[38]; const SWord32 s43 = xkey[39]; const SWord32 s44 = xkey[40]; const SWord32 s45 = xkey[41]; const SWord32 s46 = xkey[42]; const SWord32 s47 = xkey[43]; static const SWord8 table0[] = { 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22 }; static const SWord32 table1[] = { 0xc66363a5UL, 0xf87c7c84UL, 0xee777799UL, 0xf67b7b8dUL, 0xfff2f20dUL, 0xd66b6bbdUL, 0xde6f6fb1UL, 0x91c5c554UL, 0x60303050UL, 0x02010103UL, 0xce6767a9UL, 0x562b2b7dUL, 0xe7fefe19UL, 0xb5d7d762UL, 0x4dababe6UL, 0xec76769aUL, 0x8fcaca45UL, 0x1f82829dUL, 0x89c9c940UL, 0xfa7d7d87UL, 0xeffafa15UL, 0xb25959ebUL, 0x8e4747c9UL, 0xfbf0f00bUL, 0x41adadecUL, 0xb3d4d467UL, 0x5fa2a2fdUL, 0x45afafeaUL, 0x239c9cbfUL, 0x53a4a4f7UL, 0xe4727296UL, 0x9bc0c05bUL, 0x75b7b7c2UL, 0xe1fdfd1cUL, 0x3d9393aeUL, 0x4c26266aUL, 0x6c36365aUL, 0x7e3f3f41UL, 0xf5f7f702UL, 0x83cccc4fUL, 0x6834345cUL, 0x51a5a5f4UL, 0xd1e5e534UL, 0xf9f1f108UL, 0xe2717193UL, 0xabd8d873UL, 0x62313153UL, 0x2a15153fUL, 0x0804040cUL, 0x95c7c752UL, 0x46232365UL, 0x9dc3c35eUL, 0x30181828UL, 0x379696a1UL, 0x0a05050fUL, 0x2f9a9ab5UL, 0x0e070709UL, 0x24121236UL, 0x1b80809bUL, 0xdfe2e23dUL, 0xcdebeb26UL, 0x4e272769UL, 0x7fb2b2cdUL, 0xea75759fUL, 0x1209091bUL, 0x1d83839eUL, 0x582c2c74UL, 0x341a1a2eUL, 0x361b1b2dUL, 0xdc6e6eb2UL, 0xb45a5aeeUL, 0x5ba0a0fbUL, 0xa45252f6UL, 0x763b3b4dUL, 0xb7d6d661UL, 0x7db3b3ceUL, 0x5229297bUL, 0xdde3e33eUL, 0x5e2f2f71UL, 0x13848497UL, 0xa65353f5UL, 0xb9d1d168UL, 0x00000000UL, 0xc1eded2cUL, 0x40202060UL, 0xe3fcfc1fUL, 0x79b1b1c8UL, 0xb65b5bedUL, 0xd46a6abeUL, 0x8dcbcb46UL, 0x67bebed9UL, 0x7239394bUL, 0x944a4adeUL, 0x984c4cd4UL, 0xb05858e8UL, 0x85cfcf4aUL, 0xbbd0d06bUL, 0xc5efef2aUL, 0x4faaaae5UL, 0xedfbfb16UL, 0x864343c5UL, 0x9a4d4dd7UL, 0x66333355UL, 0x11858594UL, 0x8a4545cfUL, 0xe9f9f910UL, 0x04020206UL, 0xfe7f7f81UL, 0xa05050f0UL, 0x783c3c44UL, 0x259f9fbaUL, 0x4ba8a8e3UL, 0xa25151f3UL, 0x5da3a3feUL, 0x804040c0UL, 0x058f8f8aUL, 0x3f9292adUL, 0x219d9dbcUL, 0x70383848UL, 0xf1f5f504UL, 0x63bcbcdfUL, 0x77b6b6c1UL, 0xafdada75UL, 0x42212163UL, 0x20101030UL, 0xe5ffff1aUL, 0xfdf3f30eUL, 0xbfd2d26dUL, 0x81cdcd4cUL, 0x180c0c14UL, 0x26131335UL, 0xc3ecec2fUL, 0xbe5f5fe1UL, 0x359797a2UL, 0x884444ccUL, 0x2e171739UL, 0x93c4c457UL, 0x55a7a7f2UL, 0xfc7e7e82UL, 0x7a3d3d47UL, 0xc86464acUL, 0xba5d5de7UL, 0x3219192bUL, 0xe6737395UL, 0xc06060a0UL, 0x19818198UL, 0x9e4f4fd1UL, 0xa3dcdc7fUL, 0x44222266UL, 0x542a2a7eUL, 0x3b9090abUL, 0x0b888883UL, 0x8c4646caUL, 0xc7eeee29UL, 0x6bb8b8d3UL, 0x2814143cUL, 0xa7dede79UL, 0xbc5e5ee2UL, 0x160b0b1dUL, 0xaddbdb76UL, 0xdbe0e03bUL, 0x64323256UL, 0x743a3a4eUL, 0x140a0a1eUL, 0x924949dbUL, 0x0c06060aUL, 0x4824246cUL, 0xb85c5ce4UL, 0x9fc2c25dUL, 0xbdd3d36eUL, 0x43acacefUL, 0xc46262a6UL, 0x399191a8UL, 0x319595a4UL, 0xd3e4e437UL, 0xf279798bUL, 0xd5e7e732UL, 0x8bc8c843UL, 0x6e373759UL, 0xda6d6db7UL, 0x018d8d8cUL, 0xb1d5d564UL, 0x9c4e4ed2UL, 0x49a9a9e0UL, 0xd86c6cb4UL, 0xac5656faUL, 0xf3f4f407UL, 0xcfeaea25UL, 0xca6565afUL, 0xf47a7a8eUL, 0x47aeaee9UL, 0x10080818UL, 0x6fbabad5UL, 0xf0787888UL, 0x4a25256fUL, 0x5c2e2e72UL, 0x381c1c24UL, 0x57a6a6f1UL, 0x73b4b4c7UL, 0x97c6c651UL, 0xcbe8e823UL, 0xa1dddd7cUL, 0xe874749cUL, 0x3e1f1f21UL, 0x964b4bddUL, 0x61bdbddcUL, 0x0d8b8b86UL, 0x0f8a8a85UL, 0xe0707090UL, 0x7c3e3e42UL, 0x71b5b5c4UL, 0xcc6666aaUL, 0x904848d8UL, 0x06030305UL, 0xf7f6f601UL, 0x1c0e0e12UL, 0xc26161a3UL, 0x6a35355fUL, 0xae5757f9UL, 0x69b9b9d0UL, 0x17868691UL, 0x99c1c158UL, 0x3a1d1d27UL, 0x279e9eb9UL, 0xd9e1e138UL, 0xebf8f813UL, 0x2b9898b3UL, 0x22111133UL, 0xd26969bbUL, 0xa9d9d970UL, 0x078e8e89UL, 0x339494a7UL, 0x2d9b9bb6UL, 0x3c1e1e22UL, 0x15878792UL, 0xc9e9e920UL, 0x87cece49UL, 0xaa5555ffUL, 0x50282878UL, 0xa5dfdf7aUL, 0x038c8c8fUL, 0x59a1a1f8UL, 0x09898980UL, 0x1a0d0d17UL, 0x65bfbfdaUL, 0xd7e6e631UL, 0x844242c6UL, 0xd06868b8UL, 0x824141c3UL, 0x299999b0UL, 0x5a2d2d77UL, 0x1e0f0f11UL, 0x7bb0b0cbUL, 0xa85454fcUL, 0x6dbbbbd6UL, 0x2c16163aUL }; static const SWord32 table2[] = { 0xa5c66363UL, 0x84f87c7cUL, 0x99ee7777UL, 0x8df67b7bUL, 0x0dfff2f2UL, 0xbdd66b6bUL, 0xb1de6f6fUL, 0x5491c5c5UL, 0x50603030UL, 0x03020101UL, 0xa9ce6767UL, 0x7d562b2bUL, 0x19e7fefeUL, 0x62b5d7d7UL, 0xe64dababUL, 0x9aec7676UL, 0x458fcacaUL, 0x9d1f8282UL, 0x4089c9c9UL, 0x87fa7d7dUL, 0x15effafaUL, 0xebb25959UL, 0xc98e4747UL, 0x0bfbf0f0UL, 0xec41adadUL, 0x67b3d4d4UL, 0xfd5fa2a2UL, 0xea45afafUL, 0xbf239c9cUL, 0xf753a4a4UL, 0x96e47272UL, 0x5b9bc0c0UL, 0xc275b7b7UL, 0x1ce1fdfdUL, 0xae3d9393UL, 0x6a4c2626UL, 0x5a6c3636UL, 0x417e3f3fUL, 0x02f5f7f7UL, 0x4f83ccccUL, 0x5c683434UL, 0xf451a5a5UL, 0x34d1e5e5UL, 0x08f9f1f1UL, 0x93e27171UL, 0x73abd8d8UL, 0x53623131UL, 0x3f2a1515UL, 0x0c080404UL, 0x5295c7c7UL, 0x65462323UL, 0x5e9dc3c3UL, 0x28301818UL, 0xa1379696UL, 0x0f0a0505UL, 0xb52f9a9aUL, 0x090e0707UL, 0x36241212UL, 0x9b1b8080UL, 0x3ddfe2e2UL, 0x26cdebebUL, 0x694e2727UL, 0xcd7fb2b2UL, 0x9fea7575UL, 0x1b120909UL, 0x9e1d8383UL, 0x74582c2cUL, 0x2e341a1aUL, 0x2d361b1bUL, 0xb2dc6e6eUL, 0xeeb45a5aUL, 0xfb5ba0a0UL, 0xf6a45252UL, 0x4d763b3bUL, 0x61b7d6d6UL, 0xce7db3b3UL, 0x7b522929UL, 0x3edde3e3UL, 0x715e2f2fUL, 0x97138484UL, 0xf5a65353UL, 0x68b9d1d1UL, 0x00000000UL, 0x2cc1ededUL, 0x60402020UL, 0x1fe3fcfcUL, 0xc879b1b1UL, 0xedb65b5bUL, 0xbed46a6aUL, 0x468dcbcbUL, 0xd967bebeUL, 0x4b723939UL, 0xde944a4aUL, 0xd4984c4cUL, 0xe8b05858UL, 0x4a85cfcfUL, 0x6bbbd0d0UL, 0x2ac5efefUL, 0xe54faaaaUL, 0x16edfbfbUL, 0xc5864343UL, 0xd79a4d4dUL, 0x55663333UL, 0x94118585UL, 0xcf8a4545UL, 0x10e9f9f9UL, 0x06040202UL, 0x81fe7f7fUL, 0xf0a05050UL, 0x44783c3cUL, 0xba259f9fUL, 0xe34ba8a8UL, 0xf3a25151UL, 0xfe5da3a3UL, 0xc0804040UL, 0x8a058f8fUL, 0xad3f9292UL, 0xbc219d9dUL, 0x48703838UL, 0x04f1f5f5UL, 0xdf63bcbcUL, 0xc177b6b6UL, 0x75afdadaUL, 0x63422121UL, 0x30201010UL, 0x1ae5ffffUL, 0x0efdf3f3UL, 0x6dbfd2d2UL, 0x4c81cdcdUL, 0x14180c0cUL, 0x35261313UL, 0x2fc3ececUL, 0xe1be5f5fUL, 0xa2359797UL, 0xcc884444UL, 0x392e1717UL, 0x5793c4c4UL, 0xf255a7a7UL, 0x82fc7e7eUL, 0x477a3d3dUL, 0xacc86464UL, 0xe7ba5d5dUL, 0x2b321919UL, 0x95e67373UL, 0xa0c06060UL, 0x98198181UL, 0xd19e4f4fUL, 0x7fa3dcdcUL, 0x66442222UL, 0x7e542a2aUL, 0xab3b9090UL, 0x830b8888UL, 0xca8c4646UL, 0x29c7eeeeUL, 0xd36bb8b8UL, 0x3c281414UL, 0x79a7dedeUL, 0xe2bc5e5eUL, 0x1d160b0bUL, 0x76addbdbUL, 0x3bdbe0e0UL, 0x56643232UL, 0x4e743a3aUL, 0x1e140a0aUL, 0xdb924949UL, 0x0a0c0606UL, 0x6c482424UL, 0xe4b85c5cUL, 0x5d9fc2c2UL, 0x6ebdd3d3UL, 0xef43acacUL, 0xa6c46262UL, 0xa8399191UL, 0xa4319595UL, 0x37d3e4e4UL, 0x8bf27979UL, 0x32d5e7e7UL, 0x438bc8c8UL, 0x596e3737UL, 0xb7da6d6dUL, 0x8c018d8dUL, 0x64b1d5d5UL, 0xd29c4e4eUL, 0xe049a9a9UL, 0xb4d86c6cUL, 0xfaac5656UL, 0x07f3f4f4UL, 0x25cfeaeaUL, 0xafca6565UL, 0x8ef47a7aUL, 0xe947aeaeUL, 0x18100808UL, 0xd56fbabaUL, 0x88f07878UL, 0x6f4a2525UL, 0x725c2e2eUL, 0x24381c1cUL, 0xf157a6a6UL, 0xc773b4b4UL, 0x5197c6c6UL, 0x23cbe8e8UL, 0x7ca1ddddUL, 0x9ce87474UL, 0x213e1f1fUL, 0xdd964b4bUL, 0xdc61bdbdUL, 0x860d8b8bUL, 0x850f8a8aUL, 0x90e07070UL, 0x427c3e3eUL, 0xc471b5b5UL, 0xaacc6666UL, 0xd8904848UL, 0x05060303UL, 0x01f7f6f6UL, 0x121c0e0eUL, 0xa3c26161UL, 0x5f6a3535UL, 0xf9ae5757UL, 0xd069b9b9UL, 0x91178686UL, 0x5899c1c1UL, 0x273a1d1dUL, 0xb9279e9eUL, 0x38d9e1e1UL, 0x13ebf8f8UL, 0xb32b9898UL, 0x33221111UL, 0xbbd26969UL, 0x70a9d9d9UL, 0x89078e8eUL, 0xa7339494UL, 0xb62d9b9bUL, 0x223c1e1eUL, 0x92158787UL, 0x20c9e9e9UL, 0x4987ceceUL, 0xffaa5555UL, 0x78502828UL, 0x7aa5dfdfUL, 0x8f038c8cUL, 0xf859a1a1UL, 0x80098989UL, 0x171a0d0dUL, 0xda65bfbfUL, 0x31d7e6e6UL, 0xc6844242UL, 0xb8d06868UL, 0xc3824141UL, 0xb0299999UL, 0x775a2d2dUL, 0x111e0f0fUL, 0xcb7bb0b0UL, 0xfca85454UL, 0xd66dbbbbUL, 0x3a2c1616UL }; static const SWord32 table3[] = { 0x63a5c663UL, 0x7c84f87cUL, 0x7799ee77UL, 0x7b8df67bUL, 0xf20dfff2UL, 0x6bbdd66bUL, 0x6fb1de6fUL, 0xc55491c5UL, 0x30506030UL, 0x01030201UL, 0x67a9ce67UL, 0x2b7d562bUL, 0xfe19e7feUL, 0xd762b5d7UL, 0xabe64dabUL, 0x769aec76UL, 0xca458fcaUL, 0x829d1f82UL, 0xc94089c9UL, 0x7d87fa7dUL, 0xfa15effaUL, 0x59ebb259UL, 0x47c98e47UL, 0xf00bfbf0UL, 0xadec41adUL, 0xd467b3d4UL, 0xa2fd5fa2UL, 0xafea45afUL, 0x9cbf239cUL, 0xa4f753a4UL, 0x7296e472UL, 0xc05b9bc0UL, 0xb7c275b7UL, 0xfd1ce1fdUL, 0x93ae3d93UL, 0x266a4c26UL, 0x365a6c36UL, 0x3f417e3fUL, 0xf702f5f7UL, 0xcc4f83ccUL, 0x345c6834UL, 0xa5f451a5UL, 0xe534d1e5UL, 0xf108f9f1UL, 0x7193e271UL, 0xd873abd8UL, 0x31536231UL, 0x153f2a15UL, 0x040c0804UL, 0xc75295c7UL, 0x23654623UL, 0xc35e9dc3UL, 0x18283018UL, 0x96a13796UL, 0x050f0a05UL, 0x9ab52f9aUL, 0x07090e07UL, 0x12362412UL, 0x809b1b80UL, 0xe23ddfe2UL, 0xeb26cdebUL, 0x27694e27UL, 0xb2cd7fb2UL, 0x759fea75UL, 0x091b1209UL, 0x839e1d83UL, 0x2c74582cUL, 0x1a2e341aUL, 0x1b2d361bUL, 0x6eb2dc6eUL, 0x5aeeb45aUL, 0xa0fb5ba0UL, 0x52f6a452UL, 0x3b4d763bUL, 0xd661b7d6UL, 0xb3ce7db3UL, 0x297b5229UL, 0xe33edde3UL, 0x2f715e2fUL, 0x84971384UL, 0x53f5a653UL, 0xd168b9d1UL, 0x00000000UL, 0xed2cc1edUL, 0x20604020UL, 0xfc1fe3fcUL, 0xb1c879b1UL, 0x5bedb65bUL, 0x6abed46aUL, 0xcb468dcbUL, 0xbed967beUL, 0x394b7239UL, 0x4ade944aUL, 0x4cd4984cUL, 0x58e8b058UL, 0xcf4a85cfUL, 0xd06bbbd0UL, 0xef2ac5efUL, 0xaae54faaUL, 0xfb16edfbUL, 0x43c58643UL, 0x4dd79a4dUL, 0x33556633UL, 0x85941185UL, 0x45cf8a45UL, 0xf910e9f9UL, 0x02060402UL, 0x7f81fe7fUL, 0x50f0a050UL, 0x3c44783cUL, 0x9fba259fUL, 0xa8e34ba8UL, 0x51f3a251UL, 0xa3fe5da3UL, 0x40c08040UL, 0x8f8a058fUL, 0x92ad3f92UL, 0x9dbc219dUL, 0x38487038UL, 0xf504f1f5UL, 0xbcdf63bcUL, 0xb6c177b6UL, 0xda75afdaUL, 0x21634221UL, 0x10302010UL, 0xff1ae5ffUL, 0xf30efdf3UL, 0xd26dbfd2UL, 0xcd4c81cdUL, 0x0c14180cUL, 0x13352613UL, 0xec2fc3ecUL, 0x5fe1be5fUL, 0x97a23597UL, 0x44cc8844UL, 0x17392e17UL, 0xc45793c4UL, 0xa7f255a7UL, 0x7e82fc7eUL, 0x3d477a3dUL, 0x64acc864UL, 0x5de7ba5dUL, 0x192b3219UL, 0x7395e673UL, 0x60a0c060UL, 0x81981981UL, 0x4fd19e4fUL, 0xdc7fa3dcUL, 0x22664422UL, 0x2a7e542aUL, 0x90ab3b90UL, 0x88830b88UL, 0x46ca8c46UL, 0xee29c7eeUL, 0xb8d36bb8UL, 0x143c2814UL, 0xde79a7deUL, 0x5ee2bc5eUL, 0x0b1d160bUL, 0xdb76addbUL, 0xe03bdbe0UL, 0x32566432UL, 0x3a4e743aUL, 0x0a1e140aUL, 0x49db9249UL, 0x060a0c06UL, 0x246c4824UL, 0x5ce4b85cUL, 0xc25d9fc2UL, 0xd36ebdd3UL, 0xacef43acUL, 0x62a6c462UL, 0x91a83991UL, 0x95a43195UL, 0xe437d3e4UL, 0x798bf279UL, 0xe732d5e7UL, 0xc8438bc8UL, 0x37596e37UL, 0x6db7da6dUL, 0x8d8c018dUL, 0xd564b1d5UL, 0x4ed29c4eUL, 0xa9e049a9UL, 0x6cb4d86cUL, 0x56faac56UL, 0xf407f3f4UL, 0xea25cfeaUL, 0x65afca65UL, 0x7a8ef47aUL, 0xaee947aeUL, 0x08181008UL, 0xbad56fbaUL, 0x7888f078UL, 0x256f4a25UL, 0x2e725c2eUL, 0x1c24381cUL, 0xa6f157a6UL, 0xb4c773b4UL, 0xc65197c6UL, 0xe823cbe8UL, 0xdd7ca1ddUL, 0x749ce874UL, 0x1f213e1fUL, 0x4bdd964bUL, 0xbddc61bdUL, 0x8b860d8bUL, 0x8a850f8aUL, 0x7090e070UL, 0x3e427c3eUL, 0xb5c471b5UL, 0x66aacc66UL, 0x48d89048UL, 0x03050603UL, 0xf601f7f6UL, 0x0e121c0eUL, 0x61a3c261UL, 0x355f6a35UL, 0x57f9ae57UL, 0xb9d069b9UL, 0x86911786UL, 0xc15899c1UL, 0x1d273a1dUL, 0x9eb9279eUL, 0xe138d9e1UL, 0xf813ebf8UL, 0x98b32b98UL, 0x11332211UL, 0x69bbd269UL, 0xd970a9d9UL, 0x8e89078eUL, 0x94a73394UL, 0x9bb62d9bUL, 0x1e223c1eUL, 0x87921587UL, 0xe920c9e9UL, 0xce4987ceUL, 0x55ffaa55UL, 0x28785028UL, 0xdf7aa5dfUL, 0x8c8f038cUL, 0xa1f859a1UL, 0x89800989UL, 0x0d171a0dUL, 0xbfda65bfUL, 0xe631d7e6UL, 0x42c68442UL, 0x68b8d068UL, 0x41c38241UL, 0x99b02999UL, 0x2d775a2dUL, 0x0f111e0fUL, 0xb0cb7bb0UL, 0x54fca854UL, 0xbbd66dbbUL, 0x163a2c16UL }; static const SWord32 table4[] = { 0x6363a5c6UL, 0x7c7c84f8UL, 0x777799eeUL, 0x7b7b8df6UL, 0xf2f20dffUL, 0x6b6bbdd6UL, 0x6f6fb1deUL, 0xc5c55491UL, 0x30305060UL, 0x01010302UL, 0x6767a9ceUL, 0x2b2b7d56UL, 0xfefe19e7UL, 0xd7d762b5UL, 0xababe64dUL, 0x76769aecUL, 0xcaca458fUL, 0x82829d1fUL, 0xc9c94089UL, 0x7d7d87faUL, 0xfafa15efUL, 0x5959ebb2UL, 0x4747c98eUL, 0xf0f00bfbUL, 0xadadec41UL, 0xd4d467b3UL, 0xa2a2fd5fUL, 0xafafea45UL, 0x9c9cbf23UL, 0xa4a4f753UL, 0x727296e4UL, 0xc0c05b9bUL, 0xb7b7c275UL, 0xfdfd1ce1UL, 0x9393ae3dUL, 0x26266a4cUL, 0x36365a6cUL, 0x3f3f417eUL, 0xf7f702f5UL, 0xcccc4f83UL, 0x34345c68UL, 0xa5a5f451UL, 0xe5e534d1UL, 0xf1f108f9UL, 0x717193e2UL, 0xd8d873abUL, 0x31315362UL, 0x15153f2aUL, 0x04040c08UL, 0xc7c75295UL, 0x23236546UL, 0xc3c35e9dUL, 0x18182830UL, 0x9696a137UL, 0x05050f0aUL, 0x9a9ab52fUL, 0x0707090eUL, 0x12123624UL, 0x80809b1bUL, 0xe2e23ddfUL, 0xebeb26cdUL, 0x2727694eUL, 0xb2b2cd7fUL, 0x75759feaUL, 0x09091b12UL, 0x83839e1dUL, 0x2c2c7458UL, 0x1a1a2e34UL, 0x1b1b2d36UL, 0x6e6eb2dcUL, 0x5a5aeeb4UL, 0xa0a0fb5bUL, 0x5252f6a4UL, 0x3b3b4d76UL, 0xd6d661b7UL, 0xb3b3ce7dUL, 0x29297b52UL, 0xe3e33eddUL, 0x2f2f715eUL, 0x84849713UL, 0x5353f5a6UL, 0xd1d168b9UL, 0x00000000UL, 0xeded2cc1UL, 0x20206040UL, 0xfcfc1fe3UL, 0xb1b1c879UL, 0x5b5bedb6UL, 0x6a6abed4UL, 0xcbcb468dUL, 0xbebed967UL, 0x39394b72UL, 0x4a4ade94UL, 0x4c4cd498UL, 0x5858e8b0UL, 0xcfcf4a85UL, 0xd0d06bbbUL, 0xefef2ac5UL, 0xaaaae54fUL, 0xfbfb16edUL, 0x4343c586UL, 0x4d4dd79aUL, 0x33335566UL, 0x85859411UL, 0x4545cf8aUL, 0xf9f910e9UL, 0x02020604UL, 0x7f7f81feUL, 0x5050f0a0UL, 0x3c3c4478UL, 0x9f9fba25UL, 0xa8a8e34bUL, 0x5151f3a2UL, 0xa3a3fe5dUL, 0x4040c080UL, 0x8f8f8a05UL, 0x9292ad3fUL, 0x9d9dbc21UL, 0x38384870UL, 0xf5f504f1UL, 0xbcbcdf63UL, 0xb6b6c177UL, 0xdada75afUL, 0x21216342UL, 0x10103020UL, 0xffff1ae5UL, 0xf3f30efdUL, 0xd2d26dbfUL, 0xcdcd4c81UL, 0x0c0c1418UL, 0x13133526UL, 0xecec2fc3UL, 0x5f5fe1beUL, 0x9797a235UL, 0x4444cc88UL, 0x1717392eUL, 0xc4c45793UL, 0xa7a7f255UL, 0x7e7e82fcUL, 0x3d3d477aUL, 0x6464acc8UL, 0x5d5de7baUL, 0x19192b32UL, 0x737395e6UL, 0x6060a0c0UL, 0x81819819UL, 0x4f4fd19eUL, 0xdcdc7fa3UL, 0x22226644UL, 0x2a2a7e54UL, 0x9090ab3bUL, 0x8888830bUL, 0x4646ca8cUL, 0xeeee29c7UL, 0xb8b8d36bUL, 0x14143c28UL, 0xdede79a7UL, 0x5e5ee2bcUL, 0x0b0b1d16UL, 0xdbdb76adUL, 0xe0e03bdbUL, 0x32325664UL, 0x3a3a4e74UL, 0x0a0a1e14UL, 0x4949db92UL, 0x06060a0cUL, 0x24246c48UL, 0x5c5ce4b8UL, 0xc2c25d9fUL, 0xd3d36ebdUL, 0xacacef43UL, 0x6262a6c4UL, 0x9191a839UL, 0x9595a431UL, 0xe4e437d3UL, 0x79798bf2UL, 0xe7e732d5UL, 0xc8c8438bUL, 0x3737596eUL, 0x6d6db7daUL, 0x8d8d8c01UL, 0xd5d564b1UL, 0x4e4ed29cUL, 0xa9a9e049UL, 0x6c6cb4d8UL, 0x5656faacUL, 0xf4f407f3UL, 0xeaea25cfUL, 0x6565afcaUL, 0x7a7a8ef4UL, 0xaeaee947UL, 0x08081810UL, 0xbabad56fUL, 0x787888f0UL, 0x25256f4aUL, 0x2e2e725cUL, 0x1c1c2438UL, 0xa6a6f157UL, 0xb4b4c773UL, 0xc6c65197UL, 0xe8e823cbUL, 0xdddd7ca1UL, 0x74749ce8UL, 0x1f1f213eUL, 0x4b4bdd96UL, 0xbdbddc61UL, 0x8b8b860dUL, 0x8a8a850fUL, 0x707090e0UL, 0x3e3e427cUL, 0xb5b5c471UL, 0x6666aaccUL, 0x4848d890UL, 0x03030506UL, 0xf6f601f7UL, 0x0e0e121cUL, 0x6161a3c2UL, 0x35355f6aUL, 0x5757f9aeUL, 0xb9b9d069UL, 0x86869117UL, 0xc1c15899UL, 0x1d1d273aUL, 0x9e9eb927UL, 0xe1e138d9UL, 0xf8f813ebUL, 0x9898b32bUL, 0x11113322UL, 0x6969bbd2UL, 0xd9d970a9UL, 0x8e8e8907UL, 0x9494a733UL, 0x9b9bb62dUL, 0x1e1e223cUL, 0x87879215UL, 0xe9e920c9UL, 0xcece4987UL, 0x5555ffaaUL, 0x28287850UL, 0xdfdf7aa5UL, 0x8c8c8f03UL, 0xa1a1f859UL, 0x89898009UL, 0x0d0d171aUL, 0xbfbfda65UL, 0xe6e631d7UL, 0x4242c684UL, 0x6868b8d0UL, 0x4141c382UL, 0x9999b029UL, 0x2d2d775aUL, 0x0f0f111eUL, 0xb0b0cb7bUL, 0x5454fca8UL, 0xbbbbd66dUL, 0x16163a2cUL }; const SWord32 s560 = s0 ^ s4; const SWord16 s561 = (SWord16) (s560 >> 16); const SWord8 s562 = (SWord8) (s561 >> 8); const SWord32 s563 = table1[s562]; const SWord32 s819 = s1 ^ s5; const SWord16 s820 = (SWord16) (s819 >> 16); const SWord8 s821 = (SWord8) s820; const SWord32 s822 = table2[s821]; const SWord32 s823 = s563 ^ s822; const SWord32 s1079 = s2 ^ s6; const SWord16 s1080 = (SWord16) s1079; const SWord8 s1081 = (SWord8) (s1080 >> 8); const SWord32 s1082 = table3[s1081]; const SWord32 s1083 = s823 ^ s1082; const SWord32 s1339 = s3 ^ s7; const SWord16 s1340 = (SWord16) s1339; const SWord8 s1341 = (SWord8) s1340; const SWord32 s1342 = table4[s1341]; const SWord32 s1343 = s1083 ^ s1342; const SWord32 s1344 = s8 ^ s1343; const SWord16 s1345 = (SWord16) (s1344 >> 16); const SWord8 s1346 = (SWord8) (s1345 >> 8); const SWord32 s1347 = table1[s1346]; const SWord8 s1348 = (SWord8) (s820 >> 8); const SWord32 s1349 = table1[s1348]; const SWord16 s1350 = (SWord16) (s1079 >> 16); const SWord8 s1351 = (SWord8) s1350; const SWord32 s1352 = table2[s1351]; const SWord32 s1353 = s1349 ^ s1352; const SWord8 s1354 = (SWord8) (s1340 >> 8); const SWord32 s1355 = table3[s1354]; const SWord32 s1356 = s1353 ^ s1355; const SWord16 s1357 = (SWord16) s560; const SWord8 s1358 = (SWord8) s1357; const SWord32 s1359 = table4[s1358]; const SWord32 s1360 = s1356 ^ s1359; const SWord32 s1361 = s9 ^ s1360; const SWord16 s1362 = (SWord16) (s1361 >> 16); const SWord8 s1363 = (SWord8) s1362; const SWord32 s1364 = table2[s1363]; const SWord32 s1365 = s1347 ^ s1364; const SWord8 s1366 = (SWord8) (s1350 >> 8); const SWord32 s1367 = table1[s1366]; const SWord16 s1368 = (SWord16) (s1339 >> 16); const SWord8 s1369 = (SWord8) s1368; const SWord32 s1370 = table2[s1369]; const SWord32 s1371 = s1367 ^ s1370; const SWord8 s1372 = (SWord8) (s1357 >> 8); const SWord32 s1373 = table3[s1372]; const SWord32 s1374 = s1371 ^ s1373; const SWord16 s1375 = (SWord16) s819; const SWord8 s1376 = (SWord8) s1375; const SWord32 s1377 = table4[s1376]; const SWord32 s1378 = s1374 ^ s1377; const SWord32 s1379 = s10 ^ s1378; const SWord16 s1380 = (SWord16) s1379; const SWord8 s1381 = (SWord8) (s1380 >> 8); const SWord32 s1382 = table3[s1381]; const SWord32 s1383 = s1365 ^ s1382; const SWord8 s1384 = (SWord8) (s1368 >> 8); const SWord32 s1385 = table1[s1384]; const SWord8 s1386 = (SWord8) s561; const SWord32 s1387 = table2[s1386]; const SWord32 s1388 = s1385 ^ s1387; const SWord8 s1389 = (SWord8) (s1375 >> 8); const SWord32 s1390 = table3[s1389]; const SWord32 s1391 = s1388 ^ s1390; const SWord8 s1392 = (SWord8) s1080; const SWord32 s1393 = table4[s1392]; const SWord32 s1394 = s1391 ^ s1393; const SWord32 s1395 = s11 ^ s1394; const SWord16 s1396 = (SWord16) s1395; const SWord8 s1397 = (SWord8) s1396; const SWord32 s1398 = table4[s1397]; const SWord32 s1399 = s1383 ^ s1398; const SWord32 s1400 = s12 ^ s1399; const SWord16 s1401 = (SWord16) (s1400 >> 16); const SWord8 s1402 = (SWord8) (s1401 >> 8); const SWord32 s1403 = table1[s1402]; const SWord8 s1404 = (SWord8) (s1362 >> 8); const SWord32 s1405 = table1[s1404]; const SWord16 s1406 = (SWord16) (s1379 >> 16); const SWord8 s1407 = (SWord8) s1406; const SWord32 s1408 = table2[s1407]; const SWord32 s1409 = s1405 ^ s1408; const SWord8 s1410 = (SWord8) (s1396 >> 8); const SWord32 s1411 = table3[s1410]; const SWord32 s1412 = s1409 ^ s1411; const SWord16 s1413 = (SWord16) s1344; const SWord8 s1414 = (SWord8) s1413; const SWord32 s1415 = table4[s1414]; const SWord32 s1416 = s1412 ^ s1415; const SWord32 s1417 = s13 ^ s1416; const SWord16 s1418 = (SWord16) (s1417 >> 16); const SWord8 s1419 = (SWord8) s1418; const SWord32 s1420 = table2[s1419]; const SWord32 s1421 = s1403 ^ s1420; const SWord8 s1422 = (SWord8) (s1406 >> 8); const SWord32 s1423 = table1[s1422]; const SWord16 s1424 = (SWord16) (s1395 >> 16); const SWord8 s1425 = (SWord8) s1424; const SWord32 s1426 = table2[s1425]; const SWord32 s1427 = s1423 ^ s1426; const SWord8 s1428 = (SWord8) (s1413 >> 8); const SWord32 s1429 = table3[s1428]; const SWord32 s1430 = s1427 ^ s1429; const SWord16 s1431 = (SWord16) s1361; const SWord8 s1432 = (SWord8) s1431; const SWord32 s1433 = table4[s1432]; const SWord32 s1434 = s1430 ^ s1433; const SWord32 s1435 = s14 ^ s1434; const SWord16 s1436 = (SWord16) s1435; const SWord8 s1437 = (SWord8) (s1436 >> 8); const SWord32 s1438 = table3[s1437]; const SWord32 s1439 = s1421 ^ s1438; const SWord8 s1440 = (SWord8) (s1424 >> 8); const SWord32 s1441 = table1[s1440]; const SWord8 s1442 = (SWord8) s1345; const SWord32 s1443 = table2[s1442]; const SWord32 s1444 = s1441 ^ s1443; const SWord8 s1445 = (SWord8) (s1431 >> 8); const SWord32 s1446 = table3[s1445]; const SWord32 s1447 = s1444 ^ s1446; const SWord8 s1448 = (SWord8) s1380; const SWord32 s1449 = table4[s1448]; const SWord32 s1450 = s1447 ^ s1449; const SWord32 s1451 = s15 ^ s1450; const SWord16 s1452 = (SWord16) s1451; const SWord8 s1453 = (SWord8) s1452; const SWord32 s1454 = table4[s1453]; const SWord32 s1455 = s1439 ^ s1454; const SWord32 s1456 = s16 ^ s1455; const SWord16 s1457 = (SWord16) (s1456 >> 16); const SWord8 s1458 = (SWord8) (s1457 >> 8); const SWord32 s1459 = table1[s1458]; const SWord8 s1460 = (SWord8) (s1418 >> 8); const SWord32 s1461 = table1[s1460]; const SWord16 s1462 = (SWord16) (s1435 >> 16); const SWord8 s1463 = (SWord8) s1462; const SWord32 s1464 = table2[s1463]; const SWord32 s1465 = s1461 ^ s1464; const SWord8 s1466 = (SWord8) (s1452 >> 8); const SWord32 s1467 = table3[s1466]; const SWord32 s1468 = s1465 ^ s1467; const SWord16 s1469 = (SWord16) s1400; const SWord8 s1470 = (SWord8) s1469; const SWord32 s1471 = table4[s1470]; const SWord32 s1472 = s1468 ^ s1471; const SWord32 s1473 = s17 ^ s1472; const SWord16 s1474 = (SWord16) (s1473 >> 16); const SWord8 s1475 = (SWord8) s1474; const SWord32 s1476 = table2[s1475]; const SWord32 s1477 = s1459 ^ s1476; const SWord8 s1478 = (SWord8) (s1462 >> 8); const SWord32 s1479 = table1[s1478]; const SWord16 s1480 = (SWord16) (s1451 >> 16); const SWord8 s1481 = (SWord8) s1480; const SWord32 s1482 = table2[s1481]; const SWord32 s1483 = s1479 ^ s1482; const SWord8 s1484 = (SWord8) (s1469 >> 8); const SWord32 s1485 = table3[s1484]; const SWord32 s1486 = s1483 ^ s1485; const SWord16 s1487 = (SWord16) s1417; const SWord8 s1488 = (SWord8) s1487; const SWord32 s1489 = table4[s1488]; const SWord32 s1490 = s1486 ^ s1489; const SWord32 s1491 = s18 ^ s1490; const SWord16 s1492 = (SWord16) s1491; const SWord8 s1493 = (SWord8) (s1492 >> 8); const SWord32 s1494 = table3[s1493]; const SWord32 s1495 = s1477 ^ s1494; const SWord8 s1496 = (SWord8) (s1480 >> 8); const SWord32 s1497 = table1[s1496]; const SWord8 s1498 = (SWord8) s1401; const SWord32 s1499 = table2[s1498]; const SWord32 s1500 = s1497 ^ s1499; const SWord8 s1501 = (SWord8) (s1487 >> 8); const SWord32 s1502 = table3[s1501]; const SWord32 s1503 = s1500 ^ s1502; const SWord8 s1504 = (SWord8) s1436; const SWord32 s1505 = table4[s1504]; const SWord32 s1506 = s1503 ^ s1505; const SWord32 s1507 = s19 ^ s1506; const SWord16 s1508 = (SWord16) s1507; const SWord8 s1509 = (SWord8) s1508; const SWord32 s1510 = table4[s1509]; const SWord32 s1511 = s1495 ^ s1510; const SWord32 s1512 = s20 ^ s1511; const SWord16 s1513 = (SWord16) (s1512 >> 16); const SWord8 s1514 = (SWord8) (s1513 >> 8); const SWord32 s1515 = table1[s1514]; const SWord8 s1516 = (SWord8) (s1474 >> 8); const SWord32 s1517 = table1[s1516]; const SWord16 s1518 = (SWord16) (s1491 >> 16); const SWord8 s1519 = (SWord8) s1518; const SWord32 s1520 = table2[s1519]; const SWord32 s1521 = s1517 ^ s1520; const SWord8 s1522 = (SWord8) (s1508 >> 8); const SWord32 s1523 = table3[s1522]; const SWord32 s1524 = s1521 ^ s1523; const SWord16 s1525 = (SWord16) s1456; const SWord8 s1526 = (SWord8) s1525; const SWord32 s1527 = table4[s1526]; const SWord32 s1528 = s1524 ^ s1527; const SWord32 s1529 = s21 ^ s1528; const SWord16 s1530 = (SWord16) (s1529 >> 16); const SWord8 s1531 = (SWord8) s1530; const SWord32 s1532 = table2[s1531]; const SWord32 s1533 = s1515 ^ s1532; const SWord8 s1534 = (SWord8) (s1518 >> 8); const SWord32 s1535 = table1[s1534]; const SWord16 s1536 = (SWord16) (s1507 >> 16); const SWord8 s1537 = (SWord8) s1536; const SWord32 s1538 = table2[s1537]; const SWord32 s1539 = s1535 ^ s1538; const SWord8 s1540 = (SWord8) (s1525 >> 8); const SWord32 s1541 = table3[s1540]; const SWord32 s1542 = s1539 ^ s1541; const SWord16 s1543 = (SWord16) s1473; const SWord8 s1544 = (SWord8) s1543; const SWord32 s1545 = table4[s1544]; const SWord32 s1546 = s1542 ^ s1545; const SWord32 s1547 = s22 ^ s1546; const SWord16 s1548 = (SWord16) s1547; const SWord8 s1549 = (SWord8) (s1548 >> 8); const SWord32 s1550 = table3[s1549]; const SWord32 s1551 = s1533 ^ s1550; const SWord8 s1552 = (SWord8) (s1536 >> 8); const SWord32 s1553 = table1[s1552]; const SWord8 s1554 = (SWord8) s1457; const SWord32 s1555 = table2[s1554]; const SWord32 s1556 = s1553 ^ s1555; const SWord8 s1557 = (SWord8) (s1543 >> 8); const SWord32 s1558 = table3[s1557]; const SWord32 s1559 = s1556 ^ s1558; const SWord8 s1560 = (SWord8) s1492; const SWord32 s1561 = table4[s1560]; const SWord32 s1562 = s1559 ^ s1561; const SWord32 s1563 = s23 ^ s1562; const SWord16 s1564 = (SWord16) s1563; const SWord8 s1565 = (SWord8) s1564; const SWord32 s1566 = table4[s1565]; const SWord32 s1567 = s1551 ^ s1566; const SWord32 s1568 = s24 ^ s1567; const SWord16 s1569 = (SWord16) (s1568 >> 16); const SWord8 s1570 = (SWord8) (s1569 >> 8); const SWord32 s1571 = table1[s1570]; const SWord8 s1572 = (SWord8) (s1530 >> 8); const SWord32 s1573 = table1[s1572]; const SWord16 s1574 = (SWord16) (s1547 >> 16); const SWord8 s1575 = (SWord8) s1574; const SWord32 s1576 = table2[s1575]; const SWord32 s1577 = s1573 ^ s1576; const SWord8 s1578 = (SWord8) (s1564 >> 8); const SWord32 s1579 = table3[s1578]; const SWord32 s1580 = s1577 ^ s1579; const SWord16 s1581 = (SWord16) s1512; const SWord8 s1582 = (SWord8) s1581; const SWord32 s1583 = table4[s1582]; const SWord32 s1584 = s1580 ^ s1583; const SWord32 s1585 = s25 ^ s1584; const SWord16 s1586 = (SWord16) (s1585 >> 16); const SWord8 s1587 = (SWord8) s1586; const SWord32 s1588 = table2[s1587]; const SWord32 s1589 = s1571 ^ s1588; const SWord8 s1590 = (SWord8) (s1574 >> 8); const SWord32 s1591 = table1[s1590]; const SWord16 s1592 = (SWord16) (s1563 >> 16); const SWord8 s1593 = (SWord8) s1592; const SWord32 s1594 = table2[s1593]; const SWord32 s1595 = s1591 ^ s1594; const SWord8 s1596 = (SWord8) (s1581 >> 8); const SWord32 s1597 = table3[s1596]; const SWord32 s1598 = s1595 ^ s1597; const SWord16 s1599 = (SWord16) s1529; const SWord8 s1600 = (SWord8) s1599; const SWord32 s1601 = table4[s1600]; const SWord32 s1602 = s1598 ^ s1601; const SWord32 s1603 = s26 ^ s1602; const SWord16 s1604 = (SWord16) s1603; const SWord8 s1605 = (SWord8) (s1604 >> 8); const SWord32 s1606 = table3[s1605]; const SWord32 s1607 = s1589 ^ s1606; const SWord8 s1608 = (SWord8) (s1592 >> 8); const SWord32 s1609 = table1[s1608]; const SWord8 s1610 = (SWord8) s1513; const SWord32 s1611 = table2[s1610]; const SWord32 s1612 = s1609 ^ s1611; const SWord8 s1613 = (SWord8) (s1599 >> 8); const SWord32 s1614 = table3[s1613]; const SWord32 s1615 = s1612 ^ s1614; const SWord8 s1616 = (SWord8) s1548; const SWord32 s1617 = table4[s1616]; const SWord32 s1618 = s1615 ^ s1617; const SWord32 s1619 = s27 ^ s1618; const SWord16 s1620 = (SWord16) s1619; const SWord8 s1621 = (SWord8) s1620; const SWord32 s1622 = table4[s1621]; const SWord32 s1623 = s1607 ^ s1622; const SWord32 s1624 = s28 ^ s1623; const SWord16 s1625 = (SWord16) (s1624 >> 16); const SWord8 s1626 = (SWord8) (s1625 >> 8); const SWord32 s1627 = table1[s1626]; const SWord8 s1628 = (SWord8) (s1586 >> 8); const SWord32 s1629 = table1[s1628]; const SWord16 s1630 = (SWord16) (s1603 >> 16); const SWord8 s1631 = (SWord8) s1630; const SWord32 s1632 = table2[s1631]; const SWord32 s1633 = s1629 ^ s1632; const SWord8 s1634 = (SWord8) (s1620 >> 8); const SWord32 s1635 = table3[s1634]; const SWord32 s1636 = s1633 ^ s1635; const SWord16 s1637 = (SWord16) s1568; const SWord8 s1638 = (SWord8) s1637; const SWord32 s1639 = table4[s1638]; const SWord32 s1640 = s1636 ^ s1639; const SWord32 s1641 = s29 ^ s1640; const SWord16 s1642 = (SWord16) (s1641 >> 16); const SWord8 s1643 = (SWord8) s1642; const SWord32 s1644 = table2[s1643]; const SWord32 s1645 = s1627 ^ s1644; const SWord8 s1646 = (SWord8) (s1630 >> 8); const SWord32 s1647 = table1[s1646]; const SWord16 s1648 = (SWord16) (s1619 >> 16); const SWord8 s1649 = (SWord8) s1648; const SWord32 s1650 = table2[s1649]; const SWord32 s1651 = s1647 ^ s1650; const SWord8 s1652 = (SWord8) (s1637 >> 8); const SWord32 s1653 = table3[s1652]; const SWord32 s1654 = s1651 ^ s1653; const SWord16 s1655 = (SWord16) s1585; const SWord8 s1656 = (SWord8) s1655; const SWord32 s1657 = table4[s1656]; const SWord32 s1658 = s1654 ^ s1657; const SWord32 s1659 = s30 ^ s1658; const SWord16 s1660 = (SWord16) s1659; const SWord8 s1661 = (SWord8) (s1660 >> 8); const SWord32 s1662 = table3[s1661]; const SWord32 s1663 = s1645 ^ s1662; const SWord8 s1664 = (SWord8) (s1648 >> 8); const SWord32 s1665 = table1[s1664]; const SWord8 s1666 = (SWord8) s1569; const SWord32 s1667 = table2[s1666]; const SWord32 s1668 = s1665 ^ s1667; const SWord8 s1669 = (SWord8) (s1655 >> 8); const SWord32 s1670 = table3[s1669]; const SWord32 s1671 = s1668 ^ s1670; const SWord8 s1672 = (SWord8) s1604; const SWord32 s1673 = table4[s1672]; const SWord32 s1674 = s1671 ^ s1673; const SWord32 s1675 = s31 ^ s1674; const SWord16 s1676 = (SWord16) s1675; const SWord8 s1677 = (SWord8) s1676; const SWord32 s1678 = table4[s1677]; const SWord32 s1679 = s1663 ^ s1678; const SWord32 s1680 = s32 ^ s1679; const SWord16 s1681 = (SWord16) (s1680 >> 16); const SWord8 s1682 = (SWord8) (s1681 >> 8); const SWord32 s1683 = table1[s1682]; const SWord8 s1684 = (SWord8) (s1642 >> 8); const SWord32 s1685 = table1[s1684]; const SWord16 s1686 = (SWord16) (s1659 >> 16); const SWord8 s1687 = (SWord8) s1686; const SWord32 s1688 = table2[s1687]; const SWord32 s1689 = s1685 ^ s1688; const SWord8 s1690 = (SWord8) (s1676 >> 8); const SWord32 s1691 = table3[s1690]; const SWord32 s1692 = s1689 ^ s1691; const SWord16 s1693 = (SWord16) s1624; const SWord8 s1694 = (SWord8) s1693; const SWord32 s1695 = table4[s1694]; const SWord32 s1696 = s1692 ^ s1695; const SWord32 s1697 = s33 ^ s1696; const SWord16 s1698 = (SWord16) (s1697 >> 16); const SWord8 s1699 = (SWord8) s1698; const SWord32 s1700 = table2[s1699]; const SWord32 s1701 = s1683 ^ s1700; const SWord8 s1702 = (SWord8) (s1686 >> 8); const SWord32 s1703 = table1[s1702]; const SWord16 s1704 = (SWord16) (s1675 >> 16); const SWord8 s1705 = (SWord8) s1704; const SWord32 s1706 = table2[s1705]; const SWord32 s1707 = s1703 ^ s1706; const SWord8 s1708 = (SWord8) (s1693 >> 8); const SWord32 s1709 = table3[s1708]; const SWord32 s1710 = s1707 ^ s1709; const SWord16 s1711 = (SWord16) s1641; const SWord8 s1712 = (SWord8) s1711; const SWord32 s1713 = table4[s1712]; const SWord32 s1714 = s1710 ^ s1713; const SWord32 s1715 = s34 ^ s1714; const SWord16 s1716 = (SWord16) s1715; const SWord8 s1717 = (SWord8) (s1716 >> 8); const SWord32 s1718 = table3[s1717]; const SWord32 s1719 = s1701 ^ s1718; const SWord8 s1720 = (SWord8) (s1704 >> 8); const SWord32 s1721 = table1[s1720]; const SWord8 s1722 = (SWord8) s1625; const SWord32 s1723 = table2[s1722]; const SWord32 s1724 = s1721 ^ s1723; const SWord8 s1725 = (SWord8) (s1711 >> 8); const SWord32 s1726 = table3[s1725]; const SWord32 s1727 = s1724 ^ s1726; const SWord8 s1728 = (SWord8) s1660; const SWord32 s1729 = table4[s1728]; const SWord32 s1730 = s1727 ^ s1729; const SWord32 s1731 = s35 ^ s1730; const SWord16 s1732 = (SWord16) s1731; const SWord8 s1733 = (SWord8) s1732; const SWord32 s1734 = table4[s1733]; const SWord32 s1735 = s1719 ^ s1734; const SWord32 s1736 = s36 ^ s1735; const SWord16 s1737 = (SWord16) (s1736 >> 16); const SWord8 s1738 = (SWord8) (s1737 >> 8); const SWord32 s1739 = table1[s1738]; const SWord8 s1740 = (SWord8) (s1698 >> 8); const SWord32 s1741 = table1[s1740]; const SWord16 s1742 = (SWord16) (s1715 >> 16); const SWord8 s1743 = (SWord8) s1742; const SWord32 s1744 = table2[s1743]; const SWord32 s1745 = s1741 ^ s1744; const SWord8 s1746 = (SWord8) (s1732 >> 8); const SWord32 s1747 = table3[s1746]; const SWord32 s1748 = s1745 ^ s1747; const SWord16 s1749 = (SWord16) s1680; const SWord8 s1750 = (SWord8) s1749; const SWord32 s1751 = table4[s1750]; const SWord32 s1752 = s1748 ^ s1751; const SWord32 s1753 = s37 ^ s1752; const SWord16 s1754 = (SWord16) (s1753 >> 16); const SWord8 s1755 = (SWord8) s1754; const SWord32 s1756 = table2[s1755]; const SWord32 s1757 = s1739 ^ s1756; const SWord8 s1758 = (SWord8) (s1742 >> 8); const SWord32 s1759 = table1[s1758]; const SWord16 s1760 = (SWord16) (s1731 >> 16); const SWord8 s1761 = (SWord8) s1760; const SWord32 s1762 = table2[s1761]; const SWord32 s1763 = s1759 ^ s1762; const SWord8 s1764 = (SWord8) (s1749 >> 8); const SWord32 s1765 = table3[s1764]; const SWord32 s1766 = s1763 ^ s1765; const SWord16 s1767 = (SWord16) s1697; const SWord8 s1768 = (SWord8) s1767; const SWord32 s1769 = table4[s1768]; const SWord32 s1770 = s1766 ^ s1769; const SWord32 s1771 = s38 ^ s1770; const SWord16 s1772 = (SWord16) s1771; const SWord8 s1773 = (SWord8) (s1772 >> 8); const SWord32 s1774 = table3[s1773]; const SWord32 s1775 = s1757 ^ s1774; const SWord8 s1776 = (SWord8) (s1760 >> 8); const SWord32 s1777 = table1[s1776]; const SWord8 s1778 = (SWord8) s1681; const SWord32 s1779 = table2[s1778]; const SWord32 s1780 = s1777 ^ s1779; const SWord8 s1781 = (SWord8) (s1767 >> 8); const SWord32 s1782 = table3[s1781]; const SWord32 s1783 = s1780 ^ s1782; const SWord8 s1784 = (SWord8) s1716; const SWord32 s1785 = table4[s1784]; const SWord32 s1786 = s1783 ^ s1785; const SWord32 s1787 = s39 ^ s1786; const SWord16 s1788 = (SWord16) s1787; const SWord8 s1789 = (SWord8) s1788; const SWord32 s1790 = table4[s1789]; const SWord32 s1791 = s1775 ^ s1790; const SWord32 s1792 = s40 ^ s1791; const SWord16 s1793 = (SWord16) (s1792 >> 16); const SWord8 s1794 = (SWord8) (s1793 >> 8); const SWord8 s1795 = table0[s1794]; const SWord8 s1796 = (SWord8) (s1754 >> 8); const SWord32 s1797 = table1[s1796]; const SWord16 s1798 = (SWord16) (s1771 >> 16); const SWord8 s1799 = (SWord8) s1798; const SWord32 s1800 = table2[s1799]; const SWord32 s1801 = s1797 ^ s1800; const SWord8 s1802 = (SWord8) (s1788 >> 8); const SWord32 s1803 = table3[s1802]; const SWord32 s1804 = s1801 ^ s1803; const SWord16 s1805 = (SWord16) s1736; const SWord8 s1806 = (SWord8) s1805; const SWord32 s1807 = table4[s1806]; const SWord32 s1808 = s1804 ^ s1807; const SWord32 s1809 = s41 ^ s1808; const SWord16 s1810 = (SWord16) (s1809 >> 16); const SWord8 s1811 = (SWord8) s1810; const SWord8 s1812 = table0[s1811]; const SWord16 s1813 = (((SWord16) s1795) << 8) | ((SWord16) s1812); const SWord8 s1814 = (SWord8) (s1798 >> 8); const SWord32 s1815 = table1[s1814]; const SWord16 s1816 = (SWord16) (s1787 >> 16); const SWord8 s1817 = (SWord8) s1816; const SWord32 s1818 = table2[s1817]; const SWord32 s1819 = s1815 ^ s1818; const SWord8 s1820 = (SWord8) (s1805 >> 8); const SWord32 s1821 = table3[s1820]; const SWord32 s1822 = s1819 ^ s1821; const SWord16 s1823 = (SWord16) s1753; const SWord8 s1824 = (SWord8) s1823; const SWord32 s1825 = table4[s1824]; const SWord32 s1826 = s1822 ^ s1825; const SWord32 s1827 = s42 ^ s1826; const SWord16 s1828 = (SWord16) s1827; const SWord8 s1829 = (SWord8) (s1828 >> 8); const SWord8 s1830 = table0[s1829]; const SWord8 s1831 = (SWord8) (s1816 >> 8); const SWord32 s1832 = table1[s1831]; const SWord8 s1833 = (SWord8) s1737; const SWord32 s1834 = table2[s1833]; const SWord32 s1835 = s1832 ^ s1834; const SWord8 s1836 = (SWord8) (s1823 >> 8); const SWord32 s1837 = table3[s1836]; const SWord32 s1838 = s1835 ^ s1837; const SWord8 s1839 = (SWord8) s1772; const SWord32 s1840 = table4[s1839]; const SWord32 s1841 = s1838 ^ s1840; const SWord32 s1842 = s43 ^ s1841; const SWord16 s1843 = (SWord16) s1842; const SWord8 s1844 = (SWord8) s1843; const SWord8 s1845 = table0[s1844]; const SWord16 s1846 = (((SWord16) s1830) << 8) | ((SWord16) s1845); const SWord32 s1847 = (((SWord32) s1813) << 16) | ((SWord32) s1846); const SWord32 s1848 = s44 ^ s1847; const SWord8 s1849 = (SWord8) (s1810 >> 8); const SWord8 s1850 = table0[s1849]; const SWord16 s1851 = (SWord16) (s1827 >> 16); const SWord8 s1852 = (SWord8) s1851; const SWord8 s1853 = table0[s1852]; const SWord16 s1854 = (((SWord16) s1850) << 8) | ((SWord16) s1853); const SWord8 s1855 = (SWord8) (s1843 >> 8); const SWord8 s1856 = table0[s1855]; const SWord16 s1857 = (SWord16) s1792; const SWord8 s1858 = (SWord8) s1857; const SWord8 s1859 = table0[s1858]; const SWord16 s1860 = (((SWord16) s1856) << 8) | ((SWord16) s1859); const SWord32 s1861 = (((SWord32) s1854) << 16) | ((SWord32) s1860); const SWord32 s1862 = s45 ^ s1861; const SWord8 s1863 = (SWord8) (s1851 >> 8); const SWord8 s1864 = table0[s1863]; const SWord16 s1865 = (SWord16) (s1842 >> 16); const SWord8 s1866 = (SWord8) s1865; const SWord8 s1867 = table0[s1866]; const SWord16 s1868 = (((SWord16) s1864) << 8) | ((SWord16) s1867); const SWord8 s1869 = (SWord8) (s1857 >> 8); const SWord8 s1870 = table0[s1869]; const SWord16 s1871 = (SWord16) s1809; const SWord8 s1872 = (SWord8) s1871; const SWord8 s1873 = table0[s1872]; const SWord16 s1874 = (((SWord16) s1870) << 8) | ((SWord16) s1873); const SWord32 s1875 = (((SWord32) s1868) << 16) | ((SWord32) s1874); const SWord32 s1876 = s46 ^ s1875; const SWord8 s1877 = (SWord8) (s1865 >> 8); const SWord8 s1878 = table0[s1877]; const SWord8 s1879 = (SWord8) s1793; const SWord8 s1880 = table0[s1879]; const SWord16 s1881 = (((SWord16) s1878) << 8) | ((SWord16) s1880); const SWord8 s1882 = (SWord8) (s1871 >> 8); const SWord8 s1883 = table0[s1882]; const SWord8 s1884 = (SWord8) s1828; const SWord8 s1885 = table0[s1884]; const SWord16 s1886 = (((SWord16) s1883) << 8) | ((SWord16) s1885); const SWord32 s1887 = (((SWord32) s1881) << 16) | ((SWord32) s1886); const SWord32 s1888 = s47 ^ s1887; ct[0] = s1848; ct[1] = s1862; ct[2] = s1876; ct[3] = s1888; } == END: "aes128BlockEncrypt.c" ================== == BEGIN: "aes128BlockDecrypt.c" ================ /* File: "aes128BlockDecrypt.c". Automatically generated by SBV. Do not edit! */ #include "aes128Lib.h" void aes128BlockDecrypt(const SWord32 *ct, const SWord32 *xkey, SWord32 *pt) { const SWord32 s0 = ct[0]; const SWord32 s1 = ct[1]; const SWord32 s2 = ct[2]; const SWord32 s3 = ct[3]; const SWord32 s4 = xkey[0]; const SWord32 s5 = xkey[1]; const SWord32 s6 = xkey[2]; const SWord32 s7 = xkey[3]; const SWord32 s8 = xkey[4]; const SWord32 s9 = xkey[5]; const SWord32 s10 = xkey[6]; const SWord32 s11 = xkey[7]; const SWord32 s12 = xkey[8]; const SWord32 s13 = xkey[9]; const SWord32 s14 = xkey[10]; const SWord32 s15 = xkey[11]; const SWord32 s16 = xkey[12]; const SWord32 s17 = xkey[13]; const SWord32 s18 = xkey[14]; const SWord32 s19 = xkey[15]; const SWord32 s20 = xkey[16]; const SWord32 s21 = xkey[17]; const SWord32 s22 = xkey[18]; const SWord32 s23 = xkey[19]; const SWord32 s24 = xkey[20]; const SWord32 s25 = xkey[21]; const SWord32 s26 = xkey[22]; const SWord32 s27 = xkey[23]; const SWord32 s28 = xkey[24]; const SWord32 s29 = xkey[25]; const SWord32 s30 = xkey[26]; const SWord32 s31 = xkey[27]; const SWord32 s32 = xkey[28]; const SWord32 s33 = xkey[29]; const SWord32 s34 = xkey[30]; const SWord32 s35 = xkey[31]; const SWord32 s36 = xkey[32]; const SWord32 s37 = xkey[33]; const SWord32 s38 = xkey[34]; const SWord32 s39 = xkey[35]; const SWord32 s40 = xkey[36]; const SWord32 s41 = xkey[37]; const SWord32 s42 = xkey[38]; const SWord32 s43 = xkey[39]; const SWord32 s44 = xkey[40]; const SWord32 s45 = xkey[41]; const SWord32 s46 = xkey[42]; const SWord32 s47 = xkey[43]; static const SWord8 table0[] = { 82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125 }; static const SWord32 table1[] = { 0x51f4a750UL, 0x7e416553UL, 0x1a17a4c3UL, 0x3a275e96UL, 0x3bab6bcbUL, 0x1f9d45f1UL, 0xacfa58abUL, 0x4be30393UL, 0x2030fa55UL, 0xad766df6UL, 0x88cc7691UL, 0xf5024c25UL, 0x4fe5d7fcUL, 0xc52acbd7UL, 0x26354480UL, 0xb562a38fUL, 0xdeb15a49UL, 0x25ba1b67UL, 0x45ea0e98UL, 0x5dfec0e1UL, 0xc32f7502UL, 0x814cf012UL, 0x8d4697a3UL, 0x6bd3f9c6UL, 0x038f5fe7UL, 0x15929c95UL, 0xbf6d7aebUL, 0x955259daUL, 0xd4be832dUL, 0x587421d3UL, 0x49e06929UL, 0x8ec9c844UL, 0x75c2896aUL, 0xf48e7978UL, 0x99583e6bUL, 0x27b971ddUL, 0xbee14fb6UL, 0xf088ad17UL, 0xc920ac66UL, 0x7dce3ab4UL, 0x63df4a18UL, 0xe51a3182UL, 0x97513360UL, 0x62537f45UL, 0xb16477e0UL, 0xbb6bae84UL, 0xfe81a01cUL, 0xf9082b94UL, 0x70486858UL, 0x8f45fd19UL, 0x94de6c87UL, 0x527bf8b7UL, 0xab73d323UL, 0x724b02e2UL, 0xe31f8f57UL, 0x6655ab2aUL, 0xb2eb2807UL, 0x2fb5c203UL, 0x86c57b9aUL, 0xd33708a5UL, 0x302887f2UL, 0x23bfa5b2UL, 0x02036abaUL, 0xed16825cUL, 0x8acf1c2bUL, 0xa779b492UL, 0xf307f2f0UL, 0x4e69e2a1UL, 0x65daf4cdUL, 0x0605bed5UL, 0xd134621fUL, 0xc4a6fe8aUL, 0x342e539dUL, 0xa2f355a0UL, 0x058ae132UL, 0xa4f6eb75UL, 0x0b83ec39UL, 0x4060efaaUL, 0x5e719f06UL, 0xbd6e1051UL, 0x3e218af9UL, 0x96dd063dUL, 0xdd3e05aeUL, 0x4de6bd46UL, 0x91548db5UL, 0x71c45d05UL, 0x0406d46fUL, 0x605015ffUL, 0x1998fb24UL, 0xd6bde997UL, 0x894043ccUL, 0x67d99e77UL, 0xb0e842bdUL, 0x07898b88UL, 0xe7195b38UL, 0x79c8eedbUL, 0xa17c0a47UL, 0x7c420fe9UL, 0xf8841ec9UL, 0x00000000UL, 0x09808683UL, 0x322bed48UL, 0x1e1170acUL, 0x6c5a724eUL, 0xfd0efffbUL, 0x0f853856UL, 0x3daed51eUL, 0x362d3927UL, 0x0a0fd964UL, 0x685ca621UL, 0x9b5b54d1UL, 0x24362e3aUL, 0x0c0a67b1UL, 0x9357e70fUL, 0xb4ee96d2UL, 0x1b9b919eUL, 0x80c0c54fUL, 0x61dc20a2UL, 0x5a774b69UL, 0x1c121a16UL, 0xe293ba0aUL, 0xc0a02ae5UL, 0x3c22e043UL, 0x121b171dUL, 0x0e090d0bUL, 0xf28bc7adUL, 0x2db6a8b9UL, 0x141ea9c8UL, 0x57f11985UL, 0xaf75074cUL, 0xee99ddbbUL, 0xa37f60fdUL, 0xf701269fUL, 0x5c72f5bcUL, 0x44663bc5UL, 0x5bfb7e34UL, 0x8b432976UL, 0xcb23c6dcUL, 0xb6edfc68UL, 0xb8e4f163UL, 0xd731dccaUL, 0x42638510UL, 0x13972240UL, 0x84c61120UL, 0x854a247dUL, 0xd2bb3df8UL, 0xaef93211UL, 0xc729a16dUL, 0x1d9e2f4bUL, 0xdcb230f3UL, 0x0d8652ecUL, 0x77c1e3d0UL, 0x2bb3166cUL, 0xa970b999UL, 0x119448faUL, 0x47e96422UL, 0xa8fc8cc4UL, 0xa0f03f1aUL, 0x567d2cd8UL, 0x223390efUL, 0x87494ec7UL, 0xd938d1c1UL, 0x8ccaa2feUL, 0x98d40b36UL, 0xa6f581cfUL, 0xa57ade28UL, 0xdab78e26UL, 0x3fadbfa4UL, 0x2c3a9de4UL, 0x5078920dUL, 0x6a5fcc9bUL, 0x547e4662UL, 0xf68d13c2UL, 0x90d8b8e8UL, 0x2e39f75eUL, 0x82c3aff5UL, 0x9f5d80beUL, 0x69d0937cUL, 0x6fd52da9UL, 0xcf2512b3UL, 0xc8ac993bUL, 0x10187da7UL, 0xe89c636eUL, 0xdb3bbb7bUL, 0xcd267809UL, 0x6e5918f4UL, 0xec9ab701UL, 0x834f9aa8UL, 0xe6956e65UL, 0xaaffe67eUL, 0x21bccf08UL, 0xef15e8e6UL, 0xbae79bd9UL, 0x4a6f36ceUL, 0xea9f09d4UL, 0x29b07cd6UL, 0x31a4b2afUL, 0x2a3f2331UL, 0xc6a59430UL, 0x35a266c0UL, 0x744ebc37UL, 0xfc82caa6UL, 0xe090d0b0UL, 0x33a7d815UL, 0xf104984aUL, 0x41ecdaf7UL, 0x7fcd500eUL, 0x1791f62fUL, 0x764dd68dUL, 0x43efb04dUL, 0xccaa4d54UL, 0xe49604dfUL, 0x9ed1b5e3UL, 0x4c6a881bUL, 0xc12c1fb8UL, 0x4665517fUL, 0x9d5eea04UL, 0x018c355dUL, 0xfa877473UL, 0xfb0b412eUL, 0xb3671d5aUL, 0x92dbd252UL, 0xe9105633UL, 0x6dd64713UL, 0x9ad7618cUL, 0x37a10c7aUL, 0x59f8148eUL, 0xeb133c89UL, 0xcea927eeUL, 0xb761c935UL, 0xe11ce5edUL, 0x7a47b13cUL, 0x9cd2df59UL, 0x55f2733fUL, 0x1814ce79UL, 0x73c737bfUL, 0x53f7cdeaUL, 0x5ffdaa5bUL, 0xdf3d6f14UL, 0x7844db86UL, 0xcaaff381UL, 0xb968c43eUL, 0x3824342cUL, 0xc2a3405fUL, 0x161dc372UL, 0xbce2250cUL, 0x283c498bUL, 0xff0d9541UL, 0x39a80171UL, 0x080cb3deUL, 0xd8b4e49cUL, 0x6456c190UL, 0x7bcb8461UL, 0xd532b670UL, 0x486c5c74UL, 0xd0b85742UL }; static const SWord32 table2[] = { 0x5051f4a7UL, 0x537e4165UL, 0xc31a17a4UL, 0x963a275eUL, 0xcb3bab6bUL, 0xf11f9d45UL, 0xabacfa58UL, 0x934be303UL, 0x552030faUL, 0xf6ad766dUL, 0x9188cc76UL, 0x25f5024cUL, 0xfc4fe5d7UL, 0xd7c52acbUL, 0x80263544UL, 0x8fb562a3UL, 0x49deb15aUL, 0x6725ba1bUL, 0x9845ea0eUL, 0xe15dfec0UL, 0x02c32f75UL, 0x12814cf0UL, 0xa38d4697UL, 0xc66bd3f9UL, 0xe7038f5fUL, 0x9515929cUL, 0xebbf6d7aUL, 0xda955259UL, 0x2dd4be83UL, 0xd3587421UL, 0x2949e069UL, 0x448ec9c8UL, 0x6a75c289UL, 0x78f48e79UL, 0x6b99583eUL, 0xdd27b971UL, 0xb6bee14fUL, 0x17f088adUL, 0x66c920acUL, 0xb47dce3aUL, 0x1863df4aUL, 0x82e51a31UL, 0x60975133UL, 0x4562537fUL, 0xe0b16477UL, 0x84bb6baeUL, 0x1cfe81a0UL, 0x94f9082bUL, 0x58704868UL, 0x198f45fdUL, 0x8794de6cUL, 0xb7527bf8UL, 0x23ab73d3UL, 0xe2724b02UL, 0x57e31f8fUL, 0x2a6655abUL, 0x07b2eb28UL, 0x032fb5c2UL, 0x9a86c57bUL, 0xa5d33708UL, 0xf2302887UL, 0xb223bfa5UL, 0xba02036aUL, 0x5ced1682UL, 0x2b8acf1cUL, 0x92a779b4UL, 0xf0f307f2UL, 0xa14e69e2UL, 0xcd65daf4UL, 0xd50605beUL, 0x1fd13462UL, 0x8ac4a6feUL, 0x9d342e53UL, 0xa0a2f355UL, 0x32058ae1UL, 0x75a4f6ebUL, 0x390b83ecUL, 0xaa4060efUL, 0x065e719fUL, 0x51bd6e10UL, 0xf93e218aUL, 0x3d96dd06UL, 0xaedd3e05UL, 0x464de6bdUL, 0xb591548dUL, 0x0571c45dUL, 0x6f0406d4UL, 0xff605015UL, 0x241998fbUL, 0x97d6bde9UL, 0xcc894043UL, 0x7767d99eUL, 0xbdb0e842UL, 0x8807898bUL, 0x38e7195bUL, 0xdb79c8eeUL, 0x47a17c0aUL, 0xe97c420fUL, 0xc9f8841eUL, 0x00000000UL, 0x83098086UL, 0x48322bedUL, 0xac1e1170UL, 0x4e6c5a72UL, 0xfbfd0effUL, 0x560f8538UL, 0x1e3daed5UL, 0x27362d39UL, 0x640a0fd9UL, 0x21685ca6UL, 0xd19b5b54UL, 0x3a24362eUL, 0xb10c0a67UL, 0x0f9357e7UL, 0xd2b4ee96UL, 0x9e1b9b91UL, 0x4f80c0c5UL, 0xa261dc20UL, 0x695a774bUL, 0x161c121aUL, 0x0ae293baUL, 0xe5c0a02aUL, 0x433c22e0UL, 0x1d121b17UL, 0x0b0e090dUL, 0xadf28bc7UL, 0xb92db6a8UL, 0xc8141ea9UL, 0x8557f119UL, 0x4caf7507UL, 0xbbee99ddUL, 0xfda37f60UL, 0x9ff70126UL, 0xbc5c72f5UL, 0xc544663bUL, 0x345bfb7eUL, 0x768b4329UL, 0xdccb23c6UL, 0x68b6edfcUL, 0x63b8e4f1UL, 0xcad731dcUL, 0x10426385UL, 0x40139722UL, 0x2084c611UL, 0x7d854a24UL, 0xf8d2bb3dUL, 0x11aef932UL, 0x6dc729a1UL, 0x4b1d9e2fUL, 0xf3dcb230UL, 0xec0d8652UL, 0xd077c1e3UL, 0x6c2bb316UL, 0x99a970b9UL, 0xfa119448UL, 0x2247e964UL, 0xc4a8fc8cUL, 0x1aa0f03fUL, 0xd8567d2cUL, 0xef223390UL, 0xc787494eUL, 0xc1d938d1UL, 0xfe8ccaa2UL, 0x3698d40bUL, 0xcfa6f581UL, 0x28a57adeUL, 0x26dab78eUL, 0xa43fadbfUL, 0xe42c3a9dUL, 0x0d507892UL, 0x9b6a5fccUL, 0x62547e46UL, 0xc2f68d13UL, 0xe890d8b8UL, 0x5e2e39f7UL, 0xf582c3afUL, 0xbe9f5d80UL, 0x7c69d093UL, 0xa96fd52dUL, 0xb3cf2512UL, 0x3bc8ac99UL, 0xa710187dUL, 0x6ee89c63UL, 0x7bdb3bbbUL, 0x09cd2678UL, 0xf46e5918UL, 0x01ec9ab7UL, 0xa8834f9aUL, 0x65e6956eUL, 0x7eaaffe6UL, 0x0821bccfUL, 0xe6ef15e8UL, 0xd9bae79bUL, 0xce4a6f36UL, 0xd4ea9f09UL, 0xd629b07cUL, 0xaf31a4b2UL, 0x312a3f23UL, 0x30c6a594UL, 0xc035a266UL, 0x37744ebcUL, 0xa6fc82caUL, 0xb0e090d0UL, 0x1533a7d8UL, 0x4af10498UL, 0xf741ecdaUL, 0x0e7fcd50UL, 0x2f1791f6UL, 0x8d764dd6UL, 0x4d43efb0UL, 0x54ccaa4dUL, 0xdfe49604UL, 0xe39ed1b5UL, 0x1b4c6a88UL, 0xb8c12c1fUL, 0x7f466551UL, 0x049d5eeaUL, 0x5d018c35UL, 0x73fa8774UL, 0x2efb0b41UL, 0x5ab3671dUL, 0x5292dbd2UL, 0x33e91056UL, 0x136dd647UL, 0x8c9ad761UL, 0x7a37a10cUL, 0x8e59f814UL, 0x89eb133cUL, 0xeecea927UL, 0x35b761c9UL, 0xede11ce5UL, 0x3c7a47b1UL, 0x599cd2dfUL, 0x3f55f273UL, 0x791814ceUL, 0xbf73c737UL, 0xea53f7cdUL, 0x5b5ffdaaUL, 0x14df3d6fUL, 0x867844dbUL, 0x81caaff3UL, 0x3eb968c4UL, 0x2c382434UL, 0x5fc2a340UL, 0x72161dc3UL, 0x0cbce225UL, 0x8b283c49UL, 0x41ff0d95UL, 0x7139a801UL, 0xde080cb3UL, 0x9cd8b4e4UL, 0x906456c1UL, 0x617bcb84UL, 0x70d532b6UL, 0x74486c5cUL, 0x42d0b857UL }; static const SWord32 table3[] = { 0xa75051f4UL, 0x65537e41UL, 0xa4c31a17UL, 0x5e963a27UL, 0x6bcb3babUL, 0x45f11f9dUL, 0x58abacfaUL, 0x03934be3UL, 0xfa552030UL, 0x6df6ad76UL, 0x769188ccUL, 0x4c25f502UL, 0xd7fc4fe5UL, 0xcbd7c52aUL, 0x44802635UL, 0xa38fb562UL, 0x5a49deb1UL, 0x1b6725baUL, 0x0e9845eaUL, 0xc0e15dfeUL, 0x7502c32fUL, 0xf012814cUL, 0x97a38d46UL, 0xf9c66bd3UL, 0x5fe7038fUL, 0x9c951592UL, 0x7aebbf6dUL, 0x59da9552UL, 0x832dd4beUL, 0x21d35874UL, 0x692949e0UL, 0xc8448ec9UL, 0x896a75c2UL, 0x7978f48eUL, 0x3e6b9958UL, 0x71dd27b9UL, 0x4fb6bee1UL, 0xad17f088UL, 0xac66c920UL, 0x3ab47dceUL, 0x4a1863dfUL, 0x3182e51aUL, 0x33609751UL, 0x7f456253UL, 0x77e0b164UL, 0xae84bb6bUL, 0xa01cfe81UL, 0x2b94f908UL, 0x68587048UL, 0xfd198f45UL, 0x6c8794deUL, 0xf8b7527bUL, 0xd323ab73UL, 0x02e2724bUL, 0x8f57e31fUL, 0xab2a6655UL, 0x2807b2ebUL, 0xc2032fb5UL, 0x7b9a86c5UL, 0x08a5d337UL, 0x87f23028UL, 0xa5b223bfUL, 0x6aba0203UL, 0x825ced16UL, 0x1c2b8acfUL, 0xb492a779UL, 0xf2f0f307UL, 0xe2a14e69UL, 0xf4cd65daUL, 0xbed50605UL, 0x621fd134UL, 0xfe8ac4a6UL, 0x539d342eUL, 0x55a0a2f3UL, 0xe132058aUL, 0xeb75a4f6UL, 0xec390b83UL, 0xefaa4060UL, 0x9f065e71UL, 0x1051bd6eUL, 0x8af93e21UL, 0x063d96ddUL, 0x05aedd3eUL, 0xbd464de6UL, 0x8db59154UL, 0x5d0571c4UL, 0xd46f0406UL, 0x15ff6050UL, 0xfb241998UL, 0xe997d6bdUL, 0x43cc8940UL, 0x9e7767d9UL, 0x42bdb0e8UL, 0x8b880789UL, 0x5b38e719UL, 0xeedb79c8UL, 0x0a47a17cUL, 0x0fe97c42UL, 0x1ec9f884UL, 0x00000000UL, 0x86830980UL, 0xed48322bUL, 0x70ac1e11UL, 0x724e6c5aUL, 0xfffbfd0eUL, 0x38560f85UL, 0xd51e3daeUL, 0x3927362dUL, 0xd9640a0fUL, 0xa621685cUL, 0x54d19b5bUL, 0x2e3a2436UL, 0x67b10c0aUL, 0xe70f9357UL, 0x96d2b4eeUL, 0x919e1b9bUL, 0xc54f80c0UL, 0x20a261dcUL, 0x4b695a77UL, 0x1a161c12UL, 0xba0ae293UL, 0x2ae5c0a0UL, 0xe0433c22UL, 0x171d121bUL, 0x0d0b0e09UL, 0xc7adf28bUL, 0xa8b92db6UL, 0xa9c8141eUL, 0x198557f1UL, 0x074caf75UL, 0xddbbee99UL, 0x60fda37fUL, 0x269ff701UL, 0xf5bc5c72UL, 0x3bc54466UL, 0x7e345bfbUL, 0x29768b43UL, 0xc6dccb23UL, 0xfc68b6edUL, 0xf163b8e4UL, 0xdccad731UL, 0x85104263UL, 0x22401397UL, 0x112084c6UL, 0x247d854aUL, 0x3df8d2bbUL, 0x3211aef9UL, 0xa16dc729UL, 0x2f4b1d9eUL, 0x30f3dcb2UL, 0x52ec0d86UL, 0xe3d077c1UL, 0x166c2bb3UL, 0xb999a970UL, 0x48fa1194UL, 0x642247e9UL, 0x8cc4a8fcUL, 0x3f1aa0f0UL, 0x2cd8567dUL, 0x90ef2233UL, 0x4ec78749UL, 0xd1c1d938UL, 0xa2fe8ccaUL, 0x0b3698d4UL, 0x81cfa6f5UL, 0xde28a57aUL, 0x8e26dab7UL, 0xbfa43fadUL, 0x9de42c3aUL, 0x920d5078UL, 0xcc9b6a5fUL, 0x4662547eUL, 0x13c2f68dUL, 0xb8e890d8UL, 0xf75e2e39UL, 0xaff582c3UL, 0x80be9f5dUL, 0x937c69d0UL, 0x2da96fd5UL, 0x12b3cf25UL, 0x993bc8acUL, 0x7da71018UL, 0x636ee89cUL, 0xbb7bdb3bUL, 0x7809cd26UL, 0x18f46e59UL, 0xb701ec9aUL, 0x9aa8834fUL, 0x6e65e695UL, 0xe67eaaffUL, 0xcf0821bcUL, 0xe8e6ef15UL, 0x9bd9bae7UL, 0x36ce4a6fUL, 0x09d4ea9fUL, 0x7cd629b0UL, 0xb2af31a4UL, 0x23312a3fUL, 0x9430c6a5UL, 0x66c035a2UL, 0xbc37744eUL, 0xcaa6fc82UL, 0xd0b0e090UL, 0xd81533a7UL, 0x984af104UL, 0xdaf741ecUL, 0x500e7fcdUL, 0xf62f1791UL, 0xd68d764dUL, 0xb04d43efUL, 0x4d54ccaaUL, 0x04dfe496UL, 0xb5e39ed1UL, 0x881b4c6aUL, 0x1fb8c12cUL, 0x517f4665UL, 0xea049d5eUL, 0x355d018cUL, 0x7473fa87UL, 0x412efb0bUL, 0x1d5ab367UL, 0xd25292dbUL, 0x5633e910UL, 0x47136dd6UL, 0x618c9ad7UL, 0x0c7a37a1UL, 0x148e59f8UL, 0x3c89eb13UL, 0x27eecea9UL, 0xc935b761UL, 0xe5ede11cUL, 0xb13c7a47UL, 0xdf599cd2UL, 0x733f55f2UL, 0xce791814UL, 0x37bf73c7UL, 0xcdea53f7UL, 0xaa5b5ffdUL, 0x6f14df3dUL, 0xdb867844UL, 0xf381caafUL, 0xc43eb968UL, 0x342c3824UL, 0x405fc2a3UL, 0xc372161dUL, 0x250cbce2UL, 0x498b283cUL, 0x9541ff0dUL, 0x017139a8UL, 0xb3de080cUL, 0xe49cd8b4UL, 0xc1906456UL, 0x84617bcbUL, 0xb670d532UL, 0x5c74486cUL, 0x5742d0b8UL }; static const SWord32 table4[] = { 0xf4a75051UL, 0x4165537eUL, 0x17a4c31aUL, 0x275e963aUL, 0xab6bcb3bUL, 0x9d45f11fUL, 0xfa58abacUL, 0xe303934bUL, 0x30fa5520UL, 0x766df6adUL, 0xcc769188UL, 0x024c25f5UL, 0xe5d7fc4fUL, 0x2acbd7c5UL, 0x35448026UL, 0x62a38fb5UL, 0xb15a49deUL, 0xba1b6725UL, 0xea0e9845UL, 0xfec0e15dUL, 0x2f7502c3UL, 0x4cf01281UL, 0x4697a38dUL, 0xd3f9c66bUL, 0x8f5fe703UL, 0x929c9515UL, 0x6d7aebbfUL, 0x5259da95UL, 0xbe832dd4UL, 0x7421d358UL, 0xe0692949UL, 0xc9c8448eUL, 0xc2896a75UL, 0x8e7978f4UL, 0x583e6b99UL, 0xb971dd27UL, 0xe14fb6beUL, 0x88ad17f0UL, 0x20ac66c9UL, 0xce3ab47dUL, 0xdf4a1863UL, 0x1a3182e5UL, 0x51336097UL, 0x537f4562UL, 0x6477e0b1UL, 0x6bae84bbUL, 0x81a01cfeUL, 0x082b94f9UL, 0x48685870UL, 0x45fd198fUL, 0xde6c8794UL, 0x7bf8b752UL, 0x73d323abUL, 0x4b02e272UL, 0x1f8f57e3UL, 0x55ab2a66UL, 0xeb2807b2UL, 0xb5c2032fUL, 0xc57b9a86UL, 0x3708a5d3UL, 0x2887f230UL, 0xbfa5b223UL, 0x036aba02UL, 0x16825cedUL, 0xcf1c2b8aUL, 0x79b492a7UL, 0x07f2f0f3UL, 0x69e2a14eUL, 0xdaf4cd65UL, 0x05bed506UL, 0x34621fd1UL, 0xa6fe8ac4UL, 0x2e539d34UL, 0xf355a0a2UL, 0x8ae13205UL, 0xf6eb75a4UL, 0x83ec390bUL, 0x60efaa40UL, 0x719f065eUL, 0x6e1051bdUL, 0x218af93eUL, 0xdd063d96UL, 0x3e05aeddUL, 0xe6bd464dUL, 0x548db591UL, 0xc45d0571UL, 0x06d46f04UL, 0x5015ff60UL, 0x98fb2419UL, 0xbde997d6UL, 0x4043cc89UL, 0xd99e7767UL, 0xe842bdb0UL, 0x898b8807UL, 0x195b38e7UL, 0xc8eedb79UL, 0x7c0a47a1UL, 0x420fe97cUL, 0x841ec9f8UL, 0x00000000UL, 0x80868309UL, 0x2bed4832UL, 0x1170ac1eUL, 0x5a724e6cUL, 0x0efffbfdUL, 0x8538560fUL, 0xaed51e3dUL, 0x2d392736UL, 0x0fd9640aUL, 0x5ca62168UL, 0x5b54d19bUL, 0x362e3a24UL, 0x0a67b10cUL, 0x57e70f93UL, 0xee96d2b4UL, 0x9b919e1bUL, 0xc0c54f80UL, 0xdc20a261UL, 0x774b695aUL, 0x121a161cUL, 0x93ba0ae2UL, 0xa02ae5c0UL, 0x22e0433cUL, 0x1b171d12UL, 0x090d0b0eUL, 0x8bc7adf2UL, 0xb6a8b92dUL, 0x1ea9c814UL, 0xf1198557UL, 0x75074cafUL, 0x99ddbbeeUL, 0x7f60fda3UL, 0x01269ff7UL, 0x72f5bc5cUL, 0x663bc544UL, 0xfb7e345bUL, 0x4329768bUL, 0x23c6dccbUL, 0xedfc68b6UL, 0xe4f163b8UL, 0x31dccad7UL, 0x63851042UL, 0x97224013UL, 0xc6112084UL, 0x4a247d85UL, 0xbb3df8d2UL, 0xf93211aeUL, 0x29a16dc7UL, 0x9e2f4b1dUL, 0xb230f3dcUL, 0x8652ec0dUL, 0xc1e3d077UL, 0xb3166c2bUL, 0x70b999a9UL, 0x9448fa11UL, 0xe9642247UL, 0xfc8cc4a8UL, 0xf03f1aa0UL, 0x7d2cd856UL, 0x3390ef22UL, 0x494ec787UL, 0x38d1c1d9UL, 0xcaa2fe8cUL, 0xd40b3698UL, 0xf581cfa6UL, 0x7ade28a5UL, 0xb78e26daUL, 0xadbfa43fUL, 0x3a9de42cUL, 0x78920d50UL, 0x5fcc9b6aUL, 0x7e466254UL, 0x8d13c2f6UL, 0xd8b8e890UL, 0x39f75e2eUL, 0xc3aff582UL, 0x5d80be9fUL, 0xd0937c69UL, 0xd52da96fUL, 0x2512b3cfUL, 0xac993bc8UL, 0x187da710UL, 0x9c636ee8UL, 0x3bbb7bdbUL, 0x267809cdUL, 0x5918f46eUL, 0x9ab701ecUL, 0x4f9aa883UL, 0x956e65e6UL, 0xffe67eaaUL, 0xbccf0821UL, 0x15e8e6efUL, 0xe79bd9baUL, 0x6f36ce4aUL, 0x9f09d4eaUL, 0xb07cd629UL, 0xa4b2af31UL, 0x3f23312aUL, 0xa59430c6UL, 0xa266c035UL, 0x4ebc3774UL, 0x82caa6fcUL, 0x90d0b0e0UL, 0xa7d81533UL, 0x04984af1UL, 0xecdaf741UL, 0xcd500e7fUL, 0x91f62f17UL, 0x4dd68d76UL, 0xefb04d43UL, 0xaa4d54ccUL, 0x9604dfe4UL, 0xd1b5e39eUL, 0x6a881b4cUL, 0x2c1fb8c1UL, 0x65517f46UL, 0x5eea049dUL, 0x8c355d01UL, 0x877473faUL, 0x0b412efbUL, 0x671d5ab3UL, 0xdbd25292UL, 0x105633e9UL, 0xd647136dUL, 0xd7618c9aUL, 0xa10c7a37UL, 0xf8148e59UL, 0x133c89ebUL, 0xa927eeceUL, 0x61c935b7UL, 0x1ce5ede1UL, 0x47b13c7aUL, 0xd2df599cUL, 0xf2733f55UL, 0x14ce7918UL, 0xc737bf73UL, 0xf7cdea53UL, 0xfdaa5b5fUL, 0x3d6f14dfUL, 0x44db8678UL, 0xaff381caUL, 0x68c43eb9UL, 0x24342c38UL, 0xa3405fc2UL, 0x1dc37216UL, 0xe2250cbcUL, 0x3c498b28UL, 0x0d9541ffUL, 0xa8017139UL, 0x0cb3de08UL, 0xb4e49cd8UL, 0x56c19064UL, 0xcb84617bUL, 0x32b670d5UL, 0x6c5c7448UL, 0xb85742d0UL }; const SWord32 s560 = s0 ^ s4; const SWord16 s561 = (SWord16) (s560 >> 16); const SWord8 s562 = (SWord8) (s561 >> 8); const SWord32 s563 = table1[s562]; const SWord32 s819 = s3 ^ s7; const SWord16 s820 = (SWord16) (s819 >> 16); const SWord8 s821 = (SWord8) s820; const SWord32 s822 = table2[s821]; const SWord32 s823 = s563 ^ s822; const SWord32 s1079 = s2 ^ s6; const SWord16 s1080 = (SWord16) s1079; const SWord8 s1081 = (SWord8) (s1080 >> 8); const SWord32 s1082 = table3[s1081]; const SWord32 s1083 = s823 ^ s1082; const SWord32 s1339 = s1 ^ s5; const SWord16 s1340 = (SWord16) s1339; const SWord8 s1341 = (SWord8) s1340; const SWord32 s1342 = table4[s1341]; const SWord32 s1343 = s1083 ^ s1342; const SWord32 s1344 = s8 ^ s1343; const SWord16 s1345 = (SWord16) (s1344 >> 16); const SWord8 s1346 = (SWord8) (s1345 >> 8); const SWord32 s1347 = table1[s1346]; const SWord8 s1348 = (SWord8) (s820 >> 8); const SWord32 s1349 = table1[s1348]; const SWord16 s1350 = (SWord16) (s1079 >> 16); const SWord8 s1351 = (SWord8) s1350; const SWord32 s1352 = table2[s1351]; const SWord32 s1353 = s1349 ^ s1352; const SWord8 s1354 = (SWord8) (s1340 >> 8); const SWord32 s1355 = table3[s1354]; const SWord32 s1356 = s1353 ^ s1355; const SWord16 s1357 = (SWord16) s560; const SWord8 s1358 = (SWord8) s1357; const SWord32 s1359 = table4[s1358]; const SWord32 s1360 = s1356 ^ s1359; const SWord32 s1361 = s11 ^ s1360; const SWord16 s1362 = (SWord16) (s1361 >> 16); const SWord8 s1363 = (SWord8) s1362; const SWord32 s1364 = table2[s1363]; const SWord32 s1365 = s1347 ^ s1364; const SWord8 s1366 = (SWord8) (s1350 >> 8); const SWord32 s1367 = table1[s1366]; const SWord16 s1368 = (SWord16) (s1339 >> 16); const SWord8 s1369 = (SWord8) s1368; const SWord32 s1370 = table2[s1369]; const SWord32 s1371 = s1367 ^ s1370; const SWord8 s1372 = (SWord8) (s1357 >> 8); const SWord32 s1373 = table3[s1372]; const SWord32 s1374 = s1371 ^ s1373; const SWord16 s1375 = (SWord16) s819; const SWord8 s1376 = (SWord8) s1375; const SWord32 s1377 = table4[s1376]; const SWord32 s1378 = s1374 ^ s1377; const SWord32 s1379 = s10 ^ s1378; const SWord16 s1380 = (SWord16) s1379; const SWord8 s1381 = (SWord8) (s1380 >> 8); const SWord32 s1382 = table3[s1381]; const SWord32 s1383 = s1365 ^ s1382; const SWord8 s1384 = (SWord8) (s1368 >> 8); const SWord32 s1385 = table1[s1384]; const SWord8 s1386 = (SWord8) s561; const SWord32 s1387 = table2[s1386]; const SWord32 s1388 = s1385 ^ s1387; const SWord8 s1389 = (SWord8) (s1375 >> 8); const SWord32 s1390 = table3[s1389]; const SWord32 s1391 = s1388 ^ s1390; const SWord8 s1392 = (SWord8) s1080; const SWord32 s1393 = table4[s1392]; const SWord32 s1394 = s1391 ^ s1393; const SWord32 s1395 = s9 ^ s1394; const SWord16 s1396 = (SWord16) s1395; const SWord8 s1397 = (SWord8) s1396; const SWord32 s1398 = table4[s1397]; const SWord32 s1399 = s1383 ^ s1398; const SWord32 s1400 = s12 ^ s1399; const SWord16 s1401 = (SWord16) (s1400 >> 16); const SWord8 s1402 = (SWord8) (s1401 >> 8); const SWord32 s1403 = table1[s1402]; const SWord8 s1404 = (SWord8) (s1362 >> 8); const SWord32 s1405 = table1[s1404]; const SWord16 s1406 = (SWord16) (s1379 >> 16); const SWord8 s1407 = (SWord8) s1406; const SWord32 s1408 = table2[s1407]; const SWord32 s1409 = s1405 ^ s1408; const SWord8 s1410 = (SWord8) (s1396 >> 8); const SWord32 s1411 = table3[s1410]; const SWord32 s1412 = s1409 ^ s1411; const SWord16 s1413 = (SWord16) s1344; const SWord8 s1414 = (SWord8) s1413; const SWord32 s1415 = table4[s1414]; const SWord32 s1416 = s1412 ^ s1415; const SWord32 s1417 = s15 ^ s1416; const SWord16 s1418 = (SWord16) (s1417 >> 16); const SWord8 s1419 = (SWord8) s1418; const SWord32 s1420 = table2[s1419]; const SWord32 s1421 = s1403 ^ s1420; const SWord8 s1422 = (SWord8) (s1406 >> 8); const SWord32 s1423 = table1[s1422]; const SWord16 s1424 = (SWord16) (s1395 >> 16); const SWord8 s1425 = (SWord8) s1424; const SWord32 s1426 = table2[s1425]; const SWord32 s1427 = s1423 ^ s1426; const SWord8 s1428 = (SWord8) (s1413 >> 8); const SWord32 s1429 = table3[s1428]; const SWord32 s1430 = s1427 ^ s1429; const SWord16 s1431 = (SWord16) s1361; const SWord8 s1432 = (SWord8) s1431; const SWord32 s1433 = table4[s1432]; const SWord32 s1434 = s1430 ^ s1433; const SWord32 s1435 = s14 ^ s1434; const SWord16 s1436 = (SWord16) s1435; const SWord8 s1437 = (SWord8) (s1436 >> 8); const SWord32 s1438 = table3[s1437]; const SWord32 s1439 = s1421 ^ s1438; const SWord8 s1440 = (SWord8) (s1424 >> 8); const SWord32 s1441 = table1[s1440]; const SWord8 s1442 = (SWord8) s1345; const SWord32 s1443 = table2[s1442]; const SWord32 s1444 = s1441 ^ s1443; const SWord8 s1445 = (SWord8) (s1431 >> 8); const SWord32 s1446 = table3[s1445]; const SWord32 s1447 = s1444 ^ s1446; const SWord8 s1448 = (SWord8) s1380; const SWord32 s1449 = table4[s1448]; const SWord32 s1450 = s1447 ^ s1449; const SWord32 s1451 = s13 ^ s1450; const SWord16 s1452 = (SWord16) s1451; const SWord8 s1453 = (SWord8) s1452; const SWord32 s1454 = table4[s1453]; const SWord32 s1455 = s1439 ^ s1454; const SWord32 s1456 = s16 ^ s1455; const SWord16 s1457 = (SWord16) (s1456 >> 16); const SWord8 s1458 = (SWord8) (s1457 >> 8); const SWord32 s1459 = table1[s1458]; const SWord8 s1460 = (SWord8) (s1418 >> 8); const SWord32 s1461 = table1[s1460]; const SWord16 s1462 = (SWord16) (s1435 >> 16); const SWord8 s1463 = (SWord8) s1462; const SWord32 s1464 = table2[s1463]; const SWord32 s1465 = s1461 ^ s1464; const SWord8 s1466 = (SWord8) (s1452 >> 8); const SWord32 s1467 = table3[s1466]; const SWord32 s1468 = s1465 ^ s1467; const SWord16 s1469 = (SWord16) s1400; const SWord8 s1470 = (SWord8) s1469; const SWord32 s1471 = table4[s1470]; const SWord32 s1472 = s1468 ^ s1471; const SWord32 s1473 = s19 ^ s1472; const SWord16 s1474 = (SWord16) (s1473 >> 16); const SWord8 s1475 = (SWord8) s1474; const SWord32 s1476 = table2[s1475]; const SWord32 s1477 = s1459 ^ s1476; const SWord8 s1478 = (SWord8) (s1462 >> 8); const SWord32 s1479 = table1[s1478]; const SWord16 s1480 = (SWord16) (s1451 >> 16); const SWord8 s1481 = (SWord8) s1480; const SWord32 s1482 = table2[s1481]; const SWord32 s1483 = s1479 ^ s1482; const SWord8 s1484 = (SWord8) (s1469 >> 8); const SWord32 s1485 = table3[s1484]; const SWord32 s1486 = s1483 ^ s1485; const SWord16 s1487 = (SWord16) s1417; const SWord8 s1488 = (SWord8) s1487; const SWord32 s1489 = table4[s1488]; const SWord32 s1490 = s1486 ^ s1489; const SWord32 s1491 = s18 ^ s1490; const SWord16 s1492 = (SWord16) s1491; const SWord8 s1493 = (SWord8) (s1492 >> 8); const SWord32 s1494 = table3[s1493]; const SWord32 s1495 = s1477 ^ s1494; const SWord8 s1496 = (SWord8) (s1480 >> 8); const SWord32 s1497 = table1[s1496]; const SWord8 s1498 = (SWord8) s1401; const SWord32 s1499 = table2[s1498]; const SWord32 s1500 = s1497 ^ s1499; const SWord8 s1501 = (SWord8) (s1487 >> 8); const SWord32 s1502 = table3[s1501]; const SWord32 s1503 = s1500 ^ s1502; const SWord8 s1504 = (SWord8) s1436; const SWord32 s1505 = table4[s1504]; const SWord32 s1506 = s1503 ^ s1505; const SWord32 s1507 = s17 ^ s1506; const SWord16 s1508 = (SWord16) s1507; const SWord8 s1509 = (SWord8) s1508; const SWord32 s1510 = table4[s1509]; const SWord32 s1511 = s1495 ^ s1510; const SWord32 s1512 = s20 ^ s1511; const SWord16 s1513 = (SWord16) (s1512 >> 16); const SWord8 s1514 = (SWord8) (s1513 >> 8); const SWord32 s1515 = table1[s1514]; const SWord8 s1516 = (SWord8) (s1474 >> 8); const SWord32 s1517 = table1[s1516]; const SWord16 s1518 = (SWord16) (s1491 >> 16); const SWord8 s1519 = (SWord8) s1518; const SWord32 s1520 = table2[s1519]; const SWord32 s1521 = s1517 ^ s1520; const SWord8 s1522 = (SWord8) (s1508 >> 8); const SWord32 s1523 = table3[s1522]; const SWord32 s1524 = s1521 ^ s1523; const SWord16 s1525 = (SWord16) s1456; const SWord8 s1526 = (SWord8) s1525; const SWord32 s1527 = table4[s1526]; const SWord32 s1528 = s1524 ^ s1527; const SWord32 s1529 = s23 ^ s1528; const SWord16 s1530 = (SWord16) (s1529 >> 16); const SWord8 s1531 = (SWord8) s1530; const SWord32 s1532 = table2[s1531]; const SWord32 s1533 = s1515 ^ s1532; const SWord8 s1534 = (SWord8) (s1518 >> 8); const SWord32 s1535 = table1[s1534]; const SWord16 s1536 = (SWord16) (s1507 >> 16); const SWord8 s1537 = (SWord8) s1536; const SWord32 s1538 = table2[s1537]; const SWord32 s1539 = s1535 ^ s1538; const SWord8 s1540 = (SWord8) (s1525 >> 8); const SWord32 s1541 = table3[s1540]; const SWord32 s1542 = s1539 ^ s1541; const SWord16 s1543 = (SWord16) s1473; const SWord8 s1544 = (SWord8) s1543; const SWord32 s1545 = table4[s1544]; const SWord32 s1546 = s1542 ^ s1545; const SWord32 s1547 = s22 ^ s1546; const SWord16 s1548 = (SWord16) s1547; const SWord8 s1549 = (SWord8) (s1548 >> 8); const SWord32 s1550 = table3[s1549]; const SWord32 s1551 = s1533 ^ s1550; const SWord8 s1552 = (SWord8) (s1536 >> 8); const SWord32 s1553 = table1[s1552]; const SWord8 s1554 = (SWord8) s1457; const SWord32 s1555 = table2[s1554]; const SWord32 s1556 = s1553 ^ s1555; const SWord8 s1557 = (SWord8) (s1543 >> 8); const SWord32 s1558 = table3[s1557]; const SWord32 s1559 = s1556 ^ s1558; const SWord8 s1560 = (SWord8) s1492; const SWord32 s1561 = table4[s1560]; const SWord32 s1562 = s1559 ^ s1561; const SWord32 s1563 = s21 ^ s1562; const SWord16 s1564 = (SWord16) s1563; const SWord8 s1565 = (SWord8) s1564; const SWord32 s1566 = table4[s1565]; const SWord32 s1567 = s1551 ^ s1566; const SWord32 s1568 = s24 ^ s1567; const SWord16 s1569 = (SWord16) (s1568 >> 16); const SWord8 s1570 = (SWord8) (s1569 >> 8); const SWord32 s1571 = table1[s1570]; const SWord8 s1572 = (SWord8) (s1530 >> 8); const SWord32 s1573 = table1[s1572]; const SWord16 s1574 = (SWord16) (s1547 >> 16); const SWord8 s1575 = (SWord8) s1574; const SWord32 s1576 = table2[s1575]; const SWord32 s1577 = s1573 ^ s1576; const SWord8 s1578 = (SWord8) (s1564 >> 8); const SWord32 s1579 = table3[s1578]; const SWord32 s1580 = s1577 ^ s1579; const SWord16 s1581 = (SWord16) s1512; const SWord8 s1582 = (SWord8) s1581; const SWord32 s1583 = table4[s1582]; const SWord32 s1584 = s1580 ^ s1583; const SWord32 s1585 = s27 ^ s1584; const SWord16 s1586 = (SWord16) (s1585 >> 16); const SWord8 s1587 = (SWord8) s1586; const SWord32 s1588 = table2[s1587]; const SWord32 s1589 = s1571 ^ s1588; const SWord8 s1590 = (SWord8) (s1574 >> 8); const SWord32 s1591 = table1[s1590]; const SWord16 s1592 = (SWord16) (s1563 >> 16); const SWord8 s1593 = (SWord8) s1592; const SWord32 s1594 = table2[s1593]; const SWord32 s1595 = s1591 ^ s1594; const SWord8 s1596 = (SWord8) (s1581 >> 8); const SWord32 s1597 = table3[s1596]; const SWord32 s1598 = s1595 ^ s1597; const SWord16 s1599 = (SWord16) s1529; const SWord8 s1600 = (SWord8) s1599; const SWord32 s1601 = table4[s1600]; const SWord32 s1602 = s1598 ^ s1601; const SWord32 s1603 = s26 ^ s1602; const SWord16 s1604 = (SWord16) s1603; const SWord8 s1605 = (SWord8) (s1604 >> 8); const SWord32 s1606 = table3[s1605]; const SWord32 s1607 = s1589 ^ s1606; const SWord8 s1608 = (SWord8) (s1592 >> 8); const SWord32 s1609 = table1[s1608]; const SWord8 s1610 = (SWord8) s1513; const SWord32 s1611 = table2[s1610]; const SWord32 s1612 = s1609 ^ s1611; const SWord8 s1613 = (SWord8) (s1599 >> 8); const SWord32 s1614 = table3[s1613]; const SWord32 s1615 = s1612 ^ s1614; const SWord8 s1616 = (SWord8) s1548; const SWord32 s1617 = table4[s1616]; const SWord32 s1618 = s1615 ^ s1617; const SWord32 s1619 = s25 ^ s1618; const SWord16 s1620 = (SWord16) s1619; const SWord8 s1621 = (SWord8) s1620; const SWord32 s1622 = table4[s1621]; const SWord32 s1623 = s1607 ^ s1622; const SWord32 s1624 = s28 ^ s1623; const SWord16 s1625 = (SWord16) (s1624 >> 16); const SWord8 s1626 = (SWord8) (s1625 >> 8); const SWord32 s1627 = table1[s1626]; const SWord8 s1628 = (SWord8) (s1586 >> 8); const SWord32 s1629 = table1[s1628]; const SWord16 s1630 = (SWord16) (s1603 >> 16); const SWord8 s1631 = (SWord8) s1630; const SWord32 s1632 = table2[s1631]; const SWord32 s1633 = s1629 ^ s1632; const SWord8 s1634 = (SWord8) (s1620 >> 8); const SWord32 s1635 = table3[s1634]; const SWord32 s1636 = s1633 ^ s1635; const SWord16 s1637 = (SWord16) s1568; const SWord8 s1638 = (SWord8) s1637; const SWord32 s1639 = table4[s1638]; const SWord32 s1640 = s1636 ^ s1639; const SWord32 s1641 = s31 ^ s1640; const SWord16 s1642 = (SWord16) (s1641 >> 16); const SWord8 s1643 = (SWord8) s1642; const SWord32 s1644 = table2[s1643]; const SWord32 s1645 = s1627 ^ s1644; const SWord8 s1646 = (SWord8) (s1630 >> 8); const SWord32 s1647 = table1[s1646]; const SWord16 s1648 = (SWord16) (s1619 >> 16); const SWord8 s1649 = (SWord8) s1648; const SWord32 s1650 = table2[s1649]; const SWord32 s1651 = s1647 ^ s1650; const SWord8 s1652 = (SWord8) (s1637 >> 8); const SWord32 s1653 = table3[s1652]; const SWord32 s1654 = s1651 ^ s1653; const SWord16 s1655 = (SWord16) s1585; const SWord8 s1656 = (SWord8) s1655; const SWord32 s1657 = table4[s1656]; const SWord32 s1658 = s1654 ^ s1657; const SWord32 s1659 = s30 ^ s1658; const SWord16 s1660 = (SWord16) s1659; const SWord8 s1661 = (SWord8) (s1660 >> 8); const SWord32 s1662 = table3[s1661]; const SWord32 s1663 = s1645 ^ s1662; const SWord8 s1664 = (SWord8) (s1648 >> 8); const SWord32 s1665 = table1[s1664]; const SWord8 s1666 = (SWord8) s1569; const SWord32 s1667 = table2[s1666]; const SWord32 s1668 = s1665 ^ s1667; const SWord8 s1669 = (SWord8) (s1655 >> 8); const SWord32 s1670 = table3[s1669]; const SWord32 s1671 = s1668 ^ s1670; const SWord8 s1672 = (SWord8) s1604; const SWord32 s1673 = table4[s1672]; const SWord32 s1674 = s1671 ^ s1673; const SWord32 s1675 = s29 ^ s1674; const SWord16 s1676 = (SWord16) s1675; const SWord8 s1677 = (SWord8) s1676; const SWord32 s1678 = table4[s1677]; const SWord32 s1679 = s1663 ^ s1678; const SWord32 s1680 = s32 ^ s1679; const SWord16 s1681 = (SWord16) (s1680 >> 16); const SWord8 s1682 = (SWord8) (s1681 >> 8); const SWord32 s1683 = table1[s1682]; const SWord8 s1684 = (SWord8) (s1642 >> 8); const SWord32 s1685 = table1[s1684]; const SWord16 s1686 = (SWord16) (s1659 >> 16); const SWord8 s1687 = (SWord8) s1686; const SWord32 s1688 = table2[s1687]; const SWord32 s1689 = s1685 ^ s1688; const SWord8 s1690 = (SWord8) (s1676 >> 8); const SWord32 s1691 = table3[s1690]; const SWord32 s1692 = s1689 ^ s1691; const SWord16 s1693 = (SWord16) s1624; const SWord8 s1694 = (SWord8) s1693; const SWord32 s1695 = table4[s1694]; const SWord32 s1696 = s1692 ^ s1695; const SWord32 s1697 = s35 ^ s1696; const SWord16 s1698 = (SWord16) (s1697 >> 16); const SWord8 s1699 = (SWord8) s1698; const SWord32 s1700 = table2[s1699]; const SWord32 s1701 = s1683 ^ s1700; const SWord8 s1702 = (SWord8) (s1686 >> 8); const SWord32 s1703 = table1[s1702]; const SWord16 s1704 = (SWord16) (s1675 >> 16); const SWord8 s1705 = (SWord8) s1704; const SWord32 s1706 = table2[s1705]; const SWord32 s1707 = s1703 ^ s1706; const SWord8 s1708 = (SWord8) (s1693 >> 8); const SWord32 s1709 = table3[s1708]; const SWord32 s1710 = s1707 ^ s1709; const SWord16 s1711 = (SWord16) s1641; const SWord8 s1712 = (SWord8) s1711; const SWord32 s1713 = table4[s1712]; const SWord32 s1714 = s1710 ^ s1713; const SWord32 s1715 = s34 ^ s1714; const SWord16 s1716 = (SWord16) s1715; const SWord8 s1717 = (SWord8) (s1716 >> 8); const SWord32 s1718 = table3[s1717]; const SWord32 s1719 = s1701 ^ s1718; const SWord8 s1720 = (SWord8) (s1704 >> 8); const SWord32 s1721 = table1[s1720]; const SWord8 s1722 = (SWord8) s1625; const SWord32 s1723 = table2[s1722]; const SWord32 s1724 = s1721 ^ s1723; const SWord8 s1725 = (SWord8) (s1711 >> 8); const SWord32 s1726 = table3[s1725]; const SWord32 s1727 = s1724 ^ s1726; const SWord8 s1728 = (SWord8) s1660; const SWord32 s1729 = table4[s1728]; const SWord32 s1730 = s1727 ^ s1729; const SWord32 s1731 = s33 ^ s1730; const SWord16 s1732 = (SWord16) s1731; const SWord8 s1733 = (SWord8) s1732; const SWord32 s1734 = table4[s1733]; const SWord32 s1735 = s1719 ^ s1734; const SWord32 s1736 = s36 ^ s1735; const SWord16 s1737 = (SWord16) (s1736 >> 16); const SWord8 s1738 = (SWord8) (s1737 >> 8); const SWord32 s1739 = table1[s1738]; const SWord8 s1740 = (SWord8) (s1698 >> 8); const SWord32 s1741 = table1[s1740]; const SWord16 s1742 = (SWord16) (s1715 >> 16); const SWord8 s1743 = (SWord8) s1742; const SWord32 s1744 = table2[s1743]; const SWord32 s1745 = s1741 ^ s1744; const SWord8 s1746 = (SWord8) (s1732 >> 8); const SWord32 s1747 = table3[s1746]; const SWord32 s1748 = s1745 ^ s1747; const SWord16 s1749 = (SWord16) s1680; const SWord8 s1750 = (SWord8) s1749; const SWord32 s1751 = table4[s1750]; const SWord32 s1752 = s1748 ^ s1751; const SWord32 s1753 = s39 ^ s1752; const SWord16 s1754 = (SWord16) (s1753 >> 16); const SWord8 s1755 = (SWord8) s1754; const SWord32 s1756 = table2[s1755]; const SWord32 s1757 = s1739 ^ s1756; const SWord8 s1758 = (SWord8) (s1742 >> 8); const SWord32 s1759 = table1[s1758]; const SWord16 s1760 = (SWord16) (s1731 >> 16); const SWord8 s1761 = (SWord8) s1760; const SWord32 s1762 = table2[s1761]; const SWord32 s1763 = s1759 ^ s1762; const SWord8 s1764 = (SWord8) (s1749 >> 8); const SWord32 s1765 = table3[s1764]; const SWord32 s1766 = s1763 ^ s1765; const SWord16 s1767 = (SWord16) s1697; const SWord8 s1768 = (SWord8) s1767; const SWord32 s1769 = table4[s1768]; const SWord32 s1770 = s1766 ^ s1769; const SWord32 s1771 = s38 ^ s1770; const SWord16 s1772 = (SWord16) s1771; const SWord8 s1773 = (SWord8) (s1772 >> 8); const SWord32 s1774 = table3[s1773]; const SWord32 s1775 = s1757 ^ s1774; const SWord8 s1776 = (SWord8) (s1760 >> 8); const SWord32 s1777 = table1[s1776]; const SWord8 s1778 = (SWord8) s1681; const SWord32 s1779 = table2[s1778]; const SWord32 s1780 = s1777 ^ s1779; const SWord8 s1781 = (SWord8) (s1767 >> 8); const SWord32 s1782 = table3[s1781]; const SWord32 s1783 = s1780 ^ s1782; const SWord8 s1784 = (SWord8) s1716; const SWord32 s1785 = table4[s1784]; const SWord32 s1786 = s1783 ^ s1785; const SWord32 s1787 = s37 ^ s1786; const SWord16 s1788 = (SWord16) s1787; const SWord8 s1789 = (SWord8) s1788; const SWord32 s1790 = table4[s1789]; const SWord32 s1791 = s1775 ^ s1790; const SWord32 s1792 = s40 ^ s1791; const SWord16 s1793 = (SWord16) (s1792 >> 16); const SWord8 s1794 = (SWord8) (s1793 >> 8); const SWord8 s1795 = table0[s1794]; const SWord8 s1796 = (SWord8) (s1754 >> 8); const SWord32 s1797 = table1[s1796]; const SWord16 s1798 = (SWord16) (s1771 >> 16); const SWord8 s1799 = (SWord8) s1798; const SWord32 s1800 = table2[s1799]; const SWord32 s1801 = s1797 ^ s1800; const SWord8 s1802 = (SWord8) (s1788 >> 8); const SWord32 s1803 = table3[s1802]; const SWord32 s1804 = s1801 ^ s1803; const SWord16 s1805 = (SWord16) s1736; const SWord8 s1806 = (SWord8) s1805; const SWord32 s1807 = table4[s1806]; const SWord32 s1808 = s1804 ^ s1807; const SWord32 s1809 = s43 ^ s1808; const SWord16 s1810 = (SWord16) (s1809 >> 16); const SWord8 s1811 = (SWord8) s1810; const SWord8 s1812 = table0[s1811]; const SWord16 s1813 = (((SWord16) s1795) << 8) | ((SWord16) s1812); const SWord8 s1814 = (SWord8) (s1798 >> 8); const SWord32 s1815 = table1[s1814]; const SWord16 s1816 = (SWord16) (s1787 >> 16); const SWord8 s1817 = (SWord8) s1816; const SWord32 s1818 = table2[s1817]; const SWord32 s1819 = s1815 ^ s1818; const SWord8 s1820 = (SWord8) (s1805 >> 8); const SWord32 s1821 = table3[s1820]; const SWord32 s1822 = s1819 ^ s1821; const SWord16 s1823 = (SWord16) s1753; const SWord8 s1824 = (SWord8) s1823; const SWord32 s1825 = table4[s1824]; const SWord32 s1826 = s1822 ^ s1825; const SWord32 s1827 = s42 ^ s1826; const SWord16 s1828 = (SWord16) s1827; const SWord8 s1829 = (SWord8) (s1828 >> 8); const SWord8 s1830 = table0[s1829]; const SWord8 s1831 = (SWord8) (s1816 >> 8); const SWord32 s1832 = table1[s1831]; const SWord8 s1833 = (SWord8) s1737; const SWord32 s1834 = table2[s1833]; const SWord32 s1835 = s1832 ^ s1834; const SWord8 s1836 = (SWord8) (s1823 >> 8); const SWord32 s1837 = table3[s1836]; const SWord32 s1838 = s1835 ^ s1837; const SWord8 s1839 = (SWord8) s1772; const SWord32 s1840 = table4[s1839]; const SWord32 s1841 = s1838 ^ s1840; const SWord32 s1842 = s41 ^ s1841; const SWord16 s1843 = (SWord16) s1842; const SWord8 s1844 = (SWord8) s1843; const SWord8 s1845 = table0[s1844]; const SWord16 s1846 = (((SWord16) s1830) << 8) | ((SWord16) s1845); const SWord32 s1847 = (((SWord32) s1813) << 16) | ((SWord32) s1846); const SWord32 s1848 = s44 ^ s1847; const SWord16 s1849 = (SWord16) (s1842 >> 16); const SWord8 s1850 = (SWord8) (s1849 >> 8); const SWord8 s1851 = table0[s1850]; const SWord8 s1852 = (SWord8) s1793; const SWord8 s1853 = table0[s1852]; const SWord16 s1854 = (((SWord16) s1851) << 8) | ((SWord16) s1853); const SWord16 s1855 = (SWord16) s1809; const SWord8 s1856 = (SWord8) (s1855 >> 8); const SWord8 s1857 = table0[s1856]; const SWord8 s1858 = (SWord8) s1828; const SWord8 s1859 = table0[s1858]; const SWord16 s1860 = (((SWord16) s1857) << 8) | ((SWord16) s1859); const SWord32 s1861 = (((SWord32) s1854) << 16) | ((SWord32) s1860); const SWord32 s1862 = s45 ^ s1861; const SWord16 s1863 = (SWord16) (s1827 >> 16); const SWord8 s1864 = (SWord8) (s1863 >> 8); const SWord8 s1865 = table0[s1864]; const SWord8 s1866 = (SWord8) s1849; const SWord8 s1867 = table0[s1866]; const SWord16 s1868 = (((SWord16) s1865) << 8) | ((SWord16) s1867); const SWord16 s1869 = (SWord16) s1792; const SWord8 s1870 = (SWord8) (s1869 >> 8); const SWord8 s1871 = table0[s1870]; const SWord8 s1872 = (SWord8) s1855; const SWord8 s1873 = table0[s1872]; const SWord16 s1874 = (((SWord16) s1871) << 8) | ((SWord16) s1873); const SWord32 s1875 = (((SWord32) s1868) << 16) | ((SWord32) s1874); const SWord32 s1876 = s46 ^ s1875; const SWord8 s1877 = (SWord8) (s1810 >> 8); const SWord8 s1878 = table0[s1877]; const SWord8 s1879 = (SWord8) s1863; const SWord8 s1880 = table0[s1879]; const SWord16 s1881 = (((SWord16) s1878) << 8) | ((SWord16) s1880); const SWord8 s1882 = (SWord8) (s1843 >> 8); const SWord8 s1883 = table0[s1882]; const SWord8 s1884 = (SWord8) s1869; const SWord8 s1885 = table0[s1884]; const SWord16 s1886 = (((SWord16) s1883) << 8) | ((SWord16) s1885); const SWord32 s1887 = (((SWord32) s1881) << 16) | ((SWord32) s1886); const SWord32 s1888 = s47 ^ s1887; pt[0] = s1848; pt[1] = s1862; pt[2] = s1876; pt[3] = s1888; } == END: "aes128BlockDecrypt.c" ================== == BEGIN: "aes128Lib.h" ================ /* Header file for aes128Lib. Automatically generated by SBV. Do not edit! */ #ifndef __aes128Lib__HEADER_INCLUDED__ #define __aes128Lib__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototypes: */ void aes128KeySchedule(const SWord32 *key, SWord32 *encKS, SWord32 *decKS); void aes128BlockEncrypt(const SWord32 *pt, const SWord32 *xkey, SWord32 *ct); void aes128BlockDecrypt(const SWord32 *ct, const SWord32 *xkey, SWord32 *pt); #endif /* __aes128Lib__HEADER_INCLUDED__ */ == END: "aes128Lib.h" ================== == BEGIN: "aes128Lib_driver.c" ================ /* Example driver program for aes128Lib. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "aes128Lib.h" void aes128KeySchedule_driver(void) { const SWord32 key[4] = { 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL }; printf("Contents of input array key:\n"); int key_ctr; for(key_ctr = 0; key_ctr < 4 ; ++key_ctr) printf(" key[%d] = 0x%08"PRIx32"UL\n", key_ctr ,key[key_ctr]); SWord32 encKS[44]; SWord32 decKS[44]; aes128KeySchedule(key, encKS, decKS); printf("aes128KeySchedule(key, encKS, decKS) ->\n"); int encKS_ctr; for(encKS_ctr = 0; encKS_ctr < 44 ; ++encKS_ctr) printf(" encKS[%d] = 0x%08"PRIx32"UL\n", encKS_ctr ,encKS[encKS_ctr]); int decKS_ctr; for(decKS_ctr = 0; decKS_ctr < 44 ; ++decKS_ctr) printf(" decKS[%d] = 0x%08"PRIx32"UL\n", decKS_ctr ,decKS[decKS_ctr]); } void aes128BlockEncrypt_driver(void) { const SWord32 pt[4] = { 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL }; printf("Contents of input array pt:\n"); int pt_ctr; for(pt_ctr = 0; pt_ctr < 4 ; ++pt_ctr) printf(" pt[%d] = 0x%08"PRIx32"UL\n", pt_ctr ,pt[pt_ctr]); const SWord32 xkey[44] = { 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL }; printf("Contents of input array xkey:\n"); int xkey_ctr; for(xkey_ctr = 0; xkey_ctr < 44 ; ++xkey_ctr) printf(" xkey[%d] = 0x%08"PRIx32"UL\n", xkey_ctr ,xkey[xkey_ctr]); SWord32 ct[4]; aes128BlockEncrypt(pt, xkey, ct); printf("aes128BlockEncrypt(pt, xkey, ct) ->\n"); int ct_ctr; for(ct_ctr = 0; ct_ctr < 4 ; ++ct_ctr) printf(" ct[%d] = 0x%08"PRIx32"UL\n", ct_ctr ,ct[ct_ctr]); } void aes128BlockDecrypt_driver(void) { const SWord32 ct[4] = { 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL }; printf("Contents of input array ct:\n"); int ct_ctr; for(ct_ctr = 0; ct_ctr < 4 ; ++ct_ctr) printf(" ct[%d] = 0x%08"PRIx32"UL\n", ct_ctr ,ct[ct_ctr]); const SWord32 xkey[44] = { 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL }; printf("Contents of input array xkey:\n"); int xkey_ctr; for(xkey_ctr = 0; xkey_ctr < 44 ; ++xkey_ctr) printf(" xkey[%d] = 0x%08"PRIx32"UL\n", xkey_ctr ,xkey[xkey_ctr]); SWord32 pt[4]; aes128BlockDecrypt(ct, xkey, pt); printf("aes128BlockDecrypt(ct, xkey, pt) ->\n"); int pt_ctr; for(pt_ctr = 0; pt_ctr < 4 ; ++pt_ctr) printf(" pt[%d] = 0x%08"PRIx32"UL\n", pt_ctr ,pt[pt_ctr]); } int main(void) { printf("====================================\n"); printf("** Driver run for aes128KeySchedule:\n"); printf("====================================\n"); aes128KeySchedule_driver(); printf("=====================================\n"); printf("** Driver run for aes128BlockEncrypt:\n"); printf("=====================================\n"); aes128BlockEncrypt_driver(); printf("=====================================\n"); printf("** Driver run for aes128BlockDecrypt:\n"); printf("=====================================\n"); aes128BlockDecrypt_driver(); return 0; } == END: "aes128Lib_driver.c" ================== == BEGIN: "Makefile" ================ # Makefile for aes128Lib. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer AR?=ar ARFLAGS?=cr all: aes128Lib.a aes128Lib_driver aes128Lib.a: aes128KeySchedule.o aes128BlockEncrypt.o aes128BlockDecrypt.o ${AR} ${ARFLAGS} $@ $^ aes128Lib_driver: aes128Lib_driver.c aes128Lib.h ${CC} ${CCFLAGS} $< -o $@ aes128Lib.a aes128KeySchedule.o: aes128KeySchedule.c aes128Lib.h ${CC} ${CCFLAGS} -c $< -o $@ aes128BlockEncrypt.o: aes128BlockEncrypt.c aes128Lib.h ${CC} ${CCFLAGS} -c $< -o $@ aes128BlockDecrypt.o: aes128BlockDecrypt.c aes128Lib.h ${CC} ${CCFLAGS} -c $< -o $@ clean: rm -f *.o veryclean: clean rm -f aes128Lib.a aes128Lib_driver == END: "Makefile" ==================sbv-7.13/SBVTestSuite/GoldFiles/allSat1.gold0000644000000000000000000000011513405536617016757 0ustar0000000000000000Solution #1: x = Q!val!0 :: Q y = Q!val!0 :: Q This is the only solution.sbv-7.13/SBVTestSuite/GoldFiles/allSat2.gold0000644000000000000000000000025013405536617016760 0ustar0000000000000000Solution #1: x = Q!val!0 :: Q y = Q!val!0 :: Q z = Q!val!0 :: Q Solution #2: x = Q!val!0 :: Q y = Q!val!0 :: Q z = Q!val!1 :: Q Found 2 different solutions.sbv-7.13/SBVTestSuite/GoldFiles/allSat3.gold0000644000000000000000000000013713405536617016765 0ustar0000000000000000Solution #1: s0 = 0.0 :: Float Solution #2: s0 = -0.0 :: Float Found 2 different solutions.sbv-7.13/SBVTestSuite/GoldFiles/allSat4.gold0000644000000000000000000000002313405536617016760 0ustar0000000000000000No solutions found.sbv-7.13/SBVTestSuite/GoldFiles/allSat5.gold0000644000000000000000000000050213405536617016763 0ustar0000000000000000Solution #1: s0 = 0 :: Word8 s1 = 1 :: Word8 Solution #2: s0 = 0 :: Word8 s1 = 2 :: Word8 Solution #3: s0 = 0 :: Word8 s1 = 3 :: Word8 Solution #4: s0 = 1 :: Word8 s1 = 2 :: Word8 Solution #5: s0 = 1 :: Word8 s1 = 3 :: Word8 Solution #6: s0 = 2 :: Word8 s1 = 3 :: Word8 Found 6 different solutions.sbv-7.13/SBVTestSuite/GoldFiles/allSat6.gold0000644000000000000000000000031513405536617016766 0ustar0000000000000000Solution #1: x = 0 :: Word8 y = 1 :: Word8 Solution #2: x = 0 :: Word8 y = 2 :: Word8 Solution #3: x = 1 :: Word8 y = 2 :: Word8 Found 3 different solutions. (Unique up to prefix existentials.)sbv-7.13/SBVTestSuite/GoldFiles/assertWithPenalty1.gold0000644000000000000000000000023013405536617021227 0ustar0000000000000000Optimal model: x = 0 :: Integer y = 1 :: Integer as1 = False :: Bool as2 = True :: Bool as3 = True :: Bool as4 = False :: Boolsbv-7.13/SBVTestSuite/GoldFiles/assertWithPenalty2.gold0000644000000000000000000000026613405536617021241 0ustar0000000000000000Optimal model: a1 = False :: Bool a2 = True :: Bool a3 = True :: Bool as_a1 = False :: Bool as_a2 = True :: Bool as_a3 = True :: Bool as_a4 = True :: Boolsbv-7.13/SBVTestSuite/GoldFiles/auf-0.gold0000644000000000000000000000150013405536617016365 0ustar0000000000000000INPUTS s0 :: SWord32, existential, aliasing "x" s1 :: SWord32, existential, aliasing "y" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s2 = 2 :: Word32 s6 = 3 :: Word32 s13 = 1 :: Word32 TABLES ARRAYS UNINTERPRETED CONSTANTS [uninterpreted] a_uninitializedRead :: SWord32 -> SWord32 [uninterpreted] f :: SWord32 -> SWord64 USER GIVEN CODE SEGMENTS AXIOMS DEFINE s3 :: SWord32 = s0 + s2 s4 :: SBool = s1 == s3 s5 :: SBool = ~ s4 s7 :: SWord32 = s1 - s2 s8 :: SBool = s0 == s7 s9 :: SWord32 = [uninterpreted] a_uninitializedRead s7 s10 :: SWord32 = if s8 then s6 else s9 s11 :: SWord64 = [uninterpreted] f s10 s12 :: SWord32 = s1 - s0 s14 :: SWord32 = s12 + s13 s15 :: SWord64 = [uninterpreted] f s14 s16 :: SBool = s11 == s15 s17 :: SBool = s5 | s16 CONSTRAINTS ASSERTIONS OUTPUTS s17sbv-7.13/SBVTestSuite/GoldFiles/auf-1.gold0000644000000000000000000000156013405536617016374 0ustar0000000000000000INPUTS s0 :: SWord32, existential, aliasing "x" s1 :: SWord32, existential, aliasing "y" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s2 = 2 :: Word32 s6 = 3 :: Word32 s11 = 1 :: Word32 TABLES ARRAYS array_0 :: SWord32 -> SWord32, aliasing "a" Context: initialized with random elements array_1 :: SWord32 -> SWord32 Context: cloned from array_0 with s0 :: SWord32 |-> s6 :: SWord32 UNINTERPRETED CONSTANTS [uninterpreted] f :: SWord32 -> SWord64 USER GIVEN CODE SEGMENTS AXIOMS DEFINE s3 :: SWord32 = s0 + s2 s4 :: SBool = s1 == s3 s5 :: SBool = ~ s4 s7 :: SWord32 = s1 - s2 s8 :: SWord32 = select array_1 s7 s9 :: SWord64 = [uninterpreted] f s8 s10 :: SWord32 = s1 - s0 s12 :: SWord32 = s10 + s11 s13 :: SWord64 = [uninterpreted] f s12 s14 :: SBool = s9 == s13 s15 :: SBool = s5 | s14 CONSTRAINTS ASSERTIONS OUTPUTS s15sbv-7.13/SBVTestSuite/GoldFiles/basic-1_1.gold0000644000000000000000000000001213405536617017111 0ustar00000000000000005 :: Word8sbv-7.13/SBVTestSuite/GoldFiles/basic-1_2.gold0000644000000000000000000000001213405536617017112 0ustar00000000000000005 :: Word8sbv-7.13/SBVTestSuite/GoldFiles/basic-1_3.gold0000644000000000000000000000001313405536617017114 0ustar000000000000000025 :: Word8sbv-7.13/SBVTestSuite/GoldFiles/basic-1_4.gold0000644000000000000000000000001313405536617017115 0ustar000000000000000025 :: Word8sbv-7.13/SBVTestSuite/GoldFiles/basic-1_5.gold0000644000000000000000000000001213405536617017115 0ustar00000000000000004 :: Word8sbv-7.13/SBVTestSuite/GoldFiles/basic-2_1.gold0000644000000000000000000000044613405536617017125 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "y" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s1 = 3 :: Word8 TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SWord8 = s0 + s1 s3 :: SWord8 = s1 - s0 s4 :: SWord8 = s2 * s3 CONSTRAINTS ASSERTIONS OUTPUTS s4sbv-7.13/SBVTestSuite/GoldFiles/basic-2_2.gold0000644000000000000000000000041513405536617017122 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "y" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s1 = 9 :: Word8 TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SWord8 = s0 * s0 s3 :: SWord8 = s1 - s2 CONSTRAINTS ASSERTIONS OUTPUTS s3sbv-7.13/SBVTestSuite/GoldFiles/basic-2_3.gold0000644000000000000000000000041513405536617017123 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "y" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s1 = 3 :: Word8 TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SWord8 = s0 + s1 s3 :: SWord8 = s2 * s2 CONSTRAINTS ASSERTIONS OUTPUTS s3sbv-7.13/SBVTestSuite/GoldFiles/basic-2_4.gold0000644000000000000000000000041513405536617017124 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "y" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s1 = 3 :: Word8 TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SWord8 = s0 + s1 s3 :: SWord8 = s2 * s2 CONSTRAINTS ASSERTIONS OUTPUTS s3sbv-7.13/SBVTestSuite/GoldFiles/basic-2_5.gold0000644000000000000000000000001213405536617017116 0ustar00000000000000004 :: Word8sbv-7.13/SBVTestSuite/GoldFiles/basic-3_1.gold0000644000000000000000000000046113405536617017123 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" s1 :: SWord8, aliasing "y" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SWord8 = s0 + s1 s3 :: SWord8 = s0 - s1 s4 :: SWord8 = s2 * s3 CONSTRAINTS ASSERTIONS OUTPUTS s4sbv-7.13/SBVTestSuite/GoldFiles/basic-3_2.gold0000644000000000000000000000046113405536617017124 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" s1 :: SWord8, aliasing "y" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SWord8 = s0 * s0 s3 :: SWord8 = s1 * s1 s4 :: SWord8 = s2 - s3 CONSTRAINTS ASSERTIONS OUTPUTS s4sbv-7.13/SBVTestSuite/GoldFiles/basic-3_3.gold0000644000000000000000000000043013405536617017121 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" s1 :: SWord8, aliasing "y" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SWord8 = s0 + s1 s3 :: SWord8 = s2 * s2 CONSTRAINTS ASSERTIONS OUTPUTS s3sbv-7.13/SBVTestSuite/GoldFiles/basic-3_4.gold0000644000000000000000000000043013405536617017122 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" s1 :: SWord8, aliasing "y" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SWord8 = s0 + s1 s3 :: SWord8 = s2 * s2 CONSTRAINTS ASSERTIONS OUTPUTS s3sbv-7.13/SBVTestSuite/GoldFiles/basic-3_5.gold0000644000000000000000000000042113405536617017123 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" s1 :: SWord8, aliasing "y" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s2 = 1 :: Word8 TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s3 :: SWord8 = s0 + s2 CONSTRAINTS ASSERTIONS OUTPUTS s3sbv-7.13/SBVTestSuite/GoldFiles/basic-4_1.gold0000644000000000000000000000042413405536617017123 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s1 :: SWord8 = s0 + s0 s2 :: SWord8 = s0 - s0 s3 :: SWord8 = s1 * s2 CONSTRAINTS ASSERTIONS OUTPUTS s3sbv-7.13/SBVTestSuite/GoldFiles/basic-4_2.gold0000644000000000000000000000037313405536617017127 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s1 :: SWord8 = s0 * s0 s2 :: SWord8 = s1 - s1 CONSTRAINTS ASSERTIONS OUTPUTS s2sbv-7.13/SBVTestSuite/GoldFiles/basic-4_3.gold0000644000000000000000000000037313405536617017130 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s1 :: SWord8 = s0 + s0 s2 :: SWord8 = s1 * s1 CONSTRAINTS ASSERTIONS OUTPUTS s2sbv-7.13/SBVTestSuite/GoldFiles/basic-4_4.gold0000644000000000000000000000037313405536617017131 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s1 :: SWord8 = s0 + s0 s2 :: SWord8 = s1 * s1 CONSTRAINTS ASSERTIONS OUTPUTS s2sbv-7.13/SBVTestSuite/GoldFiles/basic-4_5.gold0000644000000000000000000000036413405536617017132 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s1 = 1 :: Word8 TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SWord8 = s0 + s1 CONSTRAINTS ASSERTIONS OUTPUTS s2sbv-7.13/SBVTestSuite/GoldFiles/basic-5_1.gold0000644000000000000000000000046613405536617017132 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" s1 :: SWord8, aliasing "q" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SWord8 = s0 + s0 s3 :: SWord8 = s0 - s0 s4 :: SWord8 = s2 * s3 CONSTRAINTS ASSERTIONS OUTPUTS s1 s4sbv-7.13/SBVTestSuite/GoldFiles/basic-5_2.gold0000644000000000000000000000043513405536617017127 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" s1 :: SWord8, aliasing "q" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SWord8 = s0 * s0 s3 :: SWord8 = s2 - s2 CONSTRAINTS ASSERTIONS OUTPUTS s1 s3sbv-7.13/SBVTestSuite/GoldFiles/basic-5_3.gold0000644000000000000000000000043513405536617017130 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" s1 :: SWord8, aliasing "q" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SWord8 = s0 + s0 s3 :: SWord8 = s2 * s2 CONSTRAINTS ASSERTIONS OUTPUTS s1 s3sbv-7.13/SBVTestSuite/GoldFiles/basic-5_4.gold0000644000000000000000000000043513405536617017131 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" s1 :: SWord8, aliasing "q" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SWord8 = s0 + s0 s3 :: SWord8 = s2 * s2 CONSTRAINTS ASSERTIONS OUTPUTS s1 s3sbv-7.13/SBVTestSuite/GoldFiles/basic-5_5.gold0000644000000000000000000000042613405536617017132 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" s1 :: SWord8, aliasing "q" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s2 = 1 :: Word8 TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s3 :: SWord8 = s0 + s2 CONSTRAINTS ASSERTIONS OUTPUTS s1 s3sbv-7.13/SBVTestSuite/GoldFiles/boxed1.gold0000644000000000000000000000133613405536617016646 0ustar0000000000000000Objective "min_x": Optimal in an extension field: min_x = 0.0 :: Real max_x_plus_y = 13.0 :: Real min_y = epsilon :: Real max_y = 4.0 :: Real Objective "max_x_plus_y": Optimal in an extension field: min_x = 0.0 :: Real max_x_plus_y = 13.0 :: Real min_y = epsilon :: Real max_y = 4.0 :: Real Objective "min_y": Optimal in an extension field: min_x = 0.0 :: Real max_x_plus_y = 13.0 :: Real min_y = epsilon :: Real max_y = 4.0 :: Real Objective "max_y": Optimal in an extension field: min_x = 0.0 :: Real max_x_plus_y = 13.0 :: Real min_y = epsilon :: Real max_y = 4.0 :: Realsbv-7.13/SBVTestSuite/GoldFiles/ccitt.gold0000644000000000000000000020156713405536617016602 0ustar0000000000000000INPUTS s0 :: SWord32 s1 :: SWord16 s2 :: SWord32 s3 :: SWord16 CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s13 = 0 :: Word1 s1686 = 0 :: Word8 s1687 = 1 :: Word8 s1815 = 3 :: Word8 s9 = 0 :: Word16 s525 = 1 :: Word64 s526 = 0 :: Word64 s528 = 2 :: Word64 s531 = 4 :: Word64 s534 = 8 :: Word64 s537 = 16 :: Word64 s540 = 32 :: Word64 s543 = 64 :: Word64 s546 = 128 :: Word64 s549 = 256 :: Word64 s552 = 512 :: Word64 s555 = 1024 :: Word64 s558 = 2048 :: Word64 s561 = 4096 :: Word64 s564 = 8192 :: Word64 s567 = 16384 :: Word64 s570 = 32768 :: Word64 s573 = 65536 :: Word64 s576 = 131072 :: Word64 s579 = 262144 :: Word64 s582 = 524288 :: Word64 s585 = 1048576 :: Word64 s588 = 2097152 :: Word64 s591 = 4194304 :: Word64 s594 = 8388608 :: Word64 s597 = 16777216 :: Word64 s600 = 33554432 :: Word64 s603 = 67108864 :: Word64 s606 = 134217728 :: Word64 s609 = 268435456 :: Word64 s612 = 536870912 :: Word64 s615 = 1073741824 :: Word64 s618 = 2147483648 :: Word64 s621 = 4294967296 :: Word64 s624 = 8589934592 :: Word64 s627 = 17179869184 :: Word64 s630 = 34359738368 :: Word64 s633 = 68719476736 :: Word64 s636 = 137438953472 :: Word64 s639 = 274877906944 :: Word64 s642 = 549755813888 :: Word64 s645 = 1099511627776 :: Word64 s648 = 2199023255552 :: Word64 s651 = 4398046511104 :: Word64 s654 = 8796093022208 :: Word64 s657 = 17592186044416 :: Word64 s660 = 35184372088832 :: Word64 s663 = 70368744177664 :: Word64 s666 = 140737488355328 :: Word64 s669 = 281474976710656 :: Word64 s672 = 562949953421312 :: Word64 s675 = 1125899906842624 :: Word64 s678 = 2251799813685248 :: Word64 s681 = 4503599627370496 :: Word64 s684 = 9007199254740992 :: Word64 s687 = 18014398509481984 :: Word64 s690 = 36028797018963968 :: Word64 s693 = 72057594037927936 :: Word64 s696 = 144115188075855872 :: Word64 s699 = 288230376151711744 :: Word64 s702 = 576460752303423488 :: Word64 s705 = 1152921504606846976 :: Word64 s708 = 2305843009213693952 :: Word64 s711 = 4611686018427387904 :: Word64 s714 = 9223372036854775808 :: Word64 TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s4 :: SBool = s0 == s2 s5 :: SBool = s1 == s3 s6 :: SBool = s4 & s5 s7 :: SBool = ~ s6 s8 :: SBool = ~ s7 s10 :: SWord32 = s1 # s9 s11 :: SWord64 = s0 # s10 s12 :: SWord1 = choose [63:63] s11 s14 :: SBool = s12 /= s13 s15 :: SWord1 = choose [62:62] s11 s16 :: SBool = s13 /= s15 s17 :: SWord1 = choose [61:61] s11 s18 :: SBool = s13 /= s17 s19 :: SWord1 = choose [60:60] s11 s20 :: SBool = s13 /= s19 s21 :: SWord1 = choose [59:59] s11 s22 :: SBool = s13 /= s21 s23 :: SBool = ~ s22 s24 :: SBool = if s14 then s23 else s22 s25 :: SWord1 = choose [58:58] s11 s26 :: SBool = s13 /= s25 s27 :: SBool = ~ s26 s28 :: SBool = if s16 then s27 else s26 s29 :: SWord1 = choose [57:57] s11 s30 :: SBool = s13 /= s29 s31 :: SBool = ~ s30 s32 :: SBool = if s18 then s31 else s30 s33 :: SWord1 = choose [56:56] s11 s34 :: SBool = s13 /= s33 s35 :: SBool = ~ s34 s36 :: SBool = if s20 then s35 else s34 s37 :: SWord1 = choose [55:55] s11 s38 :: SBool = s13 /= s37 s39 :: SBool = ~ s38 s40 :: SBool = if s24 then s39 else s38 s41 :: SWord1 = choose [54:54] s11 s42 :: SBool = s13 /= s41 s43 :: SBool = ~ s42 s44 :: SBool = if s28 then s43 else s42 s45 :: SWord1 = choose [53:53] s11 s46 :: SBool = s13 /= s45 s47 :: SBool = ~ s46 s48 :: SBool = if s32 then s47 else s46 s49 :: SWord1 = choose [52:52] s11 s50 :: SBool = s13 /= s49 s51 :: SBool = ~ s50 s52 :: SBool = if s14 then s51 else s50 s53 :: SBool = ~ s52 s54 :: SBool = if s36 then s53 else s52 s55 :: SWord1 = choose [51:51] s11 s56 :: SBool = s13 /= s55 s57 :: SBool = ~ s56 s58 :: SBool = if s16 then s57 else s56 s59 :: SBool = ~ s58 s60 :: SBool = if s40 then s59 else s58 s61 :: SWord1 = choose [50:50] s11 s62 :: SBool = s13 /= s61 s63 :: SBool = ~ s62 s64 :: SBool = if s18 then s63 else s62 s65 :: SBool = ~ s64 s66 :: SBool = if s44 then s65 else s64 s67 :: SWord1 = choose [49:49] s11 s68 :: SBool = s13 /= s67 s69 :: SBool = ~ s68 s70 :: SBool = if s20 then s69 else s68 s71 :: SBool = ~ s70 s72 :: SBool = if s48 then s71 else s70 s73 :: SWord1 = choose [48:48] s11 s74 :: SBool = s13 /= s73 s75 :: SBool = ~ s74 s76 :: SBool = if s24 then s75 else s74 s77 :: SBool = ~ s76 s78 :: SBool = if s54 then s77 else s76 s79 :: SWord1 = choose [47:47] s11 s80 :: SBool = s13 /= s79 s81 :: SBool = ~ s80 s82 :: SBool = if s14 then s81 else s80 s83 :: SBool = ~ s82 s84 :: SBool = if s28 then s83 else s82 s85 :: SBool = ~ s84 s86 :: SBool = if s60 then s85 else s84 s87 :: SWord1 = choose [46:46] s11 s88 :: SBool = s13 /= s87 s89 :: SBool = ~ s88 s90 :: SBool = if s16 then s89 else s88 s91 :: SBool = ~ s90 s92 :: SBool = if s32 then s91 else s90 s93 :: SBool = ~ s92 s94 :: SBool = if s66 then s93 else s92 s95 :: SWord1 = choose [45:45] s11 s96 :: SBool = s13 /= s95 s97 :: SBool = ~ s96 s98 :: SBool = if s18 then s97 else s96 s99 :: SBool = ~ s98 s100 :: SBool = if s36 then s99 else s98 s101 :: SBool = ~ s100 s102 :: SBool = if s72 then s101 else s100 s103 :: SWord1 = choose [44:44] s11 s104 :: SBool = s13 /= s103 s105 :: SBool = ~ s104 s106 :: SBool = if s20 then s105 else s104 s107 :: SBool = ~ s106 s108 :: SBool = if s40 then s107 else s106 s109 :: SBool = ~ s108 s110 :: SBool = if s78 then s109 else s108 s111 :: SWord1 = choose [43:43] s11 s112 :: SBool = s13 /= s111 s113 :: SBool = ~ s112 s114 :: SBool = if s24 then s113 else s112 s115 :: SBool = ~ s114 s116 :: SBool = if s44 then s115 else s114 s117 :: SBool = ~ s116 s118 :: SBool = if s86 then s117 else s116 s119 :: SWord1 = choose [42:42] s11 s120 :: SBool = s13 /= s119 s121 :: SBool = ~ s120 s122 :: SBool = if s28 then s121 else s120 s123 :: SBool = ~ s122 s124 :: SBool = if s48 then s123 else s122 s125 :: SBool = ~ s124 s126 :: SBool = if s94 then s125 else s124 s127 :: SWord1 = choose [41:41] s11 s128 :: SBool = s13 /= s127 s129 :: SBool = ~ s128 s130 :: SBool = if s32 then s129 else s128 s131 :: SBool = ~ s130 s132 :: SBool = if s54 then s131 else s130 s133 :: SBool = ~ s132 s134 :: SBool = if s102 then s133 else s132 s135 :: SWord1 = choose [40:40] s11 s136 :: SBool = s13 /= s135 s137 :: SBool = ~ s136 s138 :: SBool = if s36 then s137 else s136 s139 :: SBool = ~ s138 s140 :: SBool = if s60 then s139 else s138 s141 :: SBool = ~ s140 s142 :: SBool = if s110 then s141 else s140 s143 :: SWord1 = choose [39:39] s11 s144 :: SBool = s13 /= s143 s145 :: SBool = ~ s144 s146 :: SBool = if s40 then s145 else s144 s147 :: SBool = ~ s146 s148 :: SBool = if s66 then s147 else s146 s149 :: SBool = ~ s148 s150 :: SBool = if s118 then s149 else s148 s151 :: SWord1 = choose [38:38] s11 s152 :: SBool = s13 /= s151 s153 :: SBool = ~ s152 s154 :: SBool = if s44 then s153 else s152 s155 :: SBool = ~ s154 s156 :: SBool = if s72 then s155 else s154 s157 :: SBool = ~ s156 s158 :: SBool = if s126 then s157 else s156 s159 :: SWord1 = choose [37:37] s11 s160 :: SBool = s13 /= s159 s161 :: SBool = ~ s160 s162 :: SBool = if s48 then s161 else s160 s163 :: SBool = ~ s162 s164 :: SBool = if s78 then s163 else s162 s165 :: SBool = ~ s164 s166 :: SBool = if s134 then s165 else s164 s167 :: SWord1 = choose [36:36] s11 s168 :: SBool = s13 /= s167 s169 :: SBool = ~ s168 s170 :: SBool = if s54 then s169 else s168 s171 :: SBool = ~ s170 s172 :: SBool = if s86 then s171 else s170 s173 :: SBool = ~ s172 s174 :: SBool = if s142 then s173 else s172 s175 :: SWord1 = choose [35:35] s11 s176 :: SBool = s13 /= s175 s177 :: SBool = ~ s176 s178 :: SBool = if s60 then s177 else s176 s179 :: SBool = ~ s178 s180 :: SBool = if s94 then s179 else s178 s181 :: SBool = ~ s180 s182 :: SBool = if s150 then s181 else s180 s183 :: SWord1 = choose [34:34] s11 s184 :: SBool = s13 /= s183 s185 :: SBool = ~ s184 s186 :: SBool = if s66 then s185 else s184 s187 :: SBool = ~ s186 s188 :: SBool = if s102 then s187 else s186 s189 :: SBool = ~ s188 s190 :: SBool = if s158 then s189 else s188 s191 :: SWord1 = choose [33:33] s11 s192 :: SBool = s13 /= s191 s193 :: SBool = ~ s192 s194 :: SBool = if s72 then s193 else s192 s195 :: SBool = ~ s194 s196 :: SBool = if s110 then s195 else s194 s197 :: SBool = ~ s196 s198 :: SBool = if s166 then s197 else s196 s199 :: SWord1 = choose [32:32] s11 s200 :: SBool = s13 /= s199 s201 :: SBool = ~ s200 s202 :: SBool = if s78 then s201 else s200 s203 :: SBool = ~ s202 s204 :: SBool = if s118 then s203 else s202 s205 :: SBool = ~ s204 s206 :: SBool = if s174 then s205 else s204 s207 :: SWord1 = choose [31:31] s11 s208 :: SBool = s13 /= s207 s209 :: SBool = ~ s208 s210 :: SBool = if s86 then s209 else s208 s211 :: SBool = ~ s210 s212 :: SBool = if s126 then s211 else s210 s213 :: SBool = ~ s212 s214 :: SBool = if s182 then s213 else s212 s215 :: SWord1 = choose [30:30] s11 s216 :: SBool = s13 /= s215 s217 :: SBool = ~ s216 s218 :: SBool = if s94 then s217 else s216 s219 :: SBool = ~ s218 s220 :: SBool = if s134 then s219 else s218 s221 :: SBool = ~ s220 s222 :: SBool = if s190 then s221 else s220 s223 :: SWord1 = choose [29:29] s11 s224 :: SBool = s13 /= s223 s225 :: SBool = ~ s224 s226 :: SBool = if s102 then s225 else s224 s227 :: SBool = ~ s226 s228 :: SBool = if s142 then s227 else s226 s229 :: SBool = ~ s228 s230 :: SBool = if s198 then s229 else s228 s231 :: SWord1 = choose [28:28] s11 s232 :: SBool = s13 /= s231 s233 :: SBool = ~ s232 s234 :: SBool = if s110 then s233 else s232 s235 :: SBool = ~ s234 s236 :: SBool = if s150 then s235 else s234 s237 :: SBool = ~ s236 s238 :: SBool = if s206 then s237 else s236 s239 :: SWord1 = choose [27:27] s11 s240 :: SBool = s13 /= s239 s241 :: SBool = ~ s240 s242 :: SBool = if s118 then s241 else s240 s243 :: SBool = ~ s242 s244 :: SBool = if s158 then s243 else s242 s245 :: SBool = ~ s244 s246 :: SBool = if s214 then s245 else s244 s247 :: SWord1 = choose [26:26] s11 s248 :: SBool = s13 /= s247 s249 :: SBool = ~ s248 s250 :: SBool = if s126 then s249 else s248 s251 :: SBool = ~ s250 s252 :: SBool = if s166 then s251 else s250 s253 :: SBool = ~ s252 s254 :: SBool = if s222 then s253 else s252 s255 :: SWord1 = choose [25:25] s11 s256 :: SBool = s13 /= s255 s257 :: SBool = ~ s256 s258 :: SBool = if s134 then s257 else s256 s259 :: SBool = ~ s258 s260 :: SBool = if s174 then s259 else s258 s261 :: SBool = ~ s260 s262 :: SBool = if s230 then s261 else s260 s263 :: SWord1 = choose [24:24] s11 s264 :: SBool = s13 /= s263 s265 :: SBool = ~ s264 s266 :: SBool = if s142 then s265 else s264 s267 :: SBool = ~ s266 s268 :: SBool = if s182 then s267 else s266 s269 :: SBool = ~ s268 s270 :: SBool = if s238 then s269 else s268 s271 :: SWord1 = choose [23:23] s11 s272 :: SBool = s13 /= s271 s273 :: SBool = ~ s272 s274 :: SBool = if s150 then s273 else s272 s275 :: SBool = ~ s274 s276 :: SBool = if s190 then s275 else s274 s277 :: SBool = ~ s276 s278 :: SBool = if s246 then s277 else s276 s279 :: SWord1 = choose [22:22] s11 s280 :: SBool = s13 /= s279 s281 :: SBool = ~ s280 s282 :: SBool = if s158 then s281 else s280 s283 :: SBool = ~ s282 s284 :: SBool = if s198 then s283 else s282 s285 :: SBool = ~ s284 s286 :: SBool = if s254 then s285 else s284 s287 :: SWord1 = choose [21:21] s11 s288 :: SBool = s13 /= s287 s289 :: SBool = ~ s288 s290 :: SBool = if s166 then s289 else s288 s291 :: SBool = ~ s290 s292 :: SBool = if s206 then s291 else s290 s293 :: SBool = ~ s292 s294 :: SBool = if s262 then s293 else s292 s295 :: SWord1 = choose [20:20] s11 s296 :: SBool = s13 /= s295 s297 :: SBool = ~ s296 s298 :: SBool = if s174 then s297 else s296 s299 :: SBool = ~ s298 s300 :: SBool = if s214 then s299 else s298 s301 :: SBool = ~ s300 s302 :: SBool = if s270 then s301 else s300 s303 :: SWord1 = choose [19:19] s11 s304 :: SBool = s13 /= s303 s305 :: SBool = ~ s304 s306 :: SBool = if s182 then s305 else s304 s307 :: SBool = ~ s306 s308 :: SBool = if s222 then s307 else s306 s309 :: SBool = ~ s308 s310 :: SBool = if s278 then s309 else s308 s311 :: SWord1 = choose [18:18] s11 s312 :: SBool = s13 /= s311 s313 :: SBool = ~ s312 s314 :: SBool = if s190 then s313 else s312 s315 :: SBool = ~ s314 s316 :: SBool = if s230 then s315 else s314 s317 :: SBool = ~ s316 s318 :: SBool = if s286 then s317 else s316 s319 :: SWord1 = choose [17:17] s11 s320 :: SBool = s13 /= s319 s321 :: SBool = ~ s320 s322 :: SBool = if s198 then s321 else s320 s323 :: SBool = ~ s322 s324 :: SBool = if s238 then s323 else s322 s325 :: SBool = ~ s324 s326 :: SBool = if s294 then s325 else s324 s327 :: SWord1 = choose [16:16] s11 s328 :: SBool = s13 /= s327 s329 :: SBool = ~ s328 s330 :: SBool = if s206 then s329 else s328 s331 :: SBool = ~ s330 s332 :: SBool = if s246 then s331 else s330 s333 :: SBool = ~ s332 s334 :: SBool = if s302 then s333 else s332 s335 :: SBool = ~ s14 s336 :: SBool = if s14 then s335 else s14 s337 :: SBool = ~ s16 s338 :: SBool = if s16 then s337 else s16 s339 :: SBool = ~ s18 s340 :: SBool = if s18 then s339 else s18 s341 :: SBool = ~ s20 s342 :: SBool = if s20 then s341 else s20 s343 :: SBool = ~ s24 s344 :: SBool = if s24 then s343 else s24 s345 :: SBool = ~ s28 s346 :: SBool = if s28 then s345 else s28 s347 :: SBool = ~ s32 s348 :: SBool = if s32 then s347 else s32 s349 :: SBool = ~ s36 s350 :: SBool = if s36 then s349 else s36 s351 :: SBool = ~ s40 s352 :: SBool = if s40 then s351 else s40 s353 :: SBool = ~ s44 s354 :: SBool = if s44 then s353 else s44 s355 :: SBool = ~ s48 s356 :: SBool = if s48 then s355 else s48 s357 :: SBool = ~ s54 s358 :: SBool = if s54 then s357 else s54 s359 :: SBool = ~ s60 s360 :: SBool = if s60 then s359 else s60 s361 :: SBool = ~ s66 s362 :: SBool = if s66 then s361 else s66 s363 :: SBool = ~ s72 s364 :: SBool = if s72 then s363 else s72 s365 :: SBool = ~ s78 s366 :: SBool = if s78 then s365 else s78 s367 :: SBool = ~ s86 s368 :: SBool = if s86 then s367 else s86 s369 :: SBool = ~ s94 s370 :: SBool = if s94 then s369 else s94 s371 :: SBool = ~ s102 s372 :: SBool = if s102 then s371 else s102 s373 :: SBool = ~ s110 s374 :: SBool = if s110 then s373 else s110 s375 :: SBool = ~ s118 s376 :: SBool = if s118 then s375 else s118 s377 :: SBool = ~ s126 s378 :: SBool = if s126 then s377 else s126 s379 :: SBool = ~ s134 s380 :: SBool = if s134 then s379 else s134 s381 :: SBool = ~ s142 s382 :: SBool = if s142 then s381 else s142 s383 :: SBool = ~ s150 s384 :: SBool = if s150 then s383 else s150 s385 :: SBool = ~ s158 s386 :: SBool = if s158 then s385 else s158 s387 :: SBool = ~ s166 s388 :: SBool = if s166 then s387 else s166 s389 :: SBool = ~ s174 s390 :: SBool = if s174 then s389 else s174 s391 :: SBool = ~ s182 s392 :: SBool = if s182 then s391 else s182 s393 :: SBool = ~ s190 s394 :: SBool = if s190 then s393 else s190 s395 :: SBool = ~ s198 s396 :: SBool = if s198 then s395 else s198 s397 :: SBool = ~ s206 s398 :: SBool = if s206 then s397 else s206 s399 :: SBool = ~ s214 s400 :: SBool = if s214 then s399 else s214 s401 :: SBool = ~ s222 s402 :: SBool = if s222 then s401 else s222 s403 :: SBool = ~ s230 s404 :: SBool = if s230 then s403 else s230 s405 :: SBool = ~ s238 s406 :: SBool = if s238 then s405 else s238 s407 :: SBool = ~ s246 s408 :: SBool = if s246 then s407 else s246 s409 :: SBool = ~ s254 s410 :: SBool = if s254 then s409 else s254 s411 :: SBool = ~ s262 s412 :: SBool = if s262 then s411 else s262 s413 :: SBool = ~ s270 s414 :: SBool = if s270 then s413 else s270 s415 :: SBool = ~ s278 s416 :: SBool = if s278 then s415 else s278 s417 :: SBool = ~ s286 s418 :: SBool = if s286 then s417 else s286 s419 :: SBool = ~ s294 s420 :: SBool = if s294 then s419 else s294 s421 :: SBool = ~ s302 s422 :: SBool = if s302 then s421 else s302 s423 :: SBool = ~ s310 s424 :: SBool = if s310 then s423 else s310 s425 :: SBool = ~ s318 s426 :: SBool = if s318 then s425 else s318 s427 :: SBool = ~ s326 s428 :: SBool = if s326 then s427 else s326 s429 :: SBool = ~ s334 s430 :: SBool = if s334 then s429 else s334 s431 :: SWord1 = choose [15:15] s11 s432 :: SBool = s13 /= s431 s433 :: SBool = ~ s432 s434 :: SBool = if s214 then s433 else s432 s435 :: SBool = ~ s434 s436 :: SBool = if s254 then s435 else s434 s437 :: SBool = ~ s436 s438 :: SBool = if s310 then s437 else s436 s439 :: SWord1 = choose [14:14] s11 s440 :: SBool = s13 /= s439 s441 :: SBool = ~ s440 s442 :: SBool = if s222 then s441 else s440 s443 :: SBool = ~ s442 s444 :: SBool = if s262 then s443 else s442 s445 :: SBool = ~ s444 s446 :: SBool = if s318 then s445 else s444 s447 :: SWord1 = choose [13:13] s11 s448 :: SBool = s13 /= s447 s449 :: SBool = ~ s448 s450 :: SBool = if s230 then s449 else s448 s451 :: SBool = ~ s450 s452 :: SBool = if s270 then s451 else s450 s453 :: SBool = ~ s452 s454 :: SBool = if s326 then s453 else s452 s455 :: SWord1 = choose [12:12] s11 s456 :: SBool = s13 /= s455 s457 :: SBool = ~ s456 s458 :: SBool = if s238 then s457 else s456 s459 :: SBool = ~ s458 s460 :: SBool = if s278 then s459 else s458 s461 :: SBool = ~ s460 s462 :: SBool = if s334 then s461 else s460 s463 :: SWord1 = choose [11:11] s11 s464 :: SBool = s13 /= s463 s465 :: SBool = ~ s464 s466 :: SBool = if s246 then s465 else s464 s467 :: SBool = ~ s466 s468 :: SBool = if s286 then s467 else s466 s469 :: SWord1 = choose [10:10] s11 s470 :: SBool = s13 /= s469 s471 :: SBool = ~ s470 s472 :: SBool = if s254 then s471 else s470 s473 :: SBool = ~ s472 s474 :: SBool = if s294 then s473 else s472 s475 :: SWord1 = choose [9:9] s11 s476 :: SBool = s13 /= s475 s477 :: SBool = ~ s476 s478 :: SBool = if s262 then s477 else s476 s479 :: SBool = ~ s478 s480 :: SBool = if s302 then s479 else s478 s481 :: SWord1 = choose [8:8] s11 s482 :: SBool = s13 /= s481 s483 :: SBool = ~ s482 s484 :: SBool = if s270 then s483 else s482 s485 :: SBool = ~ s484 s486 :: SBool = if s310 then s485 else s484 s487 :: SWord1 = choose [7:7] s11 s488 :: SBool = s13 /= s487 s489 :: SBool = ~ s488 s490 :: SBool = if s278 then s489 else s488 s491 :: SBool = ~ s490 s492 :: SBool = if s318 then s491 else s490 s493 :: SWord1 = choose [6:6] s11 s494 :: SBool = s13 /= s493 s495 :: SBool = ~ s494 s496 :: SBool = if s286 then s495 else s494 s497 :: SBool = ~ s496 s498 :: SBool = if s326 then s497 else s496 s499 :: SWord1 = choose [5:5] s11 s500 :: SBool = s13 /= s499 s501 :: SBool = ~ s500 s502 :: SBool = if s294 then s501 else s500 s503 :: SBool = ~ s502 s504 :: SBool = if s334 then s503 else s502 s505 :: SWord1 = choose [4:4] s11 s506 :: SBool = s13 /= s505 s507 :: SBool = ~ s506 s508 :: SBool = if s302 then s507 else s506 s509 :: SWord1 = choose [3:3] s11 s510 :: SBool = s13 /= s509 s511 :: SBool = ~ s510 s512 :: SBool = if s310 then s511 else s510 s513 :: SWord1 = choose [2:2] s11 s514 :: SBool = s13 /= s513 s515 :: SBool = ~ s514 s516 :: SBool = if s318 then s515 else s514 s517 :: SWord1 = choose [1:1] s11 s518 :: SBool = s13 /= s517 s519 :: SBool = ~ s518 s520 :: SBool = if s326 then s519 else s518 s521 :: SWord1 = choose [0:0] s11 s522 :: SBool = s13 /= s521 s523 :: SBool = ~ s522 s524 :: SBool = if s334 then s523 else s522 s527 :: SWord64 = if s524 then s525 else s526 s529 :: SWord64 = s527 | s528 s530 :: SWord64 = if s520 then s529 else s527 s532 :: SWord64 = s530 | s531 s533 :: SWord64 = if s516 then s532 else s530 s535 :: SWord64 = s533 | s534 s536 :: SWord64 = if s512 then s535 else s533 s538 :: SWord64 = s536 | s537 s539 :: SWord64 = if s508 then s538 else s536 s541 :: SWord64 = s539 | s540 s542 :: SWord64 = if s504 then s541 else s539 s544 :: SWord64 = s542 | s543 s545 :: SWord64 = if s498 then s544 else s542 s547 :: SWord64 = s545 | s546 s548 :: SWord64 = if s492 then s547 else s545 s550 :: SWord64 = s548 | s549 s551 :: SWord64 = if s486 then s550 else s548 s553 :: SWord64 = s551 | s552 s554 :: SWord64 = if s480 then s553 else s551 s556 :: SWord64 = s554 | s555 s557 :: SWord64 = if s474 then s556 else s554 s559 :: SWord64 = s557 | s558 s560 :: SWord64 = if s468 then s559 else s557 s562 :: SWord64 = s560 | s561 s563 :: SWord64 = if s462 then s562 else s560 s565 :: SWord64 = s563 | s564 s566 :: SWord64 = if s454 then s565 else s563 s568 :: SWord64 = s566 | s567 s569 :: SWord64 = if s446 then s568 else s566 s571 :: SWord64 = s569 | s570 s572 :: SWord64 = if s438 then s571 else s569 s574 :: SWord64 = s572 | s573 s575 :: SWord64 = if s430 then s574 else s572 s577 :: SWord64 = s575 | s576 s578 :: SWord64 = if s428 then s577 else s575 s580 :: SWord64 = s578 | s579 s581 :: SWord64 = if s426 then s580 else s578 s583 :: SWord64 = s581 | s582 s584 :: SWord64 = if s424 then s583 else s581 s586 :: SWord64 = s584 | s585 s587 :: SWord64 = if s422 then s586 else s584 s589 :: SWord64 = s587 | s588 s590 :: SWord64 = if s420 then s589 else s587 s592 :: SWord64 = s590 | s591 s593 :: SWord64 = if s418 then s592 else s590 s595 :: SWord64 = s593 | s594 s596 :: SWord64 = if s416 then s595 else s593 s598 :: SWord64 = s596 | s597 s599 :: SWord64 = if s414 then s598 else s596 s601 :: SWord64 = s599 | s600 s602 :: SWord64 = if s412 then s601 else s599 s604 :: SWord64 = s602 | s603 s605 :: SWord64 = if s410 then s604 else s602 s607 :: SWord64 = s605 | s606 s608 :: SWord64 = if s408 then s607 else s605 s610 :: SWord64 = s608 | s609 s611 :: SWord64 = if s406 then s610 else s608 s613 :: SWord64 = s611 | s612 s614 :: SWord64 = if s404 then s613 else s611 s616 :: SWord64 = s614 | s615 s617 :: SWord64 = if s402 then s616 else s614 s619 :: SWord64 = s617 | s618 s620 :: SWord64 = if s400 then s619 else s617 s622 :: SWord64 = s620 | s621 s623 :: SWord64 = if s398 then s622 else s620 s625 :: SWord64 = s623 | s624 s626 :: SWord64 = if s396 then s625 else s623 s628 :: SWord64 = s626 | s627 s629 :: SWord64 = if s394 then s628 else s626 s631 :: SWord64 = s629 | s630 s632 :: SWord64 = if s392 then s631 else s629 s634 :: SWord64 = s632 | s633 s635 :: SWord64 = if s390 then s634 else s632 s637 :: SWord64 = s635 | s636 s638 :: SWord64 = if s388 then s637 else s635 s640 :: SWord64 = s638 | s639 s641 :: SWord64 = if s386 then s640 else s638 s643 :: SWord64 = s641 | s642 s644 :: SWord64 = if s384 then s643 else s641 s646 :: SWord64 = s644 | s645 s647 :: SWord64 = if s382 then s646 else s644 s649 :: SWord64 = s647 | s648 s650 :: SWord64 = if s380 then s649 else s647 s652 :: SWord64 = s650 | s651 s653 :: SWord64 = if s378 then s652 else s650 s655 :: SWord64 = s653 | s654 s656 :: SWord64 = if s376 then s655 else s653 s658 :: SWord64 = s656 | s657 s659 :: SWord64 = if s374 then s658 else s656 s661 :: SWord64 = s659 | s660 s662 :: SWord64 = if s372 then s661 else s659 s664 :: SWord64 = s662 | s663 s665 :: SWord64 = if s370 then s664 else s662 s667 :: SWord64 = s665 | s666 s668 :: SWord64 = if s368 then s667 else s665 s670 :: SWord64 = s668 | s669 s671 :: SWord64 = if s366 then s670 else s668 s673 :: SWord64 = s671 | s672 s674 :: SWord64 = if s364 then s673 else s671 s676 :: SWord64 = s674 | s675 s677 :: SWord64 = if s362 then s676 else s674 s679 :: SWord64 = s677 | s678 s680 :: SWord64 = if s360 then s679 else s677 s682 :: SWord64 = s680 | s681 s683 :: SWord64 = if s358 then s682 else s680 s685 :: SWord64 = s683 | s684 s686 :: SWord64 = if s356 then s685 else s683 s688 :: SWord64 = s686 | s687 s689 :: SWord64 = if s354 then s688 else s686 s691 :: SWord64 = s689 | s690 s692 :: SWord64 = if s352 then s691 else s689 s694 :: SWord64 = s692 | s693 s695 :: SWord64 = if s350 then s694 else s692 s697 :: SWord64 = s695 | s696 s698 :: SWord64 = if s348 then s697 else s695 s700 :: SWord64 = s698 | s699 s701 :: SWord64 = if s346 then s700 else s698 s703 :: SWord64 = s701 | s702 s704 :: SWord64 = if s344 then s703 else s701 s706 :: SWord64 = s704 | s705 s707 :: SWord64 = if s342 then s706 else s704 s709 :: SWord64 = s707 | s708 s710 :: SWord64 = if s340 then s709 else s707 s712 :: SWord64 = s710 | s711 s713 :: SWord64 = if s338 then s712 else s710 s715 :: SWord64 = s713 | s714 s716 :: SWord64 = if s336 then s715 else s713 s717 :: SWord32 = choose [31:0] s716 s718 :: SWord16 = choose [15:0] s717 s719 :: SWord32 = s1 # s718 s720 :: SWord64 = s0 # s719 s721 :: SWord1 = choose [0:0] s720 s722 :: SBool = s13 /= s721 s723 :: SWord32 = s3 # s9 s724 :: SWord64 = s2 # s723 s725 :: SWord1 = choose [63:63] s724 s726 :: SBool = s13 /= s725 s727 :: SWord1 = choose [62:62] s724 s728 :: SBool = s13 /= s727 s729 :: SWord1 = choose [61:61] s724 s730 :: SBool = s13 /= s729 s731 :: SWord1 = choose [60:60] s724 s732 :: SBool = s13 /= s731 s733 :: SWord1 = choose [59:59] s724 s734 :: SBool = s13 /= s733 s735 :: SBool = ~ s734 s736 :: SBool = if s726 then s735 else s734 s737 :: SWord1 = choose [58:58] s724 s738 :: SBool = s13 /= s737 s739 :: SBool = ~ s738 s740 :: SBool = if s728 then s739 else s738 s741 :: SWord1 = choose [57:57] s724 s742 :: SBool = s13 /= s741 s743 :: SBool = ~ s742 s744 :: SBool = if s730 then s743 else s742 s745 :: SWord1 = choose [56:56] s724 s746 :: SBool = s13 /= s745 s747 :: SBool = ~ s746 s748 :: SBool = if s732 then s747 else s746 s749 :: SWord1 = choose [55:55] s724 s750 :: SBool = s13 /= s749 s751 :: SBool = ~ s750 s752 :: SBool = if s736 then s751 else s750 s753 :: SWord1 = choose [54:54] s724 s754 :: SBool = s13 /= s753 s755 :: SBool = ~ s754 s756 :: SBool = if s740 then s755 else s754 s757 :: SWord1 = choose [53:53] s724 s758 :: SBool = s13 /= s757 s759 :: SBool = ~ s758 s760 :: SBool = if s744 then s759 else s758 s761 :: SWord1 = choose [52:52] s724 s762 :: SBool = s13 /= s761 s763 :: SBool = ~ s762 s764 :: SBool = if s726 then s763 else s762 s765 :: SBool = ~ s764 s766 :: SBool = if s748 then s765 else s764 s767 :: SWord1 = choose [51:51] s724 s768 :: SBool = s13 /= s767 s769 :: SBool = ~ s768 s770 :: SBool = if s728 then s769 else s768 s771 :: SBool = ~ s770 s772 :: SBool = if s752 then s771 else s770 s773 :: SWord1 = choose [50:50] s724 s774 :: SBool = s13 /= s773 s775 :: SBool = ~ s774 s776 :: SBool = if s730 then s775 else s774 s777 :: SBool = ~ s776 s778 :: SBool = if s756 then s777 else s776 s779 :: SWord1 = choose [49:49] s724 s780 :: SBool = s13 /= s779 s781 :: SBool = ~ s780 s782 :: SBool = if s732 then s781 else s780 s783 :: SBool = ~ s782 s784 :: SBool = if s760 then s783 else s782 s785 :: SWord1 = choose [48:48] s724 s786 :: SBool = s13 /= s785 s787 :: SBool = ~ s786 s788 :: SBool = if s736 then s787 else s786 s789 :: SBool = ~ s788 s790 :: SBool = if s766 then s789 else s788 s791 :: SWord1 = choose [47:47] s724 s792 :: SBool = s13 /= s791 s793 :: SBool = ~ s792 s794 :: SBool = if s726 then s793 else s792 s795 :: SBool = ~ s794 s796 :: SBool = if s740 then s795 else s794 s797 :: SBool = ~ s796 s798 :: SBool = if s772 then s797 else s796 s799 :: SWord1 = choose [46:46] s724 s800 :: SBool = s13 /= s799 s801 :: SBool = ~ s800 s802 :: SBool = if s728 then s801 else s800 s803 :: SBool = ~ s802 s804 :: SBool = if s744 then s803 else s802 s805 :: SBool = ~ s804 s806 :: SBool = if s778 then s805 else s804 s807 :: SWord1 = choose [45:45] s724 s808 :: SBool = s13 /= s807 s809 :: SBool = ~ s808 s810 :: SBool = if s730 then s809 else s808 s811 :: SBool = ~ s810 s812 :: SBool = if s748 then s811 else s810 s813 :: SBool = ~ s812 s814 :: SBool = if s784 then s813 else s812 s815 :: SWord1 = choose [44:44] s724 s816 :: SBool = s13 /= s815 s817 :: SBool = ~ s816 s818 :: SBool = if s732 then s817 else s816 s819 :: SBool = ~ s818 s820 :: SBool = if s752 then s819 else s818 s821 :: SBool = ~ s820 s822 :: SBool = if s790 then s821 else s820 s823 :: SWord1 = choose [43:43] s724 s824 :: SBool = s13 /= s823 s825 :: SBool = ~ s824 s826 :: SBool = if s736 then s825 else s824 s827 :: SBool = ~ s826 s828 :: SBool = if s756 then s827 else s826 s829 :: SBool = ~ s828 s830 :: SBool = if s798 then s829 else s828 s831 :: SWord1 = choose [42:42] s724 s832 :: SBool = s13 /= s831 s833 :: SBool = ~ s832 s834 :: SBool = if s740 then s833 else s832 s835 :: SBool = ~ s834 s836 :: SBool = if s760 then s835 else s834 s837 :: SBool = ~ s836 s838 :: SBool = if s806 then s837 else s836 s839 :: SWord1 = choose [41:41] s724 s840 :: SBool = s13 /= s839 s841 :: SBool = ~ s840 s842 :: SBool = if s744 then s841 else s840 s843 :: SBool = ~ s842 s844 :: SBool = if s766 then s843 else s842 s845 :: SBool = ~ s844 s846 :: SBool = if s814 then s845 else s844 s847 :: SWord1 = choose [40:40] s724 s848 :: SBool = s13 /= s847 s849 :: SBool = ~ s848 s850 :: SBool = if s748 then s849 else s848 s851 :: SBool = ~ s850 s852 :: SBool = if s772 then s851 else s850 s853 :: SBool = ~ s852 s854 :: SBool = if s822 then s853 else s852 s855 :: SWord1 = choose [39:39] s724 s856 :: SBool = s13 /= s855 s857 :: SBool = ~ s856 s858 :: SBool = if s752 then s857 else s856 s859 :: SBool = ~ s858 s860 :: SBool = if s778 then s859 else s858 s861 :: SBool = ~ s860 s862 :: SBool = if s830 then s861 else s860 s863 :: SWord1 = choose [38:38] s724 s864 :: SBool = s13 /= s863 s865 :: SBool = ~ s864 s866 :: SBool = if s756 then s865 else s864 s867 :: SBool = ~ s866 s868 :: SBool = if s784 then s867 else s866 s869 :: SBool = ~ s868 s870 :: SBool = if s838 then s869 else s868 s871 :: SWord1 = choose [37:37] s724 s872 :: SBool = s13 /= s871 s873 :: SBool = ~ s872 s874 :: SBool = if s760 then s873 else s872 s875 :: SBool = ~ s874 s876 :: SBool = if s790 then s875 else s874 s877 :: SBool = ~ s876 s878 :: SBool = if s846 then s877 else s876 s879 :: SWord1 = choose [36:36] s724 s880 :: SBool = s13 /= s879 s881 :: SBool = ~ s880 s882 :: SBool = if s766 then s881 else s880 s883 :: SBool = ~ s882 s884 :: SBool = if s798 then s883 else s882 s885 :: SBool = ~ s884 s886 :: SBool = if s854 then s885 else s884 s887 :: SWord1 = choose [35:35] s724 s888 :: SBool = s13 /= s887 s889 :: SBool = ~ s888 s890 :: SBool = if s772 then s889 else s888 s891 :: SBool = ~ s890 s892 :: SBool = if s806 then s891 else s890 s893 :: SBool = ~ s892 s894 :: SBool = if s862 then s893 else s892 s895 :: SWord1 = choose [34:34] s724 s896 :: SBool = s13 /= s895 s897 :: SBool = ~ s896 s898 :: SBool = if s778 then s897 else s896 s899 :: SBool = ~ s898 s900 :: SBool = if s814 then s899 else s898 s901 :: SBool = ~ s900 s902 :: SBool = if s870 then s901 else s900 s903 :: SWord1 = choose [33:33] s724 s904 :: SBool = s13 /= s903 s905 :: SBool = ~ s904 s906 :: SBool = if s784 then s905 else s904 s907 :: SBool = ~ s906 s908 :: SBool = if s822 then s907 else s906 s909 :: SBool = ~ s908 s910 :: SBool = if s878 then s909 else s908 s911 :: SWord1 = choose [32:32] s724 s912 :: SBool = s13 /= s911 s913 :: SBool = ~ s912 s914 :: SBool = if s790 then s913 else s912 s915 :: SBool = ~ s914 s916 :: SBool = if s830 then s915 else s914 s917 :: SBool = ~ s916 s918 :: SBool = if s886 then s917 else s916 s919 :: SWord1 = choose [31:31] s724 s920 :: SBool = s13 /= s919 s921 :: SBool = ~ s920 s922 :: SBool = if s798 then s921 else s920 s923 :: SBool = ~ s922 s924 :: SBool = if s838 then s923 else s922 s925 :: SBool = ~ s924 s926 :: SBool = if s894 then s925 else s924 s927 :: SWord1 = choose [30:30] s724 s928 :: SBool = s13 /= s927 s929 :: SBool = ~ s928 s930 :: SBool = if s806 then s929 else s928 s931 :: SBool = ~ s930 s932 :: SBool = if s846 then s931 else s930 s933 :: SBool = ~ s932 s934 :: SBool = if s902 then s933 else s932 s935 :: SWord1 = choose [29:29] s724 s936 :: SBool = s13 /= s935 s937 :: SBool = ~ s936 s938 :: SBool = if s814 then s937 else s936 s939 :: SBool = ~ s938 s940 :: SBool = if s854 then s939 else s938 s941 :: SBool = ~ s940 s942 :: SBool = if s910 then s941 else s940 s943 :: SWord1 = choose [28:28] s724 s944 :: SBool = s13 /= s943 s945 :: SBool = ~ s944 s946 :: SBool = if s822 then s945 else s944 s947 :: SBool = ~ s946 s948 :: SBool = if s862 then s947 else s946 s949 :: SBool = ~ s948 s950 :: SBool = if s918 then s949 else s948 s951 :: SWord1 = choose [27:27] s724 s952 :: SBool = s13 /= s951 s953 :: SBool = ~ s952 s954 :: SBool = if s830 then s953 else s952 s955 :: SBool = ~ s954 s956 :: SBool = if s870 then s955 else s954 s957 :: SBool = ~ s956 s958 :: SBool = if s926 then s957 else s956 s959 :: SWord1 = choose [26:26] s724 s960 :: SBool = s13 /= s959 s961 :: SBool = ~ s960 s962 :: SBool = if s838 then s961 else s960 s963 :: SBool = ~ s962 s964 :: SBool = if s878 then s963 else s962 s965 :: SBool = ~ s964 s966 :: SBool = if s934 then s965 else s964 s967 :: SWord1 = choose [25:25] s724 s968 :: SBool = s13 /= s967 s969 :: SBool = ~ s968 s970 :: SBool = if s846 then s969 else s968 s971 :: SBool = ~ s970 s972 :: SBool = if s886 then s971 else s970 s973 :: SBool = ~ s972 s974 :: SBool = if s942 then s973 else s972 s975 :: SWord1 = choose [24:24] s724 s976 :: SBool = s13 /= s975 s977 :: SBool = ~ s976 s978 :: SBool = if s854 then s977 else s976 s979 :: SBool = ~ s978 s980 :: SBool = if s894 then s979 else s978 s981 :: SBool = ~ s980 s982 :: SBool = if s950 then s981 else s980 s983 :: SWord1 = choose [23:23] s724 s984 :: SBool = s13 /= s983 s985 :: SBool = ~ s984 s986 :: SBool = if s862 then s985 else s984 s987 :: SBool = ~ s986 s988 :: SBool = if s902 then s987 else s986 s989 :: SBool = ~ s988 s990 :: SBool = if s958 then s989 else s988 s991 :: SWord1 = choose [22:22] s724 s992 :: SBool = s13 /= s991 s993 :: SBool = ~ s992 s994 :: SBool = if s870 then s993 else s992 s995 :: SBool = ~ s994 s996 :: SBool = if s910 then s995 else s994 s997 :: SBool = ~ s996 s998 :: SBool = if s966 then s997 else s996 s999 :: SWord1 = choose [21:21] s724 s1000 :: SBool = s13 /= s999 s1001 :: SBool = ~ s1000 s1002 :: SBool = if s878 then s1001 else s1000 s1003 :: SBool = ~ s1002 s1004 :: SBool = if s918 then s1003 else s1002 s1005 :: SBool = ~ s1004 s1006 :: SBool = if s974 then s1005 else s1004 s1007 :: SWord1 = choose [20:20] s724 s1008 :: SBool = s13 /= s1007 s1009 :: SBool = ~ s1008 s1010 :: SBool = if s886 then s1009 else s1008 s1011 :: SBool = ~ s1010 s1012 :: SBool = if s926 then s1011 else s1010 s1013 :: SBool = ~ s1012 s1014 :: SBool = if s982 then s1013 else s1012 s1015 :: SWord1 = choose [19:19] s724 s1016 :: SBool = s13 /= s1015 s1017 :: SBool = ~ s1016 s1018 :: SBool = if s894 then s1017 else s1016 s1019 :: SBool = ~ s1018 s1020 :: SBool = if s934 then s1019 else s1018 s1021 :: SBool = ~ s1020 s1022 :: SBool = if s990 then s1021 else s1020 s1023 :: SWord1 = choose [18:18] s724 s1024 :: SBool = s13 /= s1023 s1025 :: SBool = ~ s1024 s1026 :: SBool = if s902 then s1025 else s1024 s1027 :: SBool = ~ s1026 s1028 :: SBool = if s942 then s1027 else s1026 s1029 :: SBool = ~ s1028 s1030 :: SBool = if s998 then s1029 else s1028 s1031 :: SWord1 = choose [17:17] s724 s1032 :: SBool = s13 /= s1031 s1033 :: SBool = ~ s1032 s1034 :: SBool = if s910 then s1033 else s1032 s1035 :: SBool = ~ s1034 s1036 :: SBool = if s950 then s1035 else s1034 s1037 :: SBool = ~ s1036 s1038 :: SBool = if s1006 then s1037 else s1036 s1039 :: SWord1 = choose [16:16] s724 s1040 :: SBool = s13 /= s1039 s1041 :: SBool = ~ s1040 s1042 :: SBool = if s918 then s1041 else s1040 s1043 :: SBool = ~ s1042 s1044 :: SBool = if s958 then s1043 else s1042 s1045 :: SBool = ~ s1044 s1046 :: SBool = if s1014 then s1045 else s1044 s1047 :: SBool = ~ s726 s1048 :: SBool = if s726 then s1047 else s726 s1049 :: SBool = ~ s728 s1050 :: SBool = if s728 then s1049 else s728 s1051 :: SBool = ~ s730 s1052 :: SBool = if s730 then s1051 else s730 s1053 :: SBool = ~ s732 s1054 :: SBool = if s732 then s1053 else s732 s1055 :: SBool = ~ s736 s1056 :: SBool = if s736 then s1055 else s736 s1057 :: SBool = ~ s740 s1058 :: SBool = if s740 then s1057 else s740 s1059 :: SBool = ~ s744 s1060 :: SBool = if s744 then s1059 else s744 s1061 :: SBool = ~ s748 s1062 :: SBool = if s748 then s1061 else s748 s1063 :: SBool = ~ s752 s1064 :: SBool = if s752 then s1063 else s752 s1065 :: SBool = ~ s756 s1066 :: SBool = if s756 then s1065 else s756 s1067 :: SBool = ~ s760 s1068 :: SBool = if s760 then s1067 else s760 s1069 :: SBool = ~ s766 s1070 :: SBool = if s766 then s1069 else s766 s1071 :: SBool = ~ s772 s1072 :: SBool = if s772 then s1071 else s772 s1073 :: SBool = ~ s778 s1074 :: SBool = if s778 then s1073 else s778 s1075 :: SBool = ~ s784 s1076 :: SBool = if s784 then s1075 else s784 s1077 :: SBool = ~ s790 s1078 :: SBool = if s790 then s1077 else s790 s1079 :: SBool = ~ s798 s1080 :: SBool = if s798 then s1079 else s798 s1081 :: SBool = ~ s806 s1082 :: SBool = if s806 then s1081 else s806 s1083 :: SBool = ~ s814 s1084 :: SBool = if s814 then s1083 else s814 s1085 :: SBool = ~ s822 s1086 :: SBool = if s822 then s1085 else s822 s1087 :: SBool = ~ s830 s1088 :: SBool = if s830 then s1087 else s830 s1089 :: SBool = ~ s838 s1090 :: SBool = if s838 then s1089 else s838 s1091 :: SBool = ~ s846 s1092 :: SBool = if s846 then s1091 else s846 s1093 :: SBool = ~ s854 s1094 :: SBool = if s854 then s1093 else s854 s1095 :: SBool = ~ s862 s1096 :: SBool = if s862 then s1095 else s862 s1097 :: SBool = ~ s870 s1098 :: SBool = if s870 then s1097 else s870 s1099 :: SBool = ~ s878 s1100 :: SBool = if s878 then s1099 else s878 s1101 :: SBool = ~ s886 s1102 :: SBool = if s886 then s1101 else s886 s1103 :: SBool = ~ s894 s1104 :: SBool = if s894 then s1103 else s894 s1105 :: SBool = ~ s902 s1106 :: SBool = if s902 then s1105 else s902 s1107 :: SBool = ~ s910 s1108 :: SBool = if s910 then s1107 else s910 s1109 :: SBool = ~ s918 s1110 :: SBool = if s918 then s1109 else s918 s1111 :: SBool = ~ s926 s1112 :: SBool = if s926 then s1111 else s926 s1113 :: SBool = ~ s934 s1114 :: SBool = if s934 then s1113 else s934 s1115 :: SBool = ~ s942 s1116 :: SBool = if s942 then s1115 else s942 s1117 :: SBool = ~ s950 s1118 :: SBool = if s950 then s1117 else s950 s1119 :: SBool = ~ s958 s1120 :: SBool = if s958 then s1119 else s958 s1121 :: SBool = ~ s966 s1122 :: SBool = if s966 then s1121 else s966 s1123 :: SBool = ~ s974 s1124 :: SBool = if s974 then s1123 else s974 s1125 :: SBool = ~ s982 s1126 :: SBool = if s982 then s1125 else s982 s1127 :: SBool = ~ s990 s1128 :: SBool = if s990 then s1127 else s990 s1129 :: SBool = ~ s998 s1130 :: SBool = if s998 then s1129 else s998 s1131 :: SBool = ~ s1006 s1132 :: SBool = if s1006 then s1131 else s1006 s1133 :: SBool = ~ s1014 s1134 :: SBool = if s1014 then s1133 else s1014 s1135 :: SBool = ~ s1022 s1136 :: SBool = if s1022 then s1135 else s1022 s1137 :: SBool = ~ s1030 s1138 :: SBool = if s1030 then s1137 else s1030 s1139 :: SBool = ~ s1038 s1140 :: SBool = if s1038 then s1139 else s1038 s1141 :: SBool = ~ s1046 s1142 :: SBool = if s1046 then s1141 else s1046 s1143 :: SWord1 = choose [15:15] s724 s1144 :: SBool = s13 /= s1143 s1145 :: SBool = ~ s1144 s1146 :: SBool = if s926 then s1145 else s1144 s1147 :: SBool = ~ s1146 s1148 :: SBool = if s966 then s1147 else s1146 s1149 :: SBool = ~ s1148 s1150 :: SBool = if s1022 then s1149 else s1148 s1151 :: SWord1 = choose [14:14] s724 s1152 :: SBool = s13 /= s1151 s1153 :: SBool = ~ s1152 s1154 :: SBool = if s934 then s1153 else s1152 s1155 :: SBool = ~ s1154 s1156 :: SBool = if s974 then s1155 else s1154 s1157 :: SBool = ~ s1156 s1158 :: SBool = if s1030 then s1157 else s1156 s1159 :: SWord1 = choose [13:13] s724 s1160 :: SBool = s13 /= s1159 s1161 :: SBool = ~ s1160 s1162 :: SBool = if s942 then s1161 else s1160 s1163 :: SBool = ~ s1162 s1164 :: SBool = if s982 then s1163 else s1162 s1165 :: SBool = ~ s1164 s1166 :: SBool = if s1038 then s1165 else s1164 s1167 :: SWord1 = choose [12:12] s724 s1168 :: SBool = s13 /= s1167 s1169 :: SBool = ~ s1168 s1170 :: SBool = if s950 then s1169 else s1168 s1171 :: SBool = ~ s1170 s1172 :: SBool = if s990 then s1171 else s1170 s1173 :: SBool = ~ s1172 s1174 :: SBool = if s1046 then s1173 else s1172 s1175 :: SWord1 = choose [11:11] s724 s1176 :: SBool = s13 /= s1175 s1177 :: SBool = ~ s1176 s1178 :: SBool = if s958 then s1177 else s1176 s1179 :: SBool = ~ s1178 s1180 :: SBool = if s998 then s1179 else s1178 s1181 :: SWord1 = choose [10:10] s724 s1182 :: SBool = s13 /= s1181 s1183 :: SBool = ~ s1182 s1184 :: SBool = if s966 then s1183 else s1182 s1185 :: SBool = ~ s1184 s1186 :: SBool = if s1006 then s1185 else s1184 s1187 :: SWord1 = choose [9:9] s724 s1188 :: SBool = s13 /= s1187 s1189 :: SBool = ~ s1188 s1190 :: SBool = if s974 then s1189 else s1188 s1191 :: SBool = ~ s1190 s1192 :: SBool = if s1014 then s1191 else s1190 s1193 :: SWord1 = choose [8:8] s724 s1194 :: SBool = s13 /= s1193 s1195 :: SBool = ~ s1194 s1196 :: SBool = if s982 then s1195 else s1194 s1197 :: SBool = ~ s1196 s1198 :: SBool = if s1022 then s1197 else s1196 s1199 :: SWord1 = choose [7:7] s724 s1200 :: SBool = s13 /= s1199 s1201 :: SBool = ~ s1200 s1202 :: SBool = if s990 then s1201 else s1200 s1203 :: SBool = ~ s1202 s1204 :: SBool = if s1030 then s1203 else s1202 s1205 :: SWord1 = choose [6:6] s724 s1206 :: SBool = s13 /= s1205 s1207 :: SBool = ~ s1206 s1208 :: SBool = if s998 then s1207 else s1206 s1209 :: SBool = ~ s1208 s1210 :: SBool = if s1038 then s1209 else s1208 s1211 :: SWord1 = choose [5:5] s724 s1212 :: SBool = s13 /= s1211 s1213 :: SBool = ~ s1212 s1214 :: SBool = if s1006 then s1213 else s1212 s1215 :: SBool = ~ s1214 s1216 :: SBool = if s1046 then s1215 else s1214 s1217 :: SWord1 = choose [4:4] s724 s1218 :: SBool = s13 /= s1217 s1219 :: SBool = ~ s1218 s1220 :: SBool = if s1014 then s1219 else s1218 s1221 :: SWord1 = choose [3:3] s724 s1222 :: SBool = s13 /= s1221 s1223 :: SBool = ~ s1222 s1224 :: SBool = if s1022 then s1223 else s1222 s1225 :: SWord1 = choose [2:2] s724 s1226 :: SBool = s13 /= s1225 s1227 :: SBool = ~ s1226 s1228 :: SBool = if s1030 then s1227 else s1226 s1229 :: SWord1 = choose [1:1] s724 s1230 :: SBool = s13 /= s1229 s1231 :: SBool = ~ s1230 s1232 :: SBool = if s1038 then s1231 else s1230 s1233 :: SWord1 = choose [0:0] s724 s1234 :: SBool = s13 /= s1233 s1235 :: SBool = ~ s1234 s1236 :: SBool = if s1046 then s1235 else s1234 s1237 :: SWord64 = if s1236 then s525 else s526 s1238 :: SWord64 = s528 | s1237 s1239 :: SWord64 = if s1232 then s1238 else s1237 s1240 :: SWord64 = s531 | s1239 s1241 :: SWord64 = if s1228 then s1240 else s1239 s1242 :: SWord64 = s534 | s1241 s1243 :: SWord64 = if s1224 then s1242 else s1241 s1244 :: SWord64 = s537 | s1243 s1245 :: SWord64 = if s1220 then s1244 else s1243 s1246 :: SWord64 = s540 | s1245 s1247 :: SWord64 = if s1216 then s1246 else s1245 s1248 :: SWord64 = s543 | s1247 s1249 :: SWord64 = if s1210 then s1248 else s1247 s1250 :: SWord64 = s546 | s1249 s1251 :: SWord64 = if s1204 then s1250 else s1249 s1252 :: SWord64 = s549 | s1251 s1253 :: SWord64 = if s1198 then s1252 else s1251 s1254 :: SWord64 = s552 | s1253 s1255 :: SWord64 = if s1192 then s1254 else s1253 s1256 :: SWord64 = s555 | s1255 s1257 :: SWord64 = if s1186 then s1256 else s1255 s1258 :: SWord64 = s558 | s1257 s1259 :: SWord64 = if s1180 then s1258 else s1257 s1260 :: SWord64 = s561 | s1259 s1261 :: SWord64 = if s1174 then s1260 else s1259 s1262 :: SWord64 = s564 | s1261 s1263 :: SWord64 = if s1166 then s1262 else s1261 s1264 :: SWord64 = s567 | s1263 s1265 :: SWord64 = if s1158 then s1264 else s1263 s1266 :: SWord64 = s570 | s1265 s1267 :: SWord64 = if s1150 then s1266 else s1265 s1268 :: SWord64 = s573 | s1267 s1269 :: SWord64 = if s1142 then s1268 else s1267 s1270 :: SWord64 = s576 | s1269 s1271 :: SWord64 = if s1140 then s1270 else s1269 s1272 :: SWord64 = s579 | s1271 s1273 :: SWord64 = if s1138 then s1272 else s1271 s1274 :: SWord64 = s582 | s1273 s1275 :: SWord64 = if s1136 then s1274 else s1273 s1276 :: SWord64 = s585 | s1275 s1277 :: SWord64 = if s1134 then s1276 else s1275 s1278 :: SWord64 = s588 | s1277 s1279 :: SWord64 = if s1132 then s1278 else s1277 s1280 :: SWord64 = s591 | s1279 s1281 :: SWord64 = if s1130 then s1280 else s1279 s1282 :: SWord64 = s594 | s1281 s1283 :: SWord64 = if s1128 then s1282 else s1281 s1284 :: SWord64 = s597 | s1283 s1285 :: SWord64 = if s1126 then s1284 else s1283 s1286 :: SWord64 = s600 | s1285 s1287 :: SWord64 = if s1124 then s1286 else s1285 s1288 :: SWord64 = s603 | s1287 s1289 :: SWord64 = if s1122 then s1288 else s1287 s1290 :: SWord64 = s606 | s1289 s1291 :: SWord64 = if s1120 then s1290 else s1289 s1292 :: SWord64 = s609 | s1291 s1293 :: SWord64 = if s1118 then s1292 else s1291 s1294 :: SWord64 = s612 | s1293 s1295 :: SWord64 = if s1116 then s1294 else s1293 s1296 :: SWord64 = s615 | s1295 s1297 :: SWord64 = if s1114 then s1296 else s1295 s1298 :: SWord64 = s618 | s1297 s1299 :: SWord64 = if s1112 then s1298 else s1297 s1300 :: SWord64 = s621 | s1299 s1301 :: SWord64 = if s1110 then s1300 else s1299 s1302 :: SWord64 = s624 | s1301 s1303 :: SWord64 = if s1108 then s1302 else s1301 s1304 :: SWord64 = s627 | s1303 s1305 :: SWord64 = if s1106 then s1304 else s1303 s1306 :: SWord64 = s630 | s1305 s1307 :: SWord64 = if s1104 then s1306 else s1305 s1308 :: SWord64 = s633 | s1307 s1309 :: SWord64 = if s1102 then s1308 else s1307 s1310 :: SWord64 = s636 | s1309 s1311 :: SWord64 = if s1100 then s1310 else s1309 s1312 :: SWord64 = s639 | s1311 s1313 :: SWord64 = if s1098 then s1312 else s1311 s1314 :: SWord64 = s642 | s1313 s1315 :: SWord64 = if s1096 then s1314 else s1313 s1316 :: SWord64 = s645 | s1315 s1317 :: SWord64 = if s1094 then s1316 else s1315 s1318 :: SWord64 = s648 | s1317 s1319 :: SWord64 = if s1092 then s1318 else s1317 s1320 :: SWord64 = s651 | s1319 s1321 :: SWord64 = if s1090 then s1320 else s1319 s1322 :: SWord64 = s654 | s1321 s1323 :: SWord64 = if s1088 then s1322 else s1321 s1324 :: SWord64 = s657 | s1323 s1325 :: SWord64 = if s1086 then s1324 else s1323 s1326 :: SWord64 = s660 | s1325 s1327 :: SWord64 = if s1084 then s1326 else s1325 s1328 :: SWord64 = s663 | s1327 s1329 :: SWord64 = if s1082 then s1328 else s1327 s1330 :: SWord64 = s666 | s1329 s1331 :: SWord64 = if s1080 then s1330 else s1329 s1332 :: SWord64 = s669 | s1331 s1333 :: SWord64 = if s1078 then s1332 else s1331 s1334 :: SWord64 = s672 | s1333 s1335 :: SWord64 = if s1076 then s1334 else s1333 s1336 :: SWord64 = s675 | s1335 s1337 :: SWord64 = if s1074 then s1336 else s1335 s1338 :: SWord64 = s678 | s1337 s1339 :: SWord64 = if s1072 then s1338 else s1337 s1340 :: SWord64 = s681 | s1339 s1341 :: SWord64 = if s1070 then s1340 else s1339 s1342 :: SWord64 = s684 | s1341 s1343 :: SWord64 = if s1068 then s1342 else s1341 s1344 :: SWord64 = s687 | s1343 s1345 :: SWord64 = if s1066 then s1344 else s1343 s1346 :: SWord64 = s690 | s1345 s1347 :: SWord64 = if s1064 then s1346 else s1345 s1348 :: SWord64 = s693 | s1347 s1349 :: SWord64 = if s1062 then s1348 else s1347 s1350 :: SWord64 = s696 | s1349 s1351 :: SWord64 = if s1060 then s1350 else s1349 s1352 :: SWord64 = s699 | s1351 s1353 :: SWord64 = if s1058 then s1352 else s1351 s1354 :: SWord64 = s702 | s1353 s1355 :: SWord64 = if s1056 then s1354 else s1353 s1356 :: SWord64 = s705 | s1355 s1357 :: SWord64 = if s1054 then s1356 else s1355 s1358 :: SWord64 = s708 | s1357 s1359 :: SWord64 = if s1052 then s1358 else s1357 s1360 :: SWord64 = s711 | s1359 s1361 :: SWord64 = if s1050 then s1360 else s1359 s1362 :: SWord64 = s714 | s1361 s1363 :: SWord64 = if s1048 then s1362 else s1361 s1364 :: SWord32 = choose [31:0] s1363 s1365 :: SWord16 = choose [15:0] s1364 s1366 :: SWord32 = s3 # s1365 s1367 :: SWord64 = s2 # s1366 s1368 :: SWord1 = choose [0:0] s1367 s1369 :: SBool = s13 /= s1368 s1370 :: SBool = s722 == s1369 s1371 :: SWord1 = choose [1:1] s720 s1372 :: SBool = s13 /= s1371 s1373 :: SWord1 = choose [1:1] s1367 s1374 :: SBool = s13 /= s1373 s1375 :: SBool = s1372 == s1374 s1376 :: SWord1 = choose [2:2] s720 s1377 :: SBool = s13 /= s1376 s1378 :: SWord1 = choose [2:2] s1367 s1379 :: SBool = s13 /= s1378 s1380 :: SBool = s1377 == s1379 s1381 :: SWord1 = choose [3:3] s720 s1382 :: SBool = s13 /= s1381 s1383 :: SWord1 = choose [3:3] s1367 s1384 :: SBool = s13 /= s1383 s1385 :: SBool = s1382 == s1384 s1386 :: SWord1 = choose [4:4] s720 s1387 :: SBool = s13 /= s1386 s1388 :: SWord1 = choose [4:4] s1367 s1389 :: SBool = s13 /= s1388 s1390 :: SBool = s1387 == s1389 s1391 :: SWord1 = choose [5:5] s720 s1392 :: SBool = s13 /= s1391 s1393 :: SWord1 = choose [5:5] s1367 s1394 :: SBool = s13 /= s1393 s1395 :: SBool = s1392 == s1394 s1396 :: SWord1 = choose [6:6] s720 s1397 :: SBool = s13 /= s1396 s1398 :: SWord1 = choose [6:6] s1367 s1399 :: SBool = s13 /= s1398 s1400 :: SBool = s1397 == s1399 s1401 :: SWord1 = choose [7:7] s720 s1402 :: SBool = s13 /= s1401 s1403 :: SWord1 = choose [7:7] s1367 s1404 :: SBool = s13 /= s1403 s1405 :: SBool = s1402 == s1404 s1406 :: SWord1 = choose [8:8] s720 s1407 :: SBool = s13 /= s1406 s1408 :: SWord1 = choose [8:8] s1367 s1409 :: SBool = s13 /= s1408 s1410 :: SBool = s1407 == s1409 s1411 :: SWord1 = choose [9:9] s720 s1412 :: SBool = s13 /= s1411 s1413 :: SWord1 = choose [9:9] s1367 s1414 :: SBool = s13 /= s1413 s1415 :: SBool = s1412 == s1414 s1416 :: SWord1 = choose [10:10] s720 s1417 :: SBool = s13 /= s1416 s1418 :: SWord1 = choose [10:10] s1367 s1419 :: SBool = s13 /= s1418 s1420 :: SBool = s1417 == s1419 s1421 :: SWord1 = choose [11:11] s720 s1422 :: SBool = s13 /= s1421 s1423 :: SWord1 = choose [11:11] s1367 s1424 :: SBool = s13 /= s1423 s1425 :: SBool = s1422 == s1424 s1426 :: SWord1 = choose [12:12] s720 s1427 :: SBool = s13 /= s1426 s1428 :: SWord1 = choose [12:12] s1367 s1429 :: SBool = s13 /= s1428 s1430 :: SBool = s1427 == s1429 s1431 :: SWord1 = choose [13:13] s720 s1432 :: SBool = s13 /= s1431 s1433 :: SWord1 = choose [13:13] s1367 s1434 :: SBool = s13 /= s1433 s1435 :: SBool = s1432 == s1434 s1436 :: SWord1 = choose [14:14] s720 s1437 :: SBool = s13 /= s1436 s1438 :: SWord1 = choose [14:14] s1367 s1439 :: SBool = s13 /= s1438 s1440 :: SBool = s1437 == s1439 s1441 :: SWord1 = choose [15:15] s720 s1442 :: SBool = s13 /= s1441 s1443 :: SWord1 = choose [15:15] s1367 s1444 :: SBool = s13 /= s1443 s1445 :: SBool = s1442 == s1444 s1446 :: SWord1 = choose [16:16] s720 s1447 :: SBool = s13 /= s1446 s1448 :: SWord1 = choose [16:16] s1367 s1449 :: SBool = s13 /= s1448 s1450 :: SBool = s1447 == s1449 s1451 :: SWord1 = choose [17:17] s720 s1452 :: SBool = s13 /= s1451 s1453 :: SWord1 = choose [17:17] s1367 s1454 :: SBool = s13 /= s1453 s1455 :: SBool = s1452 == s1454 s1456 :: SWord1 = choose [18:18] s720 s1457 :: SBool = s13 /= s1456 s1458 :: SWord1 = choose [18:18] s1367 s1459 :: SBool = s13 /= s1458 s1460 :: SBool = s1457 == s1459 s1461 :: SWord1 = choose [19:19] s720 s1462 :: SBool = s13 /= s1461 s1463 :: SWord1 = choose [19:19] s1367 s1464 :: SBool = s13 /= s1463 s1465 :: SBool = s1462 == s1464 s1466 :: SWord1 = choose [20:20] s720 s1467 :: SBool = s13 /= s1466 s1468 :: SWord1 = choose [20:20] s1367 s1469 :: SBool = s13 /= s1468 s1470 :: SBool = s1467 == s1469 s1471 :: SWord1 = choose [21:21] s720 s1472 :: SBool = s13 /= s1471 s1473 :: SWord1 = choose [21:21] s1367 s1474 :: SBool = s13 /= s1473 s1475 :: SBool = s1472 == s1474 s1476 :: SWord1 = choose [22:22] s720 s1477 :: SBool = s13 /= s1476 s1478 :: SWord1 = choose [22:22] s1367 s1479 :: SBool = s13 /= s1478 s1480 :: SBool = s1477 == s1479 s1481 :: SWord1 = choose [23:23] s720 s1482 :: SBool = s13 /= s1481 s1483 :: SWord1 = choose [23:23] s1367 s1484 :: SBool = s13 /= s1483 s1485 :: SBool = s1482 == s1484 s1486 :: SWord1 = choose [24:24] s720 s1487 :: SBool = s13 /= s1486 s1488 :: SWord1 = choose [24:24] s1367 s1489 :: SBool = s13 /= s1488 s1490 :: SBool = s1487 == s1489 s1491 :: SWord1 = choose [25:25] s720 s1492 :: SBool = s13 /= s1491 s1493 :: SWord1 = choose [25:25] s1367 s1494 :: SBool = s13 /= s1493 s1495 :: SBool = s1492 == s1494 s1496 :: SWord1 = choose [26:26] s720 s1497 :: SBool = s13 /= s1496 s1498 :: SWord1 = choose [26:26] s1367 s1499 :: SBool = s13 /= s1498 s1500 :: SBool = s1497 == s1499 s1501 :: SWord1 = choose [27:27] s720 s1502 :: SBool = s13 /= s1501 s1503 :: SWord1 = choose [27:27] s1367 s1504 :: SBool = s13 /= s1503 s1505 :: SBool = s1502 == s1504 s1506 :: SWord1 = choose [28:28] s720 s1507 :: SBool = s13 /= s1506 s1508 :: SWord1 = choose [28:28] s1367 s1509 :: SBool = s13 /= s1508 s1510 :: SBool = s1507 == s1509 s1511 :: SWord1 = choose [29:29] s720 s1512 :: SBool = s13 /= s1511 s1513 :: SWord1 = choose [29:29] s1367 s1514 :: SBool = s13 /= s1513 s1515 :: SBool = s1512 == s1514 s1516 :: SWord1 = choose [30:30] s720 s1517 :: SBool = s13 /= s1516 s1518 :: SWord1 = choose [30:30] s1367 s1519 :: SBool = s13 /= s1518 s1520 :: SBool = s1517 == s1519 s1521 :: SWord1 = choose [31:31] s720 s1522 :: SBool = s13 /= s1521 s1523 :: SWord1 = choose [31:31] s1367 s1524 :: SBool = s13 /= s1523 s1525 :: SBool = s1522 == s1524 s1526 :: SWord1 = choose [32:32] s720 s1527 :: SBool = s13 /= s1526 s1528 :: SWord1 = choose [32:32] s1367 s1529 :: SBool = s13 /= s1528 s1530 :: SBool = s1527 == s1529 s1531 :: SWord1 = choose [33:33] s720 s1532 :: SBool = s13 /= s1531 s1533 :: SWord1 = choose [33:33] s1367 s1534 :: SBool = s13 /= s1533 s1535 :: SBool = s1532 == s1534 s1536 :: SWord1 = choose [34:34] s720 s1537 :: SBool = s13 /= s1536 s1538 :: SWord1 = choose [34:34] s1367 s1539 :: SBool = s13 /= s1538 s1540 :: SBool = s1537 == s1539 s1541 :: SWord1 = choose [35:35] s720 s1542 :: SBool = s13 /= s1541 s1543 :: SWord1 = choose [35:35] s1367 s1544 :: SBool = s13 /= s1543 s1545 :: SBool = s1542 == s1544 s1546 :: SWord1 = choose [36:36] s720 s1547 :: SBool = s13 /= s1546 s1548 :: SWord1 = choose [36:36] s1367 s1549 :: SBool = s13 /= s1548 s1550 :: SBool = s1547 == s1549 s1551 :: SWord1 = choose [37:37] s720 s1552 :: SBool = s13 /= s1551 s1553 :: SWord1 = choose [37:37] s1367 s1554 :: SBool = s13 /= s1553 s1555 :: SBool = s1552 == s1554 s1556 :: SWord1 = choose [38:38] s720 s1557 :: SBool = s13 /= s1556 s1558 :: SWord1 = choose [38:38] s1367 s1559 :: SBool = s13 /= s1558 s1560 :: SBool = s1557 == s1559 s1561 :: SWord1 = choose [39:39] s720 s1562 :: SBool = s13 /= s1561 s1563 :: SWord1 = choose [39:39] s1367 s1564 :: SBool = s13 /= s1563 s1565 :: SBool = s1562 == s1564 s1566 :: SWord1 = choose [40:40] s720 s1567 :: SBool = s13 /= s1566 s1568 :: SWord1 = choose [40:40] s1367 s1569 :: SBool = s13 /= s1568 s1570 :: SBool = s1567 == s1569 s1571 :: SWord1 = choose [41:41] s720 s1572 :: SBool = s13 /= s1571 s1573 :: SWord1 = choose [41:41] s1367 s1574 :: SBool = s13 /= s1573 s1575 :: SBool = s1572 == s1574 s1576 :: SWord1 = choose [42:42] s720 s1577 :: SBool = s13 /= s1576 s1578 :: SWord1 = choose [42:42] s1367 s1579 :: SBool = s13 /= s1578 s1580 :: SBool = s1577 == s1579 s1581 :: SWord1 = choose [43:43] s720 s1582 :: SBool = s13 /= s1581 s1583 :: SWord1 = choose [43:43] s1367 s1584 :: SBool = s13 /= s1583 s1585 :: SBool = s1582 == s1584 s1586 :: SWord1 = choose [44:44] s720 s1587 :: SBool = s13 /= s1586 s1588 :: SWord1 = choose [44:44] s1367 s1589 :: SBool = s13 /= s1588 s1590 :: SBool = s1587 == s1589 s1591 :: SWord1 = choose [45:45] s720 s1592 :: SBool = s13 /= s1591 s1593 :: SWord1 = choose [45:45] s1367 s1594 :: SBool = s13 /= s1593 s1595 :: SBool = s1592 == s1594 s1596 :: SWord1 = choose [46:46] s720 s1597 :: SBool = s13 /= s1596 s1598 :: SWord1 = choose [46:46] s1367 s1599 :: SBool = s13 /= s1598 s1600 :: SBool = s1597 == s1599 s1601 :: SWord1 = choose [47:47] s720 s1602 :: SBool = s13 /= s1601 s1603 :: SWord1 = choose [47:47] s1367 s1604 :: SBool = s13 /= s1603 s1605 :: SBool = s1602 == s1604 s1606 :: SWord1 = choose [48:48] s720 s1607 :: SBool = s13 /= s1606 s1608 :: SWord1 = choose [48:48] s1367 s1609 :: SBool = s13 /= s1608 s1610 :: SBool = s1607 == s1609 s1611 :: SWord1 = choose [49:49] s720 s1612 :: SBool = s13 /= s1611 s1613 :: SWord1 = choose [49:49] s1367 s1614 :: SBool = s13 /= s1613 s1615 :: SBool = s1612 == s1614 s1616 :: SWord1 = choose [50:50] s720 s1617 :: SBool = s13 /= s1616 s1618 :: SWord1 = choose [50:50] s1367 s1619 :: SBool = s13 /= s1618 s1620 :: SBool = s1617 == s1619 s1621 :: SWord1 = choose [51:51] s720 s1622 :: SBool = s13 /= s1621 s1623 :: SWord1 = choose [51:51] s1367 s1624 :: SBool = s13 /= s1623 s1625 :: SBool = s1622 == s1624 s1626 :: SWord1 = choose [52:52] s720 s1627 :: SBool = s13 /= s1626 s1628 :: SWord1 = choose [52:52] s1367 s1629 :: SBool = s13 /= s1628 s1630 :: SBool = s1627 == s1629 s1631 :: SWord1 = choose [53:53] s720 s1632 :: SBool = s13 /= s1631 s1633 :: SWord1 = choose [53:53] s1367 s1634 :: SBool = s13 /= s1633 s1635 :: SBool = s1632 == s1634 s1636 :: SWord1 = choose [54:54] s720 s1637 :: SBool = s13 /= s1636 s1638 :: SWord1 = choose [54:54] s1367 s1639 :: SBool = s13 /= s1638 s1640 :: SBool = s1637 == s1639 s1641 :: SWord1 = choose [55:55] s720 s1642 :: SBool = s13 /= s1641 s1643 :: SWord1 = choose [55:55] s1367 s1644 :: SBool = s13 /= s1643 s1645 :: SBool = s1642 == s1644 s1646 :: SWord1 = choose [56:56] s720 s1647 :: SBool = s13 /= s1646 s1648 :: SWord1 = choose [56:56] s1367 s1649 :: SBool = s13 /= s1648 s1650 :: SBool = s1647 == s1649 s1651 :: SWord1 = choose [57:57] s720 s1652 :: SBool = s13 /= s1651 s1653 :: SWord1 = choose [57:57] s1367 s1654 :: SBool = s13 /= s1653 s1655 :: SBool = s1652 == s1654 s1656 :: SWord1 = choose [58:58] s720 s1657 :: SBool = s13 /= s1656 s1658 :: SWord1 = choose [58:58] s1367 s1659 :: SBool = s13 /= s1658 s1660 :: SBool = s1657 == s1659 s1661 :: SWord1 = choose [59:59] s720 s1662 :: SBool = s13 /= s1661 s1663 :: SWord1 = choose [59:59] s1367 s1664 :: SBool = s13 /= s1663 s1665 :: SBool = s1662 == s1664 s1666 :: SWord1 = choose [60:60] s720 s1667 :: SBool = s13 /= s1666 s1668 :: SWord1 = choose [60:60] s1367 s1669 :: SBool = s13 /= s1668 s1670 :: SBool = s1667 == s1669 s1671 :: SWord1 = choose [61:61] s720 s1672 :: SBool = s13 /= s1671 s1673 :: SWord1 = choose [61:61] s1367 s1674 :: SBool = s13 /= s1673 s1675 :: SBool = s1672 == s1674 s1676 :: SWord1 = choose [62:62] s720 s1677 :: SBool = s13 /= s1676 s1678 :: SWord1 = choose [62:62] s1367 s1679 :: SBool = s13 /= s1678 s1680 :: SBool = s1677 == s1679 s1681 :: SWord1 = choose [63:63] s720 s1682 :: SBool = s13 /= s1681 s1683 :: SWord1 = choose [63:63] s1367 s1684 :: SBool = s13 /= s1683 s1685 :: SBool = s1682 == s1684 s1688 :: SWord8 = if s1685 then s1686 else s1687 s1689 :: SWord8 = s1687 + s1688 s1690 :: SWord8 = if s1680 then s1688 else s1689 s1691 :: SWord8 = s1687 + s1690 s1692 :: SWord8 = if s1675 then s1690 else s1691 s1693 :: SWord8 = s1687 + s1692 s1694 :: SWord8 = if s1670 then s1692 else s1693 s1695 :: SWord8 = s1687 + s1694 s1696 :: SWord8 = if s1665 then s1694 else s1695 s1697 :: SWord8 = s1687 + s1696 s1698 :: SWord8 = if s1660 then s1696 else s1697 s1699 :: SWord8 = s1687 + s1698 s1700 :: SWord8 = if s1655 then s1698 else s1699 s1701 :: SWord8 = s1687 + s1700 s1702 :: SWord8 = if s1650 then s1700 else s1701 s1703 :: SWord8 = s1687 + s1702 s1704 :: SWord8 = if s1645 then s1702 else s1703 s1705 :: SWord8 = s1687 + s1704 s1706 :: SWord8 = if s1640 then s1704 else s1705 s1707 :: SWord8 = s1687 + s1706 s1708 :: SWord8 = if s1635 then s1706 else s1707 s1709 :: SWord8 = s1687 + s1708 s1710 :: SWord8 = if s1630 then s1708 else s1709 s1711 :: SWord8 = s1687 + s1710 s1712 :: SWord8 = if s1625 then s1710 else s1711 s1713 :: SWord8 = s1687 + s1712 s1714 :: SWord8 = if s1620 then s1712 else s1713 s1715 :: SWord8 = s1687 + s1714 s1716 :: SWord8 = if s1615 then s1714 else s1715 s1717 :: SWord8 = s1687 + s1716 s1718 :: SWord8 = if s1610 then s1716 else s1717 s1719 :: SWord8 = s1687 + s1718 s1720 :: SWord8 = if s1605 then s1718 else s1719 s1721 :: SWord8 = s1687 + s1720 s1722 :: SWord8 = if s1600 then s1720 else s1721 s1723 :: SWord8 = s1687 + s1722 s1724 :: SWord8 = if s1595 then s1722 else s1723 s1725 :: SWord8 = s1687 + s1724 s1726 :: SWord8 = if s1590 then s1724 else s1725 s1727 :: SWord8 = s1687 + s1726 s1728 :: SWord8 = if s1585 then s1726 else s1727 s1729 :: SWord8 = s1687 + s1728 s1730 :: SWord8 = if s1580 then s1728 else s1729 s1731 :: SWord8 = s1687 + s1730 s1732 :: SWord8 = if s1575 then s1730 else s1731 s1733 :: SWord8 = s1687 + s1732 s1734 :: SWord8 = if s1570 then s1732 else s1733 s1735 :: SWord8 = s1687 + s1734 s1736 :: SWord8 = if s1565 then s1734 else s1735 s1737 :: SWord8 = s1687 + s1736 s1738 :: SWord8 = if s1560 then s1736 else s1737 s1739 :: SWord8 = s1687 + s1738 s1740 :: SWord8 = if s1555 then s1738 else s1739 s1741 :: SWord8 = s1687 + s1740 s1742 :: SWord8 = if s1550 then s1740 else s1741 s1743 :: SWord8 = s1687 + s1742 s1744 :: SWord8 = if s1545 then s1742 else s1743 s1745 :: SWord8 = s1687 + s1744 s1746 :: SWord8 = if s1540 then s1744 else s1745 s1747 :: SWord8 = s1687 + s1746 s1748 :: SWord8 = if s1535 then s1746 else s1747 s1749 :: SWord8 = s1687 + s1748 s1750 :: SWord8 = if s1530 then s1748 else s1749 s1751 :: SWord8 = s1687 + s1750 s1752 :: SWord8 = if s1525 then s1750 else s1751 s1753 :: SWord8 = s1687 + s1752 s1754 :: SWord8 = if s1520 then s1752 else s1753 s1755 :: SWord8 = s1687 + s1754 s1756 :: SWord8 = if s1515 then s1754 else s1755 s1757 :: SWord8 = s1687 + s1756 s1758 :: SWord8 = if s1510 then s1756 else s1757 s1759 :: SWord8 = s1687 + s1758 s1760 :: SWord8 = if s1505 then s1758 else s1759 s1761 :: SWord8 = s1687 + s1760 s1762 :: SWord8 = if s1500 then s1760 else s1761 s1763 :: SWord8 = s1687 + s1762 s1764 :: SWord8 = if s1495 then s1762 else s1763 s1765 :: SWord8 = s1687 + s1764 s1766 :: SWord8 = if s1490 then s1764 else s1765 s1767 :: SWord8 = s1687 + s1766 s1768 :: SWord8 = if s1485 then s1766 else s1767 s1769 :: SWord8 = s1687 + s1768 s1770 :: SWord8 = if s1480 then s1768 else s1769 s1771 :: SWord8 = s1687 + s1770 s1772 :: SWord8 = if s1475 then s1770 else s1771 s1773 :: SWord8 = s1687 + s1772 s1774 :: SWord8 = if s1470 then s1772 else s1773 s1775 :: SWord8 = s1687 + s1774 s1776 :: SWord8 = if s1465 then s1774 else s1775 s1777 :: SWord8 = s1687 + s1776 s1778 :: SWord8 = if s1460 then s1776 else s1777 s1779 :: SWord8 = s1687 + s1778 s1780 :: SWord8 = if s1455 then s1778 else s1779 s1781 :: SWord8 = s1687 + s1780 s1782 :: SWord8 = if s1450 then s1780 else s1781 s1783 :: SWord8 = s1687 + s1782 s1784 :: SWord8 = if s1445 then s1782 else s1783 s1785 :: SWord8 = s1687 + s1784 s1786 :: SWord8 = if s1440 then s1784 else s1785 s1787 :: SWord8 = s1687 + s1786 s1788 :: SWord8 = if s1435 then s1786 else s1787 s1789 :: SWord8 = s1687 + s1788 s1790 :: SWord8 = if s1430 then s1788 else s1789 s1791 :: SWord8 = s1687 + s1790 s1792 :: SWord8 = if s1425 then s1790 else s1791 s1793 :: SWord8 = s1687 + s1792 s1794 :: SWord8 = if s1420 then s1792 else s1793 s1795 :: SWord8 = s1687 + s1794 s1796 :: SWord8 = if s1415 then s1794 else s1795 s1797 :: SWord8 = s1687 + s1796 s1798 :: SWord8 = if s1410 then s1796 else s1797 s1799 :: SWord8 = s1687 + s1798 s1800 :: SWord8 = if s1405 then s1798 else s1799 s1801 :: SWord8 = s1687 + s1800 s1802 :: SWord8 = if s1400 then s1800 else s1801 s1803 :: SWord8 = s1687 + s1802 s1804 :: SWord8 = if s1395 then s1802 else s1803 s1805 :: SWord8 = s1687 + s1804 s1806 :: SWord8 = if s1390 then s1804 else s1805 s1807 :: SWord8 = s1687 + s1806 s1808 :: SWord8 = if s1385 then s1806 else s1807 s1809 :: SWord8 = s1687 + s1808 s1810 :: SWord8 = if s1380 then s1808 else s1809 s1811 :: SWord8 = s1687 + s1810 s1812 :: SWord8 = if s1375 then s1810 else s1811 s1813 :: SWord8 = s1687 + s1812 s1814 :: SWord8 = if s1370 then s1812 else s1813 s1816 :: SBool = s1814 > s1815 s1817 :: SBool = s8 | s1816 CONSTRAINTS ASSERTIONS OUTPUTS s1817sbv-7.13/SBVTestSuite/GoldFiles/cgUninterpret.gold0000644000000000000000000000550213405536617020314 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for tstShiftLeft. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: tstShiftLeft_driver tstShiftLeft.o: tstShiftLeft.c tstShiftLeft.h ${CC} ${CCFLAGS} -c $< -o $@ tstShiftLeft_driver.o: tstShiftLeft_driver.c ${CC} ${CCFLAGS} -c $< -o $@ tstShiftLeft_driver: tstShiftLeft.o tstShiftLeft_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f tstShiftLeft_driver == END: "Makefile" ================== == BEGIN: "tstShiftLeft.h" ================ /* Header file for tstShiftLeft. Automatically generated by SBV. Do not edit! */ #ifndef __tstShiftLeft__HEADER_INCLUDED__ #define __tstShiftLeft__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ SWord32 tstShiftLeft(const SWord32 *vs); #endif /* __tstShiftLeft__HEADER_INCLUDED__ */ == END: "tstShiftLeft.h" ================== == BEGIN: "tstShiftLeft_driver.c" ================ /* Example driver program for tstShiftLeft. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "tstShiftLeft.h" int main(void) { const SWord32 vs[3] = { 0x00000001UL, 0x00000002UL, 0x00000003UL }; printf("Contents of input array vs:\n"); int vs_ctr; for(vs_ctr = 0; vs_ctr < 3 ; ++vs_ctr) printf(" vs[%d] = 0x%08"PRIx32"UL\n", vs_ctr ,vs[vs_ctr]); const SWord32 __result = tstShiftLeft(vs); printf("tstShiftLeft(vs) = 0x%08"PRIx32"UL\n", __result); return 0; } == END: "tstShiftLeft_driver.c" ================== == BEGIN: "tstShiftLeft.c" ================ /* File: "tstShiftLeft.c". Automatically generated by SBV. Do not edit! */ #include "tstShiftLeft.h" /* User specified custom code for "SBV_SHIFTLEFT" */ #define SBV_SHIFTLEFT(x, y) ((x) << (y)) SWord32 tstShiftLeft(const SWord32 *vs) { const SWord32 s0 = vs[0]; const SWord32 s1 = vs[1]; const SWord32 s2 = vs[2]; const SWord32 s3 = /* Uninterpreted function */ SBV_SHIFTLEFT(s0, s2); const SWord32 s4 = /* Uninterpreted function */ SBV_SHIFTLEFT(s1, s2); const SWord32 s5 = s3 + s4; return s5; } == END: "tstShiftLeft.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/codeGen1.gold0000644000000000000000000001373613405536617017120 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for foo. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: foo_driver foo.o: foo.c foo.h ${CC} ${CCFLAGS} -c $< -o $@ foo_driver.o: foo_driver.c ${CC} ${CCFLAGS} -c $< -o $@ foo_driver: foo.o foo_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f foo_driver == END: "Makefile" ================== == BEGIN: "foo.h" ================ /* Header file for foo. Automatically generated by SBV. Do not edit! */ #ifndef __foo__HEADER_INCLUDED__ #define __foo__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ SInt16 foo(const SInt16 x, const SInt64 *xArr, SWord16 *z, SInt16 *zArr, SInt64 *yArr); #endif /* __foo__HEADER_INCLUDED__ */ == END: "foo.h" ================== == BEGIN: "foo_driver.c" ================ /* Example driver program for foo. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "foo.h" int main(void) { const SInt64 xArr[45] = { 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL, 0x0000000000000000LL }; printf("Contents of input array xArr:\n"); int xArr_ctr; for(xArr_ctr = 0; xArr_ctr < 45 ; ++xArr_ctr) printf(" xArr[%d] = %"PRId64"LL\n", xArr_ctr ,xArr[xArr_ctr]); SWord16 z; SInt16 zArr[7]; SInt64 yArr[45]; const SInt16 __result = foo(0x0000, xArr, &z, zArr, yArr); printf("foo(0x0000, xArr, &z, zArr, yArr) = %"PRId16"\n", __result); printf(" z = 0x%04"PRIx16"U\n", z); int zArr_ctr; for(zArr_ctr = 0; zArr_ctr < 7 ; ++zArr_ctr) printf(" zArr[%d] = %"PRId16"\n", zArr_ctr ,zArr[zArr_ctr]); int yArr_ctr; for(yArr_ctr = 0; yArr_ctr < 45 ; ++yArr_ctr) printf(" yArr[%d] = %"PRId64"LL\n", yArr_ctr ,yArr[yArr_ctr]); return 0; } == END: "foo_driver.c" ================== == BEGIN: "foo.c" ================ /* File: "foo.c". Automatically generated by SBV. Do not edit! */ #include "foo.h" SInt16 foo(const SInt16 x, const SInt64 *xArr, SWord16 *z, SInt16 *zArr, SInt64 *yArr) { const SInt16 s0 = x; const SInt64 s1 = xArr[0]; const SInt64 s2 = xArr[1]; const SInt64 s3 = xArr[2]; const SInt64 s4 = xArr[3]; const SInt64 s5 = xArr[4]; const SInt64 s6 = xArr[5]; const SInt64 s7 = xArr[6]; const SInt64 s8 = xArr[7]; const SInt64 s9 = xArr[8]; const SInt64 s10 = xArr[9]; const SInt64 s11 = xArr[10]; const SInt64 s12 = xArr[11]; const SInt64 s13 = xArr[12]; const SInt64 s14 = xArr[13]; const SInt64 s15 = xArr[14]; const SInt64 s16 = xArr[15]; const SInt64 s17 = xArr[16]; const SInt64 s18 = xArr[17]; const SInt64 s19 = xArr[18]; const SInt64 s20 = xArr[19]; const SInt64 s21 = xArr[20]; const SInt64 s22 = xArr[21]; const SInt64 s23 = xArr[22]; const SInt64 s24 = xArr[23]; const SInt64 s25 = xArr[24]; const SInt64 s26 = xArr[25]; const SInt64 s27 = xArr[26]; const SInt64 s28 = xArr[27]; const SInt64 s29 = xArr[28]; const SInt64 s30 = xArr[29]; const SInt64 s31 = xArr[30]; const SInt64 s32 = xArr[31]; const SInt64 s33 = xArr[32]; const SInt64 s34 = xArr[33]; const SInt64 s35 = xArr[34]; const SInt64 s36 = xArr[35]; const SInt64 s37 = xArr[36]; const SInt64 s38 = xArr[37]; const SInt64 s39 = xArr[38]; const SInt64 s40 = xArr[39]; const SInt64 s41 = xArr[40]; const SInt64 s42 = xArr[41]; const SInt64 s43 = xArr[42]; const SInt64 s44 = xArr[43]; const SInt64 s45 = xArr[44]; const SInt16 s48 = s0 + 0x0001; const SInt16 s50 = s0 * 0x0002; *z = 0x0005U; zArr[0] = s48; zArr[1] = s48; zArr[2] = s48; zArr[3] = s48; zArr[4] = s48; zArr[5] = s48; zArr[6] = s48; yArr[0] = s1; yArr[1] = s2; yArr[2] = s3; yArr[3] = s4; yArr[4] = s5; yArr[5] = s6; yArr[6] = s7; yArr[7] = s8; yArr[8] = s9; yArr[9] = s10; yArr[10] = s11; yArr[11] = s12; yArr[12] = s13; yArr[13] = s14; yArr[14] = s15; yArr[15] = s16; yArr[16] = s17; yArr[17] = s18; yArr[18] = s19; yArr[19] = s20; yArr[20] = s21; yArr[21] = s22; yArr[22] = s23; yArr[23] = s24; yArr[24] = s25; yArr[25] = s26; yArr[26] = s27; yArr[27] = s28; yArr[28] = s29; yArr[29] = s30; yArr[30] = s31; yArr[31] = s32; yArr[32] = s33; yArr[33] = s34; yArr[34] = s35; yArr[35] = s36; yArr[36] = s37; yArr[37] = s38; yArr[38] = s39; yArr[39] = s40; yArr[40] = s41; yArr[41] = s42; yArr[42] = s43; yArr[43] = s44; yArr[44] = s45; return s50; } == END: "foo.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/coins.gold0000644000000000000000000004475413405536617016612 0ustar0000000000000000INPUTS s0 :: SWord16, existential, aliasing "c1" s18 :: SWord16, existential, aliasing "c2" s30 :: SWord16, existential, aliasing "c3" s42 :: SWord16, existential, aliasing "c4" s54 :: SWord16, existential, aliasing "c5" s66 :: SWord16, existential, aliasing "c6" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s1 = 1 :: Word16 s3 = 5 :: Word16 s5 = 10 :: Word16 s7 = 25 :: Word16 s9 = 50 :: Word16 s11 = 100 :: Word16 s84 = 0 :: Word16 s88 = 95 :: Word16 s551 = 115 :: Word16 TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s2 :: SBool = s0 == s1 s4 :: SBool = s0 == s3 s6 :: SBool = s0 == s5 s8 :: SBool = s0 == s7 s10 :: SBool = s0 == s9 s12 :: SBool = s0 == s11 s13 :: SBool = s10 | s12 s14 :: SBool = s8 | s13 s15 :: SBool = s6 | s14 s16 :: SBool = s4 | s15 s17 :: SBool = s2 | s16 s19 :: SBool = s1 == s18 s20 :: SBool = s3 == s18 s21 :: SBool = s5 == s18 s22 :: SBool = s7 == s18 s23 :: SBool = s9 == s18 s24 :: SBool = s11 == s18 s25 :: SBool = s23 | s24 s26 :: SBool = s22 | s25 s27 :: SBool = s21 | s26 s28 :: SBool = s20 | s27 s29 :: SBool = s19 | s28 s31 :: SBool = s1 == s30 s32 :: SBool = s3 == s30 s33 :: SBool = s5 == s30 s34 :: SBool = s7 == s30 s35 :: SBool = s9 == s30 s36 :: SBool = s11 == s30 s37 :: SBool = s35 | s36 s38 :: SBool = s34 | s37 s39 :: SBool = s33 | s38 s40 :: SBool = s32 | s39 s41 :: SBool = s31 | s40 s43 :: SBool = s1 == s42 s44 :: SBool = s3 == s42 s45 :: SBool = s5 == s42 s46 :: SBool = s7 == s42 s47 :: SBool = s9 == s42 s48 :: SBool = s11 == s42 s49 :: SBool = s47 | s48 s50 :: SBool = s46 | s49 s51 :: SBool = s45 | s50 s52 :: SBool = s44 | s51 s53 :: SBool = s43 | s52 s55 :: SBool = s1 == s54 s56 :: SBool = s3 == s54 s57 :: SBool = s5 == s54 s58 :: SBool = s7 == s54 s59 :: SBool = s9 == s54 s60 :: SBool = s11 == s54 s61 :: SBool = s59 | s60 s62 :: SBool = s58 | s61 s63 :: SBool = s57 | s62 s64 :: SBool = s56 | s63 s65 :: SBool = s55 | s64 s67 :: SBool = s1 == s66 s68 :: SBool = s3 == s66 s69 :: SBool = s5 == s66 s70 :: SBool = s7 == s66 s71 :: SBool = s9 == s66 s72 :: SBool = s11 == s66 s73 :: SBool = s71 | s72 s74 :: SBool = s70 | s73 s75 :: SBool = s69 | s74 s76 :: SBool = s68 | s75 s77 :: SBool = s67 | s76 s78 :: SWord16 = s0 + s18 s79 :: SBool = s11 /= s78 s80 :: SBool = s9 /= s78 s81 :: SBool = s7 /= s78 s82 :: SBool = s5 /= s78 s83 :: SBool = s3 /= s78 s85 :: SWord16 = if s10 then s84 else s0 s86 :: SWord16 = if s23 then s84 else s18 s87 :: SWord16 = s85 + s86 s89 :: SBool = s87 /= s88 s90 :: SWord16 = s0 + s30 s91 :: SBool = s11 /= s90 s92 :: SBool = s9 /= s90 s93 :: SBool = s7 /= s90 s94 :: SBool = s5 /= s90 s95 :: SBool = s3 /= s90 s96 :: SWord16 = if s35 then s84 else s30 s97 :: SWord16 = s85 + s96 s98 :: SBool = s88 /= s97 s99 :: SWord16 = s0 + s42 s100 :: SBool = s11 /= s99 s101 :: SBool = s9 /= s99 s102 :: SBool = s7 /= s99 s103 :: SBool = s5 /= s99 s104 :: SBool = s3 /= s99 s105 :: SWord16 = if s47 then s84 else s42 s106 :: SWord16 = s85 + s105 s107 :: SBool = s88 /= s106 s108 :: SWord16 = s0 + s54 s109 :: SBool = s11 /= s108 s110 :: SBool = s9 /= s108 s111 :: SBool = s7 /= s108 s112 :: SBool = s5 /= s108 s113 :: SBool = s3 /= s108 s114 :: SWord16 = if s59 then s84 else s54 s115 :: SWord16 = s85 + s114 s116 :: SBool = s88 /= s115 s117 :: SWord16 = s0 + s66 s118 :: SBool = s11 /= s117 s119 :: SBool = s9 /= s117 s120 :: SBool = s7 /= s117 s121 :: SBool = s5 /= s117 s122 :: SBool = s3 /= s117 s123 :: SWord16 = if s71 then s84 else s66 s124 :: SWord16 = s85 + s123 s125 :: SBool = s88 /= s124 s126 :: SWord16 = s18 + s30 s127 :: SBool = s11 /= s126 s128 :: SBool = s9 /= s126 s129 :: SBool = s7 /= s126 s130 :: SBool = s5 /= s126 s131 :: SBool = s3 /= s126 s132 :: SWord16 = s86 + s96 s133 :: SBool = s88 /= s132 s134 :: SWord16 = s18 + s42 s135 :: SBool = s11 /= s134 s136 :: SBool = s9 /= s134 s137 :: SBool = s7 /= s134 s138 :: SBool = s5 /= s134 s139 :: SBool = s3 /= s134 s140 :: SWord16 = s86 + s105 s141 :: SBool = s88 /= s140 s142 :: SWord16 = s18 + s54 s143 :: SBool = s11 /= s142 s144 :: SBool = s9 /= s142 s145 :: SBool = s7 /= s142 s146 :: SBool = s5 /= s142 s147 :: SBool = s3 /= s142 s148 :: SWord16 = s86 + s114 s149 :: SBool = s88 /= s148 s150 :: SWord16 = s18 + s66 s151 :: SBool = s11 /= s150 s152 :: SBool = s9 /= s150 s153 :: SBool = s7 /= s150 s154 :: SBool = s5 /= s150 s155 :: SBool = s3 /= s150 s156 :: SWord16 = s86 + s123 s157 :: SBool = s88 /= s156 s158 :: SWord16 = s30 + s42 s159 :: SBool = s11 /= s158 s160 :: SBool = s9 /= s158 s161 :: SBool = s7 /= s158 s162 :: SBool = s5 /= s158 s163 :: SBool = s3 /= s158 s164 :: SWord16 = s96 + s105 s165 :: SBool = s88 /= s164 s166 :: SWord16 = s30 + s54 s167 :: SBool = s11 /= s166 s168 :: SBool = s9 /= s166 s169 :: SBool = s7 /= s166 s170 :: SBool = s5 /= s166 s171 :: SBool = s3 /= s166 s172 :: SWord16 = s96 + s114 s173 :: SBool = s88 /= s172 s174 :: SWord16 = s30 + s66 s175 :: SBool = s11 /= s174 s176 :: SBool = s9 /= s174 s177 :: SBool = s7 /= s174 s178 :: SBool = s5 /= s174 s179 :: SBool = s3 /= s174 s180 :: SWord16 = s96 + s123 s181 :: SBool = s88 /= s180 s182 :: SWord16 = s42 + s54 s183 :: SBool = s11 /= s182 s184 :: SBool = s9 /= s182 s185 :: SBool = s7 /= s182 s186 :: SBool = s5 /= s182 s187 :: SBool = s3 /= s182 s188 :: SWord16 = s105 + s114 s189 :: SBool = s88 /= s188 s190 :: SWord16 = s42 + s66 s191 :: SBool = s11 /= s190 s192 :: SBool = s9 /= s190 s193 :: SBool = s7 /= s190 s194 :: SBool = s5 /= s190 s195 :: SBool = s3 /= s190 s196 :: SWord16 = s105 + s123 s197 :: SBool = s88 /= s196 s198 :: SWord16 = s54 + s66 s199 :: SBool = s11 /= s198 s200 :: SBool = s9 /= s198 s201 :: SBool = s7 /= s198 s202 :: SBool = s5 /= s198 s203 :: SBool = s3 /= s198 s204 :: SWord16 = s114 + s123 s205 :: SBool = s88 /= s204 s206 :: SWord16 = s30 + s78 s207 :: SBool = s11 /= s206 s208 :: SBool = s9 /= s206 s209 :: SBool = s7 /= s206 s210 :: SBool = s5 /= s206 s211 :: SBool = s3 /= s206 s212 :: SWord16 = s87 + s96 s213 :: SBool = s88 /= s212 s214 :: SWord16 = s42 + s78 s215 :: SBool = s11 /= s214 s216 :: SBool = s9 /= s214 s217 :: SBool = s7 /= s214 s218 :: SBool = s5 /= s214 s219 :: SBool = s3 /= s214 s220 :: SWord16 = s87 + s105 s221 :: SBool = s88 /= s220 s222 :: SWord16 = s54 + s78 s223 :: SBool = s11 /= s222 s224 :: SBool = s9 /= s222 s225 :: SBool = s7 /= s222 s226 :: SBool = s5 /= s222 s227 :: SBool = s3 /= s222 s228 :: SWord16 = s87 + s114 s229 :: SBool = s88 /= s228 s230 :: SWord16 = s66 + s78 s231 :: SBool = s11 /= s230 s232 :: SBool = s9 /= s230 s233 :: SBool = s7 /= s230 s234 :: SBool = s5 /= s230 s235 :: SBool = s3 /= s230 s236 :: SWord16 = s87 + s123 s237 :: SBool = s88 /= s236 s238 :: SWord16 = s42 + s90 s239 :: SBool = s11 /= s238 s240 :: SBool = s9 /= s238 s241 :: SBool = s7 /= s238 s242 :: SBool = s5 /= s238 s243 :: SBool = s3 /= s238 s244 :: SWord16 = s97 + s105 s245 :: SBool = s88 /= s244 s246 :: SWord16 = s54 + s90 s247 :: SBool = s11 /= s246 s248 :: SBool = s9 /= s246 s249 :: SBool = s7 /= s246 s250 :: SBool = s5 /= s246 s251 :: SBool = s3 /= s246 s252 :: SWord16 = s97 + s114 s253 :: SBool = s88 /= s252 s254 :: SWord16 = s66 + s90 s255 :: SBool = s11 /= s254 s256 :: SBool = s9 /= s254 s257 :: SBool = s7 /= s254 s258 :: SBool = s5 /= s254 s259 :: SBool = s3 /= s254 s260 :: SWord16 = s97 + s123 s261 :: SBool = s88 /= s260 s262 :: SWord16 = s54 + s99 s263 :: SBool = s11 /= s262 s264 :: SBool = s9 /= s262 s265 :: SBool = s7 /= s262 s266 :: SBool = s5 /= s262 s267 :: SBool = s3 /= s262 s268 :: SWord16 = s106 + s114 s269 :: SBool = s88 /= s268 s270 :: SWord16 = s66 + s99 s271 :: SBool = s11 /= s270 s272 :: SBool = s9 /= s270 s273 :: SBool = s7 /= s270 s274 :: SBool = s5 /= s270 s275 :: SBool = s3 /= s270 s276 :: SWord16 = s106 + s123 s277 :: SBool = s88 /= s276 s278 :: SWord16 = s66 + s108 s279 :: SBool = s11 /= s278 s280 :: SBool = s9 /= s278 s281 :: SBool = s7 /= s278 s282 :: SBool = s5 /= s278 s283 :: SBool = s3 /= s278 s284 :: SWord16 = s115 + s123 s285 :: SBool = s88 /= s284 s286 :: SWord16 = s42 + s126 s287 :: SBool = s11 /= s286 s288 :: SBool = s9 /= s286 s289 :: SBool = s7 /= s286 s290 :: SBool = s5 /= s286 s291 :: SBool = s3 /= s286 s292 :: SWord16 = s105 + s132 s293 :: SBool = s88 /= s292 s294 :: SWord16 = s54 + s126 s295 :: SBool = s11 /= s294 s296 :: SBool = s9 /= s294 s297 :: SBool = s7 /= s294 s298 :: SBool = s5 /= s294 s299 :: SBool = s3 /= s294 s300 :: SWord16 = s114 + s132 s301 :: SBool = s88 /= s300 s302 :: SWord16 = s66 + s126 s303 :: SBool = s11 /= s302 s304 :: SBool = s9 /= s302 s305 :: SBool = s7 /= s302 s306 :: SBool = s5 /= s302 s307 :: SBool = s3 /= s302 s308 :: SWord16 = s123 + s132 s309 :: SBool = s88 /= s308 s310 :: SWord16 = s54 + s134 s311 :: SBool = s11 /= s310 s312 :: SBool = s9 /= s310 s313 :: SBool = s7 /= s310 s314 :: SBool = s5 /= s310 s315 :: SBool = s3 /= s310 s316 :: SWord16 = s114 + s140 s317 :: SBool = s88 /= s316 s318 :: SWord16 = s66 + s134 s319 :: SBool = s11 /= s318 s320 :: SBool = s9 /= s318 s321 :: SBool = s7 /= s318 s322 :: SBool = s5 /= s318 s323 :: SBool = s3 /= s318 s324 :: SWord16 = s123 + s140 s325 :: SBool = s88 /= s324 s326 :: SWord16 = s66 + s142 s327 :: SBool = s11 /= s326 s328 :: SBool = s9 /= s326 s329 :: SBool = s7 /= s326 s330 :: SBool = s5 /= s326 s331 :: SBool = s3 /= s326 s332 :: SWord16 = s123 + s148 s333 :: SBool = s88 /= s332 s334 :: SWord16 = s54 + s158 s335 :: SBool = s11 /= s334 s336 :: SBool = s9 /= s334 s337 :: SBool = s7 /= s334 s338 :: SBool = s5 /= s334 s339 :: SBool = s3 /= s334 s340 :: SWord16 = s114 + s164 s341 :: SBool = s88 /= s340 s342 :: SWord16 = s66 + s158 s343 :: SBool = s11 /= s342 s344 :: SBool = s9 /= s342 s345 :: SBool = s7 /= s342 s346 :: SBool = s5 /= s342 s347 :: SBool = s3 /= s342 s348 :: SWord16 = s123 + s164 s349 :: SBool = s88 /= s348 s350 :: SWord16 = s66 + s166 s351 :: SBool = s11 /= s350 s352 :: SBool = s9 /= s350 s353 :: SBool = s7 /= s350 s354 :: SBool = s5 /= s350 s355 :: SBool = s3 /= s350 s356 :: SWord16 = s123 + s172 s357 :: SBool = s88 /= s356 s358 :: SWord16 = s66 + s182 s359 :: SBool = s11 /= s358 s360 :: SBool = s9 /= s358 s361 :: SBool = s7 /= s358 s362 :: SBool = s5 /= s358 s363 :: SBool = s3 /= s358 s364 :: SWord16 = s123 + s188 s365 :: SBool = s88 /= s364 s366 :: SWord16 = s42 + s206 s367 :: SBool = s11 /= s366 s368 :: SBool = s9 /= s366 s369 :: SBool = s7 /= s366 s370 :: SBool = s5 /= s366 s371 :: SBool = s3 /= s366 s372 :: SWord16 = s105 + s212 s373 :: SBool = s88 /= s372 s374 :: SWord16 = s54 + s206 s375 :: SBool = s11 /= s374 s376 :: SBool = s9 /= s374 s377 :: SBool = s7 /= s374 s378 :: SBool = s5 /= s374 s379 :: SBool = s3 /= s374 s380 :: SWord16 = s114 + s212 s381 :: SBool = s88 /= s380 s382 :: SWord16 = s66 + s206 s383 :: SBool = s11 /= s382 s384 :: SBool = s9 /= s382 s385 :: SBool = s7 /= s382 s386 :: SBool = s5 /= s382 s387 :: SBool = s3 /= s382 s388 :: SWord16 = s123 + s212 s389 :: SBool = s88 /= s388 s390 :: SWord16 = s54 + s214 s391 :: SBool = s11 /= s390 s392 :: SBool = s9 /= s390 s393 :: SBool = s7 /= s390 s394 :: SBool = s5 /= s390 s395 :: SBool = s3 /= s390 s396 :: SWord16 = s114 + s220 s397 :: SBool = s88 /= s396 s398 :: SWord16 = s66 + s214 s399 :: SBool = s11 /= s398 s400 :: SBool = s9 /= s398 s401 :: SBool = s7 /= s398 s402 :: SBool = s5 /= s398 s403 :: SBool = s3 /= s398 s404 :: SWord16 = s123 + s220 s405 :: SBool = s88 /= s404 s406 :: SWord16 = s66 + s222 s407 :: SBool = s11 /= s406 s408 :: SBool = s9 /= s406 s409 :: SBool = s7 /= s406 s410 :: SBool = s5 /= s406 s411 :: SBool = s3 /= s406 s412 :: SWord16 = s123 + s228 s413 :: SBool = s88 /= s412 s414 :: SWord16 = s54 + s238 s415 :: SBool = s11 /= s414 s416 :: SBool = s9 /= s414 s417 :: SBool = s7 /= s414 s418 :: SBool = s5 /= s414 s419 :: SBool = s3 /= s414 s420 :: SWord16 = s114 + s244 s421 :: SBool = s88 /= s420 s422 :: SWord16 = s66 + s238 s423 :: SBool = s11 /= s422 s424 :: SBool = s9 /= s422 s425 :: SBool = s7 /= s422 s426 :: SBool = s5 /= s422 s427 :: SBool = s3 /= s422 s428 :: SWord16 = s123 + s244 s429 :: SBool = s88 /= s428 s430 :: SWord16 = s66 + s246 s431 :: SBool = s11 /= s430 s432 :: SBool = s9 /= s430 s433 :: SBool = s7 /= s430 s434 :: SBool = s5 /= s430 s435 :: SBool = s3 /= s430 s436 :: SWord16 = s123 + s252 s437 :: SBool = s88 /= s436 s438 :: SWord16 = s66 + s262 s439 :: SBool = s11 /= s438 s440 :: SBool = s9 /= s438 s441 :: SBool = s7 /= s438 s442 :: SBool = s5 /= s438 s443 :: SBool = s3 /= s438 s444 :: SWord16 = s123 + s268 s445 :: SBool = s88 /= s444 s446 :: SWord16 = s54 + s286 s447 :: SBool = s11 /= s446 s448 :: SBool = s9 /= s446 s449 :: SBool = s7 /= s446 s450 :: SBool = s5 /= s446 s451 :: SBool = s3 /= s446 s452 :: SWord16 = s114 + s292 s453 :: SBool = s88 /= s452 s454 :: SWord16 = s66 + s286 s455 :: SBool = s11 /= s454 s456 :: SBool = s9 /= s454 s457 :: SBool = s7 /= s454 s458 :: SBool = s5 /= s454 s459 :: SBool = s3 /= s454 s460 :: SWord16 = s123 + s292 s461 :: SBool = s88 /= s460 s462 :: SWord16 = s66 + s294 s463 :: SBool = s11 /= s462 s464 :: SBool = s9 /= s462 s465 :: SBool = s7 /= s462 s466 :: SBool = s5 /= s462 s467 :: SBool = s3 /= s462 s468 :: SWord16 = s123 + s300 s469 :: SBool = s88 /= s468 s470 :: SWord16 = s66 + s310 s471 :: SBool = s11 /= s470 s472 :: SBool = s9 /= s470 s473 :: SBool = s7 /= s470 s474 :: SBool = s5 /= s470 s475 :: SBool = s3 /= s470 s476 :: SWord16 = s123 + s316 s477 :: SBool = s88 /= s476 s478 :: SWord16 = s66 + s334 s479 :: SBool = s11 /= s478 s480 :: SBool = s9 /= s478 s481 :: SBool = s7 /= s478 s482 :: SBool = s5 /= s478 s483 :: SBool = s3 /= s478 s484 :: SWord16 = s123 + s340 s485 :: SBool = s88 /= s484 s486 :: SWord16 = s54 + s366 s487 :: SBool = s11 /= s486 s488 :: SBool = s9 /= s486 s489 :: SBool = s7 /= s486 s490 :: SBool = s5 /= s486 s491 :: SBool = s3 /= s486 s492 :: SWord16 = s114 + s372 s493 :: SBool = s88 /= s492 s494 :: SWord16 = s66 + s366 s495 :: SBool = s11 /= s494 s496 :: SBool = s9 /= s494 s497 :: SBool = s7 /= s494 s498 :: SBool = s5 /= s494 s499 :: SBool = s3 /= s494 s500 :: SWord16 = s123 + s372 s501 :: SBool = s88 /= s500 s502 :: SWord16 = s66 + s374 s503 :: SBool = s11 /= s502 s504 :: SBool = s9 /= s502 s505 :: SBool = s7 /= s502 s506 :: SBool = s5 /= s502 s507 :: SBool = s3 /= s502 s508 :: SWord16 = s123 + s380 s509 :: SBool = s88 /= s508 s510 :: SWord16 = s66 + s390 s511 :: SBool = s11 /= s510 s512 :: SBool = s9 /= s510 s513 :: SBool = s7 /= s510 s514 :: SBool = s5 /= s510 s515 :: SBool = s3 /= s510 s516 :: SWord16 = s123 + s396 s517 :: SBool = s88 /= s516 s518 :: SWord16 = s66 + s414 s519 :: SBool = s11 /= s518 s520 :: SBool = s9 /= s518 s521 :: SBool = s7 /= s518 s522 :: SBool = s5 /= s518 s523 :: SBool = s3 /= s518 s524 :: SWord16 = s123 + s420 s525 :: SBool = s88 /= s524 s526 :: SWord16 = s66 + s446 s527 :: SBool = s11 /= s526 s528 :: SBool = s9 /= s526 s529 :: SBool = s7 /= s526 s530 :: SBool = s5 /= s526 s531 :: SBool = s3 /= s526 s532 :: SWord16 = s123 + s452 s533 :: SBool = s88 /= s532 s534 :: SWord16 = s66 + s486 s535 :: SBool = s11 /= s534 s536 :: SBool = s9 /= s534 s537 :: SBool = s7 /= s534 s538 :: SBool = s5 /= s534 s539 :: SBool = s3 /= s534 s540 :: SWord16 = s123 + s492 s541 :: SBool = s88 /= s540 s542 :: SBool = s0 >= s18 s543 :: SBool = s18 >= s30 s544 :: SBool = s30 >= s42 s545 :: SBool = s42 >= s54 s546 :: SBool = s54 >= s66 s547 :: SBool = s545 & s546 s548 :: SBool = s544 & s547 s549 :: SBool = s543 & s548 s550 :: SBool = s542 & s549 s552 :: SBool = s534 == s551 CONSTRAINTS s17 s29 s41 s53 s65 s77 s79 s80 s81 s82 s83 s89 s91 s92 s93 s94 s95 s98 s100 s101 s102 s103 s104 s107 s109 s110 s111 s112 s113 s116 s118 s119 s120 s121 s122 s125 s127 s128 s129 s130 s131 s133 s135 s136 s137 s138 s139 s141 s143 s144 s145 s146 s147 s149 s151 s152 s153 s154 s155 s157 s159 s160 s161 s162 s163 s165 s167 s168 s169 s170 s171 s173 s175 s176 s177 s178 s179 s181 s183 s184 s185 s186 s187 s189 s191 s192 s193 s194 s195 s197 s199 s200 s201 s202 s203 s205 s207 s208 s209 s210 s211 s213 s215 s216 s217 s218 s219 s221 s223 s224 s225 s226 s227 s229 s231 s232 s233 s234 s235 s237 s239 s240 s241 s242 s243 s245 s247 s248 s249 s250 s251 s253 s255 s256 s257 s258 s259 s261 s263 s264 s265 s266 s267 s269 s271 s272 s273 s274 s275 s277 s279 s280 s281 s282 s283 s285 s287 s288 s289 s290 s291 s293 s295 s296 s297 s298 s299 s301 s303 s304 s305 s306 s307 s309 s311 s312 s313 s314 s315 s317 s319 s320 s321 s322 s323 s325 s327 s328 s329 s330 s331 s333 s335 s336 s337 s338 s339 s341 s343 s344 s345 s346 s347 s349 s351 s352 s353 s354 s355 s357 s359 s360 s361 s362 s363 s365 s367 s368 s369 s370 s371 s373 s375 s376 s377 s378 s379 s381 s383 s384 s385 s386 s387 s389 s391 s392 s393 s394 s395 s397 s399 s400 s401 s402 s403 s405 s407 s408 s409 s410 s411 s413 s415 s416 s417 s418 s419 s421 s423 s424 s425 s426 s427 s429 s431 s432 s433 s434 s435 s437 s439 s440 s441 s442 s443 s445 s447 s448 s449 s450 s451 s453 s455 s456 s457 s458 s459 s461 s463 s464 s465 s466 s467 s469 s471 s472 s473 s474 s475 s477 s479 s480 s481 s482 s483 s485 s487 s488 s489 s490 s491 s493 s495 s496 s497 s498 s499 s501 s503 s504 s505 s506 s507 s509 s511 s512 s513 s514 s515 s517 s519 s520 s521 s522 s523 s525 s527 s528 s529 s530 s531 s533 s535 s536 s537 s538 s539 s541 s550 ASSERTIONS OUTPUTS s552sbv-7.13/SBVTestSuite/GoldFiles/combined1.gold0000644000000000000000000000020113405536617017313 0ustar0000000000000000Optimal model: x = 3 :: Integer y = 2 :: Integer z = 4 :: Integer max_x = 3 :: Integer max_y = 2 :: Integersbv-7.13/SBVTestSuite/GoldFiles/combined2.gold0000644000000000000000000000024413405536617017323 0ustar0000000000000000Optimal model: a = True :: Bool b = False :: Bool c = True :: Bool soft_a = True :: Bool soft_b = False :: Bool soft_c = True :: Boolsbv-7.13/SBVTestSuite/GoldFiles/concreteFoldl.gold0000644000000000000000000000144413405536617020247 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/concreteFoldr.gold0000644000000000000000000000144413405536617020255 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/concreteReverse.gold0000644000000000000000000000144413405536617020622 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/concreteSort.gold0000644000000000000000000000144413405536617020136 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/counts.gold0000644000000000000000000020034113405536617016774 0ustar0000000000000000INPUTS s0 :: SWord8 s1 :: SWord8 s2 :: SWord8 s3 :: SWord8 s4 :: SWord8 s5 :: SWord8 s6 :: SWord8 s7 :: SWord8 s8 :: SWord8 s9 :: SWord8 CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s10 = 10 :: Word8 s12 = 0 :: Word8 s32 = 2 :: Word8 s33 = 1 :: Word8 s35 = 100 :: Word8 s555 = 3 :: Word8 s716 = 4 :: Word8 s877 = 5 :: Word8 s1038 = 6 :: Word8 s1199 = 7 :: Word8 s1360 = 8 :: Word8 s1521 = 9 :: Word8 TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s11 :: SBool = s9 < s10 s13 :: SBool = s9 == s12 s14 :: SBool = s8 < s10 s15 :: SBool = s8 == s12 s16 :: SBool = s7 < s10 s17 :: SBool = s7 == s12 s18 :: SBool = s6 < s10 s19 :: SBool = s6 == s12 s20 :: SBool = s5 < s10 s21 :: SBool = s5 == s12 s22 :: SBool = s4 < s10 s23 :: SBool = s4 == s12 s24 :: SBool = s3 < s10 s25 :: SBool = s3 == s12 s26 :: SBool = s2 < s10 s27 :: SBool = s2 == s12 s28 :: SBool = s1 < s10 s29 :: SBool = s1 == s12 s30 :: SBool = s0 < s10 s31 :: SBool = s0 == s12 s34 :: SWord8 = if s31 then s32 else s33 s36 :: SBool = s0 < s35 s37 :: SWord8 = s0 rem s10 s38 :: SBool = s12 == s37 s39 :: SWord8 = s0 quot s10 s40 :: SWord8 = s39 rem s10 s41 :: SBool = s12 == s40 s42 :: SWord8 = if s41 then s32 else s33 s43 :: SWord8 = s33 + s42 s44 :: SWord8 = if s38 then s43 else s42 s45 :: SWord8 = s39 quot s10 s46 :: SBool = s12 == s45 s47 :: SWord8 = if s46 then s32 else s33 s48 :: SWord8 = s33 + s47 s49 :: SWord8 = if s41 then s48 else s47 s50 :: SWord8 = s33 + s49 s51 :: SWord8 = if s38 then s50 else s49 s52 :: SWord8 = if s36 then s44 else s51 s53 :: SWord8 = if s30 then s34 else s52 s54 :: SWord8 = s33 + s53 s55 :: SWord8 = if s29 then s54 else s53 s56 :: SBool = s1 < s35 s57 :: SWord8 = s1 rem s10 s58 :: SBool = s12 == s57 s59 :: SWord8 = s1 quot s10 s60 :: SWord8 = s59 rem s10 s61 :: SBool = s12 == s60 s62 :: SWord8 = if s61 then s54 else s53 s63 :: SWord8 = s33 + s62 s64 :: SWord8 = if s58 then s63 else s62 s65 :: SWord8 = s59 quot s10 s66 :: SBool = s12 == s65 s67 :: SWord8 = if s66 then s54 else s53 s68 :: SWord8 = s33 + s67 s69 :: SWord8 = if s61 then s68 else s67 s70 :: SWord8 = s33 + s69 s71 :: SWord8 = if s58 then s70 else s69 s72 :: SWord8 = if s56 then s64 else s71 s73 :: SWord8 = if s28 then s55 else s72 s74 :: SWord8 = s33 + s73 s75 :: SWord8 = if s27 then s74 else s73 s76 :: SBool = s2 < s35 s77 :: SWord8 = s2 rem s10 s78 :: SBool = s12 == s77 s79 :: SWord8 = s2 quot s10 s80 :: SWord8 = s79 rem s10 s81 :: SBool = s12 == s80 s82 :: SWord8 = if s81 then s74 else s73 s83 :: SWord8 = s33 + s82 s84 :: SWord8 = if s78 then s83 else s82 s85 :: SWord8 = s79 quot s10 s86 :: SBool = s12 == s85 s87 :: SWord8 = if s86 then s74 else s73 s88 :: SWord8 = s33 + s87 s89 :: SWord8 = if s81 then s88 else s87 s90 :: SWord8 = s33 + s89 s91 :: SWord8 = if s78 then s90 else s89 s92 :: SWord8 = if s76 then s84 else s91 s93 :: SWord8 = if s26 then s75 else s92 s94 :: SWord8 = s33 + s93 s95 :: SWord8 = if s25 then s94 else s93 s96 :: SBool = s3 < s35 s97 :: SWord8 = s3 rem s10 s98 :: SBool = s12 == s97 s99 :: SWord8 = s3 quot s10 s100 :: SWord8 = s99 rem s10 s101 :: SBool = s12 == s100 s102 :: SWord8 = if s101 then s94 else s93 s103 :: SWord8 = s33 + s102 s104 :: SWord8 = if s98 then s103 else s102 s105 :: SWord8 = s99 quot s10 s106 :: SBool = s12 == s105 s107 :: SWord8 = if s106 then s94 else s93 s108 :: SWord8 = s33 + s107 s109 :: SWord8 = if s101 then s108 else s107 s110 :: SWord8 = s33 + s109 s111 :: SWord8 = if s98 then s110 else s109 s112 :: SWord8 = if s96 then s104 else s111 s113 :: SWord8 = if s24 then s95 else s112 s114 :: SWord8 = s33 + s113 s115 :: SWord8 = if s23 then s114 else s113 s116 :: SBool = s4 < s35 s117 :: SWord8 = s4 rem s10 s118 :: SBool = s12 == s117 s119 :: SWord8 = s4 quot s10 s120 :: SWord8 = s119 rem s10 s121 :: SBool = s12 == s120 s122 :: SWord8 = if s121 then s114 else s113 s123 :: SWord8 = s33 + s122 s124 :: SWord8 = if s118 then s123 else s122 s125 :: SWord8 = s119 quot s10 s126 :: SBool = s12 == s125 s127 :: SWord8 = if s126 then s114 else s113 s128 :: SWord8 = s33 + s127 s129 :: SWord8 = if s121 then s128 else s127 s130 :: SWord8 = s33 + s129 s131 :: SWord8 = if s118 then s130 else s129 s132 :: SWord8 = if s116 then s124 else s131 s133 :: SWord8 = if s22 then s115 else s132 s134 :: SWord8 = s33 + s133 s135 :: SWord8 = if s21 then s134 else s133 s136 :: SBool = s5 < s35 s137 :: SWord8 = s5 rem s10 s138 :: SBool = s12 == s137 s139 :: SWord8 = s5 quot s10 s140 :: SWord8 = s139 rem s10 s141 :: SBool = s12 == s140 s142 :: SWord8 = if s141 then s134 else s133 s143 :: SWord8 = s33 + s142 s144 :: SWord8 = if s138 then s143 else s142 s145 :: SWord8 = s139 quot s10 s146 :: SBool = s12 == s145 s147 :: SWord8 = if s146 then s134 else s133 s148 :: SWord8 = s33 + s147 s149 :: SWord8 = if s141 then s148 else s147 s150 :: SWord8 = s33 + s149 s151 :: SWord8 = if s138 then s150 else s149 s152 :: SWord8 = if s136 then s144 else s151 s153 :: SWord8 = if s20 then s135 else s152 s154 :: SWord8 = s33 + s153 s155 :: SWord8 = if s19 then s154 else s153 s156 :: SBool = s6 < s35 s157 :: SWord8 = s6 rem s10 s158 :: SBool = s12 == s157 s159 :: SWord8 = s6 quot s10 s160 :: SWord8 = s159 rem s10 s161 :: SBool = s12 == s160 s162 :: SWord8 = if s161 then s154 else s153 s163 :: SWord8 = s33 + s162 s164 :: SWord8 = if s158 then s163 else s162 s165 :: SWord8 = s159 quot s10 s166 :: SBool = s12 == s165 s167 :: SWord8 = if s166 then s154 else s153 s168 :: SWord8 = s33 + s167 s169 :: SWord8 = if s161 then s168 else s167 s170 :: SWord8 = s33 + s169 s171 :: SWord8 = if s158 then s170 else s169 s172 :: SWord8 = if s156 then s164 else s171 s173 :: SWord8 = if s18 then s155 else s172 s174 :: SWord8 = s33 + s173 s175 :: SWord8 = if s17 then s174 else s173 s176 :: SBool = s7 < s35 s177 :: SWord8 = s7 rem s10 s178 :: SBool = s12 == s177 s179 :: SWord8 = s7 quot s10 s180 :: SWord8 = s179 rem s10 s181 :: SBool = s12 == s180 s182 :: SWord8 = if s181 then s174 else s173 s183 :: SWord8 = s33 + s182 s184 :: SWord8 = if s178 then s183 else s182 s185 :: SWord8 = s179 quot s10 s186 :: SBool = s12 == s185 s187 :: SWord8 = if s186 then s174 else s173 s188 :: SWord8 = s33 + s187 s189 :: SWord8 = if s181 then s188 else s187 s190 :: SWord8 = s33 + s189 s191 :: SWord8 = if s178 then s190 else s189 s192 :: SWord8 = if s176 then s184 else s191 s193 :: SWord8 = if s16 then s175 else s192 s194 :: SWord8 = s33 + s193 s195 :: SWord8 = if s15 then s194 else s193 s196 :: SBool = s8 < s35 s197 :: SWord8 = s8 rem s10 s198 :: SBool = s12 == s197 s199 :: SWord8 = s8 quot s10 s200 :: SWord8 = s199 rem s10 s201 :: SBool = s12 == s200 s202 :: SWord8 = if s201 then s194 else s193 s203 :: SWord8 = s33 + s202 s204 :: SWord8 = if s198 then s203 else s202 s205 :: SWord8 = s199 quot s10 s206 :: SBool = s12 == s205 s207 :: SWord8 = if s206 then s194 else s193 s208 :: SWord8 = s33 + s207 s209 :: SWord8 = if s201 then s208 else s207 s210 :: SWord8 = s33 + s209 s211 :: SWord8 = if s198 then s210 else s209 s212 :: SWord8 = if s196 then s204 else s211 s213 :: SWord8 = if s14 then s195 else s212 s214 :: SWord8 = s33 + s213 s215 :: SWord8 = if s13 then s214 else s213 s216 :: SBool = s9 < s35 s217 :: SWord8 = s9 rem s10 s218 :: SBool = s12 == s217 s219 :: SWord8 = s9 quot s10 s220 :: SWord8 = s219 rem s10 s221 :: SBool = s12 == s220 s222 :: SWord8 = if s221 then s214 else s213 s223 :: SWord8 = s33 + s222 s224 :: SWord8 = if s218 then s223 else s222 s225 :: SWord8 = s219 quot s10 s226 :: SBool = s12 == s225 s227 :: SWord8 = if s226 then s214 else s213 s228 :: SWord8 = s33 + s227 s229 :: SWord8 = if s221 then s228 else s227 s230 :: SWord8 = s33 + s229 s231 :: SWord8 = if s218 then s230 else s229 s232 :: SWord8 = if s216 then s224 else s231 s233 :: SWord8 = if s11 then s215 else s232 s234 :: SBool = s0 == s233 s235 :: SBool = s9 == s33 s236 :: SBool = s8 == s33 s237 :: SBool = s7 == s33 s238 :: SBool = s6 == s33 s239 :: SBool = s5 == s33 s240 :: SBool = s4 == s33 s241 :: SBool = s3 == s33 s242 :: SBool = s2 == s33 s243 :: SBool = s1 == s33 s244 :: SBool = s0 == s33 s245 :: SWord8 = if s244 then s32 else s33 s246 :: SBool = s33 == s37 s247 :: SBool = s33 == s40 s248 :: SWord8 = if s247 then s32 else s33 s249 :: SWord8 = s33 + s248 s250 :: SWord8 = if s246 then s249 else s248 s251 :: SBool = s33 == s45 s252 :: SWord8 = if s251 then s32 else s33 s253 :: SWord8 = s33 + s252 s254 :: SWord8 = if s247 then s253 else s252 s255 :: SWord8 = s33 + s254 s256 :: SWord8 = if s246 then s255 else s254 s257 :: SWord8 = if s36 then s250 else s256 s258 :: SWord8 = if s30 then s245 else s257 s259 :: SWord8 = s33 + s258 s260 :: SWord8 = if s243 then s259 else s258 s261 :: SBool = s33 == s57 s262 :: SBool = s33 == s60 s263 :: SWord8 = if s262 then s259 else s258 s264 :: SWord8 = s33 + s263 s265 :: SWord8 = if s261 then s264 else s263 s266 :: SBool = s33 == s65 s267 :: SWord8 = if s266 then s259 else s258 s268 :: SWord8 = s33 + s267 s269 :: SWord8 = if s262 then s268 else s267 s270 :: SWord8 = s33 + s269 s271 :: SWord8 = if s261 then s270 else s269 s272 :: SWord8 = if s56 then s265 else s271 s273 :: SWord8 = if s28 then s260 else s272 s274 :: SWord8 = s33 + s273 s275 :: SWord8 = if s242 then s274 else s273 s276 :: SBool = s33 == s77 s277 :: SBool = s33 == s80 s278 :: SWord8 = if s277 then s274 else s273 s279 :: SWord8 = s33 + s278 s280 :: SWord8 = if s276 then s279 else s278 s281 :: SBool = s33 == s85 s282 :: SWord8 = if s281 then s274 else s273 s283 :: SWord8 = s33 + s282 s284 :: SWord8 = if s277 then s283 else s282 s285 :: SWord8 = s33 + s284 s286 :: SWord8 = if s276 then s285 else s284 s287 :: SWord8 = if s76 then s280 else s286 s288 :: SWord8 = if s26 then s275 else s287 s289 :: SWord8 = s33 + s288 s290 :: SWord8 = if s241 then s289 else s288 s291 :: SBool = s33 == s97 s292 :: SBool = s33 == s100 s293 :: SWord8 = if s292 then s289 else s288 s294 :: SWord8 = s33 + s293 s295 :: SWord8 = if s291 then s294 else s293 s296 :: SBool = s33 == s105 s297 :: SWord8 = if s296 then s289 else s288 s298 :: SWord8 = s33 + s297 s299 :: SWord8 = if s292 then s298 else s297 s300 :: SWord8 = s33 + s299 s301 :: SWord8 = if s291 then s300 else s299 s302 :: SWord8 = if s96 then s295 else s301 s303 :: SWord8 = if s24 then s290 else s302 s304 :: SWord8 = s33 + s303 s305 :: SWord8 = if s240 then s304 else s303 s306 :: SBool = s33 == s117 s307 :: SBool = s33 == s120 s308 :: SWord8 = if s307 then s304 else s303 s309 :: SWord8 = s33 + s308 s310 :: SWord8 = if s306 then s309 else s308 s311 :: SBool = s33 == s125 s312 :: SWord8 = if s311 then s304 else s303 s313 :: SWord8 = s33 + s312 s314 :: SWord8 = if s307 then s313 else s312 s315 :: SWord8 = s33 + s314 s316 :: SWord8 = if s306 then s315 else s314 s317 :: SWord8 = if s116 then s310 else s316 s318 :: SWord8 = if s22 then s305 else s317 s319 :: SWord8 = s33 + s318 s320 :: SWord8 = if s239 then s319 else s318 s321 :: SBool = s33 == s137 s322 :: SBool = s33 == s140 s323 :: SWord8 = if s322 then s319 else s318 s324 :: SWord8 = s33 + s323 s325 :: SWord8 = if s321 then s324 else s323 s326 :: SBool = s33 == s145 s327 :: SWord8 = if s326 then s319 else s318 s328 :: SWord8 = s33 + s327 s329 :: SWord8 = if s322 then s328 else s327 s330 :: SWord8 = s33 + s329 s331 :: SWord8 = if s321 then s330 else s329 s332 :: SWord8 = if s136 then s325 else s331 s333 :: SWord8 = if s20 then s320 else s332 s334 :: SWord8 = s33 + s333 s335 :: SWord8 = if s238 then s334 else s333 s336 :: SBool = s33 == s157 s337 :: SBool = s33 == s160 s338 :: SWord8 = if s337 then s334 else s333 s339 :: SWord8 = s33 + s338 s340 :: SWord8 = if s336 then s339 else s338 s341 :: SBool = s33 == s165 s342 :: SWord8 = if s341 then s334 else s333 s343 :: SWord8 = s33 + s342 s344 :: SWord8 = if s337 then s343 else s342 s345 :: SWord8 = s33 + s344 s346 :: SWord8 = if s336 then s345 else s344 s347 :: SWord8 = if s156 then s340 else s346 s348 :: SWord8 = if s18 then s335 else s347 s349 :: SWord8 = s33 + s348 s350 :: SWord8 = if s237 then s349 else s348 s351 :: SBool = s33 == s177 s352 :: SBool = s33 == s180 s353 :: SWord8 = if s352 then s349 else s348 s354 :: SWord8 = s33 + s353 s355 :: SWord8 = if s351 then s354 else s353 s356 :: SBool = s33 == s185 s357 :: SWord8 = if s356 then s349 else s348 s358 :: SWord8 = s33 + s357 s359 :: SWord8 = if s352 then s358 else s357 s360 :: SWord8 = s33 + s359 s361 :: SWord8 = if s351 then s360 else s359 s362 :: SWord8 = if s176 then s355 else s361 s363 :: SWord8 = if s16 then s350 else s362 s364 :: SWord8 = s33 + s363 s365 :: SWord8 = if s236 then s364 else s363 s366 :: SBool = s33 == s197 s367 :: SBool = s33 == s200 s368 :: SWord8 = if s367 then s364 else s363 s369 :: SWord8 = s33 + s368 s370 :: SWord8 = if s366 then s369 else s368 s371 :: SBool = s33 == s205 s372 :: SWord8 = if s371 then s364 else s363 s373 :: SWord8 = s33 + s372 s374 :: SWord8 = if s367 then s373 else s372 s375 :: SWord8 = s33 + s374 s376 :: SWord8 = if s366 then s375 else s374 s377 :: SWord8 = if s196 then s370 else s376 s378 :: SWord8 = if s14 then s365 else s377 s379 :: SWord8 = s33 + s378 s380 :: SWord8 = if s235 then s379 else s378 s381 :: SBool = s33 == s217 s382 :: SBool = s33 == s220 s383 :: SWord8 = if s382 then s379 else s378 s384 :: SWord8 = s33 + s383 s385 :: SWord8 = if s381 then s384 else s383 s386 :: SBool = s33 == s225 s387 :: SWord8 = if s386 then s379 else s378 s388 :: SWord8 = s33 + s387 s389 :: SWord8 = if s382 then s388 else s387 s390 :: SWord8 = s33 + s389 s391 :: SWord8 = if s381 then s390 else s389 s392 :: SWord8 = if s216 then s385 else s391 s393 :: SWord8 = if s11 then s380 else s392 s394 :: SBool = s1 == s393 s395 :: SBool = s9 == s32 s396 :: SBool = s8 == s32 s397 :: SBool = s7 == s32 s398 :: SBool = s6 == s32 s399 :: SBool = s5 == s32 s400 :: SBool = s4 == s32 s401 :: SBool = s3 == s32 s402 :: SBool = s2 == s32 s403 :: SBool = s1 == s32 s404 :: SBool = s0 == s32 s405 :: SWord8 = if s404 then s32 else s33 s406 :: SBool = s32 == s37 s407 :: SBool = s32 == s40 s408 :: SWord8 = if s407 then s32 else s33 s409 :: SWord8 = s33 + s408 s410 :: SWord8 = if s406 then s409 else s408 s411 :: SBool = s32 == s45 s412 :: SWord8 = if s411 then s32 else s33 s413 :: SWord8 = s33 + s412 s414 :: SWord8 = if s407 then s413 else s412 s415 :: SWord8 = s33 + s414 s416 :: SWord8 = if s406 then s415 else s414 s417 :: SWord8 = if s36 then s410 else s416 s418 :: SWord8 = if s30 then s405 else s417 s419 :: SWord8 = s33 + s418 s420 :: SWord8 = if s403 then s419 else s418 s421 :: SBool = s32 == s57 s422 :: SBool = s32 == s60 s423 :: SWord8 = if s422 then s419 else s418 s424 :: SWord8 = s33 + s423 s425 :: SWord8 = if s421 then s424 else s423 s426 :: SBool = s32 == s65 s427 :: SWord8 = if s426 then s419 else s418 s428 :: SWord8 = s33 + s427 s429 :: SWord8 = if s422 then s428 else s427 s430 :: SWord8 = s33 + s429 s431 :: SWord8 = if s421 then s430 else s429 s432 :: SWord8 = if s56 then s425 else s431 s433 :: SWord8 = if s28 then s420 else s432 s434 :: SWord8 = s33 + s433 s435 :: SWord8 = if s402 then s434 else s433 s436 :: SBool = s32 == s77 s437 :: SBool = s32 == s80 s438 :: SWord8 = if s437 then s434 else s433 s439 :: SWord8 = s33 + s438 s440 :: SWord8 = if s436 then s439 else s438 s441 :: SBool = s32 == s85 s442 :: SWord8 = if s441 then s434 else s433 s443 :: SWord8 = s33 + s442 s444 :: SWord8 = if s437 then s443 else s442 s445 :: SWord8 = s33 + s444 s446 :: SWord8 = if s436 then s445 else s444 s447 :: SWord8 = if s76 then s440 else s446 s448 :: SWord8 = if s26 then s435 else s447 s449 :: SWord8 = s33 + s448 s450 :: SWord8 = if s401 then s449 else s448 s451 :: SBool = s32 == s97 s452 :: SBool = s32 == s100 s453 :: SWord8 = if s452 then s449 else s448 s454 :: SWord8 = s33 + s453 s455 :: SWord8 = if s451 then s454 else s453 s456 :: SBool = s32 == s105 s457 :: SWord8 = if s456 then s449 else s448 s458 :: SWord8 = s33 + s457 s459 :: SWord8 = if s452 then s458 else s457 s460 :: SWord8 = s33 + s459 s461 :: SWord8 = if s451 then s460 else s459 s462 :: SWord8 = if s96 then s455 else s461 s463 :: SWord8 = if s24 then s450 else s462 s464 :: SWord8 = s33 + s463 s465 :: SWord8 = if s400 then s464 else s463 s466 :: SBool = s32 == s117 s467 :: SBool = s32 == s120 s468 :: SWord8 = if s467 then s464 else s463 s469 :: SWord8 = s33 + s468 s470 :: SWord8 = if s466 then s469 else s468 s471 :: SBool = s32 == s125 s472 :: SWord8 = if s471 then s464 else s463 s473 :: SWord8 = s33 + s472 s474 :: SWord8 = if s467 then s473 else s472 s475 :: SWord8 = s33 + s474 s476 :: SWord8 = if s466 then s475 else s474 s477 :: SWord8 = if s116 then s470 else s476 s478 :: SWord8 = if s22 then s465 else s477 s479 :: SWord8 = s33 + s478 s480 :: SWord8 = if s399 then s479 else s478 s481 :: SBool = s32 == s137 s482 :: SBool = s32 == s140 s483 :: SWord8 = if s482 then s479 else s478 s484 :: SWord8 = s33 + s483 s485 :: SWord8 = if s481 then s484 else s483 s486 :: SBool = s32 == s145 s487 :: SWord8 = if s486 then s479 else s478 s488 :: SWord8 = s33 + s487 s489 :: SWord8 = if s482 then s488 else s487 s490 :: SWord8 = s33 + s489 s491 :: SWord8 = if s481 then s490 else s489 s492 :: SWord8 = if s136 then s485 else s491 s493 :: SWord8 = if s20 then s480 else s492 s494 :: SWord8 = s33 + s493 s495 :: SWord8 = if s398 then s494 else s493 s496 :: SBool = s32 == s157 s497 :: SBool = s32 == s160 s498 :: SWord8 = if s497 then s494 else s493 s499 :: SWord8 = s33 + s498 s500 :: SWord8 = if s496 then s499 else s498 s501 :: SBool = s32 == s165 s502 :: SWord8 = if s501 then s494 else s493 s503 :: SWord8 = s33 + s502 s504 :: SWord8 = if s497 then s503 else s502 s505 :: SWord8 = s33 + s504 s506 :: SWord8 = if s496 then s505 else s504 s507 :: SWord8 = if s156 then s500 else s506 s508 :: SWord8 = if s18 then s495 else s507 s509 :: SWord8 = s33 + s508 s510 :: SWord8 = if s397 then s509 else s508 s511 :: SBool = s32 == s177 s512 :: SBool = s32 == s180 s513 :: SWord8 = if s512 then s509 else s508 s514 :: SWord8 = s33 + s513 s515 :: SWord8 = if s511 then s514 else s513 s516 :: SBool = s32 == s185 s517 :: SWord8 = if s516 then s509 else s508 s518 :: SWord8 = s33 + s517 s519 :: SWord8 = if s512 then s518 else s517 s520 :: SWord8 = s33 + s519 s521 :: SWord8 = if s511 then s520 else s519 s522 :: SWord8 = if s176 then s515 else s521 s523 :: SWord8 = if s16 then s510 else s522 s524 :: SWord8 = s33 + s523 s525 :: SWord8 = if s396 then s524 else s523 s526 :: SBool = s32 == s197 s527 :: SBool = s32 == s200 s528 :: SWord8 = if s527 then s524 else s523 s529 :: SWord8 = s33 + s528 s530 :: SWord8 = if s526 then s529 else s528 s531 :: SBool = s32 == s205 s532 :: SWord8 = if s531 then s524 else s523 s533 :: SWord8 = s33 + s532 s534 :: SWord8 = if s527 then s533 else s532 s535 :: SWord8 = s33 + s534 s536 :: SWord8 = if s526 then s535 else s534 s537 :: SWord8 = if s196 then s530 else s536 s538 :: SWord8 = if s14 then s525 else s537 s539 :: SWord8 = s33 + s538 s540 :: SWord8 = if s395 then s539 else s538 s541 :: SBool = s32 == s217 s542 :: SBool = s32 == s220 s543 :: SWord8 = if s542 then s539 else s538 s544 :: SWord8 = s33 + s543 s545 :: SWord8 = if s541 then s544 else s543 s546 :: SBool = s32 == s225 s547 :: SWord8 = if s546 then s539 else s538 s548 :: SWord8 = s33 + s547 s549 :: SWord8 = if s542 then s548 else s547 s550 :: SWord8 = s33 + s549 s551 :: SWord8 = if s541 then s550 else s549 s552 :: SWord8 = if s216 then s545 else s551 s553 :: SWord8 = if s11 then s540 else s552 s554 :: SBool = s2 == s553 s556 :: SBool = s9 == s555 s557 :: SBool = s8 == s555 s558 :: SBool = s7 == s555 s559 :: SBool = s6 == s555 s560 :: SBool = s5 == s555 s561 :: SBool = s4 == s555 s562 :: SBool = s3 == s555 s563 :: SBool = s2 == s555 s564 :: SBool = s1 == s555 s565 :: SBool = s0 == s555 s566 :: SWord8 = if s565 then s32 else s33 s567 :: SBool = s37 == s555 s568 :: SBool = s40 == s555 s569 :: SWord8 = if s568 then s32 else s33 s570 :: SWord8 = s33 + s569 s571 :: SWord8 = if s567 then s570 else s569 s572 :: SBool = s45 == s555 s573 :: SWord8 = if s572 then s32 else s33 s574 :: SWord8 = s33 + s573 s575 :: SWord8 = if s568 then s574 else s573 s576 :: SWord8 = s33 + s575 s577 :: SWord8 = if s567 then s576 else s575 s578 :: SWord8 = if s36 then s571 else s577 s579 :: SWord8 = if s30 then s566 else s578 s580 :: SWord8 = s33 + s579 s581 :: SWord8 = if s564 then s580 else s579 s582 :: SBool = s57 == s555 s583 :: SBool = s60 == s555 s584 :: SWord8 = if s583 then s580 else s579 s585 :: SWord8 = s33 + s584 s586 :: SWord8 = if s582 then s585 else s584 s587 :: SBool = s65 == s555 s588 :: SWord8 = if s587 then s580 else s579 s589 :: SWord8 = s33 + s588 s590 :: SWord8 = if s583 then s589 else s588 s591 :: SWord8 = s33 + s590 s592 :: SWord8 = if s582 then s591 else s590 s593 :: SWord8 = if s56 then s586 else s592 s594 :: SWord8 = if s28 then s581 else s593 s595 :: SWord8 = s33 + s594 s596 :: SWord8 = if s563 then s595 else s594 s597 :: SBool = s77 == s555 s598 :: SBool = s80 == s555 s599 :: SWord8 = if s598 then s595 else s594 s600 :: SWord8 = s33 + s599 s601 :: SWord8 = if s597 then s600 else s599 s602 :: SBool = s85 == s555 s603 :: SWord8 = if s602 then s595 else s594 s604 :: SWord8 = s33 + s603 s605 :: SWord8 = if s598 then s604 else s603 s606 :: SWord8 = s33 + s605 s607 :: SWord8 = if s597 then s606 else s605 s608 :: SWord8 = if s76 then s601 else s607 s609 :: SWord8 = if s26 then s596 else s608 s610 :: SWord8 = s33 + s609 s611 :: SWord8 = if s562 then s610 else s609 s612 :: SBool = s97 == s555 s613 :: SBool = s100 == s555 s614 :: SWord8 = if s613 then s610 else s609 s615 :: SWord8 = s33 + s614 s616 :: SWord8 = if s612 then s615 else s614 s617 :: SBool = s105 == s555 s618 :: SWord8 = if s617 then s610 else s609 s619 :: SWord8 = s33 + s618 s620 :: SWord8 = if s613 then s619 else s618 s621 :: SWord8 = s33 + s620 s622 :: SWord8 = if s612 then s621 else s620 s623 :: SWord8 = if s96 then s616 else s622 s624 :: SWord8 = if s24 then s611 else s623 s625 :: SWord8 = s33 + s624 s626 :: SWord8 = if s561 then s625 else s624 s627 :: SBool = s117 == s555 s628 :: SBool = s120 == s555 s629 :: SWord8 = if s628 then s625 else s624 s630 :: SWord8 = s33 + s629 s631 :: SWord8 = if s627 then s630 else s629 s632 :: SBool = s125 == s555 s633 :: SWord8 = if s632 then s625 else s624 s634 :: SWord8 = s33 + s633 s635 :: SWord8 = if s628 then s634 else s633 s636 :: SWord8 = s33 + s635 s637 :: SWord8 = if s627 then s636 else s635 s638 :: SWord8 = if s116 then s631 else s637 s639 :: SWord8 = if s22 then s626 else s638 s640 :: SWord8 = s33 + s639 s641 :: SWord8 = if s560 then s640 else s639 s642 :: SBool = s137 == s555 s643 :: SBool = s140 == s555 s644 :: SWord8 = if s643 then s640 else s639 s645 :: SWord8 = s33 + s644 s646 :: SWord8 = if s642 then s645 else s644 s647 :: SBool = s145 == s555 s648 :: SWord8 = if s647 then s640 else s639 s649 :: SWord8 = s33 + s648 s650 :: SWord8 = if s643 then s649 else s648 s651 :: SWord8 = s33 + s650 s652 :: SWord8 = if s642 then s651 else s650 s653 :: SWord8 = if s136 then s646 else s652 s654 :: SWord8 = if s20 then s641 else s653 s655 :: SWord8 = s33 + s654 s656 :: SWord8 = if s559 then s655 else s654 s657 :: SBool = s157 == s555 s658 :: SBool = s160 == s555 s659 :: SWord8 = if s658 then s655 else s654 s660 :: SWord8 = s33 + s659 s661 :: SWord8 = if s657 then s660 else s659 s662 :: SBool = s165 == s555 s663 :: SWord8 = if s662 then s655 else s654 s664 :: SWord8 = s33 + s663 s665 :: SWord8 = if s658 then s664 else s663 s666 :: SWord8 = s33 + s665 s667 :: SWord8 = if s657 then s666 else s665 s668 :: SWord8 = if s156 then s661 else s667 s669 :: SWord8 = if s18 then s656 else s668 s670 :: SWord8 = s33 + s669 s671 :: SWord8 = if s558 then s670 else s669 s672 :: SBool = s177 == s555 s673 :: SBool = s180 == s555 s674 :: SWord8 = if s673 then s670 else s669 s675 :: SWord8 = s33 + s674 s676 :: SWord8 = if s672 then s675 else s674 s677 :: SBool = s185 == s555 s678 :: SWord8 = if s677 then s670 else s669 s679 :: SWord8 = s33 + s678 s680 :: SWord8 = if s673 then s679 else s678 s681 :: SWord8 = s33 + s680 s682 :: SWord8 = if s672 then s681 else s680 s683 :: SWord8 = if s176 then s676 else s682 s684 :: SWord8 = if s16 then s671 else s683 s685 :: SWord8 = s33 + s684 s686 :: SWord8 = if s557 then s685 else s684 s687 :: SBool = s197 == s555 s688 :: SBool = s200 == s555 s689 :: SWord8 = if s688 then s685 else s684 s690 :: SWord8 = s33 + s689 s691 :: SWord8 = if s687 then s690 else s689 s692 :: SBool = s205 == s555 s693 :: SWord8 = if s692 then s685 else s684 s694 :: SWord8 = s33 + s693 s695 :: SWord8 = if s688 then s694 else s693 s696 :: SWord8 = s33 + s695 s697 :: SWord8 = if s687 then s696 else s695 s698 :: SWord8 = if s196 then s691 else s697 s699 :: SWord8 = if s14 then s686 else s698 s700 :: SWord8 = s33 + s699 s701 :: SWord8 = if s556 then s700 else s699 s702 :: SBool = s217 == s555 s703 :: SBool = s220 == s555 s704 :: SWord8 = if s703 then s700 else s699 s705 :: SWord8 = s33 + s704 s706 :: SWord8 = if s702 then s705 else s704 s707 :: SBool = s225 == s555 s708 :: SWord8 = if s707 then s700 else s699 s709 :: SWord8 = s33 + s708 s710 :: SWord8 = if s703 then s709 else s708 s711 :: SWord8 = s33 + s710 s712 :: SWord8 = if s702 then s711 else s710 s713 :: SWord8 = if s216 then s706 else s712 s714 :: SWord8 = if s11 then s701 else s713 s715 :: SBool = s3 == s714 s717 :: SBool = s9 == s716 s718 :: SBool = s8 == s716 s719 :: SBool = s7 == s716 s720 :: SBool = s6 == s716 s721 :: SBool = s5 == s716 s722 :: SBool = s4 == s716 s723 :: SBool = s3 == s716 s724 :: SBool = s2 == s716 s725 :: SBool = s1 == s716 s726 :: SBool = s0 == s716 s727 :: SWord8 = if s726 then s32 else s33 s728 :: SBool = s37 == s716 s729 :: SBool = s40 == s716 s730 :: SWord8 = if s729 then s32 else s33 s731 :: SWord8 = s33 + s730 s732 :: SWord8 = if s728 then s731 else s730 s733 :: SBool = s45 == s716 s734 :: SWord8 = if s733 then s32 else s33 s735 :: SWord8 = s33 + s734 s736 :: SWord8 = if s729 then s735 else s734 s737 :: SWord8 = s33 + s736 s738 :: SWord8 = if s728 then s737 else s736 s739 :: SWord8 = if s36 then s732 else s738 s740 :: SWord8 = if s30 then s727 else s739 s741 :: SWord8 = s33 + s740 s742 :: SWord8 = if s725 then s741 else s740 s743 :: SBool = s57 == s716 s744 :: SBool = s60 == s716 s745 :: SWord8 = if s744 then s741 else s740 s746 :: SWord8 = s33 + s745 s747 :: SWord8 = if s743 then s746 else s745 s748 :: SBool = s65 == s716 s749 :: SWord8 = if s748 then s741 else s740 s750 :: SWord8 = s33 + s749 s751 :: SWord8 = if s744 then s750 else s749 s752 :: SWord8 = s33 + s751 s753 :: SWord8 = if s743 then s752 else s751 s754 :: SWord8 = if s56 then s747 else s753 s755 :: SWord8 = if s28 then s742 else s754 s756 :: SWord8 = s33 + s755 s757 :: SWord8 = if s724 then s756 else s755 s758 :: SBool = s77 == s716 s759 :: SBool = s80 == s716 s760 :: SWord8 = if s759 then s756 else s755 s761 :: SWord8 = s33 + s760 s762 :: SWord8 = if s758 then s761 else s760 s763 :: SBool = s85 == s716 s764 :: SWord8 = if s763 then s756 else s755 s765 :: SWord8 = s33 + s764 s766 :: SWord8 = if s759 then s765 else s764 s767 :: SWord8 = s33 + s766 s768 :: SWord8 = if s758 then s767 else s766 s769 :: SWord8 = if s76 then s762 else s768 s770 :: SWord8 = if s26 then s757 else s769 s771 :: SWord8 = s33 + s770 s772 :: SWord8 = if s723 then s771 else s770 s773 :: SBool = s97 == s716 s774 :: SBool = s100 == s716 s775 :: SWord8 = if s774 then s771 else s770 s776 :: SWord8 = s33 + s775 s777 :: SWord8 = if s773 then s776 else s775 s778 :: SBool = s105 == s716 s779 :: SWord8 = if s778 then s771 else s770 s780 :: SWord8 = s33 + s779 s781 :: SWord8 = if s774 then s780 else s779 s782 :: SWord8 = s33 + s781 s783 :: SWord8 = if s773 then s782 else s781 s784 :: SWord8 = if s96 then s777 else s783 s785 :: SWord8 = if s24 then s772 else s784 s786 :: SWord8 = s33 + s785 s787 :: SWord8 = if s722 then s786 else s785 s788 :: SBool = s117 == s716 s789 :: SBool = s120 == s716 s790 :: SWord8 = if s789 then s786 else s785 s791 :: SWord8 = s33 + s790 s792 :: SWord8 = if s788 then s791 else s790 s793 :: SBool = s125 == s716 s794 :: SWord8 = if s793 then s786 else s785 s795 :: SWord8 = s33 + s794 s796 :: SWord8 = if s789 then s795 else s794 s797 :: SWord8 = s33 + s796 s798 :: SWord8 = if s788 then s797 else s796 s799 :: SWord8 = if s116 then s792 else s798 s800 :: SWord8 = if s22 then s787 else s799 s801 :: SWord8 = s33 + s800 s802 :: SWord8 = if s721 then s801 else s800 s803 :: SBool = s137 == s716 s804 :: SBool = s140 == s716 s805 :: SWord8 = if s804 then s801 else s800 s806 :: SWord8 = s33 + s805 s807 :: SWord8 = if s803 then s806 else s805 s808 :: SBool = s145 == s716 s809 :: SWord8 = if s808 then s801 else s800 s810 :: SWord8 = s33 + s809 s811 :: SWord8 = if s804 then s810 else s809 s812 :: SWord8 = s33 + s811 s813 :: SWord8 = if s803 then s812 else s811 s814 :: SWord8 = if s136 then s807 else s813 s815 :: SWord8 = if s20 then s802 else s814 s816 :: SWord8 = s33 + s815 s817 :: SWord8 = if s720 then s816 else s815 s818 :: SBool = s157 == s716 s819 :: SBool = s160 == s716 s820 :: SWord8 = if s819 then s816 else s815 s821 :: SWord8 = s33 + s820 s822 :: SWord8 = if s818 then s821 else s820 s823 :: SBool = s165 == s716 s824 :: SWord8 = if s823 then s816 else s815 s825 :: SWord8 = s33 + s824 s826 :: SWord8 = if s819 then s825 else s824 s827 :: SWord8 = s33 + s826 s828 :: SWord8 = if s818 then s827 else s826 s829 :: SWord8 = if s156 then s822 else s828 s830 :: SWord8 = if s18 then s817 else s829 s831 :: SWord8 = s33 + s830 s832 :: SWord8 = if s719 then s831 else s830 s833 :: SBool = s177 == s716 s834 :: SBool = s180 == s716 s835 :: SWord8 = if s834 then s831 else s830 s836 :: SWord8 = s33 + s835 s837 :: SWord8 = if s833 then s836 else s835 s838 :: SBool = s185 == s716 s839 :: SWord8 = if s838 then s831 else s830 s840 :: SWord8 = s33 + s839 s841 :: SWord8 = if s834 then s840 else s839 s842 :: SWord8 = s33 + s841 s843 :: SWord8 = if s833 then s842 else s841 s844 :: SWord8 = if s176 then s837 else s843 s845 :: SWord8 = if s16 then s832 else s844 s846 :: SWord8 = s33 + s845 s847 :: SWord8 = if s718 then s846 else s845 s848 :: SBool = s197 == s716 s849 :: SBool = s200 == s716 s850 :: SWord8 = if s849 then s846 else s845 s851 :: SWord8 = s33 + s850 s852 :: SWord8 = if s848 then s851 else s850 s853 :: SBool = s205 == s716 s854 :: SWord8 = if s853 then s846 else s845 s855 :: SWord8 = s33 + s854 s856 :: SWord8 = if s849 then s855 else s854 s857 :: SWord8 = s33 + s856 s858 :: SWord8 = if s848 then s857 else s856 s859 :: SWord8 = if s196 then s852 else s858 s860 :: SWord8 = if s14 then s847 else s859 s861 :: SWord8 = s33 + s860 s862 :: SWord8 = if s717 then s861 else s860 s863 :: SBool = s217 == s716 s864 :: SBool = s220 == s716 s865 :: SWord8 = if s864 then s861 else s860 s866 :: SWord8 = s33 + s865 s867 :: SWord8 = if s863 then s866 else s865 s868 :: SBool = s225 == s716 s869 :: SWord8 = if s868 then s861 else s860 s870 :: SWord8 = s33 + s869 s871 :: SWord8 = if s864 then s870 else s869 s872 :: SWord8 = s33 + s871 s873 :: SWord8 = if s863 then s872 else s871 s874 :: SWord8 = if s216 then s867 else s873 s875 :: SWord8 = if s11 then s862 else s874 s876 :: SBool = s4 == s875 s878 :: SBool = s9 == s877 s879 :: SBool = s8 == s877 s880 :: SBool = s7 == s877 s881 :: SBool = s6 == s877 s882 :: SBool = s5 == s877 s883 :: SBool = s4 == s877 s884 :: SBool = s3 == s877 s885 :: SBool = s2 == s877 s886 :: SBool = s1 == s877 s887 :: SBool = s0 == s877 s888 :: SWord8 = if s887 then s32 else s33 s889 :: SBool = s37 == s877 s890 :: SBool = s40 == s877 s891 :: SWord8 = if s890 then s32 else s33 s892 :: SWord8 = s33 + s891 s893 :: SWord8 = if s889 then s892 else s891 s894 :: SBool = s45 == s877 s895 :: SWord8 = if s894 then s32 else s33 s896 :: SWord8 = s33 + s895 s897 :: SWord8 = if s890 then s896 else s895 s898 :: SWord8 = s33 + s897 s899 :: SWord8 = if s889 then s898 else s897 s900 :: SWord8 = if s36 then s893 else s899 s901 :: SWord8 = if s30 then s888 else s900 s902 :: SWord8 = s33 + s901 s903 :: SWord8 = if s886 then s902 else s901 s904 :: SBool = s57 == s877 s905 :: SBool = s60 == s877 s906 :: SWord8 = if s905 then s902 else s901 s907 :: SWord8 = s33 + s906 s908 :: SWord8 = if s904 then s907 else s906 s909 :: SBool = s65 == s877 s910 :: SWord8 = if s909 then s902 else s901 s911 :: SWord8 = s33 + s910 s912 :: SWord8 = if s905 then s911 else s910 s913 :: SWord8 = s33 + s912 s914 :: SWord8 = if s904 then s913 else s912 s915 :: SWord8 = if s56 then s908 else s914 s916 :: SWord8 = if s28 then s903 else s915 s917 :: SWord8 = s33 + s916 s918 :: SWord8 = if s885 then s917 else s916 s919 :: SBool = s77 == s877 s920 :: SBool = s80 == s877 s921 :: SWord8 = if s920 then s917 else s916 s922 :: SWord8 = s33 + s921 s923 :: SWord8 = if s919 then s922 else s921 s924 :: SBool = s85 == s877 s925 :: SWord8 = if s924 then s917 else s916 s926 :: SWord8 = s33 + s925 s927 :: SWord8 = if s920 then s926 else s925 s928 :: SWord8 = s33 + s927 s929 :: SWord8 = if s919 then s928 else s927 s930 :: SWord8 = if s76 then s923 else s929 s931 :: SWord8 = if s26 then s918 else s930 s932 :: SWord8 = s33 + s931 s933 :: SWord8 = if s884 then s932 else s931 s934 :: SBool = s97 == s877 s935 :: SBool = s100 == s877 s936 :: SWord8 = if s935 then s932 else s931 s937 :: SWord8 = s33 + s936 s938 :: SWord8 = if s934 then s937 else s936 s939 :: SBool = s105 == s877 s940 :: SWord8 = if s939 then s932 else s931 s941 :: SWord8 = s33 + s940 s942 :: SWord8 = if s935 then s941 else s940 s943 :: SWord8 = s33 + s942 s944 :: SWord8 = if s934 then s943 else s942 s945 :: SWord8 = if s96 then s938 else s944 s946 :: SWord8 = if s24 then s933 else s945 s947 :: SWord8 = s33 + s946 s948 :: SWord8 = if s883 then s947 else s946 s949 :: SBool = s117 == s877 s950 :: SBool = s120 == s877 s951 :: SWord8 = if s950 then s947 else s946 s952 :: SWord8 = s33 + s951 s953 :: SWord8 = if s949 then s952 else s951 s954 :: SBool = s125 == s877 s955 :: SWord8 = if s954 then s947 else s946 s956 :: SWord8 = s33 + s955 s957 :: SWord8 = if s950 then s956 else s955 s958 :: SWord8 = s33 + s957 s959 :: SWord8 = if s949 then s958 else s957 s960 :: SWord8 = if s116 then s953 else s959 s961 :: SWord8 = if s22 then s948 else s960 s962 :: SWord8 = s33 + s961 s963 :: SWord8 = if s882 then s962 else s961 s964 :: SBool = s137 == s877 s965 :: SBool = s140 == s877 s966 :: SWord8 = if s965 then s962 else s961 s967 :: SWord8 = s33 + s966 s968 :: SWord8 = if s964 then s967 else s966 s969 :: SBool = s145 == s877 s970 :: SWord8 = if s969 then s962 else s961 s971 :: SWord8 = s33 + s970 s972 :: SWord8 = if s965 then s971 else s970 s973 :: SWord8 = s33 + s972 s974 :: SWord8 = if s964 then s973 else s972 s975 :: SWord8 = if s136 then s968 else s974 s976 :: SWord8 = if s20 then s963 else s975 s977 :: SWord8 = s33 + s976 s978 :: SWord8 = if s881 then s977 else s976 s979 :: SBool = s157 == s877 s980 :: SBool = s160 == s877 s981 :: SWord8 = if s980 then s977 else s976 s982 :: SWord8 = s33 + s981 s983 :: SWord8 = if s979 then s982 else s981 s984 :: SBool = s165 == s877 s985 :: SWord8 = if s984 then s977 else s976 s986 :: SWord8 = s33 + s985 s987 :: SWord8 = if s980 then s986 else s985 s988 :: SWord8 = s33 + s987 s989 :: SWord8 = if s979 then s988 else s987 s990 :: SWord8 = if s156 then s983 else s989 s991 :: SWord8 = if s18 then s978 else s990 s992 :: SWord8 = s33 + s991 s993 :: SWord8 = if s880 then s992 else s991 s994 :: SBool = s177 == s877 s995 :: SBool = s180 == s877 s996 :: SWord8 = if s995 then s992 else s991 s997 :: SWord8 = s33 + s996 s998 :: SWord8 = if s994 then s997 else s996 s999 :: SBool = s185 == s877 s1000 :: SWord8 = if s999 then s992 else s991 s1001 :: SWord8 = s33 + s1000 s1002 :: SWord8 = if s995 then s1001 else s1000 s1003 :: SWord8 = s33 + s1002 s1004 :: SWord8 = if s994 then s1003 else s1002 s1005 :: SWord8 = if s176 then s998 else s1004 s1006 :: SWord8 = if s16 then s993 else s1005 s1007 :: SWord8 = s33 + s1006 s1008 :: SWord8 = if s879 then s1007 else s1006 s1009 :: SBool = s197 == s877 s1010 :: SBool = s200 == s877 s1011 :: SWord8 = if s1010 then s1007 else s1006 s1012 :: SWord8 = s33 + s1011 s1013 :: SWord8 = if s1009 then s1012 else s1011 s1014 :: SBool = s205 == s877 s1015 :: SWord8 = if s1014 then s1007 else s1006 s1016 :: SWord8 = s33 + s1015 s1017 :: SWord8 = if s1010 then s1016 else s1015 s1018 :: SWord8 = s33 + s1017 s1019 :: SWord8 = if s1009 then s1018 else s1017 s1020 :: SWord8 = if s196 then s1013 else s1019 s1021 :: SWord8 = if s14 then s1008 else s1020 s1022 :: SWord8 = s33 + s1021 s1023 :: SWord8 = if s878 then s1022 else s1021 s1024 :: SBool = s217 == s877 s1025 :: SBool = s220 == s877 s1026 :: SWord8 = if s1025 then s1022 else s1021 s1027 :: SWord8 = s33 + s1026 s1028 :: SWord8 = if s1024 then s1027 else s1026 s1029 :: SBool = s225 == s877 s1030 :: SWord8 = if s1029 then s1022 else s1021 s1031 :: SWord8 = s33 + s1030 s1032 :: SWord8 = if s1025 then s1031 else s1030 s1033 :: SWord8 = s33 + s1032 s1034 :: SWord8 = if s1024 then s1033 else s1032 s1035 :: SWord8 = if s216 then s1028 else s1034 s1036 :: SWord8 = if s11 then s1023 else s1035 s1037 :: SBool = s5 == s1036 s1039 :: SBool = s9 == s1038 s1040 :: SBool = s8 == s1038 s1041 :: SBool = s7 == s1038 s1042 :: SBool = s6 == s1038 s1043 :: SBool = s5 == s1038 s1044 :: SBool = s4 == s1038 s1045 :: SBool = s3 == s1038 s1046 :: SBool = s2 == s1038 s1047 :: SBool = s1 == s1038 s1048 :: SBool = s0 == s1038 s1049 :: SWord8 = if s1048 then s32 else s33 s1050 :: SBool = s37 == s1038 s1051 :: SBool = s40 == s1038 s1052 :: SWord8 = if s1051 then s32 else s33 s1053 :: SWord8 = s33 + s1052 s1054 :: SWord8 = if s1050 then s1053 else s1052 s1055 :: SBool = s45 == s1038 s1056 :: SWord8 = if s1055 then s32 else s33 s1057 :: SWord8 = s33 + s1056 s1058 :: SWord8 = if s1051 then s1057 else s1056 s1059 :: SWord8 = s33 + s1058 s1060 :: SWord8 = if s1050 then s1059 else s1058 s1061 :: SWord8 = if s36 then s1054 else s1060 s1062 :: SWord8 = if s30 then s1049 else s1061 s1063 :: SWord8 = s33 + s1062 s1064 :: SWord8 = if s1047 then s1063 else s1062 s1065 :: SBool = s57 == s1038 s1066 :: SBool = s60 == s1038 s1067 :: SWord8 = if s1066 then s1063 else s1062 s1068 :: SWord8 = s33 + s1067 s1069 :: SWord8 = if s1065 then s1068 else s1067 s1070 :: SBool = s65 == s1038 s1071 :: SWord8 = if s1070 then s1063 else s1062 s1072 :: SWord8 = s33 + s1071 s1073 :: SWord8 = if s1066 then s1072 else s1071 s1074 :: SWord8 = s33 + s1073 s1075 :: SWord8 = if s1065 then s1074 else s1073 s1076 :: SWord8 = if s56 then s1069 else s1075 s1077 :: SWord8 = if s28 then s1064 else s1076 s1078 :: SWord8 = s33 + s1077 s1079 :: SWord8 = if s1046 then s1078 else s1077 s1080 :: SBool = s77 == s1038 s1081 :: SBool = s80 == s1038 s1082 :: SWord8 = if s1081 then s1078 else s1077 s1083 :: SWord8 = s33 + s1082 s1084 :: SWord8 = if s1080 then s1083 else s1082 s1085 :: SBool = s85 == s1038 s1086 :: SWord8 = if s1085 then s1078 else s1077 s1087 :: SWord8 = s33 + s1086 s1088 :: SWord8 = if s1081 then s1087 else s1086 s1089 :: SWord8 = s33 + s1088 s1090 :: SWord8 = if s1080 then s1089 else s1088 s1091 :: SWord8 = if s76 then s1084 else s1090 s1092 :: SWord8 = if s26 then s1079 else s1091 s1093 :: SWord8 = s33 + s1092 s1094 :: SWord8 = if s1045 then s1093 else s1092 s1095 :: SBool = s97 == s1038 s1096 :: SBool = s100 == s1038 s1097 :: SWord8 = if s1096 then s1093 else s1092 s1098 :: SWord8 = s33 + s1097 s1099 :: SWord8 = if s1095 then s1098 else s1097 s1100 :: SBool = s105 == s1038 s1101 :: SWord8 = if s1100 then s1093 else s1092 s1102 :: SWord8 = s33 + s1101 s1103 :: SWord8 = if s1096 then s1102 else s1101 s1104 :: SWord8 = s33 + s1103 s1105 :: SWord8 = if s1095 then s1104 else s1103 s1106 :: SWord8 = if s96 then s1099 else s1105 s1107 :: SWord8 = if s24 then s1094 else s1106 s1108 :: SWord8 = s33 + s1107 s1109 :: SWord8 = if s1044 then s1108 else s1107 s1110 :: SBool = s117 == s1038 s1111 :: SBool = s120 == s1038 s1112 :: SWord8 = if s1111 then s1108 else s1107 s1113 :: SWord8 = s33 + s1112 s1114 :: SWord8 = if s1110 then s1113 else s1112 s1115 :: SBool = s125 == s1038 s1116 :: SWord8 = if s1115 then s1108 else s1107 s1117 :: SWord8 = s33 + s1116 s1118 :: SWord8 = if s1111 then s1117 else s1116 s1119 :: SWord8 = s33 + s1118 s1120 :: SWord8 = if s1110 then s1119 else s1118 s1121 :: SWord8 = if s116 then s1114 else s1120 s1122 :: SWord8 = if s22 then s1109 else s1121 s1123 :: SWord8 = s33 + s1122 s1124 :: SWord8 = if s1043 then s1123 else s1122 s1125 :: SBool = s137 == s1038 s1126 :: SBool = s140 == s1038 s1127 :: SWord8 = if s1126 then s1123 else s1122 s1128 :: SWord8 = s33 + s1127 s1129 :: SWord8 = if s1125 then s1128 else s1127 s1130 :: SBool = s145 == s1038 s1131 :: SWord8 = if s1130 then s1123 else s1122 s1132 :: SWord8 = s33 + s1131 s1133 :: SWord8 = if s1126 then s1132 else s1131 s1134 :: SWord8 = s33 + s1133 s1135 :: SWord8 = if s1125 then s1134 else s1133 s1136 :: SWord8 = if s136 then s1129 else s1135 s1137 :: SWord8 = if s20 then s1124 else s1136 s1138 :: SWord8 = s33 + s1137 s1139 :: SWord8 = if s1042 then s1138 else s1137 s1140 :: SBool = s157 == s1038 s1141 :: SBool = s160 == s1038 s1142 :: SWord8 = if s1141 then s1138 else s1137 s1143 :: SWord8 = s33 + s1142 s1144 :: SWord8 = if s1140 then s1143 else s1142 s1145 :: SBool = s165 == s1038 s1146 :: SWord8 = if s1145 then s1138 else s1137 s1147 :: SWord8 = s33 + s1146 s1148 :: SWord8 = if s1141 then s1147 else s1146 s1149 :: SWord8 = s33 + s1148 s1150 :: SWord8 = if s1140 then s1149 else s1148 s1151 :: SWord8 = if s156 then s1144 else s1150 s1152 :: SWord8 = if s18 then s1139 else s1151 s1153 :: SWord8 = s33 + s1152 s1154 :: SWord8 = if s1041 then s1153 else s1152 s1155 :: SBool = s177 == s1038 s1156 :: SBool = s180 == s1038 s1157 :: SWord8 = if s1156 then s1153 else s1152 s1158 :: SWord8 = s33 + s1157 s1159 :: SWord8 = if s1155 then s1158 else s1157 s1160 :: SBool = s185 == s1038 s1161 :: SWord8 = if s1160 then s1153 else s1152 s1162 :: SWord8 = s33 + s1161 s1163 :: SWord8 = if s1156 then s1162 else s1161 s1164 :: SWord8 = s33 + s1163 s1165 :: SWord8 = if s1155 then s1164 else s1163 s1166 :: SWord8 = if s176 then s1159 else s1165 s1167 :: SWord8 = if s16 then s1154 else s1166 s1168 :: SWord8 = s33 + s1167 s1169 :: SWord8 = if s1040 then s1168 else s1167 s1170 :: SBool = s197 == s1038 s1171 :: SBool = s200 == s1038 s1172 :: SWord8 = if s1171 then s1168 else s1167 s1173 :: SWord8 = s33 + s1172 s1174 :: SWord8 = if s1170 then s1173 else s1172 s1175 :: SBool = s205 == s1038 s1176 :: SWord8 = if s1175 then s1168 else s1167 s1177 :: SWord8 = s33 + s1176 s1178 :: SWord8 = if s1171 then s1177 else s1176 s1179 :: SWord8 = s33 + s1178 s1180 :: SWord8 = if s1170 then s1179 else s1178 s1181 :: SWord8 = if s196 then s1174 else s1180 s1182 :: SWord8 = if s14 then s1169 else s1181 s1183 :: SWord8 = s33 + s1182 s1184 :: SWord8 = if s1039 then s1183 else s1182 s1185 :: SBool = s217 == s1038 s1186 :: SBool = s220 == s1038 s1187 :: SWord8 = if s1186 then s1183 else s1182 s1188 :: SWord8 = s33 + s1187 s1189 :: SWord8 = if s1185 then s1188 else s1187 s1190 :: SBool = s225 == s1038 s1191 :: SWord8 = if s1190 then s1183 else s1182 s1192 :: SWord8 = s33 + s1191 s1193 :: SWord8 = if s1186 then s1192 else s1191 s1194 :: SWord8 = s33 + s1193 s1195 :: SWord8 = if s1185 then s1194 else s1193 s1196 :: SWord8 = if s216 then s1189 else s1195 s1197 :: SWord8 = if s11 then s1184 else s1196 s1198 :: SBool = s6 == s1197 s1200 :: SBool = s9 == s1199 s1201 :: SBool = s8 == s1199 s1202 :: SBool = s7 == s1199 s1203 :: SBool = s6 == s1199 s1204 :: SBool = s5 == s1199 s1205 :: SBool = s4 == s1199 s1206 :: SBool = s3 == s1199 s1207 :: SBool = s2 == s1199 s1208 :: SBool = s1 == s1199 s1209 :: SBool = s0 == s1199 s1210 :: SWord8 = if s1209 then s32 else s33 s1211 :: SBool = s37 == s1199 s1212 :: SBool = s40 == s1199 s1213 :: SWord8 = if s1212 then s32 else s33 s1214 :: SWord8 = s33 + s1213 s1215 :: SWord8 = if s1211 then s1214 else s1213 s1216 :: SBool = s45 == s1199 s1217 :: SWord8 = if s1216 then s32 else s33 s1218 :: SWord8 = s33 + s1217 s1219 :: SWord8 = if s1212 then s1218 else s1217 s1220 :: SWord8 = s33 + s1219 s1221 :: SWord8 = if s1211 then s1220 else s1219 s1222 :: SWord8 = if s36 then s1215 else s1221 s1223 :: SWord8 = if s30 then s1210 else s1222 s1224 :: SWord8 = s33 + s1223 s1225 :: SWord8 = if s1208 then s1224 else s1223 s1226 :: SBool = s57 == s1199 s1227 :: SBool = s60 == s1199 s1228 :: SWord8 = if s1227 then s1224 else s1223 s1229 :: SWord8 = s33 + s1228 s1230 :: SWord8 = if s1226 then s1229 else s1228 s1231 :: SBool = s65 == s1199 s1232 :: SWord8 = if s1231 then s1224 else s1223 s1233 :: SWord8 = s33 + s1232 s1234 :: SWord8 = if s1227 then s1233 else s1232 s1235 :: SWord8 = s33 + s1234 s1236 :: SWord8 = if s1226 then s1235 else s1234 s1237 :: SWord8 = if s56 then s1230 else s1236 s1238 :: SWord8 = if s28 then s1225 else s1237 s1239 :: SWord8 = s33 + s1238 s1240 :: SWord8 = if s1207 then s1239 else s1238 s1241 :: SBool = s77 == s1199 s1242 :: SBool = s80 == s1199 s1243 :: SWord8 = if s1242 then s1239 else s1238 s1244 :: SWord8 = s33 + s1243 s1245 :: SWord8 = if s1241 then s1244 else s1243 s1246 :: SBool = s85 == s1199 s1247 :: SWord8 = if s1246 then s1239 else s1238 s1248 :: SWord8 = s33 + s1247 s1249 :: SWord8 = if s1242 then s1248 else s1247 s1250 :: SWord8 = s33 + s1249 s1251 :: SWord8 = if s1241 then s1250 else s1249 s1252 :: SWord8 = if s76 then s1245 else s1251 s1253 :: SWord8 = if s26 then s1240 else s1252 s1254 :: SWord8 = s33 + s1253 s1255 :: SWord8 = if s1206 then s1254 else s1253 s1256 :: SBool = s97 == s1199 s1257 :: SBool = s100 == s1199 s1258 :: SWord8 = if s1257 then s1254 else s1253 s1259 :: SWord8 = s33 + s1258 s1260 :: SWord8 = if s1256 then s1259 else s1258 s1261 :: SBool = s105 == s1199 s1262 :: SWord8 = if s1261 then s1254 else s1253 s1263 :: SWord8 = s33 + s1262 s1264 :: SWord8 = if s1257 then s1263 else s1262 s1265 :: SWord8 = s33 + s1264 s1266 :: SWord8 = if s1256 then s1265 else s1264 s1267 :: SWord8 = if s96 then s1260 else s1266 s1268 :: SWord8 = if s24 then s1255 else s1267 s1269 :: SWord8 = s33 + s1268 s1270 :: SWord8 = if s1205 then s1269 else s1268 s1271 :: SBool = s117 == s1199 s1272 :: SBool = s120 == s1199 s1273 :: SWord8 = if s1272 then s1269 else s1268 s1274 :: SWord8 = s33 + s1273 s1275 :: SWord8 = if s1271 then s1274 else s1273 s1276 :: SBool = s125 == s1199 s1277 :: SWord8 = if s1276 then s1269 else s1268 s1278 :: SWord8 = s33 + s1277 s1279 :: SWord8 = if s1272 then s1278 else s1277 s1280 :: SWord8 = s33 + s1279 s1281 :: SWord8 = if s1271 then s1280 else s1279 s1282 :: SWord8 = if s116 then s1275 else s1281 s1283 :: SWord8 = if s22 then s1270 else s1282 s1284 :: SWord8 = s33 + s1283 s1285 :: SWord8 = if s1204 then s1284 else s1283 s1286 :: SBool = s137 == s1199 s1287 :: SBool = s140 == s1199 s1288 :: SWord8 = if s1287 then s1284 else s1283 s1289 :: SWord8 = s33 + s1288 s1290 :: SWord8 = if s1286 then s1289 else s1288 s1291 :: SBool = s145 == s1199 s1292 :: SWord8 = if s1291 then s1284 else s1283 s1293 :: SWord8 = s33 + s1292 s1294 :: SWord8 = if s1287 then s1293 else s1292 s1295 :: SWord8 = s33 + s1294 s1296 :: SWord8 = if s1286 then s1295 else s1294 s1297 :: SWord8 = if s136 then s1290 else s1296 s1298 :: SWord8 = if s20 then s1285 else s1297 s1299 :: SWord8 = s33 + s1298 s1300 :: SWord8 = if s1203 then s1299 else s1298 s1301 :: SBool = s157 == s1199 s1302 :: SBool = s160 == s1199 s1303 :: SWord8 = if s1302 then s1299 else s1298 s1304 :: SWord8 = s33 + s1303 s1305 :: SWord8 = if s1301 then s1304 else s1303 s1306 :: SBool = s165 == s1199 s1307 :: SWord8 = if s1306 then s1299 else s1298 s1308 :: SWord8 = s33 + s1307 s1309 :: SWord8 = if s1302 then s1308 else s1307 s1310 :: SWord8 = s33 + s1309 s1311 :: SWord8 = if s1301 then s1310 else s1309 s1312 :: SWord8 = if s156 then s1305 else s1311 s1313 :: SWord8 = if s18 then s1300 else s1312 s1314 :: SWord8 = s33 + s1313 s1315 :: SWord8 = if s1202 then s1314 else s1313 s1316 :: SBool = s177 == s1199 s1317 :: SBool = s180 == s1199 s1318 :: SWord8 = if s1317 then s1314 else s1313 s1319 :: SWord8 = s33 + s1318 s1320 :: SWord8 = if s1316 then s1319 else s1318 s1321 :: SBool = s185 == s1199 s1322 :: SWord8 = if s1321 then s1314 else s1313 s1323 :: SWord8 = s33 + s1322 s1324 :: SWord8 = if s1317 then s1323 else s1322 s1325 :: SWord8 = s33 + s1324 s1326 :: SWord8 = if s1316 then s1325 else s1324 s1327 :: SWord8 = if s176 then s1320 else s1326 s1328 :: SWord8 = if s16 then s1315 else s1327 s1329 :: SWord8 = s33 + s1328 s1330 :: SWord8 = if s1201 then s1329 else s1328 s1331 :: SBool = s197 == s1199 s1332 :: SBool = s200 == s1199 s1333 :: SWord8 = if s1332 then s1329 else s1328 s1334 :: SWord8 = s33 + s1333 s1335 :: SWord8 = if s1331 then s1334 else s1333 s1336 :: SBool = s205 == s1199 s1337 :: SWord8 = if s1336 then s1329 else s1328 s1338 :: SWord8 = s33 + s1337 s1339 :: SWord8 = if s1332 then s1338 else s1337 s1340 :: SWord8 = s33 + s1339 s1341 :: SWord8 = if s1331 then s1340 else s1339 s1342 :: SWord8 = if s196 then s1335 else s1341 s1343 :: SWord8 = if s14 then s1330 else s1342 s1344 :: SWord8 = s33 + s1343 s1345 :: SWord8 = if s1200 then s1344 else s1343 s1346 :: SBool = s217 == s1199 s1347 :: SBool = s220 == s1199 s1348 :: SWord8 = if s1347 then s1344 else s1343 s1349 :: SWord8 = s33 + s1348 s1350 :: SWord8 = if s1346 then s1349 else s1348 s1351 :: SBool = s225 == s1199 s1352 :: SWord8 = if s1351 then s1344 else s1343 s1353 :: SWord8 = s33 + s1352 s1354 :: SWord8 = if s1347 then s1353 else s1352 s1355 :: SWord8 = s33 + s1354 s1356 :: SWord8 = if s1346 then s1355 else s1354 s1357 :: SWord8 = if s216 then s1350 else s1356 s1358 :: SWord8 = if s11 then s1345 else s1357 s1359 :: SBool = s7 == s1358 s1361 :: SBool = s9 == s1360 s1362 :: SBool = s8 == s1360 s1363 :: SBool = s7 == s1360 s1364 :: SBool = s6 == s1360 s1365 :: SBool = s5 == s1360 s1366 :: SBool = s4 == s1360 s1367 :: SBool = s3 == s1360 s1368 :: SBool = s2 == s1360 s1369 :: SBool = s1 == s1360 s1370 :: SBool = s0 == s1360 s1371 :: SWord8 = if s1370 then s32 else s33 s1372 :: SBool = s37 == s1360 s1373 :: SBool = s40 == s1360 s1374 :: SWord8 = if s1373 then s32 else s33 s1375 :: SWord8 = s33 + s1374 s1376 :: SWord8 = if s1372 then s1375 else s1374 s1377 :: SBool = s45 == s1360 s1378 :: SWord8 = if s1377 then s32 else s33 s1379 :: SWord8 = s33 + s1378 s1380 :: SWord8 = if s1373 then s1379 else s1378 s1381 :: SWord8 = s33 + s1380 s1382 :: SWord8 = if s1372 then s1381 else s1380 s1383 :: SWord8 = if s36 then s1376 else s1382 s1384 :: SWord8 = if s30 then s1371 else s1383 s1385 :: SWord8 = s33 + s1384 s1386 :: SWord8 = if s1369 then s1385 else s1384 s1387 :: SBool = s57 == s1360 s1388 :: SBool = s60 == s1360 s1389 :: SWord8 = if s1388 then s1385 else s1384 s1390 :: SWord8 = s33 + s1389 s1391 :: SWord8 = if s1387 then s1390 else s1389 s1392 :: SBool = s65 == s1360 s1393 :: SWord8 = if s1392 then s1385 else s1384 s1394 :: SWord8 = s33 + s1393 s1395 :: SWord8 = if s1388 then s1394 else s1393 s1396 :: SWord8 = s33 + s1395 s1397 :: SWord8 = if s1387 then s1396 else s1395 s1398 :: SWord8 = if s56 then s1391 else s1397 s1399 :: SWord8 = if s28 then s1386 else s1398 s1400 :: SWord8 = s33 + s1399 s1401 :: SWord8 = if s1368 then s1400 else s1399 s1402 :: SBool = s77 == s1360 s1403 :: SBool = s80 == s1360 s1404 :: SWord8 = if s1403 then s1400 else s1399 s1405 :: SWord8 = s33 + s1404 s1406 :: SWord8 = if s1402 then s1405 else s1404 s1407 :: SBool = s85 == s1360 s1408 :: SWord8 = if s1407 then s1400 else s1399 s1409 :: SWord8 = s33 + s1408 s1410 :: SWord8 = if s1403 then s1409 else s1408 s1411 :: SWord8 = s33 + s1410 s1412 :: SWord8 = if s1402 then s1411 else s1410 s1413 :: SWord8 = if s76 then s1406 else s1412 s1414 :: SWord8 = if s26 then s1401 else s1413 s1415 :: SWord8 = s33 + s1414 s1416 :: SWord8 = if s1367 then s1415 else s1414 s1417 :: SBool = s97 == s1360 s1418 :: SBool = s100 == s1360 s1419 :: SWord8 = if s1418 then s1415 else s1414 s1420 :: SWord8 = s33 + s1419 s1421 :: SWord8 = if s1417 then s1420 else s1419 s1422 :: SBool = s105 == s1360 s1423 :: SWord8 = if s1422 then s1415 else s1414 s1424 :: SWord8 = s33 + s1423 s1425 :: SWord8 = if s1418 then s1424 else s1423 s1426 :: SWord8 = s33 + s1425 s1427 :: SWord8 = if s1417 then s1426 else s1425 s1428 :: SWord8 = if s96 then s1421 else s1427 s1429 :: SWord8 = if s24 then s1416 else s1428 s1430 :: SWord8 = s33 + s1429 s1431 :: SWord8 = if s1366 then s1430 else s1429 s1432 :: SBool = s117 == s1360 s1433 :: SBool = s120 == s1360 s1434 :: SWord8 = if s1433 then s1430 else s1429 s1435 :: SWord8 = s33 + s1434 s1436 :: SWord8 = if s1432 then s1435 else s1434 s1437 :: SBool = s125 == s1360 s1438 :: SWord8 = if s1437 then s1430 else s1429 s1439 :: SWord8 = s33 + s1438 s1440 :: SWord8 = if s1433 then s1439 else s1438 s1441 :: SWord8 = s33 + s1440 s1442 :: SWord8 = if s1432 then s1441 else s1440 s1443 :: SWord8 = if s116 then s1436 else s1442 s1444 :: SWord8 = if s22 then s1431 else s1443 s1445 :: SWord8 = s33 + s1444 s1446 :: SWord8 = if s1365 then s1445 else s1444 s1447 :: SBool = s137 == s1360 s1448 :: SBool = s140 == s1360 s1449 :: SWord8 = if s1448 then s1445 else s1444 s1450 :: SWord8 = s33 + s1449 s1451 :: SWord8 = if s1447 then s1450 else s1449 s1452 :: SBool = s145 == s1360 s1453 :: SWord8 = if s1452 then s1445 else s1444 s1454 :: SWord8 = s33 + s1453 s1455 :: SWord8 = if s1448 then s1454 else s1453 s1456 :: SWord8 = s33 + s1455 s1457 :: SWord8 = if s1447 then s1456 else s1455 s1458 :: SWord8 = if s136 then s1451 else s1457 s1459 :: SWord8 = if s20 then s1446 else s1458 s1460 :: SWord8 = s33 + s1459 s1461 :: SWord8 = if s1364 then s1460 else s1459 s1462 :: SBool = s157 == s1360 s1463 :: SBool = s160 == s1360 s1464 :: SWord8 = if s1463 then s1460 else s1459 s1465 :: SWord8 = s33 + s1464 s1466 :: SWord8 = if s1462 then s1465 else s1464 s1467 :: SBool = s165 == s1360 s1468 :: SWord8 = if s1467 then s1460 else s1459 s1469 :: SWord8 = s33 + s1468 s1470 :: SWord8 = if s1463 then s1469 else s1468 s1471 :: SWord8 = s33 + s1470 s1472 :: SWord8 = if s1462 then s1471 else s1470 s1473 :: SWord8 = if s156 then s1466 else s1472 s1474 :: SWord8 = if s18 then s1461 else s1473 s1475 :: SWord8 = s33 + s1474 s1476 :: SWord8 = if s1363 then s1475 else s1474 s1477 :: SBool = s177 == s1360 s1478 :: SBool = s180 == s1360 s1479 :: SWord8 = if s1478 then s1475 else s1474 s1480 :: SWord8 = s33 + s1479 s1481 :: SWord8 = if s1477 then s1480 else s1479 s1482 :: SBool = s185 == s1360 s1483 :: SWord8 = if s1482 then s1475 else s1474 s1484 :: SWord8 = s33 + s1483 s1485 :: SWord8 = if s1478 then s1484 else s1483 s1486 :: SWord8 = s33 + s1485 s1487 :: SWord8 = if s1477 then s1486 else s1485 s1488 :: SWord8 = if s176 then s1481 else s1487 s1489 :: SWord8 = if s16 then s1476 else s1488 s1490 :: SWord8 = s33 + s1489 s1491 :: SWord8 = if s1362 then s1490 else s1489 s1492 :: SBool = s197 == s1360 s1493 :: SBool = s200 == s1360 s1494 :: SWord8 = if s1493 then s1490 else s1489 s1495 :: SWord8 = s33 + s1494 s1496 :: SWord8 = if s1492 then s1495 else s1494 s1497 :: SBool = s205 == s1360 s1498 :: SWord8 = if s1497 then s1490 else s1489 s1499 :: SWord8 = s33 + s1498 s1500 :: SWord8 = if s1493 then s1499 else s1498 s1501 :: SWord8 = s33 + s1500 s1502 :: SWord8 = if s1492 then s1501 else s1500 s1503 :: SWord8 = if s196 then s1496 else s1502 s1504 :: SWord8 = if s14 then s1491 else s1503 s1505 :: SWord8 = s33 + s1504 s1506 :: SWord8 = if s1361 then s1505 else s1504 s1507 :: SBool = s217 == s1360 s1508 :: SBool = s220 == s1360 s1509 :: SWord8 = if s1508 then s1505 else s1504 s1510 :: SWord8 = s33 + s1509 s1511 :: SWord8 = if s1507 then s1510 else s1509 s1512 :: SBool = s225 == s1360 s1513 :: SWord8 = if s1512 then s1505 else s1504 s1514 :: SWord8 = s33 + s1513 s1515 :: SWord8 = if s1508 then s1514 else s1513 s1516 :: SWord8 = s33 + s1515 s1517 :: SWord8 = if s1507 then s1516 else s1515 s1518 :: SWord8 = if s216 then s1511 else s1517 s1519 :: SWord8 = if s11 then s1506 else s1518 s1520 :: SBool = s8 == s1519 s1522 :: SBool = s9 == s1521 s1523 :: SBool = s8 == s1521 s1524 :: SBool = s7 == s1521 s1525 :: SBool = s6 == s1521 s1526 :: SBool = s5 == s1521 s1527 :: SBool = s4 == s1521 s1528 :: SBool = s3 == s1521 s1529 :: SBool = s2 == s1521 s1530 :: SBool = s1 == s1521 s1531 :: SBool = s0 == s1521 s1532 :: SWord8 = if s1531 then s32 else s33 s1533 :: SBool = s37 == s1521 s1534 :: SBool = s40 == s1521 s1535 :: SWord8 = if s1534 then s32 else s33 s1536 :: SWord8 = s33 + s1535 s1537 :: SWord8 = if s1533 then s1536 else s1535 s1538 :: SBool = s45 == s1521 s1539 :: SWord8 = if s1538 then s32 else s33 s1540 :: SWord8 = s33 + s1539 s1541 :: SWord8 = if s1534 then s1540 else s1539 s1542 :: SWord8 = s33 + s1541 s1543 :: SWord8 = if s1533 then s1542 else s1541 s1544 :: SWord8 = if s36 then s1537 else s1543 s1545 :: SWord8 = if s30 then s1532 else s1544 s1546 :: SWord8 = s33 + s1545 s1547 :: SWord8 = if s1530 then s1546 else s1545 s1548 :: SBool = s57 == s1521 s1549 :: SBool = s60 == s1521 s1550 :: SWord8 = if s1549 then s1546 else s1545 s1551 :: SWord8 = s33 + s1550 s1552 :: SWord8 = if s1548 then s1551 else s1550 s1553 :: SBool = s65 == s1521 s1554 :: SWord8 = if s1553 then s1546 else s1545 s1555 :: SWord8 = s33 + s1554 s1556 :: SWord8 = if s1549 then s1555 else s1554 s1557 :: SWord8 = s33 + s1556 s1558 :: SWord8 = if s1548 then s1557 else s1556 s1559 :: SWord8 = if s56 then s1552 else s1558 s1560 :: SWord8 = if s28 then s1547 else s1559 s1561 :: SWord8 = s33 + s1560 s1562 :: SWord8 = if s1529 then s1561 else s1560 s1563 :: SBool = s77 == s1521 s1564 :: SBool = s80 == s1521 s1565 :: SWord8 = if s1564 then s1561 else s1560 s1566 :: SWord8 = s33 + s1565 s1567 :: SWord8 = if s1563 then s1566 else s1565 s1568 :: SBool = s85 == s1521 s1569 :: SWord8 = if s1568 then s1561 else s1560 s1570 :: SWord8 = s33 + s1569 s1571 :: SWord8 = if s1564 then s1570 else s1569 s1572 :: SWord8 = s33 + s1571 s1573 :: SWord8 = if s1563 then s1572 else s1571 s1574 :: SWord8 = if s76 then s1567 else s1573 s1575 :: SWord8 = if s26 then s1562 else s1574 s1576 :: SWord8 = s33 + s1575 s1577 :: SWord8 = if s1528 then s1576 else s1575 s1578 :: SBool = s97 == s1521 s1579 :: SBool = s100 == s1521 s1580 :: SWord8 = if s1579 then s1576 else s1575 s1581 :: SWord8 = s33 + s1580 s1582 :: SWord8 = if s1578 then s1581 else s1580 s1583 :: SBool = s105 == s1521 s1584 :: SWord8 = if s1583 then s1576 else s1575 s1585 :: SWord8 = s33 + s1584 s1586 :: SWord8 = if s1579 then s1585 else s1584 s1587 :: SWord8 = s33 + s1586 s1588 :: SWord8 = if s1578 then s1587 else s1586 s1589 :: SWord8 = if s96 then s1582 else s1588 s1590 :: SWord8 = if s24 then s1577 else s1589 s1591 :: SWord8 = s33 + s1590 s1592 :: SWord8 = if s1527 then s1591 else s1590 s1593 :: SBool = s117 == s1521 s1594 :: SBool = s120 == s1521 s1595 :: SWord8 = if s1594 then s1591 else s1590 s1596 :: SWord8 = s33 + s1595 s1597 :: SWord8 = if s1593 then s1596 else s1595 s1598 :: SBool = s125 == s1521 s1599 :: SWord8 = if s1598 then s1591 else s1590 s1600 :: SWord8 = s33 + s1599 s1601 :: SWord8 = if s1594 then s1600 else s1599 s1602 :: SWord8 = s33 + s1601 s1603 :: SWord8 = if s1593 then s1602 else s1601 s1604 :: SWord8 = if s116 then s1597 else s1603 s1605 :: SWord8 = if s22 then s1592 else s1604 s1606 :: SWord8 = s33 + s1605 s1607 :: SWord8 = if s1526 then s1606 else s1605 s1608 :: SBool = s137 == s1521 s1609 :: SBool = s140 == s1521 s1610 :: SWord8 = if s1609 then s1606 else s1605 s1611 :: SWord8 = s33 + s1610 s1612 :: SWord8 = if s1608 then s1611 else s1610 s1613 :: SBool = s145 == s1521 s1614 :: SWord8 = if s1613 then s1606 else s1605 s1615 :: SWord8 = s33 + s1614 s1616 :: SWord8 = if s1609 then s1615 else s1614 s1617 :: SWord8 = s33 + s1616 s1618 :: SWord8 = if s1608 then s1617 else s1616 s1619 :: SWord8 = if s136 then s1612 else s1618 s1620 :: SWord8 = if s20 then s1607 else s1619 s1621 :: SWord8 = s33 + s1620 s1622 :: SWord8 = if s1525 then s1621 else s1620 s1623 :: SBool = s157 == s1521 s1624 :: SBool = s160 == s1521 s1625 :: SWord8 = if s1624 then s1621 else s1620 s1626 :: SWord8 = s33 + s1625 s1627 :: SWord8 = if s1623 then s1626 else s1625 s1628 :: SBool = s165 == s1521 s1629 :: SWord8 = if s1628 then s1621 else s1620 s1630 :: SWord8 = s33 + s1629 s1631 :: SWord8 = if s1624 then s1630 else s1629 s1632 :: SWord8 = s33 + s1631 s1633 :: SWord8 = if s1623 then s1632 else s1631 s1634 :: SWord8 = if s156 then s1627 else s1633 s1635 :: SWord8 = if s18 then s1622 else s1634 s1636 :: SWord8 = s33 + s1635 s1637 :: SWord8 = if s1524 then s1636 else s1635 s1638 :: SBool = s177 == s1521 s1639 :: SBool = s180 == s1521 s1640 :: SWord8 = if s1639 then s1636 else s1635 s1641 :: SWord8 = s33 + s1640 s1642 :: SWord8 = if s1638 then s1641 else s1640 s1643 :: SBool = s185 == s1521 s1644 :: SWord8 = if s1643 then s1636 else s1635 s1645 :: SWord8 = s33 + s1644 s1646 :: SWord8 = if s1639 then s1645 else s1644 s1647 :: SWord8 = s33 + s1646 s1648 :: SWord8 = if s1638 then s1647 else s1646 s1649 :: SWord8 = if s176 then s1642 else s1648 s1650 :: SWord8 = if s16 then s1637 else s1649 s1651 :: SWord8 = s33 + s1650 s1652 :: SWord8 = if s1523 then s1651 else s1650 s1653 :: SBool = s197 == s1521 s1654 :: SBool = s200 == s1521 s1655 :: SWord8 = if s1654 then s1651 else s1650 s1656 :: SWord8 = s33 + s1655 s1657 :: SWord8 = if s1653 then s1656 else s1655 s1658 :: SBool = s205 == s1521 s1659 :: SWord8 = if s1658 then s1651 else s1650 s1660 :: SWord8 = s33 + s1659 s1661 :: SWord8 = if s1654 then s1660 else s1659 s1662 :: SWord8 = s33 + s1661 s1663 :: SWord8 = if s1653 then s1662 else s1661 s1664 :: SWord8 = if s196 then s1657 else s1663 s1665 :: SWord8 = if s14 then s1652 else s1664 s1666 :: SWord8 = s33 + s1665 s1667 :: SWord8 = if s1522 then s1666 else s1665 s1668 :: SBool = s217 == s1521 s1669 :: SBool = s220 == s1521 s1670 :: SWord8 = if s1669 then s1666 else s1665 s1671 :: SWord8 = s33 + s1670 s1672 :: SWord8 = if s1668 then s1671 else s1670 s1673 :: SBool = s225 == s1521 s1674 :: SWord8 = if s1673 then s1666 else s1665 s1675 :: SWord8 = s33 + s1674 s1676 :: SWord8 = if s1669 then s1675 else s1674 s1677 :: SWord8 = s33 + s1676 s1678 :: SWord8 = if s1668 then s1677 else s1676 s1679 :: SWord8 = if s216 then s1672 else s1678 s1680 :: SWord8 = if s11 then s1667 else s1679 s1681 :: SBool = s9 == s1680 s1682 :: SBool = s1520 & s1681 s1683 :: SBool = s1359 & s1682 s1684 :: SBool = s1198 & s1683 s1685 :: SBool = s1037 & s1684 s1686 :: SBool = s876 & s1685 s1687 :: SBool = s715 & s1686 s1688 :: SBool = s554 & s1687 s1689 :: SBool = s394 & s1688 s1690 :: SBool = s234 & s1689 CONSTRAINTS ASSERTIONS OUTPUTS s1690sbv-7.13/SBVTestSuite/GoldFiles/crcPolyExist.gold0000644000000000000000000041357013405536617020123 0ustar0000000000000000INPUTS s0 :: SWord16, existential, aliasing "poly" s1 :: SWord32, aliasing "sh" s2 :: SWord16, aliasing "sl" s3 :: SWord32, aliasing "rh" s4 :: SWord16, aliasing "rl" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s6 = 0 :: Word1 s18 = 1 :: Word8 s3340 = 0 :: Word8 s3468 = 4 :: Word8 TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s5 :: SWord1 = choose [0:0] s0 s7 :: SBool = s5 /= s6 s8 :: SBool = s1 == s3 s9 :: SBool = s2 == s4 s10 :: SBool = s8 & s9 s11 :: SBool = ~ s10 s12 :: SBool = ~ s11 s13 :: SWord1 = choose [31:31] s1 s14 :: SBool = s6 /= s13 s15 :: SWord1 = choose [31:31] s3 s16 :: SBool = s6 /= s15 s17 :: SBool = s14 ^ s16 s19 :: SWord1 = choose [30:30] s1 s20 :: SBool = s6 /= s19 s21 :: SWord1 = choose [30:30] s3 s22 :: SBool = s6 /= s21 s23 :: SBool = s20 ^ s22 s24 :: SWord1 = choose [29:29] s1 s25 :: SBool = s6 /= s24 s26 :: SWord1 = choose [29:29] s3 s27 :: SBool = s6 /= s26 s28 :: SBool = s25 ^ s27 s29 :: SWord1 = choose [28:28] s1 s30 :: SBool = s6 /= s29 s31 :: SWord1 = choose [28:28] s3 s32 :: SBool = s6 /= s31 s33 :: SBool = s30 ^ s32 s34 :: SWord1 = choose [27:27] s1 s35 :: SBool = s6 /= s34 s36 :: SWord1 = choose [27:27] s3 s37 :: SBool = s6 /= s36 s38 :: SBool = s35 ^ s37 s39 :: SWord1 = choose [26:26] s1 s40 :: SBool = s6 /= s39 s41 :: SWord1 = choose [26:26] s3 s42 :: SBool = s6 /= s41 s43 :: SBool = s40 ^ s42 s44 :: SWord1 = choose [25:25] s1 s45 :: SBool = s6 /= s44 s46 :: SWord1 = choose [25:25] s3 s47 :: SBool = s6 /= s46 s48 :: SBool = s45 ^ s47 s49 :: SWord1 = choose [24:24] s1 s50 :: SBool = s6 /= s49 s51 :: SWord1 = choose [24:24] s3 s52 :: SBool = s6 /= s51 s53 :: SBool = s50 ^ s52 s54 :: SWord1 = choose [23:23] s1 s55 :: SBool = s6 /= s54 s56 :: SWord1 = choose [23:23] s3 s57 :: SBool = s6 /= s56 s58 :: SBool = s55 ^ s57 s59 :: SWord1 = choose [22:22] s1 s60 :: SBool = s6 /= s59 s61 :: SWord1 = choose [22:22] s3 s62 :: SBool = s6 /= s61 s63 :: SBool = s60 ^ s62 s64 :: SWord1 = choose [21:21] s1 s65 :: SBool = s6 /= s64 s66 :: SWord1 = choose [21:21] s3 s67 :: SBool = s6 /= s66 s68 :: SBool = s65 ^ s67 s69 :: SWord1 = choose [20:20] s1 s70 :: SBool = s6 /= s69 s71 :: SWord1 = choose [20:20] s3 s72 :: SBool = s6 /= s71 s73 :: SBool = s70 ^ s72 s74 :: SWord1 = choose [19:19] s1 s75 :: SBool = s6 /= s74 s76 :: SWord1 = choose [19:19] s3 s77 :: SBool = s6 /= s76 s78 :: SBool = s75 ^ s77 s79 :: SWord1 = choose [18:18] s1 s80 :: SBool = s6 /= s79 s81 :: SWord1 = choose [18:18] s3 s82 :: SBool = s6 /= s81 s83 :: SBool = s80 ^ s82 s84 :: SWord1 = choose [17:17] s1 s85 :: SBool = s6 /= s84 s86 :: SWord1 = choose [17:17] s3 s87 :: SBool = s6 /= s86 s88 :: SBool = s85 ^ s87 s89 :: SWord1 = choose [16:16] s1 s90 :: SBool = s6 /= s89 s91 :: SWord1 = choose [16:16] s3 s92 :: SBool = s6 /= s91 s93 :: SBool = s90 ^ s92 s94 :: SWord1 = choose [15:15] s1 s95 :: SBool = s6 /= s94 s96 :: SWord1 = choose [15:15] s3 s97 :: SBool = s6 /= s96 s98 :: SBool = s95 ^ s97 s99 :: SWord1 = choose [14:14] s1 s100 :: SBool = s6 /= s99 s101 :: SWord1 = choose [14:14] s3 s102 :: SBool = s6 /= s101 s103 :: SBool = s100 ^ s102 s104 :: SWord1 = choose [13:13] s1 s105 :: SBool = s6 /= s104 s106 :: SWord1 = choose [13:13] s3 s107 :: SBool = s6 /= s106 s108 :: SBool = s105 ^ s107 s109 :: SWord1 = choose [12:12] s1 s110 :: SBool = s6 /= s109 s111 :: SWord1 = choose [12:12] s3 s112 :: SBool = s6 /= s111 s113 :: SBool = s110 ^ s112 s114 :: SWord1 = choose [11:11] s1 s115 :: SBool = s6 /= s114 s116 :: SWord1 = choose [11:11] s3 s117 :: SBool = s6 /= s116 s118 :: SBool = s115 ^ s117 s119 :: SWord1 = choose [10:10] s1 s120 :: SBool = s6 /= s119 s121 :: SWord1 = choose [10:10] s3 s122 :: SBool = s6 /= s121 s123 :: SBool = s120 ^ s122 s124 :: SWord1 = choose [9:9] s1 s125 :: SBool = s6 /= s124 s126 :: SWord1 = choose [9:9] s3 s127 :: SBool = s6 /= s126 s128 :: SBool = s125 ^ s127 s129 :: SWord1 = choose [8:8] s1 s130 :: SBool = s6 /= s129 s131 :: SWord1 = choose [8:8] s3 s132 :: SBool = s6 /= s131 s133 :: SBool = s130 ^ s132 s134 :: SWord1 = choose [7:7] s1 s135 :: SBool = s6 /= s134 s136 :: SWord1 = choose [7:7] s3 s137 :: SBool = s6 /= s136 s138 :: SBool = s135 ^ s137 s139 :: SWord1 = choose [6:6] s1 s140 :: SBool = s6 /= s139 s141 :: SWord1 = choose [6:6] s3 s142 :: SBool = s6 /= s141 s143 :: SBool = s140 ^ s142 s144 :: SWord1 = choose [5:5] s1 s145 :: SBool = s6 /= s144 s146 :: SWord1 = choose [5:5] s3 s147 :: SBool = s6 /= s146 s148 :: SBool = s145 ^ s147 s149 :: SWord1 = choose [4:4] s1 s150 :: SBool = s6 /= s149 s151 :: SWord1 = choose [4:4] s3 s152 :: SBool = s6 /= s151 s153 :: SBool = s150 ^ s152 s154 :: SWord1 = choose [3:3] s1 s155 :: SBool = s6 /= s154 s156 :: SWord1 = choose [3:3] s3 s157 :: SBool = s6 /= s156 s158 :: SBool = s155 ^ s157 s159 :: SWord1 = choose [2:2] s1 s160 :: SBool = s6 /= s159 s161 :: SWord1 = choose [2:2] s3 s162 :: SBool = s6 /= s161 s163 :: SBool = s160 ^ s162 s164 :: SWord1 = choose [1:1] s1 s165 :: SBool = s6 /= s164 s166 :: SWord1 = choose [1:1] s3 s167 :: SBool = s6 /= s166 s168 :: SBool = s165 ^ s167 s169 :: SWord1 = choose [0:0] s1 s170 :: SBool = s6 /= s169 s171 :: SWord1 = choose [0:0] s3 s172 :: SBool = s6 /= s171 s173 :: SBool = s170 ^ s172 s174 :: SWord1 = choose [15:15] s2 s175 :: SBool = s6 /= s174 s176 :: SWord1 = choose [15:15] s4 s177 :: SBool = s6 /= s176 s178 :: SBool = s175 ^ s177 s179 :: SWord1 = choose [14:14] s2 s180 :: SBool = s6 /= s179 s181 :: SWord1 = choose [14:14] s4 s182 :: SBool = s6 /= s181 s183 :: SBool = s180 ^ s182 s184 :: SWord1 = choose [13:13] s2 s185 :: SBool = s6 /= s184 s186 :: SWord1 = choose [13:13] s4 s187 :: SBool = s6 /= s186 s188 :: SBool = s185 ^ s187 s189 :: SWord1 = choose [12:12] s2 s190 :: SBool = s6 /= s189 s191 :: SWord1 = choose [12:12] s4 s192 :: SBool = s6 /= s191 s193 :: SBool = s190 ^ s192 s194 :: SWord1 = choose [11:11] s2 s195 :: SBool = s6 /= s194 s196 :: SWord1 = choose [11:11] s4 s197 :: SBool = s6 /= s196 s198 :: SBool = s195 ^ s197 s199 :: SWord1 = choose [10:10] s2 s200 :: SBool = s6 /= s199 s201 :: SWord1 = choose [10:10] s4 s202 :: SBool = s6 /= s201 s203 :: SBool = s200 ^ s202 s204 :: SWord1 = choose [9:9] s2 s205 :: SBool = s6 /= s204 s206 :: SWord1 = choose [9:9] s4 s207 :: SBool = s6 /= s206 s208 :: SBool = s205 ^ s207 s209 :: SWord1 = choose [8:8] s2 s210 :: SBool = s6 /= s209 s211 :: SWord1 = choose [8:8] s4 s212 :: SBool = s6 /= s211 s213 :: SBool = s210 ^ s212 s214 :: SWord1 = choose [7:7] s2 s215 :: SBool = s6 /= s214 s216 :: SWord1 = choose [7:7] s4 s217 :: SBool = s6 /= s216 s218 :: SBool = s215 ^ s217 s219 :: SWord1 = choose [6:6] s2 s220 :: SBool = s6 /= s219 s221 :: SWord1 = choose [6:6] s4 s222 :: SBool = s6 /= s221 s223 :: SBool = s220 ^ s222 s224 :: SWord1 = choose [5:5] s2 s225 :: SBool = s6 /= s224 s226 :: SWord1 = choose [5:5] s4 s227 :: SBool = s6 /= s226 s228 :: SBool = s225 ^ s227 s229 :: SWord1 = choose [4:4] s2 s230 :: SBool = s6 /= s229 s231 :: SWord1 = choose [4:4] s4 s232 :: SBool = s6 /= s231 s233 :: SBool = s230 ^ s232 s234 :: SWord1 = choose [3:3] s2 s235 :: SBool = s6 /= s234 s236 :: SWord1 = choose [3:3] s4 s237 :: SBool = s6 /= s236 s238 :: SBool = s235 ^ s237 s239 :: SWord1 = choose [2:2] s2 s240 :: SBool = s6 /= s239 s241 :: SWord1 = choose [2:2] s4 s242 :: SBool = s6 /= s241 s243 :: SBool = s240 ^ s242 s244 :: SWord1 = choose [1:1] s2 s245 :: SBool = s6 /= s244 s246 :: SWord1 = choose [1:1] s4 s247 :: SBool = s6 /= s246 s248 :: SBool = s245 ^ s247 s249 :: SWord1 = choose [0:0] s2 s250 :: SBool = s6 /= s249 s251 :: SWord1 = choose [0:0] s4 s252 :: SBool = s6 /= s251 s253 :: SBool = s250 ^ s252 s254 :: SWord1 = choose [15:15] s0 s255 :: SBool = s6 /= s254 s256 :: SBool = s20 ^ s255 s257 :: SBool = if s14 then s256 else s20 s258 :: SWord1 = choose [14:14] s0 s259 :: SBool = s6 /= s258 s260 :: SBool = s25 ^ s259 s261 :: SBool = if s14 then s260 else s25 s262 :: SBool = s255 ^ s261 s263 :: SBool = if s257 then s262 else s261 s264 :: SWord1 = choose [13:13] s0 s265 :: SBool = s6 /= s264 s266 :: SBool = s30 ^ s265 s267 :: SBool = if s14 then s266 else s30 s268 :: SBool = s259 ^ s267 s269 :: SBool = if s257 then s268 else s267 s270 :: SBool = s255 ^ s269 s271 :: SBool = if s263 then s270 else s269 s272 :: SWord1 = choose [12:12] s0 s273 :: SBool = s6 /= s272 s274 :: SBool = s35 ^ s273 s275 :: SBool = if s14 then s274 else s35 s276 :: SBool = s265 ^ s275 s277 :: SBool = if s257 then s276 else s275 s278 :: SBool = s259 ^ s277 s279 :: SBool = if s263 then s278 else s277 s280 :: SBool = s255 ^ s279 s281 :: SBool = if s271 then s280 else s279 s282 :: SWord1 = choose [11:11] s0 s283 :: SBool = s6 /= s282 s284 :: SBool = s40 ^ s283 s285 :: SBool = if s14 then s284 else s40 s286 :: SBool = s273 ^ s285 s287 :: SBool = if s257 then s286 else s285 s288 :: SBool = s265 ^ s287 s289 :: SBool = if s263 then s288 else s287 s290 :: SBool = s259 ^ s289 s291 :: SBool = if s271 then s290 else s289 s292 :: SBool = s255 ^ s291 s293 :: SBool = if s281 then s292 else s291 s294 :: SWord1 = choose [10:10] s0 s295 :: SBool = s6 /= s294 s296 :: SBool = s45 ^ s295 s297 :: SBool = if s14 then s296 else s45 s298 :: SBool = s283 ^ s297 s299 :: SBool = if s257 then s298 else s297 s300 :: SBool = s273 ^ s299 s301 :: SBool = if s263 then s300 else s299 s302 :: SBool = s265 ^ s301 s303 :: SBool = if s271 then s302 else s301 s304 :: SBool = s259 ^ s303 s305 :: SBool = if s281 then s304 else s303 s306 :: SBool = s255 ^ s305 s307 :: SBool = if s293 then s306 else s305 s308 :: SWord1 = choose [9:9] s0 s309 :: SBool = s6 /= s308 s310 :: SBool = s50 ^ s309 s311 :: SBool = if s14 then s310 else s50 s312 :: SBool = s295 ^ s311 s313 :: SBool = if s257 then s312 else s311 s314 :: SBool = s283 ^ s313 s315 :: SBool = if s263 then s314 else s313 s316 :: SBool = s273 ^ s315 s317 :: SBool = if s271 then s316 else s315 s318 :: SBool = s265 ^ s317 s319 :: SBool = if s281 then s318 else s317 s320 :: SBool = s259 ^ s319 s321 :: SBool = if s293 then s320 else s319 s322 :: SBool = s255 ^ s321 s323 :: SBool = if s307 then s322 else s321 s324 :: SWord1 = choose [8:8] s0 s325 :: SBool = s6 /= s324 s326 :: SBool = s55 ^ s325 s327 :: SBool = if s14 then s326 else s55 s328 :: SBool = s309 ^ s327 s329 :: SBool = if s257 then s328 else s327 s330 :: SBool = s295 ^ s329 s331 :: SBool = if s263 then s330 else s329 s332 :: SBool = s283 ^ s331 s333 :: SBool = if s271 then s332 else s331 s334 :: SBool = s273 ^ s333 s335 :: SBool = if s281 then s334 else s333 s336 :: SBool = s265 ^ s335 s337 :: SBool = if s293 then s336 else s335 s338 :: SBool = s259 ^ s337 s339 :: SBool = if s307 then s338 else s337 s340 :: SBool = s255 ^ s339 s341 :: SBool = if s323 then s340 else s339 s342 :: SWord1 = choose [7:7] s0 s343 :: SBool = s6 /= s342 s344 :: SBool = s60 ^ s343 s345 :: SBool = if s14 then s344 else s60 s346 :: SBool = s325 ^ s345 s347 :: SBool = if s257 then s346 else s345 s348 :: SBool = s309 ^ s347 s349 :: SBool = if s263 then s348 else s347 s350 :: SBool = s295 ^ s349 s351 :: SBool = if s271 then s350 else s349 s352 :: SBool = s283 ^ s351 s353 :: SBool = if s281 then s352 else s351 s354 :: SBool = s273 ^ s353 s355 :: SBool = if s293 then s354 else s353 s356 :: SBool = s265 ^ s355 s357 :: SBool = if s307 then s356 else s355 s358 :: SBool = s259 ^ s357 s359 :: SBool = if s323 then s358 else s357 s360 :: SBool = s255 ^ s359 s361 :: SBool = if s341 then s360 else s359 s362 :: SWord1 = choose [6:6] s0 s363 :: SBool = s6 /= s362 s364 :: SBool = s65 ^ s363 s365 :: SBool = if s14 then s364 else s65 s366 :: SBool = s343 ^ s365 s367 :: SBool = if s257 then s366 else s365 s368 :: SBool = s325 ^ s367 s369 :: SBool = if s263 then s368 else s367 s370 :: SBool = s309 ^ s369 s371 :: SBool = if s271 then s370 else s369 s372 :: SBool = s295 ^ s371 s373 :: SBool = if s281 then s372 else s371 s374 :: SBool = s283 ^ s373 s375 :: SBool = if s293 then s374 else s373 s376 :: SBool = s273 ^ s375 s377 :: SBool = if s307 then s376 else s375 s378 :: SBool = s265 ^ s377 s379 :: SBool = if s323 then s378 else s377 s380 :: SBool = s259 ^ s379 s381 :: SBool = if s341 then s380 else s379 s382 :: SBool = s255 ^ s381 s383 :: SBool = if s361 then s382 else s381 s384 :: SWord1 = choose [5:5] s0 s385 :: SBool = s6 /= s384 s386 :: SBool = s70 ^ s385 s387 :: SBool = if s14 then s386 else s70 s388 :: SBool = s363 ^ s387 s389 :: SBool = if s257 then s388 else s387 s390 :: SBool = s343 ^ s389 s391 :: SBool = if s263 then s390 else s389 s392 :: SBool = s325 ^ s391 s393 :: SBool = if s271 then s392 else s391 s394 :: SBool = s309 ^ s393 s395 :: SBool = if s281 then s394 else s393 s396 :: SBool = s295 ^ s395 s397 :: SBool = if s293 then s396 else s395 s398 :: SBool = s283 ^ s397 s399 :: SBool = if s307 then s398 else s397 s400 :: SBool = s273 ^ s399 s401 :: SBool = if s323 then s400 else s399 s402 :: SBool = s265 ^ s401 s403 :: SBool = if s341 then s402 else s401 s404 :: SBool = s259 ^ s403 s405 :: SBool = if s361 then s404 else s403 s406 :: SBool = s255 ^ s405 s407 :: SBool = if s383 then s406 else s405 s408 :: SWord1 = choose [4:4] s0 s409 :: SBool = s6 /= s408 s410 :: SBool = s75 ^ s409 s411 :: SBool = if s14 then s410 else s75 s412 :: SBool = s385 ^ s411 s413 :: SBool = if s257 then s412 else s411 s414 :: SBool = s363 ^ s413 s415 :: SBool = if s263 then s414 else s413 s416 :: SBool = s343 ^ s415 s417 :: SBool = if s271 then s416 else s415 s418 :: SBool = s325 ^ s417 s419 :: SBool = if s281 then s418 else s417 s420 :: SBool = s309 ^ s419 s421 :: SBool = if s293 then s420 else s419 s422 :: SBool = s295 ^ s421 s423 :: SBool = if s307 then s422 else s421 s424 :: SBool = s283 ^ s423 s425 :: SBool = if s323 then s424 else s423 s426 :: SBool = s273 ^ s425 s427 :: SBool = if s341 then s426 else s425 s428 :: SBool = s265 ^ s427 s429 :: SBool = if s361 then s428 else s427 s430 :: SBool = s259 ^ s429 s431 :: SBool = if s383 then s430 else s429 s432 :: SBool = s255 ^ s431 s433 :: SBool = if s407 then s432 else s431 s434 :: SWord1 = choose [3:3] s0 s435 :: SBool = s6 /= s434 s436 :: SBool = s80 ^ s435 s437 :: SBool = if s14 then s436 else s80 s438 :: SBool = s409 ^ s437 s439 :: SBool = if s257 then s438 else s437 s440 :: SBool = s385 ^ s439 s441 :: SBool = if s263 then s440 else s439 s442 :: SBool = s363 ^ s441 s443 :: SBool = if s271 then s442 else s441 s444 :: SBool = s343 ^ s443 s445 :: SBool = if s281 then s444 else s443 s446 :: SBool = s325 ^ s445 s447 :: SBool = if s293 then s446 else s445 s448 :: SBool = s309 ^ s447 s449 :: SBool = if s307 then s448 else s447 s450 :: SBool = s295 ^ s449 s451 :: SBool = if s323 then s450 else s449 s452 :: SBool = s283 ^ s451 s453 :: SBool = if s341 then s452 else s451 s454 :: SBool = s273 ^ s453 s455 :: SBool = if s361 then s454 else s453 s456 :: SBool = s265 ^ s455 s457 :: SBool = if s383 then s456 else s455 s458 :: SBool = s259 ^ s457 s459 :: SBool = if s407 then s458 else s457 s460 :: SBool = s255 ^ s459 s461 :: SBool = if s433 then s460 else s459 s462 :: SWord1 = choose [2:2] s0 s463 :: SBool = s6 /= s462 s464 :: SBool = s85 ^ s463 s465 :: SBool = if s14 then s464 else s85 s466 :: SBool = s435 ^ s465 s467 :: SBool = if s257 then s466 else s465 s468 :: SBool = s409 ^ s467 s469 :: SBool = if s263 then s468 else s467 s470 :: SBool = s385 ^ s469 s471 :: SBool = if s271 then s470 else s469 s472 :: SBool = s363 ^ s471 s473 :: SBool = if s281 then s472 else s471 s474 :: SBool = s343 ^ s473 s475 :: SBool = if s293 then s474 else s473 s476 :: SBool = s325 ^ s475 s477 :: SBool = if s307 then s476 else s475 s478 :: SBool = s309 ^ s477 s479 :: SBool = if s323 then s478 else s477 s480 :: SBool = s295 ^ s479 s481 :: SBool = if s341 then s480 else s479 s482 :: SBool = s283 ^ s481 s483 :: SBool = if s361 then s482 else s481 s484 :: SBool = s273 ^ s483 s485 :: SBool = if s383 then s484 else s483 s486 :: SBool = s265 ^ s485 s487 :: SBool = if s407 then s486 else s485 s488 :: SBool = s259 ^ s487 s489 :: SBool = if s433 then s488 else s487 s490 :: SBool = s255 ^ s489 s491 :: SBool = if s461 then s490 else s489 s492 :: SWord1 = choose [1:1] s0 s493 :: SBool = s6 /= s492 s494 :: SBool = s90 ^ s493 s495 :: SBool = if s14 then s494 else s90 s496 :: SBool = s463 ^ s495 s497 :: SBool = if s257 then s496 else s495 s498 :: SBool = s435 ^ s497 s499 :: SBool = if s263 then s498 else s497 s500 :: SBool = s409 ^ s499 s501 :: SBool = if s271 then s500 else s499 s502 :: SBool = s385 ^ s501 s503 :: SBool = if s281 then s502 else s501 s504 :: SBool = s363 ^ s503 s505 :: SBool = if s293 then s504 else s503 s506 :: SBool = s343 ^ s505 s507 :: SBool = if s307 then s506 else s505 s508 :: SBool = s325 ^ s507 s509 :: SBool = if s323 then s508 else s507 s510 :: SBool = s309 ^ s509 s511 :: SBool = if s341 then s510 else s509 s512 :: SBool = s295 ^ s511 s513 :: SBool = if s361 then s512 else s511 s514 :: SBool = s283 ^ s513 s515 :: SBool = if s383 then s514 else s513 s516 :: SBool = s273 ^ s515 s517 :: SBool = if s407 then s516 else s515 s518 :: SBool = s265 ^ s517 s519 :: SBool = if s433 then s518 else s517 s520 :: SBool = s259 ^ s519 s521 :: SBool = if s461 then s520 else s519 s522 :: SBool = s255 ^ s521 s523 :: SBool = if s491 then s522 else s521 s524 :: SBool = s7 ^ s95 s525 :: SBool = if s14 then s524 else s95 s526 :: SBool = s493 ^ s525 s527 :: SBool = if s257 then s526 else s525 s528 :: SBool = s463 ^ s527 s529 :: SBool = if s263 then s528 else s527 s530 :: SBool = s435 ^ s529 s531 :: SBool = if s271 then s530 else s529 s532 :: SBool = s409 ^ s531 s533 :: SBool = if s281 then s532 else s531 s534 :: SBool = s385 ^ s533 s535 :: SBool = if s293 then s534 else s533 s536 :: SBool = s363 ^ s535 s537 :: SBool = if s307 then s536 else s535 s538 :: SBool = s343 ^ s537 s539 :: SBool = if s323 then s538 else s537 s540 :: SBool = s325 ^ s539 s541 :: SBool = if s341 then s540 else s539 s542 :: SBool = s309 ^ s541 s543 :: SBool = if s361 then s542 else s541 s544 :: SBool = s295 ^ s543 s545 :: SBool = if s383 then s544 else s543 s546 :: SBool = s283 ^ s545 s547 :: SBool = if s407 then s546 else s545 s548 :: SBool = s273 ^ s547 s549 :: SBool = if s433 then s548 else s547 s550 :: SBool = s265 ^ s549 s551 :: SBool = if s461 then s550 else s549 s552 :: SBool = s259 ^ s551 s553 :: SBool = if s491 then s552 else s551 s554 :: SBool = s255 ^ s553 s555 :: SBool = if s523 then s554 else s553 s556 :: SBool = s7 ^ s100 s557 :: SBool = if s257 then s556 else s100 s558 :: SBool = s493 ^ s557 s559 :: SBool = if s263 then s558 else s557 s560 :: SBool = s463 ^ s559 s561 :: SBool = if s271 then s560 else s559 s562 :: SBool = s435 ^ s561 s563 :: SBool = if s281 then s562 else s561 s564 :: SBool = s409 ^ s563 s565 :: SBool = if s293 then s564 else s563 s566 :: SBool = s385 ^ s565 s567 :: SBool = if s307 then s566 else s565 s568 :: SBool = s363 ^ s567 s569 :: SBool = if s323 then s568 else s567 s570 :: SBool = s343 ^ s569 s571 :: SBool = if s341 then s570 else s569 s572 :: SBool = s325 ^ s571 s573 :: SBool = if s361 then s572 else s571 s574 :: SBool = s309 ^ s573 s575 :: SBool = if s383 then s574 else s573 s576 :: SBool = s295 ^ s575 s577 :: SBool = if s407 then s576 else s575 s578 :: SBool = s283 ^ s577 s579 :: SBool = if s433 then s578 else s577 s580 :: SBool = s273 ^ s579 s581 :: SBool = if s461 then s580 else s579 s582 :: SBool = s265 ^ s581 s583 :: SBool = if s491 then s582 else s581 s584 :: SBool = s259 ^ s583 s585 :: SBool = if s523 then s584 else s583 s586 :: SBool = s255 ^ s585 s587 :: SBool = if s555 then s586 else s585 s588 :: SBool = s7 ^ s105 s589 :: SBool = if s263 then s588 else s105 s590 :: SBool = s493 ^ s589 s591 :: SBool = if s271 then s590 else s589 s592 :: SBool = s463 ^ s591 s593 :: SBool = if s281 then s592 else s591 s594 :: SBool = s435 ^ s593 s595 :: SBool = if s293 then s594 else s593 s596 :: SBool = s409 ^ s595 s597 :: SBool = if s307 then s596 else s595 s598 :: SBool = s385 ^ s597 s599 :: SBool = if s323 then s598 else s597 s600 :: SBool = s363 ^ s599 s601 :: SBool = if s341 then s600 else s599 s602 :: SBool = s343 ^ s601 s603 :: SBool = if s361 then s602 else s601 s604 :: SBool = s325 ^ s603 s605 :: SBool = if s383 then s604 else s603 s606 :: SBool = s309 ^ s605 s607 :: SBool = if s407 then s606 else s605 s608 :: SBool = s295 ^ s607 s609 :: SBool = if s433 then s608 else s607 s610 :: SBool = s283 ^ s609 s611 :: SBool = if s461 then s610 else s609 s612 :: SBool = s273 ^ s611 s613 :: SBool = if s491 then s612 else s611 s614 :: SBool = s265 ^ s613 s615 :: SBool = if s523 then s614 else s613 s616 :: SBool = s259 ^ s615 s617 :: SBool = if s555 then s616 else s615 s618 :: SBool = s255 ^ s617 s619 :: SBool = if s587 then s618 else s617 s620 :: SBool = s7 ^ s110 s621 :: SBool = if s271 then s620 else s110 s622 :: SBool = s493 ^ s621 s623 :: SBool = if s281 then s622 else s621 s624 :: SBool = s463 ^ s623 s625 :: SBool = if s293 then s624 else s623 s626 :: SBool = s435 ^ s625 s627 :: SBool = if s307 then s626 else s625 s628 :: SBool = s409 ^ s627 s629 :: SBool = if s323 then s628 else s627 s630 :: SBool = s385 ^ s629 s631 :: SBool = if s341 then s630 else s629 s632 :: SBool = s363 ^ s631 s633 :: SBool = if s361 then s632 else s631 s634 :: SBool = s343 ^ s633 s635 :: SBool = if s383 then s634 else s633 s636 :: SBool = s325 ^ s635 s637 :: SBool = if s407 then s636 else s635 s638 :: SBool = s309 ^ s637 s639 :: SBool = if s433 then s638 else s637 s640 :: SBool = s295 ^ s639 s641 :: SBool = if s461 then s640 else s639 s642 :: SBool = s283 ^ s641 s643 :: SBool = if s491 then s642 else s641 s644 :: SBool = s273 ^ s643 s645 :: SBool = if s523 then s644 else s643 s646 :: SBool = s265 ^ s645 s647 :: SBool = if s555 then s646 else s645 s648 :: SBool = s259 ^ s647 s649 :: SBool = if s587 then s648 else s647 s650 :: SBool = s255 ^ s649 s651 :: SBool = if s619 then s650 else s649 s652 :: SBool = s7 ^ s115 s653 :: SBool = if s281 then s652 else s115 s654 :: SBool = s493 ^ s653 s655 :: SBool = if s293 then s654 else s653 s656 :: SBool = s463 ^ s655 s657 :: SBool = if s307 then s656 else s655 s658 :: SBool = s435 ^ s657 s659 :: SBool = if s323 then s658 else s657 s660 :: SBool = s409 ^ s659 s661 :: SBool = if s341 then s660 else s659 s662 :: SBool = s385 ^ s661 s663 :: SBool = if s361 then s662 else s661 s664 :: SBool = s363 ^ s663 s665 :: SBool = if s383 then s664 else s663 s666 :: SBool = s343 ^ s665 s667 :: SBool = if s407 then s666 else s665 s668 :: SBool = s325 ^ s667 s669 :: SBool = if s433 then s668 else s667 s670 :: SBool = s309 ^ s669 s671 :: SBool = if s461 then s670 else s669 s672 :: SBool = s295 ^ s671 s673 :: SBool = if s491 then s672 else s671 s674 :: SBool = s283 ^ s673 s675 :: SBool = if s523 then s674 else s673 s676 :: SBool = s273 ^ s675 s677 :: SBool = if s555 then s676 else s675 s678 :: SBool = s265 ^ s677 s679 :: SBool = if s587 then s678 else s677 s680 :: SBool = s259 ^ s679 s681 :: SBool = if s619 then s680 else s679 s682 :: SBool = s255 ^ s681 s683 :: SBool = if s651 then s682 else s681 s684 :: SBool = s7 ^ s120 s685 :: SBool = if s293 then s684 else s120 s686 :: SBool = s493 ^ s685 s687 :: SBool = if s307 then s686 else s685 s688 :: SBool = s463 ^ s687 s689 :: SBool = if s323 then s688 else s687 s690 :: SBool = s435 ^ s689 s691 :: SBool = if s341 then s690 else s689 s692 :: SBool = s409 ^ s691 s693 :: SBool = if s361 then s692 else s691 s694 :: SBool = s385 ^ s693 s695 :: SBool = if s383 then s694 else s693 s696 :: SBool = s363 ^ s695 s697 :: SBool = if s407 then s696 else s695 s698 :: SBool = s343 ^ s697 s699 :: SBool = if s433 then s698 else s697 s700 :: SBool = s325 ^ s699 s701 :: SBool = if s461 then s700 else s699 s702 :: SBool = s309 ^ s701 s703 :: SBool = if s491 then s702 else s701 s704 :: SBool = s295 ^ s703 s705 :: SBool = if s523 then s704 else s703 s706 :: SBool = s283 ^ s705 s707 :: SBool = if s555 then s706 else s705 s708 :: SBool = s273 ^ s707 s709 :: SBool = if s587 then s708 else s707 s710 :: SBool = s265 ^ s709 s711 :: SBool = if s619 then s710 else s709 s712 :: SBool = s259 ^ s711 s713 :: SBool = if s651 then s712 else s711 s714 :: SBool = s255 ^ s713 s715 :: SBool = if s683 then s714 else s713 s716 :: SBool = s7 ^ s125 s717 :: SBool = if s307 then s716 else s125 s718 :: SBool = s493 ^ s717 s719 :: SBool = if s323 then s718 else s717 s720 :: SBool = s463 ^ s719 s721 :: SBool = if s341 then s720 else s719 s722 :: SBool = s435 ^ s721 s723 :: SBool = if s361 then s722 else s721 s724 :: SBool = s409 ^ s723 s725 :: SBool = if s383 then s724 else s723 s726 :: SBool = s385 ^ s725 s727 :: SBool = if s407 then s726 else s725 s728 :: SBool = s363 ^ s727 s729 :: SBool = if s433 then s728 else s727 s730 :: SBool = s343 ^ s729 s731 :: SBool = if s461 then s730 else s729 s732 :: SBool = s325 ^ s731 s733 :: SBool = if s491 then s732 else s731 s734 :: SBool = s309 ^ s733 s735 :: SBool = if s523 then s734 else s733 s736 :: SBool = s295 ^ s735 s737 :: SBool = if s555 then s736 else s735 s738 :: SBool = s283 ^ s737 s739 :: SBool = if s587 then s738 else s737 s740 :: SBool = s273 ^ s739 s741 :: SBool = if s619 then s740 else s739 s742 :: SBool = s265 ^ s741 s743 :: SBool = if s651 then s742 else s741 s744 :: SBool = s259 ^ s743 s745 :: SBool = if s683 then s744 else s743 s746 :: SBool = s255 ^ s745 s747 :: SBool = if s715 then s746 else s745 s748 :: SBool = s7 ^ s130 s749 :: SBool = if s323 then s748 else s130 s750 :: SBool = s493 ^ s749 s751 :: SBool = if s341 then s750 else s749 s752 :: SBool = s463 ^ s751 s753 :: SBool = if s361 then s752 else s751 s754 :: SBool = s435 ^ s753 s755 :: SBool = if s383 then s754 else s753 s756 :: SBool = s409 ^ s755 s757 :: SBool = if s407 then s756 else s755 s758 :: SBool = s385 ^ s757 s759 :: SBool = if s433 then s758 else s757 s760 :: SBool = s363 ^ s759 s761 :: SBool = if s461 then s760 else s759 s762 :: SBool = s343 ^ s761 s763 :: SBool = if s491 then s762 else s761 s764 :: SBool = s325 ^ s763 s765 :: SBool = if s523 then s764 else s763 s766 :: SBool = s309 ^ s765 s767 :: SBool = if s555 then s766 else s765 s768 :: SBool = s295 ^ s767 s769 :: SBool = if s587 then s768 else s767 s770 :: SBool = s283 ^ s769 s771 :: SBool = if s619 then s770 else s769 s772 :: SBool = s273 ^ s771 s773 :: SBool = if s651 then s772 else s771 s774 :: SBool = s265 ^ s773 s775 :: SBool = if s683 then s774 else s773 s776 :: SBool = s259 ^ s775 s777 :: SBool = if s715 then s776 else s775 s778 :: SBool = s255 ^ s777 s779 :: SBool = if s747 then s778 else s777 s780 :: SBool = s7 ^ s135 s781 :: SBool = if s341 then s780 else s135 s782 :: SBool = s493 ^ s781 s783 :: SBool = if s361 then s782 else s781 s784 :: SBool = s463 ^ s783 s785 :: SBool = if s383 then s784 else s783 s786 :: SBool = s435 ^ s785 s787 :: SBool = if s407 then s786 else s785 s788 :: SBool = s409 ^ s787 s789 :: SBool = if s433 then s788 else s787 s790 :: SBool = s385 ^ s789 s791 :: SBool = if s461 then s790 else s789 s792 :: SBool = s363 ^ s791 s793 :: SBool = if s491 then s792 else s791 s794 :: SBool = s343 ^ s793 s795 :: SBool = if s523 then s794 else s793 s796 :: SBool = s325 ^ s795 s797 :: SBool = if s555 then s796 else s795 s798 :: SBool = s309 ^ s797 s799 :: SBool = if s587 then s798 else s797 s800 :: SBool = s295 ^ s799 s801 :: SBool = if s619 then s800 else s799 s802 :: SBool = s283 ^ s801 s803 :: SBool = if s651 then s802 else s801 s804 :: SBool = s273 ^ s803 s805 :: SBool = if s683 then s804 else s803 s806 :: SBool = s265 ^ s805 s807 :: SBool = if s715 then s806 else s805 s808 :: SBool = s259 ^ s807 s809 :: SBool = if s747 then s808 else s807 s810 :: SBool = s255 ^ s809 s811 :: SBool = if s779 then s810 else s809 s812 :: SBool = s7 ^ s140 s813 :: SBool = if s361 then s812 else s140 s814 :: SBool = s493 ^ s813 s815 :: SBool = if s383 then s814 else s813 s816 :: SBool = s463 ^ s815 s817 :: SBool = if s407 then s816 else s815 s818 :: SBool = s435 ^ s817 s819 :: SBool = if s433 then s818 else s817 s820 :: SBool = s409 ^ s819 s821 :: SBool = if s461 then s820 else s819 s822 :: SBool = s385 ^ s821 s823 :: SBool = if s491 then s822 else s821 s824 :: SBool = s363 ^ s823 s825 :: SBool = if s523 then s824 else s823 s826 :: SBool = s343 ^ s825 s827 :: SBool = if s555 then s826 else s825 s828 :: SBool = s325 ^ s827 s829 :: SBool = if s587 then s828 else s827 s830 :: SBool = s309 ^ s829 s831 :: SBool = if s619 then s830 else s829 s832 :: SBool = s295 ^ s831 s833 :: SBool = if s651 then s832 else s831 s834 :: SBool = s283 ^ s833 s835 :: SBool = if s683 then s834 else s833 s836 :: SBool = s273 ^ s835 s837 :: SBool = if s715 then s836 else s835 s838 :: SBool = s265 ^ s837 s839 :: SBool = if s747 then s838 else s837 s840 :: SBool = s259 ^ s839 s841 :: SBool = if s779 then s840 else s839 s842 :: SBool = s255 ^ s841 s843 :: SBool = if s811 then s842 else s841 s844 :: SBool = s7 ^ s145 s845 :: SBool = if s383 then s844 else s145 s846 :: SBool = s493 ^ s845 s847 :: SBool = if s407 then s846 else s845 s848 :: SBool = s463 ^ s847 s849 :: SBool = if s433 then s848 else s847 s850 :: SBool = s435 ^ s849 s851 :: SBool = if s461 then s850 else s849 s852 :: SBool = s409 ^ s851 s853 :: SBool = if s491 then s852 else s851 s854 :: SBool = s385 ^ s853 s855 :: SBool = if s523 then s854 else s853 s856 :: SBool = s363 ^ s855 s857 :: SBool = if s555 then s856 else s855 s858 :: SBool = s343 ^ s857 s859 :: SBool = if s587 then s858 else s857 s860 :: SBool = s325 ^ s859 s861 :: SBool = if s619 then s860 else s859 s862 :: SBool = s309 ^ s861 s863 :: SBool = if s651 then s862 else s861 s864 :: SBool = s295 ^ s863 s865 :: SBool = if s683 then s864 else s863 s866 :: SBool = s283 ^ s865 s867 :: SBool = if s715 then s866 else s865 s868 :: SBool = s273 ^ s867 s869 :: SBool = if s747 then s868 else s867 s870 :: SBool = s265 ^ s869 s871 :: SBool = if s779 then s870 else s869 s872 :: SBool = s259 ^ s871 s873 :: SBool = if s811 then s872 else s871 s874 :: SBool = s255 ^ s873 s875 :: SBool = if s843 then s874 else s873 s876 :: SBool = s7 ^ s150 s877 :: SBool = if s407 then s876 else s150 s878 :: SBool = s493 ^ s877 s879 :: SBool = if s433 then s878 else s877 s880 :: SBool = s463 ^ s879 s881 :: SBool = if s461 then s880 else s879 s882 :: SBool = s435 ^ s881 s883 :: SBool = if s491 then s882 else s881 s884 :: SBool = s409 ^ s883 s885 :: SBool = if s523 then s884 else s883 s886 :: SBool = s385 ^ s885 s887 :: SBool = if s555 then s886 else s885 s888 :: SBool = s363 ^ s887 s889 :: SBool = if s587 then s888 else s887 s890 :: SBool = s343 ^ s889 s891 :: SBool = if s619 then s890 else s889 s892 :: SBool = s325 ^ s891 s893 :: SBool = if s651 then s892 else s891 s894 :: SBool = s309 ^ s893 s895 :: SBool = if s683 then s894 else s893 s896 :: SBool = s295 ^ s895 s897 :: SBool = if s715 then s896 else s895 s898 :: SBool = s283 ^ s897 s899 :: SBool = if s747 then s898 else s897 s900 :: SBool = s273 ^ s899 s901 :: SBool = if s779 then s900 else s899 s902 :: SBool = s265 ^ s901 s903 :: SBool = if s811 then s902 else s901 s904 :: SBool = s259 ^ s903 s905 :: SBool = if s843 then s904 else s903 s906 :: SBool = s255 ^ s905 s907 :: SBool = if s875 then s906 else s905 s908 :: SBool = s7 ^ s155 s909 :: SBool = if s433 then s908 else s155 s910 :: SBool = s493 ^ s909 s911 :: SBool = if s461 then s910 else s909 s912 :: SBool = s463 ^ s911 s913 :: SBool = if s491 then s912 else s911 s914 :: SBool = s435 ^ s913 s915 :: SBool = if s523 then s914 else s913 s916 :: SBool = s409 ^ s915 s917 :: SBool = if s555 then s916 else s915 s918 :: SBool = s385 ^ s917 s919 :: SBool = if s587 then s918 else s917 s920 :: SBool = s363 ^ s919 s921 :: SBool = if s619 then s920 else s919 s922 :: SBool = s343 ^ s921 s923 :: SBool = if s651 then s922 else s921 s924 :: SBool = s325 ^ s923 s925 :: SBool = if s683 then s924 else s923 s926 :: SBool = s309 ^ s925 s927 :: SBool = if s715 then s926 else s925 s928 :: SBool = s295 ^ s927 s929 :: SBool = if s747 then s928 else s927 s930 :: SBool = s283 ^ s929 s931 :: SBool = if s779 then s930 else s929 s932 :: SBool = s273 ^ s931 s933 :: SBool = if s811 then s932 else s931 s934 :: SBool = s265 ^ s933 s935 :: SBool = if s843 then s934 else s933 s936 :: SBool = s259 ^ s935 s937 :: SBool = if s875 then s936 else s935 s938 :: SBool = s255 ^ s937 s939 :: SBool = if s907 then s938 else s937 s940 :: SBool = s7 ^ s160 s941 :: SBool = if s461 then s940 else s160 s942 :: SBool = s493 ^ s941 s943 :: SBool = if s491 then s942 else s941 s944 :: SBool = s463 ^ s943 s945 :: SBool = if s523 then s944 else s943 s946 :: SBool = s435 ^ s945 s947 :: SBool = if s555 then s946 else s945 s948 :: SBool = s409 ^ s947 s949 :: SBool = if s587 then s948 else s947 s950 :: SBool = s385 ^ s949 s951 :: SBool = if s619 then s950 else s949 s952 :: SBool = s363 ^ s951 s953 :: SBool = if s651 then s952 else s951 s954 :: SBool = s343 ^ s953 s955 :: SBool = if s683 then s954 else s953 s956 :: SBool = s325 ^ s955 s957 :: SBool = if s715 then s956 else s955 s958 :: SBool = s309 ^ s957 s959 :: SBool = if s747 then s958 else s957 s960 :: SBool = s295 ^ s959 s961 :: SBool = if s779 then s960 else s959 s962 :: SBool = s283 ^ s961 s963 :: SBool = if s811 then s962 else s961 s964 :: SBool = s273 ^ s963 s965 :: SBool = if s843 then s964 else s963 s966 :: SBool = s265 ^ s965 s967 :: SBool = if s875 then s966 else s965 s968 :: SBool = s259 ^ s967 s969 :: SBool = if s907 then s968 else s967 s970 :: SBool = s255 ^ s969 s971 :: SBool = if s939 then s970 else s969 s972 :: SBool = s7 ^ s165 s973 :: SBool = if s491 then s972 else s165 s974 :: SBool = s493 ^ s973 s975 :: SBool = if s523 then s974 else s973 s976 :: SBool = s463 ^ s975 s977 :: SBool = if s555 then s976 else s975 s978 :: SBool = s435 ^ s977 s979 :: SBool = if s587 then s978 else s977 s980 :: SBool = s409 ^ s979 s981 :: SBool = if s619 then s980 else s979 s982 :: SBool = s385 ^ s981 s983 :: SBool = if s651 then s982 else s981 s984 :: SBool = s363 ^ s983 s985 :: SBool = if s683 then s984 else s983 s986 :: SBool = s343 ^ s985 s987 :: SBool = if s715 then s986 else s985 s988 :: SBool = s325 ^ s987 s989 :: SBool = if s747 then s988 else s987 s990 :: SBool = s309 ^ s989 s991 :: SBool = if s779 then s990 else s989 s992 :: SBool = s295 ^ s991 s993 :: SBool = if s811 then s992 else s991 s994 :: SBool = s283 ^ s993 s995 :: SBool = if s843 then s994 else s993 s996 :: SBool = s273 ^ s995 s997 :: SBool = if s875 then s996 else s995 s998 :: SBool = s265 ^ s997 s999 :: SBool = if s907 then s998 else s997 s1000 :: SBool = s259 ^ s999 s1001 :: SBool = if s939 then s1000 else s999 s1002 :: SBool = s255 ^ s1001 s1003 :: SBool = if s971 then s1002 else s1001 s1004 :: SBool = s7 ^ s170 s1005 :: SBool = if s523 then s1004 else s170 s1006 :: SBool = s493 ^ s1005 s1007 :: SBool = if s555 then s1006 else s1005 s1008 :: SBool = s463 ^ s1007 s1009 :: SBool = if s587 then s1008 else s1007 s1010 :: SBool = s435 ^ s1009 s1011 :: SBool = if s619 then s1010 else s1009 s1012 :: SBool = s409 ^ s1011 s1013 :: SBool = if s651 then s1012 else s1011 s1014 :: SBool = s385 ^ s1013 s1015 :: SBool = if s683 then s1014 else s1013 s1016 :: SBool = s363 ^ s1015 s1017 :: SBool = if s715 then s1016 else s1015 s1018 :: SBool = s343 ^ s1017 s1019 :: SBool = if s747 then s1018 else s1017 s1020 :: SBool = s325 ^ s1019 s1021 :: SBool = if s779 then s1020 else s1019 s1022 :: SBool = s309 ^ s1021 s1023 :: SBool = if s811 then s1022 else s1021 s1024 :: SBool = s295 ^ s1023 s1025 :: SBool = if s843 then s1024 else s1023 s1026 :: SBool = s283 ^ s1025 s1027 :: SBool = if s875 then s1026 else s1025 s1028 :: SBool = s273 ^ s1027 s1029 :: SBool = if s907 then s1028 else s1027 s1030 :: SBool = s265 ^ s1029 s1031 :: SBool = if s939 then s1030 else s1029 s1032 :: SBool = s259 ^ s1031 s1033 :: SBool = if s971 then s1032 else s1031 s1034 :: SBool = s255 ^ s1033 s1035 :: SBool = if s1003 then s1034 else s1033 s1036 :: SBool = s7 ^ s175 s1037 :: SBool = if s555 then s1036 else s175 s1038 :: SBool = s493 ^ s1037 s1039 :: SBool = if s587 then s1038 else s1037 s1040 :: SBool = s463 ^ s1039 s1041 :: SBool = if s619 then s1040 else s1039 s1042 :: SBool = s435 ^ s1041 s1043 :: SBool = if s651 then s1042 else s1041 s1044 :: SBool = s409 ^ s1043 s1045 :: SBool = if s683 then s1044 else s1043 s1046 :: SBool = s385 ^ s1045 s1047 :: SBool = if s715 then s1046 else s1045 s1048 :: SBool = s363 ^ s1047 s1049 :: SBool = if s747 then s1048 else s1047 s1050 :: SBool = s343 ^ s1049 s1051 :: SBool = if s779 then s1050 else s1049 s1052 :: SBool = s325 ^ s1051 s1053 :: SBool = if s811 then s1052 else s1051 s1054 :: SBool = s309 ^ s1053 s1055 :: SBool = if s843 then s1054 else s1053 s1056 :: SBool = s295 ^ s1055 s1057 :: SBool = if s875 then s1056 else s1055 s1058 :: SBool = s283 ^ s1057 s1059 :: SBool = if s907 then s1058 else s1057 s1060 :: SBool = s273 ^ s1059 s1061 :: SBool = if s939 then s1060 else s1059 s1062 :: SBool = s265 ^ s1061 s1063 :: SBool = if s971 then s1062 else s1061 s1064 :: SBool = s259 ^ s1063 s1065 :: SBool = if s1003 then s1064 else s1063 s1066 :: SBool = s255 ^ s1065 s1067 :: SBool = if s1035 then s1066 else s1065 s1068 :: SBool = s7 ^ s180 s1069 :: SBool = if s587 then s1068 else s180 s1070 :: SBool = s493 ^ s1069 s1071 :: SBool = if s619 then s1070 else s1069 s1072 :: SBool = s463 ^ s1071 s1073 :: SBool = if s651 then s1072 else s1071 s1074 :: SBool = s435 ^ s1073 s1075 :: SBool = if s683 then s1074 else s1073 s1076 :: SBool = s409 ^ s1075 s1077 :: SBool = if s715 then s1076 else s1075 s1078 :: SBool = s385 ^ s1077 s1079 :: SBool = if s747 then s1078 else s1077 s1080 :: SBool = s363 ^ s1079 s1081 :: SBool = if s779 then s1080 else s1079 s1082 :: SBool = s343 ^ s1081 s1083 :: SBool = if s811 then s1082 else s1081 s1084 :: SBool = s325 ^ s1083 s1085 :: SBool = if s843 then s1084 else s1083 s1086 :: SBool = s309 ^ s1085 s1087 :: SBool = if s875 then s1086 else s1085 s1088 :: SBool = s295 ^ s1087 s1089 :: SBool = if s907 then s1088 else s1087 s1090 :: SBool = s283 ^ s1089 s1091 :: SBool = if s939 then s1090 else s1089 s1092 :: SBool = s273 ^ s1091 s1093 :: SBool = if s971 then s1092 else s1091 s1094 :: SBool = s265 ^ s1093 s1095 :: SBool = if s1003 then s1094 else s1093 s1096 :: SBool = s259 ^ s1095 s1097 :: SBool = if s1035 then s1096 else s1095 s1098 :: SBool = s255 ^ s1097 s1099 :: SBool = if s1067 then s1098 else s1097 s1100 :: SBool = s7 ^ s185 s1101 :: SBool = if s619 then s1100 else s185 s1102 :: SBool = s493 ^ s1101 s1103 :: SBool = if s651 then s1102 else s1101 s1104 :: SBool = s463 ^ s1103 s1105 :: SBool = if s683 then s1104 else s1103 s1106 :: SBool = s435 ^ s1105 s1107 :: SBool = if s715 then s1106 else s1105 s1108 :: SBool = s409 ^ s1107 s1109 :: SBool = if s747 then s1108 else s1107 s1110 :: SBool = s385 ^ s1109 s1111 :: SBool = if s779 then s1110 else s1109 s1112 :: SBool = s363 ^ s1111 s1113 :: SBool = if s811 then s1112 else s1111 s1114 :: SBool = s343 ^ s1113 s1115 :: SBool = if s843 then s1114 else s1113 s1116 :: SBool = s325 ^ s1115 s1117 :: SBool = if s875 then s1116 else s1115 s1118 :: SBool = s309 ^ s1117 s1119 :: SBool = if s907 then s1118 else s1117 s1120 :: SBool = s295 ^ s1119 s1121 :: SBool = if s939 then s1120 else s1119 s1122 :: SBool = s283 ^ s1121 s1123 :: SBool = if s971 then s1122 else s1121 s1124 :: SBool = s273 ^ s1123 s1125 :: SBool = if s1003 then s1124 else s1123 s1126 :: SBool = s265 ^ s1125 s1127 :: SBool = if s1035 then s1126 else s1125 s1128 :: SBool = s259 ^ s1127 s1129 :: SBool = if s1067 then s1128 else s1127 s1130 :: SBool = s255 ^ s1129 s1131 :: SBool = if s1099 then s1130 else s1129 s1132 :: SBool = s7 ^ s190 s1133 :: SBool = if s651 then s1132 else s190 s1134 :: SBool = s493 ^ s1133 s1135 :: SBool = if s683 then s1134 else s1133 s1136 :: SBool = s463 ^ s1135 s1137 :: SBool = if s715 then s1136 else s1135 s1138 :: SBool = s435 ^ s1137 s1139 :: SBool = if s747 then s1138 else s1137 s1140 :: SBool = s409 ^ s1139 s1141 :: SBool = if s779 then s1140 else s1139 s1142 :: SBool = s385 ^ s1141 s1143 :: SBool = if s811 then s1142 else s1141 s1144 :: SBool = s363 ^ s1143 s1145 :: SBool = if s843 then s1144 else s1143 s1146 :: SBool = s343 ^ s1145 s1147 :: SBool = if s875 then s1146 else s1145 s1148 :: SBool = s325 ^ s1147 s1149 :: SBool = if s907 then s1148 else s1147 s1150 :: SBool = s309 ^ s1149 s1151 :: SBool = if s939 then s1150 else s1149 s1152 :: SBool = s295 ^ s1151 s1153 :: SBool = if s971 then s1152 else s1151 s1154 :: SBool = s283 ^ s1153 s1155 :: SBool = if s1003 then s1154 else s1153 s1156 :: SBool = s273 ^ s1155 s1157 :: SBool = if s1035 then s1156 else s1155 s1158 :: SBool = s265 ^ s1157 s1159 :: SBool = if s1067 then s1158 else s1157 s1160 :: SBool = s259 ^ s1159 s1161 :: SBool = if s1099 then s1160 else s1159 s1162 :: SBool = s255 ^ s1161 s1163 :: SBool = if s1131 then s1162 else s1161 s1164 :: SBool = s7 ^ s195 s1165 :: SBool = if s683 then s1164 else s195 s1166 :: SBool = s493 ^ s1165 s1167 :: SBool = if s715 then s1166 else s1165 s1168 :: SBool = s463 ^ s1167 s1169 :: SBool = if s747 then s1168 else s1167 s1170 :: SBool = s435 ^ s1169 s1171 :: SBool = if s779 then s1170 else s1169 s1172 :: SBool = s409 ^ s1171 s1173 :: SBool = if s811 then s1172 else s1171 s1174 :: SBool = s385 ^ s1173 s1175 :: SBool = if s843 then s1174 else s1173 s1176 :: SBool = s363 ^ s1175 s1177 :: SBool = if s875 then s1176 else s1175 s1178 :: SBool = s343 ^ s1177 s1179 :: SBool = if s907 then s1178 else s1177 s1180 :: SBool = s325 ^ s1179 s1181 :: SBool = if s939 then s1180 else s1179 s1182 :: SBool = s309 ^ s1181 s1183 :: SBool = if s971 then s1182 else s1181 s1184 :: SBool = s295 ^ s1183 s1185 :: SBool = if s1003 then s1184 else s1183 s1186 :: SBool = s283 ^ s1185 s1187 :: SBool = if s1035 then s1186 else s1185 s1188 :: SBool = s273 ^ s1187 s1189 :: SBool = if s1067 then s1188 else s1187 s1190 :: SBool = s265 ^ s1189 s1191 :: SBool = if s1099 then s1190 else s1189 s1192 :: SBool = s259 ^ s1191 s1193 :: SBool = if s1131 then s1192 else s1191 s1194 :: SBool = s255 ^ s1193 s1195 :: SBool = if s1163 then s1194 else s1193 s1196 :: SBool = s7 ^ s200 s1197 :: SBool = if s715 then s1196 else s200 s1198 :: SBool = s493 ^ s1197 s1199 :: SBool = if s747 then s1198 else s1197 s1200 :: SBool = s463 ^ s1199 s1201 :: SBool = if s779 then s1200 else s1199 s1202 :: SBool = s435 ^ s1201 s1203 :: SBool = if s811 then s1202 else s1201 s1204 :: SBool = s409 ^ s1203 s1205 :: SBool = if s843 then s1204 else s1203 s1206 :: SBool = s385 ^ s1205 s1207 :: SBool = if s875 then s1206 else s1205 s1208 :: SBool = s363 ^ s1207 s1209 :: SBool = if s907 then s1208 else s1207 s1210 :: SBool = s343 ^ s1209 s1211 :: SBool = if s939 then s1210 else s1209 s1212 :: SBool = s325 ^ s1211 s1213 :: SBool = if s971 then s1212 else s1211 s1214 :: SBool = s309 ^ s1213 s1215 :: SBool = if s1003 then s1214 else s1213 s1216 :: SBool = s295 ^ s1215 s1217 :: SBool = if s1035 then s1216 else s1215 s1218 :: SBool = s283 ^ s1217 s1219 :: SBool = if s1067 then s1218 else s1217 s1220 :: SBool = s273 ^ s1219 s1221 :: SBool = if s1099 then s1220 else s1219 s1222 :: SBool = s265 ^ s1221 s1223 :: SBool = if s1131 then s1222 else s1221 s1224 :: SBool = s259 ^ s1223 s1225 :: SBool = if s1163 then s1224 else s1223 s1226 :: SBool = s255 ^ s1225 s1227 :: SBool = if s1195 then s1226 else s1225 s1228 :: SBool = s7 ^ s205 s1229 :: SBool = if s747 then s1228 else s205 s1230 :: SBool = s493 ^ s1229 s1231 :: SBool = if s779 then s1230 else s1229 s1232 :: SBool = s463 ^ s1231 s1233 :: SBool = if s811 then s1232 else s1231 s1234 :: SBool = s435 ^ s1233 s1235 :: SBool = if s843 then s1234 else s1233 s1236 :: SBool = s409 ^ s1235 s1237 :: SBool = if s875 then s1236 else s1235 s1238 :: SBool = s385 ^ s1237 s1239 :: SBool = if s907 then s1238 else s1237 s1240 :: SBool = s363 ^ s1239 s1241 :: SBool = if s939 then s1240 else s1239 s1242 :: SBool = s343 ^ s1241 s1243 :: SBool = if s971 then s1242 else s1241 s1244 :: SBool = s325 ^ s1243 s1245 :: SBool = if s1003 then s1244 else s1243 s1246 :: SBool = s309 ^ s1245 s1247 :: SBool = if s1035 then s1246 else s1245 s1248 :: SBool = s295 ^ s1247 s1249 :: SBool = if s1067 then s1248 else s1247 s1250 :: SBool = s283 ^ s1249 s1251 :: SBool = if s1099 then s1250 else s1249 s1252 :: SBool = s273 ^ s1251 s1253 :: SBool = if s1131 then s1252 else s1251 s1254 :: SBool = s265 ^ s1253 s1255 :: SBool = if s1163 then s1254 else s1253 s1256 :: SBool = s259 ^ s1255 s1257 :: SBool = if s1195 then s1256 else s1255 s1258 :: SBool = s255 ^ s1257 s1259 :: SBool = if s1227 then s1258 else s1257 s1260 :: SBool = s7 ^ s210 s1261 :: SBool = if s779 then s1260 else s210 s1262 :: SBool = s493 ^ s1261 s1263 :: SBool = if s811 then s1262 else s1261 s1264 :: SBool = s463 ^ s1263 s1265 :: SBool = if s843 then s1264 else s1263 s1266 :: SBool = s435 ^ s1265 s1267 :: SBool = if s875 then s1266 else s1265 s1268 :: SBool = s409 ^ s1267 s1269 :: SBool = if s907 then s1268 else s1267 s1270 :: SBool = s385 ^ s1269 s1271 :: SBool = if s939 then s1270 else s1269 s1272 :: SBool = s363 ^ s1271 s1273 :: SBool = if s971 then s1272 else s1271 s1274 :: SBool = s343 ^ s1273 s1275 :: SBool = if s1003 then s1274 else s1273 s1276 :: SBool = s325 ^ s1275 s1277 :: SBool = if s1035 then s1276 else s1275 s1278 :: SBool = s309 ^ s1277 s1279 :: SBool = if s1067 then s1278 else s1277 s1280 :: SBool = s295 ^ s1279 s1281 :: SBool = if s1099 then s1280 else s1279 s1282 :: SBool = s283 ^ s1281 s1283 :: SBool = if s1131 then s1282 else s1281 s1284 :: SBool = s273 ^ s1283 s1285 :: SBool = if s1163 then s1284 else s1283 s1286 :: SBool = s265 ^ s1285 s1287 :: SBool = if s1195 then s1286 else s1285 s1288 :: SBool = s259 ^ s1287 s1289 :: SBool = if s1227 then s1288 else s1287 s1290 :: SBool = s255 ^ s1289 s1291 :: SBool = if s1259 then s1290 else s1289 s1292 :: SBool = s7 ^ s215 s1293 :: SBool = if s811 then s1292 else s215 s1294 :: SBool = s493 ^ s1293 s1295 :: SBool = if s843 then s1294 else s1293 s1296 :: SBool = s463 ^ s1295 s1297 :: SBool = if s875 then s1296 else s1295 s1298 :: SBool = s435 ^ s1297 s1299 :: SBool = if s907 then s1298 else s1297 s1300 :: SBool = s409 ^ s1299 s1301 :: SBool = if s939 then s1300 else s1299 s1302 :: SBool = s385 ^ s1301 s1303 :: SBool = if s971 then s1302 else s1301 s1304 :: SBool = s363 ^ s1303 s1305 :: SBool = if s1003 then s1304 else s1303 s1306 :: SBool = s343 ^ s1305 s1307 :: SBool = if s1035 then s1306 else s1305 s1308 :: SBool = s325 ^ s1307 s1309 :: SBool = if s1067 then s1308 else s1307 s1310 :: SBool = s309 ^ s1309 s1311 :: SBool = if s1099 then s1310 else s1309 s1312 :: SBool = s295 ^ s1311 s1313 :: SBool = if s1131 then s1312 else s1311 s1314 :: SBool = s283 ^ s1313 s1315 :: SBool = if s1163 then s1314 else s1313 s1316 :: SBool = s273 ^ s1315 s1317 :: SBool = if s1195 then s1316 else s1315 s1318 :: SBool = s265 ^ s1317 s1319 :: SBool = if s1227 then s1318 else s1317 s1320 :: SBool = s259 ^ s1319 s1321 :: SBool = if s1259 then s1320 else s1319 s1322 :: SBool = s255 ^ s1321 s1323 :: SBool = if s1291 then s1322 else s1321 s1324 :: SBool = s7 ^ s220 s1325 :: SBool = if s843 then s1324 else s220 s1326 :: SBool = s493 ^ s1325 s1327 :: SBool = if s875 then s1326 else s1325 s1328 :: SBool = s463 ^ s1327 s1329 :: SBool = if s907 then s1328 else s1327 s1330 :: SBool = s435 ^ s1329 s1331 :: SBool = if s939 then s1330 else s1329 s1332 :: SBool = s409 ^ s1331 s1333 :: SBool = if s971 then s1332 else s1331 s1334 :: SBool = s385 ^ s1333 s1335 :: SBool = if s1003 then s1334 else s1333 s1336 :: SBool = s363 ^ s1335 s1337 :: SBool = if s1035 then s1336 else s1335 s1338 :: SBool = s343 ^ s1337 s1339 :: SBool = if s1067 then s1338 else s1337 s1340 :: SBool = s325 ^ s1339 s1341 :: SBool = if s1099 then s1340 else s1339 s1342 :: SBool = s309 ^ s1341 s1343 :: SBool = if s1131 then s1342 else s1341 s1344 :: SBool = s295 ^ s1343 s1345 :: SBool = if s1163 then s1344 else s1343 s1346 :: SBool = s283 ^ s1345 s1347 :: SBool = if s1195 then s1346 else s1345 s1348 :: SBool = s273 ^ s1347 s1349 :: SBool = if s1227 then s1348 else s1347 s1350 :: SBool = s265 ^ s1349 s1351 :: SBool = if s1259 then s1350 else s1349 s1352 :: SBool = s259 ^ s1351 s1353 :: SBool = if s1291 then s1352 else s1351 s1354 :: SBool = s255 ^ s1353 s1355 :: SBool = if s1323 then s1354 else s1353 s1356 :: SBool = s7 ^ s225 s1357 :: SBool = if s875 then s1356 else s225 s1358 :: SBool = s493 ^ s1357 s1359 :: SBool = if s907 then s1358 else s1357 s1360 :: SBool = s463 ^ s1359 s1361 :: SBool = if s939 then s1360 else s1359 s1362 :: SBool = s435 ^ s1361 s1363 :: SBool = if s971 then s1362 else s1361 s1364 :: SBool = s409 ^ s1363 s1365 :: SBool = if s1003 then s1364 else s1363 s1366 :: SBool = s385 ^ s1365 s1367 :: SBool = if s1035 then s1366 else s1365 s1368 :: SBool = s363 ^ s1367 s1369 :: SBool = if s1067 then s1368 else s1367 s1370 :: SBool = s343 ^ s1369 s1371 :: SBool = if s1099 then s1370 else s1369 s1372 :: SBool = s325 ^ s1371 s1373 :: SBool = if s1131 then s1372 else s1371 s1374 :: SBool = s309 ^ s1373 s1375 :: SBool = if s1163 then s1374 else s1373 s1376 :: SBool = s295 ^ s1375 s1377 :: SBool = if s1195 then s1376 else s1375 s1378 :: SBool = s283 ^ s1377 s1379 :: SBool = if s1227 then s1378 else s1377 s1380 :: SBool = s273 ^ s1379 s1381 :: SBool = if s1259 then s1380 else s1379 s1382 :: SBool = s265 ^ s1381 s1383 :: SBool = if s1291 then s1382 else s1381 s1384 :: SBool = s259 ^ s1383 s1385 :: SBool = if s1323 then s1384 else s1383 s1386 :: SBool = s255 ^ s1385 s1387 :: SBool = if s1355 then s1386 else s1385 s1388 :: SBool = s7 ^ s230 s1389 :: SBool = if s907 then s1388 else s230 s1390 :: SBool = s493 ^ s1389 s1391 :: SBool = if s939 then s1390 else s1389 s1392 :: SBool = s463 ^ s1391 s1393 :: SBool = if s971 then s1392 else s1391 s1394 :: SBool = s435 ^ s1393 s1395 :: SBool = if s1003 then s1394 else s1393 s1396 :: SBool = s409 ^ s1395 s1397 :: SBool = if s1035 then s1396 else s1395 s1398 :: SBool = s385 ^ s1397 s1399 :: SBool = if s1067 then s1398 else s1397 s1400 :: SBool = s363 ^ s1399 s1401 :: SBool = if s1099 then s1400 else s1399 s1402 :: SBool = s343 ^ s1401 s1403 :: SBool = if s1131 then s1402 else s1401 s1404 :: SBool = s325 ^ s1403 s1405 :: SBool = if s1163 then s1404 else s1403 s1406 :: SBool = s309 ^ s1405 s1407 :: SBool = if s1195 then s1406 else s1405 s1408 :: SBool = s295 ^ s1407 s1409 :: SBool = if s1227 then s1408 else s1407 s1410 :: SBool = s283 ^ s1409 s1411 :: SBool = if s1259 then s1410 else s1409 s1412 :: SBool = s273 ^ s1411 s1413 :: SBool = if s1291 then s1412 else s1411 s1414 :: SBool = s265 ^ s1413 s1415 :: SBool = if s1323 then s1414 else s1413 s1416 :: SBool = s259 ^ s1415 s1417 :: SBool = if s1355 then s1416 else s1415 s1418 :: SBool = s255 ^ s1417 s1419 :: SBool = if s1387 then s1418 else s1417 s1420 :: SBool = s7 ^ s235 s1421 :: SBool = if s939 then s1420 else s235 s1422 :: SBool = s493 ^ s1421 s1423 :: SBool = if s971 then s1422 else s1421 s1424 :: SBool = s463 ^ s1423 s1425 :: SBool = if s1003 then s1424 else s1423 s1426 :: SBool = s435 ^ s1425 s1427 :: SBool = if s1035 then s1426 else s1425 s1428 :: SBool = s409 ^ s1427 s1429 :: SBool = if s1067 then s1428 else s1427 s1430 :: SBool = s385 ^ s1429 s1431 :: SBool = if s1099 then s1430 else s1429 s1432 :: SBool = s363 ^ s1431 s1433 :: SBool = if s1131 then s1432 else s1431 s1434 :: SBool = s343 ^ s1433 s1435 :: SBool = if s1163 then s1434 else s1433 s1436 :: SBool = s325 ^ s1435 s1437 :: SBool = if s1195 then s1436 else s1435 s1438 :: SBool = s309 ^ s1437 s1439 :: SBool = if s1227 then s1438 else s1437 s1440 :: SBool = s295 ^ s1439 s1441 :: SBool = if s1259 then s1440 else s1439 s1442 :: SBool = s283 ^ s1441 s1443 :: SBool = if s1291 then s1442 else s1441 s1444 :: SBool = s273 ^ s1443 s1445 :: SBool = if s1323 then s1444 else s1443 s1446 :: SBool = s265 ^ s1445 s1447 :: SBool = if s1355 then s1446 else s1445 s1448 :: SBool = s259 ^ s1447 s1449 :: SBool = if s1387 then s1448 else s1447 s1450 :: SBool = s255 ^ s1449 s1451 :: SBool = if s1419 then s1450 else s1449 s1452 :: SBool = s7 ^ s240 s1453 :: SBool = if s971 then s1452 else s240 s1454 :: SBool = s493 ^ s1453 s1455 :: SBool = if s1003 then s1454 else s1453 s1456 :: SBool = s463 ^ s1455 s1457 :: SBool = if s1035 then s1456 else s1455 s1458 :: SBool = s435 ^ s1457 s1459 :: SBool = if s1067 then s1458 else s1457 s1460 :: SBool = s409 ^ s1459 s1461 :: SBool = if s1099 then s1460 else s1459 s1462 :: SBool = s385 ^ s1461 s1463 :: SBool = if s1131 then s1462 else s1461 s1464 :: SBool = s363 ^ s1463 s1465 :: SBool = if s1163 then s1464 else s1463 s1466 :: SBool = s343 ^ s1465 s1467 :: SBool = if s1195 then s1466 else s1465 s1468 :: SBool = s325 ^ s1467 s1469 :: SBool = if s1227 then s1468 else s1467 s1470 :: SBool = s309 ^ s1469 s1471 :: SBool = if s1259 then s1470 else s1469 s1472 :: SBool = s295 ^ s1471 s1473 :: SBool = if s1291 then s1472 else s1471 s1474 :: SBool = s283 ^ s1473 s1475 :: SBool = if s1323 then s1474 else s1473 s1476 :: SBool = s273 ^ s1475 s1477 :: SBool = if s1355 then s1476 else s1475 s1478 :: SBool = s265 ^ s1477 s1479 :: SBool = if s1387 then s1478 else s1477 s1480 :: SBool = s259 ^ s1479 s1481 :: SBool = if s1419 then s1480 else s1479 s1482 :: SBool = s255 ^ s1481 s1483 :: SBool = if s1451 then s1482 else s1481 s1484 :: SBool = s7 ^ s245 s1485 :: SBool = if s1003 then s1484 else s245 s1486 :: SBool = s493 ^ s1485 s1487 :: SBool = if s1035 then s1486 else s1485 s1488 :: SBool = s463 ^ s1487 s1489 :: SBool = if s1067 then s1488 else s1487 s1490 :: SBool = s435 ^ s1489 s1491 :: SBool = if s1099 then s1490 else s1489 s1492 :: SBool = s409 ^ s1491 s1493 :: SBool = if s1131 then s1492 else s1491 s1494 :: SBool = s385 ^ s1493 s1495 :: SBool = if s1163 then s1494 else s1493 s1496 :: SBool = s363 ^ s1495 s1497 :: SBool = if s1195 then s1496 else s1495 s1498 :: SBool = s343 ^ s1497 s1499 :: SBool = if s1227 then s1498 else s1497 s1500 :: SBool = s325 ^ s1499 s1501 :: SBool = if s1259 then s1500 else s1499 s1502 :: SBool = s309 ^ s1501 s1503 :: SBool = if s1291 then s1502 else s1501 s1504 :: SBool = s295 ^ s1503 s1505 :: SBool = if s1323 then s1504 else s1503 s1506 :: SBool = s283 ^ s1505 s1507 :: SBool = if s1355 then s1506 else s1505 s1508 :: SBool = s273 ^ s1507 s1509 :: SBool = if s1387 then s1508 else s1507 s1510 :: SBool = s265 ^ s1509 s1511 :: SBool = if s1419 then s1510 else s1509 s1512 :: SBool = s259 ^ s1511 s1513 :: SBool = if s1451 then s1512 else s1511 s1514 :: SBool = s255 ^ s1513 s1515 :: SBool = if s1483 then s1514 else s1513 s1516 :: SBool = s7 ^ s250 s1517 :: SBool = if s1035 then s1516 else s250 s1518 :: SBool = s493 ^ s1517 s1519 :: SBool = if s1067 then s1518 else s1517 s1520 :: SBool = s463 ^ s1519 s1521 :: SBool = if s1099 then s1520 else s1519 s1522 :: SBool = s435 ^ s1521 s1523 :: SBool = if s1131 then s1522 else s1521 s1524 :: SBool = s409 ^ s1523 s1525 :: SBool = if s1163 then s1524 else s1523 s1526 :: SBool = s385 ^ s1525 s1527 :: SBool = if s1195 then s1526 else s1525 s1528 :: SBool = s363 ^ s1527 s1529 :: SBool = if s1227 then s1528 else s1527 s1530 :: SBool = s343 ^ s1529 s1531 :: SBool = if s1259 then s1530 else s1529 s1532 :: SBool = s325 ^ s1531 s1533 :: SBool = if s1291 then s1532 else s1531 s1534 :: SBool = s309 ^ s1533 s1535 :: SBool = if s1323 then s1534 else s1533 s1536 :: SBool = s295 ^ s1535 s1537 :: SBool = if s1355 then s1536 else s1535 s1538 :: SBool = s283 ^ s1537 s1539 :: SBool = if s1387 then s1538 else s1537 s1540 :: SBool = s273 ^ s1539 s1541 :: SBool = if s1419 then s1540 else s1539 s1542 :: SBool = s265 ^ s1541 s1543 :: SBool = if s1451 then s1542 else s1541 s1544 :: SBool = s259 ^ s1543 s1545 :: SBool = if s1483 then s1544 else s1543 s1546 :: SBool = s255 ^ s1545 s1547 :: SBool = if s1515 then s1546 else s1545 s1548 :: SBool = if s1067 then s7 else s_2 s1549 :: SBool = s493 ^ s1548 s1550 :: SBool = if s1099 then s1549 else s1548 s1551 :: SBool = s463 ^ s1550 s1552 :: SBool = if s1131 then s1551 else s1550 s1553 :: SBool = s435 ^ s1552 s1554 :: SBool = if s1163 then s1553 else s1552 s1555 :: SBool = s409 ^ s1554 s1556 :: SBool = if s1195 then s1555 else s1554 s1557 :: SBool = s385 ^ s1556 s1558 :: SBool = if s1227 then s1557 else s1556 s1559 :: SBool = s363 ^ s1558 s1560 :: SBool = if s1259 then s1559 else s1558 s1561 :: SBool = s343 ^ s1560 s1562 :: SBool = if s1291 then s1561 else s1560 s1563 :: SBool = s325 ^ s1562 s1564 :: SBool = if s1323 then s1563 else s1562 s1565 :: SBool = s309 ^ s1564 s1566 :: SBool = if s1355 then s1565 else s1564 s1567 :: SBool = s295 ^ s1566 s1568 :: SBool = if s1387 then s1567 else s1566 s1569 :: SBool = s283 ^ s1568 s1570 :: SBool = if s1419 then s1569 else s1568 s1571 :: SBool = s273 ^ s1570 s1572 :: SBool = if s1451 then s1571 else s1570 s1573 :: SBool = s265 ^ s1572 s1574 :: SBool = if s1483 then s1573 else s1572 s1575 :: SBool = s259 ^ s1574 s1576 :: SBool = if s1515 then s1575 else s1574 s1577 :: SBool = s255 ^ s1576 s1578 :: SBool = if s1547 then s1577 else s1576 s1579 :: SBool = s22 ^ s255 s1580 :: SBool = if s16 then s1579 else s22 s1581 :: SBool = s27 ^ s259 s1582 :: SBool = if s16 then s1581 else s27 s1583 :: SBool = s255 ^ s1582 s1584 :: SBool = if s1580 then s1583 else s1582 s1585 :: SBool = s32 ^ s265 s1586 :: SBool = if s16 then s1585 else s32 s1587 :: SBool = s259 ^ s1586 s1588 :: SBool = if s1580 then s1587 else s1586 s1589 :: SBool = s255 ^ s1588 s1590 :: SBool = if s1584 then s1589 else s1588 s1591 :: SBool = s37 ^ s273 s1592 :: SBool = if s16 then s1591 else s37 s1593 :: SBool = s265 ^ s1592 s1594 :: SBool = if s1580 then s1593 else s1592 s1595 :: SBool = s259 ^ s1594 s1596 :: SBool = if s1584 then s1595 else s1594 s1597 :: SBool = s255 ^ s1596 s1598 :: SBool = if s1590 then s1597 else s1596 s1599 :: SBool = s42 ^ s283 s1600 :: SBool = if s16 then s1599 else s42 s1601 :: SBool = s273 ^ s1600 s1602 :: SBool = if s1580 then s1601 else s1600 s1603 :: SBool = s265 ^ s1602 s1604 :: SBool = if s1584 then s1603 else s1602 s1605 :: SBool = s259 ^ s1604 s1606 :: SBool = if s1590 then s1605 else s1604 s1607 :: SBool = s255 ^ s1606 s1608 :: SBool = if s1598 then s1607 else s1606 s1609 :: SBool = s47 ^ s295 s1610 :: SBool = if s16 then s1609 else s47 s1611 :: SBool = s283 ^ s1610 s1612 :: SBool = if s1580 then s1611 else s1610 s1613 :: SBool = s273 ^ s1612 s1614 :: SBool = if s1584 then s1613 else s1612 s1615 :: SBool = s265 ^ s1614 s1616 :: SBool = if s1590 then s1615 else s1614 s1617 :: SBool = s259 ^ s1616 s1618 :: SBool = if s1598 then s1617 else s1616 s1619 :: SBool = s255 ^ s1618 s1620 :: SBool = if s1608 then s1619 else s1618 s1621 :: SBool = s52 ^ s309 s1622 :: SBool = if s16 then s1621 else s52 s1623 :: SBool = s295 ^ s1622 s1624 :: SBool = if s1580 then s1623 else s1622 s1625 :: SBool = s283 ^ s1624 s1626 :: SBool = if s1584 then s1625 else s1624 s1627 :: SBool = s273 ^ s1626 s1628 :: SBool = if s1590 then s1627 else s1626 s1629 :: SBool = s265 ^ s1628 s1630 :: SBool = if s1598 then s1629 else s1628 s1631 :: SBool = s259 ^ s1630 s1632 :: SBool = if s1608 then s1631 else s1630 s1633 :: SBool = s255 ^ s1632 s1634 :: SBool = if s1620 then s1633 else s1632 s1635 :: SBool = s57 ^ s325 s1636 :: SBool = if s16 then s1635 else s57 s1637 :: SBool = s309 ^ s1636 s1638 :: SBool = if s1580 then s1637 else s1636 s1639 :: SBool = s295 ^ s1638 s1640 :: SBool = if s1584 then s1639 else s1638 s1641 :: SBool = s283 ^ s1640 s1642 :: SBool = if s1590 then s1641 else s1640 s1643 :: SBool = s273 ^ s1642 s1644 :: SBool = if s1598 then s1643 else s1642 s1645 :: SBool = s265 ^ s1644 s1646 :: SBool = if s1608 then s1645 else s1644 s1647 :: SBool = s259 ^ s1646 s1648 :: SBool = if s1620 then s1647 else s1646 s1649 :: SBool = s255 ^ s1648 s1650 :: SBool = if s1634 then s1649 else s1648 s1651 :: SBool = s62 ^ s343 s1652 :: SBool = if s16 then s1651 else s62 s1653 :: SBool = s325 ^ s1652 s1654 :: SBool = if s1580 then s1653 else s1652 s1655 :: SBool = s309 ^ s1654 s1656 :: SBool = if s1584 then s1655 else s1654 s1657 :: SBool = s295 ^ s1656 s1658 :: SBool = if s1590 then s1657 else s1656 s1659 :: SBool = s283 ^ s1658 s1660 :: SBool = if s1598 then s1659 else s1658 s1661 :: SBool = s273 ^ s1660 s1662 :: SBool = if s1608 then s1661 else s1660 s1663 :: SBool = s265 ^ s1662 s1664 :: SBool = if s1620 then s1663 else s1662 s1665 :: SBool = s259 ^ s1664 s1666 :: SBool = if s1634 then s1665 else s1664 s1667 :: SBool = s255 ^ s1666 s1668 :: SBool = if s1650 then s1667 else s1666 s1669 :: SBool = s67 ^ s363 s1670 :: SBool = if s16 then s1669 else s67 s1671 :: SBool = s343 ^ s1670 s1672 :: SBool = if s1580 then s1671 else s1670 s1673 :: SBool = s325 ^ s1672 s1674 :: SBool = if s1584 then s1673 else s1672 s1675 :: SBool = s309 ^ s1674 s1676 :: SBool = if s1590 then s1675 else s1674 s1677 :: SBool = s295 ^ s1676 s1678 :: SBool = if s1598 then s1677 else s1676 s1679 :: SBool = s283 ^ s1678 s1680 :: SBool = if s1608 then s1679 else s1678 s1681 :: SBool = s273 ^ s1680 s1682 :: SBool = if s1620 then s1681 else s1680 s1683 :: SBool = s265 ^ s1682 s1684 :: SBool = if s1634 then s1683 else s1682 s1685 :: SBool = s259 ^ s1684 s1686 :: SBool = if s1650 then s1685 else s1684 s1687 :: SBool = s255 ^ s1686 s1688 :: SBool = if s1668 then s1687 else s1686 s1689 :: SBool = s72 ^ s385 s1690 :: SBool = if s16 then s1689 else s72 s1691 :: SBool = s363 ^ s1690 s1692 :: SBool = if s1580 then s1691 else s1690 s1693 :: SBool = s343 ^ s1692 s1694 :: SBool = if s1584 then s1693 else s1692 s1695 :: SBool = s325 ^ s1694 s1696 :: SBool = if s1590 then s1695 else s1694 s1697 :: SBool = s309 ^ s1696 s1698 :: SBool = if s1598 then s1697 else s1696 s1699 :: SBool = s295 ^ s1698 s1700 :: SBool = if s1608 then s1699 else s1698 s1701 :: SBool = s283 ^ s1700 s1702 :: SBool = if s1620 then s1701 else s1700 s1703 :: SBool = s273 ^ s1702 s1704 :: SBool = if s1634 then s1703 else s1702 s1705 :: SBool = s265 ^ s1704 s1706 :: SBool = if s1650 then s1705 else s1704 s1707 :: SBool = s259 ^ s1706 s1708 :: SBool = if s1668 then s1707 else s1706 s1709 :: SBool = s255 ^ s1708 s1710 :: SBool = if s1688 then s1709 else s1708 s1711 :: SBool = s77 ^ s409 s1712 :: SBool = if s16 then s1711 else s77 s1713 :: SBool = s385 ^ s1712 s1714 :: SBool = if s1580 then s1713 else s1712 s1715 :: SBool = s363 ^ s1714 s1716 :: SBool = if s1584 then s1715 else s1714 s1717 :: SBool = s343 ^ s1716 s1718 :: SBool = if s1590 then s1717 else s1716 s1719 :: SBool = s325 ^ s1718 s1720 :: SBool = if s1598 then s1719 else s1718 s1721 :: SBool = s309 ^ s1720 s1722 :: SBool = if s1608 then s1721 else s1720 s1723 :: SBool = s295 ^ s1722 s1724 :: SBool = if s1620 then s1723 else s1722 s1725 :: SBool = s283 ^ s1724 s1726 :: SBool = if s1634 then s1725 else s1724 s1727 :: SBool = s273 ^ s1726 s1728 :: SBool = if s1650 then s1727 else s1726 s1729 :: SBool = s265 ^ s1728 s1730 :: SBool = if s1668 then s1729 else s1728 s1731 :: SBool = s259 ^ s1730 s1732 :: SBool = if s1688 then s1731 else s1730 s1733 :: SBool = s255 ^ s1732 s1734 :: SBool = if s1710 then s1733 else s1732 s1735 :: SBool = s82 ^ s435 s1736 :: SBool = if s16 then s1735 else s82 s1737 :: SBool = s409 ^ s1736 s1738 :: SBool = if s1580 then s1737 else s1736 s1739 :: SBool = s385 ^ s1738 s1740 :: SBool = if s1584 then s1739 else s1738 s1741 :: SBool = s363 ^ s1740 s1742 :: SBool = if s1590 then s1741 else s1740 s1743 :: SBool = s343 ^ s1742 s1744 :: SBool = if s1598 then s1743 else s1742 s1745 :: SBool = s325 ^ s1744 s1746 :: SBool = if s1608 then s1745 else s1744 s1747 :: SBool = s309 ^ s1746 s1748 :: SBool = if s1620 then s1747 else s1746 s1749 :: SBool = s295 ^ s1748 s1750 :: SBool = if s1634 then s1749 else s1748 s1751 :: SBool = s283 ^ s1750 s1752 :: SBool = if s1650 then s1751 else s1750 s1753 :: SBool = s273 ^ s1752 s1754 :: SBool = if s1668 then s1753 else s1752 s1755 :: SBool = s265 ^ s1754 s1756 :: SBool = if s1688 then s1755 else s1754 s1757 :: SBool = s259 ^ s1756 s1758 :: SBool = if s1710 then s1757 else s1756 s1759 :: SBool = s255 ^ s1758 s1760 :: SBool = if s1734 then s1759 else s1758 s1761 :: SBool = s87 ^ s463 s1762 :: SBool = if s16 then s1761 else s87 s1763 :: SBool = s435 ^ s1762 s1764 :: SBool = if s1580 then s1763 else s1762 s1765 :: SBool = s409 ^ s1764 s1766 :: SBool = if s1584 then s1765 else s1764 s1767 :: SBool = s385 ^ s1766 s1768 :: SBool = if s1590 then s1767 else s1766 s1769 :: SBool = s363 ^ s1768 s1770 :: SBool = if s1598 then s1769 else s1768 s1771 :: SBool = s343 ^ s1770 s1772 :: SBool = if s1608 then s1771 else s1770 s1773 :: SBool = s325 ^ s1772 s1774 :: SBool = if s1620 then s1773 else s1772 s1775 :: SBool = s309 ^ s1774 s1776 :: SBool = if s1634 then s1775 else s1774 s1777 :: SBool = s295 ^ s1776 s1778 :: SBool = if s1650 then s1777 else s1776 s1779 :: SBool = s283 ^ s1778 s1780 :: SBool = if s1668 then s1779 else s1778 s1781 :: SBool = s273 ^ s1780 s1782 :: SBool = if s1688 then s1781 else s1780 s1783 :: SBool = s265 ^ s1782 s1784 :: SBool = if s1710 then s1783 else s1782 s1785 :: SBool = s259 ^ s1784 s1786 :: SBool = if s1734 then s1785 else s1784 s1787 :: SBool = s255 ^ s1786 s1788 :: SBool = if s1760 then s1787 else s1786 s1789 :: SBool = s92 ^ s493 s1790 :: SBool = if s16 then s1789 else s92 s1791 :: SBool = s463 ^ s1790 s1792 :: SBool = if s1580 then s1791 else s1790 s1793 :: SBool = s435 ^ s1792 s1794 :: SBool = if s1584 then s1793 else s1792 s1795 :: SBool = s409 ^ s1794 s1796 :: SBool = if s1590 then s1795 else s1794 s1797 :: SBool = s385 ^ s1796 s1798 :: SBool = if s1598 then s1797 else s1796 s1799 :: SBool = s363 ^ s1798 s1800 :: SBool = if s1608 then s1799 else s1798 s1801 :: SBool = s343 ^ s1800 s1802 :: SBool = if s1620 then s1801 else s1800 s1803 :: SBool = s325 ^ s1802 s1804 :: SBool = if s1634 then s1803 else s1802 s1805 :: SBool = s309 ^ s1804 s1806 :: SBool = if s1650 then s1805 else s1804 s1807 :: SBool = s295 ^ s1806 s1808 :: SBool = if s1668 then s1807 else s1806 s1809 :: SBool = s283 ^ s1808 s1810 :: SBool = if s1688 then s1809 else s1808 s1811 :: SBool = s273 ^ s1810 s1812 :: SBool = if s1710 then s1811 else s1810 s1813 :: SBool = s265 ^ s1812 s1814 :: SBool = if s1734 then s1813 else s1812 s1815 :: SBool = s259 ^ s1814 s1816 :: SBool = if s1760 then s1815 else s1814 s1817 :: SBool = s255 ^ s1816 s1818 :: SBool = if s1788 then s1817 else s1816 s1819 :: SBool = s7 ^ s97 s1820 :: SBool = if s16 then s1819 else s97 s1821 :: SBool = s493 ^ s1820 s1822 :: SBool = if s1580 then s1821 else s1820 s1823 :: SBool = s463 ^ s1822 s1824 :: SBool = if s1584 then s1823 else s1822 s1825 :: SBool = s435 ^ s1824 s1826 :: SBool = if s1590 then s1825 else s1824 s1827 :: SBool = s409 ^ s1826 s1828 :: SBool = if s1598 then s1827 else s1826 s1829 :: SBool = s385 ^ s1828 s1830 :: SBool = if s1608 then s1829 else s1828 s1831 :: SBool = s363 ^ s1830 s1832 :: SBool = if s1620 then s1831 else s1830 s1833 :: SBool = s343 ^ s1832 s1834 :: SBool = if s1634 then s1833 else s1832 s1835 :: SBool = s325 ^ s1834 s1836 :: SBool = if s1650 then s1835 else s1834 s1837 :: SBool = s309 ^ s1836 s1838 :: SBool = if s1668 then s1837 else s1836 s1839 :: SBool = s295 ^ s1838 s1840 :: SBool = if s1688 then s1839 else s1838 s1841 :: SBool = s283 ^ s1840 s1842 :: SBool = if s1710 then s1841 else s1840 s1843 :: SBool = s273 ^ s1842 s1844 :: SBool = if s1734 then s1843 else s1842 s1845 :: SBool = s265 ^ s1844 s1846 :: SBool = if s1760 then s1845 else s1844 s1847 :: SBool = s259 ^ s1846 s1848 :: SBool = if s1788 then s1847 else s1846 s1849 :: SBool = s255 ^ s1848 s1850 :: SBool = if s1818 then s1849 else s1848 s1851 :: SBool = s7 ^ s102 s1852 :: SBool = if s1580 then s1851 else s102 s1853 :: SBool = s493 ^ s1852 s1854 :: SBool = if s1584 then s1853 else s1852 s1855 :: SBool = s463 ^ s1854 s1856 :: SBool = if s1590 then s1855 else s1854 s1857 :: SBool = s435 ^ s1856 s1858 :: SBool = if s1598 then s1857 else s1856 s1859 :: SBool = s409 ^ s1858 s1860 :: SBool = if s1608 then s1859 else s1858 s1861 :: SBool = s385 ^ s1860 s1862 :: SBool = if s1620 then s1861 else s1860 s1863 :: SBool = s363 ^ s1862 s1864 :: SBool = if s1634 then s1863 else s1862 s1865 :: SBool = s343 ^ s1864 s1866 :: SBool = if s1650 then s1865 else s1864 s1867 :: SBool = s325 ^ s1866 s1868 :: SBool = if s1668 then s1867 else s1866 s1869 :: SBool = s309 ^ s1868 s1870 :: SBool = if s1688 then s1869 else s1868 s1871 :: SBool = s295 ^ s1870 s1872 :: SBool = if s1710 then s1871 else s1870 s1873 :: SBool = s283 ^ s1872 s1874 :: SBool = if s1734 then s1873 else s1872 s1875 :: SBool = s273 ^ s1874 s1876 :: SBool = if s1760 then s1875 else s1874 s1877 :: SBool = s265 ^ s1876 s1878 :: SBool = if s1788 then s1877 else s1876 s1879 :: SBool = s259 ^ s1878 s1880 :: SBool = if s1818 then s1879 else s1878 s1881 :: SBool = s255 ^ s1880 s1882 :: SBool = if s1850 then s1881 else s1880 s1883 :: SBool = s7 ^ s107 s1884 :: SBool = if s1584 then s1883 else s107 s1885 :: SBool = s493 ^ s1884 s1886 :: SBool = if s1590 then s1885 else s1884 s1887 :: SBool = s463 ^ s1886 s1888 :: SBool = if s1598 then s1887 else s1886 s1889 :: SBool = s435 ^ s1888 s1890 :: SBool = if s1608 then s1889 else s1888 s1891 :: SBool = s409 ^ s1890 s1892 :: SBool = if s1620 then s1891 else s1890 s1893 :: SBool = s385 ^ s1892 s1894 :: SBool = if s1634 then s1893 else s1892 s1895 :: SBool = s363 ^ s1894 s1896 :: SBool = if s1650 then s1895 else s1894 s1897 :: SBool = s343 ^ s1896 s1898 :: SBool = if s1668 then s1897 else s1896 s1899 :: SBool = s325 ^ s1898 s1900 :: SBool = if s1688 then s1899 else s1898 s1901 :: SBool = s309 ^ s1900 s1902 :: SBool = if s1710 then s1901 else s1900 s1903 :: SBool = s295 ^ s1902 s1904 :: SBool = if s1734 then s1903 else s1902 s1905 :: SBool = s283 ^ s1904 s1906 :: SBool = if s1760 then s1905 else s1904 s1907 :: SBool = s273 ^ s1906 s1908 :: SBool = if s1788 then s1907 else s1906 s1909 :: SBool = s265 ^ s1908 s1910 :: SBool = if s1818 then s1909 else s1908 s1911 :: SBool = s259 ^ s1910 s1912 :: SBool = if s1850 then s1911 else s1910 s1913 :: SBool = s255 ^ s1912 s1914 :: SBool = if s1882 then s1913 else s1912 s1915 :: SBool = s7 ^ s112 s1916 :: SBool = if s1590 then s1915 else s112 s1917 :: SBool = s493 ^ s1916 s1918 :: SBool = if s1598 then s1917 else s1916 s1919 :: SBool = s463 ^ s1918 s1920 :: SBool = if s1608 then s1919 else s1918 s1921 :: SBool = s435 ^ s1920 s1922 :: SBool = if s1620 then s1921 else s1920 s1923 :: SBool = s409 ^ s1922 s1924 :: SBool = if s1634 then s1923 else s1922 s1925 :: SBool = s385 ^ s1924 s1926 :: SBool = if s1650 then s1925 else s1924 s1927 :: SBool = s363 ^ s1926 s1928 :: SBool = if s1668 then s1927 else s1926 s1929 :: SBool = s343 ^ s1928 s1930 :: SBool = if s1688 then s1929 else s1928 s1931 :: SBool = s325 ^ s1930 s1932 :: SBool = if s1710 then s1931 else s1930 s1933 :: SBool = s309 ^ s1932 s1934 :: SBool = if s1734 then s1933 else s1932 s1935 :: SBool = s295 ^ s1934 s1936 :: SBool = if s1760 then s1935 else s1934 s1937 :: SBool = s283 ^ s1936 s1938 :: SBool = if s1788 then s1937 else s1936 s1939 :: SBool = s273 ^ s1938 s1940 :: SBool = if s1818 then s1939 else s1938 s1941 :: SBool = s265 ^ s1940 s1942 :: SBool = if s1850 then s1941 else s1940 s1943 :: SBool = s259 ^ s1942 s1944 :: SBool = if s1882 then s1943 else s1942 s1945 :: SBool = s255 ^ s1944 s1946 :: SBool = if s1914 then s1945 else s1944 s1947 :: SBool = s7 ^ s117 s1948 :: SBool = if s1598 then s1947 else s117 s1949 :: SBool = s493 ^ s1948 s1950 :: SBool = if s1608 then s1949 else s1948 s1951 :: SBool = s463 ^ s1950 s1952 :: SBool = if s1620 then s1951 else s1950 s1953 :: SBool = s435 ^ s1952 s1954 :: SBool = if s1634 then s1953 else s1952 s1955 :: SBool = s409 ^ s1954 s1956 :: SBool = if s1650 then s1955 else s1954 s1957 :: SBool = s385 ^ s1956 s1958 :: SBool = if s1668 then s1957 else s1956 s1959 :: SBool = s363 ^ s1958 s1960 :: SBool = if s1688 then s1959 else s1958 s1961 :: SBool = s343 ^ s1960 s1962 :: SBool = if s1710 then s1961 else s1960 s1963 :: SBool = s325 ^ s1962 s1964 :: SBool = if s1734 then s1963 else s1962 s1965 :: SBool = s309 ^ s1964 s1966 :: SBool = if s1760 then s1965 else s1964 s1967 :: SBool = s295 ^ s1966 s1968 :: SBool = if s1788 then s1967 else s1966 s1969 :: SBool = s283 ^ s1968 s1970 :: SBool = if s1818 then s1969 else s1968 s1971 :: SBool = s273 ^ s1970 s1972 :: SBool = if s1850 then s1971 else s1970 s1973 :: SBool = s265 ^ s1972 s1974 :: SBool = if s1882 then s1973 else s1972 s1975 :: SBool = s259 ^ s1974 s1976 :: SBool = if s1914 then s1975 else s1974 s1977 :: SBool = s255 ^ s1976 s1978 :: SBool = if s1946 then s1977 else s1976 s1979 :: SBool = s7 ^ s122 s1980 :: SBool = if s1608 then s1979 else s122 s1981 :: SBool = s493 ^ s1980 s1982 :: SBool = if s1620 then s1981 else s1980 s1983 :: SBool = s463 ^ s1982 s1984 :: SBool = if s1634 then s1983 else s1982 s1985 :: SBool = s435 ^ s1984 s1986 :: SBool = if s1650 then s1985 else s1984 s1987 :: SBool = s409 ^ s1986 s1988 :: SBool = if s1668 then s1987 else s1986 s1989 :: SBool = s385 ^ s1988 s1990 :: SBool = if s1688 then s1989 else s1988 s1991 :: SBool = s363 ^ s1990 s1992 :: SBool = if s1710 then s1991 else s1990 s1993 :: SBool = s343 ^ s1992 s1994 :: SBool = if s1734 then s1993 else s1992 s1995 :: SBool = s325 ^ s1994 s1996 :: SBool = if s1760 then s1995 else s1994 s1997 :: SBool = s309 ^ s1996 s1998 :: SBool = if s1788 then s1997 else s1996 s1999 :: SBool = s295 ^ s1998 s2000 :: SBool = if s1818 then s1999 else s1998 s2001 :: SBool = s283 ^ s2000 s2002 :: SBool = if s1850 then s2001 else s2000 s2003 :: SBool = s273 ^ s2002 s2004 :: SBool = if s1882 then s2003 else s2002 s2005 :: SBool = s265 ^ s2004 s2006 :: SBool = if s1914 then s2005 else s2004 s2007 :: SBool = s259 ^ s2006 s2008 :: SBool = if s1946 then s2007 else s2006 s2009 :: SBool = s255 ^ s2008 s2010 :: SBool = if s1978 then s2009 else s2008 s2011 :: SBool = s7 ^ s127 s2012 :: SBool = if s1620 then s2011 else s127 s2013 :: SBool = s493 ^ s2012 s2014 :: SBool = if s1634 then s2013 else s2012 s2015 :: SBool = s463 ^ s2014 s2016 :: SBool = if s1650 then s2015 else s2014 s2017 :: SBool = s435 ^ s2016 s2018 :: SBool = if s1668 then s2017 else s2016 s2019 :: SBool = s409 ^ s2018 s2020 :: SBool = if s1688 then s2019 else s2018 s2021 :: SBool = s385 ^ s2020 s2022 :: SBool = if s1710 then s2021 else s2020 s2023 :: SBool = s363 ^ s2022 s2024 :: SBool = if s1734 then s2023 else s2022 s2025 :: SBool = s343 ^ s2024 s2026 :: SBool = if s1760 then s2025 else s2024 s2027 :: SBool = s325 ^ s2026 s2028 :: SBool = if s1788 then s2027 else s2026 s2029 :: SBool = s309 ^ s2028 s2030 :: SBool = if s1818 then s2029 else s2028 s2031 :: SBool = s295 ^ s2030 s2032 :: SBool = if s1850 then s2031 else s2030 s2033 :: SBool = s283 ^ s2032 s2034 :: SBool = if s1882 then s2033 else s2032 s2035 :: SBool = s273 ^ s2034 s2036 :: SBool = if s1914 then s2035 else s2034 s2037 :: SBool = s265 ^ s2036 s2038 :: SBool = if s1946 then s2037 else s2036 s2039 :: SBool = s259 ^ s2038 s2040 :: SBool = if s1978 then s2039 else s2038 s2041 :: SBool = s255 ^ s2040 s2042 :: SBool = if s2010 then s2041 else s2040 s2043 :: SBool = s7 ^ s132 s2044 :: SBool = if s1634 then s2043 else s132 s2045 :: SBool = s493 ^ s2044 s2046 :: SBool = if s1650 then s2045 else s2044 s2047 :: SBool = s463 ^ s2046 s2048 :: SBool = if s1668 then s2047 else s2046 s2049 :: SBool = s435 ^ s2048 s2050 :: SBool = if s1688 then s2049 else s2048 s2051 :: SBool = s409 ^ s2050 s2052 :: SBool = if s1710 then s2051 else s2050 s2053 :: SBool = s385 ^ s2052 s2054 :: SBool = if s1734 then s2053 else s2052 s2055 :: SBool = s363 ^ s2054 s2056 :: SBool = if s1760 then s2055 else s2054 s2057 :: SBool = s343 ^ s2056 s2058 :: SBool = if s1788 then s2057 else s2056 s2059 :: SBool = s325 ^ s2058 s2060 :: SBool = if s1818 then s2059 else s2058 s2061 :: SBool = s309 ^ s2060 s2062 :: SBool = if s1850 then s2061 else s2060 s2063 :: SBool = s295 ^ s2062 s2064 :: SBool = if s1882 then s2063 else s2062 s2065 :: SBool = s283 ^ s2064 s2066 :: SBool = if s1914 then s2065 else s2064 s2067 :: SBool = s273 ^ s2066 s2068 :: SBool = if s1946 then s2067 else s2066 s2069 :: SBool = s265 ^ s2068 s2070 :: SBool = if s1978 then s2069 else s2068 s2071 :: SBool = s259 ^ s2070 s2072 :: SBool = if s2010 then s2071 else s2070 s2073 :: SBool = s255 ^ s2072 s2074 :: SBool = if s2042 then s2073 else s2072 s2075 :: SBool = s7 ^ s137 s2076 :: SBool = if s1650 then s2075 else s137 s2077 :: SBool = s493 ^ s2076 s2078 :: SBool = if s1668 then s2077 else s2076 s2079 :: SBool = s463 ^ s2078 s2080 :: SBool = if s1688 then s2079 else s2078 s2081 :: SBool = s435 ^ s2080 s2082 :: SBool = if s1710 then s2081 else s2080 s2083 :: SBool = s409 ^ s2082 s2084 :: SBool = if s1734 then s2083 else s2082 s2085 :: SBool = s385 ^ s2084 s2086 :: SBool = if s1760 then s2085 else s2084 s2087 :: SBool = s363 ^ s2086 s2088 :: SBool = if s1788 then s2087 else s2086 s2089 :: SBool = s343 ^ s2088 s2090 :: SBool = if s1818 then s2089 else s2088 s2091 :: SBool = s325 ^ s2090 s2092 :: SBool = if s1850 then s2091 else s2090 s2093 :: SBool = s309 ^ s2092 s2094 :: SBool = if s1882 then s2093 else s2092 s2095 :: SBool = s295 ^ s2094 s2096 :: SBool = if s1914 then s2095 else s2094 s2097 :: SBool = s283 ^ s2096 s2098 :: SBool = if s1946 then s2097 else s2096 s2099 :: SBool = s273 ^ s2098 s2100 :: SBool = if s1978 then s2099 else s2098 s2101 :: SBool = s265 ^ s2100 s2102 :: SBool = if s2010 then s2101 else s2100 s2103 :: SBool = s259 ^ s2102 s2104 :: SBool = if s2042 then s2103 else s2102 s2105 :: SBool = s255 ^ s2104 s2106 :: SBool = if s2074 then s2105 else s2104 s2107 :: SBool = s7 ^ s142 s2108 :: SBool = if s1668 then s2107 else s142 s2109 :: SBool = s493 ^ s2108 s2110 :: SBool = if s1688 then s2109 else s2108 s2111 :: SBool = s463 ^ s2110 s2112 :: SBool = if s1710 then s2111 else s2110 s2113 :: SBool = s435 ^ s2112 s2114 :: SBool = if s1734 then s2113 else s2112 s2115 :: SBool = s409 ^ s2114 s2116 :: SBool = if s1760 then s2115 else s2114 s2117 :: SBool = s385 ^ s2116 s2118 :: SBool = if s1788 then s2117 else s2116 s2119 :: SBool = s363 ^ s2118 s2120 :: SBool = if s1818 then s2119 else s2118 s2121 :: SBool = s343 ^ s2120 s2122 :: SBool = if s1850 then s2121 else s2120 s2123 :: SBool = s325 ^ s2122 s2124 :: SBool = if s1882 then s2123 else s2122 s2125 :: SBool = s309 ^ s2124 s2126 :: SBool = if s1914 then s2125 else s2124 s2127 :: SBool = s295 ^ s2126 s2128 :: SBool = if s1946 then s2127 else s2126 s2129 :: SBool = s283 ^ s2128 s2130 :: SBool = if s1978 then s2129 else s2128 s2131 :: SBool = s273 ^ s2130 s2132 :: SBool = if s2010 then s2131 else s2130 s2133 :: SBool = s265 ^ s2132 s2134 :: SBool = if s2042 then s2133 else s2132 s2135 :: SBool = s259 ^ s2134 s2136 :: SBool = if s2074 then s2135 else s2134 s2137 :: SBool = s255 ^ s2136 s2138 :: SBool = if s2106 then s2137 else s2136 s2139 :: SBool = s7 ^ s147 s2140 :: SBool = if s1688 then s2139 else s147 s2141 :: SBool = s493 ^ s2140 s2142 :: SBool = if s1710 then s2141 else s2140 s2143 :: SBool = s463 ^ s2142 s2144 :: SBool = if s1734 then s2143 else s2142 s2145 :: SBool = s435 ^ s2144 s2146 :: SBool = if s1760 then s2145 else s2144 s2147 :: SBool = s409 ^ s2146 s2148 :: SBool = if s1788 then s2147 else s2146 s2149 :: SBool = s385 ^ s2148 s2150 :: SBool = if s1818 then s2149 else s2148 s2151 :: SBool = s363 ^ s2150 s2152 :: SBool = if s1850 then s2151 else s2150 s2153 :: SBool = s343 ^ s2152 s2154 :: SBool = if s1882 then s2153 else s2152 s2155 :: SBool = s325 ^ s2154 s2156 :: SBool = if s1914 then s2155 else s2154 s2157 :: SBool = s309 ^ s2156 s2158 :: SBool = if s1946 then s2157 else s2156 s2159 :: SBool = s295 ^ s2158 s2160 :: SBool = if s1978 then s2159 else s2158 s2161 :: SBool = s283 ^ s2160 s2162 :: SBool = if s2010 then s2161 else s2160 s2163 :: SBool = s273 ^ s2162 s2164 :: SBool = if s2042 then s2163 else s2162 s2165 :: SBool = s265 ^ s2164 s2166 :: SBool = if s2074 then s2165 else s2164 s2167 :: SBool = s259 ^ s2166 s2168 :: SBool = if s2106 then s2167 else s2166 s2169 :: SBool = s255 ^ s2168 s2170 :: SBool = if s2138 then s2169 else s2168 s2171 :: SBool = s7 ^ s152 s2172 :: SBool = if s1710 then s2171 else s152 s2173 :: SBool = s493 ^ s2172 s2174 :: SBool = if s1734 then s2173 else s2172 s2175 :: SBool = s463 ^ s2174 s2176 :: SBool = if s1760 then s2175 else s2174 s2177 :: SBool = s435 ^ s2176 s2178 :: SBool = if s1788 then s2177 else s2176 s2179 :: SBool = s409 ^ s2178 s2180 :: SBool = if s1818 then s2179 else s2178 s2181 :: SBool = s385 ^ s2180 s2182 :: SBool = if s1850 then s2181 else s2180 s2183 :: SBool = s363 ^ s2182 s2184 :: SBool = if s1882 then s2183 else s2182 s2185 :: SBool = s343 ^ s2184 s2186 :: SBool = if s1914 then s2185 else s2184 s2187 :: SBool = s325 ^ s2186 s2188 :: SBool = if s1946 then s2187 else s2186 s2189 :: SBool = s309 ^ s2188 s2190 :: SBool = if s1978 then s2189 else s2188 s2191 :: SBool = s295 ^ s2190 s2192 :: SBool = if s2010 then s2191 else s2190 s2193 :: SBool = s283 ^ s2192 s2194 :: SBool = if s2042 then s2193 else s2192 s2195 :: SBool = s273 ^ s2194 s2196 :: SBool = if s2074 then s2195 else s2194 s2197 :: SBool = s265 ^ s2196 s2198 :: SBool = if s2106 then s2197 else s2196 s2199 :: SBool = s259 ^ s2198 s2200 :: SBool = if s2138 then s2199 else s2198 s2201 :: SBool = s255 ^ s2200 s2202 :: SBool = if s2170 then s2201 else s2200 s2203 :: SBool = s7 ^ s157 s2204 :: SBool = if s1734 then s2203 else s157 s2205 :: SBool = s493 ^ s2204 s2206 :: SBool = if s1760 then s2205 else s2204 s2207 :: SBool = s463 ^ s2206 s2208 :: SBool = if s1788 then s2207 else s2206 s2209 :: SBool = s435 ^ s2208 s2210 :: SBool = if s1818 then s2209 else s2208 s2211 :: SBool = s409 ^ s2210 s2212 :: SBool = if s1850 then s2211 else s2210 s2213 :: SBool = s385 ^ s2212 s2214 :: SBool = if s1882 then s2213 else s2212 s2215 :: SBool = s363 ^ s2214 s2216 :: SBool = if s1914 then s2215 else s2214 s2217 :: SBool = s343 ^ s2216 s2218 :: SBool = if s1946 then s2217 else s2216 s2219 :: SBool = s325 ^ s2218 s2220 :: SBool = if s1978 then s2219 else s2218 s2221 :: SBool = s309 ^ s2220 s2222 :: SBool = if s2010 then s2221 else s2220 s2223 :: SBool = s295 ^ s2222 s2224 :: SBool = if s2042 then s2223 else s2222 s2225 :: SBool = s283 ^ s2224 s2226 :: SBool = if s2074 then s2225 else s2224 s2227 :: SBool = s273 ^ s2226 s2228 :: SBool = if s2106 then s2227 else s2226 s2229 :: SBool = s265 ^ s2228 s2230 :: SBool = if s2138 then s2229 else s2228 s2231 :: SBool = s259 ^ s2230 s2232 :: SBool = if s2170 then s2231 else s2230 s2233 :: SBool = s255 ^ s2232 s2234 :: SBool = if s2202 then s2233 else s2232 s2235 :: SBool = s7 ^ s162 s2236 :: SBool = if s1760 then s2235 else s162 s2237 :: SBool = s493 ^ s2236 s2238 :: SBool = if s1788 then s2237 else s2236 s2239 :: SBool = s463 ^ s2238 s2240 :: SBool = if s1818 then s2239 else s2238 s2241 :: SBool = s435 ^ s2240 s2242 :: SBool = if s1850 then s2241 else s2240 s2243 :: SBool = s409 ^ s2242 s2244 :: SBool = if s1882 then s2243 else s2242 s2245 :: SBool = s385 ^ s2244 s2246 :: SBool = if s1914 then s2245 else s2244 s2247 :: SBool = s363 ^ s2246 s2248 :: SBool = if s1946 then s2247 else s2246 s2249 :: SBool = s343 ^ s2248 s2250 :: SBool = if s1978 then s2249 else s2248 s2251 :: SBool = s325 ^ s2250 s2252 :: SBool = if s2010 then s2251 else s2250 s2253 :: SBool = s309 ^ s2252 s2254 :: SBool = if s2042 then s2253 else s2252 s2255 :: SBool = s295 ^ s2254 s2256 :: SBool = if s2074 then s2255 else s2254 s2257 :: SBool = s283 ^ s2256 s2258 :: SBool = if s2106 then s2257 else s2256 s2259 :: SBool = s273 ^ s2258 s2260 :: SBool = if s2138 then s2259 else s2258 s2261 :: SBool = s265 ^ s2260 s2262 :: SBool = if s2170 then s2261 else s2260 s2263 :: SBool = s259 ^ s2262 s2264 :: SBool = if s2202 then s2263 else s2262 s2265 :: SBool = s255 ^ s2264 s2266 :: SBool = if s2234 then s2265 else s2264 s2267 :: SBool = s7 ^ s167 s2268 :: SBool = if s1788 then s2267 else s167 s2269 :: SBool = s493 ^ s2268 s2270 :: SBool = if s1818 then s2269 else s2268 s2271 :: SBool = s463 ^ s2270 s2272 :: SBool = if s1850 then s2271 else s2270 s2273 :: SBool = s435 ^ s2272 s2274 :: SBool = if s1882 then s2273 else s2272 s2275 :: SBool = s409 ^ s2274 s2276 :: SBool = if s1914 then s2275 else s2274 s2277 :: SBool = s385 ^ s2276 s2278 :: SBool = if s1946 then s2277 else s2276 s2279 :: SBool = s363 ^ s2278 s2280 :: SBool = if s1978 then s2279 else s2278 s2281 :: SBool = s343 ^ s2280 s2282 :: SBool = if s2010 then s2281 else s2280 s2283 :: SBool = s325 ^ s2282 s2284 :: SBool = if s2042 then s2283 else s2282 s2285 :: SBool = s309 ^ s2284 s2286 :: SBool = if s2074 then s2285 else s2284 s2287 :: SBool = s295 ^ s2286 s2288 :: SBool = if s2106 then s2287 else s2286 s2289 :: SBool = s283 ^ s2288 s2290 :: SBool = if s2138 then s2289 else s2288 s2291 :: SBool = s273 ^ s2290 s2292 :: SBool = if s2170 then s2291 else s2290 s2293 :: SBool = s265 ^ s2292 s2294 :: SBool = if s2202 then s2293 else s2292 s2295 :: SBool = s259 ^ s2294 s2296 :: SBool = if s2234 then s2295 else s2294 s2297 :: SBool = s255 ^ s2296 s2298 :: SBool = if s2266 then s2297 else s2296 s2299 :: SBool = s7 ^ s172 s2300 :: SBool = if s1818 then s2299 else s172 s2301 :: SBool = s493 ^ s2300 s2302 :: SBool = if s1850 then s2301 else s2300 s2303 :: SBool = s463 ^ s2302 s2304 :: SBool = if s1882 then s2303 else s2302 s2305 :: SBool = s435 ^ s2304 s2306 :: SBool = if s1914 then s2305 else s2304 s2307 :: SBool = s409 ^ s2306 s2308 :: SBool = if s1946 then s2307 else s2306 s2309 :: SBool = s385 ^ s2308 s2310 :: SBool = if s1978 then s2309 else s2308 s2311 :: SBool = s363 ^ s2310 s2312 :: SBool = if s2010 then s2311 else s2310 s2313 :: SBool = s343 ^ s2312 s2314 :: SBool = if s2042 then s2313 else s2312 s2315 :: SBool = s325 ^ s2314 s2316 :: SBool = if s2074 then s2315 else s2314 s2317 :: SBool = s309 ^ s2316 s2318 :: SBool = if s2106 then s2317 else s2316 s2319 :: SBool = s295 ^ s2318 s2320 :: SBool = if s2138 then s2319 else s2318 s2321 :: SBool = s283 ^ s2320 s2322 :: SBool = if s2170 then s2321 else s2320 s2323 :: SBool = s273 ^ s2322 s2324 :: SBool = if s2202 then s2323 else s2322 s2325 :: SBool = s265 ^ s2324 s2326 :: SBool = if s2234 then s2325 else s2324 s2327 :: SBool = s259 ^ s2326 s2328 :: SBool = if s2266 then s2327 else s2326 s2329 :: SBool = s255 ^ s2328 s2330 :: SBool = if s2298 then s2329 else s2328 s2331 :: SBool = s7 ^ s177 s2332 :: SBool = if s1850 then s2331 else s177 s2333 :: SBool = s493 ^ s2332 s2334 :: SBool = if s1882 then s2333 else s2332 s2335 :: SBool = s463 ^ s2334 s2336 :: SBool = if s1914 then s2335 else s2334 s2337 :: SBool = s435 ^ s2336 s2338 :: SBool = if s1946 then s2337 else s2336 s2339 :: SBool = s409 ^ s2338 s2340 :: SBool = if s1978 then s2339 else s2338 s2341 :: SBool = s385 ^ s2340 s2342 :: SBool = if s2010 then s2341 else s2340 s2343 :: SBool = s363 ^ s2342 s2344 :: SBool = if s2042 then s2343 else s2342 s2345 :: SBool = s343 ^ s2344 s2346 :: SBool = if s2074 then s2345 else s2344 s2347 :: SBool = s325 ^ s2346 s2348 :: SBool = if s2106 then s2347 else s2346 s2349 :: SBool = s309 ^ s2348 s2350 :: SBool = if s2138 then s2349 else s2348 s2351 :: SBool = s295 ^ s2350 s2352 :: SBool = if s2170 then s2351 else s2350 s2353 :: SBool = s283 ^ s2352 s2354 :: SBool = if s2202 then s2353 else s2352 s2355 :: SBool = s273 ^ s2354 s2356 :: SBool = if s2234 then s2355 else s2354 s2357 :: SBool = s265 ^ s2356 s2358 :: SBool = if s2266 then s2357 else s2356 s2359 :: SBool = s259 ^ s2358 s2360 :: SBool = if s2298 then s2359 else s2358 s2361 :: SBool = s255 ^ s2360 s2362 :: SBool = if s2330 then s2361 else s2360 s2363 :: SBool = s7 ^ s182 s2364 :: SBool = if s1882 then s2363 else s182 s2365 :: SBool = s493 ^ s2364 s2366 :: SBool = if s1914 then s2365 else s2364 s2367 :: SBool = s463 ^ s2366 s2368 :: SBool = if s1946 then s2367 else s2366 s2369 :: SBool = s435 ^ s2368 s2370 :: SBool = if s1978 then s2369 else s2368 s2371 :: SBool = s409 ^ s2370 s2372 :: SBool = if s2010 then s2371 else s2370 s2373 :: SBool = s385 ^ s2372 s2374 :: SBool = if s2042 then s2373 else s2372 s2375 :: SBool = s363 ^ s2374 s2376 :: SBool = if s2074 then s2375 else s2374 s2377 :: SBool = s343 ^ s2376 s2378 :: SBool = if s2106 then s2377 else s2376 s2379 :: SBool = s325 ^ s2378 s2380 :: SBool = if s2138 then s2379 else s2378 s2381 :: SBool = s309 ^ s2380 s2382 :: SBool = if s2170 then s2381 else s2380 s2383 :: SBool = s295 ^ s2382 s2384 :: SBool = if s2202 then s2383 else s2382 s2385 :: SBool = s283 ^ s2384 s2386 :: SBool = if s2234 then s2385 else s2384 s2387 :: SBool = s273 ^ s2386 s2388 :: SBool = if s2266 then s2387 else s2386 s2389 :: SBool = s265 ^ s2388 s2390 :: SBool = if s2298 then s2389 else s2388 s2391 :: SBool = s259 ^ s2390 s2392 :: SBool = if s2330 then s2391 else s2390 s2393 :: SBool = s255 ^ s2392 s2394 :: SBool = if s2362 then s2393 else s2392 s2395 :: SBool = s7 ^ s187 s2396 :: SBool = if s1914 then s2395 else s187 s2397 :: SBool = s493 ^ s2396 s2398 :: SBool = if s1946 then s2397 else s2396 s2399 :: SBool = s463 ^ s2398 s2400 :: SBool = if s1978 then s2399 else s2398 s2401 :: SBool = s435 ^ s2400 s2402 :: SBool = if s2010 then s2401 else s2400 s2403 :: SBool = s409 ^ s2402 s2404 :: SBool = if s2042 then s2403 else s2402 s2405 :: SBool = s385 ^ s2404 s2406 :: SBool = if s2074 then s2405 else s2404 s2407 :: SBool = s363 ^ s2406 s2408 :: SBool = if s2106 then s2407 else s2406 s2409 :: SBool = s343 ^ s2408 s2410 :: SBool = if s2138 then s2409 else s2408 s2411 :: SBool = s325 ^ s2410 s2412 :: SBool = if s2170 then s2411 else s2410 s2413 :: SBool = s309 ^ s2412 s2414 :: SBool = if s2202 then s2413 else s2412 s2415 :: SBool = s295 ^ s2414 s2416 :: SBool = if s2234 then s2415 else s2414 s2417 :: SBool = s283 ^ s2416 s2418 :: SBool = if s2266 then s2417 else s2416 s2419 :: SBool = s273 ^ s2418 s2420 :: SBool = if s2298 then s2419 else s2418 s2421 :: SBool = s265 ^ s2420 s2422 :: SBool = if s2330 then s2421 else s2420 s2423 :: SBool = s259 ^ s2422 s2424 :: SBool = if s2362 then s2423 else s2422 s2425 :: SBool = s255 ^ s2424 s2426 :: SBool = if s2394 then s2425 else s2424 s2427 :: SBool = s7 ^ s192 s2428 :: SBool = if s1946 then s2427 else s192 s2429 :: SBool = s493 ^ s2428 s2430 :: SBool = if s1978 then s2429 else s2428 s2431 :: SBool = s463 ^ s2430 s2432 :: SBool = if s2010 then s2431 else s2430 s2433 :: SBool = s435 ^ s2432 s2434 :: SBool = if s2042 then s2433 else s2432 s2435 :: SBool = s409 ^ s2434 s2436 :: SBool = if s2074 then s2435 else s2434 s2437 :: SBool = s385 ^ s2436 s2438 :: SBool = if s2106 then s2437 else s2436 s2439 :: SBool = s363 ^ s2438 s2440 :: SBool = if s2138 then s2439 else s2438 s2441 :: SBool = s343 ^ s2440 s2442 :: SBool = if s2170 then s2441 else s2440 s2443 :: SBool = s325 ^ s2442 s2444 :: SBool = if s2202 then s2443 else s2442 s2445 :: SBool = s309 ^ s2444 s2446 :: SBool = if s2234 then s2445 else s2444 s2447 :: SBool = s295 ^ s2446 s2448 :: SBool = if s2266 then s2447 else s2446 s2449 :: SBool = s283 ^ s2448 s2450 :: SBool = if s2298 then s2449 else s2448 s2451 :: SBool = s273 ^ s2450 s2452 :: SBool = if s2330 then s2451 else s2450 s2453 :: SBool = s265 ^ s2452 s2454 :: SBool = if s2362 then s2453 else s2452 s2455 :: SBool = s259 ^ s2454 s2456 :: SBool = if s2394 then s2455 else s2454 s2457 :: SBool = s255 ^ s2456 s2458 :: SBool = if s2426 then s2457 else s2456 s2459 :: SBool = s7 ^ s197 s2460 :: SBool = if s1978 then s2459 else s197 s2461 :: SBool = s493 ^ s2460 s2462 :: SBool = if s2010 then s2461 else s2460 s2463 :: SBool = s463 ^ s2462 s2464 :: SBool = if s2042 then s2463 else s2462 s2465 :: SBool = s435 ^ s2464 s2466 :: SBool = if s2074 then s2465 else s2464 s2467 :: SBool = s409 ^ s2466 s2468 :: SBool = if s2106 then s2467 else s2466 s2469 :: SBool = s385 ^ s2468 s2470 :: SBool = if s2138 then s2469 else s2468 s2471 :: SBool = s363 ^ s2470 s2472 :: SBool = if s2170 then s2471 else s2470 s2473 :: SBool = s343 ^ s2472 s2474 :: SBool = if s2202 then s2473 else s2472 s2475 :: SBool = s325 ^ s2474 s2476 :: SBool = if s2234 then s2475 else s2474 s2477 :: SBool = s309 ^ s2476 s2478 :: SBool = if s2266 then s2477 else s2476 s2479 :: SBool = s295 ^ s2478 s2480 :: SBool = if s2298 then s2479 else s2478 s2481 :: SBool = s283 ^ s2480 s2482 :: SBool = if s2330 then s2481 else s2480 s2483 :: SBool = s273 ^ s2482 s2484 :: SBool = if s2362 then s2483 else s2482 s2485 :: SBool = s265 ^ s2484 s2486 :: SBool = if s2394 then s2485 else s2484 s2487 :: SBool = s259 ^ s2486 s2488 :: SBool = if s2426 then s2487 else s2486 s2489 :: SBool = s255 ^ s2488 s2490 :: SBool = if s2458 then s2489 else s2488 s2491 :: SBool = s7 ^ s202 s2492 :: SBool = if s2010 then s2491 else s202 s2493 :: SBool = s493 ^ s2492 s2494 :: SBool = if s2042 then s2493 else s2492 s2495 :: SBool = s463 ^ s2494 s2496 :: SBool = if s2074 then s2495 else s2494 s2497 :: SBool = s435 ^ s2496 s2498 :: SBool = if s2106 then s2497 else s2496 s2499 :: SBool = s409 ^ s2498 s2500 :: SBool = if s2138 then s2499 else s2498 s2501 :: SBool = s385 ^ s2500 s2502 :: SBool = if s2170 then s2501 else s2500 s2503 :: SBool = s363 ^ s2502 s2504 :: SBool = if s2202 then s2503 else s2502 s2505 :: SBool = s343 ^ s2504 s2506 :: SBool = if s2234 then s2505 else s2504 s2507 :: SBool = s325 ^ s2506 s2508 :: SBool = if s2266 then s2507 else s2506 s2509 :: SBool = s309 ^ s2508 s2510 :: SBool = if s2298 then s2509 else s2508 s2511 :: SBool = s295 ^ s2510 s2512 :: SBool = if s2330 then s2511 else s2510 s2513 :: SBool = s283 ^ s2512 s2514 :: SBool = if s2362 then s2513 else s2512 s2515 :: SBool = s273 ^ s2514 s2516 :: SBool = if s2394 then s2515 else s2514 s2517 :: SBool = s265 ^ s2516 s2518 :: SBool = if s2426 then s2517 else s2516 s2519 :: SBool = s259 ^ s2518 s2520 :: SBool = if s2458 then s2519 else s2518 s2521 :: SBool = s255 ^ s2520 s2522 :: SBool = if s2490 then s2521 else s2520 s2523 :: SBool = s7 ^ s207 s2524 :: SBool = if s2042 then s2523 else s207 s2525 :: SBool = s493 ^ s2524 s2526 :: SBool = if s2074 then s2525 else s2524 s2527 :: SBool = s463 ^ s2526 s2528 :: SBool = if s2106 then s2527 else s2526 s2529 :: SBool = s435 ^ s2528 s2530 :: SBool = if s2138 then s2529 else s2528 s2531 :: SBool = s409 ^ s2530 s2532 :: SBool = if s2170 then s2531 else s2530 s2533 :: SBool = s385 ^ s2532 s2534 :: SBool = if s2202 then s2533 else s2532 s2535 :: SBool = s363 ^ s2534 s2536 :: SBool = if s2234 then s2535 else s2534 s2537 :: SBool = s343 ^ s2536 s2538 :: SBool = if s2266 then s2537 else s2536 s2539 :: SBool = s325 ^ s2538 s2540 :: SBool = if s2298 then s2539 else s2538 s2541 :: SBool = s309 ^ s2540 s2542 :: SBool = if s2330 then s2541 else s2540 s2543 :: SBool = s295 ^ s2542 s2544 :: SBool = if s2362 then s2543 else s2542 s2545 :: SBool = s283 ^ s2544 s2546 :: SBool = if s2394 then s2545 else s2544 s2547 :: SBool = s273 ^ s2546 s2548 :: SBool = if s2426 then s2547 else s2546 s2549 :: SBool = s265 ^ s2548 s2550 :: SBool = if s2458 then s2549 else s2548 s2551 :: SBool = s259 ^ s2550 s2552 :: SBool = if s2490 then s2551 else s2550 s2553 :: SBool = s255 ^ s2552 s2554 :: SBool = if s2522 then s2553 else s2552 s2555 :: SBool = s7 ^ s212 s2556 :: SBool = if s2074 then s2555 else s212 s2557 :: SBool = s493 ^ s2556 s2558 :: SBool = if s2106 then s2557 else s2556 s2559 :: SBool = s463 ^ s2558 s2560 :: SBool = if s2138 then s2559 else s2558 s2561 :: SBool = s435 ^ s2560 s2562 :: SBool = if s2170 then s2561 else s2560 s2563 :: SBool = s409 ^ s2562 s2564 :: SBool = if s2202 then s2563 else s2562 s2565 :: SBool = s385 ^ s2564 s2566 :: SBool = if s2234 then s2565 else s2564 s2567 :: SBool = s363 ^ s2566 s2568 :: SBool = if s2266 then s2567 else s2566 s2569 :: SBool = s343 ^ s2568 s2570 :: SBool = if s2298 then s2569 else s2568 s2571 :: SBool = s325 ^ s2570 s2572 :: SBool = if s2330 then s2571 else s2570 s2573 :: SBool = s309 ^ s2572 s2574 :: SBool = if s2362 then s2573 else s2572 s2575 :: SBool = s295 ^ s2574 s2576 :: SBool = if s2394 then s2575 else s2574 s2577 :: SBool = s283 ^ s2576 s2578 :: SBool = if s2426 then s2577 else s2576 s2579 :: SBool = s273 ^ s2578 s2580 :: SBool = if s2458 then s2579 else s2578 s2581 :: SBool = s265 ^ s2580 s2582 :: SBool = if s2490 then s2581 else s2580 s2583 :: SBool = s259 ^ s2582 s2584 :: SBool = if s2522 then s2583 else s2582 s2585 :: SBool = s255 ^ s2584 s2586 :: SBool = if s2554 then s2585 else s2584 s2587 :: SBool = s7 ^ s217 s2588 :: SBool = if s2106 then s2587 else s217 s2589 :: SBool = s493 ^ s2588 s2590 :: SBool = if s2138 then s2589 else s2588 s2591 :: SBool = s463 ^ s2590 s2592 :: SBool = if s2170 then s2591 else s2590 s2593 :: SBool = s435 ^ s2592 s2594 :: SBool = if s2202 then s2593 else s2592 s2595 :: SBool = s409 ^ s2594 s2596 :: SBool = if s2234 then s2595 else s2594 s2597 :: SBool = s385 ^ s2596 s2598 :: SBool = if s2266 then s2597 else s2596 s2599 :: SBool = s363 ^ s2598 s2600 :: SBool = if s2298 then s2599 else s2598 s2601 :: SBool = s343 ^ s2600 s2602 :: SBool = if s2330 then s2601 else s2600 s2603 :: SBool = s325 ^ s2602 s2604 :: SBool = if s2362 then s2603 else s2602 s2605 :: SBool = s309 ^ s2604 s2606 :: SBool = if s2394 then s2605 else s2604 s2607 :: SBool = s295 ^ s2606 s2608 :: SBool = if s2426 then s2607 else s2606 s2609 :: SBool = s283 ^ s2608 s2610 :: SBool = if s2458 then s2609 else s2608 s2611 :: SBool = s273 ^ s2610 s2612 :: SBool = if s2490 then s2611 else s2610 s2613 :: SBool = s265 ^ s2612 s2614 :: SBool = if s2522 then s2613 else s2612 s2615 :: SBool = s259 ^ s2614 s2616 :: SBool = if s2554 then s2615 else s2614 s2617 :: SBool = s255 ^ s2616 s2618 :: SBool = if s2586 then s2617 else s2616 s2619 :: SBool = s7 ^ s222 s2620 :: SBool = if s2138 then s2619 else s222 s2621 :: SBool = s493 ^ s2620 s2622 :: SBool = if s2170 then s2621 else s2620 s2623 :: SBool = s463 ^ s2622 s2624 :: SBool = if s2202 then s2623 else s2622 s2625 :: SBool = s435 ^ s2624 s2626 :: SBool = if s2234 then s2625 else s2624 s2627 :: SBool = s409 ^ s2626 s2628 :: SBool = if s2266 then s2627 else s2626 s2629 :: SBool = s385 ^ s2628 s2630 :: SBool = if s2298 then s2629 else s2628 s2631 :: SBool = s363 ^ s2630 s2632 :: SBool = if s2330 then s2631 else s2630 s2633 :: SBool = s343 ^ s2632 s2634 :: SBool = if s2362 then s2633 else s2632 s2635 :: SBool = s325 ^ s2634 s2636 :: SBool = if s2394 then s2635 else s2634 s2637 :: SBool = s309 ^ s2636 s2638 :: SBool = if s2426 then s2637 else s2636 s2639 :: SBool = s295 ^ s2638 s2640 :: SBool = if s2458 then s2639 else s2638 s2641 :: SBool = s283 ^ s2640 s2642 :: SBool = if s2490 then s2641 else s2640 s2643 :: SBool = s273 ^ s2642 s2644 :: SBool = if s2522 then s2643 else s2642 s2645 :: SBool = s265 ^ s2644 s2646 :: SBool = if s2554 then s2645 else s2644 s2647 :: SBool = s259 ^ s2646 s2648 :: SBool = if s2586 then s2647 else s2646 s2649 :: SBool = s255 ^ s2648 s2650 :: SBool = if s2618 then s2649 else s2648 s2651 :: SBool = s7 ^ s227 s2652 :: SBool = if s2170 then s2651 else s227 s2653 :: SBool = s493 ^ s2652 s2654 :: SBool = if s2202 then s2653 else s2652 s2655 :: SBool = s463 ^ s2654 s2656 :: SBool = if s2234 then s2655 else s2654 s2657 :: SBool = s435 ^ s2656 s2658 :: SBool = if s2266 then s2657 else s2656 s2659 :: SBool = s409 ^ s2658 s2660 :: SBool = if s2298 then s2659 else s2658 s2661 :: SBool = s385 ^ s2660 s2662 :: SBool = if s2330 then s2661 else s2660 s2663 :: SBool = s363 ^ s2662 s2664 :: SBool = if s2362 then s2663 else s2662 s2665 :: SBool = s343 ^ s2664 s2666 :: SBool = if s2394 then s2665 else s2664 s2667 :: SBool = s325 ^ s2666 s2668 :: SBool = if s2426 then s2667 else s2666 s2669 :: SBool = s309 ^ s2668 s2670 :: SBool = if s2458 then s2669 else s2668 s2671 :: SBool = s295 ^ s2670 s2672 :: SBool = if s2490 then s2671 else s2670 s2673 :: SBool = s283 ^ s2672 s2674 :: SBool = if s2522 then s2673 else s2672 s2675 :: SBool = s273 ^ s2674 s2676 :: SBool = if s2554 then s2675 else s2674 s2677 :: SBool = s265 ^ s2676 s2678 :: SBool = if s2586 then s2677 else s2676 s2679 :: SBool = s259 ^ s2678 s2680 :: SBool = if s2618 then s2679 else s2678 s2681 :: SBool = s255 ^ s2680 s2682 :: SBool = if s2650 then s2681 else s2680 s2683 :: SBool = s7 ^ s232 s2684 :: SBool = if s2202 then s2683 else s232 s2685 :: SBool = s493 ^ s2684 s2686 :: SBool = if s2234 then s2685 else s2684 s2687 :: SBool = s463 ^ s2686 s2688 :: SBool = if s2266 then s2687 else s2686 s2689 :: SBool = s435 ^ s2688 s2690 :: SBool = if s2298 then s2689 else s2688 s2691 :: SBool = s409 ^ s2690 s2692 :: SBool = if s2330 then s2691 else s2690 s2693 :: SBool = s385 ^ s2692 s2694 :: SBool = if s2362 then s2693 else s2692 s2695 :: SBool = s363 ^ s2694 s2696 :: SBool = if s2394 then s2695 else s2694 s2697 :: SBool = s343 ^ s2696 s2698 :: SBool = if s2426 then s2697 else s2696 s2699 :: SBool = s325 ^ s2698 s2700 :: SBool = if s2458 then s2699 else s2698 s2701 :: SBool = s309 ^ s2700 s2702 :: SBool = if s2490 then s2701 else s2700 s2703 :: SBool = s295 ^ s2702 s2704 :: SBool = if s2522 then s2703 else s2702 s2705 :: SBool = s283 ^ s2704 s2706 :: SBool = if s2554 then s2705 else s2704 s2707 :: SBool = s273 ^ s2706 s2708 :: SBool = if s2586 then s2707 else s2706 s2709 :: SBool = s265 ^ s2708 s2710 :: SBool = if s2618 then s2709 else s2708 s2711 :: SBool = s259 ^ s2710 s2712 :: SBool = if s2650 then s2711 else s2710 s2713 :: SBool = s255 ^ s2712 s2714 :: SBool = if s2682 then s2713 else s2712 s2715 :: SBool = s7 ^ s237 s2716 :: SBool = if s2234 then s2715 else s237 s2717 :: SBool = s493 ^ s2716 s2718 :: SBool = if s2266 then s2717 else s2716 s2719 :: SBool = s463 ^ s2718 s2720 :: SBool = if s2298 then s2719 else s2718 s2721 :: SBool = s435 ^ s2720 s2722 :: SBool = if s2330 then s2721 else s2720 s2723 :: SBool = s409 ^ s2722 s2724 :: SBool = if s2362 then s2723 else s2722 s2725 :: SBool = s385 ^ s2724 s2726 :: SBool = if s2394 then s2725 else s2724 s2727 :: SBool = s363 ^ s2726 s2728 :: SBool = if s2426 then s2727 else s2726 s2729 :: SBool = s343 ^ s2728 s2730 :: SBool = if s2458 then s2729 else s2728 s2731 :: SBool = s325 ^ s2730 s2732 :: SBool = if s2490 then s2731 else s2730 s2733 :: SBool = s309 ^ s2732 s2734 :: SBool = if s2522 then s2733 else s2732 s2735 :: SBool = s295 ^ s2734 s2736 :: SBool = if s2554 then s2735 else s2734 s2737 :: SBool = s283 ^ s2736 s2738 :: SBool = if s2586 then s2737 else s2736 s2739 :: SBool = s273 ^ s2738 s2740 :: SBool = if s2618 then s2739 else s2738 s2741 :: SBool = s265 ^ s2740 s2742 :: SBool = if s2650 then s2741 else s2740 s2743 :: SBool = s259 ^ s2742 s2744 :: SBool = if s2682 then s2743 else s2742 s2745 :: SBool = s255 ^ s2744 s2746 :: SBool = if s2714 then s2745 else s2744 s2747 :: SBool = s7 ^ s242 s2748 :: SBool = if s2266 then s2747 else s242 s2749 :: SBool = s493 ^ s2748 s2750 :: SBool = if s2298 then s2749 else s2748 s2751 :: SBool = s463 ^ s2750 s2752 :: SBool = if s2330 then s2751 else s2750 s2753 :: SBool = s435 ^ s2752 s2754 :: SBool = if s2362 then s2753 else s2752 s2755 :: SBool = s409 ^ s2754 s2756 :: SBool = if s2394 then s2755 else s2754 s2757 :: SBool = s385 ^ s2756 s2758 :: SBool = if s2426 then s2757 else s2756 s2759 :: SBool = s363 ^ s2758 s2760 :: SBool = if s2458 then s2759 else s2758 s2761 :: SBool = s343 ^ s2760 s2762 :: SBool = if s2490 then s2761 else s2760 s2763 :: SBool = s325 ^ s2762 s2764 :: SBool = if s2522 then s2763 else s2762 s2765 :: SBool = s309 ^ s2764 s2766 :: SBool = if s2554 then s2765 else s2764 s2767 :: SBool = s295 ^ s2766 s2768 :: SBool = if s2586 then s2767 else s2766 s2769 :: SBool = s283 ^ s2768 s2770 :: SBool = if s2618 then s2769 else s2768 s2771 :: SBool = s273 ^ s2770 s2772 :: SBool = if s2650 then s2771 else s2770 s2773 :: SBool = s265 ^ s2772 s2774 :: SBool = if s2682 then s2773 else s2772 s2775 :: SBool = s259 ^ s2774 s2776 :: SBool = if s2714 then s2775 else s2774 s2777 :: SBool = s255 ^ s2776 s2778 :: SBool = if s2746 then s2777 else s2776 s2779 :: SBool = s7 ^ s247 s2780 :: SBool = if s2298 then s2779 else s247 s2781 :: SBool = s493 ^ s2780 s2782 :: SBool = if s2330 then s2781 else s2780 s2783 :: SBool = s463 ^ s2782 s2784 :: SBool = if s2362 then s2783 else s2782 s2785 :: SBool = s435 ^ s2784 s2786 :: SBool = if s2394 then s2785 else s2784 s2787 :: SBool = s409 ^ s2786 s2788 :: SBool = if s2426 then s2787 else s2786 s2789 :: SBool = s385 ^ s2788 s2790 :: SBool = if s2458 then s2789 else s2788 s2791 :: SBool = s363 ^ s2790 s2792 :: SBool = if s2490 then s2791 else s2790 s2793 :: SBool = s343 ^ s2792 s2794 :: SBool = if s2522 then s2793 else s2792 s2795 :: SBool = s325 ^ s2794 s2796 :: SBool = if s2554 then s2795 else s2794 s2797 :: SBool = s309 ^ s2796 s2798 :: SBool = if s2586 then s2797 else s2796 s2799 :: SBool = s295 ^ s2798 s2800 :: SBool = if s2618 then s2799 else s2798 s2801 :: SBool = s283 ^ s2800 s2802 :: SBool = if s2650 then s2801 else s2800 s2803 :: SBool = s273 ^ s2802 s2804 :: SBool = if s2682 then s2803 else s2802 s2805 :: SBool = s265 ^ s2804 s2806 :: SBool = if s2714 then s2805 else s2804 s2807 :: SBool = s259 ^ s2806 s2808 :: SBool = if s2746 then s2807 else s2806 s2809 :: SBool = s255 ^ s2808 s2810 :: SBool = if s2778 then s2809 else s2808 s2811 :: SBool = s7 ^ s252 s2812 :: SBool = if s2330 then s2811 else s252 s2813 :: SBool = s493 ^ s2812 s2814 :: SBool = if s2362 then s2813 else s2812 s2815 :: SBool = s463 ^ s2814 s2816 :: SBool = if s2394 then s2815 else s2814 s2817 :: SBool = s435 ^ s2816 s2818 :: SBool = if s2426 then s2817 else s2816 s2819 :: SBool = s409 ^ s2818 s2820 :: SBool = if s2458 then s2819 else s2818 s2821 :: SBool = s385 ^ s2820 s2822 :: SBool = if s2490 then s2821 else s2820 s2823 :: SBool = s363 ^ s2822 s2824 :: SBool = if s2522 then s2823 else s2822 s2825 :: SBool = s343 ^ s2824 s2826 :: SBool = if s2554 then s2825 else s2824 s2827 :: SBool = s325 ^ s2826 s2828 :: SBool = if s2586 then s2827 else s2826 s2829 :: SBool = s309 ^ s2828 s2830 :: SBool = if s2618 then s2829 else s2828 s2831 :: SBool = s295 ^ s2830 s2832 :: SBool = if s2650 then s2831 else s2830 s2833 :: SBool = s283 ^ s2832 s2834 :: SBool = if s2682 then s2833 else s2832 s2835 :: SBool = s273 ^ s2834 s2836 :: SBool = if s2714 then s2835 else s2834 s2837 :: SBool = s265 ^ s2836 s2838 :: SBool = if s2746 then s2837 else s2836 s2839 :: SBool = s259 ^ s2838 s2840 :: SBool = if s2778 then s2839 else s2838 s2841 :: SBool = s255 ^ s2840 s2842 :: SBool = if s2810 then s2841 else s2840 s2843 :: SBool = if s2362 then s7 else s_2 s2844 :: SBool = s493 ^ s2843 s2845 :: SBool = if s2394 then s2844 else s2843 s2846 :: SBool = s463 ^ s2845 s2847 :: SBool = if s2426 then s2846 else s2845 s2848 :: SBool = s435 ^ s2847 s2849 :: SBool = if s2458 then s2848 else s2847 s2850 :: SBool = s409 ^ s2849 s2851 :: SBool = if s2490 then s2850 else s2849 s2852 :: SBool = s385 ^ s2851 s2853 :: SBool = if s2522 then s2852 else s2851 s2854 :: SBool = s363 ^ s2853 s2855 :: SBool = if s2554 then s2854 else s2853 s2856 :: SBool = s343 ^ s2855 s2857 :: SBool = if s2586 then s2856 else s2855 s2858 :: SBool = s325 ^ s2857 s2859 :: SBool = if s2618 then s2858 else s2857 s2860 :: SBool = s309 ^ s2859 s2861 :: SBool = if s2650 then s2860 else s2859 s2862 :: SBool = s295 ^ s2861 s2863 :: SBool = if s2682 then s2862 else s2861 s2864 :: SBool = s283 ^ s2863 s2865 :: SBool = if s2714 then s2864 else s2863 s2866 :: SBool = s273 ^ s2865 s2867 :: SBool = if s2746 then s2866 else s2865 s2868 :: SBool = s265 ^ s2867 s2869 :: SBool = if s2778 then s2868 else s2867 s2870 :: SBool = s259 ^ s2869 s2871 :: SBool = if s2810 then s2870 else s2869 s2872 :: SBool = s255 ^ s2871 s2873 :: SBool = if s2842 then s2872 else s2871 s2874 :: SBool = s1578 ^ s2873 s2875 :: SBool = if s1099 then s7 else s_2 s2876 :: SBool = s493 ^ s2875 s2877 :: SBool = if s1131 then s2876 else s2875 s2878 :: SBool = s463 ^ s2877 s2879 :: SBool = if s1163 then s2878 else s2877 s2880 :: SBool = s435 ^ s2879 s2881 :: SBool = if s1195 then s2880 else s2879 s2882 :: SBool = s409 ^ s2881 s2883 :: SBool = if s1227 then s2882 else s2881 s2884 :: SBool = s385 ^ s2883 s2885 :: SBool = if s1259 then s2884 else s2883 s2886 :: SBool = s363 ^ s2885 s2887 :: SBool = if s1291 then s2886 else s2885 s2888 :: SBool = s343 ^ s2887 s2889 :: SBool = if s1323 then s2888 else s2887 s2890 :: SBool = s325 ^ s2889 s2891 :: SBool = if s1355 then s2890 else s2889 s2892 :: SBool = s309 ^ s2891 s2893 :: SBool = if s1387 then s2892 else s2891 s2894 :: SBool = s295 ^ s2893 s2895 :: SBool = if s1419 then s2894 else s2893 s2896 :: SBool = s283 ^ s2895 s2897 :: SBool = if s1451 then s2896 else s2895 s2898 :: SBool = s273 ^ s2897 s2899 :: SBool = if s1483 then s2898 else s2897 s2900 :: SBool = s265 ^ s2899 s2901 :: SBool = if s1515 then s2900 else s2899 s2902 :: SBool = s259 ^ s2901 s2903 :: SBool = if s1547 then s2902 else s2901 s2904 :: SBool = if s2394 then s7 else s_2 s2905 :: SBool = s493 ^ s2904 s2906 :: SBool = if s2426 then s2905 else s2904 s2907 :: SBool = s463 ^ s2906 s2908 :: SBool = if s2458 then s2907 else s2906 s2909 :: SBool = s435 ^ s2908 s2910 :: SBool = if s2490 then s2909 else s2908 s2911 :: SBool = s409 ^ s2910 s2912 :: SBool = if s2522 then s2911 else s2910 s2913 :: SBool = s385 ^ s2912 s2914 :: SBool = if s2554 then s2913 else s2912 s2915 :: SBool = s363 ^ s2914 s2916 :: SBool = if s2586 then s2915 else s2914 s2917 :: SBool = s343 ^ s2916 s2918 :: SBool = if s2618 then s2917 else s2916 s2919 :: SBool = s325 ^ s2918 s2920 :: SBool = if s2650 then s2919 else s2918 s2921 :: SBool = s309 ^ s2920 s2922 :: SBool = if s2682 then s2921 else s2920 s2923 :: SBool = s295 ^ s2922 s2924 :: SBool = if s2714 then s2923 else s2922 s2925 :: SBool = s283 ^ s2924 s2926 :: SBool = if s2746 then s2925 else s2924 s2927 :: SBool = s273 ^ s2926 s2928 :: SBool = if s2778 then s2927 else s2926 s2929 :: SBool = s265 ^ s2928 s2930 :: SBool = if s2810 then s2929 else s2928 s2931 :: SBool = s259 ^ s2930 s2932 :: SBool = if s2842 then s2931 else s2930 s2933 :: SBool = s2903 ^ s2932 s2934 :: SBool = if s1131 then s7 else s_2 s2935 :: SBool = s493 ^ s2934 s2936 :: SBool = if s1163 then s2935 else s2934 s2937 :: SBool = s463 ^ s2936 s2938 :: SBool = if s1195 then s2937 else s2936 s2939 :: SBool = s435 ^ s2938 s2940 :: SBool = if s1227 then s2939 else s2938 s2941 :: SBool = s409 ^ s2940 s2942 :: SBool = if s1259 then s2941 else s2940 s2943 :: SBool = s385 ^ s2942 s2944 :: SBool = if s1291 then s2943 else s2942 s2945 :: SBool = s363 ^ s2944 s2946 :: SBool = if s1323 then s2945 else s2944 s2947 :: SBool = s343 ^ s2946 s2948 :: SBool = if s1355 then s2947 else s2946 s2949 :: SBool = s325 ^ s2948 s2950 :: SBool = if s1387 then s2949 else s2948 s2951 :: SBool = s309 ^ s2950 s2952 :: SBool = if s1419 then s2951 else s2950 s2953 :: SBool = s295 ^ s2952 s2954 :: SBool = if s1451 then s2953 else s2952 s2955 :: SBool = s283 ^ s2954 s2956 :: SBool = if s1483 then s2955 else s2954 s2957 :: SBool = s273 ^ s2956 s2958 :: SBool = if s1515 then s2957 else s2956 s2959 :: SBool = s265 ^ s2958 s2960 :: SBool = if s1547 then s2959 else s2958 s2961 :: SBool = if s2426 then s7 else s_2 s2962 :: SBool = s493 ^ s2961 s2963 :: SBool = if s2458 then s2962 else s2961 s2964 :: SBool = s463 ^ s2963 s2965 :: SBool = if s2490 then s2964 else s2963 s2966 :: SBool = s435 ^ s2965 s2967 :: SBool = if s2522 then s2966 else s2965 s2968 :: SBool = s409 ^ s2967 s2969 :: SBool = if s2554 then s2968 else s2967 s2970 :: SBool = s385 ^ s2969 s2971 :: SBool = if s2586 then s2970 else s2969 s2972 :: SBool = s363 ^ s2971 s2973 :: SBool = if s2618 then s2972 else s2971 s2974 :: SBool = s343 ^ s2973 s2975 :: SBool = if s2650 then s2974 else s2973 s2976 :: SBool = s325 ^ s2975 s2977 :: SBool = if s2682 then s2976 else s2975 s2978 :: SBool = s309 ^ s2977 s2979 :: SBool = if s2714 then s2978 else s2977 s2980 :: SBool = s295 ^ s2979 s2981 :: SBool = if s2746 then s2980 else s2979 s2982 :: SBool = s283 ^ s2981 s2983 :: SBool = if s2778 then s2982 else s2981 s2984 :: SBool = s273 ^ s2983 s2985 :: SBool = if s2810 then s2984 else s2983 s2986 :: SBool = s265 ^ s2985 s2987 :: SBool = if s2842 then s2986 else s2985 s2988 :: SBool = s2960 ^ s2987 s2989 :: SBool = if s1163 then s7 else s_2 s2990 :: SBool = s493 ^ s2989 s2991 :: SBool = if s1195 then s2990 else s2989 s2992 :: SBool = s463 ^ s2991 s2993 :: SBool = if s1227 then s2992 else s2991 s2994 :: SBool = s435 ^ s2993 s2995 :: SBool = if s1259 then s2994 else s2993 s2996 :: SBool = s409 ^ s2995 s2997 :: SBool = if s1291 then s2996 else s2995 s2998 :: SBool = s385 ^ s2997 s2999 :: SBool = if s1323 then s2998 else s2997 s3000 :: SBool = s363 ^ s2999 s3001 :: SBool = if s1355 then s3000 else s2999 s3002 :: SBool = s343 ^ s3001 s3003 :: SBool = if s1387 then s3002 else s3001 s3004 :: SBool = s325 ^ s3003 s3005 :: SBool = if s1419 then s3004 else s3003 s3006 :: SBool = s309 ^ s3005 s3007 :: SBool = if s1451 then s3006 else s3005 s3008 :: SBool = s295 ^ s3007 s3009 :: SBool = if s1483 then s3008 else s3007 s3010 :: SBool = s283 ^ s3009 s3011 :: SBool = if s1515 then s3010 else s3009 s3012 :: SBool = s273 ^ s3011 s3013 :: SBool = if s1547 then s3012 else s3011 s3014 :: SBool = if s2458 then s7 else s_2 s3015 :: SBool = s493 ^ s3014 s3016 :: SBool = if s2490 then s3015 else s3014 s3017 :: SBool = s463 ^ s3016 s3018 :: SBool = if s2522 then s3017 else s3016 s3019 :: SBool = s435 ^ s3018 s3020 :: SBool = if s2554 then s3019 else s3018 s3021 :: SBool = s409 ^ s3020 s3022 :: SBool = if s2586 then s3021 else s3020 s3023 :: SBool = s385 ^ s3022 s3024 :: SBool = if s2618 then s3023 else s3022 s3025 :: SBool = s363 ^ s3024 s3026 :: SBool = if s2650 then s3025 else s3024 s3027 :: SBool = s343 ^ s3026 s3028 :: SBool = if s2682 then s3027 else s3026 s3029 :: SBool = s325 ^ s3028 s3030 :: SBool = if s2714 then s3029 else s3028 s3031 :: SBool = s309 ^ s3030 s3032 :: SBool = if s2746 then s3031 else s3030 s3033 :: SBool = s295 ^ s3032 s3034 :: SBool = if s2778 then s3033 else s3032 s3035 :: SBool = s283 ^ s3034 s3036 :: SBool = if s2810 then s3035 else s3034 s3037 :: SBool = s273 ^ s3036 s3038 :: SBool = if s2842 then s3037 else s3036 s3039 :: SBool = s3013 ^ s3038 s3040 :: SBool = if s1195 then s7 else s_2 s3041 :: SBool = s493 ^ s3040 s3042 :: SBool = if s1227 then s3041 else s3040 s3043 :: SBool = s463 ^ s3042 s3044 :: SBool = if s1259 then s3043 else s3042 s3045 :: SBool = s435 ^ s3044 s3046 :: SBool = if s1291 then s3045 else s3044 s3047 :: SBool = s409 ^ s3046 s3048 :: SBool = if s1323 then s3047 else s3046 s3049 :: SBool = s385 ^ s3048 s3050 :: SBool = if s1355 then s3049 else s3048 s3051 :: SBool = s363 ^ s3050 s3052 :: SBool = if s1387 then s3051 else s3050 s3053 :: SBool = s343 ^ s3052 s3054 :: SBool = if s1419 then s3053 else s3052 s3055 :: SBool = s325 ^ s3054 s3056 :: SBool = if s1451 then s3055 else s3054 s3057 :: SBool = s309 ^ s3056 s3058 :: SBool = if s1483 then s3057 else s3056 s3059 :: SBool = s295 ^ s3058 s3060 :: SBool = if s1515 then s3059 else s3058 s3061 :: SBool = s283 ^ s3060 s3062 :: SBool = if s1547 then s3061 else s3060 s3063 :: SBool = if s2490 then s7 else s_2 s3064 :: SBool = s493 ^ s3063 s3065 :: SBool = if s2522 then s3064 else s3063 s3066 :: SBool = s463 ^ s3065 s3067 :: SBool = if s2554 then s3066 else s3065 s3068 :: SBool = s435 ^ s3067 s3069 :: SBool = if s2586 then s3068 else s3067 s3070 :: SBool = s409 ^ s3069 s3071 :: SBool = if s2618 then s3070 else s3069 s3072 :: SBool = s385 ^ s3071 s3073 :: SBool = if s2650 then s3072 else s3071 s3074 :: SBool = s363 ^ s3073 s3075 :: SBool = if s2682 then s3074 else s3073 s3076 :: SBool = s343 ^ s3075 s3077 :: SBool = if s2714 then s3076 else s3075 s3078 :: SBool = s325 ^ s3077 s3079 :: SBool = if s2746 then s3078 else s3077 s3080 :: SBool = s309 ^ s3079 s3081 :: SBool = if s2778 then s3080 else s3079 s3082 :: SBool = s295 ^ s3081 s3083 :: SBool = if s2810 then s3082 else s3081 s3084 :: SBool = s283 ^ s3083 s3085 :: SBool = if s2842 then s3084 else s3083 s3086 :: SBool = s3062 ^ s3085 s3087 :: SBool = if s1227 then s7 else s_2 s3088 :: SBool = s493 ^ s3087 s3089 :: SBool = if s1259 then s3088 else s3087 s3090 :: SBool = s463 ^ s3089 s3091 :: SBool = if s1291 then s3090 else s3089 s3092 :: SBool = s435 ^ s3091 s3093 :: SBool = if s1323 then s3092 else s3091 s3094 :: SBool = s409 ^ s3093 s3095 :: SBool = if s1355 then s3094 else s3093 s3096 :: SBool = s385 ^ s3095 s3097 :: SBool = if s1387 then s3096 else s3095 s3098 :: SBool = s363 ^ s3097 s3099 :: SBool = if s1419 then s3098 else s3097 s3100 :: SBool = s343 ^ s3099 s3101 :: SBool = if s1451 then s3100 else s3099 s3102 :: SBool = s325 ^ s3101 s3103 :: SBool = if s1483 then s3102 else s3101 s3104 :: SBool = s309 ^ s3103 s3105 :: SBool = if s1515 then s3104 else s3103 s3106 :: SBool = s295 ^ s3105 s3107 :: SBool = if s1547 then s3106 else s3105 s3108 :: SBool = if s2522 then s7 else s_2 s3109 :: SBool = s493 ^ s3108 s3110 :: SBool = if s2554 then s3109 else s3108 s3111 :: SBool = s463 ^ s3110 s3112 :: SBool = if s2586 then s3111 else s3110 s3113 :: SBool = s435 ^ s3112 s3114 :: SBool = if s2618 then s3113 else s3112 s3115 :: SBool = s409 ^ s3114 s3116 :: SBool = if s2650 then s3115 else s3114 s3117 :: SBool = s385 ^ s3116 s3118 :: SBool = if s2682 then s3117 else s3116 s3119 :: SBool = s363 ^ s3118 s3120 :: SBool = if s2714 then s3119 else s3118 s3121 :: SBool = s343 ^ s3120 s3122 :: SBool = if s2746 then s3121 else s3120 s3123 :: SBool = s325 ^ s3122 s3124 :: SBool = if s2778 then s3123 else s3122 s3125 :: SBool = s309 ^ s3124 s3126 :: SBool = if s2810 then s3125 else s3124 s3127 :: SBool = s295 ^ s3126 s3128 :: SBool = if s2842 then s3127 else s3126 s3129 :: SBool = s3107 ^ s3128 s3130 :: SBool = if s1259 then s7 else s_2 s3131 :: SBool = s493 ^ s3130 s3132 :: SBool = if s1291 then s3131 else s3130 s3133 :: SBool = s463 ^ s3132 s3134 :: SBool = if s1323 then s3133 else s3132 s3135 :: SBool = s435 ^ s3134 s3136 :: SBool = if s1355 then s3135 else s3134 s3137 :: SBool = s409 ^ s3136 s3138 :: SBool = if s1387 then s3137 else s3136 s3139 :: SBool = s385 ^ s3138 s3140 :: SBool = if s1419 then s3139 else s3138 s3141 :: SBool = s363 ^ s3140 s3142 :: SBool = if s1451 then s3141 else s3140 s3143 :: SBool = s343 ^ s3142 s3144 :: SBool = if s1483 then s3143 else s3142 s3145 :: SBool = s325 ^ s3144 s3146 :: SBool = if s1515 then s3145 else s3144 s3147 :: SBool = s309 ^ s3146 s3148 :: SBool = if s1547 then s3147 else s3146 s3149 :: SBool = if s2554 then s7 else s_2 s3150 :: SBool = s493 ^ s3149 s3151 :: SBool = if s2586 then s3150 else s3149 s3152 :: SBool = s463 ^ s3151 s3153 :: SBool = if s2618 then s3152 else s3151 s3154 :: SBool = s435 ^ s3153 s3155 :: SBool = if s2650 then s3154 else s3153 s3156 :: SBool = s409 ^ s3155 s3157 :: SBool = if s2682 then s3156 else s3155 s3158 :: SBool = s385 ^ s3157 s3159 :: SBool = if s2714 then s3158 else s3157 s3160 :: SBool = s363 ^ s3159 s3161 :: SBool = if s2746 then s3160 else s3159 s3162 :: SBool = s343 ^ s3161 s3163 :: SBool = if s2778 then s3162 else s3161 s3164 :: SBool = s325 ^ s3163 s3165 :: SBool = if s2810 then s3164 else s3163 s3166 :: SBool = s309 ^ s3165 s3167 :: SBool = if s2842 then s3166 else s3165 s3168 :: SBool = s3148 ^ s3167 s3169 :: SBool = if s1291 then s7 else s_2 s3170 :: SBool = s493 ^ s3169 s3171 :: SBool = if s1323 then s3170 else s3169 s3172 :: SBool = s463 ^ s3171 s3173 :: SBool = if s1355 then s3172 else s3171 s3174 :: SBool = s435 ^ s3173 s3175 :: SBool = if s1387 then s3174 else s3173 s3176 :: SBool = s409 ^ s3175 s3177 :: SBool = if s1419 then s3176 else s3175 s3178 :: SBool = s385 ^ s3177 s3179 :: SBool = if s1451 then s3178 else s3177 s3180 :: SBool = s363 ^ s3179 s3181 :: SBool = if s1483 then s3180 else s3179 s3182 :: SBool = s343 ^ s3181 s3183 :: SBool = if s1515 then s3182 else s3181 s3184 :: SBool = s325 ^ s3183 s3185 :: SBool = if s1547 then s3184 else s3183 s3186 :: SBool = if s2586 then s7 else s_2 s3187 :: SBool = s493 ^ s3186 s3188 :: SBool = if s2618 then s3187 else s3186 s3189 :: SBool = s463 ^ s3188 s3190 :: SBool = if s2650 then s3189 else s3188 s3191 :: SBool = s435 ^ s3190 s3192 :: SBool = if s2682 then s3191 else s3190 s3193 :: SBool = s409 ^ s3192 s3194 :: SBool = if s2714 then s3193 else s3192 s3195 :: SBool = s385 ^ s3194 s3196 :: SBool = if s2746 then s3195 else s3194 s3197 :: SBool = s363 ^ s3196 s3198 :: SBool = if s2778 then s3197 else s3196 s3199 :: SBool = s343 ^ s3198 s3200 :: SBool = if s2810 then s3199 else s3198 s3201 :: SBool = s325 ^ s3200 s3202 :: SBool = if s2842 then s3201 else s3200 s3203 :: SBool = s3185 ^ s3202 s3204 :: SBool = if s1323 then s7 else s_2 s3205 :: SBool = s493 ^ s3204 s3206 :: SBool = if s1355 then s3205 else s3204 s3207 :: SBool = s463 ^ s3206 s3208 :: SBool = if s1387 then s3207 else s3206 s3209 :: SBool = s435 ^ s3208 s3210 :: SBool = if s1419 then s3209 else s3208 s3211 :: SBool = s409 ^ s3210 s3212 :: SBool = if s1451 then s3211 else s3210 s3213 :: SBool = s385 ^ s3212 s3214 :: SBool = if s1483 then s3213 else s3212 s3215 :: SBool = s363 ^ s3214 s3216 :: SBool = if s1515 then s3215 else s3214 s3217 :: SBool = s343 ^ s3216 s3218 :: SBool = if s1547 then s3217 else s3216 s3219 :: SBool = if s2618 then s7 else s_2 s3220 :: SBool = s493 ^ s3219 s3221 :: SBool = if s2650 then s3220 else s3219 s3222 :: SBool = s463 ^ s3221 s3223 :: SBool = if s2682 then s3222 else s3221 s3224 :: SBool = s435 ^ s3223 s3225 :: SBool = if s2714 then s3224 else s3223 s3226 :: SBool = s409 ^ s3225 s3227 :: SBool = if s2746 then s3226 else s3225 s3228 :: SBool = s385 ^ s3227 s3229 :: SBool = if s2778 then s3228 else s3227 s3230 :: SBool = s363 ^ s3229 s3231 :: SBool = if s2810 then s3230 else s3229 s3232 :: SBool = s343 ^ s3231 s3233 :: SBool = if s2842 then s3232 else s3231 s3234 :: SBool = s3218 ^ s3233 s3235 :: SBool = if s1355 then s7 else s_2 s3236 :: SBool = s493 ^ s3235 s3237 :: SBool = if s1387 then s3236 else s3235 s3238 :: SBool = s463 ^ s3237 s3239 :: SBool = if s1419 then s3238 else s3237 s3240 :: SBool = s435 ^ s3239 s3241 :: SBool = if s1451 then s3240 else s3239 s3242 :: SBool = s409 ^ s3241 s3243 :: SBool = if s1483 then s3242 else s3241 s3244 :: SBool = s385 ^ s3243 s3245 :: SBool = if s1515 then s3244 else s3243 s3246 :: SBool = s363 ^ s3245 s3247 :: SBool = if s1547 then s3246 else s3245 s3248 :: SBool = if s2650 then s7 else s_2 s3249 :: SBool = s493 ^ s3248 s3250 :: SBool = if s2682 then s3249 else s3248 s3251 :: SBool = s463 ^ s3250 s3252 :: SBool = if s2714 then s3251 else s3250 s3253 :: SBool = s435 ^ s3252 s3254 :: SBool = if s2746 then s3253 else s3252 s3255 :: SBool = s409 ^ s3254 s3256 :: SBool = if s2778 then s3255 else s3254 s3257 :: SBool = s385 ^ s3256 s3258 :: SBool = if s2810 then s3257 else s3256 s3259 :: SBool = s363 ^ s3258 s3260 :: SBool = if s2842 then s3259 else s3258 s3261 :: SBool = s3247 ^ s3260 s3262 :: SBool = if s1387 then s7 else s_2 s3263 :: SBool = s493 ^ s3262 s3264 :: SBool = if s1419 then s3263 else s3262 s3265 :: SBool = s463 ^ s3264 s3266 :: SBool = if s1451 then s3265 else s3264 s3267 :: SBool = s435 ^ s3266 s3268 :: SBool = if s1483 then s3267 else s3266 s3269 :: SBool = s409 ^ s3268 s3270 :: SBool = if s1515 then s3269 else s3268 s3271 :: SBool = s385 ^ s3270 s3272 :: SBool = if s1547 then s3271 else s3270 s3273 :: SBool = if s2682 then s7 else s_2 s3274 :: SBool = s493 ^ s3273 s3275 :: SBool = if s2714 then s3274 else s3273 s3276 :: SBool = s463 ^ s3275 s3277 :: SBool = if s2746 then s3276 else s3275 s3278 :: SBool = s435 ^ s3277 s3279 :: SBool = if s2778 then s3278 else s3277 s3280 :: SBool = s409 ^ s3279 s3281 :: SBool = if s2810 then s3280 else s3279 s3282 :: SBool = s385 ^ s3281 s3283 :: SBool = if s2842 then s3282 else s3281 s3284 :: SBool = s3272 ^ s3283 s3285 :: SBool = if s1419 then s7 else s_2 s3286 :: SBool = s493 ^ s3285 s3287 :: SBool = if s1451 then s3286 else s3285 s3288 :: SBool = s463 ^ s3287 s3289 :: SBool = if s1483 then s3288 else s3287 s3290 :: SBool = s435 ^ s3289 s3291 :: SBool = if s1515 then s3290 else s3289 s3292 :: SBool = s409 ^ s3291 s3293 :: SBool = if s1547 then s3292 else s3291 s3294 :: SBool = if s2714 then s7 else s_2 s3295 :: SBool = s493 ^ s3294 s3296 :: SBool = if s2746 then s3295 else s3294 s3297 :: SBool = s463 ^ s3296 s3298 :: SBool = if s2778 then s3297 else s3296 s3299 :: SBool = s435 ^ s3298 s3300 :: SBool = if s2810 then s3299 else s3298 s3301 :: SBool = s409 ^ s3300 s3302 :: SBool = if s2842 then s3301 else s3300 s3303 :: SBool = s3293 ^ s3302 s3304 :: SBool = if s1451 then s7 else s_2 s3305 :: SBool = s493 ^ s3304 s3306 :: SBool = if s1483 then s3305 else s3304 s3307 :: SBool = s463 ^ s3306 s3308 :: SBool = if s1515 then s3307 else s3306 s3309 :: SBool = s435 ^ s3308 s3310 :: SBool = if s1547 then s3309 else s3308 s3311 :: SBool = if s2746 then s7 else s_2 s3312 :: SBool = s493 ^ s3311 s3313 :: SBool = if s2778 then s3312 else s3311 s3314 :: SBool = s463 ^ s3313 s3315 :: SBool = if s2810 then s3314 else s3313 s3316 :: SBool = s435 ^ s3315 s3317 :: SBool = if s2842 then s3316 else s3315 s3318 :: SBool = s3310 ^ s3317 s3319 :: SBool = if s1483 then s7 else s_2 s3320 :: SBool = s493 ^ s3319 s3321 :: SBool = if s1515 then s3320 else s3319 s3322 :: SBool = s463 ^ s3321 s3323 :: SBool = if s1547 then s3322 else s3321 s3324 :: SBool = if s2778 then s7 else s_2 s3325 :: SBool = s493 ^ s3324 s3326 :: SBool = if s2810 then s3325 else s3324 s3327 :: SBool = s463 ^ s3326 s3328 :: SBool = if s2842 then s3327 else s3326 s3329 :: SBool = s3323 ^ s3328 s3330 :: SBool = if s1515 then s7 else s_2 s3331 :: SBool = s493 ^ s3330 s3332 :: SBool = if s1547 then s3331 else s3330 s3333 :: SBool = if s2810 then s7 else s_2 s3334 :: SBool = s493 ^ s3333 s3335 :: SBool = if s2842 then s3334 else s3333 s3336 :: SBool = s3332 ^ s3335 s3337 :: SBool = if s1547 then s7 else s_2 s3338 :: SBool = if s2842 then s7 else s_2 s3339 :: SBool = s3337 ^ s3338 s3341 :: SWord8 = if s3339 then s18 else s3340 s3342 :: SWord8 = s18 + s3341 s3343 :: SWord8 = if s3336 then s3342 else s3341 s3344 :: SWord8 = s18 + s3343 s3345 :: SWord8 = if s3329 then s3344 else s3343 s3346 :: SWord8 = s18 + s3345 s3347 :: SWord8 = if s3318 then s3346 else s3345 s3348 :: SWord8 = s18 + s3347 s3349 :: SWord8 = if s3303 then s3348 else s3347 s3350 :: SWord8 = s18 + s3349 s3351 :: SWord8 = if s3284 then s3350 else s3349 s3352 :: SWord8 = s18 + s3351 s3353 :: SWord8 = if s3261 then s3352 else s3351 s3354 :: SWord8 = s18 + s3353 s3355 :: SWord8 = if s3234 then s3354 else s3353 s3356 :: SWord8 = s18 + s3355 s3357 :: SWord8 = if s3203 then s3356 else s3355 s3358 :: SWord8 = s18 + s3357 s3359 :: SWord8 = if s3168 then s3358 else s3357 s3360 :: SWord8 = s18 + s3359 s3361 :: SWord8 = if s3129 then s3360 else s3359 s3362 :: SWord8 = s18 + s3361 s3363 :: SWord8 = if s3086 then s3362 else s3361 s3364 :: SWord8 = s18 + s3363 s3365 :: SWord8 = if s3039 then s3364 else s3363 s3366 :: SWord8 = s18 + s3365 s3367 :: SWord8 = if s2988 then s3366 else s3365 s3368 :: SWord8 = s18 + s3367 s3369 :: SWord8 = if s2933 then s3368 else s3367 s3370 :: SWord8 = s18 + s3369 s3371 :: SWord8 = if s2874 then s3370 else s3369 s3372 :: SWord8 = s18 + s3371 s3373 :: SWord8 = if s253 then s3372 else s3371 s3374 :: SWord8 = s18 + s3373 s3375 :: SWord8 = if s248 then s3374 else s3373 s3376 :: SWord8 = s18 + s3375 s3377 :: SWord8 = if s243 then s3376 else s3375 s3378 :: SWord8 = s18 + s3377 s3379 :: SWord8 = if s238 then s3378 else s3377 s3380 :: SWord8 = s18 + s3379 s3381 :: SWord8 = if s233 then s3380 else s3379 s3382 :: SWord8 = s18 + s3381 s3383 :: SWord8 = if s228 then s3382 else s3381 s3384 :: SWord8 = s18 + s3383 s3385 :: SWord8 = if s223 then s3384 else s3383 s3386 :: SWord8 = s18 + s3385 s3387 :: SWord8 = if s218 then s3386 else s3385 s3388 :: SWord8 = s18 + s3387 s3389 :: SWord8 = if s213 then s3388 else s3387 s3390 :: SWord8 = s18 + s3389 s3391 :: SWord8 = if s208 then s3390 else s3389 s3392 :: SWord8 = s18 + s3391 s3393 :: SWord8 = if s203 then s3392 else s3391 s3394 :: SWord8 = s18 + s3393 s3395 :: SWord8 = if s198 then s3394 else s3393 s3396 :: SWord8 = s18 + s3395 s3397 :: SWord8 = if s193 then s3396 else s3395 s3398 :: SWord8 = s18 + s3397 s3399 :: SWord8 = if s188 then s3398 else s3397 s3400 :: SWord8 = s18 + s3399 s3401 :: SWord8 = if s183 then s3400 else s3399 s3402 :: SWord8 = s18 + s3401 s3403 :: SWord8 = if s178 then s3402 else s3401 s3404 :: SWord8 = s18 + s3403 s3405 :: SWord8 = if s173 then s3404 else s3403 s3406 :: SWord8 = s18 + s3405 s3407 :: SWord8 = if s168 then s3406 else s3405 s3408 :: SWord8 = s18 + s3407 s3409 :: SWord8 = if s163 then s3408 else s3407 s3410 :: SWord8 = s18 + s3409 s3411 :: SWord8 = if s158 then s3410 else s3409 s3412 :: SWord8 = s18 + s3411 s3413 :: SWord8 = if s153 then s3412 else s3411 s3414 :: SWord8 = s18 + s3413 s3415 :: SWord8 = if s148 then s3414 else s3413 s3416 :: SWord8 = s18 + s3415 s3417 :: SWord8 = if s143 then s3416 else s3415 s3418 :: SWord8 = s18 + s3417 s3419 :: SWord8 = if s138 then s3418 else s3417 s3420 :: SWord8 = s18 + s3419 s3421 :: SWord8 = if s133 then s3420 else s3419 s3422 :: SWord8 = s18 + s3421 s3423 :: SWord8 = if s128 then s3422 else s3421 s3424 :: SWord8 = s18 + s3423 s3425 :: SWord8 = if s123 then s3424 else s3423 s3426 :: SWord8 = s18 + s3425 s3427 :: SWord8 = if s118 then s3426 else s3425 s3428 :: SWord8 = s18 + s3427 s3429 :: SWord8 = if s113 then s3428 else s3427 s3430 :: SWord8 = s18 + s3429 s3431 :: SWord8 = if s108 then s3430 else s3429 s3432 :: SWord8 = s18 + s3431 s3433 :: SWord8 = if s103 then s3432 else s3431 s3434 :: SWord8 = s18 + s3433 s3435 :: SWord8 = if s98 then s3434 else s3433 s3436 :: SWord8 = s18 + s3435 s3437 :: SWord8 = if s93 then s3436 else s3435 s3438 :: SWord8 = s18 + s3437 s3439 :: SWord8 = if s88 then s3438 else s3437 s3440 :: SWord8 = s18 + s3439 s3441 :: SWord8 = if s83 then s3440 else s3439 s3442 :: SWord8 = s18 + s3441 s3443 :: SWord8 = if s78 then s3442 else s3441 s3444 :: SWord8 = s18 + s3443 s3445 :: SWord8 = if s73 then s3444 else s3443 s3446 :: SWord8 = s18 + s3445 s3447 :: SWord8 = if s68 then s3446 else s3445 s3448 :: SWord8 = s18 + s3447 s3449 :: SWord8 = if s63 then s3448 else s3447 s3450 :: SWord8 = s18 + s3449 s3451 :: SWord8 = if s58 then s3450 else s3449 s3452 :: SWord8 = s18 + s3451 s3453 :: SWord8 = if s53 then s3452 else s3451 s3454 :: SWord8 = s18 + s3453 s3455 :: SWord8 = if s48 then s3454 else s3453 s3456 :: SWord8 = s18 + s3455 s3457 :: SWord8 = if s43 then s3456 else s3455 s3458 :: SWord8 = s18 + s3457 s3459 :: SWord8 = if s38 then s3458 else s3457 s3460 :: SWord8 = s18 + s3459 s3461 :: SWord8 = if s33 then s3460 else s3459 s3462 :: SWord8 = s18 + s3461 s3463 :: SWord8 = if s28 then s3462 else s3461 s3464 :: SWord8 = s18 + s3463 s3465 :: SWord8 = if s23 then s3464 else s3463 s3466 :: SWord8 = s18 + s3465 s3467 :: SWord8 = if s17 then s3466 else s3465 s3469 :: SBool = s3467 >= s3468 s3470 :: SBool = s12 | s3469 s3471 :: SBool = s7 & s3470 CONSTRAINTS ASSERTIONS OUTPUTS s3471sbv-7.13/SBVTestSuite/GoldFiles/crcUSB5_1.gold0000644000000000000000000001222113405536617017105 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for crcUSB5. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: crcUSB5_driver crcUSB5.o: crcUSB5.c crcUSB5.h ${CC} ${CCFLAGS} -c $< -o $@ crcUSB5_driver.o: crcUSB5_driver.c ${CC} ${CCFLAGS} -c $< -o $@ crcUSB5_driver: crcUSB5.o crcUSB5_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f crcUSB5_driver == END: "Makefile" ================== == BEGIN: "crcUSB5.h" ================ /* Header file for crcUSB5. Automatically generated by SBV. Do not edit! */ #ifndef __crcUSB5__HEADER_INCLUDED__ #define __crcUSB5__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ SWord16 crcUSB5(const SWord16 msg); #endif /* __crcUSB5__HEADER_INCLUDED__ */ == END: "crcUSB5.h" ================== == BEGIN: "crcUSB5_driver.c" ================ /* Example driver program for crcUSB5. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "crcUSB5.h" int main(void) { const SWord16 __result = crcUSB5(0xfedcU); printf("crcUSB5(0xfedcU) = 0x%04"PRIx16"U\n", __result); return 0; } == END: "crcUSB5_driver.c" ================== == BEGIN: "crcUSB5.c" ================ /* File: "crcUSB5.c". Automatically generated by SBV. Do not edit! */ #include "crcUSB5.h" SWord16 crcUSB5(const SWord16 msg) { const SWord16 s0 = msg; const SBool s1 = (SBool) ((s0 >> 10) & 1); const SBool s3 = s1 != false; const SBool s4 = (SBool) ((s0 >> 9) & 1); const SBool s5 = false != s4; const SBool s6 = (SBool) ((s0 >> 8) & 1); const SBool s7 = false != s6; const SBool s8 = (SBool) ((s0 >> 7) & 1); const SBool s9 = false != s8; const SBool s10 = (SBool) ((s0 >> 6) & 1); const SBool s11 = false != s10; const SBool s12 = (SBool) ((s0 >> 5) & 1); const SBool s13 = false != s12; const SBool s14 = (SBool) ((s0 >> 4) & 1); const SBool s15 = false != s14; const SBool s16 = (SBool) ((s0 >> 3) & 1); const SBool s17 = false != s16; const SBool s18 = (SBool) ((s0 >> 2) & 1); const SBool s19 = false != s18; const SBool s20 = (SBool) ((s0 >> 1) & 1); const SBool s21 = false != s20; const SBool s22 = (SBool) (s0 & 1); const SBool s23 = false != s22; const SBool s24 = !s9; const SBool s25 = s3 ? s24 : s9; const SBool s26 = !s11; const SBool s27 = s5 ? s26 : s11; const SBool s28 = !s13; const SBool s29 = s3 ? s28 : s13; const SBool s30 = !s29; const SBool s31 = s7 ? s30 : s29; const SBool s32 = !s15; const SBool s33 = s5 ? s32 : s15; const SBool s34 = !s33; const SBool s35 = s25 ? s34 : s33; const SBool s36 = !s17; const SBool s37 = s7 ? s36 : s17; const SBool s38 = !s37; const SBool s39 = s27 ? s38 : s37; const SBool s40 = !s19; const SBool s41 = s25 ? s40 : s19; const SBool s42 = !s41; const SBool s43 = s31 ? s42 : s41; const SBool s44 = !s21; const SBool s45 = s27 ? s44 : s21; const SBool s46 = !s45; const SBool s47 = s35 ? s46 : s45; const SBool s48 = !s23; const SBool s49 = s31 ? s48 : s23; const SBool s50 = !s49; const SBool s51 = s39 ? s50 : s49; const SBool s52 = !s35; const SBool s53 = s43 ? s52 : s35; const SBool s54 = !s39; const SBool s55 = s47 ? s54 : s39; const SBool s56 = !s43; const SBool s57 = s51 ? s56 : s43; const SWord16 s60 = s51 ? 0x0001U : 0x0000U; const SWord16 s62 = s60 | 0x0002U; const SWord16 s63 = s47 ? s62 : s60; const SWord16 s65 = s63 | 0x0004U; const SWord16 s66 = s57 ? s65 : s63; const SWord16 s68 = s66 | 0x0008U; const SWord16 s69 = s55 ? s68 : s66; const SWord16 s71 = s69 | 0x0010U; const SWord16 s72 = s53 ? s71 : s69; const SWord16 s74 = s72 | 0x0020U; const SWord16 s75 = s23 ? s74 : s72; const SWord16 s77 = s75 | 0x0040U; const SWord16 s78 = s21 ? s77 : s75; const SWord16 s80 = s78 | 0x0080U; const SWord16 s81 = s19 ? s80 : s78; const SWord16 s83 = s81 | 0x0100U; const SWord16 s84 = s17 ? s83 : s81; const SWord16 s86 = s84 | 0x0200U; const SWord16 s87 = s15 ? s86 : s84; const SWord16 s89 = s87 | 0x0400U; const SWord16 s90 = s13 ? s89 : s87; const SWord16 s92 = s90 | 0x0800U; const SWord16 s93 = s11 ? s92 : s90; const SWord16 s95 = s93 | 0x1000U; const SWord16 s96 = s9 ? s95 : s93; const SWord16 s98 = s96 | 0x2000U; const SWord16 s99 = s7 ? s98 : s96; const SWord16 s101 = s99 | 0x4000U; const SWord16 s102 = s5 ? s101 : s99; const SWord16 s104 = s102 | 0x8000U; const SWord16 s105 = s3 ? s104 : s102; return s105; } == END: "crcUSB5.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/crcUSB5_2.gold0000644000000000000000000001535513405536617017121 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for crcUSB5. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: crcUSB5_driver crcUSB5.o: crcUSB5.c crcUSB5.h ${CC} ${CCFLAGS} -c $< -o $@ crcUSB5_driver.o: crcUSB5_driver.c ${CC} ${CCFLAGS} -c $< -o $@ crcUSB5_driver: crcUSB5.o crcUSB5_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f crcUSB5_driver == END: "Makefile" ================== == BEGIN: "crcUSB5.h" ================ /* Header file for crcUSB5. Automatically generated by SBV. Do not edit! */ #ifndef __crcUSB5__HEADER_INCLUDED__ #define __crcUSB5__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ SWord16 crcUSB5(const SWord16 msg); #endif /* __crcUSB5__HEADER_INCLUDED__ */ == END: "crcUSB5.h" ================== == BEGIN: "crcUSB5_driver.c" ================ /* Example driver program for crcUSB5. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "crcUSB5.h" int main(void) { const SWord16 __result = crcUSB5(0xfedcU); printf("crcUSB5(0xfedcU) = 0x%04"PRIx16"U\n", __result); return 0; } == END: "crcUSB5_driver.c" ================== == BEGIN: "crcUSB5.c" ================ /* File: "crcUSB5.c". Automatically generated by SBV. Do not edit! */ #include "crcUSB5.h" SWord16 crcUSB5(const SWord16 msg) { const SWord16 s0 = msg; const SWord16 s2 = s0 << 5; const SBool s3 = (SBool) ((s2 >> 15) & 1); const SBool s5 = s3 != false; const SBool s6 = (SBool) ((s2 >> 14) & 1); const SBool s7 = false != s6; const SBool s8 = (SBool) ((s2 >> 13) & 1); const SBool s9 = false != s8; const SBool s10 = (SBool) ((s2 >> 12) & 1); const SBool s11 = false != s10; const SBool s12 = !s11; const SBool s13 = s5 ? s12 : s11; const SBool s14 = (SBool) ((s2 >> 11) & 1); const SBool s15 = false != s14; const SBool s16 = !s15; const SBool s17 = s7 ? s16 : s15; const SBool s18 = (SBool) ((s2 >> 10) & 1); const SBool s19 = false != s18; const SBool s20 = !s19; const SBool s21 = s5 ? s20 : s19; const SBool s22 = !s21; const SBool s23 = s9 ? s22 : s21; const SBool s24 = (SBool) ((s2 >> 9) & 1); const SBool s25 = false != s24; const SBool s26 = !s25; const SBool s27 = s7 ? s26 : s25; const SBool s28 = !s27; const SBool s29 = s13 ? s28 : s27; const SBool s30 = (SBool) ((s2 >> 8) & 1); const SBool s31 = false != s30; const SBool s32 = !s31; const SBool s33 = s9 ? s32 : s31; const SBool s34 = !s33; const SBool s35 = s17 ? s34 : s33; const SBool s36 = (SBool) ((s2 >> 7) & 1); const SBool s37 = false != s36; const SBool s38 = !s37; const SBool s39 = s13 ? s38 : s37; const SBool s40 = !s39; const SBool s41 = s23 ? s40 : s39; const SBool s42 = (SBool) ((s2 >> 6) & 1); const SBool s43 = false != s42; const SBool s44 = !s43; const SBool s45 = s17 ? s44 : s43; const SBool s46 = !s45; const SBool s47 = s29 ? s46 : s45; const SBool s48 = (SBool) ((s2 >> 5) & 1); const SBool s49 = false != s48; const SBool s50 = !s49; const SBool s51 = s23 ? s50 : s49; const SBool s52 = !s51; const SBool s53 = s35 ? s52 : s51; const SBool s54 = !s5; const SBool s55 = s5 ? s54 : s5; const SBool s56 = !s7; const SBool s57 = s7 ? s56 : s7; const SBool s58 = !s9; const SBool s59 = s9 ? s58 : s9; const SBool s60 = !s13; const SBool s61 = s13 ? s60 : s13; const SBool s62 = !s17; const SBool s63 = s17 ? s62 : s17; const SBool s64 = !s23; const SBool s65 = s23 ? s64 : s23; const SBool s66 = !s29; const SBool s67 = s29 ? s66 : s29; const SBool s68 = !s35; const SBool s69 = s35 ? s68 : s35; const SBool s70 = !s41; const SBool s71 = s41 ? s70 : s41; const SBool s72 = !s47; const SBool s73 = s47 ? s72 : s47; const SBool s74 = !s53; const SBool s75 = s53 ? s74 : s53; const SBool s76 = (SBool) ((s2 >> 4) & 1); const SBool s77 = false != s76; const SBool s78 = !s77; const SBool s79 = s29 ? s78 : s77; const SBool s80 = !s79; const SBool s81 = s41 ? s80 : s79; const SBool s82 = (SBool) ((s2 >> 3) & 1); const SBool s83 = false != s82; const SBool s84 = !s83; const SBool s85 = s35 ? s84 : s83; const SBool s86 = !s85; const SBool s87 = s47 ? s86 : s85; const SBool s88 = (SBool) ((s2 >> 2) & 1); const SBool s89 = false != s88; const SBool s90 = !s89; const SBool s91 = s41 ? s90 : s89; const SBool s92 = !s91; const SBool s93 = s53 ? s92 : s91; const SBool s94 = (SBool) ((s2 >> 1) & 1); const SBool s95 = false != s94; const SBool s96 = !s95; const SBool s97 = s47 ? s96 : s95; const SBool s98 = (SBool) (s2 & 1); const SBool s99 = false != s98; const SBool s100 = !s99; const SBool s101 = s53 ? s100 : s99; const SWord16 s104 = s101 ? 0x0001U : 0x0000U; const SWord16 s106 = s104 | 0x0002U; const SWord16 s107 = s97 ? s106 : s104; const SWord16 s109 = s107 | 0x0004U; const SWord16 s110 = s93 ? s109 : s107; const SWord16 s112 = s110 | 0x0008U; const SWord16 s113 = s87 ? s112 : s110; const SWord16 s115 = s113 | 0x0010U; const SWord16 s116 = s81 ? s115 : s113; const SWord16 s118 = s116 | 0x0020U; const SWord16 s119 = s75 ? s118 : s116; const SWord16 s121 = s119 | 0x0040U; const SWord16 s122 = s73 ? s121 : s119; const SWord16 s124 = s122 | 0x0080U; const SWord16 s125 = s71 ? s124 : s122; const SWord16 s127 = s125 | 0x0100U; const SWord16 s128 = s69 ? s127 : s125; const SWord16 s130 = s128 | 0x0200U; const SWord16 s131 = s67 ? s130 : s128; const SWord16 s133 = s131 | 0x0400U; const SWord16 s134 = s65 ? s133 : s131; const SWord16 s136 = s134 | 0x0800U; const SWord16 s137 = s63 ? s136 : s134; const SWord16 s139 = s137 | 0x1000U; const SWord16 s140 = s61 ? s139 : s137; const SWord16 s142 = s140 | 0x2000U; const SWord16 s143 = s59 ? s142 : s140; const SWord16 s145 = s143 | 0x4000U; const SWord16 s146 = s57 ? s145 : s143; const SWord16 s148 = s146 | 0x8000U; const SWord16 s149 = s55 ? s148 : s146; const SWord16 s150 = s2 | s149; return s150; } == END: "crcUSB5.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/dogCatMouse.gold0000644000000000000000000000015713405536617017676 0ustar0000000000000000Solution #1: dog = 3 :: Integer cat = 41 :: Integer mouse = 56 :: Integer This is the only solution.sbv-7.13/SBVTestSuite/GoldFiles/euler185.gold0000644000000000000000000000052713405536617017037 0ustar0000000000000000Solution #1: s0 = 4 :: Word8 s1 = 6 :: Word8 s2 = 4 :: Word8 s3 = 0 :: Word8 s4 = 2 :: Word8 s5 = 6 :: Word8 s6 = 1 :: Word8 s7 = 5 :: Word8 s8 = 7 :: Word8 s9 = 1 :: Word8 s10 = 8 :: Word8 s11 = 4 :: Word8 s12 = 9 :: Word8 s13 = 5 :: Word8 s14 = 3 :: Word8 s15 = 3 :: Word8 This is the only solution.sbv-7.13/SBVTestSuite/GoldFiles/exceptionLocal1.gold0000644000000000000000000000636413405536617020524 0ustar0000000000000000** Calling: yices-smt2 --incremental [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) ** Backend solver Yices does not support global decls. ** Some incremental calls, such as pop, will be limited. [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 1) #b0) [GOOD] (define-fun s68 () (_ BitVec 32) #x00000001) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 32)) ; tracks user variable "x" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s1 () (_ BitVec 1) ((_ extract 0 0) s0)) [GOOD] (define-fun s3 () Bool (distinct s1 s2)) [GOOD] (define-fun s4 () Bool (not s3)) [GOOD] (define-fun s5 () (_ BitVec 32) (bvmul s0 s0)) [GOOD] (define-fun s6 () (_ BitVec 32) (bvmul s5 s5)) [GOOD] (define-fun s7 () (_ BitVec 32) (bvmul s6 s6)) [GOOD] (define-fun s8 () (_ BitVec 32) (bvmul s7 s7)) [GOOD] (define-fun s9 () (_ BitVec 32) (bvmul s8 s8)) [GOOD] (define-fun s10 () (_ BitVec 32) (bvmul s9 s9)) [GOOD] (define-fun s11 () (_ BitVec 32) (bvmul s10 s10)) [GOOD] (define-fun s12 () (_ BitVec 32) (bvmul s11 s11)) [GOOD] (define-fun s13 () (_ BitVec 32) (bvmul s12 s12)) [GOOD] (define-fun s14 () (_ BitVec 32) (bvmul s13 s13)) [GOOD] (define-fun s15 () (_ BitVec 32) (bvmul s14 s14)) [GOOD] (define-fun s16 () (_ BitVec 32) (bvmul s15 s15)) [GOOD] (define-fun s17 () (_ BitVec 32) (bvmul s16 s16)) [GOOD] (define-fun s18 () (_ BitVec 32) (bvmul s17 s17)) [GOOD] (define-fun s19 () (_ BitVec 32) (bvmul s18 s18)) [GOOD] (define-fun s20 () (_ BitVec 32) (bvmul s19 s19)) [GOOD] (define-fun s21 () (_ BitVec 32) (bvmul s20 s20)) [GOOD] (define-fun s22 () (_ BitVec 32) (bvmul s21 s21)) [GOOD] (define-fun s23 () (_ BitVec 32) (bvmul s22 s22)) [GOOD] (define-fun s24 () (_ BitVec 32) (bvmul s23 s23)) [GOOD] (define-fun s25 () (_ BitVec 32) (bvmul s24 s24)) [GOOD] (define-fun s26 () (_ BitVec 32) (bvmul s25 s25)) [GOOD] (define-fun s27 () (_ BitVec 32) (bvmul s26 s26)) [GOOD] (define-fun s28 () (_ BitVec 32) (bvmul s27 s27)) [GOOD] (define-fun s29 () (_ BitVec 32) (bvmul s28 s28)) [GOOD] (define-fun s30 () (_ BitVec 32) (bvmul s29 s29)) [GOOD] (define-fun s31 () (_ BitVec 32) (bvmul s30 s30)) [GOOD] (define-fun s32 () (_ BitVec 32) (bvmul s31 s31)) [GOOD] (define-fun s33 () (_ BitVec 32) (bvmul s32 s32)) [GOOD] (define-fun s34 () (_ BitVec 32) (bvmul s33 s33)) [FAIL] (define-fun s35 () (_ BitVec 32) (bvmul s34 s34)) CAUGHT SMT EXCEPTION *** Data.SBV: Unexpected non-success response from Yices: *** *** Sent : (define-fun s35 () (_ BitVec 32) (bvmul s34 s34)) *** Expected : success *** Received : (error "at line 42, column 35: in bvmul: maximal polynomial degree exceeded") *** *** Exit code : ExitSuccess *** Executable: /usr/local/bin/yices-smt2 *** Options : --incremental *** *** Reason : Check solver response for further information. If your code is correct, *** please report this as an issue either with SBV or the solver itself! sbv-7.13/SBVTestSuite/GoldFiles/exceptionLocal2.gold0000644000000000000000000000224613405536617020520 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_LIA) ; NB. User specified. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s1 () Real (/ 2.0 1.0)) [GOOD] ; --- skolem constants --- [FAIL] (declare-fun s0 () Real) ; tracks user variable "x" CAUGHT SMT EXCEPTION *** Data.SBV: Unexpected non-success response from Z3: *** *** Sent : (declare-fun s0 () Real) ; tracks user variable "x" *** Expected : success *** Received : (error "line 10 column 23: logic does not support reals") *** *** Exit code : ExitFailure (-15) *** Executable: /usr/local/bin/z3 *** Options : -nw -in -smt2 *** *** Reason : Check solver response for further information. If your code is correct, *** please report this as an issue either with SBV or the solver itself! sbv-7.13/SBVTestSuite/GoldFiles/exceptionRemote1.gold0000644000000000000000000000012113405536617020706 0ustar0000000000000000 FINAL: "OK, we got: Unexpected response from the solver, context: assert" DONE! sbv-7.13/SBVTestSuite/GoldFiles/fib1.gold0000644000000000000000000002160313405536617016304 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for fib1. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: fib1_driver fib1.o: fib1.c fib1.h ${CC} ${CCFLAGS} -c $< -o $@ fib1_driver.o: fib1_driver.c ${CC} ${CCFLAGS} -c $< -o $@ fib1_driver: fib1.o fib1_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f fib1_driver == END: "Makefile" ================== == BEGIN: "fib1.h" ================ /* Header file for fib1. Automatically generated by SBV. Do not edit! */ #ifndef __fib1__HEADER_INCLUDED__ #define __fib1__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ SWord64 fib1(const SWord64 n); #endif /* __fib1__HEADER_INCLUDED__ */ == END: "fib1.h" ================== == BEGIN: "fib1_driver.c" ================ /* Example driver program for fib1. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "fib1.h" int main(void) { const SWord64 __result = fib1(0x000000000000000cULL); printf("fib1(0x000000000000000cULL) = 0x%016"PRIx64"ULL\n", __result); return 0; } == END: "fib1_driver.c" ================== == BEGIN: "fib1.c" ================ /* File: "fib1.c". Automatically generated by SBV. Do not edit! */ #include "fib1.h" SWord64 fib1(const SWord64 n) { const SWord64 s0 = n; const SBool s2 = s0 == 0x0000000000000000ULL; const SBool s4 = s0 == 0x0000000000000001ULL; const SBool s6 = s0 == 0x0000000000000002ULL; const SBool s8 = s0 == 0x0000000000000003ULL; const SBool s10 = s0 == 0x0000000000000004ULL; const SBool s12 = s0 == 0x0000000000000005ULL; const SBool s14 = s0 == 0x0000000000000006ULL; const SBool s17 = s0 == 0x0000000000000007ULL; const SBool s19 = s0 == 0x0000000000000008ULL; const SBool s22 = s0 == 0x0000000000000009ULL; const SBool s25 = s0 == 0x000000000000000aULL; const SBool s28 = s0 == 0x000000000000000bULL; const SBool s31 = s0 == 0x000000000000000cULL; const SBool s33 = s0 == 0x000000000000000dULL; const SBool s36 = s0 == 0x000000000000000eULL; const SBool s39 = s0 == 0x000000000000000fULL; const SBool s42 = s0 == 0x0000000000000010ULL; const SBool s45 = s0 == 0x0000000000000011ULL; const SBool s48 = s0 == 0x0000000000000012ULL; const SBool s51 = s0 == 0x0000000000000013ULL; const SBool s54 = s0 == 0x0000000000000014ULL; const SBool s56 = s0 == 0x0000000000000015ULL; const SBool s59 = s0 == 0x0000000000000016ULL; const SBool s62 = s0 == 0x0000000000000017ULL; const SBool s65 = s0 == 0x0000000000000018ULL; const SBool s68 = s0 == 0x0000000000000019ULL; const SBool s71 = s0 == 0x000000000000001aULL; const SBool s74 = s0 == 0x000000000000001bULL; const SBool s77 = s0 == 0x000000000000001cULL; const SBool s80 = s0 == 0x000000000000001dULL; const SBool s83 = s0 == 0x000000000000001eULL; const SBool s86 = s0 == 0x000000000000001fULL; const SBool s89 = s0 == 0x0000000000000020ULL; const SBool s92 = s0 == 0x0000000000000021ULL; const SBool s94 = s0 == 0x0000000000000022ULL; const SBool s97 = s0 == 0x0000000000000023ULL; const SBool s100 = s0 == 0x0000000000000024ULL; const SBool s103 = s0 == 0x0000000000000025ULL; const SBool s106 = s0 == 0x0000000000000026ULL; const SBool s109 = s0 == 0x0000000000000027ULL; const SBool s112 = s0 == 0x0000000000000028ULL; const SBool s115 = s0 == 0x0000000000000029ULL; const SBool s118 = s0 == 0x000000000000002aULL; const SBool s121 = s0 == 0x000000000000002bULL; const SBool s124 = s0 == 0x000000000000002cULL; const SBool s127 = s0 == 0x000000000000002dULL; const SBool s130 = s0 == 0x000000000000002eULL; const SBool s133 = s0 == 0x000000000000002fULL; const SBool s136 = s0 == 0x0000000000000030ULL; const SBool s139 = s0 == 0x0000000000000031ULL; const SBool s142 = s0 == 0x0000000000000032ULL; const SBool s145 = s0 == 0x0000000000000033ULL; const SBool s148 = s0 == 0x0000000000000034ULL; const SBool s151 = s0 == 0x0000000000000035ULL; const SBool s154 = s0 == 0x0000000000000036ULL; const SBool s156 = s0 == 0x0000000000000037ULL; const SBool s159 = s0 == 0x0000000000000038ULL; const SBool s162 = s0 == 0x0000000000000039ULL; const SBool s165 = s0 == 0x000000000000003aULL; const SBool s168 = s0 == 0x000000000000003bULL; const SBool s171 = s0 == 0x000000000000003cULL; const SBool s174 = s0 == 0x000000000000003dULL; const SBool s177 = s0 == 0x000000000000003eULL; const SBool s180 = s0 == 0x000000000000003fULL; const SWord64 s183 = s180 ? 0x000005f6c7b064e2ULL : 0x000009a661ca20bbULL; const SWord64 s184 = s177 ? 0x000003af9a19bbd9ULL : s183; const SWord64 s185 = s174 ? 0x000002472d96a909ULL : s184; const SWord64 s186 = s171 ? 0x000001686c8312d0ULL : s185; const SWord64 s187 = s168 ? 0x000000dec1139639ULL : s186; const SWord64 s188 = s165 ? 0x00000089ab6f7c97ULL : s187; const SWord64 s189 = s162 ? 0x0000005515a419a2ULL : s188; const SWord64 s190 = s159 ? 0x0000003495cb62f5ULL : s189; const SWord64 s191 = s156 ? 0x000000207fd8b6adULL : s190; const SWord64 s192 = s154 ? 0x0000001415f2ac48ULL : s191; const SWord64 s193 = s151 ? 0x0000000c69e60a65ULL : s192; const SWord64 s194 = s148 ? 0x00000007ac0ca1e3ULL : s193; const SWord64 s195 = s145 ? 0x00000004bdd96882ULL : s194; const SWord64 s196 = s142 ? 0x00000002ee333961ULL : s195; const SWord64 s197 = s139 ? 0x00000001cfa62f21ULL : s196; const SWord64 s198 = s136 ? 0x000000011e8d0a40ULL : s197; const SWord64 s199 = s133 ? 0x00000000b11924e1ULL : s198; const SWord64 s200 = s130 ? 0x000000006d73e55fULL : s199; const SWord64 s201 = s127 ? 0x0000000043a53f82ULL : s200; const SWord64 s202 = s124 ? 0x0000000029cea5ddULL : s201; const SWord64 s203 = s121 ? 0x0000000019d699a5ULL : s202; const SWord64 s204 = s118 ? 0x000000000ff80c38ULL : s203; const SWord64 s205 = s115 ? 0x0000000009de8d6dULL : s204; const SWord64 s206 = s112 ? 0x0000000006197ecbULL : s205; const SWord64 s207 = s109 ? 0x0000000003c50ea2ULL : s206; const SWord64 s208 = s106 ? 0x0000000002547029ULL : s207; const SWord64 s209 = s103 ? 0x0000000001709e79ULL : s208; const SWord64 s210 = s100 ? 0x0000000000e3d1b0ULL : s209; const SWord64 s211 = s97 ? 0x00000000008cccc9ULL : s210; const SWord64 s212 = s94 ? 0x00000000005704e7ULL : s211; const SWord64 s213 = s92 ? 0x000000000035c7e2ULL : s212; const SWord64 s214 = s89 ? 0x0000000000213d05ULL : s213; const SWord64 s215 = s86 ? 0x0000000000148addULL : s214; const SWord64 s216 = s83 ? 0x00000000000cb228ULL : s215; const SWord64 s217 = s80 ? 0x000000000007d8b5ULL : s216; const SWord64 s218 = s77 ? 0x000000000004d973ULL : s217; const SWord64 s219 = s74 ? 0x000000000002ff42ULL : s218; const SWord64 s220 = s71 ? 0x000000000001da31ULL : s219; const SWord64 s221 = s68 ? 0x0000000000012511ULL : s220; const SWord64 s222 = s65 ? 0x000000000000b520ULL : s221; const SWord64 s223 = s62 ? 0x0000000000006ff1ULL : s222; const SWord64 s224 = s59 ? 0x000000000000452fULL : s223; const SWord64 s225 = s56 ? 0x0000000000002ac2ULL : s224; const SWord64 s226 = s54 ? 0x0000000000001a6dULL : s225; const SWord64 s227 = s51 ? 0x0000000000001055ULL : s226; const SWord64 s228 = s48 ? 0x0000000000000a18ULL : s227; const SWord64 s229 = s45 ? 0x000000000000063dULL : s228; const SWord64 s230 = s42 ? 0x00000000000003dbULL : s229; const SWord64 s231 = s39 ? 0x0000000000000262ULL : s230; const SWord64 s232 = s36 ? 0x0000000000000179ULL : s231; const SWord64 s233 = s33 ? 0x00000000000000e9ULL : s232; const SWord64 s234 = s31 ? 0x0000000000000090ULL : s233; const SWord64 s235 = s28 ? 0x0000000000000059ULL : s234; const SWord64 s236 = s25 ? 0x0000000000000037ULL : s235; const SWord64 s237 = s22 ? 0x0000000000000022ULL : s236; const SWord64 s238 = s19 ? 0x0000000000000015ULL : s237; const SWord64 s239 = s17 ? 0x000000000000000dULL : s238; const SWord64 s240 = s14 ? 0x0000000000000008ULL : s239; const SWord64 s241 = s12 ? 0x0000000000000005ULL : s240; const SWord64 s242 = s10 ? 0x0000000000000003ULL : s241; const SWord64 s243 = s8 ? 0x0000000000000002ULL : s242; const SWord64 s244 = s6 ? 0x0000000000000001ULL : s243; const SWord64 s245 = s4 ? 0x0000000000000001ULL : s244; const SWord64 s246 = s2 ? 0x0000000000000000ULL : s245; return s246; } == END: "fib1.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/fib2.gold0000644000000000000000000000730513405536617016310 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for fib2. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: fib2_driver fib2.o: fib2.c fib2.h ${CC} ${CCFLAGS} -c $< -o $@ fib2_driver.o: fib2_driver.c ${CC} ${CCFLAGS} -c $< -o $@ fib2_driver: fib2.o fib2_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f fib2_driver == END: "Makefile" ================== == BEGIN: "fib2.h" ================ /* Header file for fib2. Automatically generated by SBV. Do not edit! */ #ifndef __fib2__HEADER_INCLUDED__ #define __fib2__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ SWord64 fib2(const SWord64 n); #endif /* __fib2__HEADER_INCLUDED__ */ == END: "fib2.h" ================== == BEGIN: "fib2_driver.c" ================ /* Example driver program for fib2. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "fib2.h" int main(void) { const SWord64 __result = fib2(0x0000000000000014ULL); printf("fib2(0x0000000000000014ULL) = 0x%016"PRIx64"ULL\n", __result); return 0; } == END: "fib2_driver.c" ================== == BEGIN: "fib2.c" ================ /* File: "fib2.c". Automatically generated by SBV. Do not edit! */ #include "fib2.h" SWord64 fib2(const SWord64 n) { const SWord64 s0 = n; static const SWord64 table0[] = { 0x0000000000000000ULL, 0x0000000000000001ULL, 0x0000000000000001ULL, 0x0000000000000002ULL, 0x0000000000000003ULL, 0x0000000000000005ULL, 0x0000000000000008ULL, 0x000000000000000dULL, 0x0000000000000015ULL, 0x0000000000000022ULL, 0x0000000000000037ULL, 0x0000000000000059ULL, 0x0000000000000090ULL, 0x00000000000000e9ULL, 0x0000000000000179ULL, 0x0000000000000262ULL, 0x00000000000003dbULL, 0x000000000000063dULL, 0x0000000000000a18ULL, 0x0000000000001055ULL, 0x0000000000001a6dULL, 0x0000000000002ac2ULL, 0x000000000000452fULL, 0x0000000000006ff1ULL, 0x000000000000b520ULL, 0x0000000000012511ULL, 0x000000000001da31ULL, 0x000000000002ff42ULL, 0x000000000004d973ULL, 0x000000000007d8b5ULL, 0x00000000000cb228ULL, 0x0000000000148addULL, 0x0000000000213d05ULL, 0x000000000035c7e2ULL, 0x00000000005704e7ULL, 0x00000000008cccc9ULL, 0x0000000000e3d1b0ULL, 0x0000000001709e79ULL, 0x0000000002547029ULL, 0x0000000003c50ea2ULL, 0x0000000006197ecbULL, 0x0000000009de8d6dULL, 0x000000000ff80c38ULL, 0x0000000019d699a5ULL, 0x0000000029cea5ddULL, 0x0000000043a53f82ULL, 0x000000006d73e55fULL, 0x00000000b11924e1ULL, 0x000000011e8d0a40ULL, 0x00000001cfa62f21ULL, 0x00000002ee333961ULL, 0x00000004bdd96882ULL, 0x00000007ac0ca1e3ULL, 0x0000000c69e60a65ULL, 0x0000001415f2ac48ULL, 0x000000207fd8b6adULL, 0x0000003495cb62f5ULL, 0x0000005515a419a2ULL, 0x00000089ab6f7c97ULL, 0x000000dec1139639ULL, 0x000001686c8312d0ULL, 0x000002472d96a909ULL, 0x000003af9a19bbd9ULL, 0x000005f6c7b064e2ULL, 0x000009a661ca20bbULL }; const SWord64 s65 = s0 >= 65 ? 0x0000000000000000ULL : table0[s0]; return s65; } == END: "fib2.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/floats_cgen.gold0000644000000000000000000024040113405536617017746 0ustar0000000000000000== BEGIN: "toFP_Int8_ToFloat.c" ================ /* File: "toFP_Int8_ToFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat toFP_Int8_ToFloat(const SInt8 a) { const SInt8 s0 = a; const SFloat s2 = (SFloat) s0; return s2; } == END: "toFP_Int8_ToFloat.c" ================== == BEGIN: "toFP_Int16_ToFloat.c" ================ /* File: "toFP_Int16_ToFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat toFP_Int16_ToFloat(const SInt16 a) { const SInt16 s0 = a; const SFloat s2 = (SFloat) s0; return s2; } == END: "toFP_Int16_ToFloat.c" ================== == BEGIN: "toFP_Int32_ToFloat.c" ================ /* File: "toFP_Int32_ToFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat toFP_Int32_ToFloat(const SInt32 a) { const SInt32 s0 = a; const SFloat s2 = (SFloat) s0; return s2; } == END: "toFP_Int32_ToFloat.c" ================== == BEGIN: "toFP_Int64_ToFloat.c" ================ /* File: "toFP_Int64_ToFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat toFP_Int64_ToFloat(const SInt64 a) { const SInt64 s0 = a; const SFloat s2 = (SFloat) s0; return s2; } == END: "toFP_Int64_ToFloat.c" ================== == BEGIN: "toFP_Word8_ToFloat.c" ================ /* File: "toFP_Word8_ToFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat toFP_Word8_ToFloat(const SWord8 a) { const SWord8 s0 = a; const SFloat s2 = (SFloat) s0; return s2; } == END: "toFP_Word8_ToFloat.c" ================== == BEGIN: "toFP_Word16_ToFloat.c" ================ /* File: "toFP_Word16_ToFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat toFP_Word16_ToFloat(const SWord16 a) { const SWord16 s0 = a; const SFloat s2 = (SFloat) s0; return s2; } == END: "toFP_Word16_ToFloat.c" ================== == BEGIN: "toFP_Word32_ToFloat.c" ================ /* File: "toFP_Word32_ToFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat toFP_Word32_ToFloat(const SWord32 a) { const SWord32 s0 = a; const SFloat s2 = (SFloat) s0; return s2; } == END: "toFP_Word32_ToFloat.c" ================== == BEGIN: "toFP_Word64_ToFloat.c" ================ /* File: "toFP_Word64_ToFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat toFP_Word64_ToFloat(const SWord64 a) { const SWord64 s0 = a; const SFloat s2 = (SFloat) s0; return s2; } == END: "toFP_Word64_ToFloat.c" ================== == BEGIN: "toFP_Float_ToFloat.c" ================ /* File: "toFP_Float_ToFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat toFP_Float_ToFloat(const SFloat a) { const SFloat s0 = a; return s0; } == END: "toFP_Float_ToFloat.c" ================== == BEGIN: "toFP_Double_ToFloat.c" ================ /* File: "toFP_Double_ToFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat toFP_Double_ToFloat(const SDouble a) { const SDouble s0 = a; const SFloat s2 = (SFloat) s0; return s2; } == END: "toFP_Double_ToFloat.c" ================== == BEGIN: "toFP_Integer_ToFloat.c" ================ /* File: "toFP_Integer_ToFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat toFP_Integer_ToFloat(const SInteger a) { const SInteger s0 = a; const SFloat s2 = (SFloat) s0; return s2; } == END: "toFP_Integer_ToFloat.c" ================== == BEGIN: "toFP_Real_ToFloat.c" ================ /* File: "toFP_Real_ToFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat toFP_Real_ToFloat(const SReal a) { const SReal s0 = a; const SFloat s2 = (SFloat) s0; return s2; } == END: "toFP_Real_ToFloat.c" ================== == BEGIN: "toFP_Int8_ToDouble.c" ================ /* File: "toFP_Int8_ToDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble toFP_Int8_ToDouble(const SInt8 a) { const SInt8 s0 = a; const SDouble s2 = (SDouble) s0; return s2; } == END: "toFP_Int8_ToDouble.c" ================== == BEGIN: "toFP_Int16_ToDouble.c" ================ /* File: "toFP_Int16_ToDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble toFP_Int16_ToDouble(const SInt16 a) { const SInt16 s0 = a; const SDouble s2 = (SDouble) s0; return s2; } == END: "toFP_Int16_ToDouble.c" ================== == BEGIN: "toFP_Int32_ToDouble.c" ================ /* File: "toFP_Int32_ToDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble toFP_Int32_ToDouble(const SInt32 a) { const SInt32 s0 = a; const SDouble s2 = (SDouble) s0; return s2; } == END: "toFP_Int32_ToDouble.c" ================== == BEGIN: "toFP_Int64_ToDouble.c" ================ /* File: "toFP_Int64_ToDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble toFP_Int64_ToDouble(const SInt64 a) { const SInt64 s0 = a; const SDouble s2 = (SDouble) s0; return s2; } == END: "toFP_Int64_ToDouble.c" ================== == BEGIN: "toFP_Word8_ToDouble.c" ================ /* File: "toFP_Word8_ToDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble toFP_Word8_ToDouble(const SWord8 a) { const SWord8 s0 = a; const SDouble s2 = (SDouble) s0; return s2; } == END: "toFP_Word8_ToDouble.c" ================== == BEGIN: "toFP_Word16_ToDouble.c" ================ /* File: "toFP_Word16_ToDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble toFP_Word16_ToDouble(const SWord16 a) { const SWord16 s0 = a; const SDouble s2 = (SDouble) s0; return s2; } == END: "toFP_Word16_ToDouble.c" ================== == BEGIN: "toFP_Word32_ToDouble.c" ================ /* File: "toFP_Word32_ToDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble toFP_Word32_ToDouble(const SWord32 a) { const SWord32 s0 = a; const SDouble s2 = (SDouble) s0; return s2; } == END: "toFP_Word32_ToDouble.c" ================== == BEGIN: "toFP_Word64_ToDouble.c" ================ /* File: "toFP_Word64_ToDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble toFP_Word64_ToDouble(const SWord64 a) { const SWord64 s0 = a; const SDouble s2 = (SDouble) s0; return s2; } == END: "toFP_Word64_ToDouble.c" ================== == BEGIN: "toFP_Float_ToDouble.c" ================ /* File: "toFP_Float_ToDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble toFP_Float_ToDouble(const SFloat a) { const SFloat s0 = a; const SDouble s2 = (SDouble) s0; return s2; } == END: "toFP_Float_ToDouble.c" ================== == BEGIN: "toFP_Double_ToDouble.c" ================ /* File: "toFP_Double_ToDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble toFP_Double_ToDouble(const SDouble a) { const SDouble s0 = a; return s0; } == END: "toFP_Double_ToDouble.c" ================== == BEGIN: "toFP_Integer_ToDouble.c" ================ /* File: "toFP_Integer_ToDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble toFP_Integer_ToDouble(const SInteger a) { const SInteger s0 = a; const SDouble s2 = (SDouble) s0; return s2; } == END: "toFP_Integer_ToDouble.c" ================== == BEGIN: "toFP_Real_ToDouble.c" ================ /* File: "toFP_Real_ToDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble toFP_Real_ToDouble(const SReal a) { const SReal s0 = a; const SDouble s2 = (SDouble) s0; return s2; } == END: "toFP_Real_ToDouble.c" ================== == BEGIN: "fromFP_Float_ToInt8.c" ================ /* File: "fromFP_Float_ToInt8.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SInt8 fromFP_Float_ToInt8(const SFloat a) { const SFloat s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SInt8 s6 = (SInt8) s0; const SInt8 s8 = s4 ? s6 : 0; return s8; } == END: "fromFP_Float_ToInt8.c" ================== == BEGIN: "fromFP_Float_ToInt16.c" ================ /* File: "fromFP_Float_ToInt16.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SInt16 fromFP_Float_ToInt16(const SFloat a) { const SFloat s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SInt16 s6 = (SInt16) s0; const SInt16 s8 = s4 ? s6 : 0x0000; return s8; } == END: "fromFP_Float_ToInt16.c" ================== == BEGIN: "fromFP_Float_ToInt32.c" ================ /* File: "fromFP_Float_ToInt32.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SInt32 fromFP_Float_ToInt32(const SFloat a) { const SFloat s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SInt32 s6 = (SInt32) s0; const SInt32 s8 = s4 ? s6 : 0x00000000L; return s8; } == END: "fromFP_Float_ToInt32.c" ================== == BEGIN: "fromFP_Float_ToInt64.c" ================ /* File: "fromFP_Float_ToInt64.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SInt64 fromFP_Float_ToInt64(const SFloat a) { const SFloat s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SInt64 s6 = (SInt64) s0; const SInt64 s8 = s4 ? s6 : 0x0000000000000000LL; return s8; } == END: "fromFP_Float_ToInt64.c" ================== == BEGIN: "fromFP_Float_ToWord8.c" ================ /* File: "fromFP_Float_ToWord8.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SWord8 fromFP_Float_ToWord8(const SFloat a) { const SFloat s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SWord8 s6 = (!isnan(s0) && signbit(s0)) ? (- ((SWord8) fabsf(s0))) : ((SWord8) s0); const SWord8 s8 = s4 ? s6 : 0; return s8; } == END: "fromFP_Float_ToWord8.c" ================== == BEGIN: "fromFP_Float_ToWord16.c" ================ /* File: "fromFP_Float_ToWord16.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SWord16 fromFP_Float_ToWord16(const SFloat a) { const SFloat s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SWord16 s6 = (!isnan(s0) && signbit(s0)) ? (- ((SWord16) fabsf(s0))) : ((SWord16) s0); const SWord16 s8 = s4 ? s6 : 0x0000U; return s8; } == END: "fromFP_Float_ToWord16.c" ================== == BEGIN: "fromFP_Float_ToWord32.c" ================ /* File: "fromFP_Float_ToWord32.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SWord32 fromFP_Float_ToWord32(const SFloat a) { const SFloat s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SWord32 s6 = (!isnan(s0) && signbit(s0)) ? (- ((SWord32) fabsf(s0))) : ((SWord32) s0); const SWord32 s8 = s4 ? s6 : 0x00000000UL; return s8; } == END: "fromFP_Float_ToWord32.c" ================== == BEGIN: "fromFP_Float_ToWord64.c" ================ /* File: "fromFP_Float_ToWord64.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SWord64 fromFP_Float_ToWord64(const SFloat a) { const SFloat s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SWord64 s6 = (!isnan(s0) && signbit(s0)) ? (- ((SWord64) fabsf(s0))) : ((SWord64) s0); const SWord64 s8 = s4 ? s6 : 0x0000000000000000ULL; return s8; } == END: "fromFP_Float_ToWord64.c" ================== == BEGIN: "fromFP_Float_ToFloat.c" ================ /* File: "fromFP_Float_ToFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat fromFP_Float_ToFloat(const SFloat a) { const SFloat s0 = a; return s0; } == END: "fromFP_Float_ToFloat.c" ================== == BEGIN: "fromFP_Float_ToDouble.c" ================ /* File: "fromFP_Float_ToDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble fromFP_Float_ToDouble(const SFloat a) { const SFloat s0 = a; const SDouble s2 = (SDouble) s0; return s2; } == END: "fromFP_Float_ToDouble.c" ================== == BEGIN: "fromFP_Float_ToInteger.c" ================ /* File: "fromFP_Float_ToInteger.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SInteger fromFP_Float_ToInteger(const SFloat a) { const SFloat s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SInteger s6 = (SInteger) s0; const SInteger s8 = s4 ? s6 : 0x0000000000000000LL; return s8; } == END: "fromFP_Float_ToInteger.c" ================== == BEGIN: "fromFP_Float_ToReal.c" ================ /* File: "fromFP_Float_ToReal.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SReal fromFP_Float_ToReal(const SFloat a) { const SFloat s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SReal s6 = (SReal) s0; const SReal s8 = s4 ? s6 : 0.0L; return s8; } == END: "fromFP_Float_ToReal.c" ================== == BEGIN: "fromFP_DoubleTo_Int8.c" ================ /* File: "fromFP_DoubleTo_Int8.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SInt8 fromFP_DoubleTo_Int8(const SDouble a) { const SDouble s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SInt8 s6 = (SInt8) s0; const SInt8 s8 = s4 ? s6 : 0; return s8; } == END: "fromFP_DoubleTo_Int8.c" ================== == BEGIN: "fromFP_DoubleTo_Int16.c" ================ /* File: "fromFP_DoubleTo_Int16.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SInt16 fromFP_DoubleTo_Int16(const SDouble a) { const SDouble s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SInt16 s6 = (SInt16) s0; const SInt16 s8 = s4 ? s6 : 0x0000; return s8; } == END: "fromFP_DoubleTo_Int16.c" ================== == BEGIN: "fromFP_DoubleTo_Int32.c" ================ /* File: "fromFP_DoubleTo_Int32.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SInt32 fromFP_DoubleTo_Int32(const SDouble a) { const SDouble s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SInt32 s6 = (SInt32) s0; const SInt32 s8 = s4 ? s6 : 0x00000000L; return s8; } == END: "fromFP_DoubleTo_Int32.c" ================== == BEGIN: "fromFP_DoubleTo_Int64.c" ================ /* File: "fromFP_DoubleTo_Int64.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SInt64 fromFP_DoubleTo_Int64(const SDouble a) { const SDouble s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SInt64 s6 = (SInt64) s0; const SInt64 s8 = s4 ? s6 : 0x0000000000000000LL; return s8; } == END: "fromFP_DoubleTo_Int64.c" ================== == BEGIN: "fromFP_DoubleTo_Word8.c" ================ /* File: "fromFP_DoubleTo_Word8.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SWord8 fromFP_DoubleTo_Word8(const SDouble a) { const SDouble s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SWord8 s6 = (!isnan(s0) && signbit(s0)) ? (- ((SWord8) fabs(s0))) : ((SWord8) s0); const SWord8 s8 = s4 ? s6 : 0; return s8; } == END: "fromFP_DoubleTo_Word8.c" ================== == BEGIN: "fromFP_DoubleTo_Word16.c" ================ /* File: "fromFP_DoubleTo_Word16.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SWord16 fromFP_DoubleTo_Word16(const SDouble a) { const SDouble s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SWord16 s6 = (!isnan(s0) && signbit(s0)) ? (- ((SWord16) fabs(s0))) : ((SWord16) s0); const SWord16 s8 = s4 ? s6 : 0x0000U; return s8; } == END: "fromFP_DoubleTo_Word16.c" ================== == BEGIN: "fromFP_DoubleTo_Word32.c" ================ /* File: "fromFP_DoubleTo_Word32.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SWord32 fromFP_DoubleTo_Word32(const SDouble a) { const SDouble s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SWord32 s6 = (!isnan(s0) && signbit(s0)) ? (- ((SWord32) fabs(s0))) : ((SWord32) s0); const SWord32 s8 = s4 ? s6 : 0x00000000UL; return s8; } == END: "fromFP_DoubleTo_Word32.c" ================== == BEGIN: "fromFP_DoubleTo_Word64.c" ================ /* File: "fromFP_DoubleTo_Word64.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SWord64 fromFP_DoubleTo_Word64(const SDouble a) { const SDouble s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SWord64 s6 = (!isnan(s0) && signbit(s0)) ? (- ((SWord64) fabs(s0))) : ((SWord64) s0); const SWord64 s8 = s4 ? s6 : 0x0000000000000000ULL; return s8; } == END: "fromFP_DoubleTo_Word64.c" ================== == BEGIN: "fromFP_DoubleTo_Float.c" ================ /* File: "fromFP_DoubleTo_Float.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat fromFP_DoubleTo_Float(const SDouble a) { const SDouble s0 = a; const SFloat s2 = (SFloat) s0; return s2; } == END: "fromFP_DoubleTo_Float.c" ================== == BEGIN: "fromFP_DoubleTo_Double.c" ================ /* File: "fromFP_DoubleTo_Double.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble fromFP_DoubleTo_Double(const SDouble a) { const SDouble s0 = a; return s0; } == END: "fromFP_DoubleTo_Double.c" ================== == BEGIN: "fromFP_DoubleTo_Integer.c" ================ /* File: "fromFP_DoubleTo_Integer.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SInteger fromFP_DoubleTo_Integer(const SDouble a) { const SDouble s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SInteger s6 = (SInteger) s0; const SInteger s8 = s4 ? s6 : 0x0000000000000000LL; return s8; } == END: "fromFP_DoubleTo_Integer.c" ================== == BEGIN: "fromFP_DoubleTo_Real.c" ================ /* File: "fromFP_DoubleTo_Real.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SReal fromFP_DoubleTo_Real(const SDouble a) { const SDouble s0 = a; const SBool s1 = isnan(s0); const SBool s2 = isinf(s0); const SBool s3 = s1 || s2; const SBool s4 = !s3; const SReal s6 = (SReal) s0; const SReal s8 = s4 ? s6 : 0.0L; return s8; } == END: "fromFP_DoubleTo_Real.c" ================== == BEGIN: "fromFP_SWord32_SFloat.c" ================ /* File: "fromFP_SWord32_SFloat.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat fromFP_SWord32_SFloat(const SWord32 a) { const SWord32 s0 = a; SFloat s1; memcpy(&s1, &s0, sizeof(SFloat)); return s1; } == END: "fromFP_SWord32_SFloat.c" ================== == BEGIN: "fromFP_SWord64_SDouble.c" ================ /* File: "fromFP_SWord64_SDouble.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble fromFP_SWord64_SDouble(const SWord64 a) { const SWord64 s0 = a; SDouble s1; memcpy(&s1, &s0, sizeof(SDouble)); return s1; } == END: "fromFP_SWord64_SDouble.c" ================== == BEGIN: "fromFP_SFloat_SWord32.c" ================ /* File: "fromFP_SFloat_SWord32.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SWord32 fromFP_SFloat_SWord32(const SFloat a) { const SFloat s0 = a; SWord32 s1; memcpy(&s1, &s0, sizeof(SWord32)); return s1; } == END: "fromFP_SFloat_SWord32.c" ================== == BEGIN: "fromFP_SDouble_SWord64.c" ================ /* File: "fromFP_SDouble_SWord64.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SWord64 fromFP_SDouble_SWord64(const SDouble a) { const SDouble s0 = a; SWord64 s1; memcpy(&s1, &s0, sizeof(SWord64)); return s1; } == END: "fromFP_SDouble_SWord64.c" ================== == BEGIN: "f_FP_Abs.c" ================ /* File: "f_FP_Abs.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat f_FP_Abs(const SFloat a) { const SFloat s0 = a; const SFloat s1 = fabsf(s0); return s1; } == END: "f_FP_Abs.c" ================== == BEGIN: "d_FP_Abs.c" ================ /* File: "d_FP_Abs.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble d_FP_Abs(const SDouble a) { const SDouble s0 = a; const SDouble s1 = fabs(s0); return s1; } == END: "d_FP_Abs.c" ================== == BEGIN: "f_FP_Neg.c" ================ /* File: "f_FP_Neg.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat f_FP_Neg(const SFloat a) { const SFloat s0 = a; const SFloat s1 = (- s0); return s1; } == END: "f_FP_Neg.c" ================== == BEGIN: "d_FP_Neg.c" ================ /* File: "d_FP_Neg.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble d_FP_Neg(const SDouble a) { const SDouble s0 = a; const SDouble s1 = (- s0); return s1; } == END: "d_FP_Neg.c" ================== == BEGIN: "f_FP_Add.c" ================ /* File: "f_FP_Add.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat f_FP_Add(const SFloat a, const SFloat b) { const SFloat s0 = a; const SFloat s1 = b; const SFloat s3 = s0 + s1; return s3; } == END: "f_FP_Add.c" ================== == BEGIN: "d_FP_Add.c" ================ /* File: "d_FP_Add.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble d_FP_Add(const SDouble a, const SDouble b) { const SDouble s0 = a; const SDouble s1 = b; const SDouble s3 = s0 + s1; return s3; } == END: "d_FP_Add.c" ================== == BEGIN: "f_FP_Sub.c" ================ /* File: "f_FP_Sub.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat f_FP_Sub(const SFloat a, const SFloat b) { const SFloat s0 = a; const SFloat s1 = b; const SFloat s3 = s0 - s1; return s3; } == END: "f_FP_Sub.c" ================== == BEGIN: "d_FP_Sub.c" ================ /* File: "d_FP_Sub.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble d_FP_Sub(const SDouble a, const SDouble b) { const SDouble s0 = a; const SDouble s1 = b; const SDouble s3 = s0 - s1; return s3; } == END: "d_FP_Sub.c" ================== == BEGIN: "f_FP_Mul.c" ================ /* File: "f_FP_Mul.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat f_FP_Mul(const SFloat a, const SFloat b) { const SFloat s0 = a; const SFloat s1 = b; const SFloat s3 = s0 * s1; return s3; } == END: "f_FP_Mul.c" ================== == BEGIN: "d_FP_Mul.c" ================ /* File: "d_FP_Mul.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble d_FP_Mul(const SDouble a, const SDouble b) { const SDouble s0 = a; const SDouble s1 = b; const SDouble s3 = s0 * s1; return s3; } == END: "d_FP_Mul.c" ================== == BEGIN: "f_FP_Div.c" ================ /* File: "f_FP_Div.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat f_FP_Div(const SFloat a, const SFloat b) { const SFloat s0 = a; const SFloat s1 = b; const SFloat s3 = s0 / s1; return s3; } == END: "f_FP_Div.c" ================== == BEGIN: "d_FP_Div.c" ================ /* File: "d_FP_Div.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble d_FP_Div(const SDouble a, const SDouble b) { const SDouble s0 = a; const SDouble s1 = b; const SDouble s3 = s0 / s1; return s3; } == END: "d_FP_Div.c" ================== == BEGIN: "f_FP_FMA.c" ================ /* File: "f_FP_FMA.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat f_FP_FMA(const SFloat a, const SFloat b, const SFloat c) { const SFloat s0 = a; const SFloat s1 = b; const SFloat s2 = c; const SFloat s4 = fmaf(s0, s1, s2); return s4; } == END: "f_FP_FMA.c" ================== == BEGIN: "d_FP_FMA.c" ================ /* File: "d_FP_FMA.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble d_FP_FMA(const SDouble a, const SDouble b, const SDouble c) { const SDouble s0 = a; const SDouble s1 = b; const SDouble s2 = c; const SDouble s4 = fma(s0, s1, s2); return s4; } == END: "d_FP_FMA.c" ================== == BEGIN: "f_FP_Sqrt.c" ================ /* File: "f_FP_Sqrt.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat f_FP_Sqrt(const SFloat a) { const SFloat s0 = a; const SFloat s2 = sqrtf(s0); return s2; } == END: "f_FP_Sqrt.c" ================== == BEGIN: "d_FP_Sqrt.c" ================ /* File: "d_FP_Sqrt.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble d_FP_Sqrt(const SDouble a) { const SDouble s0 = a; const SDouble s2 = sqrt(s0); return s2; } == END: "d_FP_Sqrt.c" ================== == BEGIN: "f_FP_Rem.c" ================ /* File: "f_FP_Rem.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat f_FP_Rem(const SFloat a, const SFloat b) { const SFloat s0 = a; const SFloat s1 = b; const SFloat s2 = fmodf(s0, s1); return s2; } == END: "f_FP_Rem.c" ================== == BEGIN: "d_FP_Rem.c" ================ /* File: "d_FP_Rem.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble d_FP_Rem(const SDouble a, const SDouble b) { const SDouble s0 = a; const SDouble s1 = b; const SDouble s2 = fmod(s0, s1); return s2; } == END: "d_FP_Rem.c" ================== == BEGIN: "f_FP_RoundToIntegral.c" ================ /* File: "f_FP_RoundToIntegral.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat f_FP_RoundToIntegral(const SFloat a) { const SFloat s0 = a; const SFloat s2 = rintf(s0); return s2; } == END: "f_FP_RoundToIntegral.c" ================== == BEGIN: "d_FP_RoundToIntegral.c" ================ /* File: "d_FP_RoundToIntegral.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble d_FP_RoundToIntegral(const SDouble a) { const SDouble s0 = a; const SDouble s2 = rint(s0); return s2; } == END: "d_FP_RoundToIntegral.c" ================== == BEGIN: "f_FP_Min.c" ================ /* File: "f_FP_Min.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat f_FP_Min(const SFloat a, const SFloat b) { const SFloat s0 = a; const SFloat s1 = b; const SFloat s2 = ((FP_ZERO == fpclassify(s0)) && (FP_ZERO == fpclassify(s1)) && (signbit(s0) != signbit(s1))) ? 0.0F : fminf(s0, s1); return s2; } == END: "f_FP_Min.c" ================== == BEGIN: "d_FP_Min.c" ================ /* File: "d_FP_Min.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble d_FP_Min(const SDouble a, const SDouble b) { const SDouble s0 = a; const SDouble s1 = b; const SDouble s2 = ((FP_ZERO == fpclassify(s0)) && (FP_ZERO == fpclassify(s1)) && (signbit(s0) != signbit(s1))) ? 0.0 : fmin(s0, s1); return s2; } == END: "d_FP_Min.c" ================== == BEGIN: "f_FP_Max.c" ================ /* File: "f_FP_Max.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SFloat f_FP_Max(const SFloat a, const SFloat b) { const SFloat s0 = a; const SFloat s1 = b; const SFloat s2 = ((FP_ZERO == fpclassify(s0)) && (FP_ZERO == fpclassify(s1)) && (signbit(s0) != signbit(s1))) ? 0.0F : fmaxf(s0, s1); return s2; } == END: "f_FP_Max.c" ================== == BEGIN: "d_FP_Max.c" ================ /* File: "d_FP_Max.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SDouble d_FP_Max(const SDouble a, const SDouble b) { const SDouble s0 = a; const SDouble s1 = b; const SDouble s2 = ((FP_ZERO == fpclassify(s0)) && (FP_ZERO == fpclassify(s1)) && (signbit(s0) != signbit(s1))) ? 0.0 : fmax(s0, s1); return s2; } == END: "d_FP_Max.c" ================== == BEGIN: "f_FP_IsEqualObject.c" ================ /* File: "f_FP_IsEqualObject.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool f_FP_IsEqualObject(const SFloat a, const SFloat b) { const SFloat s0 = a; const SFloat s1 = b; const SBool s2 = isnan(s0) ? isnan(s1) : (signbit(s0) && (s0 == 0)) ? (signbit(s1) && (s1 == 0)) : (signbit(s1) && (s1 == 0)) ? (signbit(s0) && (s0 == 0)) : (s0 == s1); return s2; } == END: "f_FP_IsEqualObject.c" ================== == BEGIN: "d_FP_IsEqualObject.c" ================ /* File: "d_FP_IsEqualObject.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool d_FP_IsEqualObject(const SDouble a, const SDouble b) { const SDouble s0 = a; const SDouble s1 = b; const SBool s2 = isnan(s0) ? isnan(s1) : (signbit(s0) && (s0 == 0)) ? (signbit(s1) && (s1 == 0)) : (signbit(s1) && (s1 == 0)) ? (signbit(s0) && (s0 == 0)) : (s0 == s1); return s2; } == END: "d_FP_IsEqualObject.c" ================== == BEGIN: "f_FP_IsNormal.c" ================ /* File: "f_FP_IsNormal.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool f_FP_IsNormal(const SFloat a) { const SFloat s0 = a; const SBool s1 = isnormal(s0); return s1; } == END: "f_FP_IsNormal.c" ================== == BEGIN: "d_FP_IsNormal.c" ================ /* File: "d_FP_IsNormal.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool d_FP_IsNormal(const SDouble a) { const SDouble s0 = a; const SBool s1 = isnormal(s0); return s1; } == END: "d_FP_IsNormal.c" ================== == BEGIN: "f_FP_IsZero.c" ================ /* File: "f_FP_IsZero.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool f_FP_IsZero(const SFloat a) { const SFloat s0 = a; const SBool s1 = FP_ZERO == fpclassify(s0); return s1; } == END: "f_FP_IsZero.c" ================== == BEGIN: "d_FP_IsZero.c" ================ /* File: "d_FP_IsZero.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool d_FP_IsZero(const SDouble a) { const SDouble s0 = a; const SBool s1 = FP_ZERO == fpclassify(s0); return s1; } == END: "d_FP_IsZero.c" ================== == BEGIN: "f_FP_IsSubnormal.c" ================ /* File: "f_FP_IsSubnormal.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool f_FP_IsSubnormal(const SFloat a) { const SFloat s0 = a; const SBool s1 = FP_SUBNORMAL == fpclassify(s0); return s1; } == END: "f_FP_IsSubnormal.c" ================== == BEGIN: "d_FP_IsSubnormal.c" ================ /* File: "d_FP_IsSubnormal.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool d_FP_IsSubnormal(const SDouble a) { const SDouble s0 = a; const SBool s1 = FP_SUBNORMAL == fpclassify(s0); return s1; } == END: "d_FP_IsSubnormal.c" ================== == BEGIN: "f_FP_IsInfinite.c" ================ /* File: "f_FP_IsInfinite.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool f_FP_IsInfinite(const SFloat a) { const SFloat s0 = a; const SBool s1 = isinf(s0); return s1; } == END: "f_FP_IsInfinite.c" ================== == BEGIN: "d_FP_IsInfinite.c" ================ /* File: "d_FP_IsInfinite.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool d_FP_IsInfinite(const SDouble a) { const SDouble s0 = a; const SBool s1 = isinf(s0); return s1; } == END: "d_FP_IsInfinite.c" ================== == BEGIN: "f_FP_IsNaN.c" ================ /* File: "f_FP_IsNaN.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool f_FP_IsNaN(const SFloat a) { const SFloat s0 = a; const SBool s1 = isnan(s0); return s1; } == END: "f_FP_IsNaN.c" ================== == BEGIN: "d_FP_IsNaN.c" ================ /* File: "d_FP_IsNaN.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool d_FP_IsNaN(const SDouble a) { const SDouble s0 = a; const SBool s1 = isnan(s0); return s1; } == END: "d_FP_IsNaN.c" ================== == BEGIN: "f_FP_IsNegative.c" ================ /* File: "f_FP_IsNegative.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool f_FP_IsNegative(const SFloat a) { const SFloat s0 = a; const SBool s1 = !isnan(s0) && signbit(s0); return s1; } == END: "f_FP_IsNegative.c" ================== == BEGIN: "d_FP_IsNegative.c" ================ /* File: "d_FP_IsNegative.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool d_FP_IsNegative(const SDouble a) { const SDouble s0 = a; const SBool s1 = !isnan(s0) && signbit(s0); return s1; } == END: "d_FP_IsNegative.c" ================== == BEGIN: "f_FP_IsPositive.c" ================ /* File: "f_FP_IsPositive.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool f_FP_IsPositive(const SFloat a) { const SFloat s0 = a; const SBool s1 = !isnan(s0) && !signbit(s0); return s1; } == END: "f_FP_IsPositive.c" ================== == BEGIN: "d_FP_IsPositive.c" ================ /* File: "d_FP_IsPositive.c". Automatically generated by SBV. Do not edit! */ #include "floatCodeGen.h" SBool d_FP_IsPositive(const SDouble a) { const SDouble s0 = a; const SBool s1 = !isnan(s0) && !signbit(s0); return s1; } == END: "d_FP_IsPositive.c" ================== == BEGIN: "floatCodeGen.h" ================ /* Header file for floatCodeGen. Automatically generated by SBV. Do not edit! */ #ifndef __floatCodeGen__HEADER_INCLUDED__ #define __floatCodeGen__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* User requested mapping for SInteger. */ /* NB. Loss of precision: Target type is subject to modular arithmetic. */ typedef SInt64 SInteger; /* User requested mapping for SReal. */ /* NB. Loss of precision: Target type is subject to rounding. */ typedef long double SReal; /* Entry point prototypes: */ SFloat toFP_Int8_ToFloat(const SInt8 a); SFloat toFP_Int16_ToFloat(const SInt16 a); SFloat toFP_Int32_ToFloat(const SInt32 a); SFloat toFP_Int64_ToFloat(const SInt64 a); SFloat toFP_Word8_ToFloat(const SWord8 a); SFloat toFP_Word16_ToFloat(const SWord16 a); SFloat toFP_Word32_ToFloat(const SWord32 a); SFloat toFP_Word64_ToFloat(const SWord64 a); SFloat toFP_Float_ToFloat(const SFloat a); SFloat toFP_Double_ToFloat(const SDouble a); SFloat toFP_Integer_ToFloat(const SInteger a); SFloat toFP_Real_ToFloat(const SReal a); SDouble toFP_Int8_ToDouble(const SInt8 a); SDouble toFP_Int16_ToDouble(const SInt16 a); SDouble toFP_Int32_ToDouble(const SInt32 a); SDouble toFP_Int64_ToDouble(const SInt64 a); SDouble toFP_Word8_ToDouble(const SWord8 a); SDouble toFP_Word16_ToDouble(const SWord16 a); SDouble toFP_Word32_ToDouble(const SWord32 a); SDouble toFP_Word64_ToDouble(const SWord64 a); SDouble toFP_Float_ToDouble(const SFloat a); SDouble toFP_Double_ToDouble(const SDouble a); SDouble toFP_Integer_ToDouble(const SInteger a); SDouble toFP_Real_ToDouble(const SReal a); SInt8 fromFP_Float_ToInt8(const SFloat a); SInt16 fromFP_Float_ToInt16(const SFloat a); SInt32 fromFP_Float_ToInt32(const SFloat a); SInt64 fromFP_Float_ToInt64(const SFloat a); SWord8 fromFP_Float_ToWord8(const SFloat a); SWord16 fromFP_Float_ToWord16(const SFloat a); SWord32 fromFP_Float_ToWord32(const SFloat a); SWord64 fromFP_Float_ToWord64(const SFloat a); SFloat fromFP_Float_ToFloat(const SFloat a); SDouble fromFP_Float_ToDouble(const SFloat a); SInteger fromFP_Float_ToInteger(const SFloat a); SReal fromFP_Float_ToReal(const SFloat a); SInt8 fromFP_DoubleTo_Int8(const SDouble a); SInt16 fromFP_DoubleTo_Int16(const SDouble a); SInt32 fromFP_DoubleTo_Int32(const SDouble a); SInt64 fromFP_DoubleTo_Int64(const SDouble a); SWord8 fromFP_DoubleTo_Word8(const SDouble a); SWord16 fromFP_DoubleTo_Word16(const SDouble a); SWord32 fromFP_DoubleTo_Word32(const SDouble a); SWord64 fromFP_DoubleTo_Word64(const SDouble a); SFloat fromFP_DoubleTo_Float(const SDouble a); SDouble fromFP_DoubleTo_Double(const SDouble a); SInteger fromFP_DoubleTo_Integer(const SDouble a); SReal fromFP_DoubleTo_Real(const SDouble a); SFloat fromFP_SWord32_SFloat(const SWord32 a); SDouble fromFP_SWord64_SDouble(const SWord64 a); SWord32 fromFP_SFloat_SWord32(const SFloat a); SWord64 fromFP_SDouble_SWord64(const SDouble a); SFloat f_FP_Abs(const SFloat a); SDouble d_FP_Abs(const SDouble a); SFloat f_FP_Neg(const SFloat a); SDouble d_FP_Neg(const SDouble a); SFloat f_FP_Add(const SFloat a, const SFloat b); SDouble d_FP_Add(const SDouble a, const SDouble b); SFloat f_FP_Sub(const SFloat a, const SFloat b); SDouble d_FP_Sub(const SDouble a, const SDouble b); SFloat f_FP_Mul(const SFloat a, const SFloat b); SDouble d_FP_Mul(const SDouble a, const SDouble b); SFloat f_FP_Div(const SFloat a, const SFloat b); SDouble d_FP_Div(const SDouble a, const SDouble b); SFloat f_FP_FMA(const SFloat a, const SFloat b, const SFloat c); SDouble d_FP_FMA(const SDouble a, const SDouble b, const SDouble c); SFloat f_FP_Sqrt(const SFloat a); SDouble d_FP_Sqrt(const SDouble a); SFloat f_FP_Rem(const SFloat a, const SFloat b); SDouble d_FP_Rem(const SDouble a, const SDouble b); SFloat f_FP_RoundToIntegral(const SFloat a); SDouble d_FP_RoundToIntegral(const SDouble a); SFloat f_FP_Min(const SFloat a, const SFloat b); SDouble d_FP_Min(const SDouble a, const SDouble b); SFloat f_FP_Max(const SFloat a, const SFloat b); SDouble d_FP_Max(const SDouble a, const SDouble b); SBool f_FP_IsEqualObject(const SFloat a, const SFloat b); SBool d_FP_IsEqualObject(const SDouble a, const SDouble b); SBool f_FP_IsNormal(const SFloat a); SBool d_FP_IsNormal(const SDouble a); SBool f_FP_IsZero(const SFloat a); SBool d_FP_IsZero(const SDouble a); SBool f_FP_IsSubnormal(const SFloat a); SBool d_FP_IsSubnormal(const SDouble a); SBool f_FP_IsInfinite(const SFloat a); SBool d_FP_IsInfinite(const SDouble a); SBool f_FP_IsNaN(const SFloat a); SBool d_FP_IsNaN(const SDouble a); SBool f_FP_IsNegative(const SFloat a); SBool d_FP_IsNegative(const SDouble a); SBool f_FP_IsPositive(const SFloat a); SBool d_FP_IsPositive(const SDouble a); #endif /* __floatCodeGen__HEADER_INCLUDED__ */ == END: "floatCodeGen.h" ================== == BEGIN: "floatCodeGen_driver.c" ================ /* Example driver program for floatCodeGen. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "floatCodeGen.h" void toFP_Int8_ToFloat_driver(void) { const SFloat __result = toFP_Int8_ToFloat(42); printf("toFP_Int8_ToFloat(42) = %.6g\n", __result); } void toFP_Int16_ToFloat_driver(void) { const SFloat __result = toFP_Int16_ToFloat(0x002a); printf("toFP_Int16_ToFloat(0x002a) = %.6g\n", __result); } void toFP_Int32_ToFloat_driver(void) { const SFloat __result = toFP_Int32_ToFloat(0x0000002aL); printf("toFP_Int32_ToFloat(0x0000002aL) = %.6g\n", __result); } void toFP_Int64_ToFloat_driver(void) { const SFloat __result = toFP_Int64_ToFloat(0x000000000000002aLL); printf("toFP_Int64_ToFloat(0x000000000000002aLL) = %.6g\n", __result); } void toFP_Word8_ToFloat_driver(void) { const SFloat __result = toFP_Word8_ToFloat(42); printf("toFP_Word8_ToFloat(42) = %.6g\n", __result); } void toFP_Word16_ToFloat_driver(void) { const SFloat __result = toFP_Word16_ToFloat(0x002aU); printf("toFP_Word16_ToFloat(0x002aU) = %.6g\n", __result); } void toFP_Word32_ToFloat_driver(void) { const SFloat __result = toFP_Word32_ToFloat(0x0000002aUL); printf("toFP_Word32_ToFloat(0x0000002aUL) = %.6g\n", __result); } void toFP_Word64_ToFloat_driver(void) { const SFloat __result = toFP_Word64_ToFloat(0x000000000000002aULL); printf("toFP_Word64_ToFloat(0x000000000000002aULL) = %.6g\n", __result); } void toFP_Float_ToFloat_driver(void) { const SFloat __result = toFP_Float_ToFloat(42.0F); printf("toFP_Float_ToFloat(42.0F) = %.6g\n", __result); } void toFP_Double_ToFloat_driver(void) { const SFloat __result = toFP_Double_ToFloat(42.0); printf("toFP_Double_ToFloat(42.0) = %.6g\n", __result); } void toFP_Integer_ToFloat_driver(void) { const SFloat __result = toFP_Integer_ToFloat(0x000000000000002aLL); printf("toFP_Integer_ToFloat(0x000000000000002aLL) = %.6g\n", __result); } void toFP_Real_ToFloat_driver(void) { const SFloat __result = toFP_Real_ToFloat(42.0L); printf("toFP_Real_ToFloat(42.0L) = %.6g\n", __result); } void toFP_Int8_ToDouble_driver(void) { const SDouble __result = toFP_Int8_ToDouble(42); printf("toFP_Int8_ToDouble(42) = %.15g\n", __result); } void toFP_Int16_ToDouble_driver(void) { const SDouble __result = toFP_Int16_ToDouble(0x002a); printf("toFP_Int16_ToDouble(0x002a) = %.15g\n", __result); } void toFP_Int32_ToDouble_driver(void) { const SDouble __result = toFP_Int32_ToDouble(0x0000002aL); printf("toFP_Int32_ToDouble(0x0000002aL) = %.15g\n", __result); } void toFP_Int64_ToDouble_driver(void) { const SDouble __result = toFP_Int64_ToDouble(0x000000000000002aLL); printf("toFP_Int64_ToDouble(0x000000000000002aLL) = %.15g\n", __result); } void toFP_Word8_ToDouble_driver(void) { const SDouble __result = toFP_Word8_ToDouble(42); printf("toFP_Word8_ToDouble(42) = %.15g\n", __result); } void toFP_Word16_ToDouble_driver(void) { const SDouble __result = toFP_Word16_ToDouble(0x002aU); printf("toFP_Word16_ToDouble(0x002aU) = %.15g\n", __result); } void toFP_Word32_ToDouble_driver(void) { const SDouble __result = toFP_Word32_ToDouble(0x0000002aUL); printf("toFP_Word32_ToDouble(0x0000002aUL) = %.15g\n", __result); } void toFP_Word64_ToDouble_driver(void) { const SDouble __result = toFP_Word64_ToDouble(0x000000000000002aULL); printf("toFP_Word64_ToDouble(0x000000000000002aULL) = %.15g\n", __result); } void toFP_Float_ToDouble_driver(void) { const SDouble __result = toFP_Float_ToDouble(42.0F); printf("toFP_Float_ToDouble(42.0F) = %.15g\n", __result); } void toFP_Double_ToDouble_driver(void) { const SDouble __result = toFP_Double_ToDouble(42.0); printf("toFP_Double_ToDouble(42.0) = %.15g\n", __result); } void toFP_Integer_ToDouble_driver(void) { const SDouble __result = toFP_Integer_ToDouble(0x000000000000002aLL); printf("toFP_Integer_ToDouble(0x000000000000002aLL) = %.15g\n", __result); } void toFP_Real_ToDouble_driver(void) { const SDouble __result = toFP_Real_ToDouble(42.0L); printf("toFP_Real_ToDouble(42.0L) = %.15g\n", __result); } void fromFP_Float_ToInt8_driver(void) { const SInt8 __result = fromFP_Float_ToInt8(42.0F); printf("fromFP_Float_ToInt8(42.0F) = %"PRId8"\n", __result); } void fromFP_Float_ToInt16_driver(void) { const SInt16 __result = fromFP_Float_ToInt16(42.0F); printf("fromFP_Float_ToInt16(42.0F) = %"PRId16"\n", __result); } void fromFP_Float_ToInt32_driver(void) { const SInt32 __result = fromFP_Float_ToInt32(42.0F); printf("fromFP_Float_ToInt32(42.0F) = %"PRId32"L\n", __result); } void fromFP_Float_ToInt64_driver(void) { const SInt64 __result = fromFP_Float_ToInt64(42.0F); printf("fromFP_Float_ToInt64(42.0F) = %"PRId64"LL\n", __result); } void fromFP_Float_ToWord8_driver(void) { const SWord8 __result = fromFP_Float_ToWord8(42.0F); printf("fromFP_Float_ToWord8(42.0F) = %"PRIu8"\n", __result); } void fromFP_Float_ToWord16_driver(void) { const SWord16 __result = fromFP_Float_ToWord16(42.0F); printf("fromFP_Float_ToWord16(42.0F) = 0x%04"PRIx16"U\n", __result); } void fromFP_Float_ToWord32_driver(void) { const SWord32 __result = fromFP_Float_ToWord32(42.0F); printf("fromFP_Float_ToWord32(42.0F) = 0x%08"PRIx32"UL\n", __result); } void fromFP_Float_ToWord64_driver(void) { const SWord64 __result = fromFP_Float_ToWord64(42.0F); printf("fromFP_Float_ToWord64(42.0F) = 0x%016"PRIx64"ULL\n", __result); } void fromFP_Float_ToFloat_driver(void) { const SFloat __result = fromFP_Float_ToFloat(42.0F); printf("fromFP_Float_ToFloat(42.0F) = %.6g\n", __result); } void fromFP_Float_ToDouble_driver(void) { const SDouble __result = fromFP_Float_ToDouble(42.0F); printf("fromFP_Float_ToDouble(42.0F) = %.15g\n", __result); } void fromFP_Float_ToInteger_driver(void) { const SInteger __result = fromFP_Float_ToInteger(42.0F); printf("fromFP_Float_ToInteger(42.0F) = %"PRId64"LL\n", __result); } void fromFP_Float_ToReal_driver(void) { const SReal __result = fromFP_Float_ToReal(42.0F); printf("fromFP_Float_ToReal(42.0F) = %Lf\n", __result); } void fromFP_DoubleTo_Int8_driver(void) { const SInt8 __result = fromFP_DoubleTo_Int8(42.0); printf("fromFP_DoubleTo_Int8(42.0) = %"PRId8"\n", __result); } void fromFP_DoubleTo_Int16_driver(void) { const SInt16 __result = fromFP_DoubleTo_Int16(42.0); printf("fromFP_DoubleTo_Int16(42.0) = %"PRId16"\n", __result); } void fromFP_DoubleTo_Int32_driver(void) { const SInt32 __result = fromFP_DoubleTo_Int32(42.0); printf("fromFP_DoubleTo_Int32(42.0) = %"PRId32"L\n", __result); } void fromFP_DoubleTo_Int64_driver(void) { const SInt64 __result = fromFP_DoubleTo_Int64(42.0); printf("fromFP_DoubleTo_Int64(42.0) = %"PRId64"LL\n", __result); } void fromFP_DoubleTo_Word8_driver(void) { const SWord8 __result = fromFP_DoubleTo_Word8(42.0); printf("fromFP_DoubleTo_Word8(42.0) = %"PRIu8"\n", __result); } void fromFP_DoubleTo_Word16_driver(void) { const SWord16 __result = fromFP_DoubleTo_Word16(42.0); printf("fromFP_DoubleTo_Word16(42.0) = 0x%04"PRIx16"U\n", __result); } void fromFP_DoubleTo_Word32_driver(void) { const SWord32 __result = fromFP_DoubleTo_Word32(42.0); printf("fromFP_DoubleTo_Word32(42.0) = 0x%08"PRIx32"UL\n", __result); } void fromFP_DoubleTo_Word64_driver(void) { const SWord64 __result = fromFP_DoubleTo_Word64(42.0); printf("fromFP_DoubleTo_Word64(42.0) = 0x%016"PRIx64"ULL\n", __result); } void fromFP_DoubleTo_Float_driver(void) { const SFloat __result = fromFP_DoubleTo_Float(42.0); printf("fromFP_DoubleTo_Float(42.0) = %.6g\n", __result); } void fromFP_DoubleTo_Double_driver(void) { const SDouble __result = fromFP_DoubleTo_Double(42.0); printf("fromFP_DoubleTo_Double(42.0) = %.15g\n", __result); } void fromFP_DoubleTo_Integer_driver(void) { const SInteger __result = fromFP_DoubleTo_Integer(42.0); printf("fromFP_DoubleTo_Integer(42.0) = %"PRId64"LL\n", __result); } void fromFP_DoubleTo_Real_driver(void) { const SReal __result = fromFP_DoubleTo_Real(42.0); printf("fromFP_DoubleTo_Real(42.0) = %Lf\n", __result); } void fromFP_SWord32_SFloat_driver(void) { const SFloat __result = fromFP_SWord32_SFloat(0x0000002aUL); printf("fromFP_SWord32_SFloat(0x0000002aUL) = %.6g\n", __result); } void fromFP_SWord64_SDouble_driver(void) { const SDouble __result = fromFP_SWord64_SDouble(0x000000000000002aULL); printf("fromFP_SWord64_SDouble(0x000000000000002aULL) = %.15g\n", __result); } void fromFP_SFloat_SWord32_driver(void) { const SWord32 __result = fromFP_SFloat_SWord32(42.0F); printf("fromFP_SFloat_SWord32(42.0F) = 0x%08"PRIx32"UL\n", __result); } void fromFP_SDouble_SWord64_driver(void) { const SWord64 __result = fromFP_SDouble_SWord64(42.0); printf("fromFP_SDouble_SWord64(42.0) = 0x%016"PRIx64"ULL\n", __result); } void f_FP_Abs_driver(void) { const SFloat __result = f_FP_Abs(42.0F); printf("f_FP_Abs(42.0F) = %.6g\n", __result); } void d_FP_Abs_driver(void) { const SDouble __result = d_FP_Abs(42.0); printf("d_FP_Abs(42.0) = %.15g\n", __result); } void f_FP_Neg_driver(void) { const SFloat __result = f_FP_Neg(42.0F); printf("f_FP_Neg(42.0F) = %.6g\n", __result); } void d_FP_Neg_driver(void) { const SDouble __result = d_FP_Neg(42.0); printf("d_FP_Neg(42.0) = %.15g\n", __result); } void f_FP_Add_driver(void) { const SFloat __result = f_FP_Add(42.0F, 43.0F); printf("f_FP_Add(42.0F, 43.0F) = %.6g\n", __result); } void d_FP_Add_driver(void) { const SDouble __result = d_FP_Add(42.0, 43.0); printf("d_FP_Add(42.0, 43.0) = %.15g\n", __result); } void f_FP_Sub_driver(void) { const SFloat __result = f_FP_Sub(42.0F, 43.0F); printf("f_FP_Sub(42.0F, 43.0F) = %.6g\n", __result); } void d_FP_Sub_driver(void) { const SDouble __result = d_FP_Sub(42.0, 43.0); printf("d_FP_Sub(42.0, 43.0) = %.15g\n", __result); } void f_FP_Mul_driver(void) { const SFloat __result = f_FP_Mul(42.0F, 43.0F); printf("f_FP_Mul(42.0F, 43.0F) = %.6g\n", __result); } void d_FP_Mul_driver(void) { const SDouble __result = d_FP_Mul(42.0, 43.0); printf("d_FP_Mul(42.0, 43.0) = %.15g\n", __result); } void f_FP_Div_driver(void) { const SFloat __result = f_FP_Div(42.0F, 43.0F); printf("f_FP_Div(42.0F, 43.0F) = %.6g\n", __result); } void d_FP_Div_driver(void) { const SDouble __result = d_FP_Div(42.0, 43.0); printf("d_FP_Div(42.0, 43.0) = %.15g\n", __result); } void f_FP_FMA_driver(void) { const SFloat __result = f_FP_FMA(42.0F, 43.0F, 44.0F); printf("f_FP_FMA(42.0F, 43.0F, 44.0F) = %.6g\n", __result); } void d_FP_FMA_driver(void) { const SDouble __result = d_FP_FMA(42.0, 43.0, 44.0); printf("d_FP_FMA(42.0, 43.0, 44.0) = %.15g\n", __result); } void f_FP_Sqrt_driver(void) { const SFloat __result = f_FP_Sqrt(42.0F); printf("f_FP_Sqrt(42.0F) = %.6g\n", __result); } void d_FP_Sqrt_driver(void) { const SDouble __result = d_FP_Sqrt(42.0); printf("d_FP_Sqrt(42.0) = %.15g\n", __result); } void f_FP_Rem_driver(void) { const SFloat __result = f_FP_Rem(42.0F, 43.0F); printf("f_FP_Rem(42.0F, 43.0F) = %.6g\n", __result); } void d_FP_Rem_driver(void) { const SDouble __result = d_FP_Rem(42.0, 43.0); printf("d_FP_Rem(42.0, 43.0) = %.15g\n", __result); } void f_FP_RoundToIntegral_driver(void) { const SFloat __result = f_FP_RoundToIntegral(42.0F); printf("f_FP_RoundToIntegral(42.0F) = %.6g\n", __result); } void d_FP_RoundToIntegral_driver(void) { const SDouble __result = d_FP_RoundToIntegral(42.0); printf("d_FP_RoundToIntegral(42.0) = %.15g\n", __result); } void f_FP_Min_driver(void) { const SFloat __result = f_FP_Min(42.0F, 43.0F); printf("f_FP_Min(42.0F, 43.0F) = %.6g\n", __result); } void d_FP_Min_driver(void) { const SDouble __result = d_FP_Min(42.0, 43.0); printf("d_FP_Min(42.0, 43.0) = %.15g\n", __result); } void f_FP_Max_driver(void) { const SFloat __result = f_FP_Max(42.0F, 43.0F); printf("f_FP_Max(42.0F, 43.0F) = %.6g\n", __result); } void d_FP_Max_driver(void) { const SDouble __result = d_FP_Max(42.0, 43.0); printf("d_FP_Max(42.0, 43.0) = %.15g\n", __result); } void f_FP_IsEqualObject_driver(void) { const SBool __result = f_FP_IsEqualObject(42.0F, 43.0F); printf("f_FP_IsEqualObject(42.0F, 43.0F) = %d\n", __result); } void d_FP_IsEqualObject_driver(void) { const SBool __result = d_FP_IsEqualObject(42.0, 43.0); printf("d_FP_IsEqualObject(42.0, 43.0) = %d\n", __result); } void f_FP_IsNormal_driver(void) { const SBool __result = f_FP_IsNormal(42.0F); printf("f_FP_IsNormal(42.0F) = %d\n", __result); } void d_FP_IsNormal_driver(void) { const SBool __result = d_FP_IsNormal(42.0); printf("d_FP_IsNormal(42.0) = %d\n", __result); } void f_FP_IsZero_driver(void) { const SBool __result = f_FP_IsZero(42.0F); printf("f_FP_IsZero(42.0F) = %d\n", __result); } void d_FP_IsZero_driver(void) { const SBool __result = d_FP_IsZero(42.0); printf("d_FP_IsZero(42.0) = %d\n", __result); } void f_FP_IsSubnormal_driver(void) { const SBool __result = f_FP_IsSubnormal(42.0F); printf("f_FP_IsSubnormal(42.0F) = %d\n", __result); } void d_FP_IsSubnormal_driver(void) { const SBool __result = d_FP_IsSubnormal(42.0); printf("d_FP_IsSubnormal(42.0) = %d\n", __result); } void f_FP_IsInfinite_driver(void) { const SBool __result = f_FP_IsInfinite(42.0F); printf("f_FP_IsInfinite(42.0F) = %d\n", __result); } void d_FP_IsInfinite_driver(void) { const SBool __result = d_FP_IsInfinite(42.0); printf("d_FP_IsInfinite(42.0) = %d\n", __result); } void f_FP_IsNaN_driver(void) { const SBool __result = f_FP_IsNaN(42.0F); printf("f_FP_IsNaN(42.0F) = %d\n", __result); } void d_FP_IsNaN_driver(void) { const SBool __result = d_FP_IsNaN(42.0); printf("d_FP_IsNaN(42.0) = %d\n", __result); } void f_FP_IsNegative_driver(void) { const SBool __result = f_FP_IsNegative(42.0F); printf("f_FP_IsNegative(42.0F) = %d\n", __result); } void d_FP_IsNegative_driver(void) { const SBool __result = d_FP_IsNegative(42.0); printf("d_FP_IsNegative(42.0) = %d\n", __result); } void f_FP_IsPositive_driver(void) { const SBool __result = f_FP_IsPositive(42.0F); printf("f_FP_IsPositive(42.0F) = %d\n", __result); } void d_FP_IsPositive_driver(void) { const SBool __result = d_FP_IsPositive(42.0); printf("d_FP_IsPositive(42.0) = %d\n", __result); } int main(void) { printf("====================================\n"); printf("** Driver run for toFP_Int8_ToFloat:\n"); printf("====================================\n"); toFP_Int8_ToFloat_driver(); printf("=====================================\n"); printf("** Driver run for toFP_Int16_ToFloat:\n"); printf("=====================================\n"); toFP_Int16_ToFloat_driver(); printf("=====================================\n"); printf("** Driver run for toFP_Int32_ToFloat:\n"); printf("=====================================\n"); toFP_Int32_ToFloat_driver(); printf("=====================================\n"); printf("** Driver run for toFP_Int64_ToFloat:\n"); printf("=====================================\n"); toFP_Int64_ToFloat_driver(); printf("=====================================\n"); printf("** Driver run for toFP_Word8_ToFloat:\n"); printf("=====================================\n"); toFP_Word8_ToFloat_driver(); printf("======================================\n"); printf("** Driver run for toFP_Word16_ToFloat:\n"); printf("======================================\n"); toFP_Word16_ToFloat_driver(); printf("======================================\n"); printf("** Driver run for toFP_Word32_ToFloat:\n"); printf("======================================\n"); toFP_Word32_ToFloat_driver(); printf("======================================\n"); printf("** Driver run for toFP_Word64_ToFloat:\n"); printf("======================================\n"); toFP_Word64_ToFloat_driver(); printf("=====================================\n"); printf("** Driver run for toFP_Float_ToFloat:\n"); printf("=====================================\n"); toFP_Float_ToFloat_driver(); printf("======================================\n"); printf("** Driver run for toFP_Double_ToFloat:\n"); printf("======================================\n"); toFP_Double_ToFloat_driver(); printf("=======================================\n"); printf("** Driver run for toFP_Integer_ToFloat:\n"); printf("=======================================\n"); toFP_Integer_ToFloat_driver(); printf("====================================\n"); printf("** Driver run for toFP_Real_ToFloat:\n"); printf("====================================\n"); toFP_Real_ToFloat_driver(); printf("=====================================\n"); printf("** Driver run for toFP_Int8_ToDouble:\n"); printf("=====================================\n"); toFP_Int8_ToDouble_driver(); printf("======================================\n"); printf("** Driver run for toFP_Int16_ToDouble:\n"); printf("======================================\n"); toFP_Int16_ToDouble_driver(); printf("======================================\n"); printf("** Driver run for toFP_Int32_ToDouble:\n"); printf("======================================\n"); toFP_Int32_ToDouble_driver(); printf("======================================\n"); printf("** Driver run for toFP_Int64_ToDouble:\n"); printf("======================================\n"); toFP_Int64_ToDouble_driver(); printf("======================================\n"); printf("** Driver run for toFP_Word8_ToDouble:\n"); printf("======================================\n"); toFP_Word8_ToDouble_driver(); printf("=======================================\n"); printf("** Driver run for toFP_Word16_ToDouble:\n"); printf("=======================================\n"); toFP_Word16_ToDouble_driver(); printf("=======================================\n"); printf("** Driver run for toFP_Word32_ToDouble:\n"); printf("=======================================\n"); toFP_Word32_ToDouble_driver(); printf("=======================================\n"); printf("** Driver run for toFP_Word64_ToDouble:\n"); printf("=======================================\n"); toFP_Word64_ToDouble_driver(); printf("======================================\n"); printf("** Driver run for toFP_Float_ToDouble:\n"); printf("======================================\n"); toFP_Float_ToDouble_driver(); printf("=======================================\n"); printf("** Driver run for toFP_Double_ToDouble:\n"); printf("=======================================\n"); toFP_Double_ToDouble_driver(); printf("========================================\n"); printf("** Driver run for toFP_Integer_ToDouble:\n"); printf("========================================\n"); toFP_Integer_ToDouble_driver(); printf("=====================================\n"); printf("** Driver run for toFP_Real_ToDouble:\n"); printf("=====================================\n"); toFP_Real_ToDouble_driver(); printf("======================================\n"); printf("** Driver run for fromFP_Float_ToInt8:\n"); printf("======================================\n"); fromFP_Float_ToInt8_driver(); printf("=======================================\n"); printf("** Driver run for fromFP_Float_ToInt16:\n"); printf("=======================================\n"); fromFP_Float_ToInt16_driver(); printf("=======================================\n"); printf("** Driver run for fromFP_Float_ToInt32:\n"); printf("=======================================\n"); fromFP_Float_ToInt32_driver(); printf("=======================================\n"); printf("** Driver run for fromFP_Float_ToInt64:\n"); printf("=======================================\n"); fromFP_Float_ToInt64_driver(); printf("=======================================\n"); printf("** Driver run for fromFP_Float_ToWord8:\n"); printf("=======================================\n"); fromFP_Float_ToWord8_driver(); printf("========================================\n"); printf("** Driver run for fromFP_Float_ToWord16:\n"); printf("========================================\n"); fromFP_Float_ToWord16_driver(); printf("========================================\n"); printf("** Driver run for fromFP_Float_ToWord32:\n"); printf("========================================\n"); fromFP_Float_ToWord32_driver(); printf("========================================\n"); printf("** Driver run for fromFP_Float_ToWord64:\n"); printf("========================================\n"); fromFP_Float_ToWord64_driver(); printf("=======================================\n"); printf("** Driver run for fromFP_Float_ToFloat:\n"); printf("=======================================\n"); fromFP_Float_ToFloat_driver(); printf("========================================\n"); printf("** Driver run for fromFP_Float_ToDouble:\n"); printf("========================================\n"); fromFP_Float_ToDouble_driver(); printf("=========================================\n"); printf("** Driver run for fromFP_Float_ToInteger:\n"); printf("=========================================\n"); fromFP_Float_ToInteger_driver(); printf("======================================\n"); printf("** Driver run for fromFP_Float_ToReal:\n"); printf("======================================\n"); fromFP_Float_ToReal_driver(); printf("=======================================\n"); printf("** Driver run for fromFP_DoubleTo_Int8:\n"); printf("=======================================\n"); fromFP_DoubleTo_Int8_driver(); printf("========================================\n"); printf("** Driver run for fromFP_DoubleTo_Int16:\n"); printf("========================================\n"); fromFP_DoubleTo_Int16_driver(); printf("========================================\n"); printf("** Driver run for fromFP_DoubleTo_Int32:\n"); printf("========================================\n"); fromFP_DoubleTo_Int32_driver(); printf("========================================\n"); printf("** Driver run for fromFP_DoubleTo_Int64:\n"); printf("========================================\n"); fromFP_DoubleTo_Int64_driver(); printf("========================================\n"); printf("** Driver run for fromFP_DoubleTo_Word8:\n"); printf("========================================\n"); fromFP_DoubleTo_Word8_driver(); printf("=========================================\n"); printf("** Driver run for fromFP_DoubleTo_Word16:\n"); printf("=========================================\n"); fromFP_DoubleTo_Word16_driver(); printf("=========================================\n"); printf("** Driver run for fromFP_DoubleTo_Word32:\n"); printf("=========================================\n"); fromFP_DoubleTo_Word32_driver(); printf("=========================================\n"); printf("** Driver run for fromFP_DoubleTo_Word64:\n"); printf("=========================================\n"); fromFP_DoubleTo_Word64_driver(); printf("========================================\n"); printf("** Driver run for fromFP_DoubleTo_Float:\n"); printf("========================================\n"); fromFP_DoubleTo_Float_driver(); printf("=========================================\n"); printf("** Driver run for fromFP_DoubleTo_Double:\n"); printf("=========================================\n"); fromFP_DoubleTo_Double_driver(); printf("==========================================\n"); printf("** Driver run for fromFP_DoubleTo_Integer:\n"); printf("==========================================\n"); fromFP_DoubleTo_Integer_driver(); printf("=======================================\n"); printf("** Driver run for fromFP_DoubleTo_Real:\n"); printf("=======================================\n"); fromFP_DoubleTo_Real_driver(); printf("========================================\n"); printf("** Driver run for fromFP_SWord32_SFloat:\n"); printf("========================================\n"); fromFP_SWord32_SFloat_driver(); printf("=========================================\n"); printf("** Driver run for fromFP_SWord64_SDouble:\n"); printf("=========================================\n"); fromFP_SWord64_SDouble_driver(); printf("========================================\n"); printf("** Driver run for fromFP_SFloat_SWord32:\n"); printf("========================================\n"); fromFP_SFloat_SWord32_driver(); printf("=========================================\n"); printf("** Driver run for fromFP_SDouble_SWord64:\n"); printf("=========================================\n"); fromFP_SDouble_SWord64_driver(); printf("===========================\n"); printf("** Driver run for f_FP_Abs:\n"); printf("===========================\n"); f_FP_Abs_driver(); printf("===========================\n"); printf("** Driver run for d_FP_Abs:\n"); printf("===========================\n"); d_FP_Abs_driver(); printf("===========================\n"); printf("** Driver run for f_FP_Neg:\n"); printf("===========================\n"); f_FP_Neg_driver(); printf("===========================\n"); printf("** Driver run for d_FP_Neg:\n"); printf("===========================\n"); d_FP_Neg_driver(); printf("===========================\n"); printf("** Driver run for f_FP_Add:\n"); printf("===========================\n"); f_FP_Add_driver(); printf("===========================\n"); printf("** Driver run for d_FP_Add:\n"); printf("===========================\n"); d_FP_Add_driver(); printf("===========================\n"); printf("** Driver run for f_FP_Sub:\n"); printf("===========================\n"); f_FP_Sub_driver(); printf("===========================\n"); printf("** Driver run for d_FP_Sub:\n"); printf("===========================\n"); d_FP_Sub_driver(); printf("===========================\n"); printf("** Driver run for f_FP_Mul:\n"); printf("===========================\n"); f_FP_Mul_driver(); printf("===========================\n"); printf("** Driver run for d_FP_Mul:\n"); printf("===========================\n"); d_FP_Mul_driver(); printf("===========================\n"); printf("** Driver run for f_FP_Div:\n"); printf("===========================\n"); f_FP_Div_driver(); printf("===========================\n"); printf("** Driver run for d_FP_Div:\n"); printf("===========================\n"); d_FP_Div_driver(); printf("===========================\n"); printf("** Driver run for f_FP_FMA:\n"); printf("===========================\n"); f_FP_FMA_driver(); printf("===========================\n"); printf("** Driver run for d_FP_FMA:\n"); printf("===========================\n"); d_FP_FMA_driver(); printf("============================\n"); printf("** Driver run for f_FP_Sqrt:\n"); printf("============================\n"); f_FP_Sqrt_driver(); printf("============================\n"); printf("** Driver run for d_FP_Sqrt:\n"); printf("============================\n"); d_FP_Sqrt_driver(); printf("===========================\n"); printf("** Driver run for f_FP_Rem:\n"); printf("===========================\n"); f_FP_Rem_driver(); printf("===========================\n"); printf("** Driver run for d_FP_Rem:\n"); printf("===========================\n"); d_FP_Rem_driver(); printf("=======================================\n"); printf("** Driver run for f_FP_RoundToIntegral:\n"); printf("=======================================\n"); f_FP_RoundToIntegral_driver(); printf("=======================================\n"); printf("** Driver run for d_FP_RoundToIntegral:\n"); printf("=======================================\n"); d_FP_RoundToIntegral_driver(); printf("===========================\n"); printf("** Driver run for f_FP_Min:\n"); printf("===========================\n"); f_FP_Min_driver(); printf("===========================\n"); printf("** Driver run for d_FP_Min:\n"); printf("===========================\n"); d_FP_Min_driver(); printf("===========================\n"); printf("** Driver run for f_FP_Max:\n"); printf("===========================\n"); f_FP_Max_driver(); printf("===========================\n"); printf("** Driver run for d_FP_Max:\n"); printf("===========================\n"); d_FP_Max_driver(); printf("=====================================\n"); printf("** Driver run for f_FP_IsEqualObject:\n"); printf("=====================================\n"); f_FP_IsEqualObject_driver(); printf("=====================================\n"); printf("** Driver run for d_FP_IsEqualObject:\n"); printf("=====================================\n"); d_FP_IsEqualObject_driver(); printf("================================\n"); printf("** Driver run for f_FP_IsNormal:\n"); printf("================================\n"); f_FP_IsNormal_driver(); printf("================================\n"); printf("** Driver run for d_FP_IsNormal:\n"); printf("================================\n"); d_FP_IsNormal_driver(); printf("==============================\n"); printf("** Driver run for f_FP_IsZero:\n"); printf("==============================\n"); f_FP_IsZero_driver(); printf("==============================\n"); printf("** Driver run for d_FP_IsZero:\n"); printf("==============================\n"); d_FP_IsZero_driver(); printf("===================================\n"); printf("** Driver run for f_FP_IsSubnormal:\n"); printf("===================================\n"); f_FP_IsSubnormal_driver(); printf("===================================\n"); printf("** Driver run for d_FP_IsSubnormal:\n"); printf("===================================\n"); d_FP_IsSubnormal_driver(); printf("==================================\n"); printf("** Driver run for f_FP_IsInfinite:\n"); printf("==================================\n"); f_FP_IsInfinite_driver(); printf("==================================\n"); printf("** Driver run for d_FP_IsInfinite:\n"); printf("==================================\n"); d_FP_IsInfinite_driver(); printf("=============================\n"); printf("** Driver run for f_FP_IsNaN:\n"); printf("=============================\n"); f_FP_IsNaN_driver(); printf("=============================\n"); printf("** Driver run for d_FP_IsNaN:\n"); printf("=============================\n"); d_FP_IsNaN_driver(); printf("==================================\n"); printf("** Driver run for f_FP_IsNegative:\n"); printf("==================================\n"); f_FP_IsNegative_driver(); printf("==================================\n"); printf("** Driver run for d_FP_IsNegative:\n"); printf("==================================\n"); d_FP_IsNegative_driver(); printf("==================================\n"); printf("** Driver run for f_FP_IsPositive:\n"); printf("==================================\n"); f_FP_IsPositive_driver(); printf("==================================\n"); printf("** Driver run for d_FP_IsPositive:\n"); printf("==================================\n"); d_FP_IsPositive_driver(); return 0; } == END: "floatCodeGen_driver.c" ================== == BEGIN: "Makefile" ================ # Makefile for floatCodeGen. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer LDFLAGS?=-lm AR?=ar ARFLAGS?=cr all: floatCodeGen.a floatCodeGen_driver floatCodeGen.a: toFP_Int8_ToFloat.o toFP_Int16_ToFloat.o toFP_Int32_ToFloat.o toFP_Int64_ToFloat.o toFP_Word8_ToFloat.o toFP_Word16_ToFloat.o toFP_Word32_ToFloat.o toFP_Word64_ToFloat.o toFP_Float_ToFloat.o toFP_Double_ToFloat.o toFP_Integer_ToFloat.o toFP_Real_ToFloat.o toFP_Int8_ToDouble.o toFP_Int16_ToDouble.o toFP_Int32_ToDouble.o toFP_Int64_ToDouble.o toFP_Word8_ToDouble.o toFP_Word16_ToDouble.o toFP_Word32_ToDouble.o toFP_Word64_ToDouble.o toFP_Float_ToDouble.o toFP_Double_ToDouble.o toFP_Integer_ToDouble.o toFP_Real_ToDouble.o fromFP_Float_ToInt8.o fromFP_Float_ToInt16.o fromFP_Float_ToInt32.o fromFP_Float_ToInt64.o fromFP_Float_ToWord8.o fromFP_Float_ToWord16.o fromFP_Float_ToWord32.o fromFP_Float_ToWord64.o fromFP_Float_ToFloat.o fromFP_Float_ToDouble.o fromFP_Float_ToInteger.o fromFP_Float_ToReal.o fromFP_DoubleTo_Int8.o fromFP_DoubleTo_Int16.o fromFP_DoubleTo_Int32.o fromFP_DoubleTo_Int64.o fromFP_DoubleTo_Word8.o fromFP_DoubleTo_Word16.o fromFP_DoubleTo_Word32.o fromFP_DoubleTo_Word64.o fromFP_DoubleTo_Float.o fromFP_DoubleTo_Double.o fromFP_DoubleTo_Integer.o fromFP_DoubleTo_Real.o fromFP_SWord32_SFloat.o fromFP_SWord64_SDouble.o fromFP_SFloat_SWord32.o fromFP_SDouble_SWord64.o f_FP_Abs.o d_FP_Abs.o f_FP_Neg.o d_FP_Neg.o f_FP_Add.o d_FP_Add.o f_FP_Sub.o d_FP_Sub.o f_FP_Mul.o d_FP_Mul.o f_FP_Div.o d_FP_Div.o f_FP_FMA.o d_FP_FMA.o f_FP_Sqrt.o d_FP_Sqrt.o f_FP_Rem.o d_FP_Rem.o f_FP_RoundToIntegral.o d_FP_RoundToIntegral.o f_FP_Min.o d_FP_Min.o f_FP_Max.o d_FP_Max.o f_FP_IsEqualObject.o d_FP_IsEqualObject.o f_FP_IsNormal.o d_FP_IsNormal.o f_FP_IsZero.o d_FP_IsZero.o f_FP_IsSubnormal.o d_FP_IsSubnormal.o f_FP_IsInfinite.o d_FP_IsInfinite.o f_FP_IsNaN.o d_FP_IsNaN.o f_FP_IsNegative.o d_FP_IsNegative.o f_FP_IsPositive.o d_FP_IsPositive.o ${AR} ${ARFLAGS} $@ $^ floatCodeGen_driver: floatCodeGen_driver.c floatCodeGen.h ${CC} ${CCFLAGS} $< -o $@ floatCodeGen.a ${LDFLAGS} toFP_Int8_ToFloat.o: toFP_Int8_ToFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Int16_ToFloat.o: toFP_Int16_ToFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Int32_ToFloat.o: toFP_Int32_ToFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Int64_ToFloat.o: toFP_Int64_ToFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Word8_ToFloat.o: toFP_Word8_ToFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Word16_ToFloat.o: toFP_Word16_ToFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Word32_ToFloat.o: toFP_Word32_ToFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Word64_ToFloat.o: toFP_Word64_ToFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Float_ToFloat.o: toFP_Float_ToFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Double_ToFloat.o: toFP_Double_ToFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Integer_ToFloat.o: toFP_Integer_ToFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Real_ToFloat.o: toFP_Real_ToFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Int8_ToDouble.o: toFP_Int8_ToDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Int16_ToDouble.o: toFP_Int16_ToDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Int32_ToDouble.o: toFP_Int32_ToDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Int64_ToDouble.o: toFP_Int64_ToDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Word8_ToDouble.o: toFP_Word8_ToDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Word16_ToDouble.o: toFP_Word16_ToDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Word32_ToDouble.o: toFP_Word32_ToDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Word64_ToDouble.o: toFP_Word64_ToDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Float_ToDouble.o: toFP_Float_ToDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Double_ToDouble.o: toFP_Double_ToDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Integer_ToDouble.o: toFP_Integer_ToDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ toFP_Real_ToDouble.o: toFP_Real_ToDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_Float_ToInt8.o: fromFP_Float_ToInt8.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_Float_ToInt16.o: fromFP_Float_ToInt16.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_Float_ToInt32.o: fromFP_Float_ToInt32.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_Float_ToInt64.o: fromFP_Float_ToInt64.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_Float_ToWord8.o: fromFP_Float_ToWord8.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_Float_ToWord16.o: fromFP_Float_ToWord16.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_Float_ToWord32.o: fromFP_Float_ToWord32.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_Float_ToWord64.o: fromFP_Float_ToWord64.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_Float_ToFloat.o: fromFP_Float_ToFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_Float_ToDouble.o: fromFP_Float_ToDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_Float_ToInteger.o: fromFP_Float_ToInteger.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_Float_ToReal.o: fromFP_Float_ToReal.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_DoubleTo_Int8.o: fromFP_DoubleTo_Int8.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_DoubleTo_Int16.o: fromFP_DoubleTo_Int16.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_DoubleTo_Int32.o: fromFP_DoubleTo_Int32.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_DoubleTo_Int64.o: fromFP_DoubleTo_Int64.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_DoubleTo_Word8.o: fromFP_DoubleTo_Word8.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_DoubleTo_Word16.o: fromFP_DoubleTo_Word16.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_DoubleTo_Word32.o: fromFP_DoubleTo_Word32.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_DoubleTo_Word64.o: fromFP_DoubleTo_Word64.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_DoubleTo_Float.o: fromFP_DoubleTo_Float.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_DoubleTo_Double.o: fromFP_DoubleTo_Double.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_DoubleTo_Integer.o: fromFP_DoubleTo_Integer.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_DoubleTo_Real.o: fromFP_DoubleTo_Real.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_SWord32_SFloat.o: fromFP_SWord32_SFloat.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_SWord64_SDouble.o: fromFP_SWord64_SDouble.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_SFloat_SWord32.o: fromFP_SFloat_SWord32.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ fromFP_SDouble_SWord64.o: fromFP_SDouble_SWord64.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_Abs.o: f_FP_Abs.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_Abs.o: d_FP_Abs.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_Neg.o: f_FP_Neg.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_Neg.o: d_FP_Neg.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_Add.o: f_FP_Add.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_Add.o: d_FP_Add.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_Sub.o: f_FP_Sub.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_Sub.o: d_FP_Sub.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_Mul.o: f_FP_Mul.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_Mul.o: d_FP_Mul.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_Div.o: f_FP_Div.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_Div.o: d_FP_Div.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_FMA.o: f_FP_FMA.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_FMA.o: d_FP_FMA.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_Sqrt.o: f_FP_Sqrt.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_Sqrt.o: d_FP_Sqrt.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_Rem.o: f_FP_Rem.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_Rem.o: d_FP_Rem.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_RoundToIntegral.o: f_FP_RoundToIntegral.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_RoundToIntegral.o: d_FP_RoundToIntegral.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_Min.o: f_FP_Min.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_Min.o: d_FP_Min.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_Max.o: f_FP_Max.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_Max.o: d_FP_Max.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_IsEqualObject.o: f_FP_IsEqualObject.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_IsEqualObject.o: d_FP_IsEqualObject.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_IsNormal.o: f_FP_IsNormal.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_IsNormal.o: d_FP_IsNormal.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_IsZero.o: f_FP_IsZero.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_IsZero.o: d_FP_IsZero.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_IsSubnormal.o: f_FP_IsSubnormal.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_IsSubnormal.o: d_FP_IsSubnormal.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_IsInfinite.o: f_FP_IsInfinite.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_IsInfinite.o: d_FP_IsInfinite.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_IsNaN.o: f_FP_IsNaN.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_IsNaN.o: d_FP_IsNaN.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_IsNegative.o: f_FP_IsNegative.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_IsNegative.o: d_FP_IsNegative.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ f_FP_IsPositive.o: f_FP_IsPositive.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ d_FP_IsPositive.o: d_FP_IsPositive.c floatCodeGen.h ${CC} ${CCFLAGS} -c $< -o $@ clean: rm -f *.o veryclean: clean rm -f floatCodeGen.a floatCodeGen_driver == END: "Makefile" ==================sbv-7.13/SBVTestSuite/GoldFiles/foldlABC1.gold0000644000000000000000000000436013405536617017153 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s3 () Int 0) [GOOD] (define-fun s19 () Int 1) [GOOD] (define-fun s12 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "a" [GOOD] (declare-fun s1 () Int) ; tracks user variable "b" [GOOD] (declare-fun s2 () Int) ; tracks user variable "c" [GOOD] (declare-fun s14 () Int) ; tracks user variable "__internal_sbv_s14" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s4 () Bool (> s0 s3)) [GOOD] (define-fun s5 () Bool (> s1 s3)) [GOOD] (define-fun s6 () Bool (> s2 s3)) [GOOD] (define-fun s7 () (Seq Int) (seq.unit s0)) [GOOD] (define-fun s8 () (Seq Int) (seq.unit s1)) [GOOD] (define-fun s9 () (Seq Int) (seq.unit s2)) [GOOD] (define-fun s10 () (Seq Int) (seq.++ s8 s9)) [GOOD] (define-fun s11 () (Seq Int) (seq.++ s7 s10)) [GOOD] (define-fun s13 () Bool (= s11 s12)) [GOOD] (define-fun s15 () (Seq Int) (seq.unit s14)) [GOOD] (define-fun s16 () Int (seq.len s11)) [GOOD] (define-fun s17 () Bool (> s16 s3)) [GOOD] (define-fun s18 () Bool (not s17)) [GOOD] (define-fun s20 () (Seq Int) (seq.extract s11 s3 s19)) [GOOD] (define-fun s21 () Bool (= s15 s20)) [GOOD] (define-fun s22 () Bool (or s18 s21)) [GOOD] (define-fun s23 () Int (ite s13 s3 s14)) [GOOD] (define-fun s24 () Int (+ s0 s1)) [GOOD] (define-fun s25 () Int (+ s2 s24)) [GOOD] (define-fun s26 () Bool (= s23 s25)) [GOOD] (assert s4) [GOOD] (assert s5) [GOOD] (assert s6) [GOOD] (assert s22) [GOOD] (assert s26) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/foldlABC2.gold0000644000000000000000000000561613405536617017161 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s3 () Int 0) [GOOD] (define-fun s19 () Int 1) [GOOD] (define-fun s12 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "a" [GOOD] (declare-fun s1 () Int) ; tracks user variable "b" [GOOD] (declare-fun s2 () Int) ; tracks user variable "c" [GOOD] (declare-fun s14 () Int) ; tracks user variable "__internal_sbv_s14" [GOOD] (declare-fun s26 () Int) ; tracks user variable "__internal_sbv_s26" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s4 () Bool (> s0 s3)) [GOOD] (define-fun s5 () Bool (> s1 s3)) [GOOD] (define-fun s6 () Bool (> s2 s3)) [GOOD] (define-fun s7 () (Seq Int) (seq.unit s0)) [GOOD] (define-fun s8 () (Seq Int) (seq.unit s1)) [GOOD] (define-fun s9 () (Seq Int) (seq.unit s2)) [GOOD] (define-fun s10 () (Seq Int) (seq.++ s8 s9)) [GOOD] (define-fun s11 () (Seq Int) (seq.++ s7 s10)) [GOOD] (define-fun s13 () Bool (= s11 s12)) [GOOD] (define-fun s15 () (Seq Int) (seq.unit s14)) [GOOD] (define-fun s16 () Int (seq.len s11)) [GOOD] (define-fun s17 () Bool (> s16 s3)) [GOOD] (define-fun s18 () Bool (not s17)) [GOOD] (define-fun s20 () (Seq Int) (seq.extract s11 s3 s19)) [GOOD] (define-fun s21 () Bool (= s15 s20)) [GOOD] (define-fun s22 () Bool (or s18 s21)) [GOOD] (define-fun s23 () Int (- s16 s19)) [GOOD] (define-fun s24 () (Seq Int) (seq.extract s11 s19 s23)) [GOOD] (define-fun s25 () Bool (= s12 s24)) [GOOD] (define-fun s27 () (Seq Int) (seq.unit s26)) [GOOD] (define-fun s28 () Int (seq.len s24)) [GOOD] (define-fun s29 () Bool (> s28 s3)) [GOOD] (define-fun s30 () Bool (not s29)) [GOOD] (define-fun s31 () (Seq Int) (seq.extract s24 s3 s19)) [GOOD] (define-fun s32 () Bool (= s27 s31)) [GOOD] (define-fun s33 () Bool (or s30 s32)) [GOOD] (define-fun s34 () Int (ite s25 s3 s26)) [GOOD] (define-fun s35 () Int (+ s14 s34)) [GOOD] (define-fun s36 () Int (ite s13 s3 s35)) [GOOD] (define-fun s37 () Int (+ s0 s1)) [GOOD] (define-fun s38 () Int (+ s2 s37)) [GOOD] (define-fun s39 () Bool (= s36 s38)) [GOOD] (assert s4) [GOOD] (assert s5) [GOOD] (assert s6) [GOOD] (assert s22) [GOOD] (assert s33) [GOOD] (assert s39) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/foldlABC3.gold0000644000000000000000000000705213405536617017156 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s3 () Int 0) [GOOD] (define-fun s19 () Int 1) [GOOD] (define-fun s12 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "a" [GOOD] (declare-fun s1 () Int) ; tracks user variable "b" [GOOD] (declare-fun s2 () Int) ; tracks user variable "c" [GOOD] (declare-fun s14 () Int) ; tracks user variable "__internal_sbv_s14" [GOOD] (declare-fun s26 () Int) ; tracks user variable "__internal_sbv_s26" [GOOD] (declare-fun s37 () Int) ; tracks user variable "__internal_sbv_s37" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s4 () Bool (> s0 s3)) [GOOD] (define-fun s5 () Bool (> s1 s3)) [GOOD] (define-fun s6 () Bool (> s2 s3)) [GOOD] (define-fun s7 () (Seq Int) (seq.unit s0)) [GOOD] (define-fun s8 () (Seq Int) (seq.unit s1)) [GOOD] (define-fun s9 () (Seq Int) (seq.unit s2)) [GOOD] (define-fun s10 () (Seq Int) (seq.++ s8 s9)) [GOOD] (define-fun s11 () (Seq Int) (seq.++ s7 s10)) [GOOD] (define-fun s13 () Bool (= s11 s12)) [GOOD] (define-fun s15 () (Seq Int) (seq.unit s14)) [GOOD] (define-fun s16 () Int (seq.len s11)) [GOOD] (define-fun s17 () Bool (> s16 s3)) [GOOD] (define-fun s18 () Bool (not s17)) [GOOD] (define-fun s20 () (Seq Int) (seq.extract s11 s3 s19)) [GOOD] (define-fun s21 () Bool (= s15 s20)) [GOOD] (define-fun s22 () Bool (or s18 s21)) [GOOD] (define-fun s23 () Int (- s16 s19)) [GOOD] (define-fun s24 () (Seq Int) (seq.extract s11 s19 s23)) [GOOD] (define-fun s25 () Bool (= s12 s24)) [GOOD] (define-fun s27 () (Seq Int) (seq.unit s26)) [GOOD] (define-fun s28 () Int (seq.len s24)) [GOOD] (define-fun s29 () Bool (> s28 s3)) [GOOD] (define-fun s30 () Bool (not s29)) [GOOD] (define-fun s31 () (Seq Int) (seq.extract s24 s3 s19)) [GOOD] (define-fun s32 () Bool (= s27 s31)) [GOOD] (define-fun s33 () Bool (or s30 s32)) [GOOD] (define-fun s34 () Int (- s28 s19)) [GOOD] (define-fun s35 () (Seq Int) (seq.extract s24 s19 s34)) [GOOD] (define-fun s36 () Bool (= s12 s35)) [GOOD] (define-fun s38 () (Seq Int) (seq.unit s37)) [GOOD] (define-fun s39 () Int (seq.len s35)) [GOOD] (define-fun s40 () Bool (> s39 s3)) [GOOD] (define-fun s41 () Bool (not s40)) [GOOD] (define-fun s42 () (Seq Int) (seq.extract s35 s3 s19)) [GOOD] (define-fun s43 () Bool (= s38 s42)) [GOOD] (define-fun s44 () Bool (or s41 s43)) [GOOD] (define-fun s45 () Int (ite s36 s3 s37)) [GOOD] (define-fun s46 () Int (+ s26 s45)) [GOOD] (define-fun s47 () Int (ite s25 s3 s46)) [GOOD] (define-fun s48 () Int (+ s14 s47)) [GOOD] (define-fun s49 () Int (ite s13 s3 s48)) [GOOD] (define-fun s50 () Int (+ s0 s1)) [GOOD] (define-fun s51 () Int (+ s2 s50)) [GOOD] (define-fun s52 () Bool (= s49 s51)) [GOOD] (assert s4) [GOOD] (assert s5) [GOOD] (assert s6) [GOOD] (assert s22) [GOOD] (assert s33) [GOOD] (assert s44) [GOOD] (assert s52) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/foldrAB1.gold0000644000000000000000000000374113405536617017060 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () Int 0) [GOOD] (define-fun s15 () Int 1) [GOOD] (define-fun s8 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "a" [GOOD] (declare-fun s1 () Int) ; tracks user variable "b" [GOOD] (declare-fun s10 () Int) ; tracks user variable "__internal_sbv_s10" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (> s0 s2)) [GOOD] (define-fun s4 () Bool (> s1 s2)) [GOOD] (define-fun s5 () (Seq Int) (seq.unit s0)) [GOOD] (define-fun s6 () (Seq Int) (seq.unit s1)) [GOOD] (define-fun s7 () (Seq Int) (seq.++ s5 s6)) [GOOD] (define-fun s9 () Bool (= s7 s8)) [GOOD] (define-fun s11 () (Seq Int) (seq.unit s10)) [GOOD] (define-fun s12 () Int (seq.len s7)) [GOOD] (define-fun s13 () Bool (> s12 s2)) [GOOD] (define-fun s14 () Bool (not s13)) [GOOD] (define-fun s16 () (Seq Int) (seq.extract s7 s2 s15)) [GOOD] (define-fun s17 () Bool (= s11 s16)) [GOOD] (define-fun s18 () Bool (or s14 s17)) [GOOD] (define-fun s19 () Int (ite s9 s2 s10)) [GOOD] (define-fun s20 () Int (+ s0 s1)) [GOOD] (define-fun s21 () Bool (= s19 s20)) [GOOD] (assert s3) [GOOD] (assert s4) [GOOD] (assert s18) [GOOD] (assert s21) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/foldrAB2.gold0000644000000000000000000000517313405536617017062 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () Int 0) [GOOD] (define-fun s15 () Int 1) [GOOD] (define-fun s8 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "a" [GOOD] (declare-fun s1 () Int) ; tracks user variable "b" [GOOD] (declare-fun s10 () Int) ; tracks user variable "__internal_sbv_s10" [GOOD] (declare-fun s22 () Int) ; tracks user variable "__internal_sbv_s22" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (> s0 s2)) [GOOD] (define-fun s4 () Bool (> s1 s2)) [GOOD] (define-fun s5 () (Seq Int) (seq.unit s0)) [GOOD] (define-fun s6 () (Seq Int) (seq.unit s1)) [GOOD] (define-fun s7 () (Seq Int) (seq.++ s5 s6)) [GOOD] (define-fun s9 () Bool (= s7 s8)) [GOOD] (define-fun s11 () (Seq Int) (seq.unit s10)) [GOOD] (define-fun s12 () Int (seq.len s7)) [GOOD] (define-fun s13 () Bool (> s12 s2)) [GOOD] (define-fun s14 () Bool (not s13)) [GOOD] (define-fun s16 () (Seq Int) (seq.extract s7 s2 s15)) [GOOD] (define-fun s17 () Bool (= s11 s16)) [GOOD] (define-fun s18 () Bool (or s14 s17)) [GOOD] (define-fun s19 () Int (- s12 s15)) [GOOD] (define-fun s20 () (Seq Int) (seq.extract s7 s15 s19)) [GOOD] (define-fun s21 () Bool (= s8 s20)) [GOOD] (define-fun s23 () (Seq Int) (seq.unit s22)) [GOOD] (define-fun s24 () Int (seq.len s20)) [GOOD] (define-fun s25 () Bool (> s24 s2)) [GOOD] (define-fun s26 () Bool (not s25)) [GOOD] (define-fun s27 () (Seq Int) (seq.extract s20 s2 s15)) [GOOD] (define-fun s28 () Bool (= s23 s27)) [GOOD] (define-fun s29 () Bool (or s26 s28)) [GOOD] (define-fun s30 () Int (ite s21 s2 s22)) [GOOD] (define-fun s31 () Int (+ s10 s30)) [GOOD] (define-fun s32 () Int (ite s9 s2 s31)) [GOOD] (define-fun s33 () Int (+ s0 s1)) [GOOD] (define-fun s34 () Bool (= s32 s33)) [GOOD] (assert s3) [GOOD] (assert s4) [GOOD] (assert s18) [GOOD] (assert s29) [GOOD] (assert s34) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/foldrAB3.gold0000644000000000000000000000643013405536617017060 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () Int 0) [GOOD] (define-fun s15 () Int 1) [GOOD] (define-fun s8 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "a" [GOOD] (declare-fun s1 () Int) ; tracks user variable "b" [GOOD] (declare-fun s10 () Int) ; tracks user variable "__internal_sbv_s10" [GOOD] (declare-fun s22 () Int) ; tracks user variable "__internal_sbv_s22" [GOOD] (declare-fun s33 () Int) ; tracks user variable "__internal_sbv_s33" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (> s0 s2)) [GOOD] (define-fun s4 () Bool (> s1 s2)) [GOOD] (define-fun s5 () (Seq Int) (seq.unit s0)) [GOOD] (define-fun s6 () (Seq Int) (seq.unit s1)) [GOOD] (define-fun s7 () (Seq Int) (seq.++ s5 s6)) [GOOD] (define-fun s9 () Bool (= s7 s8)) [GOOD] (define-fun s11 () (Seq Int) (seq.unit s10)) [GOOD] (define-fun s12 () Int (seq.len s7)) [GOOD] (define-fun s13 () Bool (> s12 s2)) [GOOD] (define-fun s14 () Bool (not s13)) [GOOD] (define-fun s16 () (Seq Int) (seq.extract s7 s2 s15)) [GOOD] (define-fun s17 () Bool (= s11 s16)) [GOOD] (define-fun s18 () Bool (or s14 s17)) [GOOD] (define-fun s19 () Int (- s12 s15)) [GOOD] (define-fun s20 () (Seq Int) (seq.extract s7 s15 s19)) [GOOD] (define-fun s21 () Bool (= s8 s20)) [GOOD] (define-fun s23 () (Seq Int) (seq.unit s22)) [GOOD] (define-fun s24 () Int (seq.len s20)) [GOOD] (define-fun s25 () Bool (> s24 s2)) [GOOD] (define-fun s26 () Bool (not s25)) [GOOD] (define-fun s27 () (Seq Int) (seq.extract s20 s2 s15)) [GOOD] (define-fun s28 () Bool (= s23 s27)) [GOOD] (define-fun s29 () Bool (or s26 s28)) [GOOD] (define-fun s30 () Int (- s24 s15)) [GOOD] (define-fun s31 () (Seq Int) (seq.extract s20 s15 s30)) [GOOD] (define-fun s32 () Bool (= s8 s31)) [GOOD] (define-fun s34 () (Seq Int) (seq.unit s33)) [GOOD] (define-fun s35 () Int (seq.len s31)) [GOOD] (define-fun s36 () Bool (> s35 s2)) [GOOD] (define-fun s37 () Bool (not s36)) [GOOD] (define-fun s38 () (Seq Int) (seq.extract s31 s2 s15)) [GOOD] (define-fun s39 () Bool (= s34 s38)) [GOOD] (define-fun s40 () Bool (or s37 s39)) [GOOD] (define-fun s41 () Int (ite s32 s2 s33)) [GOOD] (define-fun s42 () Int (+ s22 s41)) [GOOD] (define-fun s43 () Int (ite s21 s2 s42)) [GOOD] (define-fun s44 () Int (+ s10 s43)) [GOOD] (define-fun s45 () Int (ite s9 s2 s44)) [GOOD] (define-fun s46 () Int (+ s0 s1)) [GOOD] (define-fun s47 () Bool (= s45 s46)) [GOOD] (assert s3) [GOOD] (assert s4) [GOOD] (assert s18) [GOOD] (assert s29) [GOOD] (assert s40) [GOOD] (assert s47) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/freshVars.gold0000644000000000000000000002070713405536617017432 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s1 () Int 0) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "a" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (= s0 s1)) [GOOD] (assert s2) [GOOD] (declare-fun s3 () Bool) [GOOD] (declare-fun s4 () (_ BitVec 8)) [GOOD] (declare-fun s5 () (_ BitVec 16)) [GOOD] (declare-fun s6 () (_ BitVec 32)) [GOOD] (declare-fun s7 () (_ BitVec 64)) [GOOD] (declare-fun s8 () (_ BitVec 8)) [GOOD] (declare-fun s9 () (_ BitVec 16)) [GOOD] (declare-fun s10 () (_ BitVec 32)) [GOOD] (declare-fun s11 () (_ BitVec 64)) [GOOD] (declare-fun s12 () (_ FloatingPoint 8 24)) [GOOD] (declare-fun s13 () (_ FloatingPoint 11 53)) [GOOD] (declare-fun s14 () Real) [GOOD] (declare-fun s15 () Int) [GOOD] (declare-datatypes () ((BinOp (Plus) (Minus) (Times)))) [GOOD] (define-fun BinOp_constrIndex ((x BinOp)) Int (ite (= x Plus) 0 (ite (= x Minus) 1 2)) ) [GOOD] (declare-fun s16 () BinOp) [GOOD] (assert s3) [GOOD] (define-fun s17 () (_ BitVec 8) #x01) [GOOD] (define-fun s18 () Bool (= s4 s17)) [GOOD] (assert s18) [GOOD] (define-fun s19 () (_ BitVec 16) #x0002) [GOOD] (define-fun s20 () Bool (= s5 s19)) [GOOD] (assert s20) [GOOD] (define-fun s21 () (_ BitVec 32) #x00000003) [GOOD] (define-fun s22 () Bool (= s6 s21)) [GOOD] (assert s22) [GOOD] (define-fun s23 () (_ BitVec 64) #x0000000000000004) [GOOD] (define-fun s24 () Bool (= s7 s23)) [GOOD] (assert s24) [GOOD] (define-fun s25 () (_ BitVec 8) #x05) [GOOD] (define-fun s26 () Bool (= s8 s25)) [GOOD] (assert s26) [GOOD] (define-fun s27 () (_ BitVec 16) #x0006) [GOOD] (define-fun s28 () Bool (= s9 s27)) [GOOD] (assert s28) [GOOD] (define-fun s29 () (_ BitVec 32) #x00000007) [GOOD] (define-fun s30 () Bool (= s10 s29)) [GOOD] (assert s30) [GOOD] (define-fun s31 () (_ BitVec 64) #x0000000000000008) [GOOD] (define-fun s32 () Bool (= s11 s31)) [GOOD] (assert s32) [GOOD] (define-fun s33 () (_ FloatingPoint 8 24) ((_ to_fp 8 24) roundNearestTiesToEven (/ 9.0 1.0))) [GOOD] (define-fun s34 () Bool (fp.eq s12 s33)) [GOOD] (assert s34) [GOOD] (define-fun s35 () (_ FloatingPoint 11 53) ((_ to_fp 11 53) roundNearestTiesToEven (/ 10.0 1.0))) [GOOD] (define-fun s36 () Bool (fp.eq s13 s35)) [GOOD] (assert s36) [GOOD] (define-fun s37 () Real (/ 11.0 1.0)) [GOOD] (define-fun s38 () Bool (= s14 s37)) [GOOD] (assert s38) [GOOD] (define-fun s39 () Int 12) [GOOD] (define-fun s40 () Bool (= s15 s39)) [GOOD] (assert s40) [GOOD] (define-fun s41 () BinOp Plus) [GOOD] (define-fun s42 () Bool (= s16 s41)) [GOOD] (assert s42) [GOOD] (declare-fun array_0 () (Array Int Int)) [GOOD] (declare-fun s43 () Int) [GOOD] (declare-fun s44 () Bool) [GOOD] (define-fun s46 () Int 2) [GOOD] (define-fun s45 () Int (select array_0 s43)) [GOOD] (define-fun s47 () Bool (= s45 s46)) [GOOD] (assert s47) [GOOD] (define-fun s49 () (_ BitVec 8) #x61) [GOOD] (declare-fun vFArray_uninitializedRead (Bool) (_ BitVec 8)) [GOOD] (define-fun s48 () (_ BitVec 8) (vFArray_uninitializedRead s44)) [GOOD] (define-fun s50 () Bool (= s48 s49)) [GOOD] (assert s50) [GOOD] (define-fun s51 () Int 42) [GOOD] (define-fun array_1 () (Array Int Int) ((as const (Array Int Int)) 42)) [GOOD] (declare-fun s52 () Int) [GOOD] (declare-fun s53 () (_ BitVec 8)) [GOOD] (define-fun s54 () Int 96) [GOOD] (define-fun s55 () Int (select array_1 s54)) [GOOD] (define-fun s56 () Bool (= s52 s55)) [GOOD] (assert s56) [GOOD] (define-fun s57 () (_ BitVec 8) #x58) [GOOD] (define-fun s58 () Bool (= s53 s57)) [GOOD] (assert s58) [GOOD] (define-fun s59 () Int 1) [GOOD] (define-fun s60 () Bool (= s43 s59)) [GOOD] (assert s60) [GOOD] (define-fun s61 () Bool (not s44)) [GOOD] (assert s61) [GOOD] (declare-fun s62 () String) [GOOD] (declare-fun s63 () (Seq Int)) [GOOD] (declare-fun s64 () (Seq (Seq Int))) [GOOD] (declare-fun s65 () (Seq (_ BitVec 8))) [GOOD] (declare-fun s66 () (Seq (Seq (_ BitVec 16)))) [GOOD] (define-fun s67 () String "hello") [GOOD] (define-fun s68 () Bool (= s62 s67)) [GOOD] (assert s68) [GOOD] (define-fun s69 () (Seq Int) (seq.++ (seq.unit 1) (seq.unit 2) (seq.unit 3) (seq.unit 4))) [GOOD] (define-fun s70 () Bool (= s63 s69)) [GOOD] (assert s70) [GOOD] (define-fun s71 () (Seq (Seq Int)) (seq.++ (seq.unit (seq.++ (seq.unit 1) (seq.unit 2) (seq.unit 3))) (seq.unit (seq.++ (seq.unit 4) (seq.unit 5) (seq.unit 6) (seq.unit 7))))) [GOOD] (define-fun s72 () Bool (= s64 s71)) [GOOD] (assert s72) [GOOD] (define-fun s73 () (Seq (_ BitVec 8)) (seq.++ (seq.unit #x01) (seq.unit #x02))) [GOOD] (define-fun s74 () Bool (= s65 s73)) [GOOD] (assert s74) [GOOD] (define-fun s75 () (Seq (Seq (_ BitVec 16))) (seq.++ (seq.unit (seq.++ (seq.unit #x0001) (seq.unit #x0002) (seq.unit #x0003))) (seq.unit (as seq.empty (Seq (_ BitVec 16)))) (seq.unit (seq.++ (seq.unit #x0004) (seq.unit #x0005) (seq.unit #x0006))))) [GOOD] (define-fun s76 () Bool (= s66 s75)) [GOOD] (assert s76) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 0)) [SEND] (get-value (s3)) [RECV] ((s3 true)) [SEND] (get-value (s4)) [RECV] ((s4 #x01)) [SEND] (get-value (s5)) [RECV] ((s5 #x0002)) [SEND] (get-value (s6)) [RECV] ((s6 #x00000003)) [SEND] (get-value (s7)) [RECV] ((s7 #x0000000000000004)) [SEND] (get-value (s8)) [RECV] ((s8 #x05)) [SEND] (get-value (s9)) [RECV] ((s9 #x0006)) [SEND] (get-value (s10)) [RECV] ((s10 #x00000007)) [SEND] (get-value (s11)) [RECV] ((s11 #x0000000000000008)) [SEND] (get-value (s12)) [RECV] ((s12 (fp #b0 #x82 #b00100000000000000000000))) [SEND] (get-value (s13)) [RECV] ((s13 (fp #b0 #b10000000010 #x4000000000000))) [SEND] (get-value (s14)) [RECV] ((s14 11.0)) [SEND] (get-value (s15)) [RECV] ((s15 12)) [SEND] (get-value (s16)) [RECV] ((s16 Plus)) [SEND] (get-value (s43)) [RECV] ((s43 1)) [SEND] (get-value (s44)) [RECV] ((s44 false)) [SEND] (get-value (s52)) [RECV] ((s52 42)) [SEND] (get-value (s53)) [RECV] ((s53 #x58)) [SEND] (get-value (s62)) [RECV] ((s62 "hello")) [SEND] (get-value (s63)) [RECV] ((s63 (seq.++ (seq.unit 1) (seq.++ (seq.unit 2) (seq.++ (seq.unit 3) (seq.unit 4)))))) [SEND] (get-value (s64)) [RECV] ((s64 (seq.++ (seq.unit (seq.++ (seq.unit 1) (seq.++ (seq.unit 2) (seq.unit 3)))) (seq.unit (seq.++ (seq.unit 4) (seq.++ (seq.unit 5) (seq.++ (seq.unit 6) (seq.unit 7)))))))) [SEND] (get-value (s65)) [RECV] ((s65 "\x01\x02")) [SEND] (get-value (s66)) [RECV] ((s66 (seq.++ (seq.unit (seq.++ (seq.unit #x0001) (seq.++ (seq.unit #x0002) (seq.unit #x0003)))) (seq.++ (seq.unit (as seq.empty (Seq (_ BitVec 16)))) (seq.unit (seq.++ (seq.unit #x0004) (seq.++ (seq.unit #x0005) (seq.unit #x0006)))))))) *** Solver : Z3 *** Exit code: ExitSuccess FINAL:Satisfiable. Model: a = 0 :: Integer vBool = True :: Bool vWord8 = 1 :: Word8 s5 = 2 :: Word16 s6 = 3 :: Word32 vWord64 = 4 :: Word64 vInt8 = 5 :: Int8 s9 = 6 :: Int16 s10 = 7 :: Int32 vInt64 = 8 :: Int64 vFloat = 9.0 :: Float s13 = 10.0 :: Double s14 = 11.0 :: Real vInteger = 12 :: Integer vBinOp = Plus :: BinOp i1 = 1 :: Integer i2 = False :: Bool mustBe42 = 42 :: Integer mustBeX = 'X' :: Char vString = "hello" :: String vList1 = [1,2,3,4] :: [SInteger] vList2 = [[1,2,3],[4,5,6,7]] :: [[SInteger]] vList3 = [1,2] :: [SWord8] vList4 = [[1,2,3],[],[4,5,6]] :: [[SWord16]] DONE! sbv-7.13/SBVTestSuite/GoldFiles/gcd.gold0000644000000000000000000000731213405536617016221 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for sgcd. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: sgcd_driver sgcd.o: sgcd.c sgcd.h ${CC} ${CCFLAGS} -c $< -o $@ sgcd_driver.o: sgcd_driver.c ${CC} ${CCFLAGS} -c $< -o $@ sgcd_driver: sgcd.o sgcd_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f sgcd_driver == END: "Makefile" ================== == BEGIN: "sgcd.h" ================ /* Header file for sgcd. Automatically generated by SBV. Do not edit! */ #ifndef __sgcd__HEADER_INCLUDED__ #define __sgcd__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ SWord8 sgcd(const SWord8 x, const SWord8 y); #endif /* __sgcd__HEADER_INCLUDED__ */ == END: "sgcd.h" ================== == BEGIN: "sgcd_driver.c" ================ /* Example driver program for sgcd. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "sgcd.h" int main(void) { const SWord8 __result = sgcd(55, 154); printf("sgcd(55, 154) = %"PRIu8"\n", __result); return 0; } == END: "sgcd_driver.c" ================== == BEGIN: "sgcd.c" ================ /* File: "sgcd.c". Automatically generated by SBV. Do not edit! */ #include "sgcd.h" SWord8 sgcd(const SWord8 x, const SWord8 y) { const SWord8 s0 = x; const SWord8 s1 = y; const SBool s3 = s1 == 0; const SWord8 s4 = (s1 == 0) ? s0 : (s0 % s1); const SWord8 s5 = s3 ? s0 : s4; const SBool s6 = 0 == s5; const SWord8 s7 = (s5 == 0) ? s1 : (s1 % s5); const SWord8 s8 = s6 ? s1 : s7; const SBool s9 = 0 == s8; const SWord8 s10 = (s8 == 0) ? s5 : (s5 % s8); const SWord8 s11 = s9 ? s5 : s10; const SBool s12 = 0 == s11; const SWord8 s13 = (s11 == 0) ? s8 : (s8 % s11); const SWord8 s14 = s12 ? s8 : s13; const SBool s15 = 0 == s14; const SWord8 s16 = (s14 == 0) ? s11 : (s11 % s14); const SWord8 s17 = s15 ? s11 : s16; const SBool s18 = 0 == s17; const SWord8 s19 = (s17 == 0) ? s14 : (s14 % s17); const SWord8 s20 = s18 ? s14 : s19; const SBool s21 = 0 == s20; const SWord8 s22 = (s20 == 0) ? s17 : (s17 % s20); const SWord8 s23 = s21 ? s17 : s22; const SBool s24 = 0 == s23; const SWord8 s25 = (s23 == 0) ? s20 : (s20 % s23); const SWord8 s26 = s24 ? s20 : s25; const SBool s27 = 0 == s26; const SWord8 s28 = (s26 == 0) ? s23 : (s23 % s26); const SWord8 s29 = s27 ? s23 : s28; const SBool s30 = 0 == s29; const SWord8 s31 = (s29 == 0) ? s26 : (s26 % s29); const SWord8 s32 = s30 ? s26 : s31; const SBool s33 = 0 == s32; const SWord8 s34 = (s32 == 0) ? s29 : (s29 % s32); const SWord8 s35 = s33 ? s29 : s34; const SBool s36 = 0 == s35; const SWord8 s37 = s36 ? s32 : s35; const SWord8 s38 = s33 ? s29 : s37; const SWord8 s39 = s30 ? s26 : s38; const SWord8 s40 = s27 ? s23 : s39; const SWord8 s41 = s24 ? s20 : s40; const SWord8 s42 = s21 ? s17 : s41; const SWord8 s43 = s18 ? s14 : s42; const SWord8 s44 = s15 ? s11 : s43; const SWord8 s45 = s12 ? s8 : s44; const SWord8 s46 = s9 ? s5 : s45; const SWord8 s47 = s6 ? s1 : s46; const SWord8 s48 = s3 ? s0 : s47; return s48; } == END: "sgcd.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/genBenchMark1.gold0000644000000000000000000000114713405536617020071 0ustar0000000000000000(set-option :smtlib2_compliant true) (set-option :diagnostic-output-channel "stdout") (set-option :produce-models true) (set-logic QF_BV) ; --- uninterpreted sorts --- ; --- literal constants --- (define-fun s_2 () Bool false) (define-fun s_1 () Bool true) (define-fun s1 () (_ BitVec 8) #x01) ; --- skolem constants --- (declare-fun s0 () (_ BitVec 8)) ; --- constant tables --- ; --- skolemized tables --- ; --- arrays --- ; --- uninterpreted constants --- ; --- user given axioms --- ; --- formula --- (define-fun s2 () (_ BitVec 8) (bvadd s0 s1)) (define-fun s3 () Bool (= s0 s2)) (assert (not s3)) (check-sat) sbv-7.13/SBVTestSuite/GoldFiles/genBenchMark2.gold0000644000000000000000000000114113405536617020064 0ustar0000000000000000(set-option :smtlib2_compliant true) (set-option :diagnostic-output-channel "stdout") (set-option :produce-models true) (set-logic QF_BV) ; --- uninterpreted sorts --- ; --- literal constants --- (define-fun s_2 () Bool false) (define-fun s_1 () Bool true) (define-fun s1 () (_ BitVec 8) #x01) ; --- skolem constants --- (declare-fun s0 () (_ BitVec 8)) ; --- constant tables --- ; --- skolemized tables --- ; --- arrays --- ; --- uninterpreted constants --- ; --- user given axioms --- ; --- formula --- (define-fun s2 () (_ BitVec 8) (bvadd s0 s1)) (define-fun s3 () Bool (= s0 s2)) (assert s3) (check-sat) sbv-7.13/SBVTestSuite/GoldFiles/higher-1.gold0000644000000000000000000000000613405536617017061 0ustar0000000000000000Q.E.D.sbv-7.13/SBVTestSuite/GoldFiles/higher-2.gold0000644000000000000000000000000613405536617017062 0ustar0000000000000000Q.E.D.sbv-7.13/SBVTestSuite/GoldFiles/higher-3.gold0000644000000000000000000000000613405536617017063 0ustar0000000000000000Q.E.D.sbv-7.13/SBVTestSuite/GoldFiles/higher-4.gold0000644000000000000000000000000613405536617017064 0ustar0000000000000000Q.E.D.sbv-7.13/SBVTestSuite/GoldFiles/higher-5.gold0000644000000000000000000000000613405536617017065 0ustar0000000000000000Q.E.D.sbv-7.13/SBVTestSuite/GoldFiles/higher-6.gold0000644000000000000000000000000613405536617017066 0ustar0000000000000000Q.E.D.sbv-7.13/SBVTestSuite/GoldFiles/higher-7.gold0000644000000000000000000000000613405536617017067 0ustar0000000000000000Q.E.D.sbv-7.13/SBVTestSuite/GoldFiles/higher-8.gold0000644000000000000000000000000613405536617017070 0ustar0000000000000000Q.E.D.sbv-7.13/SBVTestSuite/GoldFiles/higher-9.gold0000644000000000000000000000006113405536617017072 0ustar0000000000000000Falsifiable. Counter-example: s0 = 128 :: Word8sbv-7.13/SBVTestSuite/GoldFiles/iteTest1.gold0000644000000000000000000000030413405536617017160 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE CONSTRAINTS ASSERTIONS OUTPUTSsbv-7.13/SBVTestSuite/GoldFiles/iteTest2.gold0000644000000000000000000000030413405536617017161 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE CONSTRAINTS ASSERTIONS OUTPUTSsbv-7.13/SBVTestSuite/GoldFiles/iteTest3.gold0000644000000000000000000000030413405536617017162 0ustar0000000000000000INPUTS s0 :: SWord8, aliasing "x" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE CONSTRAINTS ASSERTIONS OUTPUTSsbv-7.13/SBVTestSuite/GoldFiles/legato.gold0000644000000000000000000071302313405536617016742 0ustar0000000000000000INPUTS s0 :: SWord8, existential, aliasing "x" s1 :: SWord8, existential, aliasing "y" s2 :: SWord8, existential, aliasing "lo" s3 :: SWord8, existential, aliasing "regX" s4 :: SWord8, existential, aliasing "regA" s5 :: SBool, existential, aliasing "flagC" s6 :: SBool, existential, aliasing "flagZ" CONSTANTS s_2 = False :: Bool s_1 = True :: Bool s10 = 0 :: Word1 s8 = 0 :: Word8 s14 = 128 :: Word8 s16 = 127 :: Word8 s7 = 256 :: Word16 TABLES ARRAYS UNINTERPRETED CONSTANTS USER GIVEN CODE SEGMENTS AXIOMS DEFINE s9 :: SWord1 = choose [0:0] s0 s11 :: SBool = s9 /= s10 s12 :: SBool = s_2 == s11 s13 :: SWord8 = s0 >>> 1 s15 :: SWord8 = s13 | s14 s17 :: SWord8 = s13 & s16 s18 :: SWord8 = if s5 then s15 else s17 s19 :: SWord1 = choose [0:0] s18 s20 :: SBool = s10 /= s19 s21 :: SBool = s_2 == s20 s22 :: SWord1 = choose [0:0] s2 s23 :: SBool = s10 /= s22 s24 :: SWord8 = s18 >>> 1 s25 :: SWord8 = s14 | s24 s26 :: SWord8 = s16 & s24 s27 :: SWord8 = if s23 then s25 else s26 s28 :: SWord1 = choose [0:0] s27 s29 :: SBool = s10 /= s28 s30 :: SBool = s_2 == s29 s31 :: SWord8 = s2 >>> 1 s32 :: SWord8 = s16 & s31 s33 :: SWord1 = choose [0:0] s32 s34 :: SBool = s10 /= s33 s35 :: SWord8 = s27 >>> 1 s36 :: SWord8 = s14 | s35 s37 :: SWord8 = s16 & s35 s38 :: SWord8 = if s34 then s36 else s37 s39 :: SWord1 = choose [0:0] s38 s40 :: SBool = s10 /= s39 s41 :: SBool = s_2 == s40 s42 :: SWord8 = if s11 then s14 else s8 s43 :: SWord1 = choose [0:0] s42 s44 :: SBool = s10 /= s43 s45 :: SWord8 = s32 >>> 1 s46 :: SWord8 = s14 | s45 s47 :: SWord8 = s16 & s45 s48 :: SWord8 = if s44 then s46 else s47 s49 :: SWord1 = choose [0:0] s48 s50 :: SBool = s10 /= s49 s51 :: SWord8 = s38 >>> 1 s52 :: SWord8 = s14 | s51 s53 :: SWord8 = s16 & s51 s54 :: SWord8 = if s50 then s52 else s53 s55 :: SWord1 = choose [0:0] s54 s56 :: SBool = s10 /= s55 s57 :: SBool = s_2 == s56 s58 :: SWord8 = s42 >>> 1 s59 :: SWord8 = s14 | s58 s60 :: SWord8 = s16 & s58 s61 :: SWord8 = if s20 then s59 else s60 s62 :: SWord1 = choose [0:0] s61 s63 :: SBool = s10 /= s62 s64 :: SWord8 = s48 >>> 1 s65 :: SWord8 = s14 | s64 s66 :: SWord8 = s16 & s64 s67 :: SWord8 = if s63 then s65 else s66 s68 :: SWord1 = choose [0:0] s67 s69 :: SBool = s10 /= s68 s70 :: SWord8 = s54 >>> 1 s71 :: SWord8 = s14 | s70 s72 :: SWord8 = s16 & s70 s73 :: SWord8 = if s69 then s71 else s72 s74 :: SWord1 = choose [0:0] s73 s75 :: SBool = s10 /= s74 s76 :: SBool = s_2 == s75 s77 :: SWord8 = s61 >>> 1 s78 :: SWord8 = s14 | s77 s79 :: SWord8 = s16 & s77 s80 :: SWord8 = if s29 then s78 else s79 s81 :: SWord1 = choose [0:0] s80 s82 :: SBool = s10 /= s81 s83 :: SWord8 = s67 >>> 1 s84 :: SWord8 = s14 | s83 s85 :: SWord8 = s16 & s83 s86 :: SWord8 = if s82 then s84 else s85 s87 :: SWord1 = choose [0:0] s86 s88 :: SBool = s10 /= s87 s89 :: SWord8 = s73 >>> 1 s90 :: SWord8 = s14 | s89 s91 :: SWord8 = s16 & s89 s92 :: SWord8 = if s88 then s90 else s91 s93 :: SWord1 = choose [0:0] s92 s94 :: SBool = s10 /= s93 s95 :: SBool = s_2 == s94 s96 :: SWord8 = s80 >>> 1 s97 :: SWord8 = s14 | s96 s98 :: SWord8 = s16 & s96 s99 :: SWord8 = if s40 then s97 else s98 s100 :: SWord1 = choose [0:0] s99 s101 :: SBool = s10 /= s100 s102 :: SWord8 = s86 >>> 1 s103 :: SWord8 = s14 | s102 s104 :: SWord8 = s16 & s102 s105 :: SWord8 = if s101 then s103 else s104 s106 :: SWord1 = choose [0:0] s105 s107 :: SBool = s10 /= s106 s108 :: SWord8 = s92 >>> 1 s109 :: SWord8 = s14 | s108 s110 :: SWord8 = s16 & s108 s111 :: SWord8 = if s107 then s109 else s110 s112 :: SWord1 = choose [0:0] s111 s113 :: SBool = s10 /= s112 s114 :: SBool = s_2 == s113 s115 :: SWord8 = s99 >>> 1 s116 :: SWord8 = s14 | s115 s117 :: SWord8 = s16 & s115 s118 :: SWord8 = if s56 then s116 else s117 s119 :: SWord8 = s118 >>> 1 s120 :: SWord8 = s14 | s119 s121 :: SWord8 = s16 & s119 s122 :: SWord8 = if s75 then s120 else s121 s123 :: SWord8 = s122 >>> 1 s124 :: SWord8 = s14 | s123 s125 :: SWord8 = s16 & s123 s126 :: SWord8 = if s94 then s124 else s125 s127 :: SWord8 = s126 >>> 1 s128 :: SWord8 = s14 | s127 s129 :: SWord8 = s16 & s127 s130 :: SWord8 = if s113 then s128 else s129 s131 :: SWord8 = s1 + s126 s132 :: SBool = s131 < s1 s133 :: SBool = s131 < s126 s134 :: SBool = s132 | s133 s135 :: SWord8 = s131 >>> 1 s136 :: SWord8 = s14 | s135 s137 :: SWord8 = s16 & s135 s138 :: SWord8 = if s134 then s136 else s137 s139 :: SWord8 = if s114 then s130 else s138 s140 :: SWord8 = s1 + s122 s141 :: SBool = s140 < s1 s142 :: SBool = s140 < s122 s143 :: SBool = s141 | s142 s144 :: SWord8 = s140 >>> 1 s145 :: SWord8 = s14 | s144 s146 :: SWord8 = s16 & s144 s147 :: SWord8 = if s143 then s145 else s146 s148 :: SWord8 = s147 >>> 1 s149 :: SWord8 = s14 | s148 s150 :: SWord8 = s16 & s148 s151 :: SWord8 = if s113 then s149 else s150 s152 :: SWord8 = s1 + s147 s153 :: SBool = s152 < s1 s154 :: SBool = s152 < s147 s155 :: SBool = s153 | s154 s156 :: SWord8 = s152 >>> 1 s157 :: SWord8 = s14 | s156 s158 :: SWord8 = s16 & s156 s159 :: SWord8 = if s155 then s157 else s158 s160 :: SWord8 = if s114 then s151 else s159 s161 :: SWord8 = if s95 then s139 else s160 s162 :: SWord8 = s1 + s118 s163 :: SBool = s162 < s1 s164 :: SBool = s162 < s118 s165 :: SBool = s163 | s164 s166 :: SWord8 = s162 >>> 1 s167 :: SWord8 = s14 | s166 s168 :: SWord8 = s16 & s166 s169 :: SWord8 = if s165 then s167 else s168 s170 :: SWord8 = s169 >>> 1 s171 :: SWord8 = s14 | s170 s172 :: SWord8 = s16 & s170 s173 :: SWord8 = if s94 then s171 else s172 s174 :: SWord8 = s173 >>> 1 s175 :: SWord8 = s14 | s174 s176 :: SWord8 = s16 & s174 s177 :: SWord8 = if s113 then s175 else s176 s178 :: SWord8 = s1 + s173 s179 :: SBool = s178 < s1 s180 :: SBool = s178 < s173 s181 :: SBool = s179 | s180 s182 :: SWord8 = s178 >>> 1 s183 :: SWord8 = s14 | s182 s184 :: SWord8 = s16 & s182 s185 :: SWord8 = if s181 then s183 else s184 s186 :: SWord8 = if s114 then s177 else s185 s187 :: SWord8 = s1 + s169 s188 :: SBool = s187 < s1 s189 :: SBool = s187 < s169 s190 :: SBool = s188 | s189 s191 :: SWord8 = s187 >>> 1 s192 :: SWord8 = s14 | s191 s193 :: SWord8 = s16 & s191 s194 :: SWord8 = if s190 then s192 else s193 s195 :: SWord8 = s194 >>> 1 s196 :: SWord8 = s14 | s195 s197 :: SWord8 = s16 & s195 s198 :: SWord8 = if s113 then s196 else s197 s199 :: SWord8 = s1 + s194 s200 :: SBool = s199 < s1 s201 :: SBool = s199 < s194 s202 :: SBool = s200 | s201 s203 :: SWord8 = s199 >>> 1 s204 :: SWord8 = s14 | s203 s205 :: SWord8 = s16 & s203 s206 :: SWord8 = if s202 then s204 else s205 s207 :: SWord8 = if s114 then s198 else s206 s208 :: SWord8 = if s95 then s186 else s207 s209 :: SWord8 = if s76 then s161 else s208 s210 :: SWord8 = s1 + s99 s211 :: SWord1 = choose [0:0] s210 s212 :: SBool = s10 /= s211 s213 :: SWord8 = if s212 then s103 else s104 s214 :: SWord1 = choose [0:0] s213 s215 :: SBool = s10 /= s214 s216 :: SWord8 = if s215 then s109 else s110 s217 :: SWord1 = choose [0:0] s216 s218 :: SBool = s10 /= s217 s219 :: SBool = s_2 == s218 s220 :: SBool = s210 < s1 s221 :: SBool = s210 < s99 s222 :: SBool = s220 | s221 s223 :: SWord8 = s210 >>> 1 s224 :: SWord8 = s14 | s223 s225 :: SWord8 = s16 & s223 s226 :: SWord8 = if s222 then s224 else s225 s227 :: SWord8 = s226 >>> 1 s228 :: SWord8 = s14 | s227 s229 :: SWord8 = s16 & s227 s230 :: SWord8 = if s75 then s228 else s229 s231 :: SWord8 = s230 >>> 1 s232 :: SWord8 = s14 | s231 s233 :: SWord8 = s16 & s231 s234 :: SWord8 = if s94 then s232 else s233 s235 :: SWord8 = s234 >>> 1 s236 :: SWord8 = s14 | s235 s237 :: SWord8 = s16 & s235 s238 :: SWord8 = if s218 then s236 else s237 s239 :: SWord8 = s1 + s234 s240 :: SBool = s239 < s1 s241 :: SBool = s239 < s234 s242 :: SBool = s240 | s241 s243 :: SWord8 = s239 >>> 1 s244 :: SWord8 = s14 | s243 s245 :: SWord8 = s16 & s243 s246 :: SWord8 = if s242 then s244 else s245 s247 :: SWord8 = if s219 then s238 else s246 s248 :: SWord8 = s1 + s230 s249 :: SBool = s248 < s1 s250 :: SBool = s248 < s230 s251 :: SBool = s249 | s250 s252 :: SWord8 = s248 >>> 1 s253 :: SWord8 = s14 | s252 s254 :: SWord8 = s16 & s252 s255 :: SWord8 = if s251 then s253 else s254 s256 :: SWord8 = s255 >>> 1 s257 :: SWord8 = s14 | s256 s258 :: SWord8 = s16 & s256 s259 :: SWord8 = if s218 then s257 else s258 s260 :: SWord8 = s1 + s255 s261 :: SBool = s260 < s1 s262 :: SBool = s260 < s255 s263 :: SBool = s261 | s262 s264 :: SWord8 = s260 >>> 1 s265 :: SWord8 = s14 | s264 s266 :: SWord8 = s16 & s264 s267 :: SWord8 = if s263 then s265 else s266 s268 :: SWord8 = if s219 then s259 else s267 s269 :: SWord8 = if s95 then s247 else s268 s270 :: SWord8 = s1 + s226 s271 :: SBool = s270 < s1 s272 :: SBool = s270 < s226 s273 :: SBool = s271 | s272 s274 :: SWord8 = s270 >>> 1 s275 :: SWord8 = s14 | s274 s276 :: SWord8 = s16 & s274 s277 :: SWord8 = if s273 then s275 else s276 s278 :: SWord8 = s277 >>> 1 s279 :: SWord8 = s14 | s278 s280 :: SWord8 = s16 & s278 s281 :: SWord8 = if s94 then s279 else s280 s282 :: SWord8 = s281 >>> 1 s283 :: SWord8 = s14 | s282 s284 :: SWord8 = s16 & s282 s285 :: SWord8 = if s218 then s283 else s284 s286 :: SWord8 = s1 + s281 s287 :: SBool = s286 < s1 s288 :: SBool = s286 < s281 s289 :: SBool = s287 | s288 s290 :: SWord8 = s286 >>> 1 s291 :: SWord8 = s14 | s290 s292 :: SWord8 = s16 & s290 s293 :: SWord8 = if s289 then s291 else s292 s294 :: SWord8 = if s219 then s285 else s293 s295 :: SWord8 = s1 + s277 s296 :: SBool = s295 < s1 s297 :: SBool = s295 < s277 s298 :: SBool = s296 | s297 s299 :: SWord8 = s295 >>> 1 s300 :: SWord8 = s14 | s299 s301 :: SWord8 = s16 & s299 s302 :: SWord8 = if s298 then s300 else s301 s303 :: SWord8 = s302 >>> 1 s304 :: SWord8 = s14 | s303 s305 :: SWord8 = s16 & s303 s306 :: SWord8 = if s218 then s304 else s305 s307 :: SWord8 = s1 + s302 s308 :: SBool = s307 < s1 s309 :: SBool = s307 < s302 s310 :: SBool = s308 | s309 s311 :: SWord8 = s307 >>> 1 s312 :: SWord8 = s14 | s311 s313 :: SWord8 = s16 & s311 s314 :: SWord8 = if s310 then s312 else s313 s315 :: SWord8 = if s219 then s306 else s314 s316 :: SWord8 = if s95 then s294 else s315 s317 :: SWord8 = if s76 then s269 else s316 s318 :: SWord8 = if s57 then s209 else s317 s319 :: SWord8 = s1 + s80 s320 :: SWord1 = choose [0:0] s319 s321 :: SBool = s10 /= s320 s322 :: SWord8 = if s321 then s84 else s85 s323 :: SWord1 = choose [0:0] s322 s324 :: SBool = s10 /= s323 s325 :: SWord8 = if s324 then s90 else s91 s326 :: SWord1 = choose [0:0] s325 s327 :: SBool = s10 /= s326 s328 :: SBool = s_2 == s327 s329 :: SBool = s319 < s1 s330 :: SBool = s319 < s80 s331 :: SBool = s329 | s330 s332 :: SWord8 = s319 >>> 1 s333 :: SWord8 = s14 | s332 s334 :: SWord8 = s16 & s332 s335 :: SWord8 = if s331 then s333 else s334 s336 :: SWord1 = choose [0:0] s335 s337 :: SBool = s10 /= s336 s338 :: SWord8 = s322 >>> 1 s339 :: SWord8 = s14 | s338 s340 :: SWord8 = s16 & s338 s341 :: SWord8 = if s337 then s339 else s340 s342 :: SWord1 = choose [0:0] s341 s343 :: SBool = s10 /= s342 s344 :: SWord8 = s325 >>> 1 s345 :: SWord8 = s14 | s344 s346 :: SWord8 = s16 & s344 s347 :: SWord8 = if s343 then s345 else s346 s348 :: SWord1 = choose [0:0] s347 s349 :: SBool = s10 /= s348 s350 :: SBool = s_2 == s349 s351 :: SWord8 = s335 >>> 1 s352 :: SWord8 = s14 | s351 s353 :: SWord8 = s16 & s351 s354 :: SWord8 = if s56 then s352 else s353 s355 :: SWord8 = s354 >>> 1 s356 :: SWord8 = s14 | s355 s357 :: SWord8 = s16 & s355 s358 :: SWord8 = if s75 then s356 else s357 s359 :: SWord8 = s358 >>> 1 s360 :: SWord8 = s14 | s359 s361 :: SWord8 = s16 & s359 s362 :: SWord8 = if s327 then s360 else s361 s363 :: SWord8 = s362 >>> 1 s364 :: SWord8 = s14 | s363 s365 :: SWord8 = s16 & s363 s366 :: SWord8 = if s349 then s364 else s365 s367 :: SWord8 = s1 + s362 s368 :: SBool = s367 < s1 s369 :: SBool = s367 < s362 s370 :: SBool = s368 | s369 s371 :: SWord8 = s367 >>> 1 s372 :: SWord8 = s14 | s371 s373 :: SWord8 = s16 & s371 s374 :: SWord8 = if s370 then s372 else s373 s375 :: SWord8 = if s350 then s366 else s374 s376 :: SWord8 = s1 + s358 s377 :: SBool = s376 < s1 s378 :: SBool = s376 < s358 s379 :: SBool = s377 | s378 s380 :: SWord8 = s376 >>> 1 s381 :: SWord8 = s14 | s380 s382 :: SWord8 = s16 & s380 s383 :: SWord8 = if s379 then s381 else s382 s384 :: SWord8 = s383 >>> 1 s385 :: SWord8 = s14 | s384 s386 :: SWord8 = s16 & s384 s387 :: SWord8 = if s349 then s385 else s386 s388 :: SWord8 = s1 + s383 s389 :: SBool = s388 < s1 s390 :: SBool = s388 < s383 s391 :: SBool = s389 | s390 s392 :: SWord8 = s388 >>> 1 s393 :: SWord8 = s14 | s392 s394 :: SWord8 = s16 & s392 s395 :: SWord8 = if s391 then s393 else s394 s396 :: SWord8 = if s350 then s387 else s395 s397 :: SWord8 = if s328 then s375 else s396 s398 :: SWord8 = s1 + s354 s399 :: SBool = s398 < s1 s400 :: SBool = s398 < s354 s401 :: SBool = s399 | s400 s402 :: SWord8 = s398 >>> 1 s403 :: SWord8 = s14 | s402 s404 :: SWord8 = s16 & s402 s405 :: SWord8 = if s401 then s403 else s404 s406 :: SWord8 = s405 >>> 1 s407 :: SWord8 = s14 | s406 s408 :: SWord8 = s16 & s406 s409 :: SWord8 = if s327 then s407 else s408 s410 :: SWord8 = s409 >>> 1 s411 :: SWord8 = s14 | s410 s412 :: SWord8 = s16 & s410 s413 :: SWord8 = if s349 then s411 else s412 s414 :: SWord8 = s1 + s409 s415 :: SBool = s414 < s1 s416 :: SBool = s414 < s409 s417 :: SBool = s415 | s416 s418 :: SWord8 = s414 >>> 1 s419 :: SWord8 = s14 | s418 s420 :: SWord8 = s16 & s418 s421 :: SWord8 = if s417 then s419 else s420 s422 :: SWord8 = if s350 then s413 else s421 s423 :: SWord8 = s1 + s405 s424 :: SBool = s423 < s1 s425 :: SBool = s423 < s405 s426 :: SBool = s424 | s425 s427 :: SWord8 = s423 >>> 1 s428 :: SWord8 = s14 | s427 s429 :: SWord8 = s16 & s427 s430 :: SWord8 = if s426 then s428 else s429 s431 :: SWord8 = s430 >>> 1 s432 :: SWord8 = s14 | s431 s433 :: SWord8 = s16 & s431 s434 :: SWord8 = if s349 then s432 else s433 s435 :: SWord8 = s1 + s430 s436 :: SBool = s435 < s1 s437 :: SBool = s435 < s430 s438 :: SBool = s436 | s437 s439 :: SWord8 = s435 >>> 1 s440 :: SWord8 = s14 | s439 s441 :: SWord8 = s16 & s439 s442 :: SWord8 = if s438 then s440 else s441 s443 :: SWord8 = if s350 then s434 else s442 s444 :: SWord8 = if s328 then s422 else s443 s445 :: SWord8 = if s76 then s397 else s444 s446 :: SWord8 = s1 + s335 s447 :: SWord1 = choose [0:0] s446 s448 :: SBool = s10 /= s447 s449 :: SWord8 = if s448 then s339 else s340 s450 :: SWord1 = choose [0:0] s449 s451 :: SBool = s10 /= s450 s452 :: SWord8 = if s451 then s345 else s346 s453 :: SWord1 = choose [0:0] s452 s454 :: SBool = s10 /= s453 s455 :: SBool = s_2 == s454 s456 :: SBool = s446 < s1 s457 :: SBool = s446 < s335 s458 :: SBool = s456 | s457 s459 :: SWord8 = s446 >>> 1 s460 :: SWord8 = s14 | s459 s461 :: SWord8 = s16 & s459 s462 :: SWord8 = if s458 then s460 else s461 s463 :: SWord8 = s462 >>> 1 s464 :: SWord8 = s14 | s463 s465 :: SWord8 = s16 & s463 s466 :: SWord8 = if s75 then s464 else s465 s467 :: SWord8 = s466 >>> 1 s468 :: SWord8 = s14 | s467 s469 :: SWord8 = s16 & s467 s470 :: SWord8 = if s327 then s468 else s469 s471 :: SWord8 = s470 >>> 1 s472 :: SWord8 = s14 | s471 s473 :: SWord8 = s16 & s471 s474 :: SWord8 = if s454 then s472 else s473 s475 :: SWord8 = s1 + s470 s476 :: SBool = s475 < s1 s477 :: SBool = s475 < s470 s478 :: SBool = s476 | s477 s479 :: SWord8 = s475 >>> 1 s480 :: SWord8 = s14 | s479 s481 :: SWord8 = s16 & s479 s482 :: SWord8 = if s478 then s480 else s481 s483 :: SWord8 = if s455 then s474 else s482 s484 :: SWord8 = s1 + s466 s485 :: SBool = s484 < s1 s486 :: SBool = s484 < s466 s487 :: SBool = s485 | s486 s488 :: SWord8 = s484 >>> 1 s489 :: SWord8 = s14 | s488 s490 :: SWord8 = s16 & s488 s491 :: SWord8 = if s487 then s489 else s490 s492 :: SWord8 = s491 >>> 1 s493 :: SWord8 = s14 | s492 s494 :: SWord8 = s16 & s492 s495 :: SWord8 = if s454 then s493 else s494 s496 :: SWord8 = s1 + s491 s497 :: SBool = s496 < s1 s498 :: SBool = s496 < s491 s499 :: SBool = s497 | s498 s500 :: SWord8 = s496 >>> 1 s501 :: SWord8 = s14 | s500 s502 :: SWord8 = s16 & s500 s503 :: SWord8 = if s499 then s501 else s502 s504 :: SWord8 = if s455 then s495 else s503 s505 :: SWord8 = if s328 then s483 else s504 s506 :: SWord8 = s1 + s462 s507 :: SBool = s506 < s1 s508 :: SBool = s506 < s462 s509 :: SBool = s507 | s508 s510 :: SWord8 = s506 >>> 1 s511 :: SWord8 = s14 | s510 s512 :: SWord8 = s16 & s510 s513 :: SWord8 = if s509 then s511 else s512 s514 :: SWord8 = s513 >>> 1 s515 :: SWord8 = s14 | s514 s516 :: SWord8 = s16 & s514 s517 :: SWord8 = if s327 then s515 else s516 s518 :: SWord8 = s517 >>> 1 s519 :: SWord8 = s14 | s518 s520 :: SWord8 = s16 & s518 s521 :: SWord8 = if s454 then s519 else s520 s522 :: SWord8 = s1 + s517 s523 :: SBool = s522 < s1 s524 :: SBool = s522 < s517 s525 :: SBool = s523 | s524 s526 :: SWord8 = s522 >>> 1 s527 :: SWord8 = s14 | s526 s528 :: SWord8 = s16 & s526 s529 :: SWord8 = if s525 then s527 else s528 s530 :: SWord8 = if s455 then s521 else s529 s531 :: SWord8 = s1 + s513 s532 :: SBool = s531 < s1 s533 :: SBool = s531 < s513 s534 :: SBool = s532 | s533 s535 :: SWord8 = s531 >>> 1 s536 :: SWord8 = s14 | s535 s537 :: SWord8 = s16 & s535 s538 :: SWord8 = if s534 then s536 else s537 s539 :: SWord8 = s538 >>> 1 s540 :: SWord8 = s14 | s539 s541 :: SWord8 = s16 & s539 s542 :: SWord8 = if s454 then s540 else s541 s543 :: SWord8 = s1 + s538 s544 :: SBool = s543 < s1 s545 :: SBool = s543 < s538 s546 :: SBool = s544 | s545 s547 :: SWord8 = s543 >>> 1 s548 :: SWord8 = s14 | s547 s549 :: SWord8 = s16 & s547 s550 :: SWord8 = if s546 then s548 else s549 s551 :: SWord8 = if s455 then s542 else s550 s552 :: SWord8 = if s328 then s530 else s551 s553 :: SWord8 = if s76 then s505 else s552 s554 :: SWord8 = if s57 then s445 else s553 s555 :: SWord8 = if s41 then s318 else s554 s556 :: SWord8 = s1 + s61 s557 :: SWord1 = choose [0:0] s556 s558 :: SBool = s10 /= s557 s559 :: SWord8 = if s558 then s65 else s66 s560 :: SWord1 = choose [0:0] s559 s561 :: SBool = s10 /= s560 s562 :: SWord8 = if s561 then s71 else s72 s563 :: SWord1 = choose [0:0] s562 s564 :: SBool = s10 /= s563 s565 :: SBool = s_2 == s564 s566 :: SBool = s556 < s1 s567 :: SBool = s556 < s61 s568 :: SBool = s566 | s567 s569 :: SWord8 = s556 >>> 1 s570 :: SWord8 = s14 | s569 s571 :: SWord8 = s16 & s569 s572 :: SWord8 = if s568 then s570 else s571 s573 :: SWord1 = choose [0:0] s572 s574 :: SBool = s10 /= s573 s575 :: SWord8 = s559 >>> 1 s576 :: SWord8 = s14 | s575 s577 :: SWord8 = s16 & s575 s578 :: SWord8 = if s574 then s576 else s577 s579 :: SWord1 = choose [0:0] s578 s580 :: SBool = s10 /= s579 s581 :: SWord8 = s562 >>> 1 s582 :: SWord8 = s14 | s581 s583 :: SWord8 = s16 & s581 s584 :: SWord8 = if s580 then s582 else s583 s585 :: SWord1 = choose [0:0] s584 s586 :: SBool = s10 /= s585 s587 :: SBool = s_2 == s586 s588 :: SWord8 = s572 >>> 1 s589 :: SWord8 = s14 | s588 s590 :: SWord8 = s16 & s588 s591 :: SWord8 = if s40 then s589 else s590 s592 :: SWord1 = choose [0:0] s591 s593 :: SBool = s10 /= s592 s594 :: SWord8 = s578 >>> 1 s595 :: SWord8 = s14 | s594 s596 :: SWord8 = s16 & s594 s597 :: SWord8 = if s593 then s595 else s596 s598 :: SWord1 = choose [0:0] s597 s599 :: SBool = s10 /= s598 s600 :: SWord8 = s584 >>> 1 s601 :: SWord8 = s14 | s600 s602 :: SWord8 = s16 & s600 s603 :: SWord8 = if s599 then s601 else s602 s604 :: SWord1 = choose [0:0] s603 s605 :: SBool = s10 /= s604 s606 :: SBool = s_2 == s605 s607 :: SWord8 = s591 >>> 1 s608 :: SWord8 = s14 | s607 s609 :: SWord8 = s16 & s607 s610 :: SWord8 = if s56 then s608 else s609 s611 :: SWord8 = s610 >>> 1 s612 :: SWord8 = s14 | s611 s613 :: SWord8 = s16 & s611 s614 :: SWord8 = if s564 then s612 else s613 s615 :: SWord8 = s614 >>> 1 s616 :: SWord8 = s14 | s615 s617 :: SWord8 = s16 & s615 s618 :: SWord8 = if s586 then s616 else s617 s619 :: SWord8 = s618 >>> 1 s620 :: SWord8 = s14 | s619 s621 :: SWord8 = s16 & s619 s622 :: SWord8 = if s605 then s620 else s621 s623 :: SWord8 = s1 + s618 s624 :: SBool = s623 < s1 s625 :: SBool = s623 < s618 s626 :: SBool = s624 | s625 s627 :: SWord8 = s623 >>> 1 s628 :: SWord8 = s14 | s627 s629 :: SWord8 = s16 & s627 s630 :: SWord8 = if s626 then s628 else s629 s631 :: SWord8 = if s606 then s622 else s630 s632 :: SWord8 = s1 + s614 s633 :: SBool = s632 < s1 s634 :: SBool = s632 < s614 s635 :: SBool = s633 | s634 s636 :: SWord8 = s632 >>> 1 s637 :: SWord8 = s14 | s636 s638 :: SWord8 = s16 & s636 s639 :: SWord8 = if s635 then s637 else s638 s640 :: SWord8 = s639 >>> 1 s641 :: SWord8 = s14 | s640 s642 :: SWord8 = s16 & s640 s643 :: SWord8 = if s605 then s641 else s642 s644 :: SWord8 = s1 + s639 s645 :: SBool = s644 < s1 s646 :: SBool = s644 < s639 s647 :: SBool = s645 | s646 s648 :: SWord8 = s644 >>> 1 s649 :: SWord8 = s14 | s648 s650 :: SWord8 = s16 & s648 s651 :: SWord8 = if s647 then s649 else s650 s652 :: SWord8 = if s606 then s643 else s651 s653 :: SWord8 = if s587 then s631 else s652 s654 :: SWord8 = s1 + s610 s655 :: SBool = s654 < s1 s656 :: SBool = s654 < s610 s657 :: SBool = s655 | s656 s658 :: SWord8 = s654 >>> 1 s659 :: SWord8 = s14 | s658 s660 :: SWord8 = s16 & s658 s661 :: SWord8 = if s657 then s659 else s660 s662 :: SWord8 = s661 >>> 1 s663 :: SWord8 = s14 | s662 s664 :: SWord8 = s16 & s662 s665 :: SWord8 = if s586 then s663 else s664 s666 :: SWord8 = s665 >>> 1 s667 :: SWord8 = s14 | s666 s668 :: SWord8 = s16 & s666 s669 :: SWord8 = if s605 then s667 else s668 s670 :: SWord8 = s1 + s665 s671 :: SBool = s670 < s1 s672 :: SBool = s670 < s665 s673 :: SBool = s671 | s672 s674 :: SWord8 = s670 >>> 1 s675 :: SWord8 = s14 | s674 s676 :: SWord8 = s16 & s674 s677 :: SWord8 = if s673 then s675 else s676 s678 :: SWord8 = if s606 then s669 else s677 s679 :: SWord8 = s1 + s661 s680 :: SBool = s679 < s1 s681 :: SBool = s679 < s661 s682 :: SBool = s680 | s681 s683 :: SWord8 = s679 >>> 1 s684 :: SWord8 = s14 | s683 s685 :: SWord8 = s16 & s683 s686 :: SWord8 = if s682 then s684 else s685 s687 :: SWord8 = s686 >>> 1 s688 :: SWord8 = s14 | s687 s689 :: SWord8 = s16 & s687 s690 :: SWord8 = if s605 then s688 else s689 s691 :: SWord8 = s1 + s686 s692 :: SBool = s691 < s1 s693 :: SBool = s691 < s686 s694 :: SBool = s692 | s693 s695 :: SWord8 = s691 >>> 1 s696 :: SWord8 = s14 | s695 s697 :: SWord8 = s16 & s695 s698 :: SWord8 = if s694 then s696 else s697 s699 :: SWord8 = if s606 then s690 else s698 s700 :: SWord8 = if s587 then s678 else s699 s701 :: SWord8 = if s565 then s653 else s700 s702 :: SWord8 = s1 + s591 s703 :: SWord1 = choose [0:0] s702 s704 :: SBool = s10 /= s703 s705 :: SWord8 = if s704 then s595 else s596 s706 :: SWord1 = choose [0:0] s705 s707 :: SBool = s10 /= s706 s708 :: SWord8 = if s707 then s601 else s602 s709 :: SWord1 = choose [0:0] s708 s710 :: SBool = s10 /= s709 s711 :: SBool = s_2 == s710 s712 :: SBool = s702 < s1 s713 :: SBool = s702 < s591 s714 :: SBool = s712 | s713 s715 :: SWord8 = s702 >>> 1 s716 :: SWord8 = s14 | s715 s717 :: SWord8 = s16 & s715 s718 :: SWord8 = if s714 then s716 else s717 s719 :: SWord8 = s718 >>> 1 s720 :: SWord8 = s14 | s719 s721 :: SWord8 = s16 & s719 s722 :: SWord8 = if s564 then s720 else s721 s723 :: SWord8 = s722 >>> 1 s724 :: SWord8 = s14 | s723 s725 :: SWord8 = s16 & s723 s726 :: SWord8 = if s586 then s724 else s725 s727 :: SWord8 = s726 >>> 1 s728 :: SWord8 = s14 | s727 s729 :: SWord8 = s16 & s727 s730 :: SWord8 = if s710 then s728 else s729 s731 :: SWord8 = s1 + s726 s732 :: SBool = s731 < s1 s733 :: SBool = s731 < s726 s734 :: SBool = s732 | s733 s735 :: SWord8 = s731 >>> 1 s736 :: SWord8 = s14 | s735 s737 :: SWord8 = s16 & s735 s738 :: SWord8 = if s734 then s736 else s737 s739 :: SWord8 = if s711 then s730 else s738 s740 :: SWord8 = s1 + s722 s741 :: SBool = s740 < s1 s742 :: SBool = s740 < s722 s743 :: SBool = s741 | s742 s744 :: SWord8 = s740 >>> 1 s745 :: SWord8 = s14 | s744 s746 :: SWord8 = s16 & s744 s747 :: SWord8 = if s743 then s745 else s746 s748 :: SWord8 = s747 >>> 1 s749 :: SWord8 = s14 | s748 s750 :: SWord8 = s16 & s748 s751 :: SWord8 = if s710 then s749 else s750 s752 :: SWord8 = s1 + s747 s753 :: SBool = s752 < s1 s754 :: SBool = s752 < s747 s755 :: SBool = s753 | s754 s756 :: SWord8 = s752 >>> 1 s757 :: SWord8 = s14 | s756 s758 :: SWord8 = s16 & s756 s759 :: SWord8 = if s755 then s757 else s758 s760 :: SWord8 = if s711 then s751 else s759 s761 :: SWord8 = if s587 then s739 else s760 s762 :: SWord8 = s1 + s718 s763 :: SBool = s762 < s1 s764 :: SBool = s762 < s718 s765 :: SBool = s763 | s764 s766 :: SWord8 = s762 >>> 1 s767 :: SWord8 = s14 | s766 s768 :: SWord8 = s16 & s766 s769 :: SWord8 = if s765 then s767 else s768 s770 :: SWord8 = s769 >>> 1 s771 :: SWord8 = s14 | s770 s772 :: SWord8 = s16 & s770 s773 :: SWord8 = if s586 then s771 else s772 s774 :: SWord8 = s773 >>> 1 s775 :: SWord8 = s14 | s774 s776 :: SWord8 = s16 & s774 s777 :: SWord8 = if s710 then s775 else s776 s778 :: SWord8 = s1 + s773 s779 :: SBool = s778 < s1 s780 :: SBool = s778 < s773 s781 :: SBool = s779 | s780 s782 :: SWord8 = s778 >>> 1 s783 :: SWord8 = s14 | s782 s784 :: SWord8 = s16 & s782 s785 :: SWord8 = if s781 then s783 else s784 s786 :: SWord8 = if s711 then s777 else s785 s787 :: SWord8 = s1 + s769 s788 :: SBool = s787 < s1 s789 :: SBool = s787 < s769 s790 :: SBool = s788 | s789 s791 :: SWord8 = s787 >>> 1 s792 :: SWord8 = s14 | s791 s793 :: SWord8 = s16 & s791 s794 :: SWord8 = if s790 then s792 else s793 s795 :: SWord8 = s794 >>> 1 s796 :: SWord8 = s14 | s795 s797 :: SWord8 = s16 & s795 s798 :: SWord8 = if s710 then s796 else s797 s799 :: SWord8 = s1 + s794 s800 :: SBool = s799 < s1 s801 :: SBool = s799 < s794 s802 :: SBool = s800 | s801 s803 :: SWord8 = s799 >>> 1 s804 :: SWord8 = s14 | s803 s805 :: SWord8 = s16 & s803 s806 :: SWord8 = if s802 then s804 else s805 s807 :: SWord8 = if s711 then s798 else s806 s808 :: SWord8 = if s587 then s786 else s807 s809 :: SWord8 = if s565 then s761 else s808 s810 :: SWord8 = if s57 then s701 else s809 s811 :: SWord8 = s1 + s572 s812 :: SWord1 = choose [0:0] s811 s813 :: SBool = s10 /= s812 s814 :: SWord8 = if s813 then s576 else s577 s815 :: SWord1 = choose [0:0] s814 s816 :: SBool = s10 /= s815 s817 :: SWord8 = if s816 then s582 else s583 s818 :: SWord1 = choose [0:0] s817 s819 :: SBool = s10 /= s818 s820 :: SBool = s_2 == s819 s821 :: SBool = s811 < s1 s822 :: SBool = s811 < s572 s823 :: SBool = s821 | s822 s824 :: SWord8 = s811 >>> 1 s825 :: SWord8 = s14 | s824 s826 :: SWord8 = s16 & s824 s827 :: SWord8 = if s823 then s825 else s826 s828 :: SWord1 = choose [0:0] s827 s829 :: SBool = s10 /= s828 s830 :: SWord8 = s814 >>> 1 s831 :: SWord8 = s14 | s830 s832 :: SWord8 = s16 & s830 s833 :: SWord8 = if s829 then s831 else s832 s834 :: SWord1 = choose [0:0] s833 s835 :: SBool = s10 /= s834 s836 :: SWord8 = s817 >>> 1 s837 :: SWord8 = s14 | s836 s838 :: SWord8 = s16 & s836 s839 :: SWord8 = if s835 then s837 else s838 s840 :: SWord1 = choose [0:0] s839 s841 :: SBool = s10 /= s840 s842 :: SBool = s_2 == s841 s843 :: SWord8 = s827 >>> 1 s844 :: SWord8 = s14 | s843 s845 :: SWord8 = s16 & s843 s846 :: SWord8 = if s56 then s844 else s845 s847 :: SWord8 = s846 >>> 1 s848 :: SWord8 = s14 | s847 s849 :: SWord8 = s16 & s847 s850 :: SWord8 = if s564 then s848 else s849 s851 :: SWord8 = s850 >>> 1 s852 :: SWord8 = s14 | s851 s853 :: SWord8 = s16 & s851 s854 :: SWord8 = if s819 then s852 else s853 s855 :: SWord8 = s854 >>> 1 s856 :: SWord8 = s14 | s855 s857 :: SWord8 = s16 & s855 s858 :: SWord8 = if s841 then s856 else s857 s859 :: SWord8 = s1 + s854 s860 :: SBool = s859 < s1 s861 :: SBool = s859 < s854 s862 :: SBool = s860 | s861 s863 :: SWord8 = s859 >>> 1 s864 :: SWord8 = s14 | s863 s865 :: SWord8 = s16 & s863 s866 :: SWord8 = if s862 then s864 else s865 s867 :: SWord8 = if s842 then s858 else s866 s868 :: SWord8 = s1 + s850 s869 :: SBool = s868 < s1 s870 :: SBool = s868 < s850 s871 :: SBool = s869 | s870 s872 :: SWord8 = s868 >>> 1 s873 :: SWord8 = s14 | s872 s874 :: SWord8 = s16 & s872 s875 :: SWord8 = if s871 then s873 else s874 s876 :: SWord8 = s875 >>> 1 s877 :: SWord8 = s14 | s876 s878 :: SWord8 = s16 & s876 s879 :: SWord8 = if s841 then s877 else s878 s880 :: SWord8 = s1 + s875 s881 :: SBool = s880 < s1 s882 :: SBool = s880 < s875 s883 :: SBool = s881 | s882 s884 :: SWord8 = s880 >>> 1 s885 :: SWord8 = s14 | s884 s886 :: SWord8 = s16 & s884 s887 :: SWord8 = if s883 then s885 else s886 s888 :: SWord8 = if s842 then s879 else s887 s889 :: SWord8 = if s820 then s867 else s888 s890 :: SWord8 = s1 + s846 s891 :: SBool = s890 < s1 s892 :: SBool = s890 < s846 s893 :: SBool = s891 | s892 s894 :: SWord8 = s890 >>> 1 s895 :: SWord8 = s14 | s894 s896 :: SWord8 = s16 & s894 s897 :: SWord8 = if s893 then s895 else s896 s898 :: SWord8 = s897 >>> 1 s899 :: SWord8 = s14 | s898 s900 :: SWord8 = s16 & s898 s901 :: SWord8 = if s819 then s899 else s900 s902 :: SWord8 = s901 >>> 1 s903 :: SWord8 = s14 | s902 s904 :: SWord8 = s16 & s902 s905 :: SWord8 = if s841 then s903 else s904 s906 :: SWord8 = s1 + s901 s907 :: SBool = s906 < s1 s908 :: SBool = s906 < s901 s909 :: SBool = s907 | s908 s910 :: SWord8 = s906 >>> 1 s911 :: SWord8 = s14 | s910 s912 :: SWord8 = s16 & s910 s913 :: SWord8 = if s909 then s911 else s912 s914 :: SWord8 = if s842 then s905 else s913 s915 :: SWord8 = s1 + s897 s916 :: SBool = s915 < s1 s917 :: SBool = s915 < s897 s918 :: SBool = s916 | s917 s919 :: SWord8 = s915 >>> 1 s920 :: SWord8 = s14 | s919 s921 :: SWord8 = s16 & s919 s922 :: SWord8 = if s918 then s920 else s921 s923 :: SWord8 = s922 >>> 1 s924 :: SWord8 = s14 | s923 s925 :: SWord8 = s16 & s923 s926 :: SWord8 = if s841 then s924 else s925 s927 :: SWord8 = s1 + s922 s928 :: SBool = s927 < s1 s929 :: SBool = s927 < s922 s930 :: SBool = s928 | s929 s931 :: SWord8 = s927 >>> 1 s932 :: SWord8 = s14 | s931 s933 :: SWord8 = s16 & s931 s934 :: SWord8 = if s930 then s932 else s933 s935 :: SWord8 = if s842 then s926 else s934 s936 :: SWord8 = if s820 then s914 else s935 s937 :: SWord8 = if s565 then s889 else s936 s938 :: SWord8 = s1 + s827 s939 :: SWord1 = choose [0:0] s938 s940 :: SBool = s10 /= s939 s941 :: SWord8 = if s940 then s831 else s832 s942 :: SWord1 = choose [0:0] s941 s943 :: SBool = s10 /= s942 s944 :: SWord8 = if s943 then s837 else s838 s945 :: SWord1 = choose [0:0] s944 s946 :: SBool = s10 /= s945 s947 :: SBool = s_2 == s946 s948 :: SBool = s938 < s1 s949 :: SBool = s938 < s827 s950 :: SBool = s948 | s949 s951 :: SWord8 = s938 >>> 1 s952 :: SWord8 = s14 | s951 s953 :: SWord8 = s16 & s951 s954 :: SWord8 = if s950 then s952 else s953 s955 :: SWord8 = s954 >>> 1 s956 :: SWord8 = s14 | s955 s957 :: SWord8 = s16 & s955 s958 :: SWord8 = if s564 then s956 else s957 s959 :: SWord8 = s958 >>> 1 s960 :: SWord8 = s14 | s959 s961 :: SWord8 = s16 & s959 s962 :: SWord8 = if s819 then s960 else s961 s963 :: SWord8 = s962 >>> 1 s964 :: SWord8 = s14 | s963 s965 :: SWord8 = s16 & s963 s966 :: SWord8 = if s946 then s964 else s965 s967 :: SWord8 = s1 + s962 s968 :: SBool = s967 < s1 s969 :: SBool = s967 < s962 s970 :: SBool = s968 | s969 s971 :: SWord8 = s967 >>> 1 s972 :: SWord8 = s14 | s971 s973 :: SWord8 = s16 & s971 s974 :: SWord8 = if s970 then s972 else s973 s975 :: SWord8 = if s947 then s966 else s974 s976 :: SWord8 = s1 + s958 s977 :: SBool = s976 < s1 s978 :: SBool = s976 < s958 s979 :: SBool = s977 | s978 s980 :: SWord8 = s976 >>> 1 s981 :: SWord8 = s14 | s980 s982 :: SWord8 = s16 & s980 s983 :: SWord8 = if s979 then s981 else s982 s984 :: SWord8 = s983 >>> 1 s985 :: SWord8 = s14 | s984 s986 :: SWord8 = s16 & s984 s987 :: SWord8 = if s946 then s985 else s986 s988 :: SWord8 = s1 + s983 s989 :: SBool = s988 < s1 s990 :: SBool = s988 < s983 s991 :: SBool = s989 | s990 s992 :: SWord8 = s988 >>> 1 s993 :: SWord8 = s14 | s992 s994 :: SWord8 = s16 & s992 s995 :: SWord8 = if s991 then s993 else s994 s996 :: SWord8 = if s947 then s987 else s995 s997 :: SWord8 = if s820 then s975 else s996 s998 :: SWord8 = s1 + s954 s999 :: SBool = s998 < s1 s1000 :: SBool = s998 < s954 s1001 :: SBool = s999 | s1000 s1002 :: SWord8 = s998 >>> 1 s1003 :: SWord8 = s14 | s1002 s1004 :: SWord8 = s16 & s1002 s1005 :: SWord8 = if s1001 then s1003 else s1004 s1006 :: SWord8 = s1005 >>> 1 s1007 :: SWord8 = s14 | s1006 s1008 :: SWord8 = s16 & s1006 s1009 :: SWord8 = if s819 then s1007 else s1008 s1010 :: SWord8 = s1009 >>> 1 s1011 :: SWord8 = s14 | s1010 s1012 :: SWord8 = s16 & s1010 s1013 :: SWord8 = if s946 then s1011 else s1012 s1014 :: SWord8 = s1 + s1009 s1015 :: SBool = s1014 < s1 s1016 :: SBool = s1014 < s1009 s1017 :: SBool = s1015 | s1016 s1018 :: SWord8 = s1014 >>> 1 s1019 :: SWord8 = s14 | s1018 s1020 :: SWord8 = s16 & s1018 s1021 :: SWord8 = if s1017 then s1019 else s1020 s1022 :: SWord8 = if s947 then s1013 else s1021 s1023 :: SWord8 = s1 + s1005 s1024 :: SBool = s1023 < s1 s1025 :: SBool = s1023 < s1005 s1026 :: SBool = s1024 | s1025 s1027 :: SWord8 = s1023 >>> 1 s1028 :: SWord8 = s14 | s1027 s1029 :: SWord8 = s16 & s1027 s1030 :: SWord8 = if s1026 then s1028 else s1029 s1031 :: SWord8 = s1030 >>> 1 s1032 :: SWord8 = s14 | s1031 s1033 :: SWord8 = s16 & s1031 s1034 :: SWord8 = if s946 then s1032 else s1033 s1035 :: SWord8 = s1 + s1030 s1036 :: SBool = s1035 < s1 s1037 :: SBool = s1035 < s1030 s1038 :: SBool = s1036 | s1037 s1039 :: SWord8 = s1035 >>> 1 s1040 :: SWord8 = s14 | s1039 s1041 :: SWord8 = s16 & s1039 s1042 :: SWord8 = if s1038 then s1040 else s1041 s1043 :: SWord8 = if s947 then s1034 else s1042 s1044 :: SWord8 = if s820 then s1022 else s1043 s1045 :: SWord8 = if s565 then s997 else s1044 s1046 :: SWord8 = if s57 then s937 else s1045 s1047 :: SWord8 = if s41 then s810 else s1046 s1048 :: SWord8 = if s30 then s555 else s1047 s1049 :: SWord8 = s1 + s42 s1050 :: SWord1 = choose [0:0] s1049 s1051 :: SBool = s10 /= s1050 s1052 :: SWord8 = if s1051 then s46 else s47 s1053 :: SWord1 = choose [0:0] s1052 s1054 :: SBool = s10 /= s1053 s1055 :: SWord8 = if s1054 then s52 else s53 s1056 :: SWord1 = choose [0:0] s1055 s1057 :: SBool = s10 /= s1056 s1058 :: SBool = s_2 == s1057 s1059 :: SBool = s1049 < s1 s1060 :: SBool = s1049 < s42 s1061 :: SBool = s1059 | s1060 s1062 :: SWord8 = s1049 >>> 1 s1063 :: SWord8 = s14 | s1062 s1064 :: SWord8 = s16 & s1062 s1065 :: SWord8 = if s1061 then s1063 else s1064 s1066 :: SWord1 = choose [0:0] s1065 s1067 :: SBool = s10 /= s1066 s1068 :: SWord8 = s1052 >>> 1 s1069 :: SWord8 = s14 | s1068 s1070 :: SWord8 = s16 & s1068 s1071 :: SWord8 = if s1067 then s1069 else s1070 s1072 :: SWord1 = choose [0:0] s1071 s1073 :: SBool = s10 /= s1072 s1074 :: SWord8 = s1055 >>> 1 s1075 :: SWord8 = s14 | s1074 s1076 :: SWord8 = s16 & s1074 s1077 :: SWord8 = if s1073 then s1075 else s1076 s1078 :: SWord1 = choose [0:0] s1077 s1079 :: SBool = s10 /= s1078 s1080 :: SBool = s_2 == s1079 s1081 :: SWord8 = s1065 >>> 1 s1082 :: SWord8 = s14 | s1081 s1083 :: SWord8 = s16 & s1081 s1084 :: SWord8 = if s29 then s1082 else s1083 s1085 :: SWord1 = choose [0:0] s1084 s1086 :: SBool = s10 /= s1085 s1087 :: SWord8 = s1071 >>> 1 s1088 :: SWord8 = s14 | s1087 s1089 :: SWord8 = s16 & s1087 s1090 :: SWord8 = if s1086 then s1088 else s1089 s1091 :: SWord1 = choose [0:0] s1090 s1092 :: SBool = s10 /= s1091 s1093 :: SWord8 = s1077 >>> 1 s1094 :: SWord8 = s14 | s1093 s1095 :: SWord8 = s16 & s1093 s1096 :: SWord8 = if s1092 then s1094 else s1095 s1097 :: SWord1 = choose [0:0] s1096 s1098 :: SBool = s10 /= s1097 s1099 :: SBool = s_2 == s1098 s1100 :: SWord8 = s1084 >>> 1 s1101 :: SWord8 = s14 | s1100 s1102 :: SWord8 = s16 & s1100 s1103 :: SWord8 = if s40 then s1101 else s1102 s1104 :: SWord1 = choose [0:0] s1103 s1105 :: SBool = s10 /= s1104 s1106 :: SWord8 = s1090 >>> 1 s1107 :: SWord8 = s14 | s1106 s1108 :: SWord8 = s16 & s1106 s1109 :: SWord8 = if s1105 then s1107 else s1108 s1110 :: SWord1 = choose [0:0] s1109 s1111 :: SBool = s10 /= s1110 s1112 :: SWord8 = s1096 >>> 1 s1113 :: SWord8 = s14 | s1112 s1114 :: SWord8 = s16 & s1112 s1115 :: SWord8 = if s1111 then s1113 else s1114 s1116 :: SWord1 = choose [0:0] s1115 s1117 :: SBool = s10 /= s1116 s1118 :: SBool = s_2 == s1117 s1119 :: SWord8 = s1103 >>> 1 s1120 :: SWord8 = s14 | s1119 s1121 :: SWord8 = s16 & s1119 s1122 :: SWord8 = if s1057 then s1120 else s1121 s1123 :: SWord8 = s1122 >>> 1 s1124 :: SWord8 = s14 | s1123 s1125 :: SWord8 = s16 & s1123 s1126 :: SWord8 = if s1079 then s1124 else s1125 s1127 :: SWord8 = s1126 >>> 1 s1128 :: SWord8 = s14 | s1127 s1129 :: SWord8 = s16 & s1127 s1130 :: SWord8 = if s1098 then s1128 else s1129 s1131 :: SWord8 = s1130 >>> 1 s1132 :: SWord8 = s14 | s1131 s1133 :: SWord8 = s16 & s1131 s1134 :: SWord8 = if s1117 then s1132 else s1133 s1135 :: SWord8 = s1 + s1130 s1136 :: SBool = s1135 < s1 s1137 :: SBool = s1135 < s1130 s1138 :: SBool = s1136 | s1137 s1139 :: SWord8 = s1135 >>> 1 s1140 :: SWord8 = s14 | s1139 s1141 :: SWord8 = s16 & s1139 s1142 :: SWord8 = if s1138 then s1140 else s1141 s1143 :: SWord8 = if s1118 then s1134 else s1142 s1144 :: SWord8 = s1 + s1126 s1145 :: SBool = s1144 < s1 s1146 :: SBool = s1144 < s1126 s1147 :: SBool = s1145 | s1146 s1148 :: SWord8 = s1144 >>> 1 s1149 :: SWord8 = s14 | s1148 s1150 :: SWord8 = s16 & s1148 s1151 :: SWord8 = if s1147 then s1149 else s1150 s1152 :: SWord8 = s1151 >>> 1 s1153 :: SWord8 = s14 | s1152 s1154 :: SWord8 = s16 & s1152 s1155 :: SWord8 = if s1117 then s1153 else s1154 s1156 :: SWord8 = s1 + s1151 s1157 :: SBool = s1156 < s1 s1158 :: SBool = s1156 < s1151 s1159 :: SBool = s1157 | s1158 s1160 :: SWord8 = s1156 >>> 1 s1161 :: SWord8 = s14 | s1160 s1162 :: SWord8 = s16 & s1160 s1163 :: SWord8 = if s1159 then s1161 else s1162 s1164 :: SWord8 = if s1118 then s1155 else s1163 s1165 :: SWord8 = if s1099 then s1143 else s1164 s1166 :: SWord8 = s1 + s1122 s1167 :: SBool = s1166 < s1 s1168 :: SBool = s1166 < s1122 s1169 :: SBool = s1167 | s1168 s1170 :: SWord8 = s1166 >>> 1 s1171 :: SWord8 = s14 | s1170 s1172 :: SWord8 = s16 & s1170 s1173 :: SWord8 = if s1169 then s1171 else s1172 s1174 :: SWord8 = s1173 >>> 1 s1175 :: SWord8 = s14 | s1174 s1176 :: SWord8 = s16 & s1174 s1177 :: SWord8 = if s1098 then s1175 else s1176 s1178 :: SWord8 = s1177 >>> 1 s1179 :: SWord8 = s14 | s1178 s1180 :: SWord8 = s16 & s1178 s1181 :: SWord8 = if s1117 then s1179 else s1180 s1182 :: SWord8 = s1 + s1177 s1183 :: SBool = s1182 < s1 s1184 :: SBool = s1182 < s1177 s1185 :: SBool = s1183 | s1184 s1186 :: SWord8 = s1182 >>> 1 s1187 :: SWord8 = s14 | s1186 s1188 :: SWord8 = s16 & s1186 s1189 :: SWord8 = if s1185 then s1187 else s1188 s1190 :: SWord8 = if s1118 then s1181 else s1189 s1191 :: SWord8 = s1 + s1173 s1192 :: SBool = s1191 < s1 s1193 :: SBool = s1191 < s1173 s1194 :: SBool = s1192 | s1193 s1195 :: SWord8 = s1191 >>> 1 s1196 :: SWord8 = s14 | s1195 s1197 :: SWord8 = s16 & s1195 s1198 :: SWord8 = if s1194 then s1196 else s1197 s1199 :: SWord8 = s1198 >>> 1 s1200 :: SWord8 = s14 | s1199 s1201 :: SWord8 = s16 & s1199 s1202 :: SWord8 = if s1117 then s1200 else s1201 s1203 :: SWord8 = s1 + s1198 s1204 :: SBool = s1203 < s1 s1205 :: SBool = s1203 < s1198 s1206 :: SBool = s1204 | s1205 s1207 :: SWord8 = s1203 >>> 1 s1208 :: SWord8 = s14 | s1207 s1209 :: SWord8 = s16 & s1207 s1210 :: SWord8 = if s1206 then s1208 else s1209 s1211 :: SWord8 = if s1118 then s1202 else s1210 s1212 :: SWord8 = if s1099 then s1190 else s1211 s1213 :: SWord8 = if s1080 then s1165 else s1212 s1214 :: SWord8 = s1 + s1103 s1215 :: SWord1 = choose [0:0] s1214 s1216 :: SBool = s10 /= s1215 s1217 :: SWord8 = if s1216 then s1107 else s1108 s1218 :: SWord1 = choose [0:0] s1217 s1219 :: SBool = s10 /= s1218 s1220 :: SWord8 = if s1219 then s1113 else s1114 s1221 :: SWord1 = choose [0:0] s1220 s1222 :: SBool = s10 /= s1221 s1223 :: SBool = s_2 == s1222 s1224 :: SBool = s1214 < s1 s1225 :: SBool = s1214 < s1103 s1226 :: SBool = s1224 | s1225 s1227 :: SWord8 = s1214 >>> 1 s1228 :: SWord8 = s14 | s1227 s1229 :: SWord8 = s16 & s1227 s1230 :: SWord8 = if s1226 then s1228 else s1229 s1231 :: SWord8 = s1230 >>> 1 s1232 :: SWord8 = s14 | s1231 s1233 :: SWord8 = s16 & s1231 s1234 :: SWord8 = if s1079 then s1232 else s1233 s1235 :: SWord8 = s1234 >>> 1 s1236 :: SWord8 = s14 | s1235 s1237 :: SWord8 = s16 & s1235 s1238 :: SWord8 = if s1098 then s1236 else s1237 s1239 :: SWord8 = s1238 >>> 1 s1240 :: SWord8 = s14 | s1239 s1241 :: SWord8 = s16 & s1239 s1242 :: SWord8 = if s1222 then s1240 else s1241 s1243 :: SWord8 = s1 + s1238 s1244 :: SBool = s1243 < s1 s1245 :: SBool = s1243 < s1238 s1246 :: SBool = s1244 | s1245 s1247 :: SWord8 = s1243 >>> 1 s1248 :: SWord8 = s14 | s1247 s1249 :: SWord8 = s16 & s1247 s1250 :: SWord8 = if s1246 then s1248 else s1249 s1251 :: SWord8 = if s1223 then s1242 else s1250 s1252 :: SWord8 = s1 + s1234 s1253 :: SBool = s1252 < s1 s1254 :: SBool = s1252 < s1234 s1255 :: SBool = s1253 | s1254 s1256 :: SWord8 = s1252 >>> 1 s1257 :: SWord8 = s14 | s1256 s1258 :: SWord8 = s16 & s1256 s1259 :: SWord8 = if s1255 then s1257 else s1258 s1260 :: SWord8 = s1259 >>> 1 s1261 :: SWord8 = s14 | s1260 s1262 :: SWord8 = s16 & s1260 s1263 :: SWord8 = if s1222 then s1261 else s1262 s1264 :: SWord8 = s1 + s1259 s1265 :: SBool = s1264 < s1 s1266 :: SBool = s1264 < s1259 s1267 :: SBool = s1265 | s1266 s1268 :: SWord8 = s1264 >>> 1 s1269 :: SWord8 = s14 | s1268 s1270 :: SWord8 = s16 & s1268 s1271 :: SWord8 = if s1267 then s1269 else s1270 s1272 :: SWord8 = if s1223 then s1263 else s1271 s1273 :: SWord8 = if s1099 then s1251 else s1272 s1274 :: SWord8 = s1 + s1230 s1275 :: SBool = s1274 < s1 s1276 :: SBool = s1274 < s1230 s1277 :: SBool = s1275 | s1276 s1278 :: SWord8 = s1274 >>> 1 s1279 :: SWord8 = s14 | s1278 s1280 :: SWord8 = s16 & s1278 s1281 :: SWord8 = if s1277 then s1279 else s1280 s1282 :: SWord8 = s1281 >>> 1 s1283 :: SWord8 = s14 | s1282 s1284 :: SWord8 = s16 & s1282 s1285 :: SWord8 = if s1098 then s1283 else s1284 s1286 :: SWord8 = s1285 >>> 1 s1287 :: SWord8 = s14 | s1286 s1288 :: SWord8 = s16 & s1286 s1289 :: SWord8 = if s1222 then s1287 else s1288 s1290 :: SWord8 = s1 + s1285 s1291 :: SBool = s1290 < s1 s1292 :: SBool = s1290 < s1285 s1293 :: SBool = s1291 | s1292 s1294 :: SWord8 = s1290 >>> 1 s1295 :: SWord8 = s14 | s1294 s1296 :: SWord8 = s16 & s1294 s1297 :: SWord8 = if s1293 then s1295 else s1296 s1298 :: SWord8 = if s1223 then s1289 else s1297 s1299 :: SWord8 = s1 + s1281 s1300 :: SBool = s1299 < s1 s1301 :: SBool = s1299 < s1281 s1302 :: SBool = s1300 | s1301 s1303 :: SWord8 = s1299 >>> 1 s1304 :: SWord8 = s14 | s1303 s1305 :: SWord8 = s16 & s1303 s1306 :: SWord8 = if s1302 then s1304 else s1305 s1307 :: SWord8 = s1306 >>> 1 s1308 :: SWord8 = s14 | s1307 s1309 :: SWord8 = s16 & s1307 s1310 :: SWord8 = if s1222 then s1308 else s1309 s1311 :: SWord8 = s1 + s1306 s1312 :: SBool = s1311 < s1 s1313 :: SBool = s1311 < s1306 s1314 :: SBool = s1312 | s1313 s1315 :: SWord8 = s1311 >>> 1 s1316 :: SWord8 = s14 | s1315 s1317 :: SWord8 = s16 & s1315 s1318 :: SWord8 = if s1314 then s1316 else s1317 s1319 :: SWord8 = if s1223 then s1310 else s1318 s1320 :: SWord8 = if s1099 then s1298 else s1319 s1321 :: SWord8 = if s1080 then s1273 else s1320 s1322 :: SWord8 = if s1058 then s1213 else s1321 s1323 :: SWord8 = s1 + s1084 s1324 :: SWord1 = choose [0:0] s1323 s1325 :: SBool = s10 /= s1324 s1326 :: SWord8 = if s1325 then s1088 else s1089 s1327 :: SWord1 = choose [0:0] s1326 s1328 :: SBool = s10 /= s1327 s1329 :: SWord8 = if s1328 then s1094 else s1095 s1330 :: SWord1 = choose [0:0] s1329 s1331 :: SBool = s10 /= s1330 s1332 :: SBool = s_2 == s1331 s1333 :: SBool = s1323 < s1 s1334 :: SBool = s1323 < s1084 s1335 :: SBool = s1333 | s1334 s1336 :: SWord8 = s1323 >>> 1 s1337 :: SWord8 = s14 | s1336 s1338 :: SWord8 = s16 & s1336 s1339 :: SWord8 = if s1335 then s1337 else s1338 s1340 :: SWord1 = choose [0:0] s1339 s1341 :: SBool = s10 /= s1340 s1342 :: SWord8 = s1326 >>> 1 s1343 :: SWord8 = s14 | s1342 s1344 :: SWord8 = s16 & s1342 s1345 :: SWord8 = if s1341 then s1343 else s1344 s1346 :: SWord1 = choose [0:0] s1345 s1347 :: SBool = s10 /= s1346 s1348 :: SWord8 = s1329 >>> 1 s1349 :: SWord8 = s14 | s1348 s1350 :: SWord8 = s16 & s1348 s1351 :: SWord8 = if s1347 then s1349 else s1350 s1352 :: SWord1 = choose [0:0] s1351 s1353 :: SBool = s10 /= s1352 s1354 :: SBool = s_2 == s1353 s1355 :: SWord8 = s1339 >>> 1 s1356 :: SWord8 = s14 | s1355 s1357 :: SWord8 = s16 & s1355 s1358 :: SWord8 = if s1057 then s1356 else s1357 s1359 :: SWord8 = s1358 >>> 1 s1360 :: SWord8 = s14 | s1359 s1361 :: SWord8 = s16 & s1359 s1362 :: SWord8 = if s1079 then s1360 else s1361 s1363 :: SWord8 = s1362 >>> 1 s1364 :: SWord8 = s14 | s1363 s1365 :: SWord8 = s16 & s1363 s1366 :: SWord8 = if s1331 then s1364 else s1365 s1367 :: SWord8 = s1366 >>> 1 s1368 :: SWord8 = s14 | s1367 s1369 :: SWord8 = s16 & s1367 s1370 :: SWord8 = if s1353 then s1368 else s1369 s1371 :: SWord8 = s1 + s1366 s1372 :: SBool = s1371 < s1 s1373 :: SBool = s1371 < s1366 s1374 :: SBool = s1372 | s1373 s1375 :: SWord8 = s1371 >>> 1 s1376 :: SWord8 = s14 | s1375 s1377 :: SWord8 = s16 & s1375 s1378 :: SWord8 = if s1374 then s1376 else s1377 s1379 :: SWord8 = if s1354 then s1370 else s1378 s1380 :: SWord8 = s1 + s1362 s1381 :: SBool = s1380 < s1 s1382 :: SBool = s1380 < s1362 s1383 :: SBool = s1381 | s1382 s1384 :: SWord8 = s1380 >>> 1 s1385 :: SWord8 = s14 | s1384 s1386 :: SWord8 = s16 & s1384 s1387 :: SWord8 = if s1383 then s1385 else s1386 s1388 :: SWord8 = s1387 >>> 1 s1389 :: SWord8 = s14 | s1388 s1390 :: SWord8 = s16 & s1388 s1391 :: SWord8 = if s1353 then s1389 else s1390 s1392 :: SWord8 = s1 + s1387 s1393 :: SBool = s1392 < s1 s1394 :: SBool = s1392 < s1387 s1395 :: SBool = s1393 | s1394 s1396 :: SWord8 = s1392 >>> 1 s1397 :: SWord8 = s14 | s1396 s1398 :: SWord8 = s16 & s1396 s1399 :: SWord8 = if s1395 then s1397 else s1398 s1400 :: SWord8 = if s1354 then s1391 else s1399 s1401 :: SWord8 = if s1332 then s1379 else s1400 s1402 :: SWord8 = s1 + s1358 s1403 :: SBool = s1402 < s1 s1404 :: SBool = s1402 < s1358 s1405 :: SBool = s1403 | s1404 s1406 :: SWord8 = s1402 >>> 1 s1407 :: SWord8 = s14 | s1406 s1408 :: SWord8 = s16 & s1406 s1409 :: SWord8 = if s1405 then s1407 else s1408 s1410 :: SWord8 = s1409 >>> 1 s1411 :: SWord8 = s14 | s1410 s1412 :: SWord8 = s16 & s1410 s1413 :: SWord8 = if s1331 then s1411 else s1412 s1414 :: SWord8 = s1413 >>> 1 s1415 :: SWord8 = s14 | s1414 s1416 :: SWord8 = s16 & s1414 s1417 :: SWord8 = if s1353 then s1415 else s1416 s1418 :: SWord8 = s1 + s1413 s1419 :: SBool = s1418 < s1 s1420 :: SBool = s1418 < s1413 s1421 :: SBool = s1419 | s1420 s1422 :: SWord8 = s1418 >>> 1 s1423 :: SWord8 = s14 | s1422 s1424 :: SWord8 = s16 & s1422 s1425 :: SWord8 = if s1421 then s1423 else s1424 s1426 :: SWord8 = if s1354 then s1417 else s1425 s1427 :: SWord8 = s1 + s1409 s1428 :: SBool = s1427 < s1 s1429 :: SBool = s1427 < s1409 s1430 :: SBool = s1428 | s1429 s1431 :: SWord8 = s1427 >>> 1 s1432 :: SWord8 = s14 | s1431 s1433 :: SWord8 = s16 & s1431 s1434 :: SWord8 = if s1430 then s1432 else s1433 s1435 :: SWord8 = s1434 >>> 1 s1436 :: SWord8 = s14 | s1435 s1437 :: SWord8 = s16 & s1435 s1438 :: SWord8 = if s1353 then s1436 else s1437 s1439 :: SWord8 = s1 + s1434 s1440 :: SBool = s1439 < s1 s1441 :: SBool = s1439 < s1434 s1442 :: SBool = s1440 | s1441 s1443 :: SWord8 = s1439 >>> 1 s1444 :: SWord8 = s14 | s1443 s1445 :: SWord8 = s16 & s1443 s1446 :: SWord8 = if s1442 then s1444 else s1445 s1447 :: SWord8 = if s1354 then s1438 else s1446 s1448 :: SWord8 = if s1332 then s1426 else s1447 s1449 :: SWord8 = if s1080 then s1401 else s1448 s1450 :: SWord8 = s1 + s1339 s1451 :: SWord1 = choose [0:0] s1450 s1452 :: SBool = s10 /= s1451 s1453 :: SWord8 = if s1452 then s1343 else s1344 s1454 :: SWord1 = choose [0:0] s1453 s1455 :: SBool = s10 /= s1454 s1456 :: SWord8 = if s1455 then s1349 else s1350 s1457 :: SWord1 = choose [0:0] s1456 s1458 :: SBool = s10 /= s1457 s1459 :: SBool = s_2 == s1458 s1460 :: SBool = s1450 < s1 s1461 :: SBool = s1450 < s1339 s1462 :: SBool = s1460 | s1461 s1463 :: SWord8 = s1450 >>> 1 s1464 :: SWord8 = s14 | s1463 s1465 :: SWord8 = s16 & s1463 s1466 :: SWord8 = if s1462 then s1464 else s1465 s1467 :: SWord8 = s1466 >>> 1 s1468 :: SWord8 = s14 | s1467 s1469 :: SWord8 = s16 & s1467 s1470 :: SWord8 = if s1079 then s1468 else s1469 s1471 :: SWord8 = s1470 >>> 1 s1472 :: SWord8 = s14 | s1471 s1473 :: SWord8 = s16 & s1471 s1474 :: SWord8 = if s1331 then s1472 else s1473 s1475 :: SWord8 = s1474 >>> 1 s1476 :: SWord8 = s14 | s1475 s1477 :: SWord8 = s16 & s1475 s1478 :: SWord8 = if s1458 then s1476 else s1477 s1479 :: SWord8 = s1 + s1474 s1480 :: SBool = s1479 < s1 s1481 :: SBool = s1479 < s1474 s1482 :: SBool = s1480 | s1481 s1483 :: SWord8 = s1479 >>> 1 s1484 :: SWord8 = s14 | s1483 s1485 :: SWord8 = s16 & s1483 s1486 :: SWord8 = if s1482 then s1484 else s1485 s1487 :: SWord8 = if s1459 then s1478 else s1486 s1488 :: SWord8 = s1 + s1470 s1489 :: SBool = s1488 < s1 s1490 :: SBool = s1488 < s1470 s1491 :: SBool = s1489 | s1490 s1492 :: SWord8 = s1488 >>> 1 s1493 :: SWord8 = s14 | s1492 s1494 :: SWord8 = s16 & s1492 s1495 :: SWord8 = if s1491 then s1493 else s1494 s1496 :: SWord8 = s1495 >>> 1 s1497 :: SWord8 = s14 | s1496 s1498 :: SWord8 = s16 & s1496 s1499 :: SWord8 = if s1458 then s1497 else s1498 s1500 :: SWord8 = s1 + s1495 s1501 :: SBool = s1500 < s1 s1502 :: SBool = s1500 < s1495 s1503 :: SBool = s1501 | s1502 s1504 :: SWord8 = s1500 >>> 1 s1505 :: SWord8 = s14 | s1504 s1506 :: SWord8 = s16 & s1504 s1507 :: SWord8 = if s1503 then s1505 else s1506 s1508 :: SWord8 = if s1459 then s1499 else s1507 s1509 :: SWord8 = if s1332 then s1487 else s1508 s1510 :: SWord8 = s1 + s1466 s1511 :: SBool = s1510 < s1 s1512 :: SBool = s1510 < s1466 s1513 :: SBool = s1511 | s1512 s1514 :: SWord8 = s1510 >>> 1 s1515 :: SWord8 = s14 | s1514 s1516 :: SWord8 = s16 & s1514 s1517 :: SWord8 = if s1513 then s1515 else s1516 s1518 :: SWord8 = s1517 >>> 1 s1519 :: SWord8 = s14 | s1518 s1520 :: SWord8 = s16 & s1518 s1521 :: SWord8 = if s1331 then s1519 else s1520 s1522 :: SWord8 = s1521 >>> 1 s1523 :: SWord8 = s14 | s1522 s1524 :: SWord8 = s16 & s1522 s1525 :: SWord8 = if s1458 then s1523 else s1524 s1526 :: SWord8 = s1 + s1521 s1527 :: SBool = s1526 < s1 s1528 :: SBool = s1526 < s1521 s1529 :: SBool = s1527 | s1528 s1530 :: SWord8 = s1526 >>> 1 s1531 :: SWord8 = s14 | s1530 s1532 :: SWord8 = s16 & s1530 s1533 :: SWord8 = if s1529 then s1531 else s1532 s1534 :: SWord8 = if s1459 then s1525 else s1533 s1535 :: SWord8 = s1 + s1517 s1536 :: SBool = s1535 < s1 s1537 :: SBool = s1535 < s1517 s1538 :: SBool = s1536 | s1537 s1539 :: SWord8 = s1535 >>> 1 s1540 :: SWord8 = s14 | s1539 s1541 :: SWord8 = s16 & s1539 s1542 :: SWord8 = if s1538 then s1540 else s1541 s1543 :: SWord8 = s1542 >>> 1 s1544 :: SWord8 = s14 | s1543 s1545 :: SWord8 = s16 & s1543 s1546 :: SWord8 = if s1458 then s1544 else s1545 s1547 :: SWord8 = s1 + s1542 s1548 :: SBool = s1547 < s1 s1549 :: SBool = s1547 < s1542 s1550 :: SBool = s1548 | s1549 s1551 :: SWord8 = s1547 >>> 1 s1552 :: SWord8 = s14 | s1551 s1553 :: SWord8 = s16 & s1551 s1554 :: SWord8 = if s1550 then s1552 else s1553 s1555 :: SWord8 = if s1459 then s1546 else s1554 s1556 :: SWord8 = if s1332 then s1534 else s1555 s1557 :: SWord8 = if s1080 then s1509 else s1556 s1558 :: SWord8 = if s1058 then s1449 else s1557 s1559 :: SWord8 = if s41 then s1322 else s1558 s1560 :: SWord8 = s1 + s1065 s1561 :: SWord1 = choose [0:0] s1560 s1562 :: SBool = s10 /= s1561 s1563 :: SWord8 = if s1562 then s1069 else s1070 s1564 :: SWord1 = choose [0:0] s1563 s1565 :: SBool = s10 /= s1564 s1566 :: SWord8 = if s1565 then s1075 else s1076 s1567 :: SWord1 = choose [0:0] s1566 s1568 :: SBool = s10 /= s1567 s1569 :: SBool = s_2 == s1568 s1570 :: SBool = s1560 < s1 s1571 :: SBool = s1560 < s1065 s1572 :: SBool = s1570 | s1571 s1573 :: SWord8 = s1560 >>> 1 s1574 :: SWord8 = s14 | s1573 s1575 :: SWord8 = s16 & s1573 s1576 :: SWord8 = if s1572 then s1574 else s1575 s1577 :: SWord1 = choose [0:0] s1576 s1578 :: SBool = s10 /= s1577 s1579 :: SWord8 = s1563 >>> 1 s1580 :: SWord8 = s14 | s1579 s1581 :: SWord8 = s16 & s1579 s1582 :: SWord8 = if s1578 then s1580 else s1581 s1583 :: SWord1 = choose [0:0] s1582 s1584 :: SBool = s10 /= s1583 s1585 :: SWord8 = s1566 >>> 1 s1586 :: SWord8 = s14 | s1585 s1587 :: SWord8 = s16 & s1585 s1588 :: SWord8 = if s1584 then s1586 else s1587 s1589 :: SWord1 = choose [0:0] s1588 s1590 :: SBool = s10 /= s1589 s1591 :: SBool = s_2 == s1590 s1592 :: SWord8 = s1576 >>> 1 s1593 :: SWord8 = s14 | s1592 s1594 :: SWord8 = s16 & s1592 s1595 :: SWord8 = if s40 then s1593 else s1594 s1596 :: SWord1 = choose [0:0] s1595 s1597 :: SBool = s10 /= s1596 s1598 :: SWord8 = s1582 >>> 1 s1599 :: SWord8 = s14 | s1598 s1600 :: SWord8 = s16 & s1598 s1601 :: SWord8 = if s1597 then s1599 else s1600 s1602 :: SWord1 = choose [0:0] s1601 s1603 :: SBool = s10 /= s1602 s1604 :: SWord8 = s1588 >>> 1 s1605 :: SWord8 = s14 | s1604 s1606 :: SWord8 = s16 & s1604 s1607 :: SWord8 = if s1603 then s1605 else s1606 s1608 :: SWord1 = choose [0:0] s1607 s1609 :: SBool = s10 /= s1608 s1610 :: SBool = s_2 == s1609 s1611 :: SWord8 = s1595 >>> 1 s1612 :: SWord8 = s14 | s1611 s1613 :: SWord8 = s16 & s1611 s1614 :: SWord8 = if s1057 then s1612 else s1613 s1615 :: SWord8 = s1614 >>> 1 s1616 :: SWord8 = s14 | s1615 s1617 :: SWord8 = s16 & s1615 s1618 :: SWord8 = if s1568 then s1616 else s1617 s1619 :: SWord8 = s1618 >>> 1 s1620 :: SWord8 = s14 | s1619 s1621 :: SWord8 = s16 & s1619 s1622 :: SWord8 = if s1590 then s1620 else s1621 s1623 :: SWord8 = s1622 >>> 1 s1624 :: SWord8 = s14 | s1623 s1625 :: SWord8 = s16 & s1623 s1626 :: SWord8 = if s1609 then s1624 else s1625 s1627 :: SWord8 = s1 + s1622 s1628 :: SBool = s1627 < s1 s1629 :: SBool = s1627 < s1622 s1630 :: SBool = s1628 | s1629 s1631 :: SWord8 = s1627 >>> 1 s1632 :: SWord8 = s14 | s1631 s1633 :: SWord8 = s16 & s1631 s1634 :: SWord8 = if s1630 then s1632 else s1633 s1635 :: SWord8 = if s1610 then s1626 else s1634 s1636 :: SWord8 = s1 + s1618 s1637 :: SBool = s1636 < s1 s1638 :: SBool = s1636 < s1618 s1639 :: SBool = s1637 | s1638 s1640 :: SWord8 = s1636 >>> 1 s1641 :: SWord8 = s14 | s1640 s1642 :: SWord8 = s16 & s1640 s1643 :: SWord8 = if s1639 then s1641 else s1642 s1644 :: SWord8 = s1643 >>> 1 s1645 :: SWord8 = s14 | s1644 s1646 :: SWord8 = s16 & s1644 s1647 :: SWord8 = if s1609 then s1645 else s1646 s1648 :: SWord8 = s1 + s1643 s1649 :: SBool = s1648 < s1 s1650 :: SBool = s1648 < s1643 s1651 :: SBool = s1649 | s1650 s1652 :: SWord8 = s1648 >>> 1 s1653 :: SWord8 = s14 | s1652 s1654 :: SWord8 = s16 & s1652 s1655 :: SWord8 = if s1651 then s1653 else s1654 s1656 :: SWord8 = if s1610 then s1647 else s1655 s1657 :: SWord8 = if s1591 then s1635 else s1656 s1658 :: SWord8 = s1 + s1614 s1659 :: SBool = s1658 < s1 s1660 :: SBool = s1658 < s1614 s1661 :: SBool = s1659 | s1660 s1662 :: SWord8 = s1658 >>> 1 s1663 :: SWord8 = s14 | s1662 s1664 :: SWord8 = s16 & s1662 s1665 :: SWord8 = if s1661 then s1663 else s1664 s1666 :: SWord8 = s1665 >>> 1 s1667 :: SWord8 = s14 | s1666 s1668 :: SWord8 = s16 & s1666 s1669 :: SWord8 = if s1590 then s1667 else s1668 s1670 :: SWord8 = s1669 >>> 1 s1671 :: SWord8 = s14 | s1670 s1672 :: SWord8 = s16 & s1670 s1673 :: SWord8 = if s1609 then s1671 else s1672 s1674 :: SWord8 = s1 + s1669 s1675 :: SBool = s1674 < s1 s1676 :: SBool = s1674 < s1669 s1677 :: SBool = s1675 | s1676 s1678 :: SWord8 = s1674 >>> 1 s1679 :: SWord8 = s14 | s1678 s1680 :: SWord8 = s16 & s1678 s1681 :: SWord8 = if s1677 then s1679 else s1680 s1682 :: SWord8 = if s1610 then s1673 else s1681 s1683 :: SWord8 = s1 + s1665 s1684 :: SBool = s1683 < s1 s1685 :: SBool = s1683 < s1665 s1686 :: SBool = s1684 | s1685 s1687 :: SWord8 = s1683 >>> 1 s1688 :: SWord8 = s14 | s1687 s1689 :: SWord8 = s16 & s1687 s1690 :: SWord8 = if s1686 then s1688 else s1689 s1691 :: SWord8 = s1690 >>> 1 s1692 :: SWord8 = s14 | s1691 s1693 :: SWord8 = s16 & s1691 s1694 :: SWord8 = if s1609 then s1692 else s1693 s1695 :: SWord8 = s1 + s1690 s1696 :: SBool = s1695 < s1 s1697 :: SBool = s1695 < s1690 s1698 :: SBool = s1696 | s1697 s1699 :: SWord8 = s1695 >>> 1 s1700 :: SWord8 = s14 | s1699 s1701 :: SWord8 = s16 & s1699 s1702 :: SWord8 = if s1698 then s1700 else s1701 s1703 :: SWord8 = if s1610 then s1694 else s1702 s1704 :: SWord8 = if s1591 then s1682 else s1703 s1705 :: SWord8 = if s1569 then s1657 else s1704 s1706 :: SWord8 = s1 + s1595 s1707 :: SWord1 = choose [0:0] s1706 s1708 :: SBool = s10 /= s1707 s1709 :: SWord8 = if s1708 then s1599 else s1600 s1710 :: SWord1 = choose [0:0] s1709 s1711 :: SBool = s10 /= s1710 s1712 :: SWord8 = if s1711 then s1605 else s1606 s1713 :: SWord1 = choose [0:0] s1712 s1714 :: SBool = s10 /= s1713 s1715 :: SBool = s_2 == s1714 s1716 :: SBool = s1706 < s1 s1717 :: SBool = s1706 < s1595 s1718 :: SBool = s1716 | s1717 s1719 :: SWord8 = s1706 >>> 1 s1720 :: SWord8 = s14 | s1719 s1721 :: SWord8 = s16 & s1719 s1722 :: SWord8 = if s1718 then s1720 else s1721 s1723 :: SWord8 = s1722 >>> 1 s1724 :: SWord8 = s14 | s1723 s1725 :: SWord8 = s16 & s1723 s1726 :: SWord8 = if s1568 then s1724 else s1725 s1727 :: SWord8 = s1726 >>> 1 s1728 :: SWord8 = s14 | s1727 s1729 :: SWord8 = s16 & s1727 s1730 :: SWord8 = if s1590 then s1728 else s1729 s1731 :: SWord8 = s1730 >>> 1 s1732 :: SWord8 = s14 | s1731 s1733 :: SWord8 = s16 & s1731 s1734 :: SWord8 = if s1714 then s1732 else s1733 s1735 :: SWord8 = s1 + s1730 s1736 :: SBool = s1735 < s1 s1737 :: SBool = s1735 < s1730 s1738 :: SBool = s1736 | s1737 s1739 :: SWord8 = s1735 >>> 1 s1740 :: SWord8 = s14 | s1739 s1741 :: SWord8 = s16 & s1739 s1742 :: SWord8 = if s1738 then s1740 else s1741 s1743 :: SWord8 = if s1715 then s1734 else s1742 s1744 :: SWord8 = s1 + s1726 s1745 :: SBool = s1744 < s1 s1746 :: SBool = s1744 < s1726 s1747 :: SBool = s1745 | s1746 s1748 :: SWord8 = s1744 >>> 1 s1749 :: SWord8 = s14 | s1748 s1750 :: SWord8 = s16 & s1748 s1751 :: SWord8 = if s1747 then s1749 else s1750 s1752 :: SWord8 = s1751 >>> 1 s1753 :: SWord8 = s14 | s1752 s1754 :: SWord8 = s16 & s1752 s1755 :: SWord8 = if s1714 then s1753 else s1754 s1756 :: SWord8 = s1 + s1751 s1757 :: SBool = s1756 < s1 s1758 :: SBool = s1756 < s1751 s1759 :: SBool = s1757 | s1758 s1760 :: SWord8 = s1756 >>> 1 s1761 :: SWord8 = s14 | s1760 s1762 :: SWord8 = s16 & s1760 s1763 :: SWord8 = if s1759 then s1761 else s1762 s1764 :: SWord8 = if s1715 then s1755 else s1763 s1765 :: SWord8 = if s1591 then s1743 else s1764 s1766 :: SWord8 = s1 + s1722 s1767 :: SBool = s1766 < s1 s1768 :: SBool = s1766 < s1722 s1769 :: SBool = s1767 | s1768 s1770 :: SWord8 = s1766 >>> 1 s1771 :: SWord8 = s14 | s1770 s1772 :: SWord8 = s16 & s1770 s1773 :: SWord8 = if s1769 then s1771 else s1772 s1774 :: SWord8 = s1773 >>> 1 s1775 :: SWord8 = s14 | s1774 s1776 :: SWord8 = s16 & s1774 s1777 :: SWord8 = if s1590 then s1775 else s1776 s1778 :: SWord8 = s1777 >>> 1 s1779 :: SWord8 = s14 | s1778 s1780 :: SWord8 = s16 & s1778 s1781 :: SWord8 = if s1714 then s1779 else s1780 s1782 :: SWord8 = s1 + s1777 s1783 :: SBool = s1782 < s1 s1784 :: SBool = s1782 < s1777 s1785 :: SBool = s1783 | s1784 s1786 :: SWord8 = s1782 >>> 1 s1787 :: SWord8 = s14 | s1786 s1788 :: SWord8 = s16 & s1786 s1789 :: SWord8 = if s1785 then s1787 else s1788 s1790 :: SWord8 = if s1715 then s1781 else s1789 s1791 :: SWord8 = s1 + s1773 s1792 :: SBool = s1791 < s1 s1793 :: SBool = s1791 < s1773 s1794 :: SBool = s1792 | s1793 s1795 :: SWord8 = s1791 >>> 1 s1796 :: SWord8 = s14 | s1795 s1797 :: SWord8 = s16 & s1795 s1798 :: SWord8 = if s1794 then s1796 else s1797 s1799 :: SWord8 = s1798 >>> 1 s1800 :: SWord8 = s14 | s1799 s1801 :: SWord8 = s16 & s1799 s1802 :: SWord8 = if s1714 then s1800 else s1801 s1803 :: SWord8 = s1 + s1798 s1804 :: SBool = s1803 < s1 s1805 :: SBool = s1803 < s1798 s1806 :: SBool = s1804 | s1805 s1807 :: SWord8 = s1803 >>> 1 s1808 :: SWord8 = s14 | s1807 s1809 :: SWord8 = s16 & s1807 s1810 :: SWord8 = if s1806 then s1808 else s1809 s1811 :: SWord8 = if s1715 then s1802 else s1810 s1812 :: SWord8 = if s1591 then s1790 else s1811 s1813 :: SWord8 = if s1569 then s1765 else s1812 s1814 :: SWord8 = if s1058 then s1705 else s1813 s1815 :: SWord8 = s1 + s1576 s1816 :: SWord1 = choose [0:0] s1815 s1817 :: SBool = s10 /= s1816 s1818 :: SWord8 = if s1817 then s1580 else s1581 s1819 :: SWord1 = choose [0:0] s1818 s1820 :: SBool = s10 /= s1819 s1821 :: SWord8 = if s1820 then s1586 else s1587 s1822 :: SWord1 = choose [0:0] s1821 s1823 :: SBool = s10 /= s1822 s1824 :: SBool = s_2 == s1823 s1825 :: SBool = s1815 < s1 s1826 :: SBool = s1815 < s1576 s1827 :: SBool = s1825 | s1826 s1828 :: SWord8 = s1815 >>> 1 s1829 :: SWord8 = s14 | s1828 s1830 :: SWord8 = s16 & s1828 s1831 :: SWord8 = if s1827 then s1829 else s1830 s1832 :: SWord1 = choose [0:0] s1831 s1833 :: SBool = s10 /= s1832 s1834 :: SWord8 = s1818 >>> 1 s1835 :: SWord8 = s14 | s1834 s1836 :: SWord8 = s16 & s1834 s1837 :: SWord8 = if s1833 then s1835 else s1836 s1838 :: SWord1 = choose [0:0] s1837 s1839 :: SBool = s10 /= s1838 s1840 :: SWord8 = s1821 >>> 1 s1841 :: SWord8 = s14 | s1840 s1842 :: SWord8 = s16 & s1840 s1843 :: SWord8 = if s1839 then s1841 else s1842 s1844 :: SWord1 = choose [0:0] s1843 s1845 :: SBool = s10 /= s1844 s1846 :: SBool = s_2 == s1845 s1847 :: SWord8 = s1831 >>> 1 s1848 :: SWord8 = s14 | s1847 s1849 :: SWord8 = s16 & s1847 s1850 :: SWord8 = if s1057 then s1848 else s1849 s1851 :: SWord8 = s1850 >>> 1 s1852 :: SWord8 = s14 | s1851 s1853 :: SWord8 = s16 & s1851 s1854 :: SWord8 = if s1568 then s1852 else s1853 s1855 :: SWord8 = s1854 >>> 1 s1856 :: SWord8 = s14 | s1855 s1857 :: SWord8 = s16 & s1855 s1858 :: SWord8 = if s1823 then s1856 else s1857 s1859 :: SWord8 = s1858 >>> 1 s1860 :: SWord8 = s14 | s1859 s1861 :: SWord8 = s16 & s1859 s1862 :: SWord8 = if s1845 then s1860 else s1861 s1863 :: SWord8 = s1 + s1858 s1864 :: SBool = s1863 < s1 s1865 :: SBool = s1863 < s1858 s1866 :: SBool = s1864 | s1865 s1867 :: SWord8 = s1863 >>> 1 s1868 :: SWord8 = s14 | s1867 s1869 :: SWord8 = s16 & s1867 s1870 :: SWord8 = if s1866 then s1868 else s1869 s1871 :: SWord8 = if s1846 then s1862 else s1870 s1872 :: SWord8 = s1 + s1854 s1873 :: SBool = s1872 < s1 s1874 :: SBool = s1872 < s1854 s1875 :: SBool = s1873 | s1874 s1876 :: SWord8 = s1872 >>> 1 s1877 :: SWord8 = s14 | s1876 s1878 :: SWord8 = s16 & s1876 s1879 :: SWord8 = if s1875 then s1877 else s1878 s1880 :: SWord8 = s1879 >>> 1 s1881 :: SWord8 = s14 | s1880 s1882 :: SWord8 = s16 & s1880 s1883 :: SWord8 = if s1845 then s1881 else s1882 s1884 :: SWord8 = s1 + s1879 s1885 :: SBool = s1884 < s1 s1886 :: SBool = s1884 < s1879 s1887 :: SBool = s1885 | s1886 s1888 :: SWord8 = s1884 >>> 1 s1889 :: SWord8 = s14 | s1888 s1890 :: SWord8 = s16 & s1888 s1891 :: SWord8 = if s1887 then s1889 else s1890 s1892 :: SWord8 = if s1846 then s1883 else s1891 s1893 :: SWord8 = if s1824 then s1871 else s1892 s1894 :: SWord8 = s1 + s1850 s1895 :: SBool = s1894 < s1 s1896 :: SBool = s1894 < s1850 s1897 :: SBool = s1895 | s1896 s1898 :: SWord8 = s1894 >>> 1 s1899 :: SWord8 = s14 | s1898 s1900 :: SWord8 = s16 & s1898 s1901 :: SWord8 = if s1897 then s1899 else s1900 s1902 :: SWord8 = s1901 >>> 1 s1903 :: SWord8 = s14 | s1902 s1904 :: SWord8 = s16 & s1902 s1905 :: SWord8 = if s1823 then s1903 else s1904 s1906 :: SWord8 = s1905 >>> 1 s1907 :: SWord8 = s14 | s1906 s1908 :: SWord8 = s16 & s1906 s1909 :: SWord8 = if s1845 then s1907 else s1908 s1910 :: SWord8 = s1 + s1905 s1911 :: SBool = s1910 < s1 s1912 :: SBool = s1910 < s1905 s1913 :: SBool = s1911 | s1912 s1914 :: SWord8 = s1910 >>> 1 s1915 :: SWord8 = s14 | s1914 s1916 :: SWord8 = s16 & s1914 s1917 :: SWord8 = if s1913 then s1915 else s1916 s1918 :: SWord8 = if s1846 then s1909 else s1917 s1919 :: SWord8 = s1 + s1901 s1920 :: SBool = s1919 < s1 s1921 :: SBool = s1919 < s1901 s1922 :: SBool = s1920 | s1921 s1923 :: SWord8 = s1919 >>> 1 s1924 :: SWord8 = s14 | s1923 s1925 :: SWord8 = s16 & s1923 s1926 :: SWord8 = if s1922 then s1924 else s1925 s1927 :: SWord8 = s1926 >>> 1 s1928 :: SWord8 = s14 | s1927 s1929 :: SWord8 = s16 & s1927 s1930 :: SWord8 = if s1845 then s1928 else s1929 s1931 :: SWord8 = s1 + s1926 s1932 :: SBool = s1931 < s1 s1933 :: SBool = s1931 < s1926 s1934 :: SBool = s1932 | s1933 s1935 :: SWord8 = s1931 >>> 1 s1936 :: SWord8 = s14 | s1935 s1937 :: SWord8 = s16 & s1935 s1938 :: SWord8 = if s1934 then s1936 else s1937 s1939 :: SWord8 = if s1846 then s1930 else s1938 s1940 :: SWord8 = if s1824 then s1918 else s1939 s1941 :: SWord8 = if s1569 then s1893 else s1940 s1942 :: SWord8 = s1 + s1831 s1943 :: SWord1 = choose [0:0] s1942 s1944 :: SBool = s10 /= s1943 s1945 :: SWord8 = if s1944 then s1835 else s1836 s1946 :: SWord1 = choose [0:0] s1945 s1947 :: SBool = s10 /= s1946 s1948 :: SWord8 = if s1947 then s1841 else s1842 s1949 :: SWord1 = choose [0:0] s1948 s1950 :: SBool = s10 /= s1949 s1951 :: SBool = s_2 == s1950 s1952 :: SBool = s1942 < s1 s1953 :: SBool = s1942 < s1831 s1954 :: SBool = s1952 | s1953 s1955 :: SWord8 = s1942 >>> 1 s1956 :: SWord8 = s14 | s1955 s1957 :: SWord8 = s16 & s1955 s1958 :: SWord8 = if s1954 then s1956 else s1957 s1959 :: SWord8 = s1958 >>> 1 s1960 :: SWord8 = s14 | s1959 s1961 :: SWord8 = s16 & s1959 s1962 :: SWord8 = if s1568 then s1960 else s1961 s1963 :: SWord8 = s1962 >>> 1 s1964 :: SWord8 = s14 | s1963 s1965 :: SWord8 = s16 & s1963 s1966 :: SWord8 = if s1823 then s1964 else s1965 s1967 :: SWord8 = s1966 >>> 1 s1968 :: SWord8 = s14 | s1967 s1969 :: SWord8 = s16 & s1967 s1970 :: SWord8 = if s1950 then s1968 else s1969 s1971 :: SWord8 = s1 + s1966 s1972 :: SBool = s1971 < s1 s1973 :: SBool = s1971 < s1966 s1974 :: SBool = s1972 | s1973 s1975 :: SWord8 = s1971 >>> 1 s1976 :: SWord8 = s14 | s1975 s1977 :: SWord8 = s16 & s1975 s1978 :: SWord8 = if s1974 then s1976 else s1977 s1979 :: SWord8 = if s1951 then s1970 else s1978 s1980 :: SWord8 = s1 + s1962 s1981 :: SBool = s1980 < s1 s1982 :: SBool = s1980 < s1962 s1983 :: SBool = s1981 | s1982 s1984 :: SWord8 = s1980 >>> 1 s1985 :: SWord8 = s14 | s1984 s1986 :: SWord8 = s16 & s1984 s1987 :: SWord8 = if s1983 then s1985 else s1986 s1988 :: SWord8 = s1987 >>> 1 s1989 :: SWord8 = s14 | s1988 s1990 :: SWord8 = s16 & s1988 s1991 :: SWord8 = if s1950 then s1989 else s1990 s1992 :: SWord8 = s1 + s1987 s1993 :: SBool = s1992 < s1 s1994 :: SBool = s1992 < s1987 s1995 :: SBool = s1993 | s1994 s1996 :: SWord8 = s1992 >>> 1 s1997 :: SWord8 = s14 | s1996 s1998 :: SWord8 = s16 & s1996 s1999 :: SWord8 = if s1995 then s1997 else s1998 s2000 :: SWord8 = if s1951 then s1991 else s1999 s2001 :: SWord8 = if s1824 then s1979 else s2000 s2002 :: SWord8 = s1 + s1958 s2003 :: SBool = s2002 < s1 s2004 :: SBool = s2002 < s1958 s2005 :: SBool = s2003 | s2004 s2006 :: SWord8 = s2002 >>> 1 s2007 :: SWord8 = s14 | s2006 s2008 :: SWord8 = s16 & s2006 s2009 :: SWord8 = if s2005 then s2007 else s2008 s2010 :: SWord8 = s2009 >>> 1 s2011 :: SWord8 = s14 | s2010 s2012 :: SWord8 = s16 & s2010 s2013 :: SWord8 = if s1823 then s2011 else s2012 s2014 :: SWord8 = s2013 >>> 1 s2015 :: SWord8 = s14 | s2014 s2016 :: SWord8 = s16 & s2014 s2017 :: SWord8 = if s1950 then s2015 else s2016 s2018 :: SWord8 = s1 + s2013 s2019 :: SBool = s2018 < s1 s2020 :: SBool = s2018 < s2013 s2021 :: SBool = s2019 | s2020 s2022 :: SWord8 = s2018 >>> 1 s2023 :: SWord8 = s14 | s2022 s2024 :: SWord8 = s16 & s2022 s2025 :: SWord8 = if s2021 then s2023 else s2024 s2026 :: SWord8 = if s1951 then s2017 else s2025 s2027 :: SWord8 = s1 + s2009 s2028 :: SBool = s2027 < s1 s2029 :: SBool = s2027 < s2009 s2030 :: SBool = s2028 | s2029 s2031 :: SWord8 = s2027 >>> 1 s2032 :: SWord8 = s14 | s2031 s2033 :: SWord8 = s16 & s2031 s2034 :: SWord8 = if s2030 then s2032 else s2033 s2035 :: SWord8 = s2034 >>> 1 s2036 :: SWord8 = s14 | s2035 s2037 :: SWord8 = s16 & s2035 s2038 :: SWord8 = if s1950 then s2036 else s2037 s2039 :: SWord8 = s1 + s2034 s2040 :: SBool = s2039 < s1 s2041 :: SBool = s2039 < s2034 s2042 :: SBool = s2040 | s2041 s2043 :: SWord8 = s2039 >>> 1 s2044 :: SWord8 = s14 | s2043 s2045 :: SWord8 = s16 & s2043 s2046 :: SWord8 = if s2042 then s2044 else s2045 s2047 :: SWord8 = if s1951 then s2038 else s2046 s2048 :: SWord8 = if s1824 then s2026 else s2047 s2049 :: SWord8 = if s1569 then s2001 else s2048 s2050 :: SWord8 = if s1058 then s1941 else s2049 s2051 :: SWord8 = if s41 then s1814 else s2050 s2052 :: SWord8 = if s30 then s1559 else s2051 s2053 :: SWord8 = if s21 then s1048 else s2052 s2054 :: SWord1 = choose [0:0] s1 s2055 :: SBool = s10 /= s2054 s2056 :: SWord8 = s14 | s31 s2057 :: SWord8 = if s2055 then s2056 else s32 s2058 :: SWord1 = choose [0:0] s2057 s2059 :: SBool = s10 /= s2058 s2060 :: SWord8 = if s2059 then s36 else s37 s2061 :: SWord1 = choose [0:0] s2060 s2062 :: SBool = s10 /= s2061 s2063 :: SBool = s_2 == s2062 s2064 :: SWord8 = s1 >>> 1 s2065 :: SWord8 = s16 & s2064 s2066 :: SWord1 = choose [0:0] s2065 s2067 :: SBool = s10 /= s2066 s2068 :: SWord8 = s2057 >>> 1 s2069 :: SWord8 = s14 | s2068 s2070 :: SWord8 = s16 & s2068 s2071 :: SWord8 = if s2067 then s2069 else s2070 s2072 :: SWord1 = choose [0:0] s2071 s2073 :: SBool = s10 /= s2072 s2074 :: SWord8 = s2060 >>> 1 s2075 :: SWord8 = s14 | s2074 s2076 :: SWord8 = s16 & s2074 s2077 :: SWord8 = if s2073 then s2075 else s2076 s2078 :: SWord1 = choose [0:0] s2077 s2079 :: SBool = s10 /= s2078 s2080 :: SBool = s_2 == s2079 s2081 :: SWord8 = s2065 >>> 1 s2082 :: SWord8 = s14 | s2081 s2083 :: SWord8 = s16 & s2081 s2084 :: SWord8 = if s20 then s2082 else s2083 s2085 :: SWord1 = choose [0:0] s2084 s2086 :: SBool = s10 /= s2085 s2087 :: SWord8 = s2071 >>> 1 s2088 :: SWord8 = s14 | s2087 s2089 :: SWord8 = s16 & s2087 s2090 :: SWord8 = if s2086 then s2088 else s2089 s2091 :: SWord1 = choose [0:0] s2090 s2092 :: SBool = s10 /= s2091 s2093 :: SWord8 = s2077 >>> 1 s2094 :: SWord8 = s14 | s2093 s2095 :: SWord8 = s16 & s2093 s2096 :: SWord8 = if s2092 then s2094 else s2095 s2097 :: SWord1 = choose [0:0] s2096 s2098 :: SBool = s10 /= s2097 s2099 :: SBool = s_2 == s2098 s2100 :: SWord8 = s2084 >>> 1 s2101 :: SWord8 = s14 | s2100 s2102 :: SWord8 = s16 & s2100 s2103 :: SWord8 = if s29 then s2101 else s2102 s2104 :: SWord1 = choose [0:0] s2103 s2105 :: SBool = s10 /= s2104 s2106 :: SWord8 = s2090 >>> 1 s2107 :: SWord8 = s14 | s2106 s2108 :: SWord8 = s16 & s2106 s2109 :: SWord8 = if s2105 then s2107 else s2108 s2110 :: SWord1 = choose [0:0] s2109 s2111 :: SBool = s10 /= s2110 s2112 :: SWord8 = s2096 >>> 1 s2113 :: SWord8 = s14 | s2112 s2114 :: SWord8 = s16 & s2112 s2115 :: SWord8 = if s2111 then s2113 else s2114 s2116 :: SWord1 = choose [0:0] s2115 s2117 :: SBool = s10 /= s2116 s2118 :: SBool = s_2 == s2117 s2119 :: SWord8 = s2103 >>> 1 s2120 :: SWord8 = s14 | s2119 s2121 :: SWord8 = s16 & s2119 s2122 :: SWord8 = if s2062 then s2120 else s2121 s2123 :: SWord1 = choose [0:0] s2122 s2124 :: SBool = s10 /= s2123 s2125 :: SWord8 = s2109 >>> 1 s2126 :: SWord8 = s14 | s2125 s2127 :: SWord8 = s16 & s2125 s2128 :: SWord8 = if s2124 then s2126 else s2127 s2129 :: SWord1 = choose [0:0] s2128 s2130 :: SBool = s10 /= s2129 s2131 :: SWord8 = s2115 >>> 1 s2132 :: SWord8 = s14 | s2131 s2133 :: SWord8 = s16 & s2131 s2134 :: SWord8 = if s2130 then s2132 else s2133 s2135 :: SWord1 = choose [0:0] s2134 s2136 :: SBool = s10 /= s2135 s2137 :: SBool = s_2 == s2136 s2138 :: SWord8 = s2122 >>> 1 s2139 :: SWord8 = s14 | s2138 s2140 :: SWord8 = s16 & s2138 s2141 :: SWord8 = if s2079 then s2139 else s2140 s2142 :: SWord8 = s2141 >>> 1 s2143 :: SWord8 = s14 | s2142 s2144 :: SWord8 = s16 & s2142 s2145 :: SWord8 = if s2098 then s2143 else s2144 s2146 :: SWord8 = s2145 >>> 1 s2147 :: SWord8 = s14 | s2146 s2148 :: SWord8 = s16 & s2146 s2149 :: SWord8 = if s2117 then s2147 else s2148 s2150 :: SWord8 = s2149 >>> 1 s2151 :: SWord8 = s14 | s2150 s2152 :: SWord8 = s16 & s2150 s2153 :: SWord8 = if s2136 then s2151 else s2152 s2154 :: SWord8 = s1 + s2149 s2155 :: SBool = s2154 < s1 s2156 :: SBool = s2154 < s2149 s2157 :: SBool = s2155 | s2156 s2158 :: SWord8 = s2154 >>> 1 s2159 :: SWord8 = s14 | s2158 s2160 :: SWord8 = s16 & s2158 s2161 :: SWord8 = if s2157 then s2159 else s2160 s2162 :: SWord8 = if s2137 then s2153 else s2161 s2163 :: SWord8 = s1 + s2145 s2164 :: SBool = s2163 < s1 s2165 :: SBool = s2163 < s2145 s2166 :: SBool = s2164 | s2165 s2167 :: SWord8 = s2163 >>> 1 s2168 :: SWord8 = s14 | s2167 s2169 :: SWord8 = s16 & s2167 s2170 :: SWord8 = if s2166 then s2168 else s2169 s2171 :: SWord8 = s2170 >>> 1 s2172 :: SWord8 = s14 | s2171 s2173 :: SWord8 = s16 & s2171 s2174 :: SWord8 = if s2136 then s2172 else s2173 s2175 :: SWord8 = s1 + s2170 s2176 :: SBool = s2175 < s1 s2177 :: SBool = s2175 < s2170 s2178 :: SBool = s2176 | s2177 s2179 :: SWord8 = s2175 >>> 1 s2180 :: SWord8 = s14 | s2179 s2181 :: SWord8 = s16 & s2179 s2182 :: SWord8 = if s2178 then s2180 else s2181 s2183 :: SWord8 = if s2137 then s2174 else s2182 s2184 :: SWord8 = if s2118 then s2162 else s2183 s2185 :: SWord8 = s1 + s2141 s2186 :: SBool = s2185 < s1 s2187 :: SBool = s2185 < s2141 s2188 :: SBool = s2186 | s2187 s2189 :: SWord8 = s2185 >>> 1 s2190 :: SWord8 = s14 | s2189 s2191 :: SWord8 = s16 & s2189 s2192 :: SWord8 = if s2188 then s2190 else s2191 s2193 :: SWord8 = s2192 >>> 1 s2194 :: SWord8 = s14 | s2193 s2195 :: SWord8 = s16 & s2193 s2196 :: SWord8 = if s2117 then s2194 else s2195 s2197 :: SWord8 = s2196 >>> 1 s2198 :: SWord8 = s14 | s2197 s2199 :: SWord8 = s16 & s2197 s2200 :: SWord8 = if s2136 then s2198 else s2199 s2201 :: SWord8 = s1 + s2196 s2202 :: SBool = s2201 < s1 s2203 :: SBool = s2201 < s2196 s2204 :: SBool = s2202 | s2203 s2205 :: SWord8 = s2201 >>> 1 s2206 :: SWord8 = s14 | s2205 s2207 :: SWord8 = s16 & s2205 s2208 :: SWord8 = if s2204 then s2206 else s2207 s2209 :: SWord8 = if s2137 then s2200 else s2208 s2210 :: SWord8 = s1 + s2192 s2211 :: SBool = s2210 < s1 s2212 :: SBool = s2210 < s2192 s2213 :: SBool = s2211 | s2212 s2214 :: SWord8 = s2210 >>> 1 s2215 :: SWord8 = s14 | s2214 s2216 :: SWord8 = s16 & s2214 s2217 :: SWord8 = if s2213 then s2215 else s2216 s2218 :: SWord8 = s2217 >>> 1 s2219 :: SWord8 = s14 | s2218 s2220 :: SWord8 = s16 & s2218 s2221 :: SWord8 = if s2136 then s2219 else s2220 s2222 :: SWord8 = s1 + s2217 s2223 :: SBool = s2222 < s1 s2224 :: SBool = s2222 < s2217 s2225 :: SBool = s2223 | s2224 s2226 :: SWord8 = s2222 >>> 1 s2227 :: SWord8 = s14 | s2226 s2228 :: SWord8 = s16 & s2226 s2229 :: SWord8 = if s2225 then s2227 else s2228 s2230 :: SWord8 = if s2137 then s2221 else s2229 s2231 :: SWord8 = if s2118 then s2209 else s2230 s2232 :: SWord8 = if s2099 then s2184 else s2231 s2233 :: SWord8 = s1 + s2122 s2234 :: SWord1 = choose [0:0] s2233 s2235 :: SBool = s10 /= s2234 s2236 :: SWord8 = if s2235 then s2126 else s2127 s2237 :: SWord1 = choose [0:0] s2236 s2238 :: SBool = s10 /= s2237 s2239 :: SWord8 = if s2238 then s2132 else s2133 s2240 :: SWord1 = choose [0:0] s2239 s2241 :: SBool = s10 /= s2240 s2242 :: SBool = s_2 == s2241 s2243 :: SBool = s2233 < s1 s2244 :: SBool = s2233 < s2122 s2245 :: SBool = s2243 | s2244 s2246 :: SWord8 = s2233 >>> 1 s2247 :: SWord8 = s14 | s2246 s2248 :: SWord8 = s16 & s2246 s2249 :: SWord8 = if s2245 then s2247 else s2248 s2250 :: SWord8 = s2249 >>> 1 s2251 :: SWord8 = s14 | s2250 s2252 :: SWord8 = s16 & s2250 s2253 :: SWord8 = if s2098 then s2251 else s2252 s2254 :: SWord8 = s2253 >>> 1 s2255 :: SWord8 = s14 | s2254 s2256 :: SWord8 = s16 & s2254 s2257 :: SWord8 = if s2117 then s2255 else s2256 s2258 :: SWord8 = s2257 >>> 1 s2259 :: SWord8 = s14 | s2258 s2260 :: SWord8 = s16 & s2258 s2261 :: SWord8 = if s2241 then s2259 else s2260 s2262 :: SWord8 = s1 + s2257 s2263 :: SBool = s2262 < s1 s2264 :: SBool = s2262 < s2257 s2265 :: SBool = s2263 | s2264 s2266 :: SWord8 = s2262 >>> 1 s2267 :: SWord8 = s14 | s2266 s2268 :: SWord8 = s16 & s2266 s2269 :: SWord8 = if s2265 then s2267 else s2268 s2270 :: SWord8 = if s2242 then s2261 else s2269 s2271 :: SWord8 = s1 + s2253 s2272 :: SBool = s2271 < s1 s2273 :: SBool = s2271 < s2253 s2274 :: SBool = s2272 | s2273 s2275 :: SWord8 = s2271 >>> 1 s2276 :: SWord8 = s14 | s2275 s2277 :: SWord8 = s16 & s2275 s2278 :: SWord8 = if s2274 then s2276 else s2277 s2279 :: SWord8 = s2278 >>> 1 s2280 :: SWord8 = s14 | s2279 s2281 :: SWord8 = s16 & s2279 s2282 :: SWord8 = if s2241 then s2280 else s2281 s2283 :: SWord8 = s1 + s2278 s2284 :: SBool = s2283 < s1 s2285 :: SBool = s2283 < s2278 s2286 :: SBool = s2284 | s2285 s2287 :: SWord8 = s2283 >>> 1 s2288 :: SWord8 = s14 | s2287 s2289 :: SWord8 = s16 & s2287 s2290 :: SWord8 = if s2286 then s2288 else s2289 s2291 :: SWord8 = if s2242 then s2282 else s2290 s2292 :: SWord8 = if s2118 then s2270 else s2291 s2293 :: SWord8 = s1 + s2249 s2294 :: SBool = s2293 < s1 s2295 :: SBool = s2293 < s2249 s2296 :: SBool = s2294 | s2295 s2297 :: SWord8 = s2293 >>> 1 s2298 :: SWord8 = s14 | s2297 s2299 :: SWord8 = s16 & s2297 s2300 :: SWord8 = if s2296 then s2298 else s2299 s2301 :: SWord8 = s2300 >>> 1 s2302 :: SWord8 = s14 | s2301 s2303 :: SWord8 = s16 & s2301 s2304 :: SWord8 = if s2117 then s2302 else s2303 s2305 :: SWord8 = s2304 >>> 1 s2306 :: SWord8 = s14 | s2305 s2307 :: SWord8 = s16 & s2305 s2308 :: SWord8 = if s2241 then s2306 else s2307 s2309 :: SWord8 = s1 + s2304 s2310 :: SBool = s2309 < s1 s2311 :: SBool = s2309 < s2304 s2312 :: SBool = s2310 | s2311 s2313 :: SWord8 = s2309 >>> 1 s2314 :: SWord8 = s14 | s2313 s2315 :: SWord8 = s16 & s2313 s2316 :: SWord8 = if s2312 then s2314 else s2315 s2317 :: SWord8 = if s2242 then s2308 else s2316 s2318 :: SWord8 = s1 + s2300 s2319 :: SBool = s2318 < s1 s2320 :: SBool = s2318 < s2300 s2321 :: SBool = s2319 | s2320 s2322 :: SWord8 = s2318 >>> 1 s2323 :: SWord8 = s14 | s2322 s2324 :: SWord8 = s16 & s2322 s2325 :: SWord8 = if s2321 then s2323 else s2324 s2326 :: SWord8 = s2325 >>> 1 s2327 :: SWord8 = s14 | s2326 s2328 :: SWord8 = s16 & s2326 s2329 :: SWord8 = if s2241 then s2327 else s2328 s2330 :: SWord8 = s1 + s2325 s2331 :: SBool = s2330 < s1 s2332 :: SBool = s2330 < s2325 s2333 :: SBool = s2331 | s2332 s2334 :: SWord8 = s2330 >>> 1 s2335 :: SWord8 = s14 | s2334 s2336 :: SWord8 = s16 & s2334 s2337 :: SWord8 = if s2333 then s2335 else s2336 s2338 :: SWord8 = if s2242 then s2329 else s2337 s2339 :: SWord8 = if s2118 then s2317 else s2338 s2340 :: SWord8 = if s2099 then s2292 else s2339 s2341 :: SWord8 = if s2080 then s2232 else s2340 s2342 :: SWord8 = s1 + s2103 s2343 :: SWord1 = choose [0:0] s2342 s2344 :: SBool = s10 /= s2343 s2345 :: SWord8 = if s2344 then s2107 else s2108 s2346 :: SWord1 = choose [0:0] s2345 s2347 :: SBool = s10 /= s2346 s2348 :: SWord8 = if s2347 then s2113 else s2114 s2349 :: SWord1 = choose [0:0] s2348 s2350 :: SBool = s10 /= s2349 s2351 :: SBool = s_2 == s2350 s2352 :: SBool = s2342 < s1 s2353 :: SBool = s2342 < s2103 s2354 :: SBool = s2352 | s2353 s2355 :: SWord8 = s2342 >>> 1 s2356 :: SWord8 = s14 | s2355 s2357 :: SWord8 = s16 & s2355 s2358 :: SWord8 = if s2354 then s2356 else s2357 s2359 :: SWord1 = choose [0:0] s2358 s2360 :: SBool = s10 /= s2359 s2361 :: SWord8 = s2345 >>> 1 s2362 :: SWord8 = s14 | s2361 s2363 :: SWord8 = s16 & s2361 s2364 :: SWord8 = if s2360 then s2362 else s2363 s2365 :: SWord1 = choose [0:0] s2364 s2366 :: SBool = s10 /= s2365 s2367 :: SWord8 = s2348 >>> 1 s2368 :: SWord8 = s14 | s2367 s2369 :: SWord8 = s16 & s2367 s2370 :: SWord8 = if s2366 then s2368 else s2369 s2371 :: SWord1 = choose [0:0] s2370 s2372 :: SBool = s10 /= s2371 s2373 :: SBool = s_2 == s2372 s2374 :: SWord8 = s2358 >>> 1 s2375 :: SWord8 = s14 | s2374 s2376 :: SWord8 = s16 & s2374 s2377 :: SWord8 = if s2079 then s2375 else s2376 s2378 :: SWord8 = s2377 >>> 1 s2379 :: SWord8 = s14 | s2378 s2380 :: SWord8 = s16 & s2378 s2381 :: SWord8 = if s2098 then s2379 else s2380 s2382 :: SWord8 = s2381 >>> 1 s2383 :: SWord8 = s14 | s2382 s2384 :: SWord8 = s16 & s2382 s2385 :: SWord8 = if s2350 then s2383 else s2384 s2386 :: SWord8 = s2385 >>> 1 s2387 :: SWord8 = s14 | s2386 s2388 :: SWord8 = s16 & s2386 s2389 :: SWord8 = if s2372 then s2387 else s2388 s2390 :: SWord8 = s1 + s2385 s2391 :: SBool = s2390 < s1 s2392 :: SBool = s2390 < s2385 s2393 :: SBool = s2391 | s2392 s2394 :: SWord8 = s2390 >>> 1 s2395 :: SWord8 = s14 | s2394 s2396 :: SWord8 = s16 & s2394 s2397 :: SWord8 = if s2393 then s2395 else s2396 s2398 :: SWord8 = if s2373 then s2389 else s2397 s2399 :: SWord8 = s1 + s2381 s2400 :: SBool = s2399 < s1 s2401 :: SBool = s2399 < s2381 s2402 :: SBool = s2400 | s2401 s2403 :: SWord8 = s2399 >>> 1 s2404 :: SWord8 = s14 | s2403 s2405 :: SWord8 = s16 & s2403 s2406 :: SWord8 = if s2402 then s2404 else s2405 s2407 :: SWord8 = s2406 >>> 1 s2408 :: SWord8 = s14 | s2407 s2409 :: SWord8 = s16 & s2407 s2410 :: SWord8 = if s2372 then s2408 else s2409 s2411 :: SWord8 = s1 + s2406 s2412 :: SBool = s2411 < s1 s2413 :: SBool = s2411 < s2406 s2414 :: SBool = s2412 | s2413 s2415 :: SWord8 = s2411 >>> 1 s2416 :: SWord8 = s14 | s2415 s2417 :: SWord8 = s16 & s2415 s2418 :: SWord8 = if s2414 then s2416 else s2417 s2419 :: SWord8 = if s2373 then s2410 else s2418 s2420 :: SWord8 = if s2351 then s2398 else s2419 s2421 :: SWord8 = s1 + s2377 s2422 :: SBool = s2421 < s1 s2423 :: SBool = s2421 < s2377 s2424 :: SBool = s2422 | s2423 s2425 :: SWord8 = s2421 >>> 1 s2426 :: SWord8 = s14 | s2425 s2427 :: SWord8 = s16 & s2425 s2428 :: SWord8 = if s2424 then s2426 else s2427 s2429 :: SWord8 = s2428 >>> 1 s2430 :: SWord8 = s14 | s2429 s2431 :: SWord8 = s16 & s2429 s2432 :: SWord8 = if s2350 then s2430 else s2431 s2433 :: SWord8 = s2432 >>> 1 s2434 :: SWord8 = s14 | s2433 s2435 :: SWord8 = s16 & s2433 s2436 :: SWord8 = if s2372 then s2434 else s2435 s2437 :: SWord8 = s1 + s2432 s2438 :: SBool = s2437 < s1 s2439 :: SBool = s2437 < s2432 s2440 :: SBool = s2438 | s2439 s2441 :: SWord8 = s2437 >>> 1 s2442 :: SWord8 = s14 | s2441 s2443 :: SWord8 = s16 & s2441 s2444 :: SWord8 = if s2440 then s2442 else s2443 s2445 :: SWord8 = if s2373 then s2436 else s2444 s2446 :: SWord8 = s1 + s2428 s2447 :: SBool = s2446 < s1 s2448 :: SBool = s2446 < s2428 s2449 :: SBool = s2447 | s2448 s2450 :: SWord8 = s2446 >>> 1 s2451 :: SWord8 = s14 | s2450 s2452 :: SWord8 = s16 & s2450 s2453 :: SWord8 = if s2449 then s2451 else s2452 s2454 :: SWord8 = s2453 >>> 1 s2455 :: SWord8 = s14 | s2454 s2456 :: SWord8 = s16 & s2454 s2457 :: SWord8 = if s2372 then s2455 else s2456 s2458 :: SWord8 = s1 + s2453 s2459 :: SBool = s2458 < s1 s2460 :: SBool = s2458 < s2453 s2461 :: SBool = s2459 | s2460 s2462 :: SWord8 = s2458 >>> 1 s2463 :: SWord8 = s14 | s2462 s2464 :: SWord8 = s16 & s2462 s2465 :: SWord8 = if s2461 then s2463 else s2464 s2466 :: SWord8 = if s2373 then s2457 else s2465 s2467 :: SWord8 = if s2351 then s2445 else s2466 s2468 :: SWord8 = if s2099 then s2420 else s2467 s2469 :: SWord8 = s1 + s2358 s2470 :: SWord1 = choose [0:0] s2469 s2471 :: SBool = s10 /= s2470 s2472 :: SWord8 = if s2471 then s2362 else s2363 s2473 :: SWord1 = choose [0:0] s2472 s2474 :: SBool = s10 /= s2473 s2475 :: SWord8 = if s2474 then s2368 else s2369 s2476 :: SWord1 = choose [0:0] s2475 s2477 :: SBool = s10 /= s2476 s2478 :: SBool = s_2 == s2477 s2479 :: SBool = s2469 < s1 s2480 :: SBool = s2469 < s2358 s2481 :: SBool = s2479 | s2480 s2482 :: SWord8 = s2469 >>> 1 s2483 :: SWord8 = s14 | s2482 s2484 :: SWord8 = s16 & s2482 s2485 :: SWord8 = if s2481 then s2483 else s2484 s2486 :: SWord8 = s2485 >>> 1 s2487 :: SWord8 = s14 | s2486 s2488 :: SWord8 = s16 & s2486 s2489 :: SWord8 = if s2098 then s2487 else s2488 s2490 :: SWord8 = s2489 >>> 1 s2491 :: SWord8 = s14 | s2490 s2492 :: SWord8 = s16 & s2490 s2493 :: SWord8 = if s2350 then s2491 else s2492 s2494 :: SWord8 = s2493 >>> 1 s2495 :: SWord8 = s14 | s2494 s2496 :: SWord8 = s16 & s2494 s2497 :: SWord8 = if s2477 then s2495 else s2496 s2498 :: SWord8 = s1 + s2493 s2499 :: SBool = s2498 < s1 s2500 :: SBool = s2498 < s2493 s2501 :: SBool = s2499 | s2500 s2502 :: SWord8 = s2498 >>> 1 s2503 :: SWord8 = s14 | s2502 s2504 :: SWord8 = s16 & s2502 s2505 :: SWord8 = if s2501 then s2503 else s2504 s2506 :: SWord8 = if s2478 then s2497 else s2505 s2507 :: SWord8 = s1 + s2489 s2508 :: SBool = s2507 < s1 s2509 :: SBool = s2507 < s2489 s2510 :: SBool = s2508 | s2509 s2511 :: SWord8 = s2507 >>> 1 s2512 :: SWord8 = s14 | s2511 s2513 :: SWord8 = s16 & s2511 s2514 :: SWord8 = if s2510 then s2512 else s2513 s2515 :: SWord8 = s2514 >>> 1 s2516 :: SWord8 = s14 | s2515 s2517 :: SWord8 = s16 & s2515 s2518 :: SWord8 = if s2477 then s2516 else s2517 s2519 :: SWord8 = s1 + s2514 s2520 :: SBool = s2519 < s1 s2521 :: SBool = s2519 < s2514 s2522 :: SBool = s2520 | s2521 s2523 :: SWord8 = s2519 >>> 1 s2524 :: SWord8 = s14 | s2523 s2525 :: SWord8 = s16 & s2523 s2526 :: SWord8 = if s2522 then s2524 else s2525 s2527 :: SWord8 = if s2478 then s2518 else s2526 s2528 :: SWord8 = if s2351 then s2506 else s2527 s2529 :: SWord8 = s1 + s2485 s2530 :: SBool = s2529 < s1 s2531 :: SBool = s2529 < s2485 s2532 :: SBool = s2530 | s2531 s2533 :: SWord8 = s2529 >>> 1 s2534 :: SWord8 = s14 | s2533 s2535 :: SWord8 = s16 & s2533 s2536 :: SWord8 = if s2532 then s2534 else s2535 s2537 :: SWord8 = s2536 >>> 1 s2538 :: SWord8 = s14 | s2537 s2539 :: SWord8 = s16 & s2537 s2540 :: SWord8 = if s2350 then s2538 else s2539 s2541 :: SWord8 = s2540 >>> 1 s2542 :: SWord8 = s14 | s2541 s2543 :: SWord8 = s16 & s2541 s2544 :: SWord8 = if s2477 then s2542 else s2543 s2545 :: SWord8 = s1 + s2540 s2546 :: SBool = s2545 < s1 s2547 :: SBool = s2545 < s2540 s2548 :: SBool = s2546 | s2547 s2549 :: SWord8 = s2545 >>> 1 s2550 :: SWord8 = s14 | s2549 s2551 :: SWord8 = s16 & s2549 s2552 :: SWord8 = if s2548 then s2550 else s2551 s2553 :: SWord8 = if s2478 then s2544 else s2552 s2554 :: SWord8 = s1 + s2536 s2555 :: SBool = s2554 < s1 s2556 :: SBool = s2554 < s2536 s2557 :: SBool = s2555 | s2556 s2558 :: SWord8 = s2554 >>> 1 s2559 :: SWord8 = s14 | s2558 s2560 :: SWord8 = s16 & s2558 s2561 :: SWord8 = if s2557 then s2559 else s2560 s2562 :: SWord8 = s2561 >>> 1 s2563 :: SWord8 = s14 | s2562 s2564 :: SWord8 = s16 & s2562 s2565 :: SWord8 = if s2477 then s2563 else s2564 s2566 :: SWord8 = s1 + s2561 s2567 :: SBool = s2566 < s1 s2568 :: SBool = s2566 < s2561 s2569 :: SBool = s2567 | s2568 s2570 :: SWord8 = s2566 >>> 1 s2571 :: SWord8 = s14 | s2570 s2572 :: SWord8 = s16 & s2570 s2573 :: SWord8 = if s2569 then s2571 else s2572 s2574 :: SWord8 = if s2478 then s2565 else s2573 s2575 :: SWord8 = if s2351 then s2553 else s2574 s2576 :: SWord8 = if s2099 then s2528 else s2575 s2577 :: SWord8 = if s2080 then s2468 else s2576 s2578 :: SWord8 = if s2063 then s2341 else s2577 s2579 :: SWord8 = s1 + s2084 s2580 :: SWord1 = choose [0:0] s2579 s2581 :: SBool = s10 /= s2580 s2582 :: SWord8 = if s2581 then s2088 else s2089 s2583 :: SWord1 = choose [0:0] s2582 s2584 :: SBool = s10 /= s2583 s2585 :: SWord8 = if s2584 then s2094 else s2095 s2586 :: SWord1 = choose [0:0] s2585 s2587 :: SBool = s10 /= s2586 s2588 :: SBool = s_2 == s2587 s2589 :: SBool = s2579 < s1 s2590 :: SBool = s2579 < s2084 s2591 :: SBool = s2589 | s2590 s2592 :: SWord8 = s2579 >>> 1 s2593 :: SWord8 = s14 | s2592 s2594 :: SWord8 = s16 & s2592 s2595 :: SWord8 = if s2591 then s2593 else s2594 s2596 :: SWord1 = choose [0:0] s2595 s2597 :: SBool = s10 /= s2596 s2598 :: SWord8 = s2582 >>> 1 s2599 :: SWord8 = s14 | s2598 s2600 :: SWord8 = s16 & s2598 s2601 :: SWord8 = if s2597 then s2599 else s2600 s2602 :: SWord1 = choose [0:0] s2601 s2603 :: SBool = s10 /= s2602 s2604 :: SWord8 = s2585 >>> 1 s2605 :: SWord8 = s14 | s2604 s2606 :: SWord8 = s16 & s2604 s2607 :: SWord8 = if s2603 then s2605 else s2606 s2608 :: SWord1 = choose [0:0] s2607 s2609 :: SBool = s10 /= s2608 s2610 :: SBool = s_2 == s2609 s2611 :: SWord8 = s2595 >>> 1 s2612 :: SWord8 = s14 | s2611 s2613 :: SWord8 = s16 & s2611 s2614 :: SWord8 = if s2062 then s2612 else s2613 s2615 :: SWord1 = choose [0:0] s2614 s2616 :: SBool = s10 /= s2615 s2617 :: SWord8 = s2601 >>> 1 s2618 :: SWord8 = s14 | s2617 s2619 :: SWord8 = s16 & s2617 s2620 :: SWord8 = if s2616 then s2618 else s2619 s2621 :: SWord1 = choose [0:0] s2620 s2622 :: SBool = s10 /= s2621 s2623 :: SWord8 = s2607 >>> 1 s2624 :: SWord8 = s14 | s2623 s2625 :: SWord8 = s16 & s2623 s2626 :: SWord8 = if s2622 then s2624 else s2625 s2627 :: SWord1 = choose [0:0] s2626 s2628 :: SBool = s10 /= s2627 s2629 :: SBool = s_2 == s2628 s2630 :: SWord8 = s2614 >>> 1 s2631 :: SWord8 = s14 | s2630 s2632 :: SWord8 = s16 & s2630 s2633 :: SWord8 = if s2079 then s2631 else s2632 s2634 :: SWord8 = s2633 >>> 1 s2635 :: SWord8 = s14 | s2634 s2636 :: SWord8 = s16 & s2634 s2637 :: SWord8 = if s2587 then s2635 else s2636 s2638 :: SWord8 = s2637 >>> 1 s2639 :: SWord8 = s14 | s2638 s2640 :: SWord8 = s16 & s2638 s2641 :: SWord8 = if s2609 then s2639 else s2640 s2642 :: SWord8 = s2641 >>> 1 s2643 :: SWord8 = s14 | s2642 s2644 :: SWord8 = s16 & s2642 s2645 :: SWord8 = if s2628 then s2643 else s2644 s2646 :: SWord8 = s1 + s2641 s2647 :: SBool = s2646 < s1 s2648 :: SBool = s2646 < s2641 s2649 :: SBool = s2647 | s2648 s2650 :: SWord8 = s2646 >>> 1 s2651 :: SWord8 = s14 | s2650 s2652 :: SWord8 = s16 & s2650 s2653 :: SWord8 = if s2649 then s2651 else s2652 s2654 :: SWord8 = if s2629 then s2645 else s2653 s2655 :: SWord8 = s1 + s2637 s2656 :: SBool = s2655 < s1 s2657 :: SBool = s2655 < s2637 s2658 :: SBool = s2656 | s2657 s2659 :: SWord8 = s2655 >>> 1 s2660 :: SWord8 = s14 | s2659 s2661 :: SWord8 = s16 & s2659 s2662 :: SWord8 = if s2658 then s2660 else s2661 s2663 :: SWord8 = s2662 >>> 1 s2664 :: SWord8 = s14 | s2663 s2665 :: SWord8 = s16 & s2663 s2666 :: SWord8 = if s2628 then s2664 else s2665 s2667 :: SWord8 = s1 + s2662 s2668 :: SBool = s2667 < s1 s2669 :: SBool = s2667 < s2662 s2670 :: SBool = s2668 | s2669 s2671 :: SWord8 = s2667 >>> 1 s2672 :: SWord8 = s14 | s2671 s2673 :: SWord8 = s16 & s2671 s2674 :: SWord8 = if s2670 then s2672 else s2673 s2675 :: SWord8 = if s2629 then s2666 else s2674 s2676 :: SWord8 = if s2610 then s2654 else s2675 s2677 :: SWord8 = s1 + s2633 s2678 :: SBool = s2677 < s1 s2679 :: SBool = s2677 < s2633 s2680 :: SBool = s2678 | s2679 s2681 :: SWord8 = s2677 >>> 1 s2682 :: SWord8 = s14 | s2681 s2683 :: SWord8 = s16 & s2681 s2684 :: SWord8 = if s2680 then s2682 else s2683 s2685 :: SWord8 = s2684 >>> 1 s2686 :: SWord8 = s14 | s2685 s2687 :: SWord8 = s16 & s2685 s2688 :: SWord8 = if s2609 then s2686 else s2687 s2689 :: SWord8 = s2688 >>> 1 s2690 :: SWord8 = s14 | s2689 s2691 :: SWord8 = s16 & s2689 s2692 :: SWord8 = if s2628 then s2690 else s2691 s2693 :: SWord8 = s1 + s2688 s2694 :: SBool = s2693 < s1 s2695 :: SBool = s2693 < s2688 s2696 :: SBool = s2694 | s2695 s2697 :: SWord8 = s2693 >>> 1 s2698 :: SWord8 = s14 | s2697 s2699 :: SWord8 = s16 & s2697 s2700 :: SWord8 = if s2696 then s2698 else s2699 s2701 :: SWord8 = if s2629 then s2692 else s2700 s2702 :: SWord8 = s1 + s2684 s2703 :: SBool = s2702 < s1 s2704 :: SBool = s2702 < s2684 s2705 :: SBool = s2703 | s2704 s2706 :: SWord8 = s2702 >>> 1 s2707 :: SWord8 = s14 | s2706 s2708 :: SWord8 = s16 & s2706 s2709 :: SWord8 = if s2705 then s2707 else s2708 s2710 :: SWord8 = s2709 >>> 1 s2711 :: SWord8 = s14 | s2710 s2712 :: SWord8 = s16 & s2710 s2713 :: SWord8 = if s2628 then s2711 else s2712 s2714 :: SWord8 = s1 + s2709 s2715 :: SBool = s2714 < s1 s2716 :: SBool = s2714 < s2709 s2717 :: SBool = s2715 | s2716 s2718 :: SWord8 = s2714 >>> 1 s2719 :: SWord8 = s14 | s2718 s2720 :: SWord8 = s16 & s2718 s2721 :: SWord8 = if s2717 then s2719 else s2720 s2722 :: SWord8 = if s2629 then s2713 else s2721 s2723 :: SWord8 = if s2610 then s2701 else s2722 s2724 :: SWord8 = if s2588 then s2676 else s2723 s2725 :: SWord8 = s1 + s2614 s2726 :: SWord1 = choose [0:0] s2725 s2727 :: SBool = s10 /= s2726 s2728 :: SWord8 = if s2727 then s2618 else s2619 s2729 :: SWord1 = choose [0:0] s2728 s2730 :: SBool = s10 /= s2729 s2731 :: SWord8 = if s2730 then s2624 else s2625 s2732 :: SWord1 = choose [0:0] s2731 s2733 :: SBool = s10 /= s2732 s2734 :: SBool = s_2 == s2733 s2735 :: SBool = s2725 < s1 s2736 :: SBool = s2725 < s2614 s2737 :: SBool = s2735 | s2736 s2738 :: SWord8 = s2725 >>> 1 s2739 :: SWord8 = s14 | s2738 s2740 :: SWord8 = s16 & s2738 s2741 :: SWord8 = if s2737 then s2739 else s2740 s2742 :: SWord8 = s2741 >>> 1 s2743 :: SWord8 = s14 | s2742 s2744 :: SWord8 = s16 & s2742 s2745 :: SWord8 = if s2587 then s2743 else s2744 s2746 :: SWord8 = s2745 >>> 1 s2747 :: SWord8 = s14 | s2746 s2748 :: SWord8 = s16 & s2746 s2749 :: SWord8 = if s2609 then s2747 else s2748 s2750 :: SWord8 = s2749 >>> 1 s2751 :: SWord8 = s14 | s2750 s2752 :: SWord8 = s16 & s2750 s2753 :: SWord8 = if s2733 then s2751 else s2752 s2754 :: SWord8 = s1 + s2749 s2755 :: SBool = s2754 < s1 s2756 :: SBool = s2754 < s2749 s2757 :: SBool = s2755 | s2756 s2758 :: SWord8 = s2754 >>> 1 s2759 :: SWord8 = s14 | s2758 s2760 :: SWord8 = s16 & s2758 s2761 :: SWord8 = if s2757 then s2759 else s2760 s2762 :: SWord8 = if s2734 then s2753 else s2761 s2763 :: SWord8 = s1 + s2745 s2764 :: SBool = s2763 < s1 s2765 :: SBool = s2763 < s2745 s2766 :: SBool = s2764 | s2765 s2767 :: SWord8 = s2763 >>> 1 s2768 :: SWord8 = s14 | s2767 s2769 :: SWord8 = s16 & s2767 s2770 :: SWord8 = if s2766 then s2768 else s2769 s2771 :: SWord8 = s2770 >>> 1 s2772 :: SWord8 = s14 | s2771 s2773 :: SWord8 = s16 & s2771 s2774 :: SWord8 = if s2733 then s2772 else s2773 s2775 :: SWord8 = s1 + s2770 s2776 :: SBool = s2775 < s1 s2777 :: SBool = s2775 < s2770 s2778 :: SBool = s2776 | s2777 s2779 :: SWord8 = s2775 >>> 1 s2780 :: SWord8 = s14 | s2779 s2781 :: SWord8 = s16 & s2779 s2782 :: SWord8 = if s2778 then s2780 else s2781 s2783 :: SWord8 = if s2734 then s2774 else s2782 s2784 :: SWord8 = if s2610 then s2762 else s2783 s2785 :: SWord8 = s1 + s2741 s2786 :: SBool = s2785 < s1 s2787 :: SBool = s2785 < s2741 s2788 :: SBool = s2786 | s2787 s2789 :: SWord8 = s2785 >>> 1 s2790 :: SWord8 = s14 | s2789 s2791 :: SWord8 = s16 & s2789 s2792 :: SWord8 = if s2788 then s2790 else s2791 s2793 :: SWord8 = s2792 >>> 1 s2794 :: SWord8 = s14 | s2793 s2795 :: SWord8 = s16 & s2793 s2796 :: SWord8 = if s2609 then s2794 else s2795 s2797 :: SWord8 = s2796 >>> 1 s2798 :: SWord8 = s14 | s2797 s2799 :: SWord8 = s16 & s2797 s2800 :: SWord8 = if s2733 then s2798 else s2799 s2801 :: SWord8 = s1 + s2796 s2802 :: SBool = s2801 < s1 s2803 :: SBool = s2801 < s2796 s2804 :: SBool = s2802 | s2803 s2805 :: SWord8 = s2801 >>> 1 s2806 :: SWord8 = s14 | s2805 s2807 :: SWord8 = s16 & s2805 s2808 :: SWord8 = if s2804 then s2806 else s2807 s2809 :: SWord8 = if s2734 then s2800 else s2808 s2810 :: SWord8 = s1 + s2792 s2811 :: SBool = s2810 < s1 s2812 :: SBool = s2810 < s2792 s2813 :: SBool = s2811 | s2812 s2814 :: SWord8 = s2810 >>> 1 s2815 :: SWord8 = s14 | s2814 s2816 :: SWord8 = s16 & s2814 s2817 :: SWord8 = if s2813 then s2815 else s2816 s2818 :: SWord8 = s2817 >>> 1 s2819 :: SWord8 = s14 | s2818 s2820 :: SWord8 = s16 & s2818 s2821 :: SWord8 = if s2733 then s2819 else s2820 s2822 :: SWord8 = s1 + s2817 s2823 :: SBool = s2822 < s1 s2824 :: SBool = s2822 < s2817 s2825 :: SBool = s2823 | s2824 s2826 :: SWord8 = s2822 >>> 1 s2827 :: SWord8 = s14 | s2826 s2828 :: SWord8 = s16 & s2826 s2829 :: SWord8 = if s2825 then s2827 else s2828 s2830 :: SWord8 = if s2734 then s2821 else s2829 s2831 :: SWord8 = if s2610 then s2809 else s2830 s2832 :: SWord8 = if s2588 then s2784 else s2831 s2833 :: SWord8 = if s2080 then s2724 else s2832 s2834 :: SWord8 = s1 + s2595 s2835 :: SWord1 = choose [0:0] s2834 s2836 :: SBool = s10 /= s2835 s2837 :: SWord8 = if s2836 then s2599 else s2600 s2838 :: SWord1 = choose [0:0] s2837 s2839 :: SBool = s10 /= s2838 s2840 :: SWord8 = if s2839 then s2605 else s2606 s2841 :: SWord1 = choose [0:0] s2840 s2842 :: SBool = s10 /= s2841 s2843 :: SBool = s_2 == s2842 s2844 :: SBool = s2834 < s1 s2845 :: SBool = s2834 < s2595 s2846 :: SBool = s2844 | s2845 s2847 :: SWord8 = s2834 >>> 1 s2848 :: SWord8 = s14 | s2847 s2849 :: SWord8 = s16 & s2847 s2850 :: SWord8 = if s2846 then s2848 else s2849 s2851 :: SWord1 = choose [0:0] s2850 s2852 :: SBool = s10 /= s2851 s2853 :: SWord8 = s2837 >>> 1 s2854 :: SWord8 = s14 | s2853 s2855 :: SWord8 = s16 & s2853 s2856 :: SWord8 = if s2852 then s2854 else s2855 s2857 :: SWord1 = choose [0:0] s2856 s2858 :: SBool = s10 /= s2857 s2859 :: SWord8 = s2840 >>> 1 s2860 :: SWord8 = s14 | s2859 s2861 :: SWord8 = s16 & s2859 s2862 :: SWord8 = if s2858 then s2860 else s2861 s2863 :: SWord1 = choose [0:0] s2862 s2864 :: SBool = s10 /= s2863 s2865 :: SBool = s_2 == s2864 s2866 :: SWord8 = s2850 >>> 1 s2867 :: SWord8 = s14 | s2866 s2868 :: SWord8 = s16 & s2866 s2869 :: SWord8 = if s2079 then s2867 else s2868 s2870 :: SWord8 = s2869 >>> 1 s2871 :: SWord8 = s14 | s2870 s2872 :: SWord8 = s16 & s2870 s2873 :: SWord8 = if s2587 then s2871 else s2872 s2874 :: SWord8 = s2873 >>> 1 s2875 :: SWord8 = s14 | s2874 s2876 :: SWord8 = s16 & s2874 s2877 :: SWord8 = if s2842 then s2875 else s2876 s2878 :: SWord8 = s2877 >>> 1 s2879 :: SWord8 = s14 | s2878 s2880 :: SWord8 = s16 & s2878 s2881 :: SWord8 = if s2864 then s2879 else s2880 s2882 :: SWord8 = s1 + s2877 s2883 :: SBool = s2882 < s1 s2884 :: SBool = s2882 < s2877 s2885 :: SBool = s2883 | s2884 s2886 :: SWord8 = s2882 >>> 1 s2887 :: SWord8 = s14 | s2886 s2888 :: SWord8 = s16 & s2886 s2889 :: SWord8 = if s2885 then s2887 else s2888 s2890 :: SWord8 = if s2865 then s2881 else s2889 s2891 :: SWord8 = s1 + s2873 s2892 :: SBool = s2891 < s1 s2893 :: SBool = s2891 < s2873 s2894 :: SBool = s2892 | s2893 s2895 :: SWord8 = s2891 >>> 1 s2896 :: SWord8 = s14 | s2895 s2897 :: SWord8 = s16 & s2895 s2898 :: SWord8 = if s2894 then s2896 else s2897 s2899 :: SWord8 = s2898 >>> 1 s2900 :: SWord8 = s14 | s2899 s2901 :: SWord8 = s16 & s2899 s2902 :: SWord8 = if s2864 then s2900 else s2901 s2903 :: SWord8 = s1 + s2898 s2904 :: SBool = s2903 < s1 s2905 :: SBool = s2903 < s2898 s2906 :: SBool = s2904 | s2905 s2907 :: SWord8 = s2903 >>> 1 s2908 :: SWord8 = s14 | s2907 s2909 :: SWord8 = s16 & s2907 s2910 :: SWord8 = if s2906 then s2908 else s2909 s2911 :: SWord8 = if s2865 then s2902 else s2910 s2912 :: SWord8 = if s2843 then s2890 else s2911 s2913 :: SWord8 = s1 + s2869 s2914 :: SBool = s2913 < s1 s2915 :: SBool = s2913 < s2869 s2916 :: SBool = s2914 | s2915 s2917 :: SWord8 = s2913 >>> 1 s2918 :: SWord8 = s14 | s2917 s2919 :: SWord8 = s16 & s2917 s2920 :: SWord8 = if s2916 then s2918 else s2919 s2921 :: SWord8 = s2920 >>> 1 s2922 :: SWord8 = s14 | s2921 s2923 :: SWord8 = s16 & s2921 s2924 :: SWord8 = if s2842 then s2922 else s2923 s2925 :: SWord8 = s2924 >>> 1 s2926 :: SWord8 = s14 | s2925 s2927 :: SWord8 = s16 & s2925 s2928 :: SWord8 = if s2864 then s2926 else s2927 s2929 :: SWord8 = s1 + s2924 s2930 :: SBool = s2929 < s1 s2931 :: SBool = s2929 < s2924 s2932 :: SBool = s2930 | s2931 s2933 :: SWord8 = s2929 >>> 1 s2934 :: SWord8 = s14 | s2933 s2935 :: SWord8 = s16 & s2933 s2936 :: SWord8 = if s2932 then s2934 else s2935 s2937 :: SWord8 = if s2865 then s2928 else s2936 s2938 :: SWord8 = s1 + s2920 s2939 :: SBool = s2938 < s1 s2940 :: SBool = s2938 < s2920 s2941 :: SBool = s2939 | s2940 s2942 :: SWord8 = s2938 >>> 1 s2943 :: SWord8 = s14 | s2942 s2944 :: SWord8 = s16 & s2942 s2945 :: SWord8 = if s2941 then s2943 else s2944 s2946 :: SWord8 = s2945 >>> 1 s2947 :: SWord8 = s14 | s2946 s2948 :: SWord8 = s16 & s2946 s2949 :: SWord8 = if s2864 then s2947 else s2948 s2950 :: SWord8 = s1 + s2945 s2951 :: SBool = s2950 < s1 s2952 :: SBool = s2950 < s2945 s2953 :: SBool = s2951 | s2952 s2954 :: SWord8 = s2950 >>> 1 s2955 :: SWord8 = s14 | s2954 s2956 :: SWord8 = s16 & s2954 s2957 :: SWord8 = if s2953 then s2955 else s2956 s2958 :: SWord8 = if s2865 then s2949 else s2957 s2959 :: SWord8 = if s2843 then s2937 else s2958 s2960 :: SWord8 = if s2588 then s2912 else s2959 s2961 :: SWord8 = s1 + s2850 s2962 :: SWord1 = choose [0:0] s2961 s2963 :: SBool = s10 /= s2962 s2964 :: SWord8 = if s2963 then s2854 else s2855 s2965 :: SWord1 = choose [0:0] s2964 s2966 :: SBool = s10 /= s2965 s2967 :: SWord8 = if s2966 then s2860 else s2861 s2968 :: SWord1 = choose [0:0] s2967 s2969 :: SBool = s10 /= s2968 s2970 :: SBool = s_2 == s2969 s2971 :: SBool = s2961 < s1 s2972 :: SBool = s2961 < s2850 s2973 :: SBool = s2971 | s2972 s2974 :: SWord8 = s2961 >>> 1 s2975 :: SWord8 = s14 | s2974 s2976 :: SWord8 = s16 & s2974 s2977 :: SWord8 = if s2973 then s2975 else s2976 s2978 :: SWord8 = s2977 >>> 1 s2979 :: SWord8 = s14 | s2978 s2980 :: SWord8 = s16 & s2978 s2981 :: SWord8 = if s2587 then s2979 else s2980 s2982 :: SWord8 = s2981 >>> 1 s2983 :: SWord8 = s14 | s2982 s2984 :: SWord8 = s16 & s2982 s2985 :: SWord8 = if s2842 then s2983 else s2984 s2986 :: SWord8 = s2985 >>> 1 s2987 :: SWord8 = s14 | s2986 s2988 :: SWord8 = s16 & s2986 s2989 :: SWord8 = if s2969 then s2987 else s2988 s2990 :: SWord8 = s1 + s2985 s2991 :: SBool = s2990 < s1 s2992 :: SBool = s2990 < s2985 s2993 :: SBool = s2991 | s2992 s2994 :: SWord8 = s2990 >>> 1 s2995 :: SWord8 = s14 | s2994 s2996 :: SWord8 = s16 & s2994 s2997 :: SWord8 = if s2993 then s2995 else s2996 s2998 :: SWord8 = if s2970 then s2989 else s2997 s2999 :: SWord8 = s1 + s2981 s3000 :: SBool = s2999 < s1 s3001 :: SBool = s2999 < s2981 s3002 :: SBool = s3000 | s3001 s3003 :: SWord8 = s2999 >>> 1 s3004 :: SWord8 = s14 | s3003 s3005 :: SWord8 = s16 & s3003 s3006 :: SWord8 = if s3002 then s3004 else s3005 s3007 :: SWord8 = s3006 >>> 1 s3008 :: SWord8 = s14 | s3007 s3009 :: SWord8 = s16 & s3007 s3010 :: SWord8 = if s2969 then s3008 else s3009 s3011 :: SWord8 = s1 + s3006 s3012 :: SBool = s3011 < s1 s3013 :: SBool = s3011 < s3006 s3014 :: SBool = s3012 | s3013 s3015 :: SWord8 = s3011 >>> 1 s3016 :: SWord8 = s14 | s3015 s3017 :: SWord8 = s16 & s3015 s3018 :: SWord8 = if s3014 then s3016 else s3017 s3019 :: SWord8 = if s2970 then s3010 else s3018 s3020 :: SWord8 = if s2843 then s2998 else s3019 s3021 :: SWord8 = s1 + s2977 s3022 :: SBool = s3021 < s1 s3023 :: SBool = s3021 < s2977 s3024 :: SBool = s3022 | s3023 s3025 :: SWord8 = s3021 >>> 1 s3026 :: SWord8 = s14 | s3025 s3027 :: SWord8 = s16 & s3025 s3028 :: SWord8 = if s3024 then s3026 else s3027 s3029 :: SWord8 = s3028 >>> 1 s3030 :: SWord8 = s14 | s3029 s3031 :: SWord8 = s16 & s3029 s3032 :: SWord8 = if s2842 then s3030 else s3031 s3033 :: SWord8 = s3032 >>> 1 s3034 :: SWord8 = s14 | s3033 s3035 :: SWord8 = s16 & s3033 s3036 :: SWord8 = if s2969 then s3034 else s3035 s3037 :: SWord8 = s1 + s3032 s3038 :: SBool = s3037 < s1 s3039 :: SBool = s3037 < s3032 s3040 :: SBool = s3038 | s3039 s3041 :: SWord8 = s3037 >>> 1 s3042 :: SWord8 = s14 | s3041 s3043 :: SWord8 = s16 & s3041 s3044 :: SWord8 = if s3040 then s3042 else s3043 s3045 :: SWord8 = if s2970 then s3036 else s3044 s3046 :: SWord8 = s1 + s3028 s3047 :: SBool = s3046 < s1 s3048 :: SBool = s3046 < s3028 s3049 :: SBool = s3047 | s3048 s3050 :: SWord8 = s3046 >>> 1 s3051 :: SWord8 = s14 | s3050 s3052 :: SWord8 = s16 & s3050 s3053 :: SWord8 = if s3049 then s3051 else s3052 s3054 :: SWord8 = s3053 >>> 1 s3055 :: SWord8 = s14 | s3054 s3056 :: SWord8 = s16 & s3054 s3057 :: SWord8 = if s2969 then s3055 else s3056 s3058 :: SWord8 = s1 + s3053 s3059 :: SBool = s3058 < s1 s3060 :: SBool = s3058 < s3053 s3061 :: SBool = s3059 | s3060 s3062 :: SWord8 = s3058 >>> 1 s3063 :: SWord8 = s14 | s3062 s3064 :: SWord8 = s16 & s3062 s3065 :: SWord8 = if s3061 then s3063 else s3064 s3066 :: SWord8 = if s2970 then s3057 else s3065 s3067 :: SWord8 = if s2843 then s3045 else s3066 s3068 :: SWord8 = if s2588 then s3020 else s3067 s3069 :: SWord8 = if s2080 then s2960 else s3068 s3070 :: SWord8 = if s2063 then s2833 else s3069 s3071 :: SWord8 = if s30 then s2578 else s3070 s3072 :: SWord8 = s1 + s2065 s3073 :: SWord1 = choose [0:0] s3072 s3074 :: SBool = s10 /= s3073 s3075 :: SWord8 = if s3074 then s2069 else s2070 s3076 :: SWord1 = choose [0:0] s3075 s3077 :: SBool = s10 /= s3076 s3078 :: SWord8 = if s3077 then s2075 else s2076 s3079 :: SWord1 = choose [0:0] s3078 s3080 :: SBool = s10 /= s3079 s3081 :: SBool = s_2 == s3080 s3082 :: SBool = s3072 < s1 s3083 :: SBool = s3072 < s2065 s3084 :: SBool = s3082 | s3083 s3085 :: SWord8 = s3072 >>> 1 s3086 :: SWord8 = s14 | s3085 s3087 :: SWord8 = s16 & s3085 s3088 :: SWord8 = if s3084 then s3086 else s3087 s3089 :: SWord1 = choose [0:0] s3088 s3090 :: SBool = s10 /= s3089 s3091 :: SWord8 = s3075 >>> 1 s3092 :: SWord8 = s14 | s3091 s3093 :: SWord8 = s16 & s3091 s3094 :: SWord8 = if s3090 then s3092 else s3093 s3095 :: SWord1 = choose [0:0] s3094 s3096 :: SBool = s10 /= s3095 s3097 :: SWord8 = s3078 >>> 1 s3098 :: SWord8 = s14 | s3097 s3099 :: SWord8 = s16 & s3097 s3100 :: SWord8 = if s3096 then s3098 else s3099 s3101 :: SWord1 = choose [0:0] s3100 s3102 :: SBool = s10 /= s3101 s3103 :: SBool = s_2 == s3102 s3104 :: SWord8 = s3088 >>> 1 s3105 :: SWord8 = s14 | s3104 s3106 :: SWord8 = s16 & s3104 s3107 :: SWord8 = if s29 then s3105 else s3106 s3108 :: SWord1 = choose [0:0] s3107 s3109 :: SBool = s10 /= s3108 s3110 :: SWord8 = s3094 >>> 1 s3111 :: SWord8 = s14 | s3110 s3112 :: SWord8 = s16 & s3110 s3113 :: SWord8 = if s3109 then s3111 else s3112 s3114 :: SWord1 = choose [0:0] s3113 s3115 :: SBool = s10 /= s3114 s3116 :: SWord8 = s3100 >>> 1 s3117 :: SWord8 = s14 | s3116 s3118 :: SWord8 = s16 & s3116 s3119 :: SWord8 = if s3115 then s3117 else s3118 s3120 :: SWord1 = choose [0:0] s3119 s3121 :: SBool = s10 /= s3120 s3122 :: SBool = s_2 == s3121 s3123 :: SWord8 = s3107 >>> 1 s3124 :: SWord8 = s14 | s3123 s3125 :: SWord8 = s16 & s3123 s3126 :: SWord8 = if s2062 then s3124 else s3125 s3127 :: SWord1 = choose [0:0] s3126 s3128 :: SBool = s10 /= s3127 s3129 :: SWord8 = s3113 >>> 1 s3130 :: SWord8 = s14 | s3129 s3131 :: SWord8 = s16 & s3129 s3132 :: SWord8 = if s3128 then s3130 else s3131 s3133 :: SWord1 = choose [0:0] s3132 s3134 :: SBool = s10 /= s3133 s3135 :: SWord8 = s3119 >>> 1 s3136 :: SWord8 = s14 | s3135 s3137 :: SWord8 = s16 & s3135 s3138 :: SWord8 = if s3134 then s3136 else s3137 s3139 :: SWord1 = choose [0:0] s3138 s3140 :: SBool = s10 /= s3139 s3141 :: SBool = s_2 == s3140 s3142 :: SWord8 = s3126 >>> 1 s3143 :: SWord8 = s14 | s3142 s3144 :: SWord8 = s16 & s3142 s3145 :: SWord8 = if s3080 then s3143 else s3144 s3146 :: SWord8 = s3145 >>> 1 s3147 :: SWord8 = s14 | s3146 s3148 :: SWord8 = s16 & s3146 s3149 :: SWord8 = if s3102 then s3147 else s3148 s3150 :: SWord8 = s3149 >>> 1 s3151 :: SWord8 = s14 | s3150 s3152 :: SWord8 = s16 & s3150 s3153 :: SWord8 = if s3121 then s3151 else s3152 s3154 :: SWord8 = s3153 >>> 1 s3155 :: SWord8 = s14 | s3154 s3156 :: SWord8 = s16 & s3154 s3157 :: SWord8 = if s3140 then s3155 else s3156 s3158 :: SWord8 = s1 + s3153 s3159 :: SBool = s3158 < s1 s3160 :: SBool = s3158 < s3153 s3161 :: SBool = s3159 | s3160 s3162 :: SWord8 = s3158 >>> 1 s3163 :: SWord8 = s14 | s3162 s3164 :: SWord8 = s16 & s3162 s3165 :: SWord8 = if s3161 then s3163 else s3164 s3166 :: SWord8 = if s3141 then s3157 else s3165 s3167 :: SWord8 = s1 + s3149 s3168 :: SBool = s3167 < s1 s3169 :: SBool = s3167 < s3149 s3170 :: SBool = s3168 | s3169 s3171 :: SWord8 = s3167 >>> 1 s3172 :: SWord8 = s14 | s3171 s3173 :: SWord8 = s16 & s3171 s3174 :: SWord8 = if s3170 then s3172 else s3173 s3175 :: SWord8 = s3174 >>> 1 s3176 :: SWord8 = s14 | s3175 s3177 :: SWord8 = s16 & s3175 s3178 :: SWord8 = if s3140 then s3176 else s3177 s3179 :: SWord8 = s1 + s3174 s3180 :: SBool = s3179 < s1 s3181 :: SBool = s3179 < s3174 s3182 :: SBool = s3180 | s3181 s3183 :: SWord8 = s3179 >>> 1 s3184 :: SWord8 = s14 | s3183 s3185 :: SWord8 = s16 & s3183 s3186 :: SWord8 = if s3182 then s3184 else s3185 s3187 :: SWord8 = if s3141 then s3178 else s3186 s3188 :: SWord8 = if s3122 then s3166 else s3187 s3189 :: SWord8 = s1 + s3145 s3190 :: SBool = s3189 < s1 s3191 :: SBool = s3189 < s3145 s3192 :: SBool = s3190 | s3191 s3193 :: SWord8 = s3189 >>> 1 s3194 :: SWord8 = s14 | s3193 s3195 :: SWord8 = s16 & s3193 s3196 :: SWord8 = if s3192 then s3194 else s3195 s3197 :: SWord8 = s3196 >>> 1 s3198 :: SWord8 = s14 | s3197 s3199 :: SWord8 = s16 & s3197 s3200 :: SWord8 = if s3121 then s3198 else s3199 s3201 :: SWord8 = s3200 >>> 1 s3202 :: SWord8 = s14 | s3201 s3203 :: SWord8 = s16 & s3201 s3204 :: SWord8 = if s3140 then s3202 else s3203 s3205 :: SWord8 = s1 + s3200 s3206 :: SBool = s3205 < s1 s3207 :: SBool = s3205 < s3200 s3208 :: SBool = s3206 | s3207 s3209 :: SWord8 = s3205 >>> 1 s3210 :: SWord8 = s14 | s3209 s3211 :: SWord8 = s16 & s3209 s3212 :: SWord8 = if s3208 then s3210 else s3211 s3213 :: SWord8 = if s3141 then s3204 else s3212 s3214 :: SWord8 = s1 + s3196 s3215 :: SBool = s3214 < s1 s3216 :: SBool = s3214 < s3196 s3217 :: SBool = s3215 | s3216 s3218 :: SWord8 = s3214 >>> 1 s3219 :: SWord8 = s14 | s3218 s3220 :: SWord8 = s16 & s3218 s3221 :: SWord8 = if s3217 then s3219 else s3220 s3222 :: SWord8 = s3221 >>> 1 s3223 :: SWord8 = s14 | s3222 s3224 :: SWord8 = s16 & s3222 s3225 :: SWord8 = if s3140 then s3223 else s3224 s3226 :: SWord8 = s1 + s3221 s3227 :: SBool = s3226 < s1 s3228 :: SBool = s3226 < s3221 s3229 :: SBool = s3227 | s3228 s3230 :: SWord8 = s3226 >>> 1 s3231 :: SWord8 = s14 | s3230 s3232 :: SWord8 = s16 & s3230 s3233 :: SWord8 = if s3229 then s3231 else s3232 s3234 :: SWord8 = if s3141 then s3225 else s3233 s3235 :: SWord8 = if s3122 then s3213 else s3234 s3236 :: SWord8 = if s3103 then s3188 else s3235 s3237 :: SWord8 = s1 + s3126 s3238 :: SWord1 = choose [0:0] s3237 s3239 :: SBool = s10 /= s3238 s3240 :: SWord8 = if s3239 then s3130 else s3131 s3241 :: SWord1 = choose [0:0] s3240 s3242 :: SBool = s10 /= s3241 s3243 :: SWord8 = if s3242 then s3136 else s3137 s3244 :: SWord1 = choose [0:0] s3243 s3245 :: SBool = s10 /= s3244 s3246 :: SBool = s_2 == s3245 s3247 :: SBool = s3237 < s1 s3248 :: SBool = s3237 < s3126 s3249 :: SBool = s3247 | s3248 s3250 :: SWord8 = s3237 >>> 1 s3251 :: SWord8 = s14 | s3250 s3252 :: SWord8 = s16 & s3250 s3253 :: SWord8 = if s3249 then s3251 else s3252 s3254 :: SWord8 = s3253 >>> 1 s3255 :: SWord8 = s14 | s3254 s3256 :: SWord8 = s16 & s3254 s3257 :: SWord8 = if s3102 then s3255 else s3256 s3258 :: SWord8 = s3257 >>> 1 s3259 :: SWord8 = s14 | s3258 s3260 :: SWord8 = s16 & s3258 s3261 :: SWord8 = if s3121 then s3259 else s3260 s3262 :: SWord8 = s3261 >>> 1 s3263 :: SWord8 = s14 | s3262 s3264 :: SWord8 = s16 & s3262 s3265 :: SWord8 = if s3245 then s3263 else s3264 s3266 :: SWord8 = s1 + s3261 s3267 :: SBool = s3266 < s1 s3268 :: SBool = s3266 < s3261 s3269 :: SBool = s3267 | s3268 s3270 :: SWord8 = s3266 >>> 1 s3271 :: SWord8 = s14 | s3270 s3272 :: SWord8 = s16 & s3270 s3273 :: SWord8 = if s3269 then s3271 else s3272 s3274 :: SWord8 = if s3246 then s3265 else s3273 s3275 :: SWord8 = s1 + s3257 s3276 :: SBool = s3275 < s1 s3277 :: SBool = s3275 < s3257 s3278 :: SBool = s3276 | s3277 s3279 :: SWord8 = s3275 >>> 1 s3280 :: SWord8 = s14 | s3279 s3281 :: SWord8 = s16 & s3279 s3282 :: SWord8 = if s3278 then s3280 else s3281 s3283 :: SWord8 = s3282 >>> 1 s3284 :: SWord8 = s14 | s3283 s3285 :: SWord8 = s16 & s3283 s3286 :: SWord8 = if s3245 then s3284 else s3285 s3287 :: SWord8 = s1 + s3282 s3288 :: SBool = s3287 < s1 s3289 :: SBool = s3287 < s3282 s3290 :: SBool = s3288 | s3289 s3291 :: SWord8 = s3287 >>> 1 s3292 :: SWord8 = s14 | s3291 s3293 :: SWord8 = s16 & s3291 s3294 :: SWord8 = if s3290 then s3292 else s3293 s3295 :: SWord8 = if s3246 then s3286 else s3294 s3296 :: SWord8 = if s3122 then s3274 else s3295 s3297 :: SWord8 = s1 + s3253 s3298 :: SBool = s3297 < s1 s3299 :: SBool = s3297 < s3253 s3300 :: SBool = s3298 | s3299 s3301 :: SWord8 = s3297 >>> 1 s3302 :: SWord8 = s14 | s3301 s3303 :: SWord8 = s16 & s3301 s3304 :: SWord8 = if s3300 then s3302 else s3303 s3305 :: SWord8 = s3304 >>> 1 s3306 :: SWord8 = s14 | s3305 s3307 :: SWord8 = s16 & s3305 s3308 :: SWord8 = if s3121 then s3306 else s3307 s3309 :: SWord8 = s3308 >>> 1 s3310 :: SWord8 = s14 | s3309 s3311 :: SWord8 = s16 & s3309 s3312 :: SWord8 = if s3245 then s3310 else s3311 s3313 :: SWord8 = s1 + s3308 s3314 :: SBool = s3313 < s1 s3315 :: SBool = s3313 < s3308 s3316 :: SBool = s3314 | s3315 s3317 :: SWord8 = s3313 >>> 1 s3318 :: SWord8 = s14 | s3317 s3319 :: SWord8 = s16 & s3317 s3320 :: SWord8 = if s3316 then s3318 else s3319 s3321 :: SWord8 = if s3246 then s3312 else s3320 s3322 :: SWord8 = s1 + s3304 s3323 :: SBool = s3322 < s1 s3324 :: SBool = s3322 < s3304 s3325 :: SBool = s3323 | s3324 s3326 :: SWord8 = s3322 >>> 1 s3327 :: SWord8 = s14 | s3326 s3328 :: SWord8 = s16 & s3326 s3329 :: SWord8 = if s3325 then s3327 else s3328 s3330 :: SWord8 = s3329 >>> 1 s3331 :: SWord8 = s14 | s3330 s3332 :: SWord8 = s16 & s3330 s3333 :: SWord8 = if s3245 then s3331 else s3332 s3334 :: SWord8 = s1 + s3329 s3335 :: SBool = s3334 < s1 s3336 :: SBool = s3334 < s3329 s3337 :: SBool = s3335 | s3336 s3338 :: SWord8 = s3334 >>> 1 s3339 :: SWord8 = s14 | s3338 s3340 :: SWord8 = s16 & s3338 s3341 :: SWord8 = if s3337 then s3339 else s3340 s3342 :: SWord8 = if s3246 then s3333 else s3341 s3343 :: SWord8 = if s3122 then s3321 else s3342 s3344 :: SWord8 = if s3103 then s3296 else s3343 s3345 :: SWord8 = if s3081 then s3236 else s3344 s3346 :: SWord8 = s1 + s3107 s3347 :: SWord1 = choose [0:0] s3346 s3348 :: SBool = s10 /= s3347 s3349 :: SWord8 = if s3348 then s3111 else s3112 s3350 :: SWord1 = choose [0:0] s3349 s3351 :: SBool = s10 /= s3350 s3352 :: SWord8 = if s3351 then s3117 else s3118 s3353 :: SWord1 = choose [0:0] s3352 s3354 :: SBool = s10 /= s3353 s3355 :: SBool = s_2 == s3354 s3356 :: SBool = s3346 < s1 s3357 :: SBool = s3346 < s3107 s3358 :: SBool = s3356 | s3357 s3359 :: SWord8 = s3346 >>> 1 s3360 :: SWord8 = s14 | s3359 s3361 :: SWord8 = s16 & s3359 s3362 :: SWord8 = if s3358 then s3360 else s3361 s3363 :: SWord1 = choose [0:0] s3362 s3364 :: SBool = s10 /= s3363 s3365 :: SWord8 = s3349 >>> 1 s3366 :: SWord8 = s14 | s3365 s3367 :: SWord8 = s16 & s3365 s3368 :: SWord8 = if s3364 then s3366 else s3367 s3369 :: SWord1 = choose [0:0] s3368 s3370 :: SBool = s10 /= s3369 s3371 :: SWord8 = s3352 >>> 1 s3372 :: SWord8 = s14 | s3371 s3373 :: SWord8 = s16 & s3371 s3374 :: SWord8 = if s3370 then s3372 else s3373 s3375 :: SWord1 = choose [0:0] s3374 s3376 :: SBool = s10 /= s3375 s3377 :: SBool = s_2 == s3376 s3378 :: SWord8 = s3362 >>> 1 s3379 :: SWord8 = s14 | s3378 s3380 :: SWord8 = s16 & s3378 s3381 :: SWord8 = if s3080 then s3379 else s3380 s3382 :: SWord8 = s3381 >>> 1 s3383 :: SWord8 = s14 | s3382 s3384 :: SWord8 = s16 & s3382 s3385 :: SWord8 = if s3102 then s3383 else s3384 s3386 :: SWord8 = s3385 >>> 1 s3387 :: SWord8 = s14 | s3386 s3388 :: SWord8 = s16 & s3386 s3389 :: SWord8 = if s3354 then s3387 else s3388 s3390 :: SWord8 = s3389 >>> 1 s3391 :: SWord8 = s14 | s3390 s3392 :: SWord8 = s16 & s3390 s3393 :: SWord8 = if s3376 then s3391 else s3392 s3394 :: SWord8 = s1 + s3389 s3395 :: SBool = s3394 < s1 s3396 :: SBool = s3394 < s3389 s3397 :: SBool = s3395 | s3396 s3398 :: SWord8 = s3394 >>> 1 s3399 :: SWord8 = s14 | s3398 s3400 :: SWord8 = s16 & s3398 s3401 :: SWord8 = if s3397 then s3399 else s3400 s3402 :: SWord8 = if s3377 then s3393 else s3401 s3403 :: SWord8 = s1 + s3385 s3404 :: SBool = s3403 < s1 s3405 :: SBool = s3403 < s3385 s3406 :: SBool = s3404 | s3405 s3407 :: SWord8 = s3403 >>> 1 s3408 :: SWord8 = s14 | s3407 s3409 :: SWord8 = s16 & s3407 s3410 :: SWord8 = if s3406 then s3408 else s3409 s3411 :: SWord8 = s3410 >>> 1 s3412 :: SWord8 = s14 | s3411 s3413 :: SWord8 = s16 & s3411 s3414 :: SWord8 = if s3376 then s3412 else s3413 s3415 :: SWord8 = s1 + s3410 s3416 :: SBool = s3415 < s1 s3417 :: SBool = s3415 < s3410 s3418 :: SBool = s3416 | s3417 s3419 :: SWord8 = s3415 >>> 1 s3420 :: SWord8 = s14 | s3419 s3421 :: SWord8 = s16 & s3419 s3422 :: SWord8 = if s3418 then s3420 else s3421 s3423 :: SWord8 = if s3377 then s3414 else s3422 s3424 :: SWord8 = if s3355 then s3402 else s3423 s3425 :: SWord8 = s1 + s3381 s3426 :: SBool = s3425 < s1 s3427 :: SBool = s3425 < s3381 s3428 :: SBool = s3426 | s3427 s3429 :: SWord8 = s3425 >>> 1 s3430 :: SWord8 = s14 | s3429 s3431 :: SWord8 = s16 & s3429 s3432 :: SWord8 = if s3428 then s3430 else s3431 s3433 :: SWord8 = s3432 >>> 1 s3434 :: SWord8 = s14 | s3433 s3435 :: SWord8 = s16 & s3433 s3436 :: SWord8 = if s3354 then s3434 else s3435 s3437 :: SWord8 = s3436 >>> 1 s3438 :: SWord8 = s14 | s3437 s3439 :: SWord8 = s16 & s3437 s3440 :: SWord8 = if s3376 then s3438 else s3439 s3441 :: SWord8 = s1 + s3436 s3442 :: SBool = s3441 < s1 s3443 :: SBool = s3441 < s3436 s3444 :: SBool = s3442 | s3443 s3445 :: SWord8 = s3441 >>> 1 s3446 :: SWord8 = s14 | s3445 s3447 :: SWord8 = s16 & s3445 s3448 :: SWord8 = if s3444 then s3446 else s3447 s3449 :: SWord8 = if s3377 then s3440 else s3448 s3450 :: SWord8 = s1 + s3432 s3451 :: SBool = s3450 < s1 s3452 :: SBool = s3450 < s3432 s3453 :: SBool = s3451 | s3452 s3454 :: SWord8 = s3450 >>> 1 s3455 :: SWord8 = s14 | s3454 s3456 :: SWord8 = s16 & s3454 s3457 :: SWord8 = if s3453 then s3455 else s3456 s3458 :: SWord8 = s3457 >>> 1 s3459 :: SWord8 = s14 | s3458 s3460 :: SWord8 = s16 & s3458 s3461 :: SWord8 = if s3376 then s3459 else s3460 s3462 :: SWord8 = s1 + s3457 s3463 :: SBool = s3462 < s1 s3464 :: SBool = s3462 < s3457 s3465 :: SBool = s3463 | s3464 s3466 :: SWord8 = s3462 >>> 1 s3467 :: SWord8 = s14 | s3466 s3468 :: SWord8 = s16 & s3466 s3469 :: SWord8 = if s3465 then s3467 else s3468 s3470 :: SWord8 = if s3377 then s3461 else s3469 s3471 :: SWord8 = if s3355 then s3449 else s3470 s3472 :: SWord8 = if s3103 then s3424 else s3471 s3473 :: SWord8 = s1 + s3362 s3474 :: SWord1 = choose [0:0] s3473 s3475 :: SBool = s10 /= s3474 s3476 :: SWord8 = if s3475 then s3366 else s3367 s3477 :: SWord1 = choose [0:0] s3476 s3478 :: SBool = s10 /= s3477 s3479 :: SWord8 = if s3478 then s3372 else s3373 s3480 :: SWord1 = choose [0:0] s3479 s3481 :: SBool = s10 /= s3480 s3482 :: SBool = s_2 == s3481 s3483 :: SBool = s3473 < s1 s3484 :: SBool = s3473 < s3362 s3485 :: SBool = s3483 | s3484 s3486 :: SWord8 = s3473 >>> 1 s3487 :: SWord8 = s14 | s3486 s3488 :: SWord8 = s16 & s3486 s3489 :: SWord8 = if s3485 then s3487 else s3488 s3490 :: SWord8 = s3489 >>> 1 s3491 :: SWord8 = s14 | s3490 s3492 :: SWord8 = s16 & s3490 s3493 :: SWord8 = if s3102 then s3491 else s3492 s3494 :: SWord8 = s3493 >>> 1 s3495 :: SWord8 = s14 | s3494 s3496 :: SWord8 = s16 & s3494 s3497 :: SWord8 = if s3354 then s3495 else s3496 s3498 :: SWord8 = s3497 >>> 1 s3499 :: SWord8 = s14 | s3498 s3500 :: SWord8 = s16 & s3498 s3501 :: SWord8 = if s3481 then s3499 else s3500 s3502 :: SWord8 = s1 + s3497 s3503 :: SBool = s3502 < s1 s3504 :: SBool = s3502 < s3497 s3505 :: SBool = s3503 | s3504 s3506 :: SWord8 = s3502 >>> 1 s3507 :: SWord8 = s14 | s3506 s3508 :: SWord8 = s16 & s3506 s3509 :: SWord8 = if s3505 then s3507 else s3508 s3510 :: SWord8 = if s3482 then s3501 else s3509 s3511 :: SWord8 = s1 + s3493 s3512 :: SBool = s3511 < s1 s3513 :: SBool = s3511 < s3493 s3514 :: SBool = s3512 | s3513 s3515 :: SWord8 = s3511 >>> 1 s3516 :: SWord8 = s14 | s3515 s3517 :: SWord8 = s16 & s3515 s3518 :: SWord8 = if s3514 then s3516 else s3517 s3519 :: SWord8 = s3518 >>> 1 s3520 :: SWord8 = s14 | s3519 s3521 :: SWord8 = s16 & s3519 s3522 :: SWord8 = if s3481 then s3520 else s3521 s3523 :: SWord8 = s1 + s3518 s3524 :: SBool = s3523 < s1 s3525 :: SBool = s3523 < s3518 s3526 :: SBool = s3524 | s3525 s3527 :: SWord8 = s3523 >>> 1 s3528 :: SWord8 = s14 | s3527 s3529 :: SWord8 = s16 & s3527 s3530 :: SWord8 = if s3526 then s3528 else s3529 s3531 :: SWord8 = if s3482 then s3522 else s3530 s3532 :: SWord8 = if s3355 then s3510 else s3531 s3533 :: SWord8 = s1 + s3489 s3534 :: SBool = s3533 < s1 s3535 :: SBool = s3533 < s3489 s3536 :: SBool = s3534 | s3535 s3537 :: SWord8 = s3533 >>> 1 s3538 :: SWord8 = s14 | s3537 s3539 :: SWord8 = s16 & s3537 s3540 :: SWord8 = if s3536 then s3538 else s3539 s3541 :: SWord8 = s3540 >>> 1 s3542 :: SWord8 = s14 | s3541 s3543 :: SWord8 = s16 & s3541 s3544 :: SWord8 = if s3354 then s3542 else s3543 s3545 :: SWord8 = s3544 >>> 1 s3546 :: SWord8 = s14 | s3545 s3547 :: SWord8 = s16 & s3545 s3548 :: SWord8 = if s3481 then s3546 else s3547 s3549 :: SWord8 = s1 + s3544 s3550 :: SBool = s3549 < s1 s3551 :: SBool = s3549 < s3544 s3552 :: SBool = s3550 | s3551 s3553 :: SWord8 = s3549 >>> 1 s3554 :: SWord8 = s14 | s3553 s3555 :: SWord8 = s16 & s3553 s3556 :: SWord8 = if s3552 then s3554 else s3555 s3557 :: SWord8 = if s3482 then s3548 else s3556 s3558 :: SWord8 = s1 + s3540 s3559 :: SBool = s3558 < s1 s3560 :: SBool = s3558 < s3540 s3561 :: SBool = s3559 | s3560 s3562 :: SWord8 = s3558 >>> 1 s3563 :: SWord8 = s14 | s3562 s3564 :: SWord8 = s16 & s3562 s3565 :: SWord8 = if s3561 then s3563 else s3564 s3566 :: SWord8 = s3565 >>> 1 s3567 :: SWord8 = s14 | s3566 s3568 :: SWord8 = s16 & s3566 s3569 :: SWord8 = if s3481 then s3567 else s3568 s3570 :: SWord8 = s1 + s3565 s3571 :: SBool = s3570 < s1 s3572 :: SBool = s3570 < s3565 s3573 :: SBool = s3571 | s3572 s3574 :: SWord8 = s3570 >>> 1 s3575 :: SWord8 = s14 | s3574 s3576 :: SWord8 = s16 & s3574 s3577 :: SWord8 = if s3573 then s3575 else s3576 s3578 :: SWord8 = if s3482 then s3569 else s3577 s3579 :: SWord8 = if s3355 then s3557 else s3578 s3580 :: SWord8 = if s3103 then s3532 else s3579 s3581 :: SWord8 = if s3081 then s3472 else s3580 s3582 :: SWord8 = if s2063 then s3345 else s3581 s3583 :: SWord8 = s1 + s3088 s3584 :: SWord1 = choose [0:0] s3583 s3585 :: SBool = s10 /= s3584 s3586 :: SWord8 = if s3585 then s3092 else s3093 s3587 :: SWord1 = choose [0:0] s3586 s3588 :: SBool = s10 /= s3587 s3589 :: SWord8 = if s3588 then s3098 else s3099 s3590 :: SWord1 = choose [0:0] s3589 s3591 :: SBool = s10 /= s3590 s3592 :: SBool = s_2 == s3591 s3593 :: SBool = s3583 < s1 s3594 :: SBool = s3583 < s3088 s3595 :: SBool = s3593 | s3594 s3596 :: SWord8 = s3583 >>> 1 s3597 :: SWord8 = s14 | s3596 s3598 :: SWord8 = s16 & s3596 s3599 :: SWord8 = if s3595 then s3597 else s3598 s3600 :: SWord1 = choose [0:0] s3599 s3601 :: SBool = s10 /= s3600 s3602 :: SWord8 = s3586 >>> 1 s3603 :: SWord8 = s14 | s3602 s3604 :: SWord8 = s16 & s3602 s3605 :: SWord8 = if s3601 then s3603 else s3604 s3606 :: SWord1 = choose [0:0] s3605 s3607 :: SBool = s10 /= s3606 s3608 :: SWord8 = s3589 >>> 1 s3609 :: SWord8 = s14 | s3608 s3610 :: SWord8 = s16 & s3608 s3611 :: SWord8 = if s3607 then s3609 else s3610 s3612 :: SWord1 = choose [0:0] s3611 s3613 :: SBool = s10 /= s3612 s3614 :: SBool = s_2 == s3613 s3615 :: SWord8 = s3599 >>> 1 s3616 :: SWord8 = s14 | s3615 s3617 :: SWord8 = s16 & s3615 s3618 :: SWord8 = if s2062 then s3616 else s3617 s3619 :: SWord1 = choose [0:0] s3618 s3620 :: SBool = s10 /= s3619 s3621 :: SWord8 = s3605 >>> 1 s3622 :: SWord8 = s14 | s3621 s3623 :: SWord8 = s16 & s3621 s3624 :: SWord8 = if s3620 then s3622 else s3623 s3625 :: SWord1 = choose [0:0] s3624 s3626 :: SBool = s10 /= s3625 s3627 :: SWord8 = s3611 >>> 1 s3628 :: SWord8 = s14 | s3627 s3629 :: SWord8 = s16 & s3627 s3630 :: SWord8 = if s3626 then s3628 else s3629 s3631 :: SWord1 = choose [0:0] s3630 s3632 :: SBool = s10 /= s3631 s3633 :: SBool = s_2 == s3632 s3634 :: SWord8 = s3618 >>> 1 s3635 :: SWord8 = s14 | s3634 s3636 :: SWord8 = s16 & s3634 s3637 :: SWord8 = if s3080 then s3635 else s3636 s3638 :: SWord8 = s3637 >>> 1 s3639 :: SWord8 = s14 | s3638 s3640 :: SWord8 = s16 & s3638 s3641 :: SWord8 = if s3591 then s3639 else s3640 s3642 :: SWord8 = s3641 >>> 1 s3643 :: SWord8 = s14 | s3642 s3644 :: SWord8 = s16 & s3642 s3645 :: SWord8 = if s3613 then s3643 else s3644 s3646 :: SWord8 = s3645 >>> 1 s3647 :: SWord8 = s14 | s3646 s3648 :: SWord8 = s16 & s3646 s3649 :: SWord8 = if s3632 then s3647 else s3648 s3650 :: SWord8 = s1 + s3645 s3651 :: SBool = s3650 < s1 s3652 :: SBool = s3650 < s3645 s3653 :: SBool = s3651 | s3652 s3654 :: SWord8 = s3650 >>> 1 s3655 :: SWord8 = s14 | s3654 s3656 :: SWord8 = s16 & s3654 s3657 :: SWord8 = if s3653 then s3655 else s3656 s3658 :: SWord8 = if s3633 then s3649 else s3657 s3659 :: SWord8 = s1 + s3641 s3660 :: SBool = s3659 < s1 s3661 :: SBool = s3659 < s3641 s3662 :: SBool = s3660 | s3661 s3663 :: SWord8 = s3659 >>> 1 s3664 :: SWord8 = s14 | s3663 s3665 :: SWord8 = s16 & s3663 s3666 :: SWord8 = if s3662 then s3664 else s3665 s3667 :: SWord8 = s3666 >>> 1 s3668 :: SWord8 = s14 | s3667 s3669 :: SWord8 = s16 & s3667 s3670 :: SWord8 = if s3632 then s3668 else s3669 s3671 :: SWord8 = s1 + s3666 s3672 :: SBool = s3671 < s1 s3673 :: SBool = s3671 < s3666 s3674 :: SBool = s3672 | s3673 s3675 :: SWord8 = s3671 >>> 1 s3676 :: SWord8 = s14 | s3675 s3677 :: SWord8 = s16 & s3675 s3678 :: SWord8 = if s3674 then s3676 else s3677 s3679 :: SWord8 = if s3633 then s3670 else s3678 s3680 :: SWord8 = if s3614 then s3658 else s3679 s3681 :: SWord8 = s1 + s3637 s3682 :: SBool = s3681 < s1 s3683 :: SBool = s3681 < s3637 s3684 :: SBool = s3682 | s3683 s3685 :: SWord8 = s3681 >>> 1 s3686 :: SWord8 = s14 | s3685 s3687 :: SWord8 = s16 & s3685 s3688 :: SWord8 = if s3684 then s3686 else s3687 s3689 :: SWord8 = s3688 >>> 1 s3690 :: SWord8 = s14 | s3689 s3691 :: SWord8 = s16 & s3689 s3692 :: SWord8 = if s3613 then s3690 else s3691 s3693 :: SWord8 = s3692 >>> 1 s3694 :: SWord8 = s14 | s3693 s3695 :: SWord8 = s16 & s3693 s3696 :: SWord8 = if s3632 then s3694 else s3695 s3697 :: SWord8 = s1 + s3692 s3698 :: SBool = s3697 < s1 s3699 :: SBool = s3697 < s3692 s3700 :: SBool = s3698 | s3699 s3701 :: SWord8 = s3697 >>> 1 s3702 :: SWord8 = s14 | s3701 s3703 :: SWord8 = s16 & s3701 s3704 :: SWord8 = if s3700 then s3702 else s3703 s3705 :: SWord8 = if s3633 then s3696 else s3704 s3706 :: SWord8 = s1 + s3688 s3707 :: SBool = s3706 < s1 s3708 :: SBool = s3706 < s3688 s3709 :: SBool = s3707 | s3708 s3710 :: SWord8 = s3706 >>> 1 s3711 :: SWord8 = s14 | s3710 s3712 :: SWord8 = s16 & s3710 s3713 :: SWord8 = if s3709 then s3711 else s3712 s3714 :: SWord8 = s3713 >>> 1 s3715 :: SWord8 = s14 | s3714 s3716 :: SWord8 = s16 & s3714 s3717 :: SWord8 = if s3632 then s3715 else s3716 s3718 :: SWord8 = s1 + s3713 s3719 :: SBool = s3718 < s1 s3720 :: SBool = s3718 < s3713 s3721 :: SBool = s3719 | s3720 s3722 :: SWord8 = s3718 >>> 1 s3723 :: SWord8 = s14 | s3722 s3724 :: SWord8 = s16 & s3722 s3725 :: SWord8 = if s3721 then s3723 else s3724 s3726 :: SWord8 = if s3633 then s3717 else s3725 s3727 :: SWord8 = if s3614 then s3705 else s3726 s3728 :: SWord8 = if s3592 then s3680 else s3727 s3729 :: SWord8 = s1 + s3618 s3730 :: SWord1 = choose [0:0] s3729 s3731 :: SBool = s10 /= s3730 s3732 :: SWord8 = if s3731 then s3622 else s3623 s3733 :: SWord1 = choose [0:0] s3732 s3734 :: SBool = s10 /= s3733 s3735 :: SWord8 = if s3734 then s3628 else s3629 s3736 :: SWord1 = choose [0:0] s3735 s3737 :: SBool = s10 /= s3736 s3738 :: SBool = s_2 == s3737 s3739 :: SBool = s3729 < s1 s3740 :: SBool = s3729 < s3618 s3741 :: SBool = s3739 | s3740 s3742 :: SWord8 = s3729 >>> 1 s3743 :: SWord8 = s14 | s3742 s3744 :: SWord8 = s16 & s3742 s3745 :: SWord8 = if s3741 then s3743 else s3744 s3746 :: SWord8 = s3745 >>> 1 s3747 :: SWord8 = s14 | s3746 s3748 :: SWord8 = s16 & s3746 s3749 :: SWord8 = if s3591 then s3747 else s3748 s3750 :: SWord8 = s3749 >>> 1 s3751 :: SWord8 = s14 | s3750 s3752 :: SWord8 = s16 & s3750 s3753 :: SWord8 = if s3613 then s3751 else s3752 s3754 :: SWord8 = s3753 >>> 1 s3755 :: SWord8 = s14 | s3754 s3756 :: SWord8 = s16 & s3754 s3757 :: SWord8 = if s3737 then s3755 else s3756 s3758 :: SWord8 = s1 + s3753 s3759 :: SBool = s3758 < s1 s3760 :: SBool = s3758 < s3753 s3761 :: SBool = s3759 | s3760 s3762 :: SWord8 = s3758 >>> 1 s3763 :: SWord8 = s14 | s3762 s3764 :: SWord8 = s16 & s3762 s3765 :: SWord8 = if s3761 then s3763 else s3764 s3766 :: SWord8 = if s3738 then s3757 else s3765 s3767 :: SWord8 = s1 + s3749 s3768 :: SBool = s3767 < s1 s3769 :: SBool = s3767 < s3749 s3770 :: SBool = s3768 | s3769 s3771 :: SWord8 = s3767 >>> 1 s3772 :: SWord8 = s14 | s3771 s3773 :: SWord8 = s16 & s3771 s3774 :: SWord8 = if s3770 then s3772 else s3773 s3775 :: SWord8 = s3774 >>> 1 s3776 :: SWord8 = s14 | s3775 s3777 :: SWord8 = s16 & s3775 s3778 :: SWord8 = if s3737 then s3776 else s3777 s3779 :: SWord8 = s1 + s3774 s3780 :: SBool = s3779 < s1 s3781 :: SBool = s3779 < s3774 s3782 :: SBool = s3780 | s3781 s3783 :: SWord8 = s3779 >>> 1 s3784 :: SWord8 = s14 | s3783 s3785 :: SWord8 = s16 & s3783 s3786 :: SWord8 = if s3782 then s3784 else s3785 s3787 :: SWord8 = if s3738 then s3778 else s3786 s3788 :: SWord8 = if s3614 then s3766 else s3787 s3789 :: SWord8 = s1 + s3745 s3790 :: SBool = s3789 < s1 s3791 :: SBool = s3789 < s3745 s3792 :: SBool = s3790 | s3791 s3793 :: SWord8 = s3789 >>> 1 s3794 :: SWord8 = s14 | s3793 s3795 :: SWord8 = s16 & s3793 s3796 :: SWord8 = if s3792 then s3794 else s3795 s3797 :: SWord8 = s3796 >>> 1 s3798 :: SWord8 = s14 | s3797 s3799 :: SWord8 = s16 & s3797 s3800 :: SWord8 = if s3613 then s3798 else s3799 s3801 :: SWord8 = s3800 >>> 1 s3802 :: SWord8 = s14 | s3801 s3803 :: SWord8 = s16 & s3801 s3804 :: SWord8 = if s3737 then s3802 else s3803 s3805 :: SWord8 = s1 + s3800 s3806 :: SBool = s3805 < s1 s3807 :: SBool = s3805 < s3800 s3808 :: SBool = s3806 | s3807 s3809 :: SWord8 = s3805 >>> 1 s3810 :: SWord8 = s14 | s3809 s3811 :: SWord8 = s16 & s3809 s3812 :: SWord8 = if s3808 then s3810 else s3811 s3813 :: SWord8 = if s3738 then s3804 else s3812 s3814 :: SWord8 = s1 + s3796 s3815 :: SBool = s3814 < s1 s3816 :: SBool = s3814 < s3796 s3817 :: SBool = s3815 | s3816 s3818 :: SWord8 = s3814 >>> 1 s3819 :: SWord8 = s14 | s3818 s3820 :: SWord8 = s16 & s3818 s3821 :: SWord8 = if s3817 then s3819 else s3820 s3822 :: SWord8 = s3821 >>> 1 s3823 :: SWord8 = s14 | s3822 s3824 :: SWord8 = s16 & s3822 s3825 :: SWord8 = if s3737 then s3823 else s3824 s3826 :: SWord8 = s1 + s3821 s3827 :: SBool = s3826 < s1 s3828 :: SBool = s3826 < s3821 s3829 :: SBool = s3827 | s3828 s3830 :: SWord8 = s3826 >>> 1 s3831 :: SWord8 = s14 | s3830 s3832 :: SWord8 = s16 & s3830 s3833 :: SWord8 = if s3829 then s3831 else s3832 s3834 :: SWord8 = if s3738 then s3825 else s3833 s3835 :: SWord8 = if s3614 then s3813 else s3834 s3836 :: SWord8 = if s3592 then s3788 else s3835 s3837 :: SWord8 = if s3081 then s3728 else s3836 s3838 :: SWord8 = s1 + s3599 s3839 :: SWord1 = choose [0:0] s3838 s3840 :: SBool = s10 /= s3839 s3841 :: SWord8 = if s3840 then s3603 else s3604 s3842 :: SWord1 = choose [0:0] s3841 s3843 :: SBool = s10 /= s3842 s3844 :: SWord8 = if s3843 then s3609 else s3610 s3845 :: SWord1 = choose [0:0] s3844 s3846 :: SBool = s10 /= s3845 s3847 :: SBool = s_2 == s3846 s3848 :: SBool = s3838 < s1 s3849 :: SBool = s3838 < s3599 s3850 :: SBool = s3848 | s3849 s3851 :: SWord8 = s3838 >>> 1 s3852 :: SWord8 = s14 | s3851 s3853 :: SWord8 = s16 & s3851 s3854 :: SWord8 = if s3850 then s3852 else s3853 s3855 :: SWord1 = choose [0:0] s3854 s3856 :: SBool = s10 /= s3855 s3857 :: SWord8 = s3841 >>> 1 s3858 :: SWord8 = s14 | s3857 s3859 :: SWord8 = s16 & s3857 s3860 :: SWord8 = if s3856 then s3858 else s3859 s3861 :: SWord1 = choose [0:0] s3860 s3862 :: SBool = s10 /= s3861 s3863 :: SWord8 = s3844 >>> 1 s3864 :: SWord8 = s14 | s3863 s3865 :: SWord8 = s16 & s3863 s3866 :: SWord8 = if s3862 then s3864 else s3865 s3867 :: SWord1 = choose [0:0] s3866 s3868 :: SBool = s10 /= s3867 s3869 :: SBool = s_2 == s3868 s3870 :: SWord8 = s3854 >>> 1 s3871 :: SWord8 = s14 | s3870 s3872 :: SWord8 = s16 & s3870 s3873 :: SWord8 = if s3080 then s3871 else s3872 s3874 :: SWord8 = s3873 >>> 1 s3875 :: SWord8 = s14 | s3874 s3876 :: SWord8 = s16 & s3874 s3877 :: SWord8 = if s3591 then s3875 else s3876 s3878 :: SWord8 = s3877 >>> 1 s3879 :: SWord8 = s14 | s3878 s3880 :: SWord8 = s16 & s3878 s3881 :: SWord8 = if s3846 then s3879 else s3880 s3882 :: SWord8 = s3881 >>> 1 s3883 :: SWord8 = s14 | s3882 s3884 :: SWord8 = s16 & s3882 s3885 :: SWord8 = if s3868 then s3883 else s3884 s3886 :: SWord8 = s1 + s3881 s3887 :: SBool = s3886 < s1 s3888 :: SBool = s3886 < s3881 s3889 :: SBool = s3887 | s3888 s3890 :: SWord8 = s3886 >>> 1 s3891 :: SWord8 = s14 | s3890 s3892 :: SWord8 = s16 & s3890 s3893 :: SWord8 = if s3889 then s3891 else s3892 s3894 :: SWord8 = if s3869 then s3885 else s3893 s3895 :: SWord8 = s1 + s3877 s3896 :: SBool = s3895 < s1 s3897 :: SBool = s3895 < s3877 s3898 :: SBool = s3896 | s3897 s3899 :: SWord8 = s3895 >>> 1 s3900 :: SWord8 = s14 | s3899 s3901 :: SWord8 = s16 & s3899 s3902 :: SWord8 = if s3898 then s3900 else s3901 s3903 :: SWord8 = s3902 >>> 1 s3904 :: SWord8 = s14 | s3903 s3905 :: SWord8 = s16 & s3903 s3906 :: SWord8 = if s3868 then s3904 else s3905 s3907 :: SWord8 = s1 + s3902 s3908 :: SBool = s3907 < s1 s3909 :: SBool = s3907 < s3902 s3910 :: SBool = s3908 | s3909 s3911 :: SWord8 = s3907 >>> 1 s3912 :: SWord8 = s14 | s3911 s3913 :: SWord8 = s16 & s3911 s3914 :: SWord8 = if s3910 then s3912 else s3913 s3915 :: SWord8 = if s3869 then s3906 else s3914 s3916 :: SWord8 = if s3847 then s3894 else s3915 s3917 :: SWord8 = s1 + s3873 s3918 :: SBool = s3917 < s1 s3919 :: SBool = s3917 < s3873 s3920 :: SBool = s3918 | s3919 s3921 :: SWord8 = s3917 >>> 1 s3922 :: SWord8 = s14 | s3921 s3923 :: SWord8 = s16 & s3921 s3924 :: SWord8 = if s3920 then s3922 else s3923 s3925 :: SWord8 = s3924 >>> 1 s3926 :: SWord8 = s14 | s3925 s3927 :: SWord8 = s16 & s3925 s3928 :: SWord8 = if s3846 then s3926 else s3927 s3929 :: SWord8 = s3928 >>> 1 s3930 :: SWord8 = s14 | s3929 s3931 :: SWord8 = s16 & s3929 s3932 :: SWord8 = if s3868 then s3930 else s3931 s3933 :: SWord8 = s1 + s3928 s3934 :: SBool = s3933 < s1 s3935 :: SBool = s3933 < s3928 s3936 :: SBool = s3934 | s3935 s3937 :: SWord8 = s3933 >>> 1 s3938 :: SWord8 = s14 | s3937 s3939 :: SWord8 = s16 & s3937 s3940 :: SWord8 = if s3936 then s3938 else s3939 s3941 :: SWord8 = if s3869 then s3932 else s3940 s3942 :: SWord8 = s1 + s3924 s3943 :: SBool = s3942 < s1 s3944 :: SBool = s3942 < s3924 s3945 :: SBool = s3943 | s3944 s3946 :: SWord8 = s3942 >>> 1 s3947 :: SWord8 = s14 | s3946 s3948 :: SWord8 = s16 & s3946 s3949 :: SWord8 = if s3945 then s3947 else s3948 s3950 :: SWord8 = s3949 >>> 1 s3951 :: SWord8 = s14 | s3950 s3952 :: SWord8 = s16 & s3950 s3953 :: SWord8 = if s3868 then s3951 else s3952 s3954 :: SWord8 = s1 + s3949 s3955 :: SBool = s3954 < s1 s3956 :: SBool = s3954 < s3949 s3957 :: SBool = s3955 | s3956 s3958 :: SWord8 = s3954 >>> 1 s3959 :: SWord8 = s14 | s3958 s3960 :: SWord8 = s16 & s3958 s3961 :: SWord8 = if s3957 then s3959 else s3960 s3962 :: SWord8 = if s3869 then s3953 else s3961 s3963 :: SWord8 = if s3847 then s3941 else s3962 s3964 :: SWord8 = if s3592 then s3916 else s3963 s3965 :: SWord8 = s1 + s3854 s3966 :: SWord1 = choose [0:0] s3965 s3967 :: SBool = s10 /= s3966 s3968 :: SWord8 = if s3967 then s3858 else s3859 s3969 :: SWord1 = choose [0:0] s3968 s3970 :: SBool = s10 /= s3969 s3971 :: SWord8 = if s3970 then s3864 else s3865 s3972 :: SWord1 = choose [0:0] s3971 s3973 :: SBool = s10 /= s3972 s3974 :: SBool = s_2 == s3973 s3975 :: SBool = s3965 < s1 s3976 :: SBool = s3965 < s3854 s3977 :: SBool = s3975 | s3976 s3978 :: SWord8 = s3965 >>> 1 s3979 :: SWord8 = s14 | s3978 s3980 :: SWord8 = s16 & s3978 s3981 :: SWord8 = if s3977 then s3979 else s3980 s3982 :: SWord8 = s3981 >>> 1 s3983 :: SWord8 = s14 | s3982 s3984 :: SWord8 = s16 & s3982 s3985 :: SWord8 = if s3591 then s3983 else s3984 s3986 :: SWord8 = s3985 >>> 1 s3987 :: SWord8 = s14 | s3986 s3988 :: SWord8 = s16 & s3986 s3989 :: SWord8 = if s3846 then s3987 else s3988 s3990 :: SWord8 = s3989 >>> 1 s3991 :: SWord8 = s14 | s3990 s3992 :: SWord8 = s16 & s3990 s3993 :: SWord8 = if s3973 then s3991 else s3992 s3994 :: SWord8 = s1 + s3989 s3995 :: SBool = s3994 < s1 s3996 :: SBool = s3994 < s3989 s3997 :: SBool = s3995 | s3996 s3998 :: SWord8 = s3994 >>> 1 s3999 :: SWord8 = s14 | s3998 s4000 :: SWord8 = s16 & s3998 s4001 :: SWord8 = if s3997 then s3999 else s4000 s4002 :: SWord8 = if s3974 then s3993 else s4001 s4003 :: SWord8 = s1 + s3985 s4004 :: SBool = s4003 < s1 s4005 :: SBool = s4003 < s3985 s4006 :: SBool = s4004 | s4005 s4007 :: SWord8 = s4003 >>> 1 s4008 :: SWord8 = s14 | s4007 s4009 :: SWord8 = s16 & s4007 s4010 :: SWord8 = if s4006 then s4008 else s4009 s4011 :: SWord8 = s4010 >>> 1 s4012 :: SWord8 = s14 | s4011 s4013 :: SWord8 = s16 & s4011 s4014 :: SWord8 = if s3973 then s4012 else s4013 s4015 :: SWord8 = s1 + s4010 s4016 :: SBool = s4015 < s1 s4017 :: SBool = s4015 < s4010 s4018 :: SBool = s4016 | s4017 s4019 :: SWord8 = s4015 >>> 1 s4020 :: SWord8 = s14 | s4019 s4021 :: SWord8 = s16 & s4019 s4022 :: SWord8 = if s4018 then s4020 else s4021 s4023 :: SWord8 = if s3974 then s4014 else s4022 s4024 :: SWord8 = if s3847 then s4002 else s4023 s4025 :: SWord8 = s1 + s3981 s4026 :: SBool = s4025 < s1 s4027 :: SBool = s4025 < s3981 s4028 :: SBool = s4026 | s4027 s4029 :: SWord8 = s4025 >>> 1 s4030 :: SWord8 = s14 | s4029 s4031 :: SWord8 = s16 & s4029 s4032 :: SWord8 = if s4028 then s4030 else s4031 s4033 :: SWord8 = s4032 >>> 1 s4034 :: SWord8 = s14 | s4033 s4035 :: SWord8 = s16 & s4033 s4036 :: SWord8 = if s3846 then s4034 else s4035 s4037 :: SWord8 = s4036 >>> 1 s4038 :: SWord8 = s14 | s4037 s4039 :: SWord8 = s16 & s4037 s4040 :: SWord8 = if s3973 then s4038 else s4039 s4041 :: SWord8 = s1 + s4036 s4042 :: SBool = s4041 < s1 s4043 :: SBool = s4041 < s4036 s4044 :: SBool = s4042 | s4043 s4045 :: SWord8 = s4041 >>> 1 s4046 :: SWord8 = s14 | s4045 s4047 :: SWord8 = s16 & s4045 s4048 :: SWord8 = if s4044 then s4046 else s4047 s4049 :: SWord8 = if s3974 then s4040 else s4048 s4050 :: SWord8 = s1 + s4032 s4051 :: SBool = s4050 < s1 s4052 :: SBool = s4050 < s4032 s4053 :: SBool = s4051 | s4052 s4054 :: SWord8 = s4050 >>> 1 s4055 :: SWord8 = s14 | s4054 s4056 :: SWord8 = s16 & s4054 s4057 :: SWord8 = if s4053 then s4055 else s4056 s4058 :: SWord8 = s4057 >>> 1 s4059 :: SWord8 = s14 | s4058 s4060 :: SWord8 = s16 & s4058 s4061 :: SWord8 = if s3973 then s4059 else s4060 s4062 :: SWord8 = s1 + s4057 s4063 :: SBool = s4062 < s1 s4064 :: SBool = s4062 < s4057 s4065 :: SBool = s4063 | s4064 s4066 :: SWord8 = s4062 >>> 1 s4067 :: SWord8 = s14 | s4066 s4068 :: SWord8 = s16 & s4066 s4069 :: SWord8 = if s4065 then s4067 else s4068 s4070 :: SWord8 = if s3974 then s4061 else s4069 s4071 :: SWord8 = if s3847 then s4049 else s4070 s4072 :: SWord8 = if s3592 then s4024 else s4071 s4073 :: SWord8 = if s3081 then s3964 else s4072 s4074 :: SWord8 = if s2063 then s3837 else s4073 s4075 :: SWord8 = if s30 then s3582 else s4074 s4076 :: SWord8 = if s21 then s3071 else s4075 s4077 :: SWord8 = if s12 then s2053 else s4076 s4078 :: SWord16 = s8 # s4077 s4079 :: SWord16 = s7 * s4078 s4080 :: SWord1 = choose [0:0] s126 s4081 :: SBool = s10 /= s4080 s4082 :: SWord1 = choose [0:0] s122 s4083 :: SBool = s10 /= s4082 s4084 :: SWord1 = choose [0:0] s118 s4085 :: SBool = s10 /= s4084 s4086 :: SWord8 = s105 >>> 1 s4087 :: SWord8 = s14 | s4086 s4088 :: SWord8 = s16 & s4086 s4089 :: SWord8 = if s4085 then s4087 else s4088 s4090 :: SWord8 = s4089 >>> 1 s4091 :: SWord8 = s14 | s4090 s4092 :: SWord8 = s16 & s4090 s4093 :: SWord8 = if s4083 then s4091 else s4092 s4094 :: SWord8 = s4093 >>> 1 s4095 :: SWord8 = s14 | s4094 s4096 :: SWord8 = s16 & s4094 s4097 :: SWord8 = if s4081 then s4095 else s4096 s4098 :: SWord1 = choose [0:0] s131 s4099 :: SBool = s10 /= s4098 s4100 :: SWord8 = if s4099 then s4095 else s4096 s4101 :: SWord8 = if s114 then s4097 else s4100 s4102 :: SWord1 = choose [0:0] s147 s4103 :: SBool = s10 /= s4102 s4104 :: SWord1 = choose [0:0] s140 s4105 :: SBool = s10 /= s4104 s4106 :: SWord8 = if s4105 then s4091 else s4092 s4107 :: SWord8 = s4106 >>> 1 s4108 :: SWord8 = s14 | s4107 s4109 :: SWord8 = s16 & s4107 s4110 :: SWord8 = if s4103 then s4108 else s4109 s4111 :: SWord1 = choose [0:0] s152 s4112 :: SBool = s10 /= s4111 s4113 :: SWord8 = if s4112 then s4108 else s4109 s4114 :: SWord8 = if s114 then s4110 else s4113 s4115 :: SWord8 = if s95 then s4101 else s4114 s4116 :: SWord1 = choose [0:0] s173 s4117 :: SBool = s10 /= s4116 s4118 :: SWord1 = choose [0:0] s169 s4119 :: SBool = s10 /= s4118 s4120 :: SWord1 = choose [0:0] s162 s4121 :: SBool = s10 /= s4120 s4122 :: SWord8 = if s4121 then s4087 else s4088 s4123 :: SWord8 = s4122 >>> 1 s4124 :: SWord8 = s14 | s4123 s4125 :: SWord8 = s16 & s4123 s4126 :: SWord8 = if s4119 then s4124 else s4125 s4127 :: SWord8 = s4126 >>> 1 s4128 :: SWord8 = s14 | s4127 s4129 :: SWord8 = s16 & s4127 s4130 :: SWord8 = if s4117 then s4128 else s4129 s4131 :: SWord1 = choose [0:0] s178 s4132 :: SBool = s10 /= s4131 s4133 :: SWord8 = if s4132 then s4128 else s4129 s4134 :: SWord8 = if s114 then s4130 else s4133 s4135 :: SWord1 = choose [0:0] s194 s4136 :: SBool = s10 /= s4135 s4137 :: SWord1 = choose [0:0] s187 s4138 :: SBool = s10 /= s4137 s4139 :: SWord8 = if s4138 then s4124 else s4125 s4140 :: SWord8 = s4139 >>> 1 s4141 :: SWord8 = s14 | s4140 s4142 :: SWord8 = s16 & s4140 s4143 :: SWord8 = if s4136 then s4141 else s4142 s4144 :: SWord1 = choose [0:0] s199 s4145 :: SBool = s10 /= s4144 s4146 :: SWord8 = if s4145 then s4141 else s4142 s4147 :: SWord8 = if s114 then s4143 else s4146 s4148 :: SWord8 = if s95 then s4134 else s4147 s4149 :: SWord8 = if s76 then s4115 else s4148 s4150 :: SWord1 = choose [0:0] s234 s4151 :: SBool = s10 /= s4150 s4152 :: SWord1 = choose [0:0] s230 s4153 :: SBool = s10 /= s4152 s4154 :: SWord1 = choose [0:0] s226 s4155 :: SBool = s10 /= s4154 s4156 :: SWord8 = s213 >>> 1 s4157 :: SWord8 = s14 | s4156 s4158 :: SWord8 = s16 & s4156 s4159 :: SWord8 = if s4155 then s4157 else s4158 s4160 :: SWord8 = s4159 >>> 1 s4161 :: SWord8 = s14 | s4160 s4162 :: SWord8 = s16 & s4160 s4163 :: SWord8 = if s4153 then s4161 else s4162 s4164 :: SWord8 = s4163 >>> 1 s4165 :: SWord8 = s14 | s4164 s4166 :: SWord8 = s16 & s4164 s4167 :: SWord8 = if s4151 then s4165 else s4166 s4168 :: SWord1 = choose [0:0] s239 s4169 :: SBool = s10 /= s4168 s4170 :: SWord8 = if s4169 then s4165 else s4166 s4171 :: SWord8 = if s219 then s4167 else s4170 s4172 :: SWord1 = choose [0:0] s255 s4173 :: SBool = s10 /= s4172 s4174 :: SWord1 = choose [0:0] s248 s4175 :: SBool = s10 /= s4174 s4176 :: SWord8 = if s4175 then s4161 else s4162 s4177 :: SWord8 = s4176 >>> 1 s4178 :: SWord8 = s14 | s4177 s4179 :: SWord8 = s16 & s4177 s4180 :: SWord8 = if s4173 then s4178 else s4179 s4181 :: SWord1 = choose [0:0] s260 s4182 :: SBool = s10 /= s4181 s4183 :: SWord8 = if s4182 then s4178 else s4179 s4184 :: SWord8 = if s219 then s4180 else s4183 s4185 :: SWord8 = if s95 then s4171 else s4184 s4186 :: SWord1 = choose [0:0] s281 s4187 :: SBool = s10 /= s4186 s4188 :: SWord1 = choose [0:0] s277 s4189 :: SBool = s10 /= s4188 s4190 :: SWord1 = choose [0:0] s270 s4191 :: SBool = s10 /= s4190 s4192 :: SWord8 = if s4191 then s4157 else s4158 s4193 :: SWord8 = s4192 >>> 1 s4194 :: SWord8 = s14 | s4193 s4195 :: SWord8 = s16 & s4193 s4196 :: SWord8 = if s4189 then s4194 else s4195 s4197 :: SWord8 = s4196 >>> 1 s4198 :: SWord8 = s14 | s4197 s4199 :: SWord8 = s16 & s4197 s4200 :: SWord8 = if s4187 then s4198 else s4199 s4201 :: SWord1 = choose [0:0] s286 s4202 :: SBool = s10 /= s4201 s4203 :: SWord8 = if s4202 then s4198 else s4199 s4204 :: SWord8 = if s219 then s4200 else s4203 s4205 :: SWord1 = choose [0:0] s302 s4206 :: SBool = s10 /= s4205 s4207 :: SWord1 = choose [0:0] s295 s4208 :: SBool = s10 /= s4207 s4209 :: SWord8 = if s4208 then s4194 else s4195 s4210 :: SWord8 = s4209 >>> 1 s4211 :: SWord8 = s14 | s4210 s4212 :: SWord8 = s16 & s4210 s4213 :: SWord8 = if s4206 then s4211 else s4212 s4214 :: SWord1 = choose [0:0] s307 s4215 :: SBool = s10 /= s4214 s4216 :: SWord8 = if s4215 then s4211 else s4212 s4217 :: SWord8 = if s219 then s4213 else s4216 s4218 :: SWord8 = if s95 then s4204 else s4217 s4219 :: SWord8 = if s76 then s4185 else s4218 s4220 :: SWord8 = if s57 then s4149 else s4219 s4221 :: SWord1 = choose [0:0] s362 s4222 :: SBool = s10 /= s4221 s4223 :: SWord1 = choose [0:0] s358 s4224 :: SBool = s10 /= s4223 s4225 :: SWord1 = choose [0:0] s354 s4226 :: SBool = s10 /= s4225 s4227 :: SWord8 = s341 >>> 1 s4228 :: SWord8 = s14 | s4227 s4229 :: SWord8 = s16 & s4227 s4230 :: SWord8 = if s4226 then s4228 else s4229 s4231 :: SWord8 = s4230 >>> 1 s4232 :: SWord8 = s14 | s4231 s4233 :: SWord8 = s16 & s4231 s4234 :: SWord8 = if s4224 then s4232 else s4233 s4235 :: SWord8 = s4234 >>> 1 s4236 :: SWord8 = s14 | s4235 s4237 :: SWord8 = s16 & s4235 s4238 :: SWord8 = if s4222 then s4236 else s4237 s4239 :: SWord1 = choose [0:0] s367 s4240 :: SBool = s10 /= s4239 s4241 :: SWord8 = if s4240 then s4236 else s4237 s4242 :: SWord8 = if s350 then s4238 else s4241 s4243 :: SWord1 = choose [0:0] s383 s4244 :: SBool = s10 /= s4243 s4245 :: SWord1 = choose [0:0] s376 s4246 :: SBool = s10 /= s4245 s4247 :: SWord8 = if s4246 then s4232 else s4233 s4248 :: SWord8 = s4247 >>> 1 s4249 :: SWord8 = s14 | s4248 s4250 :: SWord8 = s16 & s4248 s4251 :: SWord8 = if s4244 then s4249 else s4250 s4252 :: SWord1 = choose [0:0] s388 s4253 :: SBool = s10 /= s4252 s4254 :: SWord8 = if s4253 then s4249 else s4250 s4255 :: SWord8 = if s350 then s4251 else s4254 s4256 :: SWord8 = if s328 then s4242 else s4255 s4257 :: SWord1 = choose [0:0] s409 s4258 :: SBool = s10 /= s4257 s4259 :: SWord1 = choose [0:0] s405 s4260 :: SBool = s10 /= s4259 s4261 :: SWord1 = choose [0:0] s398 s4262 :: SBool = s10 /= s4261 s4263 :: SWord8 = if s4262 then s4228 else s4229 s4264 :: SWord8 = s4263 >>> 1 s4265 :: SWord8 = s14 | s4264 s4266 :: SWord8 = s16 & s4264 s4267 :: SWord8 = if s4260 then s4265 else s4266 s4268 :: SWord8 = s4267 >>> 1 s4269 :: SWord8 = s14 | s4268 s4270 :: SWord8 = s16 & s4268 s4271 :: SWord8 = if s4258 then s4269 else s4270 s4272 :: SWord1 = choose [0:0] s414 s4273 :: SBool = s10 /= s4272 s4274 :: SWord8 = if s4273 then s4269 else s4270 s4275 :: SWord8 = if s350 then s4271 else s4274 s4276 :: SWord1 = choose [0:0] s430 s4277 :: SBool = s10 /= s4276 s4278 :: SWord1 = choose [0:0] s423 s4279 :: SBool = s10 /= s4278 s4280 :: SWord8 = if s4279 then s4265 else s4266 s4281 :: SWord8 = s4280 >>> 1 s4282 :: SWord8 = s14 | s4281 s4283 :: SWord8 = s16 & s4281 s4284 :: SWord8 = if s4277 then s4282 else s4283 s4285 :: SWord1 = choose [0:0] s435 s4286 :: SBool = s10 /= s4285 s4287 :: SWord8 = if s4286 then s4282 else s4283 s4288 :: SWord8 = if s350 then s4284 else s4287 s4289 :: SWord8 = if s328 then s4275 else s4288 s4290 :: SWord8 = if s76 then s4256 else s4289 s4291 :: SWord1 = choose [0:0] s470 s4292 :: SBool = s10 /= s4291 s4293 :: SWord1 = choose [0:0] s466 s4294 :: SBool = s10 /= s4293 s4295 :: SWord1 = choose [0:0] s462 s4296 :: SBool = s10 /= s4295 s4297 :: SWord8 = s449 >>> 1 s4298 :: SWord8 = s14 | s4297 s4299 :: SWord8 = s16 & s4297 s4300 :: SWord8 = if s4296 then s4298 else s4299 s4301 :: SWord8 = s4300 >>> 1 s4302 :: SWord8 = s14 | s4301 s4303 :: SWord8 = s16 & s4301 s4304 :: SWord8 = if s4294 then s4302 else s4303 s4305 :: SWord8 = s4304 >>> 1 s4306 :: SWord8 = s14 | s4305 s4307 :: SWord8 = s16 & s4305 s4308 :: SWord8 = if s4292 then s4306 else s4307 s4309 :: SWord1 = choose [0:0] s475 s4310 :: SBool = s10 /= s4309 s4311 :: SWord8 = if s4310 then s4306 else s4307 s4312 :: SWord8 = if s455 then s4308 else s4311 s4313 :: SWord1 = choose [0:0] s491 s4314 :: SBool = s10 /= s4313 s4315 :: SWord1 = choose [0:0] s484 s4316 :: SBool = s10 /= s4315 s4317 :: SWord8 = if s4316 then s4302 else s4303 s4318 :: SWord8 = s4317 >>> 1 s4319 :: SWord8 = s14 | s4318 s4320 :: SWord8 = s16 & s4318 s4321 :: SWord8 = if s4314 then s4319 else s4320 s4322 :: SWord1 = choose [0:0] s496 s4323 :: SBool = s10 /= s4322 s4324 :: SWord8 = if s4323 then s4319 else s4320 s4325 :: SWord8 = if s455 then s4321 else s4324 s4326 :: SWord8 = if s328 then s4312 else s4325 s4327 :: SWord1 = choose [0:0] s517 s4328 :: SBool = s10 /= s4327 s4329 :: SWord1 = choose [0:0] s513 s4330 :: SBool = s10 /= s4329 s4331 :: SWord1 = choose [0:0] s506 s4332 :: SBool = s10 /= s4331 s4333 :: SWord8 = if s4332 then s4298 else s4299 s4334 :: SWord8 = s4333 >>> 1 s4335 :: SWord8 = s14 | s4334 s4336 :: SWord8 = s16 & s4334 s4337 :: SWord8 = if s4330 then s4335 else s4336 s4338 :: SWord8 = s4337 >>> 1 s4339 :: SWord8 = s14 | s4338 s4340 :: SWord8 = s16 & s4338 s4341 :: SWord8 = if s4328 then s4339 else s4340 s4342 :: SWord1 = choose [0:0] s522 s4343 :: SBool = s10 /= s4342 s4344 :: SWord8 = if s4343 then s4339 else s4340 s4345 :: SWord8 = if s455 then s4341 else s4344 s4346 :: SWord1 = choose [0:0] s538 s4347 :: SBool = s10 /= s4346 s4348 :: SWord1 = choose [0:0] s531 s4349 :: SBool = s10 /= s4348 s4350 :: SWord8 = if s4349 then s4335 else s4336 s4351 :: SWord8 = s4350 >>> 1 s4352 :: SWord8 = s14 | s4351 s4353 :: SWord8 = s16 & s4351 s4354 :: SWord8 = if s4347 then s4352 else s4353 s4355 :: SWord1 = choose [0:0] s543 s4356 :: SBool = s10 /= s4355 s4357 :: SWord8 = if s4356 then s4352 else s4353 s4358 :: SWord8 = if s455 then s4354 else s4357 s4359 :: SWord8 = if s328 then s4345 else s4358 s4360 :: SWord8 = if s76 then s4326 else s4359 s4361 :: SWord8 = if s57 then s4290 else s4360 s4362 :: SWord8 = if s41 then s4220 else s4361 s4363 :: SWord1 = choose [0:0] s618 s4364 :: SBool = s10 /= s4363 s4365 :: SWord1 = choose [0:0] s614 s4366 :: SBool = s10 /= s4365 s4367 :: SWord1 = choose [0:0] s610 s4368 :: SBool = s10 /= s4367 s4369 :: SWord8 = s597 >>> 1 s4370 :: SWord8 = s14 | s4369 s4371 :: SWord8 = s16 & s4369 s4372 :: SWord8 = if s4368 then s4370 else s4371 s4373 :: SWord8 = s4372 >>> 1 s4374 :: SWord8 = s14 | s4373 s4375 :: SWord8 = s16 & s4373 s4376 :: SWord8 = if s4366 then s4374 else s4375 s4377 :: SWord8 = s4376 >>> 1 s4378 :: SWord8 = s14 | s4377 s4379 :: SWord8 = s16 & s4377 s4380 :: SWord8 = if s4364 then s4378 else s4379 s4381 :: SWord1 = choose [0:0] s623 s4382 :: SBool = s10 /= s4381 s4383 :: SWord8 = if s4382 then s4378 else s4379 s4384 :: SWord8 = if s606 then s4380 else s4383 s4385 :: SWord1 = choose [0:0] s639 s4386 :: SBool = s10 /= s4385 s4387 :: SWord1 = choose [0:0] s632 s4388 :: SBool = s10 /= s4387 s4389 :: SWord8 = if s4388 then s4374 else s4375 s4390 :: SWord8 = s4389 >>> 1 s4391 :: SWord8 = s14 | s4390 s4392 :: SWord8 = s16 & s4390 s4393 :: SWord8 = if s4386 then s4391 else s4392 s4394 :: SWord1 = choose [0:0] s644 s4395 :: SBool = s10 /= s4394 s4396 :: SWord8 = if s4395 then s4391 else s4392 s4397 :: SWord8 = if s606 then s4393 else s4396 s4398 :: SWord8 = if s587 then s4384 else s4397 s4399 :: SWord1 = choose [0:0] s665 s4400 :: SBool = s10 /= s4399 s4401 :: SWord1 = choose [0:0] s661 s4402 :: SBool = s10 /= s4401 s4403 :: SWord1 = choose [0:0] s654 s4404 :: SBool = s10 /= s4403 s4405 :: SWord8 = if s4404 then s4370 else s4371 s4406 :: SWord8 = s4405 >>> 1 s4407 :: SWord8 = s14 | s4406 s4408 :: SWord8 = s16 & s4406 s4409 :: SWord8 = if s4402 then s4407 else s4408 s4410 :: SWord8 = s4409 >>> 1 s4411 :: SWord8 = s14 | s4410 s4412 :: SWord8 = s16 & s4410 s4413 :: SWord8 = if s4400 then s4411 else s4412 s4414 :: SWord1 = choose [0:0] s670 s4415 :: SBool = s10 /= s4414 s4416 :: SWord8 = if s4415 then s4411 else s4412 s4417 :: SWord8 = if s606 then s4413 else s4416 s4418 :: SWord1 = choose [0:0] s686 s4419 :: SBool = s10 /= s4418 s4420 :: SWord1 = choose [0:0] s679 s4421 :: SBool = s10 /= s4420 s4422 :: SWord8 = if s4421 then s4407 else s4408 s4423 :: SWord8 = s4422 >>> 1 s4424 :: SWord8 = s14 | s4423 s4425 :: SWord8 = s16 & s4423 s4426 :: SWord8 = if s4419 then s4424 else s4425 s4427 :: SWord1 = choose [0:0] s691 s4428 :: SBool = s10 /= s4427 s4429 :: SWord8 = if s4428 then s4424 else s4425 s4430 :: SWord8 = if s606 then s4426 else s4429 s4431 :: SWord8 = if s587 then s4417 else s4430 s4432 :: SWord8 = if s565 then s4398 else s4431 s4433 :: SWord1 = choose [0:0] s726 s4434 :: SBool = s10 /= s4433 s4435 :: SWord1 = choose [0:0] s722 s4436 :: SBool = s10 /= s4435 s4437 :: SWord1 = choose [0:0] s718 s4438 :: SBool = s10 /= s4437 s4439 :: SWord8 = s705 >>> 1 s4440 :: SWord8 = s14 | s4439 s4441 :: SWord8 = s16 & s4439 s4442 :: SWord8 = if s4438 then s4440 else s4441 s4443 :: SWord8 = s4442 >>> 1 s4444 :: SWord8 = s14 | s4443 s4445 :: SWord8 = s16 & s4443 s4446 :: SWord8 = if s4436 then s4444 else s4445 s4447 :: SWord8 = s4446 >>> 1 s4448 :: SWord8 = s14 | s4447 s4449 :: SWord8 = s16 & s4447 s4450 :: SWord8 = if s4434 then s4448 else s4449 s4451 :: SWord1 = choose [0:0] s731 s4452 :: SBool = s10 /= s4451 s4453 :: SWord8 = if s4452 then s4448 else s4449 s4454 :: SWord8 = if s711 then s4450 else s4453 s4455 :: SWord1 = choose [0:0] s747 s4456 :: SBool = s10 /= s4455 s4457 :: SWord1 = choose [0:0] s740 s4458 :: SBool = s10 /= s4457 s4459 :: SWord8 = if s4458 then s4444 else s4445 s4460 :: SWord8 = s4459 >>> 1 s4461 :: SWord8 = s14 | s4460 s4462 :: SWord8 = s16 & s4460 s4463 :: SWord8 = if s4456 then s4461 else s4462 s4464 :: SWord1 = choose [0:0] s752 s4465 :: SBool = s10 /= s4464 s4466 :: SWord8 = if s4465 then s4461 else s4462 s4467 :: SWord8 = if s711 then s4463 else s4466 s4468 :: SWord8 = if s587 then s4454 else s4467 s4469 :: SWord1 = choose [0:0] s773 s4470 :: SBool = s10 /= s4469 s4471 :: SWord1 = choose [0:0] s769 s4472 :: SBool = s10 /= s4471 s4473 :: SWord1 = choose [0:0] s762 s4474 :: SBool = s10 /= s4473 s4475 :: SWord8 = if s4474 then s4440 else s4441 s4476 :: SWord8 = s4475 >>> 1 s4477 :: SWord8 = s14 | s4476 s4478 :: SWord8 = s16 & s4476 s4479 :: SWord8 = if s4472 then s4477 else s4478 s4480 :: SWord8 = s4479 >>> 1 s4481 :: SWord8 = s14 | s4480 s4482 :: SWord8 = s16 & s4480 s4483 :: SWord8 = if s4470 then s4481 else s4482 s4484 :: SWord1 = choose [0:0] s778 s4485 :: SBool = s10 /= s4484 s4486 :: SWord8 = if s4485 then s4481 else s4482 s4487 :: SWord8 = if s711 then s4483 else s4486 s4488 :: SWord1 = choose [0:0] s794 s4489 :: SBool = s10 /= s4488 s4490 :: SWord1 = choose [0:0] s787 s4491 :: SBool = s10 /= s4490 s4492 :: SWord8 = if s4491 then s4477 else s4478 s4493 :: SWord8 = s4492 >>> 1 s4494 :: SWord8 = s14 | s4493 s4495 :: SWord8 = s16 & s4493 s4496 :: SWord8 = if s4489 then s4494 else s4495 s4497 :: SWord1 = choose [0:0] s799 s4498 :: SBool = s10 /= s4497 s4499 :: SWord8 = if s4498 then s4494 else s4495 s4500 :: SWord8 = if s711 then s4496 else s4499 s4501 :: SWord8 = if s587 then s4487 else s4500 s4502 :: SWord8 = if s565 then s4468 else s4501 s4503 :: SWord8 = if s57 then s4432 else s4502 s4504 :: SWord1 = choose [0:0] s854 s4505 :: SBool = s10 /= s4504 s4506 :: SWord1 = choose [0:0] s850 s4507 :: SBool = s10 /= s4506 s4508 :: SWord1 = choose [0:0] s846 s4509 :: SBool = s10 /= s4508 s4510 :: SWord8 = s833 >>> 1 s4511 :: SWord8 = s14 | s4510 s4512 :: SWord8 = s16 & s4510 s4513 :: SWord8 = if s4509 then s4511 else s4512 s4514 :: SWord8 = s4513 >>> 1 s4515 :: SWord8 = s14 | s4514 s4516 :: SWord8 = s16 & s4514 s4517 :: SWord8 = if s4507 then s4515 else s4516 s4518 :: SWord8 = s4517 >>> 1 s4519 :: SWord8 = s14 | s4518 s4520 :: SWord8 = s16 & s4518 s4521 :: SWord8 = if s4505 then s4519 else s4520 s4522 :: SWord1 = choose [0:0] s859 s4523 :: SBool = s10 /= s4522 s4524 :: SWord8 = if s4523 then s4519 else s4520 s4525 :: SWord8 = if s842 then s4521 else s4524 s4526 :: SWord1 = choose [0:0] s875 s4527 :: SBool = s10 /= s4526 s4528 :: SWord1 = choose [0:0] s868 s4529 :: SBool = s10 /= s4528 s4530 :: SWord8 = if s4529 then s4515 else s4516 s4531 :: SWord8 = s4530 >>> 1 s4532 :: SWord8 = s14 | s4531 s4533 :: SWord8 = s16 & s4531 s4534 :: SWord8 = if s4527 then s4532 else s4533 s4535 :: SWord1 = choose [0:0] s880 s4536 :: SBool = s10 /= s4535 s4537 :: SWord8 = if s4536 then s4532 else s4533 s4538 :: SWord8 = if s842 then s4534 else s4537 s4539 :: SWord8 = if s820 then s4525 else s4538 s4540 :: SWord1 = choose [0:0] s901 s4541 :: SBool = s10 /= s4540 s4542 :: SWord1 = choose [0:0] s897 s4543 :: SBool = s10 /= s4542 s4544 :: SWord1 = choose [0:0] s890 s4545 :: SBool = s10 /= s4544 s4546 :: SWord8 = if s4545 then s4511 else s4512 s4547 :: SWord8 = s4546 >>> 1 s4548 :: SWord8 = s14 | s4547 s4549 :: SWord8 = s16 & s4547 s4550 :: SWord8 = if s4543 then s4548 else s4549 s4551 :: SWord8 = s4550 >>> 1 s4552 :: SWord8 = s14 | s4551 s4553 :: SWord8 = s16 & s4551 s4554 :: SWord8 = if s4541 then s4552 else s4553 s4555 :: SWord1 = choose [0:0] s906 s4556 :: SBool = s10 /= s4555 s4557 :: SWord8 = if s4556 then s4552 else s4553 s4558 :: SWord8 = if s842 then s4554 else s4557 s4559 :: SWord1 = choose [0:0] s922 s4560 :: SBool = s10 /= s4559 s4561 :: SWord1 = choose [0:0] s915 s4562 :: SBool = s10 /= s4561 s4563 :: SWord8 = if s4562 then s4548 else s4549 s4564 :: SWord8 = s4563 >>> 1 s4565 :: SWord8 = s14 | s4564 s4566 :: SWord8 = s16 & s4564 s4567 :: SWord8 = if s4560 then s4565 else s4566 s4568 :: SWord1 = choose [0:0] s927 s4569 :: SBool = s10 /= s4568 s4570 :: SWord8 = if s4569 then s4565 else s4566 s4571 :: SWord8 = if s842 then s4567 else s4570 s4572 :: SWord8 = if s820 then s4558 else s4571 s4573 :: SWord8 = if s565 then s4539 else s4572 s4574 :: SWord1 = choose [0:0] s962 s4575 :: SBool = s10 /= s4574 s4576 :: SWord1 = choose [0:0] s958 s4577 :: SBool = s10 /= s4576 s4578 :: SWord1 = choose [0:0] s954 s4579 :: SBool = s10 /= s4578 s4580 :: SWord8 = s941 >>> 1 s4581 :: SWord8 = s14 | s4580 s4582 :: SWord8 = s16 & s4580 s4583 :: SWord8 = if s4579 then s4581 else s4582 s4584 :: SWord8 = s4583 >>> 1 s4585 :: SWord8 = s14 | s4584 s4586 :: SWord8 = s16 & s4584 s4587 :: SWord8 = if s4577 then s4585 else s4586 s4588 :: SWord8 = s4587 >>> 1 s4589 :: SWord8 = s14 | s4588 s4590 :: SWord8 = s16 & s4588 s4591 :: SWord8 = if s4575 then s4589 else s4590 s4592 :: SWord1 = choose [0:0] s967 s4593 :: SBool = s10 /= s4592 s4594 :: SWord8 = if s4593 then s4589 else s4590 s4595 :: SWord8 = if s947 then s4591 else s4594 s4596 :: SWord1 = choose [0:0] s983 s4597 :: SBool = s10 /= s4596 s4598 :: SWord1 = choose [0:0] s976 s4599 :: SBool = s10 /= s4598 s4600 :: SWord8 = if s4599 then s4585 else s4586 s4601 :: SWord8 = s4600 >>> 1 s4602 :: SWord8 = s14 | s4601 s4603 :: SWord8 = s16 & s4601 s4604 :: SWord8 = if s4597 then s4602 else s4603 s4605 :: SWord1 = choose [0:0] s988 s4606 :: SBool = s10 /= s4605 s4607 :: SWord8 = if s4606 then s4602 else s4603 s4608 :: SWord8 = if s947 then s4604 else s4607 s4609 :: SWord8 = if s820 then s4595 else s4608 s4610 :: SWord1 = choose [0:0] s1009 s4611 :: SBool = s10 /= s4610 s4612 :: SWord1 = choose [0:0] s1005 s4613 :: SBool = s10 /= s4612 s4614 :: SWord1 = choose [0:0] s998 s4615 :: SBool = s10 /= s4614 s4616 :: SWord8 = if s4615 then s4581 else s4582 s4617 :: SWord8 = s4616 >>> 1 s4618 :: SWord8 = s14 | s4617 s4619 :: SWord8 = s16 & s4617 s4620 :: SWord8 = if s4613 then s4618 else s4619 s4621 :: SWord8 = s4620 >>> 1 s4622 :: SWord8 = s14 | s4621 s4623 :: SWord8 = s16 & s4621 s4624 :: SWord8 = if s4611 then s4622 else s4623 s4625 :: SWord1 = choose [0:0] s1014 s4626 :: SBool = s10 /= s4625 s4627 :: SWord8 = if s4626 then s4622 else s4623 s4628 :: SWord8 = if s947 then s4624 else s4627 s4629 :: SWord1 = choose [0:0] s1030 s4630 :: SBool = s10 /= s4629 s4631 :: SWord1 = choose [0:0] s1023 s4632 :: SBool = s10 /= s4631 s4633 :: SWord8 = if s4632 then s4618 else s4619 s4634 :: SWord8 = s4633 >>> 1 s4635 :: SWord8 = s14 | s4634 s4636 :: SWord8 = s16 & s4634 s4637 :: SWord8 = if s4630 then s4635 else s4636 s4638 :: SWord1 = choose [0:0] s1035 s4639 :: SBool = s10 /= s4638 s4640 :: SWord8 = if s4639 then s4635 else s4636 s4641 :: SWord8 = if s947 then s4637 else s4640 s4642 :: SWord8 = if s820 then s4628 else s4641 s4643 :: SWord8 = if s565 then s4609 else s4642 s4644 :: SWord8 = if s57 then s4573 else s4643 s4645 :: SWord8 = if s41 then s4503 else s4644 s4646 :: SWord8 = if s30 then s4362 else s4645 s4647 :: SWord1 = choose [0:0] s1130 s4648 :: SBool = s10 /= s4647 s4649 :: SWord1 = choose [0:0] s1126 s4650 :: SBool = s10 /= s4649 s4651 :: SWord1 = choose [0:0] s1122 s4652 :: SBool = s10 /= s4651 s4653 :: SWord8 = s1109 >>> 1 s4654 :: SWord8 = s14 | s4653 s4655 :: SWord8 = s16 & s4653 s4656 :: SWord8 = if s4652 then s4654 else s4655 s4657 :: SWord8 = s4656 >>> 1 s4658 :: SWord8 = s14 | s4657 s4659 :: SWord8 = s16 & s4657 s4660 :: SWord8 = if s4650 then s4658 else s4659 s4661 :: SWord8 = s4660 >>> 1 s4662 :: SWord8 = s14 | s4661 s4663 :: SWord8 = s16 & s4661 s4664 :: SWord8 = if s4648 then s4662 else s4663 s4665 :: SWord1 = choose [0:0] s1135 s4666 :: SBool = s10 /= s4665 s4667 :: SWord8 = if s4666 then s4662 else s4663 s4668 :: SWord8 = if s1118 then s4664 else s4667 s4669 :: SWord1 = choose [0:0] s1151 s4670 :: SBool = s10 /= s4669 s4671 :: SWord1 = choose [0:0] s1144 s4672 :: SBool = s10 /= s4671 s4673 :: SWord8 = if s4672 then s4658 else s4659 s4674 :: SWord8 = s4673 >>> 1 s4675 :: SWord8 = s14 | s4674 s4676 :: SWord8 = s16 & s4674 s4677 :: SWord8 = if s4670 then s4675 else s4676 s4678 :: SWord1 = choose [0:0] s1156 s4679 :: SBool = s10 /= s4678 s4680 :: SWord8 = if s4679 then s4675 else s4676 s4681 :: SWord8 = if s1118 then s4677 else s4680 s4682 :: SWord8 = if s1099 then s4668 else s4681 s4683 :: SWord1 = choose [0:0] s1177 s4684 :: SBool = s10 /= s4683 s4685 :: SWord1 = choose [0:0] s1173 s4686 :: SBool = s10 /= s4685 s4687 :: SWord1 = choose [0:0] s1166 s4688 :: SBool = s10 /= s4687 s4689 :: SWord8 = if s4688 then s4654 else s4655 s4690 :: SWord8 = s4689 >>> 1 s4691 :: SWord8 = s14 | s4690 s4692 :: SWord8 = s16 & s4690 s4693 :: SWord8 = if s4686 then s4691 else s4692 s4694 :: SWord8 = s4693 >>> 1 s4695 :: SWord8 = s14 | s4694 s4696 :: SWord8 = s16 & s4694 s4697 :: SWord8 = if s4684 then s4695 else s4696 s4698 :: SWord1 = choose [0:0] s1182 s4699 :: SBool = s10 /= s4698 s4700 :: SWord8 = if s4699 then s4695 else s4696 s4701 :: SWord8 = if s1118 then s4697 else s4700 s4702 :: SWord1 = choose [0:0] s1198 s4703 :: SBool = s10 /= s4702 s4704 :: SWord1 = choose [0:0] s1191 s4705 :: SBool = s10 /= s4704 s4706 :: SWord8 = if s4705 then s4691 else s4692 s4707 :: SWord8 = s4706 >>> 1 s4708 :: SWord8 = s14 | s4707 s4709 :: SWord8 = s16 & s4707 s4710 :: SWord8 = if s4703 then s4708 else s4709 s4711 :: SWord1 = choose [0:0] s1203 s4712 :: SBool = s10 /= s4711 s4713 :: SWord8 = if s4712 then s4708 else s4709 s4714 :: SWord8 = if s1118 then s4710 else s4713 s4715 :: SWord8 = if s1099 then s4701 else s4714 s4716 :: SWord8 = if s1080 then s4682 else s4715 s4717 :: SWord1 = choose [0:0] s1238 s4718 :: SBool = s10 /= s4717 s4719 :: SWord1 = choose [0:0] s1234 s4720 :: SBool = s10 /= s4719 s4721 :: SWord1 = choose [0:0] s1230 s4722 :: SBool = s10 /= s4721 s4723 :: SWord8 = s1217 >>> 1 s4724 :: SWord8 = s14 | s4723 s4725 :: SWord8 = s16 & s4723 s4726 :: SWord8 = if s4722 then s4724 else s4725 s4727 :: SWord8 = s4726 >>> 1 s4728 :: SWord8 = s14 | s4727 s4729 :: SWord8 = s16 & s4727 s4730 :: SWord8 = if s4720 then s4728 else s4729 s4731 :: SWord8 = s4730 >>> 1 s4732 :: SWord8 = s14 | s4731 s4733 :: SWord8 = s16 & s4731 s4734 :: SWord8 = if s4718 then s4732 else s4733 s4735 :: SWord1 = choose [0:0] s1243 s4736 :: SBool = s10 /= s4735 s4737 :: SWord8 = if s4736 then s4732 else s4733 s4738 :: SWord8 = if s1223 then s4734 else s4737 s4739 :: SWord1 = choose [0:0] s1259 s4740 :: SBool = s10 /= s4739 s4741 :: SWord1 = choose [0:0] s1252 s4742 :: SBool = s10 /= s4741 s4743 :: SWord8 = if s4742 then s4728 else s4729 s4744 :: SWord8 = s4743 >>> 1 s4745 :: SWord8 = s14 | s4744 s4746 :: SWord8 = s16 & s4744 s4747 :: SWord8 = if s4740 then s4745 else s4746 s4748 :: SWord1 = choose [0:0] s1264 s4749 :: SBool = s10 /= s4748 s4750 :: SWord8 = if s4749 then s4745 else s4746 s4751 :: SWord8 = if s1223 then s4747 else s4750 s4752 :: SWord8 = if s1099 then s4738 else s4751 s4753 :: SWord1 = choose [0:0] s1285 s4754 :: SBool = s10 /= s4753 s4755 :: SWord1 = choose [0:0] s1281 s4756 :: SBool = s10 /= s4755 s4757 :: SWord1 = choose [0:0] s1274 s4758 :: SBool = s10 /= s4757 s4759 :: SWord8 = if s4758 then s4724 else s4725 s4760 :: SWord8 = s4759 >>> 1 s4761 :: SWord8 = s14 | s4760 s4762 :: SWord8 = s16 & s4760 s4763 :: SWord8 = if s4756 then s4761 else s4762 s4764 :: SWord8 = s4763 >>> 1 s4765 :: SWord8 = s14 | s4764 s4766 :: SWord8 = s16 & s4764 s4767 :: SWord8 = if s4754 then s4765 else s4766 s4768 :: SWord1 = choose [0:0] s1290 s4769 :: SBool = s10 /= s4768 s4770 :: SWord8 = if s4769 then s4765 else s4766 s4771 :: SWord8 = if s1223 then s4767 else s4770 s4772 :: SWord1 = choose [0:0] s1306 s4773 :: SBool = s10 /= s4772 s4774 :: SWord1 = choose [0:0] s1299 s4775 :: SBool = s10 /= s4774 s4776 :: SWord8 = if s4775 then s4761 else s4762 s4777 :: SWord8 = s4776 >>> 1 s4778 :: SWord8 = s14 | s4777 s4779 :: SWord8 = s16 & s4777 s4780 :: SWord8 = if s4773 then s4778 else s4779 s4781 :: SWord1 = choose [0:0] s1311 s4782 :: SBool = s10 /= s4781 s4783 :: SWord8 = if s4782 then s4778 else s4779 s4784 :: SWord8 = if s1223 then s4780 else s4783 s4785 :: SWord8 = if s1099 then s4771 else s4784 s4786 :: SWord8 = if s1080 then s4752 else s4785 s4787 :: SWord8 = if s1058 then s4716 else s4786 s4788 :: SWord1 = choose [0:0] s1366 s4789 :: SBool = s10 /= s4788 s4790 :: SWord1 = choose [0:0] s1362 s4791 :: SBool = s10 /= s4790 s4792 :: SWord1 = choose [0:0] s1358 s4793 :: SBool = s10 /= s4792 s4794 :: SWord8 = s1345 >>> 1 s4795 :: SWord8 = s14 | s4794 s4796 :: SWord8 = s16 & s4794 s4797 :: SWord8 = if s4793 then s4795 else s4796 s4798 :: SWord8 = s4797 >>> 1 s4799 :: SWord8 = s14 | s4798 s4800 :: SWord8 = s16 & s4798 s4801 :: SWord8 = if s4791 then s4799 else s4800 s4802 :: SWord8 = s4801 >>> 1 s4803 :: SWord8 = s14 | s4802 s4804 :: SWord8 = s16 & s4802 s4805 :: SWord8 = if s4789 then s4803 else s4804 s4806 :: SWord1 = choose [0:0] s1371 s4807 :: SBool = s10 /= s4806 s4808 :: SWord8 = if s4807 then s4803 else s4804 s4809 :: SWord8 = if s1354 then s4805 else s4808 s4810 :: SWord1 = choose [0:0] s1387 s4811 :: SBool = s10 /= s4810 s4812 :: SWord1 = choose [0:0] s1380 s4813 :: SBool = s10 /= s4812 s4814 :: SWord8 = if s4813 then s4799 else s4800 s4815 :: SWord8 = s4814 >>> 1 s4816 :: SWord8 = s14 | s4815 s4817 :: SWord8 = s16 & s4815 s4818 :: SWord8 = if s4811 then s4816 else s4817 s4819 :: SWord1 = choose [0:0] s1392 s4820 :: SBool = s10 /= s4819 s4821 :: SWord8 = if s4820 then s4816 else s4817 s4822 :: SWord8 = if s1354 then s4818 else s4821 s4823 :: SWord8 = if s1332 then s4809 else s4822 s4824 :: SWord1 = choose [0:0] s1413 s4825 :: SBool = s10 /= s4824 s4826 :: SWord1 = choose [0:0] s1409 s4827 :: SBool = s10 /= s4826 s4828 :: SWord1 = choose [0:0] s1402 s4829 :: SBool = s10 /= s4828 s4830 :: SWord8 = if s4829 then s4795 else s4796 s4831 :: SWord8 = s4830 >>> 1 s4832 :: SWord8 = s14 | s4831 s4833 :: SWord8 = s16 & s4831 s4834 :: SWord8 = if s4827 then s4832 else s4833 s4835 :: SWord8 = s4834 >>> 1 s4836 :: SWord8 = s14 | s4835 s4837 :: SWord8 = s16 & s4835 s4838 :: SWord8 = if s4825 then s4836 else s4837 s4839 :: SWord1 = choose [0:0] s1418 s4840 :: SBool = s10 /= s4839 s4841 :: SWord8 = if s4840 then s4836 else s4837 s4842 :: SWord8 = if s1354 then s4838 else s4841 s4843 :: SWord1 = choose [0:0] s1434 s4844 :: SBool = s10 /= s4843 s4845 :: SWord1 = choose [0:0] s1427 s4846 :: SBool = s10 /= s4845 s4847 :: SWord8 = if s4846 then s4832 else s4833 s4848 :: SWord8 = s4847 >>> 1 s4849 :: SWord8 = s14 | s4848 s4850 :: SWord8 = s16 & s4848 s4851 :: SWord8 = if s4844 then s4849 else s4850 s4852 :: SWord1 = choose [0:0] s1439 s4853 :: SBool = s10 /= s4852 s4854 :: SWord8 = if s4853 then s4849 else s4850 s4855 :: SWord8 = if s1354 then s4851 else s4854 s4856 :: SWord8 = if s1332 then s4842 else s4855 s4857 :: SWord8 = if s1080 then s4823 else s4856 s4858 :: SWord1 = choose [0:0] s1474 s4859 :: SBool = s10 /= s4858 s4860 :: SWord1 = choose [0:0] s1470 s4861 :: SBool = s10 /= s4860 s4862 :: SWord1 = choose [0:0] s1466 s4863 :: SBool = s10 /= s4862 s4864 :: SWord8 = s1453 >>> 1 s4865 :: SWord8 = s14 | s4864 s4866 :: SWord8 = s16 & s4864 s4867 :: SWord8 = if s4863 then s4865 else s4866 s4868 :: SWord8 = s4867 >>> 1 s4869 :: SWord8 = s14 | s4868 s4870 :: SWord8 = s16 & s4868 s4871 :: SWord8 = if s4861 then s4869 else s4870 s4872 :: SWord8 = s4871 >>> 1 s4873 :: SWord8 = s14 | s4872 s4874 :: SWord8 = s16 & s4872 s4875 :: SWord8 = if s4859 then s4873 else s4874 s4876 :: SWord1 = choose [0:0] s1479 s4877 :: SBool = s10 /= s4876 s4878 :: SWord8 = if s4877 then s4873 else s4874 s4879 :: SWord8 = if s1459 then s4875 else s4878 s4880 :: SWord1 = choose [0:0] s1495 s4881 :: SBool = s10 /= s4880 s4882 :: SWord1 = choose [0:0] s1488 s4883 :: SBool = s10 /= s4882 s4884 :: SWord8 = if s4883 then s4869 else s4870 s4885 :: SWord8 = s4884 >>> 1 s4886 :: SWord8 = s14 | s4885 s4887 :: SWord8 = s16 & s4885 s4888 :: SWord8 = if s4881 then s4886 else s4887 s4889 :: SWord1 = choose [0:0] s1500 s4890 :: SBool = s10 /= s4889 s4891 :: SWord8 = if s4890 then s4886 else s4887 s4892 :: SWord8 = if s1459 then s4888 else s4891 s4893 :: SWord8 = if s1332 then s4879 else s4892 s4894 :: SWord1 = choose [0:0] s1521 s4895 :: SBool = s10 /= s4894 s4896 :: SWord1 = choose [0:0] s1517 s4897 :: SBool = s10 /= s4896 s4898 :: SWord1 = choose [0:0] s1510 s4899 :: SBool = s10 /= s4898 s4900 :: SWord8 = if s4899 then s4865 else s4866 s4901 :: SWord8 = s4900 >>> 1 s4902 :: SWord8 = s14 | s4901 s4903 :: SWord8 = s16 & s4901 s4904 :: SWord8 = if s4897 then s4902 else s4903 s4905 :: SWord8 = s4904 >>> 1 s4906 :: SWord8 = s14 | s4905 s4907 :: SWord8 = s16 & s4905 s4908 :: SWord8 = if s4895 then s4906 else s4907 s4909 :: SWord1 = choose [0:0] s1526 s4910 :: SBool = s10 /= s4909 s4911 :: SWord8 = if s4910 then s4906 else s4907 s4912 :: SWord8 = if s1459 then s4908 else s4911 s4913 :: SWord1 = choose [0:0] s1542 s4914 :: SBool = s10 /= s4913 s4915 :: SWord1 = choose [0:0] s1535 s4916 :: SBool = s10 /= s4915 s4917 :: SWord8 = if s4916 then s4902 else s4903 s4918 :: SWord8 = s4917 >>> 1 s4919 :: SWord8 = s14 | s4918 s4920 :: SWord8 = s16 & s4918 s4921 :: SWord8 = if s4914 then s4919 else s4920 s4922 :: SWord1 = choose [0:0] s1547 s4923 :: SBool = s10 /= s4922 s4924 :: SWord8 = if s4923 then s4919 else s4920 s4925 :: SWord8 = if s1459 then s4921 else s4924 s4926 :: SWord8 = if s1332 then s4912 else s4925 s4927 :: SWord8 = if s1080 then s4893 else s4926 s4928 :: SWord8 = if s1058 then s4857 else s4927 s4929 :: SWord8 = if s41 then s4787 else s4928 s4930 :: SWord1 = choose [0:0] s1622 s4931 :: SBool = s10 /= s4930 s4932 :: SWord1 = choose [0:0] s1618 s4933 :: SBool = s10 /= s4932 s4934 :: SWord1 = choose [0:0] s1614 s4935 :: SBool = s10 /= s4934 s4936 :: SWord8 = s1601 >>> 1 s4937 :: SWord8 = s14 | s4936 s4938 :: SWord8 = s16 & s4936 s4939 :: SWord8 = if s4935 then s4937 else s4938 s4940 :: SWord8 = s4939 >>> 1 s4941 :: SWord8 = s14 | s4940 s4942 :: SWord8 = s16 & s4940 s4943 :: SWord8 = if s4933 then s4941 else s4942 s4944 :: SWord8 = s4943 >>> 1 s4945 :: SWord8 = s14 | s4944 s4946 :: SWord8 = s16 & s4944 s4947 :: SWord8 = if s4931 then s4945 else s4946 s4948 :: SWord1 = choose [0:0] s1627 s4949 :: SBool = s10 /= s4948 s4950 :: SWord8 = if s4949 then s4945 else s4946 s4951 :: SWord8 = if s1610 then s4947 else s4950 s4952 :: SWord1 = choose [0:0] s1643 s4953 :: SBool = s10 /= s4952 s4954 :: SWord1 = choose [0:0] s1636 s4955 :: SBool = s10 /= s4954 s4956 :: SWord8 = if s4955 then s4941 else s4942 s4957 :: SWord8 = s4956 >>> 1 s4958 :: SWord8 = s14 | s4957 s4959 :: SWord8 = s16 & s4957 s4960 :: SWord8 = if s4953 then s4958 else s4959 s4961 :: SWord1 = choose [0:0] s1648 s4962 :: SBool = s10 /= s4961 s4963 :: SWord8 = if s4962 then s4958 else s4959 s4964 :: SWord8 = if s1610 then s4960 else s4963 s4965 :: SWord8 = if s1591 then s4951 else s4964 s4966 :: SWord1 = choose [0:0] s1669 s4967 :: SBool = s10 /= s4966 s4968 :: SWord1 = choose [0:0] s1665 s4969 :: SBool = s10 /= s4968 s4970 :: SWord1 = choose [0:0] s1658 s4971 :: SBool = s10 /= s4970 s4972 :: SWord8 = if s4971 then s4937 else s4938 s4973 :: SWord8 = s4972 >>> 1 s4974 :: SWord8 = s14 | s4973 s4975 :: SWord8 = s16 & s4973 s4976 :: SWord8 = if s4969 then s4974 else s4975 s4977 :: SWord8 = s4976 >>> 1 s4978 :: SWord8 = s14 | s4977 s4979 :: SWord8 = s16 & s4977 s4980 :: SWord8 = if s4967 then s4978 else s4979 s4981 :: SWord1 = choose [0:0] s1674 s4982 :: SBool = s10 /= s4981 s4983 :: SWord8 = if s4982 then s4978 else s4979 s4984 :: SWord8 = if s1610 then s4980 else s4983 s4985 :: SWord1 = choose [0:0] s1690 s4986 :: SBool = s10 /= s4985 s4987 :: SWord1 = choose [0:0] s1683 s4988 :: SBool = s10 /= s4987 s4989 :: SWord8 = if s4988 then s4974 else s4975 s4990 :: SWord8 = s4989 >>> 1 s4991 :: SWord8 = s14 | s4990 s4992 :: SWord8 = s16 & s4990 s4993 :: SWord8 = if s4986 then s4991 else s4992 s4994 :: SWord1 = choose [0:0] s1695 s4995 :: SBool = s10 /= s4994 s4996 :: SWord8 = if s4995 then s4991 else s4992 s4997 :: SWord8 = if s1610 then s4993 else s4996 s4998 :: SWord8 = if s1591 then s4984 else s4997 s4999 :: SWord8 = if s1569 then s4965 else s4998 s5000 :: SWord1 = choose [0:0] s1730 s5001 :: SBool = s10 /= s5000 s5002 :: SWord1 = choose [0:0] s1726 s5003 :: SBool = s10 /= s5002 s5004 :: SWord1 = choose [0:0] s1722 s5005 :: SBool = s10 /= s5004 s5006 :: SWord8 = s1709 >>> 1 s5007 :: SWord8 = s14 | s5006 s5008 :: SWord8 = s16 & s5006 s5009 :: SWord8 = if s5005 then s5007 else s5008 s5010 :: SWord8 = s5009 >>> 1 s5011 :: SWord8 = s14 | s5010 s5012 :: SWord8 = s16 & s5010 s5013 :: SWord8 = if s5003 then s5011 else s5012 s5014 :: SWord8 = s5013 >>> 1 s5015 :: SWord8 = s14 | s5014 s5016 :: SWord8 = s16 & s5014 s5017 :: SWord8 = if s5001 then s5015 else s5016 s5018 :: SWord1 = choose [0:0] s1735 s5019 :: SBool = s10 /= s5018 s5020 :: SWord8 = if s5019 then s5015 else s5016 s5021 :: SWord8 = if s1715 then s5017 else s5020 s5022 :: SWord1 = choose [0:0] s1751 s5023 :: SBool = s10 /= s5022 s5024 :: SWord1 = choose [0:0] s1744 s5025 :: SBool = s10 /= s5024 s5026 :: SWord8 = if s5025 then s5011 else s5012 s5027 :: SWord8 = s5026 >>> 1 s5028 :: SWord8 = s14 | s5027 s5029 :: SWord8 = s16 & s5027 s5030 :: SWord8 = if s5023 then s5028 else s5029 s5031 :: SWord1 = choose [0:0] s1756 s5032 :: SBool = s10 /= s5031 s5033 :: SWord8 = if s5032 then s5028 else s5029 s5034 :: SWord8 = if s1715 then s5030 else s5033 s5035 :: SWord8 = if s1591 then s5021 else s5034 s5036 :: SWord1 = choose [0:0] s1777 s5037 :: SBool = s10 /= s5036 s5038 :: SWord1 = choose [0:0] s1773 s5039 :: SBool = s10 /= s5038 s5040 :: SWord1 = choose [0:0] s1766 s5041 :: SBool = s10 /= s5040 s5042 :: SWord8 = if s5041 then s5007 else s5008 s5043 :: SWord8 = s5042 >>> 1 s5044 :: SWord8 = s14 | s5043 s5045 :: SWord8 = s16 & s5043 s5046 :: SWord8 = if s5039 then s5044 else s5045 s5047 :: SWord8 = s5046 >>> 1 s5048 :: SWord8 = s14 | s5047 s5049 :: SWord8 = s16 & s5047 s5050 :: SWord8 = if s5037 then s5048 else s5049 s5051 :: SWord1 = choose [0:0] s1782 s5052 :: SBool = s10 /= s5051 s5053 :: SWord8 = if s5052 then s5048 else s5049 s5054 :: SWord8 = if s1715 then s5050 else s5053 s5055 :: SWord1 = choose [0:0] s1798 s5056 :: SBool = s10 /= s5055 s5057 :: SWord1 = choose [0:0] s1791 s5058 :: SBool = s10 /= s5057 s5059 :: SWord8 = if s5058 then s5044 else s5045 s5060 :: SWord8 = s5059 >>> 1 s5061 :: SWord8 = s14 | s5060 s5062 :: SWord8 = s16 & s5060 s5063 :: SWord8 = if s5056 then s5061 else s5062 s5064 :: SWord1 = choose [0:0] s1803 s5065 :: SBool = s10 /= s5064 s5066 :: SWord8 = if s5065 then s5061 else s5062 s5067 :: SWord8 = if s1715 then s5063 else s5066 s5068 :: SWord8 = if s1591 then s5054 else s5067 s5069 :: SWord8 = if s1569 then s5035 else s5068 s5070 :: SWord8 = if s1058 then s4999 else s5069 s5071 :: SWord1 = choose [0:0] s1858 s5072 :: SBool = s10 /= s5071 s5073 :: SWord1 = choose [0:0] s1854 s5074 :: SBool = s10 /= s5073 s5075 :: SWord1 = choose [0:0] s1850 s5076 :: SBool = s10 /= s5075 s5077 :: SWord8 = s1837 >>> 1 s5078 :: SWord8 = s14 | s5077 s5079 :: SWord8 = s16 & s5077 s5080 :: SWord8 = if s5076 then s5078 else s5079 s5081 :: SWord8 = s5080 >>> 1 s5082 :: SWord8 = s14 | s5081 s5083 :: SWord8 = s16 & s5081 s5084 :: SWord8 = if s5074 then s5082 else s5083 s5085 :: SWord8 = s5084 >>> 1 s5086 :: SWord8 = s14 | s5085 s5087 :: SWord8 = s16 & s5085 s5088 :: SWord8 = if s5072 then s5086 else s5087 s5089 :: SWord1 = choose [0:0] s1863 s5090 :: SBool = s10 /= s5089 s5091 :: SWord8 = if s5090 then s5086 else s5087 s5092 :: SWord8 = if s1846 then s5088 else s5091 s5093 :: SWord1 = choose [0:0] s1879 s5094 :: SBool = s10 /= s5093 s5095 :: SWord1 = choose [0:0] s1872 s5096 :: SBool = s10 /= s5095 s5097 :: SWord8 = if s5096 then s5082 else s5083 s5098 :: SWord8 = s5097 >>> 1 s5099 :: SWord8 = s14 | s5098 s5100 :: SWord8 = s16 & s5098 s5101 :: SWord8 = if s5094 then s5099 else s5100 s5102 :: SWord1 = choose [0:0] s1884 s5103 :: SBool = s10 /= s5102 s5104 :: SWord8 = if s5103 then s5099 else s5100 s5105 :: SWord8 = if s1846 then s5101 else s5104 s5106 :: SWord8 = if s1824 then s5092 else s5105 s5107 :: SWord1 = choose [0:0] s1905 s5108 :: SBool = s10 /= s5107 s5109 :: SWord1 = choose [0:0] s1901 s5110 :: SBool = s10 /= s5109 s5111 :: SWord1 = choose [0:0] s1894 s5112 :: SBool = s10 /= s5111 s5113 :: SWord8 = if s5112 then s5078 else s5079 s5114 :: SWord8 = s5113 >>> 1 s5115 :: SWord8 = s14 | s5114 s5116 :: SWord8 = s16 & s5114 s5117 :: SWord8 = if s5110 then s5115 else s5116 s5118 :: SWord8 = s5117 >>> 1 s5119 :: SWord8 = s14 | s5118 s5120 :: SWord8 = s16 & s5118 s5121 :: SWord8 = if s5108 then s5119 else s5120 s5122 :: SWord1 = choose [0:0] s1910 s5123 :: SBool = s10 /= s5122 s5124 :: SWord8 = if s5123 then s5119 else s5120 s5125 :: SWord8 = if s1846 then s5121 else s5124 s5126 :: SWord1 = choose [0:0] s1926 s5127 :: SBool = s10 /= s5126 s5128 :: SWord1 = choose [0:0] s1919 s5129 :: SBool = s10 /= s5128 s5130 :: SWord8 = if s5129 then s5115 else s5116 s5131 :: SWord8 = s5130 >>> 1 s5132 :: SWord8 = s14 | s5131 s5133 :: SWord8 = s16 & s5131 s5134 :: SWord8 = if s5127 then s5132 else s5133 s5135 :: SWord1 = choose [0:0] s1931 s5136 :: SBool = s10 /= s5135 s5137 :: SWord8 = if s5136 then s5132 else s5133 s5138 :: SWord8 = if s1846 then s5134 else s5137 s5139 :: SWord8 = if s1824 then s5125 else s5138 s5140 :: SWord8 = if s1569 then s5106 else s5139 s5141 :: SWord1 = choose [0:0] s1966 s5142 :: SBool = s10 /= s5141 s5143 :: SWord1 = choose [0:0] s1962 s5144 :: SBool = s10 /= s5143 s5145 :: SWord1 = choose [0:0] s1958 s5146 :: SBool = s10 /= s5145 s5147 :: SWord8 = s1945 >>> 1 s5148 :: SWord8 = s14 | s5147 s5149 :: SWord8 = s16 & s5147 s5150 :: SWord8 = if s5146 then s5148 else s5149 s5151 :: SWord8 = s5150 >>> 1 s5152 :: SWord8 = s14 | s5151 s5153 :: SWord8 = s16 & s5151 s5154 :: SWord8 = if s5144 then s5152 else s5153 s5155 :: SWord8 = s5154 >>> 1 s5156 :: SWord8 = s14 | s5155 s5157 :: SWord8 = s16 & s5155 s5158 :: SWord8 = if s5142 then s5156 else s5157 s5159 :: SWord1 = choose [0:0] s1971 s5160 :: SBool = s10 /= s5159 s5161 :: SWord8 = if s5160 then s5156 else s5157 s5162 :: SWord8 = if s1951 then s5158 else s5161 s5163 :: SWord1 = choose [0:0] s1987 s5164 :: SBool = s10 /= s5163 s5165 :: SWord1 = choose [0:0] s1980 s5166 :: SBool = s10 /= s5165 s5167 :: SWord8 = if s5166 then s5152 else s5153 s5168 :: SWord8 = s5167 >>> 1 s5169 :: SWord8 = s14 | s5168 s5170 :: SWord8 = s16 & s5168 s5171 :: SWord8 = if s5164 then s5169 else s5170 s5172 :: SWord1 = choose [0:0] s1992 s5173 :: SBool = s10 /= s5172 s5174 :: SWord8 = if s5173 then s5169 else s5170 s5175 :: SWord8 = if s1951 then s5171 else s5174 s5176 :: SWord8 = if s1824 then s5162 else s5175 s5177 :: SWord1 = choose [0:0] s2013 s5178 :: SBool = s10 /= s5177 s5179 :: SWord1 = choose [0:0] s2009 s5180 :: SBool = s10 /= s5179 s5181 :: SWord1 = choose [0:0] s2002 s5182 :: SBool = s10 /= s5181 s5183 :: SWord8 = if s5182 then s5148 else s5149 s5184 :: SWord8 = s5183 >>> 1 s5185 :: SWord8 = s14 | s5184 s5186 :: SWord8 = s16 & s5184 s5187 :: SWord8 = if s5180 then s5185 else s5186 s5188 :: SWord8 = s5187 >>> 1 s5189 :: SWord8 = s14 | s5188 s5190 :: SWord8 = s16 & s5188 s5191 :: SWord8 = if s5178 then s5189 else s5190 s5192 :: SWord1 = choose [0:0] s2018 s5193 :: SBool = s10 /= s5192 s5194 :: SWord8 = if s5193 then s5189 else s5190 s5195 :: SWord8 = if s1951 then s5191 else s5194 s5196 :: SWord1 = choose [0:0] s2034 s5197 :: SBool = s10 /= s5196 s5198 :: SWord1 = choose [0:0] s2027 s5199 :: SBool = s10 /= s5198 s5200 :: SWord8 = if s5199 then s5185 else s5186 s5201 :: SWord8 = s5200 >>> 1 s5202 :: SWord8 = s14 | s5201 s5203 :: SWord8 = s16 & s5201 s5204 :: SWord8 = if s5197 then s5202 else s5203 s5205 :: SWord1 = choose [0:0] s2039 s5206 :: SBool = s10 /= s5205 s5207 :: SWord8 = if s5206 then s5202 else s5203 s5208 :: SWord8 = if s1951 then s5204 else s5207 s5209 :: SWord8 = if s1824 then s5195 else s5208 s5210 :: SWord8 = if s1569 then s5176 else s5209 s5211 :: SWord8 = if s1058 then s5140 else s5210 s5212 :: SWord8 = if s41 then s5070 else s5211 s5213 :: SWord8 = if s30 then s4929 else s5212 s5214 :: SWord8 = if s21 then s4646 else s5213 s5215 :: SWord1 = choose [0:0] s2149 s5216 :: SBool = s10 /= s5215 s5217 :: SWord1 = choose [0:0] s2145 s5218 :: SBool = s10 /= s5217 s5219 :: SWord1 = choose [0:0] s2141 s5220 :: SBool = s10 /= s5219 s5221 :: SWord8 = s2128 >>> 1 s5222 :: SWord8 = s14 | s5221 s5223 :: SWord8 = s16 & s5221 s5224 :: SWord8 = if s5220 then s5222 else s5223 s5225 :: SWord8 = s5224 >>> 1 s5226 :: SWord8 = s14 | s5225 s5227 :: SWord8 = s16 & s5225 s5228 :: SWord8 = if s5218 then s5226 else s5227 s5229 :: SWord8 = s5228 >>> 1 s5230 :: SWord8 = s14 | s5229 s5231 :: SWord8 = s16 & s5229 s5232 :: SWord8 = if s5216 then s5230 else s5231 s5233 :: SWord1 = choose [0:0] s2154 s5234 :: SBool = s10 /= s5233 s5235 :: SWord8 = if s5234 then s5230 else s5231 s5236 :: SWord8 = if s2137 then s5232 else s5235 s5237 :: SWord1 = choose [0:0] s2170 s5238 :: SBool = s10 /= s5237 s5239 :: SWord1 = choose [0:0] s2163 s5240 :: SBool = s10 /= s5239 s5241 :: SWord8 = if s5240 then s5226 else s5227 s5242 :: SWord8 = s5241 >>> 1 s5243 :: SWord8 = s14 | s5242 s5244 :: SWord8 = s16 & s5242 s5245 :: SWord8 = if s5238 then s5243 else s5244 s5246 :: SWord1 = choose [0:0] s2175 s5247 :: SBool = s10 /= s5246 s5248 :: SWord8 = if s5247 then s5243 else s5244 s5249 :: SWord8 = if s2137 then s5245 else s5248 s5250 :: SWord8 = if s2118 then s5236 else s5249 s5251 :: SWord1 = choose [0:0] s2196 s5252 :: SBool = s10 /= s5251 s5253 :: SWord1 = choose [0:0] s2192 s5254 :: SBool = s10 /= s5253 s5255 :: SWord1 = choose [0:0] s2185 s5256 :: SBool = s10 /= s5255 s5257 :: SWord8 = if s5256 then s5222 else s5223 s5258 :: SWord8 = s5257 >>> 1 s5259 :: SWord8 = s14 | s5258 s5260 :: SWord8 = s16 & s5258 s5261 :: SWord8 = if s5254 then s5259 else s5260 s5262 :: SWord8 = s5261 >>> 1 s5263 :: SWord8 = s14 | s5262 s5264 :: SWord8 = s16 & s5262 s5265 :: SWord8 = if s5252 then s5263 else s5264 s5266 :: SWord1 = choose [0:0] s2201 s5267 :: SBool = s10 /= s5266 s5268 :: SWord8 = if s5267 then s5263 else s5264 s5269 :: SWord8 = if s2137 then s5265 else s5268 s5270 :: SWord1 = choose [0:0] s2217 s5271 :: SBool = s10 /= s5270 s5272 :: SWord1 = choose [0:0] s2210 s5273 :: SBool = s10 /= s5272 s5274 :: SWord8 = if s5273 then s5259 else s5260 s5275 :: SWord8 = s5274 >>> 1 s5276 :: SWord8 = s14 | s5275 s5277 :: SWord8 = s16 & s5275 s5278 :: SWord8 = if s5271 then s5276 else s5277 s5279 :: SWord1 = choose [0:0] s2222 s5280 :: SBool = s10 /= s5279 s5281 :: SWord8 = if s5280 then s5276 else s5277 s5282 :: SWord8 = if s2137 then s5278 else s5281 s5283 :: SWord8 = if s2118 then s5269 else s5282 s5284 :: SWord8 = if s2099 then s5250 else s5283 s5285 :: SWord1 = choose [0:0] s2257 s5286 :: SBool = s10 /= s5285 s5287 :: SWord1 = choose [0:0] s2253 s5288 :: SBool = s10 /= s5287 s5289 :: SWord1 = choose [0:0] s2249 s5290 :: SBool = s10 /= s5289 s5291 :: SWord8 = s2236 >>> 1 s5292 :: SWord8 = s14 | s5291 s5293 :: SWord8 = s16 & s5291 s5294 :: SWord8 = if s5290 then s5292 else s5293 s5295 :: SWord8 = s5294 >>> 1 s5296 :: SWord8 = s14 | s5295 s5297 :: SWord8 = s16 & s5295 s5298 :: SWord8 = if s5288 then s5296 else s5297 s5299 :: SWord8 = s5298 >>> 1 s5300 :: SWord8 = s14 | s5299 s5301 :: SWord8 = s16 & s5299 s5302 :: SWord8 = if s5286 then s5300 else s5301 s5303 :: SWord1 = choose [0:0] s2262 s5304 :: SBool = s10 /= s5303 s5305 :: SWord8 = if s5304 then s5300 else s5301 s5306 :: SWord8 = if s2242 then s5302 else s5305 s5307 :: SWord1 = choose [0:0] s2278 s5308 :: SBool = s10 /= s5307 s5309 :: SWord1 = choose [0:0] s2271 s5310 :: SBool = s10 /= s5309 s5311 :: SWord8 = if s5310 then s5296 else s5297 s5312 :: SWord8 = s5311 >>> 1 s5313 :: SWord8 = s14 | s5312 s5314 :: SWord8 = s16 & s5312 s5315 :: SWord8 = if s5308 then s5313 else s5314 s5316 :: SWord1 = choose [0:0] s2283 s5317 :: SBool = s10 /= s5316 s5318 :: SWord8 = if s5317 then s5313 else s5314 s5319 :: SWord8 = if s2242 then s5315 else s5318 s5320 :: SWord8 = if s2118 then s5306 else s5319 s5321 :: SWord1 = choose [0:0] s2304 s5322 :: SBool = s10 /= s5321 s5323 :: SWord1 = choose [0:0] s2300 s5324 :: SBool = s10 /= s5323 s5325 :: SWord1 = choose [0:0] s2293 s5326 :: SBool = s10 /= s5325 s5327 :: SWord8 = if s5326 then s5292 else s5293 s5328 :: SWord8 = s5327 >>> 1 s5329 :: SWord8 = s14 | s5328 s5330 :: SWord8 = s16 & s5328 s5331 :: SWord8 = if s5324 then s5329 else s5330 s5332 :: SWord8 = s5331 >>> 1 s5333 :: SWord8 = s14 | s5332 s5334 :: SWord8 = s16 & s5332 s5335 :: SWord8 = if s5322 then s5333 else s5334 s5336 :: SWord1 = choose [0:0] s2309 s5337 :: SBool = s10 /= s5336 s5338 :: SWord8 = if s5337 then s5333 else s5334 s5339 :: SWord8 = if s2242 then s5335 else s5338 s5340 :: SWord1 = choose [0:0] s2325 s5341 :: SBool = s10 /= s5340 s5342 :: SWord1 = choose [0:0] s2318 s5343 :: SBool = s10 /= s5342 s5344 :: SWord8 = if s5343 then s5329 else s5330 s5345 :: SWord8 = s5344 >>> 1 s5346 :: SWord8 = s14 | s5345 s5347 :: SWord8 = s16 & s5345 s5348 :: SWord8 = if s5341 then s5346 else s5347 s5349 :: SWord1 = choose [0:0] s2330 s5350 :: SBool = s10 /= s5349 s5351 :: SWord8 = if s5350 then s5346 else s5347 s5352 :: SWord8 = if s2242 then s5348 else s5351 s5353 :: SWord8 = if s2118 then s5339 else s5352 s5354 :: SWord8 = if s2099 then s5320 else s5353 s5355 :: SWord8 = if s2080 then s5284 else s5354 s5356 :: SWord1 = choose [0:0] s2385 s5357 :: SBool = s10 /= s5356 s5358 :: SWord1 = choose [0:0] s2381 s5359 :: SBool = s10 /= s5358 s5360 :: SWord1 = choose [0:0] s2377 s5361 :: SBool = s10 /= s5360 s5362 :: SWord8 = s2364 >>> 1 s5363 :: SWord8 = s14 | s5362 s5364 :: SWord8 = s16 & s5362 s5365 :: SWord8 = if s5361 then s5363 else s5364 s5366 :: SWord8 = s5365 >>> 1 s5367 :: SWord8 = s14 | s5366 s5368 :: SWord8 = s16 & s5366 s5369 :: SWord8 = if s5359 then s5367 else s5368 s5370 :: SWord8 = s5369 >>> 1 s5371 :: SWord8 = s14 | s5370 s5372 :: SWord8 = s16 & s5370 s5373 :: SWord8 = if s5357 then s5371 else s5372 s5374 :: SWord1 = choose [0:0] s2390 s5375 :: SBool = s10 /= s5374 s5376 :: SWord8 = if s5375 then s5371 else s5372 s5377 :: SWord8 = if s2373 then s5373 else s5376 s5378 :: SWord1 = choose [0:0] s2406 s5379 :: SBool = s10 /= s5378 s5380 :: SWord1 = choose [0:0] s2399 s5381 :: SBool = s10 /= s5380 s5382 :: SWord8 = if s5381 then s5367 else s5368 s5383 :: SWord8 = s5382 >>> 1 s5384 :: SWord8 = s14 | s5383 s5385 :: SWord8 = s16 & s5383 s5386 :: SWord8 = if s5379 then s5384 else s5385 s5387 :: SWord1 = choose [0:0] s2411 s5388 :: SBool = s10 /= s5387 s5389 :: SWord8 = if s5388 then s5384 else s5385 s5390 :: SWord8 = if s2373 then s5386 else s5389 s5391 :: SWord8 = if s2351 then s5377 else s5390 s5392 :: SWord1 = choose [0:0] s2432 s5393 :: SBool = s10 /= s5392 s5394 :: SWord1 = choose [0:0] s2428 s5395 :: SBool = s10 /= s5394 s5396 :: SWord1 = choose [0:0] s2421 s5397 :: SBool = s10 /= s5396 s5398 :: SWord8 = if s5397 then s5363 else s5364 s5399 :: SWord8 = s5398 >>> 1 s5400 :: SWord8 = s14 | s5399 s5401 :: SWord8 = s16 & s5399 s5402 :: SWord8 = if s5395 then s5400 else s5401 s5403 :: SWord8 = s5402 >>> 1 s5404 :: SWord8 = s14 | s5403 s5405 :: SWord8 = s16 & s5403 s5406 :: SWord8 = if s5393 then s5404 else s5405 s5407 :: SWord1 = choose [0:0] s2437 s5408 :: SBool = s10 /= s5407 s5409 :: SWord8 = if s5408 then s5404 else s5405 s5410 :: SWord8 = if s2373 then s5406 else s5409 s5411 :: SWord1 = choose [0:0] s2453 s5412 :: SBool = s10 /= s5411 s5413 :: SWord1 = choose [0:0] s2446 s5414 :: SBool = s10 /= s5413 s5415 :: SWord8 = if s5414 then s5400 else s5401 s5416 :: SWord8 = s5415 >>> 1 s5417 :: SWord8 = s14 | s5416 s5418 :: SWord8 = s16 & s5416 s5419 :: SWord8 = if s5412 then s5417 else s5418 s5420 :: SWord1 = choose [0:0] s2458 s5421 :: SBool = s10 /= s5420 s5422 :: SWord8 = if s5421 then s5417 else s5418 s5423 :: SWord8 = if s2373 then s5419 else s5422 s5424 :: SWord8 = if s2351 then s5410 else s5423 s5425 :: SWord8 = if s2099 then s5391 else s5424 s5426 :: SWord1 = choose [0:0] s2493 s5427 :: SBool = s10 /= s5426 s5428 :: SWord1 = choose [0:0] s2489 s5429 :: SBool = s10 /= s5428 s5430 :: SWord1 = choose [0:0] s2485 s5431 :: SBool = s10 /= s5430 s5432 :: SWord8 = s2472 >>> 1 s5433 :: SWord8 = s14 | s5432 s5434 :: SWord8 = s16 & s5432 s5435 :: SWord8 = if s5431 then s5433 else s5434 s5436 :: SWord8 = s5435 >>> 1 s5437 :: SWord8 = s14 | s5436 s5438 :: SWord8 = s16 & s5436 s5439 :: SWord8 = if s5429 then s5437 else s5438 s5440 :: SWord8 = s5439 >>> 1 s5441 :: SWord8 = s14 | s5440 s5442 :: SWord8 = s16 & s5440 s5443 :: SWord8 = if s5427 then s5441 else s5442 s5444 :: SWord1 = choose [0:0] s2498 s5445 :: SBool = s10 /= s5444 s5446 :: SWord8 = if s5445 then s5441 else s5442 s5447 :: SWord8 = if s2478 then s5443 else s5446 s5448 :: SWord1 = choose [0:0] s2514 s5449 :: SBool = s10 /= s5448 s5450 :: SWord1 = choose [0:0] s2507 s5451 :: SBool = s10 /= s5450 s5452 :: SWord8 = if s5451 then s5437 else s5438 s5453 :: SWord8 = s5452 >>> 1 s5454 :: SWord8 = s14 | s5453 s5455 :: SWord8 = s16 & s5453 s5456 :: SWord8 = if s5449 then s5454 else s5455 s5457 :: SWord1 = choose [0:0] s2519 s5458 :: SBool = s10 /= s5457 s5459 :: SWord8 = if s5458 then s5454 else s5455 s5460 :: SWord8 = if s2478 then s5456 else s5459 s5461 :: SWord8 = if s2351 then s5447 else s5460 s5462 :: SWord1 = choose [0:0] s2540 s5463 :: SBool = s10 /= s5462 s5464 :: SWord1 = choose [0:0] s2536 s5465 :: SBool = s10 /= s5464 s5466 :: SWord1 = choose [0:0] s2529 s5467 :: SBool = s10 /= s5466 s5468 :: SWord8 = if s5467 then s5433 else s5434 s5469 :: SWord8 = s5468 >>> 1 s5470 :: SWord8 = s14 | s5469 s5471 :: SWord8 = s16 & s5469 s5472 :: SWord8 = if s5465 then s5470 else s5471 s5473 :: SWord8 = s5472 >>> 1 s5474 :: SWord8 = s14 | s5473 s5475 :: SWord8 = s16 & s5473 s5476 :: SWord8 = if s5463 then s5474 else s5475 s5477 :: SWord1 = choose [0:0] s2545 s5478 :: SBool = s10 /= s5477 s5479 :: SWord8 = if s5478 then s5474 else s5475 s5480 :: SWord8 = if s2478 then s5476 else s5479 s5481 :: SWord1 = choose [0:0] s2561 s5482 :: SBool = s10 /= s5481 s5483 :: SWord1 = choose [0:0] s2554 s5484 :: SBool = s10 /= s5483 s5485 :: SWord8 = if s5484 then s5470 else s5471 s5486 :: SWord8 = s5485 >>> 1 s5487 :: SWord8 = s14 | s5486 s5488 :: SWord8 = s16 & s5486 s5489 :: SWord8 = if s5482 then s5487 else s5488 s5490 :: SWord1 = choose [0:0] s2566 s5491 :: SBool = s10 /= s5490 s5492 :: SWord8 = if s5491 then s5487 else s5488 s5493 :: SWord8 = if s2478 then s5489 else s5492 s5494 :: SWord8 = if s2351 then s5480 else s5493 s5495 :: SWord8 = if s2099 then s5461 else s5494 s5496 :: SWord8 = if s2080 then s5425 else s5495 s5497 :: SWord8 = if s2063 then s5355 else s5496 s5498 :: SWord1 = choose [0:0] s2641 s5499 :: SBool = s10 /= s5498 s5500 :: SWord1 = choose [0:0] s2637 s5501 :: SBool = s10 /= s5500 s5502 :: SWord1 = choose [0:0] s2633 s5503 :: SBool = s10 /= s5502 s5504 :: SWord8 = s2620 >>> 1 s5505 :: SWord8 = s14 | s5504 s5506 :: SWord8 = s16 & s5504 s5507 :: SWord8 = if s5503 then s5505 else s5506 s5508 :: SWord8 = s5507 >>> 1 s5509 :: SWord8 = s14 | s5508 s5510 :: SWord8 = s16 & s5508 s5511 :: SWord8 = if s5501 then s5509 else s5510 s5512 :: SWord8 = s5511 >>> 1 s5513 :: SWord8 = s14 | s5512 s5514 :: SWord8 = s16 & s5512 s5515 :: SWord8 = if s5499 then s5513 else s5514 s5516 :: SWord1 = choose [0:0] s2646 s5517 :: SBool = s10 /= s5516 s5518 :: SWord8 = if s5517 then s5513 else s5514 s5519 :: SWord8 = if s2629 then s5515 else s5518 s5520 :: SWord1 = choose [0:0] s2662 s5521 :: SBool = s10 /= s5520 s5522 :: SWord1 = choose [0:0] s2655 s5523 :: SBool = s10 /= s5522 s5524 :: SWord8 = if s5523 then s5509 else s5510 s5525 :: SWord8 = s5524 >>> 1 s5526 :: SWord8 = s14 | s5525 s5527 :: SWord8 = s16 & s5525 s5528 :: SWord8 = if s5521 then s5526 else s5527 s5529 :: SWord1 = choose [0:0] s2667 s5530 :: SBool = s10 /= s5529 s5531 :: SWord8 = if s5530 then s5526 else s5527 s5532 :: SWord8 = if s2629 then s5528 else s5531 s5533 :: SWord8 = if s2610 then s5519 else s5532 s5534 :: SWord1 = choose [0:0] s2688 s5535 :: SBool = s10 /= s5534 s5536 :: SWord1 = choose [0:0] s2684 s5537 :: SBool = s10 /= s5536 s5538 :: SWord1 = choose [0:0] s2677 s5539 :: SBool = s10 /= s5538 s5540 :: SWord8 = if s5539 then s5505 else s5506 s5541 :: SWord8 = s5540 >>> 1 s5542 :: SWord8 = s14 | s5541 s5543 :: SWord8 = s16 & s5541 s5544 :: SWord8 = if s5537 then s5542 else s5543 s5545 :: SWord8 = s5544 >>> 1 s5546 :: SWord8 = s14 | s5545 s5547 :: SWord8 = s16 & s5545 s5548 :: SWord8 = if s5535 then s5546 else s5547 s5549 :: SWord1 = choose [0:0] s2693 s5550 :: SBool = s10 /= s5549 s5551 :: SWord8 = if s5550 then s5546 else s5547 s5552 :: SWord8 = if s2629 then s5548 else s5551 s5553 :: SWord1 = choose [0:0] s2709 s5554 :: SBool = s10 /= s5553 s5555 :: SWord1 = choose [0:0] s2702 s5556 :: SBool = s10 /= s5555 s5557 :: SWord8 = if s5556 then s5542 else s5543 s5558 :: SWord8 = s5557 >>> 1 s5559 :: SWord8 = s14 | s5558 s5560 :: SWord8 = s16 & s5558 s5561 :: SWord8 = if s5554 then s5559 else s5560 s5562 :: SWord1 = choose [0:0] s2714 s5563 :: SBool = s10 /= s5562 s5564 :: SWord8 = if s5563 then s5559 else s5560 s5565 :: SWord8 = if s2629 then s5561 else s5564 s5566 :: SWord8 = if s2610 then s5552 else s5565 s5567 :: SWord8 = if s2588 then s5533 else s5566 s5568 :: SWord1 = choose [0:0] s2749 s5569 :: SBool = s10 /= s5568 s5570 :: SWord1 = choose [0:0] s2745 s5571 :: SBool = s10 /= s5570 s5572 :: SWord1 = choose [0:0] s2741 s5573 :: SBool = s10 /= s5572 s5574 :: SWord8 = s2728 >>> 1 s5575 :: SWord8 = s14 | s5574 s5576 :: SWord8 = s16 & s5574 s5577 :: SWord8 = if s5573 then s5575 else s5576 s5578 :: SWord8 = s5577 >>> 1 s5579 :: SWord8 = s14 | s5578 s5580 :: SWord8 = s16 & s5578 s5581 :: SWord8 = if s5571 then s5579 else s5580 s5582 :: SWord8 = s5581 >>> 1 s5583 :: SWord8 = s14 | s5582 s5584 :: SWord8 = s16 & s5582 s5585 :: SWord8 = if s5569 then s5583 else s5584 s5586 :: SWord1 = choose [0:0] s2754 s5587 :: SBool = s10 /= s5586 s5588 :: SWord8 = if s5587 then s5583 else s5584 s5589 :: SWord8 = if s2734 then s5585 else s5588 s5590 :: SWord1 = choose [0:0] s2770 s5591 :: SBool = s10 /= s5590 s5592 :: SWord1 = choose [0:0] s2763 s5593 :: SBool = s10 /= s5592 s5594 :: SWord8 = if s5593 then s5579 else s5580 s5595 :: SWord8 = s5594 >>> 1 s5596 :: SWord8 = s14 | s5595 s5597 :: SWord8 = s16 & s5595 s5598 :: SWord8 = if s5591 then s5596 else s5597 s5599 :: SWord1 = choose [0:0] s2775 s5600 :: SBool = s10 /= s5599 s5601 :: SWord8 = if s5600 then s5596 else s5597 s5602 :: SWord8 = if s2734 then s5598 else s5601 s5603 :: SWord8 = if s2610 then s5589 else s5602 s5604 :: SWord1 = choose [0:0] s2796 s5605 :: SBool = s10 /= s5604 s5606 :: SWord1 = choose [0:0] s2792 s5607 :: SBool = s10 /= s5606 s5608 :: SWord1 = choose [0:0] s2785 s5609 :: SBool = s10 /= s5608 s5610 :: SWord8 = if s5609 then s5575 else s5576 s5611 :: SWord8 = s5610 >>> 1 s5612 :: SWord8 = s14 | s5611 s5613 :: SWord8 = s16 & s5611 s5614 :: SWord8 = if s5607 then s5612 else s5613 s5615 :: SWord8 = s5614 >>> 1 s5616 :: SWord8 = s14 | s5615 s5617 :: SWord8 = s16 & s5615 s5618 :: SWord8 = if s5605 then s5616 else s5617 s5619 :: SWord1 = choose [0:0] s2801 s5620 :: SBool = s10 /= s5619 s5621 :: SWord8 = if s5620 then s5616 else s5617 s5622 :: SWord8 = if s2734 then s5618 else s5621 s5623 :: SWord1 = choose [0:0] s2817 s5624 :: SBool = s10 /= s5623 s5625 :: SWord1 = choose [0:0] s2810 s5626 :: SBool = s10 /= s5625 s5627 :: SWord8 = if s5626 then s5612 else s5613 s5628 :: SWord8 = s5627 >>> 1 s5629 :: SWord8 = s14 | s5628 s5630 :: SWord8 = s16 & s5628 s5631 :: SWord8 = if s5624 then s5629 else s5630 s5632 :: SWord1 = choose [0:0] s2822 s5633 :: SBool = s10 /= s5632 s5634 :: SWord8 = if s5633 then s5629 else s5630 s5635 :: SWord8 = if s2734 then s5631 else s5634 s5636 :: SWord8 = if s2610 then s5622 else s5635 s5637 :: SWord8 = if s2588 then s5603 else s5636 s5638 :: SWord8 = if s2080 then s5567 else s5637 s5639 :: SWord1 = choose [0:0] s2877 s5640 :: SBool = s10 /= s5639 s5641 :: SWord1 = choose [0:0] s2873 s5642 :: SBool = s10 /= s5641 s5643 :: SWord1 = choose [0:0] s2869 s5644 :: SBool = s10 /= s5643 s5645 :: SWord8 = s2856 >>> 1 s5646 :: SWord8 = s14 | s5645 s5647 :: SWord8 = s16 & s5645 s5648 :: SWord8 = if s5644 then s5646 else s5647 s5649 :: SWord8 = s5648 >>> 1 s5650 :: SWord8 = s14 | s5649 s5651 :: SWord8 = s16 & s5649 s5652 :: SWord8 = if s5642 then s5650 else s5651 s5653 :: SWord8 = s5652 >>> 1 s5654 :: SWord8 = s14 | s5653 s5655 :: SWord8 = s16 & s5653 s5656 :: SWord8 = if s5640 then s5654 else s5655 s5657 :: SWord1 = choose [0:0] s2882 s5658 :: SBool = s10 /= s5657 s5659 :: SWord8 = if s5658 then s5654 else s5655 s5660 :: SWord8 = if s2865 then s5656 else s5659 s5661 :: SWord1 = choose [0:0] s2898 s5662 :: SBool = s10 /= s5661 s5663 :: SWord1 = choose [0:0] s2891 s5664 :: SBool = s10 /= s5663 s5665 :: SWord8 = if s5664 then s5650 else s5651 s5666 :: SWord8 = s5665 >>> 1 s5667 :: SWord8 = s14 | s5666 s5668 :: SWord8 = s16 & s5666 s5669 :: SWord8 = if s5662 then s5667 else s5668 s5670 :: SWord1 = choose [0:0] s2903 s5671 :: SBool = s10 /= s5670 s5672 :: SWord8 = if s5671 then s5667 else s5668 s5673 :: SWord8 = if s2865 then s5669 else s5672 s5674 :: SWord8 = if s2843 then s5660 else s5673 s5675 :: SWord1 = choose [0:0] s2924 s5676 :: SBool = s10 /= s5675 s5677 :: SWord1 = choose [0:0] s2920 s5678 :: SBool = s10 /= s5677 s5679 :: SWord1 = choose [0:0] s2913 s5680 :: SBool = s10 /= s5679 s5681 :: SWord8 = if s5680 then s5646 else s5647 s5682 :: SWord8 = s5681 >>> 1 s5683 :: SWord8 = s14 | s5682 s5684 :: SWord8 = s16 & s5682 s5685 :: SWord8 = if s5678 then s5683 else s5684 s5686 :: SWord8 = s5685 >>> 1 s5687 :: SWord8 = s14 | s5686 s5688 :: SWord8 = s16 & s5686 s5689 :: SWord8 = if s5676 then s5687 else s5688 s5690 :: SWord1 = choose [0:0] s2929 s5691 :: SBool = s10 /= s5690 s5692 :: SWord8 = if s5691 then s5687 else s5688 s5693 :: SWord8 = if s2865 then s5689 else s5692 s5694 :: SWord1 = choose [0:0] s2945 s5695 :: SBool = s10 /= s5694 s5696 :: SWord1 = choose [0:0] s2938 s5697 :: SBool = s10 /= s5696 s5698 :: SWord8 = if s5697 then s5683 else s5684 s5699 :: SWord8 = s5698 >>> 1 s5700 :: SWord8 = s14 | s5699 s5701 :: SWord8 = s16 & s5699 s5702 :: SWord8 = if s5695 then s5700 else s5701 s5703 :: SWord1 = choose [0:0] s2950 s5704 :: SBool = s10 /= s5703 s5705 :: SWord8 = if s5704 then s5700 else s5701 s5706 :: SWord8 = if s2865 then s5702 else s5705 s5707 :: SWord8 = if s2843 then s5693 else s5706 s5708 :: SWord8 = if s2588 then s5674 else s5707 s5709 :: SWord1 = choose [0:0] s2985 s5710 :: SBool = s10 /= s5709 s5711 :: SWord1 = choose [0:0] s2981 s5712 :: SBool = s10 /= s5711 s5713 :: SWord1 = choose [0:0] s2977 s5714 :: SBool = s10 /= s5713 s5715 :: SWord8 = s2964 >>> 1 s5716 :: SWord8 = s14 | s5715 s5717 :: SWord8 = s16 & s5715 s5718 :: SWord8 = if s5714 then s5716 else s5717 s5719 :: SWord8 = s5718 >>> 1 s5720 :: SWord8 = s14 | s5719 s5721 :: SWord8 = s16 & s5719 s5722 :: SWord8 = if s5712 then s5720 else s5721 s5723 :: SWord8 = s5722 >>> 1 s5724 :: SWord8 = s14 | s5723 s5725 :: SWord8 = s16 & s5723 s5726 :: SWord8 = if s5710 then s5724 else s5725 s5727 :: SWord1 = choose [0:0] s2990 s5728 :: SBool = s10 /= s5727 s5729 :: SWord8 = if s5728 then s5724 else s5725 s5730 :: SWord8 = if s2970 then s5726 else s5729 s5731 :: SWord1 = choose [0:0] s3006 s5732 :: SBool = s10 /= s5731 s5733 :: SWord1 = choose [0:0] s2999 s5734 :: SBool = s10 /= s5733 s5735 :: SWord8 = if s5734 then s5720 else s5721 s5736 :: SWord8 = s5735 >>> 1 s5737 :: SWord8 = s14 | s5736 s5738 :: SWord8 = s16 & s5736 s5739 :: SWord8 = if s5732 then s5737 else s5738 s5740 :: SWord1 = choose [0:0] s3011 s5741 :: SBool = s10 /= s5740 s5742 :: SWord8 = if s5741 then s5737 else s5738 s5743 :: SWord8 = if s2970 then s5739 else s5742 s5744 :: SWord8 = if s2843 then s5730 else s5743 s5745 :: SWord1 = choose [0:0] s3032 s5746 :: SBool = s10 /= s5745 s5747 :: SWord1 = choose [0:0] s3028 s5748 :: SBool = s10 /= s5747 s5749 :: SWord1 = choose [0:0] s3021 s5750 :: SBool = s10 /= s5749 s5751 :: SWord8 = if s5750 then s5716 else s5717 s5752 :: SWord8 = s5751 >>> 1 s5753 :: SWord8 = s14 | s5752 s5754 :: SWord8 = s16 & s5752 s5755 :: SWord8 = if s5748 then s5753 else s5754 s5756 :: SWord8 = s5755 >>> 1 s5757 :: SWord8 = s14 | s5756 s5758 :: SWord8 = s16 & s5756 s5759 :: SWord8 = if s5746 then s5757 else s5758 s5760 :: SWord1 = choose [0:0] s3037 s5761 :: SBool = s10 /= s5760 s5762 :: SWord8 = if s5761 then s5757 else s5758 s5763 :: SWord8 = if s2970 then s5759 else s5762 s5764 :: SWord1 = choose [0:0] s3053 s5765 :: SBool = s10 /= s5764 s5766 :: SWord1 = choose [0:0] s3046 s5767 :: SBool = s10 /= s5766 s5768 :: SWord8 = if s5767 then s5753 else s5754 s5769 :: SWord8 = s5768 >>> 1 s5770 :: SWord8 = s14 | s5769 s5771 :: SWord8 = s16 & s5769 s5772 :: SWord8 = if s5765 then s5770 else s5771 s5773 :: SWord1 = choose [0:0] s3058 s5774 :: SBool = s10 /= s5773 s5775 :: SWord8 = if s5774 then s5770 else s5771 s5776 :: SWord8 = if s2970 then s5772 else s5775 s5777 :: SWord8 = if s2843 then s5763 else s5776 s5778 :: SWord8 = if s2588 then s5744 else s5777 s5779 :: SWord8 = if s2080 then s5708 else s5778 s5780 :: SWord8 = if s2063 then s5638 else s5779 s5781 :: SWord8 = if s30 then s5497 else s5780 s5782 :: SWord1 = choose [0:0] s3153 s5783 :: SBool = s10 /= s5782 s5784 :: SWord1 = choose [0:0] s3149 s5785 :: SBool = s10 /= s5784 s5786 :: SWord1 = choose [0:0] s3145 s5787 :: SBool = s10 /= s5786 s5788 :: SWord8 = s3132 >>> 1 s5789 :: SWord8 = s14 | s5788 s5790 :: SWord8 = s16 & s5788 s5791 :: SWord8 = if s5787 then s5789 else s5790 s5792 :: SWord8 = s5791 >>> 1 s5793 :: SWord8 = s14 | s5792 s5794 :: SWord8 = s16 & s5792 s5795 :: SWord8 = if s5785 then s5793 else s5794 s5796 :: SWord8 = s5795 >>> 1 s5797 :: SWord8 = s14 | s5796 s5798 :: SWord8 = s16 & s5796 s5799 :: SWord8 = if s5783 then s5797 else s5798 s5800 :: SWord1 = choose [0:0] s3158 s5801 :: SBool = s10 /= s5800 s5802 :: SWord8 = if s5801 then s5797 else s5798 s5803 :: SWord8 = if s3141 then s5799 else s5802 s5804 :: SWord1 = choose [0:0] s3174 s5805 :: SBool = s10 /= s5804 s5806 :: SWord1 = choose [0:0] s3167 s5807 :: SBool = s10 /= s5806 s5808 :: SWord8 = if s5807 then s5793 else s5794 s5809 :: SWord8 = s5808 >>> 1 s5810 :: SWord8 = s14 | s5809 s5811 :: SWord8 = s16 & s5809 s5812 :: SWord8 = if s5805 then s5810 else s5811 s5813 :: SWord1 = choose [0:0] s3179 s5814 :: SBool = s10 /= s5813 s5815 :: SWord8 = if s5814 then s5810 else s5811 s5816 :: SWord8 = if s3141 then s5812 else s5815 s5817 :: SWord8 = if s3122 then s5803 else s5816 s5818 :: SWord1 = choose [0:0] s3200 s5819 :: SBool = s10 /= s5818 s5820 :: SWord1 = choose [0:0] s3196 s5821 :: SBool = s10 /= s5820 s5822 :: SWord1 = choose [0:0] s3189 s5823 :: SBool = s10 /= s5822 s5824 :: SWord8 = if s5823 then s5789 else s5790 s5825 :: SWord8 = s5824 >>> 1 s5826 :: SWord8 = s14 | s5825 s5827 :: SWord8 = s16 & s5825 s5828 :: SWord8 = if s5821 then s5826 else s5827 s5829 :: SWord8 = s5828 >>> 1 s5830 :: SWord8 = s14 | s5829 s5831 :: SWord8 = s16 & s5829 s5832 :: SWord8 = if s5819 then s5830 else s5831 s5833 :: SWord1 = choose [0:0] s3205 s5834 :: SBool = s10 /= s5833 s5835 :: SWord8 = if s5834 then s5830 else s5831 s5836 :: SWord8 = if s3141 then s5832 else s5835 s5837 :: SWord1 = choose [0:0] s3221 s5838 :: SBool = s10 /= s5837 s5839 :: SWord1 = choose [0:0] s3214 s5840 :: SBool = s10 /= s5839 s5841 :: SWord8 = if s5840 then s5826 else s5827 s5842 :: SWord8 = s5841 >>> 1 s5843 :: SWord8 = s14 | s5842 s5844 :: SWord8 = s16 & s5842 s5845 :: SWord8 = if s5838 then s5843 else s5844 s5846 :: SWord1 = choose [0:0] s3226 s5847 :: SBool = s10 /= s5846 s5848 :: SWord8 = if s5847 then s5843 else s5844 s5849 :: SWord8 = if s3141 then s5845 else s5848 s5850 :: SWord8 = if s3122 then s5836 else s5849 s5851 :: SWord8 = if s3103 then s5817 else s5850 s5852 :: SWord1 = choose [0:0] s3261 s5853 :: SBool = s10 /= s5852 s5854 :: SWord1 = choose [0:0] s3257 s5855 :: SBool = s10 /= s5854 s5856 :: SWord1 = choose [0:0] s3253 s5857 :: SBool = s10 /= s5856 s5858 :: SWord8 = s3240 >>> 1 s5859 :: SWord8 = s14 | s5858 s5860 :: SWord8 = s16 & s5858 s5861 :: SWord8 = if s5857 then s5859 else s5860 s5862 :: SWord8 = s5861 >>> 1 s5863 :: SWord8 = s14 | s5862 s5864 :: SWord8 = s16 & s5862 s5865 :: SWord8 = if s5855 then s5863 else s5864 s5866 :: SWord8 = s5865 >>> 1 s5867 :: SWord8 = s14 | s5866 s5868 :: SWord8 = s16 & s5866 s5869 :: SWord8 = if s5853 then s5867 else s5868 s5870 :: SWord1 = choose [0:0] s3266 s5871 :: SBool = s10 /= s5870 s5872 :: SWord8 = if s5871 then s5867 else s5868 s5873 :: SWord8 = if s3246 then s5869 else s5872 s5874 :: SWord1 = choose [0:0] s3282 s5875 :: SBool = s10 /= s5874 s5876 :: SWord1 = choose [0:0] s3275 s5877 :: SBool = s10 /= s5876 s5878 :: SWord8 = if s5877 then s5863 else s5864 s5879 :: SWord8 = s5878 >>> 1 s5880 :: SWord8 = s14 | s5879 s5881 :: SWord8 = s16 & s5879 s5882 :: SWord8 = if s5875 then s5880 else s5881 s5883 :: SWord1 = choose [0:0] s3287 s5884 :: SBool = s10 /= s5883 s5885 :: SWord8 = if s5884 then s5880 else s5881 s5886 :: SWord8 = if s3246 then s5882 else s5885 s5887 :: SWord8 = if s3122 then s5873 else s5886 s5888 :: SWord1 = choose [0:0] s3308 s5889 :: SBool = s10 /= s5888 s5890 :: SWord1 = choose [0:0] s3304 s5891 :: SBool = s10 /= s5890 s5892 :: SWord1 = choose [0:0] s3297 s5893 :: SBool = s10 /= s5892 s5894 :: SWord8 = if s5893 then s5859 else s5860 s5895 :: SWord8 = s5894 >>> 1 s5896 :: SWord8 = s14 | s5895 s5897 :: SWord8 = s16 & s5895 s5898 :: SWord8 = if s5891 then s5896 else s5897 s5899 :: SWord8 = s5898 >>> 1 s5900 :: SWord8 = s14 | s5899 s5901 :: SWord8 = s16 & s5899 s5902 :: SWord8 = if s5889 then s5900 else s5901 s5903 :: SWord1 = choose [0:0] s3313 s5904 :: SBool = s10 /= s5903 s5905 :: SWord8 = if s5904 then s5900 else s5901 s5906 :: SWord8 = if s3246 then s5902 else s5905 s5907 :: SWord1 = choose [0:0] s3329 s5908 :: SBool = s10 /= s5907 s5909 :: SWord1 = choose [0:0] s3322 s5910 :: SBool = s10 /= s5909 s5911 :: SWord8 = if s5910 then s5896 else s5897 s5912 :: SWord8 = s5911 >>> 1 s5913 :: SWord8 = s14 | s5912 s5914 :: SWord8 = s16 & s5912 s5915 :: SWord8 = if s5908 then s5913 else s5914 s5916 :: SWord1 = choose [0:0] s3334 s5917 :: SBool = s10 /= s5916 s5918 :: SWord8 = if s5917 then s5913 else s5914 s5919 :: SWord8 = if s3246 then s5915 else s5918 s5920 :: SWord8 = if s3122 then s5906 else s5919 s5921 :: SWord8 = if s3103 then s5887 else s5920 s5922 :: SWord8 = if s3081 then s5851 else s5921 s5923 :: SWord1 = choose [0:0] s3389 s5924 :: SBool = s10 /= s5923 s5925 :: SWord1 = choose [0:0] s3385 s5926 :: SBool = s10 /= s5925 s5927 :: SWord1 = choose [0:0] s3381 s5928 :: SBool = s10 /= s5927 s5929 :: SWord8 = s3368 >>> 1 s5930 :: SWord8 = s14 | s5929 s5931 :: SWord8 = s16 & s5929 s5932 :: SWord8 = if s5928 then s5930 else s5931 s5933 :: SWord8 = s5932 >>> 1 s5934 :: SWord8 = s14 | s5933 s5935 :: SWord8 = s16 & s5933 s5936 :: SWord8 = if s5926 then s5934 else s5935 s5937 :: SWord8 = s5936 >>> 1 s5938 :: SWord8 = s14 | s5937 s5939 :: SWord8 = s16 & s5937 s5940 :: SWord8 = if s5924 then s5938 else s5939 s5941 :: SWord1 = choose [0:0] s3394 s5942 :: SBool = s10 /= s5941 s5943 :: SWord8 = if s5942 then s5938 else s5939 s5944 :: SWord8 = if s3377 then s5940 else s5943 s5945 :: SWord1 = choose [0:0] s3410 s5946 :: SBool = s10 /= s5945 s5947 :: SWord1 = choose [0:0] s3403 s5948 :: SBool = s10 /= s5947 s5949 :: SWord8 = if s5948 then s5934 else s5935 s5950 :: SWord8 = s5949 >>> 1 s5951 :: SWord8 = s14 | s5950 s5952 :: SWord8 = s16 & s5950 s5953 :: SWord8 = if s5946 then s5951 else s5952 s5954 :: SWord1 = choose [0:0] s3415 s5955 :: SBool = s10 /= s5954 s5956 :: SWord8 = if s5955 then s5951 else s5952 s5957 :: SWord8 = if s3377 then s5953 else s5956 s5958 :: SWord8 = if s3355 then s5944 else s5957 s5959 :: SWord1 = choose [0:0] s3436 s5960 :: SBool = s10 /= s5959 s5961 :: SWord1 = choose [0:0] s3432 s5962 :: SBool = s10 /= s5961 s5963 :: SWord1 = choose [0:0] s3425 s5964 :: SBool = s10 /= s5963 s5965 :: SWord8 = if s5964 then s5930 else s5931 s5966 :: SWord8 = s5965 >>> 1 s5967 :: SWord8 = s14 | s5966 s5968 :: SWord8 = s16 & s5966 s5969 :: SWord8 = if s5962 then s5967 else s5968 s5970 :: SWord8 = s5969 >>> 1 s5971 :: SWord8 = s14 | s5970 s5972 :: SWord8 = s16 & s5970 s5973 :: SWord8 = if s5960 then s5971 else s5972 s5974 :: SWord1 = choose [0:0] s3441 s5975 :: SBool = s10 /= s5974 s5976 :: SWord8 = if s5975 then s5971 else s5972 s5977 :: SWord8 = if s3377 then s5973 else s5976 s5978 :: SWord1 = choose [0:0] s3457 s5979 :: SBool = s10 /= s5978 s5980 :: SWord1 = choose [0:0] s3450 s5981 :: SBool = s10 /= s5980 s5982 :: SWord8 = if s5981 then s5967 else s5968 s5983 :: SWord8 = s5982 >>> 1 s5984 :: SWord8 = s14 | s5983 s5985 :: SWord8 = s16 & s5983 s5986 :: SWord8 = if s5979 then s5984 else s5985 s5987 :: SWord1 = choose [0:0] s3462 s5988 :: SBool = s10 /= s5987 s5989 :: SWord8 = if s5988 then s5984 else s5985 s5990 :: SWord8 = if s3377 then s5986 else s5989 s5991 :: SWord8 = if s3355 then s5977 else s5990 s5992 :: SWord8 = if s3103 then s5958 else s5991 s5993 :: SWord1 = choose [0:0] s3497 s5994 :: SBool = s10 /= s5993 s5995 :: SWord1 = choose [0:0] s3493 s5996 :: SBool = s10 /= s5995 s5997 :: SWord1 = choose [0:0] s3489 s5998 :: SBool = s10 /= s5997 s5999 :: SWord8 = s3476 >>> 1 s6000 :: SWord8 = s14 | s5999 s6001 :: SWord8 = s16 & s5999 s6002 :: SWord8 = if s5998 then s6000 else s6001 s6003 :: SWord8 = s6002 >>> 1 s6004 :: SWord8 = s14 | s6003 s6005 :: SWord8 = s16 & s6003 s6006 :: SWord8 = if s5996 then s6004 else s6005 s6007 :: SWord8 = s6006 >>> 1 s6008 :: SWord8 = s14 | s6007 s6009 :: SWord8 = s16 & s6007 s6010 :: SWord8 = if s5994 then s6008 else s6009 s6011 :: SWord1 = choose [0:0] s3502 s6012 :: SBool = s10 /= s6011 s6013 :: SWord8 = if s6012 then s6008 else s6009 s6014 :: SWord8 = if s3482 then s6010 else s6013 s6015 :: SWord1 = choose [0:0] s3518 s6016 :: SBool = s10 /= s6015 s6017 :: SWord1 = choose [0:0] s3511 s6018 :: SBool = s10 /= s6017 s6019 :: SWord8 = if s6018 then s6004 else s6005 s6020 :: SWord8 = s6019 >>> 1 s6021 :: SWord8 = s14 | s6020 s6022 :: SWord8 = s16 & s6020 s6023 :: SWord8 = if s6016 then s6021 else s6022 s6024 :: SWord1 = choose [0:0] s3523 s6025 :: SBool = s10 /= s6024 s6026 :: SWord8 = if s6025 then s6021 else s6022 s6027 :: SWord8 = if s3482 then s6023 else s6026 s6028 :: SWord8 = if s3355 then s6014 else s6027 s6029 :: SWord1 = choose [0:0] s3544 s6030 :: SBool = s10 /= s6029 s6031 :: SWord1 = choose [0:0] s3540 s6032 :: SBool = s10 /= s6031 s6033 :: SWord1 = choose [0:0] s3533 s6034 :: SBool = s10 /= s6033 s6035 :: SWord8 = if s6034 then s6000 else s6001 s6036 :: SWord8 = s6035 >>> 1 s6037 :: SWord8 = s14 | s6036 s6038 :: SWord8 = s16 & s6036 s6039 :: SWord8 = if s6032 then s6037 else s6038 s6040 :: SWord8 = s6039 >>> 1 s6041 :: SWord8 = s14 | s6040 s6042 :: SWord8 = s16 & s6040 s6043 :: SWord8 = if s6030 then s6041 else s6042 s6044 :: SWord1 = choose [0:0] s3549 s6045 :: SBool = s10 /= s6044 s6046 :: SWord8 = if s6045 then s6041 else s6042 s6047 :: SWord8 = if s3482 then s6043 else s6046 s6048 :: SWord1 = choose [0:0] s3565 s6049 :: SBool = s10 /= s6048 s6050 :: SWord1 = choose [0:0] s3558 s6051 :: SBool = s10 /= s6050 s6052 :: SWord8 = if s6051 then s6037 else s6038 s6053 :: SWord8 = s6052 >>> 1 s6054 :: SWord8 = s14 | s6053 s6055 :: SWord8 = s16 & s6053 s6056 :: SWord8 = if s6049 then s6054 else s6055 s6057 :: SWord1 = choose [0:0] s3570 s6058 :: SBool = s10 /= s6057 s6059 :: SWord8 = if s6058 then s6054 else s6055 s6060 :: SWord8 = if s3482 then s6056 else s6059 s6061 :: SWord8 = if s3355 then s6047 else s6060 s6062 :: SWord8 = if s3103 then s6028 else s6061 s6063 :: SWord8 = if s3081 then s5992 else s6062 s6064 :: SWord8 = if s2063 then s5922 else s6063 s6065 :: SWord1 = choose [0:0] s3645 s6066 :: SBool = s10 /= s6065 s6067 :: SWord1 = choose [0:0] s3641 s6068 :: SBool = s10 /= s6067 s6069 :: SWord1 = choose [0:0] s3637 s6070 :: SBool = s10 /= s6069 s6071 :: SWord8 = s3624 >>> 1 s6072 :: SWord8 = s14 | s6071 s6073 :: SWord8 = s16 & s6071 s6074 :: SWord8 = if s6070 then s6072 else s6073 s6075 :: SWord8 = s6074 >>> 1 s6076 :: SWord8 = s14 | s6075 s6077 :: SWord8 = s16 & s6075 s6078 :: SWord8 = if s6068 then s6076 else s6077 s6079 :: SWord8 = s6078 >>> 1 s6080 :: SWord8 = s14 | s6079 s6081 :: SWord8 = s16 & s6079 s6082 :: SWord8 = if s6066 then s6080 else s6081 s6083 :: SWord1 = choose [0:0] s3650 s6084 :: SBool = s10 /= s6083 s6085 :: SWord8 = if s6084 then s6080 else s6081 s6086 :: SWord8 = if s3633 then s6082 else s6085 s6087 :: SWord1 = choose [0:0] s3666 s6088 :: SBool = s10 /= s6087 s6089 :: SWord1 = choose [0:0] s3659 s6090 :: SBool = s10 /= s6089 s6091 :: SWord8 = if s6090 then s6076 else s6077 s6092 :: SWord8 = s6091 >>> 1 s6093 :: SWord8 = s14 | s6092 s6094 :: SWord8 = s16 & s6092 s6095 :: SWord8 = if s6088 then s6093 else s6094 s6096 :: SWord1 = choose [0:0] s3671 s6097 :: SBool = s10 /= s6096 s6098 :: SWord8 = if s6097 then s6093 else s6094 s6099 :: SWord8 = if s3633 then s6095 else s6098 s6100 :: SWord8 = if s3614 then s6086 else s6099 s6101 :: SWord1 = choose [0:0] s3692 s6102 :: SBool = s10 /= s6101 s6103 :: SWord1 = choose [0:0] s3688 s6104 :: SBool = s10 /= s6103 s6105 :: SWord1 = choose [0:0] s3681 s6106 :: SBool = s10 /= s6105 s6107 :: SWord8 = if s6106 then s6072 else s6073 s6108 :: SWord8 = s6107 >>> 1 s6109 :: SWord8 = s14 | s6108 s6110 :: SWord8 = s16 & s6108 s6111 :: SWord8 = if s6104 then s6109 else s6110 s6112 :: SWord8 = s6111 >>> 1 s6113 :: SWord8 = s14 | s6112 s6114 :: SWord8 = s16 & s6112 s6115 :: SWord8 = if s6102 then s6113 else s6114 s6116 :: SWord1 = choose [0:0] s3697 s6117 :: SBool = s10 /= s6116 s6118 :: SWord8 = if s6117 then s6113 else s6114 s6119 :: SWord8 = if s3633 then s6115 else s6118 s6120 :: SWord1 = choose [0:0] s3713 s6121 :: SBool = s10 /= s6120 s6122 :: SWord1 = choose [0:0] s3706 s6123 :: SBool = s10 /= s6122 s6124 :: SWord8 = if s6123 then s6109 else s6110 s6125 :: SWord8 = s6124 >>> 1 s6126 :: SWord8 = s14 | s6125 s6127 :: SWord8 = s16 & s6125 s6128 :: SWord8 = if s6121 then s6126 else s6127 s6129 :: SWord1 = choose [0:0] s3718 s6130 :: SBool = s10 /= s6129 s6131 :: SWord8 = if s6130 then s6126 else s6127 s6132 :: SWord8 = if s3633 then s6128 else s6131 s6133 :: SWord8 = if s3614 then s6119 else s6132 s6134 :: SWord8 = if s3592 then s6100 else s6133 s6135 :: SWord1 = choose [0:0] s3753 s6136 :: SBool = s10 /= s6135 s6137 :: SWord1 = choose [0:0] s3749 s6138 :: SBool = s10 /= s6137 s6139 :: SWord1 = choose [0:0] s3745 s6140 :: SBool = s10 /= s6139 s6141 :: SWord8 = s3732 >>> 1 s6142 :: SWord8 = s14 | s6141 s6143 :: SWord8 = s16 & s6141 s6144 :: SWord8 = if s6140 then s6142 else s6143 s6145 :: SWord8 = s6144 >>> 1 s6146 :: SWord8 = s14 | s6145 s6147 :: SWord8 = s16 & s6145 s6148 :: SWord8 = if s6138 then s6146 else s6147 s6149 :: SWord8 = s6148 >>> 1 s6150 :: SWord8 = s14 | s6149 s6151 :: SWord8 = s16 & s6149 s6152 :: SWord8 = if s6136 then s6150 else s6151 s6153 :: SWord1 = choose [0:0] s3758 s6154 :: SBool = s10 /= s6153 s6155 :: SWord8 = if s6154 then s6150 else s6151 s6156 :: SWord8 = if s3738 then s6152 else s6155 s6157 :: SWord1 = choose [0:0] s3774 s6158 :: SBool = s10 /= s6157 s6159 :: SWord1 = choose [0:0] s3767 s6160 :: SBool = s10 /= s6159 s6161 :: SWord8 = if s6160 then s6146 else s6147 s6162 :: SWord8 = s6161 >>> 1 s6163 :: SWord8 = s14 | s6162 s6164 :: SWord8 = s16 & s6162 s6165 :: SWord8 = if s6158 then s6163 else s6164 s6166 :: SWord1 = choose [0:0] s3779 s6167 :: SBool = s10 /= s6166 s6168 :: SWord8 = if s6167 then s6163 else s6164 s6169 :: SWord8 = if s3738 then s6165 else s6168 s6170 :: SWord8 = if s3614 then s6156 else s6169 s6171 :: SWord1 = choose [0:0] s3800 s6172 :: SBool = s10 /= s6171 s6173 :: SWord1 = choose [0:0] s3796 s6174 :: SBool = s10 /= s6173 s6175 :: SWord1 = choose [0:0] s3789 s6176 :: SBool = s10 /= s6175 s6177 :: SWord8 = if s6176 then s6142 else s6143 s6178 :: SWord8 = s6177 >>> 1 s6179 :: SWord8 = s14 | s6178 s6180 :: SWord8 = s16 & s6178 s6181 :: SWord8 = if s6174 then s6179 else s6180 s6182 :: SWord8 = s6181 >>> 1 s6183 :: SWord8 = s14 | s6182 s6184 :: SWord8 = s16 & s6182 s6185 :: SWord8 = if s6172 then s6183 else s6184 s6186 :: SWord1 = choose [0:0] s3805 s6187 :: SBool = s10 /= s6186 s6188 :: SWord8 = if s6187 then s6183 else s6184 s6189 :: SWord8 = if s3738 then s6185 else s6188 s6190 :: SWord1 = choose [0:0] s3821 s6191 :: SBool = s10 /= s6190 s6192 :: SWord1 = choose [0:0] s3814 s6193 :: SBool = s10 /= s6192 s6194 :: SWord8 = if s6193 then s6179 else s6180 s6195 :: SWord8 = s6194 >>> 1 s6196 :: SWord8 = s14 | s6195 s6197 :: SWord8 = s16 & s6195 s6198 :: SWord8 = if s6191 then s6196 else s6197 s6199 :: SWord1 = choose [0:0] s3826 s6200 :: SBool = s10 /= s6199 s6201 :: SWord8 = if s6200 then s6196 else s6197 s6202 :: SWord8 = if s3738 then s6198 else s6201 s6203 :: SWord8 = if s3614 then s6189 else s6202 s6204 :: SWord8 = if s3592 then s6170 else s6203 s6205 :: SWord8 = if s3081 then s6134 else s6204 s6206 :: SWord1 = choose [0:0] s3881 s6207 :: SBool = s10 /= s6206 s6208 :: SWord1 = choose [0:0] s3877 s6209 :: SBool = s10 /= s6208 s6210 :: SWord1 = choose [0:0] s3873 s6211 :: SBool = s10 /= s6210 s6212 :: SWord8 = s3860 >>> 1 s6213 :: SWord8 = s14 | s6212 s6214 :: SWord8 = s16 & s6212 s6215 :: SWord8 = if s6211 then s6213 else s6214 s6216 :: SWord8 = s6215 >>> 1 s6217 :: SWord8 = s14 | s6216 s6218 :: SWord8 = s16 & s6216 s6219 :: SWord8 = if s6209 then s6217 else s6218 s6220 :: SWord8 = s6219 >>> 1 s6221 :: SWord8 = s14 | s6220 s6222 :: SWord8 = s16 & s6220 s6223 :: SWord8 = if s6207 then s6221 else s6222 s6224 :: SWord1 = choose [0:0] s3886 s6225 :: SBool = s10 /= s6224 s6226 :: SWord8 = if s6225 then s6221 else s6222 s6227 :: SWord8 = if s3869 then s6223 else s6226 s6228 :: SWord1 = choose [0:0] s3902 s6229 :: SBool = s10 /= s6228 s6230 :: SWord1 = choose [0:0] s3895 s6231 :: SBool = s10 /= s6230 s6232 :: SWord8 = if s6231 then s6217 else s6218 s6233 :: SWord8 = s6232 >>> 1 s6234 :: SWord8 = s14 | s6233 s6235 :: SWord8 = s16 & s6233 s6236 :: SWord8 = if s6229 then s6234 else s6235 s6237 :: SWord1 = choose [0:0] s3907 s6238 :: SBool = s10 /= s6237 s6239 :: SWord8 = if s6238 then s6234 else s6235 s6240 :: SWord8 = if s3869 then s6236 else s6239 s6241 :: SWord8 = if s3847 then s6227 else s6240 s6242 :: SWord1 = choose [0:0] s3928 s6243 :: SBool = s10 /= s6242 s6244 :: SWord1 = choose [0:0] s3924 s6245 :: SBool = s10 /= s6244 s6246 :: SWord1 = choose [0:0] s3917 s6247 :: SBool = s10 /= s6246 s6248 :: SWord8 = if s6247 then s6213 else s6214 s6249 :: SWord8 = s6248 >>> 1 s6250 :: SWord8 = s14 | s6249 s6251 :: SWord8 = s16 & s6249 s6252 :: SWord8 = if s6245 then s6250 else s6251 s6253 :: SWord8 = s6252 >>> 1 s6254 :: SWord8 = s14 | s6253 s6255 :: SWord8 = s16 & s6253 s6256 :: SWord8 = if s6243 then s6254 else s6255 s6257 :: SWord1 = choose [0:0] s3933 s6258 :: SBool = s10 /= s6257 s6259 :: SWord8 = if s6258 then s6254 else s6255 s6260 :: SWord8 = if s3869 then s6256 else s6259 s6261 :: SWord1 = choose [0:0] s3949 s6262 :: SBool = s10 /= s6261 s6263 :: SWord1 = choose [0:0] s3942 s6264 :: SBool = s10 /= s6263 s6265 :: SWord8 = if s6264 then s6250 else s6251 s6266 :: SWord8 = s6265 >>> 1 s6267 :: SWord8 = s14 | s6266 s6268 :: SWord8 = s16 & s6266 s6269 :: SWord8 = if s6262 then s6267 else s6268 s6270 :: SWord1 = choose [0:0] s3954 s6271 :: SBool = s10 /= s6270 s6272 :: SWord8 = if s6271 then s6267 else s6268 s6273 :: SWord8 = if s3869 then s6269 else s6272 s6274 :: SWord8 = if s3847 then s6260 else s6273 s6275 :: SWord8 = if s3592 then s6241 else s6274 s6276 :: SWord1 = choose [0:0] s3989 s6277 :: SBool = s10 /= s6276 s6278 :: SWord1 = choose [0:0] s3985 s6279 :: SBool = s10 /= s6278 s6280 :: SWord1 = choose [0:0] s3981 s6281 :: SBool = s10 /= s6280 s6282 :: SWord8 = s3968 >>> 1 s6283 :: SWord8 = s14 | s6282 s6284 :: SWord8 = s16 & s6282 s6285 :: SWord8 = if s6281 then s6283 else s6284 s6286 :: SWord8 = s6285 >>> 1 s6287 :: SWord8 = s14 | s6286 s6288 :: SWord8 = s16 & s6286 s6289 :: SWord8 = if s6279 then s6287 else s6288 s6290 :: SWord8 = s6289 >>> 1 s6291 :: SWord8 = s14 | s6290 s6292 :: SWord8 = s16 & s6290 s6293 :: SWord8 = if s6277 then s6291 else s6292 s6294 :: SWord1 = choose [0:0] s3994 s6295 :: SBool = s10 /= s6294 s6296 :: SWord8 = if s6295 then s6291 else s6292 s6297 :: SWord8 = if s3974 then s6293 else s6296 s6298 :: SWord1 = choose [0:0] s4010 s6299 :: SBool = s10 /= s6298 s6300 :: SWord1 = choose [0:0] s4003 s6301 :: SBool = s10 /= s6300 s6302 :: SWord8 = if s6301 then s6287 else s6288 s6303 :: SWord8 = s6302 >>> 1 s6304 :: SWord8 = s14 | s6303 s6305 :: SWord8 = s16 & s6303 s6306 :: SWord8 = if s6299 then s6304 else s6305 s6307 :: SWord1 = choose [0:0] s4015 s6308 :: SBool = s10 /= s6307 s6309 :: SWord8 = if s6308 then s6304 else s6305 s6310 :: SWord8 = if s3974 then s6306 else s6309 s6311 :: SWord8 = if s3847 then s6297 else s6310 s6312 :: SWord1 = choose [0:0] s4036 s6313 :: SBool = s10 /= s6312 s6314 :: SWord1 = choose [0:0] s4032 s6315 :: SBool = s10 /= s6314 s6316 :: SWord1 = choose [0:0] s4025 s6317 :: SBool = s10 /= s6316 s6318 :: SWord8 = if s6317 then s6283 else s6284 s6319 :: SWord8 = s6318 >>> 1 s6320 :: SWord8 = s14 | s6319 s6321 :: SWord8 = s16 & s6319 s6322 :: SWord8 = if s6315 then s6320 else s6321 s6323 :: SWord8 = s6322 >>> 1 s6324 :: SWord8 = s14 | s6323 s6325 :: SWord8 = s16 & s6323 s6326 :: SWord8 = if s6313 then s6324 else s6325 s6327 :: SWord1 = choose [0:0] s4041 s6328 :: SBool = s10 /= s6327 s6329 :: SWord8 = if s6328 then s6324 else s6325 s6330 :: SWord8 = if s3974 then s6326 else s6329 s6331 :: SWord1 = choose [0:0] s4057 s6332 :: SBool = s10 /= s6331 s6333 :: SWord1 = choose [0:0] s4050 s6334 :: SBool = s10 /= s6333 s6335 :: SWord8 = if s6334 then s6320 else s6321 s6336 :: SWord8 = s6335 >>> 1 s6337 :: SWord8 = s14 | s6336 s6338 :: SWord8 = s16 & s6336 s6339 :: SWord8 = if s6332 then s6337 else s6338 s6340 :: SWord1 = choose [0:0] s4062 s6341 :: SBool = s10 /= s6340 s6342 :: SWord8 = if s6341 then s6337 else s6338 s6343 :: SWord8 = if s3974 then s6339 else s6342 s6344 :: SWord8 = if s3847 then s6330 else s6343 s6345 :: SWord8 = if s3592 then s6311 else s6344 s6346 :: SWord8 = if s3081 then s6275 else s6345 s6347 :: SWord8 = if s2063 then s6205 else s6346 s6348 :: SWord8 = if s30 then s6064 else s6347 s6349 :: SWord8 = if s21 then s5781 else s6348 s6350 :: SWord8 = if s12 then s5214 else s6349 s6351 :: SWord16 = s8 # s6350 s6352 :: SWord16 = s4079 + s6351 s6353 :: SWord16 = s8 # s0 s6354 :: SWord16 = s8 # s1 s6355 :: SWord16 = s6353 * s6354 s6356 :: SBool = s6352 == s6355 CONSTRAINTS ASSERTIONS OUTPUTS s6356sbv-7.13/SBVTestSuite/GoldFiles/legato_c.gold0000644000000000000000000100203213405536617017234 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for legatoMult. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: legatoMult_driver legatoMult.o: legatoMult.c legatoMult.h ${CC} ${CCFLAGS} -c $< -o $@ legatoMult_driver.o: legatoMult_driver.c ${CC} ${CCFLAGS} -c $< -o $@ legatoMult_driver: legatoMult.o legatoMult_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f legatoMult_driver == END: "Makefile" ================== == BEGIN: "legatoMult.h" ================ /* Header file for legatoMult. Automatically generated by SBV. Do not edit! */ #ifndef __legatoMult__HEADER_INCLUDED__ #define __legatoMult__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ void legatoMult(const SWord8 x, const SWord8 y, SWord8 *hi, SWord8 *lo); #endif /* __legatoMult__HEADER_INCLUDED__ */ == END: "legatoMult.h" ================== == BEGIN: "legatoMult_driver.c" ================ /* Example driver program for legatoMult. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "legatoMult.h" int main(void) { SWord8 hi; SWord8 lo; legatoMult(87, 92, &hi, &lo); printf("legatoMult(87, 92, &hi, &lo) ->\n"); printf(" hi = %"PRIu8"\n", hi); printf(" lo = %"PRIu8"\n", lo); return 0; } == END: "legatoMult_driver.c" ================== == BEGIN: "legatoMult.c" ================ /* File: "legatoMult.c". Automatically generated by SBV. Do not edit! */ #include "legatoMult.h" void legatoMult(const SWord8 x, const SWord8 y, SWord8 *hi, SWord8 *lo) { const SWord8 s0 = x; const SWord8 s1 = y; const SBool s2 = (SBool) (s0 & 1); const SBool s4 = s2 != false; const SBool s5 = false == s4; const SWord8 s6 = (s0 >> 1) | (s0 << 7); const SWord8 s8 = s6 & 127; const SBool s9 = (SBool) (s8 & 1); const SBool s10 = false != s9; const SBool s11 = false == s10; const SWord8 s12 = (s8 >> 1) | (s8 << 7); const SWord8 s13 = 127 & s12; const SBool s14 = (SBool) (s13 & 1); const SBool s15 = false != s14; const SBool s16 = false == s15; const SWord8 s17 = (s13 >> 1) | (s13 << 7); const SWord8 s18 = 127 & s17; const SBool s19 = (SBool) (s18 & 1); const SBool s20 = false != s19; const SBool s21 = false == s20; const SWord8 s24 = s4 ? 128 : 0; const SBool s25 = (SBool) (s24 & 1); const SBool s26 = false != s25; const SWord8 s27 = s26 ? 128 : 0; const SBool s28 = (SBool) (s27 & 1); const SBool s29 = false != s28; const SWord8 s30 = (s18 >> 1) | (s18 << 7); const SWord8 s31 = 128 | s30; const SWord8 s32 = 127 & s30; const SWord8 s33 = s29 ? s31 : s32; const SBool s34 = (SBool) (s33 & 1); const SBool s35 = false != s34; const SBool s36 = false == s35; const SWord8 s37 = (s24 >> 1) | (s24 << 7); const SWord8 s38 = 128 | s37; const SWord8 s39 = 127 & s37; const SWord8 s40 = s10 ? s38 : s39; const SBool s41 = (SBool) (s40 & 1); const SBool s42 = false != s41; const SWord8 s43 = (s27 >> 1) | (s27 << 7); const SWord8 s44 = 128 | s43; const SWord8 s45 = 127 & s43; const SWord8 s46 = s42 ? s44 : s45; const SBool s47 = (SBool) (s46 & 1); const SBool s48 = false != s47; const SWord8 s49 = (s33 >> 1) | (s33 << 7); const SWord8 s50 = 128 | s49; const SWord8 s51 = 127 & s49; const SWord8 s52 = s48 ? s50 : s51; const SBool s53 = (SBool) (s52 & 1); const SBool s54 = false != s53; const SBool s55 = false == s54; const SWord8 s56 = (s40 >> 1) | (s40 << 7); const SWord8 s57 = 128 | s56; const SWord8 s58 = 127 & s56; const SWord8 s59 = s15 ? s57 : s58; const SBool s60 = (SBool) (s59 & 1); const SBool s61 = false != s60; const SWord8 s62 = (s46 >> 1) | (s46 << 7); const SWord8 s63 = 128 | s62; const SWord8 s64 = 127 & s62; const SWord8 s65 = s61 ? s63 : s64; const SBool s66 = (SBool) (s65 & 1); const SBool s67 = false != s66; const SWord8 s68 = (s52 >> 1) | (s52 << 7); const SWord8 s69 = 128 | s68; const SWord8 s70 = 127 & s68; const SWord8 s71 = s67 ? s69 : s70; const SBool s72 = (SBool) (s71 & 1); const SBool s73 = false != s72; const SBool s74 = false == s73; const SWord8 s75 = (s59 >> 1) | (s59 << 7); const SWord8 s76 = 128 | s75; const SWord8 s77 = 127 & s75; const SWord8 s78 = s20 ? s76 : s77; const SBool s79 = (SBool) (s78 & 1); const SBool s80 = false != s79; const SWord8 s81 = (s65 >> 1) | (s65 << 7); const SWord8 s82 = 128 | s81; const SWord8 s83 = 127 & s81; const SWord8 s84 = s80 ? s82 : s83; const SBool s85 = (SBool) (s84 & 1); const SBool s86 = false != s85; const SWord8 s87 = (s71 >> 1) | (s71 << 7); const SWord8 s88 = 128 | s87; const SWord8 s89 = 127 & s87; const SWord8 s90 = s86 ? s88 : s89; const SBool s91 = (SBool) (s90 & 1); const SBool s92 = false != s91; const SBool s93 = false == s92; const SWord8 s94 = (s78 >> 1) | (s78 << 7); const SWord8 s95 = 128 | s94; const SWord8 s96 = 127 & s94; const SWord8 s97 = s35 ? s95 : s96; const SWord8 s98 = (s97 >> 1) | (s97 << 7); const SWord8 s99 = 128 | s98; const SWord8 s100 = 127 & s98; const SWord8 s101 = s54 ? s99 : s100; const SWord8 s102 = (s101 >> 1) | (s101 << 7); const SWord8 s103 = 128 | s102; const SWord8 s104 = 127 & s102; const SWord8 s105 = s73 ? s103 : s104; const SWord8 s106 = (s105 >> 1) | (s105 << 7); const SWord8 s107 = 128 | s106; const SWord8 s108 = 127 & s106; const SWord8 s109 = s92 ? s107 : s108; const SWord8 s110 = s1 + s105; const SBool s111 = s110 < s1; const SBool s112 = s110 < s105; const SBool s113 = s111 || s112; const SWord8 s114 = (s110 >> 1) | (s110 << 7); const SWord8 s115 = 128 | s114; const SWord8 s116 = 127 & s114; const SWord8 s117 = s113 ? s115 : s116; const SWord8 s118 = s93 ? s109 : s117; const SWord8 s119 = s1 + s101; const SBool s120 = s119 < s1; const SBool s121 = s119 < s101; const SBool s122 = s120 || s121; const SWord8 s123 = (s119 >> 1) | (s119 << 7); const SWord8 s124 = 128 | s123; const SWord8 s125 = 127 & s123; const SWord8 s126 = s122 ? s124 : s125; const SWord8 s127 = (s126 >> 1) | (s126 << 7); const SWord8 s128 = 128 | s127; const SWord8 s129 = 127 & s127; const SWord8 s130 = s92 ? s128 : s129; const SWord8 s131 = s1 + s126; const SBool s132 = s131 < s1; const SBool s133 = s131 < s126; const SBool s134 = s132 || s133; const SWord8 s135 = (s131 >> 1) | (s131 << 7); const SWord8 s136 = 128 | s135; const SWord8 s137 = 127 & s135; const SWord8 s138 = s134 ? s136 : s137; const SWord8 s139 = s93 ? s130 : s138; const SWord8 s140 = s74 ? s118 : s139; const SWord8 s141 = s1 + s97; const SBool s142 = s141 < s1; const SBool s143 = s141 < s97; const SBool s144 = s142 || s143; const SWord8 s145 = (s141 >> 1) | (s141 << 7); const SWord8 s146 = 128 | s145; const SWord8 s147 = 127 & s145; const SWord8 s148 = s144 ? s146 : s147; const SWord8 s149 = (s148 >> 1) | (s148 << 7); const SWord8 s150 = 128 | s149; const SWord8 s151 = 127 & s149; const SWord8 s152 = s73 ? s150 : s151; const SWord8 s153 = (s152 >> 1) | (s152 << 7); const SWord8 s154 = 128 | s153; const SWord8 s155 = 127 & s153; const SWord8 s156 = s92 ? s154 : s155; const SWord8 s157 = s1 + s152; const SBool s158 = s157 < s1; const SBool s159 = s157 < s152; const SBool s160 = s158 || s159; const SWord8 s161 = (s157 >> 1) | (s157 << 7); const SWord8 s162 = 128 | s161; const SWord8 s163 = 127 & s161; const SWord8 s164 = s160 ? s162 : s163; const SWord8 s165 = s93 ? s156 : s164; const SWord8 s166 = s1 + s148; const SBool s167 = s166 < s1; const SBool s168 = s166 < s148; const SBool s169 = s167 || s168; const SWord8 s170 = (s166 >> 1) | (s166 << 7); const SWord8 s171 = 128 | s170; const SWord8 s172 = 127 & s170; const SWord8 s173 = s169 ? s171 : s172; const SWord8 s174 = (s173 >> 1) | (s173 << 7); const SWord8 s175 = 128 | s174; const SWord8 s176 = 127 & s174; const SWord8 s177 = s92 ? s175 : s176; const SWord8 s178 = s1 + s173; const SBool s179 = s178 < s1; const SBool s180 = s178 < s173; const SBool s181 = s179 || s180; const SWord8 s182 = (s178 >> 1) | (s178 << 7); const SWord8 s183 = 128 | s182; const SWord8 s184 = 127 & s182; const SWord8 s185 = s181 ? s183 : s184; const SWord8 s186 = s93 ? s177 : s185; const SWord8 s187 = s74 ? s165 : s186; const SWord8 s188 = s55 ? s140 : s187; const SWord8 s189 = s1 + s78; const SBool s190 = (SBool) (s189 & 1); const SBool s191 = false != s190; const SWord8 s192 = s191 ? s82 : s83; const SBool s193 = (SBool) (s192 & 1); const SBool s194 = false != s193; const SWord8 s195 = s194 ? s88 : s89; const SBool s196 = (SBool) (s195 & 1); const SBool s197 = false != s196; const SBool s198 = false == s197; const SBool s199 = s189 < s1; const SBool s200 = s189 < s78; const SBool s201 = s199 || s200; const SWord8 s202 = (s189 >> 1) | (s189 << 7); const SWord8 s203 = 128 | s202; const SWord8 s204 = 127 & s202; const SWord8 s205 = s201 ? s203 : s204; const SWord8 s206 = (s205 >> 1) | (s205 << 7); const SWord8 s207 = 128 | s206; const SWord8 s208 = 127 & s206; const SWord8 s209 = s54 ? s207 : s208; const SWord8 s210 = (s209 >> 1) | (s209 << 7); const SWord8 s211 = 128 | s210; const SWord8 s212 = 127 & s210; const SWord8 s213 = s73 ? s211 : s212; const SWord8 s214 = (s213 >> 1) | (s213 << 7); const SWord8 s215 = 128 | s214; const SWord8 s216 = 127 & s214; const SWord8 s217 = s197 ? s215 : s216; const SWord8 s218 = s1 + s213; const SBool s219 = s218 < s1; const SBool s220 = s218 < s213; const SBool s221 = s219 || s220; const SWord8 s222 = (s218 >> 1) | (s218 << 7); const SWord8 s223 = 128 | s222; const SWord8 s224 = 127 & s222; const SWord8 s225 = s221 ? s223 : s224; const SWord8 s226 = s198 ? s217 : s225; const SWord8 s227 = s1 + s209; const SBool s228 = s227 < s1; const SBool s229 = s227 < s209; const SBool s230 = s228 || s229; const SWord8 s231 = (s227 >> 1) | (s227 << 7); const SWord8 s232 = 128 | s231; const SWord8 s233 = 127 & s231; const SWord8 s234 = s230 ? s232 : s233; const SWord8 s235 = (s234 >> 1) | (s234 << 7); const SWord8 s236 = 128 | s235; const SWord8 s237 = 127 & s235; const SWord8 s238 = s197 ? s236 : s237; const SWord8 s239 = s1 + s234; const SBool s240 = s239 < s1; const SBool s241 = s239 < s234; const SBool s242 = s240 || s241; const SWord8 s243 = (s239 >> 1) | (s239 << 7); const SWord8 s244 = 128 | s243; const SWord8 s245 = 127 & s243; const SWord8 s246 = s242 ? s244 : s245; const SWord8 s247 = s198 ? s238 : s246; const SWord8 s248 = s74 ? s226 : s247; const SWord8 s249 = s1 + s205; const SBool s250 = s249 < s1; const SBool s251 = s249 < s205; const SBool s252 = s250 || s251; const SWord8 s253 = (s249 >> 1) | (s249 << 7); const SWord8 s254 = 128 | s253; const SWord8 s255 = 127 & s253; const SWord8 s256 = s252 ? s254 : s255; const SWord8 s257 = (s256 >> 1) | (s256 << 7); const SWord8 s258 = 128 | s257; const SWord8 s259 = 127 & s257; const SWord8 s260 = s73 ? s258 : s259; const SWord8 s261 = (s260 >> 1) | (s260 << 7); const SWord8 s262 = 128 | s261; const SWord8 s263 = 127 & s261; const SWord8 s264 = s197 ? s262 : s263; const SWord8 s265 = s1 + s260; const SBool s266 = s265 < s1; const SBool s267 = s265 < s260; const SBool s268 = s266 || s267; const SWord8 s269 = (s265 >> 1) | (s265 << 7); const SWord8 s270 = 128 | s269; const SWord8 s271 = 127 & s269; const SWord8 s272 = s268 ? s270 : s271; const SWord8 s273 = s198 ? s264 : s272; const SWord8 s274 = s1 + s256; const SBool s275 = s274 < s1; const SBool s276 = s274 < s256; const SBool s277 = s275 || s276; const SWord8 s278 = (s274 >> 1) | (s274 << 7); const SWord8 s279 = 128 | s278; const SWord8 s280 = 127 & s278; const SWord8 s281 = s277 ? s279 : s280; const SWord8 s282 = (s281 >> 1) | (s281 << 7); const SWord8 s283 = 128 | s282; const SWord8 s284 = 127 & s282; const SWord8 s285 = s197 ? s283 : s284; const SWord8 s286 = s1 + s281; const SBool s287 = s286 < s1; const SBool s288 = s286 < s281; const SBool s289 = s287 || s288; const SWord8 s290 = (s286 >> 1) | (s286 << 7); const SWord8 s291 = 128 | s290; const SWord8 s292 = 127 & s290; const SWord8 s293 = s289 ? s291 : s292; const SWord8 s294 = s198 ? s285 : s293; const SWord8 s295 = s74 ? s273 : s294; const SWord8 s296 = s55 ? s248 : s295; const SWord8 s297 = s36 ? s188 : s296; const SWord8 s298 = s1 + s59; const SBool s299 = (SBool) (s298 & 1); const SBool s300 = false != s299; const SWord8 s301 = s300 ? s63 : s64; const SBool s302 = (SBool) (s301 & 1); const SBool s303 = false != s302; const SWord8 s304 = s303 ? s69 : s70; const SBool s305 = (SBool) (s304 & 1); const SBool s306 = false != s305; const SBool s307 = false == s306; const SBool s308 = s298 < s1; const SBool s309 = s298 < s59; const SBool s310 = s308 || s309; const SWord8 s311 = (s298 >> 1) | (s298 << 7); const SWord8 s312 = 128 | s311; const SWord8 s313 = 127 & s311; const SWord8 s314 = s310 ? s312 : s313; const SBool s315 = (SBool) (s314 & 1); const SBool s316 = false != s315; const SWord8 s317 = (s301 >> 1) | (s301 << 7); const SWord8 s318 = 128 | s317; const SWord8 s319 = 127 & s317; const SWord8 s320 = s316 ? s318 : s319; const SBool s321 = (SBool) (s320 & 1); const SBool s322 = false != s321; const SWord8 s323 = (s304 >> 1) | (s304 << 7); const SWord8 s324 = 128 | s323; const SWord8 s325 = 127 & s323; const SWord8 s326 = s322 ? s324 : s325; const SBool s327 = (SBool) (s326 & 1); const SBool s328 = false != s327; const SBool s329 = false == s328; const SWord8 s330 = (s314 >> 1) | (s314 << 7); const SWord8 s331 = 128 | s330; const SWord8 s332 = 127 & s330; const SWord8 s333 = s35 ? s331 : s332; const SWord8 s334 = (s333 >> 1) | (s333 << 7); const SWord8 s335 = 128 | s334; const SWord8 s336 = 127 & s334; const SWord8 s337 = s54 ? s335 : s336; const SWord8 s338 = (s337 >> 1) | (s337 << 7); const SWord8 s339 = 128 | s338; const SWord8 s340 = 127 & s338; const SWord8 s341 = s306 ? s339 : s340; const SWord8 s342 = (s341 >> 1) | (s341 << 7); const SWord8 s343 = 128 | s342; const SWord8 s344 = 127 & s342; const SWord8 s345 = s328 ? s343 : s344; const SWord8 s346 = s1 + s341; const SBool s347 = s346 < s1; const SBool s348 = s346 < s341; const SBool s349 = s347 || s348; const SWord8 s350 = (s346 >> 1) | (s346 << 7); const SWord8 s351 = 128 | s350; const SWord8 s352 = 127 & s350; const SWord8 s353 = s349 ? s351 : s352; const SWord8 s354 = s329 ? s345 : s353; const SWord8 s355 = s1 + s337; const SBool s356 = s355 < s1; const SBool s357 = s355 < s337; const SBool s358 = s356 || s357; const SWord8 s359 = (s355 >> 1) | (s355 << 7); const SWord8 s360 = 128 | s359; const SWord8 s361 = 127 & s359; const SWord8 s362 = s358 ? s360 : s361; const SWord8 s363 = (s362 >> 1) | (s362 << 7); const SWord8 s364 = 128 | s363; const SWord8 s365 = 127 & s363; const SWord8 s366 = s328 ? s364 : s365; const SWord8 s367 = s1 + s362; const SBool s368 = s367 < s1; const SBool s369 = s367 < s362; const SBool s370 = s368 || s369; const SWord8 s371 = (s367 >> 1) | (s367 << 7); const SWord8 s372 = 128 | s371; const SWord8 s373 = 127 & s371; const SWord8 s374 = s370 ? s372 : s373; const SWord8 s375 = s329 ? s366 : s374; const SWord8 s376 = s307 ? s354 : s375; const SWord8 s377 = s1 + s333; const SBool s378 = s377 < s1; const SBool s379 = s377 < s333; const SBool s380 = s378 || s379; const SWord8 s381 = (s377 >> 1) | (s377 << 7); const SWord8 s382 = 128 | s381; const SWord8 s383 = 127 & s381; const SWord8 s384 = s380 ? s382 : s383; const SWord8 s385 = (s384 >> 1) | (s384 << 7); const SWord8 s386 = 128 | s385; const SWord8 s387 = 127 & s385; const SWord8 s388 = s306 ? s386 : s387; const SWord8 s389 = (s388 >> 1) | (s388 << 7); const SWord8 s390 = 128 | s389; const SWord8 s391 = 127 & s389; const SWord8 s392 = s328 ? s390 : s391; const SWord8 s393 = s1 + s388; const SBool s394 = s393 < s1; const SBool s395 = s393 < s388; const SBool s396 = s394 || s395; const SWord8 s397 = (s393 >> 1) | (s393 << 7); const SWord8 s398 = 128 | s397; const SWord8 s399 = 127 & s397; const SWord8 s400 = s396 ? s398 : s399; const SWord8 s401 = s329 ? s392 : s400; const SWord8 s402 = s1 + s384; const SBool s403 = s402 < s1; const SBool s404 = s402 < s384; const SBool s405 = s403 || s404; const SWord8 s406 = (s402 >> 1) | (s402 << 7); const SWord8 s407 = 128 | s406; const SWord8 s408 = 127 & s406; const SWord8 s409 = s405 ? s407 : s408; const SWord8 s410 = (s409 >> 1) | (s409 << 7); const SWord8 s411 = 128 | s410; const SWord8 s412 = 127 & s410; const SWord8 s413 = s328 ? s411 : s412; const SWord8 s414 = s1 + s409; const SBool s415 = s414 < s1; const SBool s416 = s414 < s409; const SBool s417 = s415 || s416; const SWord8 s418 = (s414 >> 1) | (s414 << 7); const SWord8 s419 = 128 | s418; const SWord8 s420 = 127 & s418; const SWord8 s421 = s417 ? s419 : s420; const SWord8 s422 = s329 ? s413 : s421; const SWord8 s423 = s307 ? s401 : s422; const SWord8 s424 = s55 ? s376 : s423; const SWord8 s425 = s1 + s314; const SBool s426 = (SBool) (s425 & 1); const SBool s427 = false != s426; const SWord8 s428 = s427 ? s318 : s319; const SBool s429 = (SBool) (s428 & 1); const SBool s430 = false != s429; const SWord8 s431 = s430 ? s324 : s325; const SBool s432 = (SBool) (s431 & 1); const SBool s433 = false != s432; const SBool s434 = false == s433; const SBool s435 = s425 < s1; const SBool s436 = s425 < s314; const SBool s437 = s435 || s436; const SWord8 s438 = (s425 >> 1) | (s425 << 7); const SWord8 s439 = 128 | s438; const SWord8 s440 = 127 & s438; const SWord8 s441 = s437 ? s439 : s440; const SWord8 s442 = (s441 >> 1) | (s441 << 7); const SWord8 s443 = 128 | s442; const SWord8 s444 = 127 & s442; const SWord8 s445 = s54 ? s443 : s444; const SWord8 s446 = (s445 >> 1) | (s445 << 7); const SWord8 s447 = 128 | s446; const SWord8 s448 = 127 & s446; const SWord8 s449 = s306 ? s447 : s448; const SWord8 s450 = (s449 >> 1) | (s449 << 7); const SWord8 s451 = 128 | s450; const SWord8 s452 = 127 & s450; const SWord8 s453 = s433 ? s451 : s452; const SWord8 s454 = s1 + s449; const SBool s455 = s454 < s1; const SBool s456 = s454 < s449; const SBool s457 = s455 || s456; const SWord8 s458 = (s454 >> 1) | (s454 << 7); const SWord8 s459 = 128 | s458; const SWord8 s460 = 127 & s458; const SWord8 s461 = s457 ? s459 : s460; const SWord8 s462 = s434 ? s453 : s461; const SWord8 s463 = s1 + s445; const SBool s464 = s463 < s1; const SBool s465 = s463 < s445; const SBool s466 = s464 || s465; const SWord8 s467 = (s463 >> 1) | (s463 << 7); const SWord8 s468 = 128 | s467; const SWord8 s469 = 127 & s467; const SWord8 s470 = s466 ? s468 : s469; const SWord8 s471 = (s470 >> 1) | (s470 << 7); const SWord8 s472 = 128 | s471; const SWord8 s473 = 127 & s471; const SWord8 s474 = s433 ? s472 : s473; const SWord8 s475 = s1 + s470; const SBool s476 = s475 < s1; const SBool s477 = s475 < s470; const SBool s478 = s476 || s477; const SWord8 s479 = (s475 >> 1) | (s475 << 7); const SWord8 s480 = 128 | s479; const SWord8 s481 = 127 & s479; const SWord8 s482 = s478 ? s480 : s481; const SWord8 s483 = s434 ? s474 : s482; const SWord8 s484 = s307 ? s462 : s483; const SWord8 s485 = s1 + s441; const SBool s486 = s485 < s1; const SBool s487 = s485 < s441; const SBool s488 = s486 || s487; const SWord8 s489 = (s485 >> 1) | (s485 << 7); const SWord8 s490 = 128 | s489; const SWord8 s491 = 127 & s489; const SWord8 s492 = s488 ? s490 : s491; const SWord8 s493 = (s492 >> 1) | (s492 << 7); const SWord8 s494 = 128 | s493; const SWord8 s495 = 127 & s493; const SWord8 s496 = s306 ? s494 : s495; const SWord8 s497 = (s496 >> 1) | (s496 << 7); const SWord8 s498 = 128 | s497; const SWord8 s499 = 127 & s497; const SWord8 s500 = s433 ? s498 : s499; const SWord8 s501 = s1 + s496; const SBool s502 = s501 < s1; const SBool s503 = s501 < s496; const SBool s504 = s502 || s503; const SWord8 s505 = (s501 >> 1) | (s501 << 7); const SWord8 s506 = 128 | s505; const SWord8 s507 = 127 & s505; const SWord8 s508 = s504 ? s506 : s507; const SWord8 s509 = s434 ? s500 : s508; const SWord8 s510 = s1 + s492; const SBool s511 = s510 < s1; const SBool s512 = s510 < s492; const SBool s513 = s511 || s512; const SWord8 s514 = (s510 >> 1) | (s510 << 7); const SWord8 s515 = 128 | s514; const SWord8 s516 = 127 & s514; const SWord8 s517 = s513 ? s515 : s516; const SWord8 s518 = (s517 >> 1) | (s517 << 7); const SWord8 s519 = 128 | s518; const SWord8 s520 = 127 & s518; const SWord8 s521 = s433 ? s519 : s520; const SWord8 s522 = s1 + s517; const SBool s523 = s522 < s1; const SBool s524 = s522 < s517; const SBool s525 = s523 || s524; const SWord8 s526 = (s522 >> 1) | (s522 << 7); const SWord8 s527 = 128 | s526; const SWord8 s528 = 127 & s526; const SWord8 s529 = s525 ? s527 : s528; const SWord8 s530 = s434 ? s521 : s529; const SWord8 s531 = s307 ? s509 : s530; const SWord8 s532 = s55 ? s484 : s531; const SWord8 s533 = s36 ? s424 : s532; const SWord8 s534 = s21 ? s297 : s533; const SWord8 s535 = s1 + s40; const SBool s536 = (SBool) (s535 & 1); const SBool s537 = false != s536; const SWord8 s538 = s537 ? s44 : s45; const SBool s539 = (SBool) (s538 & 1); const SBool s540 = false != s539; const SWord8 s541 = s540 ? s50 : s51; const SBool s542 = (SBool) (s541 & 1); const SBool s543 = false != s542; const SBool s544 = false == s543; const SBool s545 = s535 < s1; const SBool s546 = s535 < s40; const SBool s547 = s545 || s546; const SWord8 s548 = (s535 >> 1) | (s535 << 7); const SWord8 s549 = 128 | s548; const SWord8 s550 = 127 & s548; const SWord8 s551 = s547 ? s549 : s550; const SBool s552 = (SBool) (s551 & 1); const SBool s553 = false != s552; const SWord8 s554 = (s538 >> 1) | (s538 << 7); const SWord8 s555 = 128 | s554; const SWord8 s556 = 127 & s554; const SWord8 s557 = s553 ? s555 : s556; const SBool s558 = (SBool) (s557 & 1); const SBool s559 = false != s558; const SWord8 s560 = (s541 >> 1) | (s541 << 7); const SWord8 s561 = 128 | s560; const SWord8 s562 = 127 & s560; const SWord8 s563 = s559 ? s561 : s562; const SBool s564 = (SBool) (s563 & 1); const SBool s565 = false != s564; const SBool s566 = false == s565; const SWord8 s567 = (s551 >> 1) | (s551 << 7); const SWord8 s568 = 128 | s567; const SWord8 s569 = 127 & s567; const SWord8 s570 = s20 ? s568 : s569; const SBool s571 = (SBool) (s570 & 1); const SBool s572 = false != s571; const SWord8 s573 = (s557 >> 1) | (s557 << 7); const SWord8 s574 = 128 | s573; const SWord8 s575 = 127 & s573; const SWord8 s576 = s572 ? s574 : s575; const SBool s577 = (SBool) (s576 & 1); const SBool s578 = false != s577; const SWord8 s579 = (s563 >> 1) | (s563 << 7); const SWord8 s580 = 128 | s579; const SWord8 s581 = 127 & s579; const SWord8 s582 = s578 ? s580 : s581; const SBool s583 = (SBool) (s582 & 1); const SBool s584 = false != s583; const SBool s585 = false == s584; const SWord8 s586 = (s570 >> 1) | (s570 << 7); const SWord8 s587 = 128 | s586; const SWord8 s588 = 127 & s586; const SWord8 s589 = s35 ? s587 : s588; const SWord8 s590 = (s589 >> 1) | (s589 << 7); const SWord8 s591 = 128 | s590; const SWord8 s592 = 127 & s590; const SWord8 s593 = s543 ? s591 : s592; const SWord8 s594 = (s593 >> 1) | (s593 << 7); const SWord8 s595 = 128 | s594; const SWord8 s596 = 127 & s594; const SWord8 s597 = s565 ? s595 : s596; const SWord8 s598 = (s597 >> 1) | (s597 << 7); const SWord8 s599 = 128 | s598; const SWord8 s600 = 127 & s598; const SWord8 s601 = s584 ? s599 : s600; const SWord8 s602 = s1 + s597; const SBool s603 = s602 < s1; const SBool s604 = s602 < s597; const SBool s605 = s603 || s604; const SWord8 s606 = (s602 >> 1) | (s602 << 7); const SWord8 s607 = 128 | s606; const SWord8 s608 = 127 & s606; const SWord8 s609 = s605 ? s607 : s608; const SWord8 s610 = s585 ? s601 : s609; const SWord8 s611 = s1 + s593; const SBool s612 = s611 < s1; const SBool s613 = s611 < s593; const SBool s614 = s612 || s613; const SWord8 s615 = (s611 >> 1) | (s611 << 7); const SWord8 s616 = 128 | s615; const SWord8 s617 = 127 & s615; const SWord8 s618 = s614 ? s616 : s617; const SWord8 s619 = (s618 >> 1) | (s618 << 7); const SWord8 s620 = 128 | s619; const SWord8 s621 = 127 & s619; const SWord8 s622 = s584 ? s620 : s621; const SWord8 s623 = s1 + s618; const SBool s624 = s623 < s1; const SBool s625 = s623 < s618; const SBool s626 = s624 || s625; const SWord8 s627 = (s623 >> 1) | (s623 << 7); const SWord8 s628 = 128 | s627; const SWord8 s629 = 127 & s627; const SWord8 s630 = s626 ? s628 : s629; const SWord8 s631 = s585 ? s622 : s630; const SWord8 s632 = s566 ? s610 : s631; const SWord8 s633 = s1 + s589; const SBool s634 = s633 < s1; const SBool s635 = s633 < s589; const SBool s636 = s634 || s635; const SWord8 s637 = (s633 >> 1) | (s633 << 7); const SWord8 s638 = 128 | s637; const SWord8 s639 = 127 & s637; const SWord8 s640 = s636 ? s638 : s639; const SWord8 s641 = (s640 >> 1) | (s640 << 7); const SWord8 s642 = 128 | s641; const SWord8 s643 = 127 & s641; const SWord8 s644 = s565 ? s642 : s643; const SWord8 s645 = (s644 >> 1) | (s644 << 7); const SWord8 s646 = 128 | s645; const SWord8 s647 = 127 & s645; const SWord8 s648 = s584 ? s646 : s647; const SWord8 s649 = s1 + s644; const SBool s650 = s649 < s1; const SBool s651 = s649 < s644; const SBool s652 = s650 || s651; const SWord8 s653 = (s649 >> 1) | (s649 << 7); const SWord8 s654 = 128 | s653; const SWord8 s655 = 127 & s653; const SWord8 s656 = s652 ? s654 : s655; const SWord8 s657 = s585 ? s648 : s656; const SWord8 s658 = s1 + s640; const SBool s659 = s658 < s1; const SBool s660 = s658 < s640; const SBool s661 = s659 || s660; const SWord8 s662 = (s658 >> 1) | (s658 << 7); const SWord8 s663 = 128 | s662; const SWord8 s664 = 127 & s662; const SWord8 s665 = s661 ? s663 : s664; const SWord8 s666 = (s665 >> 1) | (s665 << 7); const SWord8 s667 = 128 | s666; const SWord8 s668 = 127 & s666; const SWord8 s669 = s584 ? s667 : s668; const SWord8 s670 = s1 + s665; const SBool s671 = s670 < s1; const SBool s672 = s670 < s665; const SBool s673 = s671 || s672; const SWord8 s674 = (s670 >> 1) | (s670 << 7); const SWord8 s675 = 128 | s674; const SWord8 s676 = 127 & s674; const SWord8 s677 = s673 ? s675 : s676; const SWord8 s678 = s585 ? s669 : s677; const SWord8 s679 = s566 ? s657 : s678; const SWord8 s680 = s544 ? s632 : s679; const SWord8 s681 = s1 + s570; const SBool s682 = (SBool) (s681 & 1); const SBool s683 = false != s682; const SWord8 s684 = s683 ? s574 : s575; const SBool s685 = (SBool) (s684 & 1); const SBool s686 = false != s685; const SWord8 s687 = s686 ? s580 : s581; const SBool s688 = (SBool) (s687 & 1); const SBool s689 = false != s688; const SBool s690 = false == s689; const SBool s691 = s681 < s1; const SBool s692 = s681 < s570; const SBool s693 = s691 || s692; const SWord8 s694 = (s681 >> 1) | (s681 << 7); const SWord8 s695 = 128 | s694; const SWord8 s696 = 127 & s694; const SWord8 s697 = s693 ? s695 : s696; const SWord8 s698 = (s697 >> 1) | (s697 << 7); const SWord8 s699 = 128 | s698; const SWord8 s700 = 127 & s698; const SWord8 s701 = s543 ? s699 : s700; const SWord8 s702 = (s701 >> 1) | (s701 << 7); const SWord8 s703 = 128 | s702; const SWord8 s704 = 127 & s702; const SWord8 s705 = s565 ? s703 : s704; const SWord8 s706 = (s705 >> 1) | (s705 << 7); const SWord8 s707 = 128 | s706; const SWord8 s708 = 127 & s706; const SWord8 s709 = s689 ? s707 : s708; const SWord8 s710 = s1 + s705; const SBool s711 = s710 < s1; const SBool s712 = s710 < s705; const SBool s713 = s711 || s712; const SWord8 s714 = (s710 >> 1) | (s710 << 7); const SWord8 s715 = 128 | s714; const SWord8 s716 = 127 & s714; const SWord8 s717 = s713 ? s715 : s716; const SWord8 s718 = s690 ? s709 : s717; const SWord8 s719 = s1 + s701; const SBool s720 = s719 < s1; const SBool s721 = s719 < s701; const SBool s722 = s720 || s721; const SWord8 s723 = (s719 >> 1) | (s719 << 7); const SWord8 s724 = 128 | s723; const SWord8 s725 = 127 & s723; const SWord8 s726 = s722 ? s724 : s725; const SWord8 s727 = (s726 >> 1) | (s726 << 7); const SWord8 s728 = 128 | s727; const SWord8 s729 = 127 & s727; const SWord8 s730 = s689 ? s728 : s729; const SWord8 s731 = s1 + s726; const SBool s732 = s731 < s1; const SBool s733 = s731 < s726; const SBool s734 = s732 || s733; const SWord8 s735 = (s731 >> 1) | (s731 << 7); const SWord8 s736 = 128 | s735; const SWord8 s737 = 127 & s735; const SWord8 s738 = s734 ? s736 : s737; const SWord8 s739 = s690 ? s730 : s738; const SWord8 s740 = s566 ? s718 : s739; const SWord8 s741 = s1 + s697; const SBool s742 = s741 < s1; const SBool s743 = s741 < s697; const SBool s744 = s742 || s743; const SWord8 s745 = (s741 >> 1) | (s741 << 7); const SWord8 s746 = 128 | s745; const SWord8 s747 = 127 & s745; const SWord8 s748 = s744 ? s746 : s747; const SWord8 s749 = (s748 >> 1) | (s748 << 7); const SWord8 s750 = 128 | s749; const SWord8 s751 = 127 & s749; const SWord8 s752 = s565 ? s750 : s751; const SWord8 s753 = (s752 >> 1) | (s752 << 7); const SWord8 s754 = 128 | s753; const SWord8 s755 = 127 & s753; const SWord8 s756 = s689 ? s754 : s755; const SWord8 s757 = s1 + s752; const SBool s758 = s757 < s1; const SBool s759 = s757 < s752; const SBool s760 = s758 || s759; const SWord8 s761 = (s757 >> 1) | (s757 << 7); const SWord8 s762 = 128 | s761; const SWord8 s763 = 127 & s761; const SWord8 s764 = s760 ? s762 : s763; const SWord8 s765 = s690 ? s756 : s764; const SWord8 s766 = s1 + s748; const SBool s767 = s766 < s1; const SBool s768 = s766 < s748; const SBool s769 = s767 || s768; const SWord8 s770 = (s766 >> 1) | (s766 << 7); const SWord8 s771 = 128 | s770; const SWord8 s772 = 127 & s770; const SWord8 s773 = s769 ? s771 : s772; const SWord8 s774 = (s773 >> 1) | (s773 << 7); const SWord8 s775 = 128 | s774; const SWord8 s776 = 127 & s774; const SWord8 s777 = s689 ? s775 : s776; const SWord8 s778 = s1 + s773; const SBool s779 = s778 < s1; const SBool s780 = s778 < s773; const SBool s781 = s779 || s780; const SWord8 s782 = (s778 >> 1) | (s778 << 7); const SWord8 s783 = 128 | s782; const SWord8 s784 = 127 & s782; const SWord8 s785 = s781 ? s783 : s784; const SWord8 s786 = s690 ? s777 : s785; const SWord8 s787 = s566 ? s765 : s786; const SWord8 s788 = s544 ? s740 : s787; const SWord8 s789 = s36 ? s680 : s788; const SWord8 s790 = s1 + s551; const SBool s791 = (SBool) (s790 & 1); const SBool s792 = false != s791; const SWord8 s793 = s792 ? s555 : s556; const SBool s794 = (SBool) (s793 & 1); const SBool s795 = false != s794; const SWord8 s796 = s795 ? s561 : s562; const SBool s797 = (SBool) (s796 & 1); const SBool s798 = false != s797; const SBool s799 = false == s798; const SBool s800 = s790 < s1; const SBool s801 = s790 < s551; const SBool s802 = s800 || s801; const SWord8 s803 = (s790 >> 1) | (s790 << 7); const SWord8 s804 = 128 | s803; const SWord8 s805 = 127 & s803; const SWord8 s806 = s802 ? s804 : s805; const SBool s807 = (SBool) (s806 & 1); const SBool s808 = false != s807; const SWord8 s809 = (s793 >> 1) | (s793 << 7); const SWord8 s810 = 128 | s809; const SWord8 s811 = 127 & s809; const SWord8 s812 = s808 ? s810 : s811; const SBool s813 = (SBool) (s812 & 1); const SBool s814 = false != s813; const SWord8 s815 = (s796 >> 1) | (s796 << 7); const SWord8 s816 = 128 | s815; const SWord8 s817 = 127 & s815; const SWord8 s818 = s814 ? s816 : s817; const SBool s819 = (SBool) (s818 & 1); const SBool s820 = false != s819; const SBool s821 = false == s820; const SWord8 s822 = (s806 >> 1) | (s806 << 7); const SWord8 s823 = 128 | s822; const SWord8 s824 = 127 & s822; const SWord8 s825 = s35 ? s823 : s824; const SWord8 s826 = (s825 >> 1) | (s825 << 7); const SWord8 s827 = 128 | s826; const SWord8 s828 = 127 & s826; const SWord8 s829 = s543 ? s827 : s828; const SWord8 s830 = (s829 >> 1) | (s829 << 7); const SWord8 s831 = 128 | s830; const SWord8 s832 = 127 & s830; const SWord8 s833 = s798 ? s831 : s832; const SWord8 s834 = (s833 >> 1) | (s833 << 7); const SWord8 s835 = 128 | s834; const SWord8 s836 = 127 & s834; const SWord8 s837 = s820 ? s835 : s836; const SWord8 s838 = s1 + s833; const SBool s839 = s838 < s1; const SBool s840 = s838 < s833; const SBool s841 = s839 || s840; const SWord8 s842 = (s838 >> 1) | (s838 << 7); const SWord8 s843 = 128 | s842; const SWord8 s844 = 127 & s842; const SWord8 s845 = s841 ? s843 : s844; const SWord8 s846 = s821 ? s837 : s845; const SWord8 s847 = s1 + s829; const SBool s848 = s847 < s1; const SBool s849 = s847 < s829; const SBool s850 = s848 || s849; const SWord8 s851 = (s847 >> 1) | (s847 << 7); const SWord8 s852 = 128 | s851; const SWord8 s853 = 127 & s851; const SWord8 s854 = s850 ? s852 : s853; const SWord8 s855 = (s854 >> 1) | (s854 << 7); const SWord8 s856 = 128 | s855; const SWord8 s857 = 127 & s855; const SWord8 s858 = s820 ? s856 : s857; const SWord8 s859 = s1 + s854; const SBool s860 = s859 < s1; const SBool s861 = s859 < s854; const SBool s862 = s860 || s861; const SWord8 s863 = (s859 >> 1) | (s859 << 7); const SWord8 s864 = 128 | s863; const SWord8 s865 = 127 & s863; const SWord8 s866 = s862 ? s864 : s865; const SWord8 s867 = s821 ? s858 : s866; const SWord8 s868 = s799 ? s846 : s867; const SWord8 s869 = s1 + s825; const SBool s870 = s869 < s1; const SBool s871 = s869 < s825; const SBool s872 = s870 || s871; const SWord8 s873 = (s869 >> 1) | (s869 << 7); const SWord8 s874 = 128 | s873; const SWord8 s875 = 127 & s873; const SWord8 s876 = s872 ? s874 : s875; const SWord8 s877 = (s876 >> 1) | (s876 << 7); const SWord8 s878 = 128 | s877; const SWord8 s879 = 127 & s877; const SWord8 s880 = s798 ? s878 : s879; const SWord8 s881 = (s880 >> 1) | (s880 << 7); const SWord8 s882 = 128 | s881; const SWord8 s883 = 127 & s881; const SWord8 s884 = s820 ? s882 : s883; const SWord8 s885 = s1 + s880; const SBool s886 = s885 < s1; const SBool s887 = s885 < s880; const SBool s888 = s886 || s887; const SWord8 s889 = (s885 >> 1) | (s885 << 7); const SWord8 s890 = 128 | s889; const SWord8 s891 = 127 & s889; const SWord8 s892 = s888 ? s890 : s891; const SWord8 s893 = s821 ? s884 : s892; const SWord8 s894 = s1 + s876; const SBool s895 = s894 < s1; const SBool s896 = s894 < s876; const SBool s897 = s895 || s896; const SWord8 s898 = (s894 >> 1) | (s894 << 7); const SWord8 s899 = 128 | s898; const SWord8 s900 = 127 & s898; const SWord8 s901 = s897 ? s899 : s900; const SWord8 s902 = (s901 >> 1) | (s901 << 7); const SWord8 s903 = 128 | s902; const SWord8 s904 = 127 & s902; const SWord8 s905 = s820 ? s903 : s904; const SWord8 s906 = s1 + s901; const SBool s907 = s906 < s1; const SBool s908 = s906 < s901; const SBool s909 = s907 || s908; const SWord8 s910 = (s906 >> 1) | (s906 << 7); const SWord8 s911 = 128 | s910; const SWord8 s912 = 127 & s910; const SWord8 s913 = s909 ? s911 : s912; const SWord8 s914 = s821 ? s905 : s913; const SWord8 s915 = s799 ? s893 : s914; const SWord8 s916 = s544 ? s868 : s915; const SWord8 s917 = s1 + s806; const SBool s918 = (SBool) (s917 & 1); const SBool s919 = false != s918; const SWord8 s920 = s919 ? s810 : s811; const SBool s921 = (SBool) (s920 & 1); const SBool s922 = false != s921; const SWord8 s923 = s922 ? s816 : s817; const SBool s924 = (SBool) (s923 & 1); const SBool s925 = false != s924; const SBool s926 = false == s925; const SBool s927 = s917 < s1; const SBool s928 = s917 < s806; const SBool s929 = s927 || s928; const SWord8 s930 = (s917 >> 1) | (s917 << 7); const SWord8 s931 = 128 | s930; const SWord8 s932 = 127 & s930; const SWord8 s933 = s929 ? s931 : s932; const SWord8 s934 = (s933 >> 1) | (s933 << 7); const SWord8 s935 = 128 | s934; const SWord8 s936 = 127 & s934; const SWord8 s937 = s543 ? s935 : s936; const SWord8 s938 = (s937 >> 1) | (s937 << 7); const SWord8 s939 = 128 | s938; const SWord8 s940 = 127 & s938; const SWord8 s941 = s798 ? s939 : s940; const SWord8 s942 = (s941 >> 1) | (s941 << 7); const SWord8 s943 = 128 | s942; const SWord8 s944 = 127 & s942; const SWord8 s945 = s925 ? s943 : s944; const SWord8 s946 = s1 + s941; const SBool s947 = s946 < s1; const SBool s948 = s946 < s941; const SBool s949 = s947 || s948; const SWord8 s950 = (s946 >> 1) | (s946 << 7); const SWord8 s951 = 128 | s950; const SWord8 s952 = 127 & s950; const SWord8 s953 = s949 ? s951 : s952; const SWord8 s954 = s926 ? s945 : s953; const SWord8 s955 = s1 + s937; const SBool s956 = s955 < s1; const SBool s957 = s955 < s937; const SBool s958 = s956 || s957; const SWord8 s959 = (s955 >> 1) | (s955 << 7); const SWord8 s960 = 128 | s959; const SWord8 s961 = 127 & s959; const SWord8 s962 = s958 ? s960 : s961; const SWord8 s963 = (s962 >> 1) | (s962 << 7); const SWord8 s964 = 128 | s963; const SWord8 s965 = 127 & s963; const SWord8 s966 = s925 ? s964 : s965; const SWord8 s967 = s1 + s962; const SBool s968 = s967 < s1; const SBool s969 = s967 < s962; const SBool s970 = s968 || s969; const SWord8 s971 = (s967 >> 1) | (s967 << 7); const SWord8 s972 = 128 | s971; const SWord8 s973 = 127 & s971; const SWord8 s974 = s970 ? s972 : s973; const SWord8 s975 = s926 ? s966 : s974; const SWord8 s976 = s799 ? s954 : s975; const SWord8 s977 = s1 + s933; const SBool s978 = s977 < s1; const SBool s979 = s977 < s933; const SBool s980 = s978 || s979; const SWord8 s981 = (s977 >> 1) | (s977 << 7); const SWord8 s982 = 128 | s981; const SWord8 s983 = 127 & s981; const SWord8 s984 = s980 ? s982 : s983; const SWord8 s985 = (s984 >> 1) | (s984 << 7); const SWord8 s986 = 128 | s985; const SWord8 s987 = 127 & s985; const SWord8 s988 = s798 ? s986 : s987; const SWord8 s989 = (s988 >> 1) | (s988 << 7); const SWord8 s990 = 128 | s989; const SWord8 s991 = 127 & s989; const SWord8 s992 = s925 ? s990 : s991; const SWord8 s993 = s1 + s988; const SBool s994 = s993 < s1; const SBool s995 = s993 < s988; const SBool s996 = s994 || s995; const SWord8 s997 = (s993 >> 1) | (s993 << 7); const SWord8 s998 = 128 | s997; const SWord8 s999 = 127 & s997; const SWord8 s1000 = s996 ? s998 : s999; const SWord8 s1001 = s926 ? s992 : s1000; const SWord8 s1002 = s1 + s984; const SBool s1003 = s1002 < s1; const SBool s1004 = s1002 < s984; const SBool s1005 = s1003 || s1004; const SWord8 s1006 = (s1002 >> 1) | (s1002 << 7); const SWord8 s1007 = 128 | s1006; const SWord8 s1008 = 127 & s1006; const SWord8 s1009 = s1005 ? s1007 : s1008; const SWord8 s1010 = (s1009 >> 1) | (s1009 << 7); const SWord8 s1011 = 128 | s1010; const SWord8 s1012 = 127 & s1010; const SWord8 s1013 = s925 ? s1011 : s1012; const SWord8 s1014 = s1 + s1009; const SBool s1015 = s1014 < s1; const SBool s1016 = s1014 < s1009; const SBool s1017 = s1015 || s1016; const SWord8 s1018 = (s1014 >> 1) | (s1014 << 7); const SWord8 s1019 = 128 | s1018; const SWord8 s1020 = 127 & s1018; const SWord8 s1021 = s1017 ? s1019 : s1020; const SWord8 s1022 = s926 ? s1013 : s1021; const SWord8 s1023 = s799 ? s1001 : s1022; const SWord8 s1024 = s544 ? s976 : s1023; const SWord8 s1025 = s36 ? s916 : s1024; const SWord8 s1026 = s21 ? s789 : s1025; const SWord8 s1027 = s16 ? s534 : s1026; const SWord8 s1028 = s1 + s24; const SBool s1029 = (SBool) (s1028 & 1); const SBool s1030 = false != s1029; const SWord8 s1031 = s1030 ? 128 : 0; const SBool s1032 = (SBool) (s1031 & 1); const SBool s1033 = false != s1032; const SWord8 s1034 = s1033 ? s31 : s32; const SBool s1035 = (SBool) (s1034 & 1); const SBool s1036 = false != s1035; const SBool s1037 = false == s1036; const SBool s1038 = s1028 < s1; const SBool s1039 = s1028 < s24; const SBool s1040 = s1038 || s1039; const SWord8 s1041 = (s1028 >> 1) | (s1028 << 7); const SWord8 s1042 = 128 | s1041; const SWord8 s1043 = 127 & s1041; const SWord8 s1044 = s1040 ? s1042 : s1043; const SBool s1045 = (SBool) (s1044 & 1); const SBool s1046 = false != s1045; const SWord8 s1047 = (s1031 >> 1) | (s1031 << 7); const SWord8 s1048 = 128 | s1047; const SWord8 s1049 = 127 & s1047; const SWord8 s1050 = s1046 ? s1048 : s1049; const SBool s1051 = (SBool) (s1050 & 1); const SBool s1052 = false != s1051; const SWord8 s1053 = (s1034 >> 1) | (s1034 << 7); const SWord8 s1054 = 128 | s1053; const SWord8 s1055 = 127 & s1053; const SWord8 s1056 = s1052 ? s1054 : s1055; const SBool s1057 = (SBool) (s1056 & 1); const SBool s1058 = false != s1057; const SBool s1059 = false == s1058; const SWord8 s1060 = (s1044 >> 1) | (s1044 << 7); const SWord8 s1061 = 128 | s1060; const SWord8 s1062 = 127 & s1060; const SWord8 s1063 = s15 ? s1061 : s1062; const SBool s1064 = (SBool) (s1063 & 1); const SBool s1065 = false != s1064; const SWord8 s1066 = (s1050 >> 1) | (s1050 << 7); const SWord8 s1067 = 128 | s1066; const SWord8 s1068 = 127 & s1066; const SWord8 s1069 = s1065 ? s1067 : s1068; const SBool s1070 = (SBool) (s1069 & 1); const SBool s1071 = false != s1070; const SWord8 s1072 = (s1056 >> 1) | (s1056 << 7); const SWord8 s1073 = 128 | s1072; const SWord8 s1074 = 127 & s1072; const SWord8 s1075 = s1071 ? s1073 : s1074; const SBool s1076 = (SBool) (s1075 & 1); const SBool s1077 = false != s1076; const SBool s1078 = false == s1077; const SWord8 s1079 = (s1063 >> 1) | (s1063 << 7); const SWord8 s1080 = 128 | s1079; const SWord8 s1081 = 127 & s1079; const SWord8 s1082 = s20 ? s1080 : s1081; const SBool s1083 = (SBool) (s1082 & 1); const SBool s1084 = false != s1083; const SWord8 s1085 = (s1069 >> 1) | (s1069 << 7); const SWord8 s1086 = 128 | s1085; const SWord8 s1087 = 127 & s1085; const SWord8 s1088 = s1084 ? s1086 : s1087; const SBool s1089 = (SBool) (s1088 & 1); const SBool s1090 = false != s1089; const SWord8 s1091 = (s1075 >> 1) | (s1075 << 7); const SWord8 s1092 = 128 | s1091; const SWord8 s1093 = 127 & s1091; const SWord8 s1094 = s1090 ? s1092 : s1093; const SBool s1095 = (SBool) (s1094 & 1); const SBool s1096 = false != s1095; const SBool s1097 = false == s1096; const SWord8 s1098 = (s1082 >> 1) | (s1082 << 7); const SWord8 s1099 = 128 | s1098; const SWord8 s1100 = 127 & s1098; const SWord8 s1101 = s1036 ? s1099 : s1100; const SWord8 s1102 = (s1101 >> 1) | (s1101 << 7); const SWord8 s1103 = 128 | s1102; const SWord8 s1104 = 127 & s1102; const SWord8 s1105 = s1058 ? s1103 : s1104; const SWord8 s1106 = (s1105 >> 1) | (s1105 << 7); const SWord8 s1107 = 128 | s1106; const SWord8 s1108 = 127 & s1106; const SWord8 s1109 = s1077 ? s1107 : s1108; const SWord8 s1110 = (s1109 >> 1) | (s1109 << 7); const SWord8 s1111 = 128 | s1110; const SWord8 s1112 = 127 & s1110; const SWord8 s1113 = s1096 ? s1111 : s1112; const SWord8 s1114 = s1 + s1109; const SBool s1115 = s1114 < s1; const SBool s1116 = s1114 < s1109; const SBool s1117 = s1115 || s1116; const SWord8 s1118 = (s1114 >> 1) | (s1114 << 7); const SWord8 s1119 = 128 | s1118; const SWord8 s1120 = 127 & s1118; const SWord8 s1121 = s1117 ? s1119 : s1120; const SWord8 s1122 = s1097 ? s1113 : s1121; const SWord8 s1123 = s1 + s1105; const SBool s1124 = s1123 < s1; const SBool s1125 = s1123 < s1105; const SBool s1126 = s1124 || s1125; const SWord8 s1127 = (s1123 >> 1) | (s1123 << 7); const SWord8 s1128 = 128 | s1127; const SWord8 s1129 = 127 & s1127; const SWord8 s1130 = s1126 ? s1128 : s1129; const SWord8 s1131 = (s1130 >> 1) | (s1130 << 7); const SWord8 s1132 = 128 | s1131; const SWord8 s1133 = 127 & s1131; const SWord8 s1134 = s1096 ? s1132 : s1133; const SWord8 s1135 = s1 + s1130; const SBool s1136 = s1135 < s1; const SBool s1137 = s1135 < s1130; const SBool s1138 = s1136 || s1137; const SWord8 s1139 = (s1135 >> 1) | (s1135 << 7); const SWord8 s1140 = 128 | s1139; const SWord8 s1141 = 127 & s1139; const SWord8 s1142 = s1138 ? s1140 : s1141; const SWord8 s1143 = s1097 ? s1134 : s1142; const SWord8 s1144 = s1078 ? s1122 : s1143; const SWord8 s1145 = s1 + s1101; const SBool s1146 = s1145 < s1; const SBool s1147 = s1145 < s1101; const SBool s1148 = s1146 || s1147; const SWord8 s1149 = (s1145 >> 1) | (s1145 << 7); const SWord8 s1150 = 128 | s1149; const SWord8 s1151 = 127 & s1149; const SWord8 s1152 = s1148 ? s1150 : s1151; const SWord8 s1153 = (s1152 >> 1) | (s1152 << 7); const SWord8 s1154 = 128 | s1153; const SWord8 s1155 = 127 & s1153; const SWord8 s1156 = s1077 ? s1154 : s1155; const SWord8 s1157 = (s1156 >> 1) | (s1156 << 7); const SWord8 s1158 = 128 | s1157; const SWord8 s1159 = 127 & s1157; const SWord8 s1160 = s1096 ? s1158 : s1159; const SWord8 s1161 = s1 + s1156; const SBool s1162 = s1161 < s1; const SBool s1163 = s1161 < s1156; const SBool s1164 = s1162 || s1163; const SWord8 s1165 = (s1161 >> 1) | (s1161 << 7); const SWord8 s1166 = 128 | s1165; const SWord8 s1167 = 127 & s1165; const SWord8 s1168 = s1164 ? s1166 : s1167; const SWord8 s1169 = s1097 ? s1160 : s1168; const SWord8 s1170 = s1 + s1152; const SBool s1171 = s1170 < s1; const SBool s1172 = s1170 < s1152; const SBool s1173 = s1171 || s1172; const SWord8 s1174 = (s1170 >> 1) | (s1170 << 7); const SWord8 s1175 = 128 | s1174; const SWord8 s1176 = 127 & s1174; const SWord8 s1177 = s1173 ? s1175 : s1176; const SWord8 s1178 = (s1177 >> 1) | (s1177 << 7); const SWord8 s1179 = 128 | s1178; const SWord8 s1180 = 127 & s1178; const SWord8 s1181 = s1096 ? s1179 : s1180; const SWord8 s1182 = s1 + s1177; const SBool s1183 = s1182 < s1; const SBool s1184 = s1182 < s1177; const SBool s1185 = s1183 || s1184; const SWord8 s1186 = (s1182 >> 1) | (s1182 << 7); const SWord8 s1187 = 128 | s1186; const SWord8 s1188 = 127 & s1186; const SWord8 s1189 = s1185 ? s1187 : s1188; const SWord8 s1190 = s1097 ? s1181 : s1189; const SWord8 s1191 = s1078 ? s1169 : s1190; const SWord8 s1192 = s1059 ? s1144 : s1191; const SWord8 s1193 = s1 + s1082; const SBool s1194 = (SBool) (s1193 & 1); const SBool s1195 = false != s1194; const SWord8 s1196 = s1195 ? s1086 : s1087; const SBool s1197 = (SBool) (s1196 & 1); const SBool s1198 = false != s1197; const SWord8 s1199 = s1198 ? s1092 : s1093; const SBool s1200 = (SBool) (s1199 & 1); const SBool s1201 = false != s1200; const SBool s1202 = false == s1201; const SBool s1203 = s1193 < s1; const SBool s1204 = s1193 < s1082; const SBool s1205 = s1203 || s1204; const SWord8 s1206 = (s1193 >> 1) | (s1193 << 7); const SWord8 s1207 = 128 | s1206; const SWord8 s1208 = 127 & s1206; const SWord8 s1209 = s1205 ? s1207 : s1208; const SWord8 s1210 = (s1209 >> 1) | (s1209 << 7); const SWord8 s1211 = 128 | s1210; const SWord8 s1212 = 127 & s1210; const SWord8 s1213 = s1058 ? s1211 : s1212; const SWord8 s1214 = (s1213 >> 1) | (s1213 << 7); const SWord8 s1215 = 128 | s1214; const SWord8 s1216 = 127 & s1214; const SWord8 s1217 = s1077 ? s1215 : s1216; const SWord8 s1218 = (s1217 >> 1) | (s1217 << 7); const SWord8 s1219 = 128 | s1218; const SWord8 s1220 = 127 & s1218; const SWord8 s1221 = s1201 ? s1219 : s1220; const SWord8 s1222 = s1 + s1217; const SBool s1223 = s1222 < s1; const SBool s1224 = s1222 < s1217; const SBool s1225 = s1223 || s1224; const SWord8 s1226 = (s1222 >> 1) | (s1222 << 7); const SWord8 s1227 = 128 | s1226; const SWord8 s1228 = 127 & s1226; const SWord8 s1229 = s1225 ? s1227 : s1228; const SWord8 s1230 = s1202 ? s1221 : s1229; const SWord8 s1231 = s1 + s1213; const SBool s1232 = s1231 < s1; const SBool s1233 = s1231 < s1213; const SBool s1234 = s1232 || s1233; const SWord8 s1235 = (s1231 >> 1) | (s1231 << 7); const SWord8 s1236 = 128 | s1235; const SWord8 s1237 = 127 & s1235; const SWord8 s1238 = s1234 ? s1236 : s1237; const SWord8 s1239 = (s1238 >> 1) | (s1238 << 7); const SWord8 s1240 = 128 | s1239; const SWord8 s1241 = 127 & s1239; const SWord8 s1242 = s1201 ? s1240 : s1241; const SWord8 s1243 = s1 + s1238; const SBool s1244 = s1243 < s1; const SBool s1245 = s1243 < s1238; const SBool s1246 = s1244 || s1245; const SWord8 s1247 = (s1243 >> 1) | (s1243 << 7); const SWord8 s1248 = 128 | s1247; const SWord8 s1249 = 127 & s1247; const SWord8 s1250 = s1246 ? s1248 : s1249; const SWord8 s1251 = s1202 ? s1242 : s1250; const SWord8 s1252 = s1078 ? s1230 : s1251; const SWord8 s1253 = s1 + s1209; const SBool s1254 = s1253 < s1; const SBool s1255 = s1253 < s1209; const SBool s1256 = s1254 || s1255; const SWord8 s1257 = (s1253 >> 1) | (s1253 << 7); const SWord8 s1258 = 128 | s1257; const SWord8 s1259 = 127 & s1257; const SWord8 s1260 = s1256 ? s1258 : s1259; const SWord8 s1261 = (s1260 >> 1) | (s1260 << 7); const SWord8 s1262 = 128 | s1261; const SWord8 s1263 = 127 & s1261; const SWord8 s1264 = s1077 ? s1262 : s1263; const SWord8 s1265 = (s1264 >> 1) | (s1264 << 7); const SWord8 s1266 = 128 | s1265; const SWord8 s1267 = 127 & s1265; const SWord8 s1268 = s1201 ? s1266 : s1267; const SWord8 s1269 = s1 + s1264; const SBool s1270 = s1269 < s1; const SBool s1271 = s1269 < s1264; const SBool s1272 = s1270 || s1271; const SWord8 s1273 = (s1269 >> 1) | (s1269 << 7); const SWord8 s1274 = 128 | s1273; const SWord8 s1275 = 127 & s1273; const SWord8 s1276 = s1272 ? s1274 : s1275; const SWord8 s1277 = s1202 ? s1268 : s1276; const SWord8 s1278 = s1 + s1260; const SBool s1279 = s1278 < s1; const SBool s1280 = s1278 < s1260; const SBool s1281 = s1279 || s1280; const SWord8 s1282 = (s1278 >> 1) | (s1278 << 7); const SWord8 s1283 = 128 | s1282; const SWord8 s1284 = 127 & s1282; const SWord8 s1285 = s1281 ? s1283 : s1284; const SWord8 s1286 = (s1285 >> 1) | (s1285 << 7); const SWord8 s1287 = 128 | s1286; const SWord8 s1288 = 127 & s1286; const SWord8 s1289 = s1201 ? s1287 : s1288; const SWord8 s1290 = s1 + s1285; const SBool s1291 = s1290 < s1; const SBool s1292 = s1290 < s1285; const SBool s1293 = s1291 || s1292; const SWord8 s1294 = (s1290 >> 1) | (s1290 << 7); const SWord8 s1295 = 128 | s1294; const SWord8 s1296 = 127 & s1294; const SWord8 s1297 = s1293 ? s1295 : s1296; const SWord8 s1298 = s1202 ? s1289 : s1297; const SWord8 s1299 = s1078 ? s1277 : s1298; const SWord8 s1300 = s1059 ? s1252 : s1299; const SWord8 s1301 = s1037 ? s1192 : s1300; const SWord8 s1302 = s1 + s1063; const SBool s1303 = (SBool) (s1302 & 1); const SBool s1304 = false != s1303; const SWord8 s1305 = s1304 ? s1067 : s1068; const SBool s1306 = (SBool) (s1305 & 1); const SBool s1307 = false != s1306; const SWord8 s1308 = s1307 ? s1073 : s1074; const SBool s1309 = (SBool) (s1308 & 1); const SBool s1310 = false != s1309; const SBool s1311 = false == s1310; const SBool s1312 = s1302 < s1; const SBool s1313 = s1302 < s1063; const SBool s1314 = s1312 || s1313; const SWord8 s1315 = (s1302 >> 1) | (s1302 << 7); const SWord8 s1316 = 128 | s1315; const SWord8 s1317 = 127 & s1315; const SWord8 s1318 = s1314 ? s1316 : s1317; const SBool s1319 = (SBool) (s1318 & 1); const SBool s1320 = false != s1319; const SWord8 s1321 = (s1305 >> 1) | (s1305 << 7); const SWord8 s1322 = 128 | s1321; const SWord8 s1323 = 127 & s1321; const SWord8 s1324 = s1320 ? s1322 : s1323; const SBool s1325 = (SBool) (s1324 & 1); const SBool s1326 = false != s1325; const SWord8 s1327 = (s1308 >> 1) | (s1308 << 7); const SWord8 s1328 = 128 | s1327; const SWord8 s1329 = 127 & s1327; const SWord8 s1330 = s1326 ? s1328 : s1329; const SBool s1331 = (SBool) (s1330 & 1); const SBool s1332 = false != s1331; const SBool s1333 = false == s1332; const SWord8 s1334 = (s1318 >> 1) | (s1318 << 7); const SWord8 s1335 = 128 | s1334; const SWord8 s1336 = 127 & s1334; const SWord8 s1337 = s1036 ? s1335 : s1336; const SWord8 s1338 = (s1337 >> 1) | (s1337 << 7); const SWord8 s1339 = 128 | s1338; const SWord8 s1340 = 127 & s1338; const SWord8 s1341 = s1058 ? s1339 : s1340; const SWord8 s1342 = (s1341 >> 1) | (s1341 << 7); const SWord8 s1343 = 128 | s1342; const SWord8 s1344 = 127 & s1342; const SWord8 s1345 = s1310 ? s1343 : s1344; const SWord8 s1346 = (s1345 >> 1) | (s1345 << 7); const SWord8 s1347 = 128 | s1346; const SWord8 s1348 = 127 & s1346; const SWord8 s1349 = s1332 ? s1347 : s1348; const SWord8 s1350 = s1 + s1345; const SBool s1351 = s1350 < s1; const SBool s1352 = s1350 < s1345; const SBool s1353 = s1351 || s1352; const SWord8 s1354 = (s1350 >> 1) | (s1350 << 7); const SWord8 s1355 = 128 | s1354; const SWord8 s1356 = 127 & s1354; const SWord8 s1357 = s1353 ? s1355 : s1356; const SWord8 s1358 = s1333 ? s1349 : s1357; const SWord8 s1359 = s1 + s1341; const SBool s1360 = s1359 < s1; const SBool s1361 = s1359 < s1341; const SBool s1362 = s1360 || s1361; const SWord8 s1363 = (s1359 >> 1) | (s1359 << 7); const SWord8 s1364 = 128 | s1363; const SWord8 s1365 = 127 & s1363; const SWord8 s1366 = s1362 ? s1364 : s1365; const SWord8 s1367 = (s1366 >> 1) | (s1366 << 7); const SWord8 s1368 = 128 | s1367; const SWord8 s1369 = 127 & s1367; const SWord8 s1370 = s1332 ? s1368 : s1369; const SWord8 s1371 = s1 + s1366; const SBool s1372 = s1371 < s1; const SBool s1373 = s1371 < s1366; const SBool s1374 = s1372 || s1373; const SWord8 s1375 = (s1371 >> 1) | (s1371 << 7); const SWord8 s1376 = 128 | s1375; const SWord8 s1377 = 127 & s1375; const SWord8 s1378 = s1374 ? s1376 : s1377; const SWord8 s1379 = s1333 ? s1370 : s1378; const SWord8 s1380 = s1311 ? s1358 : s1379; const SWord8 s1381 = s1 + s1337; const SBool s1382 = s1381 < s1; const SBool s1383 = s1381 < s1337; const SBool s1384 = s1382 || s1383; const SWord8 s1385 = (s1381 >> 1) | (s1381 << 7); const SWord8 s1386 = 128 | s1385; const SWord8 s1387 = 127 & s1385; const SWord8 s1388 = s1384 ? s1386 : s1387; const SWord8 s1389 = (s1388 >> 1) | (s1388 << 7); const SWord8 s1390 = 128 | s1389; const SWord8 s1391 = 127 & s1389; const SWord8 s1392 = s1310 ? s1390 : s1391; const SWord8 s1393 = (s1392 >> 1) | (s1392 << 7); const SWord8 s1394 = 128 | s1393; const SWord8 s1395 = 127 & s1393; const SWord8 s1396 = s1332 ? s1394 : s1395; const SWord8 s1397 = s1 + s1392; const SBool s1398 = s1397 < s1; const SBool s1399 = s1397 < s1392; const SBool s1400 = s1398 || s1399; const SWord8 s1401 = (s1397 >> 1) | (s1397 << 7); const SWord8 s1402 = 128 | s1401; const SWord8 s1403 = 127 & s1401; const SWord8 s1404 = s1400 ? s1402 : s1403; const SWord8 s1405 = s1333 ? s1396 : s1404; const SWord8 s1406 = s1 + s1388; const SBool s1407 = s1406 < s1; const SBool s1408 = s1406 < s1388; const SBool s1409 = s1407 || s1408; const SWord8 s1410 = (s1406 >> 1) | (s1406 << 7); const SWord8 s1411 = 128 | s1410; const SWord8 s1412 = 127 & s1410; const SWord8 s1413 = s1409 ? s1411 : s1412; const SWord8 s1414 = (s1413 >> 1) | (s1413 << 7); const SWord8 s1415 = 128 | s1414; const SWord8 s1416 = 127 & s1414; const SWord8 s1417 = s1332 ? s1415 : s1416; const SWord8 s1418 = s1 + s1413; const SBool s1419 = s1418 < s1; const SBool s1420 = s1418 < s1413; const SBool s1421 = s1419 || s1420; const SWord8 s1422 = (s1418 >> 1) | (s1418 << 7); const SWord8 s1423 = 128 | s1422; const SWord8 s1424 = 127 & s1422; const SWord8 s1425 = s1421 ? s1423 : s1424; const SWord8 s1426 = s1333 ? s1417 : s1425; const SWord8 s1427 = s1311 ? s1405 : s1426; const SWord8 s1428 = s1059 ? s1380 : s1427; const SWord8 s1429 = s1 + s1318; const SBool s1430 = (SBool) (s1429 & 1); const SBool s1431 = false != s1430; const SWord8 s1432 = s1431 ? s1322 : s1323; const SBool s1433 = (SBool) (s1432 & 1); const SBool s1434 = false != s1433; const SWord8 s1435 = s1434 ? s1328 : s1329; const SBool s1436 = (SBool) (s1435 & 1); const SBool s1437 = false != s1436; const SBool s1438 = false == s1437; const SBool s1439 = s1429 < s1; const SBool s1440 = s1429 < s1318; const SBool s1441 = s1439 || s1440; const SWord8 s1442 = (s1429 >> 1) | (s1429 << 7); const SWord8 s1443 = 128 | s1442; const SWord8 s1444 = 127 & s1442; const SWord8 s1445 = s1441 ? s1443 : s1444; const SWord8 s1446 = (s1445 >> 1) | (s1445 << 7); const SWord8 s1447 = 128 | s1446; const SWord8 s1448 = 127 & s1446; const SWord8 s1449 = s1058 ? s1447 : s1448; const SWord8 s1450 = (s1449 >> 1) | (s1449 << 7); const SWord8 s1451 = 128 | s1450; const SWord8 s1452 = 127 & s1450; const SWord8 s1453 = s1310 ? s1451 : s1452; const SWord8 s1454 = (s1453 >> 1) | (s1453 << 7); const SWord8 s1455 = 128 | s1454; const SWord8 s1456 = 127 & s1454; const SWord8 s1457 = s1437 ? s1455 : s1456; const SWord8 s1458 = s1 + s1453; const SBool s1459 = s1458 < s1; const SBool s1460 = s1458 < s1453; const SBool s1461 = s1459 || s1460; const SWord8 s1462 = (s1458 >> 1) | (s1458 << 7); const SWord8 s1463 = 128 | s1462; const SWord8 s1464 = 127 & s1462; const SWord8 s1465 = s1461 ? s1463 : s1464; const SWord8 s1466 = s1438 ? s1457 : s1465; const SWord8 s1467 = s1 + s1449; const SBool s1468 = s1467 < s1; const SBool s1469 = s1467 < s1449; const SBool s1470 = s1468 || s1469; const SWord8 s1471 = (s1467 >> 1) | (s1467 << 7); const SWord8 s1472 = 128 | s1471; const SWord8 s1473 = 127 & s1471; const SWord8 s1474 = s1470 ? s1472 : s1473; const SWord8 s1475 = (s1474 >> 1) | (s1474 << 7); const SWord8 s1476 = 128 | s1475; const SWord8 s1477 = 127 & s1475; const SWord8 s1478 = s1437 ? s1476 : s1477; const SWord8 s1479 = s1 + s1474; const SBool s1480 = s1479 < s1; const SBool s1481 = s1479 < s1474; const SBool s1482 = s1480 || s1481; const SWord8 s1483 = (s1479 >> 1) | (s1479 << 7); const SWord8 s1484 = 128 | s1483; const SWord8 s1485 = 127 & s1483; const SWord8 s1486 = s1482 ? s1484 : s1485; const SWord8 s1487 = s1438 ? s1478 : s1486; const SWord8 s1488 = s1311 ? s1466 : s1487; const SWord8 s1489 = s1 + s1445; const SBool s1490 = s1489 < s1; const SBool s1491 = s1489 < s1445; const SBool s1492 = s1490 || s1491; const SWord8 s1493 = (s1489 >> 1) | (s1489 << 7); const SWord8 s1494 = 128 | s1493; const SWord8 s1495 = 127 & s1493; const SWord8 s1496 = s1492 ? s1494 : s1495; const SWord8 s1497 = (s1496 >> 1) | (s1496 << 7); const SWord8 s1498 = 128 | s1497; const SWord8 s1499 = 127 & s1497; const SWord8 s1500 = s1310 ? s1498 : s1499; const SWord8 s1501 = (s1500 >> 1) | (s1500 << 7); const SWord8 s1502 = 128 | s1501; const SWord8 s1503 = 127 & s1501; const SWord8 s1504 = s1437 ? s1502 : s1503; const SWord8 s1505 = s1 + s1500; const SBool s1506 = s1505 < s1; const SBool s1507 = s1505 < s1500; const SBool s1508 = s1506 || s1507; const SWord8 s1509 = (s1505 >> 1) | (s1505 << 7); const SWord8 s1510 = 128 | s1509; const SWord8 s1511 = 127 & s1509; const SWord8 s1512 = s1508 ? s1510 : s1511; const SWord8 s1513 = s1438 ? s1504 : s1512; const SWord8 s1514 = s1 + s1496; const SBool s1515 = s1514 < s1; const SBool s1516 = s1514 < s1496; const SBool s1517 = s1515 || s1516; const SWord8 s1518 = (s1514 >> 1) | (s1514 << 7); const SWord8 s1519 = 128 | s1518; const SWord8 s1520 = 127 & s1518; const SWord8 s1521 = s1517 ? s1519 : s1520; const SWord8 s1522 = (s1521 >> 1) | (s1521 << 7); const SWord8 s1523 = 128 | s1522; const SWord8 s1524 = 127 & s1522; const SWord8 s1525 = s1437 ? s1523 : s1524; const SWord8 s1526 = s1 + s1521; const SBool s1527 = s1526 < s1; const SBool s1528 = s1526 < s1521; const SBool s1529 = s1527 || s1528; const SWord8 s1530 = (s1526 >> 1) | (s1526 << 7); const SWord8 s1531 = 128 | s1530; const SWord8 s1532 = 127 & s1530; const SWord8 s1533 = s1529 ? s1531 : s1532; const SWord8 s1534 = s1438 ? s1525 : s1533; const SWord8 s1535 = s1311 ? s1513 : s1534; const SWord8 s1536 = s1059 ? s1488 : s1535; const SWord8 s1537 = s1037 ? s1428 : s1536; const SWord8 s1538 = s21 ? s1301 : s1537; const SWord8 s1539 = s1 + s1044; const SBool s1540 = (SBool) (s1539 & 1); const SBool s1541 = false != s1540; const SWord8 s1542 = s1541 ? s1048 : s1049; const SBool s1543 = (SBool) (s1542 & 1); const SBool s1544 = false != s1543; const SWord8 s1545 = s1544 ? s1054 : s1055; const SBool s1546 = (SBool) (s1545 & 1); const SBool s1547 = false != s1546; const SBool s1548 = false == s1547; const SBool s1549 = s1539 < s1; const SBool s1550 = s1539 < s1044; const SBool s1551 = s1549 || s1550; const SWord8 s1552 = (s1539 >> 1) | (s1539 << 7); const SWord8 s1553 = 128 | s1552; const SWord8 s1554 = 127 & s1552; const SWord8 s1555 = s1551 ? s1553 : s1554; const SBool s1556 = (SBool) (s1555 & 1); const SBool s1557 = false != s1556; const SWord8 s1558 = (s1542 >> 1) | (s1542 << 7); const SWord8 s1559 = 128 | s1558; const SWord8 s1560 = 127 & s1558; const SWord8 s1561 = s1557 ? s1559 : s1560; const SBool s1562 = (SBool) (s1561 & 1); const SBool s1563 = false != s1562; const SWord8 s1564 = (s1545 >> 1) | (s1545 << 7); const SWord8 s1565 = 128 | s1564; const SWord8 s1566 = 127 & s1564; const SWord8 s1567 = s1563 ? s1565 : s1566; const SBool s1568 = (SBool) (s1567 & 1); const SBool s1569 = false != s1568; const SBool s1570 = false == s1569; const SWord8 s1571 = (s1555 >> 1) | (s1555 << 7); const SWord8 s1572 = 128 | s1571; const SWord8 s1573 = 127 & s1571; const SWord8 s1574 = s20 ? s1572 : s1573; const SBool s1575 = (SBool) (s1574 & 1); const SBool s1576 = false != s1575; const SWord8 s1577 = (s1561 >> 1) | (s1561 << 7); const SWord8 s1578 = 128 | s1577; const SWord8 s1579 = 127 & s1577; const SWord8 s1580 = s1576 ? s1578 : s1579; const SBool s1581 = (SBool) (s1580 & 1); const SBool s1582 = false != s1581; const SWord8 s1583 = (s1567 >> 1) | (s1567 << 7); const SWord8 s1584 = 128 | s1583; const SWord8 s1585 = 127 & s1583; const SWord8 s1586 = s1582 ? s1584 : s1585; const SBool s1587 = (SBool) (s1586 & 1); const SBool s1588 = false != s1587; const SBool s1589 = false == s1588; const SWord8 s1590 = (s1574 >> 1) | (s1574 << 7); const SWord8 s1591 = 128 | s1590; const SWord8 s1592 = 127 & s1590; const SWord8 s1593 = s1036 ? s1591 : s1592; const SWord8 s1594 = (s1593 >> 1) | (s1593 << 7); const SWord8 s1595 = 128 | s1594; const SWord8 s1596 = 127 & s1594; const SWord8 s1597 = s1547 ? s1595 : s1596; const SWord8 s1598 = (s1597 >> 1) | (s1597 << 7); const SWord8 s1599 = 128 | s1598; const SWord8 s1600 = 127 & s1598; const SWord8 s1601 = s1569 ? s1599 : s1600; const SWord8 s1602 = (s1601 >> 1) | (s1601 << 7); const SWord8 s1603 = 128 | s1602; const SWord8 s1604 = 127 & s1602; const SWord8 s1605 = s1588 ? s1603 : s1604; const SWord8 s1606 = s1 + s1601; const SBool s1607 = s1606 < s1; const SBool s1608 = s1606 < s1601; const SBool s1609 = s1607 || s1608; const SWord8 s1610 = (s1606 >> 1) | (s1606 << 7); const SWord8 s1611 = 128 | s1610; const SWord8 s1612 = 127 & s1610; const SWord8 s1613 = s1609 ? s1611 : s1612; const SWord8 s1614 = s1589 ? s1605 : s1613; const SWord8 s1615 = s1 + s1597; const SBool s1616 = s1615 < s1; const SBool s1617 = s1615 < s1597; const SBool s1618 = s1616 || s1617; const SWord8 s1619 = (s1615 >> 1) | (s1615 << 7); const SWord8 s1620 = 128 | s1619; const SWord8 s1621 = 127 & s1619; const SWord8 s1622 = s1618 ? s1620 : s1621; const SWord8 s1623 = (s1622 >> 1) | (s1622 << 7); const SWord8 s1624 = 128 | s1623; const SWord8 s1625 = 127 & s1623; const SWord8 s1626 = s1588 ? s1624 : s1625; const SWord8 s1627 = s1 + s1622; const SBool s1628 = s1627 < s1; const SBool s1629 = s1627 < s1622; const SBool s1630 = s1628 || s1629; const SWord8 s1631 = (s1627 >> 1) | (s1627 << 7); const SWord8 s1632 = 128 | s1631; const SWord8 s1633 = 127 & s1631; const SWord8 s1634 = s1630 ? s1632 : s1633; const SWord8 s1635 = s1589 ? s1626 : s1634; const SWord8 s1636 = s1570 ? s1614 : s1635; const SWord8 s1637 = s1 + s1593; const SBool s1638 = s1637 < s1; const SBool s1639 = s1637 < s1593; const SBool s1640 = s1638 || s1639; const SWord8 s1641 = (s1637 >> 1) | (s1637 << 7); const SWord8 s1642 = 128 | s1641; const SWord8 s1643 = 127 & s1641; const SWord8 s1644 = s1640 ? s1642 : s1643; const SWord8 s1645 = (s1644 >> 1) | (s1644 << 7); const SWord8 s1646 = 128 | s1645; const SWord8 s1647 = 127 & s1645; const SWord8 s1648 = s1569 ? s1646 : s1647; const SWord8 s1649 = (s1648 >> 1) | (s1648 << 7); const SWord8 s1650 = 128 | s1649; const SWord8 s1651 = 127 & s1649; const SWord8 s1652 = s1588 ? s1650 : s1651; const SWord8 s1653 = s1 + s1648; const SBool s1654 = s1653 < s1; const SBool s1655 = s1653 < s1648; const SBool s1656 = s1654 || s1655; const SWord8 s1657 = (s1653 >> 1) | (s1653 << 7); const SWord8 s1658 = 128 | s1657; const SWord8 s1659 = 127 & s1657; const SWord8 s1660 = s1656 ? s1658 : s1659; const SWord8 s1661 = s1589 ? s1652 : s1660; const SWord8 s1662 = s1 + s1644; const SBool s1663 = s1662 < s1; const SBool s1664 = s1662 < s1644; const SBool s1665 = s1663 || s1664; const SWord8 s1666 = (s1662 >> 1) | (s1662 << 7); const SWord8 s1667 = 128 | s1666; const SWord8 s1668 = 127 & s1666; const SWord8 s1669 = s1665 ? s1667 : s1668; const SWord8 s1670 = (s1669 >> 1) | (s1669 << 7); const SWord8 s1671 = 128 | s1670; const SWord8 s1672 = 127 & s1670; const SWord8 s1673 = s1588 ? s1671 : s1672; const SWord8 s1674 = s1 + s1669; const SBool s1675 = s1674 < s1; const SBool s1676 = s1674 < s1669; const SBool s1677 = s1675 || s1676; const SWord8 s1678 = (s1674 >> 1) | (s1674 << 7); const SWord8 s1679 = 128 | s1678; const SWord8 s1680 = 127 & s1678; const SWord8 s1681 = s1677 ? s1679 : s1680; const SWord8 s1682 = s1589 ? s1673 : s1681; const SWord8 s1683 = s1570 ? s1661 : s1682; const SWord8 s1684 = s1548 ? s1636 : s1683; const SWord8 s1685 = s1 + s1574; const SBool s1686 = (SBool) (s1685 & 1); const SBool s1687 = false != s1686; const SWord8 s1688 = s1687 ? s1578 : s1579; const SBool s1689 = (SBool) (s1688 & 1); const SBool s1690 = false != s1689; const SWord8 s1691 = s1690 ? s1584 : s1585; const SBool s1692 = (SBool) (s1691 & 1); const SBool s1693 = false != s1692; const SBool s1694 = false == s1693; const SBool s1695 = s1685 < s1; const SBool s1696 = s1685 < s1574; const SBool s1697 = s1695 || s1696; const SWord8 s1698 = (s1685 >> 1) | (s1685 << 7); const SWord8 s1699 = 128 | s1698; const SWord8 s1700 = 127 & s1698; const SWord8 s1701 = s1697 ? s1699 : s1700; const SWord8 s1702 = (s1701 >> 1) | (s1701 << 7); const SWord8 s1703 = 128 | s1702; const SWord8 s1704 = 127 & s1702; const SWord8 s1705 = s1547 ? s1703 : s1704; const SWord8 s1706 = (s1705 >> 1) | (s1705 << 7); const SWord8 s1707 = 128 | s1706; const SWord8 s1708 = 127 & s1706; const SWord8 s1709 = s1569 ? s1707 : s1708; const SWord8 s1710 = (s1709 >> 1) | (s1709 << 7); const SWord8 s1711 = 128 | s1710; const SWord8 s1712 = 127 & s1710; const SWord8 s1713 = s1693 ? s1711 : s1712; const SWord8 s1714 = s1 + s1709; const SBool s1715 = s1714 < s1; const SBool s1716 = s1714 < s1709; const SBool s1717 = s1715 || s1716; const SWord8 s1718 = (s1714 >> 1) | (s1714 << 7); const SWord8 s1719 = 128 | s1718; const SWord8 s1720 = 127 & s1718; const SWord8 s1721 = s1717 ? s1719 : s1720; const SWord8 s1722 = s1694 ? s1713 : s1721; const SWord8 s1723 = s1 + s1705; const SBool s1724 = s1723 < s1; const SBool s1725 = s1723 < s1705; const SBool s1726 = s1724 || s1725; const SWord8 s1727 = (s1723 >> 1) | (s1723 << 7); const SWord8 s1728 = 128 | s1727; const SWord8 s1729 = 127 & s1727; const SWord8 s1730 = s1726 ? s1728 : s1729; const SWord8 s1731 = (s1730 >> 1) | (s1730 << 7); const SWord8 s1732 = 128 | s1731; const SWord8 s1733 = 127 & s1731; const SWord8 s1734 = s1693 ? s1732 : s1733; const SWord8 s1735 = s1 + s1730; const SBool s1736 = s1735 < s1; const SBool s1737 = s1735 < s1730; const SBool s1738 = s1736 || s1737; const SWord8 s1739 = (s1735 >> 1) | (s1735 << 7); const SWord8 s1740 = 128 | s1739; const SWord8 s1741 = 127 & s1739; const SWord8 s1742 = s1738 ? s1740 : s1741; const SWord8 s1743 = s1694 ? s1734 : s1742; const SWord8 s1744 = s1570 ? s1722 : s1743; const SWord8 s1745 = s1 + s1701; const SBool s1746 = s1745 < s1; const SBool s1747 = s1745 < s1701; const SBool s1748 = s1746 || s1747; const SWord8 s1749 = (s1745 >> 1) | (s1745 << 7); const SWord8 s1750 = 128 | s1749; const SWord8 s1751 = 127 & s1749; const SWord8 s1752 = s1748 ? s1750 : s1751; const SWord8 s1753 = (s1752 >> 1) | (s1752 << 7); const SWord8 s1754 = 128 | s1753; const SWord8 s1755 = 127 & s1753; const SWord8 s1756 = s1569 ? s1754 : s1755; const SWord8 s1757 = (s1756 >> 1) | (s1756 << 7); const SWord8 s1758 = 128 | s1757; const SWord8 s1759 = 127 & s1757; const SWord8 s1760 = s1693 ? s1758 : s1759; const SWord8 s1761 = s1 + s1756; const SBool s1762 = s1761 < s1; const SBool s1763 = s1761 < s1756; const SBool s1764 = s1762 || s1763; const SWord8 s1765 = (s1761 >> 1) | (s1761 << 7); const SWord8 s1766 = 128 | s1765; const SWord8 s1767 = 127 & s1765; const SWord8 s1768 = s1764 ? s1766 : s1767; const SWord8 s1769 = s1694 ? s1760 : s1768; const SWord8 s1770 = s1 + s1752; const SBool s1771 = s1770 < s1; const SBool s1772 = s1770 < s1752; const SBool s1773 = s1771 || s1772; const SWord8 s1774 = (s1770 >> 1) | (s1770 << 7); const SWord8 s1775 = 128 | s1774; const SWord8 s1776 = 127 & s1774; const SWord8 s1777 = s1773 ? s1775 : s1776; const SWord8 s1778 = (s1777 >> 1) | (s1777 << 7); const SWord8 s1779 = 128 | s1778; const SWord8 s1780 = 127 & s1778; const SWord8 s1781 = s1693 ? s1779 : s1780; const SWord8 s1782 = s1 + s1777; const SBool s1783 = s1782 < s1; const SBool s1784 = s1782 < s1777; const SBool s1785 = s1783 || s1784; const SWord8 s1786 = (s1782 >> 1) | (s1782 << 7); const SWord8 s1787 = 128 | s1786; const SWord8 s1788 = 127 & s1786; const SWord8 s1789 = s1785 ? s1787 : s1788; const SWord8 s1790 = s1694 ? s1781 : s1789; const SWord8 s1791 = s1570 ? s1769 : s1790; const SWord8 s1792 = s1548 ? s1744 : s1791; const SWord8 s1793 = s1037 ? s1684 : s1792; const SWord8 s1794 = s1 + s1555; const SBool s1795 = (SBool) (s1794 & 1); const SBool s1796 = false != s1795; const SWord8 s1797 = s1796 ? s1559 : s1560; const SBool s1798 = (SBool) (s1797 & 1); const SBool s1799 = false != s1798; const SWord8 s1800 = s1799 ? s1565 : s1566; const SBool s1801 = (SBool) (s1800 & 1); const SBool s1802 = false != s1801; const SBool s1803 = false == s1802; const SBool s1804 = s1794 < s1; const SBool s1805 = s1794 < s1555; const SBool s1806 = s1804 || s1805; const SWord8 s1807 = (s1794 >> 1) | (s1794 << 7); const SWord8 s1808 = 128 | s1807; const SWord8 s1809 = 127 & s1807; const SWord8 s1810 = s1806 ? s1808 : s1809; const SBool s1811 = (SBool) (s1810 & 1); const SBool s1812 = false != s1811; const SWord8 s1813 = (s1797 >> 1) | (s1797 << 7); const SWord8 s1814 = 128 | s1813; const SWord8 s1815 = 127 & s1813; const SWord8 s1816 = s1812 ? s1814 : s1815; const SBool s1817 = (SBool) (s1816 & 1); const SBool s1818 = false != s1817; const SWord8 s1819 = (s1800 >> 1) | (s1800 << 7); const SWord8 s1820 = 128 | s1819; const SWord8 s1821 = 127 & s1819; const SWord8 s1822 = s1818 ? s1820 : s1821; const SBool s1823 = (SBool) (s1822 & 1); const SBool s1824 = false != s1823; const SBool s1825 = false == s1824; const SWord8 s1826 = (s1810 >> 1) | (s1810 << 7); const SWord8 s1827 = 128 | s1826; const SWord8 s1828 = 127 & s1826; const SWord8 s1829 = s1036 ? s1827 : s1828; const SWord8 s1830 = (s1829 >> 1) | (s1829 << 7); const SWord8 s1831 = 128 | s1830; const SWord8 s1832 = 127 & s1830; const SWord8 s1833 = s1547 ? s1831 : s1832; const SWord8 s1834 = (s1833 >> 1) | (s1833 << 7); const SWord8 s1835 = 128 | s1834; const SWord8 s1836 = 127 & s1834; const SWord8 s1837 = s1802 ? s1835 : s1836; const SWord8 s1838 = (s1837 >> 1) | (s1837 << 7); const SWord8 s1839 = 128 | s1838; const SWord8 s1840 = 127 & s1838; const SWord8 s1841 = s1824 ? s1839 : s1840; const SWord8 s1842 = s1 + s1837; const SBool s1843 = s1842 < s1; const SBool s1844 = s1842 < s1837; const SBool s1845 = s1843 || s1844; const SWord8 s1846 = (s1842 >> 1) | (s1842 << 7); const SWord8 s1847 = 128 | s1846; const SWord8 s1848 = 127 & s1846; const SWord8 s1849 = s1845 ? s1847 : s1848; const SWord8 s1850 = s1825 ? s1841 : s1849; const SWord8 s1851 = s1 + s1833; const SBool s1852 = s1851 < s1; const SBool s1853 = s1851 < s1833; const SBool s1854 = s1852 || s1853; const SWord8 s1855 = (s1851 >> 1) | (s1851 << 7); const SWord8 s1856 = 128 | s1855; const SWord8 s1857 = 127 & s1855; const SWord8 s1858 = s1854 ? s1856 : s1857; const SWord8 s1859 = (s1858 >> 1) | (s1858 << 7); const SWord8 s1860 = 128 | s1859; const SWord8 s1861 = 127 & s1859; const SWord8 s1862 = s1824 ? s1860 : s1861; const SWord8 s1863 = s1 + s1858; const SBool s1864 = s1863 < s1; const SBool s1865 = s1863 < s1858; const SBool s1866 = s1864 || s1865; const SWord8 s1867 = (s1863 >> 1) | (s1863 << 7); const SWord8 s1868 = 128 | s1867; const SWord8 s1869 = 127 & s1867; const SWord8 s1870 = s1866 ? s1868 : s1869; const SWord8 s1871 = s1825 ? s1862 : s1870; const SWord8 s1872 = s1803 ? s1850 : s1871; const SWord8 s1873 = s1 + s1829; const SBool s1874 = s1873 < s1; const SBool s1875 = s1873 < s1829; const SBool s1876 = s1874 || s1875; const SWord8 s1877 = (s1873 >> 1) | (s1873 << 7); const SWord8 s1878 = 128 | s1877; const SWord8 s1879 = 127 & s1877; const SWord8 s1880 = s1876 ? s1878 : s1879; const SWord8 s1881 = (s1880 >> 1) | (s1880 << 7); const SWord8 s1882 = 128 | s1881; const SWord8 s1883 = 127 & s1881; const SWord8 s1884 = s1802 ? s1882 : s1883; const SWord8 s1885 = (s1884 >> 1) | (s1884 << 7); const SWord8 s1886 = 128 | s1885; const SWord8 s1887 = 127 & s1885; const SWord8 s1888 = s1824 ? s1886 : s1887; const SWord8 s1889 = s1 + s1884; const SBool s1890 = s1889 < s1; const SBool s1891 = s1889 < s1884; const SBool s1892 = s1890 || s1891; const SWord8 s1893 = (s1889 >> 1) | (s1889 << 7); const SWord8 s1894 = 128 | s1893; const SWord8 s1895 = 127 & s1893; const SWord8 s1896 = s1892 ? s1894 : s1895; const SWord8 s1897 = s1825 ? s1888 : s1896; const SWord8 s1898 = s1 + s1880; const SBool s1899 = s1898 < s1; const SBool s1900 = s1898 < s1880; const SBool s1901 = s1899 || s1900; const SWord8 s1902 = (s1898 >> 1) | (s1898 << 7); const SWord8 s1903 = 128 | s1902; const SWord8 s1904 = 127 & s1902; const SWord8 s1905 = s1901 ? s1903 : s1904; const SWord8 s1906 = (s1905 >> 1) | (s1905 << 7); const SWord8 s1907 = 128 | s1906; const SWord8 s1908 = 127 & s1906; const SWord8 s1909 = s1824 ? s1907 : s1908; const SWord8 s1910 = s1 + s1905; const SBool s1911 = s1910 < s1; const SBool s1912 = s1910 < s1905; const SBool s1913 = s1911 || s1912; const SWord8 s1914 = (s1910 >> 1) | (s1910 << 7); const SWord8 s1915 = 128 | s1914; const SWord8 s1916 = 127 & s1914; const SWord8 s1917 = s1913 ? s1915 : s1916; const SWord8 s1918 = s1825 ? s1909 : s1917; const SWord8 s1919 = s1803 ? s1897 : s1918; const SWord8 s1920 = s1548 ? s1872 : s1919; const SWord8 s1921 = s1 + s1810; const SBool s1922 = (SBool) (s1921 & 1); const SBool s1923 = false != s1922; const SWord8 s1924 = s1923 ? s1814 : s1815; const SBool s1925 = (SBool) (s1924 & 1); const SBool s1926 = false != s1925; const SWord8 s1927 = s1926 ? s1820 : s1821; const SBool s1928 = (SBool) (s1927 & 1); const SBool s1929 = false != s1928; const SBool s1930 = false == s1929; const SBool s1931 = s1921 < s1; const SBool s1932 = s1921 < s1810; const SBool s1933 = s1931 || s1932; const SWord8 s1934 = (s1921 >> 1) | (s1921 << 7); const SWord8 s1935 = 128 | s1934; const SWord8 s1936 = 127 & s1934; const SWord8 s1937 = s1933 ? s1935 : s1936; const SWord8 s1938 = (s1937 >> 1) | (s1937 << 7); const SWord8 s1939 = 128 | s1938; const SWord8 s1940 = 127 & s1938; const SWord8 s1941 = s1547 ? s1939 : s1940; const SWord8 s1942 = (s1941 >> 1) | (s1941 << 7); const SWord8 s1943 = 128 | s1942; const SWord8 s1944 = 127 & s1942; const SWord8 s1945 = s1802 ? s1943 : s1944; const SWord8 s1946 = (s1945 >> 1) | (s1945 << 7); const SWord8 s1947 = 128 | s1946; const SWord8 s1948 = 127 & s1946; const SWord8 s1949 = s1929 ? s1947 : s1948; const SWord8 s1950 = s1 + s1945; const SBool s1951 = s1950 < s1; const SBool s1952 = s1950 < s1945; const SBool s1953 = s1951 || s1952; const SWord8 s1954 = (s1950 >> 1) | (s1950 << 7); const SWord8 s1955 = 128 | s1954; const SWord8 s1956 = 127 & s1954; const SWord8 s1957 = s1953 ? s1955 : s1956; const SWord8 s1958 = s1930 ? s1949 : s1957; const SWord8 s1959 = s1 + s1941; const SBool s1960 = s1959 < s1; const SBool s1961 = s1959 < s1941; const SBool s1962 = s1960 || s1961; const SWord8 s1963 = (s1959 >> 1) | (s1959 << 7); const SWord8 s1964 = 128 | s1963; const SWord8 s1965 = 127 & s1963; const SWord8 s1966 = s1962 ? s1964 : s1965; const SWord8 s1967 = (s1966 >> 1) | (s1966 << 7); const SWord8 s1968 = 128 | s1967; const SWord8 s1969 = 127 & s1967; const SWord8 s1970 = s1929 ? s1968 : s1969; const SWord8 s1971 = s1 + s1966; const SBool s1972 = s1971 < s1; const SBool s1973 = s1971 < s1966; const SBool s1974 = s1972 || s1973; const SWord8 s1975 = (s1971 >> 1) | (s1971 << 7); const SWord8 s1976 = 128 | s1975; const SWord8 s1977 = 127 & s1975; const SWord8 s1978 = s1974 ? s1976 : s1977; const SWord8 s1979 = s1930 ? s1970 : s1978; const SWord8 s1980 = s1803 ? s1958 : s1979; const SWord8 s1981 = s1 + s1937; const SBool s1982 = s1981 < s1; const SBool s1983 = s1981 < s1937; const SBool s1984 = s1982 || s1983; const SWord8 s1985 = (s1981 >> 1) | (s1981 << 7); const SWord8 s1986 = 128 | s1985; const SWord8 s1987 = 127 & s1985; const SWord8 s1988 = s1984 ? s1986 : s1987; const SWord8 s1989 = (s1988 >> 1) | (s1988 << 7); const SWord8 s1990 = 128 | s1989; const SWord8 s1991 = 127 & s1989; const SWord8 s1992 = s1802 ? s1990 : s1991; const SWord8 s1993 = (s1992 >> 1) | (s1992 << 7); const SWord8 s1994 = 128 | s1993; const SWord8 s1995 = 127 & s1993; const SWord8 s1996 = s1929 ? s1994 : s1995; const SWord8 s1997 = s1 + s1992; const SBool s1998 = s1997 < s1; const SBool s1999 = s1997 < s1992; const SBool s2000 = s1998 || s1999; const SWord8 s2001 = (s1997 >> 1) | (s1997 << 7); const SWord8 s2002 = 128 | s2001; const SWord8 s2003 = 127 & s2001; const SWord8 s2004 = s2000 ? s2002 : s2003; const SWord8 s2005 = s1930 ? s1996 : s2004; const SWord8 s2006 = s1 + s1988; const SBool s2007 = s2006 < s1; const SBool s2008 = s2006 < s1988; const SBool s2009 = s2007 || s2008; const SWord8 s2010 = (s2006 >> 1) | (s2006 << 7); const SWord8 s2011 = 128 | s2010; const SWord8 s2012 = 127 & s2010; const SWord8 s2013 = s2009 ? s2011 : s2012; const SWord8 s2014 = (s2013 >> 1) | (s2013 << 7); const SWord8 s2015 = 128 | s2014; const SWord8 s2016 = 127 & s2014; const SWord8 s2017 = s1929 ? s2015 : s2016; const SWord8 s2018 = s1 + s2013; const SBool s2019 = s2018 < s1; const SBool s2020 = s2018 < s2013; const SBool s2021 = s2019 || s2020; const SWord8 s2022 = (s2018 >> 1) | (s2018 << 7); const SWord8 s2023 = 128 | s2022; const SWord8 s2024 = 127 & s2022; const SWord8 s2025 = s2021 ? s2023 : s2024; const SWord8 s2026 = s1930 ? s2017 : s2025; const SWord8 s2027 = s1803 ? s2005 : s2026; const SWord8 s2028 = s1548 ? s1980 : s2027; const SWord8 s2029 = s1037 ? s1920 : s2028; const SWord8 s2030 = s21 ? s1793 : s2029; const SWord8 s2031 = s16 ? s1538 : s2030; const SWord8 s2032 = s11 ? s1027 : s2031; const SBool s2033 = (SBool) (s1 & 1); const SBool s2034 = false != s2033; const SWord8 s2035 = s2034 ? 128 : 0; const SBool s2036 = (SBool) (s2035 & 1); const SBool s2037 = false != s2036; const SWord8 s2038 = s17 | 128; const SWord8 s2039 = s2037 ? s2038 : s18; const SBool s2040 = (SBool) (s2039 & 1); const SBool s2041 = false != s2040; const SBool s2042 = false == s2041; const SWord8 s2043 = (s1 >> 1) | (s1 << 7); const SWord8 s2044 = 127 & s2043; const SBool s2045 = (SBool) (s2044 & 1); const SBool s2046 = false != s2045; const SWord8 s2047 = (s2035 >> 1) | (s2035 << 7); const SWord8 s2048 = 128 | s2047; const SWord8 s2049 = 127 & s2047; const SWord8 s2050 = s2046 ? s2048 : s2049; const SBool s2051 = (SBool) (s2050 & 1); const SBool s2052 = false != s2051; const SWord8 s2053 = (s2039 >> 1) | (s2039 << 7); const SWord8 s2054 = 128 | s2053; const SWord8 s2055 = 127 & s2053; const SWord8 s2056 = s2052 ? s2054 : s2055; const SBool s2057 = (SBool) (s2056 & 1); const SBool s2058 = false != s2057; const SBool s2059 = false == s2058; const SWord8 s2060 = (s2044 >> 1) | (s2044 << 7); const SWord8 s2061 = 128 | s2060; const SWord8 s2062 = 127 & s2060; const SWord8 s2063 = s10 ? s2061 : s2062; const SBool s2064 = (SBool) (s2063 & 1); const SBool s2065 = false != s2064; const SWord8 s2066 = (s2050 >> 1) | (s2050 << 7); const SWord8 s2067 = 128 | s2066; const SWord8 s2068 = 127 & s2066; const SWord8 s2069 = s2065 ? s2067 : s2068; const SBool s2070 = (SBool) (s2069 & 1); const SBool s2071 = false != s2070; const SWord8 s2072 = (s2056 >> 1) | (s2056 << 7); const SWord8 s2073 = 128 | s2072; const SWord8 s2074 = 127 & s2072; const SWord8 s2075 = s2071 ? s2073 : s2074; const SBool s2076 = (SBool) (s2075 & 1); const SBool s2077 = false != s2076; const SBool s2078 = false == s2077; const SWord8 s2079 = (s2063 >> 1) | (s2063 << 7); const SWord8 s2080 = 128 | s2079; const SWord8 s2081 = 127 & s2079; const SWord8 s2082 = s15 ? s2080 : s2081; const SBool s2083 = (SBool) (s2082 & 1); const SBool s2084 = false != s2083; const SWord8 s2085 = (s2069 >> 1) | (s2069 << 7); const SWord8 s2086 = 128 | s2085; const SWord8 s2087 = 127 & s2085; const SWord8 s2088 = s2084 ? s2086 : s2087; const SBool s2089 = (SBool) (s2088 & 1); const SBool s2090 = false != s2089; const SWord8 s2091 = (s2075 >> 1) | (s2075 << 7); const SWord8 s2092 = 128 | s2091; const SWord8 s2093 = 127 & s2091; const SWord8 s2094 = s2090 ? s2092 : s2093; const SBool s2095 = (SBool) (s2094 & 1); const SBool s2096 = false != s2095; const SBool s2097 = false == s2096; const SWord8 s2098 = (s2082 >> 1) | (s2082 << 7); const SWord8 s2099 = 128 | s2098; const SWord8 s2100 = 127 & s2098; const SWord8 s2101 = s2041 ? s2099 : s2100; const SBool s2102 = (SBool) (s2101 & 1); const SBool s2103 = false != s2102; const SWord8 s2104 = (s2088 >> 1) | (s2088 << 7); const SWord8 s2105 = 128 | s2104; const SWord8 s2106 = 127 & s2104; const SWord8 s2107 = s2103 ? s2105 : s2106; const SBool s2108 = (SBool) (s2107 & 1); const SBool s2109 = false != s2108; const SWord8 s2110 = (s2094 >> 1) | (s2094 << 7); const SWord8 s2111 = 128 | s2110; const SWord8 s2112 = 127 & s2110; const SWord8 s2113 = s2109 ? s2111 : s2112; const SBool s2114 = (SBool) (s2113 & 1); const SBool s2115 = false != s2114; const SBool s2116 = false == s2115; const SWord8 s2117 = (s2101 >> 1) | (s2101 << 7); const SWord8 s2118 = 128 | s2117; const SWord8 s2119 = 127 & s2117; const SWord8 s2120 = s2058 ? s2118 : s2119; const SWord8 s2121 = (s2120 >> 1) | (s2120 << 7); const SWord8 s2122 = 128 | s2121; const SWord8 s2123 = 127 & s2121; const SWord8 s2124 = s2077 ? s2122 : s2123; const SWord8 s2125 = (s2124 >> 1) | (s2124 << 7); const SWord8 s2126 = 128 | s2125; const SWord8 s2127 = 127 & s2125; const SWord8 s2128 = s2096 ? s2126 : s2127; const SWord8 s2129 = (s2128 >> 1) | (s2128 << 7); const SWord8 s2130 = 128 | s2129; const SWord8 s2131 = 127 & s2129; const SWord8 s2132 = s2115 ? s2130 : s2131; const SWord8 s2133 = s1 + s2128; const SBool s2134 = s2133 < s1; const SBool s2135 = s2133 < s2128; const SBool s2136 = s2134 || s2135; const SWord8 s2137 = (s2133 >> 1) | (s2133 << 7); const SWord8 s2138 = 128 | s2137; const SWord8 s2139 = 127 & s2137; const SWord8 s2140 = s2136 ? s2138 : s2139; const SWord8 s2141 = s2116 ? s2132 : s2140; const SWord8 s2142 = s1 + s2124; const SBool s2143 = s2142 < s1; const SBool s2144 = s2142 < s2124; const SBool s2145 = s2143 || s2144; const SWord8 s2146 = (s2142 >> 1) | (s2142 << 7); const SWord8 s2147 = 128 | s2146; const SWord8 s2148 = 127 & s2146; const SWord8 s2149 = s2145 ? s2147 : s2148; const SWord8 s2150 = (s2149 >> 1) | (s2149 << 7); const SWord8 s2151 = 128 | s2150; const SWord8 s2152 = 127 & s2150; const SWord8 s2153 = s2115 ? s2151 : s2152; const SWord8 s2154 = s1 + s2149; const SBool s2155 = s2154 < s1; const SBool s2156 = s2154 < s2149; const SBool s2157 = s2155 || s2156; const SWord8 s2158 = (s2154 >> 1) | (s2154 << 7); const SWord8 s2159 = 128 | s2158; const SWord8 s2160 = 127 & s2158; const SWord8 s2161 = s2157 ? s2159 : s2160; const SWord8 s2162 = s2116 ? s2153 : s2161; const SWord8 s2163 = s2097 ? s2141 : s2162; const SWord8 s2164 = s1 + s2120; const SBool s2165 = s2164 < s1; const SBool s2166 = s2164 < s2120; const SBool s2167 = s2165 || s2166; const SWord8 s2168 = (s2164 >> 1) | (s2164 << 7); const SWord8 s2169 = 128 | s2168; const SWord8 s2170 = 127 & s2168; const SWord8 s2171 = s2167 ? s2169 : s2170; const SWord8 s2172 = (s2171 >> 1) | (s2171 << 7); const SWord8 s2173 = 128 | s2172; const SWord8 s2174 = 127 & s2172; const SWord8 s2175 = s2096 ? s2173 : s2174; const SWord8 s2176 = (s2175 >> 1) | (s2175 << 7); const SWord8 s2177 = 128 | s2176; const SWord8 s2178 = 127 & s2176; const SWord8 s2179 = s2115 ? s2177 : s2178; const SWord8 s2180 = s1 + s2175; const SBool s2181 = s2180 < s1; const SBool s2182 = s2180 < s2175; const SBool s2183 = s2181 || s2182; const SWord8 s2184 = (s2180 >> 1) | (s2180 << 7); const SWord8 s2185 = 128 | s2184; const SWord8 s2186 = 127 & s2184; const SWord8 s2187 = s2183 ? s2185 : s2186; const SWord8 s2188 = s2116 ? s2179 : s2187; const SWord8 s2189 = s1 + s2171; const SBool s2190 = s2189 < s1; const SBool s2191 = s2189 < s2171; const SBool s2192 = s2190 || s2191; const SWord8 s2193 = (s2189 >> 1) | (s2189 << 7); const SWord8 s2194 = 128 | s2193; const SWord8 s2195 = 127 & s2193; const SWord8 s2196 = s2192 ? s2194 : s2195; const SWord8 s2197 = (s2196 >> 1) | (s2196 << 7); const SWord8 s2198 = 128 | s2197; const SWord8 s2199 = 127 & s2197; const SWord8 s2200 = s2115 ? s2198 : s2199; const SWord8 s2201 = s1 + s2196; const SBool s2202 = s2201 < s1; const SBool s2203 = s2201 < s2196; const SBool s2204 = s2202 || s2203; const SWord8 s2205 = (s2201 >> 1) | (s2201 << 7); const SWord8 s2206 = 128 | s2205; const SWord8 s2207 = 127 & s2205; const SWord8 s2208 = s2204 ? s2206 : s2207; const SWord8 s2209 = s2116 ? s2200 : s2208; const SWord8 s2210 = s2097 ? s2188 : s2209; const SWord8 s2211 = s2078 ? s2163 : s2210; const SWord8 s2212 = s1 + s2101; const SBool s2213 = (SBool) (s2212 & 1); const SBool s2214 = false != s2213; const SWord8 s2215 = s2214 ? s2105 : s2106; const SBool s2216 = (SBool) (s2215 & 1); const SBool s2217 = false != s2216; const SWord8 s2218 = s2217 ? s2111 : s2112; const SBool s2219 = (SBool) (s2218 & 1); const SBool s2220 = false != s2219; const SBool s2221 = false == s2220; const SBool s2222 = s2212 < s1; const SBool s2223 = s2212 < s2101; const SBool s2224 = s2222 || s2223; const SWord8 s2225 = (s2212 >> 1) | (s2212 << 7); const SWord8 s2226 = 128 | s2225; const SWord8 s2227 = 127 & s2225; const SWord8 s2228 = s2224 ? s2226 : s2227; const SWord8 s2229 = (s2228 >> 1) | (s2228 << 7); const SWord8 s2230 = 128 | s2229; const SWord8 s2231 = 127 & s2229; const SWord8 s2232 = s2077 ? s2230 : s2231; const SWord8 s2233 = (s2232 >> 1) | (s2232 << 7); const SWord8 s2234 = 128 | s2233; const SWord8 s2235 = 127 & s2233; const SWord8 s2236 = s2096 ? s2234 : s2235; const SWord8 s2237 = (s2236 >> 1) | (s2236 << 7); const SWord8 s2238 = 128 | s2237; const SWord8 s2239 = 127 & s2237; const SWord8 s2240 = s2220 ? s2238 : s2239; const SWord8 s2241 = s1 + s2236; const SBool s2242 = s2241 < s1; const SBool s2243 = s2241 < s2236; const SBool s2244 = s2242 || s2243; const SWord8 s2245 = (s2241 >> 1) | (s2241 << 7); const SWord8 s2246 = 128 | s2245; const SWord8 s2247 = 127 & s2245; const SWord8 s2248 = s2244 ? s2246 : s2247; const SWord8 s2249 = s2221 ? s2240 : s2248; const SWord8 s2250 = s1 + s2232; const SBool s2251 = s2250 < s1; const SBool s2252 = s2250 < s2232; const SBool s2253 = s2251 || s2252; const SWord8 s2254 = (s2250 >> 1) | (s2250 << 7); const SWord8 s2255 = 128 | s2254; const SWord8 s2256 = 127 & s2254; const SWord8 s2257 = s2253 ? s2255 : s2256; const SWord8 s2258 = (s2257 >> 1) | (s2257 << 7); const SWord8 s2259 = 128 | s2258; const SWord8 s2260 = 127 & s2258; const SWord8 s2261 = s2220 ? s2259 : s2260; const SWord8 s2262 = s1 + s2257; const SBool s2263 = s2262 < s1; const SBool s2264 = s2262 < s2257; const SBool s2265 = s2263 || s2264; const SWord8 s2266 = (s2262 >> 1) | (s2262 << 7); const SWord8 s2267 = 128 | s2266; const SWord8 s2268 = 127 & s2266; const SWord8 s2269 = s2265 ? s2267 : s2268; const SWord8 s2270 = s2221 ? s2261 : s2269; const SWord8 s2271 = s2097 ? s2249 : s2270; const SWord8 s2272 = s1 + s2228; const SBool s2273 = s2272 < s1; const SBool s2274 = s2272 < s2228; const SBool s2275 = s2273 || s2274; const SWord8 s2276 = (s2272 >> 1) | (s2272 << 7); const SWord8 s2277 = 128 | s2276; const SWord8 s2278 = 127 & s2276; const SWord8 s2279 = s2275 ? s2277 : s2278; const SWord8 s2280 = (s2279 >> 1) | (s2279 << 7); const SWord8 s2281 = 128 | s2280; const SWord8 s2282 = 127 & s2280; const SWord8 s2283 = s2096 ? s2281 : s2282; const SWord8 s2284 = (s2283 >> 1) | (s2283 << 7); const SWord8 s2285 = 128 | s2284; const SWord8 s2286 = 127 & s2284; const SWord8 s2287 = s2220 ? s2285 : s2286; const SWord8 s2288 = s1 + s2283; const SBool s2289 = s2288 < s1; const SBool s2290 = s2288 < s2283; const SBool s2291 = s2289 || s2290; const SWord8 s2292 = (s2288 >> 1) | (s2288 << 7); const SWord8 s2293 = 128 | s2292; const SWord8 s2294 = 127 & s2292; const SWord8 s2295 = s2291 ? s2293 : s2294; const SWord8 s2296 = s2221 ? s2287 : s2295; const SWord8 s2297 = s1 + s2279; const SBool s2298 = s2297 < s1; const SBool s2299 = s2297 < s2279; const SBool s2300 = s2298 || s2299; const SWord8 s2301 = (s2297 >> 1) | (s2297 << 7); const SWord8 s2302 = 128 | s2301; const SWord8 s2303 = 127 & s2301; const SWord8 s2304 = s2300 ? s2302 : s2303; const SWord8 s2305 = (s2304 >> 1) | (s2304 << 7); const SWord8 s2306 = 128 | s2305; const SWord8 s2307 = 127 & s2305; const SWord8 s2308 = s2220 ? s2306 : s2307; const SWord8 s2309 = s1 + s2304; const SBool s2310 = s2309 < s1; const SBool s2311 = s2309 < s2304; const SBool s2312 = s2310 || s2311; const SWord8 s2313 = (s2309 >> 1) | (s2309 << 7); const SWord8 s2314 = 128 | s2313; const SWord8 s2315 = 127 & s2313; const SWord8 s2316 = s2312 ? s2314 : s2315; const SWord8 s2317 = s2221 ? s2308 : s2316; const SWord8 s2318 = s2097 ? s2296 : s2317; const SWord8 s2319 = s2078 ? s2271 : s2318; const SWord8 s2320 = s2059 ? s2211 : s2319; const SWord8 s2321 = s1 + s2082; const SBool s2322 = (SBool) (s2321 & 1); const SBool s2323 = false != s2322; const SWord8 s2324 = s2323 ? s2086 : s2087; const SBool s2325 = (SBool) (s2324 & 1); const SBool s2326 = false != s2325; const SWord8 s2327 = s2326 ? s2092 : s2093; const SBool s2328 = (SBool) (s2327 & 1); const SBool s2329 = false != s2328; const SBool s2330 = false == s2329; const SBool s2331 = s2321 < s1; const SBool s2332 = s2321 < s2082; const SBool s2333 = s2331 || s2332; const SWord8 s2334 = (s2321 >> 1) | (s2321 << 7); const SWord8 s2335 = 128 | s2334; const SWord8 s2336 = 127 & s2334; const SWord8 s2337 = s2333 ? s2335 : s2336; const SBool s2338 = (SBool) (s2337 & 1); const SBool s2339 = false != s2338; const SWord8 s2340 = (s2324 >> 1) | (s2324 << 7); const SWord8 s2341 = 128 | s2340; const SWord8 s2342 = 127 & s2340; const SWord8 s2343 = s2339 ? s2341 : s2342; const SBool s2344 = (SBool) (s2343 & 1); const SBool s2345 = false != s2344; const SWord8 s2346 = (s2327 >> 1) | (s2327 << 7); const SWord8 s2347 = 128 | s2346; const SWord8 s2348 = 127 & s2346; const SWord8 s2349 = s2345 ? s2347 : s2348; const SBool s2350 = (SBool) (s2349 & 1); const SBool s2351 = false != s2350; const SBool s2352 = false == s2351; const SWord8 s2353 = (s2337 >> 1) | (s2337 << 7); const SWord8 s2354 = 128 | s2353; const SWord8 s2355 = 127 & s2353; const SWord8 s2356 = s2058 ? s2354 : s2355; const SWord8 s2357 = (s2356 >> 1) | (s2356 << 7); const SWord8 s2358 = 128 | s2357; const SWord8 s2359 = 127 & s2357; const SWord8 s2360 = s2077 ? s2358 : s2359; const SWord8 s2361 = (s2360 >> 1) | (s2360 << 7); const SWord8 s2362 = 128 | s2361; const SWord8 s2363 = 127 & s2361; const SWord8 s2364 = s2329 ? s2362 : s2363; const SWord8 s2365 = (s2364 >> 1) | (s2364 << 7); const SWord8 s2366 = 128 | s2365; const SWord8 s2367 = 127 & s2365; const SWord8 s2368 = s2351 ? s2366 : s2367; const SWord8 s2369 = s1 + s2364; const SBool s2370 = s2369 < s1; const SBool s2371 = s2369 < s2364; const SBool s2372 = s2370 || s2371; const SWord8 s2373 = (s2369 >> 1) | (s2369 << 7); const SWord8 s2374 = 128 | s2373; const SWord8 s2375 = 127 & s2373; const SWord8 s2376 = s2372 ? s2374 : s2375; const SWord8 s2377 = s2352 ? s2368 : s2376; const SWord8 s2378 = s1 + s2360; const SBool s2379 = s2378 < s1; const SBool s2380 = s2378 < s2360; const SBool s2381 = s2379 || s2380; const SWord8 s2382 = (s2378 >> 1) | (s2378 << 7); const SWord8 s2383 = 128 | s2382; const SWord8 s2384 = 127 & s2382; const SWord8 s2385 = s2381 ? s2383 : s2384; const SWord8 s2386 = (s2385 >> 1) | (s2385 << 7); const SWord8 s2387 = 128 | s2386; const SWord8 s2388 = 127 & s2386; const SWord8 s2389 = s2351 ? s2387 : s2388; const SWord8 s2390 = s1 + s2385; const SBool s2391 = s2390 < s1; const SBool s2392 = s2390 < s2385; const SBool s2393 = s2391 || s2392; const SWord8 s2394 = (s2390 >> 1) | (s2390 << 7); const SWord8 s2395 = 128 | s2394; const SWord8 s2396 = 127 & s2394; const SWord8 s2397 = s2393 ? s2395 : s2396; const SWord8 s2398 = s2352 ? s2389 : s2397; const SWord8 s2399 = s2330 ? s2377 : s2398; const SWord8 s2400 = s1 + s2356; const SBool s2401 = s2400 < s1; const SBool s2402 = s2400 < s2356; const SBool s2403 = s2401 || s2402; const SWord8 s2404 = (s2400 >> 1) | (s2400 << 7); const SWord8 s2405 = 128 | s2404; const SWord8 s2406 = 127 & s2404; const SWord8 s2407 = s2403 ? s2405 : s2406; const SWord8 s2408 = (s2407 >> 1) | (s2407 << 7); const SWord8 s2409 = 128 | s2408; const SWord8 s2410 = 127 & s2408; const SWord8 s2411 = s2329 ? s2409 : s2410; const SWord8 s2412 = (s2411 >> 1) | (s2411 << 7); const SWord8 s2413 = 128 | s2412; const SWord8 s2414 = 127 & s2412; const SWord8 s2415 = s2351 ? s2413 : s2414; const SWord8 s2416 = s1 + s2411; const SBool s2417 = s2416 < s1; const SBool s2418 = s2416 < s2411; const SBool s2419 = s2417 || s2418; const SWord8 s2420 = (s2416 >> 1) | (s2416 << 7); const SWord8 s2421 = 128 | s2420; const SWord8 s2422 = 127 & s2420; const SWord8 s2423 = s2419 ? s2421 : s2422; const SWord8 s2424 = s2352 ? s2415 : s2423; const SWord8 s2425 = s1 + s2407; const SBool s2426 = s2425 < s1; const SBool s2427 = s2425 < s2407; const SBool s2428 = s2426 || s2427; const SWord8 s2429 = (s2425 >> 1) | (s2425 << 7); const SWord8 s2430 = 128 | s2429; const SWord8 s2431 = 127 & s2429; const SWord8 s2432 = s2428 ? s2430 : s2431; const SWord8 s2433 = (s2432 >> 1) | (s2432 << 7); const SWord8 s2434 = 128 | s2433; const SWord8 s2435 = 127 & s2433; const SWord8 s2436 = s2351 ? s2434 : s2435; const SWord8 s2437 = s1 + s2432; const SBool s2438 = s2437 < s1; const SBool s2439 = s2437 < s2432; const SBool s2440 = s2438 || s2439; const SWord8 s2441 = (s2437 >> 1) | (s2437 << 7); const SWord8 s2442 = 128 | s2441; const SWord8 s2443 = 127 & s2441; const SWord8 s2444 = s2440 ? s2442 : s2443; const SWord8 s2445 = s2352 ? s2436 : s2444; const SWord8 s2446 = s2330 ? s2424 : s2445; const SWord8 s2447 = s2078 ? s2399 : s2446; const SWord8 s2448 = s1 + s2337; const SBool s2449 = (SBool) (s2448 & 1); const SBool s2450 = false != s2449; const SWord8 s2451 = s2450 ? s2341 : s2342; const SBool s2452 = (SBool) (s2451 & 1); const SBool s2453 = false != s2452; const SWord8 s2454 = s2453 ? s2347 : s2348; const SBool s2455 = (SBool) (s2454 & 1); const SBool s2456 = false != s2455; const SBool s2457 = false == s2456; const SBool s2458 = s2448 < s1; const SBool s2459 = s2448 < s2337; const SBool s2460 = s2458 || s2459; const SWord8 s2461 = (s2448 >> 1) | (s2448 << 7); const SWord8 s2462 = 128 | s2461; const SWord8 s2463 = 127 & s2461; const SWord8 s2464 = s2460 ? s2462 : s2463; const SWord8 s2465 = (s2464 >> 1) | (s2464 << 7); const SWord8 s2466 = 128 | s2465; const SWord8 s2467 = 127 & s2465; const SWord8 s2468 = s2077 ? s2466 : s2467; const SWord8 s2469 = (s2468 >> 1) | (s2468 << 7); const SWord8 s2470 = 128 | s2469; const SWord8 s2471 = 127 & s2469; const SWord8 s2472 = s2329 ? s2470 : s2471; const SWord8 s2473 = (s2472 >> 1) | (s2472 << 7); const SWord8 s2474 = 128 | s2473; const SWord8 s2475 = 127 & s2473; const SWord8 s2476 = s2456 ? s2474 : s2475; const SWord8 s2477 = s1 + s2472; const SBool s2478 = s2477 < s1; const SBool s2479 = s2477 < s2472; const SBool s2480 = s2478 || s2479; const SWord8 s2481 = (s2477 >> 1) | (s2477 << 7); const SWord8 s2482 = 128 | s2481; const SWord8 s2483 = 127 & s2481; const SWord8 s2484 = s2480 ? s2482 : s2483; const SWord8 s2485 = s2457 ? s2476 : s2484; const SWord8 s2486 = s1 + s2468; const SBool s2487 = s2486 < s1; const SBool s2488 = s2486 < s2468; const SBool s2489 = s2487 || s2488; const SWord8 s2490 = (s2486 >> 1) | (s2486 << 7); const SWord8 s2491 = 128 | s2490; const SWord8 s2492 = 127 & s2490; const SWord8 s2493 = s2489 ? s2491 : s2492; const SWord8 s2494 = (s2493 >> 1) | (s2493 << 7); const SWord8 s2495 = 128 | s2494; const SWord8 s2496 = 127 & s2494; const SWord8 s2497 = s2456 ? s2495 : s2496; const SWord8 s2498 = s1 + s2493; const SBool s2499 = s2498 < s1; const SBool s2500 = s2498 < s2493; const SBool s2501 = s2499 || s2500; const SWord8 s2502 = (s2498 >> 1) | (s2498 << 7); const SWord8 s2503 = 128 | s2502; const SWord8 s2504 = 127 & s2502; const SWord8 s2505 = s2501 ? s2503 : s2504; const SWord8 s2506 = s2457 ? s2497 : s2505; const SWord8 s2507 = s2330 ? s2485 : s2506; const SWord8 s2508 = s1 + s2464; const SBool s2509 = s2508 < s1; const SBool s2510 = s2508 < s2464; const SBool s2511 = s2509 || s2510; const SWord8 s2512 = (s2508 >> 1) | (s2508 << 7); const SWord8 s2513 = 128 | s2512; const SWord8 s2514 = 127 & s2512; const SWord8 s2515 = s2511 ? s2513 : s2514; const SWord8 s2516 = (s2515 >> 1) | (s2515 << 7); const SWord8 s2517 = 128 | s2516; const SWord8 s2518 = 127 & s2516; const SWord8 s2519 = s2329 ? s2517 : s2518; const SWord8 s2520 = (s2519 >> 1) | (s2519 << 7); const SWord8 s2521 = 128 | s2520; const SWord8 s2522 = 127 & s2520; const SWord8 s2523 = s2456 ? s2521 : s2522; const SWord8 s2524 = s1 + s2519; const SBool s2525 = s2524 < s1; const SBool s2526 = s2524 < s2519; const SBool s2527 = s2525 || s2526; const SWord8 s2528 = (s2524 >> 1) | (s2524 << 7); const SWord8 s2529 = 128 | s2528; const SWord8 s2530 = 127 & s2528; const SWord8 s2531 = s2527 ? s2529 : s2530; const SWord8 s2532 = s2457 ? s2523 : s2531; const SWord8 s2533 = s1 + s2515; const SBool s2534 = s2533 < s1; const SBool s2535 = s2533 < s2515; const SBool s2536 = s2534 || s2535; const SWord8 s2537 = (s2533 >> 1) | (s2533 << 7); const SWord8 s2538 = 128 | s2537; const SWord8 s2539 = 127 & s2537; const SWord8 s2540 = s2536 ? s2538 : s2539; const SWord8 s2541 = (s2540 >> 1) | (s2540 << 7); const SWord8 s2542 = 128 | s2541; const SWord8 s2543 = 127 & s2541; const SWord8 s2544 = s2456 ? s2542 : s2543; const SWord8 s2545 = s1 + s2540; const SBool s2546 = s2545 < s1; const SBool s2547 = s2545 < s2540; const SBool s2548 = s2546 || s2547; const SWord8 s2549 = (s2545 >> 1) | (s2545 << 7); const SWord8 s2550 = 128 | s2549; const SWord8 s2551 = 127 & s2549; const SWord8 s2552 = s2548 ? s2550 : s2551; const SWord8 s2553 = s2457 ? s2544 : s2552; const SWord8 s2554 = s2330 ? s2532 : s2553; const SWord8 s2555 = s2078 ? s2507 : s2554; const SWord8 s2556 = s2059 ? s2447 : s2555; const SWord8 s2557 = s2042 ? s2320 : s2556; const SWord8 s2558 = s1 + s2063; const SBool s2559 = (SBool) (s2558 & 1); const SBool s2560 = false != s2559; const SWord8 s2561 = s2560 ? s2067 : s2068; const SBool s2562 = (SBool) (s2561 & 1); const SBool s2563 = false != s2562; const SWord8 s2564 = s2563 ? s2073 : s2074; const SBool s2565 = (SBool) (s2564 & 1); const SBool s2566 = false != s2565; const SBool s2567 = false == s2566; const SBool s2568 = s2558 < s1; const SBool s2569 = s2558 < s2063; const SBool s2570 = s2568 || s2569; const SWord8 s2571 = (s2558 >> 1) | (s2558 << 7); const SWord8 s2572 = 128 | s2571; const SWord8 s2573 = 127 & s2571; const SWord8 s2574 = s2570 ? s2572 : s2573; const SBool s2575 = (SBool) (s2574 & 1); const SBool s2576 = false != s2575; const SWord8 s2577 = (s2561 >> 1) | (s2561 << 7); const SWord8 s2578 = 128 | s2577; const SWord8 s2579 = 127 & s2577; const SWord8 s2580 = s2576 ? s2578 : s2579; const SBool s2581 = (SBool) (s2580 & 1); const SBool s2582 = false != s2581; const SWord8 s2583 = (s2564 >> 1) | (s2564 << 7); const SWord8 s2584 = 128 | s2583; const SWord8 s2585 = 127 & s2583; const SWord8 s2586 = s2582 ? s2584 : s2585; const SBool s2587 = (SBool) (s2586 & 1); const SBool s2588 = false != s2587; const SBool s2589 = false == s2588; const SWord8 s2590 = (s2574 >> 1) | (s2574 << 7); const SWord8 s2591 = 128 | s2590; const SWord8 s2592 = 127 & s2590; const SWord8 s2593 = s2041 ? s2591 : s2592; const SBool s2594 = (SBool) (s2593 & 1); const SBool s2595 = false != s2594; const SWord8 s2596 = (s2580 >> 1) | (s2580 << 7); const SWord8 s2597 = 128 | s2596; const SWord8 s2598 = 127 & s2596; const SWord8 s2599 = s2595 ? s2597 : s2598; const SBool s2600 = (SBool) (s2599 & 1); const SBool s2601 = false != s2600; const SWord8 s2602 = (s2586 >> 1) | (s2586 << 7); const SWord8 s2603 = 128 | s2602; const SWord8 s2604 = 127 & s2602; const SWord8 s2605 = s2601 ? s2603 : s2604; const SBool s2606 = (SBool) (s2605 & 1); const SBool s2607 = false != s2606; const SBool s2608 = false == s2607; const SWord8 s2609 = (s2593 >> 1) | (s2593 << 7); const SWord8 s2610 = 128 | s2609; const SWord8 s2611 = 127 & s2609; const SWord8 s2612 = s2058 ? s2610 : s2611; const SWord8 s2613 = (s2612 >> 1) | (s2612 << 7); const SWord8 s2614 = 128 | s2613; const SWord8 s2615 = 127 & s2613; const SWord8 s2616 = s2566 ? s2614 : s2615; const SWord8 s2617 = (s2616 >> 1) | (s2616 << 7); const SWord8 s2618 = 128 | s2617; const SWord8 s2619 = 127 & s2617; const SWord8 s2620 = s2588 ? s2618 : s2619; const SWord8 s2621 = (s2620 >> 1) | (s2620 << 7); const SWord8 s2622 = 128 | s2621; const SWord8 s2623 = 127 & s2621; const SWord8 s2624 = s2607 ? s2622 : s2623; const SWord8 s2625 = s1 + s2620; const SBool s2626 = s2625 < s1; const SBool s2627 = s2625 < s2620; const SBool s2628 = s2626 || s2627; const SWord8 s2629 = (s2625 >> 1) | (s2625 << 7); const SWord8 s2630 = 128 | s2629; const SWord8 s2631 = 127 & s2629; const SWord8 s2632 = s2628 ? s2630 : s2631; const SWord8 s2633 = s2608 ? s2624 : s2632; const SWord8 s2634 = s1 + s2616; const SBool s2635 = s2634 < s1; const SBool s2636 = s2634 < s2616; const SBool s2637 = s2635 || s2636; const SWord8 s2638 = (s2634 >> 1) | (s2634 << 7); const SWord8 s2639 = 128 | s2638; const SWord8 s2640 = 127 & s2638; const SWord8 s2641 = s2637 ? s2639 : s2640; const SWord8 s2642 = (s2641 >> 1) | (s2641 << 7); const SWord8 s2643 = 128 | s2642; const SWord8 s2644 = 127 & s2642; const SWord8 s2645 = s2607 ? s2643 : s2644; const SWord8 s2646 = s1 + s2641; const SBool s2647 = s2646 < s1; const SBool s2648 = s2646 < s2641; const SBool s2649 = s2647 || s2648; const SWord8 s2650 = (s2646 >> 1) | (s2646 << 7); const SWord8 s2651 = 128 | s2650; const SWord8 s2652 = 127 & s2650; const SWord8 s2653 = s2649 ? s2651 : s2652; const SWord8 s2654 = s2608 ? s2645 : s2653; const SWord8 s2655 = s2589 ? s2633 : s2654; const SWord8 s2656 = s1 + s2612; const SBool s2657 = s2656 < s1; const SBool s2658 = s2656 < s2612; const SBool s2659 = s2657 || s2658; const SWord8 s2660 = (s2656 >> 1) | (s2656 << 7); const SWord8 s2661 = 128 | s2660; const SWord8 s2662 = 127 & s2660; const SWord8 s2663 = s2659 ? s2661 : s2662; const SWord8 s2664 = (s2663 >> 1) | (s2663 << 7); const SWord8 s2665 = 128 | s2664; const SWord8 s2666 = 127 & s2664; const SWord8 s2667 = s2588 ? s2665 : s2666; const SWord8 s2668 = (s2667 >> 1) | (s2667 << 7); const SWord8 s2669 = 128 | s2668; const SWord8 s2670 = 127 & s2668; const SWord8 s2671 = s2607 ? s2669 : s2670; const SWord8 s2672 = s1 + s2667; const SBool s2673 = s2672 < s1; const SBool s2674 = s2672 < s2667; const SBool s2675 = s2673 || s2674; const SWord8 s2676 = (s2672 >> 1) | (s2672 << 7); const SWord8 s2677 = 128 | s2676; const SWord8 s2678 = 127 & s2676; const SWord8 s2679 = s2675 ? s2677 : s2678; const SWord8 s2680 = s2608 ? s2671 : s2679; const SWord8 s2681 = s1 + s2663; const SBool s2682 = s2681 < s1; const SBool s2683 = s2681 < s2663; const SBool s2684 = s2682 || s2683; const SWord8 s2685 = (s2681 >> 1) | (s2681 << 7); const SWord8 s2686 = 128 | s2685; const SWord8 s2687 = 127 & s2685; const SWord8 s2688 = s2684 ? s2686 : s2687; const SWord8 s2689 = (s2688 >> 1) | (s2688 << 7); const SWord8 s2690 = 128 | s2689; const SWord8 s2691 = 127 & s2689; const SWord8 s2692 = s2607 ? s2690 : s2691; const SWord8 s2693 = s1 + s2688; const SBool s2694 = s2693 < s1; const SBool s2695 = s2693 < s2688; const SBool s2696 = s2694 || s2695; const SWord8 s2697 = (s2693 >> 1) | (s2693 << 7); const SWord8 s2698 = 128 | s2697; const SWord8 s2699 = 127 & s2697; const SWord8 s2700 = s2696 ? s2698 : s2699; const SWord8 s2701 = s2608 ? s2692 : s2700; const SWord8 s2702 = s2589 ? s2680 : s2701; const SWord8 s2703 = s2567 ? s2655 : s2702; const SWord8 s2704 = s1 + s2593; const SBool s2705 = (SBool) (s2704 & 1); const SBool s2706 = false != s2705; const SWord8 s2707 = s2706 ? s2597 : s2598; const SBool s2708 = (SBool) (s2707 & 1); const SBool s2709 = false != s2708; const SWord8 s2710 = s2709 ? s2603 : s2604; const SBool s2711 = (SBool) (s2710 & 1); const SBool s2712 = false != s2711; const SBool s2713 = false == s2712; const SBool s2714 = s2704 < s1; const SBool s2715 = s2704 < s2593; const SBool s2716 = s2714 || s2715; const SWord8 s2717 = (s2704 >> 1) | (s2704 << 7); const SWord8 s2718 = 128 | s2717; const SWord8 s2719 = 127 & s2717; const SWord8 s2720 = s2716 ? s2718 : s2719; const SWord8 s2721 = (s2720 >> 1) | (s2720 << 7); const SWord8 s2722 = 128 | s2721; const SWord8 s2723 = 127 & s2721; const SWord8 s2724 = s2566 ? s2722 : s2723; const SWord8 s2725 = (s2724 >> 1) | (s2724 << 7); const SWord8 s2726 = 128 | s2725; const SWord8 s2727 = 127 & s2725; const SWord8 s2728 = s2588 ? s2726 : s2727; const SWord8 s2729 = (s2728 >> 1) | (s2728 << 7); const SWord8 s2730 = 128 | s2729; const SWord8 s2731 = 127 & s2729; const SWord8 s2732 = s2712 ? s2730 : s2731; const SWord8 s2733 = s1 + s2728; const SBool s2734 = s2733 < s1; const SBool s2735 = s2733 < s2728; const SBool s2736 = s2734 || s2735; const SWord8 s2737 = (s2733 >> 1) | (s2733 << 7); const SWord8 s2738 = 128 | s2737; const SWord8 s2739 = 127 & s2737; const SWord8 s2740 = s2736 ? s2738 : s2739; const SWord8 s2741 = s2713 ? s2732 : s2740; const SWord8 s2742 = s1 + s2724; const SBool s2743 = s2742 < s1; const SBool s2744 = s2742 < s2724; const SBool s2745 = s2743 || s2744; const SWord8 s2746 = (s2742 >> 1) | (s2742 << 7); const SWord8 s2747 = 128 | s2746; const SWord8 s2748 = 127 & s2746; const SWord8 s2749 = s2745 ? s2747 : s2748; const SWord8 s2750 = (s2749 >> 1) | (s2749 << 7); const SWord8 s2751 = 128 | s2750; const SWord8 s2752 = 127 & s2750; const SWord8 s2753 = s2712 ? s2751 : s2752; const SWord8 s2754 = s1 + s2749; const SBool s2755 = s2754 < s1; const SBool s2756 = s2754 < s2749; const SBool s2757 = s2755 || s2756; const SWord8 s2758 = (s2754 >> 1) | (s2754 << 7); const SWord8 s2759 = 128 | s2758; const SWord8 s2760 = 127 & s2758; const SWord8 s2761 = s2757 ? s2759 : s2760; const SWord8 s2762 = s2713 ? s2753 : s2761; const SWord8 s2763 = s2589 ? s2741 : s2762; const SWord8 s2764 = s1 + s2720; const SBool s2765 = s2764 < s1; const SBool s2766 = s2764 < s2720; const SBool s2767 = s2765 || s2766; const SWord8 s2768 = (s2764 >> 1) | (s2764 << 7); const SWord8 s2769 = 128 | s2768; const SWord8 s2770 = 127 & s2768; const SWord8 s2771 = s2767 ? s2769 : s2770; const SWord8 s2772 = (s2771 >> 1) | (s2771 << 7); const SWord8 s2773 = 128 | s2772; const SWord8 s2774 = 127 & s2772; const SWord8 s2775 = s2588 ? s2773 : s2774; const SWord8 s2776 = (s2775 >> 1) | (s2775 << 7); const SWord8 s2777 = 128 | s2776; const SWord8 s2778 = 127 & s2776; const SWord8 s2779 = s2712 ? s2777 : s2778; const SWord8 s2780 = s1 + s2775; const SBool s2781 = s2780 < s1; const SBool s2782 = s2780 < s2775; const SBool s2783 = s2781 || s2782; const SWord8 s2784 = (s2780 >> 1) | (s2780 << 7); const SWord8 s2785 = 128 | s2784; const SWord8 s2786 = 127 & s2784; const SWord8 s2787 = s2783 ? s2785 : s2786; const SWord8 s2788 = s2713 ? s2779 : s2787; const SWord8 s2789 = s1 + s2771; const SBool s2790 = s2789 < s1; const SBool s2791 = s2789 < s2771; const SBool s2792 = s2790 || s2791; const SWord8 s2793 = (s2789 >> 1) | (s2789 << 7); const SWord8 s2794 = 128 | s2793; const SWord8 s2795 = 127 & s2793; const SWord8 s2796 = s2792 ? s2794 : s2795; const SWord8 s2797 = (s2796 >> 1) | (s2796 << 7); const SWord8 s2798 = 128 | s2797; const SWord8 s2799 = 127 & s2797; const SWord8 s2800 = s2712 ? s2798 : s2799; const SWord8 s2801 = s1 + s2796; const SBool s2802 = s2801 < s1; const SBool s2803 = s2801 < s2796; const SBool s2804 = s2802 || s2803; const SWord8 s2805 = (s2801 >> 1) | (s2801 << 7); const SWord8 s2806 = 128 | s2805; const SWord8 s2807 = 127 & s2805; const SWord8 s2808 = s2804 ? s2806 : s2807; const SWord8 s2809 = s2713 ? s2800 : s2808; const SWord8 s2810 = s2589 ? s2788 : s2809; const SWord8 s2811 = s2567 ? s2763 : s2810; const SWord8 s2812 = s2059 ? s2703 : s2811; const SWord8 s2813 = s1 + s2574; const SBool s2814 = (SBool) (s2813 & 1); const SBool s2815 = false != s2814; const SWord8 s2816 = s2815 ? s2578 : s2579; const SBool s2817 = (SBool) (s2816 & 1); const SBool s2818 = false != s2817; const SWord8 s2819 = s2818 ? s2584 : s2585; const SBool s2820 = (SBool) (s2819 & 1); const SBool s2821 = false != s2820; const SBool s2822 = false == s2821; const SBool s2823 = s2813 < s1; const SBool s2824 = s2813 < s2574; const SBool s2825 = s2823 || s2824; const SWord8 s2826 = (s2813 >> 1) | (s2813 << 7); const SWord8 s2827 = 128 | s2826; const SWord8 s2828 = 127 & s2826; const SWord8 s2829 = s2825 ? s2827 : s2828; const SBool s2830 = (SBool) (s2829 & 1); const SBool s2831 = false != s2830; const SWord8 s2832 = (s2816 >> 1) | (s2816 << 7); const SWord8 s2833 = 128 | s2832; const SWord8 s2834 = 127 & s2832; const SWord8 s2835 = s2831 ? s2833 : s2834; const SBool s2836 = (SBool) (s2835 & 1); const SBool s2837 = false != s2836; const SWord8 s2838 = (s2819 >> 1) | (s2819 << 7); const SWord8 s2839 = 128 | s2838; const SWord8 s2840 = 127 & s2838; const SWord8 s2841 = s2837 ? s2839 : s2840; const SBool s2842 = (SBool) (s2841 & 1); const SBool s2843 = false != s2842; const SBool s2844 = false == s2843; const SWord8 s2845 = (s2829 >> 1) | (s2829 << 7); const SWord8 s2846 = 128 | s2845; const SWord8 s2847 = 127 & s2845; const SWord8 s2848 = s2058 ? s2846 : s2847; const SWord8 s2849 = (s2848 >> 1) | (s2848 << 7); const SWord8 s2850 = 128 | s2849; const SWord8 s2851 = 127 & s2849; const SWord8 s2852 = s2566 ? s2850 : s2851; const SWord8 s2853 = (s2852 >> 1) | (s2852 << 7); const SWord8 s2854 = 128 | s2853; const SWord8 s2855 = 127 & s2853; const SWord8 s2856 = s2821 ? s2854 : s2855; const SWord8 s2857 = (s2856 >> 1) | (s2856 << 7); const SWord8 s2858 = 128 | s2857; const SWord8 s2859 = 127 & s2857; const SWord8 s2860 = s2843 ? s2858 : s2859; const SWord8 s2861 = s1 + s2856; const SBool s2862 = s2861 < s1; const SBool s2863 = s2861 < s2856; const SBool s2864 = s2862 || s2863; const SWord8 s2865 = (s2861 >> 1) | (s2861 << 7); const SWord8 s2866 = 128 | s2865; const SWord8 s2867 = 127 & s2865; const SWord8 s2868 = s2864 ? s2866 : s2867; const SWord8 s2869 = s2844 ? s2860 : s2868; const SWord8 s2870 = s1 + s2852; const SBool s2871 = s2870 < s1; const SBool s2872 = s2870 < s2852; const SBool s2873 = s2871 || s2872; const SWord8 s2874 = (s2870 >> 1) | (s2870 << 7); const SWord8 s2875 = 128 | s2874; const SWord8 s2876 = 127 & s2874; const SWord8 s2877 = s2873 ? s2875 : s2876; const SWord8 s2878 = (s2877 >> 1) | (s2877 << 7); const SWord8 s2879 = 128 | s2878; const SWord8 s2880 = 127 & s2878; const SWord8 s2881 = s2843 ? s2879 : s2880; const SWord8 s2882 = s1 + s2877; const SBool s2883 = s2882 < s1; const SBool s2884 = s2882 < s2877; const SBool s2885 = s2883 || s2884; const SWord8 s2886 = (s2882 >> 1) | (s2882 << 7); const SWord8 s2887 = 128 | s2886; const SWord8 s2888 = 127 & s2886; const SWord8 s2889 = s2885 ? s2887 : s2888; const SWord8 s2890 = s2844 ? s2881 : s2889; const SWord8 s2891 = s2822 ? s2869 : s2890; const SWord8 s2892 = s1 + s2848; const SBool s2893 = s2892 < s1; const SBool s2894 = s2892 < s2848; const SBool s2895 = s2893 || s2894; const SWord8 s2896 = (s2892 >> 1) | (s2892 << 7); const SWord8 s2897 = 128 | s2896; const SWord8 s2898 = 127 & s2896; const SWord8 s2899 = s2895 ? s2897 : s2898; const SWord8 s2900 = (s2899 >> 1) | (s2899 << 7); const SWord8 s2901 = 128 | s2900; const SWord8 s2902 = 127 & s2900; const SWord8 s2903 = s2821 ? s2901 : s2902; const SWord8 s2904 = (s2903 >> 1) | (s2903 << 7); const SWord8 s2905 = 128 | s2904; const SWord8 s2906 = 127 & s2904; const SWord8 s2907 = s2843 ? s2905 : s2906; const SWord8 s2908 = s1 + s2903; const SBool s2909 = s2908 < s1; const SBool s2910 = s2908 < s2903; const SBool s2911 = s2909 || s2910; const SWord8 s2912 = (s2908 >> 1) | (s2908 << 7); const SWord8 s2913 = 128 | s2912; const SWord8 s2914 = 127 & s2912; const SWord8 s2915 = s2911 ? s2913 : s2914; const SWord8 s2916 = s2844 ? s2907 : s2915; const SWord8 s2917 = s1 + s2899; const SBool s2918 = s2917 < s1; const SBool s2919 = s2917 < s2899; const SBool s2920 = s2918 || s2919; const SWord8 s2921 = (s2917 >> 1) | (s2917 << 7); const SWord8 s2922 = 128 | s2921; const SWord8 s2923 = 127 & s2921; const SWord8 s2924 = s2920 ? s2922 : s2923; const SWord8 s2925 = (s2924 >> 1) | (s2924 << 7); const SWord8 s2926 = 128 | s2925; const SWord8 s2927 = 127 & s2925; const SWord8 s2928 = s2843 ? s2926 : s2927; const SWord8 s2929 = s1 + s2924; const SBool s2930 = s2929 < s1; const SBool s2931 = s2929 < s2924; const SBool s2932 = s2930 || s2931; const SWord8 s2933 = (s2929 >> 1) | (s2929 << 7); const SWord8 s2934 = 128 | s2933; const SWord8 s2935 = 127 & s2933; const SWord8 s2936 = s2932 ? s2934 : s2935; const SWord8 s2937 = s2844 ? s2928 : s2936; const SWord8 s2938 = s2822 ? s2916 : s2937; const SWord8 s2939 = s2567 ? s2891 : s2938; const SWord8 s2940 = s1 + s2829; const SBool s2941 = (SBool) (s2940 & 1); const SBool s2942 = false != s2941; const SWord8 s2943 = s2942 ? s2833 : s2834; const SBool s2944 = (SBool) (s2943 & 1); const SBool s2945 = false != s2944; const SWord8 s2946 = s2945 ? s2839 : s2840; const SBool s2947 = (SBool) (s2946 & 1); const SBool s2948 = false != s2947; const SBool s2949 = false == s2948; const SBool s2950 = s2940 < s1; const SBool s2951 = s2940 < s2829; const SBool s2952 = s2950 || s2951; const SWord8 s2953 = (s2940 >> 1) | (s2940 << 7); const SWord8 s2954 = 128 | s2953; const SWord8 s2955 = 127 & s2953; const SWord8 s2956 = s2952 ? s2954 : s2955; const SWord8 s2957 = (s2956 >> 1) | (s2956 << 7); const SWord8 s2958 = 128 | s2957; const SWord8 s2959 = 127 & s2957; const SWord8 s2960 = s2566 ? s2958 : s2959; const SWord8 s2961 = (s2960 >> 1) | (s2960 << 7); const SWord8 s2962 = 128 | s2961; const SWord8 s2963 = 127 & s2961; const SWord8 s2964 = s2821 ? s2962 : s2963; const SWord8 s2965 = (s2964 >> 1) | (s2964 << 7); const SWord8 s2966 = 128 | s2965; const SWord8 s2967 = 127 & s2965; const SWord8 s2968 = s2948 ? s2966 : s2967; const SWord8 s2969 = s1 + s2964; const SBool s2970 = s2969 < s1; const SBool s2971 = s2969 < s2964; const SBool s2972 = s2970 || s2971; const SWord8 s2973 = (s2969 >> 1) | (s2969 << 7); const SWord8 s2974 = 128 | s2973; const SWord8 s2975 = 127 & s2973; const SWord8 s2976 = s2972 ? s2974 : s2975; const SWord8 s2977 = s2949 ? s2968 : s2976; const SWord8 s2978 = s1 + s2960; const SBool s2979 = s2978 < s1; const SBool s2980 = s2978 < s2960; const SBool s2981 = s2979 || s2980; const SWord8 s2982 = (s2978 >> 1) | (s2978 << 7); const SWord8 s2983 = 128 | s2982; const SWord8 s2984 = 127 & s2982; const SWord8 s2985 = s2981 ? s2983 : s2984; const SWord8 s2986 = (s2985 >> 1) | (s2985 << 7); const SWord8 s2987 = 128 | s2986; const SWord8 s2988 = 127 & s2986; const SWord8 s2989 = s2948 ? s2987 : s2988; const SWord8 s2990 = s1 + s2985; const SBool s2991 = s2990 < s1; const SBool s2992 = s2990 < s2985; const SBool s2993 = s2991 || s2992; const SWord8 s2994 = (s2990 >> 1) | (s2990 << 7); const SWord8 s2995 = 128 | s2994; const SWord8 s2996 = 127 & s2994; const SWord8 s2997 = s2993 ? s2995 : s2996; const SWord8 s2998 = s2949 ? s2989 : s2997; const SWord8 s2999 = s2822 ? s2977 : s2998; const SWord8 s3000 = s1 + s2956; const SBool s3001 = s3000 < s1; const SBool s3002 = s3000 < s2956; const SBool s3003 = s3001 || s3002; const SWord8 s3004 = (s3000 >> 1) | (s3000 << 7); const SWord8 s3005 = 128 | s3004; const SWord8 s3006 = 127 & s3004; const SWord8 s3007 = s3003 ? s3005 : s3006; const SWord8 s3008 = (s3007 >> 1) | (s3007 << 7); const SWord8 s3009 = 128 | s3008; const SWord8 s3010 = 127 & s3008; const SWord8 s3011 = s2821 ? s3009 : s3010; const SWord8 s3012 = (s3011 >> 1) | (s3011 << 7); const SWord8 s3013 = 128 | s3012; const SWord8 s3014 = 127 & s3012; const SWord8 s3015 = s2948 ? s3013 : s3014; const SWord8 s3016 = s1 + s3011; const SBool s3017 = s3016 < s1; const SBool s3018 = s3016 < s3011; const SBool s3019 = s3017 || s3018; const SWord8 s3020 = (s3016 >> 1) | (s3016 << 7); const SWord8 s3021 = 128 | s3020; const SWord8 s3022 = 127 & s3020; const SWord8 s3023 = s3019 ? s3021 : s3022; const SWord8 s3024 = s2949 ? s3015 : s3023; const SWord8 s3025 = s1 + s3007; const SBool s3026 = s3025 < s1; const SBool s3027 = s3025 < s3007; const SBool s3028 = s3026 || s3027; const SWord8 s3029 = (s3025 >> 1) | (s3025 << 7); const SWord8 s3030 = 128 | s3029; const SWord8 s3031 = 127 & s3029; const SWord8 s3032 = s3028 ? s3030 : s3031; const SWord8 s3033 = (s3032 >> 1) | (s3032 << 7); const SWord8 s3034 = 128 | s3033; const SWord8 s3035 = 127 & s3033; const SWord8 s3036 = s2948 ? s3034 : s3035; const SWord8 s3037 = s1 + s3032; const SBool s3038 = s3037 < s1; const SBool s3039 = s3037 < s3032; const SBool s3040 = s3038 || s3039; const SWord8 s3041 = (s3037 >> 1) | (s3037 << 7); const SWord8 s3042 = 128 | s3041; const SWord8 s3043 = 127 & s3041; const SWord8 s3044 = s3040 ? s3042 : s3043; const SWord8 s3045 = s2949 ? s3036 : s3044; const SWord8 s3046 = s2822 ? s3024 : s3045; const SWord8 s3047 = s2567 ? s2999 : s3046; const SWord8 s3048 = s2059 ? s2939 : s3047; const SWord8 s3049 = s2042 ? s2812 : s3048; const SWord8 s3050 = s16 ? s2557 : s3049; const SWord8 s3051 = s1 + s2044; const SBool s3052 = (SBool) (s3051 & 1); const SBool s3053 = false != s3052; const SWord8 s3054 = s3053 ? s2048 : s2049; const SBool s3055 = (SBool) (s3054 & 1); const SBool s3056 = false != s3055; const SWord8 s3057 = s3056 ? s2054 : s2055; const SBool s3058 = (SBool) (s3057 & 1); const SBool s3059 = false != s3058; const SBool s3060 = false == s3059; const SBool s3061 = s3051 < s1; const SBool s3062 = s3051 < s2044; const SBool s3063 = s3061 || s3062; const SWord8 s3064 = (s3051 >> 1) | (s3051 << 7); const SWord8 s3065 = 128 | s3064; const SWord8 s3066 = 127 & s3064; const SWord8 s3067 = s3063 ? s3065 : s3066; const SBool s3068 = (SBool) (s3067 & 1); const SBool s3069 = false != s3068; const SWord8 s3070 = (s3054 >> 1) | (s3054 << 7); const SWord8 s3071 = 128 | s3070; const SWord8 s3072 = 127 & s3070; const SWord8 s3073 = s3069 ? s3071 : s3072; const SBool s3074 = (SBool) (s3073 & 1); const SBool s3075 = false != s3074; const SWord8 s3076 = (s3057 >> 1) | (s3057 << 7); const SWord8 s3077 = 128 | s3076; const SWord8 s3078 = 127 & s3076; const SWord8 s3079 = s3075 ? s3077 : s3078; const SBool s3080 = (SBool) (s3079 & 1); const SBool s3081 = false != s3080; const SBool s3082 = false == s3081; const SWord8 s3083 = (s3067 >> 1) | (s3067 << 7); const SWord8 s3084 = 128 | s3083; const SWord8 s3085 = 127 & s3083; const SWord8 s3086 = s15 ? s3084 : s3085; const SBool s3087 = (SBool) (s3086 & 1); const SBool s3088 = false != s3087; const SWord8 s3089 = (s3073 >> 1) | (s3073 << 7); const SWord8 s3090 = 128 | s3089; const SWord8 s3091 = 127 & s3089; const SWord8 s3092 = s3088 ? s3090 : s3091; const SBool s3093 = (SBool) (s3092 & 1); const SBool s3094 = false != s3093; const SWord8 s3095 = (s3079 >> 1) | (s3079 << 7); const SWord8 s3096 = 128 | s3095; const SWord8 s3097 = 127 & s3095; const SWord8 s3098 = s3094 ? s3096 : s3097; const SBool s3099 = (SBool) (s3098 & 1); const SBool s3100 = false != s3099; const SBool s3101 = false == s3100; const SWord8 s3102 = (s3086 >> 1) | (s3086 << 7); const SWord8 s3103 = 128 | s3102; const SWord8 s3104 = 127 & s3102; const SWord8 s3105 = s2041 ? s3103 : s3104; const SBool s3106 = (SBool) (s3105 & 1); const SBool s3107 = false != s3106; const SWord8 s3108 = (s3092 >> 1) | (s3092 << 7); const SWord8 s3109 = 128 | s3108; const SWord8 s3110 = 127 & s3108; const SWord8 s3111 = s3107 ? s3109 : s3110; const SBool s3112 = (SBool) (s3111 & 1); const SBool s3113 = false != s3112; const SWord8 s3114 = (s3098 >> 1) | (s3098 << 7); const SWord8 s3115 = 128 | s3114; const SWord8 s3116 = 127 & s3114; const SWord8 s3117 = s3113 ? s3115 : s3116; const SBool s3118 = (SBool) (s3117 & 1); const SBool s3119 = false != s3118; const SBool s3120 = false == s3119; const SWord8 s3121 = (s3105 >> 1) | (s3105 << 7); const SWord8 s3122 = 128 | s3121; const SWord8 s3123 = 127 & s3121; const SWord8 s3124 = s3059 ? s3122 : s3123; const SWord8 s3125 = (s3124 >> 1) | (s3124 << 7); const SWord8 s3126 = 128 | s3125; const SWord8 s3127 = 127 & s3125; const SWord8 s3128 = s3081 ? s3126 : s3127; const SWord8 s3129 = (s3128 >> 1) | (s3128 << 7); const SWord8 s3130 = 128 | s3129; const SWord8 s3131 = 127 & s3129; const SWord8 s3132 = s3100 ? s3130 : s3131; const SWord8 s3133 = (s3132 >> 1) | (s3132 << 7); const SWord8 s3134 = 128 | s3133; const SWord8 s3135 = 127 & s3133; const SWord8 s3136 = s3119 ? s3134 : s3135; const SWord8 s3137 = s1 + s3132; const SBool s3138 = s3137 < s1; const SBool s3139 = s3137 < s3132; const SBool s3140 = s3138 || s3139; const SWord8 s3141 = (s3137 >> 1) | (s3137 << 7); const SWord8 s3142 = 128 | s3141; const SWord8 s3143 = 127 & s3141; const SWord8 s3144 = s3140 ? s3142 : s3143; const SWord8 s3145 = s3120 ? s3136 : s3144; const SWord8 s3146 = s1 + s3128; const SBool s3147 = s3146 < s1; const SBool s3148 = s3146 < s3128; const SBool s3149 = s3147 || s3148; const SWord8 s3150 = (s3146 >> 1) | (s3146 << 7); const SWord8 s3151 = 128 | s3150; const SWord8 s3152 = 127 & s3150; const SWord8 s3153 = s3149 ? s3151 : s3152; const SWord8 s3154 = (s3153 >> 1) | (s3153 << 7); const SWord8 s3155 = 128 | s3154; const SWord8 s3156 = 127 & s3154; const SWord8 s3157 = s3119 ? s3155 : s3156; const SWord8 s3158 = s1 + s3153; const SBool s3159 = s3158 < s1; const SBool s3160 = s3158 < s3153; const SBool s3161 = s3159 || s3160; const SWord8 s3162 = (s3158 >> 1) | (s3158 << 7); const SWord8 s3163 = 128 | s3162; const SWord8 s3164 = 127 & s3162; const SWord8 s3165 = s3161 ? s3163 : s3164; const SWord8 s3166 = s3120 ? s3157 : s3165; const SWord8 s3167 = s3101 ? s3145 : s3166; const SWord8 s3168 = s1 + s3124; const SBool s3169 = s3168 < s1; const SBool s3170 = s3168 < s3124; const SBool s3171 = s3169 || s3170; const SWord8 s3172 = (s3168 >> 1) | (s3168 << 7); const SWord8 s3173 = 128 | s3172; const SWord8 s3174 = 127 & s3172; const SWord8 s3175 = s3171 ? s3173 : s3174; const SWord8 s3176 = (s3175 >> 1) | (s3175 << 7); const SWord8 s3177 = 128 | s3176; const SWord8 s3178 = 127 & s3176; const SWord8 s3179 = s3100 ? s3177 : s3178; const SWord8 s3180 = (s3179 >> 1) | (s3179 << 7); const SWord8 s3181 = 128 | s3180; const SWord8 s3182 = 127 & s3180; const SWord8 s3183 = s3119 ? s3181 : s3182; const SWord8 s3184 = s1 + s3179; const SBool s3185 = s3184 < s1; const SBool s3186 = s3184 < s3179; const SBool s3187 = s3185 || s3186; const SWord8 s3188 = (s3184 >> 1) | (s3184 << 7); const SWord8 s3189 = 128 | s3188; const SWord8 s3190 = 127 & s3188; const SWord8 s3191 = s3187 ? s3189 : s3190; const SWord8 s3192 = s3120 ? s3183 : s3191; const SWord8 s3193 = s1 + s3175; const SBool s3194 = s3193 < s1; const SBool s3195 = s3193 < s3175; const SBool s3196 = s3194 || s3195; const SWord8 s3197 = (s3193 >> 1) | (s3193 << 7); const SWord8 s3198 = 128 | s3197; const SWord8 s3199 = 127 & s3197; const SWord8 s3200 = s3196 ? s3198 : s3199; const SWord8 s3201 = (s3200 >> 1) | (s3200 << 7); const SWord8 s3202 = 128 | s3201; const SWord8 s3203 = 127 & s3201; const SWord8 s3204 = s3119 ? s3202 : s3203; const SWord8 s3205 = s1 + s3200; const SBool s3206 = s3205 < s1; const SBool s3207 = s3205 < s3200; const SBool s3208 = s3206 || s3207; const SWord8 s3209 = (s3205 >> 1) | (s3205 << 7); const SWord8 s3210 = 128 | s3209; const SWord8 s3211 = 127 & s3209; const SWord8 s3212 = s3208 ? s3210 : s3211; const SWord8 s3213 = s3120 ? s3204 : s3212; const SWord8 s3214 = s3101 ? s3192 : s3213; const SWord8 s3215 = s3082 ? s3167 : s3214; const SWord8 s3216 = s1 + s3105; const SBool s3217 = (SBool) (s3216 & 1); const SBool s3218 = false != s3217; const SWord8 s3219 = s3218 ? s3109 : s3110; const SBool s3220 = (SBool) (s3219 & 1); const SBool s3221 = false != s3220; const SWord8 s3222 = s3221 ? s3115 : s3116; const SBool s3223 = (SBool) (s3222 & 1); const SBool s3224 = false != s3223; const SBool s3225 = false == s3224; const SBool s3226 = s3216 < s1; const SBool s3227 = s3216 < s3105; const SBool s3228 = s3226 || s3227; const SWord8 s3229 = (s3216 >> 1) | (s3216 << 7); const SWord8 s3230 = 128 | s3229; const SWord8 s3231 = 127 & s3229; const SWord8 s3232 = s3228 ? s3230 : s3231; const SWord8 s3233 = (s3232 >> 1) | (s3232 << 7); const SWord8 s3234 = 128 | s3233; const SWord8 s3235 = 127 & s3233; const SWord8 s3236 = s3081 ? s3234 : s3235; const SWord8 s3237 = (s3236 >> 1) | (s3236 << 7); const SWord8 s3238 = 128 | s3237; const SWord8 s3239 = 127 & s3237; const SWord8 s3240 = s3100 ? s3238 : s3239; const SWord8 s3241 = (s3240 >> 1) | (s3240 << 7); const SWord8 s3242 = 128 | s3241; const SWord8 s3243 = 127 & s3241; const SWord8 s3244 = s3224 ? s3242 : s3243; const SWord8 s3245 = s1 + s3240; const SBool s3246 = s3245 < s1; const SBool s3247 = s3245 < s3240; const SBool s3248 = s3246 || s3247; const SWord8 s3249 = (s3245 >> 1) | (s3245 << 7); const SWord8 s3250 = 128 | s3249; const SWord8 s3251 = 127 & s3249; const SWord8 s3252 = s3248 ? s3250 : s3251; const SWord8 s3253 = s3225 ? s3244 : s3252; const SWord8 s3254 = s1 + s3236; const SBool s3255 = s3254 < s1; const SBool s3256 = s3254 < s3236; const SBool s3257 = s3255 || s3256; const SWord8 s3258 = (s3254 >> 1) | (s3254 << 7); const SWord8 s3259 = 128 | s3258; const SWord8 s3260 = 127 & s3258; const SWord8 s3261 = s3257 ? s3259 : s3260; const SWord8 s3262 = (s3261 >> 1) | (s3261 << 7); const SWord8 s3263 = 128 | s3262; const SWord8 s3264 = 127 & s3262; const SWord8 s3265 = s3224 ? s3263 : s3264; const SWord8 s3266 = s1 + s3261; const SBool s3267 = s3266 < s1; const SBool s3268 = s3266 < s3261; const SBool s3269 = s3267 || s3268; const SWord8 s3270 = (s3266 >> 1) | (s3266 << 7); const SWord8 s3271 = 128 | s3270; const SWord8 s3272 = 127 & s3270; const SWord8 s3273 = s3269 ? s3271 : s3272; const SWord8 s3274 = s3225 ? s3265 : s3273; const SWord8 s3275 = s3101 ? s3253 : s3274; const SWord8 s3276 = s1 + s3232; const SBool s3277 = s3276 < s1; const SBool s3278 = s3276 < s3232; const SBool s3279 = s3277 || s3278; const SWord8 s3280 = (s3276 >> 1) | (s3276 << 7); const SWord8 s3281 = 128 | s3280; const SWord8 s3282 = 127 & s3280; const SWord8 s3283 = s3279 ? s3281 : s3282; const SWord8 s3284 = (s3283 >> 1) | (s3283 << 7); const SWord8 s3285 = 128 | s3284; const SWord8 s3286 = 127 & s3284; const SWord8 s3287 = s3100 ? s3285 : s3286; const SWord8 s3288 = (s3287 >> 1) | (s3287 << 7); const SWord8 s3289 = 128 | s3288; const SWord8 s3290 = 127 & s3288; const SWord8 s3291 = s3224 ? s3289 : s3290; const SWord8 s3292 = s1 + s3287; const SBool s3293 = s3292 < s1; const SBool s3294 = s3292 < s3287; const SBool s3295 = s3293 || s3294; const SWord8 s3296 = (s3292 >> 1) | (s3292 << 7); const SWord8 s3297 = 128 | s3296; const SWord8 s3298 = 127 & s3296; const SWord8 s3299 = s3295 ? s3297 : s3298; const SWord8 s3300 = s3225 ? s3291 : s3299; const SWord8 s3301 = s1 + s3283; const SBool s3302 = s3301 < s1; const SBool s3303 = s3301 < s3283; const SBool s3304 = s3302 || s3303; const SWord8 s3305 = (s3301 >> 1) | (s3301 << 7); const SWord8 s3306 = 128 | s3305; const SWord8 s3307 = 127 & s3305; const SWord8 s3308 = s3304 ? s3306 : s3307; const SWord8 s3309 = (s3308 >> 1) | (s3308 << 7); const SWord8 s3310 = 128 | s3309; const SWord8 s3311 = 127 & s3309; const SWord8 s3312 = s3224 ? s3310 : s3311; const SWord8 s3313 = s1 + s3308; const SBool s3314 = s3313 < s1; const SBool s3315 = s3313 < s3308; const SBool s3316 = s3314 || s3315; const SWord8 s3317 = (s3313 >> 1) | (s3313 << 7); const SWord8 s3318 = 128 | s3317; const SWord8 s3319 = 127 & s3317; const SWord8 s3320 = s3316 ? s3318 : s3319; const SWord8 s3321 = s3225 ? s3312 : s3320; const SWord8 s3322 = s3101 ? s3300 : s3321; const SWord8 s3323 = s3082 ? s3275 : s3322; const SWord8 s3324 = s3060 ? s3215 : s3323; const SWord8 s3325 = s1 + s3086; const SBool s3326 = (SBool) (s3325 & 1); const SBool s3327 = false != s3326; const SWord8 s3328 = s3327 ? s3090 : s3091; const SBool s3329 = (SBool) (s3328 & 1); const SBool s3330 = false != s3329; const SWord8 s3331 = s3330 ? s3096 : s3097; const SBool s3332 = (SBool) (s3331 & 1); const SBool s3333 = false != s3332; const SBool s3334 = false == s3333; const SBool s3335 = s3325 < s1; const SBool s3336 = s3325 < s3086; const SBool s3337 = s3335 || s3336; const SWord8 s3338 = (s3325 >> 1) | (s3325 << 7); const SWord8 s3339 = 128 | s3338; const SWord8 s3340 = 127 & s3338; const SWord8 s3341 = s3337 ? s3339 : s3340; const SBool s3342 = (SBool) (s3341 & 1); const SBool s3343 = false != s3342; const SWord8 s3344 = (s3328 >> 1) | (s3328 << 7); const SWord8 s3345 = 128 | s3344; const SWord8 s3346 = 127 & s3344; const SWord8 s3347 = s3343 ? s3345 : s3346; const SBool s3348 = (SBool) (s3347 & 1); const SBool s3349 = false != s3348; const SWord8 s3350 = (s3331 >> 1) | (s3331 << 7); const SWord8 s3351 = 128 | s3350; const SWord8 s3352 = 127 & s3350; const SWord8 s3353 = s3349 ? s3351 : s3352; const SBool s3354 = (SBool) (s3353 & 1); const SBool s3355 = false != s3354; const SBool s3356 = false == s3355; const SWord8 s3357 = (s3341 >> 1) | (s3341 << 7); const SWord8 s3358 = 128 | s3357; const SWord8 s3359 = 127 & s3357; const SWord8 s3360 = s3059 ? s3358 : s3359; const SWord8 s3361 = (s3360 >> 1) | (s3360 << 7); const SWord8 s3362 = 128 | s3361; const SWord8 s3363 = 127 & s3361; const SWord8 s3364 = s3081 ? s3362 : s3363; const SWord8 s3365 = (s3364 >> 1) | (s3364 << 7); const SWord8 s3366 = 128 | s3365; const SWord8 s3367 = 127 & s3365; const SWord8 s3368 = s3333 ? s3366 : s3367; const SWord8 s3369 = (s3368 >> 1) | (s3368 << 7); const SWord8 s3370 = 128 | s3369; const SWord8 s3371 = 127 & s3369; const SWord8 s3372 = s3355 ? s3370 : s3371; const SWord8 s3373 = s1 + s3368; const SBool s3374 = s3373 < s1; const SBool s3375 = s3373 < s3368; const SBool s3376 = s3374 || s3375; const SWord8 s3377 = (s3373 >> 1) | (s3373 << 7); const SWord8 s3378 = 128 | s3377; const SWord8 s3379 = 127 & s3377; const SWord8 s3380 = s3376 ? s3378 : s3379; const SWord8 s3381 = s3356 ? s3372 : s3380; const SWord8 s3382 = s1 + s3364; const SBool s3383 = s3382 < s1; const SBool s3384 = s3382 < s3364; const SBool s3385 = s3383 || s3384; const SWord8 s3386 = (s3382 >> 1) | (s3382 << 7); const SWord8 s3387 = 128 | s3386; const SWord8 s3388 = 127 & s3386; const SWord8 s3389 = s3385 ? s3387 : s3388; const SWord8 s3390 = (s3389 >> 1) | (s3389 << 7); const SWord8 s3391 = 128 | s3390; const SWord8 s3392 = 127 & s3390; const SWord8 s3393 = s3355 ? s3391 : s3392; const SWord8 s3394 = s1 + s3389; const SBool s3395 = s3394 < s1; const SBool s3396 = s3394 < s3389; const SBool s3397 = s3395 || s3396; const SWord8 s3398 = (s3394 >> 1) | (s3394 << 7); const SWord8 s3399 = 128 | s3398; const SWord8 s3400 = 127 & s3398; const SWord8 s3401 = s3397 ? s3399 : s3400; const SWord8 s3402 = s3356 ? s3393 : s3401; const SWord8 s3403 = s3334 ? s3381 : s3402; const SWord8 s3404 = s1 + s3360; const SBool s3405 = s3404 < s1; const SBool s3406 = s3404 < s3360; const SBool s3407 = s3405 || s3406; const SWord8 s3408 = (s3404 >> 1) | (s3404 << 7); const SWord8 s3409 = 128 | s3408; const SWord8 s3410 = 127 & s3408; const SWord8 s3411 = s3407 ? s3409 : s3410; const SWord8 s3412 = (s3411 >> 1) | (s3411 << 7); const SWord8 s3413 = 128 | s3412; const SWord8 s3414 = 127 & s3412; const SWord8 s3415 = s3333 ? s3413 : s3414; const SWord8 s3416 = (s3415 >> 1) | (s3415 << 7); const SWord8 s3417 = 128 | s3416; const SWord8 s3418 = 127 & s3416; const SWord8 s3419 = s3355 ? s3417 : s3418; const SWord8 s3420 = s1 + s3415; const SBool s3421 = s3420 < s1; const SBool s3422 = s3420 < s3415; const SBool s3423 = s3421 || s3422; const SWord8 s3424 = (s3420 >> 1) | (s3420 << 7); const SWord8 s3425 = 128 | s3424; const SWord8 s3426 = 127 & s3424; const SWord8 s3427 = s3423 ? s3425 : s3426; const SWord8 s3428 = s3356 ? s3419 : s3427; const SWord8 s3429 = s1 + s3411; const SBool s3430 = s3429 < s1; const SBool s3431 = s3429 < s3411; const SBool s3432 = s3430 || s3431; const SWord8 s3433 = (s3429 >> 1) | (s3429 << 7); const SWord8 s3434 = 128 | s3433; const SWord8 s3435 = 127 & s3433; const SWord8 s3436 = s3432 ? s3434 : s3435; const SWord8 s3437 = (s3436 >> 1) | (s3436 << 7); const SWord8 s3438 = 128 | s3437; const SWord8 s3439 = 127 & s3437; const SWord8 s3440 = s3355 ? s3438 : s3439; const SWord8 s3441 = s1 + s3436; const SBool s3442 = s3441 < s1; const SBool s3443 = s3441 < s3436; const SBool s3444 = s3442 || s3443; const SWord8 s3445 = (s3441 >> 1) | (s3441 << 7); const SWord8 s3446 = 128 | s3445; const SWord8 s3447 = 127 & s3445; const SWord8 s3448 = s3444 ? s3446 : s3447; const SWord8 s3449 = s3356 ? s3440 : s3448; const SWord8 s3450 = s3334 ? s3428 : s3449; const SWord8 s3451 = s3082 ? s3403 : s3450; const SWord8 s3452 = s1 + s3341; const SBool s3453 = (SBool) (s3452 & 1); const SBool s3454 = false != s3453; const SWord8 s3455 = s3454 ? s3345 : s3346; const SBool s3456 = (SBool) (s3455 & 1); const SBool s3457 = false != s3456; const SWord8 s3458 = s3457 ? s3351 : s3352; const SBool s3459 = (SBool) (s3458 & 1); const SBool s3460 = false != s3459; const SBool s3461 = false == s3460; const SBool s3462 = s3452 < s1; const SBool s3463 = s3452 < s3341; const SBool s3464 = s3462 || s3463; const SWord8 s3465 = (s3452 >> 1) | (s3452 << 7); const SWord8 s3466 = 128 | s3465; const SWord8 s3467 = 127 & s3465; const SWord8 s3468 = s3464 ? s3466 : s3467; const SWord8 s3469 = (s3468 >> 1) | (s3468 << 7); const SWord8 s3470 = 128 | s3469; const SWord8 s3471 = 127 & s3469; const SWord8 s3472 = s3081 ? s3470 : s3471; const SWord8 s3473 = (s3472 >> 1) | (s3472 << 7); const SWord8 s3474 = 128 | s3473; const SWord8 s3475 = 127 & s3473; const SWord8 s3476 = s3333 ? s3474 : s3475; const SWord8 s3477 = (s3476 >> 1) | (s3476 << 7); const SWord8 s3478 = 128 | s3477; const SWord8 s3479 = 127 & s3477; const SWord8 s3480 = s3460 ? s3478 : s3479; const SWord8 s3481 = s1 + s3476; const SBool s3482 = s3481 < s1; const SBool s3483 = s3481 < s3476; const SBool s3484 = s3482 || s3483; const SWord8 s3485 = (s3481 >> 1) | (s3481 << 7); const SWord8 s3486 = 128 | s3485; const SWord8 s3487 = 127 & s3485; const SWord8 s3488 = s3484 ? s3486 : s3487; const SWord8 s3489 = s3461 ? s3480 : s3488; const SWord8 s3490 = s1 + s3472; const SBool s3491 = s3490 < s1; const SBool s3492 = s3490 < s3472; const SBool s3493 = s3491 || s3492; const SWord8 s3494 = (s3490 >> 1) | (s3490 << 7); const SWord8 s3495 = 128 | s3494; const SWord8 s3496 = 127 & s3494; const SWord8 s3497 = s3493 ? s3495 : s3496; const SWord8 s3498 = (s3497 >> 1) | (s3497 << 7); const SWord8 s3499 = 128 | s3498; const SWord8 s3500 = 127 & s3498; const SWord8 s3501 = s3460 ? s3499 : s3500; const SWord8 s3502 = s1 + s3497; const SBool s3503 = s3502 < s1; const SBool s3504 = s3502 < s3497; const SBool s3505 = s3503 || s3504; const SWord8 s3506 = (s3502 >> 1) | (s3502 << 7); const SWord8 s3507 = 128 | s3506; const SWord8 s3508 = 127 & s3506; const SWord8 s3509 = s3505 ? s3507 : s3508; const SWord8 s3510 = s3461 ? s3501 : s3509; const SWord8 s3511 = s3334 ? s3489 : s3510; const SWord8 s3512 = s1 + s3468; const SBool s3513 = s3512 < s1; const SBool s3514 = s3512 < s3468; const SBool s3515 = s3513 || s3514; const SWord8 s3516 = (s3512 >> 1) | (s3512 << 7); const SWord8 s3517 = 128 | s3516; const SWord8 s3518 = 127 & s3516; const SWord8 s3519 = s3515 ? s3517 : s3518; const SWord8 s3520 = (s3519 >> 1) | (s3519 << 7); const SWord8 s3521 = 128 | s3520; const SWord8 s3522 = 127 & s3520; const SWord8 s3523 = s3333 ? s3521 : s3522; const SWord8 s3524 = (s3523 >> 1) | (s3523 << 7); const SWord8 s3525 = 128 | s3524; const SWord8 s3526 = 127 & s3524; const SWord8 s3527 = s3460 ? s3525 : s3526; const SWord8 s3528 = s1 + s3523; const SBool s3529 = s3528 < s1; const SBool s3530 = s3528 < s3523; const SBool s3531 = s3529 || s3530; const SWord8 s3532 = (s3528 >> 1) | (s3528 << 7); const SWord8 s3533 = 128 | s3532; const SWord8 s3534 = 127 & s3532; const SWord8 s3535 = s3531 ? s3533 : s3534; const SWord8 s3536 = s3461 ? s3527 : s3535; const SWord8 s3537 = s1 + s3519; const SBool s3538 = s3537 < s1; const SBool s3539 = s3537 < s3519; const SBool s3540 = s3538 || s3539; const SWord8 s3541 = (s3537 >> 1) | (s3537 << 7); const SWord8 s3542 = 128 | s3541; const SWord8 s3543 = 127 & s3541; const SWord8 s3544 = s3540 ? s3542 : s3543; const SWord8 s3545 = (s3544 >> 1) | (s3544 << 7); const SWord8 s3546 = 128 | s3545; const SWord8 s3547 = 127 & s3545; const SWord8 s3548 = s3460 ? s3546 : s3547; const SWord8 s3549 = s1 + s3544; const SBool s3550 = s3549 < s1; const SBool s3551 = s3549 < s3544; const SBool s3552 = s3550 || s3551; const SWord8 s3553 = (s3549 >> 1) | (s3549 << 7); const SWord8 s3554 = 128 | s3553; const SWord8 s3555 = 127 & s3553; const SWord8 s3556 = s3552 ? s3554 : s3555; const SWord8 s3557 = s3461 ? s3548 : s3556; const SWord8 s3558 = s3334 ? s3536 : s3557; const SWord8 s3559 = s3082 ? s3511 : s3558; const SWord8 s3560 = s3060 ? s3451 : s3559; const SWord8 s3561 = s2042 ? s3324 : s3560; const SWord8 s3562 = s1 + s3067; const SBool s3563 = (SBool) (s3562 & 1); const SBool s3564 = false != s3563; const SWord8 s3565 = s3564 ? s3071 : s3072; const SBool s3566 = (SBool) (s3565 & 1); const SBool s3567 = false != s3566; const SWord8 s3568 = s3567 ? s3077 : s3078; const SBool s3569 = (SBool) (s3568 & 1); const SBool s3570 = false != s3569; const SBool s3571 = false == s3570; const SBool s3572 = s3562 < s1; const SBool s3573 = s3562 < s3067; const SBool s3574 = s3572 || s3573; const SWord8 s3575 = (s3562 >> 1) | (s3562 << 7); const SWord8 s3576 = 128 | s3575; const SWord8 s3577 = 127 & s3575; const SWord8 s3578 = s3574 ? s3576 : s3577; const SBool s3579 = (SBool) (s3578 & 1); const SBool s3580 = false != s3579; const SWord8 s3581 = (s3565 >> 1) | (s3565 << 7); const SWord8 s3582 = 128 | s3581; const SWord8 s3583 = 127 & s3581; const SWord8 s3584 = s3580 ? s3582 : s3583; const SBool s3585 = (SBool) (s3584 & 1); const SBool s3586 = false != s3585; const SWord8 s3587 = (s3568 >> 1) | (s3568 << 7); const SWord8 s3588 = 128 | s3587; const SWord8 s3589 = 127 & s3587; const SWord8 s3590 = s3586 ? s3588 : s3589; const SBool s3591 = (SBool) (s3590 & 1); const SBool s3592 = false != s3591; const SBool s3593 = false == s3592; const SWord8 s3594 = (s3578 >> 1) | (s3578 << 7); const SWord8 s3595 = 128 | s3594; const SWord8 s3596 = 127 & s3594; const SWord8 s3597 = s2041 ? s3595 : s3596; const SBool s3598 = (SBool) (s3597 & 1); const SBool s3599 = false != s3598; const SWord8 s3600 = (s3584 >> 1) | (s3584 << 7); const SWord8 s3601 = 128 | s3600; const SWord8 s3602 = 127 & s3600; const SWord8 s3603 = s3599 ? s3601 : s3602; const SBool s3604 = (SBool) (s3603 & 1); const SBool s3605 = false != s3604; const SWord8 s3606 = (s3590 >> 1) | (s3590 << 7); const SWord8 s3607 = 128 | s3606; const SWord8 s3608 = 127 & s3606; const SWord8 s3609 = s3605 ? s3607 : s3608; const SBool s3610 = (SBool) (s3609 & 1); const SBool s3611 = false != s3610; const SBool s3612 = false == s3611; const SWord8 s3613 = (s3597 >> 1) | (s3597 << 7); const SWord8 s3614 = 128 | s3613; const SWord8 s3615 = 127 & s3613; const SWord8 s3616 = s3059 ? s3614 : s3615; const SWord8 s3617 = (s3616 >> 1) | (s3616 << 7); const SWord8 s3618 = 128 | s3617; const SWord8 s3619 = 127 & s3617; const SWord8 s3620 = s3570 ? s3618 : s3619; const SWord8 s3621 = (s3620 >> 1) | (s3620 << 7); const SWord8 s3622 = 128 | s3621; const SWord8 s3623 = 127 & s3621; const SWord8 s3624 = s3592 ? s3622 : s3623; const SWord8 s3625 = (s3624 >> 1) | (s3624 << 7); const SWord8 s3626 = 128 | s3625; const SWord8 s3627 = 127 & s3625; const SWord8 s3628 = s3611 ? s3626 : s3627; const SWord8 s3629 = s1 + s3624; const SBool s3630 = s3629 < s1; const SBool s3631 = s3629 < s3624; const SBool s3632 = s3630 || s3631; const SWord8 s3633 = (s3629 >> 1) | (s3629 << 7); const SWord8 s3634 = 128 | s3633; const SWord8 s3635 = 127 & s3633; const SWord8 s3636 = s3632 ? s3634 : s3635; const SWord8 s3637 = s3612 ? s3628 : s3636; const SWord8 s3638 = s1 + s3620; const SBool s3639 = s3638 < s1; const SBool s3640 = s3638 < s3620; const SBool s3641 = s3639 || s3640; const SWord8 s3642 = (s3638 >> 1) | (s3638 << 7); const SWord8 s3643 = 128 | s3642; const SWord8 s3644 = 127 & s3642; const SWord8 s3645 = s3641 ? s3643 : s3644; const SWord8 s3646 = (s3645 >> 1) | (s3645 << 7); const SWord8 s3647 = 128 | s3646; const SWord8 s3648 = 127 & s3646; const SWord8 s3649 = s3611 ? s3647 : s3648; const SWord8 s3650 = s1 + s3645; const SBool s3651 = s3650 < s1; const SBool s3652 = s3650 < s3645; const SBool s3653 = s3651 || s3652; const SWord8 s3654 = (s3650 >> 1) | (s3650 << 7); const SWord8 s3655 = 128 | s3654; const SWord8 s3656 = 127 & s3654; const SWord8 s3657 = s3653 ? s3655 : s3656; const SWord8 s3658 = s3612 ? s3649 : s3657; const SWord8 s3659 = s3593 ? s3637 : s3658; const SWord8 s3660 = s1 + s3616; const SBool s3661 = s3660 < s1; const SBool s3662 = s3660 < s3616; const SBool s3663 = s3661 || s3662; const SWord8 s3664 = (s3660 >> 1) | (s3660 << 7); const SWord8 s3665 = 128 | s3664; const SWord8 s3666 = 127 & s3664; const SWord8 s3667 = s3663 ? s3665 : s3666; const SWord8 s3668 = (s3667 >> 1) | (s3667 << 7); const SWord8 s3669 = 128 | s3668; const SWord8 s3670 = 127 & s3668; const SWord8 s3671 = s3592 ? s3669 : s3670; const SWord8 s3672 = (s3671 >> 1) | (s3671 << 7); const SWord8 s3673 = 128 | s3672; const SWord8 s3674 = 127 & s3672; const SWord8 s3675 = s3611 ? s3673 : s3674; const SWord8 s3676 = s1 + s3671; const SBool s3677 = s3676 < s1; const SBool s3678 = s3676 < s3671; const SBool s3679 = s3677 || s3678; const SWord8 s3680 = (s3676 >> 1) | (s3676 << 7); const SWord8 s3681 = 128 | s3680; const SWord8 s3682 = 127 & s3680; const SWord8 s3683 = s3679 ? s3681 : s3682; const SWord8 s3684 = s3612 ? s3675 : s3683; const SWord8 s3685 = s1 + s3667; const SBool s3686 = s3685 < s1; const SBool s3687 = s3685 < s3667; const SBool s3688 = s3686 || s3687; const SWord8 s3689 = (s3685 >> 1) | (s3685 << 7); const SWord8 s3690 = 128 | s3689; const SWord8 s3691 = 127 & s3689; const SWord8 s3692 = s3688 ? s3690 : s3691; const SWord8 s3693 = (s3692 >> 1) | (s3692 << 7); const SWord8 s3694 = 128 | s3693; const SWord8 s3695 = 127 & s3693; const SWord8 s3696 = s3611 ? s3694 : s3695; const SWord8 s3697 = s1 + s3692; const SBool s3698 = s3697 < s1; const SBool s3699 = s3697 < s3692; const SBool s3700 = s3698 || s3699; const SWord8 s3701 = (s3697 >> 1) | (s3697 << 7); const SWord8 s3702 = 128 | s3701; const SWord8 s3703 = 127 & s3701; const SWord8 s3704 = s3700 ? s3702 : s3703; const SWord8 s3705 = s3612 ? s3696 : s3704; const SWord8 s3706 = s3593 ? s3684 : s3705; const SWord8 s3707 = s3571 ? s3659 : s3706; const SWord8 s3708 = s1 + s3597; const SBool s3709 = (SBool) (s3708 & 1); const SBool s3710 = false != s3709; const SWord8 s3711 = s3710 ? s3601 : s3602; const SBool s3712 = (SBool) (s3711 & 1); const SBool s3713 = false != s3712; const SWord8 s3714 = s3713 ? s3607 : s3608; const SBool s3715 = (SBool) (s3714 & 1); const SBool s3716 = false != s3715; const SBool s3717 = false == s3716; const SBool s3718 = s3708 < s1; const SBool s3719 = s3708 < s3597; const SBool s3720 = s3718 || s3719; const SWord8 s3721 = (s3708 >> 1) | (s3708 << 7); const SWord8 s3722 = 128 | s3721; const SWord8 s3723 = 127 & s3721; const SWord8 s3724 = s3720 ? s3722 : s3723; const SWord8 s3725 = (s3724 >> 1) | (s3724 << 7); const SWord8 s3726 = 128 | s3725; const SWord8 s3727 = 127 & s3725; const SWord8 s3728 = s3570 ? s3726 : s3727; const SWord8 s3729 = (s3728 >> 1) | (s3728 << 7); const SWord8 s3730 = 128 | s3729; const SWord8 s3731 = 127 & s3729; const SWord8 s3732 = s3592 ? s3730 : s3731; const SWord8 s3733 = (s3732 >> 1) | (s3732 << 7); const SWord8 s3734 = 128 | s3733; const SWord8 s3735 = 127 & s3733; const SWord8 s3736 = s3716 ? s3734 : s3735; const SWord8 s3737 = s1 + s3732; const SBool s3738 = s3737 < s1; const SBool s3739 = s3737 < s3732; const SBool s3740 = s3738 || s3739; const SWord8 s3741 = (s3737 >> 1) | (s3737 << 7); const SWord8 s3742 = 128 | s3741; const SWord8 s3743 = 127 & s3741; const SWord8 s3744 = s3740 ? s3742 : s3743; const SWord8 s3745 = s3717 ? s3736 : s3744; const SWord8 s3746 = s1 + s3728; const SBool s3747 = s3746 < s1; const SBool s3748 = s3746 < s3728; const SBool s3749 = s3747 || s3748; const SWord8 s3750 = (s3746 >> 1) | (s3746 << 7); const SWord8 s3751 = 128 | s3750; const SWord8 s3752 = 127 & s3750; const SWord8 s3753 = s3749 ? s3751 : s3752; const SWord8 s3754 = (s3753 >> 1) | (s3753 << 7); const SWord8 s3755 = 128 | s3754; const SWord8 s3756 = 127 & s3754; const SWord8 s3757 = s3716 ? s3755 : s3756; const SWord8 s3758 = s1 + s3753; const SBool s3759 = s3758 < s1; const SBool s3760 = s3758 < s3753; const SBool s3761 = s3759 || s3760; const SWord8 s3762 = (s3758 >> 1) | (s3758 << 7); const SWord8 s3763 = 128 | s3762; const SWord8 s3764 = 127 & s3762; const SWord8 s3765 = s3761 ? s3763 : s3764; const SWord8 s3766 = s3717 ? s3757 : s3765; const SWord8 s3767 = s3593 ? s3745 : s3766; const SWord8 s3768 = s1 + s3724; const SBool s3769 = s3768 < s1; const SBool s3770 = s3768 < s3724; const SBool s3771 = s3769 || s3770; const SWord8 s3772 = (s3768 >> 1) | (s3768 << 7); const SWord8 s3773 = 128 | s3772; const SWord8 s3774 = 127 & s3772; const SWord8 s3775 = s3771 ? s3773 : s3774; const SWord8 s3776 = (s3775 >> 1) | (s3775 << 7); const SWord8 s3777 = 128 | s3776; const SWord8 s3778 = 127 & s3776; const SWord8 s3779 = s3592 ? s3777 : s3778; const SWord8 s3780 = (s3779 >> 1) | (s3779 << 7); const SWord8 s3781 = 128 | s3780; const SWord8 s3782 = 127 & s3780; const SWord8 s3783 = s3716 ? s3781 : s3782; const SWord8 s3784 = s1 + s3779; const SBool s3785 = s3784 < s1; const SBool s3786 = s3784 < s3779; const SBool s3787 = s3785 || s3786; const SWord8 s3788 = (s3784 >> 1) | (s3784 << 7); const SWord8 s3789 = 128 | s3788; const SWord8 s3790 = 127 & s3788; const SWord8 s3791 = s3787 ? s3789 : s3790; const SWord8 s3792 = s3717 ? s3783 : s3791; const SWord8 s3793 = s1 + s3775; const SBool s3794 = s3793 < s1; const SBool s3795 = s3793 < s3775; const SBool s3796 = s3794 || s3795; const SWord8 s3797 = (s3793 >> 1) | (s3793 << 7); const SWord8 s3798 = 128 | s3797; const SWord8 s3799 = 127 & s3797; const SWord8 s3800 = s3796 ? s3798 : s3799; const SWord8 s3801 = (s3800 >> 1) | (s3800 << 7); const SWord8 s3802 = 128 | s3801; const SWord8 s3803 = 127 & s3801; const SWord8 s3804 = s3716 ? s3802 : s3803; const SWord8 s3805 = s1 + s3800; const SBool s3806 = s3805 < s1; const SBool s3807 = s3805 < s3800; const SBool s3808 = s3806 || s3807; const SWord8 s3809 = (s3805 >> 1) | (s3805 << 7); const SWord8 s3810 = 128 | s3809; const SWord8 s3811 = 127 & s3809; const SWord8 s3812 = s3808 ? s3810 : s3811; const SWord8 s3813 = s3717 ? s3804 : s3812; const SWord8 s3814 = s3593 ? s3792 : s3813; const SWord8 s3815 = s3571 ? s3767 : s3814; const SWord8 s3816 = s3060 ? s3707 : s3815; const SWord8 s3817 = s1 + s3578; const SBool s3818 = (SBool) (s3817 & 1); const SBool s3819 = false != s3818; const SWord8 s3820 = s3819 ? s3582 : s3583; const SBool s3821 = (SBool) (s3820 & 1); const SBool s3822 = false != s3821; const SWord8 s3823 = s3822 ? s3588 : s3589; const SBool s3824 = (SBool) (s3823 & 1); const SBool s3825 = false != s3824; const SBool s3826 = false == s3825; const SBool s3827 = s3817 < s1; const SBool s3828 = s3817 < s3578; const SBool s3829 = s3827 || s3828; const SWord8 s3830 = (s3817 >> 1) | (s3817 << 7); const SWord8 s3831 = 128 | s3830; const SWord8 s3832 = 127 & s3830; const SWord8 s3833 = s3829 ? s3831 : s3832; const SBool s3834 = (SBool) (s3833 & 1); const SBool s3835 = false != s3834; const SWord8 s3836 = (s3820 >> 1) | (s3820 << 7); const SWord8 s3837 = 128 | s3836; const SWord8 s3838 = 127 & s3836; const SWord8 s3839 = s3835 ? s3837 : s3838; const SBool s3840 = (SBool) (s3839 & 1); const SBool s3841 = false != s3840; const SWord8 s3842 = (s3823 >> 1) | (s3823 << 7); const SWord8 s3843 = 128 | s3842; const SWord8 s3844 = 127 & s3842; const SWord8 s3845 = s3841 ? s3843 : s3844; const SBool s3846 = (SBool) (s3845 & 1); const SBool s3847 = false != s3846; const SBool s3848 = false == s3847; const SWord8 s3849 = (s3833 >> 1) | (s3833 << 7); const SWord8 s3850 = 128 | s3849; const SWord8 s3851 = 127 & s3849; const SWord8 s3852 = s3059 ? s3850 : s3851; const SWord8 s3853 = (s3852 >> 1) | (s3852 << 7); const SWord8 s3854 = 128 | s3853; const SWord8 s3855 = 127 & s3853; const SWord8 s3856 = s3570 ? s3854 : s3855; const SWord8 s3857 = (s3856 >> 1) | (s3856 << 7); const SWord8 s3858 = 128 | s3857; const SWord8 s3859 = 127 & s3857; const SWord8 s3860 = s3825 ? s3858 : s3859; const SWord8 s3861 = (s3860 >> 1) | (s3860 << 7); const SWord8 s3862 = 128 | s3861; const SWord8 s3863 = 127 & s3861; const SWord8 s3864 = s3847 ? s3862 : s3863; const SWord8 s3865 = s1 + s3860; const SBool s3866 = s3865 < s1; const SBool s3867 = s3865 < s3860; const SBool s3868 = s3866 || s3867; const SWord8 s3869 = (s3865 >> 1) | (s3865 << 7); const SWord8 s3870 = 128 | s3869; const SWord8 s3871 = 127 & s3869; const SWord8 s3872 = s3868 ? s3870 : s3871; const SWord8 s3873 = s3848 ? s3864 : s3872; const SWord8 s3874 = s1 + s3856; const SBool s3875 = s3874 < s1; const SBool s3876 = s3874 < s3856; const SBool s3877 = s3875 || s3876; const SWord8 s3878 = (s3874 >> 1) | (s3874 << 7); const SWord8 s3879 = 128 | s3878; const SWord8 s3880 = 127 & s3878; const SWord8 s3881 = s3877 ? s3879 : s3880; const SWord8 s3882 = (s3881 >> 1) | (s3881 << 7); const SWord8 s3883 = 128 | s3882; const SWord8 s3884 = 127 & s3882; const SWord8 s3885 = s3847 ? s3883 : s3884; const SWord8 s3886 = s1 + s3881; const SBool s3887 = s3886 < s1; const SBool s3888 = s3886 < s3881; const SBool s3889 = s3887 || s3888; const SWord8 s3890 = (s3886 >> 1) | (s3886 << 7); const SWord8 s3891 = 128 | s3890; const SWord8 s3892 = 127 & s3890; const SWord8 s3893 = s3889 ? s3891 : s3892; const SWord8 s3894 = s3848 ? s3885 : s3893; const SWord8 s3895 = s3826 ? s3873 : s3894; const SWord8 s3896 = s1 + s3852; const SBool s3897 = s3896 < s1; const SBool s3898 = s3896 < s3852; const SBool s3899 = s3897 || s3898; const SWord8 s3900 = (s3896 >> 1) | (s3896 << 7); const SWord8 s3901 = 128 | s3900; const SWord8 s3902 = 127 & s3900; const SWord8 s3903 = s3899 ? s3901 : s3902; const SWord8 s3904 = (s3903 >> 1) | (s3903 << 7); const SWord8 s3905 = 128 | s3904; const SWord8 s3906 = 127 & s3904; const SWord8 s3907 = s3825 ? s3905 : s3906; const SWord8 s3908 = (s3907 >> 1) | (s3907 << 7); const SWord8 s3909 = 128 | s3908; const SWord8 s3910 = 127 & s3908; const SWord8 s3911 = s3847 ? s3909 : s3910; const SWord8 s3912 = s1 + s3907; const SBool s3913 = s3912 < s1; const SBool s3914 = s3912 < s3907; const SBool s3915 = s3913 || s3914; const SWord8 s3916 = (s3912 >> 1) | (s3912 << 7); const SWord8 s3917 = 128 | s3916; const SWord8 s3918 = 127 & s3916; const SWord8 s3919 = s3915 ? s3917 : s3918; const SWord8 s3920 = s3848 ? s3911 : s3919; const SWord8 s3921 = s1 + s3903; const SBool s3922 = s3921 < s1; const SBool s3923 = s3921 < s3903; const SBool s3924 = s3922 || s3923; const SWord8 s3925 = (s3921 >> 1) | (s3921 << 7); const SWord8 s3926 = 128 | s3925; const SWord8 s3927 = 127 & s3925; const SWord8 s3928 = s3924 ? s3926 : s3927; const SWord8 s3929 = (s3928 >> 1) | (s3928 << 7); const SWord8 s3930 = 128 | s3929; const SWord8 s3931 = 127 & s3929; const SWord8 s3932 = s3847 ? s3930 : s3931; const SWord8 s3933 = s1 + s3928; const SBool s3934 = s3933 < s1; const SBool s3935 = s3933 < s3928; const SBool s3936 = s3934 || s3935; const SWord8 s3937 = (s3933 >> 1) | (s3933 << 7); const SWord8 s3938 = 128 | s3937; const SWord8 s3939 = 127 & s3937; const SWord8 s3940 = s3936 ? s3938 : s3939; const SWord8 s3941 = s3848 ? s3932 : s3940; const SWord8 s3942 = s3826 ? s3920 : s3941; const SWord8 s3943 = s3571 ? s3895 : s3942; const SWord8 s3944 = s1 + s3833; const SBool s3945 = (SBool) (s3944 & 1); const SBool s3946 = false != s3945; const SWord8 s3947 = s3946 ? s3837 : s3838; const SBool s3948 = (SBool) (s3947 & 1); const SBool s3949 = false != s3948; const SWord8 s3950 = s3949 ? s3843 : s3844; const SBool s3951 = (SBool) (s3950 & 1); const SBool s3952 = false != s3951; const SBool s3953 = false == s3952; const SBool s3954 = s3944 < s1; const SBool s3955 = s3944 < s3833; const SBool s3956 = s3954 || s3955; const SWord8 s3957 = (s3944 >> 1) | (s3944 << 7); const SWord8 s3958 = 128 | s3957; const SWord8 s3959 = 127 & s3957; const SWord8 s3960 = s3956 ? s3958 : s3959; const SWord8 s3961 = (s3960 >> 1) | (s3960 << 7); const SWord8 s3962 = 128 | s3961; const SWord8 s3963 = 127 & s3961; const SWord8 s3964 = s3570 ? s3962 : s3963; const SWord8 s3965 = (s3964 >> 1) | (s3964 << 7); const SWord8 s3966 = 128 | s3965; const SWord8 s3967 = 127 & s3965; const SWord8 s3968 = s3825 ? s3966 : s3967; const SWord8 s3969 = (s3968 >> 1) | (s3968 << 7); const SWord8 s3970 = 128 | s3969; const SWord8 s3971 = 127 & s3969; const SWord8 s3972 = s3952 ? s3970 : s3971; const SWord8 s3973 = s1 + s3968; const SBool s3974 = s3973 < s1; const SBool s3975 = s3973 < s3968; const SBool s3976 = s3974 || s3975; const SWord8 s3977 = (s3973 >> 1) | (s3973 << 7); const SWord8 s3978 = 128 | s3977; const SWord8 s3979 = 127 & s3977; const SWord8 s3980 = s3976 ? s3978 : s3979; const SWord8 s3981 = s3953 ? s3972 : s3980; const SWord8 s3982 = s1 + s3964; const SBool s3983 = s3982 < s1; const SBool s3984 = s3982 < s3964; const SBool s3985 = s3983 || s3984; const SWord8 s3986 = (s3982 >> 1) | (s3982 << 7); const SWord8 s3987 = 128 | s3986; const SWord8 s3988 = 127 & s3986; const SWord8 s3989 = s3985 ? s3987 : s3988; const SWord8 s3990 = (s3989 >> 1) | (s3989 << 7); const SWord8 s3991 = 128 | s3990; const SWord8 s3992 = 127 & s3990; const SWord8 s3993 = s3952 ? s3991 : s3992; const SWord8 s3994 = s1 + s3989; const SBool s3995 = s3994 < s1; const SBool s3996 = s3994 < s3989; const SBool s3997 = s3995 || s3996; const SWord8 s3998 = (s3994 >> 1) | (s3994 << 7); const SWord8 s3999 = 128 | s3998; const SWord8 s4000 = 127 & s3998; const SWord8 s4001 = s3997 ? s3999 : s4000; const SWord8 s4002 = s3953 ? s3993 : s4001; const SWord8 s4003 = s3826 ? s3981 : s4002; const SWord8 s4004 = s1 + s3960; const SBool s4005 = s4004 < s1; const SBool s4006 = s4004 < s3960; const SBool s4007 = s4005 || s4006; const SWord8 s4008 = (s4004 >> 1) | (s4004 << 7); const SWord8 s4009 = 128 | s4008; const SWord8 s4010 = 127 & s4008; const SWord8 s4011 = s4007 ? s4009 : s4010; const SWord8 s4012 = (s4011 >> 1) | (s4011 << 7); const SWord8 s4013 = 128 | s4012; const SWord8 s4014 = 127 & s4012; const SWord8 s4015 = s3825 ? s4013 : s4014; const SWord8 s4016 = (s4015 >> 1) | (s4015 << 7); const SWord8 s4017 = 128 | s4016; const SWord8 s4018 = 127 & s4016; const SWord8 s4019 = s3952 ? s4017 : s4018; const SWord8 s4020 = s1 + s4015; const SBool s4021 = s4020 < s1; const SBool s4022 = s4020 < s4015; const SBool s4023 = s4021 || s4022; const SWord8 s4024 = (s4020 >> 1) | (s4020 << 7); const SWord8 s4025 = 128 | s4024; const SWord8 s4026 = 127 & s4024; const SWord8 s4027 = s4023 ? s4025 : s4026; const SWord8 s4028 = s3953 ? s4019 : s4027; const SWord8 s4029 = s1 + s4011; const SBool s4030 = s4029 < s1; const SBool s4031 = s4029 < s4011; const SBool s4032 = s4030 || s4031; const SWord8 s4033 = (s4029 >> 1) | (s4029 << 7); const SWord8 s4034 = 128 | s4033; const SWord8 s4035 = 127 & s4033; const SWord8 s4036 = s4032 ? s4034 : s4035; const SWord8 s4037 = (s4036 >> 1) | (s4036 << 7); const SWord8 s4038 = 128 | s4037; const SWord8 s4039 = 127 & s4037; const SWord8 s4040 = s3952 ? s4038 : s4039; const SWord8 s4041 = s1 + s4036; const SBool s4042 = s4041 < s1; const SBool s4043 = s4041 < s4036; const SBool s4044 = s4042 || s4043; const SWord8 s4045 = (s4041 >> 1) | (s4041 << 7); const SWord8 s4046 = 128 | s4045; const SWord8 s4047 = 127 & s4045; const SWord8 s4048 = s4044 ? s4046 : s4047; const SWord8 s4049 = s3953 ? s4040 : s4048; const SWord8 s4050 = s3826 ? s4028 : s4049; const SWord8 s4051 = s3571 ? s4003 : s4050; const SWord8 s4052 = s3060 ? s3943 : s4051; const SWord8 s4053 = s2042 ? s3816 : s4052; const SWord8 s4054 = s16 ? s3561 : s4053; const SWord8 s4055 = s11 ? s3050 : s4054; const SWord8 s4056 = s5 ? s2032 : s4055; const SBool s4057 = (SBool) (s105 & 1); const SBool s4058 = false != s4057; const SBool s4059 = (SBool) (s101 & 1); const SBool s4060 = false != s4059; const SBool s4061 = (SBool) (s97 & 1); const SBool s4062 = false != s4061; const SWord8 s4063 = (s84 >> 1) | (s84 << 7); const SWord8 s4064 = 128 | s4063; const SWord8 s4065 = 127 & s4063; const SWord8 s4066 = s4062 ? s4064 : s4065; const SWord8 s4067 = (s4066 >> 1) | (s4066 << 7); const SWord8 s4068 = 128 | s4067; const SWord8 s4069 = 127 & s4067; const SWord8 s4070 = s4060 ? s4068 : s4069; const SWord8 s4071 = (s4070 >> 1) | (s4070 << 7); const SWord8 s4072 = 128 | s4071; const SWord8 s4073 = 127 & s4071; const SWord8 s4074 = s4058 ? s4072 : s4073; const SBool s4075 = (SBool) (s110 & 1); const SBool s4076 = false != s4075; const SWord8 s4077 = s4076 ? s4072 : s4073; const SWord8 s4078 = s93 ? s4074 : s4077; const SBool s4079 = (SBool) (s126 & 1); const SBool s4080 = false != s4079; const SBool s4081 = (SBool) (s119 & 1); const SBool s4082 = false != s4081; const SWord8 s4083 = s4082 ? s4068 : s4069; const SWord8 s4084 = (s4083 >> 1) | (s4083 << 7); const SWord8 s4085 = 128 | s4084; const SWord8 s4086 = 127 & s4084; const SWord8 s4087 = s4080 ? s4085 : s4086; const SBool s4088 = (SBool) (s131 & 1); const SBool s4089 = false != s4088; const SWord8 s4090 = s4089 ? s4085 : s4086; const SWord8 s4091 = s93 ? s4087 : s4090; const SWord8 s4092 = s74 ? s4078 : s4091; const SBool s4093 = (SBool) (s152 & 1); const SBool s4094 = false != s4093; const SBool s4095 = (SBool) (s148 & 1); const SBool s4096 = false != s4095; const SBool s4097 = (SBool) (s141 & 1); const SBool s4098 = false != s4097; const SWord8 s4099 = s4098 ? s4064 : s4065; const SWord8 s4100 = (s4099 >> 1) | (s4099 << 7); const SWord8 s4101 = 128 | s4100; const SWord8 s4102 = 127 & s4100; const SWord8 s4103 = s4096 ? s4101 : s4102; const SWord8 s4104 = (s4103 >> 1) | (s4103 << 7); const SWord8 s4105 = 128 | s4104; const SWord8 s4106 = 127 & s4104; const SWord8 s4107 = s4094 ? s4105 : s4106; const SBool s4108 = (SBool) (s157 & 1); const SBool s4109 = false != s4108; const SWord8 s4110 = s4109 ? s4105 : s4106; const SWord8 s4111 = s93 ? s4107 : s4110; const SBool s4112 = (SBool) (s173 & 1); const SBool s4113 = false != s4112; const SBool s4114 = (SBool) (s166 & 1); const SBool s4115 = false != s4114; const SWord8 s4116 = s4115 ? s4101 : s4102; const SWord8 s4117 = (s4116 >> 1) | (s4116 << 7); const SWord8 s4118 = 128 | s4117; const SWord8 s4119 = 127 & s4117; const SWord8 s4120 = s4113 ? s4118 : s4119; const SBool s4121 = (SBool) (s178 & 1); const SBool s4122 = false != s4121; const SWord8 s4123 = s4122 ? s4118 : s4119; const SWord8 s4124 = s93 ? s4120 : s4123; const SWord8 s4125 = s74 ? s4111 : s4124; const SWord8 s4126 = s55 ? s4092 : s4125; const SBool s4127 = (SBool) (s213 & 1); const SBool s4128 = false != s4127; const SBool s4129 = (SBool) (s209 & 1); const SBool s4130 = false != s4129; const SBool s4131 = (SBool) (s205 & 1); const SBool s4132 = false != s4131; const SWord8 s4133 = (s192 >> 1) | (s192 << 7); const SWord8 s4134 = 128 | s4133; const SWord8 s4135 = 127 & s4133; const SWord8 s4136 = s4132 ? s4134 : s4135; const SWord8 s4137 = (s4136 >> 1) | (s4136 << 7); const SWord8 s4138 = 128 | s4137; const SWord8 s4139 = 127 & s4137; const SWord8 s4140 = s4130 ? s4138 : s4139; const SWord8 s4141 = (s4140 >> 1) | (s4140 << 7); const SWord8 s4142 = 128 | s4141; const SWord8 s4143 = 127 & s4141; const SWord8 s4144 = s4128 ? s4142 : s4143; const SBool s4145 = (SBool) (s218 & 1); const SBool s4146 = false != s4145; const SWord8 s4147 = s4146 ? s4142 : s4143; const SWord8 s4148 = s198 ? s4144 : s4147; const SBool s4149 = (SBool) (s234 & 1); const SBool s4150 = false != s4149; const SBool s4151 = (SBool) (s227 & 1); const SBool s4152 = false != s4151; const SWord8 s4153 = s4152 ? s4138 : s4139; const SWord8 s4154 = (s4153 >> 1) | (s4153 << 7); const SWord8 s4155 = 128 | s4154; const SWord8 s4156 = 127 & s4154; const SWord8 s4157 = s4150 ? s4155 : s4156; const SBool s4158 = (SBool) (s239 & 1); const SBool s4159 = false != s4158; const SWord8 s4160 = s4159 ? s4155 : s4156; const SWord8 s4161 = s198 ? s4157 : s4160; const SWord8 s4162 = s74 ? s4148 : s4161; const SBool s4163 = (SBool) (s260 & 1); const SBool s4164 = false != s4163; const SBool s4165 = (SBool) (s256 & 1); const SBool s4166 = false != s4165; const SBool s4167 = (SBool) (s249 & 1); const SBool s4168 = false != s4167; const SWord8 s4169 = s4168 ? s4134 : s4135; const SWord8 s4170 = (s4169 >> 1) | (s4169 << 7); const SWord8 s4171 = 128 | s4170; const SWord8 s4172 = 127 & s4170; const SWord8 s4173 = s4166 ? s4171 : s4172; const SWord8 s4174 = (s4173 >> 1) | (s4173 << 7); const SWord8 s4175 = 128 | s4174; const SWord8 s4176 = 127 & s4174; const SWord8 s4177 = s4164 ? s4175 : s4176; const SBool s4178 = (SBool) (s265 & 1); const SBool s4179 = false != s4178; const SWord8 s4180 = s4179 ? s4175 : s4176; const SWord8 s4181 = s198 ? s4177 : s4180; const SBool s4182 = (SBool) (s281 & 1); const SBool s4183 = false != s4182; const SBool s4184 = (SBool) (s274 & 1); const SBool s4185 = false != s4184; const SWord8 s4186 = s4185 ? s4171 : s4172; const SWord8 s4187 = (s4186 >> 1) | (s4186 << 7); const SWord8 s4188 = 128 | s4187; const SWord8 s4189 = 127 & s4187; const SWord8 s4190 = s4183 ? s4188 : s4189; const SBool s4191 = (SBool) (s286 & 1); const SBool s4192 = false != s4191; const SWord8 s4193 = s4192 ? s4188 : s4189; const SWord8 s4194 = s198 ? s4190 : s4193; const SWord8 s4195 = s74 ? s4181 : s4194; const SWord8 s4196 = s55 ? s4162 : s4195; const SWord8 s4197 = s36 ? s4126 : s4196; const SBool s4198 = (SBool) (s341 & 1); const SBool s4199 = false != s4198; const SBool s4200 = (SBool) (s337 & 1); const SBool s4201 = false != s4200; const SBool s4202 = (SBool) (s333 & 1); const SBool s4203 = false != s4202; const SWord8 s4204 = (s320 >> 1) | (s320 << 7); const SWord8 s4205 = 128 | s4204; const SWord8 s4206 = 127 & s4204; const SWord8 s4207 = s4203 ? s4205 : s4206; const SWord8 s4208 = (s4207 >> 1) | (s4207 << 7); const SWord8 s4209 = 128 | s4208; const SWord8 s4210 = 127 & s4208; const SWord8 s4211 = s4201 ? s4209 : s4210; const SWord8 s4212 = (s4211 >> 1) | (s4211 << 7); const SWord8 s4213 = 128 | s4212; const SWord8 s4214 = 127 & s4212; const SWord8 s4215 = s4199 ? s4213 : s4214; const SBool s4216 = (SBool) (s346 & 1); const SBool s4217 = false != s4216; const SWord8 s4218 = s4217 ? s4213 : s4214; const SWord8 s4219 = s329 ? s4215 : s4218; const SBool s4220 = (SBool) (s362 & 1); const SBool s4221 = false != s4220; const SBool s4222 = (SBool) (s355 & 1); const SBool s4223 = false != s4222; const SWord8 s4224 = s4223 ? s4209 : s4210; const SWord8 s4225 = (s4224 >> 1) | (s4224 << 7); const SWord8 s4226 = 128 | s4225; const SWord8 s4227 = 127 & s4225; const SWord8 s4228 = s4221 ? s4226 : s4227; const SBool s4229 = (SBool) (s367 & 1); const SBool s4230 = false != s4229; const SWord8 s4231 = s4230 ? s4226 : s4227; const SWord8 s4232 = s329 ? s4228 : s4231; const SWord8 s4233 = s307 ? s4219 : s4232; const SBool s4234 = (SBool) (s388 & 1); const SBool s4235 = false != s4234; const SBool s4236 = (SBool) (s384 & 1); const SBool s4237 = false != s4236; const SBool s4238 = (SBool) (s377 & 1); const SBool s4239 = false != s4238; const SWord8 s4240 = s4239 ? s4205 : s4206; const SWord8 s4241 = (s4240 >> 1) | (s4240 << 7); const SWord8 s4242 = 128 | s4241; const SWord8 s4243 = 127 & s4241; const SWord8 s4244 = s4237 ? s4242 : s4243; const SWord8 s4245 = (s4244 >> 1) | (s4244 << 7); const SWord8 s4246 = 128 | s4245; const SWord8 s4247 = 127 & s4245; const SWord8 s4248 = s4235 ? s4246 : s4247; const SBool s4249 = (SBool) (s393 & 1); const SBool s4250 = false != s4249; const SWord8 s4251 = s4250 ? s4246 : s4247; const SWord8 s4252 = s329 ? s4248 : s4251; const SBool s4253 = (SBool) (s409 & 1); const SBool s4254 = false != s4253; const SBool s4255 = (SBool) (s402 & 1); const SBool s4256 = false != s4255; const SWord8 s4257 = s4256 ? s4242 : s4243; const SWord8 s4258 = (s4257 >> 1) | (s4257 << 7); const SWord8 s4259 = 128 | s4258; const SWord8 s4260 = 127 & s4258; const SWord8 s4261 = s4254 ? s4259 : s4260; const SBool s4262 = (SBool) (s414 & 1); const SBool s4263 = false != s4262; const SWord8 s4264 = s4263 ? s4259 : s4260; const SWord8 s4265 = s329 ? s4261 : s4264; const SWord8 s4266 = s307 ? s4252 : s4265; const SWord8 s4267 = s55 ? s4233 : s4266; const SBool s4268 = (SBool) (s449 & 1); const SBool s4269 = false != s4268; const SBool s4270 = (SBool) (s445 & 1); const SBool s4271 = false != s4270; const SBool s4272 = (SBool) (s441 & 1); const SBool s4273 = false != s4272; const SWord8 s4274 = (s428 >> 1) | (s428 << 7); const SWord8 s4275 = 128 | s4274; const SWord8 s4276 = 127 & s4274; const SWord8 s4277 = s4273 ? s4275 : s4276; const SWord8 s4278 = (s4277 >> 1) | (s4277 << 7); const SWord8 s4279 = 128 | s4278; const SWord8 s4280 = 127 & s4278; const SWord8 s4281 = s4271 ? s4279 : s4280; const SWord8 s4282 = (s4281 >> 1) | (s4281 << 7); const SWord8 s4283 = 128 | s4282; const SWord8 s4284 = 127 & s4282; const SWord8 s4285 = s4269 ? s4283 : s4284; const SBool s4286 = (SBool) (s454 & 1); const SBool s4287 = false != s4286; const SWord8 s4288 = s4287 ? s4283 : s4284; const SWord8 s4289 = s434 ? s4285 : s4288; const SBool s4290 = (SBool) (s470 & 1); const SBool s4291 = false != s4290; const SBool s4292 = (SBool) (s463 & 1); const SBool s4293 = false != s4292; const SWord8 s4294 = s4293 ? s4279 : s4280; const SWord8 s4295 = (s4294 >> 1) | (s4294 << 7); const SWord8 s4296 = 128 | s4295; const SWord8 s4297 = 127 & s4295; const SWord8 s4298 = s4291 ? s4296 : s4297; const SBool s4299 = (SBool) (s475 & 1); const SBool s4300 = false != s4299; const SWord8 s4301 = s4300 ? s4296 : s4297; const SWord8 s4302 = s434 ? s4298 : s4301; const SWord8 s4303 = s307 ? s4289 : s4302; const SBool s4304 = (SBool) (s496 & 1); const SBool s4305 = false != s4304; const SBool s4306 = (SBool) (s492 & 1); const SBool s4307 = false != s4306; const SBool s4308 = (SBool) (s485 & 1); const SBool s4309 = false != s4308; const SWord8 s4310 = s4309 ? s4275 : s4276; const SWord8 s4311 = (s4310 >> 1) | (s4310 << 7); const SWord8 s4312 = 128 | s4311; const SWord8 s4313 = 127 & s4311; const SWord8 s4314 = s4307 ? s4312 : s4313; const SWord8 s4315 = (s4314 >> 1) | (s4314 << 7); const SWord8 s4316 = 128 | s4315; const SWord8 s4317 = 127 & s4315; const SWord8 s4318 = s4305 ? s4316 : s4317; const SBool s4319 = (SBool) (s501 & 1); const SBool s4320 = false != s4319; const SWord8 s4321 = s4320 ? s4316 : s4317; const SWord8 s4322 = s434 ? s4318 : s4321; const SBool s4323 = (SBool) (s517 & 1); const SBool s4324 = false != s4323; const SBool s4325 = (SBool) (s510 & 1); const SBool s4326 = false != s4325; const SWord8 s4327 = s4326 ? s4312 : s4313; const SWord8 s4328 = (s4327 >> 1) | (s4327 << 7); const SWord8 s4329 = 128 | s4328; const SWord8 s4330 = 127 & s4328; const SWord8 s4331 = s4324 ? s4329 : s4330; const SBool s4332 = (SBool) (s522 & 1); const SBool s4333 = false != s4332; const SWord8 s4334 = s4333 ? s4329 : s4330; const SWord8 s4335 = s434 ? s4331 : s4334; const SWord8 s4336 = s307 ? s4322 : s4335; const SWord8 s4337 = s55 ? s4303 : s4336; const SWord8 s4338 = s36 ? s4267 : s4337; const SWord8 s4339 = s21 ? s4197 : s4338; const SBool s4340 = (SBool) (s597 & 1); const SBool s4341 = false != s4340; const SBool s4342 = (SBool) (s593 & 1); const SBool s4343 = false != s4342; const SBool s4344 = (SBool) (s589 & 1); const SBool s4345 = false != s4344; const SWord8 s4346 = (s576 >> 1) | (s576 << 7); const SWord8 s4347 = 128 | s4346; const SWord8 s4348 = 127 & s4346; const SWord8 s4349 = s4345 ? s4347 : s4348; const SWord8 s4350 = (s4349 >> 1) | (s4349 << 7); const SWord8 s4351 = 128 | s4350; const SWord8 s4352 = 127 & s4350; const SWord8 s4353 = s4343 ? s4351 : s4352; const SWord8 s4354 = (s4353 >> 1) | (s4353 << 7); const SWord8 s4355 = 128 | s4354; const SWord8 s4356 = 127 & s4354; const SWord8 s4357 = s4341 ? s4355 : s4356; const SBool s4358 = (SBool) (s602 & 1); const SBool s4359 = false != s4358; const SWord8 s4360 = s4359 ? s4355 : s4356; const SWord8 s4361 = s585 ? s4357 : s4360; const SBool s4362 = (SBool) (s618 & 1); const SBool s4363 = false != s4362; const SBool s4364 = (SBool) (s611 & 1); const SBool s4365 = false != s4364; const SWord8 s4366 = s4365 ? s4351 : s4352; const SWord8 s4367 = (s4366 >> 1) | (s4366 << 7); const SWord8 s4368 = 128 | s4367; const SWord8 s4369 = 127 & s4367; const SWord8 s4370 = s4363 ? s4368 : s4369; const SBool s4371 = (SBool) (s623 & 1); const SBool s4372 = false != s4371; const SWord8 s4373 = s4372 ? s4368 : s4369; const SWord8 s4374 = s585 ? s4370 : s4373; const SWord8 s4375 = s566 ? s4361 : s4374; const SBool s4376 = (SBool) (s644 & 1); const SBool s4377 = false != s4376; const SBool s4378 = (SBool) (s640 & 1); const SBool s4379 = false != s4378; const SBool s4380 = (SBool) (s633 & 1); const SBool s4381 = false != s4380; const SWord8 s4382 = s4381 ? s4347 : s4348; const SWord8 s4383 = (s4382 >> 1) | (s4382 << 7); const SWord8 s4384 = 128 | s4383; const SWord8 s4385 = 127 & s4383; const SWord8 s4386 = s4379 ? s4384 : s4385; const SWord8 s4387 = (s4386 >> 1) | (s4386 << 7); const SWord8 s4388 = 128 | s4387; const SWord8 s4389 = 127 & s4387; const SWord8 s4390 = s4377 ? s4388 : s4389; const SBool s4391 = (SBool) (s649 & 1); const SBool s4392 = false != s4391; const SWord8 s4393 = s4392 ? s4388 : s4389; const SWord8 s4394 = s585 ? s4390 : s4393; const SBool s4395 = (SBool) (s665 & 1); const SBool s4396 = false != s4395; const SBool s4397 = (SBool) (s658 & 1); const SBool s4398 = false != s4397; const SWord8 s4399 = s4398 ? s4384 : s4385; const SWord8 s4400 = (s4399 >> 1) | (s4399 << 7); const SWord8 s4401 = 128 | s4400; const SWord8 s4402 = 127 & s4400; const SWord8 s4403 = s4396 ? s4401 : s4402; const SBool s4404 = (SBool) (s670 & 1); const SBool s4405 = false != s4404; const SWord8 s4406 = s4405 ? s4401 : s4402; const SWord8 s4407 = s585 ? s4403 : s4406; const SWord8 s4408 = s566 ? s4394 : s4407; const SWord8 s4409 = s544 ? s4375 : s4408; const SBool s4410 = (SBool) (s705 & 1); const SBool s4411 = false != s4410; const SBool s4412 = (SBool) (s701 & 1); const SBool s4413 = false != s4412; const SBool s4414 = (SBool) (s697 & 1); const SBool s4415 = false != s4414; const SWord8 s4416 = (s684 >> 1) | (s684 << 7); const SWord8 s4417 = 128 | s4416; const SWord8 s4418 = 127 & s4416; const SWord8 s4419 = s4415 ? s4417 : s4418; const SWord8 s4420 = (s4419 >> 1) | (s4419 << 7); const SWord8 s4421 = 128 | s4420; const SWord8 s4422 = 127 & s4420; const SWord8 s4423 = s4413 ? s4421 : s4422; const SWord8 s4424 = (s4423 >> 1) | (s4423 << 7); const SWord8 s4425 = 128 | s4424; const SWord8 s4426 = 127 & s4424; const SWord8 s4427 = s4411 ? s4425 : s4426; const SBool s4428 = (SBool) (s710 & 1); const SBool s4429 = false != s4428; const SWord8 s4430 = s4429 ? s4425 : s4426; const SWord8 s4431 = s690 ? s4427 : s4430; const SBool s4432 = (SBool) (s726 & 1); const SBool s4433 = false != s4432; const SBool s4434 = (SBool) (s719 & 1); const SBool s4435 = false != s4434; const SWord8 s4436 = s4435 ? s4421 : s4422; const SWord8 s4437 = (s4436 >> 1) | (s4436 << 7); const SWord8 s4438 = 128 | s4437; const SWord8 s4439 = 127 & s4437; const SWord8 s4440 = s4433 ? s4438 : s4439; const SBool s4441 = (SBool) (s731 & 1); const SBool s4442 = false != s4441; const SWord8 s4443 = s4442 ? s4438 : s4439; const SWord8 s4444 = s690 ? s4440 : s4443; const SWord8 s4445 = s566 ? s4431 : s4444; const SBool s4446 = (SBool) (s752 & 1); const SBool s4447 = false != s4446; const SBool s4448 = (SBool) (s748 & 1); const SBool s4449 = false != s4448; const SBool s4450 = (SBool) (s741 & 1); const SBool s4451 = false != s4450; const SWord8 s4452 = s4451 ? s4417 : s4418; const SWord8 s4453 = (s4452 >> 1) | (s4452 << 7); const SWord8 s4454 = 128 | s4453; const SWord8 s4455 = 127 & s4453; const SWord8 s4456 = s4449 ? s4454 : s4455; const SWord8 s4457 = (s4456 >> 1) | (s4456 << 7); const SWord8 s4458 = 128 | s4457; const SWord8 s4459 = 127 & s4457; const SWord8 s4460 = s4447 ? s4458 : s4459; const SBool s4461 = (SBool) (s757 & 1); const SBool s4462 = false != s4461; const SWord8 s4463 = s4462 ? s4458 : s4459; const SWord8 s4464 = s690 ? s4460 : s4463; const SBool s4465 = (SBool) (s773 & 1); const SBool s4466 = false != s4465; const SBool s4467 = (SBool) (s766 & 1); const SBool s4468 = false != s4467; const SWord8 s4469 = s4468 ? s4454 : s4455; const SWord8 s4470 = (s4469 >> 1) | (s4469 << 7); const SWord8 s4471 = 128 | s4470; const SWord8 s4472 = 127 & s4470; const SWord8 s4473 = s4466 ? s4471 : s4472; const SBool s4474 = (SBool) (s778 & 1); const SBool s4475 = false != s4474; const SWord8 s4476 = s4475 ? s4471 : s4472; const SWord8 s4477 = s690 ? s4473 : s4476; const SWord8 s4478 = s566 ? s4464 : s4477; const SWord8 s4479 = s544 ? s4445 : s4478; const SWord8 s4480 = s36 ? s4409 : s4479; const SBool s4481 = (SBool) (s833 & 1); const SBool s4482 = false != s4481; const SBool s4483 = (SBool) (s829 & 1); const SBool s4484 = false != s4483; const SBool s4485 = (SBool) (s825 & 1); const SBool s4486 = false != s4485; const SWord8 s4487 = (s812 >> 1) | (s812 << 7); const SWord8 s4488 = 128 | s4487; const SWord8 s4489 = 127 & s4487; const SWord8 s4490 = s4486 ? s4488 : s4489; const SWord8 s4491 = (s4490 >> 1) | (s4490 << 7); const SWord8 s4492 = 128 | s4491; const SWord8 s4493 = 127 & s4491; const SWord8 s4494 = s4484 ? s4492 : s4493; const SWord8 s4495 = (s4494 >> 1) | (s4494 << 7); const SWord8 s4496 = 128 | s4495; const SWord8 s4497 = 127 & s4495; const SWord8 s4498 = s4482 ? s4496 : s4497; const SBool s4499 = (SBool) (s838 & 1); const SBool s4500 = false != s4499; const SWord8 s4501 = s4500 ? s4496 : s4497; const SWord8 s4502 = s821 ? s4498 : s4501; const SBool s4503 = (SBool) (s854 & 1); const SBool s4504 = false != s4503; const SBool s4505 = (SBool) (s847 & 1); const SBool s4506 = false != s4505; const SWord8 s4507 = s4506 ? s4492 : s4493; const SWord8 s4508 = (s4507 >> 1) | (s4507 << 7); const SWord8 s4509 = 128 | s4508; const SWord8 s4510 = 127 & s4508; const SWord8 s4511 = s4504 ? s4509 : s4510; const SBool s4512 = (SBool) (s859 & 1); const SBool s4513 = false != s4512; const SWord8 s4514 = s4513 ? s4509 : s4510; const SWord8 s4515 = s821 ? s4511 : s4514; const SWord8 s4516 = s799 ? s4502 : s4515; const SBool s4517 = (SBool) (s880 & 1); const SBool s4518 = false != s4517; const SBool s4519 = (SBool) (s876 & 1); const SBool s4520 = false != s4519; const SBool s4521 = (SBool) (s869 & 1); const SBool s4522 = false != s4521; const SWord8 s4523 = s4522 ? s4488 : s4489; const SWord8 s4524 = (s4523 >> 1) | (s4523 << 7); const SWord8 s4525 = 128 | s4524; const SWord8 s4526 = 127 & s4524; const SWord8 s4527 = s4520 ? s4525 : s4526; const SWord8 s4528 = (s4527 >> 1) | (s4527 << 7); const SWord8 s4529 = 128 | s4528; const SWord8 s4530 = 127 & s4528; const SWord8 s4531 = s4518 ? s4529 : s4530; const SBool s4532 = (SBool) (s885 & 1); const SBool s4533 = false != s4532; const SWord8 s4534 = s4533 ? s4529 : s4530; const SWord8 s4535 = s821 ? s4531 : s4534; const SBool s4536 = (SBool) (s901 & 1); const SBool s4537 = false != s4536; const SBool s4538 = (SBool) (s894 & 1); const SBool s4539 = false != s4538; const SWord8 s4540 = s4539 ? s4525 : s4526; const SWord8 s4541 = (s4540 >> 1) | (s4540 << 7); const SWord8 s4542 = 128 | s4541; const SWord8 s4543 = 127 & s4541; const SWord8 s4544 = s4537 ? s4542 : s4543; const SBool s4545 = (SBool) (s906 & 1); const SBool s4546 = false != s4545; const SWord8 s4547 = s4546 ? s4542 : s4543; const SWord8 s4548 = s821 ? s4544 : s4547; const SWord8 s4549 = s799 ? s4535 : s4548; const SWord8 s4550 = s544 ? s4516 : s4549; const SBool s4551 = (SBool) (s941 & 1); const SBool s4552 = false != s4551; const SBool s4553 = (SBool) (s937 & 1); const SBool s4554 = false != s4553; const SBool s4555 = (SBool) (s933 & 1); const SBool s4556 = false != s4555; const SWord8 s4557 = (s920 >> 1) | (s920 << 7); const SWord8 s4558 = 128 | s4557; const SWord8 s4559 = 127 & s4557; const SWord8 s4560 = s4556 ? s4558 : s4559; const SWord8 s4561 = (s4560 >> 1) | (s4560 << 7); const SWord8 s4562 = 128 | s4561; const SWord8 s4563 = 127 & s4561; const SWord8 s4564 = s4554 ? s4562 : s4563; const SWord8 s4565 = (s4564 >> 1) | (s4564 << 7); const SWord8 s4566 = 128 | s4565; const SWord8 s4567 = 127 & s4565; const SWord8 s4568 = s4552 ? s4566 : s4567; const SBool s4569 = (SBool) (s946 & 1); const SBool s4570 = false != s4569; const SWord8 s4571 = s4570 ? s4566 : s4567; const SWord8 s4572 = s926 ? s4568 : s4571; const SBool s4573 = (SBool) (s962 & 1); const SBool s4574 = false != s4573; const SBool s4575 = (SBool) (s955 & 1); const SBool s4576 = false != s4575; const SWord8 s4577 = s4576 ? s4562 : s4563; const SWord8 s4578 = (s4577 >> 1) | (s4577 << 7); const SWord8 s4579 = 128 | s4578; const SWord8 s4580 = 127 & s4578; const SWord8 s4581 = s4574 ? s4579 : s4580; const SBool s4582 = (SBool) (s967 & 1); const SBool s4583 = false != s4582; const SWord8 s4584 = s4583 ? s4579 : s4580; const SWord8 s4585 = s926 ? s4581 : s4584; const SWord8 s4586 = s799 ? s4572 : s4585; const SBool s4587 = (SBool) (s988 & 1); const SBool s4588 = false != s4587; const SBool s4589 = (SBool) (s984 & 1); const SBool s4590 = false != s4589; const SBool s4591 = (SBool) (s977 & 1); const SBool s4592 = false != s4591; const SWord8 s4593 = s4592 ? s4558 : s4559; const SWord8 s4594 = (s4593 >> 1) | (s4593 << 7); const SWord8 s4595 = 128 | s4594; const SWord8 s4596 = 127 & s4594; const SWord8 s4597 = s4590 ? s4595 : s4596; const SWord8 s4598 = (s4597 >> 1) | (s4597 << 7); const SWord8 s4599 = 128 | s4598; const SWord8 s4600 = 127 & s4598; const SWord8 s4601 = s4588 ? s4599 : s4600; const SBool s4602 = (SBool) (s993 & 1); const SBool s4603 = false != s4602; const SWord8 s4604 = s4603 ? s4599 : s4600; const SWord8 s4605 = s926 ? s4601 : s4604; const SBool s4606 = (SBool) (s1009 & 1); const SBool s4607 = false != s4606; const SBool s4608 = (SBool) (s1002 & 1); const SBool s4609 = false != s4608; const SWord8 s4610 = s4609 ? s4595 : s4596; const SWord8 s4611 = (s4610 >> 1) | (s4610 << 7); const SWord8 s4612 = 128 | s4611; const SWord8 s4613 = 127 & s4611; const SWord8 s4614 = s4607 ? s4612 : s4613; const SBool s4615 = (SBool) (s1014 & 1); const SBool s4616 = false != s4615; const SWord8 s4617 = s4616 ? s4612 : s4613; const SWord8 s4618 = s926 ? s4614 : s4617; const SWord8 s4619 = s799 ? s4605 : s4618; const SWord8 s4620 = s544 ? s4586 : s4619; const SWord8 s4621 = s36 ? s4550 : s4620; const SWord8 s4622 = s21 ? s4480 : s4621; const SWord8 s4623 = s16 ? s4339 : s4622; const SBool s4624 = (SBool) (s1109 & 1); const SBool s4625 = false != s4624; const SBool s4626 = (SBool) (s1105 & 1); const SBool s4627 = false != s4626; const SBool s4628 = (SBool) (s1101 & 1); const SBool s4629 = false != s4628; const SWord8 s4630 = (s1088 >> 1) | (s1088 << 7); const SWord8 s4631 = 128 | s4630; const SWord8 s4632 = 127 & s4630; const SWord8 s4633 = s4629 ? s4631 : s4632; const SWord8 s4634 = (s4633 >> 1) | (s4633 << 7); const SWord8 s4635 = 128 | s4634; const SWord8 s4636 = 127 & s4634; const SWord8 s4637 = s4627 ? s4635 : s4636; const SWord8 s4638 = (s4637 >> 1) | (s4637 << 7); const SWord8 s4639 = 128 | s4638; const SWord8 s4640 = 127 & s4638; const SWord8 s4641 = s4625 ? s4639 : s4640; const SBool s4642 = (SBool) (s1114 & 1); const SBool s4643 = false != s4642; const SWord8 s4644 = s4643 ? s4639 : s4640; const SWord8 s4645 = s1097 ? s4641 : s4644; const SBool s4646 = (SBool) (s1130 & 1); const SBool s4647 = false != s4646; const SBool s4648 = (SBool) (s1123 & 1); const SBool s4649 = false != s4648; const SWord8 s4650 = s4649 ? s4635 : s4636; const SWord8 s4651 = (s4650 >> 1) | (s4650 << 7); const SWord8 s4652 = 128 | s4651; const SWord8 s4653 = 127 & s4651; const SWord8 s4654 = s4647 ? s4652 : s4653; const SBool s4655 = (SBool) (s1135 & 1); const SBool s4656 = false != s4655; const SWord8 s4657 = s4656 ? s4652 : s4653; const SWord8 s4658 = s1097 ? s4654 : s4657; const SWord8 s4659 = s1078 ? s4645 : s4658; const SBool s4660 = (SBool) (s1156 & 1); const SBool s4661 = false != s4660; const SBool s4662 = (SBool) (s1152 & 1); const SBool s4663 = false != s4662; const SBool s4664 = (SBool) (s1145 & 1); const SBool s4665 = false != s4664; const SWord8 s4666 = s4665 ? s4631 : s4632; const SWord8 s4667 = (s4666 >> 1) | (s4666 << 7); const SWord8 s4668 = 128 | s4667; const SWord8 s4669 = 127 & s4667; const SWord8 s4670 = s4663 ? s4668 : s4669; const SWord8 s4671 = (s4670 >> 1) | (s4670 << 7); const SWord8 s4672 = 128 | s4671; const SWord8 s4673 = 127 & s4671; const SWord8 s4674 = s4661 ? s4672 : s4673; const SBool s4675 = (SBool) (s1161 & 1); const SBool s4676 = false != s4675; const SWord8 s4677 = s4676 ? s4672 : s4673; const SWord8 s4678 = s1097 ? s4674 : s4677; const SBool s4679 = (SBool) (s1177 & 1); const SBool s4680 = false != s4679; const SBool s4681 = (SBool) (s1170 & 1); const SBool s4682 = false != s4681; const SWord8 s4683 = s4682 ? s4668 : s4669; const SWord8 s4684 = (s4683 >> 1) | (s4683 << 7); const SWord8 s4685 = 128 | s4684; const SWord8 s4686 = 127 & s4684; const SWord8 s4687 = s4680 ? s4685 : s4686; const SBool s4688 = (SBool) (s1182 & 1); const SBool s4689 = false != s4688; const SWord8 s4690 = s4689 ? s4685 : s4686; const SWord8 s4691 = s1097 ? s4687 : s4690; const SWord8 s4692 = s1078 ? s4678 : s4691; const SWord8 s4693 = s1059 ? s4659 : s4692; const SBool s4694 = (SBool) (s1217 & 1); const SBool s4695 = false != s4694; const SBool s4696 = (SBool) (s1213 & 1); const SBool s4697 = false != s4696; const SBool s4698 = (SBool) (s1209 & 1); const SBool s4699 = false != s4698; const SWord8 s4700 = (s1196 >> 1) | (s1196 << 7); const SWord8 s4701 = 128 | s4700; const SWord8 s4702 = 127 & s4700; const SWord8 s4703 = s4699 ? s4701 : s4702; const SWord8 s4704 = (s4703 >> 1) | (s4703 << 7); const SWord8 s4705 = 128 | s4704; const SWord8 s4706 = 127 & s4704; const SWord8 s4707 = s4697 ? s4705 : s4706; const SWord8 s4708 = (s4707 >> 1) | (s4707 << 7); const SWord8 s4709 = 128 | s4708; const SWord8 s4710 = 127 & s4708; const SWord8 s4711 = s4695 ? s4709 : s4710; const SBool s4712 = (SBool) (s1222 & 1); const SBool s4713 = false != s4712; const SWord8 s4714 = s4713 ? s4709 : s4710; const SWord8 s4715 = s1202 ? s4711 : s4714; const SBool s4716 = (SBool) (s1238 & 1); const SBool s4717 = false != s4716; const SBool s4718 = (SBool) (s1231 & 1); const SBool s4719 = false != s4718; const SWord8 s4720 = s4719 ? s4705 : s4706; const SWord8 s4721 = (s4720 >> 1) | (s4720 << 7); const SWord8 s4722 = 128 | s4721; const SWord8 s4723 = 127 & s4721; const SWord8 s4724 = s4717 ? s4722 : s4723; const SBool s4725 = (SBool) (s1243 & 1); const SBool s4726 = false != s4725; const SWord8 s4727 = s4726 ? s4722 : s4723; const SWord8 s4728 = s1202 ? s4724 : s4727; const SWord8 s4729 = s1078 ? s4715 : s4728; const SBool s4730 = (SBool) (s1264 & 1); const SBool s4731 = false != s4730; const SBool s4732 = (SBool) (s1260 & 1); const SBool s4733 = false != s4732; const SBool s4734 = (SBool) (s1253 & 1); const SBool s4735 = false != s4734; const SWord8 s4736 = s4735 ? s4701 : s4702; const SWord8 s4737 = (s4736 >> 1) | (s4736 << 7); const SWord8 s4738 = 128 | s4737; const SWord8 s4739 = 127 & s4737; const SWord8 s4740 = s4733 ? s4738 : s4739; const SWord8 s4741 = (s4740 >> 1) | (s4740 << 7); const SWord8 s4742 = 128 | s4741; const SWord8 s4743 = 127 & s4741; const SWord8 s4744 = s4731 ? s4742 : s4743; const SBool s4745 = (SBool) (s1269 & 1); const SBool s4746 = false != s4745; const SWord8 s4747 = s4746 ? s4742 : s4743; const SWord8 s4748 = s1202 ? s4744 : s4747; const SBool s4749 = (SBool) (s1285 & 1); const SBool s4750 = false != s4749; const SBool s4751 = (SBool) (s1278 & 1); const SBool s4752 = false != s4751; const SWord8 s4753 = s4752 ? s4738 : s4739; const SWord8 s4754 = (s4753 >> 1) | (s4753 << 7); const SWord8 s4755 = 128 | s4754; const SWord8 s4756 = 127 & s4754; const SWord8 s4757 = s4750 ? s4755 : s4756; const SBool s4758 = (SBool) (s1290 & 1); const SBool s4759 = false != s4758; const SWord8 s4760 = s4759 ? s4755 : s4756; const SWord8 s4761 = s1202 ? s4757 : s4760; const SWord8 s4762 = s1078 ? s4748 : s4761; const SWord8 s4763 = s1059 ? s4729 : s4762; const SWord8 s4764 = s1037 ? s4693 : s4763; const SBool s4765 = (SBool) (s1345 & 1); const SBool s4766 = false != s4765; const SBool s4767 = (SBool) (s1341 & 1); const SBool s4768 = false != s4767; const SBool s4769 = (SBool) (s1337 & 1); const SBool s4770 = false != s4769; const SWord8 s4771 = (s1324 >> 1) | (s1324 << 7); const SWord8 s4772 = 128 | s4771; const SWord8 s4773 = 127 & s4771; const SWord8 s4774 = s4770 ? s4772 : s4773; const SWord8 s4775 = (s4774 >> 1) | (s4774 << 7); const SWord8 s4776 = 128 | s4775; const SWord8 s4777 = 127 & s4775; const SWord8 s4778 = s4768 ? s4776 : s4777; const SWord8 s4779 = (s4778 >> 1) | (s4778 << 7); const SWord8 s4780 = 128 | s4779; const SWord8 s4781 = 127 & s4779; const SWord8 s4782 = s4766 ? s4780 : s4781; const SBool s4783 = (SBool) (s1350 & 1); const SBool s4784 = false != s4783; const SWord8 s4785 = s4784 ? s4780 : s4781; const SWord8 s4786 = s1333 ? s4782 : s4785; const SBool s4787 = (SBool) (s1366 & 1); const SBool s4788 = false != s4787; const SBool s4789 = (SBool) (s1359 & 1); const SBool s4790 = false != s4789; const SWord8 s4791 = s4790 ? s4776 : s4777; const SWord8 s4792 = (s4791 >> 1) | (s4791 << 7); const SWord8 s4793 = 128 | s4792; const SWord8 s4794 = 127 & s4792; const SWord8 s4795 = s4788 ? s4793 : s4794; const SBool s4796 = (SBool) (s1371 & 1); const SBool s4797 = false != s4796; const SWord8 s4798 = s4797 ? s4793 : s4794; const SWord8 s4799 = s1333 ? s4795 : s4798; const SWord8 s4800 = s1311 ? s4786 : s4799; const SBool s4801 = (SBool) (s1392 & 1); const SBool s4802 = false != s4801; const SBool s4803 = (SBool) (s1388 & 1); const SBool s4804 = false != s4803; const SBool s4805 = (SBool) (s1381 & 1); const SBool s4806 = false != s4805; const SWord8 s4807 = s4806 ? s4772 : s4773; const SWord8 s4808 = (s4807 >> 1) | (s4807 << 7); const SWord8 s4809 = 128 | s4808; const SWord8 s4810 = 127 & s4808; const SWord8 s4811 = s4804 ? s4809 : s4810; const SWord8 s4812 = (s4811 >> 1) | (s4811 << 7); const SWord8 s4813 = 128 | s4812; const SWord8 s4814 = 127 & s4812; const SWord8 s4815 = s4802 ? s4813 : s4814; const SBool s4816 = (SBool) (s1397 & 1); const SBool s4817 = false != s4816; const SWord8 s4818 = s4817 ? s4813 : s4814; const SWord8 s4819 = s1333 ? s4815 : s4818; const SBool s4820 = (SBool) (s1413 & 1); const SBool s4821 = false != s4820; const SBool s4822 = (SBool) (s1406 & 1); const SBool s4823 = false != s4822; const SWord8 s4824 = s4823 ? s4809 : s4810; const SWord8 s4825 = (s4824 >> 1) | (s4824 << 7); const SWord8 s4826 = 128 | s4825; const SWord8 s4827 = 127 & s4825; const SWord8 s4828 = s4821 ? s4826 : s4827; const SBool s4829 = (SBool) (s1418 & 1); const SBool s4830 = false != s4829; const SWord8 s4831 = s4830 ? s4826 : s4827; const SWord8 s4832 = s1333 ? s4828 : s4831; const SWord8 s4833 = s1311 ? s4819 : s4832; const SWord8 s4834 = s1059 ? s4800 : s4833; const SBool s4835 = (SBool) (s1453 & 1); const SBool s4836 = false != s4835; const SBool s4837 = (SBool) (s1449 & 1); const SBool s4838 = false != s4837; const SBool s4839 = (SBool) (s1445 & 1); const SBool s4840 = false != s4839; const SWord8 s4841 = (s1432 >> 1) | (s1432 << 7); const SWord8 s4842 = 128 | s4841; const SWord8 s4843 = 127 & s4841; const SWord8 s4844 = s4840 ? s4842 : s4843; const SWord8 s4845 = (s4844 >> 1) | (s4844 << 7); const SWord8 s4846 = 128 | s4845; const SWord8 s4847 = 127 & s4845; const SWord8 s4848 = s4838 ? s4846 : s4847; const SWord8 s4849 = (s4848 >> 1) | (s4848 << 7); const SWord8 s4850 = 128 | s4849; const SWord8 s4851 = 127 & s4849; const SWord8 s4852 = s4836 ? s4850 : s4851; const SBool s4853 = (SBool) (s1458 & 1); const SBool s4854 = false != s4853; const SWord8 s4855 = s4854 ? s4850 : s4851; const SWord8 s4856 = s1438 ? s4852 : s4855; const SBool s4857 = (SBool) (s1474 & 1); const SBool s4858 = false != s4857; const SBool s4859 = (SBool) (s1467 & 1); const SBool s4860 = false != s4859; const SWord8 s4861 = s4860 ? s4846 : s4847; const SWord8 s4862 = (s4861 >> 1) | (s4861 << 7); const SWord8 s4863 = 128 | s4862; const SWord8 s4864 = 127 & s4862; const SWord8 s4865 = s4858 ? s4863 : s4864; const SBool s4866 = (SBool) (s1479 & 1); const SBool s4867 = false != s4866; const SWord8 s4868 = s4867 ? s4863 : s4864; const SWord8 s4869 = s1438 ? s4865 : s4868; const SWord8 s4870 = s1311 ? s4856 : s4869; const SBool s4871 = (SBool) (s1500 & 1); const SBool s4872 = false != s4871; const SBool s4873 = (SBool) (s1496 & 1); const SBool s4874 = false != s4873; const SBool s4875 = (SBool) (s1489 & 1); const SBool s4876 = false != s4875; const SWord8 s4877 = s4876 ? s4842 : s4843; const SWord8 s4878 = (s4877 >> 1) | (s4877 << 7); const SWord8 s4879 = 128 | s4878; const SWord8 s4880 = 127 & s4878; const SWord8 s4881 = s4874 ? s4879 : s4880; const SWord8 s4882 = (s4881 >> 1) | (s4881 << 7); const SWord8 s4883 = 128 | s4882; const SWord8 s4884 = 127 & s4882; const SWord8 s4885 = s4872 ? s4883 : s4884; const SBool s4886 = (SBool) (s1505 & 1); const SBool s4887 = false != s4886; const SWord8 s4888 = s4887 ? s4883 : s4884; const SWord8 s4889 = s1438 ? s4885 : s4888; const SBool s4890 = (SBool) (s1521 & 1); const SBool s4891 = false != s4890; const SBool s4892 = (SBool) (s1514 & 1); const SBool s4893 = false != s4892; const SWord8 s4894 = s4893 ? s4879 : s4880; const SWord8 s4895 = (s4894 >> 1) | (s4894 << 7); const SWord8 s4896 = 128 | s4895; const SWord8 s4897 = 127 & s4895; const SWord8 s4898 = s4891 ? s4896 : s4897; const SBool s4899 = (SBool) (s1526 & 1); const SBool s4900 = false != s4899; const SWord8 s4901 = s4900 ? s4896 : s4897; const SWord8 s4902 = s1438 ? s4898 : s4901; const SWord8 s4903 = s1311 ? s4889 : s4902; const SWord8 s4904 = s1059 ? s4870 : s4903; const SWord8 s4905 = s1037 ? s4834 : s4904; const SWord8 s4906 = s21 ? s4764 : s4905; const SBool s4907 = (SBool) (s1601 & 1); const SBool s4908 = false != s4907; const SBool s4909 = (SBool) (s1597 & 1); const SBool s4910 = false != s4909; const SBool s4911 = (SBool) (s1593 & 1); const SBool s4912 = false != s4911; const SWord8 s4913 = (s1580 >> 1) | (s1580 << 7); const SWord8 s4914 = 128 | s4913; const SWord8 s4915 = 127 & s4913; const SWord8 s4916 = s4912 ? s4914 : s4915; const SWord8 s4917 = (s4916 >> 1) | (s4916 << 7); const SWord8 s4918 = 128 | s4917; const SWord8 s4919 = 127 & s4917; const SWord8 s4920 = s4910 ? s4918 : s4919; const SWord8 s4921 = (s4920 >> 1) | (s4920 << 7); const SWord8 s4922 = 128 | s4921; const SWord8 s4923 = 127 & s4921; const SWord8 s4924 = s4908 ? s4922 : s4923; const SBool s4925 = (SBool) (s1606 & 1); const SBool s4926 = false != s4925; const SWord8 s4927 = s4926 ? s4922 : s4923; const SWord8 s4928 = s1589 ? s4924 : s4927; const SBool s4929 = (SBool) (s1622 & 1); const SBool s4930 = false != s4929; const SBool s4931 = (SBool) (s1615 & 1); const SBool s4932 = false != s4931; const SWord8 s4933 = s4932 ? s4918 : s4919; const SWord8 s4934 = (s4933 >> 1) | (s4933 << 7); const SWord8 s4935 = 128 | s4934; const SWord8 s4936 = 127 & s4934; const SWord8 s4937 = s4930 ? s4935 : s4936; const SBool s4938 = (SBool) (s1627 & 1); const SBool s4939 = false != s4938; const SWord8 s4940 = s4939 ? s4935 : s4936; const SWord8 s4941 = s1589 ? s4937 : s4940; const SWord8 s4942 = s1570 ? s4928 : s4941; const SBool s4943 = (SBool) (s1648 & 1); const SBool s4944 = false != s4943; const SBool s4945 = (SBool) (s1644 & 1); const SBool s4946 = false != s4945; const SBool s4947 = (SBool) (s1637 & 1); const SBool s4948 = false != s4947; const SWord8 s4949 = s4948 ? s4914 : s4915; const SWord8 s4950 = (s4949 >> 1) | (s4949 << 7); const SWord8 s4951 = 128 | s4950; const SWord8 s4952 = 127 & s4950; const SWord8 s4953 = s4946 ? s4951 : s4952; const SWord8 s4954 = (s4953 >> 1) | (s4953 << 7); const SWord8 s4955 = 128 | s4954; const SWord8 s4956 = 127 & s4954; const SWord8 s4957 = s4944 ? s4955 : s4956; const SBool s4958 = (SBool) (s1653 & 1); const SBool s4959 = false != s4958; const SWord8 s4960 = s4959 ? s4955 : s4956; const SWord8 s4961 = s1589 ? s4957 : s4960; const SBool s4962 = (SBool) (s1669 & 1); const SBool s4963 = false != s4962; const SBool s4964 = (SBool) (s1662 & 1); const SBool s4965 = false != s4964; const SWord8 s4966 = s4965 ? s4951 : s4952; const SWord8 s4967 = (s4966 >> 1) | (s4966 << 7); const SWord8 s4968 = 128 | s4967; const SWord8 s4969 = 127 & s4967; const SWord8 s4970 = s4963 ? s4968 : s4969; const SBool s4971 = (SBool) (s1674 & 1); const SBool s4972 = false != s4971; const SWord8 s4973 = s4972 ? s4968 : s4969; const SWord8 s4974 = s1589 ? s4970 : s4973; const SWord8 s4975 = s1570 ? s4961 : s4974; const SWord8 s4976 = s1548 ? s4942 : s4975; const SBool s4977 = (SBool) (s1709 & 1); const SBool s4978 = false != s4977; const SBool s4979 = (SBool) (s1705 & 1); const SBool s4980 = false != s4979; const SBool s4981 = (SBool) (s1701 & 1); const SBool s4982 = false != s4981; const SWord8 s4983 = (s1688 >> 1) | (s1688 << 7); const SWord8 s4984 = 128 | s4983; const SWord8 s4985 = 127 & s4983; const SWord8 s4986 = s4982 ? s4984 : s4985; const SWord8 s4987 = (s4986 >> 1) | (s4986 << 7); const SWord8 s4988 = 128 | s4987; const SWord8 s4989 = 127 & s4987; const SWord8 s4990 = s4980 ? s4988 : s4989; const SWord8 s4991 = (s4990 >> 1) | (s4990 << 7); const SWord8 s4992 = 128 | s4991; const SWord8 s4993 = 127 & s4991; const SWord8 s4994 = s4978 ? s4992 : s4993; const SBool s4995 = (SBool) (s1714 & 1); const SBool s4996 = false != s4995; const SWord8 s4997 = s4996 ? s4992 : s4993; const SWord8 s4998 = s1694 ? s4994 : s4997; const SBool s4999 = (SBool) (s1730 & 1); const SBool s5000 = false != s4999; const SBool s5001 = (SBool) (s1723 & 1); const SBool s5002 = false != s5001; const SWord8 s5003 = s5002 ? s4988 : s4989; const SWord8 s5004 = (s5003 >> 1) | (s5003 << 7); const SWord8 s5005 = 128 | s5004; const SWord8 s5006 = 127 & s5004; const SWord8 s5007 = s5000 ? s5005 : s5006; const SBool s5008 = (SBool) (s1735 & 1); const SBool s5009 = false != s5008; const SWord8 s5010 = s5009 ? s5005 : s5006; const SWord8 s5011 = s1694 ? s5007 : s5010; const SWord8 s5012 = s1570 ? s4998 : s5011; const SBool s5013 = (SBool) (s1756 & 1); const SBool s5014 = false != s5013; const SBool s5015 = (SBool) (s1752 & 1); const SBool s5016 = false != s5015; const SBool s5017 = (SBool) (s1745 & 1); const SBool s5018 = false != s5017; const SWord8 s5019 = s5018 ? s4984 : s4985; const SWord8 s5020 = (s5019 >> 1) | (s5019 << 7); const SWord8 s5021 = 128 | s5020; const SWord8 s5022 = 127 & s5020; const SWord8 s5023 = s5016 ? s5021 : s5022; const SWord8 s5024 = (s5023 >> 1) | (s5023 << 7); const SWord8 s5025 = 128 | s5024; const SWord8 s5026 = 127 & s5024; const SWord8 s5027 = s5014 ? s5025 : s5026; const SBool s5028 = (SBool) (s1761 & 1); const SBool s5029 = false != s5028; const SWord8 s5030 = s5029 ? s5025 : s5026; const SWord8 s5031 = s1694 ? s5027 : s5030; const SBool s5032 = (SBool) (s1777 & 1); const SBool s5033 = false != s5032; const SBool s5034 = (SBool) (s1770 & 1); const SBool s5035 = false != s5034; const SWord8 s5036 = s5035 ? s5021 : s5022; const SWord8 s5037 = (s5036 >> 1) | (s5036 << 7); const SWord8 s5038 = 128 | s5037; const SWord8 s5039 = 127 & s5037; const SWord8 s5040 = s5033 ? s5038 : s5039; const SBool s5041 = (SBool) (s1782 & 1); const SBool s5042 = false != s5041; const SWord8 s5043 = s5042 ? s5038 : s5039; const SWord8 s5044 = s1694 ? s5040 : s5043; const SWord8 s5045 = s1570 ? s5031 : s5044; const SWord8 s5046 = s1548 ? s5012 : s5045; const SWord8 s5047 = s1037 ? s4976 : s5046; const SBool s5048 = (SBool) (s1837 & 1); const SBool s5049 = false != s5048; const SBool s5050 = (SBool) (s1833 & 1); const SBool s5051 = false != s5050; const SBool s5052 = (SBool) (s1829 & 1); const SBool s5053 = false != s5052; const SWord8 s5054 = (s1816 >> 1) | (s1816 << 7); const SWord8 s5055 = 128 | s5054; const SWord8 s5056 = 127 & s5054; const SWord8 s5057 = s5053 ? s5055 : s5056; const SWord8 s5058 = (s5057 >> 1) | (s5057 << 7); const SWord8 s5059 = 128 | s5058; const SWord8 s5060 = 127 & s5058; const SWord8 s5061 = s5051 ? s5059 : s5060; const SWord8 s5062 = (s5061 >> 1) | (s5061 << 7); const SWord8 s5063 = 128 | s5062; const SWord8 s5064 = 127 & s5062; const SWord8 s5065 = s5049 ? s5063 : s5064; const SBool s5066 = (SBool) (s1842 & 1); const SBool s5067 = false != s5066; const SWord8 s5068 = s5067 ? s5063 : s5064; const SWord8 s5069 = s1825 ? s5065 : s5068; const SBool s5070 = (SBool) (s1858 & 1); const SBool s5071 = false != s5070; const SBool s5072 = (SBool) (s1851 & 1); const SBool s5073 = false != s5072; const SWord8 s5074 = s5073 ? s5059 : s5060; const SWord8 s5075 = (s5074 >> 1) | (s5074 << 7); const SWord8 s5076 = 128 | s5075; const SWord8 s5077 = 127 & s5075; const SWord8 s5078 = s5071 ? s5076 : s5077; const SBool s5079 = (SBool) (s1863 & 1); const SBool s5080 = false != s5079; const SWord8 s5081 = s5080 ? s5076 : s5077; const SWord8 s5082 = s1825 ? s5078 : s5081; const SWord8 s5083 = s1803 ? s5069 : s5082; const SBool s5084 = (SBool) (s1884 & 1); const SBool s5085 = false != s5084; const SBool s5086 = (SBool) (s1880 & 1); const SBool s5087 = false != s5086; const SBool s5088 = (SBool) (s1873 & 1); const SBool s5089 = false != s5088; const SWord8 s5090 = s5089 ? s5055 : s5056; const SWord8 s5091 = (s5090 >> 1) | (s5090 << 7); const SWord8 s5092 = 128 | s5091; const SWord8 s5093 = 127 & s5091; const SWord8 s5094 = s5087 ? s5092 : s5093; const SWord8 s5095 = (s5094 >> 1) | (s5094 << 7); const SWord8 s5096 = 128 | s5095; const SWord8 s5097 = 127 & s5095; const SWord8 s5098 = s5085 ? s5096 : s5097; const SBool s5099 = (SBool) (s1889 & 1); const SBool s5100 = false != s5099; const SWord8 s5101 = s5100 ? s5096 : s5097; const SWord8 s5102 = s1825 ? s5098 : s5101; const SBool s5103 = (SBool) (s1905 & 1); const SBool s5104 = false != s5103; const SBool s5105 = (SBool) (s1898 & 1); const SBool s5106 = false != s5105; const SWord8 s5107 = s5106 ? s5092 : s5093; const SWord8 s5108 = (s5107 >> 1) | (s5107 << 7); const SWord8 s5109 = 128 | s5108; const SWord8 s5110 = 127 & s5108; const SWord8 s5111 = s5104 ? s5109 : s5110; const SBool s5112 = (SBool) (s1910 & 1); const SBool s5113 = false != s5112; const SWord8 s5114 = s5113 ? s5109 : s5110; const SWord8 s5115 = s1825 ? s5111 : s5114; const SWord8 s5116 = s1803 ? s5102 : s5115; const SWord8 s5117 = s1548 ? s5083 : s5116; const SBool s5118 = (SBool) (s1945 & 1); const SBool s5119 = false != s5118; const SBool s5120 = (SBool) (s1941 & 1); const SBool s5121 = false != s5120; const SBool s5122 = (SBool) (s1937 & 1); const SBool s5123 = false != s5122; const SWord8 s5124 = (s1924 >> 1) | (s1924 << 7); const SWord8 s5125 = 128 | s5124; const SWord8 s5126 = 127 & s5124; const SWord8 s5127 = s5123 ? s5125 : s5126; const SWord8 s5128 = (s5127 >> 1) | (s5127 << 7); const SWord8 s5129 = 128 | s5128; const SWord8 s5130 = 127 & s5128; const SWord8 s5131 = s5121 ? s5129 : s5130; const SWord8 s5132 = (s5131 >> 1) | (s5131 << 7); const SWord8 s5133 = 128 | s5132; const SWord8 s5134 = 127 & s5132; const SWord8 s5135 = s5119 ? s5133 : s5134; const SBool s5136 = (SBool) (s1950 & 1); const SBool s5137 = false != s5136; const SWord8 s5138 = s5137 ? s5133 : s5134; const SWord8 s5139 = s1930 ? s5135 : s5138; const SBool s5140 = (SBool) (s1966 & 1); const SBool s5141 = false != s5140; const SBool s5142 = (SBool) (s1959 & 1); const SBool s5143 = false != s5142; const SWord8 s5144 = s5143 ? s5129 : s5130; const SWord8 s5145 = (s5144 >> 1) | (s5144 << 7); const SWord8 s5146 = 128 | s5145; const SWord8 s5147 = 127 & s5145; const SWord8 s5148 = s5141 ? s5146 : s5147; const SBool s5149 = (SBool) (s1971 & 1); const SBool s5150 = false != s5149; const SWord8 s5151 = s5150 ? s5146 : s5147; const SWord8 s5152 = s1930 ? s5148 : s5151; const SWord8 s5153 = s1803 ? s5139 : s5152; const SBool s5154 = (SBool) (s1992 & 1); const SBool s5155 = false != s5154; const SBool s5156 = (SBool) (s1988 & 1); const SBool s5157 = false != s5156; const SBool s5158 = (SBool) (s1981 & 1); const SBool s5159 = false != s5158; const SWord8 s5160 = s5159 ? s5125 : s5126; const SWord8 s5161 = (s5160 >> 1) | (s5160 << 7); const SWord8 s5162 = 128 | s5161; const SWord8 s5163 = 127 & s5161; const SWord8 s5164 = s5157 ? s5162 : s5163; const SWord8 s5165 = (s5164 >> 1) | (s5164 << 7); const SWord8 s5166 = 128 | s5165; const SWord8 s5167 = 127 & s5165; const SWord8 s5168 = s5155 ? s5166 : s5167; const SBool s5169 = (SBool) (s1997 & 1); const SBool s5170 = false != s5169; const SWord8 s5171 = s5170 ? s5166 : s5167; const SWord8 s5172 = s1930 ? s5168 : s5171; const SBool s5173 = (SBool) (s2013 & 1); const SBool s5174 = false != s5173; const SBool s5175 = (SBool) (s2006 & 1); const SBool s5176 = false != s5175; const SWord8 s5177 = s5176 ? s5162 : s5163; const SWord8 s5178 = (s5177 >> 1) | (s5177 << 7); const SWord8 s5179 = 128 | s5178; const SWord8 s5180 = 127 & s5178; const SWord8 s5181 = s5174 ? s5179 : s5180; const SBool s5182 = (SBool) (s2018 & 1); const SBool s5183 = false != s5182; const SWord8 s5184 = s5183 ? s5179 : s5180; const SWord8 s5185 = s1930 ? s5181 : s5184; const SWord8 s5186 = s1803 ? s5172 : s5185; const SWord8 s5187 = s1548 ? s5153 : s5186; const SWord8 s5188 = s1037 ? s5117 : s5187; const SWord8 s5189 = s21 ? s5047 : s5188; const SWord8 s5190 = s16 ? s4906 : s5189; const SWord8 s5191 = s11 ? s4623 : s5190; const SBool s5192 = (SBool) (s2128 & 1); const SBool s5193 = false != s5192; const SBool s5194 = (SBool) (s2124 & 1); const SBool s5195 = false != s5194; const SBool s5196 = (SBool) (s2120 & 1); const SBool s5197 = false != s5196; const SWord8 s5198 = (s2107 >> 1) | (s2107 << 7); const SWord8 s5199 = 128 | s5198; const SWord8 s5200 = 127 & s5198; const SWord8 s5201 = s5197 ? s5199 : s5200; const SWord8 s5202 = (s5201 >> 1) | (s5201 << 7); const SWord8 s5203 = 128 | s5202; const SWord8 s5204 = 127 & s5202; const SWord8 s5205 = s5195 ? s5203 : s5204; const SWord8 s5206 = (s5205 >> 1) | (s5205 << 7); const SWord8 s5207 = 128 | s5206; const SWord8 s5208 = 127 & s5206; const SWord8 s5209 = s5193 ? s5207 : s5208; const SBool s5210 = (SBool) (s2133 & 1); const SBool s5211 = false != s5210; const SWord8 s5212 = s5211 ? s5207 : s5208; const SWord8 s5213 = s2116 ? s5209 : s5212; const SBool s5214 = (SBool) (s2149 & 1); const SBool s5215 = false != s5214; const SBool s5216 = (SBool) (s2142 & 1); const SBool s5217 = false != s5216; const SWord8 s5218 = s5217 ? s5203 : s5204; const SWord8 s5219 = (s5218 >> 1) | (s5218 << 7); const SWord8 s5220 = 128 | s5219; const SWord8 s5221 = 127 & s5219; const SWord8 s5222 = s5215 ? s5220 : s5221; const SBool s5223 = (SBool) (s2154 & 1); const SBool s5224 = false != s5223; const SWord8 s5225 = s5224 ? s5220 : s5221; const SWord8 s5226 = s2116 ? s5222 : s5225; const SWord8 s5227 = s2097 ? s5213 : s5226; const SBool s5228 = (SBool) (s2175 & 1); const SBool s5229 = false != s5228; const SBool s5230 = (SBool) (s2171 & 1); const SBool s5231 = false != s5230; const SBool s5232 = (SBool) (s2164 & 1); const SBool s5233 = false != s5232; const SWord8 s5234 = s5233 ? s5199 : s5200; const SWord8 s5235 = (s5234 >> 1) | (s5234 << 7); const SWord8 s5236 = 128 | s5235; const SWord8 s5237 = 127 & s5235; const SWord8 s5238 = s5231 ? s5236 : s5237; const SWord8 s5239 = (s5238 >> 1) | (s5238 << 7); const SWord8 s5240 = 128 | s5239; const SWord8 s5241 = 127 & s5239; const SWord8 s5242 = s5229 ? s5240 : s5241; const SBool s5243 = (SBool) (s2180 & 1); const SBool s5244 = false != s5243; const SWord8 s5245 = s5244 ? s5240 : s5241; const SWord8 s5246 = s2116 ? s5242 : s5245; const SBool s5247 = (SBool) (s2196 & 1); const SBool s5248 = false != s5247; const SBool s5249 = (SBool) (s2189 & 1); const SBool s5250 = false != s5249; const SWord8 s5251 = s5250 ? s5236 : s5237; const SWord8 s5252 = (s5251 >> 1) | (s5251 << 7); const SWord8 s5253 = 128 | s5252; const SWord8 s5254 = 127 & s5252; const SWord8 s5255 = s5248 ? s5253 : s5254; const SBool s5256 = (SBool) (s2201 & 1); const SBool s5257 = false != s5256; const SWord8 s5258 = s5257 ? s5253 : s5254; const SWord8 s5259 = s2116 ? s5255 : s5258; const SWord8 s5260 = s2097 ? s5246 : s5259; const SWord8 s5261 = s2078 ? s5227 : s5260; const SBool s5262 = (SBool) (s2236 & 1); const SBool s5263 = false != s5262; const SBool s5264 = (SBool) (s2232 & 1); const SBool s5265 = false != s5264; const SBool s5266 = (SBool) (s2228 & 1); const SBool s5267 = false != s5266; const SWord8 s5268 = (s2215 >> 1) | (s2215 << 7); const SWord8 s5269 = 128 | s5268; const SWord8 s5270 = 127 & s5268; const SWord8 s5271 = s5267 ? s5269 : s5270; const SWord8 s5272 = (s5271 >> 1) | (s5271 << 7); const SWord8 s5273 = 128 | s5272; const SWord8 s5274 = 127 & s5272; const SWord8 s5275 = s5265 ? s5273 : s5274; const SWord8 s5276 = (s5275 >> 1) | (s5275 << 7); const SWord8 s5277 = 128 | s5276; const SWord8 s5278 = 127 & s5276; const SWord8 s5279 = s5263 ? s5277 : s5278; const SBool s5280 = (SBool) (s2241 & 1); const SBool s5281 = false != s5280; const SWord8 s5282 = s5281 ? s5277 : s5278; const SWord8 s5283 = s2221 ? s5279 : s5282; const SBool s5284 = (SBool) (s2257 & 1); const SBool s5285 = false != s5284; const SBool s5286 = (SBool) (s2250 & 1); const SBool s5287 = false != s5286; const SWord8 s5288 = s5287 ? s5273 : s5274; const SWord8 s5289 = (s5288 >> 1) | (s5288 << 7); const SWord8 s5290 = 128 | s5289; const SWord8 s5291 = 127 & s5289; const SWord8 s5292 = s5285 ? s5290 : s5291; const SBool s5293 = (SBool) (s2262 & 1); const SBool s5294 = false != s5293; const SWord8 s5295 = s5294 ? s5290 : s5291; const SWord8 s5296 = s2221 ? s5292 : s5295; const SWord8 s5297 = s2097 ? s5283 : s5296; const SBool s5298 = (SBool) (s2283 & 1); const SBool s5299 = false != s5298; const SBool s5300 = (SBool) (s2279 & 1); const SBool s5301 = false != s5300; const SBool s5302 = (SBool) (s2272 & 1); const SBool s5303 = false != s5302; const SWord8 s5304 = s5303 ? s5269 : s5270; const SWord8 s5305 = (s5304 >> 1) | (s5304 << 7); const SWord8 s5306 = 128 | s5305; const SWord8 s5307 = 127 & s5305; const SWord8 s5308 = s5301 ? s5306 : s5307; const SWord8 s5309 = (s5308 >> 1) | (s5308 << 7); const SWord8 s5310 = 128 | s5309; const SWord8 s5311 = 127 & s5309; const SWord8 s5312 = s5299 ? s5310 : s5311; const SBool s5313 = (SBool) (s2288 & 1); const SBool s5314 = false != s5313; const SWord8 s5315 = s5314 ? s5310 : s5311; const SWord8 s5316 = s2221 ? s5312 : s5315; const SBool s5317 = (SBool) (s2304 & 1); const SBool s5318 = false != s5317; const SBool s5319 = (SBool) (s2297 & 1); const SBool s5320 = false != s5319; const SWord8 s5321 = s5320 ? s5306 : s5307; const SWord8 s5322 = (s5321 >> 1) | (s5321 << 7); const SWord8 s5323 = 128 | s5322; const SWord8 s5324 = 127 & s5322; const SWord8 s5325 = s5318 ? s5323 : s5324; const SBool s5326 = (SBool) (s2309 & 1); const SBool s5327 = false != s5326; const SWord8 s5328 = s5327 ? s5323 : s5324; const SWord8 s5329 = s2221 ? s5325 : s5328; const SWord8 s5330 = s2097 ? s5316 : s5329; const SWord8 s5331 = s2078 ? s5297 : s5330; const SWord8 s5332 = s2059 ? s5261 : s5331; const SBool s5333 = (SBool) (s2364 & 1); const SBool s5334 = false != s5333; const SBool s5335 = (SBool) (s2360 & 1); const SBool s5336 = false != s5335; const SBool s5337 = (SBool) (s2356 & 1); const SBool s5338 = false != s5337; const SWord8 s5339 = (s2343 >> 1) | (s2343 << 7); const SWord8 s5340 = 128 | s5339; const SWord8 s5341 = 127 & s5339; const SWord8 s5342 = s5338 ? s5340 : s5341; const SWord8 s5343 = (s5342 >> 1) | (s5342 << 7); const SWord8 s5344 = 128 | s5343; const SWord8 s5345 = 127 & s5343; const SWord8 s5346 = s5336 ? s5344 : s5345; const SWord8 s5347 = (s5346 >> 1) | (s5346 << 7); const SWord8 s5348 = 128 | s5347; const SWord8 s5349 = 127 & s5347; const SWord8 s5350 = s5334 ? s5348 : s5349; const SBool s5351 = (SBool) (s2369 & 1); const SBool s5352 = false != s5351; const SWord8 s5353 = s5352 ? s5348 : s5349; const SWord8 s5354 = s2352 ? s5350 : s5353; const SBool s5355 = (SBool) (s2385 & 1); const SBool s5356 = false != s5355; const SBool s5357 = (SBool) (s2378 & 1); const SBool s5358 = false != s5357; const SWord8 s5359 = s5358 ? s5344 : s5345; const SWord8 s5360 = (s5359 >> 1) | (s5359 << 7); const SWord8 s5361 = 128 | s5360; const SWord8 s5362 = 127 & s5360; const SWord8 s5363 = s5356 ? s5361 : s5362; const SBool s5364 = (SBool) (s2390 & 1); const SBool s5365 = false != s5364; const SWord8 s5366 = s5365 ? s5361 : s5362; const SWord8 s5367 = s2352 ? s5363 : s5366; const SWord8 s5368 = s2330 ? s5354 : s5367; const SBool s5369 = (SBool) (s2411 & 1); const SBool s5370 = false != s5369; const SBool s5371 = (SBool) (s2407 & 1); const SBool s5372 = false != s5371; const SBool s5373 = (SBool) (s2400 & 1); const SBool s5374 = false != s5373; const SWord8 s5375 = s5374 ? s5340 : s5341; const SWord8 s5376 = (s5375 >> 1) | (s5375 << 7); const SWord8 s5377 = 128 | s5376; const SWord8 s5378 = 127 & s5376; const SWord8 s5379 = s5372 ? s5377 : s5378; const SWord8 s5380 = (s5379 >> 1) | (s5379 << 7); const SWord8 s5381 = 128 | s5380; const SWord8 s5382 = 127 & s5380; const SWord8 s5383 = s5370 ? s5381 : s5382; const SBool s5384 = (SBool) (s2416 & 1); const SBool s5385 = false != s5384; const SWord8 s5386 = s5385 ? s5381 : s5382; const SWord8 s5387 = s2352 ? s5383 : s5386; const SBool s5388 = (SBool) (s2432 & 1); const SBool s5389 = false != s5388; const SBool s5390 = (SBool) (s2425 & 1); const SBool s5391 = false != s5390; const SWord8 s5392 = s5391 ? s5377 : s5378; const SWord8 s5393 = (s5392 >> 1) | (s5392 << 7); const SWord8 s5394 = 128 | s5393; const SWord8 s5395 = 127 & s5393; const SWord8 s5396 = s5389 ? s5394 : s5395; const SBool s5397 = (SBool) (s2437 & 1); const SBool s5398 = false != s5397; const SWord8 s5399 = s5398 ? s5394 : s5395; const SWord8 s5400 = s2352 ? s5396 : s5399; const SWord8 s5401 = s2330 ? s5387 : s5400; const SWord8 s5402 = s2078 ? s5368 : s5401; const SBool s5403 = (SBool) (s2472 & 1); const SBool s5404 = false != s5403; const SBool s5405 = (SBool) (s2468 & 1); const SBool s5406 = false != s5405; const SBool s5407 = (SBool) (s2464 & 1); const SBool s5408 = false != s5407; const SWord8 s5409 = (s2451 >> 1) | (s2451 << 7); const SWord8 s5410 = 128 | s5409; const SWord8 s5411 = 127 & s5409; const SWord8 s5412 = s5408 ? s5410 : s5411; const SWord8 s5413 = (s5412 >> 1) | (s5412 << 7); const SWord8 s5414 = 128 | s5413; const SWord8 s5415 = 127 & s5413; const SWord8 s5416 = s5406 ? s5414 : s5415; const SWord8 s5417 = (s5416 >> 1) | (s5416 << 7); const SWord8 s5418 = 128 | s5417; const SWord8 s5419 = 127 & s5417; const SWord8 s5420 = s5404 ? s5418 : s5419; const SBool s5421 = (SBool) (s2477 & 1); const SBool s5422 = false != s5421; const SWord8 s5423 = s5422 ? s5418 : s5419; const SWord8 s5424 = s2457 ? s5420 : s5423; const SBool s5425 = (SBool) (s2493 & 1); const SBool s5426 = false != s5425; const SBool s5427 = (SBool) (s2486 & 1); const SBool s5428 = false != s5427; const SWord8 s5429 = s5428 ? s5414 : s5415; const SWord8 s5430 = (s5429 >> 1) | (s5429 << 7); const SWord8 s5431 = 128 | s5430; const SWord8 s5432 = 127 & s5430; const SWord8 s5433 = s5426 ? s5431 : s5432; const SBool s5434 = (SBool) (s2498 & 1); const SBool s5435 = false != s5434; const SWord8 s5436 = s5435 ? s5431 : s5432; const SWord8 s5437 = s2457 ? s5433 : s5436; const SWord8 s5438 = s2330 ? s5424 : s5437; const SBool s5439 = (SBool) (s2519 & 1); const SBool s5440 = false != s5439; const SBool s5441 = (SBool) (s2515 & 1); const SBool s5442 = false != s5441; const SBool s5443 = (SBool) (s2508 & 1); const SBool s5444 = false != s5443; const SWord8 s5445 = s5444 ? s5410 : s5411; const SWord8 s5446 = (s5445 >> 1) | (s5445 << 7); const SWord8 s5447 = 128 | s5446; const SWord8 s5448 = 127 & s5446; const SWord8 s5449 = s5442 ? s5447 : s5448; const SWord8 s5450 = (s5449 >> 1) | (s5449 << 7); const SWord8 s5451 = 128 | s5450; const SWord8 s5452 = 127 & s5450; const SWord8 s5453 = s5440 ? s5451 : s5452; const SBool s5454 = (SBool) (s2524 & 1); const SBool s5455 = false != s5454; const SWord8 s5456 = s5455 ? s5451 : s5452; const SWord8 s5457 = s2457 ? s5453 : s5456; const SBool s5458 = (SBool) (s2540 & 1); const SBool s5459 = false != s5458; const SBool s5460 = (SBool) (s2533 & 1); const SBool s5461 = false != s5460; const SWord8 s5462 = s5461 ? s5447 : s5448; const SWord8 s5463 = (s5462 >> 1) | (s5462 << 7); const SWord8 s5464 = 128 | s5463; const SWord8 s5465 = 127 & s5463; const SWord8 s5466 = s5459 ? s5464 : s5465; const SBool s5467 = (SBool) (s2545 & 1); const SBool s5468 = false != s5467; const SWord8 s5469 = s5468 ? s5464 : s5465; const SWord8 s5470 = s2457 ? s5466 : s5469; const SWord8 s5471 = s2330 ? s5457 : s5470; const SWord8 s5472 = s2078 ? s5438 : s5471; const SWord8 s5473 = s2059 ? s5402 : s5472; const SWord8 s5474 = s2042 ? s5332 : s5473; const SBool s5475 = (SBool) (s2620 & 1); const SBool s5476 = false != s5475; const SBool s5477 = (SBool) (s2616 & 1); const SBool s5478 = false != s5477; const SBool s5479 = (SBool) (s2612 & 1); const SBool s5480 = false != s5479; const SWord8 s5481 = (s2599 >> 1) | (s2599 << 7); const SWord8 s5482 = 128 | s5481; const SWord8 s5483 = 127 & s5481; const SWord8 s5484 = s5480 ? s5482 : s5483; const SWord8 s5485 = (s5484 >> 1) | (s5484 << 7); const SWord8 s5486 = 128 | s5485; const SWord8 s5487 = 127 & s5485; const SWord8 s5488 = s5478 ? s5486 : s5487; const SWord8 s5489 = (s5488 >> 1) | (s5488 << 7); const SWord8 s5490 = 128 | s5489; const SWord8 s5491 = 127 & s5489; const SWord8 s5492 = s5476 ? s5490 : s5491; const SBool s5493 = (SBool) (s2625 & 1); const SBool s5494 = false != s5493; const SWord8 s5495 = s5494 ? s5490 : s5491; const SWord8 s5496 = s2608 ? s5492 : s5495; const SBool s5497 = (SBool) (s2641 & 1); const SBool s5498 = false != s5497; const SBool s5499 = (SBool) (s2634 & 1); const SBool s5500 = false != s5499; const SWord8 s5501 = s5500 ? s5486 : s5487; const SWord8 s5502 = (s5501 >> 1) | (s5501 << 7); const SWord8 s5503 = 128 | s5502; const SWord8 s5504 = 127 & s5502; const SWord8 s5505 = s5498 ? s5503 : s5504; const SBool s5506 = (SBool) (s2646 & 1); const SBool s5507 = false != s5506; const SWord8 s5508 = s5507 ? s5503 : s5504; const SWord8 s5509 = s2608 ? s5505 : s5508; const SWord8 s5510 = s2589 ? s5496 : s5509; const SBool s5511 = (SBool) (s2667 & 1); const SBool s5512 = false != s5511; const SBool s5513 = (SBool) (s2663 & 1); const SBool s5514 = false != s5513; const SBool s5515 = (SBool) (s2656 & 1); const SBool s5516 = false != s5515; const SWord8 s5517 = s5516 ? s5482 : s5483; const SWord8 s5518 = (s5517 >> 1) | (s5517 << 7); const SWord8 s5519 = 128 | s5518; const SWord8 s5520 = 127 & s5518; const SWord8 s5521 = s5514 ? s5519 : s5520; const SWord8 s5522 = (s5521 >> 1) | (s5521 << 7); const SWord8 s5523 = 128 | s5522; const SWord8 s5524 = 127 & s5522; const SWord8 s5525 = s5512 ? s5523 : s5524; const SBool s5526 = (SBool) (s2672 & 1); const SBool s5527 = false != s5526; const SWord8 s5528 = s5527 ? s5523 : s5524; const SWord8 s5529 = s2608 ? s5525 : s5528; const SBool s5530 = (SBool) (s2688 & 1); const SBool s5531 = false != s5530; const SBool s5532 = (SBool) (s2681 & 1); const SBool s5533 = false != s5532; const SWord8 s5534 = s5533 ? s5519 : s5520; const SWord8 s5535 = (s5534 >> 1) | (s5534 << 7); const SWord8 s5536 = 128 | s5535; const SWord8 s5537 = 127 & s5535; const SWord8 s5538 = s5531 ? s5536 : s5537; const SBool s5539 = (SBool) (s2693 & 1); const SBool s5540 = false != s5539; const SWord8 s5541 = s5540 ? s5536 : s5537; const SWord8 s5542 = s2608 ? s5538 : s5541; const SWord8 s5543 = s2589 ? s5529 : s5542; const SWord8 s5544 = s2567 ? s5510 : s5543; const SBool s5545 = (SBool) (s2728 & 1); const SBool s5546 = false != s5545; const SBool s5547 = (SBool) (s2724 & 1); const SBool s5548 = false != s5547; const SBool s5549 = (SBool) (s2720 & 1); const SBool s5550 = false != s5549; const SWord8 s5551 = (s2707 >> 1) | (s2707 << 7); const SWord8 s5552 = 128 | s5551; const SWord8 s5553 = 127 & s5551; const SWord8 s5554 = s5550 ? s5552 : s5553; const SWord8 s5555 = (s5554 >> 1) | (s5554 << 7); const SWord8 s5556 = 128 | s5555; const SWord8 s5557 = 127 & s5555; const SWord8 s5558 = s5548 ? s5556 : s5557; const SWord8 s5559 = (s5558 >> 1) | (s5558 << 7); const SWord8 s5560 = 128 | s5559; const SWord8 s5561 = 127 & s5559; const SWord8 s5562 = s5546 ? s5560 : s5561; const SBool s5563 = (SBool) (s2733 & 1); const SBool s5564 = false != s5563; const SWord8 s5565 = s5564 ? s5560 : s5561; const SWord8 s5566 = s2713 ? s5562 : s5565; const SBool s5567 = (SBool) (s2749 & 1); const SBool s5568 = false != s5567; const SBool s5569 = (SBool) (s2742 & 1); const SBool s5570 = false != s5569; const SWord8 s5571 = s5570 ? s5556 : s5557; const SWord8 s5572 = (s5571 >> 1) | (s5571 << 7); const SWord8 s5573 = 128 | s5572; const SWord8 s5574 = 127 & s5572; const SWord8 s5575 = s5568 ? s5573 : s5574; const SBool s5576 = (SBool) (s2754 & 1); const SBool s5577 = false != s5576; const SWord8 s5578 = s5577 ? s5573 : s5574; const SWord8 s5579 = s2713 ? s5575 : s5578; const SWord8 s5580 = s2589 ? s5566 : s5579; const SBool s5581 = (SBool) (s2775 & 1); const SBool s5582 = false != s5581; const SBool s5583 = (SBool) (s2771 & 1); const SBool s5584 = false != s5583; const SBool s5585 = (SBool) (s2764 & 1); const SBool s5586 = false != s5585; const SWord8 s5587 = s5586 ? s5552 : s5553; const SWord8 s5588 = (s5587 >> 1) | (s5587 << 7); const SWord8 s5589 = 128 | s5588; const SWord8 s5590 = 127 & s5588; const SWord8 s5591 = s5584 ? s5589 : s5590; const SWord8 s5592 = (s5591 >> 1) | (s5591 << 7); const SWord8 s5593 = 128 | s5592; const SWord8 s5594 = 127 & s5592; const SWord8 s5595 = s5582 ? s5593 : s5594; const SBool s5596 = (SBool) (s2780 & 1); const SBool s5597 = false != s5596; const SWord8 s5598 = s5597 ? s5593 : s5594; const SWord8 s5599 = s2713 ? s5595 : s5598; const SBool s5600 = (SBool) (s2796 & 1); const SBool s5601 = false != s5600; const SBool s5602 = (SBool) (s2789 & 1); const SBool s5603 = false != s5602; const SWord8 s5604 = s5603 ? s5589 : s5590; const SWord8 s5605 = (s5604 >> 1) | (s5604 << 7); const SWord8 s5606 = 128 | s5605; const SWord8 s5607 = 127 & s5605; const SWord8 s5608 = s5601 ? s5606 : s5607; const SBool s5609 = (SBool) (s2801 & 1); const SBool s5610 = false != s5609; const SWord8 s5611 = s5610 ? s5606 : s5607; const SWord8 s5612 = s2713 ? s5608 : s5611; const SWord8 s5613 = s2589 ? s5599 : s5612; const SWord8 s5614 = s2567 ? s5580 : s5613; const SWord8 s5615 = s2059 ? s5544 : s5614; const SBool s5616 = (SBool) (s2856 & 1); const SBool s5617 = false != s5616; const SBool s5618 = (SBool) (s2852 & 1); const SBool s5619 = false != s5618; const SBool s5620 = (SBool) (s2848 & 1); const SBool s5621 = false != s5620; const SWord8 s5622 = (s2835 >> 1) | (s2835 << 7); const SWord8 s5623 = 128 | s5622; const SWord8 s5624 = 127 & s5622; const SWord8 s5625 = s5621 ? s5623 : s5624; const SWord8 s5626 = (s5625 >> 1) | (s5625 << 7); const SWord8 s5627 = 128 | s5626; const SWord8 s5628 = 127 & s5626; const SWord8 s5629 = s5619 ? s5627 : s5628; const SWord8 s5630 = (s5629 >> 1) | (s5629 << 7); const SWord8 s5631 = 128 | s5630; const SWord8 s5632 = 127 & s5630; const SWord8 s5633 = s5617 ? s5631 : s5632; const SBool s5634 = (SBool) (s2861 & 1); const SBool s5635 = false != s5634; const SWord8 s5636 = s5635 ? s5631 : s5632; const SWord8 s5637 = s2844 ? s5633 : s5636; const SBool s5638 = (SBool) (s2877 & 1); const SBool s5639 = false != s5638; const SBool s5640 = (SBool) (s2870 & 1); const SBool s5641 = false != s5640; const SWord8 s5642 = s5641 ? s5627 : s5628; const SWord8 s5643 = (s5642 >> 1) | (s5642 << 7); const SWord8 s5644 = 128 | s5643; const SWord8 s5645 = 127 & s5643; const SWord8 s5646 = s5639 ? s5644 : s5645; const SBool s5647 = (SBool) (s2882 & 1); const SBool s5648 = false != s5647; const SWord8 s5649 = s5648 ? s5644 : s5645; const SWord8 s5650 = s2844 ? s5646 : s5649; const SWord8 s5651 = s2822 ? s5637 : s5650; const SBool s5652 = (SBool) (s2903 & 1); const SBool s5653 = false != s5652; const SBool s5654 = (SBool) (s2899 & 1); const SBool s5655 = false != s5654; const SBool s5656 = (SBool) (s2892 & 1); const SBool s5657 = false != s5656; const SWord8 s5658 = s5657 ? s5623 : s5624; const SWord8 s5659 = (s5658 >> 1) | (s5658 << 7); const SWord8 s5660 = 128 | s5659; const SWord8 s5661 = 127 & s5659; const SWord8 s5662 = s5655 ? s5660 : s5661; const SWord8 s5663 = (s5662 >> 1) | (s5662 << 7); const SWord8 s5664 = 128 | s5663; const SWord8 s5665 = 127 & s5663; const SWord8 s5666 = s5653 ? s5664 : s5665; const SBool s5667 = (SBool) (s2908 & 1); const SBool s5668 = false != s5667; const SWord8 s5669 = s5668 ? s5664 : s5665; const SWord8 s5670 = s2844 ? s5666 : s5669; const SBool s5671 = (SBool) (s2924 & 1); const SBool s5672 = false != s5671; const SBool s5673 = (SBool) (s2917 & 1); const SBool s5674 = false != s5673; const SWord8 s5675 = s5674 ? s5660 : s5661; const SWord8 s5676 = (s5675 >> 1) | (s5675 << 7); const SWord8 s5677 = 128 | s5676; const SWord8 s5678 = 127 & s5676; const SWord8 s5679 = s5672 ? s5677 : s5678; const SBool s5680 = (SBool) (s2929 & 1); const SBool s5681 = false != s5680; const SWord8 s5682 = s5681 ? s5677 : s5678; const SWord8 s5683 = s2844 ? s5679 : s5682; const SWord8 s5684 = s2822 ? s5670 : s5683; const SWord8 s5685 = s2567 ? s5651 : s5684; const SBool s5686 = (SBool) (s2964 & 1); const SBool s5687 = false != s5686; const SBool s5688 = (SBool) (s2960 & 1); const SBool s5689 = false != s5688; const SBool s5690 = (SBool) (s2956 & 1); const SBool s5691 = false != s5690; const SWord8 s5692 = (s2943 >> 1) | (s2943 << 7); const SWord8 s5693 = 128 | s5692; const SWord8 s5694 = 127 & s5692; const SWord8 s5695 = s5691 ? s5693 : s5694; const SWord8 s5696 = (s5695 >> 1) | (s5695 << 7); const SWord8 s5697 = 128 | s5696; const SWord8 s5698 = 127 & s5696; const SWord8 s5699 = s5689 ? s5697 : s5698; const SWord8 s5700 = (s5699 >> 1) | (s5699 << 7); const SWord8 s5701 = 128 | s5700; const SWord8 s5702 = 127 & s5700; const SWord8 s5703 = s5687 ? s5701 : s5702; const SBool s5704 = (SBool) (s2969 & 1); const SBool s5705 = false != s5704; const SWord8 s5706 = s5705 ? s5701 : s5702; const SWord8 s5707 = s2949 ? s5703 : s5706; const SBool s5708 = (SBool) (s2985 & 1); const SBool s5709 = false != s5708; const SBool s5710 = (SBool) (s2978 & 1); const SBool s5711 = false != s5710; const SWord8 s5712 = s5711 ? s5697 : s5698; const SWord8 s5713 = (s5712 >> 1) | (s5712 << 7); const SWord8 s5714 = 128 | s5713; const SWord8 s5715 = 127 & s5713; const SWord8 s5716 = s5709 ? s5714 : s5715; const SBool s5717 = (SBool) (s2990 & 1); const SBool s5718 = false != s5717; const SWord8 s5719 = s5718 ? s5714 : s5715; const SWord8 s5720 = s2949 ? s5716 : s5719; const SWord8 s5721 = s2822 ? s5707 : s5720; const SBool s5722 = (SBool) (s3011 & 1); const SBool s5723 = false != s5722; const SBool s5724 = (SBool) (s3007 & 1); const SBool s5725 = false != s5724; const SBool s5726 = (SBool) (s3000 & 1); const SBool s5727 = false != s5726; const SWord8 s5728 = s5727 ? s5693 : s5694; const SWord8 s5729 = (s5728 >> 1) | (s5728 << 7); const SWord8 s5730 = 128 | s5729; const SWord8 s5731 = 127 & s5729; const SWord8 s5732 = s5725 ? s5730 : s5731; const SWord8 s5733 = (s5732 >> 1) | (s5732 << 7); const SWord8 s5734 = 128 | s5733; const SWord8 s5735 = 127 & s5733; const SWord8 s5736 = s5723 ? s5734 : s5735; const SBool s5737 = (SBool) (s3016 & 1); const SBool s5738 = false != s5737; const SWord8 s5739 = s5738 ? s5734 : s5735; const SWord8 s5740 = s2949 ? s5736 : s5739; const SBool s5741 = (SBool) (s3032 & 1); const SBool s5742 = false != s5741; const SBool s5743 = (SBool) (s3025 & 1); const SBool s5744 = false != s5743; const SWord8 s5745 = s5744 ? s5730 : s5731; const SWord8 s5746 = (s5745 >> 1) | (s5745 << 7); const SWord8 s5747 = 128 | s5746; const SWord8 s5748 = 127 & s5746; const SWord8 s5749 = s5742 ? s5747 : s5748; const SBool s5750 = (SBool) (s3037 & 1); const SBool s5751 = false != s5750; const SWord8 s5752 = s5751 ? s5747 : s5748; const SWord8 s5753 = s2949 ? s5749 : s5752; const SWord8 s5754 = s2822 ? s5740 : s5753; const SWord8 s5755 = s2567 ? s5721 : s5754; const SWord8 s5756 = s2059 ? s5685 : s5755; const SWord8 s5757 = s2042 ? s5615 : s5756; const SWord8 s5758 = s16 ? s5474 : s5757; const SBool s5759 = (SBool) (s3132 & 1); const SBool s5760 = false != s5759; const SBool s5761 = (SBool) (s3128 & 1); const SBool s5762 = false != s5761; const SBool s5763 = (SBool) (s3124 & 1); const SBool s5764 = false != s5763; const SWord8 s5765 = (s3111 >> 1) | (s3111 << 7); const SWord8 s5766 = 128 | s5765; const SWord8 s5767 = 127 & s5765; const SWord8 s5768 = s5764 ? s5766 : s5767; const SWord8 s5769 = (s5768 >> 1) | (s5768 << 7); const SWord8 s5770 = 128 | s5769; const SWord8 s5771 = 127 & s5769; const SWord8 s5772 = s5762 ? s5770 : s5771; const SWord8 s5773 = (s5772 >> 1) | (s5772 << 7); const SWord8 s5774 = 128 | s5773; const SWord8 s5775 = 127 & s5773; const SWord8 s5776 = s5760 ? s5774 : s5775; const SBool s5777 = (SBool) (s3137 & 1); const SBool s5778 = false != s5777; const SWord8 s5779 = s5778 ? s5774 : s5775; const SWord8 s5780 = s3120 ? s5776 : s5779; const SBool s5781 = (SBool) (s3153 & 1); const SBool s5782 = false != s5781; const SBool s5783 = (SBool) (s3146 & 1); const SBool s5784 = false != s5783; const SWord8 s5785 = s5784 ? s5770 : s5771; const SWord8 s5786 = (s5785 >> 1) | (s5785 << 7); const SWord8 s5787 = 128 | s5786; const SWord8 s5788 = 127 & s5786; const SWord8 s5789 = s5782 ? s5787 : s5788; const SBool s5790 = (SBool) (s3158 & 1); const SBool s5791 = false != s5790; const SWord8 s5792 = s5791 ? s5787 : s5788; const SWord8 s5793 = s3120 ? s5789 : s5792; const SWord8 s5794 = s3101 ? s5780 : s5793; const SBool s5795 = (SBool) (s3179 & 1); const SBool s5796 = false != s5795; const SBool s5797 = (SBool) (s3175 & 1); const SBool s5798 = false != s5797; const SBool s5799 = (SBool) (s3168 & 1); const SBool s5800 = false != s5799; const SWord8 s5801 = s5800 ? s5766 : s5767; const SWord8 s5802 = (s5801 >> 1) | (s5801 << 7); const SWord8 s5803 = 128 | s5802; const SWord8 s5804 = 127 & s5802; const SWord8 s5805 = s5798 ? s5803 : s5804; const SWord8 s5806 = (s5805 >> 1) | (s5805 << 7); const SWord8 s5807 = 128 | s5806; const SWord8 s5808 = 127 & s5806; const SWord8 s5809 = s5796 ? s5807 : s5808; const SBool s5810 = (SBool) (s3184 & 1); const SBool s5811 = false != s5810; const SWord8 s5812 = s5811 ? s5807 : s5808; const SWord8 s5813 = s3120 ? s5809 : s5812; const SBool s5814 = (SBool) (s3200 & 1); const SBool s5815 = false != s5814; const SBool s5816 = (SBool) (s3193 & 1); const SBool s5817 = false != s5816; const SWord8 s5818 = s5817 ? s5803 : s5804; const SWord8 s5819 = (s5818 >> 1) | (s5818 << 7); const SWord8 s5820 = 128 | s5819; const SWord8 s5821 = 127 & s5819; const SWord8 s5822 = s5815 ? s5820 : s5821; const SBool s5823 = (SBool) (s3205 & 1); const SBool s5824 = false != s5823; const SWord8 s5825 = s5824 ? s5820 : s5821; const SWord8 s5826 = s3120 ? s5822 : s5825; const SWord8 s5827 = s3101 ? s5813 : s5826; const SWord8 s5828 = s3082 ? s5794 : s5827; const SBool s5829 = (SBool) (s3240 & 1); const SBool s5830 = false != s5829; const SBool s5831 = (SBool) (s3236 & 1); const SBool s5832 = false != s5831; const SBool s5833 = (SBool) (s3232 & 1); const SBool s5834 = false != s5833; const SWord8 s5835 = (s3219 >> 1) | (s3219 << 7); const SWord8 s5836 = 128 | s5835; const SWord8 s5837 = 127 & s5835; const SWord8 s5838 = s5834 ? s5836 : s5837; const SWord8 s5839 = (s5838 >> 1) | (s5838 << 7); const SWord8 s5840 = 128 | s5839; const SWord8 s5841 = 127 & s5839; const SWord8 s5842 = s5832 ? s5840 : s5841; const SWord8 s5843 = (s5842 >> 1) | (s5842 << 7); const SWord8 s5844 = 128 | s5843; const SWord8 s5845 = 127 & s5843; const SWord8 s5846 = s5830 ? s5844 : s5845; const SBool s5847 = (SBool) (s3245 & 1); const SBool s5848 = false != s5847; const SWord8 s5849 = s5848 ? s5844 : s5845; const SWord8 s5850 = s3225 ? s5846 : s5849; const SBool s5851 = (SBool) (s3261 & 1); const SBool s5852 = false != s5851; const SBool s5853 = (SBool) (s3254 & 1); const SBool s5854 = false != s5853; const SWord8 s5855 = s5854 ? s5840 : s5841; const SWord8 s5856 = (s5855 >> 1) | (s5855 << 7); const SWord8 s5857 = 128 | s5856; const SWord8 s5858 = 127 & s5856; const SWord8 s5859 = s5852 ? s5857 : s5858; const SBool s5860 = (SBool) (s3266 & 1); const SBool s5861 = false != s5860; const SWord8 s5862 = s5861 ? s5857 : s5858; const SWord8 s5863 = s3225 ? s5859 : s5862; const SWord8 s5864 = s3101 ? s5850 : s5863; const SBool s5865 = (SBool) (s3287 & 1); const SBool s5866 = false != s5865; const SBool s5867 = (SBool) (s3283 & 1); const SBool s5868 = false != s5867; const SBool s5869 = (SBool) (s3276 & 1); const SBool s5870 = false != s5869; const SWord8 s5871 = s5870 ? s5836 : s5837; const SWord8 s5872 = (s5871 >> 1) | (s5871 << 7); const SWord8 s5873 = 128 | s5872; const SWord8 s5874 = 127 & s5872; const SWord8 s5875 = s5868 ? s5873 : s5874; const SWord8 s5876 = (s5875 >> 1) | (s5875 << 7); const SWord8 s5877 = 128 | s5876; const SWord8 s5878 = 127 & s5876; const SWord8 s5879 = s5866 ? s5877 : s5878; const SBool s5880 = (SBool) (s3292 & 1); const SBool s5881 = false != s5880; const SWord8 s5882 = s5881 ? s5877 : s5878; const SWord8 s5883 = s3225 ? s5879 : s5882; const SBool s5884 = (SBool) (s3308 & 1); const SBool s5885 = false != s5884; const SBool s5886 = (SBool) (s3301 & 1); const SBool s5887 = false != s5886; const SWord8 s5888 = s5887 ? s5873 : s5874; const SWord8 s5889 = (s5888 >> 1) | (s5888 << 7); const SWord8 s5890 = 128 | s5889; const SWord8 s5891 = 127 & s5889; const SWord8 s5892 = s5885 ? s5890 : s5891; const SBool s5893 = (SBool) (s3313 & 1); const SBool s5894 = false != s5893; const SWord8 s5895 = s5894 ? s5890 : s5891; const SWord8 s5896 = s3225 ? s5892 : s5895; const SWord8 s5897 = s3101 ? s5883 : s5896; const SWord8 s5898 = s3082 ? s5864 : s5897; const SWord8 s5899 = s3060 ? s5828 : s5898; const SBool s5900 = (SBool) (s3368 & 1); const SBool s5901 = false != s5900; const SBool s5902 = (SBool) (s3364 & 1); const SBool s5903 = false != s5902; const SBool s5904 = (SBool) (s3360 & 1); const SBool s5905 = false != s5904; const SWord8 s5906 = (s3347 >> 1) | (s3347 << 7); const SWord8 s5907 = 128 | s5906; const SWord8 s5908 = 127 & s5906; const SWord8 s5909 = s5905 ? s5907 : s5908; const SWord8 s5910 = (s5909 >> 1) | (s5909 << 7); const SWord8 s5911 = 128 | s5910; const SWord8 s5912 = 127 & s5910; const SWord8 s5913 = s5903 ? s5911 : s5912; const SWord8 s5914 = (s5913 >> 1) | (s5913 << 7); const SWord8 s5915 = 128 | s5914; const SWord8 s5916 = 127 & s5914; const SWord8 s5917 = s5901 ? s5915 : s5916; const SBool s5918 = (SBool) (s3373 & 1); const SBool s5919 = false != s5918; const SWord8 s5920 = s5919 ? s5915 : s5916; const SWord8 s5921 = s3356 ? s5917 : s5920; const SBool s5922 = (SBool) (s3389 & 1); const SBool s5923 = false != s5922; const SBool s5924 = (SBool) (s3382 & 1); const SBool s5925 = false != s5924; const SWord8 s5926 = s5925 ? s5911 : s5912; const SWord8 s5927 = (s5926 >> 1) | (s5926 << 7); const SWord8 s5928 = 128 | s5927; const SWord8 s5929 = 127 & s5927; const SWord8 s5930 = s5923 ? s5928 : s5929; const SBool s5931 = (SBool) (s3394 & 1); const SBool s5932 = false != s5931; const SWord8 s5933 = s5932 ? s5928 : s5929; const SWord8 s5934 = s3356 ? s5930 : s5933; const SWord8 s5935 = s3334 ? s5921 : s5934; const SBool s5936 = (SBool) (s3415 & 1); const SBool s5937 = false != s5936; const SBool s5938 = (SBool) (s3411 & 1); const SBool s5939 = false != s5938; const SBool s5940 = (SBool) (s3404 & 1); const SBool s5941 = false != s5940; const SWord8 s5942 = s5941 ? s5907 : s5908; const SWord8 s5943 = (s5942 >> 1) | (s5942 << 7); const SWord8 s5944 = 128 | s5943; const SWord8 s5945 = 127 & s5943; const SWord8 s5946 = s5939 ? s5944 : s5945; const SWord8 s5947 = (s5946 >> 1) | (s5946 << 7); const SWord8 s5948 = 128 | s5947; const SWord8 s5949 = 127 & s5947; const SWord8 s5950 = s5937 ? s5948 : s5949; const SBool s5951 = (SBool) (s3420 & 1); const SBool s5952 = false != s5951; const SWord8 s5953 = s5952 ? s5948 : s5949; const SWord8 s5954 = s3356 ? s5950 : s5953; const SBool s5955 = (SBool) (s3436 & 1); const SBool s5956 = false != s5955; const SBool s5957 = (SBool) (s3429 & 1); const SBool s5958 = false != s5957; const SWord8 s5959 = s5958 ? s5944 : s5945; const SWord8 s5960 = (s5959 >> 1) | (s5959 << 7); const SWord8 s5961 = 128 | s5960; const SWord8 s5962 = 127 & s5960; const SWord8 s5963 = s5956 ? s5961 : s5962; const SBool s5964 = (SBool) (s3441 & 1); const SBool s5965 = false != s5964; const SWord8 s5966 = s5965 ? s5961 : s5962; const SWord8 s5967 = s3356 ? s5963 : s5966; const SWord8 s5968 = s3334 ? s5954 : s5967; const SWord8 s5969 = s3082 ? s5935 : s5968; const SBool s5970 = (SBool) (s3476 & 1); const SBool s5971 = false != s5970; const SBool s5972 = (SBool) (s3472 & 1); const SBool s5973 = false != s5972; const SBool s5974 = (SBool) (s3468 & 1); const SBool s5975 = false != s5974; const SWord8 s5976 = (s3455 >> 1) | (s3455 << 7); const SWord8 s5977 = 128 | s5976; const SWord8 s5978 = 127 & s5976; const SWord8 s5979 = s5975 ? s5977 : s5978; const SWord8 s5980 = (s5979 >> 1) | (s5979 << 7); const SWord8 s5981 = 128 | s5980; const SWord8 s5982 = 127 & s5980; const SWord8 s5983 = s5973 ? s5981 : s5982; const SWord8 s5984 = (s5983 >> 1) | (s5983 << 7); const SWord8 s5985 = 128 | s5984; const SWord8 s5986 = 127 & s5984; const SWord8 s5987 = s5971 ? s5985 : s5986; const SBool s5988 = (SBool) (s3481 & 1); const SBool s5989 = false != s5988; const SWord8 s5990 = s5989 ? s5985 : s5986; const SWord8 s5991 = s3461 ? s5987 : s5990; const SBool s5992 = (SBool) (s3497 & 1); const SBool s5993 = false != s5992; const SBool s5994 = (SBool) (s3490 & 1); const SBool s5995 = false != s5994; const SWord8 s5996 = s5995 ? s5981 : s5982; const SWord8 s5997 = (s5996 >> 1) | (s5996 << 7); const SWord8 s5998 = 128 | s5997; const SWord8 s5999 = 127 & s5997; const SWord8 s6000 = s5993 ? s5998 : s5999; const SBool s6001 = (SBool) (s3502 & 1); const SBool s6002 = false != s6001; const SWord8 s6003 = s6002 ? s5998 : s5999; const SWord8 s6004 = s3461 ? s6000 : s6003; const SWord8 s6005 = s3334 ? s5991 : s6004; const SBool s6006 = (SBool) (s3523 & 1); const SBool s6007 = false != s6006; const SBool s6008 = (SBool) (s3519 & 1); const SBool s6009 = false != s6008; const SBool s6010 = (SBool) (s3512 & 1); const SBool s6011 = false != s6010; const SWord8 s6012 = s6011 ? s5977 : s5978; const SWord8 s6013 = (s6012 >> 1) | (s6012 << 7); const SWord8 s6014 = 128 | s6013; const SWord8 s6015 = 127 & s6013; const SWord8 s6016 = s6009 ? s6014 : s6015; const SWord8 s6017 = (s6016 >> 1) | (s6016 << 7); const SWord8 s6018 = 128 | s6017; const SWord8 s6019 = 127 & s6017; const SWord8 s6020 = s6007 ? s6018 : s6019; const SBool s6021 = (SBool) (s3528 & 1); const SBool s6022 = false != s6021; const SWord8 s6023 = s6022 ? s6018 : s6019; const SWord8 s6024 = s3461 ? s6020 : s6023; const SBool s6025 = (SBool) (s3544 & 1); const SBool s6026 = false != s6025; const SBool s6027 = (SBool) (s3537 & 1); const SBool s6028 = false != s6027; const SWord8 s6029 = s6028 ? s6014 : s6015; const SWord8 s6030 = (s6029 >> 1) | (s6029 << 7); const SWord8 s6031 = 128 | s6030; const SWord8 s6032 = 127 & s6030; const SWord8 s6033 = s6026 ? s6031 : s6032; const SBool s6034 = (SBool) (s3549 & 1); const SBool s6035 = false != s6034; const SWord8 s6036 = s6035 ? s6031 : s6032; const SWord8 s6037 = s3461 ? s6033 : s6036; const SWord8 s6038 = s3334 ? s6024 : s6037; const SWord8 s6039 = s3082 ? s6005 : s6038; const SWord8 s6040 = s3060 ? s5969 : s6039; const SWord8 s6041 = s2042 ? s5899 : s6040; const SBool s6042 = (SBool) (s3624 & 1); const SBool s6043 = false != s6042; const SBool s6044 = (SBool) (s3620 & 1); const SBool s6045 = false != s6044; const SBool s6046 = (SBool) (s3616 & 1); const SBool s6047 = false != s6046; const SWord8 s6048 = (s3603 >> 1) | (s3603 << 7); const SWord8 s6049 = 128 | s6048; const SWord8 s6050 = 127 & s6048; const SWord8 s6051 = s6047 ? s6049 : s6050; const SWord8 s6052 = (s6051 >> 1) | (s6051 << 7); const SWord8 s6053 = 128 | s6052; const SWord8 s6054 = 127 & s6052; const SWord8 s6055 = s6045 ? s6053 : s6054; const SWord8 s6056 = (s6055 >> 1) | (s6055 << 7); const SWord8 s6057 = 128 | s6056; const SWord8 s6058 = 127 & s6056; const SWord8 s6059 = s6043 ? s6057 : s6058; const SBool s6060 = (SBool) (s3629 & 1); const SBool s6061 = false != s6060; const SWord8 s6062 = s6061 ? s6057 : s6058; const SWord8 s6063 = s3612 ? s6059 : s6062; const SBool s6064 = (SBool) (s3645 & 1); const SBool s6065 = false != s6064; const SBool s6066 = (SBool) (s3638 & 1); const SBool s6067 = false != s6066; const SWord8 s6068 = s6067 ? s6053 : s6054; const SWord8 s6069 = (s6068 >> 1) | (s6068 << 7); const SWord8 s6070 = 128 | s6069; const SWord8 s6071 = 127 & s6069; const SWord8 s6072 = s6065 ? s6070 : s6071; const SBool s6073 = (SBool) (s3650 & 1); const SBool s6074 = false != s6073; const SWord8 s6075 = s6074 ? s6070 : s6071; const SWord8 s6076 = s3612 ? s6072 : s6075; const SWord8 s6077 = s3593 ? s6063 : s6076; const SBool s6078 = (SBool) (s3671 & 1); const SBool s6079 = false != s6078; const SBool s6080 = (SBool) (s3667 & 1); const SBool s6081 = false != s6080; const SBool s6082 = (SBool) (s3660 & 1); const SBool s6083 = false != s6082; const SWord8 s6084 = s6083 ? s6049 : s6050; const SWord8 s6085 = (s6084 >> 1) | (s6084 << 7); const SWord8 s6086 = 128 | s6085; const SWord8 s6087 = 127 & s6085; const SWord8 s6088 = s6081 ? s6086 : s6087; const SWord8 s6089 = (s6088 >> 1) | (s6088 << 7); const SWord8 s6090 = 128 | s6089; const SWord8 s6091 = 127 & s6089; const SWord8 s6092 = s6079 ? s6090 : s6091; const SBool s6093 = (SBool) (s3676 & 1); const SBool s6094 = false != s6093; const SWord8 s6095 = s6094 ? s6090 : s6091; const SWord8 s6096 = s3612 ? s6092 : s6095; const SBool s6097 = (SBool) (s3692 & 1); const SBool s6098 = false != s6097; const SBool s6099 = (SBool) (s3685 & 1); const SBool s6100 = false != s6099; const SWord8 s6101 = s6100 ? s6086 : s6087; const SWord8 s6102 = (s6101 >> 1) | (s6101 << 7); const SWord8 s6103 = 128 | s6102; const SWord8 s6104 = 127 & s6102; const SWord8 s6105 = s6098 ? s6103 : s6104; const SBool s6106 = (SBool) (s3697 & 1); const SBool s6107 = false != s6106; const SWord8 s6108 = s6107 ? s6103 : s6104; const SWord8 s6109 = s3612 ? s6105 : s6108; const SWord8 s6110 = s3593 ? s6096 : s6109; const SWord8 s6111 = s3571 ? s6077 : s6110; const SBool s6112 = (SBool) (s3732 & 1); const SBool s6113 = false != s6112; const SBool s6114 = (SBool) (s3728 & 1); const SBool s6115 = false != s6114; const SBool s6116 = (SBool) (s3724 & 1); const SBool s6117 = false != s6116; const SWord8 s6118 = (s3711 >> 1) | (s3711 << 7); const SWord8 s6119 = 128 | s6118; const SWord8 s6120 = 127 & s6118; const SWord8 s6121 = s6117 ? s6119 : s6120; const SWord8 s6122 = (s6121 >> 1) | (s6121 << 7); const SWord8 s6123 = 128 | s6122; const SWord8 s6124 = 127 & s6122; const SWord8 s6125 = s6115 ? s6123 : s6124; const SWord8 s6126 = (s6125 >> 1) | (s6125 << 7); const SWord8 s6127 = 128 | s6126; const SWord8 s6128 = 127 & s6126; const SWord8 s6129 = s6113 ? s6127 : s6128; const SBool s6130 = (SBool) (s3737 & 1); const SBool s6131 = false != s6130; const SWord8 s6132 = s6131 ? s6127 : s6128; const SWord8 s6133 = s3717 ? s6129 : s6132; const SBool s6134 = (SBool) (s3753 & 1); const SBool s6135 = false != s6134; const SBool s6136 = (SBool) (s3746 & 1); const SBool s6137 = false != s6136; const SWord8 s6138 = s6137 ? s6123 : s6124; const SWord8 s6139 = (s6138 >> 1) | (s6138 << 7); const SWord8 s6140 = 128 | s6139; const SWord8 s6141 = 127 & s6139; const SWord8 s6142 = s6135 ? s6140 : s6141; const SBool s6143 = (SBool) (s3758 & 1); const SBool s6144 = false != s6143; const SWord8 s6145 = s6144 ? s6140 : s6141; const SWord8 s6146 = s3717 ? s6142 : s6145; const SWord8 s6147 = s3593 ? s6133 : s6146; const SBool s6148 = (SBool) (s3779 & 1); const SBool s6149 = false != s6148; const SBool s6150 = (SBool) (s3775 & 1); const SBool s6151 = false != s6150; const SBool s6152 = (SBool) (s3768 & 1); const SBool s6153 = false != s6152; const SWord8 s6154 = s6153 ? s6119 : s6120; const SWord8 s6155 = (s6154 >> 1) | (s6154 << 7); const SWord8 s6156 = 128 | s6155; const SWord8 s6157 = 127 & s6155; const SWord8 s6158 = s6151 ? s6156 : s6157; const SWord8 s6159 = (s6158 >> 1) | (s6158 << 7); const SWord8 s6160 = 128 | s6159; const SWord8 s6161 = 127 & s6159; const SWord8 s6162 = s6149 ? s6160 : s6161; const SBool s6163 = (SBool) (s3784 & 1); const SBool s6164 = false != s6163; const SWord8 s6165 = s6164 ? s6160 : s6161; const SWord8 s6166 = s3717 ? s6162 : s6165; const SBool s6167 = (SBool) (s3800 & 1); const SBool s6168 = false != s6167; const SBool s6169 = (SBool) (s3793 & 1); const SBool s6170 = false != s6169; const SWord8 s6171 = s6170 ? s6156 : s6157; const SWord8 s6172 = (s6171 >> 1) | (s6171 << 7); const SWord8 s6173 = 128 | s6172; const SWord8 s6174 = 127 & s6172; const SWord8 s6175 = s6168 ? s6173 : s6174; const SBool s6176 = (SBool) (s3805 & 1); const SBool s6177 = false != s6176; const SWord8 s6178 = s6177 ? s6173 : s6174; const SWord8 s6179 = s3717 ? s6175 : s6178; const SWord8 s6180 = s3593 ? s6166 : s6179; const SWord8 s6181 = s3571 ? s6147 : s6180; const SWord8 s6182 = s3060 ? s6111 : s6181; const SBool s6183 = (SBool) (s3860 & 1); const SBool s6184 = false != s6183; const SBool s6185 = (SBool) (s3856 & 1); const SBool s6186 = false != s6185; const SBool s6187 = (SBool) (s3852 & 1); const SBool s6188 = false != s6187; const SWord8 s6189 = (s3839 >> 1) | (s3839 << 7); const SWord8 s6190 = 128 | s6189; const SWord8 s6191 = 127 & s6189; const SWord8 s6192 = s6188 ? s6190 : s6191; const SWord8 s6193 = (s6192 >> 1) | (s6192 << 7); const SWord8 s6194 = 128 | s6193; const SWord8 s6195 = 127 & s6193; const SWord8 s6196 = s6186 ? s6194 : s6195; const SWord8 s6197 = (s6196 >> 1) | (s6196 << 7); const SWord8 s6198 = 128 | s6197; const SWord8 s6199 = 127 & s6197; const SWord8 s6200 = s6184 ? s6198 : s6199; const SBool s6201 = (SBool) (s3865 & 1); const SBool s6202 = false != s6201; const SWord8 s6203 = s6202 ? s6198 : s6199; const SWord8 s6204 = s3848 ? s6200 : s6203; const SBool s6205 = (SBool) (s3881 & 1); const SBool s6206 = false != s6205; const SBool s6207 = (SBool) (s3874 & 1); const SBool s6208 = false != s6207; const SWord8 s6209 = s6208 ? s6194 : s6195; const SWord8 s6210 = (s6209 >> 1) | (s6209 << 7); const SWord8 s6211 = 128 | s6210; const SWord8 s6212 = 127 & s6210; const SWord8 s6213 = s6206 ? s6211 : s6212; const SBool s6214 = (SBool) (s3886 & 1); const SBool s6215 = false != s6214; const SWord8 s6216 = s6215 ? s6211 : s6212; const SWord8 s6217 = s3848 ? s6213 : s6216; const SWord8 s6218 = s3826 ? s6204 : s6217; const SBool s6219 = (SBool) (s3907 & 1); const SBool s6220 = false != s6219; const SBool s6221 = (SBool) (s3903 & 1); const SBool s6222 = false != s6221; const SBool s6223 = (SBool) (s3896 & 1); const SBool s6224 = false != s6223; const SWord8 s6225 = s6224 ? s6190 : s6191; const SWord8 s6226 = (s6225 >> 1) | (s6225 << 7); const SWord8 s6227 = 128 | s6226; const SWord8 s6228 = 127 & s6226; const SWord8 s6229 = s6222 ? s6227 : s6228; const SWord8 s6230 = (s6229 >> 1) | (s6229 << 7); const SWord8 s6231 = 128 | s6230; const SWord8 s6232 = 127 & s6230; const SWord8 s6233 = s6220 ? s6231 : s6232; const SBool s6234 = (SBool) (s3912 & 1); const SBool s6235 = false != s6234; const SWord8 s6236 = s6235 ? s6231 : s6232; const SWord8 s6237 = s3848 ? s6233 : s6236; const SBool s6238 = (SBool) (s3928 & 1); const SBool s6239 = false != s6238; const SBool s6240 = (SBool) (s3921 & 1); const SBool s6241 = false != s6240; const SWord8 s6242 = s6241 ? s6227 : s6228; const SWord8 s6243 = (s6242 >> 1) | (s6242 << 7); const SWord8 s6244 = 128 | s6243; const SWord8 s6245 = 127 & s6243; const SWord8 s6246 = s6239 ? s6244 : s6245; const SBool s6247 = (SBool) (s3933 & 1); const SBool s6248 = false != s6247; const SWord8 s6249 = s6248 ? s6244 : s6245; const SWord8 s6250 = s3848 ? s6246 : s6249; const SWord8 s6251 = s3826 ? s6237 : s6250; const SWord8 s6252 = s3571 ? s6218 : s6251; const SBool s6253 = (SBool) (s3968 & 1); const SBool s6254 = false != s6253; const SBool s6255 = (SBool) (s3964 & 1); const SBool s6256 = false != s6255; const SBool s6257 = (SBool) (s3960 & 1); const SBool s6258 = false != s6257; const SWord8 s6259 = (s3947 >> 1) | (s3947 << 7); const SWord8 s6260 = 128 | s6259; const SWord8 s6261 = 127 & s6259; const SWord8 s6262 = s6258 ? s6260 : s6261; const SWord8 s6263 = (s6262 >> 1) | (s6262 << 7); const SWord8 s6264 = 128 | s6263; const SWord8 s6265 = 127 & s6263; const SWord8 s6266 = s6256 ? s6264 : s6265; const SWord8 s6267 = (s6266 >> 1) | (s6266 << 7); const SWord8 s6268 = 128 | s6267; const SWord8 s6269 = 127 & s6267; const SWord8 s6270 = s6254 ? s6268 : s6269; const SBool s6271 = (SBool) (s3973 & 1); const SBool s6272 = false != s6271; const SWord8 s6273 = s6272 ? s6268 : s6269; const SWord8 s6274 = s3953 ? s6270 : s6273; const SBool s6275 = (SBool) (s3989 & 1); const SBool s6276 = false != s6275; const SBool s6277 = (SBool) (s3982 & 1); const SBool s6278 = false != s6277; const SWord8 s6279 = s6278 ? s6264 : s6265; const SWord8 s6280 = (s6279 >> 1) | (s6279 << 7); const SWord8 s6281 = 128 | s6280; const SWord8 s6282 = 127 & s6280; const SWord8 s6283 = s6276 ? s6281 : s6282; const SBool s6284 = (SBool) (s3994 & 1); const SBool s6285 = false != s6284; const SWord8 s6286 = s6285 ? s6281 : s6282; const SWord8 s6287 = s3953 ? s6283 : s6286; const SWord8 s6288 = s3826 ? s6274 : s6287; const SBool s6289 = (SBool) (s4015 & 1); const SBool s6290 = false != s6289; const SBool s6291 = (SBool) (s4011 & 1); const SBool s6292 = false != s6291; const SBool s6293 = (SBool) (s4004 & 1); const SBool s6294 = false != s6293; const SWord8 s6295 = s6294 ? s6260 : s6261; const SWord8 s6296 = (s6295 >> 1) | (s6295 << 7); const SWord8 s6297 = 128 | s6296; const SWord8 s6298 = 127 & s6296; const SWord8 s6299 = s6292 ? s6297 : s6298; const SWord8 s6300 = (s6299 >> 1) | (s6299 << 7); const SWord8 s6301 = 128 | s6300; const SWord8 s6302 = 127 & s6300; const SWord8 s6303 = s6290 ? s6301 : s6302; const SBool s6304 = (SBool) (s4020 & 1); const SBool s6305 = false != s6304; const SWord8 s6306 = s6305 ? s6301 : s6302; const SWord8 s6307 = s3953 ? s6303 : s6306; const SBool s6308 = (SBool) (s4036 & 1); const SBool s6309 = false != s6308; const SBool s6310 = (SBool) (s4029 & 1); const SBool s6311 = false != s6310; const SWord8 s6312 = s6311 ? s6297 : s6298; const SWord8 s6313 = (s6312 >> 1) | (s6312 << 7); const SWord8 s6314 = 128 | s6313; const SWord8 s6315 = 127 & s6313; const SWord8 s6316 = s6309 ? s6314 : s6315; const SBool s6317 = (SBool) (s4041 & 1); const SBool s6318 = false != s6317; const SWord8 s6319 = s6318 ? s6314 : s6315; const SWord8 s6320 = s3953 ? s6316 : s6319; const SWord8 s6321 = s3826 ? s6307 : s6320; const SWord8 s6322 = s3571 ? s6288 : s6321; const SWord8 s6323 = s3060 ? s6252 : s6322; const SWord8 s6324 = s2042 ? s6182 : s6323; const SWord8 s6325 = s16 ? s6041 : s6324; const SWord8 s6326 = s11 ? s5758 : s6325; const SWord8 s6327 = s5 ? s5191 : s6326; *hi = s4056; *lo = s6327; } == END: "legatoMult.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/mapNoFailure.gold0000644000000000000000000002340513405536617020047 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s5 () Int 6) [GOOD] (define-fun s7 () Int 0) [GOOD] (define-fun s20 () Int 1) [GOOD] (define-fun s66 () Int 10) [GOOD] (define-fun s18 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "a" [GOOD] (declare-fun s1 () Int) ; tracks user variable "b" [GOOD] (declare-fun s2 () Int) ; tracks user variable "c" [GOOD] (declare-fun s57 () Int) ; tracks user variable "__internal_sbv_s57" [GOOD] (declare-fun s70 () Int) ; tracks user variable "__internal_sbv_s70" [GOOD] (declare-fun s82 () Int) ; tracks user variable "__internal_sbv_s82" [GOOD] (declare-fun s94 () Int) ; tracks user variable "__internal_sbv_s94" [GOOD] (declare-fun s106 () Int) ; tracks user variable "__internal_sbv_s106" [GOOD] (declare-fun s118 () Int) ; tracks user variable "__internal_sbv_s118" [GOOD] (declare-fun s130 () Int) ; tracks user variable "__internal_sbv_s130" [GOOD] (declare-fun s142 () Int) ; tracks user variable "__internal_sbv_s142" [GOOD] (declare-fun s154 () Int) ; tracks user variable "__internal_sbv_s154" [GOOD] (declare-fun s166 () Int) ; tracks user variable "__internal_sbv_s166" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Int (+ s0 s1)) [GOOD] (define-fun s4 () Int (+ s2 s3)) [GOOD] (define-fun s6 () Bool (= s4 s5)) [GOOD] (define-fun s8 () Bool (> s0 s7)) [GOOD] (define-fun s9 () Bool (> s1 s7)) [GOOD] (define-fun s10 () Bool (> s2 s7)) [GOOD] (define-fun s11 () Bool (and s9 s10)) [GOOD] (define-fun s12 () Bool (and s8 s11)) [GOOD] (define-fun s13 () (Seq Int) (seq.unit s0)) [GOOD] (define-fun s14 () (Seq Int) (seq.unit s1)) [GOOD] (define-fun s15 () (Seq Int) (seq.unit s2)) [GOOD] (define-fun s16 () (Seq Int) (seq.++ s14 s15)) [GOOD] (define-fun s17 () (Seq Int) (seq.++ s13 s16)) [GOOD] (define-fun s19 () Bool (= s17 s18)) [GOOD] (define-fun s21 () Int (seq.len s17)) [GOOD] (define-fun s22 () Int (- s21 s20)) [GOOD] (define-fun s23 () (Seq Int) (seq.extract s17 s20 s22)) [GOOD] (define-fun s24 () Bool (= s18 s23)) [GOOD] (define-fun s25 () Int (seq.len s23)) [GOOD] (define-fun s26 () Int (- s25 s20)) [GOOD] (define-fun s27 () (Seq Int) (seq.extract s23 s20 s26)) [GOOD] (define-fun s28 () Bool (= s18 s27)) [GOOD] (define-fun s29 () Int (seq.len s27)) [GOOD] (define-fun s30 () Int (- s29 s20)) [GOOD] (define-fun s31 () (Seq Int) (seq.extract s27 s20 s30)) [GOOD] (define-fun s32 () Bool (= s18 s31)) [GOOD] (define-fun s33 () Int (seq.len s31)) [GOOD] (define-fun s34 () Int (- s33 s20)) [GOOD] (define-fun s35 () (Seq Int) (seq.extract s31 s20 s34)) [GOOD] (define-fun s36 () Bool (= s18 s35)) [GOOD] (define-fun s37 () Int (seq.len s35)) [GOOD] (define-fun s38 () Int (- s37 s20)) [GOOD] (define-fun s39 () (Seq Int) (seq.extract s35 s20 s38)) [GOOD] (define-fun s40 () Bool (= s18 s39)) [GOOD] (define-fun s41 () Int (seq.len s39)) [GOOD] (define-fun s42 () Int (- s41 s20)) [GOOD] (define-fun s43 () (Seq Int) (seq.extract s39 s20 s42)) [GOOD] (define-fun s44 () Bool (= s18 s43)) [GOOD] (define-fun s45 () Int (seq.len s43)) [GOOD] (define-fun s46 () Int (- s45 s20)) [GOOD] (define-fun s47 () (Seq Int) (seq.extract s43 s20 s46)) [GOOD] (define-fun s48 () Bool (= s18 s47)) [GOOD] (define-fun s49 () Int (seq.len s47)) [GOOD] (define-fun s50 () Int (- s49 s20)) [GOOD] (define-fun s51 () (Seq Int) (seq.extract s47 s20 s50)) [GOOD] (define-fun s52 () Bool (= s18 s51)) [GOOD] (define-fun s53 () Int (seq.len s51)) [GOOD] (define-fun s54 () Int (- s53 s20)) [GOOD] (define-fun s55 () (Seq Int) (seq.extract s51 s20 s54)) [GOOD] (define-fun s56 () Bool (= s18 s55)) [GOOD] (define-fun s58 () (Seq Int) (seq.unit s57)) [GOOD] (define-fun s59 () Int (seq.len s55)) [GOOD] (define-fun s60 () Bool (> s59 s7)) [GOOD] (define-fun s61 () Bool (not s60)) [GOOD] (define-fun s62 () (Seq Int) (seq.extract s55 s7 s20)) [GOOD] (define-fun s63 () Bool (= s58 s62)) [GOOD] (define-fun s64 () Bool (or s61 s63)) [GOOD] (define-fun s65 () Bool (< s57 s7)) [GOOD] (define-fun s67 () Bool (> s57 s66)) [GOOD] (define-fun s68 () Bool (or s65 s67)) [GOOD] (define-fun s69 () Bool (ite s56 s_2 s68)) [GOOD] (define-fun s71 () (Seq Int) (seq.unit s70)) [GOOD] (define-fun s72 () Bool (> s53 s7)) [GOOD] (define-fun s73 () Bool (not s72)) [GOOD] (define-fun s74 () (Seq Int) (seq.extract s51 s7 s20)) [GOOD] (define-fun s75 () Bool (= s71 s74)) [GOOD] (define-fun s76 () Bool (or s73 s75)) [GOOD] (define-fun s77 () Bool (< s70 s7)) [GOOD] (define-fun s78 () Bool (> s70 s66)) [GOOD] (define-fun s79 () Bool (or s77 s78)) [GOOD] (define-fun s80 () Bool (or s69 s79)) [GOOD] (define-fun s81 () Bool (ite s52 s_2 s80)) [GOOD] (define-fun s83 () (Seq Int) (seq.unit s82)) [GOOD] (define-fun s84 () Bool (> s49 s7)) [GOOD] (define-fun s85 () Bool (not s84)) [GOOD] (define-fun s86 () (Seq Int) (seq.extract s47 s7 s20)) [GOOD] (define-fun s87 () Bool (= s83 s86)) [GOOD] (define-fun s88 () Bool (or s85 s87)) [GOOD] (define-fun s89 () Bool (< s82 s7)) [GOOD] (define-fun s90 () Bool (> s82 s66)) [GOOD] (define-fun s91 () Bool (or s89 s90)) [GOOD] (define-fun s92 () Bool (or s81 s91)) [GOOD] (define-fun s93 () Bool (ite s48 s_2 s92)) [GOOD] (define-fun s95 () (Seq Int) (seq.unit s94)) [GOOD] (define-fun s96 () Bool (> s45 s7)) [GOOD] (define-fun s97 () Bool (not s96)) [GOOD] (define-fun s98 () (Seq Int) (seq.extract s43 s7 s20)) [GOOD] (define-fun s99 () Bool (= s95 s98)) [GOOD] (define-fun s100 () Bool (or s97 s99)) [GOOD] (define-fun s101 () Bool (< s94 s7)) [GOOD] (define-fun s102 () Bool (> s94 s66)) [GOOD] (define-fun s103 () Bool (or s101 s102)) [GOOD] (define-fun s104 () Bool (or s93 s103)) [GOOD] (define-fun s105 () Bool (ite s44 s_2 s104)) [GOOD] (define-fun s107 () (Seq Int) (seq.unit s106)) [GOOD] (define-fun s108 () Bool (> s41 s7)) [GOOD] (define-fun s109 () Bool (not s108)) [GOOD] (define-fun s110 () (Seq Int) (seq.extract s39 s7 s20)) [GOOD] (define-fun s111 () Bool (= s107 s110)) [GOOD] (define-fun s112 () Bool (or s109 s111)) [GOOD] (define-fun s113 () Bool (< s106 s7)) [GOOD] (define-fun s114 () Bool (> s106 s66)) [GOOD] (define-fun s115 () Bool (or s113 s114)) [GOOD] (define-fun s116 () Bool (or s105 s115)) [GOOD] (define-fun s117 () Bool (ite s40 s_2 s116)) [GOOD] (define-fun s119 () (Seq Int) (seq.unit s118)) [GOOD] (define-fun s120 () Bool (> s37 s7)) [GOOD] (define-fun s121 () Bool (not s120)) [GOOD] (define-fun s122 () (Seq Int) (seq.extract s35 s7 s20)) [GOOD] (define-fun s123 () Bool (= s119 s122)) [GOOD] (define-fun s124 () Bool (or s121 s123)) [GOOD] (define-fun s125 () Bool (< s118 s7)) [GOOD] (define-fun s126 () Bool (> s118 s66)) [GOOD] (define-fun s127 () Bool (or s125 s126)) [GOOD] (define-fun s128 () Bool (or s117 s127)) [GOOD] (define-fun s129 () Bool (ite s36 s_2 s128)) [GOOD] (define-fun s131 () (Seq Int) (seq.unit s130)) [GOOD] (define-fun s132 () Bool (> s33 s7)) [GOOD] (define-fun s133 () Bool (not s132)) [GOOD] (define-fun s134 () (Seq Int) (seq.extract s31 s7 s20)) [GOOD] (define-fun s135 () Bool (= s131 s134)) [GOOD] (define-fun s136 () Bool (or s133 s135)) [GOOD] (define-fun s137 () Bool (< s130 s7)) [GOOD] (define-fun s138 () Bool (> s130 s66)) [GOOD] (define-fun s139 () Bool (or s137 s138)) [GOOD] (define-fun s140 () Bool (or s129 s139)) [GOOD] (define-fun s141 () Bool (ite s32 s_2 s140)) [GOOD] (define-fun s143 () (Seq Int) (seq.unit s142)) [GOOD] (define-fun s144 () Bool (> s29 s7)) [GOOD] (define-fun s145 () Bool (not s144)) [GOOD] (define-fun s146 () (Seq Int) (seq.extract s27 s7 s20)) [GOOD] (define-fun s147 () Bool (= s143 s146)) [GOOD] (define-fun s148 () Bool (or s145 s147)) [GOOD] (define-fun s149 () Bool (< s142 s7)) [GOOD] (define-fun s150 () Bool (> s142 s66)) [GOOD] (define-fun s151 () Bool (or s149 s150)) [GOOD] (define-fun s152 () Bool (or s141 s151)) [GOOD] (define-fun s153 () Bool (ite s28 s_2 s152)) [GOOD] (define-fun s155 () (Seq Int) (seq.unit s154)) [GOOD] (define-fun s156 () Bool (> s25 s7)) [GOOD] (define-fun s157 () Bool (not s156)) [GOOD] (define-fun s158 () (Seq Int) (seq.extract s23 s7 s20)) [GOOD] (define-fun s159 () Bool (= s155 s158)) [GOOD] (define-fun s160 () Bool (or s157 s159)) [GOOD] (define-fun s161 () Bool (< s154 s7)) [GOOD] (define-fun s162 () Bool (> s154 s66)) [GOOD] (define-fun s163 () Bool (or s161 s162)) [GOOD] (define-fun s164 () Bool (or s153 s163)) [GOOD] (define-fun s165 () Bool (ite s24 s_2 s164)) [GOOD] (define-fun s167 () (Seq Int) (seq.unit s166)) [GOOD] (define-fun s168 () Bool (> s21 s7)) [GOOD] (define-fun s169 () Bool (not s168)) [GOOD] (define-fun s170 () (Seq Int) (seq.extract s17 s7 s20)) [GOOD] (define-fun s171 () Bool (= s167 s170)) [GOOD] (define-fun s172 () Bool (or s169 s171)) [GOOD] (define-fun s173 () Bool (< s166 s7)) [GOOD] (define-fun s174 () Bool (> s166 s66)) [GOOD] (define-fun s175 () Bool (or s173 s174)) [GOOD] (define-fun s176 () Bool (or s165 s175)) [GOOD] (define-fun s177 () Bool (ite s19 s_2 s176)) [GOOD] (assert s6) [GOOD] (assert s12) [GOOD] (assert s64) [GOOD] (assert s76) [GOOD] (assert s88) [GOOD] (assert s100) [GOOD] (assert s112) [GOOD] (assert s124) [GOOD] (assert s136) [GOOD] (assert s148) [GOOD] (assert s160) [GOOD] (assert s172) [GOOD] (assert s177) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/mapWithFailure.gold0000644000000000000000000002712713405536617020413 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s8 () Int 0) [GOOD] (define-fun s11 () Int 1) [GOOD] (define-fun s154 () Int 2) [GOOD] (define-fun s160 () Int 11) [GOOD] (define-fun s164 () Int 10) [GOOD] (define-fun s3 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (Seq Int)) ; tracks user variable "ints" [GOOD] (declare-fun s1 () Int) ; tracks user variable "__internal_sbv_s1" [GOOD] (declare-fun s5 () Int) ; tracks user variable "__internal_sbv_s5" [GOOD] (declare-fun s20 () Int) ; tracks user variable "__internal_sbv_s20" [GOOD] (declare-fun s33 () Int) ; tracks user variable "__internal_sbv_s33" [GOOD] (declare-fun s46 () Int) ; tracks user variable "__internal_sbv_s46" [GOOD] (declare-fun s59 () Int) ; tracks user variable "__internal_sbv_s59" [GOOD] (declare-fun s72 () Int) ; tracks user variable "__internal_sbv_s72" [GOOD] (declare-fun s85 () Int) ; tracks user variable "__internal_sbv_s85" [GOOD] (declare-fun s98 () Int) ; tracks user variable "__internal_sbv_s98" [GOOD] (declare-fun s111 () Int) ; tracks user variable "__internal_sbv_s111" [GOOD] (declare-fun s124 () Int) ; tracks user variable "__internal_sbv_s124" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () (Seq Int) (seq.unit s1)) [GOOD] (define-fun s4 () Bool (= s0 s3)) [GOOD] (define-fun s6 () (Seq Int) (seq.unit s5)) [GOOD] (define-fun s7 () Int (seq.len s0)) [GOOD] (define-fun s9 () Bool (> s7 s8)) [GOOD] (define-fun s10 () Bool (not s9)) [GOOD] (define-fun s12 () (Seq Int) (seq.extract s0 s8 s11)) [GOOD] (define-fun s13 () Bool (= s6 s12)) [GOOD] (define-fun s14 () Bool (or s10 s13)) [GOOD] (define-fun s15 () Int (+ s5 s11)) [GOOD] (define-fun s16 () (Seq Int) (seq.unit s15)) [GOOD] (define-fun s17 () Int (- s7 s11)) [GOOD] (define-fun s18 () (Seq Int) (seq.extract s0 s11 s17)) [GOOD] (define-fun s19 () Bool (= s3 s18)) [GOOD] (define-fun s21 () (Seq Int) (seq.unit s20)) [GOOD] (define-fun s22 () Int (seq.len s18)) [GOOD] (define-fun s23 () Bool (> s22 s8)) [GOOD] (define-fun s24 () Bool (not s23)) [GOOD] (define-fun s25 () (Seq Int) (seq.extract s18 s8 s11)) [GOOD] (define-fun s26 () Bool (= s21 s25)) [GOOD] (define-fun s27 () Bool (or s24 s26)) [GOOD] (define-fun s28 () Int (+ s11 s20)) [GOOD] (define-fun s29 () (Seq Int) (seq.unit s28)) [GOOD] (define-fun s30 () Int (- s22 s11)) [GOOD] (define-fun s31 () (Seq Int) (seq.extract s18 s11 s30)) [GOOD] (define-fun s32 () Bool (= s3 s31)) [GOOD] (define-fun s34 () (Seq Int) (seq.unit s33)) [GOOD] (define-fun s35 () Int (seq.len s31)) [GOOD] (define-fun s36 () Bool (> s35 s8)) [GOOD] (define-fun s37 () Bool (not s36)) [GOOD] (define-fun s38 () (Seq Int) (seq.extract s31 s8 s11)) [GOOD] (define-fun s39 () Bool (= s34 s38)) [GOOD] (define-fun s40 () Bool (or s37 s39)) [GOOD] (define-fun s41 () Int (+ s11 s33)) [GOOD] (define-fun s42 () (Seq Int) (seq.unit s41)) [GOOD] (define-fun s43 () Int (- s35 s11)) [GOOD] (define-fun s44 () (Seq Int) (seq.extract s31 s11 s43)) [GOOD] (define-fun s45 () Bool (= s3 s44)) [GOOD] (define-fun s47 () (Seq Int) (seq.unit s46)) [GOOD] (define-fun s48 () Int (seq.len s44)) [GOOD] (define-fun s49 () Bool (> s48 s8)) [GOOD] (define-fun s50 () Bool (not s49)) [GOOD] (define-fun s51 () (Seq Int) (seq.extract s44 s8 s11)) [GOOD] (define-fun s52 () Bool (= s47 s51)) [GOOD] (define-fun s53 () Bool (or s50 s52)) [GOOD] (define-fun s54 () Int (+ s11 s46)) [GOOD] (define-fun s55 () (Seq Int) (seq.unit s54)) [GOOD] (define-fun s56 () Int (- s48 s11)) [GOOD] (define-fun s57 () (Seq Int) (seq.extract s44 s11 s56)) [GOOD] (define-fun s58 () Bool (= s3 s57)) [GOOD] (define-fun s60 () (Seq Int) (seq.unit s59)) [GOOD] (define-fun s61 () Int (seq.len s57)) [GOOD] (define-fun s62 () Bool (> s61 s8)) [GOOD] (define-fun s63 () Bool (not s62)) [GOOD] (define-fun s64 () (Seq Int) (seq.extract s57 s8 s11)) [GOOD] (define-fun s65 () Bool (= s60 s64)) [GOOD] (define-fun s66 () Bool (or s63 s65)) [GOOD] (define-fun s67 () Int (+ s11 s59)) [GOOD] (define-fun s68 () (Seq Int) (seq.unit s67)) [GOOD] (define-fun s69 () Int (- s61 s11)) [GOOD] (define-fun s70 () (Seq Int) (seq.extract s57 s11 s69)) [GOOD] (define-fun s71 () Bool (= s3 s70)) [GOOD] (define-fun s73 () (Seq Int) (seq.unit s72)) [GOOD] (define-fun s74 () Int (seq.len s70)) [GOOD] (define-fun s75 () Bool (> s74 s8)) [GOOD] (define-fun s76 () Bool (not s75)) [GOOD] (define-fun s77 () (Seq Int) (seq.extract s70 s8 s11)) [GOOD] (define-fun s78 () Bool (= s73 s77)) [GOOD] (define-fun s79 () Bool (or s76 s78)) [GOOD] (define-fun s80 () Int (+ s11 s72)) [GOOD] (define-fun s81 () (Seq Int) (seq.unit s80)) [GOOD] (define-fun s82 () Int (- s74 s11)) [GOOD] (define-fun s83 () (Seq Int) (seq.extract s70 s11 s82)) [GOOD] (define-fun s84 () Bool (= s3 s83)) [GOOD] (define-fun s86 () (Seq Int) (seq.unit s85)) [GOOD] (define-fun s87 () Int (seq.len s83)) [GOOD] (define-fun s88 () Bool (> s87 s8)) [GOOD] (define-fun s89 () Bool (not s88)) [GOOD] (define-fun s90 () (Seq Int) (seq.extract s83 s8 s11)) [GOOD] (define-fun s91 () Bool (= s86 s90)) [GOOD] (define-fun s92 () Bool (or s89 s91)) [GOOD] (define-fun s93 () Int (+ s11 s85)) [GOOD] (define-fun s94 () (Seq Int) (seq.unit s93)) [GOOD] (define-fun s95 () Int (- s87 s11)) [GOOD] (define-fun s96 () (Seq Int) (seq.extract s83 s11 s95)) [GOOD] (define-fun s97 () Bool (= s3 s96)) [GOOD] (define-fun s99 () (Seq Int) (seq.unit s98)) [GOOD] (define-fun s100 () Int (seq.len s96)) [GOOD] (define-fun s101 () Bool (> s100 s8)) [GOOD] (define-fun s102 () Bool (not s101)) [GOOD] (define-fun s103 () (Seq Int) (seq.extract s96 s8 s11)) [GOOD] (define-fun s104 () Bool (= s99 s103)) [GOOD] (define-fun s105 () Bool (or s102 s104)) [GOOD] (define-fun s106 () Int (+ s11 s98)) [GOOD] (define-fun s107 () (Seq Int) (seq.unit s106)) [GOOD] (define-fun s108 () Int (- s100 s11)) [GOOD] (define-fun s109 () (Seq Int) (seq.extract s96 s11 s108)) [GOOD] (define-fun s110 () Bool (= s3 s109)) [GOOD] (define-fun s112 () (Seq Int) (seq.unit s111)) [GOOD] (define-fun s113 () Int (seq.len s109)) [GOOD] (define-fun s114 () Bool (> s113 s8)) [GOOD] (define-fun s115 () Bool (not s114)) [GOOD] (define-fun s116 () (Seq Int) (seq.extract s109 s8 s11)) [GOOD] (define-fun s117 () Bool (= s112 s116)) [GOOD] (define-fun s118 () Bool (or s115 s117)) [GOOD] (define-fun s119 () Int (+ s11 s111)) [GOOD] (define-fun s120 () (Seq Int) (seq.unit s119)) [GOOD] (define-fun s121 () Int (- s113 s11)) [GOOD] (define-fun s122 () (Seq Int) (seq.extract s109 s11 s121)) [GOOD] (define-fun s123 () Bool (= s3 s122)) [GOOD] (define-fun s125 () (Seq Int) (seq.unit s124)) [GOOD] (define-fun s126 () Int (seq.len s122)) [GOOD] (define-fun s127 () Bool (> s126 s8)) [GOOD] (define-fun s128 () Bool (not s127)) [GOOD] (define-fun s129 () (Seq Int) (seq.extract s122 s8 s11)) [GOOD] (define-fun s130 () Bool (= s125 s129)) [GOOD] (define-fun s131 () Bool (or s128 s130)) [GOOD] (define-fun s132 () Int (+ s11 s124)) [GOOD] (define-fun s133 () (Seq Int) (seq.unit s132)) [GOOD] (define-fun s134 () (Seq Int) (ite s123 s3 s133)) [GOOD] (define-fun s135 () (Seq Int) (seq.++ s120 s134)) [GOOD] (define-fun s136 () (Seq Int) (ite s110 s3 s135)) [GOOD] (define-fun s137 () (Seq Int) (seq.++ s107 s136)) [GOOD] (define-fun s138 () (Seq Int) (ite s97 s3 s137)) [GOOD] (define-fun s139 () (Seq Int) (seq.++ s94 s138)) [GOOD] (define-fun s140 () (Seq Int) (ite s84 s3 s139)) [GOOD] (define-fun s141 () (Seq Int) (seq.++ s81 s140)) [GOOD] (define-fun s142 () (Seq Int) (ite s71 s3 s141)) [GOOD] (define-fun s143 () (Seq Int) (seq.++ s68 s142)) [GOOD] (define-fun s144 () (Seq Int) (ite s58 s3 s143)) [GOOD] (define-fun s145 () (Seq Int) (seq.++ s55 s144)) [GOOD] (define-fun s146 () (Seq Int) (ite s45 s3 s145)) [GOOD] (define-fun s147 () (Seq Int) (seq.++ s42 s146)) [GOOD] (define-fun s148 () (Seq Int) (ite s32 s3 s147)) [GOOD] (define-fun s149 () (Seq Int) (seq.++ s29 s148)) [GOOD] (define-fun s150 () (Seq Int) (ite s19 s3 s149)) [GOOD] (define-fun s151 () (Seq Int) (seq.++ s16 s150)) [GOOD] (define-fun s152 () (Seq Int) (ite s4 s3 s151)) [GOOD] (define-fun s153 () Int (seq.len s152)) [GOOD] (define-fun s155 () Bool (> s153 s154)) [GOOD] (define-fun s156 () Bool (not s155)) [GOOD] (define-fun s157 () (Seq Int) (seq.extract s152 s154 s11)) [GOOD] (define-fun s158 () Bool (= s2 s157)) [GOOD] (define-fun s159 () Bool (or s156 s158)) [GOOD] (define-fun s161 () Bool (> s1 s160)) [GOOD] (define-fun s162 () Bool (not s161)) [GOOD] (define-fun s163 () Bool (< s124 s8)) [GOOD] (define-fun s165 () Bool (> s124 s164)) [GOOD] (define-fun s166 () Bool (or s163 s165)) [GOOD] (define-fun s167 () Bool (ite s123 s_2 s166)) [GOOD] (define-fun s168 () Bool (< s111 s8)) [GOOD] (define-fun s169 () Bool (> s111 s164)) [GOOD] (define-fun s170 () Bool (or s168 s169)) [GOOD] (define-fun s171 () Bool (or s167 s170)) [GOOD] (define-fun s172 () Bool (ite s110 s_2 s171)) [GOOD] (define-fun s173 () Bool (< s98 s8)) [GOOD] (define-fun s174 () Bool (> s98 s164)) [GOOD] (define-fun s175 () Bool (or s173 s174)) [GOOD] (define-fun s176 () Bool (or s172 s175)) [GOOD] (define-fun s177 () Bool (ite s97 s_2 s176)) [GOOD] (define-fun s178 () Bool (< s85 s8)) [GOOD] (define-fun s179 () Bool (> s85 s164)) [GOOD] (define-fun s180 () Bool (or s178 s179)) [GOOD] (define-fun s181 () Bool (or s177 s180)) [GOOD] (define-fun s182 () Bool (ite s84 s_2 s181)) [GOOD] (define-fun s183 () Bool (< s72 s8)) [GOOD] (define-fun s184 () Bool (> s72 s164)) [GOOD] (define-fun s185 () Bool (or s183 s184)) [GOOD] (define-fun s186 () Bool (or s182 s185)) [GOOD] (define-fun s187 () Bool (ite s71 s_2 s186)) [GOOD] (define-fun s188 () Bool (< s59 s8)) [GOOD] (define-fun s189 () Bool (> s59 s164)) [GOOD] (define-fun s190 () Bool (or s188 s189)) [GOOD] (define-fun s191 () Bool (or s187 s190)) [GOOD] (define-fun s192 () Bool (ite s58 s_2 s191)) [GOOD] (define-fun s193 () Bool (< s46 s8)) [GOOD] (define-fun s194 () Bool (> s46 s164)) [GOOD] (define-fun s195 () Bool (or s193 s194)) [GOOD] (define-fun s196 () Bool (or s192 s195)) [GOOD] (define-fun s197 () Bool (ite s45 s_2 s196)) [GOOD] (define-fun s198 () Bool (< s33 s8)) [GOOD] (define-fun s199 () Bool (> s33 s164)) [GOOD] (define-fun s200 () Bool (or s198 s199)) [GOOD] (define-fun s201 () Bool (or s197 s200)) [GOOD] (define-fun s202 () Bool (ite s32 s_2 s201)) [GOOD] (define-fun s203 () Bool (< s20 s8)) [GOOD] (define-fun s204 () Bool (> s20 s164)) [GOOD] (define-fun s205 () Bool (or s203 s204)) [GOOD] (define-fun s206 () Bool (or s202 s205)) [GOOD] (define-fun s207 () Bool (ite s19 s_2 s206)) [GOOD] (define-fun s208 () Bool (< s5 s8)) [GOOD] (define-fun s209 () Bool (> s5 s164)) [GOOD] (define-fun s210 () Bool (or s208 s209)) [GOOD] (define-fun s211 () Bool (or s207 s210)) [GOOD] (define-fun s212 () Bool (ite s4 s_2 s211)) [GOOD] (define-fun s213 () Bool (or s162 s212)) [GOOD] (assert s14) [GOOD] (assert s27) [GOOD] (assert s40) [GOOD] (assert s53) [GOOD] (assert s66) [GOOD] (assert s79) [GOOD] (assert s92) [GOOD] (assert s105) [GOOD] (assert s118) [GOOD] (assert s131) [GOOD] (assert s159) [GOOD] (assert s213) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/maxlWithFailure.gold0000644000000000000000000002501213405536617020566 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s3 () Int 0) [GOOD] (define-fun s4 () Int 1) [GOOD] (define-fun s142 () Int 10) [GOOD] (define-fun s1 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (Seq Int)) ; tracks user variable "ints" [GOOD] (declare-fun s9 () Int) ; tracks user variable "__internal_sbv_s9" [GOOD] (declare-fun s22 () Int) ; tracks user variable "__internal_sbv_s22" [GOOD] (declare-fun s35 () Int) ; tracks user variable "__internal_sbv_s35" [GOOD] (declare-fun s48 () Int) ; tracks user variable "__internal_sbv_s48" [GOOD] (declare-fun s61 () Int) ; tracks user variable "__internal_sbv_s61" [GOOD] (declare-fun s74 () Int) ; tracks user variable "__internal_sbv_s74" [GOOD] (declare-fun s87 () Int) ; tracks user variable "__internal_sbv_s87" [GOOD] (declare-fun s100 () Int) ; tracks user variable "__internal_sbv_s100" [GOOD] (declare-fun s113 () Int) ; tracks user variable "__internal_sbv_s113" [GOOD] (declare-fun s122 () Int) ; tracks user variable "__internal_sbv_s122" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (= s0 s1)) [GOOD] (define-fun s5 () Int (seq.len s0)) [GOOD] (define-fun s6 () Int (- s5 s4)) [GOOD] (define-fun s7 () (Seq Int) (seq.extract s0 s4 s6)) [GOOD] (define-fun s8 () Bool (= s1 s7)) [GOOD] (define-fun s10 () (Seq Int) (seq.unit s9)) [GOOD] (define-fun s11 () Bool (> s5 s3)) [GOOD] (define-fun s12 () Bool (not s11)) [GOOD] (define-fun s13 () (Seq Int) (seq.extract s0 s3 s4)) [GOOD] (define-fun s14 () Bool (= s10 s13)) [GOOD] (define-fun s15 () Bool (or s12 s14)) [GOOD] (define-fun s16 () Bool (<= s9 s3)) [GOOD] (define-fun s17 () Int (ite s16 s3 s9)) [GOOD] (define-fun s18 () Int (seq.len s7)) [GOOD] (define-fun s19 () Int (- s18 s4)) [GOOD] (define-fun s20 () (Seq Int) (seq.extract s7 s4 s19)) [GOOD] (define-fun s21 () Bool (= s1 s20)) [GOOD] (define-fun s23 () (Seq Int) (seq.unit s22)) [GOOD] (define-fun s24 () Bool (> s18 s3)) [GOOD] (define-fun s25 () Bool (not s24)) [GOOD] (define-fun s26 () (Seq Int) (seq.extract s7 s3 s4)) [GOOD] (define-fun s27 () Bool (= s23 s26)) [GOOD] (define-fun s28 () Bool (or s25 s27)) [GOOD] (define-fun s29 () Bool (<= s22 s17)) [GOOD] (define-fun s30 () Int (ite s29 s17 s22)) [GOOD] (define-fun s31 () Int (seq.len s20)) [GOOD] (define-fun s32 () Int (- s31 s4)) [GOOD] (define-fun s33 () (Seq Int) (seq.extract s20 s4 s32)) [GOOD] (define-fun s34 () Bool (= s1 s33)) [GOOD] (define-fun s36 () (Seq Int) (seq.unit s35)) [GOOD] (define-fun s37 () Bool (> s31 s3)) [GOOD] (define-fun s38 () Bool (not s37)) [GOOD] (define-fun s39 () (Seq Int) (seq.extract s20 s3 s4)) [GOOD] (define-fun s40 () Bool (= s36 s39)) [GOOD] (define-fun s41 () Bool (or s38 s40)) [GOOD] (define-fun s42 () Bool (<= s35 s30)) [GOOD] (define-fun s43 () Int (ite s42 s30 s35)) [GOOD] (define-fun s44 () Int (seq.len s33)) [GOOD] (define-fun s45 () Int (- s44 s4)) [GOOD] (define-fun s46 () (Seq Int) (seq.extract s33 s4 s45)) [GOOD] (define-fun s47 () Bool (= s1 s46)) [GOOD] (define-fun s49 () (Seq Int) (seq.unit s48)) [GOOD] (define-fun s50 () Bool (> s44 s3)) [GOOD] (define-fun s51 () Bool (not s50)) [GOOD] (define-fun s52 () (Seq Int) (seq.extract s33 s3 s4)) [GOOD] (define-fun s53 () Bool (= s49 s52)) [GOOD] (define-fun s54 () Bool (or s51 s53)) [GOOD] (define-fun s55 () Bool (<= s48 s43)) [GOOD] (define-fun s56 () Int (ite s55 s43 s48)) [GOOD] (define-fun s57 () Int (seq.len s46)) [GOOD] (define-fun s58 () Int (- s57 s4)) [GOOD] (define-fun s59 () (Seq Int) (seq.extract s46 s4 s58)) [GOOD] (define-fun s60 () Bool (= s1 s59)) [GOOD] (define-fun s62 () (Seq Int) (seq.unit s61)) [GOOD] (define-fun s63 () Bool (> s57 s3)) [GOOD] (define-fun s64 () Bool (not s63)) [GOOD] (define-fun s65 () (Seq Int) (seq.extract s46 s3 s4)) [GOOD] (define-fun s66 () Bool (= s62 s65)) [GOOD] (define-fun s67 () Bool (or s64 s66)) [GOOD] (define-fun s68 () Bool (<= s61 s56)) [GOOD] (define-fun s69 () Int (ite s68 s56 s61)) [GOOD] (define-fun s70 () Int (seq.len s59)) [GOOD] (define-fun s71 () Int (- s70 s4)) [GOOD] (define-fun s72 () (Seq Int) (seq.extract s59 s4 s71)) [GOOD] (define-fun s73 () Bool (= s1 s72)) [GOOD] (define-fun s75 () (Seq Int) (seq.unit s74)) [GOOD] (define-fun s76 () Bool (> s70 s3)) [GOOD] (define-fun s77 () Bool (not s76)) [GOOD] (define-fun s78 () (Seq Int) (seq.extract s59 s3 s4)) [GOOD] (define-fun s79 () Bool (= s75 s78)) [GOOD] (define-fun s80 () Bool (or s77 s79)) [GOOD] (define-fun s81 () Bool (<= s74 s69)) [GOOD] (define-fun s82 () Int (ite s81 s69 s74)) [GOOD] (define-fun s83 () Int (seq.len s72)) [GOOD] (define-fun s84 () Int (- s83 s4)) [GOOD] (define-fun s85 () (Seq Int) (seq.extract s72 s4 s84)) [GOOD] (define-fun s86 () Bool (= s1 s85)) [GOOD] (define-fun s88 () (Seq Int) (seq.unit s87)) [GOOD] (define-fun s89 () Bool (> s83 s3)) [GOOD] (define-fun s90 () Bool (not s89)) [GOOD] (define-fun s91 () (Seq Int) (seq.extract s72 s3 s4)) [GOOD] (define-fun s92 () Bool (= s88 s91)) [GOOD] (define-fun s93 () Bool (or s90 s92)) [GOOD] (define-fun s94 () Bool (<= s87 s82)) [GOOD] (define-fun s95 () Int (ite s94 s82 s87)) [GOOD] (define-fun s96 () Int (seq.len s85)) [GOOD] (define-fun s97 () Int (- s96 s4)) [GOOD] (define-fun s98 () (Seq Int) (seq.extract s85 s4 s97)) [GOOD] (define-fun s99 () Bool (= s1 s98)) [GOOD] (define-fun s101 () (Seq Int) (seq.unit s100)) [GOOD] (define-fun s102 () Bool (> s96 s3)) [GOOD] (define-fun s103 () Bool (not s102)) [GOOD] (define-fun s104 () (Seq Int) (seq.extract s85 s3 s4)) [GOOD] (define-fun s105 () Bool (= s101 s104)) [GOOD] (define-fun s106 () Bool (or s103 s105)) [GOOD] (define-fun s107 () Bool (<= s100 s95)) [GOOD] (define-fun s108 () Int (ite s107 s95 s100)) [GOOD] (define-fun s109 () Int (seq.len s98)) [GOOD] (define-fun s110 () Int (- s109 s4)) [GOOD] (define-fun s111 () (Seq Int) (seq.extract s98 s4 s110)) [GOOD] (define-fun s112 () Bool (= s1 s111)) [GOOD] (define-fun s114 () (Seq Int) (seq.unit s113)) [GOOD] (define-fun s115 () Bool (> s109 s3)) [GOOD] (define-fun s116 () Bool (not s115)) [GOOD] (define-fun s117 () (Seq Int) (seq.extract s98 s3 s4)) [GOOD] (define-fun s118 () Bool (= s114 s117)) [GOOD] (define-fun s119 () Bool (or s116 s118)) [GOOD] (define-fun s120 () Bool (<= s113 s108)) [GOOD] (define-fun s121 () Int (ite s120 s108 s113)) [GOOD] (define-fun s123 () (Seq Int) (seq.unit s122)) [GOOD] (define-fun s124 () Int (seq.len s111)) [GOOD] (define-fun s125 () Bool (> s124 s3)) [GOOD] (define-fun s126 () Bool (not s125)) [GOOD] (define-fun s127 () (Seq Int) (seq.extract s111 s3 s4)) [GOOD] (define-fun s128 () Bool (= s123 s127)) [GOOD] (define-fun s129 () Bool (or s126 s128)) [GOOD] (define-fun s130 () Bool (<= s122 s121)) [GOOD] (define-fun s131 () Int (ite s130 s121 s122)) [GOOD] (define-fun s132 () Int (ite s112 s121 s131)) [GOOD] (define-fun s133 () Int (ite s99 s108 s132)) [GOOD] (define-fun s134 () Int (ite s86 s95 s133)) [GOOD] (define-fun s135 () Int (ite s73 s82 s134)) [GOOD] (define-fun s136 () Int (ite s60 s69 s135)) [GOOD] (define-fun s137 () Int (ite s47 s56 s136)) [GOOD] (define-fun s138 () Int (ite s34 s43 s137)) [GOOD] (define-fun s139 () Int (ite s21 s30 s138)) [GOOD] (define-fun s140 () Int (ite s8 s17 s139)) [GOOD] (define-fun s141 () Int (ite s2 s3 s140)) [GOOD] (define-fun s143 () Bool (> s141 s142)) [GOOD] (define-fun s144 () Bool (not s143)) [GOOD] (define-fun s145 () Bool (< s9 s3)) [GOOD] (define-fun s146 () Bool (> s9 s142)) [GOOD] (define-fun s147 () Bool (or s145 s146)) [GOOD] (define-fun s148 () Bool (< s22 s3)) [GOOD] (define-fun s149 () Bool (> s22 s142)) [GOOD] (define-fun s150 () Bool (or s148 s149)) [GOOD] (define-fun s151 () Bool (or s147 s150)) [GOOD] (define-fun s152 () Bool (< s35 s3)) [GOOD] (define-fun s153 () Bool (> s35 s142)) [GOOD] (define-fun s154 () Bool (or s152 s153)) [GOOD] (define-fun s155 () Bool (or s151 s154)) [GOOD] (define-fun s156 () Bool (< s48 s3)) [GOOD] (define-fun s157 () Bool (> s48 s142)) [GOOD] (define-fun s158 () Bool (or s156 s157)) [GOOD] (define-fun s159 () Bool (or s155 s158)) [GOOD] (define-fun s160 () Bool (< s61 s3)) [GOOD] (define-fun s161 () Bool (> s61 s142)) [GOOD] (define-fun s162 () Bool (or s160 s161)) [GOOD] (define-fun s163 () Bool (or s159 s162)) [GOOD] (define-fun s164 () Bool (< s74 s3)) [GOOD] (define-fun s165 () Bool (> s74 s142)) [GOOD] (define-fun s166 () Bool (or s164 s165)) [GOOD] (define-fun s167 () Bool (or s163 s166)) [GOOD] (define-fun s168 () Bool (< s87 s3)) [GOOD] (define-fun s169 () Bool (> s87 s142)) [GOOD] (define-fun s170 () Bool (or s168 s169)) [GOOD] (define-fun s171 () Bool (or s167 s170)) [GOOD] (define-fun s172 () Bool (< s100 s3)) [GOOD] (define-fun s173 () Bool (> s100 s142)) [GOOD] (define-fun s174 () Bool (or s172 s173)) [GOOD] (define-fun s175 () Bool (or s171 s174)) [GOOD] (define-fun s176 () Bool (< s113 s3)) [GOOD] (define-fun s177 () Bool (> s113 s142)) [GOOD] (define-fun s178 () Bool (or s176 s177)) [GOOD] (define-fun s179 () Bool (or s175 s178)) [GOOD] (define-fun s180 () Bool (< s122 s3)) [GOOD] (define-fun s181 () Bool (> s122 s142)) [GOOD] (define-fun s182 () Bool (or s180 s181)) [GOOD] (define-fun s183 () Bool (or s179 s182)) [GOOD] (define-fun s184 () Bool (ite s112 s179 s183)) [GOOD] (define-fun s185 () Bool (ite s99 s175 s184)) [GOOD] (define-fun s186 () Bool (ite s86 s171 s185)) [GOOD] (define-fun s187 () Bool (ite s73 s167 s186)) [GOOD] (define-fun s188 () Bool (ite s60 s163 s187)) [GOOD] (define-fun s189 () Bool (ite s47 s159 s188)) [GOOD] (define-fun s190 () Bool (ite s34 s155 s189)) [GOOD] (define-fun s191 () Bool (ite s21 s151 s190)) [GOOD] (define-fun s192 () Bool (ite s8 s147 s191)) [GOOD] (define-fun s193 () Bool (ite s2 s_2 s192)) [GOOD] (define-fun s194 () Bool (or s144 s193)) [GOOD] (assert s15) [GOOD] (assert s28) [GOOD] (assert s41) [GOOD] (assert s54) [GOOD] (assert s67) [GOOD] (assert s80) [GOOD] (assert s93) [GOOD] (assert s106) [GOOD] (assert s119) [GOOD] (assert s129) [GOOD] (assert s194) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/maxrWithFailure.gold0000644000000000000000000002476613405536617020613 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s3 () Int 0) [GOOD] (define-fun s9 () Int 1) [GOOD] (define-fun s142 () Int 10) [GOOD] (define-fun s1 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (Seq Int)) ; tracks user variable "ints" [GOOD] (declare-fun s4 () Int) ; tracks user variable "__internal_sbv_s4" [GOOD] (declare-fun s16 () Int) ; tracks user variable "__internal_sbv_s16" [GOOD] (declare-fun s27 () Int) ; tracks user variable "__internal_sbv_s27" [GOOD] (declare-fun s38 () Int) ; tracks user variable "__internal_sbv_s38" [GOOD] (declare-fun s49 () Int) ; tracks user variable "__internal_sbv_s49" [GOOD] (declare-fun s60 () Int) ; tracks user variable "__internal_sbv_s60" [GOOD] (declare-fun s71 () Int) ; tracks user variable "__internal_sbv_s71" [GOOD] (declare-fun s82 () Int) ; tracks user variable "__internal_sbv_s82" [GOOD] (declare-fun s93 () Int) ; tracks user variable "__internal_sbv_s93" [GOOD] (declare-fun s104 () Int) ; tracks user variable "__internal_sbv_s104" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (= s0 s1)) [GOOD] (define-fun s5 () (Seq Int) (seq.unit s4)) [GOOD] (define-fun s6 () Int (seq.len s0)) [GOOD] (define-fun s7 () Bool (> s6 s3)) [GOOD] (define-fun s8 () Bool (not s7)) [GOOD] (define-fun s10 () (Seq Int) (seq.extract s0 s3 s9)) [GOOD] (define-fun s11 () Bool (= s5 s10)) [GOOD] (define-fun s12 () Bool (or s8 s11)) [GOOD] (define-fun s13 () Int (- s6 s9)) [GOOD] (define-fun s14 () (Seq Int) (seq.extract s0 s9 s13)) [GOOD] (define-fun s15 () Bool (= s1 s14)) [GOOD] (define-fun s17 () (Seq Int) (seq.unit s16)) [GOOD] (define-fun s18 () Int (seq.len s14)) [GOOD] (define-fun s19 () Bool (> s18 s3)) [GOOD] (define-fun s20 () Bool (not s19)) [GOOD] (define-fun s21 () (Seq Int) (seq.extract s14 s3 s9)) [GOOD] (define-fun s22 () Bool (= s17 s21)) [GOOD] (define-fun s23 () Bool (or s20 s22)) [GOOD] (define-fun s24 () Int (- s18 s9)) [GOOD] (define-fun s25 () (Seq Int) (seq.extract s14 s9 s24)) [GOOD] (define-fun s26 () Bool (= s1 s25)) [GOOD] (define-fun s28 () (Seq Int) (seq.unit s27)) [GOOD] (define-fun s29 () Int (seq.len s25)) [GOOD] (define-fun s30 () Bool (> s29 s3)) [GOOD] (define-fun s31 () Bool (not s30)) [GOOD] (define-fun s32 () (Seq Int) (seq.extract s25 s3 s9)) [GOOD] (define-fun s33 () Bool (= s28 s32)) [GOOD] (define-fun s34 () Bool (or s31 s33)) [GOOD] (define-fun s35 () Int (- s29 s9)) [GOOD] (define-fun s36 () (Seq Int) (seq.extract s25 s9 s35)) [GOOD] (define-fun s37 () Bool (= s1 s36)) [GOOD] (define-fun s39 () (Seq Int) (seq.unit s38)) [GOOD] (define-fun s40 () Int (seq.len s36)) [GOOD] (define-fun s41 () Bool (> s40 s3)) [GOOD] (define-fun s42 () Bool (not s41)) [GOOD] (define-fun s43 () (Seq Int) (seq.extract s36 s3 s9)) [GOOD] (define-fun s44 () Bool (= s39 s43)) [GOOD] (define-fun s45 () Bool (or s42 s44)) [GOOD] (define-fun s46 () Int (- s40 s9)) [GOOD] (define-fun s47 () (Seq Int) (seq.extract s36 s9 s46)) [GOOD] (define-fun s48 () Bool (= s1 s47)) [GOOD] (define-fun s50 () (Seq Int) (seq.unit s49)) [GOOD] (define-fun s51 () Int (seq.len s47)) [GOOD] (define-fun s52 () Bool (> s51 s3)) [GOOD] (define-fun s53 () Bool (not s52)) [GOOD] (define-fun s54 () (Seq Int) (seq.extract s47 s3 s9)) [GOOD] (define-fun s55 () Bool (= s50 s54)) [GOOD] (define-fun s56 () Bool (or s53 s55)) [GOOD] (define-fun s57 () Int (- s51 s9)) [GOOD] (define-fun s58 () (Seq Int) (seq.extract s47 s9 s57)) [GOOD] (define-fun s59 () Bool (= s1 s58)) [GOOD] (define-fun s61 () (Seq Int) (seq.unit s60)) [GOOD] (define-fun s62 () Int (seq.len s58)) [GOOD] (define-fun s63 () Bool (> s62 s3)) [GOOD] (define-fun s64 () Bool (not s63)) [GOOD] (define-fun s65 () (Seq Int) (seq.extract s58 s3 s9)) [GOOD] (define-fun s66 () Bool (= s61 s65)) [GOOD] (define-fun s67 () Bool (or s64 s66)) [GOOD] (define-fun s68 () Int (- s62 s9)) [GOOD] (define-fun s69 () (Seq Int) (seq.extract s58 s9 s68)) [GOOD] (define-fun s70 () Bool (= s1 s69)) [GOOD] (define-fun s72 () (Seq Int) (seq.unit s71)) [GOOD] (define-fun s73 () Int (seq.len s69)) [GOOD] (define-fun s74 () Bool (> s73 s3)) [GOOD] (define-fun s75 () Bool (not s74)) [GOOD] (define-fun s76 () (Seq Int) (seq.extract s69 s3 s9)) [GOOD] (define-fun s77 () Bool (= s72 s76)) [GOOD] (define-fun s78 () Bool (or s75 s77)) [GOOD] (define-fun s79 () Int (- s73 s9)) [GOOD] (define-fun s80 () (Seq Int) (seq.extract s69 s9 s79)) [GOOD] (define-fun s81 () Bool (= s1 s80)) [GOOD] (define-fun s83 () (Seq Int) (seq.unit s82)) [GOOD] (define-fun s84 () Int (seq.len s80)) [GOOD] (define-fun s85 () Bool (> s84 s3)) [GOOD] (define-fun s86 () Bool (not s85)) [GOOD] (define-fun s87 () (Seq Int) (seq.extract s80 s3 s9)) [GOOD] (define-fun s88 () Bool (= s83 s87)) [GOOD] (define-fun s89 () Bool (or s86 s88)) [GOOD] (define-fun s90 () Int (- s84 s9)) [GOOD] (define-fun s91 () (Seq Int) (seq.extract s80 s9 s90)) [GOOD] (define-fun s92 () Bool (= s1 s91)) [GOOD] (define-fun s94 () (Seq Int) (seq.unit s93)) [GOOD] (define-fun s95 () Int (seq.len s91)) [GOOD] (define-fun s96 () Bool (> s95 s3)) [GOOD] (define-fun s97 () Bool (not s96)) [GOOD] (define-fun s98 () (Seq Int) (seq.extract s91 s3 s9)) [GOOD] (define-fun s99 () Bool (= s94 s98)) [GOOD] (define-fun s100 () Bool (or s97 s99)) [GOOD] (define-fun s101 () Int (- s95 s9)) [GOOD] (define-fun s102 () (Seq Int) (seq.extract s91 s9 s101)) [GOOD] (define-fun s103 () Bool (= s1 s102)) [GOOD] (define-fun s105 () (Seq Int) (seq.unit s104)) [GOOD] (define-fun s106 () Int (seq.len s102)) [GOOD] (define-fun s107 () Bool (> s106 s3)) [GOOD] (define-fun s108 () Bool (not s107)) [GOOD] (define-fun s109 () (Seq Int) (seq.extract s102 s3 s9)) [GOOD] (define-fun s110 () Bool (= s105 s109)) [GOOD] (define-fun s111 () Bool (or s108 s110)) [GOOD] (define-fun s112 () Bool (<= s104 s3)) [GOOD] (define-fun s113 () Int (ite s112 s3 s104)) [GOOD] (define-fun s114 () Int (ite s103 s3 s113)) [GOOD] (define-fun s115 () Bool (<= s93 s114)) [GOOD] (define-fun s116 () Int (ite s115 s114 s93)) [GOOD] (define-fun s117 () Int (ite s92 s3 s116)) [GOOD] (define-fun s118 () Bool (<= s82 s117)) [GOOD] (define-fun s119 () Int (ite s118 s117 s82)) [GOOD] (define-fun s120 () Int (ite s81 s3 s119)) [GOOD] (define-fun s121 () Bool (<= s71 s120)) [GOOD] (define-fun s122 () Int (ite s121 s120 s71)) [GOOD] (define-fun s123 () Int (ite s70 s3 s122)) [GOOD] (define-fun s124 () Bool (<= s60 s123)) [GOOD] (define-fun s125 () Int (ite s124 s123 s60)) [GOOD] (define-fun s126 () Int (ite s59 s3 s125)) [GOOD] (define-fun s127 () Bool (<= s49 s126)) [GOOD] (define-fun s128 () Int (ite s127 s126 s49)) [GOOD] (define-fun s129 () Int (ite s48 s3 s128)) [GOOD] (define-fun s130 () Bool (<= s38 s129)) [GOOD] (define-fun s131 () Int (ite s130 s129 s38)) [GOOD] (define-fun s132 () Int (ite s37 s3 s131)) [GOOD] (define-fun s133 () Bool (<= s27 s132)) [GOOD] (define-fun s134 () Int (ite s133 s132 s27)) [GOOD] (define-fun s135 () Int (ite s26 s3 s134)) [GOOD] (define-fun s136 () Bool (<= s16 s135)) [GOOD] (define-fun s137 () Int (ite s136 s135 s16)) [GOOD] (define-fun s138 () Int (ite s15 s3 s137)) [GOOD] (define-fun s139 () Bool (<= s4 s138)) [GOOD] (define-fun s140 () Int (ite s139 s138 s4)) [GOOD] (define-fun s141 () Int (ite s2 s3 s140)) [GOOD] (define-fun s143 () Bool (> s141 s142)) [GOOD] (define-fun s144 () Bool (not s143)) [GOOD] (define-fun s145 () Bool (< s104 s3)) [GOOD] (define-fun s146 () Bool (> s104 s142)) [GOOD] (define-fun s147 () Bool (or s145 s146)) [GOOD] (define-fun s148 () Bool (ite s103 s_2 s147)) [GOOD] (define-fun s149 () Bool (< s93 s3)) [GOOD] (define-fun s150 () Bool (> s93 s142)) [GOOD] (define-fun s151 () Bool (or s149 s150)) [GOOD] (define-fun s152 () Bool (or s148 s151)) [GOOD] (define-fun s153 () Bool (ite s92 s_2 s152)) [GOOD] (define-fun s154 () Bool (< s82 s3)) [GOOD] (define-fun s155 () Bool (> s82 s142)) [GOOD] (define-fun s156 () Bool (or s154 s155)) [GOOD] (define-fun s157 () Bool (or s153 s156)) [GOOD] (define-fun s158 () Bool (ite s81 s_2 s157)) [GOOD] (define-fun s159 () Bool (< s71 s3)) [GOOD] (define-fun s160 () Bool (> s71 s142)) [GOOD] (define-fun s161 () Bool (or s159 s160)) [GOOD] (define-fun s162 () Bool (or s158 s161)) [GOOD] (define-fun s163 () Bool (ite s70 s_2 s162)) [GOOD] (define-fun s164 () Bool (< s60 s3)) [GOOD] (define-fun s165 () Bool (> s60 s142)) [GOOD] (define-fun s166 () Bool (or s164 s165)) [GOOD] (define-fun s167 () Bool (or s163 s166)) [GOOD] (define-fun s168 () Bool (ite s59 s_2 s167)) [GOOD] (define-fun s169 () Bool (< s49 s3)) [GOOD] (define-fun s170 () Bool (> s49 s142)) [GOOD] (define-fun s171 () Bool (or s169 s170)) [GOOD] (define-fun s172 () Bool (or s168 s171)) [GOOD] (define-fun s173 () Bool (ite s48 s_2 s172)) [GOOD] (define-fun s174 () Bool (< s38 s3)) [GOOD] (define-fun s175 () Bool (> s38 s142)) [GOOD] (define-fun s176 () Bool (or s174 s175)) [GOOD] (define-fun s177 () Bool (or s173 s176)) [GOOD] (define-fun s178 () Bool (ite s37 s_2 s177)) [GOOD] (define-fun s179 () Bool (< s27 s3)) [GOOD] (define-fun s180 () Bool (> s27 s142)) [GOOD] (define-fun s181 () Bool (or s179 s180)) [GOOD] (define-fun s182 () Bool (or s178 s181)) [GOOD] (define-fun s183 () Bool (ite s26 s_2 s182)) [GOOD] (define-fun s184 () Bool (< s16 s3)) [GOOD] (define-fun s185 () Bool (> s16 s142)) [GOOD] (define-fun s186 () Bool (or s184 s185)) [GOOD] (define-fun s187 () Bool (or s183 s186)) [GOOD] (define-fun s188 () Bool (ite s15 s_2 s187)) [GOOD] (define-fun s189 () Bool (< s4 s3)) [GOOD] (define-fun s190 () Bool (> s4 s142)) [GOOD] (define-fun s191 () Bool (or s189 s190)) [GOOD] (define-fun s192 () Bool (or s188 s191)) [GOOD] (define-fun s193 () Bool (ite s2 s_2 s192)) [GOOD] (define-fun s194 () Bool (or s144 s193)) [GOOD] (assert s12) [GOOD] (assert s23) [GOOD] (assert s34) [GOOD] (assert s45) [GOOD] (assert s56) [GOOD] (assert s67) [GOOD] (assert s78) [GOOD] (assert s89) [GOOD] (assert s100) [GOOD] (assert s111) [GOOD] (assert s194) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/merge.gold0000644000000000000000000000745613405536617016574 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for merge. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: merge_driver merge.o: merge.c merge.h ${CC} ${CCFLAGS} -c $< -o $@ merge_driver.o: merge_driver.c ${CC} ${CCFLAGS} -c $< -o $@ merge_driver: merge.o merge_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f merge_driver == END: "Makefile" ================== == BEGIN: "merge.h" ================ /* Header file for merge. Automatically generated by SBV. Do not edit! */ #ifndef __merge__HEADER_INCLUDED__ #define __merge__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ void merge(const SWord8 *xs, SWord8 *ys); #endif /* __merge__HEADER_INCLUDED__ */ == END: "merge.h" ================== == BEGIN: "merge_driver.c" ================ /* Example driver program for merge. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "merge.h" int main(void) { const SWord8 xs[5] = { 10, 6, 4, 82, 71 }; printf("Contents of input array xs:\n"); int xs_ctr; for(xs_ctr = 0; xs_ctr < 5 ; ++xs_ctr) printf(" xs[%d] = %"PRIu8"\n", xs_ctr ,xs[xs_ctr]); SWord8 ys[5]; merge(xs, ys); printf("merge(xs, ys) ->\n"); int ys_ctr; for(ys_ctr = 0; ys_ctr < 5 ; ++ys_ctr) printf(" ys[%d] = %"PRIu8"\n", ys_ctr ,ys[ys_ctr]); return 0; } == END: "merge_driver.c" ================== == BEGIN: "merge.c" ================ /* File: "merge.c". Automatically generated by SBV. Do not edit! */ #include "merge.h" void merge(const SWord8 *xs, SWord8 *ys) { const SWord8 s0 = xs[0]; const SWord8 s1 = xs[1]; const SWord8 s2 = xs[2]; const SWord8 s3 = xs[3]; const SWord8 s4 = xs[4]; const SBool s5 = s0 < s1; const SWord8 s6 = s5 ? s0 : s1; const SBool s7 = s3 < s4; const SWord8 s8 = s7 ? s3 : s4; const SBool s9 = s2 < s8; const SWord8 s10 = s9 ? s2 : s8; const SBool s11 = s6 < s10; const SWord8 s12 = s11 ? s6 : s10; const SWord8 s13 = s5 ? s1 : s0; const SBool s14 = s13 < s10; const SWord8 s15 = s14 ? s13 : s10; const SWord8 s16 = s7 ? s4 : s3; const SBool s17 = s2 < s16; const SWord8 s18 = s17 ? s2 : s16; const SWord8 s19 = s9 ? s8 : s18; const SBool s20 = s6 < s19; const SWord8 s21 = s20 ? s6 : s19; const SWord8 s22 = s11 ? s15 : s21; const SBool s23 = s13 < s19; const SWord8 s24 = s23 ? s13 : s19; const SWord8 s25 = s14 ? s10 : s24; const SWord8 s26 = s17 ? s16 : s2; const SWord8 s27 = s9 ? s16 : s26; const SBool s28 = s6 < s27; const SWord8 s29 = s28 ? s6 : s27; const SWord8 s30 = s20 ? s24 : s29; const SWord8 s31 = s11 ? s25 : s30; const SBool s32 = s13 < s27; const SWord8 s33 = s32 ? s13 : s27; const SWord8 s34 = s23 ? s19 : s33; const SWord8 s35 = s14 ? s19 : s34; const SWord8 s36 = s28 ? s33 : s6; const SWord8 s37 = s20 ? s34 : s36; const SWord8 s38 = s11 ? s35 : s37; const SWord8 s39 = s32 ? s27 : s13; const SWord8 s40 = s23 ? s27 : s39; const SWord8 s41 = s14 ? s27 : s40; const SWord8 s42 = s28 ? s39 : s13; const SWord8 s43 = s20 ? s40 : s42; const SWord8 s44 = s11 ? s41 : s43; ys[0] = s12; ys[1] = s22; ys[2] = s31; ys[3] = s38; ys[4] = s44; } == END: "merge.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/noOpt1.gold0000644000000000000000000000162513405536617016645 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) *** Data.SBV: Unsupported call to optimize when no objectives are present. *** Use "sat" for plain satisfaction CallStack (from HasCallStack): sbv-7.13/SBVTestSuite/GoldFiles/noOpt2.gold0000644000000000000000000000204113405536617016637 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) [GOOD] ; --- optimization tracker variables --- [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks mx [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) *** Data.SBV: Unsupported call sat/prove when optimization objectives are present. *** Use "optimize"/"optimizeWith" to calculate optimal satisfaction! CallStack (from HasCallStack): sbv-7.13/SBVTestSuite/GoldFiles/optBasics1.gold0000644000000000000000000000013413405536617017467 0ustar0000000000000000Optimal model: x = 1 :: Integer y = 1 :: Integer x_plus_y = 2 :: Integersbv-7.13/SBVTestSuite/GoldFiles/optBasics2.gold0000644000000000000000000000013413405536617017470 0ustar0000000000000000Optimal model: x = 2 :: Integer y = 2 :: Integer x_plus_y = 4 :: Integersbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_08_signed_max.gold0000644000000000000000000000006213405536617023070 0ustar0000000000000000Optimal model: x = 127 :: Int8 m = 127 :: Int8sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_08_signed_min.gold0000644000000000000000000000006413405536617023070 0ustar0000000000000000Optimal model: x = -128 :: Int8 m = -128 :: Int8sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_08_unsigned_max.gold0000644000000000000000000000006413405536617023435 0ustar0000000000000000Optimal model: x = 255 :: Word8 m = 255 :: Word8sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_08_unsigned_min.gold0000644000000000000000000000006013405536617023427 0ustar0000000000000000Optimal model: x = 0 :: Word8 m = 0 :: Word8sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_16_signed_max.gold0000644000000000000000000000007013405536617023066 0ustar0000000000000000Optimal model: x = 32767 :: Int16 m = 32767 :: Int16sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_16_signed_min.gold0000644000000000000000000000007213405536617023066 0ustar0000000000000000Optimal model: x = -32768 :: Int16 m = -32768 :: Int16sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_16_unsigned_max.gold0000644000000000000000000000007213405536617023433 0ustar0000000000000000Optimal model: x = 65535 :: Word16 m = 65535 :: Word16sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_16_unsigned_min.gold0000644000000000000000000000006213405536617023430 0ustar0000000000000000Optimal model: x = 0 :: Word16 m = 0 :: Word16sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_32_signed_max.gold0000644000000000000000000000010213405536617023060 0ustar0000000000000000Optimal model: x = 2147483647 :: Int32 m = 2147483647 :: Int32sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_32_signed_min.gold0000644000000000000000000000010413405536617023060 0ustar0000000000000000Optimal model: x = -2147483648 :: Int32 m = -2147483648 :: Int32sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_32_unsigned_max.gold0000644000000000000000000000010413405536617023425 0ustar0000000000000000Optimal model: x = 4294967295 :: Word32 m = 4294967295 :: Word32sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_32_unsigned_min.gold0000644000000000000000000000006213405536617023426 0ustar0000000000000000Optimal model: x = 0 :: Word32 m = 0 :: Word32sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_64_signed_max.gold0000644000000000000000000000012413405536617023071 0ustar0000000000000000Optimal model: x = 9223372036854775807 :: Int64 m = 9223372036854775807 :: Int64sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_64_signed_min.gold0000644000000000000000000000012613405536617023071 0ustar0000000000000000Optimal model: x = -9223372036854775808 :: Int64 m = -9223372036854775808 :: Int64sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_64_unsigned_max.gold0000644000000000000000000000013013405536617023431 0ustar0000000000000000Optimal model: x = 18446744073709551615 :: Word64 m = 18446744073709551615 :: Word64sbv-7.13/SBVTestSuite/GoldFiles/optBasicsRange_64_unsigned_min.gold0000644000000000000000000000006213405536617023433 0ustar0000000000000000Optimal model: x = 0 :: Word64 m = 0 :: Word64sbv-7.13/SBVTestSuite/GoldFiles/optExtField1.gold0000644000000000000000000000007113405536617017767 0ustar0000000000000000Optimal in an extension field: x_plus_y = oo :: Integersbv-7.13/SBVTestSuite/GoldFiles/optExtField2.gold0000644000000000000000000000007213405536617017771 0ustar0000000000000000Optimal in an extension field: x_plus_y = -oo :: Integersbv-7.13/SBVTestSuite/GoldFiles/optExtField3.gold0000644000000000000000000000011213405536617017765 0ustar0000000000000000Optimal in an extension field: x_plus_y = 9.0 + (-2.0 * epsilon) :: Realsbv-7.13/SBVTestSuite/GoldFiles/optQuant1.gold0000644000000000000000000000033413405536617017355 0ustar0000000000000000*** Data.SBV: Problem needs optimization of metric in the scope of universally quantified variable(s): *** *** goal [Depends on: x] *** *** Optimization is only meaningful with existentially quantified metrics. sbv-7.13/SBVTestSuite/GoldFiles/optQuant2.gold0000644000000000000000000000014613405536617017357 0ustar0000000000000000Optimal model: a = 0 :: Integer b1 = 1 :: Integer b2 = 1 :: Integer goal = 0 :: Integersbv-7.13/SBVTestSuite/GoldFiles/optQuant3.gold0000644000000000000000000000014613405536617017360 0ustar0000000000000000Optimal model: a = 0 :: Integer b1 = 1 :: Integer b2 = 1 :: Integer goal = 0 :: Integersbv-7.13/SBVTestSuite/GoldFiles/optQuant4.gold0000644000000000000000000000014613405536617017361 0ustar0000000000000000Optimal model: a = 0 :: Integer b1 = 1 :: Integer b2 = 1 :: Integer goal = 0 :: Integersbv-7.13/SBVTestSuite/GoldFiles/optQuant5.gold0000644000000000000000000000033713405536617017364 0ustar0000000000000000*** Data.SBV: Problem needs optimization of metric in the scope of universally quantified variable(s): *** *** goal [Depends on: x, y] *** *** Optimization is only meaningful with existentially quantified metrics. sbv-7.13/SBVTestSuite/GoldFiles/optReal1.gold0000644000000000000000000000016213405536617017147 0ustar0000000000000000Optimal model: x = 10.0 :: Real y = 10.0 :: Real z = 0.0 :: Real w = 20.0 :: Real p = 115.0 :: Realsbv-7.13/SBVTestSuite/GoldFiles/pareto1.gold0000644000000000000000000001255013405536617017037 0ustar0000000000000000Pareto front #1: Optimal model: x = 0 :: Integer y = 0 :: Integer min_x = 0 :: Integer max_x_plus_y = 0 :: Integer min_y = 0 :: Integer Pareto front #2: Optimal model: x = 1 :: Integer y = 0 :: Integer min_x = 1 :: Integer max_x_plus_y = 1 :: Integer min_y = 0 :: Integer Pareto front #3: Optimal model: x = 0 :: Integer y = 2 :: Integer min_x = 0 :: Integer max_x_plus_y = 2 :: Integer min_y = 2 :: Integer Pareto front #4: Optimal model: x = 1 :: Integer y = 1 :: Integer min_x = 1 :: Integer max_x_plus_y = 2 :: Integer min_y = 1 :: Integer Pareto front #5: Optimal model: x = 0 :: Integer y = 1 :: Integer min_x = 0 :: Integer max_x_plus_y = 1 :: Integer min_y = 1 :: Integer Pareto front #6: Optimal model: x = 1 :: Integer y = 2 :: Integer min_x = 1 :: Integer max_x_plus_y = 3 :: Integer min_y = 2 :: Integer Pareto front #7: Optimal model: x = 2 :: Integer y = 0 :: Integer min_x = 2 :: Integer max_x_plus_y = 2 :: Integer min_y = 0 :: Integer Pareto front #8: Optimal model: x = 2 :: Integer y = 1 :: Integer min_x = 2 :: Integer max_x_plus_y = 3 :: Integer min_y = 1 :: Integer Pareto front #9: Optimal model: x = 3 :: Integer y = 0 :: Integer min_x = 3 :: Integer max_x_plus_y = 3 :: Integer min_y = 0 :: Integer Pareto front #10: Optimal model: x = 3 :: Integer y = 1 :: Integer min_x = 3 :: Integer max_x_plus_y = 4 :: Integer min_y = 1 :: Integer Pareto front #11: Optimal model: x = 4 :: Integer y = 0 :: Integer min_x = 4 :: Integer max_x_plus_y = 4 :: Integer min_y = 0 :: Integer Pareto front #12: Optimal model: x = 4 :: Integer y = 1 :: Integer min_x = 4 :: Integer max_x_plus_y = 5 :: Integer min_y = 1 :: Integer Pareto front #13: Optimal model: x = 5 :: Integer y = 0 :: Integer min_x = 5 :: Integer max_x_plus_y = 5 :: Integer min_y = 0 :: Integer Pareto front #14: Optimal model: x = 5 :: Integer y = 1 :: Integer min_x = 5 :: Integer max_x_plus_y = 6 :: Integer min_y = 1 :: Integer Pareto front #15: Optimal model: x = 2 :: Integer y = 2 :: Integer min_x = 2 :: Integer max_x_plus_y = 4 :: Integer min_y = 2 :: Integer Pareto front #16: Optimal model: x = 0 :: Integer y = 3 :: Integer min_x = 0 :: Integer max_x_plus_y = 3 :: Integer min_y = 3 :: Integer Pareto front #17: Optimal model: x = 1 :: Integer y = 3 :: Integer min_x = 1 :: Integer max_x_plus_y = 4 :: Integer min_y = 3 :: Integer Pareto front #18: Optimal model: x = 0 :: Integer y = 4 :: Integer min_x = 0 :: Integer max_x_plus_y = 4 :: Integer min_y = 4 :: Integer Pareto front #19: Optimal model: x = 1 :: Integer y = 4 :: Integer min_x = 1 :: Integer max_x_plus_y = 5 :: Integer min_y = 4 :: Integer Pareto front #20: Optimal model: x = 2 :: Integer y = 3 :: Integer min_x = 2 :: Integer max_x_plus_y = 5 :: Integer min_y = 3 :: Integer Pareto front #21: Optimal model: x = 2 :: Integer y = 4 :: Integer min_x = 2 :: Integer max_x_plus_y = 6 :: Integer min_y = 4 :: Integer Pareto front #22: Optimal model: x = 3 :: Integer y = 2 :: Integer min_x = 3 :: Integer max_x_plus_y = 5 :: Integer min_y = 2 :: Integer Pareto front #23: Optimal model: x = 3 :: Integer y = 3 :: Integer min_x = 3 :: Integer max_x_plus_y = 6 :: Integer min_y = 3 :: Integer Pareto front #24: Optimal model: x = 3 :: Integer y = 4 :: Integer min_x = 3 :: Integer max_x_plus_y = 7 :: Integer min_y = 4 :: Integer Pareto front #25: Optimal model: x = 4 :: Integer y = 2 :: Integer min_x = 4 :: Integer max_x_plus_y = 6 :: Integer min_y = 2 :: Integer Pareto front #26: Optimal model: x = 5 :: Integer y = 2 :: Integer min_x = 5 :: Integer max_x_plus_y = 7 :: Integer min_y = 2 :: Integer Pareto front #27: Optimal model: x = 4 :: Integer y = 3 :: Integer min_x = 4 :: Integer max_x_plus_y = 7 :: Integer min_y = 3 :: Integer Pareto front #28: Optimal model: x = 5 :: Integer y = 3 :: Integer min_x = 5 :: Integer max_x_plus_y = 8 :: Integer min_y = 3 :: Integer Pareto front #29: Optimal model: x = 4 :: Integer y = 4 :: Integer min_x = 4 :: Integer max_x_plus_y = 8 :: Integer min_y = 4 :: Integer Pareto front #30: Optimal model: x = 5 :: Integer y = 4 :: Integer min_x = 5 :: Integer max_x_plus_y = 9 :: Integer min_y = 4 :: Integersbv-7.13/SBVTestSuite/GoldFiles/pareto2.gold0000644000000000000000000001323113405536617017035 0ustar0000000000000000Pareto front #1: Optimal model: x = 0 :: Integer y = 5 :: Integer min_x = 0 :: Integer max_y = 5 :: Integer max_x_plus_y = 5 :: Integer Pareto front #2: Optimal model: x = 0 :: Integer y = 6 :: Integer min_x = 0 :: Integer max_y = 6 :: Integer max_x_plus_y = 6 :: Integer Pareto front #3: Optimal model: x = 0 :: Integer y = 4 :: Integer min_x = 0 :: Integer max_y = 4 :: Integer max_x_plus_y = 4 :: Integer Pareto front #4: Optimal model: x = 0 :: Integer y = 3 :: Integer min_x = 0 :: Integer max_y = 3 :: Integer max_x_plus_y = 3 :: Integer Pareto front #5: Optimal model: x = 0 :: Integer y = 2 :: Integer min_x = 0 :: Integer max_y = 2 :: Integer max_x_plus_y = 2 :: Integer Pareto front #6: Optimal model: x = 0 :: Integer y = 1 :: Integer min_x = 0 :: Integer max_y = 1 :: Integer max_x_plus_y = 1 :: Integer Pareto front #7: Optimal model: x = 0 :: Integer y = 0 :: Integer min_x = 0 :: Integer max_y = 0 :: Integer max_x_plus_y = 0 :: Integer Pareto front #8: Optimal model: x = 0 :: Integer y = -1 :: Integer min_x = 0 :: Integer max_y = -1 :: Integer max_x_plus_y = -1 :: Integer Pareto front #9: Optimal model: x = 0 :: Integer y = -2 :: Integer min_x = 0 :: Integer max_y = -2 :: Integer max_x_plus_y = -2 :: Integer Pareto front #10: Optimal model: x = 0 :: Integer y = -3 :: Integer min_x = 0 :: Integer max_y = -3 :: Integer max_x_plus_y = -3 :: Integer Pareto front #11: Optimal model: x = 0 :: Integer y = -4 :: Integer min_x = 0 :: Integer max_y = -4 :: Integer max_x_plus_y = -4 :: Integer Pareto front #12: Optimal model: x = 0 :: Integer y = -5 :: Integer min_x = 0 :: Integer max_y = -5 :: Integer max_x_plus_y = -5 :: Integer Pareto front #13: Optimal model: x = 0 :: Integer y = -6 :: Integer min_x = 0 :: Integer max_y = -6 :: Integer max_x_plus_y = -6 :: Integer Pareto front #14: Optimal model: x = 0 :: Integer y = -7 :: Integer min_x = 0 :: Integer max_y = -7 :: Integer max_x_plus_y = -7 :: Integer Pareto front #15: Optimal model: x = 0 :: Integer y = -8 :: Integer min_x = 0 :: Integer max_y = -8 :: Integer max_x_plus_y = -8 :: Integer Pareto front #16: Optimal model: x = 0 :: Integer y = -9 :: Integer min_x = 0 :: Integer max_y = -9 :: Integer max_x_plus_y = -9 :: Integer Pareto front #17: Optimal model: x = 0 :: Integer y = -10 :: Integer min_x = 0 :: Integer max_y = -10 :: Integer max_x_plus_y = -10 :: Integer Pareto front #18: Optimal model: x = 0 :: Integer y = -11 :: Integer min_x = 0 :: Integer max_y = -11 :: Integer max_x_plus_y = -11 :: Integer Pareto front #19: Optimal model: x = 0 :: Integer y = -12 :: Integer min_x = 0 :: Integer max_y = -12 :: Integer max_x_plus_y = -12 :: Integer Pareto front #20: Optimal model: x = 0 :: Integer y = -13 :: Integer min_x = 0 :: Integer max_y = -13 :: Integer max_x_plus_y = -13 :: Integer Pareto front #21: Optimal model: x = 0 :: Integer y = -14 :: Integer min_x = 0 :: Integer max_y = -14 :: Integer max_x_plus_y = -14 :: Integer Pareto front #22: Optimal model: x = 0 :: Integer y = -15 :: Integer min_x = 0 :: Integer max_y = -15 :: Integer max_x_plus_y = -15 :: Integer Pareto front #23: Optimal model: x = 0 :: Integer y = -16 :: Integer min_x = 0 :: Integer max_y = -16 :: Integer max_x_plus_y = -16 :: Integer Pareto front #24: Optimal model: x = 0 :: Integer y = -17 :: Integer min_x = 0 :: Integer max_y = -17 :: Integer max_x_plus_y = -17 :: Integer Pareto front #25: Optimal model: x = 0 :: Integer y = -18 :: Integer min_x = 0 :: Integer max_y = -18 :: Integer max_x_plus_y = -18 :: Integer Pareto front #26: Optimal model: x = 0 :: Integer y = -19 :: Integer min_x = 0 :: Integer max_y = -19 :: Integer max_x_plus_y = -19 :: Integer Pareto front #27: Optimal model: x = 0 :: Integer y = -20 :: Integer min_x = 0 :: Integer max_y = -20 :: Integer max_x_plus_y = -20 :: Integer Pareto front #28: Optimal model: x = 0 :: Integer y = -21 :: Integer min_x = 0 :: Integer max_y = -21 :: Integer max_x_plus_y = -21 :: Integer Pareto front #29: Optimal model: x = 0 :: Integer y = -22 :: Integer min_x = 0 :: Integer max_y = -22 :: Integer max_x_plus_y = -22 :: Integer Pareto front #30: Optimal model: x = 0 :: Integer y = -23 :: Integer min_x = 0 :: Integer max_y = -23 :: Integer max_x_plus_y = -23 :: Integer *** Note: Pareto-front extraction was terminated as requested by the user. *** There might be many other results!sbv-7.13/SBVTestSuite/GoldFiles/pareto3.gold0000644000000000000000000000036313405536617017040 0ustar0000000000000000Pareto front #1: Optimal model: x = 0 :: Integer min_x = 0 :: Integer max_x_plus_x = 0 :: Integer Pareto front #2: Optimal model: x = 1 :: Integer min_x = 1 :: Integer max_x_plus_x = 2 :: Integersbv-7.13/SBVTestSuite/GoldFiles/pbAtLeast.gold0000644000000000000000000000553313405536617017346 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s11 () (_ BitVec 32) #x00000001) [GOOD] (define-fun s12 () (_ BitVec 32) #x00000000) [GOOD] (define-fun s32 () (_ BitVec 32) #x00000005) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Bool) ; tracks user variable "b0" [GOOD] (declare-fun s1 () Bool) ; tracks user variable "b1" [GOOD] (declare-fun s2 () Bool) ; tracks user variable "b2" [GOOD] (declare-fun s3 () Bool) ; tracks user variable "b3" [GOOD] (declare-fun s4 () Bool) ; tracks user variable "b4" [GOOD] (declare-fun s5 () Bool) ; tracks user variable "b5" [GOOD] (declare-fun s6 () Bool) ; tracks user variable "b6" [GOOD] (declare-fun s7 () Bool) ; tracks user variable "b7" [GOOD] (declare-fun s8 () Bool) ; tracks user variable "b8" [GOOD] (declare-fun s9 () Bool) ; tracks user variable "b9" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s10 () Bool ((_ at-least 5) s0 s1 s2 s3 s4 s5 s6 s7 s8 s9)) [GOOD] (define-fun s13 () (_ BitVec 32) (ite s0 s11 s12)) [GOOD] (define-fun s14 () (_ BitVec 32) (ite s1 s11 s12)) [GOOD] (define-fun s15 () (_ BitVec 32) (bvadd s13 s14)) [GOOD] (define-fun s16 () (_ BitVec 32) (ite s2 s11 s12)) [GOOD] (define-fun s17 () (_ BitVec 32) (bvadd s15 s16)) [GOOD] (define-fun s18 () (_ BitVec 32) (ite s3 s11 s12)) [GOOD] (define-fun s19 () (_ BitVec 32) (bvadd s17 s18)) [GOOD] (define-fun s20 () (_ BitVec 32) (ite s4 s11 s12)) [GOOD] (define-fun s21 () (_ BitVec 32) (bvadd s19 s20)) [GOOD] (define-fun s22 () (_ BitVec 32) (ite s5 s11 s12)) [GOOD] (define-fun s23 () (_ BitVec 32) (bvadd s21 s22)) [GOOD] (define-fun s24 () (_ BitVec 32) (ite s6 s11 s12)) [GOOD] (define-fun s25 () (_ BitVec 32) (bvadd s23 s24)) [GOOD] (define-fun s26 () (_ BitVec 32) (ite s7 s11 s12)) [GOOD] (define-fun s27 () (_ BitVec 32) (bvadd s25 s26)) [GOOD] (define-fun s28 () (_ BitVec 32) (ite s8 s11 s12)) [GOOD] (define-fun s29 () (_ BitVec 32) (bvadd s27 s28)) [GOOD] (define-fun s30 () (_ BitVec 32) (ite s9 s11 s12)) [GOOD] (define-fun s31 () (_ BitVec 32) (bvadd s29 s30)) [GOOD] (define-fun s33 () Bool (bvuge s31 s32)) [GOOD] (define-fun s34 () Bool (= s10 s33)) [GOOD] (define-fun s35 () Bool (not s34)) [GOOD] (assert s35) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/pbAtMost.gold0000644000000000000000000000553213405536617017217 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s11 () (_ BitVec 32) #x00000001) [GOOD] (define-fun s12 () (_ BitVec 32) #x00000000) [GOOD] (define-fun s32 () (_ BitVec 32) #x00000008) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Bool) ; tracks user variable "b0" [GOOD] (declare-fun s1 () Bool) ; tracks user variable "b1" [GOOD] (declare-fun s2 () Bool) ; tracks user variable "b2" [GOOD] (declare-fun s3 () Bool) ; tracks user variable "b3" [GOOD] (declare-fun s4 () Bool) ; tracks user variable "b4" [GOOD] (declare-fun s5 () Bool) ; tracks user variable "b5" [GOOD] (declare-fun s6 () Bool) ; tracks user variable "b6" [GOOD] (declare-fun s7 () Bool) ; tracks user variable "b7" [GOOD] (declare-fun s8 () Bool) ; tracks user variable "b8" [GOOD] (declare-fun s9 () Bool) ; tracks user variable "b9" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s10 () Bool ((_ at-most 8) s0 s1 s2 s3 s4 s5 s6 s7 s8 s9)) [GOOD] (define-fun s13 () (_ BitVec 32) (ite s0 s11 s12)) [GOOD] (define-fun s14 () (_ BitVec 32) (ite s1 s11 s12)) [GOOD] (define-fun s15 () (_ BitVec 32) (bvadd s13 s14)) [GOOD] (define-fun s16 () (_ BitVec 32) (ite s2 s11 s12)) [GOOD] (define-fun s17 () (_ BitVec 32) (bvadd s15 s16)) [GOOD] (define-fun s18 () (_ BitVec 32) (ite s3 s11 s12)) [GOOD] (define-fun s19 () (_ BitVec 32) (bvadd s17 s18)) [GOOD] (define-fun s20 () (_ BitVec 32) (ite s4 s11 s12)) [GOOD] (define-fun s21 () (_ BitVec 32) (bvadd s19 s20)) [GOOD] (define-fun s22 () (_ BitVec 32) (ite s5 s11 s12)) [GOOD] (define-fun s23 () (_ BitVec 32) (bvadd s21 s22)) [GOOD] (define-fun s24 () (_ BitVec 32) (ite s6 s11 s12)) [GOOD] (define-fun s25 () (_ BitVec 32) (bvadd s23 s24)) [GOOD] (define-fun s26 () (_ BitVec 32) (ite s7 s11 s12)) [GOOD] (define-fun s27 () (_ BitVec 32) (bvadd s25 s26)) [GOOD] (define-fun s28 () (_ BitVec 32) (ite s8 s11 s12)) [GOOD] (define-fun s29 () (_ BitVec 32) (bvadd s27 s28)) [GOOD] (define-fun s30 () (_ BitVec 32) (ite s9 s11 s12)) [GOOD] (define-fun s31 () (_ BitVec 32) (bvadd s29 s30)) [GOOD] (define-fun s33 () Bool (bvule s31 s32)) [GOOD] (define-fun s34 () Bool (= s10 s33)) [GOOD] (define-fun s35 () Bool (not s34)) [GOOD] (assert s35) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/pbEq.gold0000644000000000000000000000552613405536617016360 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s11 () Int 1) [GOOD] (define-fun s12 () Int 0) [GOOD] (define-fun s14 () Int 2) [GOOD] (define-fun s17 () Int 3) [GOOD] (define-fun s20 () Int 4) [GOOD] (define-fun s23 () Int 5) [GOOD] (define-fun s26 () Int 6) [GOOD] (define-fun s29 () Int 7) [GOOD] (define-fun s32 () Int 8) [GOOD] (define-fun s35 () Int 9) [GOOD] (define-fun s38 () Int 10) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Bool) ; tracks user variable "b0" [GOOD] (declare-fun s1 () Bool) ; tracks user variable "b1" [GOOD] (declare-fun s2 () Bool) ; tracks user variable "b2" [GOOD] (declare-fun s3 () Bool) ; tracks user variable "b3" [GOOD] (declare-fun s4 () Bool) ; tracks user variable "b4" [GOOD] (declare-fun s5 () Bool) ; tracks user variable "b5" [GOOD] (declare-fun s6 () Bool) ; tracks user variable "b6" [GOOD] (declare-fun s7 () Bool) ; tracks user variable "b7" [GOOD] (declare-fun s8 () Bool) ; tracks user variable "b8" [GOOD] (declare-fun s9 () Bool) ; tracks user variable "b9" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s10 () Bool ((_ pbeq 7 1 2 3 4 5 6 7 8 9 10) s0 s1 s2 s3 s4 s5 s6 s7 s8 s9)) [GOOD] (define-fun s13 () Int (ite s0 s11 s12)) [GOOD] (define-fun s15 () Int (ite s1 s14 s12)) [GOOD] (define-fun s16 () Int (+ s13 s15)) [GOOD] (define-fun s18 () Int (ite s2 s17 s12)) [GOOD] (define-fun s19 () Int (+ s16 s18)) [GOOD] (define-fun s21 () Int (ite s3 s20 s12)) [GOOD] (define-fun s22 () Int (+ s19 s21)) [GOOD] (define-fun s24 () Int (ite s4 s23 s12)) [GOOD] (define-fun s25 () Int (+ s22 s24)) [GOOD] (define-fun s27 () Int (ite s5 s26 s12)) [GOOD] (define-fun s28 () Int (+ s25 s27)) [GOOD] (define-fun s30 () Int (ite s6 s29 s12)) [GOOD] (define-fun s31 () Int (+ s28 s30)) [GOOD] (define-fun s33 () Int (ite s7 s32 s12)) [GOOD] (define-fun s34 () Int (+ s31 s33)) [GOOD] (define-fun s36 () Int (ite s8 s35 s12)) [GOOD] (define-fun s37 () Int (+ s34 s36)) [GOOD] (define-fun s39 () Int (ite s9 s38 s12)) [GOOD] (define-fun s40 () Int (+ s37 s39)) [GOOD] (define-fun s41 () Bool (= s29 s40)) [GOOD] (define-fun s42 () Bool (= s10 s41)) [GOOD] (define-fun s43 () Bool (not s42)) [GOOD] (assert s43) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/pbEq2.gold0000644000000000000000000000474113405536617016440 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Bool) ; tracks user variable "b0" [GOOD] (declare-fun s1 () Bool) ; tracks user variable "b1" [GOOD] (declare-fun s2 () Bool) ; tracks user variable "b2" [GOOD] (declare-fun s3 () Bool) ; tracks user variable "b3" [GOOD] (declare-fun s4 () Bool) ; tracks user variable "b4" [GOOD] (declare-fun s5 () Bool) ; tracks user variable "b5" [GOOD] (declare-fun s6 () Bool) ; tracks user variable "b6" [GOOD] (declare-fun s7 () Bool) ; tracks user variable "b7" [GOOD] (declare-fun s8 () Bool) ; tracks user variable "b8" [GOOD] (declare-fun s9 () Bool) ; tracks user variable "b9" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s10 () Bool ((_ pbeq 3 1 1) s1 s2)) [GOOD] (define-fun s11 () Bool ((_ pbeq 1 1 1) s1 s2)) [GOOD] (define-fun s12 () Bool (ite s0 s10 s11)) [GOOD] (define-fun s13 () Bool ((_ pbeq 3 1 1 1) s0 s3 s4)) [GOOD] (define-fun s14 () Bool ((_ pbeq 1 1 1 1) s0 s3 s4)) [GOOD] (define-fun s15 () Bool (ite s2 s13 s14)) [GOOD] (define-fun s16 () Bool (and s12 s15)) [GOOD] (define-fun s17 () Bool (not s16)) [GOOD] (define-fun s18 () Bool (= s_2 s0)) [GOOD] (define-fun s19 () Bool (= s_2 s2)) [GOOD] (define-fun s20 () Bool (= s_2 s4)) [GOOD] (define-fun s21 () Bool (and s3 s20)) [GOOD] (define-fun s22 () Bool (and s19 s21)) [GOOD] (define-fun s23 () Bool (and s1 s22)) [GOOD] (define-fun s24 () Bool (and s18 s23)) [GOOD] (define-fun s25 () Bool (= s_2 s3)) [GOOD] (define-fun s26 () Bool (and s4 s25)) [GOOD] (define-fun s27 () Bool (and s19 s26)) [GOOD] (define-fun s28 () Bool (and s1 s27)) [GOOD] (define-fun s29 () Bool (and s18 s28)) [GOOD] (define-fun s30 () Bool (or s24 s29)) [GOOD] (define-fun s31 () Bool (or s17 s30)) [GOOD] (define-fun s32 () Bool (not s31)) [GOOD] (assert s32) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/pbExactly.gold0000644000000000000000000000554713405536617017427 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s11 () (_ BitVec 32) #x00000001) [GOOD] (define-fun s12 () (_ BitVec 32) #x00000000) [GOOD] (define-fun s32 () (_ BitVec 32) #x00000005) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Bool) ; tracks user variable "b0" [GOOD] (declare-fun s1 () Bool) ; tracks user variable "b1" [GOOD] (declare-fun s2 () Bool) ; tracks user variable "b2" [GOOD] (declare-fun s3 () Bool) ; tracks user variable "b3" [GOOD] (declare-fun s4 () Bool) ; tracks user variable "b4" [GOOD] (declare-fun s5 () Bool) ; tracks user variable "b5" [GOOD] (declare-fun s6 () Bool) ; tracks user variable "b6" [GOOD] (declare-fun s7 () Bool) ; tracks user variable "b7" [GOOD] (declare-fun s8 () Bool) ; tracks user variable "b8" [GOOD] (declare-fun s9 () Bool) ; tracks user variable "b9" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s10 () Bool ((_ pbeq 5 1 1 1 1 1 1 1 1 1 1) s0 s1 s2 s3 s4 s5 s6 s7 s8 s9)) [GOOD] (define-fun s13 () (_ BitVec 32) (ite s0 s11 s12)) [GOOD] (define-fun s14 () (_ BitVec 32) (ite s1 s11 s12)) [GOOD] (define-fun s15 () (_ BitVec 32) (bvadd s13 s14)) [GOOD] (define-fun s16 () (_ BitVec 32) (ite s2 s11 s12)) [GOOD] (define-fun s17 () (_ BitVec 32) (bvadd s15 s16)) [GOOD] (define-fun s18 () (_ BitVec 32) (ite s3 s11 s12)) [GOOD] (define-fun s19 () (_ BitVec 32) (bvadd s17 s18)) [GOOD] (define-fun s20 () (_ BitVec 32) (ite s4 s11 s12)) [GOOD] (define-fun s21 () (_ BitVec 32) (bvadd s19 s20)) [GOOD] (define-fun s22 () (_ BitVec 32) (ite s5 s11 s12)) [GOOD] (define-fun s23 () (_ BitVec 32) (bvadd s21 s22)) [GOOD] (define-fun s24 () (_ BitVec 32) (ite s6 s11 s12)) [GOOD] (define-fun s25 () (_ BitVec 32) (bvadd s23 s24)) [GOOD] (define-fun s26 () (_ BitVec 32) (ite s7 s11 s12)) [GOOD] (define-fun s27 () (_ BitVec 32) (bvadd s25 s26)) [GOOD] (define-fun s28 () (_ BitVec 32) (ite s8 s11 s12)) [GOOD] (define-fun s29 () (_ BitVec 32) (bvadd s27 s28)) [GOOD] (define-fun s30 () (_ BitVec 32) (ite s9 s11 s12)) [GOOD] (define-fun s31 () (_ BitVec 32) (bvadd s29 s30)) [GOOD] (define-fun s33 () Bool (= s31 s32)) [GOOD] (define-fun s34 () Bool (= s10 s33)) [GOOD] (define-fun s35 () Bool (not s34)) [GOOD] (assert s35) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/pbGe.gold0000644000000000000000000000552713405536617016347 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s11 () Int 1) [GOOD] (define-fun s12 () Int 0) [GOOD] (define-fun s14 () Int 2) [GOOD] (define-fun s17 () Int 3) [GOOD] (define-fun s20 () Int 4) [GOOD] (define-fun s23 () Int 5) [GOOD] (define-fun s26 () Int 6) [GOOD] (define-fun s29 () Int 7) [GOOD] (define-fun s32 () Int 8) [GOOD] (define-fun s35 () Int 9) [GOOD] (define-fun s38 () Int 10) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Bool) ; tracks user variable "b0" [GOOD] (declare-fun s1 () Bool) ; tracks user variable "b1" [GOOD] (declare-fun s2 () Bool) ; tracks user variable "b2" [GOOD] (declare-fun s3 () Bool) ; tracks user variable "b3" [GOOD] (declare-fun s4 () Bool) ; tracks user variable "b4" [GOOD] (declare-fun s5 () Bool) ; tracks user variable "b5" [GOOD] (declare-fun s6 () Bool) ; tracks user variable "b6" [GOOD] (declare-fun s7 () Bool) ; tracks user variable "b7" [GOOD] (declare-fun s8 () Bool) ; tracks user variable "b8" [GOOD] (declare-fun s9 () Bool) ; tracks user variable "b9" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s10 () Bool ((_ pbge 7 1 2 3 4 5 6 7 8 9 10) s0 s1 s2 s3 s4 s5 s6 s7 s8 s9)) [GOOD] (define-fun s13 () Int (ite s0 s11 s12)) [GOOD] (define-fun s15 () Int (ite s1 s14 s12)) [GOOD] (define-fun s16 () Int (+ s13 s15)) [GOOD] (define-fun s18 () Int (ite s2 s17 s12)) [GOOD] (define-fun s19 () Int (+ s16 s18)) [GOOD] (define-fun s21 () Int (ite s3 s20 s12)) [GOOD] (define-fun s22 () Int (+ s19 s21)) [GOOD] (define-fun s24 () Int (ite s4 s23 s12)) [GOOD] (define-fun s25 () Int (+ s22 s24)) [GOOD] (define-fun s27 () Int (ite s5 s26 s12)) [GOOD] (define-fun s28 () Int (+ s25 s27)) [GOOD] (define-fun s30 () Int (ite s6 s29 s12)) [GOOD] (define-fun s31 () Int (+ s28 s30)) [GOOD] (define-fun s33 () Int (ite s7 s32 s12)) [GOOD] (define-fun s34 () Int (+ s31 s33)) [GOOD] (define-fun s36 () Int (ite s8 s35 s12)) [GOOD] (define-fun s37 () Int (+ s34 s36)) [GOOD] (define-fun s39 () Int (ite s9 s38 s12)) [GOOD] (define-fun s40 () Int (+ s37 s39)) [GOOD] (define-fun s41 () Bool (>= s40 s29)) [GOOD] (define-fun s42 () Bool (= s10 s41)) [GOOD] (define-fun s43 () Bool (not s42)) [GOOD] (assert s43) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/pbLe.gold0000644000000000000000000000552713405536617016354 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s11 () Int 1) [GOOD] (define-fun s12 () Int 0) [GOOD] (define-fun s14 () Int 2) [GOOD] (define-fun s17 () Int 3) [GOOD] (define-fun s20 () Int 4) [GOOD] (define-fun s23 () Int 5) [GOOD] (define-fun s26 () Int 6) [GOOD] (define-fun s29 () Int 7) [GOOD] (define-fun s32 () Int 8) [GOOD] (define-fun s35 () Int 9) [GOOD] (define-fun s38 () Int 10) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Bool) ; tracks user variable "b0" [GOOD] (declare-fun s1 () Bool) ; tracks user variable "b1" [GOOD] (declare-fun s2 () Bool) ; tracks user variable "b2" [GOOD] (declare-fun s3 () Bool) ; tracks user variable "b3" [GOOD] (declare-fun s4 () Bool) ; tracks user variable "b4" [GOOD] (declare-fun s5 () Bool) ; tracks user variable "b5" [GOOD] (declare-fun s6 () Bool) ; tracks user variable "b6" [GOOD] (declare-fun s7 () Bool) ; tracks user variable "b7" [GOOD] (declare-fun s8 () Bool) ; tracks user variable "b8" [GOOD] (declare-fun s9 () Bool) ; tracks user variable "b9" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s10 () Bool ((_ pble 7 1 2 3 4 5 6 7 8 9 10) s0 s1 s2 s3 s4 s5 s6 s7 s8 s9)) [GOOD] (define-fun s13 () Int (ite s0 s11 s12)) [GOOD] (define-fun s15 () Int (ite s1 s14 s12)) [GOOD] (define-fun s16 () Int (+ s13 s15)) [GOOD] (define-fun s18 () Int (ite s2 s17 s12)) [GOOD] (define-fun s19 () Int (+ s16 s18)) [GOOD] (define-fun s21 () Int (ite s3 s20 s12)) [GOOD] (define-fun s22 () Int (+ s19 s21)) [GOOD] (define-fun s24 () Int (ite s4 s23 s12)) [GOOD] (define-fun s25 () Int (+ s22 s24)) [GOOD] (define-fun s27 () Int (ite s5 s26 s12)) [GOOD] (define-fun s28 () Int (+ s25 s27)) [GOOD] (define-fun s30 () Int (ite s6 s29 s12)) [GOOD] (define-fun s31 () Int (+ s28 s30)) [GOOD] (define-fun s33 () Int (ite s7 s32 s12)) [GOOD] (define-fun s34 () Int (+ s31 s33)) [GOOD] (define-fun s36 () Int (ite s8 s35 s12)) [GOOD] (define-fun s37 () Int (+ s34 s36)) [GOOD] (define-fun s39 () Int (ite s9 s38 s12)) [GOOD] (define-fun s40 () Int (+ s37 s39)) [GOOD] (define-fun s41 () Bool (<= s40 s29)) [GOOD] (define-fun s42 () Bool (= s10 s41)) [GOOD] (define-fun s43 () Bool (not s42)) [GOOD] (assert s43) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/pbMutexed.gold0000644000000000000000000000544613405536617017427 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s11 () (_ BitVec 32) #x00000001) [GOOD] (define-fun s12 () (_ BitVec 32) #x00000000) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Bool) ; tracks user variable "b0" [GOOD] (declare-fun s1 () Bool) ; tracks user variable "b1" [GOOD] (declare-fun s2 () Bool) ; tracks user variable "b2" [GOOD] (declare-fun s3 () Bool) ; tracks user variable "b3" [GOOD] (declare-fun s4 () Bool) ; tracks user variable "b4" [GOOD] (declare-fun s5 () Bool) ; tracks user variable "b5" [GOOD] (declare-fun s6 () Bool) ; tracks user variable "b6" [GOOD] (declare-fun s7 () Bool) ; tracks user variable "b7" [GOOD] (declare-fun s8 () Bool) ; tracks user variable "b8" [GOOD] (declare-fun s9 () Bool) ; tracks user variable "b9" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s10 () Bool ((_ at-most 1) s0 s1 s2 s3 s4 s5 s6 s7 s8 s9)) [GOOD] (define-fun s13 () (_ BitVec 32) (ite s0 s11 s12)) [GOOD] (define-fun s14 () (_ BitVec 32) (ite s1 s11 s12)) [GOOD] (define-fun s15 () (_ BitVec 32) (bvadd s13 s14)) [GOOD] (define-fun s16 () (_ BitVec 32) (ite s2 s11 s12)) [GOOD] (define-fun s17 () (_ BitVec 32) (bvadd s15 s16)) [GOOD] (define-fun s18 () (_ BitVec 32) (ite s3 s11 s12)) [GOOD] (define-fun s19 () (_ BitVec 32) (bvadd s17 s18)) [GOOD] (define-fun s20 () (_ BitVec 32) (ite s4 s11 s12)) [GOOD] (define-fun s21 () (_ BitVec 32) (bvadd s19 s20)) [GOOD] (define-fun s22 () (_ BitVec 32) (ite s5 s11 s12)) [GOOD] (define-fun s23 () (_ BitVec 32) (bvadd s21 s22)) [GOOD] (define-fun s24 () (_ BitVec 32) (ite s6 s11 s12)) [GOOD] (define-fun s25 () (_ BitVec 32) (bvadd s23 s24)) [GOOD] (define-fun s26 () (_ BitVec 32) (ite s7 s11 s12)) [GOOD] (define-fun s27 () (_ BitVec 32) (bvadd s25 s26)) [GOOD] (define-fun s28 () (_ BitVec 32) (ite s8 s11 s12)) [GOOD] (define-fun s29 () (_ BitVec 32) (bvadd s27 s28)) [GOOD] (define-fun s30 () (_ BitVec 32) (ite s9 s11 s12)) [GOOD] (define-fun s31 () (_ BitVec 32) (bvadd s29 s30)) [GOOD] (define-fun s32 () Bool (bvule s31 s11)) [GOOD] (define-fun s33 () Bool (= s10 s32)) [GOOD] (define-fun s34 () Bool (not s33)) [GOOD] (assert s34) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/pbStronglyMutexed.gold0000644000000000000000000000546313405536617021170 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s11 () (_ BitVec 32) #x00000001) [GOOD] (define-fun s12 () (_ BitVec 32) #x00000000) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Bool) ; tracks user variable "b0" [GOOD] (declare-fun s1 () Bool) ; tracks user variable "b1" [GOOD] (declare-fun s2 () Bool) ; tracks user variable "b2" [GOOD] (declare-fun s3 () Bool) ; tracks user variable "b3" [GOOD] (declare-fun s4 () Bool) ; tracks user variable "b4" [GOOD] (declare-fun s5 () Bool) ; tracks user variable "b5" [GOOD] (declare-fun s6 () Bool) ; tracks user variable "b6" [GOOD] (declare-fun s7 () Bool) ; tracks user variable "b7" [GOOD] (declare-fun s8 () Bool) ; tracks user variable "b8" [GOOD] (declare-fun s9 () Bool) ; tracks user variable "b9" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s10 () Bool ((_ pbeq 1 1 1 1 1 1 1 1 1 1 1) s0 s1 s2 s3 s4 s5 s6 s7 s8 s9)) [GOOD] (define-fun s13 () (_ BitVec 32) (ite s0 s11 s12)) [GOOD] (define-fun s14 () (_ BitVec 32) (ite s1 s11 s12)) [GOOD] (define-fun s15 () (_ BitVec 32) (bvadd s13 s14)) [GOOD] (define-fun s16 () (_ BitVec 32) (ite s2 s11 s12)) [GOOD] (define-fun s17 () (_ BitVec 32) (bvadd s15 s16)) [GOOD] (define-fun s18 () (_ BitVec 32) (ite s3 s11 s12)) [GOOD] (define-fun s19 () (_ BitVec 32) (bvadd s17 s18)) [GOOD] (define-fun s20 () (_ BitVec 32) (ite s4 s11 s12)) [GOOD] (define-fun s21 () (_ BitVec 32) (bvadd s19 s20)) [GOOD] (define-fun s22 () (_ BitVec 32) (ite s5 s11 s12)) [GOOD] (define-fun s23 () (_ BitVec 32) (bvadd s21 s22)) [GOOD] (define-fun s24 () (_ BitVec 32) (ite s6 s11 s12)) [GOOD] (define-fun s25 () (_ BitVec 32) (bvadd s23 s24)) [GOOD] (define-fun s26 () (_ BitVec 32) (ite s7 s11 s12)) [GOOD] (define-fun s27 () (_ BitVec 32) (bvadd s25 s26)) [GOOD] (define-fun s28 () (_ BitVec 32) (ite s8 s11 s12)) [GOOD] (define-fun s29 () (_ BitVec 32) (bvadd s27 s28)) [GOOD] (define-fun s30 () (_ BitVec 32) (ite s9 s11 s12)) [GOOD] (define-fun s31 () (_ BitVec 32) (bvadd s29 s30)) [GOOD] (define-fun s32 () Bool (= s11 s31)) [GOOD] (define-fun s33 () Bool (= s10 s32)) [GOOD] (define-fun s34 () Bool (not s33)) [GOOD] (assert s34) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/popCount1.gold0000644000000000000000000001001513405536617017346 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for popCount. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: popCount_driver popCount.o: popCount.c popCount.h ${CC} ${CCFLAGS} -c $< -o $@ popCount_driver.o: popCount_driver.c ${CC} ${CCFLAGS} -c $< -o $@ popCount_driver: popCount.o popCount_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f popCount_driver == END: "Makefile" ================== == BEGIN: "popCount.h" ================ /* Header file for popCount. Automatically generated by SBV. Do not edit! */ #ifndef __popCount__HEADER_INCLUDED__ #define __popCount__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ SWord8 popCount(const SWord64 x); #endif /* __popCount__HEADER_INCLUDED__ */ == END: "popCount.h" ================== == BEGIN: "popCount_driver.c" ================ /* Example driver program for popCount. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "popCount.h" int main(void) { const SWord8 __result = popCount(0x0123456789abcdefULL); printf("popCount(0x0123456789abcdefULL) = %"PRIu8"\n", __result); return 0; } == END: "popCount_driver.c" ================== == BEGIN: "popCount.c" ================ /* File: "popCount.c". Automatically generated by SBV. Do not edit! */ #include "popCount.h" SWord8 popCount(const SWord64 x) { const SWord64 s0 = x; static const SWord8 table0[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 }; const SWord64 s11 = s0 & 0x00000000000000ffULL; const SWord8 s12 = table0[s11]; const SWord64 s14 = s0 >> 8; const SWord64 s15 = 0x00000000000000ffULL & s14; const SWord8 s16 = table0[s15]; const SWord8 s17 = s12 + s16; const SWord64 s18 = s14 >> 8; const SWord64 s19 = 0x00000000000000ffULL & s18; const SWord8 s20 = table0[s19]; const SWord8 s21 = s17 + s20; const SWord64 s22 = s18 >> 8; const SWord64 s23 = 0x00000000000000ffULL & s22; const SWord8 s24 = table0[s23]; const SWord8 s25 = s21 + s24; const SWord64 s26 = s22 >> 8; const SWord64 s27 = 0x00000000000000ffULL & s26; const SWord8 s28 = table0[s27]; const SWord8 s29 = s25 + s28; const SWord64 s30 = s26 >> 8; const SWord64 s31 = 0x00000000000000ffULL & s30; const SWord8 s32 = table0[s31]; const SWord8 s33 = s29 + s32; const SWord64 s34 = s30 >> 8; const SWord64 s35 = 0x00000000000000ffULL & s34; const SWord8 s36 = table0[s35]; const SWord8 s37 = s33 + s36; const SWord64 s38 = s34 >> 8; const SWord64 s39 = 0x00000000000000ffULL & s38; const SWord8 s40 = table0[s39]; const SWord8 s41 = s37 + s40; return s41; } == END: "popCount.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/popCount2.gold0000644000000000000000000001022513405536617017352 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for popCount. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: popCount_driver popCount.o: popCount.c popCount.h ${CC} ${CCFLAGS} -c $< -o $@ popCount_driver.o: popCount_driver.c ${CC} ${CCFLAGS} -c $< -o $@ popCount_driver: popCount.o popCount_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f popCount_driver == END: "Makefile" ================== == BEGIN: "popCount.h" ================ /* Header file for popCount. Automatically generated by SBV. Do not edit! */ #ifndef __popCount__HEADER_INCLUDED__ #define __popCount__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ SWord8 popCount(const SWord64 x); #endif /* __popCount__HEADER_INCLUDED__ */ == END: "popCount.h" ================== == BEGIN: "popCount_driver.c" ================ /* Example driver program for popCount. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "popCount.h" int main(void) { const SWord8 __result = popCount(0x0123456789abcdefULL); printf("popCount(0x0123456789abcdefULL) = %"PRIu8"\n", __result); return 0; } == END: "popCount_driver.c" ================== == BEGIN: "popCount.c" ================ /* File: "popCount.c". Automatically generated by SBV. Do not edit! */ #include "popCount.h" SWord8 popCount(const SWord64 x) { const SWord64 s0 = x; static const SWord8 table0[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 }; const SWord64 s11 = s0 & 0x00000000000000ffULL; const SWord8 s12 = s11 >= 256 ? 0 : table0[s11]; const SWord64 s14 = s0 >> 8; const SWord64 s15 = 0x00000000000000ffULL & s14; const SWord8 s16 = s15 >= 256 ? 0 : table0[s15]; const SWord8 s17 = s12 + s16; const SWord64 s18 = s14 >> 8; const SWord64 s19 = 0x00000000000000ffULL & s18; const SWord8 s20 = s19 >= 256 ? 0 : table0[s19]; const SWord8 s21 = s17 + s20; const SWord64 s22 = s18 >> 8; const SWord64 s23 = 0x00000000000000ffULL & s22; const SWord8 s24 = s23 >= 256 ? 0 : table0[s23]; const SWord8 s25 = s21 + s24; const SWord64 s26 = s22 >> 8; const SWord64 s27 = 0x00000000000000ffULL & s26; const SWord8 s28 = s27 >= 256 ? 0 : table0[s27]; const SWord8 s29 = s25 + s28; const SWord64 s30 = s26 >> 8; const SWord64 s31 = 0x00000000000000ffULL & s30; const SWord8 s32 = s31 >= 256 ? 0 : table0[s31]; const SWord8 s33 = s29 + s32; const SWord64 s34 = s30 >> 8; const SWord64 s35 = 0x00000000000000ffULL & s34; const SWord8 s36 = s35 >= 256 ? 0 : table0[s35]; const SWord8 s37 = s33 + s36; const SWord64 s38 = s34 >> 8; const SWord64 s39 = 0x00000000000000ffULL & s38; const SWord8 s40 = s39 >= 256 ? 0 : table0[s39]; const SWord8 s41 = s37 + s40; return s41; } == END: "popCount.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/qEnum1.gold0000644000000000000000000000306013405536617016626 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has user-defined sorts, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] (declare-datatypes () ((BinOp (Plus) (Minus) (Times)))) [GOOD] (define-fun BinOp_constrIndex ((x BinOp)) Int (ite (= x Plus) 0 (ite (= x Minus) 1 2)) ) [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () BinOp) ; tracks user variable "p" [GOOD] (declare-fun s1 () BinOp) ; tracks user variable "m" [GOOD] (declare-fun s2 () BinOp) ; tracks user variable "t" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (<= (BinOp_constrIndex s0) (BinOp_constrIndex s1))) [GOOD] (define-fun s4 () Bool (<= (BinOp_constrIndex s1) (BinOp_constrIndex s2))) [GOOD] (define-fun s5 () Bool (distinct s0 s1 s2)) [GOOD] (assert s3) [GOOD] (assert s4) [GOOD] (assert s5) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 Plus)) [SEND] (get-value (s1)) [RECV] ((s1 Minus)) [SEND] (get-value (s2)) [RECV] ((s2 Times)) *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_existsexists_contradiction_c.gold0000644000000000000000000000201513405536617027104 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8)) (s1 (_ BitVec 8))) (let ((s2 (= s0 s1))) (let ((s3 (distinct s0 s1))) (let ((s4 (and s2 s3))) (and s4 s_2)))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_existsexists_contradiction_p.gold0000644000000000000000000000200713405536617027122 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8)) (s1 (_ BitVec 8))) (let ((s2 (= s0 s1))) (let ((s3 (distinct s0 s1))) (let ((s4 (and s2 s3))) (not s4)))))) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_existsexists_satisfiable_c.gold0000644000000000000000000000201213405536617026527 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8)) (s1 (_ BitVec 8))) (let ((s3 (bvadd s1 s2))) (let ((s4 (= s0 s3))) (and s4 s_2))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_existsexists_satisfiable_p.gold0000644000000000000000000000200613405536617026547 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8)) (s1 (_ BitVec 8))) (let ((s3 (bvadd s1 s2))) (let ((s4 (= s0 s3))) (not s4))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_existsexists_thm_c.gold0000644000000000000000000000201413405536617025033 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8)) (s1 (_ BitVec 8))) (let ((s2 (bvsub s1 s0))) (let ((s3 (bvadd s0 s2))) (let ((s4 (= s1 s3))) (and s4 s_2)))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_existsexists_thm_p.gold0000644000000000000000000000201013405536617025044 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8)) (s1 (_ BitVec 8))) (let ((s2 (bvsub s1 s0))) (let ((s3 (bvadd s0 s2))) (let ((s4 (= s1 s3))) (not s4)))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_existsforall_contradiction_c.gold0000644000000000000000000000207413405536617027051 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s1 ((_ BitVec 8)) (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8))) (let ((s2 (= s0 (s1 s0)))) (let ((s3 (distinct s0 (s1 s0)))) (let ((s4 (and s2 s3))) (and s4 s_2)))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_existsforall_contradiction_p.gold0000644000000000000000000000206613405536617027067 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s1 ((_ BitVec 8)) (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8))) (let ((s2 (= s0 (s1 s0)))) (let ((s3 (distinct s0 (s1 s0)))) (let ((s4 (and s2 s3))) (not s4)))))) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_existsforall_satisfiable_c.gold0000644000000000000000000000206413405536617026476 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s1 ((_ BitVec 8)) (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8))) (let ((s3 (bvadd (s1 s0) s2))) (let ((s4 (= s0 s3))) (and s4 s_2))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_existsforall_satisfiable_p.gold0000644000000000000000000000205613405536617026514 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s1 ((_ BitVec 8)) (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8))) (let ((s3 (bvadd (s1 s0) s2))) (let ((s4 (= s0 s3))) (not s4))))) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_existsforall_thm_c.gold0000644000000000000000000000207313405536617025000 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s1 ((_ BitVec 8)) (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8))) (let ((s2 (bvsub (s1 s0) s0))) (let ((s3 (bvadd s0 s2))) (let ((s4 (= (s1 s0) s3))) (and s4 s_2)))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_existsforall_thm_p.gold0000644000000000000000000000206713405536617025020 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s1 ((_ BitVec 8)) (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8))) (let ((s2 (bvsub (s1 s0) s0))) (let ((s3 (bvadd s0 s2))) (let ((s4 (= (s1 s0) s3))) (not s4)))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_forallexists_contradiction_c.gold0000644000000000000000000000204613405536617027050 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s1 (_ BitVec 8))) (let ((s2 (= s0 s1))) (let ((s3 (distinct s0 s1))) (let ((s4 (and s2 s3))) (and s4 s_2)))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_forallexists_contradiction_p.gold0000644000000000000000000000211313405536617027060 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s1 (_ BitVec 8))) (let ((s2 (= s0 s1))) (let ((s3 (distinct s0 s1))) (let ((s4 (and s2 s3))) (not s4)))))) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x00)) *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_forallexists_satisfiable_c.gold0000644000000000000000000000204313405536617026473 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s1 (_ BitVec 8))) (let ((s3 (bvadd s1 s2))) (let ((s4 (= s0 s3))) (and s4 s_2))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_forallexists_satisfiable_p.gold0000644000000000000000000000203713405536617026513 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s1 (_ BitVec 8))) (let ((s3 (bvadd s1 s2))) (let ((s4 (= s0 s3))) (not s4))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_forallexists_thm_c.gold0000644000000000000000000000204513405536617024777 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s1 (_ BitVec 8))) (let ((s2 (bvsub s1 s0))) (let ((s3 (bvadd s0 s2))) (let ((s4 (= s1 s3))) (and s4 s_2)))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_forallexists_thm_p.gold0000644000000000000000000000204113405536617025010 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s1 (_ BitVec 8))) (let ((s2 (bvsub s1 s0))) (let ((s3 (bvadd s0 s2))) (let ((s4 (= s1 s3))) (not s4)))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_forallforall_contradiction_c.gold0000644000000000000000000000210313405536617027002 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (= s0 s1)) [GOOD] (define-fun s3 () Bool (distinct s0 s1)) [GOOD] (define-fun s4 () Bool (and s2 s3)) [GOOD] (assert s4) [GOOD] (assert s_2) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_forallforall_contradiction_p.gold0000644000000000000000000000221113405536617027017 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (= s0 s1)) [GOOD] (define-fun s3 () Bool (distinct s0 s1)) [GOOD] (define-fun s4 () Bool (and s2 s3)) [GOOD] (assert (not s4)) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x00)) [SEND] (get-value (s1)) [RECV] ((s1 #x00)) *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_forallforall_satisfiable_c.gold0000644000000000000000000000211113405536617026427 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () (_ BitVec 8) (bvadd s1 s2)) [GOOD] (define-fun s4 () Bool (= s0 s3)) [GOOD] (assert s4) [GOOD] (assert s_2) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_forallforall_satisfiable_p.gold0000644000000000000000000000221713405536617026453 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () (_ BitVec 8) (bvadd s1 s2)) [GOOD] (define-fun s4 () Bool (= s0 s3)) [GOOD] (assert (not s4)) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #xff)) [SEND] (get-value (s1)) [RECV] ((s1 #xff)) *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_forallforall_thm_c.gold0000644000000000000000000000212213405536617024733 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () (_ BitVec 8) (bvsub s1 s0)) [GOOD] (define-fun s3 () (_ BitVec 8) (bvadd s0 s2)) [GOOD] (define-fun s4 () Bool (= s1 s3)) [GOOD] (assert s4) [GOOD] (assert s_2) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_prove_forallforall_thm_p.gold0000644000000000000000000000210413405536617024750 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () (_ BitVec 8) (bvsub s1 s0)) [GOOD] (define-fun s3 () (_ BitVec 8) (bvadd s0 s2)) [GOOD] (define-fun s4 () Bool (= s1 s3)) [GOOD] (assert (not s4)) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_existsexists_contradiction_c.gold0000644000000000000000000000205713405536617026546 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (= s0 s1)) [GOOD] (define-fun s3 () Bool (distinct s0 s1)) [GOOD] (define-fun s4 () Bool (and s2 s3)) [GOOD] (assert s4) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_existsexists_contradiction_p.gold0000644000000000000000000000205713405536617026563 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (= s0 s1)) [GOOD] (define-fun s3 () Bool (distinct s0 s1)) [GOOD] (define-fun s4 () Bool (and s2 s3)) [GOOD] (assert s4) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_existsexists_satisfiable_c.gold0000644000000000000000000000221113405536617026164 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () (_ BitVec 8) (bvadd s1 s2)) [GOOD] (define-fun s4 () Bool (= s0 s3)) [GOOD] (assert s4) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x01)) [SEND] (get-value (s1)) [RECV] ((s1 #x00)) *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_existsexists_satisfiable_p.gold0000644000000000000000000000221113405536617026201 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () (_ BitVec 8) (bvadd s1 s2)) [GOOD] (define-fun s4 () Bool (= s0 s3)) [GOOD] (assert s4) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x01)) [SEND] (get-value (s1)) [RECV] ((s1 #x00)) *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_existsexists_thm_c.gold0000644000000000000000000000222213405536617024470 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () (_ BitVec 8) (bvsub s1 s0)) [GOOD] (define-fun s3 () (_ BitVec 8) (bvadd s0 s2)) [GOOD] (define-fun s4 () Bool (= s1 s3)) [GOOD] (assert s4) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x00)) [SEND] (get-value (s1)) [RECV] ((s1 #x00)) *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_existsexists_thm_p.gold0000644000000000000000000000222213405536617024505 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () (_ BitVec 8) (bvsub s1 s0)) [GOOD] (define-fun s3 () (_ BitVec 8) (bvadd s0 s2)) [GOOD] (define-fun s4 () Bool (= s1 s3)) [GOOD] (assert s4) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x00)) [SEND] (get-value (s1)) [RECV] ((s1 #x00)) *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_existsforall_contradiction_c.gold0000644000000000000000000000203413405536617026501 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s1 (_ BitVec 8))) (let ((s2 (= s0 s1))) (let ((s3 (distinct s0 s1))) (let ((s4 (and s2 s3))) s4))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_existsforall_contradiction_p.gold0000644000000000000000000000203413405536617026516 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s1 (_ BitVec 8))) (let ((s2 (= s0 s1))) (let ((s3 (distinct s0 s1))) (let ((s4 (and s2 s3))) s4))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_existsforall_satisfiable_c.gold0000644000000000000000000000203113405536617026124 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s1 (_ BitVec 8))) (let ((s3 (bvadd s1 s2))) (let ((s4 (= s0 s3))) s4)))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_existsforall_satisfiable_p.gold0000644000000000000000000000203113405536617026141 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s1 (_ BitVec 8))) (let ((s3 (bvadd s1 s2))) (let ((s4 (= s0 s3))) s4)))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_existsforall_thm_c.gold0000644000000000000000000000210413405536617024427 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s1 (_ BitVec 8))) (let ((s2 (bvsub s1 s0))) (let ((s3 (bvadd s0 s2))) (let ((s4 (= s1 s3))) s4))))) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x00)) *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_existsforall_thm_p.gold0000644000000000000000000000210413405536617024444 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "x" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s1 (_ BitVec 8))) (let ((s2 (bvsub s1 s0))) (let ((s3 (bvadd s0 s2))) (let ((s4 (= s1 s3))) s4))))) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x00)) *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_forallexists_contradiction_c.gold0000644000000000000000000000206213405536617026502 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s1 ((_ BitVec 8)) (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8))) (let ((s2 (= s0 (s1 s0)))) (let ((s3 (distinct s0 (s1 s0)))) (let ((s4 (and s2 s3))) s4))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_forallexists_contradiction_p.gold0000644000000000000000000000206213405536617026517 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s1 ((_ BitVec 8)) (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8))) (let ((s2 (= s0 (s1 s0)))) (let ((s3 (distinct s0 (s1 s0)))) (let ((s4 (and s2 s3))) s4))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_forallexists_satisfiable_c.gold0000644000000000000000000000205013405536617026125 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s1 ((_ BitVec 8)) (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8))) (let ((s3 (bvadd (s1 s0) s2))) (let ((s4 (= s0 s3))) s4)))) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_forallexists_satisfiable_p.gold0000644000000000000000000000205013405536617026142 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s1 ((_ BitVec 8)) (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8))) (let ((s3 (bvadd (s1 s0) s2))) (let ((s4 (= s0 s3))) s4)))) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_forallexists_thm_c.gold0000644000000000000000000000205713405536617024436 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s1 ((_ BitVec 8)) (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8))) (let ((s2 (bvsub (s1 s0) s0))) (let ((s3 (bvadd s0 s2))) (let ((s4 (= (s1 s0) s3))) s4))))) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_forallexists_thm_p.gold0000644000000000000000000000205713405536617024453 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s1 ((_ BitVec 8)) (_ BitVec 8)) ; tracks user variable "y" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8))) (let ((s2 (bvsub (s1 s0) s0))) (let ((s3 (bvadd s0 s2))) (let ((s4 (= (s1 s0) s3))) s4))))) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_forallforall_contradiction_c.gold0000644000000000000000000000200313405536617026435 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8)) (s1 (_ BitVec 8))) (let ((s2 (= s0 s1))) (let ((s3 (distinct s0 s1))) (let ((s4 (and s2 s3))) s4))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_forallforall_contradiction_p.gold0000644000000000000000000000200313405536617026452 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8)) (s1 (_ BitVec 8))) (let ((s2 (= s0 s1))) (let ((s3 (distinct s0 s1))) (let ((s4 (and s2 s3))) s4))))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_forallforall_satisfiable_c.gold0000644000000000000000000000200013405536617026060 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8)) (s1 (_ BitVec 8))) (let ((s3 (bvadd s1 s2))) (let ((s4 (= s0 s3))) s4)))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_forallforall_satisfiable_p.gold0000644000000000000000000000200013405536617026075 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8)) (s1 (_ BitVec 8))) (let ((s3 (bvadd s1 s2))) (let ((s4 (= s0 s3))) s4)))) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_forallforall_thm_c.gold0000644000000000000000000000200013405536617024362 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8)) (s1 (_ BitVec 8))) (let ((s2 (bvsub s1 s0))) (let ((s3 (bvadd s0 s2))) (let ((s4 (= s1 s3))) s4))))) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/quantified_sat_forallforall_thm_p.gold0000644000000000000000000000200013405536617024377 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert (forall ((s0 (_ BitVec 8)) (s1 (_ BitVec 8))) (let ((s2 (bvsub s1 s0))) (let ((s3 (bvadd s0 s2))) (let ((s4 (= s1 s3))) s4))))) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/query1.gold0000644000000000000000000001613313405536617016713 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-unsat-cores true) [GOOD] (set-option :produce-unsat-assumptions true) [GOOD] (set-option :produce-proofs true) [GOOD] (set-option :produce-interpolants true) [GOOD] (set-option :random-seed 123) [GOOD] (set-option :produce-assertions true) [GOOD] (set-option :smt.mbqi true) [GOOD] (set-option :produce-assignments true) [GOOD] (set-info :status sat) [GOOD] (set-info :bad what) [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s6 () Int 0) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "a" [GOOD] (declare-fun s1 () Int) ; tracks user variable "b" [GOOD] (declare-fun s2 () (_ FloatingPoint 8 24)) ; tracks user variable "c" [GOOD] (declare-fun s3 () Bool) ; tracks user variable "d" [GOOD] (declare-fun s4 () Real) ; tracks user variable "e" [GOOD] (declare-fun s5 () (_ BitVec 8)) [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s7 () Bool (> s0 s6)) [GOOD] (define-fun s8 () Bool (> s1 s6)) [GOOD] (assert (! s7 :named |a > 0|)) [GOOD] (assert s8) [GOOD] (define-fun s9 () Int 2) [GOOD] (define-fun s11 () Int 5) [GOOD] (define-fun s10 () Int (+ s0 s9)) [GOOD] (define-fun s12 () Bool (>= s10 s11)) [GOOD] (assert s12) [GOOD] (define-fun s14 () Int 12) [GOOD] (define-fun s13 () Int (+ s0 s1)) [GOOD] (define-fun s15 () Bool (< s13 s14)) [GOOD] (assert (! s15 :named |a+b_<_12|)) [SEND] (get-option :diagnostic-output-channel) [RECV] stdout [SEND] (get-option :produce-assertions) [RECV] true [SEND] (get-option :produce-assignments) [RECV] true [SEND] (get-option :produce-proofs) [RECV] true [SEND] (get-option :produce-interpolants) [RECV] true [SEND] (get-option :produce-unsat-assumptions) [RECV] unsupported [SEND] (get-option :produce-unsat-cores) [SKIP] ; :produce-unsat-assumptions line: 44 position: 0 [RECV] true [SEND] (get-option :random-seed) [RECV] 123 [SEND] (get-option :reproducible-resource-limit) [RECV] unsupported [SEND] (get-option :verbosity) [SKIP] ; :reproducible-resource-limit line: 47 position: 0 [RECV] 0 [SEND] (get-option :smt.mbqi) [RECV] true [SEND] (get-option :smt.mbqi) [RECV] true [SEND] (get-info :reason-unknown) [RECV] (:reason-unknown "state of the most recent check-sat command is not known") [SEND] (get-info :version) [RECV] (:version "4.8.4") [SEND] (get-info :status) [RECV] (:status sat) [GOOD] (define-fun s16 () Int 4) [GOOD] (define-fun s17 () Bool (> s0 s16)) [GOOD] (assert (! s17 :named |later, a > 4|)) [SEND] (check-sat) [RECV] sat [GOOD] (set-info :status unknown) [GOOD] (define-fun s18 () Bool (> s0 s9)) [GOOD] (declare-const __assumption_proxy_s18_19 Bool) [GOOD] (assert (= __assumption_proxy_s18_19 s18)) [SEND] (check-sat-assuming (__assumption_proxy_s18_19)) [RECV] sat [GOOD] (declare-const __assumption_proxy_s18_20 Bool) [GOOD] (assert (= __assumption_proxy_s18_20 s18)) [SEND] (check-sat-assuming (__assumption_proxy_s18_20)) [RECV] sat [SEND] (get-assignment) [RECV] ((s_1 true) (s7 true) (|a > 0| true) (s15 true) (s_2 false) (s8 true) (a+b_<_12 true) (s17 true) (|later, a > 4| true) (s18 true) (s12 true)) [SEND] (get-info :assertion-stack-levels) [RECV] (:assertion-stack-levels 0) [SEND] (get-info :authors) [RECV] (:authors "Leonardo de Moura, Nikolaj Bjorner and Christoph Wintersteiger") [SEND] (get-info :error-behavior) [RECV] (:error-behavior continued-execution) [SEND] (get-info :name) [RECV] (:name "Z3") [SEND] (get-info :reason-unknown) [RECV] (:reason-unknown "unknown") [SEND] (get-info :version) [RECV] (:version "4.8.4") [SEND] (get-info :memory) [RECV] unsupported [SEND] (get-info :time) [SKIP] ; :memory line: 73 position: 0 [RECV] unsupported [SEND] (get-value (s0)) [SKIP] ; :time line: 74 position: 0 [RECV] ((s0 5)) [SEND] (get-value (s1)) [RECV] ((s1 1)) [GOOD] (define-fun s21 () Int 100) [GOOD] (define-fun s23 () Int 9) [GOOD] (define-fun s22 () Bool (> s0 s21)) [GOOD] (define-fun s24 () Bool (> s0 s23)) [GOOD] (declare-const __assumption_proxy_s22_25 Bool) [GOOD] (assert (= __assumption_proxy_s22_25 s22)) [GOOD] (declare-const __assumption_proxy_s24_26 Bool) [GOOD] (assert (= __assumption_proxy_s24_26 s24)) [SEND] (check-sat-assuming (__assumption_proxy_s22_25 __assumption_proxy_s24_26)) [RECV] unsat [SEND] (get-unsat-assumptions) [RECV] (a+b_<_12 __assumption_proxy_s22_25) *** In call to 'getUnsatAssumptions' *** *** Unexpected assumption named: "a+b_<_12" *** Was expecting one of : ["s22","s24"] *** *** This can happen if unsat-cores are also enabled. Ignoring. [GOOD] (push 5) [GOOD] (pop 3) [GOOD] (define-fun s27 () Int 6) [GOOD] (define-fun s28 () Bool (> s0 s27)) [GOOD] (assert (! s28 :named |bey|)) [GOOD] (define-fun s29 () Bool (< s0 s27)) [GOOD] (assert (! s29 :named |hey|)) [SEND] (check-sat) [RECV] unsat [SEND, TimeOut: 80000ms] (get-unsat-core) [RECV] (bey hey) [SEND] (get-proof) [RECV] ((set-logic ALL) (declare-fun bey () Bool) (declare-fun hey () Bool) (proof (let (($x177 (<= s0 6))) (let (($x178 (not $x177))) (let (($x239 (or (not bey) $x178))) (let ((@x237 (monotonicity (rewrite (= (> s0 6) $x178)) (= (=> bey (> s0 6)) (=> bey $x178))))) (let ((@x243 (trans @x237 (rewrite (= (=> bey $x178) $x239)) (= (=> bey (> s0 6)) $x239)))) (let ((@x244 (mp (asserted (=> bey (> s0 6))) @x243 $x239))) (let (($x256 (>= s0 6))) (let (($x255 (not $x256))) (let (($x265 (or (not hey) $x255))) (let ((@x258 (monotonicity (rewrite (= (<= 6 s0) $x256)) (= (not (<= 6 s0)) $x255)))) (let ((@x260 (trans (rewrite (= (< s0 6) (not (<= 6 s0)))) @x258 (= (< s0 6) $x255)))) (let ((@x269 (trans (monotonicity @x260 (= (=> hey (< s0 6)) (=> hey $x255))) (rewrite (= (=> hey $x255) $x265)) (= (=> hey (< s0 6)) $x265)))) (let ((@x270 (mp (asserted (=> hey (< s0 6))) @x269 $x265))) (unit-resolution ((_ th-lemma arith farkas 1 1) (or $x256 $x177)) (unit-resolution @x270 (asserted hey) $x255) (unit-resolution @x244 (asserted bey) $x178) false)))))))))))))))) [SEND, TimeOut: 90000ms] (get-assertions) [RECV] ((! s7 :named |a > 0|) s8 s12 (! s15 :named |a+b_<_12|) (! s17 :named |later, a > 4|) (= __assumption_proxy_s18_19 s18) (= __assumption_proxy_s18_20 s18) (= __assumption_proxy_s22_25 s22) (= __assumption_proxy_s24_26 s24) (! s28 :named |bey|) (! s29 :named |hey|)) [SEND] (echo "there we go") [RECV] "there we go" *** Solver : Z3 *** Exit code: ExitSuccess FINAL:Satisfiable. Model: a = 332 :: Integer b = 3 :: Integer c = 2.3 :: Float d = True :: Bool e = 3.12 :: Real s5 = -12 :: Int8 DONE! sbv-7.13/SBVTestSuite/GoldFiles/query_abc.gold0000644000000000000000000000236613405536617017442 0ustar0000000000000000** Calling: abc -S "%blast; &sweep -C 5000; &syn4; &cec -s -m -C 2000" [ISSUE] ; Automatically generated by SBV. Do not edit. ** Skipping heart-beat for the solver ABC ** Backend solver ABC does not support global decls. ** Some incremental calls, such as pop, will be limited. [ISSUE] (set-option :diagnostic-output-channel "stdout") [ISSUE] (set-option :produce-models true) [ISSUE] (set-logic QF_BV) [ISSUE] ; --- uninterpreted sorts --- [ISSUE] ; --- literal constants --- [ISSUE] (define-fun s_2 () Bool false) [ISSUE] (define-fun s_1 () Bool true) [ISSUE] (define-fun s2 () (_ BitVec 32) #x00000000) [ISSUE] ; --- skolem constants --- [ISSUE] (declare-fun s0 () (_ BitVec 32)) ; tracks user variable "a" [ISSUE] (declare-fun s1 () (_ BitVec 32)) ; tracks user variable "b" [ISSUE] ; --- constant tables --- [ISSUE] ; --- skolemized tables --- [ISSUE] ; --- arrays --- [ISSUE] ; --- uninterpreted constants --- [ISSUE] ; --- user given axioms --- [ISSUE] ; --- formula --- [ISSUE] (define-fun s3 () Bool (bvsgt s0 s2)) [ISSUE] (define-fun s4 () Bool (bvsgt s1 s2)) [ISSUE] (assert s3) [ISSUE] (assert s4) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x1)) [SEND] (get-value (s1)) [RECV] ((s1 #x1)) *** Solver : ABC *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/query_badOption.gold0000644000000000000000000000430313405536617020625 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [FAIL] (set-option :there-is-no-such-option bad argument) *** Data.SBV: Unexpected non-success response from Z3: *** *** Sent : (set-option :there-is-no-such-option bad argument) *** Expected : success *** Received : (error "line 5 column 37: unknown parameter 'there_is_no_such_option' *** Legal parameters are: *** auto_config (bool) (default: true) *** debug_ref_count (bool) (default: false) *** dot_proof_file (string) (default: proof.dot) *** dump_models (bool) (default: false) *** memory_high_watermark (unsigned int) (default: 0) *** memory_max_alloc_count (unsigned int) (default: 0) *** memory_max_size (unsigned int) (default: 0) *** model (bool) (default: true) *** model_compress (bool) (default: true) *** model_validate (bool) (default: false) *** proof (bool) (default: false) *** rlimit (unsigned int) (default: 0) *** smtlib2_compliant (bool) (default: false) *** stats (bool) (default: false) *** timeout (unsigned int) (default: 4294967295) *** trace (bool) (default: false) *** trace_file_name (string) (default: z3.log) *** type_check (bool) (default: true) *** unsat_core (bool) (default: false) *** verbose (unsigned int) (default: 0) *** warning (bool) (default: true) *** well_sorted_check (bool) (default: false)") *** *** Exit code : ExitFailure (-15) *** Executable: /usr/local/bin/z3 *** Options : -nw -in -smt2 *** *** Reason : Backend solver reports it does not support this option. *** Check the spelling, and if correct please report this as a *** bug/feature request with the solver! sbv-7.13/SBVTestSuite/GoldFiles/query_boolector.gold0000644000000000000000000000401213405536617020673 0ustar0000000000000000** Calling: boolector --smt2 --smt2-model --no-exit-codes --incremental [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) ** Backend solver Boolector does not support global decls. ** Some incremental calls, such as pop, will be limited. [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 32) #x00000000) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 32)) ; tracks user variable "a" [GOOD] (declare-fun s1 () (_ BitVec 32)) ; tracks user variable "b" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (bvsgt s0 s2)) [GOOD] (define-fun s4 () Bool (bvsgt s1 s2)) [GOOD] (assert s3) [GOOD] (assert s4) [GOOD] (define-fun s5 () (_ BitVec 32) #x00000002) [GOOD] (define-fun s7 () (_ BitVec 32) #x0000000f) [GOOD] (define-fun s6 () (_ BitVec 32) (bvadd s0 s5)) [GOOD] (define-fun s8 () Bool (bvsle s6 s7)) [GOOD] (assert s8) [GOOD] (define-fun s9 () (_ BitVec 32) #x00000003) [GOOD] (define-fun s10 () Bool (bvslt s0 s9)) [GOOD] (assert s10) [GOOD] (define-fun s11 () Bool (bvslt s1 s5)) [GOOD] (assert s11) [GOOD] (define-fun s13 () (_ BitVec 32) #x0000000c) [GOOD] (define-fun s12 () (_ BitVec 32) (bvadd s0 s1)) [GOOD] (define-fun s14 () Bool (bvslt s12 s13)) [GOOD] (assert s14) [GOOD] (define-fun s15 () Bool (bvslt s0 s5)) [GOOD] (assert s15) [SEND] (check-sat) [RECV] sat [GOOD] (define-fun s16 () (_ BitVec 32) #x00000001) [GOOD] (define-fun s17 () Bool (bvsge s0 s16)) [GOOD] (assert s17) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #b00000000000000000000000000000001)) [SEND] (get-value (s1)) [RECV] ((s1 #b00000000000000000000000000000001)) *** Solver : Boolector *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/query_Chars1.gold0000644000000000000000000000272213405536617020032 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () Int 65) [GOOD] (define-fun s4 () Int 66) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "a" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s1 () Int (+ (ite (= ((_ extract 0 0) s0) #b1) 1 0) (ite (= ((_ extract 1 1) s0) #b1) 2 0) (ite (= ((_ extract 2 2) s0) #b1) 4 0) (ite (= ((_ extract 3 3) s0) #b1) 8 0) (ite (= ((_ extract 4 4) s0) #b1) 16 0) (ite (= ((_ extract 5 5) s0) #b1) 32 0) (ite (= ((_ extract 6 6) s0) #b1) 64 0) (ite (= ((_ extract 7 7) s0) #b1) 128 0))) [GOOD] (define-fun s3 () Bool (>= s1 s2)) [GOOD] (define-fun s5 () Bool (< s1 s4)) [GOOD] (assert s3) [GOOD] (assert s5) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x41)) *** Solver : Z3 *** Exit code: ExitSuccess FINAL OUTPUT: 'A' sbv-7.13/SBVTestSuite/GoldFiles/query_cvc4.gold0000644000000000000000000000417713405536617017556 0ustar0000000000000000** Calling: cvc4 --lang smt --incremental --interactive --no-interactive-prompt [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 32) #x00000000) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 32)) ; tracks user variable "a" [GOOD] (declare-fun s1 () (_ BitVec 32)) ; tracks user variable "b" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (bvsgt s0 s2)) [GOOD] (define-fun s4 () Bool (bvsgt s1 s2)) [GOOD] (assert (! s3 :named |a > 0|)) [GOOD] (assert s4) [GOOD] (define-fun s5 () (_ BitVec 32) #x00000002) [GOOD] (define-fun s7 () (_ BitVec 32) #x0000000f) [GOOD] (define-fun s6 () (_ BitVec 32) (bvadd s0 s5)) [GOOD] (define-fun s8 () Bool (bvsle s6 s7)) [GOOD] (assert s8) [GOOD] (define-fun s9 () (_ BitVec 32) #x00000003) [GOOD] (define-fun s10 () Bool (bvslt s0 s9)) [GOOD] (assert s10) [GOOD] (define-fun s11 () Bool (bvslt s1 s5)) [GOOD] (assert s11) [GOOD] (define-fun s13 () (_ BitVec 32) #x0000000c) [GOOD] (define-fun s12 () (_ BitVec 32) (bvadd s0 s1)) [GOOD] (define-fun s14 () Bool (bvslt s12 s13)) [GOOD] (assert (! s14 :named |a+b_<_12|)) [GOOD] (push 1) [GOOD] (define-fun s15 () Bool (bvslt s0 s5)) [GOOD] (assert s15) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 (_ bv1 32))) [GOOD] (pop 1) [GOOD] (define-fun s16 () (_ BitVec 32) #x00000001) [GOOD] (define-fun s17 () Bool (bvsgt s0 s16)) [GOOD] (assert (! s17 :named |extra|)) [GOOD] (assert s11) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 (_ bv2 32))) [SEND] (get-value (s1)) [RECV] ((s1 (_ bv1 32))) *** Solver : CVC4 *** Exit code: ExitSuccess *** Std-out : sbv-7.13/SBVTestSuite/GoldFiles/query_Interpolant1.gold0000644000000000000000000000314013405536617021264 0ustar0000000000000000** Calling: mathsat -input=smt2 -theory.fp.minmax_zero_mode=4 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) ** Backend solver MathSAT does not support global decls. ** Some incremental calls, such as pop, will be limited. [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-interpolants true) [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "a" [GOOD] (declare-fun s1 () Int) ; tracks user variable "b" [GOOD] (declare-fun s2 () Int) ; tracks user variable "c" [GOOD] (declare-fun s3 () Int) ; tracks user variable "d" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s4 () Bool (= s0 s1)) [GOOD] (define-fun s5 () Bool (= s0 s2)) [GOOD] (define-fun s6 () Bool (and s4 s5)) [GOOD] (define-fun s7 () Bool (= s1 s3)) [GOOD] (define-fun s8 () Bool (= s2 s3)) [GOOD] (define-fun s9 () Bool (not s8)) [GOOD] (define-fun s10 () Bool (and s7 s9)) [GOOD] (assert (! s6 :interpolation-group |c1|)) [GOOD] (assert (! s10 :interpolation-group |c2|)) [SEND] (check-sat) [RECV] unsat [SEND] (get-interpolant (|c1|)) [RECV] (= s1 s2) *** Solver : MathSAT *** Exit code: ExitSuccess FINAL OUTPUT: "(= s1 s2)" sbv-7.13/SBVTestSuite/GoldFiles/query_Interpolant2.gold0000644000000000000000000000352313405536617021272 0ustar0000000000000000** Calling: mathsat -input=smt2 -theory.fp.minmax_zero_mode=4 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) ** Backend solver MathSAT does not support global decls. ** Some incremental calls, such as pop, will be limited. [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-interpolants true) [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "a" [GOOD] (declare-fun s1 () Int) ; tracks user variable "b" [GOOD] (declare-fun s2 () Int) ; tracks user variable "c" [GOOD] (declare-fun s3 () Int) ; tracks user variable "d" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] (declare-fun f (Int) Int) [GOOD] (declare-fun g (Int) Int) [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s4 () Int (f s0)) [GOOD] (define-fun s5 () Bool (= s2 s4)) [GOOD] (define-fun s6 () Int (f s1)) [GOOD] (define-fun s7 () Bool (= s3 s6)) [GOOD] (define-fun s8 () Bool (and s5 s7)) [GOOD] (define-fun s9 () Bool (= s0 s1)) [GOOD] (define-fun s10 () Int (g s2)) [GOOD] (define-fun s11 () Int (g s3)) [GOOD] (define-fun s12 () Bool (distinct s10 s11)) [GOOD] (define-fun s13 () Bool (and s9 s12)) [GOOD] (assert (! s8 :interpolation-group |c1|)) [GOOD] (assert (! s13 :interpolation-group |c2|)) [SEND] (check-sat) [RECV] unsat [SEND] (get-interpolant (|c1|)) [RECV] (not (and (= s0 s1) (not (= s2 s3)))) *** Solver : MathSAT *** Exit code: ExitSuccess FINAL OUTPUT: "(not (and (= s0 s1) (not (= s2 s3))))" sbv-7.13/SBVTestSuite/GoldFiles/query_Lists1.gold0000644000000000000000000000245013405536617020066 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s1 () (Seq Int) (seq.++ (seq.unit 1) (seq.unit 2) (seq.unit 3) (seq.unit 4) (seq.unit 5))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (Seq Int)) ; tracks user variable "a" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (= s0 s1)) [GOOD] (assert s2) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 (seq.++ (seq.unit 1) (seq.++ (seq.unit 2) (seq.++ (seq.unit 3) (seq.++ (seq.unit 4) (seq.unit 5))))))) *** Solver : Z3 *** Exit code: ExitSuccess FINAL OUTPUT: [1,2,3,4,5] sbv-7.13/SBVTestSuite/GoldFiles/query_mathsat.gold0000644000000000000000000000410413405536617020346 0ustar0000000000000000** Calling: mathsat -input=smt2 -theory.fp.minmax_zero_mode=4 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) ** Backend solver MathSAT does not support global decls. ** Some incremental calls, such as pop, will be limited. [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 32) #x00000000) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 32)) ; tracks user variable "a" [GOOD] (declare-fun s1 () (_ BitVec 32)) ; tracks user variable "b" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (bvsgt s0 s2)) [GOOD] (define-fun s4 () Bool (bvsgt s1 s2)) [GOOD] (assert (! s3 :named |a > 0|)) [GOOD] (assert s4) [GOOD] (define-fun s5 () (_ BitVec 32) #x00000002) [GOOD] (define-fun s7 () (_ BitVec 32) #x0000000f) [GOOD] (define-fun s6 () (_ BitVec 32) (bvadd s0 s5)) [GOOD] (define-fun s8 () Bool (bvsle s6 s7)) [GOOD] (assert s8) [GOOD] (define-fun s9 () (_ BitVec 32) #x00000003) [GOOD] (define-fun s10 () Bool (bvslt s0 s9)) [GOOD] (assert s10) [GOOD] (define-fun s11 () Bool (bvslt s1 s5)) [GOOD] (assert s11) [GOOD] (define-fun s13 () (_ BitVec 32) #x0000000c) [GOOD] (define-fun s12 () (_ BitVec 32) (bvadd s0 s1)) [GOOD] (define-fun s14 () Bool (bvslt s12 s13)) [GOOD] (assert (! s14 :named |a+b_<_12|)) [GOOD] (define-fun s15 () Bool (bvslt s0 s5)) [GOOD] (assert s15) [SEND] (check-sat) [RECV] sat [GOOD] (define-fun s16 () (_ BitVec 32) #x00000001) [GOOD] (define-fun s17 () Bool (bvsge s0 s16)) [GOOD] (assert (! s17 :named |extra|)) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ( (s0 (_ bv1 32)) ) [SEND] (get-value (s1)) [RECV] ( (s1 (_ bv1 32)) ) *** Solver : MathSAT *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/query_Strings1.gold0000644000000000000000000000201313405536617020414 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () String) ; tracks user variable "a" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s1 () Bool (str.in.re s0 ((_ re.loop 5 5) (str.to.re "xyz")))) [GOOD] (assert s1) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 "xyzxyzxyzxyzxyz")) *** Solver : Z3 *** Exit code: ExitSuccess FINAL OUTPUT: ["xyzxyzxyzxyzxyz"] sbv-7.13/SBVTestSuite/GoldFiles/query_yices.gold0000644000000000000000000000403313405536617020022 0ustar0000000000000000** Calling: yices-smt2 --incremental [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) ** Backend solver Yices does not support global decls. ** Some incremental calls, such as pop, will be limited. [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 32) #x00000000) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 32)) ; tracks user variable "a" [GOOD] (declare-fun s1 () (_ BitVec 32)) ; tracks user variable "b" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (bvsgt s0 s2)) [GOOD] (define-fun s4 () Bool (bvsgt s1 s2)) [GOOD] (assert (! s3 :named |a > 0|)) [GOOD] (assert s4) [GOOD] (define-fun s5 () (_ BitVec 32) #x00000002) [GOOD] (define-fun s7 () (_ BitVec 32) #x0000000f) [GOOD] (define-fun s6 () (_ BitVec 32) (bvadd s0 s5)) [GOOD] (define-fun s8 () Bool (bvsle s6 s7)) [GOOD] (assert s8) [GOOD] (define-fun s9 () (_ BitVec 32) #x00000003) [GOOD] (define-fun s10 () Bool (bvslt s0 s9)) [GOOD] (assert s10) [GOOD] (define-fun s11 () Bool (bvslt s1 s5)) [GOOD] (assert s11) [GOOD] (define-fun s13 () (_ BitVec 32) #x0000000c) [GOOD] (define-fun s12 () (_ BitVec 32) (bvadd s0 s1)) [GOOD] (define-fun s14 () Bool (bvslt s12 s13)) [GOOD] (assert (! s14 :named |a+b_<_12|)) [GOOD] (define-fun s15 () Bool (bvslt s0 s5)) [GOOD] (assert s15) [SEND] (check-sat) [RECV] sat [GOOD] (define-fun s16 () (_ BitVec 32) #x00000001) [GOOD] (define-fun s17 () Bool (bvsge s0 s16)) [GOOD] (assert (! s17 :named |extra|)) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #b00000000000000000000000000000001)) [SEND] (get-value (s1)) [RECV] ((s1 #b00000000000000000000000000000001)) *** Solver : Yices *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/query_z3.gold0000644000000000000000000000414613405536617017247 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s2 () (_ BitVec 32) #x00000000) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 32)) ; tracks user variable "a" [GOOD] (declare-fun s1 () (_ BitVec 32)) ; tracks user variable "b" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (bvsgt s0 s2)) [GOOD] (define-fun s4 () Bool (bvsgt s1 s2)) [GOOD] (assert (! s3 :named |a > 0|)) [GOOD] (assert s4) [GOOD] (define-fun s5 () (_ BitVec 32) #x00000002) [GOOD] (define-fun s7 () (_ BitVec 32) #x0000000f) [GOOD] (define-fun s6 () (_ BitVec 32) (bvadd s0 s5)) [GOOD] (define-fun s8 () Bool (bvsle s6 s7)) [GOOD] (assert s8) [GOOD] (define-fun s9 () (_ BitVec 32) #x00000003) [GOOD] (define-fun s10 () Bool (bvslt s0 s9)) [GOOD] (assert s10) [GOOD] (define-fun s11 () Bool (bvslt s1 s5)) [GOOD] (assert s11) [GOOD] (define-fun s13 () (_ BitVec 32) #x0000000c) [GOOD] (define-fun s12 () (_ BitVec 32) (bvadd s0 s1)) [GOOD] (define-fun s14 () Bool (bvslt s12 s13)) [GOOD] (assert (! s14 :named |a+b_<_12|)) [GOOD] (push 1) [GOOD] (define-fun s15 () Bool (bvslt s0 s5)) [GOOD] (assert s15) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x00000001)) [GOOD] (pop 1) [GOOD] (define-fun s16 () (_ BitVec 32) #x00000001) [GOOD] (define-fun s17 () Bool (bvsgt s0 s16)) [GOOD] (assert (! s17 :named |extra|)) [GOOD] (assert s11) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x00000002)) [SEND] (get-value (s1)) [RECV] ((s1 #x00000001)) *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/queryArrays1.gold0000644000000000000000000000274613405536617020102 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_ABV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "a1" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "a2" [GOOD] (declare-fun s3 () (_ BitVec 8)) ; tracks user variable "v1" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] (declare-fun array_0 () (Array (_ BitVec 8) (_ BitVec 8))) [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (distinct s0 s1)) [GOOD] (assert s2) [GOOD] (declare-fun array_1 () (Array (_ BitVec 8) (_ BitVec 8))) [GOOD] (define-fun s4 () (_ BitVec 8) (select array_1 s0)) [GOOD] (define-fun s5 () Bool (= s3 s4)) [GOOD] (assert (= array_1 (store array_0 s0 s3))) [GOOD] (assert s5) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x00)) [SEND] (get-value (s1)) [RECV] ((s1 #xff)) [SEND] (get-value (s3)) [RECV] ((s3 #x00)) *** Solver : Z3 *** Exit code: ExitSuccess FINAL:(0,255,0) DONE! sbv-7.13/SBVTestSuite/GoldFiles/queryArrays2.gold0000644000000000000000000005422113405536617020076 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_UFBV) ; NB. User specified. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "i" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [GOOD] (define-fun s1 () (_ BitVec 8) #x00) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] (define-fun s3 () (_ BitVec 8) #x02) [GOOD] (define-fun s4 () (_ BitVec 8) #x03) [GOOD] (define-fun s5 () (_ BitVec 8) #x04) [GOOD] (define-fun s6 () (_ BitVec 8) #x05) [GOOD] (define-fun s7 () (_ BitVec 8) #x06) [GOOD] (define-fun s8 () (_ BitVec 8) #x07) [GOOD] (define-fun s9 () (_ BitVec 8) #x08) [GOOD] (define-fun s10 () (_ BitVec 8) #x09) [GOOD] (define-fun s11 () (_ BitVec 8) #x0a) [GOOD] (define-fun s12 () (_ BitVec 8) #x0b) [GOOD] (define-fun s13 () (_ BitVec 8) #x0c) [GOOD] (define-fun s14 () (_ BitVec 8) #x0d) [GOOD] (define-fun s15 () (_ BitVec 8) #x0e) [GOOD] (define-fun s16 () (_ BitVec 8) #x0f) [GOOD] (define-fun s17 () (_ BitVec 8) #x10) [GOOD] (define-fun s18 () (_ BitVec 8) #x11) [GOOD] (define-fun s19 () (_ BitVec 8) #x12) [GOOD] (define-fun s20 () (_ BitVec 8) #x13) [GOOD] (define-fun s21 () (_ BitVec 8) #x14) [GOOD] (define-fun s22 () (_ BitVec 8) #x15) [GOOD] (define-fun s23 () (_ BitVec 8) #x16) [GOOD] (define-fun s24 () (_ BitVec 8) #x17) [GOOD] (define-fun s25 () (_ BitVec 8) #x18) [GOOD] (define-fun s26 () (_ BitVec 8) #x19) [GOOD] (define-fun s27 () (_ BitVec 8) #x1a) [GOOD] (define-fun s28 () (_ BitVec 8) #x1b) [GOOD] (define-fun s29 () (_ BitVec 8) #x1c) [GOOD] (define-fun s30 () (_ BitVec 8) #x1d) [GOOD] (define-fun s31 () (_ BitVec 8) #x1e) [GOOD] (define-fun s32 () (_ BitVec 8) #x1f) [GOOD] (define-fun s33 () (_ BitVec 8) #x20) [GOOD] (define-fun s34 () (_ BitVec 8) #x21) [GOOD] (define-fun s35 () (_ BitVec 8) #x22) [GOOD] (define-fun s36 () (_ BitVec 8) #x23) [GOOD] (define-fun s37 () (_ BitVec 8) #x24) [GOOD] (define-fun s38 () (_ BitVec 8) #x25) [GOOD] (define-fun s39 () (_ BitVec 8) #x26) [GOOD] (define-fun s40 () (_ BitVec 8) #x27) [GOOD] (define-fun s41 () (_ BitVec 8) #x28) [GOOD] (define-fun s42 () (_ BitVec 8) #x29) [GOOD] (define-fun s43 () (_ BitVec 8) #x2a) [GOOD] (define-fun s44 () (_ BitVec 8) #x2b) [GOOD] (define-fun s45 () (_ BitVec 8) #x2c) [GOOD] (define-fun s46 () (_ BitVec 8) #x2d) [GOOD] (define-fun s47 () (_ BitVec 8) #x2e) [GOOD] (define-fun s48 () (_ BitVec 8) #x2f) [GOOD] (define-fun s49 () (_ BitVec 8) #x30) [GOOD] (define-fun s50 () (_ BitVec 8) #x31) [GOOD] (define-fun s51 () (_ BitVec 8) #x32) [GOOD] (define-fun s52 () (_ BitVec 8) #x33) [GOOD] (define-fun s53 () (_ BitVec 8) #x34) [GOOD] (define-fun s54 () (_ BitVec 8) #x35) [GOOD] (define-fun s55 () (_ BitVec 8) #x36) [GOOD] (define-fun s56 () (_ BitVec 8) #x37) [GOOD] (define-fun s57 () (_ BitVec 8) #x38) [GOOD] (define-fun s58 () (_ BitVec 8) #x39) [GOOD] (define-fun s59 () (_ BitVec 8) #x3a) [GOOD] (define-fun s60 () (_ BitVec 8) #x3b) [GOOD] (define-fun s61 () (_ BitVec 8) #x3c) [GOOD] (define-fun s62 () (_ BitVec 8) #x3d) [GOOD] (define-fun s63 () (_ BitVec 8) #x3e) [GOOD] (define-fun s64 () (_ BitVec 8) #x3f) [GOOD] (define-fun s65 () (_ BitVec 8) #x40) [GOOD] (define-fun s66 () (_ BitVec 8) #x41) [GOOD] (define-fun s67 () (_ BitVec 8) #x42) [GOOD] (define-fun s68 () (_ BitVec 8) #x43) [GOOD] (define-fun s69 () (_ BitVec 8) #x44) [GOOD] (define-fun s70 () (_ BitVec 8) #x45) [GOOD] (define-fun s71 () (_ BitVec 8) #x46) [GOOD] (define-fun s72 () (_ BitVec 8) #x47) [GOOD] (define-fun s73 () (_ BitVec 8) #x48) [GOOD] (define-fun s74 () (_ BitVec 8) #x49) [GOOD] (define-fun s75 () (_ BitVec 8) #x4a) [GOOD] (define-fun s76 () (_ BitVec 8) #x4b) [GOOD] (define-fun s77 () (_ BitVec 8) #x4c) [GOOD] (define-fun s78 () (_ BitVec 8) #x4d) [GOOD] (define-fun s79 () (_ BitVec 8) #x4e) [GOOD] (define-fun s80 () (_ BitVec 8) #x4f) [GOOD] (define-fun s81 () (_ BitVec 8) #x50) [GOOD] (define-fun s82 () (_ BitVec 8) #x51) [GOOD] (define-fun s83 () (_ BitVec 8) #x52) [GOOD] (define-fun s84 () (_ BitVec 8) #x53) [GOOD] (define-fun s85 () (_ BitVec 8) #x54) [GOOD] (define-fun s86 () (_ BitVec 8) #x55) [GOOD] (define-fun s87 () (_ BitVec 8) #x56) [GOOD] (define-fun s88 () (_ BitVec 8) #x57) [GOOD] (define-fun s89 () (_ BitVec 8) #x58) [GOOD] (define-fun s90 () (_ BitVec 8) #x59) [GOOD] (define-fun s91 () (_ BitVec 8) #x5a) [GOOD] (define-fun s92 () (_ BitVec 8) #x5b) [GOOD] (define-fun s93 () (_ BitVec 8) #x5c) [GOOD] (define-fun s94 () (_ BitVec 8) #x5d) [GOOD] (define-fun s95 () (_ BitVec 8) #x5e) [GOOD] (define-fun s96 () (_ BitVec 8) #x5f) [GOOD] (define-fun s97 () (_ BitVec 8) #x60) [GOOD] (define-fun s98 () (_ BitVec 8) #x61) [GOOD] (define-fun s99 () (_ BitVec 8) #x62) [GOOD] (define-fun s100 () (_ BitVec 8) #x63) [GOOD] (define-fun s101 () (_ BitVec 8) #x64) [GOOD] (define-fun s102 () (_ BitVec 8) #x65) [GOOD] (define-fun s103 () (_ BitVec 8) #x66) [GOOD] (define-fun s104 () (_ BitVec 8) #x67) [GOOD] (define-fun s105 () (_ BitVec 8) #x68) [GOOD] (define-fun s106 () (_ BitVec 8) #x69) [GOOD] (define-fun s107 () (_ BitVec 8) #x6a) [GOOD] (define-fun s108 () (_ BitVec 8) #x6b) [GOOD] (define-fun s109 () (_ BitVec 8) #x6c) [GOOD] (define-fun s110 () (_ BitVec 8) #x6d) [GOOD] (define-fun s111 () (_ BitVec 8) #x6e) [GOOD] (define-fun s112 () (_ BitVec 8) #x6f) [GOOD] (define-fun s113 () (_ BitVec 8) #x70) [GOOD] (define-fun s114 () (_ BitVec 8) #x71) [GOOD] (define-fun s115 () (_ BitVec 8) #x72) [GOOD] (define-fun s116 () (_ BitVec 8) #x73) [GOOD] (define-fun s117 () (_ BitVec 8) #x74) [GOOD] (define-fun s118 () (_ BitVec 8) #x75) [GOOD] (define-fun s119 () (_ BitVec 8) #x76) [GOOD] (define-fun s120 () (_ BitVec 8) #x77) [GOOD] (define-fun s121 () (_ BitVec 8) #x78) [GOOD] (define-fun s122 () (_ BitVec 8) #x79) [GOOD] (define-fun s123 () (_ BitVec 8) #x7a) [GOOD] (define-fun s124 () (_ BitVec 8) #x7b) [GOOD] (define-fun s125 () (_ BitVec 8) #x7c) [GOOD] (define-fun s126 () (_ BitVec 8) #x7d) [GOOD] (define-fun s127 () (_ BitVec 8) #x7e) [GOOD] (define-fun s128 () (_ BitVec 8) #x7f) [GOOD] (define-fun s129 () (_ BitVec 8) #x80) [GOOD] (define-fun s130 () (_ BitVec 8) #x81) [GOOD] (define-fun s131 () (_ BitVec 8) #x82) [GOOD] (define-fun s132 () (_ BitVec 8) #x83) [GOOD] (define-fun s133 () (_ BitVec 8) #x84) [GOOD] (define-fun s134 () (_ BitVec 8) #x85) [GOOD] (define-fun s135 () (_ BitVec 8) #x86) [GOOD] (define-fun s136 () (_ BitVec 8) #x87) [GOOD] (define-fun s137 () (_ BitVec 8) #x88) [GOOD] (define-fun s138 () (_ BitVec 8) #x89) [GOOD] (define-fun s139 () (_ BitVec 8) #x8a) [GOOD] (define-fun s140 () (_ BitVec 8) #x8b) [GOOD] (define-fun s141 () (_ BitVec 8) #x8c) [GOOD] (define-fun s142 () (_ BitVec 8) #x8d) [GOOD] (define-fun s143 () (_ BitVec 8) #x8e) [GOOD] (define-fun s144 () (_ BitVec 8) #x8f) [GOOD] (define-fun s145 () (_ BitVec 8) #x90) [GOOD] (define-fun s146 () (_ BitVec 8) #x91) [GOOD] (define-fun s147 () (_ BitVec 8) #x92) [GOOD] (define-fun s148 () (_ BitVec 8) #x93) [GOOD] (define-fun s149 () (_ BitVec 8) #x94) [GOOD] (define-fun s150 () (_ BitVec 8) #x95) [GOOD] (define-fun s151 () (_ BitVec 8) #x96) [GOOD] (define-fun s152 () (_ BitVec 8) #x97) [GOOD] (define-fun s153 () (_ BitVec 8) #x98) [GOOD] (define-fun s154 () (_ BitVec 8) #x99) [GOOD] (define-fun s155 () (_ BitVec 8) #x9a) [GOOD] (define-fun s156 () (_ BitVec 8) #x9b) [GOOD] (define-fun s157 () (_ BitVec 8) #x9c) [GOOD] (define-fun s158 () (_ BitVec 8) #x9d) [GOOD] (define-fun s159 () (_ BitVec 8) #x9e) [GOOD] (define-fun s160 () (_ BitVec 8) #x9f) [GOOD] (define-fun s161 () (_ BitVec 8) #xa0) [GOOD] (define-fun s162 () (_ BitVec 8) #xa1) [GOOD] (define-fun s163 () (_ BitVec 8) #xa2) [GOOD] (define-fun s164 () (_ BitVec 8) #xa3) [GOOD] (define-fun s165 () (_ BitVec 8) #xa4) [GOOD] (define-fun s166 () (_ BitVec 8) #xa5) [GOOD] (define-fun s167 () (_ BitVec 8) #xa6) [GOOD] (define-fun s168 () (_ BitVec 8) #xa7) [GOOD] (define-fun s169 () (_ BitVec 8) #xa8) [GOOD] (define-fun s170 () (_ BitVec 8) #xa9) [GOOD] (define-fun s171 () (_ BitVec 8) #xaa) [GOOD] (define-fun s172 () (_ BitVec 8) #xab) [GOOD] (define-fun s173 () (_ BitVec 8) #xac) [GOOD] (define-fun s174 () (_ BitVec 8) #xad) [GOOD] (define-fun s175 () (_ BitVec 8) #xae) [GOOD] (define-fun s176 () (_ BitVec 8) #xaf) [GOOD] (define-fun s177 () (_ BitVec 8) #xb0) [GOOD] (define-fun s178 () (_ BitVec 8) #xb1) [GOOD] (define-fun s179 () (_ BitVec 8) #xb2) [GOOD] (define-fun s180 () (_ BitVec 8) #xb3) [GOOD] (define-fun s181 () (_ BitVec 8) #xb4) [GOOD] (define-fun s182 () (_ BitVec 8) #xb5) [GOOD] (define-fun s183 () (_ BitVec 8) #xb6) [GOOD] (define-fun s184 () (_ BitVec 8) #xb7) [GOOD] (define-fun s185 () (_ BitVec 8) #xb8) [GOOD] (define-fun s186 () (_ BitVec 8) #xb9) [GOOD] (define-fun s187 () (_ BitVec 8) #xba) [GOOD] (define-fun s188 () (_ BitVec 8) #xbb) [GOOD] (define-fun s189 () (_ BitVec 8) #xbc) [GOOD] (define-fun s190 () (_ BitVec 8) #xbd) [GOOD] (define-fun s191 () (_ BitVec 8) #xbe) [GOOD] (define-fun s192 () (_ BitVec 8) #xbf) [GOOD] (define-fun s193 () (_ BitVec 8) #xc0) [GOOD] (define-fun s194 () (_ BitVec 8) #xc1) [GOOD] (define-fun s195 () (_ BitVec 8) #xc2) [GOOD] (define-fun s196 () (_ BitVec 8) #xc3) [GOOD] (define-fun s197 () (_ BitVec 8) #xc4) [GOOD] (define-fun s198 () (_ BitVec 8) #xc5) [GOOD] (define-fun s199 () (_ BitVec 8) #xc6) [GOOD] (define-fun s200 () (_ BitVec 8) #xc7) [GOOD] (define-fun s201 () (_ BitVec 8) #xc8) [GOOD] (define-fun s202 () (_ BitVec 8) #xc9) [GOOD] (define-fun s203 () (_ BitVec 8) #xca) [GOOD] (define-fun s204 () (_ BitVec 8) #xcb) [GOOD] (define-fun s205 () (_ BitVec 8) #xcc) [GOOD] (define-fun s206 () (_ BitVec 8) #xcd) [GOOD] (define-fun s207 () (_ BitVec 8) #xce) [GOOD] (define-fun s208 () (_ BitVec 8) #xcf) [GOOD] (define-fun s209 () (_ BitVec 8) #xd0) [GOOD] (define-fun s210 () (_ BitVec 8) #xd1) [GOOD] (define-fun s211 () (_ BitVec 8) #xd2) [GOOD] (define-fun s212 () (_ BitVec 8) #xd3) [GOOD] (define-fun s213 () (_ BitVec 8) #xd4) [GOOD] (define-fun s214 () (_ BitVec 8) #xd5) [GOOD] (define-fun s215 () (_ BitVec 8) #xd6) [GOOD] (define-fun s216 () (_ BitVec 8) #xd7) [GOOD] (define-fun s217 () (_ BitVec 8) #xd8) [GOOD] (define-fun s218 () (_ BitVec 8) #xd9) [GOOD] (define-fun s219 () (_ BitVec 8) #xda) [GOOD] (define-fun s220 () (_ BitVec 8) #xdb) [GOOD] (define-fun s221 () (_ BitVec 8) #xdc) [GOOD] (define-fun s222 () (_ BitVec 8) #xdd) [GOOD] (define-fun s223 () (_ BitVec 8) #xde) [GOOD] (define-fun s224 () (_ BitVec 8) #xdf) [GOOD] (define-fun s225 () (_ BitVec 8) #xe0) [GOOD] (define-fun s226 () (_ BitVec 8) #xe1) [GOOD] (define-fun s227 () (_ BitVec 8) #xe2) [GOOD] (define-fun s228 () (_ BitVec 8) #xe3) [GOOD] (define-fun s229 () (_ BitVec 8) #xe4) [GOOD] (define-fun s230 () (_ BitVec 8) #xe5) [GOOD] (define-fun s231 () (_ BitVec 8) #xe6) [GOOD] (define-fun s232 () (_ BitVec 8) #xe7) [GOOD] (define-fun s233 () (_ BitVec 8) #xe8) [GOOD] (define-fun s234 () (_ BitVec 8) #xe9) [GOOD] (define-fun s235 () (_ BitVec 8) #xea) [GOOD] (define-fun s236 () (_ BitVec 8) #xeb) [GOOD] (define-fun s237 () (_ BitVec 8) #xec) [GOOD] (define-fun s238 () (_ BitVec 8) #xed) [GOOD] (define-fun s239 () (_ BitVec 8) #xee) [GOOD] (define-fun s240 () (_ BitVec 8) #xef) [GOOD] (define-fun s241 () (_ BitVec 8) #xf0) [GOOD] (define-fun s242 () (_ BitVec 8) #xf1) [GOOD] (define-fun s243 () (_ BitVec 8) #xf2) [GOOD] (define-fun s244 () (_ BitVec 8) #xf3) [GOOD] (define-fun s245 () (_ BitVec 8) #xf4) [GOOD] (define-fun s246 () (_ BitVec 8) #xf5) [GOOD] (define-fun s247 () (_ BitVec 8) #xf6) [GOOD] (define-fun s248 () (_ BitVec 8) #xf7) [GOOD] (define-fun s249 () (_ BitVec 8) #xf8) [GOOD] (define-fun s250 () (_ BitVec 8) #xf9) [GOOD] (define-fun s251 () (_ BitVec 8) #xfa) [GOOD] (define-fun s252 () (_ BitVec 8) #xfb) [GOOD] (define-fun s253 () (_ BitVec 8) #xfc) [GOOD] (define-fun s254 () (_ BitVec 8) #xfd) [GOOD] (define-fun s255 () (_ BitVec 8) #xfe) [GOOD] (define-fun s256 () (_ BitVec 8) #xff) [GOOD] (declare-fun table0 ((_ BitVec 8)) (_ BitVec 8)) [GOOD] (assert (= (table0 #x00) s1)) [GOOD] (assert (= (table0 #x01) s2)) [GOOD] (assert (= (table0 #x02) s3)) [GOOD] (assert (= (table0 #x03) s4)) [GOOD] (assert (= (table0 #x04) s5)) [GOOD] (assert (= (table0 #x05) s6)) [GOOD] (assert (= (table0 #x06) s7)) [GOOD] (assert (= (table0 #x07) s8)) [GOOD] (assert (= (table0 #x08) s9)) [GOOD] (assert (= (table0 #x09) s10)) [GOOD] (assert (= (table0 #x0a) s11)) [GOOD] (assert (= (table0 #x0b) s12)) [GOOD] (assert (= (table0 #x0c) s13)) [GOOD] (assert (= (table0 #x0d) s14)) [GOOD] (assert (= (table0 #x0e) s15)) [GOOD] (assert (= (table0 #x0f) s16)) [GOOD] (assert (= (table0 #x10) s17)) [GOOD] (assert (= (table0 #x11) s18)) [GOOD] (assert (= (table0 #x12) s19)) [GOOD] (assert (= (table0 #x13) s20)) [GOOD] (assert (= (table0 #x14) s21)) [GOOD] (assert (= (table0 #x15) s22)) [GOOD] (assert (= (table0 #x16) s23)) [GOOD] (assert (= (table0 #x17) s24)) [GOOD] (assert (= (table0 #x18) s25)) [GOOD] (assert (= (table0 #x19) s26)) [GOOD] (assert (= (table0 #x1a) s27)) [GOOD] (assert (= (table0 #x1b) s28)) [GOOD] (assert (= (table0 #x1c) s29)) [GOOD] (assert (= (table0 #x1d) s30)) [GOOD] (assert (= (table0 #x1e) s31)) [GOOD] (assert (= (table0 #x1f) s32)) [GOOD] (assert (= (table0 #x20) s33)) [GOOD] (assert (= (table0 #x21) s34)) [GOOD] (assert (= (table0 #x22) s35)) [GOOD] (assert (= (table0 #x23) s36)) [GOOD] (assert (= (table0 #x24) s37)) [GOOD] (assert (= (table0 #x25) s38)) [GOOD] (assert (= (table0 #x26) s39)) [GOOD] (assert (= (table0 #x27) s40)) [GOOD] (assert (= (table0 #x28) s41)) [GOOD] (assert (= (table0 #x29) s42)) [GOOD] (assert (= (table0 #x2a) s43)) [GOOD] (assert (= (table0 #x2b) s44)) [GOOD] (assert (= (table0 #x2c) s45)) [GOOD] (assert (= (table0 #x2d) s46)) [GOOD] (assert (= (table0 #x2e) s47)) [GOOD] (assert (= (table0 #x2f) s48)) [GOOD] (assert (= (table0 #x30) s49)) [GOOD] (assert (= (table0 #x31) s50)) [GOOD] (assert (= (table0 #x32) s51)) [GOOD] (assert (= (table0 #x33) s52)) [GOOD] (assert (= (table0 #x34) s53)) [GOOD] (assert (= (table0 #x35) s54)) [GOOD] (assert (= (table0 #x36) s55)) [GOOD] (assert (= (table0 #x37) s56)) [GOOD] (assert (= (table0 #x38) s57)) [GOOD] (assert (= (table0 #x39) s58)) [GOOD] (assert (= (table0 #x3a) s59)) [GOOD] (assert (= (table0 #x3b) s60)) [GOOD] (assert (= (table0 #x3c) s61)) [GOOD] (assert (= (table0 #x3d) s62)) [GOOD] (assert (= (table0 #x3e) s63)) [GOOD] (assert (= (table0 #x3f) s64)) [GOOD] (assert (= (table0 #x40) s65)) [GOOD] (assert (= (table0 #x41) s66)) [GOOD] (assert (= (table0 #x42) s67)) [GOOD] (assert (= (table0 #x43) s68)) [GOOD] (assert (= (table0 #x44) s69)) [GOOD] (assert (= (table0 #x45) s70)) [GOOD] (assert (= (table0 #x46) s71)) [GOOD] (assert (= (table0 #x47) s72)) [GOOD] (assert (= (table0 #x48) s73)) [GOOD] (assert (= (table0 #x49) s74)) [GOOD] (assert (= (table0 #x4a) s75)) [GOOD] (assert (= (table0 #x4b) s76)) [GOOD] (assert (= (table0 #x4c) s77)) [GOOD] (assert (= (table0 #x4d) s78)) [GOOD] (assert (= (table0 #x4e) s79)) [GOOD] (assert (= (table0 #x4f) s80)) [GOOD] (assert (= (table0 #x50) s81)) [GOOD] (assert (= (table0 #x51) s82)) [GOOD] (assert (= (table0 #x52) s83)) [GOOD] (assert (= (table0 #x53) s84)) [GOOD] (assert (= (table0 #x54) s85)) [GOOD] (assert (= (table0 #x55) s86)) [GOOD] (assert (= (table0 #x56) s87)) [GOOD] (assert (= (table0 #x57) s88)) [GOOD] (assert (= (table0 #x58) s89)) [GOOD] (assert (= (table0 #x59) s90)) [GOOD] (assert (= (table0 #x5a) s91)) [GOOD] (assert (= (table0 #x5b) s92)) [GOOD] (assert (= (table0 #x5c) s93)) [GOOD] (assert (= (table0 #x5d) s94)) [GOOD] (assert (= (table0 #x5e) s95)) [GOOD] (assert (= (table0 #x5f) s96)) [GOOD] (assert (= (table0 #x60) s97)) [GOOD] (assert (= (table0 #x61) s98)) [GOOD] (assert (= (table0 #x62) s99)) [GOOD] (assert (= (table0 #x63) s100)) [GOOD] (assert (= (table0 #x64) s101)) [GOOD] (assert (= (table0 #x65) s102)) [GOOD] (assert (= (table0 #x66) s103)) [GOOD] (assert (= (table0 #x67) s104)) [GOOD] (assert (= (table0 #x68) s105)) [GOOD] (assert (= (table0 #x69) s106)) [GOOD] (assert (= (table0 #x6a) s107)) [GOOD] (assert (= (table0 #x6b) s108)) [GOOD] (assert (= (table0 #x6c) s109)) [GOOD] (assert (= (table0 #x6d) s110)) [GOOD] (assert (= (table0 #x6e) s111)) [GOOD] (assert (= (table0 #x6f) s112)) [GOOD] (assert (= (table0 #x70) s113)) [GOOD] (assert (= (table0 #x71) s114)) [GOOD] (assert (= (table0 #x72) s115)) [GOOD] (assert (= (table0 #x73) s116)) [GOOD] (assert (= (table0 #x74) s117)) [GOOD] (assert (= (table0 #x75) s118)) [GOOD] (assert (= (table0 #x76) s119)) [GOOD] (assert (= (table0 #x77) s120)) [GOOD] (assert (= (table0 #x78) s121)) [GOOD] (assert (= (table0 #x79) s122)) [GOOD] (assert (= (table0 #x7a) s123)) [GOOD] (assert (= (table0 #x7b) s124)) [GOOD] (assert (= (table0 #x7c) s125)) [GOOD] (assert (= (table0 #x7d) s126)) [GOOD] (assert (= (table0 #x7e) s127)) [GOOD] (assert (= (table0 #x7f) s128)) [GOOD] (assert (= (table0 #x80) s129)) [GOOD] (assert (= (table0 #x81) s130)) [GOOD] (assert (= (table0 #x82) s131)) [GOOD] (assert (= (table0 #x83) s132)) [GOOD] (assert (= (table0 #x84) s133)) [GOOD] (assert (= (table0 #x85) s134)) [GOOD] (assert (= (table0 #x86) s135)) [GOOD] (assert (= (table0 #x87) s136)) [GOOD] (assert (= (table0 #x88) s137)) [GOOD] (assert (= (table0 #x89) s138)) [GOOD] (assert (= (table0 #x8a) s139)) [GOOD] (assert (= (table0 #x8b) s140)) [GOOD] (assert (= (table0 #x8c) s141)) [GOOD] (assert (= (table0 #x8d) s142)) [GOOD] (assert (= (table0 #x8e) s143)) [GOOD] (assert (= (table0 #x8f) s144)) [GOOD] (assert (= (table0 #x90) s145)) [GOOD] (assert (= (table0 #x91) s146)) [GOOD] (assert (= (table0 #x92) s147)) [GOOD] (assert (= (table0 #x93) s148)) [GOOD] (assert (= (table0 #x94) s149)) [GOOD] (assert (= (table0 #x95) s150)) [GOOD] (assert (= (table0 #x96) s151)) [GOOD] (assert (= (table0 #x97) s152)) [GOOD] (assert (= (table0 #x98) s153)) [GOOD] (assert (= (table0 #x99) s154)) [GOOD] (assert (= (table0 #x9a) s155)) [GOOD] (assert (= (table0 #x9b) s156)) [GOOD] (assert (= (table0 #x9c) s157)) [GOOD] (assert (= (table0 #x9d) s158)) [GOOD] (assert (= (table0 #x9e) s159)) [GOOD] (assert (= (table0 #x9f) s160)) [GOOD] (assert (= (table0 #xa0) s161)) [GOOD] (assert (= (table0 #xa1) s162)) [GOOD] (assert (= (table0 #xa2) s163)) [GOOD] (assert (= (table0 #xa3) s164)) [GOOD] (assert (= (table0 #xa4) s165)) [GOOD] (assert (= (table0 #xa5) s166)) [GOOD] (assert (= (table0 #xa6) s167)) [GOOD] (assert (= (table0 #xa7) s168)) [GOOD] (assert (= (table0 #xa8) s169)) [GOOD] (assert (= (table0 #xa9) s170)) [GOOD] (assert (= (table0 #xaa) s171)) [GOOD] (assert (= (table0 #xab) s172)) [GOOD] (assert (= (table0 #xac) s173)) [GOOD] (assert (= (table0 #xad) s174)) [GOOD] (assert (= (table0 #xae) s175)) [GOOD] (assert (= (table0 #xaf) s176)) [GOOD] (assert (= (table0 #xb0) s177)) [GOOD] (assert (= (table0 #xb1) s178)) [GOOD] (assert (= (table0 #xb2) s179)) [GOOD] (assert (= (table0 #xb3) s180)) [GOOD] (assert (= (table0 #xb4) s181)) [GOOD] (assert (= (table0 #xb5) s182)) [GOOD] (assert (= (table0 #xb6) s183)) [GOOD] (assert (= (table0 #xb7) s184)) [GOOD] (assert (= (table0 #xb8) s185)) [GOOD] (assert (= (table0 #xb9) s186)) [GOOD] (assert (= (table0 #xba) s187)) [GOOD] (assert (= (table0 #xbb) s188)) [GOOD] (assert (= (table0 #xbc) s189)) [GOOD] (assert (= (table0 #xbd) s190)) [GOOD] (assert (= (table0 #xbe) s191)) [GOOD] (assert (= (table0 #xbf) s192)) [GOOD] (assert (= (table0 #xc0) s193)) [GOOD] (assert (= (table0 #xc1) s194)) [GOOD] (assert (= (table0 #xc2) s195)) [GOOD] (assert (= (table0 #xc3) s196)) [GOOD] (assert (= (table0 #xc4) s197)) [GOOD] (assert (= (table0 #xc5) s198)) [GOOD] (assert (= (table0 #xc6) s199)) [GOOD] (assert (= (table0 #xc7) s200)) [GOOD] (assert (= (table0 #xc8) s201)) [GOOD] (assert (= (table0 #xc9) s202)) [GOOD] (assert (= (table0 #xca) s203)) [GOOD] (assert (= (table0 #xcb) s204)) [GOOD] (assert (= (table0 #xcc) s205)) [GOOD] (assert (= (table0 #xcd) s206)) [GOOD] (assert (= (table0 #xce) s207)) [GOOD] (assert (= (table0 #xcf) s208)) [GOOD] (assert (= (table0 #xd0) s209)) [GOOD] (assert (= (table0 #xd1) s210)) [GOOD] (assert (= (table0 #xd2) s211)) [GOOD] (assert (= (table0 #xd3) s212)) [GOOD] (assert (= (table0 #xd4) s213)) [GOOD] (assert (= (table0 #xd5) s214)) [GOOD] (assert (= (table0 #xd6) s215)) [GOOD] (assert (= (table0 #xd7) s216)) [GOOD] (assert (= (table0 #xd8) s217)) [GOOD] (assert (= (table0 #xd9) s218)) [GOOD] (assert (= (table0 #xda) s219)) [GOOD] (assert (= (table0 #xdb) s220)) [GOOD] (assert (= (table0 #xdc) s221)) [GOOD] (assert (= (table0 #xdd) s222)) [GOOD] (assert (= (table0 #xde) s223)) [GOOD] (assert (= (table0 #xdf) s224)) [GOOD] (assert (= (table0 #xe0) s225)) [GOOD] (assert (= (table0 #xe1) s226)) [GOOD] (assert (= (table0 #xe2) s227)) [GOOD] (assert (= (table0 #xe3) s228)) [GOOD] (assert (= (table0 #xe4) s229)) [GOOD] (assert (= (table0 #xe5) s230)) [GOOD] (assert (= (table0 #xe6) s231)) [GOOD] (assert (= (table0 #xe7) s232)) [GOOD] (assert (= (table0 #xe8) s233)) [GOOD] (assert (= (table0 #xe9) s234)) [GOOD] (assert (= (table0 #xea) s235)) [GOOD] (assert (= (table0 #xeb) s236)) [GOOD] (assert (= (table0 #xec) s237)) [GOOD] (assert (= (table0 #xed) s238)) [GOOD] (assert (= (table0 #xee) s239)) [GOOD] (assert (= (table0 #xef) s240)) [GOOD] (assert (= (table0 #xf0) s241)) [GOOD] (assert (= (table0 #xf1) s242)) [GOOD] (assert (= (table0 #xf2) s243)) [GOOD] (assert (= (table0 #xf3) s244)) [GOOD] (assert (= (table0 #xf4) s245)) [GOOD] (assert (= (table0 #xf5) s246)) [GOOD] (assert (= (table0 #xf6) s247)) [GOOD] (assert (= (table0 #xf7) s248)) [GOOD] (assert (= (table0 #xf8) s249)) [GOOD] (assert (= (table0 #xf9) s250)) [GOOD] (assert (= (table0 #xfa) s251)) [GOOD] (assert (= (table0 #xfb) s252)) [GOOD] (assert (= (table0 #xfc) s253)) [GOOD] (assert (= (table0 #xfd) s254)) [GOOD] (assert (= (table0 #xfe) s255)) [GOOD] (assert (= (table0 #xff) s256)) [GOOD] (define-fun s257 () (_ BitVec 8) (table0 s0)) [GOOD] (define-fun s258 () Bool (= s0 s257)) [GOOD] (assert s258) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x00)) *** Solver : Z3 *** Exit code: ExitSuccess FINAL:0 DONE! sbv-7.13/SBVTestSuite/GoldFiles/queryArrays3.gold0000644000000000000000000002461513405536617020103 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_UFBV) ; NB. User specified. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "i" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [GOOD] (define-fun s1 () (_ BitVec 8) #x00) [GOOD] (declare-fun table0 ((_ BitVec 8)) (_ BitVec 8)) [GOOD] (assert (= (table0 #x00) s0)) [GOOD] (assert (= (table0 #x01) s0)) [GOOD] (assert (= (table0 #x02) s0)) [GOOD] (assert (= (table0 #x03) s0)) [GOOD] (assert (= (table0 #x04) s0)) [GOOD] (assert (= (table0 #x05) s0)) [GOOD] (assert (= (table0 #x06) s0)) [GOOD] (assert (= (table0 #x07) s0)) [GOOD] (assert (= (table0 #x08) s0)) [GOOD] (assert (= (table0 #x09) s0)) [GOOD] (assert (= (table0 #x0a) s0)) [GOOD] (assert (= (table0 #x0b) s0)) [GOOD] (assert (= (table0 #x0c) s0)) [GOOD] (assert (= (table0 #x0d) s0)) [GOOD] (assert (= (table0 #x0e) s0)) [GOOD] (assert (= (table0 #x0f) s0)) [GOOD] (assert (= (table0 #x10) s0)) [GOOD] (assert (= (table0 #x11) s0)) [GOOD] (assert (= (table0 #x12) s0)) [GOOD] (assert (= (table0 #x13) s0)) [GOOD] (assert (= (table0 #x14) s0)) [GOOD] (assert (= (table0 #x15) s0)) [GOOD] (assert (= (table0 #x16) s0)) [GOOD] (assert (= (table0 #x17) s0)) [GOOD] (assert (= (table0 #x18) s0)) [GOOD] (assert (= (table0 #x19) s0)) [GOOD] (assert (= (table0 #x1a) s0)) [GOOD] (assert (= (table0 #x1b) s0)) [GOOD] (assert (= (table0 #x1c) s0)) [GOOD] (assert (= (table0 #x1d) s0)) [GOOD] (assert (= (table0 #x1e) s0)) [GOOD] (assert (= (table0 #x1f) s0)) [GOOD] (assert (= (table0 #x20) s0)) [GOOD] (assert (= (table0 #x21) s0)) [GOOD] (assert (= (table0 #x22) s0)) [GOOD] (assert (= (table0 #x23) s0)) [GOOD] (assert (= (table0 #x24) s0)) [GOOD] (assert (= (table0 #x25) s0)) [GOOD] (assert (= (table0 #x26) s0)) [GOOD] (assert (= (table0 #x27) s0)) [GOOD] (assert (= (table0 #x28) s0)) [GOOD] (assert (= (table0 #x29) s0)) [GOOD] (assert (= (table0 #x2a) s0)) [GOOD] (assert (= (table0 #x2b) s0)) [GOOD] (assert (= (table0 #x2c) s0)) [GOOD] (assert (= (table0 #x2d) s0)) [GOOD] (assert (= (table0 #x2e) s0)) [GOOD] (assert (= (table0 #x2f) s0)) [GOOD] (assert (= (table0 #x30) s0)) [GOOD] (assert (= (table0 #x31) s0)) [GOOD] (assert (= (table0 #x32) s0)) [GOOD] (assert (= (table0 #x33) s0)) [GOOD] (assert (= (table0 #x34) s0)) [GOOD] (assert (= (table0 #x35) s0)) [GOOD] (assert (= (table0 #x36) s0)) [GOOD] (assert (= (table0 #x37) s0)) [GOOD] (assert (= (table0 #x38) s0)) [GOOD] (assert (= (table0 #x39) s0)) [GOOD] (assert (= (table0 #x3a) s0)) [GOOD] (assert (= (table0 #x3b) s0)) [GOOD] (assert (= (table0 #x3c) s0)) [GOOD] (assert (= (table0 #x3d) s0)) [GOOD] (assert (= (table0 #x3e) s0)) [GOOD] (assert (= (table0 #x3f) s0)) [GOOD] (assert (= (table0 #x40) s0)) [GOOD] (assert (= (table0 #x41) s0)) [GOOD] (assert (= (table0 #x42) s0)) [GOOD] (assert (= (table0 #x43) s0)) [GOOD] (assert (= (table0 #x44) s0)) [GOOD] (assert (= (table0 #x45) s0)) [GOOD] (assert (= (table0 #x46) s0)) [GOOD] (assert (= (table0 #x47) s0)) [GOOD] (assert (= (table0 #x48) s0)) [GOOD] (assert (= (table0 #x49) s0)) [GOOD] (assert (= (table0 #x4a) s0)) [GOOD] (assert (= (table0 #x4b) s0)) [GOOD] (assert (= (table0 #x4c) s0)) [GOOD] (assert (= (table0 #x4d) s0)) [GOOD] (assert (= (table0 #x4e) s0)) [GOOD] (assert (= (table0 #x4f) s0)) [GOOD] (assert (= (table0 #x50) s0)) [GOOD] (assert (= (table0 #x51) s0)) [GOOD] (assert (= (table0 #x52) s0)) [GOOD] (assert (= (table0 #x53) s0)) [GOOD] (assert (= (table0 #x54) s0)) [GOOD] (assert (= (table0 #x55) s0)) [GOOD] (assert (= (table0 #x56) s0)) [GOOD] (assert (= (table0 #x57) s0)) [GOOD] (assert (= (table0 #x58) s0)) [GOOD] (assert (= (table0 #x59) s0)) [GOOD] (assert (= (table0 #x5a) s0)) [GOOD] (assert (= (table0 #x5b) s0)) [GOOD] (assert (= (table0 #x5c) s0)) [GOOD] (assert (= (table0 #x5d) s0)) [GOOD] (assert (= (table0 #x5e) s0)) [GOOD] (assert (= (table0 #x5f) s0)) [GOOD] (assert (= (table0 #x60) s0)) [GOOD] (assert (= (table0 #x61) s0)) [GOOD] (assert (= (table0 #x62) s0)) [GOOD] (assert (= (table0 #x63) s0)) [GOOD] (assert (= (table0 #x64) s0)) [GOOD] (assert (= (table0 #x65) s0)) [GOOD] (assert (= (table0 #x66) s0)) [GOOD] (assert (= (table0 #x67) s0)) [GOOD] (assert (= (table0 #x68) s0)) [GOOD] (assert (= (table0 #x69) s0)) [GOOD] (assert (= (table0 #x6a) s0)) [GOOD] (assert (= (table0 #x6b) s0)) [GOOD] (assert (= (table0 #x6c) s0)) [GOOD] (assert (= (table0 #x6d) s0)) [GOOD] (assert (= (table0 #x6e) s0)) [GOOD] (assert (= (table0 #x6f) s0)) [GOOD] (assert (= (table0 #x70) s0)) [GOOD] (assert (= (table0 #x71) s0)) [GOOD] (assert (= (table0 #x72) s0)) [GOOD] (assert (= (table0 #x73) s0)) [GOOD] (assert (= (table0 #x74) s0)) [GOOD] (assert (= (table0 #x75) s0)) [GOOD] (assert (= (table0 #x76) s0)) [GOOD] (assert (= (table0 #x77) s0)) [GOOD] (assert (= (table0 #x78) s0)) [GOOD] (assert (= (table0 #x79) s0)) [GOOD] (assert (= (table0 #x7a) s0)) [GOOD] (assert (= (table0 #x7b) s0)) [GOOD] (assert (= (table0 #x7c) s0)) [GOOD] (assert (= (table0 #x7d) s0)) [GOOD] (assert (= (table0 #x7e) s0)) [GOOD] (assert (= (table0 #x7f) s0)) [GOOD] (assert (= (table0 #x80) s0)) [GOOD] (assert (= (table0 #x81) s0)) [GOOD] (assert (= (table0 #x82) s0)) [GOOD] (assert (= (table0 #x83) s0)) [GOOD] (assert (= (table0 #x84) s0)) [GOOD] (assert (= (table0 #x85) s0)) [GOOD] (assert (= (table0 #x86) s0)) [GOOD] (assert (= (table0 #x87) s0)) [GOOD] (assert (= (table0 #x88) s0)) [GOOD] (assert (= (table0 #x89) s0)) [GOOD] (assert (= (table0 #x8a) s0)) [GOOD] (assert (= (table0 #x8b) s0)) [GOOD] (assert (= (table0 #x8c) s0)) [GOOD] (assert (= (table0 #x8d) s0)) [GOOD] (assert (= (table0 #x8e) s0)) [GOOD] (assert (= (table0 #x8f) s0)) [GOOD] (assert (= (table0 #x90) s0)) [GOOD] (assert (= (table0 #x91) s0)) [GOOD] (assert (= (table0 #x92) s0)) [GOOD] (assert (= (table0 #x93) s0)) [GOOD] (assert (= (table0 #x94) s0)) [GOOD] (assert (= (table0 #x95) s0)) [GOOD] (assert (= (table0 #x96) s0)) [GOOD] (assert (= (table0 #x97) s0)) [GOOD] (assert (= (table0 #x98) s0)) [GOOD] (assert (= (table0 #x99) s0)) [GOOD] (assert (= (table0 #x9a) s0)) [GOOD] (assert (= (table0 #x9b) s0)) [GOOD] (assert (= (table0 #x9c) s0)) [GOOD] (assert (= (table0 #x9d) s0)) [GOOD] (assert (= (table0 #x9e) s0)) [GOOD] (assert (= (table0 #x9f) s0)) [GOOD] (assert (= (table0 #xa0) s0)) [GOOD] (assert (= (table0 #xa1) s0)) [GOOD] (assert (= (table0 #xa2) s0)) [GOOD] (assert (= (table0 #xa3) s0)) [GOOD] (assert (= (table0 #xa4) s0)) [GOOD] (assert (= (table0 #xa5) s0)) [GOOD] (assert (= (table0 #xa6) s0)) [GOOD] (assert (= (table0 #xa7) s0)) [GOOD] (assert (= (table0 #xa8) s0)) [GOOD] (assert (= (table0 #xa9) s0)) [GOOD] (assert (= (table0 #xaa) s0)) [GOOD] (assert (= (table0 #xab) s0)) [GOOD] (assert (= (table0 #xac) s0)) [GOOD] (assert (= (table0 #xad) s0)) [GOOD] (assert (= (table0 #xae) s0)) [GOOD] (assert (= (table0 #xaf) s0)) [GOOD] (assert (= (table0 #xb0) s0)) [GOOD] (assert (= (table0 #xb1) s0)) [GOOD] (assert (= (table0 #xb2) s0)) [GOOD] (assert (= (table0 #xb3) s0)) [GOOD] (assert (= (table0 #xb4) s0)) [GOOD] (assert (= (table0 #xb5) s0)) [GOOD] (assert (= (table0 #xb6) s0)) [GOOD] (assert (= (table0 #xb7) s0)) [GOOD] (assert (= (table0 #xb8) s0)) [GOOD] (assert (= (table0 #xb9) s0)) [GOOD] (assert (= (table0 #xba) s0)) [GOOD] (assert (= (table0 #xbb) s0)) [GOOD] (assert (= (table0 #xbc) s0)) [GOOD] (assert (= (table0 #xbd) s0)) [GOOD] (assert (= (table0 #xbe) s0)) [GOOD] (assert (= (table0 #xbf) s0)) [GOOD] (assert (= (table0 #xc0) s0)) [GOOD] (assert (= (table0 #xc1) s0)) [GOOD] (assert (= (table0 #xc2) s0)) [GOOD] (assert (= (table0 #xc3) s0)) [GOOD] (assert (= (table0 #xc4) s0)) [GOOD] (assert (= (table0 #xc5) s0)) [GOOD] (assert (= (table0 #xc6) s0)) [GOOD] (assert (= (table0 #xc7) s0)) [GOOD] (assert (= (table0 #xc8) s0)) [GOOD] (assert (= (table0 #xc9) s0)) [GOOD] (assert (= (table0 #xca) s0)) [GOOD] (assert (= (table0 #xcb) s0)) [GOOD] (assert (= (table0 #xcc) s0)) [GOOD] (assert (= (table0 #xcd) s0)) [GOOD] (assert (= (table0 #xce) s0)) [GOOD] (assert (= (table0 #xcf) s0)) [GOOD] (assert (= (table0 #xd0) s0)) [GOOD] (assert (= (table0 #xd1) s0)) [GOOD] (assert (= (table0 #xd2) s0)) [GOOD] (assert (= (table0 #xd3) s0)) [GOOD] (assert (= (table0 #xd4) s0)) [GOOD] (assert (= (table0 #xd5) s0)) [GOOD] (assert (= (table0 #xd6) s0)) [GOOD] (assert (= (table0 #xd7) s0)) [GOOD] (assert (= (table0 #xd8) s0)) [GOOD] (assert (= (table0 #xd9) s0)) [GOOD] (assert (= (table0 #xda) s0)) [GOOD] (assert (= (table0 #xdb) s0)) [GOOD] (assert (= (table0 #xdc) s0)) [GOOD] (assert (= (table0 #xdd) s0)) [GOOD] (assert (= (table0 #xde) s0)) [GOOD] (assert (= (table0 #xdf) s0)) [GOOD] (assert (= (table0 #xe0) s0)) [GOOD] (assert (= (table0 #xe1) s0)) [GOOD] (assert (= (table0 #xe2) s0)) [GOOD] (assert (= (table0 #xe3) s0)) [GOOD] (assert (= (table0 #xe4) s0)) [GOOD] (assert (= (table0 #xe5) s0)) [GOOD] (assert (= (table0 #xe6) s0)) [GOOD] (assert (= (table0 #xe7) s0)) [GOOD] (assert (= (table0 #xe8) s0)) [GOOD] (assert (= (table0 #xe9) s0)) [GOOD] (assert (= (table0 #xea) s0)) [GOOD] (assert (= (table0 #xeb) s0)) [GOOD] (assert (= (table0 #xec) s0)) [GOOD] (assert (= (table0 #xed) s0)) [GOOD] (assert (= (table0 #xee) s0)) [GOOD] (assert (= (table0 #xef) s0)) [GOOD] (assert (= (table0 #xf0) s0)) [GOOD] (assert (= (table0 #xf1) s0)) [GOOD] (assert (= (table0 #xf2) s0)) [GOOD] (assert (= (table0 #xf3) s0)) [GOOD] (assert (= (table0 #xf4) s0)) [GOOD] (assert (= (table0 #xf5) s0)) [GOOD] (assert (= (table0 #xf6) s0)) [GOOD] (assert (= (table0 #xf7) s0)) [GOOD] (assert (= (table0 #xf8) s0)) [GOOD] (assert (= (table0 #xf9) s0)) [GOOD] (assert (= (table0 #xfa) s0)) [GOOD] (assert (= (table0 #xfb) s0)) [GOOD] (assert (= (table0 #xfc) s0)) [GOOD] (assert (= (table0 #xfd) s0)) [GOOD] (assert (= (table0 #xfe) s0)) [GOOD] (assert (= (table0 #xff) s0)) [GOOD] (define-fun s2 () (_ BitVec 8) (table0 s0)) [GOOD] (define-fun s3 () Bool (= s0 s2)) [GOOD] (assert s3) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x00)) *** Solver : Z3 *** Exit code: ExitSuccess FINAL:0 DONE! sbv-7.13/SBVTestSuite/GoldFiles/queryArrays4.gold0000644000000000000000000005502513405536617020103 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_UFBV) ; NB. User specified. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "i" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "j" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [GOOD] (define-fun s2 () (_ BitVec 8) #x00) [GOOD] (define-fun s3 () (_ BitVec 8) #x01) [GOOD] (define-fun s4 () (_ BitVec 8) #x02) [GOOD] (define-fun s5 () (_ BitVec 8) #x03) [GOOD] (define-fun s6 () (_ BitVec 8) #x04) [GOOD] (define-fun s7 () (_ BitVec 8) #x05) [GOOD] (define-fun s8 () (_ BitVec 8) #x06) [GOOD] (define-fun s9 () (_ BitVec 8) #x07) [GOOD] (define-fun s10 () (_ BitVec 8) #x08) [GOOD] (define-fun s11 () (_ BitVec 8) #x09) [GOOD] (define-fun s12 () (_ BitVec 8) #x0a) [GOOD] (define-fun s13 () (_ BitVec 8) #x0b) [GOOD] (define-fun s14 () (_ BitVec 8) #x0c) [GOOD] (define-fun s15 () (_ BitVec 8) #x0d) [GOOD] (define-fun s16 () (_ BitVec 8) #x0e) [GOOD] (define-fun s17 () (_ BitVec 8) #x0f) [GOOD] (define-fun s18 () (_ BitVec 8) #x10) [GOOD] (define-fun s19 () (_ BitVec 8) #x11) [GOOD] (define-fun s20 () (_ BitVec 8) #x12) [GOOD] (define-fun s21 () (_ BitVec 8) #x13) [GOOD] (define-fun s22 () (_ BitVec 8) #x14) [GOOD] (define-fun s23 () (_ BitVec 8) #x15) [GOOD] (define-fun s24 () (_ BitVec 8) #x16) [GOOD] (define-fun s25 () (_ BitVec 8) #x17) [GOOD] (define-fun s26 () (_ BitVec 8) #x18) [GOOD] (define-fun s27 () (_ BitVec 8) #x19) [GOOD] (define-fun s28 () (_ BitVec 8) #x1a) [GOOD] (define-fun s29 () (_ BitVec 8) #x1b) [GOOD] (define-fun s30 () (_ BitVec 8) #x1c) [GOOD] (define-fun s31 () (_ BitVec 8) #x1d) [GOOD] (define-fun s32 () (_ BitVec 8) #x1e) [GOOD] (define-fun s33 () (_ BitVec 8) #x1f) [GOOD] (define-fun s34 () (_ BitVec 8) #x20) [GOOD] (define-fun s35 () (_ BitVec 8) #x21) [GOOD] (define-fun s36 () (_ BitVec 8) #x22) [GOOD] (define-fun s37 () (_ BitVec 8) #x23) [GOOD] (define-fun s38 () (_ BitVec 8) #x24) [GOOD] (define-fun s39 () (_ BitVec 8) #x25) [GOOD] (define-fun s40 () (_ BitVec 8) #x26) [GOOD] (define-fun s41 () (_ BitVec 8) #x27) [GOOD] (define-fun s42 () (_ BitVec 8) #x28) [GOOD] (define-fun s43 () (_ BitVec 8) #x29) [GOOD] (define-fun s44 () (_ BitVec 8) #x2a) [GOOD] (define-fun s45 () (_ BitVec 8) #x2b) [GOOD] (define-fun s46 () (_ BitVec 8) #x2c) [GOOD] (define-fun s47 () (_ BitVec 8) #x2d) [GOOD] (define-fun s48 () (_ BitVec 8) #x2e) [GOOD] (define-fun s49 () (_ BitVec 8) #x2f) [GOOD] (define-fun s50 () (_ BitVec 8) #x30) [GOOD] (define-fun s51 () (_ BitVec 8) #x31) [GOOD] (define-fun s52 () (_ BitVec 8) #x32) [GOOD] (define-fun s53 () (_ BitVec 8) #x33) [GOOD] (define-fun s54 () (_ BitVec 8) #x34) [GOOD] (define-fun s55 () (_ BitVec 8) #x35) [GOOD] (define-fun s56 () (_ BitVec 8) #x36) [GOOD] (define-fun s57 () (_ BitVec 8) #x37) [GOOD] (define-fun s58 () (_ BitVec 8) #x38) [GOOD] (define-fun s59 () (_ BitVec 8) #x39) [GOOD] (define-fun s60 () (_ BitVec 8) #x3a) [GOOD] (define-fun s61 () (_ BitVec 8) #x3b) [GOOD] (define-fun s62 () (_ BitVec 8) #x3c) [GOOD] (define-fun s63 () (_ BitVec 8) #x3d) [GOOD] (define-fun s64 () (_ BitVec 8) #x3e) [GOOD] (define-fun s65 () (_ BitVec 8) #x3f) [GOOD] (define-fun s66 () (_ BitVec 8) #x40) [GOOD] (define-fun s67 () (_ BitVec 8) #x41) [GOOD] (define-fun s68 () (_ BitVec 8) #x42) [GOOD] (define-fun s69 () (_ BitVec 8) #x43) [GOOD] (define-fun s70 () (_ BitVec 8) #x44) [GOOD] (define-fun s71 () (_ BitVec 8) #x45) [GOOD] (define-fun s72 () (_ BitVec 8) #x46) [GOOD] (define-fun s73 () (_ BitVec 8) #x47) [GOOD] (define-fun s74 () (_ BitVec 8) #x48) [GOOD] (define-fun s75 () (_ BitVec 8) #x49) [GOOD] (define-fun s76 () (_ BitVec 8) #x4a) [GOOD] (define-fun s77 () (_ BitVec 8) #x4b) [GOOD] (define-fun s78 () (_ BitVec 8) #x4c) [GOOD] (define-fun s79 () (_ BitVec 8) #x4d) [GOOD] (define-fun s80 () (_ BitVec 8) #x4e) [GOOD] (define-fun s81 () (_ BitVec 8) #x4f) [GOOD] (define-fun s82 () (_ BitVec 8) #x50) [GOOD] (define-fun s83 () (_ BitVec 8) #x51) [GOOD] (define-fun s84 () (_ BitVec 8) #x52) [GOOD] (define-fun s85 () (_ BitVec 8) #x53) [GOOD] (define-fun s86 () (_ BitVec 8) #x54) [GOOD] (define-fun s87 () (_ BitVec 8) #x55) [GOOD] (define-fun s88 () (_ BitVec 8) #x56) [GOOD] (define-fun s89 () (_ BitVec 8) #x57) [GOOD] (define-fun s90 () (_ BitVec 8) #x58) [GOOD] (define-fun s91 () (_ BitVec 8) #x59) [GOOD] (define-fun s92 () (_ BitVec 8) #x5a) [GOOD] (define-fun s93 () (_ BitVec 8) #x5b) [GOOD] (define-fun s94 () (_ BitVec 8) #x5c) [GOOD] (define-fun s95 () (_ BitVec 8) #x5d) [GOOD] (define-fun s96 () (_ BitVec 8) #x5e) [GOOD] (define-fun s97 () (_ BitVec 8) #x5f) [GOOD] (define-fun s98 () (_ BitVec 8) #x60) [GOOD] (define-fun s99 () (_ BitVec 8) #x61) [GOOD] (define-fun s100 () (_ BitVec 8) #x62) [GOOD] (define-fun s101 () (_ BitVec 8) #x63) [GOOD] (define-fun s102 () (_ BitVec 8) #x64) [GOOD] (define-fun s103 () (_ BitVec 8) #x65) [GOOD] (define-fun s104 () (_ BitVec 8) #x66) [GOOD] (define-fun s105 () (_ BitVec 8) #x67) [GOOD] (define-fun s106 () (_ BitVec 8) #x68) [GOOD] (define-fun s107 () (_ BitVec 8) #x69) [GOOD] (define-fun s108 () (_ BitVec 8) #x6a) [GOOD] (define-fun s109 () (_ BitVec 8) #x6b) [GOOD] (define-fun s110 () (_ BitVec 8) #x6c) [GOOD] (define-fun s111 () (_ BitVec 8) #x6d) [GOOD] (define-fun s112 () (_ BitVec 8) #x6e) [GOOD] (define-fun s113 () (_ BitVec 8) #x6f) [GOOD] (define-fun s114 () (_ BitVec 8) #x70) [GOOD] (define-fun s115 () (_ BitVec 8) #x71) [GOOD] (define-fun s116 () (_ BitVec 8) #x72) [GOOD] (define-fun s117 () (_ BitVec 8) #x73) [GOOD] (define-fun s118 () (_ BitVec 8) #x74) [GOOD] (define-fun s119 () (_ BitVec 8) #x75) [GOOD] (define-fun s120 () (_ BitVec 8) #x76) [GOOD] (define-fun s121 () (_ BitVec 8) #x77) [GOOD] (define-fun s122 () (_ BitVec 8) #x78) [GOOD] (define-fun s123 () (_ BitVec 8) #x79) [GOOD] (define-fun s124 () (_ BitVec 8) #x7a) [GOOD] (define-fun s125 () (_ BitVec 8) #x7b) [GOOD] (define-fun s126 () (_ BitVec 8) #x7c) [GOOD] (define-fun s127 () (_ BitVec 8) #x7d) [GOOD] (define-fun s128 () (_ BitVec 8) #x7e) [GOOD] (define-fun s129 () (_ BitVec 8) #x7f) [GOOD] (define-fun s130 () (_ BitVec 8) #x80) [GOOD] (define-fun s131 () (_ BitVec 8) #x81) [GOOD] (define-fun s132 () (_ BitVec 8) #x82) [GOOD] (define-fun s133 () (_ BitVec 8) #x83) [GOOD] (define-fun s134 () (_ BitVec 8) #x84) [GOOD] (define-fun s135 () (_ BitVec 8) #x85) [GOOD] (define-fun s136 () (_ BitVec 8) #x86) [GOOD] (define-fun s137 () (_ BitVec 8) #x87) [GOOD] (define-fun s138 () (_ BitVec 8) #x88) [GOOD] (define-fun s139 () (_ BitVec 8) #x89) [GOOD] (define-fun s140 () (_ BitVec 8) #x8a) [GOOD] (define-fun s141 () (_ BitVec 8) #x8b) [GOOD] (define-fun s142 () (_ BitVec 8) #x8c) [GOOD] (define-fun s143 () (_ BitVec 8) #x8d) [GOOD] (define-fun s144 () (_ BitVec 8) #x8e) [GOOD] (define-fun s145 () (_ BitVec 8) #x8f) [GOOD] (define-fun s146 () (_ BitVec 8) #x90) [GOOD] (define-fun s147 () (_ BitVec 8) #x91) [GOOD] (define-fun s148 () (_ BitVec 8) #x92) [GOOD] (define-fun s149 () (_ BitVec 8) #x93) [GOOD] (define-fun s150 () (_ BitVec 8) #x94) [GOOD] (define-fun s151 () (_ BitVec 8) #x95) [GOOD] (define-fun s152 () (_ BitVec 8) #x96) [GOOD] (define-fun s153 () (_ BitVec 8) #x97) [GOOD] (define-fun s154 () (_ BitVec 8) #x98) [GOOD] (define-fun s155 () (_ BitVec 8) #x99) [GOOD] (define-fun s156 () (_ BitVec 8) #x9a) [GOOD] (define-fun s157 () (_ BitVec 8) #x9b) [GOOD] (define-fun s158 () (_ BitVec 8) #x9c) [GOOD] (define-fun s159 () (_ BitVec 8) #x9d) [GOOD] (define-fun s160 () (_ BitVec 8) #x9e) [GOOD] (define-fun s161 () (_ BitVec 8) #x9f) [GOOD] (define-fun s162 () (_ BitVec 8) #xa0) [GOOD] (define-fun s163 () (_ BitVec 8) #xa1) [GOOD] (define-fun s164 () (_ BitVec 8) #xa2) [GOOD] (define-fun s165 () (_ BitVec 8) #xa3) [GOOD] (define-fun s166 () (_ BitVec 8) #xa4) [GOOD] (define-fun s167 () (_ BitVec 8) #xa5) [GOOD] (define-fun s168 () (_ BitVec 8) #xa6) [GOOD] (define-fun s169 () (_ BitVec 8) #xa7) [GOOD] (define-fun s170 () (_ BitVec 8) #xa8) [GOOD] (define-fun s171 () (_ BitVec 8) #xa9) [GOOD] (define-fun s172 () (_ BitVec 8) #xaa) [GOOD] (define-fun s173 () (_ BitVec 8) #xab) [GOOD] (define-fun s174 () (_ BitVec 8) #xac) [GOOD] (define-fun s175 () (_ BitVec 8) #xad) [GOOD] (define-fun s176 () (_ BitVec 8) #xae) [GOOD] (define-fun s177 () (_ BitVec 8) #xaf) [GOOD] (define-fun s178 () (_ BitVec 8) #xb0) [GOOD] (define-fun s179 () (_ BitVec 8) #xb1) [GOOD] (define-fun s180 () (_ BitVec 8) #xb2) [GOOD] (define-fun s181 () (_ BitVec 8) #xb3) [GOOD] (define-fun s182 () (_ BitVec 8) #xb4) [GOOD] (define-fun s183 () (_ BitVec 8) #xb5) [GOOD] (define-fun s184 () (_ BitVec 8) #xb6) [GOOD] (define-fun s185 () (_ BitVec 8) #xb7) [GOOD] (define-fun s186 () (_ BitVec 8) #xb8) [GOOD] (define-fun s187 () (_ BitVec 8) #xb9) [GOOD] (define-fun s188 () (_ BitVec 8) #xba) [GOOD] (define-fun s189 () (_ BitVec 8) #xbb) [GOOD] (define-fun s190 () (_ BitVec 8) #xbc) [GOOD] (define-fun s191 () (_ BitVec 8) #xbd) [GOOD] (define-fun s192 () (_ BitVec 8) #xbe) [GOOD] (define-fun s193 () (_ BitVec 8) #xbf) [GOOD] (define-fun s194 () (_ BitVec 8) #xc0) [GOOD] (define-fun s195 () (_ BitVec 8) #xc1) [GOOD] (define-fun s196 () (_ BitVec 8) #xc2) [GOOD] (define-fun s197 () (_ BitVec 8) #xc3) [GOOD] (define-fun s198 () (_ BitVec 8) #xc4) [GOOD] (define-fun s199 () (_ BitVec 8) #xc5) [GOOD] (define-fun s200 () (_ BitVec 8) #xc6) [GOOD] (define-fun s201 () (_ BitVec 8) #xc7) [GOOD] (define-fun s202 () (_ BitVec 8) #xc8) [GOOD] (define-fun s203 () (_ BitVec 8) #xc9) [GOOD] (define-fun s204 () (_ BitVec 8) #xca) [GOOD] (define-fun s205 () (_ BitVec 8) #xcb) [GOOD] (define-fun s206 () (_ BitVec 8) #xcc) [GOOD] (define-fun s207 () (_ BitVec 8) #xcd) [GOOD] (define-fun s208 () (_ BitVec 8) #xce) [GOOD] (define-fun s209 () (_ BitVec 8) #xcf) [GOOD] (define-fun s210 () (_ BitVec 8) #xd0) [GOOD] (define-fun s211 () (_ BitVec 8) #xd1) [GOOD] (define-fun s212 () (_ BitVec 8) #xd2) [GOOD] (define-fun s213 () (_ BitVec 8) #xd3) [GOOD] (define-fun s214 () (_ BitVec 8) #xd4) [GOOD] (define-fun s215 () (_ BitVec 8) #xd5) [GOOD] (define-fun s216 () (_ BitVec 8) #xd6) [GOOD] (define-fun s217 () (_ BitVec 8) #xd7) [GOOD] (define-fun s218 () (_ BitVec 8) #xd8) [GOOD] (define-fun s219 () (_ BitVec 8) #xd9) [GOOD] (define-fun s220 () (_ BitVec 8) #xda) [GOOD] (define-fun s221 () (_ BitVec 8) #xdb) [GOOD] (define-fun s222 () (_ BitVec 8) #xdc) [GOOD] (define-fun s223 () (_ BitVec 8) #xdd) [GOOD] (define-fun s224 () (_ BitVec 8) #xde) [GOOD] (define-fun s225 () (_ BitVec 8) #xdf) [GOOD] (define-fun s226 () (_ BitVec 8) #xe0) [GOOD] (define-fun s227 () (_ BitVec 8) #xe1) [GOOD] (define-fun s228 () (_ BitVec 8) #xe2) [GOOD] (define-fun s229 () (_ BitVec 8) #xe3) [GOOD] (define-fun s230 () (_ BitVec 8) #xe4) [GOOD] (define-fun s231 () (_ BitVec 8) #xe5) [GOOD] (define-fun s232 () (_ BitVec 8) #xe6) [GOOD] (define-fun s233 () (_ BitVec 8) #xe7) [GOOD] (define-fun s234 () (_ BitVec 8) #xe8) [GOOD] (define-fun s235 () (_ BitVec 8) #xe9) [GOOD] (define-fun s236 () (_ BitVec 8) #xea) [GOOD] (define-fun s237 () (_ BitVec 8) #xeb) [GOOD] (define-fun s238 () (_ BitVec 8) #xec) [GOOD] (define-fun s239 () (_ BitVec 8) #xed) [GOOD] (define-fun s240 () (_ BitVec 8) #xee) [GOOD] (define-fun s241 () (_ BitVec 8) #xef) [GOOD] (define-fun s242 () (_ BitVec 8) #xf0) [GOOD] (define-fun s243 () (_ BitVec 8) #xf1) [GOOD] (define-fun s244 () (_ BitVec 8) #xf2) [GOOD] (define-fun s245 () (_ BitVec 8) #xf3) [GOOD] (define-fun s246 () (_ BitVec 8) #xf4) [GOOD] (define-fun s247 () (_ BitVec 8) #xf5) [GOOD] (define-fun s248 () (_ BitVec 8) #xf6) [GOOD] (define-fun s249 () (_ BitVec 8) #xf7) [GOOD] (define-fun s250 () (_ BitVec 8) #xf8) [GOOD] (define-fun s251 () (_ BitVec 8) #xf9) [GOOD] (define-fun s252 () (_ BitVec 8) #xfa) [GOOD] (define-fun s253 () (_ BitVec 8) #xfb) [GOOD] (define-fun s254 () (_ BitVec 8) #xfc) [GOOD] (define-fun s255 () (_ BitVec 8) #xfd) [GOOD] (define-fun s256 () (_ BitVec 8) #xfe) [GOOD] (define-fun s257 () (_ BitVec 8) #xff) [GOOD] (declare-fun table0 ((_ BitVec 8)) (_ BitVec 8)) [GOOD] (assert (= (table0 #x00) s2)) [GOOD] (assert (= (table0 #x01) s3)) [GOOD] (assert (= (table0 #x02) s4)) [GOOD] (assert (= (table0 #x03) s5)) [GOOD] (assert (= (table0 #x04) s6)) [GOOD] (assert (= (table0 #x05) s7)) [GOOD] (assert (= (table0 #x06) s8)) [GOOD] (assert (= (table0 #x07) s9)) [GOOD] (assert (= (table0 #x08) s10)) [GOOD] (assert (= (table0 #x09) s11)) [GOOD] (assert (= (table0 #x0a) s12)) [GOOD] (assert (= (table0 #x0b) s13)) [GOOD] (assert (= (table0 #x0c) s14)) [GOOD] (assert (= (table0 #x0d) s15)) [GOOD] (assert (= (table0 #x0e) s16)) [GOOD] (assert (= (table0 #x0f) s17)) [GOOD] (assert (= (table0 #x10) s18)) [GOOD] (assert (= (table0 #x11) s19)) [GOOD] (assert (= (table0 #x12) s20)) [GOOD] (assert (= (table0 #x13) s21)) [GOOD] (assert (= (table0 #x14) s22)) [GOOD] (assert (= (table0 #x15) s23)) [GOOD] (assert (= (table0 #x16) s24)) [GOOD] (assert (= (table0 #x17) s25)) [GOOD] (assert (= (table0 #x18) s26)) [GOOD] (assert (= (table0 #x19) s27)) [GOOD] (assert (= (table0 #x1a) s28)) [GOOD] (assert (= (table0 #x1b) s29)) [GOOD] (assert (= (table0 #x1c) s30)) [GOOD] (assert (= (table0 #x1d) s31)) [GOOD] (assert (= (table0 #x1e) s32)) [GOOD] (assert (= (table0 #x1f) s33)) [GOOD] (assert (= (table0 #x20) s34)) [GOOD] (assert (= (table0 #x21) s35)) [GOOD] (assert (= (table0 #x22) s36)) [GOOD] (assert (= (table0 #x23) s37)) [GOOD] (assert (= (table0 #x24) s38)) [GOOD] (assert (= (table0 #x25) s39)) [GOOD] (assert (= (table0 #x26) s40)) [GOOD] (assert (= (table0 #x27) s41)) [GOOD] (assert (= (table0 #x28) s42)) [GOOD] (assert (= (table0 #x29) s43)) [GOOD] (assert (= (table0 #x2a) s44)) [GOOD] (assert (= (table0 #x2b) s45)) [GOOD] (assert (= (table0 #x2c) s46)) [GOOD] (assert (= (table0 #x2d) s47)) [GOOD] (assert (= (table0 #x2e) s48)) [GOOD] (assert (= (table0 #x2f) s49)) [GOOD] (assert (= (table0 #x30) s50)) [GOOD] (assert (= (table0 #x31) s51)) [GOOD] (assert (= (table0 #x32) s52)) [GOOD] (assert (= (table0 #x33) s53)) [GOOD] (assert (= (table0 #x34) s54)) [GOOD] (assert (= (table0 #x35) s55)) [GOOD] (assert (= (table0 #x36) s56)) [GOOD] (assert (= (table0 #x37) s57)) [GOOD] (assert (= (table0 #x38) s58)) [GOOD] (assert (= (table0 #x39) s59)) [GOOD] (assert (= (table0 #x3a) s60)) [GOOD] (assert (= (table0 #x3b) s61)) [GOOD] (assert (= (table0 #x3c) s62)) [GOOD] (assert (= (table0 #x3d) s63)) [GOOD] (assert (= (table0 #x3e) s64)) [GOOD] (assert (= (table0 #x3f) s65)) [GOOD] (assert (= (table0 #x40) s66)) [GOOD] (assert (= (table0 #x41) s67)) [GOOD] (assert (= (table0 #x42) s68)) [GOOD] (assert (= (table0 #x43) s69)) [GOOD] (assert (= (table0 #x44) s70)) [GOOD] (assert (= (table0 #x45) s71)) [GOOD] (assert (= (table0 #x46) s72)) [GOOD] (assert (= (table0 #x47) s73)) [GOOD] (assert (= (table0 #x48) s74)) [GOOD] (assert (= (table0 #x49) s75)) [GOOD] (assert (= (table0 #x4a) s76)) [GOOD] (assert (= (table0 #x4b) s77)) [GOOD] (assert (= (table0 #x4c) s78)) [GOOD] (assert (= (table0 #x4d) s79)) [GOOD] (assert (= (table0 #x4e) s80)) [GOOD] (assert (= (table0 #x4f) s81)) [GOOD] (assert (= (table0 #x50) s82)) [GOOD] (assert (= (table0 #x51) s83)) [GOOD] (assert (= (table0 #x52) s84)) [GOOD] (assert (= (table0 #x53) s85)) [GOOD] (assert (= (table0 #x54) s86)) [GOOD] (assert (= (table0 #x55) s87)) [GOOD] (assert (= (table0 #x56) s88)) [GOOD] (assert (= (table0 #x57) s89)) [GOOD] (assert (= (table0 #x58) s90)) [GOOD] (assert (= (table0 #x59) s91)) [GOOD] (assert (= (table0 #x5a) s92)) [GOOD] (assert (= (table0 #x5b) s93)) [GOOD] (assert (= (table0 #x5c) s94)) [GOOD] (assert (= (table0 #x5d) s95)) [GOOD] (assert (= (table0 #x5e) s96)) [GOOD] (assert (= (table0 #x5f) s97)) [GOOD] (assert (= (table0 #x60) s98)) [GOOD] (assert (= (table0 #x61) s99)) [GOOD] (assert (= (table0 #x62) s100)) [GOOD] (assert (= (table0 #x63) s101)) [GOOD] (assert (= (table0 #x64) s102)) [GOOD] (assert (= (table0 #x65) s103)) [GOOD] (assert (= (table0 #x66) s104)) [GOOD] (assert (= (table0 #x67) s105)) [GOOD] (assert (= (table0 #x68) s106)) [GOOD] (assert (= (table0 #x69) s107)) [GOOD] (assert (= (table0 #x6a) s108)) [GOOD] (assert (= (table0 #x6b) s109)) [GOOD] (assert (= (table0 #x6c) s110)) [GOOD] (assert (= (table0 #x6d) s111)) [GOOD] (assert (= (table0 #x6e) s112)) [GOOD] (assert (= (table0 #x6f) s113)) [GOOD] (assert (= (table0 #x70) s114)) [GOOD] (assert (= (table0 #x71) s115)) [GOOD] (assert (= (table0 #x72) s116)) [GOOD] (assert (= (table0 #x73) s117)) [GOOD] (assert (= (table0 #x74) s118)) [GOOD] (assert (= (table0 #x75) s119)) [GOOD] (assert (= (table0 #x76) s120)) [GOOD] (assert (= (table0 #x77) s121)) [GOOD] (assert (= (table0 #x78) s122)) [GOOD] (assert (= (table0 #x79) s123)) [GOOD] (assert (= (table0 #x7a) s124)) [GOOD] (assert (= (table0 #x7b) s125)) [GOOD] (assert (= (table0 #x7c) s126)) [GOOD] (assert (= (table0 #x7d) s127)) [GOOD] (assert (= (table0 #x7e) s128)) [GOOD] (assert (= (table0 #x7f) s129)) [GOOD] (assert (= (table0 #x80) s130)) [GOOD] (assert (= (table0 #x81) s131)) [GOOD] (assert (= (table0 #x82) s132)) [GOOD] (assert (= (table0 #x83) s133)) [GOOD] (assert (= (table0 #x84) s134)) [GOOD] (assert (= (table0 #x85) s135)) [GOOD] (assert (= (table0 #x86) s136)) [GOOD] (assert (= (table0 #x87) s137)) [GOOD] (assert (= (table0 #x88) s138)) [GOOD] (assert (= (table0 #x89) s139)) [GOOD] (assert (= (table0 #x8a) s140)) [GOOD] (assert (= (table0 #x8b) s141)) [GOOD] (assert (= (table0 #x8c) s142)) [GOOD] (assert (= (table0 #x8d) s143)) [GOOD] (assert (= (table0 #x8e) s144)) [GOOD] (assert (= (table0 #x8f) s145)) [GOOD] (assert (= (table0 #x90) s146)) [GOOD] (assert (= (table0 #x91) s147)) [GOOD] (assert (= (table0 #x92) s148)) [GOOD] (assert (= (table0 #x93) s149)) [GOOD] (assert (= (table0 #x94) s150)) [GOOD] (assert (= (table0 #x95) s151)) [GOOD] (assert (= (table0 #x96) s152)) [GOOD] (assert (= (table0 #x97) s153)) [GOOD] (assert (= (table0 #x98) s154)) [GOOD] (assert (= (table0 #x99) s155)) [GOOD] (assert (= (table0 #x9a) s156)) [GOOD] (assert (= (table0 #x9b) s157)) [GOOD] (assert (= (table0 #x9c) s158)) [GOOD] (assert (= (table0 #x9d) s159)) [GOOD] (assert (= (table0 #x9e) s160)) [GOOD] (assert (= (table0 #x9f) s161)) [GOOD] (assert (= (table0 #xa0) s162)) [GOOD] (assert (= (table0 #xa1) s163)) [GOOD] (assert (= (table0 #xa2) s164)) [GOOD] (assert (= (table0 #xa3) s165)) [GOOD] (assert (= (table0 #xa4) s166)) [GOOD] (assert (= (table0 #xa5) s167)) [GOOD] (assert (= (table0 #xa6) s168)) [GOOD] (assert (= (table0 #xa7) s169)) [GOOD] (assert (= (table0 #xa8) s170)) [GOOD] (assert (= (table0 #xa9) s171)) [GOOD] (assert (= (table0 #xaa) s172)) [GOOD] (assert (= (table0 #xab) s173)) [GOOD] (assert (= (table0 #xac) s174)) [GOOD] (assert (= (table0 #xad) s175)) [GOOD] (assert (= (table0 #xae) s176)) [GOOD] (assert (= (table0 #xaf) s177)) [GOOD] (assert (= (table0 #xb0) s178)) [GOOD] (assert (= (table0 #xb1) s179)) [GOOD] (assert (= (table0 #xb2) s180)) [GOOD] (assert (= (table0 #xb3) s181)) [GOOD] (assert (= (table0 #xb4) s182)) [GOOD] (assert (= (table0 #xb5) s183)) [GOOD] (assert (= (table0 #xb6) s184)) [GOOD] (assert (= (table0 #xb7) s185)) [GOOD] (assert (= (table0 #xb8) s186)) [GOOD] (assert (= (table0 #xb9) s187)) [GOOD] (assert (= (table0 #xba) s188)) [GOOD] (assert (= (table0 #xbb) s189)) [GOOD] (assert (= (table0 #xbc) s190)) [GOOD] (assert (= (table0 #xbd) s191)) [GOOD] (assert (= (table0 #xbe) s192)) [GOOD] (assert (= (table0 #xbf) s193)) [GOOD] (assert (= (table0 #xc0) s194)) [GOOD] (assert (= (table0 #xc1) s195)) [GOOD] (assert (= (table0 #xc2) s196)) [GOOD] (assert (= (table0 #xc3) s197)) [GOOD] (assert (= (table0 #xc4) s198)) [GOOD] (assert (= (table0 #xc5) s199)) [GOOD] (assert (= (table0 #xc6) s200)) [GOOD] (assert (= (table0 #xc7) s201)) [GOOD] (assert (= (table0 #xc8) s202)) [GOOD] (assert (= (table0 #xc9) s203)) [GOOD] (assert (= (table0 #xca) s204)) [GOOD] (assert (= (table0 #xcb) s205)) [GOOD] (assert (= (table0 #xcc) s206)) [GOOD] (assert (= (table0 #xcd) s207)) [GOOD] (assert (= (table0 #xce) s208)) [GOOD] (assert (= (table0 #xcf) s209)) [GOOD] (assert (= (table0 #xd0) s210)) [GOOD] (assert (= (table0 #xd1) s211)) [GOOD] (assert (= (table0 #xd2) s212)) [GOOD] (assert (= (table0 #xd3) s213)) [GOOD] (assert (= (table0 #xd4) s214)) [GOOD] (assert (= (table0 #xd5) s215)) [GOOD] (assert (= (table0 #xd6) s216)) [GOOD] (assert (= (table0 #xd7) s217)) [GOOD] (assert (= (table0 #xd8) s218)) [GOOD] (assert (= (table0 #xd9) s219)) [GOOD] (assert (= (table0 #xda) s220)) [GOOD] (assert (= (table0 #xdb) s221)) [GOOD] (assert (= (table0 #xdc) s222)) [GOOD] (assert (= (table0 #xdd) s223)) [GOOD] (assert (= (table0 #xde) s224)) [GOOD] (assert (= (table0 #xdf) s225)) [GOOD] (assert (= (table0 #xe0) s226)) [GOOD] (assert (= (table0 #xe1) s227)) [GOOD] (assert (= (table0 #xe2) s228)) [GOOD] (assert (= (table0 #xe3) s229)) [GOOD] (assert (= (table0 #xe4) s230)) [GOOD] (assert (= (table0 #xe5) s231)) [GOOD] (assert (= (table0 #xe6) s232)) [GOOD] (assert (= (table0 #xe7) s233)) [GOOD] (assert (= (table0 #xe8) s234)) [GOOD] (assert (= (table0 #xe9) s235)) [GOOD] (assert (= (table0 #xea) s236)) [GOOD] (assert (= (table0 #xeb) s237)) [GOOD] (assert (= (table0 #xec) s238)) [GOOD] (assert (= (table0 #xed) s239)) [GOOD] (assert (= (table0 #xee) s240)) [GOOD] (assert (= (table0 #xef) s241)) [GOOD] (assert (= (table0 #xf0) s242)) [GOOD] (assert (= (table0 #xf1) s243)) [GOOD] (assert (= (table0 #xf2) s244)) [GOOD] (assert (= (table0 #xf3) s245)) [GOOD] (assert (= (table0 #xf4) s246)) [GOOD] (assert (= (table0 #xf5) s247)) [GOOD] (assert (= (table0 #xf6) s248)) [GOOD] (assert (= (table0 #xf7) s249)) [GOOD] (assert (= (table0 #xf8) s250)) [GOOD] (assert (= (table0 #xf9) s251)) [GOOD] (assert (= (table0 #xfa) s252)) [GOOD] (assert (= (table0 #xfb) s253)) [GOOD] (assert (= (table0 #xfc) s254)) [GOOD] (assert (= (table0 #xfd) s255)) [GOOD] (assert (= (table0 #xfe) s256)) [GOOD] (assert (= (table0 #xff) s257)) [GOOD] (define-fun s258 () (_ BitVec 8) (table0 s0)) [GOOD] (define-fun s259 () Bool (= s0 s258)) [GOOD] (assert s259) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 #x00)) [GOOD] (define-fun s260 () (_ BitVec 8) (table0 s1)) [GOOD] (define-fun s261 () Bool (= s1 s260)) [GOOD] (assert s261) [GOOD] (define-fun s262 () (_ BitVec 8) (bvadd s0 s3)) [GOOD] (define-fun s263 () Bool (= s1 s262)) [GOOD] (assert s263) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s1)) [RECV] ((s1 #x01)) *** Solver : Z3 *** Exit code: ExitSuccess FINAL:(0,1) DONE! sbv-7.13/SBVTestSuite/GoldFiles/queryArrays5.gold0000644000000000000000000000305513405536617020100 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_ABV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (_ BitVec 8)) ; tracks user variable "a" [GOOD] (declare-fun s1 () (_ BitVec 8)) ; tracks user variable "v" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] (declare-fun array_0 () (Array (_ BitVec 8) (_ BitVec 8))) [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [GOOD] (define-fun s4 () (_ BitVec 8) #x01) [GOOD] (define-fun s2 () (_ BitVec 8) #x01) [GOOD] (declare-fun array_1 () (Array (_ BitVec 8) (_ BitVec 8))) [GOOD] (declare-fun array_2 () (Array (_ BitVec 8) (_ BitVec 8))) [GOOD] (define-fun s3 () (_ BitVec 8) (bvadd s1 s2)) [GOOD] (define-fun s5 () (_ BitVec 8) (bvadd s0 s4)) [GOOD] (define-fun s6 () (_ BitVec 8) (select array_2 s5)) [GOOD] (define-fun s7 () Bool (distinct s3 s6)) [GOOD] (assert (= array_1 (store array_0 s0 s1))) [GOOD] (assert (= array_2 (store array_1 s5 s3))) [GOOD] (assert s7) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess FINAL:Nothing DONE! sbv-7.13/SBVTestSuite/GoldFiles/queryArrays6.gold0000644000000000000000000000541213405536617020100 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] (declare-fun array_0 () (Array Int Int)) [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [GOOD] (push 1) [GOOD] (define-fun s0 () Int 1) [GOOD] (define-fun s2 () Int 5) [GOOD] (declare-fun array_1 () (Array Int Int)) [GOOD] (define-fun array_1_initializer_0 () Bool (= array_1 (store array_0 s0 s0))) [GOOD] (define-fun s1 () Int (select array_1 s0)) [GOOD] (define-fun s3 () Bool (= s1 s2)) [GOOD] (define-fun array_1_initializer () Bool array_1_initializer_0) [GOOD] (assert array_1_initializer) [GOOD] (assert s3) [SEND] (check-sat) [RECV] unsat [GOOD] (pop 1) [GOOD] (assert array_1_initializer) [GOOD] (declare-fun s4 () Int) [GOOD] (define-fun s6 () Int 3) [GOOD] (define-fun s5 () Bool (>= s4 s0)) [GOOD] (define-fun s7 () Bool (< s4 s6)) [GOOD] (define-fun s8 () Bool (and s5 s7)) [GOOD] (assert s8) [GOOD] (push 1) [GOOD] (declare-fun array_2 () (Array Int Int)) [GOOD] (define-fun s9 () Int (+ s1 s4)) [GOOD] (define-fun s10 () Int (select array_2 s0)) [GOOD] (define-fun s11 () Bool (= s2 s10)) [GOOD] (define-fun array_2_initializer_0 () Bool (= array_2 (store array_1 s0 s9))) [GOOD] (define-fun array_2_initializer () Bool array_2_initializer_0) [GOOD] (assert array_2_initializer) [GOOD] (assert s11) [SEND] (check-sat) [RECV] unsat [GOOD] (pop 1) [GOOD] (assert (and array_1_initializer array_2_initializer)) [GOOD] (declare-fun s12 () Int) [GOOD] (define-fun s13 () Bool (>= s12 s0)) [GOOD] (define-fun s14 () Bool (< s12 s6)) [GOOD] (define-fun s15 () Bool (and s13 s14)) [GOOD] (assert s15) [GOOD] (push 1) [GOOD] (declare-fun array_3 () (Array Int Int)) [GOOD] (define-fun s16 () Int (+ s10 s12)) [GOOD] (define-fun s17 () Int (select array_3 s0)) [GOOD] (define-fun s18 () Bool (= s2 s17)) [GOOD] (define-fun array_3_initializer_0 () Bool (= array_3 (store array_2 s0 s16))) [GOOD] (define-fun array_3_initializer () Bool array_3_initializer_0) [GOOD] (assert array_3_initializer) [GOOD] (assert s18) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s4)) [RECV] ((s4 2)) [SEND] (get-value (s12)) [RECV] ((s12 2)) *** Solver : Z3 *** Exit code: ExitSuccess FINAL:[2,2] DONE! sbv-7.13/SBVTestSuite/GoldFiles/qUninterp1.gold0000644000000000000000000000177613405536617017542 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has user-defined sorts, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] (declare-sort L 0) ; N.B. Uninterpreted: L.B: not a nullary constructor [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () L) [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 L!val!0)) *** Solver : Z3 *** Exit code: ExitSuccess FINAL:L!val!0 DONE! sbv-7.13/SBVTestSuite/GoldFiles/reverse.gold0000644000000000000000000002072013405536617017135 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s13 () Int 1) [GOOD] (define-fun s53 () Int 0) [GOOD] (define-fun s11 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "a" [GOOD] (declare-fun s1 () Int) ; tracks user variable "b" [GOOD] (declare-fun s2 () Int) ; tracks user variable "c" [GOOD] (declare-fun s3 () Int) ; tracks user variable "d" [GOOD] (declare-fun s50 () Int) ; tracks user variable "__internal_sbv_s50" [GOOD] (declare-fun s60 () Int) ; tracks user variable "__internal_sbv_s60" [GOOD] (declare-fun s69 () Int) ; tracks user variable "__internal_sbv_s69" [GOOD] (declare-fun s78 () Int) ; tracks user variable "__internal_sbv_s78" [GOOD] (declare-fun s87 () Int) ; tracks user variable "__internal_sbv_s87" [GOOD] (declare-fun s96 () Int) ; tracks user variable "__internal_sbv_s96" [GOOD] (declare-fun s105 () Int) ; tracks user variable "__internal_sbv_s105" [GOOD] (declare-fun s114 () Int) ; tracks user variable "__internal_sbv_s114" [GOOD] (declare-fun s123 () Int) ; tracks user variable "__internal_sbv_s123" [GOOD] (declare-fun s132 () Int) ; tracks user variable "__internal_sbv_s132" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s4 () (Seq Int) (seq.unit s0)) [GOOD] (define-fun s5 () (Seq Int) (seq.unit s1)) [GOOD] (define-fun s6 () (Seq Int) (seq.unit s2)) [GOOD] (define-fun s7 () (Seq Int) (seq.unit s3)) [GOOD] (define-fun s8 () (Seq Int) (seq.++ s6 s7)) [GOOD] (define-fun s9 () (Seq Int) (seq.++ s5 s8)) [GOOD] (define-fun s10 () (Seq Int) (seq.++ s4 s9)) [GOOD] (define-fun s12 () Bool (= s10 s11)) [GOOD] (define-fun s14 () Int (seq.len s10)) [GOOD] (define-fun s15 () Int (- s14 s13)) [GOOD] (define-fun s16 () (Seq Int) (seq.extract s10 s13 s15)) [GOOD] (define-fun s17 () Bool (= s11 s16)) [GOOD] (define-fun s18 () Int (seq.len s16)) [GOOD] (define-fun s19 () Int (- s18 s13)) [GOOD] (define-fun s20 () (Seq Int) (seq.extract s16 s13 s19)) [GOOD] (define-fun s21 () Bool (= s11 s20)) [GOOD] (define-fun s22 () Int (seq.len s20)) [GOOD] (define-fun s23 () Int (- s22 s13)) [GOOD] (define-fun s24 () (Seq Int) (seq.extract s20 s13 s23)) [GOOD] (define-fun s25 () Bool (= s11 s24)) [GOOD] (define-fun s26 () Int (seq.len s24)) [GOOD] (define-fun s27 () Int (- s26 s13)) [GOOD] (define-fun s28 () (Seq Int) (seq.extract s24 s13 s27)) [GOOD] (define-fun s29 () Bool (= s11 s28)) [GOOD] (define-fun s30 () Int (seq.len s28)) [GOOD] (define-fun s31 () Int (- s30 s13)) [GOOD] (define-fun s32 () (Seq Int) (seq.extract s28 s13 s31)) [GOOD] (define-fun s33 () Bool (= s11 s32)) [GOOD] (define-fun s34 () Int (seq.len s32)) [GOOD] (define-fun s35 () Int (- s34 s13)) [GOOD] (define-fun s36 () (Seq Int) (seq.extract s32 s13 s35)) [GOOD] (define-fun s37 () Bool (= s11 s36)) [GOOD] (define-fun s38 () Int (seq.len s36)) [GOOD] (define-fun s39 () Int (- s38 s13)) [GOOD] (define-fun s40 () (Seq Int) (seq.extract s36 s13 s39)) [GOOD] (define-fun s41 () Bool (= s11 s40)) [GOOD] (define-fun s42 () Int (seq.len s40)) [GOOD] (define-fun s43 () Int (- s42 s13)) [GOOD] (define-fun s44 () (Seq Int) (seq.extract s40 s13 s43)) [GOOD] (define-fun s45 () Bool (= s11 s44)) [GOOD] (define-fun s46 () Int (seq.len s44)) [GOOD] (define-fun s47 () Int (- s46 s13)) [GOOD] (define-fun s48 () (Seq Int) (seq.extract s44 s13 s47)) [GOOD] (define-fun s49 () Bool (= s11 s48)) [GOOD] (define-fun s51 () (Seq Int) (seq.unit s50)) [GOOD] (define-fun s52 () Int (seq.len s48)) [GOOD] (define-fun s54 () Bool (> s52 s53)) [GOOD] (define-fun s55 () Bool (not s54)) [GOOD] (define-fun s56 () (Seq Int) (seq.extract s48 s53 s13)) [GOOD] (define-fun s57 () Bool (= s51 s56)) [GOOD] (define-fun s58 () Bool (or s55 s57)) [GOOD] (define-fun s59 () (Seq Int) (ite s49 s11 s51)) [GOOD] (define-fun s61 () (Seq Int) (seq.unit s60)) [GOOD] (define-fun s62 () Bool (> s46 s53)) [GOOD] (define-fun s63 () Bool (not s62)) [GOOD] (define-fun s64 () (Seq Int) (seq.extract s44 s53 s13)) [GOOD] (define-fun s65 () Bool (= s61 s64)) [GOOD] (define-fun s66 () Bool (or s63 s65)) [GOOD] (define-fun s67 () (Seq Int) (seq.++ s59 s61)) [GOOD] (define-fun s68 () (Seq Int) (ite s45 s11 s67)) [GOOD] (define-fun s70 () (Seq Int) (seq.unit s69)) [GOOD] (define-fun s71 () Bool (> s42 s53)) [GOOD] (define-fun s72 () Bool (not s71)) [GOOD] (define-fun s73 () (Seq Int) (seq.extract s40 s53 s13)) [GOOD] (define-fun s74 () Bool (= s70 s73)) [GOOD] (define-fun s75 () Bool (or s72 s74)) [GOOD] (define-fun s76 () (Seq Int) (seq.++ s68 s70)) [GOOD] (define-fun s77 () (Seq Int) (ite s41 s11 s76)) [GOOD] (define-fun s79 () (Seq Int) (seq.unit s78)) [GOOD] (define-fun s80 () Bool (> s38 s53)) [GOOD] (define-fun s81 () Bool (not s80)) [GOOD] (define-fun s82 () (Seq Int) (seq.extract s36 s53 s13)) [GOOD] (define-fun s83 () Bool (= s79 s82)) [GOOD] (define-fun s84 () Bool (or s81 s83)) [GOOD] (define-fun s85 () (Seq Int) (seq.++ s77 s79)) [GOOD] (define-fun s86 () (Seq Int) (ite s37 s11 s85)) [GOOD] (define-fun s88 () (Seq Int) (seq.unit s87)) [GOOD] (define-fun s89 () Bool (> s34 s53)) [GOOD] (define-fun s90 () Bool (not s89)) [GOOD] (define-fun s91 () (Seq Int) (seq.extract s32 s53 s13)) [GOOD] (define-fun s92 () Bool (= s88 s91)) [GOOD] (define-fun s93 () Bool (or s90 s92)) [GOOD] (define-fun s94 () (Seq Int) (seq.++ s86 s88)) [GOOD] (define-fun s95 () (Seq Int) (ite s33 s11 s94)) [GOOD] (define-fun s97 () (Seq Int) (seq.unit s96)) [GOOD] (define-fun s98 () Bool (> s30 s53)) [GOOD] (define-fun s99 () Bool (not s98)) [GOOD] (define-fun s100 () (Seq Int) (seq.extract s28 s53 s13)) [GOOD] (define-fun s101 () Bool (= s97 s100)) [GOOD] (define-fun s102 () Bool (or s99 s101)) [GOOD] (define-fun s103 () (Seq Int) (seq.++ s95 s97)) [GOOD] (define-fun s104 () (Seq Int) (ite s29 s11 s103)) [GOOD] (define-fun s106 () (Seq Int) (seq.unit s105)) [GOOD] (define-fun s107 () Bool (> s26 s53)) [GOOD] (define-fun s108 () Bool (not s107)) [GOOD] (define-fun s109 () (Seq Int) (seq.extract s24 s53 s13)) [GOOD] (define-fun s110 () Bool (= s106 s109)) [GOOD] (define-fun s111 () Bool (or s108 s110)) [GOOD] (define-fun s112 () (Seq Int) (seq.++ s104 s106)) [GOOD] (define-fun s113 () (Seq Int) (ite s25 s11 s112)) [GOOD] (define-fun s115 () (Seq Int) (seq.unit s114)) [GOOD] (define-fun s116 () Bool (> s22 s53)) [GOOD] (define-fun s117 () Bool (not s116)) [GOOD] (define-fun s118 () (Seq Int) (seq.extract s20 s53 s13)) [GOOD] (define-fun s119 () Bool (= s115 s118)) [GOOD] (define-fun s120 () Bool (or s117 s119)) [GOOD] (define-fun s121 () (Seq Int) (seq.++ s113 s115)) [GOOD] (define-fun s122 () (Seq Int) (ite s21 s11 s121)) [GOOD] (define-fun s124 () (Seq Int) (seq.unit s123)) [GOOD] (define-fun s125 () Bool (> s18 s53)) [GOOD] (define-fun s126 () Bool (not s125)) [GOOD] (define-fun s127 () (Seq Int) (seq.extract s16 s53 s13)) [GOOD] (define-fun s128 () Bool (= s124 s127)) [GOOD] (define-fun s129 () Bool (or s126 s128)) [GOOD] (define-fun s130 () (Seq Int) (seq.++ s122 s124)) [GOOD] (define-fun s131 () (Seq Int) (ite s17 s11 s130)) [GOOD] (define-fun s133 () (Seq Int) (seq.unit s132)) [GOOD] (define-fun s134 () Bool (> s14 s53)) [GOOD] (define-fun s135 () Bool (not s134)) [GOOD] (define-fun s136 () (Seq Int) (seq.extract s10 s53 s13)) [GOOD] (define-fun s137 () Bool (= s133 s136)) [GOOD] (define-fun s138 () Bool (or s135 s137)) [GOOD] (define-fun s139 () (Seq Int) (seq.++ s131 s133)) [GOOD] (define-fun s140 () (Seq Int) (ite s12 s11 s139)) [GOOD] (define-fun s141 () (Seq Int) (seq.++ s5 s4)) [GOOD] (define-fun s142 () (Seq Int) (seq.++ s6 s141)) [GOOD] (define-fun s143 () (Seq Int) (seq.++ s7 s142)) [GOOD] (define-fun s144 () Bool (= s140 s143)) [GOOD] (assert s58) [GOOD] (assert s66) [GOOD] (assert s75) [GOOD] (assert s84) [GOOD] (assert s93) [GOOD] (assert s102) [GOOD] (assert s111) [GOOD] (assert s120) [GOOD] (assert s129) [GOOD] (assert s138) [GOOD] (assert s144) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/reverseAlt10.gold0000644000000000000000000002626113405536617017745 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s3 () Int 1) [GOOD] (define-fun s43 () Int 0) [GOOD] (define-fun s1 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (Seq Int)) ; tracks user variable "xs" [GOOD] (declare-fun s40 () Int) ; tracks user variable "__internal_sbv_s40" [GOOD] (declare-fun s50 () Int) ; tracks user variable "__internal_sbv_s50" [GOOD] (declare-fun s59 () Int) ; tracks user variable "__internal_sbv_s59" [GOOD] (declare-fun s68 () Int) ; tracks user variable "__internal_sbv_s68" [GOOD] (declare-fun s77 () Int) ; tracks user variable "__internal_sbv_s77" [GOOD] (declare-fun s86 () Int) ; tracks user variable "__internal_sbv_s86" [GOOD] (declare-fun s95 () Int) ; tracks user variable "__internal_sbv_s95" [GOOD] (declare-fun s104 () Int) ; tracks user variable "__internal_sbv_s104" [GOOD] (declare-fun s113 () Int) ; tracks user variable "__internal_sbv_s113" [GOOD] (declare-fun s122 () Int) ; tracks user variable "__internal_sbv_s122" [GOOD] (declare-fun s131 () Int) ; tracks user variable "__internal_sbv_s131" [GOOD] (declare-fun s135 () Int) ; tracks user variable "__internal_sbv_s135" [GOOD] (declare-fun s140 () Int) ; tracks user variable "__internal_sbv_s140" [GOOD] (declare-fun s145 () Int) ; tracks user variable "__internal_sbv_s145" [GOOD] (declare-fun s150 () Int) ; tracks user variable "__internal_sbv_s150" [GOOD] (declare-fun s155 () Int) ; tracks user variable "__internal_sbv_s155" [GOOD] (declare-fun s160 () Int) ; tracks user variable "__internal_sbv_s160" [GOOD] (declare-fun s165 () Int) ; tracks user variable "__internal_sbv_s165" [GOOD] (declare-fun s170 () Int) ; tracks user variable "__internal_sbv_s170" [GOOD] (declare-fun s175 () Int) ; tracks user variable "__internal_sbv_s175" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (= s0 s1)) [GOOD] (define-fun s4 () Int (seq.len s0)) [GOOD] (define-fun s5 () Int (- s4 s3)) [GOOD] (define-fun s6 () (Seq Int) (seq.extract s0 s3 s5)) [GOOD] (define-fun s7 () Bool (= s1 s6)) [GOOD] (define-fun s8 () Int (seq.len s6)) [GOOD] (define-fun s9 () Int (- s8 s3)) [GOOD] (define-fun s10 () (Seq Int) (seq.extract s6 s3 s9)) [GOOD] (define-fun s11 () Bool (= s1 s10)) [GOOD] (define-fun s12 () Int (seq.len s10)) [GOOD] (define-fun s13 () Int (- s12 s3)) [GOOD] (define-fun s14 () (Seq Int) (seq.extract s10 s3 s13)) [GOOD] (define-fun s15 () Bool (= s1 s14)) [GOOD] (define-fun s16 () Int (seq.len s14)) [GOOD] (define-fun s17 () Int (- s16 s3)) [GOOD] (define-fun s18 () (Seq Int) (seq.extract s14 s3 s17)) [GOOD] (define-fun s19 () Bool (= s1 s18)) [GOOD] (define-fun s20 () Int (seq.len s18)) [GOOD] (define-fun s21 () Int (- s20 s3)) [GOOD] (define-fun s22 () (Seq Int) (seq.extract s18 s3 s21)) [GOOD] (define-fun s23 () Bool (= s1 s22)) [GOOD] (define-fun s24 () Int (seq.len s22)) [GOOD] (define-fun s25 () Int (- s24 s3)) [GOOD] (define-fun s26 () (Seq Int) (seq.extract s22 s3 s25)) [GOOD] (define-fun s27 () Bool (= s1 s26)) [GOOD] (define-fun s28 () Int (seq.len s26)) [GOOD] (define-fun s29 () Int (- s28 s3)) [GOOD] (define-fun s30 () (Seq Int) (seq.extract s26 s3 s29)) [GOOD] (define-fun s31 () Bool (= s1 s30)) [GOOD] (define-fun s32 () Int (seq.len s30)) [GOOD] (define-fun s33 () Int (- s32 s3)) [GOOD] (define-fun s34 () (Seq Int) (seq.extract s30 s3 s33)) [GOOD] (define-fun s35 () Bool (= s1 s34)) [GOOD] (define-fun s36 () Int (seq.len s34)) [GOOD] (define-fun s37 () Int (- s36 s3)) [GOOD] (define-fun s38 () (Seq Int) (seq.extract s34 s3 s37)) [GOOD] (define-fun s39 () Bool (= s1 s38)) [GOOD] (define-fun s41 () (Seq Int) (seq.unit s40)) [GOOD] (define-fun s42 () Int (seq.len s38)) [GOOD] (define-fun s44 () Bool (> s42 s43)) [GOOD] (define-fun s45 () Bool (not s44)) [GOOD] (define-fun s46 () (Seq Int) (seq.extract s38 s43 s3)) [GOOD] (define-fun s47 () Bool (= s41 s46)) [GOOD] (define-fun s48 () Bool (or s45 s47)) [GOOD] (define-fun s49 () (Seq Int) (ite s39 s1 s41)) [GOOD] (define-fun s51 () (Seq Int) (seq.unit s50)) [GOOD] (define-fun s52 () Bool (> s36 s43)) [GOOD] (define-fun s53 () Bool (not s52)) [GOOD] (define-fun s54 () (Seq Int) (seq.extract s34 s43 s3)) [GOOD] (define-fun s55 () Bool (= s51 s54)) [GOOD] (define-fun s56 () Bool (or s53 s55)) [GOOD] (define-fun s57 () (Seq Int) (seq.++ s49 s51)) [GOOD] (define-fun s58 () (Seq Int) (ite s35 s1 s57)) [GOOD] (define-fun s60 () (Seq Int) (seq.unit s59)) [GOOD] (define-fun s61 () Bool (> s32 s43)) [GOOD] (define-fun s62 () Bool (not s61)) [GOOD] (define-fun s63 () (Seq Int) (seq.extract s30 s43 s3)) [GOOD] (define-fun s64 () Bool (= s60 s63)) [GOOD] (define-fun s65 () Bool (or s62 s64)) [GOOD] (define-fun s66 () (Seq Int) (seq.++ s58 s60)) [GOOD] (define-fun s67 () (Seq Int) (ite s31 s1 s66)) [GOOD] (define-fun s69 () (Seq Int) (seq.unit s68)) [GOOD] (define-fun s70 () Bool (> s28 s43)) [GOOD] (define-fun s71 () Bool (not s70)) [GOOD] (define-fun s72 () (Seq Int) (seq.extract s26 s43 s3)) [GOOD] (define-fun s73 () Bool (= s69 s72)) [GOOD] (define-fun s74 () Bool (or s71 s73)) [GOOD] (define-fun s75 () (Seq Int) (seq.++ s67 s69)) [GOOD] (define-fun s76 () (Seq Int) (ite s27 s1 s75)) [GOOD] (define-fun s78 () (Seq Int) (seq.unit s77)) [GOOD] (define-fun s79 () Bool (> s24 s43)) [GOOD] (define-fun s80 () Bool (not s79)) [GOOD] (define-fun s81 () (Seq Int) (seq.extract s22 s43 s3)) [GOOD] (define-fun s82 () Bool (= s78 s81)) [GOOD] (define-fun s83 () Bool (or s80 s82)) [GOOD] (define-fun s84 () (Seq Int) (seq.++ s76 s78)) [GOOD] (define-fun s85 () (Seq Int) (ite s23 s1 s84)) [GOOD] (define-fun s87 () (Seq Int) (seq.unit s86)) [GOOD] (define-fun s88 () Bool (> s20 s43)) [GOOD] (define-fun s89 () Bool (not s88)) [GOOD] (define-fun s90 () (Seq Int) (seq.extract s18 s43 s3)) [GOOD] (define-fun s91 () Bool (= s87 s90)) [GOOD] (define-fun s92 () Bool (or s89 s91)) [GOOD] (define-fun s93 () (Seq Int) (seq.++ s85 s87)) [GOOD] (define-fun s94 () (Seq Int) (ite s19 s1 s93)) [GOOD] (define-fun s96 () (Seq Int) (seq.unit s95)) [GOOD] (define-fun s97 () Bool (> s16 s43)) [GOOD] (define-fun s98 () Bool (not s97)) [GOOD] (define-fun s99 () (Seq Int) (seq.extract s14 s43 s3)) [GOOD] (define-fun s100 () Bool (= s96 s99)) [GOOD] (define-fun s101 () Bool (or s98 s100)) [GOOD] (define-fun s102 () (Seq Int) (seq.++ s94 s96)) [GOOD] (define-fun s103 () (Seq Int) (ite s15 s1 s102)) [GOOD] (define-fun s105 () (Seq Int) (seq.unit s104)) [GOOD] (define-fun s106 () Bool (> s12 s43)) [GOOD] (define-fun s107 () Bool (not s106)) [GOOD] (define-fun s108 () (Seq Int) (seq.extract s10 s43 s3)) [GOOD] (define-fun s109 () Bool (= s105 s108)) [GOOD] (define-fun s110 () Bool (or s107 s109)) [GOOD] (define-fun s111 () (Seq Int) (seq.++ s103 s105)) [GOOD] (define-fun s112 () (Seq Int) (ite s11 s1 s111)) [GOOD] (define-fun s114 () (Seq Int) (seq.unit s113)) [GOOD] (define-fun s115 () Bool (> s8 s43)) [GOOD] (define-fun s116 () Bool (not s115)) [GOOD] (define-fun s117 () (Seq Int) (seq.extract s6 s43 s3)) [GOOD] (define-fun s118 () Bool (= s114 s117)) [GOOD] (define-fun s119 () Bool (or s116 s118)) [GOOD] (define-fun s120 () (Seq Int) (seq.++ s112 s114)) [GOOD] (define-fun s121 () (Seq Int) (ite s7 s1 s120)) [GOOD] (define-fun s123 () (Seq Int) (seq.unit s122)) [GOOD] (define-fun s124 () Bool (> s4 s43)) [GOOD] (define-fun s125 () Bool (not s124)) [GOOD] (define-fun s126 () (Seq Int) (seq.extract s0 s43 s3)) [GOOD] (define-fun s127 () Bool (= s123 s126)) [GOOD] (define-fun s128 () Bool (or s125 s127)) [GOOD] (define-fun s129 () (Seq Int) (seq.++ s121 s123)) [GOOD] (define-fun s130 () (Seq Int) (ite s2 s1 s129)) [GOOD] (define-fun s132 () (Seq Int) (seq.unit s131)) [GOOD] (define-fun s133 () Bool (= s126 s132)) [GOOD] (define-fun s134 () Bool (or s125 s133)) [GOOD] (define-fun s136 () (Seq Int) (seq.unit s135)) [GOOD] (define-fun s137 () Bool (= s117 s136)) [GOOD] (define-fun s138 () Bool (or s116 s137)) [GOOD] (define-fun s139 () (Seq Int) (seq.++ s136 s132)) [GOOD] (define-fun s141 () (Seq Int) (seq.unit s140)) [GOOD] (define-fun s142 () Bool (= s108 s141)) [GOOD] (define-fun s143 () Bool (or s107 s142)) [GOOD] (define-fun s144 () (Seq Int) (seq.++ s141 s139)) [GOOD] (define-fun s146 () (Seq Int) (seq.unit s145)) [GOOD] (define-fun s147 () Bool (= s99 s146)) [GOOD] (define-fun s148 () Bool (or s98 s147)) [GOOD] (define-fun s149 () (Seq Int) (seq.++ s146 s144)) [GOOD] (define-fun s151 () (Seq Int) (seq.unit s150)) [GOOD] (define-fun s152 () Bool (= s90 s151)) [GOOD] (define-fun s153 () Bool (or s89 s152)) [GOOD] (define-fun s154 () (Seq Int) (seq.++ s151 s149)) [GOOD] (define-fun s156 () (Seq Int) (seq.unit s155)) [GOOD] (define-fun s157 () Bool (= s81 s156)) [GOOD] (define-fun s158 () Bool (or s80 s157)) [GOOD] (define-fun s159 () (Seq Int) (seq.++ s156 s154)) [GOOD] (define-fun s161 () (Seq Int) (seq.unit s160)) [GOOD] (define-fun s162 () Bool (= s72 s161)) [GOOD] (define-fun s163 () Bool (or s71 s162)) [GOOD] (define-fun s164 () (Seq Int) (seq.++ s161 s159)) [GOOD] (define-fun s166 () (Seq Int) (seq.unit s165)) [GOOD] (define-fun s167 () Bool (= s63 s166)) [GOOD] (define-fun s168 () Bool (or s62 s167)) [GOOD] (define-fun s169 () (Seq Int) (seq.++ s166 s164)) [GOOD] (define-fun s171 () (Seq Int) (seq.unit s170)) [GOOD] (define-fun s172 () Bool (= s54 s171)) [GOOD] (define-fun s173 () Bool (or s53 s172)) [GOOD] (define-fun s174 () (Seq Int) (seq.++ s171 s169)) [GOOD] (define-fun s176 () (Seq Int) (seq.unit s175)) [GOOD] (define-fun s177 () Bool (= s46 s176)) [GOOD] (define-fun s178 () Bool (or s45 s177)) [GOOD] (define-fun s179 () (Seq Int) (seq.++ s176 s174)) [GOOD] (define-fun s180 () (Seq Int) (ite s39 s174 s179)) [GOOD] (define-fun s181 () (Seq Int) (ite s35 s169 s180)) [GOOD] (define-fun s182 () (Seq Int) (ite s31 s164 s181)) [GOOD] (define-fun s183 () (Seq Int) (ite s27 s159 s182)) [GOOD] (define-fun s184 () (Seq Int) (ite s23 s154 s183)) [GOOD] (define-fun s185 () (Seq Int) (ite s19 s149 s184)) [GOOD] (define-fun s186 () (Seq Int) (ite s15 s144 s185)) [GOOD] (define-fun s187 () (Seq Int) (ite s11 s139 s186)) [GOOD] (define-fun s188 () (Seq Int) (ite s7 s132 s187)) [GOOD] (define-fun s189 () (Seq Int) (ite s2 s1 s188)) [GOOD] (define-fun s190 () Bool (distinct s130 s189)) [GOOD] (assert s48) [GOOD] (assert s56) [GOOD] (assert s65) [GOOD] (assert s74) [GOOD] (assert s83) [GOOD] (assert s92) [GOOD] (assert s101) [GOOD] (assert s110) [GOOD] (assert s119) [GOOD] (assert s128) [GOOD] (assert s134) [GOOD] (assert s138) [GOOD] (assert s143) [GOOD] (assert s148) [GOOD] (assert s153) [GOOD] (assert s158) [GOOD] (assert s163) [GOOD] (assert s168) [GOOD] (assert s173) [GOOD] (assert s178) [GOOD] (assert s190) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/safe1.gold0000644000000000000000000000227313405536617016464 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s1 () Int 12) [GOOD] (define-fun s3 () Int 2) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (= s0 s1)) [GOOD] (define-fun s4 () Bool (> s0 s3)) [GOOD] (define-fun s5 () Bool (not s4)) [GOOD] (assert s_1) [GOOD] (push 1) [GOOD] (assert s5) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 0)) [GOOD] (pop 1) *** Solver : Z3 *** Exit code: ExitSuccess FINAL: [safe1: Violated. Model: s0 = 0 :: Integer] DONE!sbv-7.13/SBVTestSuite/GoldFiles/safe2.gold0000644000000000000000000000222213405536617016457 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) ; has unbounded values, using catch-all. [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s1 () Int 12) [GOOD] (define-fun s2 () Int 2) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (> s0 s2)) [GOOD] (define-fun s4 () Bool (not s3)) [GOOD] (assert s_1) [GOOD] (push 1) [GOOD] (assert s4) [SEND] (check-sat) [RECV] sat [SEND] (get-value (s0)) [RECV] ((s0 0)) [GOOD] (pop 1) *** Solver : Z3 *** Exit code: ExitSuccess FINAL: [safe2: Violated. Model: s0 = 0 :: Integer] DONE!sbv-7.13/SBVTestSuite/GoldFiles/selChecked.gold0000644000000000000000000000426113405536617017516 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for selChecked. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: selChecked_driver selChecked.o: selChecked.c selChecked.h ${CC} ${CCFLAGS} -c $< -o $@ selChecked_driver.o: selChecked_driver.c ${CC} ${CCFLAGS} -c $< -o $@ selChecked_driver: selChecked.o selChecked_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f selChecked_driver == END: "Makefile" ================== == BEGIN: "selChecked.h" ================ /* Header file for selChecked. Automatically generated by SBV. Do not edit! */ #ifndef __selChecked__HEADER_INCLUDED__ #define __selChecked__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ SWord8 selChecked(const SWord8 x); #endif /* __selChecked__HEADER_INCLUDED__ */ == END: "selChecked.h" ================== == BEGIN: "selChecked_driver.c" ================ /* Example driver program for selChecked. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "selChecked.h" int main(void) { const SWord8 __result = selChecked(65); printf("selChecked(65) = %"PRIu8"\n", __result); return 0; } == END: "selChecked_driver.c" ================== == BEGIN: "selChecked.c" ================ /* File: "selChecked.c". Automatically generated by SBV. Do not edit! */ #include "selChecked.h" SWord8 selChecked(const SWord8 x) { const SWord8 s0 = x; const SWord8 s3 = s0 + 2; const SWord8 table0[] = { 1, s3 }; const SWord8 s5 = s0 >= 2 ? 3 : table0[s0]; return s5; } == END: "selChecked.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/selUnchecked.gold0000644000000000000000000000433513405536617020063 0ustar0000000000000000== BEGIN: "Makefile" ================ # Makefile for selUnChecked. Automatically generated by SBV. Do not edit! # include any user-defined .mk file in the current directory. -include *.mk CC?=gcc CCFLAGS?=-Wall -O3 -DNDEBUG -fomit-frame-pointer all: selUnChecked_driver selUnChecked.o: selUnChecked.c selUnChecked.h ${CC} ${CCFLAGS} -c $< -o $@ selUnChecked_driver.o: selUnChecked_driver.c ${CC} ${CCFLAGS} -c $< -o $@ selUnChecked_driver: selUnChecked.o selUnChecked_driver.o ${CC} ${CCFLAGS} $^ -o $@ clean: rm -f *.o veryclean: clean rm -f selUnChecked_driver == END: "Makefile" ================== == BEGIN: "selUnChecked.h" ================ /* Header file for selUnChecked. Automatically generated by SBV. Do not edit! */ #ifndef __selUnChecked__HEADER_INCLUDED__ #define __selUnChecked__HEADER_INCLUDED__ #include #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; /* Entry point prototype: */ SWord8 selUnChecked(const SWord8 x); #endif /* __selUnChecked__HEADER_INCLUDED__ */ == END: "selUnChecked.h" ================== == BEGIN: "selUnChecked_driver.c" ================ /* Example driver program for selUnChecked. */ /* Automatically generated by SBV. Edit as you see fit! */ #include #include "selUnChecked.h" int main(void) { const SWord8 __result = selUnChecked(65); printf("selUnChecked(65) = %"PRIu8"\n", __result); return 0; } == END: "selUnChecked_driver.c" ================== == BEGIN: "selUnChecked.c" ================ /* File: "selUnChecked.c". Automatically generated by SBV. Do not edit! */ #include "selUnChecked.h" SWord8 selUnChecked(const SWord8 x) { const SWord8 s0 = x; const SWord8 s3 = s0 + 2; const SWord8 table0[] = { 1, s3 }; const SWord8 s5 = table0[s0]; return s5; } == END: "selUnChecked.c" ==================sbv-7.13/SBVTestSuite/GoldFiles/seqConcat.gold0000644000000000000000000000144413405536617017404 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/seqConcatBad.gold0000644000000000000000000000144613405536617020015 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_2) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/seqExamples1.gold0000644000000000000000000000144413405536617020034 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/seqExamples2.gold0000644000000000000000000000227013405536617020033 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s1 () (Seq Int) (seq.unit 2)) [GOOD] (define-fun s3 () (Seq Int) (seq.unit 1)) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (Seq Int)) ; tracks user variable "a" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () (Seq Int) (seq.++ s0 s1)) [GOOD] (define-fun s4 () (Seq Int) (seq.++ s3 s0)) [GOOD] (define-fun s5 () Bool (= s2 s4)) [GOOD] (assert s5) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/seqExamples3.gold0000644000000000000000000000316713405536617020042 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s4 () (Seq Int) (seq.++ (seq.unit 1) (seq.unit 2) (seq.unit 3) (seq.unit 4))) [GOOD] (define-fun s7 () (Seq Int) (seq.++ (seq.unit 3) (seq.unit 4) (seq.unit 5) (seq.unit 6))) [GOOD] (define-fun s9 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (Seq Int)) ; tracks user variable "a" [GOOD] (declare-fun s1 () (Seq Int)) ; tracks user variable "b" [GOOD] (declare-fun s2 () (Seq Int)) ; tracks user variable "c" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () (Seq Int) (seq.++ s0 s1)) [GOOD] (define-fun s5 () Bool (= s3 s4)) [GOOD] (define-fun s6 () (Seq Int) (seq.++ s1 s2)) [GOOD] (define-fun s8 () Bool (= s6 s7)) [GOOD] (define-fun s10 () Bool (= s1 s9)) [GOOD] (define-fun s11 () Bool (not s10)) [GOOD] (assert s5) [GOOD] (assert s8) [GOOD] (assert s11) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/seqExamples4.gold0000644000000000000000000000270413405536617020037 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s8 () Int 2) [GOOD] (define-fun s2 () (Seq Int) (seq.++ (seq.unit 1) (seq.unit 2) (seq.unit 3))) [GOOD] (define-fun s4 () (Seq Int) (seq.++ (seq.unit 3) (seq.unit 4) (seq.unit 5))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (Seq Int)) ; tracks user variable "a" [GOOD] (declare-fun s1 () (Seq Int)) ; tracks user variable "b" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () (Seq Int) (seq.++ s2 s0)) [GOOD] (define-fun s5 () (Seq Int) (seq.++ s1 s4)) [GOOD] (define-fun s6 () Bool (= s3 s5)) [GOOD] (define-fun s7 () Int (seq.len s0)) [GOOD] (define-fun s9 () Bool (<= s7 s8)) [GOOD] (assert s6) [GOOD] (assert s9) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/seqExamples5.gold0000644000000000000000000000350113405536617020034 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s3 () (Seq Int) (seq.++ (seq.unit 1) (seq.unit 2))) [GOOD] (define-fun s6 () (Seq Int) (seq.++ (seq.unit 2) (seq.unit 1))) [GOOD] (define-fun s12 () (Seq Int) (seq.unit 1)) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (Seq Int)) ; tracks user variable "a" [GOOD] (declare-fun s1 () (Seq Int)) ; tracks user variable "b" [GOOD] (declare-fun s2 () (Seq Int)) ; tracks user variable "c" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s4 () (Seq Int) (seq.++ s3 s1)) [GOOD] (define-fun s5 () (Seq Int) (seq.++ s0 s4)) [GOOD] (define-fun s7 () (Seq Int) (seq.++ s6 s2)) [GOOD] (define-fun s8 () (Seq Int) (seq.++ s1 s7)) [GOOD] (define-fun s9 () Bool (= s5 s8)) [GOOD] (define-fun s10 () (Seq Int) (seq.++ s0 s1)) [GOOD] (define-fun s11 () Bool (= s2 s10)) [GOOD] (define-fun s13 () (Seq Int) (seq.++ s0 s12)) [GOOD] (define-fun s14 () (Seq Int) (seq.++ s12 s0)) [GOOD] (define-fun s15 () Bool (= s13 s14)) [GOOD] (define-fun s16 () Bool (not s15)) [GOOD] (assert s9) [GOOD] (assert s11) [GOOD] (assert s16) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/seqExamples6.gold0000644000000000000000000000246113405536617020041 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (Seq Int)) ; tracks user variable "a" [GOOD] (declare-fun s1 () (Seq Int)) ; tracks user variable "b" [GOOD] (declare-fun s2 () (Seq Int)) ; tracks user variable "c" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (seq.contains s0 s1)) [GOOD] (define-fun s4 () Bool (seq.contains s1 s2)) [GOOD] (define-fun s5 () Bool (seq.contains s0 s2)) [GOOD] (define-fun s6 () Bool (not s5)) [GOOD] (assert s3) [GOOD] (assert s4) [GOOD] (assert s6) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/seqExamples7.gold0000644000000000000000000000263613405536617020046 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (Seq Int)) ; tracks user variable "a" [GOOD] (declare-fun s1 () (Seq Int)) ; tracks user variable "b" [GOOD] (declare-fun s2 () (Seq Int)) ; tracks user variable "c" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (seq.contains s0 s1)) [GOOD] (define-fun s4 () Bool (seq.contains s0 s2)) [GOOD] (define-fun s5 () Bool (seq.contains s1 s2)) [GOOD] (define-fun s6 () Bool (not s5)) [GOOD] (define-fun s7 () Bool (seq.contains s2 s1)) [GOOD] (define-fun s8 () Bool (not s7)) [GOOD] (assert s3) [GOOD] (assert s4) [GOOD] (assert s6) [GOOD] (assert s8) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/seqExamples8.gold0000644000000000000000000000310413405536617020036 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () (Seq Int)) ; tracks user variable "a" [GOOD] (declare-fun s1 () (Seq Int)) ; tracks user variable "b" [GOOD] (declare-fun s2 () (Seq Int)) ; tracks user variable "c" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (seq.prefixof s1 s0)) [GOOD] (define-fun s4 () Bool (seq.suffixof s2 s0)) [GOOD] (define-fun s5 () Int (seq.len s0)) [GOOD] (define-fun s6 () Int (seq.len s1)) [GOOD] (define-fun s7 () Int (seq.len s2)) [GOOD] (define-fun s8 () Int (+ s6 s7)) [GOOD] (define-fun s9 () Bool (= s5 s8)) [GOOD] (define-fun s10 () (Seq Int) (seq.++ s1 s2)) [GOOD] (define-fun s11 () Bool (= s0 s10)) [GOOD] (define-fun s12 () Bool (not s11)) [GOOD] (assert s3) [GOOD] (assert s4) [GOOD] (assert s9) [GOOD] (assert s12) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/seqIndexOf.gold0000644000000000000000000000144413405536617017531 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/seqIndexOfBad.gold0000644000000000000000000000144613405536617020142 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_2) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/sort.gold0000644000000000000000000002504013405536617016451 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-option :pp.max_depth 4294967295) [GOOD] (set-option :pp.min_alias_size 4294967295) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s14 () Int 1) [GOOD] (define-fun s26 () Int 0) [GOOD] (define-fun s12 () (Seq Int) (as seq.empty (Seq Int))) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "a" [GOOD] (declare-fun s1 () Int) ; tracks user variable "b" [GOOD] (declare-fun s2 () Int) ; tracks user variable "c" [GOOD] (declare-fun s23 () Int) ; tracks user variable "__internal_sbv_s23" [GOOD] (declare-fun s34 () Int) ; tracks user variable "__internal_sbv_s34" [GOOD] (declare-fun s41 () Int) ; tracks user variable "__internal_sbv_s41" [GOOD] (declare-fun s55 () Int) ; tracks user variable "__internal_sbv_s55" [GOOD] (declare-fun s69 () Int) ; tracks user variable "__internal_sbv_s69" [GOOD] (declare-fun s93 () Int) ; tracks user variable "__internal_sbv_s93" [GOOD] (declare-fun s100 () Int) ; tracks user variable "__internal_sbv_s100" [GOOD] (declare-fun s114 () Int) ; tracks user variable "__internal_sbv_s114" [GOOD] (declare-fun s128 () Int) ; tracks user variable "__internal_sbv_s128" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (<= s0 s1)) [GOOD] (define-fun s4 () Bool (<= s1 s2)) [GOOD] (define-fun s5 () Bool (and s3 s4)) [GOOD] (define-fun s6 () Bool (not s5)) [GOOD] (define-fun s7 () (Seq Int) (seq.unit s0)) [GOOD] (define-fun s8 () (Seq Int) (seq.unit s1)) [GOOD] (define-fun s9 () (Seq Int) (seq.unit s2)) [GOOD] (define-fun s10 () (Seq Int) (seq.++ s8 s9)) [GOOD] (define-fun s11 () (Seq Int) (seq.++ s7 s10)) [GOOD] (define-fun s13 () Bool (= s11 s12)) [GOOD] (define-fun s15 () Int (seq.len s11)) [GOOD] (define-fun s16 () Int (- s15 s14)) [GOOD] (define-fun s17 () (Seq Int) (seq.extract s11 s14 s16)) [GOOD] (define-fun s18 () Bool (= s12 s17)) [GOOD] (define-fun s19 () Int (seq.len s17)) [GOOD] (define-fun s20 () Int (- s19 s14)) [GOOD] (define-fun s21 () (Seq Int) (seq.extract s17 s14 s20)) [GOOD] (define-fun s22 () Bool (= s12 s21)) [GOOD] (define-fun s24 () (Seq Int) (seq.unit s23)) [GOOD] (define-fun s25 () Int (seq.len s21)) [GOOD] (define-fun s27 () Bool (> s25 s26)) [GOOD] (define-fun s28 () Bool (not s27)) [GOOD] (define-fun s29 () (Seq Int) (seq.extract s21 s26 s14)) [GOOD] (define-fun s30 () Bool (= s24 s29)) [GOOD] (define-fun s31 () Bool (or s28 s30)) [GOOD] (define-fun s32 () (Seq Int) (ite s22 s12 s24)) [GOOD] (define-fun s33 () Bool (= s12 s32)) [GOOD] (define-fun s35 () (Seq Int) (seq.unit s34)) [GOOD] (define-fun s36 () Bool (> s19 s26)) [GOOD] (define-fun s37 () Bool (not s36)) [GOOD] (define-fun s38 () (Seq Int) (seq.extract s17 s26 s14)) [GOOD] (define-fun s39 () Bool (= s35 s38)) [GOOD] (define-fun s40 () Bool (or s37 s39)) [GOOD] (define-fun s42 () (Seq Int) (seq.unit s41)) [GOOD] (define-fun s43 () Int (seq.len s32)) [GOOD] (define-fun s44 () Bool (> s43 s26)) [GOOD] (define-fun s45 () Bool (not s44)) [GOOD] (define-fun s46 () (Seq Int) (seq.extract s32 s26 s14)) [GOOD] (define-fun s47 () Bool (= s42 s46)) [GOOD] (define-fun s48 () Bool (or s45 s47)) [GOOD] (define-fun s49 () Bool (< s34 s41)) [GOOD] (define-fun s50 () Int (- s43 s14)) [GOOD] (define-fun s51 () (Seq Int) (seq.extract s32 s14 s50)) [GOOD] (define-fun s52 () (Seq Int) (seq.++ s42 s51)) [GOOD] (define-fun s53 () (Seq Int) (seq.++ s35 s52)) [GOOD] (define-fun s54 () Bool (= s12 s51)) [GOOD] (define-fun s56 () (Seq Int) (seq.unit s55)) [GOOD] (define-fun s57 () Int (seq.len s51)) [GOOD] (define-fun s58 () Bool (> s57 s26)) [GOOD] (define-fun s59 () Bool (not s58)) [GOOD] (define-fun s60 () (Seq Int) (seq.extract s51 s26 s14)) [GOOD] (define-fun s61 () Bool (= s56 s60)) [GOOD] (define-fun s62 () Bool (or s59 s61)) [GOOD] (define-fun s63 () Bool (< s34 s55)) [GOOD] (define-fun s64 () Int (- s57 s14)) [GOOD] (define-fun s65 () (Seq Int) (seq.extract s51 s14 s64)) [GOOD] (define-fun s66 () (Seq Int) (seq.++ s56 s65)) [GOOD] (define-fun s67 () (Seq Int) (seq.++ s35 s66)) [GOOD] (define-fun s68 () Bool (= s12 s65)) [GOOD] (define-fun s70 () (Seq Int) (seq.unit s69)) [GOOD] (define-fun s71 () Int (seq.len s65)) [GOOD] (define-fun s72 () Bool (> s71 s26)) [GOOD] (define-fun s73 () Bool (not s72)) [GOOD] (define-fun s74 () (Seq Int) (seq.extract s65 s26 s14)) [GOOD] (define-fun s75 () Bool (= s70 s74)) [GOOD] (define-fun s76 () Bool (or s73 s75)) [GOOD] (define-fun s77 () Bool (< s34 s69)) [GOOD] (define-fun s78 () Int (- s71 s14)) [GOOD] (define-fun s79 () (Seq Int) (seq.extract s65 s14 s78)) [GOOD] (define-fun s80 () (Seq Int) (seq.++ s70 s79)) [GOOD] (define-fun s81 () (Seq Int) (seq.++ s35 s80)) [GOOD] (define-fun s82 () (Seq Int) (seq.++ s70 s35)) [GOOD] (define-fun s83 () (Seq Int) (ite s77 s81 s82)) [GOOD] (define-fun s84 () (Seq Int) (ite s68 s35 s83)) [GOOD] (define-fun s85 () (Seq Int) (seq.++ s56 s84)) [GOOD] (define-fun s86 () (Seq Int) (ite s63 s67 s85)) [GOOD] (define-fun s87 () (Seq Int) (ite s54 s35 s86)) [GOOD] (define-fun s88 () (Seq Int) (seq.++ s42 s87)) [GOOD] (define-fun s89 () (Seq Int) (ite s49 s53 s88)) [GOOD] (define-fun s90 () (Seq Int) (ite s33 s35 s89)) [GOOD] (define-fun s91 () (Seq Int) (ite s18 s12 s90)) [GOOD] (define-fun s92 () Bool (= s12 s91)) [GOOD] (define-fun s94 () (Seq Int) (seq.unit s93)) [GOOD] (define-fun s95 () Bool (> s15 s26)) [GOOD] (define-fun s96 () Bool (not s95)) [GOOD] (define-fun s97 () (Seq Int) (seq.extract s11 s26 s14)) [GOOD] (define-fun s98 () Bool (= s94 s97)) [GOOD] (define-fun s99 () Bool (or s96 s98)) [GOOD] (define-fun s101 () (Seq Int) (seq.unit s100)) [GOOD] (define-fun s102 () Int (seq.len s91)) [GOOD] (define-fun s103 () Bool (> s102 s26)) [GOOD] (define-fun s104 () Bool (not s103)) [GOOD] (define-fun s105 () (Seq Int) (seq.extract s91 s26 s14)) [GOOD] (define-fun s106 () Bool (= s101 s105)) [GOOD] (define-fun s107 () Bool (or s104 s106)) [GOOD] (define-fun s108 () Bool (< s93 s100)) [GOOD] (define-fun s109 () Int (- s102 s14)) [GOOD] (define-fun s110 () (Seq Int) (seq.extract s91 s14 s109)) [GOOD] (define-fun s111 () (Seq Int) (seq.++ s101 s110)) [GOOD] (define-fun s112 () (Seq Int) (seq.++ s94 s111)) [GOOD] (define-fun s113 () Bool (= s12 s110)) [GOOD] (define-fun s115 () (Seq Int) (seq.unit s114)) [GOOD] (define-fun s116 () Int (seq.len s110)) [GOOD] (define-fun s117 () Bool (> s116 s26)) [GOOD] (define-fun s118 () Bool (not s117)) [GOOD] (define-fun s119 () (Seq Int) (seq.extract s110 s26 s14)) [GOOD] (define-fun s120 () Bool (= s115 s119)) [GOOD] (define-fun s121 () Bool (or s118 s120)) [GOOD] (define-fun s122 () Bool (< s93 s114)) [GOOD] (define-fun s123 () Int (- s116 s14)) [GOOD] (define-fun s124 () (Seq Int) (seq.extract s110 s14 s123)) [GOOD] (define-fun s125 () (Seq Int) (seq.++ s115 s124)) [GOOD] (define-fun s126 () (Seq Int) (seq.++ s94 s125)) [GOOD] (define-fun s127 () Bool (= s12 s124)) [GOOD] (define-fun s129 () (Seq Int) (seq.unit s128)) [GOOD] (define-fun s130 () Int (seq.len s124)) [GOOD] (define-fun s131 () Bool (> s130 s26)) [GOOD] (define-fun s132 () Bool (not s131)) [GOOD] (define-fun s133 () (Seq Int) (seq.extract s124 s26 s14)) [GOOD] (define-fun s134 () Bool (= s129 s133)) [GOOD] (define-fun s135 () Bool (or s132 s134)) [GOOD] (define-fun s136 () Bool (< s93 s128)) [GOOD] (define-fun s137 () Int (- s130 s14)) [GOOD] (define-fun s138 () (Seq Int) (seq.extract s124 s14 s137)) [GOOD] (define-fun s139 () (Seq Int) (seq.++ s129 s138)) [GOOD] (define-fun s140 () (Seq Int) (seq.++ s94 s139)) [GOOD] (define-fun s141 () (Seq Int) (seq.++ s129 s94)) [GOOD] (define-fun s142 () (Seq Int) (ite s136 s140 s141)) [GOOD] (define-fun s143 () (Seq Int) (ite s127 s94 s142)) [GOOD] (define-fun s144 () (Seq Int) (seq.++ s115 s143)) [GOOD] (define-fun s145 () (Seq Int) (ite s122 s126 s144)) [GOOD] (define-fun s146 () (Seq Int) (ite s113 s94 s145)) [GOOD] (define-fun s147 () (Seq Int) (seq.++ s101 s146)) [GOOD] (define-fun s148 () (Seq Int) (ite s108 s112 s147)) [GOOD] (define-fun s149 () (Seq Int) (ite s92 s94 s148)) [GOOD] (define-fun s150 () (Seq Int) (ite s13 s12 s149)) [GOOD] (define-fun s151 () Bool (= s11 s150)) [GOOD] (define-fun s152 () Bool (or s6 s151)) [GOOD] (define-fun s153 () Bool (<= s0 s2)) [GOOD] (define-fun s154 () Bool (<= s2 s1)) [GOOD] (define-fun s155 () Bool (and s153 s154)) [GOOD] (define-fun s156 () Bool (not s155)) [GOOD] (define-fun s157 () (Seq Int) (seq.++ s9 s8)) [GOOD] (define-fun s158 () (Seq Int) (seq.++ s7 s157)) [GOOD] (define-fun s159 () Bool (= s150 s158)) [GOOD] (define-fun s160 () Bool (or s156 s159)) [GOOD] (define-fun s161 () Bool (<= s1 s0)) [GOOD] (define-fun s162 () Bool (and s153 s161)) [GOOD] (define-fun s163 () Bool (not s162)) [GOOD] (define-fun s164 () (Seq Int) (seq.++ s7 s9)) [GOOD] (define-fun s165 () (Seq Int) (seq.++ s8 s164)) [GOOD] (define-fun s166 () Bool (= s150 s165)) [GOOD] (define-fun s167 () Bool (or s163 s166)) [GOOD] (define-fun s168 () Bool (<= s2 s0)) [GOOD] (define-fun s169 () Bool (and s4 s168)) [GOOD] (define-fun s170 () Bool (not s169)) [GOOD] (define-fun s171 () (Seq Int) (seq.++ s9 s7)) [GOOD] (define-fun s172 () (Seq Int) (seq.++ s8 s171)) [GOOD] (define-fun s173 () Bool (= s150 s172)) [GOOD] (define-fun s174 () Bool (or s170 s173)) [GOOD] (define-fun s175 () Bool (and s3 s168)) [GOOD] (define-fun s176 () Bool (not s175)) [GOOD] (define-fun s177 () (Seq Int) (seq.++ s7 s8)) [GOOD] (define-fun s178 () (Seq Int) (seq.++ s9 s177)) [GOOD] (define-fun s179 () Bool (= s150 s178)) [GOOD] (define-fun s180 () Bool (or s176 s179)) [GOOD] (define-fun s181 () Bool (and s154 s161)) [GOOD] (define-fun s182 () Bool (not s181)) [GOOD] (define-fun s183 () (Seq Int) (seq.++ s8 s7)) [GOOD] (define-fun s184 () (Seq Int) (seq.++ s9 s183)) [GOOD] (define-fun s185 () Bool (= s150 s184)) [GOOD] (define-fun s186 () Bool (or s182 s185)) [GOOD] (assert s31) [GOOD] (assert s40) [GOOD] (assert s48) [GOOD] (assert s62) [GOOD] (assert s76) [GOOD] (assert s99) [GOOD] (assert s107) [GOOD] (assert s121) [GOOD] (assert s135) [GOOD] (assert s152) [GOOD] (assert s160) [GOOD] (assert s167) [GOOD] (assert s174) [GOOD] (assert s180) [GOOD] (assert s186) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/squashReals1.gold0000644000000000000000000000011413405536617020031 0ustar0000000000000000Satisfiable. Model: s0 = root(2, x^2 = 59) = 7.6811457478686081... :: Realsbv-7.13/SBVTestSuite/GoldFiles/squashReals2.gold0000644000000000000000000000004613405536617020036 0ustar0000000000000000Satisfiable. Model: s0 = 4.0 :: Realsbv-7.13/SBVTestSuite/GoldFiles/squashReals3.gold0000644000000000000000000000013713405536617020040 0ustar0000000000000000Satisfiable. Model: s0 = root(2, x^2 = 59) = 7.68114574786860817576968702173137247... :: Realsbv-7.13/SBVTestSuite/GoldFiles/squashReals4.gold0000644000000000000000000000004613405536617020040 0ustar0000000000000000Satisfiable. Model: s0 = 4.0 :: Realsbv-7.13/SBVTestSuite/GoldFiles/strConcat.gold0000644000000000000000000000144413405536617017424 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strConcatBad.gold0000644000000000000000000000144613405536617020035 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_2) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strExamples1.gold0000644000000000000000000000144413405536617020054 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strExamples10.gold0000644000000000000000000000207013405536617020130 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s3 () Int 6) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () String) ; tracks user variable "a" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s1 () Bool (str.in.re s0 ((_ re.loop 1 3) (str.to.re "ab")))) [GOOD] (define-fun s2 () Int (str.len s0)) [GOOD] (define-fun s4 () Bool (> s2 s3)) [GOOD] (assert s1) [GOOD] (assert s4) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strExamples11.gold0000644000000000000000000000214213405536617020131 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s1 () Int 11) [GOOD] (define-fun s4 () String "11") [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "i" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (= s0 s1)) [GOOD] (define-fun s3 () String (int.to.str s0)) [GOOD] (define-fun s5 () Bool (= s3 s4)) [GOOD] (define-fun s6 () Bool (not s5)) [GOOD] (assert s2) [GOOD] (assert s6) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strExamples12.gold0000644000000000000000000000214313405536617020133 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s1 () Int (- 2)) [GOOD] (define-fun s4 () String "") [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () Int) ; tracks user variable "i" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (= s0 s1)) [GOOD] (define-fun s3 () String (int.to.str s0)) [GOOD] (define-fun s5 () Bool (= s3 s4)) [GOOD] (define-fun s6 () Bool (not s5)) [GOOD] (assert s2) [GOOD] (assert s6) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strExamples13.gold0000644000000000000000000000214213405536617020133 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s4 () Int 13) [GOOD] (define-fun s1 () String "13") [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () String) ; tracks user variable "s" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () Bool (= s0 s1)) [GOOD] (define-fun s3 () Int (str.to.int s0)) [GOOD] (define-fun s5 () Bool (= s3 s4)) [GOOD] (define-fun s6 () Bool (not s5)) [GOOD] (assert s2) [GOOD] (assert s6) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strExamples2.gold0000644000000000000000000000206313405536617020053 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s1 () String "b") [GOOD] (define-fun s3 () String "a") [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () String) ; tracks user variable "a" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s2 () String (str.++ s0 s1)) [GOOD] (define-fun s4 () String (str.++ s3 s0)) [GOOD] (define-fun s5 () Bool (= s2 s4)) [GOOD] (assert s5) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strExamples3.gold0000644000000000000000000000257113405536617020060 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s4 () String "abcd") [GOOD] (define-fun s7 () String "cdef") [GOOD] (define-fun s9 () String "") [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () String) ; tracks user variable "a" [GOOD] (declare-fun s1 () String) ; tracks user variable "b" [GOOD] (declare-fun s2 () String) ; tracks user variable "c" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () String (str.++ s0 s1)) [GOOD] (define-fun s5 () Bool (= s3 s4)) [GOOD] (define-fun s6 () String (str.++ s1 s2)) [GOOD] (define-fun s8 () Bool (= s6 s7)) [GOOD] (define-fun s10 () Bool (= s1 s9)) [GOOD] (define-fun s11 () Bool (not s10)) [GOOD] (assert s5) [GOOD] (assert s8) [GOOD] (assert s11) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strExamples4.gold0000644000000000000000000000237213405536617020060 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s8 () Int 2) [GOOD] (define-fun s2 () String "abc") [GOOD] (define-fun s4 () String "cef") [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () String) ; tracks user variable "a" [GOOD] (declare-fun s1 () String) ; tracks user variable "b" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () String (str.++ s2 s0)) [GOOD] (define-fun s5 () String (str.++ s1 s4)) [GOOD] (define-fun s6 () Bool (= s3 s5)) [GOOD] (define-fun s7 () Int (str.len s0)) [GOOD] (define-fun s9 () Bool (<= s7 s8)) [GOOD] (assert s6) [GOOD] (assert s9) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strExamples5.gold0000644000000000000000000000316113405536617020056 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s3 () String "ab") [GOOD] (define-fun s6 () String "ba") [GOOD] (define-fun s12 () String "a") [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () String) ; tracks user variable "a" [GOOD] (declare-fun s1 () String) ; tracks user variable "b" [GOOD] (declare-fun s2 () String) ; tracks user variable "c" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s4 () String (str.++ s3 s1)) [GOOD] (define-fun s5 () String (str.++ s0 s4)) [GOOD] (define-fun s7 () String (str.++ s6 s2)) [GOOD] (define-fun s8 () String (str.++ s1 s7)) [GOOD] (define-fun s9 () Bool (= s5 s8)) [GOOD] (define-fun s10 () String (str.++ s0 s1)) [GOOD] (define-fun s11 () Bool (= s2 s10)) [GOOD] (define-fun s13 () String (str.++ s0 s12)) [GOOD] (define-fun s14 () String (str.++ s12 s0)) [GOOD] (define-fun s15 () Bool (= s13 s14)) [GOOD] (define-fun s16 () Bool (not s15)) [GOOD] (assert s9) [GOOD] (assert s11) [GOOD] (assert s16) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strExamples6.gold0000644000000000000000000000230413405536617020055 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () String) ; tracks user variable "a" [GOOD] (declare-fun s1 () String) ; tracks user variable "b" [GOOD] (declare-fun s2 () String) ; tracks user variable "c" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (str.contains s0 s1)) [GOOD] (define-fun s4 () Bool (str.contains s1 s2)) [GOOD] (define-fun s5 () Bool (str.contains s0 s2)) [GOOD] (define-fun s6 () Bool (not s5)) [GOOD] (assert s3) [GOOD] (assert s4) [GOOD] (assert s6) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strExamples7.gold0000644000000000000000000000246113405536617020062 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () String) ; tracks user variable "a" [GOOD] (declare-fun s1 () String) ; tracks user variable "b" [GOOD] (declare-fun s2 () String) ; tracks user variable "c" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (str.contains s0 s1)) [GOOD] (define-fun s4 () Bool (str.contains s0 s2)) [GOOD] (define-fun s5 () Bool (str.contains s1 s2)) [GOOD] (define-fun s6 () Bool (not s5)) [GOOD] (define-fun s7 () Bool (str.contains s2 s1)) [GOOD] (define-fun s8 () Bool (not s7)) [GOOD] (assert s3) [GOOD] (assert s4) [GOOD] (assert s6) [GOOD] (assert s8) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strExamples8.gold0000644000000000000000000000272413405536617020065 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () String) ; tracks user variable "a" [GOOD] (declare-fun s1 () String) ; tracks user variable "b" [GOOD] (declare-fun s2 () String) ; tracks user variable "c" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s3 () Bool (str.prefixof s1 s0)) [GOOD] (define-fun s4 () Bool (str.suffixof s2 s0)) [GOOD] (define-fun s5 () Int (str.len s0)) [GOOD] (define-fun s6 () Int (str.len s1)) [GOOD] (define-fun s7 () Int (str.len s2)) [GOOD] (define-fun s8 () Int (+ s6 s7)) [GOOD] (define-fun s9 () Bool (= s5 s8)) [GOOD] (define-fun s10 () String (str.++ s1 s2)) [GOOD] (define-fun s11 () Bool (= s0 s10)) [GOOD] (define-fun s12 () Bool (not s11)) [GOOD] (assert s3) [GOOD] (assert s4) [GOOD] (assert s9) [GOOD] (assert s12) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strExamples9.gold0000644000000000000000000000206613405536617020065 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic ALL) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] (define-fun s3 () Int 6) [GOOD] ; --- skolem constants --- [GOOD] (declare-fun s0 () String) ; tracks user variable "a" [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (define-fun s1 () Bool (str.in.re s0 ((_ re.loop 1 3) (str.to.re "ab")))) [GOOD] (define-fun s2 () Int (str.len s0)) [GOOD] (define-fun s4 () Bool (= s2 s3)) [GOOD] (assert s1) [GOOD] (assert s4) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strIndexOf.gold0000644000000000000000000000144413405536617017551 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_1) [SEND] (check-sat) [RECV] sat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/strIndexOfBad.gold0000644000000000000000000000144613405536617020162 0ustar0000000000000000** Calling: z3 -nw -in -smt2 [GOOD] ; Automatically generated by SBV. Do not edit. [GOOD] (set-option :print-success true) [GOOD] (set-option :global-declarations true) [GOOD] (set-option :smtlib2_compliant true) [GOOD] (set-option :diagnostic-output-channel "stdout") [GOOD] (set-option :produce-models true) [GOOD] (set-logic QF_BV) [GOOD] ; --- uninterpreted sorts --- [GOOD] ; --- literal constants --- [GOOD] (define-fun s_2 () Bool false) [GOOD] (define-fun s_1 () Bool true) [GOOD] ; --- skolem constants --- [GOOD] ; --- constant tables --- [GOOD] ; --- skolemized tables --- [GOOD] ; --- arrays --- [GOOD] ; --- uninterpreted constants --- [GOOD] ; --- user given axioms --- [GOOD] ; --- formula --- [GOOD] (assert s_2) [SEND] (check-sat) [RECV] unsat *** Solver : Z3 *** Exit code: ExitSuccess sbv-7.13/SBVTestSuite/GoldFiles/temperature.gold0000644000000000000000000000005313405536617020014 0ustar0000000000000000[("s0",16 :: Integer),("s0",28 :: Integer)]sbv-7.13/SBVTestSuite/GoldFiles/tgen_c.gold0000644000000000000000000000375413405536617016731 0ustar0000000000000000/* Automatically generated by SBV. Do not edit! */ #include #include #include #include #include #include /* The boolean type */ typedef bool SBool; /* The float type */ typedef float SFloat; /* The double type */ typedef double SDouble; /* Unsigned bit-vectors */ typedef uint8_t SWord8; typedef uint16_t SWord16; typedef uint32_t SWord32; typedef uint64_t SWord64; /* Signed bit-vectors */ typedef int8_t SInt8; typedef int16_t SInt16; typedef int32_t SInt32; typedef int64_t SInt64; typedef struct { struct { SWord32 i0; SWord32 i1; } input; struct { SWord32 o0; SWord32 o1; SWord32 o2; } output; } CTestTestVector; CTestTestVector CTest[] = { {{0xfcbe0fdbUL, 0xd321df04UL}, {0xcfdfeedfUL, 0x299c30d7UL, 0x0f03046cUL}} , {{0x7e037b43UL, 0xf66d083bUL}, {0x7470837eUL, 0x87967308UL, 0x042e8071UL}} , {{0xce482a70UL, 0x66b7c768UL}, {0x34fff1d8UL, 0x67906308UL, 0xdc5e4d80UL}} , {{0xec1eda04UL, 0x465a32a9UL}, {0x32790cadUL, 0xa5c4a75bUL, 0xa45ab4a4UL}} , {{0x61f89467UL, 0x00d8fb06UL}, {0x62d18f6dUL, 0x611f9961UL, 0x3c3c776aUL}} , {{0x30e2d88cUL, 0x10ea31cdUL}, {0x41cd0a59UL, 0x1ff8a6bfUL, 0x4112341cUL}} , {{0x4bf1b3fdUL, 0x2124dc8bUL}, {0x6d169088UL, 0x2accd772UL, 0xdf7e265fUL}} , {{0x96885656UL, 0x60a8c5caUL}, {0xf7311c20UL, 0x35df908cUL, 0x9a744ddcUL}} , {{0xc2bac856UL, 0xe5a9367cUL}, {0xa863fed2UL, 0xdd1191daUL, 0xe7812da8UL}} , {{0x8b10b4f2UL, 0xf010d50fUL}, {0x7b218a01UL, 0x9affdfe3UL, 0x3ba7f42eUL}} }; int CTestLength = 10; /* Stub driver showing the test values, replace with code that uses the test vectors. */ int main(void) { int i; for(i = 0; i < CTestLength; ++i) { printf("%*d. 0x%08"PRIx32"UL 0x%08"PRIx32"UL -> 0x%08"PRIx32"UL 0x%08"PRIx32"UL 0x%08"PRIx32"UL\n", 1, i , CTest[i].input.i0 , CTest[i].input.i1 , CTest[i].output.o0 , CTest[i].output.o1 , CTest[i].output.o2); } return 0; }sbv-7.13/SBVTestSuite/GoldFiles/tgen_forte.gold0000644000000000000000000000452613405536617017624 0ustar0000000000000000// Automatically generated by SBV. Do not edit! let ForteTest = let c s = val [_, r] = str_split s "'" in map (\s. s == "1") (explode (string_tl r)) in [ ((c "32'b11111100101111100000111111011011", c "32'b11010011001000011101111100000100"), (c "32'b11001111110111111110111011011111", c "32'b00101001100111000011000011010111", c "32'b00001111000000110000010001101100")) , ((c "32'b01111110000000110111101101000011", c "32'b11110110011011010000100000111011"), (c "32'b01110100011100001000001101111110", c "32'b10000111100101100111001100001000", c "32'b00000100001011101000000001110001")) , ((c "32'b11001110010010000010101001110000", c "32'b01100110101101111100011101101000"), (c "32'b00110100111111111111000111011000", c "32'b01100111100100000110001100001000", c "32'b11011100010111100100110110000000")) , ((c "32'b11101100000111101101101000000100", c "32'b01000110010110100011001010101001"), (c "32'b00110010011110010000110010101101", c "32'b10100101110001001010011101011011", c "32'b10100100010110101011010010100100")) , ((c "32'b01100001111110001001010001100111", c "32'b00000000110110001111101100000110"), (c "32'b01100010110100011000111101101101", c "32'b01100001000111111001100101100001", c "32'b00111100001111000111011101101010")) , ((c "32'b00110000111000101101100010001100", c "32'b00010000111010100011000111001101"), (c "32'b01000001110011010000101001011001", c "32'b00011111111110001010011010111111", c "32'b01000001000100100011010000011100")) , ((c "32'b01001011111100011011001111111101", c "32'b00100001001001001101110010001011"), (c "32'b01101101000101101001000010001000", c "32'b00101010110011001101011101110010", c "32'b11011111011111100010011001011111")) , ((c "32'b10010110100010000101011001010110", c "32'b01100000101010001100010111001010"), (c "32'b11110111001100010001110000100000", c "32'b00110101110111111001000010001100", c "32'b10011010011101000100110111011100")) , ((c "32'b11000010101110101100100001010110", c "32'b11100101101010010011011001111100"), (c "32'b10101000011000111111111011010010", c "32'b11011101000100011001000111011010", c "32'b11100111100000010010110110101000")) , ((c "32'b10001011000100001011010011110010", c "32'b11110000000100001101010100001111"), (c "32'b01111011001000011000101000000001", c "32'b10011010111111111101111111100011", c "32'b00111011101001111111010000101110")) ];sbv-7.13/SBVTestSuite/GoldFiles/tgen_haskell.gold0000644000000000000000000000163713405536617020130 0ustar0000000000000000-- Automatically generated by SBV. Do not edit! module HaskTest(haskTest) where import Data.Word haskTest :: [([Word32], [Word32])] haskTest = [ ([0xfcbe0fdb, 0xd321df04], [0xcfdfeedf, 0x299c30d7, 0x0f03046c]) , ([0x7e037b43, 0xf66d083b], [0x7470837e, 0x87967308, 0x042e8071]) , ([0xce482a70, 0x66b7c768], [0x34fff1d8, 0x67906308, 0xdc5e4d80]) , ([0xec1eda04, 0x465a32a9], [0x32790cad, 0xa5c4a75b, 0xa45ab4a4]) , ([0x61f89467, 0x00d8fb06], [0x62d18f6d, 0x611f9961, 0x3c3c776a]) , ([0x30e2d88c, 0x10ea31cd], [0x41cd0a59, 0x1ff8a6bf, 0x4112341c]) , ([0x4bf1b3fd, 0x2124dc8b], [0x6d169088, 0x2accd772, 0xdf7e265f]) , ([0x96885656, 0x60a8c5ca], [0xf7311c20, 0x35df908c, 0x9a744ddc]) , ([0xc2bac856, 0xe5a9367c], [0xa863fed2, 0xdd1191da, 0xe7812da8]) , ([0x8b10b4f2, 0xf010d50f], [0x7b218a01, 0x9affdfe3, 0x3ba7f42e]) ]sbv-7.13/SBVTestSuite/GoldFiles/timeout1.gold0000644000000000000000000000003213405536617017223 0ustar0000000000000000Unknown. Reason: timeoutsbv-7.13/SBVTestSuite/GoldFiles/U2Bridge.gold0000644000000000000000000000143213405536617017064 0ustar0000000000000000Solution #1: s0 = False :: Bool s1 = Edge :: U2Member s2 = Bono :: U2Member s3 = True :: Bool s4 = Bono :: U2Member s5 = Bono :: U2Member s6 = False :: Bool s7 = Larry :: U2Member s8 = Adam :: U2Member s9 = True :: Bool s10 = Edge :: U2Member s11 = Bono :: U2Member s12 = False :: Bool s13 = Edge :: U2Member s14 = Bono :: U2Member Solution #2: s0 = False :: Bool s1 = Edge :: U2Member s2 = Bono :: U2Member s3 = True :: Bool s4 = Edge :: U2Member s5 = Bono :: U2Member s6 = False :: Bool s7 = Larry :: U2Member s8 = Adam :: U2Member s9 = True :: Bool s10 = Bono :: U2Member s11 = Bono :: U2Member s12 = False :: Bool s13 = Edge :: U2Member s14 = Bono :: U2Member Found 2 different solutions.sbv-7.13/SBVTestSuite/TestSuite/0000755000000000000000000000000013405536617014673 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/Arrays/0000755000000000000000000000000013405536617016134 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/Arrays/InitVals.hs0000644000000000000000000000311713405536617020223 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Arrays.InitVals -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing arrays with initializers ----------------------------------------------------------------------------- {-# LANGUAGE Rank2Types #-} module TestSuite.Arrays.InitVals(tests) where import Utils.SBVTestFramework readDef :: forall m. SymArray m => m Integer Integer -> Predicate readDef proxy = do c <- free "c" i <- free "i" j <- free "j" a <- newArray_ (Just c) `asTypeOf` return proxy let a' = writeArray a j 32 return $ ite (i ./= j) (readArray a' i .== c) (readArray a' i .== 32) readNoDef :: forall m. SymArray m => m Integer Integer -> Predicate readNoDef proxy = do i <- free "i" j <- free "j" a <- newArray_ Nothing `asTypeOf` return proxy return $ readArray a i .== j tests :: TestTree tests = testGroup "Arrays.InitVals" [ testCase "readDef_SArray" $ assertIsThm (readDef (undefined :: SArray Integer Integer)) , testCase "readDef_SFunArray" $ assertIsThm (readDef (undefined :: SFunArray Integer Integer)) , testCase "readDef_SArray" $ assertIsSat (readNoDef (undefined :: SArray Integer Integer)) , testCase "readDef_SFunArray" $ assertIsSat (readNoDef (undefined :: SFunArray Integer Integer)) ] sbv-7.13/SBVTestSuite/TestSuite/Arrays/Memory.hs0000644000000000000000000001741213405536617017745 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Arrays.Memory -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.Arrays.Memory ----------------------------------------------------------------------------- {-# LANGUAGE Rank2Types #-} module TestSuite.Arrays.Memory(tests) where import Utils.SBVTestFramework type AddressBase = Word32 type ValueBase = Word64 type Address = SBV AddressBase type Value = SBV ValueBase type Memory m = m AddressBase ValueBase -- | read-after-write: If you write a value and read it back, you'll get it raw :: SymArray m => Address -> Value -> Memory m -> SBool raw a v m = readArray (writeArray m a v) a .== v -- | if read from a place you didn't write to, the result doesn't change rawd :: SymArray m => Address -> Address -> Value -> Memory m -> SBool rawd a b v m = a ./= b ==> readArray (writeArray m a v) b .== readArray m b -- | write-after-write: If you write to the same location twice, then the first one is ignored waw :: SymArray m => Address -> Value -> Value -> Memory m -> Address -> SBool waw a v1 v2 m0 i = readArray m2 i .== readArray m3 i where m1 = writeArray m0 a v1 m2 = writeArray m1 a v2 m3 = writeArray m0 a v2 -- | Two writes to different locations commute, i.e., can be done in any order wcommutesGood :: SymArray m => (Address, Value) -> (Address, Value) -> Memory m -> Address -> SBool wcommutesGood (a, x) (b, y) m i = a ./= b ==> wcommutesBad (a, x) (b, y) m i -- | Two writes do not commute if they can be done to the same location wcommutesBad :: SymArray m => (Address, Value) -> (Address, Value) -> Memory m -> Address -> SBool wcommutesBad (a, x) (b, y) m i = readArray m0 i .== readArray m1 i where m0 = writeArray (writeArray m a x) b y m1 = writeArray (writeArray m b y) a x -- | Extensionality. Note that we can only check this for SArray, since an SFunArray doesn't allow for -- symbolic equality. (In other words, checking this for SFunArray would be saying "if all reads are the -- same, then all reads are the same," which is useless at best.) Essentially, we need a nested -- quantifier here. extensionality :: (SymArray m, EqSymbolic (Memory m)) => Memory m -> Memory m -> Predicate extensionality m1 m2 = do i <- exists_ return $ (readArray m1 i ./= readArray m2 i) ||| m1 .== m2 -- | Extensionality, second variant. Expressible for both kinds of arrays. extensionality2 :: SymArray m => Memory m -> Memory m -> Address -> Predicate extensionality2 m1 m2 i = do j <- exists_ return $ (readArray m1 j ./= readArray m2 j) ||| readArray m1 i .== readArray m2 i -- | Merge, using memory equality to check result mergeEq :: (SymArray m, Mergeable (Memory m), EqSymbolic (Memory m)) => SBool -> Memory m -> Memory m -> SBool mergeEq b m1 m2 = ite b m1 m2 .== ite (bnot b) m2 m1 -- | Merge, using extensionality to check result mergeExt :: (SymArray m, Mergeable (Memory m)) => SBool -> Memory m -> Memory m -> Address -> SBool mergeExt b m1 m2 i = readArray (ite b m1 m2) i .== readArray (ite (bnot b) m2 m1) i -- | Merge semantics mergeSem :: (SymArray m, Mergeable (Memory m)) => SBool -> Memory m -> Memory m -> Address -> SBool mergeSem b m1 m2 i = readArray (ite b m1 m2) i .== ite b (readArray m1 i) (readArray m2 i) -- | Merge semantics 2, but make sure to populate the array so merge does something interesting mergeSem2 :: (SymArray m, Mergeable (Memory m)) => SBool -> Memory m -> Memory m -> (Address, Value) -> (Address, Value) -> Address -> SBool mergeSem2 b m1 m2 (a1, v1) (a2, v2) i = readArray (ite b m1' m2') i .== ite b (readArray m1' i) (readArray m2' i) where m1' = writeArray (writeArray m1 a1 v1) a2 v2 m2' = writeArray (writeArray m2 a1 v1) a2 v2 -- | Merge is done correctly: mergeSem3 :: (SymArray m, Mergeable (Memory m)) => SBool -> Memory m -> (Address, Value) -> (Address, Value) -> SBool mergeSem3 b m (a1, v1) (a2, v2) = readArray (ite b m1 m2) a1 .== ite b (readArray m1 a1) (readArray m2 a1) where m1 = writeArray m a1 v1 m2 = writeArray m a2 v2 -- | Another merge check mergeSem4 :: (SymArray m, Mergeable (Memory m)) => SBool -> Memory m -> Address -> Address -> SBool mergeSem4 b m a1 a2 = readArray m3 a2 .== ite b (readArray m a2) 3 where m1 = writeArray m a1 1 m2 = writeArray (writeArray m a1 2) a2 3 m3 = ite b m1 m2 tests :: TestTree tests = testGroup "Arrays.Memory" [ testCase "raw_SArray" $ assertIsThm (raw :: Address -> Value -> Memory SArray -> SBool) , testCase "raw_SFunArray" $ assertIsThm (raw :: Address -> Value -> Memory SFunArray -> SBool) , testCase "rawd_SArray" $ assertIsThm (rawd :: Address -> Address -> Value -> Memory SArray -> SBool) , testCase "rawd_SFunArray" $ assertIsThm (rawd :: Address -> Address -> Value -> Memory SFunArray -> SBool) , testCase "waw_SArray" $ assertIsThm (waw :: Address -> Value -> Value -> Memory SArray -> Address -> SBool) , testCase "waw_SFunArray" $ assertIsThm (waw :: Address -> Value -> Value -> Memory SFunArray -> Address -> SBool) , testCase "wcommute-good_SArray" $ assertIsThm (wcommutesGood :: (Address, Value) -> (Address, Value) -> Memory SArray -> Address -> SBool) , testCase "wcommute-good_SFunArray" $ assertIsThm (wcommutesGood :: (Address, Value) -> (Address, Value) -> Memory SFunArray -> Address -> SBool) , testCase "wcommute-bad_SArray" $ assertIsntThm (wcommutesBad :: (Address, Value) -> (Address, Value) -> Memory SArray -> Address -> SBool) , testCase "wcommute-bad_SFunArray" $ assertIsntThm (wcommutesBad :: (Address, Value) -> (Address, Value) -> Memory SFunArray -> Address -> SBool) , testCase "ext_SArray" $ assertIsThm (extensionality :: Memory SArray -> Memory SArray -> Predicate) , testCase "ext2_SArray" $ assertIsThm (extensionality2 :: Memory SArray -> Memory SArray -> Address -> Predicate) , testCase "ext2_SFunArray" $ assertIsThm (extensionality2 :: Memory SFunArray -> Memory SFunArray -> Address -> Predicate) , testCase "mergeEq_SArray" $ assertIsThm (mergeEq :: SBool -> Memory SArray -> Memory SArray -> SBool) , testCase "mergeExt_SArray" $ assertIsThm (mergeExt :: SBool -> Memory SArray -> Memory SArray -> Address -> SBool) , testCase "mergeExt_SFunArray" $ assertIsThm (mergeExt :: SBool -> Memory SFunArray -> Memory SFunArray -> Address -> SBool) , testCase "mergeSem_SArray" $ assertIsThm (mergeSem :: SBool -> Memory SArray -> Memory SArray -> Address -> SBool) , testCase "mergeSem_SFunArray" $ assertIsThm (mergeSem :: SBool -> Memory SFunArray -> Memory SFunArray -> Address -> SBool) , testCase "mergeSem2_SArray" $ assertIsThm (mergeSem2 :: SBool -> Memory SArray -> Memory SArray -> (Address, Value) -> (Address, Value) -> Address -> SBool) , testCase "mergeSem2_SFunArray" $ assertIsThm (mergeSem2 :: SBool -> Memory SFunArray -> Memory SFunArray -> (Address, Value) -> (Address, Value) -> Address -> SBool) , testCase "mergeSem3_SArray" $ assertIsThm (mergeSem3 :: SBool -> Memory SArray -> (Address, Value) -> (Address, Value) -> SBool) , testCase "mergeSem3_SFunArray" $ assertIsThm (mergeSem3 :: SBool -> Memory SFunArray -> (Address, Value) -> (Address, Value) -> SBool) , testCase "mergeSem4_SArray" $ assertIsntThm (mergeSem4 :: SBool -> Memory SArray -> Address -> Address -> SBool) , testCase "mergeSem4_SFunArray" $ assertIsntThm (mergeSem4 :: SBool -> Memory SFunArray -> Address -> Address -> SBool) ] sbv-7.13/SBVTestSuite/TestSuite/Arrays/Query.hs0000644000000000000000000000726413405536617017606 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Arrays.Query -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for query mode arrays ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Arrays.Query(tests) where import Data.SBV.Control import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Arrays.Query" [ goldenCapturedIO "queryArrays1" $ t q1 , goldenCapturedIO "queryArrays2" $ t q2 , goldenCapturedIO "queryArrays3" $ t q3 , goldenCapturedIO "queryArrays4" $ t q4 , goldenCapturedIO "queryArrays5" $ t q5 , goldenCapturedIO "queryArrays6" $ t q6 ] where t tc goldFile = do r <- runSMTWith defaultSMTCfg{verbose=True, redirectVerbose=Just goldFile} tc appendFile goldFile ("\n FINAL:" ++ show r ++ "\nDONE!\n") q1 :: Symbolic (Word8, Word8, Int8) q1 = do m :: SArray Word8 Int8 <- newArray "a" Nothing a1 <- sWord8 "a1" a2 <- sWord8 "a2" constrain $ a1 ./= a2 v1 <- sInt8 "v1" query $ do constrain $ v1 .== readArray (writeArray m a1 v1) a1 _ <- checkSat va1 <- getValue a1 va2 <- getValue a2 vv1 <- getValue v1 return (va1, va2, vv1) q2 :: Symbolic Word8 q2 = do i <- sWord8 "i" setLogic QF_UFBV query $ do constrain $ i .== select [0 .. 255] 0 i _ <- checkSat getValue i q3 :: Symbolic Word8 q3 = do i <- sWord8 "i" setLogic QF_UFBV query $ do constrain $ i .== select (replicate 256 i) 0 i _ <- checkSat getValue i q4 :: Symbolic (Word8, Word8) q4 = do i <- sWord8 "i" j <- sWord8 "j" setLogic QF_UFBV query $ do constrain $ i .== select [0 .. 255] 0 i _ <- checkSat iv <- getValue i constrain $ j .== select [0 .. 255] 0 j constrain $ j .== i+1 _ <- checkSat jv <- getValue j return (iv, jv) q5 :: Symbolic (Maybe (Word8, Int8)) q5 = do m :: SArray Word8 Int8 <- newArray "a" Nothing a <- sWord8 "a" v <- sInt8 "v" query $ do let m2 = writeArray (writeArray m a v) (a+1) (v+1) vRead = readArray m2 (a+1) constrain $ v + 1 ./= vRead cs <- checkSat case cs of Unsat -> return Nothing Unk -> error "solver returned Unknown!" Sat -> do av <- getValue a vv <- getValue v return $ Just (av, vv) q6 :: Symbolic [Integer] q6 = do (a :: SArray Integer Integer) <- newArray "a" Nothing query $ loop (writeArray a 1 1) [] where loop a sofar = do push 1 constrain $ readArray a 1 .== 5 cs <- checkSat case cs of Unk -> error "Unknown" Unsat -> do pop 1 d <- freshVar $ "d" ++ show (length sofar) constrain $ d .>= 1 &&& d .< 3 loop (writeArray a 1 (readArray a 1 + d)) (sofar ++ [d]) Sat -> mapM getValue sofar {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/SBVTestSuite/TestSuite/Basics/0000755000000000000000000000000013405536617016077 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/Basics/AllSat.hs0000644000000000000000000000316413405536617017617 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.AllSat -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for basic allsat calls ----------------------------------------------------------------------------- {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveDataTypeable #-} module TestSuite.Basics.AllSat(tests) where import Data.Generics import Utils.SBVTestFramework import Data.List (sortOn) tests :: TestTree tests = testGroup "Basics.AllSat" [ goldenVsStringShow "allSat1" t1 , goldenVsStringShow "allSat2" t2 , goldenVsStringShow "allSat3" $ allSat $ \x -> x .== (0::SFloat) , goldenVsStringShow "allSat4" $ allSat $ \x -> x .< (0::SWord8) , goldenVsStringShow "allSat5" $ fmap srt $ allSat $ \x y -> x .< y &&& y .< (4::SWord8) , goldenVsStringShow "allSat6" $ allSat $ exists "x" >>= \x -> exists "y" >>= \y -> forall "z" >>= \z -> return (x .< (y::SWord8) &&& y .< 3 &&& z .== (z::SWord8)) ] srt :: AllSatResult -> AllSatResult srt (AllSatResult (b1, b2, rs)) = AllSatResult (b1, b2, sortOn getModelDictionary rs) newtype Q = Q () deriving (Eq, Ord, Data, Read, Show, SymWord, HasKind) type SQ = SBV Q t1 :: IO AllSatResult t1 = allSat $ do x <- free "x" y <- free "y" return $ x .== (y :: SQ) t2 :: IO AllSatResult t2 = allSat $ do x <- free "x" y <- free "y" z <- free "z" return $ x .== (y :: SQ) &&& z .== (z :: SQ) sbv-7.13/SBVTestSuite/TestSuite/Basics/ArithNoSolver.hs0000644000000000000000000016166413405536617021210 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.ArithNoSolver -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for basic concrete arithmetic, i.e., testing all -- the constant folding based arithmetic implementation in SBV ----------------------------------------------------------------------------- {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE TupleSections #-} module TestSuite.Basics.ArithNoSolver(tests) where import qualified Data.Numbers.CrackNum as CN (wordToFloat, wordToDouble, floatToWord, doubleToWord) import Data.SBV.Internals import Utils.SBVTestFramework import Data.Maybe (fromJust, isJust, fromMaybe) import Data.List (genericIndex, isInfixOf, isPrefixOf, isSuffixOf, genericTake, genericDrop, genericLength) import qualified Data.Char as C import qualified Data.SBV.Char as SC import qualified Data.SBV.String as SS import qualified Data.SBV.List as SL -- Test suite tests :: TestTree tests = testGroup "Arith.NoSolver" $ genReals ++ genFloats ++ genQRems ++ genBinTest "+" (+) ++ genBinTest "-" (-) ++ genBinTest "*" (*) ++ genUnTest "negate" negate ++ genUnTest "abs" abs ++ genUnTest "signum" signum ++ genBinTest ".&." (.&.) ++ genBinTest ".|." (.|.) ++ genBoolTest "<" (<) (.<) ++ genBoolTest "<=" (<=) (.<=) ++ genBoolTest ">" (>) (.>) ++ genBoolTest ">=" (>=) (.>=) ++ genBoolTest "==" (==) (.==) ++ genBoolTest "/=" (/=) (./=) ++ genBinTest "xor" xor ++ genUnTest "complement" complement ++ genIntTest False "setBit" setBit ++ genIntTest False "clearBit" clearBit ++ genIntTest False "complementBit" complementBit ++ genIntTest True "shift" shift ++ genIntTest True "shiftL" shiftL ++ genIntTest True "shiftR" shiftR ++ genIntTest True "rotate" rotate ++ genIntTest True "rotateL" rotateL ++ genIntTest True "rotateR" rotateR ++ genShiftRotTest "shiftL_gen" sShiftLeft ++ genShiftRotTest "shiftR_gen" sShiftRight ++ genShiftRotTest "rotateL_gen" sRotateLeft ++ genShiftRotTest "rotateR_gen" sRotateRight ++ genShiftMixSize ++ genBlasts ++ genCounts ++ genIntCasts ++ genChars ++ genStrings ++ genLists genBinTest :: String -> (forall a. (Num a, Bits a) => a -> a -> a) -> [TestTree] genBinTest nm op = map mkTest $ zipWith pair [(show x, show y, x `op` y) | x <- w8s, y <- w8s ] [x `op` y | x <- sw8s, y <- sw8s ] ++ zipWith pair [(show x, show y, x `op` y) | x <- w16s, y <- w16s] [x `op` y | x <- sw16s, y <- sw16s] ++ zipWith pair [(show x, show y, x `op` y) | x <- w32s, y <- w32s] [x `op` y | x <- sw32s, y <- sw32s] ++ zipWith pair [(show x, show y, x `op` y) | x <- w64s, y <- w64s] [x `op` y | x <- sw64s, y <- sw64s] ++ zipWith pair [(show x, show y, x `op` y) | x <- i8s, y <- i8s ] [x `op` y | x <- si8s, y <- si8s ] ++ zipWith pair [(show x, show y, x `op` y) | x <- i16s, y <- i16s] [x `op` y | x <- si16s, y <- si16s] ++ zipWith pair [(show x, show y, x `op` y) | x <- i32s, y <- i32s] [x `op` y | x <- si32s, y <- si32s] ++ zipWith pair [(show x, show y, x `op` y) | x <- i64s, y <- i64s] [x `op` y | x <- si64s, y <- si64s] ++ zipWith pair [(show x, show y, x `op` y) | x <- iUBs, y <- iUBs] [x `op` y | x <- siUBs, y <- siUBs] where pair (x, y, a) b = (x, y, show (fromIntegral a `asTypeOf` b) == show b) mkTest (x, y, s) = testCase ("arithCF-" ++ nm ++ "." ++ x ++ "_" ++ y) (s `showsAs` "True") genBoolTest :: String -> (forall a. Ord a => a -> a -> Bool) -> (forall a. OrdSymbolic a => a -> a -> SBool) -> [TestTree] genBoolTest nm op opS = map mkTest $ zipWith pair [(show x, show y, x `op` y) | x <- w8s, y <- w8s ] [x `opS` y | x <- sw8s, y <- sw8s ] ++ zipWith pair [(show x, show y, x `op` y) | x <- w16s, y <- w16s] [x `opS` y | x <- sw16s, y <- sw16s] ++ zipWith pair [(show x, show y, x `op` y) | x <- w32s, y <- w32s] [x `opS` y | x <- sw32s, y <- sw32s] ++ zipWith pair [(show x, show y, x `op` y) | x <- w64s, y <- w64s] [x `opS` y | x <- sw64s, y <- sw64s] ++ zipWith pair [(show x, show y, x `op` y) | x <- i8s, y <- i8s ] [x `opS` y | x <- si8s, y <- si8s ] ++ zipWith pair [(show x, show y, x `op` y) | x <- i16s, y <- i16s] [x `opS` y | x <- si16s, y <- si16s] ++ zipWith pair [(show x, show y, x `op` y) | x <- i32s, y <- i32s] [x `opS` y | x <- si32s, y <- si32s] ++ zipWith pair [(show x, show y, x `op` y) | x <- i64s, y <- i64s] [x `opS` y | x <- si64s, y <- si64s] ++ zipWith pair [(show x, show y, x `op` y) | x <- iUBs, y <- iUBs] [x `opS` y | x <- siUBs, y <- siUBs] ++ zipWith pair [(show x, show y, x `op` y) | x <- iCs, y <- iCs ] [x `opS` y | x <- siCs, y <- siCs ] ++ zipWith pair [(show x, show y, x `op` y) | x <- ss, y <- ss ] [x `opS` y | x <- sss, y <- sss ] ++ zipWith pair [(show x, show y, toL x `op` toL y) | x <- ssl, y <- ssl ] [x `opS` y | x <- ssl, y <- ssl ] where pair (x, y, a) b = (x, y, Just a == unliteral b) mkTest (x, y, s) = testCase ("arithCF-" ++ nm ++ "." ++ x ++ "_" ++ y) (s `showsAs` "True") toL x = fromMaybe (error "genBoolTest: Cannot extract a literal!") (unliteral x) genUnTest :: String -> (forall a. (Num a, Bits a) => a -> a) -> [TestTree] genUnTest nm op = map mkTest $ zipWith pair [(show x, op x) | x <- w8s ] [op x | x <- sw8s ] ++ zipWith pair [(show x, op x) | x <- w16s] [op x | x <- sw16s] ++ zipWith pair [(show x, op x) | x <- w32s] [op x | x <- sw32s] ++ zipWith pair [(show x, op x) | x <- w64s] [op x | x <- sw64s] ++ zipWith pair [(show x, op x) | x <- i8s ] [op x | x <- si8s ] ++ zipWith pair [(show x, op x) | x <- i16s] [op x | x <- si16s] ++ zipWith pair [(show x, op x) | x <- i32s] [op x | x <- si32s] ++ zipWith pair [(show x, op x) | x <- i64s] [op x | x <- si64s] ++ zipWith pair [(show x, op x) | x <- iUBs] [op x | x <- siUBs] where pair (x, a) b = (x, show (fromIntegral a `asTypeOf` b) == show b) mkTest (x, s) = testCase ("arithCF-" ++ nm ++ "." ++ x) (s `showsAs` "True") genIntTest :: Bool -> String -> (forall a. (Num a, Bits a) => (a -> Int -> a)) -> [TestTree] genIntTest overSized nm op = map mkTest $ zipWith pair [("u8", show x, show y, x `op` y) | x <- w8s, y <- is (intSizeOf x)] [x `op` y | x <- sw8s, y <- is (intSizeOf x)] ++ zipWith pair [("u16", show x, show y, x `op` y) | x <- w16s, y <- is (intSizeOf x)] [x `op` y | x <- sw16s, y <- is (intSizeOf x)] ++ zipWith pair [("u32", show x, show y, x `op` y) | x <- w32s, y <- is (intSizeOf x)] [x `op` y | x <- sw32s, y <- is (intSizeOf x)] ++ zipWith pair [("u64", show x, show y, x `op` y) | x <- w64s, y <- is (intSizeOf x)] [x `op` y | x <- sw64s, y <- is (intSizeOf x)] ++ zipWith pair [("s8", show x, show y, x `op` y) | x <- i8s, y <- is (intSizeOf x)] [x `op` y | x <- si8s, y <- is (intSizeOf x)] ++ zipWith pair [("s16", show x, show y, x `op` y) | x <- i16s, y <- is (intSizeOf x)] [x `op` y | x <- si16s, y <- is (intSizeOf x)] ++ zipWith pair [("s32", show x, show y, x `op` y) | x <- i32s, y <- is (intSizeOf x)] [x `op` y | x <- si32s, y <- is (intSizeOf x)] ++ zipWith pair [("s64", show x, show y, x `op` y) | x <- i64s, y <- is (intSizeOf x)] [x `op` y | x <- si64s, y <- is (intSizeOf x)] ++ zipWith pair [("iUB", show x, show y, x `op` y) | x <- iUBs, y <- [0..10]] [x `op` y | x <- siUBs, y <- [0..10]] where is sz = [0 .. sz - 1] ++ extras where extras | overSized = map (sz +) ([0 .. 1] ++ [sz, sz+1]) | True = [] pair (t, x, y, a) b = (t, x, y, show a, show b, show (fromIntegral a `asTypeOf` b) == show b) mkTest (t, x, y, a, b, s) = testCase ("arithCF-" ++ nm ++ "." ++ t ++ "_" ++ x ++ "_" ++ y ++ "_" ++ a ++ "_" ++ b) (s `showsAs` "True") genShiftRotTest :: String -> (forall a. (SIntegral a, SDivisible (SBV a)) => (SBV a -> SBV a -> SBV a)) -> [TestTree] genShiftRotTest nm op = map mkTest $ zipWith pair [("u8", show x, show y, literal x `op` y) | x <- w8s, y <- is (intSizeOf x)] [x `op` y | x <- sw8s, y <- is (intSizeOf x)] ++ zipWith pair [("u16", show x, show y, literal x `op` y) | x <- w16s, y <- is (intSizeOf x)] [x `op` y | x <- sw16s, y <- is (intSizeOf x)] ++ zipWith pair [("u32", show x, show y, literal x `op` y) | x <- w32s, y <- is (intSizeOf x)] [x `op` y | x <- sw32s, y <- is (intSizeOf x)] ++ zipWith pair [("u64", show x, show y, literal x `op` y) | x <- w64s, y <- is (intSizeOf x)] [x `op` y | x <- sw64s, y <- is (intSizeOf x)] ++ zipWith pair [("s8", show x, show y, literal x `op` y) | x <- i8s, y <- is (intSizeOf x)] [x `op` y | x <- si8s, y <- is (intSizeOf x)] ++ zipWith pair [("s16", show x, show y, literal x `op` y) | x <- i16s, y <- is (intSizeOf x)] [x `op` y | x <- si16s, y <- is (intSizeOf x)] ++ zipWith pair [("s32", show x, show y, literal x `op` y) | x <- i32s, y <- is (intSizeOf x)] [x `op` y | x <- si32s, y <- is (intSizeOf x)] ++ zipWith pair [("s64", show x, show y, literal x `op` y) | x <- i64s, y <- is (intSizeOf x)] [x `op` y | x <- si64s, y <- is (intSizeOf x)] -- NB. No generic shift/rotate for SMTLib unbounded integers where is sz = let b :: Word32 b = fromIntegral sz in map (sFromIntegral . literal) $ [0 .. b - 1] ++ [b, b+1, 2*b, 2*b+1] pair (t, x, y, a) b = (t, x, y, show a, show b, isJust (unliteral a) && isJust (unliteral b) && unliteral a == unliteral b) mkTest (t, x, y, a, b, s) = testCase ("arithCF-" ++ nm ++ "." ++ t ++ "_" ++ x ++ "_" ++ y ++ "_" ++ a ++ "_" ++ b) (s `showsAs` "True") -- A few tests for mixed-size shifts genShiftMixSize :: [TestTree] genShiftMixSize = map mkTest $ map pair [(show x, show y, "shl_w8_w16", literal x `sShiftLeft` literal y, x `shiftL` fromIntegral y) | x <- w8s, y <- yw16s] ++ map pair [(show x, show y, "shr_w8_w16", literal x `sShiftRight` literal y, x `shiftR` fromIntegral y) | x <- w8s, y <- yw16s] ++ map pair [(show x, show y, "shl_w16_w8", literal x `sShiftLeft` literal y, x `shiftL` fromIntegral y) | x <- w16s, y <- w8s] ++ map pair [(show x, show y, "shr_w16_w8", literal x `sShiftRight` literal y, x `shiftR` fromIntegral y) | x <- w16s, y <- w8s] ++ map pair [(show x, show y, "shl_i8_i16", literal x `sShiftLeft` literal y, x `shiftL` fromIntegral y) | x <- i8s, y <- yi16s] ++ map pair [(show x, show y, "shr_i8_i16", literal x `sShiftRight` literal y, x `shiftR` fromIntegral y) | x <- i8s, y <- yi16s] ++ map pair [(show x, show y, "shl_i16_i8", literal x `sShiftLeft` literal y, x `shiftL` fromIntegral y) | x <- i16s, y <- i8s, y >= 0] ++ map pair [(show x, show y, "shr_i16_i8", literal x `sShiftRight` literal y, x `shiftR` fromIntegral y) | x <- i16s, y <- i8s, y >= 0] ++ map pair [(show x, show y, "shl_w8_i16", literal x `sShiftLeft` literal y, x `shiftL` fromIntegral y) | x <- w8s, y <- yi16s] ++ map pair [(show x, show y, "shr_w8_i16", literal x `sShiftRight` literal y, x `shiftR` fromIntegral y) | x <- w8s, y <- yi16s] ++ map pair [(show x, show y, "shl_w16_i8", literal x `sShiftLeft` literal y, x `shiftL` fromIntegral y) | x <- w16s, y <- i8s, y >= 0] ++ map pair [(show x, show y, "shr_w16_i8", literal x `sShiftRight` literal y, x `shiftR` fromIntegral y) | x <- w16s, y <- i8s, y >= 0] ++ map pair [(show x, show y, "shl_i8_w16", literal x `sShiftLeft` literal y, x `shiftL` fromIntegral y) | x <- i8s, y <- yw16s] ++ map pair [(show x, show y, "shr_i8_w16", literal x `sShiftRight` literal y, x `shiftR` fromIntegral y) | x <- i8s, y <- yw16s] ++ map pair [(show x, show y, "shl_i16_w8", literal x `sShiftLeft` literal y, x `shiftL` fromIntegral y) | x <- i16s, y <- w8s] ++ map pair [(show x, show y, "shr_i16_w8", literal x `sShiftRight` literal y, x `shiftR` fromIntegral y) | x <- i16s, y <- w8s] where pair :: (SymWord a, Show a) => (String, String, String, SBV a, a) -> (String, Bool) pair (x, y, l, sr, lr) = (l ++ "." ++ x ++ "_" ++ y ++ "_" ++ show (unliteral sr) ++ "_" ++ show lr, isJust (unliteral sr) && unliteral sr == Just lr) mkTest (l, s) = testCase ("arithCF-genShiftMixSize" ++ l) (s `showsAs` "True") yi16s :: [Int16] yi16s = [0, 255, 256, 257, maxBound] yw16s :: [Word16] yw16s = [0, 255, 256, 257, maxBound] genBlasts :: [TestTree] genBlasts = map mkTest $ [(show x, fromBitsLE (blastLE x) .== x) | x <- sw8s ] ++ [(show x, fromBitsBE (blastBE x) .== x) | x <- sw8s ] ++ [(show x, fromBitsLE (blastLE x) .== x) | x <- si8s ] ++ [(show x, fromBitsBE (blastBE x) .== x) | x <- si8s ] ++ [(show x, fromBitsLE (blastLE x) .== x) | x <- sw16s] ++ [(show x, fromBitsBE (blastBE x) .== x) | x <- sw16s] ++ [(show x, fromBitsLE (blastLE x) .== x) | x <- si16s] ++ [(show x, fromBitsBE (blastBE x) .== x) | x <- si16s] ++ [(show x, fromBitsLE (blastLE x) .== x) | x <- sw32s] ++ [(show x, fromBitsBE (blastBE x) .== x) | x <- sw32s] ++ [(show x, fromBitsLE (blastLE x) .== x) | x <- si32s] ++ [(show x, fromBitsBE (blastBE x) .== x) | x <- si32s] ++ [(show x, fromBitsLE (blastLE x) .== x) | x <- sw64s] ++ [(show x, fromBitsBE (blastBE x) .== x) | x <- sw64s] ++ [(show x, fromBitsLE (blastLE x) .== x) | x <- si64s] ++ [(show x, fromBitsBE (blastBE x) .== x) | x <- si64s] where mkTest (x, r) = testCase ("blast-" ++ x) (r `showsAs` "True") genCounts :: [TestTree] genCounts = map mkTest $ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsBE (blastLE x) :: SWord8 )) | x <- sw8s ] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsLE (blastBE x) :: SWord8 )) | x <- sw8s ] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsBE (blastLE x) :: SInt8 )) | x <- si8s ] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsLE (blastBE x) :: SInt8 )) | x <- si8s ] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsBE (blastLE x) :: SWord16)) | x <- sw16s] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsLE (blastBE x) :: SWord16)) | x <- sw16s] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsBE (blastLE x) :: SInt16 )) | x <- si16s] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsLE (blastBE x) :: SInt16 )) | x <- si16s] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsBE (blastLE x) :: SWord32)) | x <- sw32s] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsLE (blastBE x) :: SWord32)) | x <- sw32s] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsBE (blastLE x) :: SInt32 )) | x <- si32s] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsLE (blastBE x) :: SInt32 )) | x <- si32s] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsBE (blastLE x) :: SWord64)) | x <- sw64s] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsLE (blastBE x) :: SWord64)) | x <- sw64s] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsBE (blastLE x) :: SInt64 )) | x <- si64s] ++ [(show x, sCountTrailingZeros x .== sCountLeadingZeros (fromBitsLE (blastBE x) :: SInt64 )) | x <- si64s] where mkTest (x, r) = testCase ("count-" ++ x) (r `showsAs` "True") genIntCasts :: [TestTree] genIntCasts = map mkTest $ cast w8s ++ cast w16s ++ cast w32s ++ cast w64s ++ cast i8s ++ cast i16s ++ cast i32s ++ cast i64s ++ cast iUBs where mkTest (x, r) = testCase ("intCast-" ++ x) (r `showsAs` "True") lhs x = sFromIntegral (literal x) rhs x = literal (fromIntegral x) cast :: forall a. (Show a, Integral a, SymWord a) => [a] -> [(String, SBool)] cast xs = toWords xs ++ toInts xs toWords xs = [(show x, lhs x .== (rhs x :: SWord8 )) | x <- xs] ++ [(show x, lhs x .== (rhs x :: SWord16)) | x <- xs] ++ [(show x, lhs x .== (rhs x :: SWord32)) | x <- xs] ++ [(show x, lhs x .== (rhs x :: SWord64)) | x <- xs] toInts xs = [(show x, lhs x .== (rhs x :: SInt8 )) | x <- xs] ++ [(show x, lhs x .== (rhs x :: SInt16)) | x <- xs] ++ [(show x, lhs x .== (rhs x :: SInt32)) | x <- xs] ++ [(show x, lhs x .== (rhs x :: SInt64)) | x <- xs] ++ [(show x, lhs x .== (rhs x :: SInteger)) | x <- xs] genQRems :: [TestTree] genQRems = map mkTest $ zipWith pair [("divMod", show x, show y, x `divMod0` y) | x <- w8s, y <- w8s ] [x `sDivMod` y | x <- sw8s, y <- sw8s ] ++ zipWith pair [("divMod", show x, show y, x `divMod0` y) | x <- w16s, y <- w16s] [x `sDivMod` y | x <- sw16s, y <- sw16s] ++ zipWith pair [("divMod", show x, show y, x `divMod0` y) | x <- w32s, y <- w32s] [x `sDivMod` y | x <- sw32s, y <- sw32s] ++ zipWith pair [("divMod", show x, show y, x `divMod0` y) | x <- w64s, y <- w64s] [x `sDivMod` y | x <- sw64s, y <- sw64s] ++ zipWith pair [("divMod", show x, show y, x `divMod1` y) | x <- i8s, y <- i8s ] [x `sDivMod` y | x <- si8s, y <- si8s ] ++ zipWith pair [("divMod", show x, show y, x `divMod1` y) | x <- i16s, y <- i16s] [x `sDivMod` y | x <- si16s, y <- si16s] ++ zipWith pair [("divMod", show x, show y, x `divMod1` y) | x <- i32s, y <- i32s] [x `sDivMod` y | x <- si32s, y <- si32s] ++ zipWith pair [("divMod", show x, show y, x `divMod1` y) | x <- i64s, y <- i64s] [x `sDivMod` y | x <- si64s, y <- si64s] ++ zipWith pair [("divMod", show x, show y, x `divMod0` y) | x <- iUBs, y <- iUBs] [x `sDivMod` y | x <- siUBs, y <- siUBs] ++ zipWith pair [("quotRem", show x, show y, x `quotRem0` y) | x <- w8s, y <- w8s ] [x `sQuotRem` y | x <- sw8s, y <- sw8s ] ++ zipWith pair [("quotRem", show x, show y, x `quotRem0` y) | x <- w16s, y <- w16s] [x `sQuotRem` y | x <- sw16s, y <- sw16s] ++ zipWith pair [("quotRem", show x, show y, x `quotRem0` y) | x <- w32s, y <- w32s] [x `sQuotRem` y | x <- sw32s, y <- sw32s] ++ zipWith pair [("quotRem", show x, show y, x `quotRem0` y) | x <- w64s, y <- w64s] [x `sQuotRem` y | x <- sw64s, y <- sw64s] ++ zipWith pair [("quotRem", show x, show y, x `quotRem1` y) | x <- i8s, y <- i8s ] [x `sQuotRem` y | x <- si8s, y <- si8s ] ++ zipWith pair [("quotRem", show x, show y, x `quotRem1` y) | x <- i16s, y <- i16s] [x `sQuotRem` y | x <- si16s, y <- si16s] ++ zipWith pair [("quotRem", show x, show y, x `quotRem1` y) | x <- i32s, y <- i32s] [x `sQuotRem` y | x <- si32s, y <- si32s] ++ zipWith pair [("quotRem", show x, show y, x `quotRem1` y) | x <- i64s, y <- i64s] [x `sQuotRem` y | x <- si64s, y <- si64s] ++ zipWith pair [("quotRem", show x, show y, x `quotRem0` y) | x <- iUBs, y <- iUBs] [x `sQuotRem` y | x <- siUBs, y <- siUBs] where pair (nm, x, y, (r1, r2)) (e1, e2) = (nm, x, y, show (fromIntegral r1 `asTypeOf` e1, fromIntegral r2 `asTypeOf` e2) == show (e1, e2)) mkTest (nm, x, y, s) = testCase ("arithCF-" ++ nm ++ "." ++ x ++ "_" ++ y) (s `showsAs` "True") -- Haskell's divMod and quotRem differs from SBV's in two ways: -- - when y is 0, Haskell throws an exception, SBV sets the result to 0; like in division -- - Haskell overflows if x == minBound and y == -1 for bounded signed types; but SBV returns minBound, 0; which is more meaningful -- NB. There was a ticket filed against the second anomaly above, See: http://ghc.haskell.org/trac/ghc/ticket/8695 -- But the Haskell folks decided not to fix it. Sigh.. overflow x y = x == minBound && y == -1 divMod0 x y = if y == 0 then (0, x) else x `divMod` y divMod1 x y = if overflow x y then (x, 0) else x `divMod0` y quotRem0 x y = if y == 0 then (0, x) else x `quotRem` y quotRem1 x y = if overflow x y then (x, 0) else x `quotRem0` y genReals :: [TestTree] genReals = map mkTest $ map ("+",) (zipWith pair [(show x, show y, x + y) | x <- rs, y <- rs ] [x + y | x <- srs, y <- srs ]) ++ map ("-",) (zipWith pair [(show x, show y, x - y) | x <- rs, y <- rs ] [x - y | x <- srs, y <- srs ]) ++ map ("*",) (zipWith pair [(show x, show y, x * y) | x <- rs, y <- rs ] [x * y | x <- srs, y <- srs ]) ++ map ("<",) (zipWith pair [(show x, show y, x < y) | x <- rs, y <- rs ] [x .< y | x <- srs, y <- srs ]) ++ map ("<=",) (zipWith pair [(show x, show y, x <= y) | x <- rs, y <- rs ] [x .<= y | x <- srs, y <- srs ]) ++ map (">",) (zipWith pair [(show x, show y, x > y) | x <- rs, y <- rs ] [x .> y | x <- srs, y <- srs ]) ++ map (">=",) (zipWith pair [(show x, show y, x >= y) | x <- rs, y <- rs ] [x .>= y | x <- srs, y <- srs ]) ++ map ("==",) (zipWith pair [(show x, show y, x == y) | x <- rs, y <- rs ] [x .== y | x <- srs, y <- srs ]) ++ map ("/=",) (zipWith pair [(show x, show y, x /= y) | x <- rs, y <- rs ] [x ./= y | x <- srs, y <- srs ]) ++ map ("/",) (zipWith pair [(show x, show y, x / y) | x <- rs, y <- rs, y /= 0] [x / y | x <- srs, y <- srs, unliteral y /= Just 0]) where pair (x, y, a) b = (x, y, Just a == unliteral b) mkTest (nm, (x, y, s)) = testCase ("arithCF-" ++ nm ++ "." ++ x ++ "_" ++ y) (s `showsAs` "True") genFloats :: [TestTree] genFloats = bTests ++ uTests ++ fpTests1 ++ fpTests2 ++ converts where bTests = map mkTest2 $ floatRun2 "+" (+) (+) comb ++ doubleRun2 "+" (+) (+) comb ++ floatRun2 "-" (-) (-) comb ++ doubleRun2 "-" (-) (-) comb ++ floatRun2 "*" (*) (*) comb ++ doubleRun2 "*" (*) (*) comb ++ floatRun2 "/" (/) (/) comb ++ doubleRun2 "/" (/) (/) comb ++ floatRun2 "<" (<) (.<) combB ++ doubleRun2 "<" (<) (.<) combB ++ floatRun2 "<=" (<=) (.<=) combB ++ doubleRun2 "<=" (<=) (.<=) combB ++ floatRun2 ">" (>) (.>) combB ++ doubleRun2 ">" (>) (.>) combB ++ floatRun2 ">=" (>=) (.>=) combB ++ doubleRun2 ">=" (>=) (.>=) combB ++ floatRun2 "==" (==) (.==) combB ++ doubleRun2 "==" (==) (.==) combB ++ floatRun2 "/=" (/=) (./=) combN ++ doubleRun2 "/=" (/=) (./=) combN fpTests1 = map mkTest1 $ floatRun1 "abs" abs abs comb1 ++ floatRun1 "fpAbs" abs fpAbs comb1 ++ doubleRun1 "abs" abs abs comb1 ++ doubleRun1 "fpAbs" abs fpAbs comb1 ++ floatRun1 "negate" negate negate comb1 ++ floatRun1 "fpNeg" negate fpNeg comb1 ++ doubleRun1 "negate" negate negate comb1 ++ doubleRun1 "fpNeg" negate fpNeg comb1 ++ floatRun1M "fpSqrt" sqrt fpSqrt comb1 ++ doubleRun1M "fpSqrt" sqrt fpSqrt comb1 ++ floatRun1M "fpRoundToIntegral" fpRoundToIntegralH fpRoundToIntegral comb1 ++ doubleRun1M "fpRoundToIntegral" fpRoundToIntegralH fpRoundToIntegral comb1 ++ floatRun1 "signum" signum signum comb1 ++ doubleRun1 "signum" signum signum comb1 -- TODO. Can't possibly test fma, unless we FFI out to C. Leave it out for the time being fpTests2 = map mkTest2 $ floatRun2M "fpAdd" (+) fpAdd comb ++ doubleRun2M "fpAdd" (+) fpAdd comb ++ floatRun2M "fpSub" (-) fpSub comb ++ doubleRun2M "fpSub" (-) fpSub comb ++ floatRun2M "fpMul" (*) fpMul comb ++ doubleRun2M "fpMul" (*) fpMul comb ++ floatRun2M "fpDiv" (/) fpDiv comb ++ doubleRun2M "fpDiv" (/) fpDiv comb ++ floatRunMM "fpMin" fpMinH fpMin comb ++ doubleRunMM "fpMin" fpMinH fpMin comb ++ floatRunMM "fpMax" fpMaxH fpMax comb ++ doubleRunMM "fpMax" fpMaxH fpMax comb ++ floatRun2 "fpRem" fpRemH fpRem comb ++ doubleRun2 "fpRem" fpRemH fpRem comb ++ floatRun2 "fpIsEqualObject" fpIsEqualObjectH fpIsEqualObject combE ++ doubleRun2 "fpIsEqualObject" fpIsEqualObjectH fpIsEqualObject combE converts = map cvtTest [("toFP_Int8_ToFloat", show x, toSFloat sRNE (literal x), fromRational (toRational x)) | x <- i8s ] ++ map cvtTest [("toFP_Int16_ToFloat", show x, toSFloat sRNE (literal x), fromRational (toRational x)) | x <- i16s] ++ map cvtTest [("toFP_Int32_ToFloat", show x, toSFloat sRNE (literal x), fromRational (toRational x)) | x <- i32s] ++ map cvtTest [("toFP_Int64_ToFloat", show x, toSFloat sRNE (literal x), fromRational (toRational x)) | x <- i64s] ++ map cvtTest [("toFP_Word8_ToFloat", show x, toSFloat sRNE (literal x), fromRational (toRational x)) | x <- w8s ] ++ map cvtTest [("toFP_Word16_ToFloat", show x, toSFloat sRNE (literal x), fromRational (toRational x)) | x <- w16s] ++ map cvtTest [("toFP_Word32_ToFloat", show x, toSFloat sRNE (literal x), fromRational (toRational x)) | x <- w32s] ++ map cvtTest [("toFP_Word64_ToFloat", show x, toSFloat sRNE (literal x), fromRational (toRational x)) | x <- w64s] ++ map cvtTest [("toFP_Float_ToFloat", show x, toSFloat sRNE (literal x), literal x ) | x <- fs ] ++ map cvtTest [("toFP_Double_ToFloat", show x, toSFloat sRNE (literal x), literal (fp2fp x)) | x <- ds ] ++ map cvtTest [("toFP_Integer_ToFloat", show x, toSFloat sRNE (literal x), fromRational (toRational x)) | x <- iUBs] ++ map cvtTest [("toFP_Real_ToFloat", show x, toSFloat sRNE (literal x), fromRational (toRational x)) | x <- rs ] ++ map cvtTest [("toFP_Int8_ToDouble", show x, toSDouble sRNE (literal x), fromRational (toRational x)) | x <- i8s ] ++ map cvtTest [("toFP_Int16_ToDouble", show x, toSDouble sRNE (literal x), fromRational (toRational x)) | x <- i16s] ++ map cvtTest [("toFP_Int32_ToDouble", show x, toSDouble sRNE (literal x), fromRational (toRational x)) | x <- i32s] ++ map cvtTest [("toFP_Int64_ToDouble", show x, toSDouble sRNE (literal x), fromRational (toRational x)) | x <- i64s] ++ map cvtTest [("toFP_Word8_ToDouble", show x, toSDouble sRNE (literal x), fromRational (toRational x)) | x <- w8s ] ++ map cvtTest [("toFP_Word16_ToDouble", show x, toSDouble sRNE (literal x), fromRational (toRational x)) | x <- w16s] ++ map cvtTest [("toFP_Word32_ToDouble", show x, toSDouble sRNE (literal x), fromRational (toRational x)) | x <- w32s] ++ map cvtTest [("toFP_Word64_ToDouble", show x, toSDouble sRNE (literal x), fromRational (toRational x)) | x <- w64s] ++ map cvtTest [("toFP_Float_ToDouble", show x, toSDouble sRNE (literal x), literal (fp2fp x)) | x <- fs ] ++ map cvtTest [("toFP_Double_ToDouble", show x, toSDouble sRNE (literal x), literal x) | x <- ds ] ++ map cvtTest [("toFP_Integer_ToDouble", show x, toSDouble sRNE (literal x), fromRational (toRational x)) | x <- iUBs] ++ map cvtTest [("toFP_Real_ToDouble", show x, toSDouble sRNE (literal x), fromRational (toRational x)) | x <- rs ] ++ map cvtTestI [("fromFP_Float_ToInt8", show x, (fromSFloat sRNE :: SFloat -> SInt8) (literal x), ((fromIntegral :: Integer -> SInt8) . fpRound0) x) | x <- fs] ++ map cvtTestI [("fromFP_Float_ToInt16", show x, (fromSFloat sRNE :: SFloat -> SInt16) (literal x), ((fromIntegral :: Integer -> SInt16) . fpRound0) x) | x <- fs] ++ map cvtTestI [("fromFP_Float_ToInt32", show x, (fromSFloat sRNE :: SFloat -> SInt32) (literal x), ((fromIntegral :: Integer -> SInt32) . fpRound0) x) | x <- fs] ++ map cvtTestI [("fromFP_Float_ToInt64", show x, (fromSFloat sRNE :: SFloat -> SInt64) (literal x), ((fromIntegral :: Integer -> SInt64) . fpRound0) x) | x <- fs] ++ map cvtTestI [("fromFP_Float_ToWord8", show x, (fromSFloat sRNE :: SFloat -> SWord8) (literal x), ((fromIntegral :: Integer -> SWord8) . fpRound0) x) | x <- fs] ++ map cvtTestI [("fromFP_Float_ToWord16", show x, (fromSFloat sRNE :: SFloat -> SWord16) (literal x), ((fromIntegral :: Integer -> SWord16) . fpRound0) x) | x <- fs] ++ map cvtTestI [("fromFP_Float_ToWord32", show x, (fromSFloat sRNE :: SFloat -> SWord32) (literal x), ((fromIntegral :: Integer -> SWord32) . fpRound0) x) | x <- fs] ++ map cvtTestI [("fromFP_Float_ToWord64", show x, (fromSFloat sRNE :: SFloat -> SWord64) (literal x), ((fromIntegral :: Integer -> SWord64) . fpRound0) x) | x <- fs] ++ map cvtTest [("fromFP_Float_ToFloat", show x, (fromSFloat sRNE :: SFloat -> SFloat) (literal x), literal x) | x <- fs] ++ map cvtTest [("fromFP_Float_ToDouble", show x, (fromSFloat sRNE :: SFloat -> SDouble) (literal x), (literal . fp2fp) x) | x <- fs] ++ map cvtTestI [("fromFP_Float_ToInteger", show x, (fromSFloat sRNE :: SFloat -> SInteger) (literal x), ((fromIntegral :: Integer -> SInteger) . fpRound0) x) | x <- fs] ++ map cvtTestI [("fromFP_Float_ToReal", show x, (fromSFloat sRNE :: SFloat -> SReal) (literal x), (fromRational . fpRatio0) x) | x <- fs] ++ map cvtTestI [("fromFP_Double_ToInt8", show x, (fromSDouble sRNE :: SDouble -> SInt8) (literal x), ((fromIntegral :: Integer -> SInt8) . fpRound0) x) | x <- ds] ++ map cvtTestI [("fromFP_Double_ToInt16", show x, (fromSDouble sRNE :: SDouble -> SInt16) (literal x), ((fromIntegral :: Integer -> SInt16) . fpRound0) x) | x <- ds] ++ map cvtTestI [("fromFP_Double_ToInt32", show x, (fromSDouble sRNE :: SDouble -> SInt32) (literal x), ((fromIntegral :: Integer -> SInt32) . fpRound0) x) | x <- ds] ++ map cvtTestI [("fromFP_Double_ToInt64", show x, (fromSDouble sRNE :: SDouble -> SInt64) (literal x), ((fromIntegral :: Integer -> SInt64) . fpRound0) x) | x <- ds] ++ map cvtTestI [("fromFP_Double_ToWord8", show x, (fromSDouble sRNE :: SDouble -> SWord8) (literal x), ((fromIntegral :: Integer -> SWord8) . fpRound0) x) | x <- ds] ++ map cvtTestI [("fromFP_Double_ToWord16", show x, (fromSDouble sRNE :: SDouble -> SWord16) (literal x), ((fromIntegral :: Integer -> SWord16) . fpRound0) x) | x <- ds] ++ map cvtTestI [("fromFP_Double_ToWord32", show x, (fromSDouble sRNE :: SDouble -> SWord32) (literal x), ((fromIntegral :: Integer -> SWord32) . fpRound0) x) | x <- ds] ++ map cvtTestI [("fromFP_Double_ToWord64", show x, (fromSDouble sRNE :: SDouble -> SWord64) (literal x), ((fromIntegral :: Integer -> SWord64) . fpRound0) x) | x <- ds] ++ map cvtTest [("fromFP_Double_ToFloat", show x, (fromSDouble sRNE :: SDouble -> SFloat) (literal x), (literal . fp2fp) x) | x <- ds] ++ map cvtTest [("fromFP_Double_ToDouble", show x, (fromSDouble sRNE :: SDouble -> SDouble) (literal x), literal x) | x <- ds] ++ map cvtTestI [("fromFP_Double_ToInteger", show x, (fromSDouble sRNE :: SDouble -> SInteger) (literal x), ((fromIntegral :: Integer -> SInteger) . fpRound0) x) | x <- ds] ++ map cvtTestI [("fromFP_Double_ToReal", show x, (fromSDouble sRNE :: SDouble -> SReal) (literal x), (fromRational . fpRatio0) x) | x <- ds] ++ map cvtTest [("reinterp_Word32_Float", show x, sWord32AsSFloat (literal x), literal (CN.wordToFloat x)) | x <- w32s] ++ map cvtTest [("reinterp_Word64_Double", show x, sWord64AsSDouble (literal x), literal (CN.wordToDouble x)) | x <- w64s] ++ map cvtTestI [("reinterp_Float_Word32", show x, sFloatAsSWord32 (literal x), literal (CN.floatToWord x)) | x <- fs, not (isNaN x)] -- Not unique for NaN ++ map cvtTestI [("reinterp_Double_Word64", show x, sDoubleAsSWord64 (literal x), literal (CN.doubleToWord x)) | x <- ds, not (isNaN x)] -- Not unique for NaN floatRun1 nm f g cmb = map (nm,) [cmb (x, f x, extract (g (literal x))) | x <- fs] doubleRun1 nm f g cmb = map (nm,) [cmb (x, f x, extract (g (literal x))) | x <- ds] floatRun1M nm f g cmb = map (nm,) [cmb (x, f x, extract (g sRNE (literal x))) | x <- fs] doubleRun1M nm f g cmb = map (nm,) [cmb (x, f x, extract (g sRNE (literal x))) | x <- ds] floatRun2 nm f g cmb = map (nm,) [cmb (x, y, f x y, extract (g (literal x) (literal y))) | x <- fs, y <- fs] doubleRun2 nm f g cmb = map (nm,) [cmb (x, y, f x y, extract (g (literal x) (literal y))) | x <- ds, y <- ds] floatRun2M nm f g cmb = map (nm,) [cmb (x, y, f x y, extract (g sRNE (literal x) (literal y))) | x <- fs, y <- fs] doubleRun2M nm f g cmb = map (nm,) [cmb (x, y, f x y, extract (g sRNE (literal x) (literal y))) | x <- ds, y <- ds] floatRunMM nm f g cmb = map (nm,) [cmb (x, y, f x y, extract (g (literal x) (literal y))) | x <- fs, y <- fs, not (alt0 x y || alt0 y x)] doubleRunMM nm f g cmb = map (nm,) [cmb (x, y, f x y, extract (g (literal x) (literal y))) | x <- ds, y <- ds, not (alt0 x y || alt0 y x)] -- fpMin/fpMax: skip +0/-0 case as this is underspecified alt0 x y = isNegativeZero x && y == 0 && not (isNegativeZero y) uTests = map mkTest1 $ concatMap (checkPred fs sfs) predicates ++ concatMap (checkPred ds sds) predicates extract :: SymWord a => SBV a -> a extract = fromJust . unliteral comb (x, y, a, b) = (show x, show y, same a b) combB (x, y, a, b) = (show x, show y, checkNaN f x y a b) where f v w = not (v || w) -- All comparisons except /=: Both should be False if we have a NaN argument combN (x, y, a, b) = (show x, show y, checkNaN f x y a b) where f v w = v && w -- /=: Both should be True combE (x, y, a, b) = (show x, show y, a == b) comb1 (x, a, b) = (show x, same a b) same a b = (isNaN a &&& isNaN b) || (a == b) checkNaN f x y a b | isNaN x || isNaN y = f a b | True = a == b cvtTest (nm, x, a, b) = testCase ("arithCF-" ++ nm ++ "." ++ x) (same (extract a) (extract b) `showsAs` "True") cvtTestI (nm, x, a, b) = testCase ("arithCF-" ++ nm ++ "." ++ x) ((a .== b) `showsAs` "True") mkTest1 (nm, (x, s)) = testCase ("arithCF-" ++ nm ++ "." ++ x) (s `showsAs` "True") mkTest2 (nm, (x, y, s)) = testCase ("arithCF-" ++ nm ++ "." ++ x ++ "_" ++ y) (s `showsAs` "True") checkPred :: Show a => [a] -> [SBV a] -> (String, SBV a -> SBool, a -> Bool) -> [(String, (String, Bool))] checkPred xs sxs (n, ps, p) = zipWith (chk n) (map (\x -> (x, p x)) xs) (map ps sxs) where chk nm (x, v) sv = (nm, (show x, Just v == unliteral sv)) predicates :: IEEEFloating a => [(String, SBV a -> SBool, a -> Bool)] predicates = [ ("fpIsNormal", fpIsNormal, fpIsNormalizedH) , ("fpIsSubnormal", fpIsSubnormal, isDenormalized) , ("fpIsZero", fpIsZero, (== 0)) , ("fpIsInfinite", fpIsInfinite, isInfinite) , ("fpIsNaN", fpIsNaN, isNaN) , ("fpIsNegative", fpIsNegative, \x -> x < 0 || isNegativeZero x) , ("fpIsPositive", fpIsPositive, \x -> x >= 0 && not (isNegativeZero x)) , ("fpIsNegativeZero", fpIsNegativeZero, isNegativeZero) , ("fpIsPositiveZero", fpIsPositiveZero, \x -> x == 0 && not (isNegativeZero x)) , ("fpIsPoint", fpIsPoint, \x -> not (isNaN x || isInfinite x)) ] genChars :: [TestTree] genChars = map mkTest $ [("ord", show c, check SC.ord cord c) | c <- cs] ++ [("toLower", show c, check SC.toLower C.toLower c) | c <- cs] ++ [("toUpper", show c, check SC.toUpper C.toUpper c) | c <- cs, toUpperExceptions c] ++ [("digitToInt", show c, check SC.digitToInt dig2Int c) | c <- cs, digitToIntRange c] ++ [("intToDigit", show c, check SC.intToDigit int2Dig c) | c <- [0 .. 15]] ++ [("isControl", show c, check SC.isControl C.isControl c) | c <- cs] ++ [("isSpace", show c, check SC.isSpace C.isSpace c) | c <- cs] ++ [("isLower", show c, check SC.isLower C.isLower c) | c <- cs] ++ [("isUpper", show c, check SC.isUpper C.isUpper c) | c <- cs] ++ [("isAlpha", show c, check SC.isAlpha C.isAlpha c) | c <- cs] ++ [("isAlphaNum", show c, check SC.isAlphaNum C.isAlphaNum c) | c <- cs] ++ [("isPrint", show c, check SC.isPrint C.isPrint c) | c <- cs] ++ [("isDigit", show c, check SC.isDigit C.isDigit c) | c <- cs] ++ [("isOctDigit", show c, check SC.isOctDigit C.isOctDigit c) | c <- cs] ++ [("isHexDigit", show c, check SC.isHexDigit C.isHexDigit c) | c <- cs] ++ [("isLetter", show c, check SC.isLetter C.isLetter c) | c <- cs] ++ [("isMark", show c, check SC.isMark C.isMark c) | c <- cs] ++ [("isNumber", show c, check SC.isNumber C.isNumber c) | c <- cs] ++ [("isPunctuation", show c, check SC.isPunctuation C.isPunctuation c) | c <- cs] ++ [("isSymbol", show c, check SC.isSymbol C.isSymbol c) | c <- cs] ++ [("isSeparator", show c, check SC.isSeparator C.isSeparator c) | c <- cs] ++ [("isAscii", show c, check SC.isAscii C.isAscii c) | c <- cs] ++ [("isLatin1", show c, check SC.isLatin1 C.isLatin1 c) | c <- cs] ++ [("isAsciiUpper", show c, check SC.isAsciiUpper C.isAsciiUpper c) | c <- cs] ++ [("isAsciiLower", show c, check SC.isAsciiLower C.isAsciiLower c) | c <- cs] where toUpperExceptions = (`notElem` "\181\255") digitToIntRange = (`elem` "0123456789abcdefABCDEF") cord :: Char -> Integer cord = fromIntegral . C.ord dig2Int :: Char -> Integer dig2Int = fromIntegral . C.digitToInt int2Dig :: Integer -> Char int2Dig = C.intToDigit . fromIntegral mkTest (nm, x, t) = testCase ("genChars-" ++ nm ++ "." ++ x) (assert t) check sop cop arg = case unliteral (sop (literal arg)) of Nothing -> False Just x -> x == cop arg genStrings :: [TestTree] genStrings = map mkTest1 ( [("length", show s, check1 SS.length strLen s ) | s <- ss ] ++ [("null", show s, check1 SS.null null s ) | s <- ss ] ++ [("head", show s, check1 SS.head head s ) | s <- ss, not (null s) ] ++ [("tail", show s, check1 SS.tail tail s ) | s <- ss, not (null s) ] ++ [("singleton", show c, check1 SS.singleton (: []) c ) | c <- cs ] ++ [("implode", show s, checkI SS.implode s ) | s <- ss ] ++ [("strToNat", show s, check1 SS.strToNat strToNat s ) | s <- ss ] ++ [("natToStr", show i, check1 SS.natToStr natToStr i ) | i <- iUBs ]) ++ map mkTest2 ( [("strToStrAt", show s, show i, check2 SS.strToStrAt strToStrAt s i ) | s <- ss, i <- range s ] ++ [("strToCharAt", show s, show i, check2 SS.strToCharAt strToCharAt s i ) | s <- ss, i <- range s ] ++ [("concat", show s, show s1, check2 SS.concat (++) s s1 ) | s <- ss, s1 <- ss ] ++ [("isInfixOf", show s, show s1, check2 SS.isInfixOf isInfixOf s s1 ) | s <- ss, s1 <- ss ] ++ [("isSuffixOf", show s, show s1, check2 SS.isSuffixOf isSuffixOf s s1 ) | s <- ss, s1 <- ss ] ++ [("isPrefixOf", show s, show s1, check2 SS.isPrefixOf isPrefixOf s s1 ) | s <- ss, s1 <- ss ] ++ [("take", show s, show i, check2 SS.take genericTake i s ) | s <- ss, i <- iUBs ] ++ [("drop", show s, show i, check2 SS.drop genericDrop i s ) | s <- ss, i <- iUBs ] ++ [("indexOf", show s, show s1, check2 SS.indexOf indexOf s s1 ) | s <- ss, s1 <- ss ]) ++ map mkTest3 ( [("subStr", show s, show i, show j, check3 SS.subStr subStr s i j ) | s <- ss, i <- range s, j <- range s, i + j <= genericLength s] ++ [("replace", show s, show s1, show s2, check3 SS.replace replace s s1 s2) | s <- ss, s1 <- ss, s2 <- ss ] ++ [("offsetIndexOf", show s, show s1, show i, check3 SS.offsetIndexOf offsetIndexOf s s1 i ) | s <- ss, s1 <- ss, i <- range s ]) where strLen :: String -> Integer strLen = fromIntegral . length strToNat :: String -> Integer strToNat s | all C.isDigit s && not (null s) = read s | True = -1 natToStr :: Integer -> String natToStr i | i >= 0 = show i | True = "" range :: String -> [Integer] range s = map fromIntegral [0 .. length s - 1] indexOf :: String -> String -> Integer indexOf s1 s2 = go 0 s1 where go i x | s2 `isPrefixOf` x = i | True = case x of "" -> -1 (_:r) -> go (i+1) r strToStrAt :: String -> Integer -> String s `strToStrAt` i = [s `strToCharAt` i] strToCharAt :: String -> Integer -> Char s `strToCharAt` i = s `genericIndex` i subStr :: String -> Integer -> Integer -> String subStr s i j = genericTake j (genericDrop i s) replace :: String -> String -> String -> String replace s "" y = y ++ s replace s x y = go s where go "" = "" go h@(c:rest) | x `isPrefixOf` h = y ++ drop (length x) h | True = c : go rest offsetIndexOf :: String -> String -> Integer -> Integer offsetIndexOf x y i = case indexOf (genericDrop i x) y of -1 -> -1 r -> r+i mkTest1 (nm, x, t) = testCase ("genStrings-" ++ nm ++ "." ++ x) (assert t) mkTest2 (nm, x, y, t) = testCase ("genStrings-" ++ nm ++ "." ++ x ++ "_" ++ y) (assert t) mkTest3 (nm, x, y, z, t) = testCase ("genStrings-" ++ nm ++ "." ++ x ++ "_" ++ y ++ "_" ++ z) (assert t) checkI sop s = case unliteral (sop (map literal s)) of Nothing -> False Just x -> s == x check1 sop cop arg = case unliteral (sop (literal arg)) of Nothing -> False Just x -> x == cop arg check2 sop cop arg1 arg2 = case unliteral (sop (literal arg1) (literal arg2)) of Nothing -> False Just x -> x == cop arg1 arg2 check3 sop cop arg1 arg2 arg3 = case unliteral (sop (literal arg1) (literal arg2) (literal arg3)) of Nothing -> False Just x -> x == cop arg1 arg2 arg3 genLists :: [TestTree] genLists = map mkTest1 ( [("length", show l, check1 SL.length llen l ) | l <- sl ] ++ [("null", show l, check1 SL.null null l ) | l <- sl ] ++ [("head", show l, check1 SL.head head l ) | l <- sl, not (null l) ] ++ [("tail", show l, check1 SL.tail tail l ) | l <- sl, not (null l) ] ++ [("singleton", show i, check1 SL.singleton (: []) i ) | i <- iUBs ] ++ [("implode", show l, checkI SL.implode id l ) | l <- sl ]) ++ map mkTest2 ( [("listToListAt", show l, show i, check2 SL.listToListAt listToListAt l i ) | l <- sl, i <- range l ] ++ [("elemAt", show l, show i, check2 SL.elemAt elemAt l i ) | l <- sl, i <- range l ] ++ [("concat", show l, show l1, check2 SL.concat (++) l l1 ) | l <- sl, l1 <- sl ] ++ [("isInfixOf", show l, show l1, check2 SL.isInfixOf isInfixOf l l1 ) | l <- sl, l1 <- sl ] ++ [("isSuffixOf", show l, show l1, check2 SL.isSuffixOf isSuffixOf l l1 ) | l <- sl, l1 <- sl ] ++ [("isPrefixOf", show l, show l1, check2 SL.isPrefixOf isPrefixOf l l1 ) | l <- sl, l1 <- sl ] ++ [("take", show l, show i, check2 SL.take genericTake i l ) | l <- sl, i <- iUBs ] ++ [("drop", show l, show i, check2 SL.drop genericDrop i l ) | l <- sl, i <- iUBs ] ++ [("indexOf", show l, show l1, check2 SL.indexOf indexOf l l1 ) | l <- sl, l1 <- sl ]) ++ map mkTest3 ( [("subList", show l, show i, show j, check3 SL.subList subList l i j ) | l <- sl, i <- range l, j <- range l, i + j <= genericLength l] ++ [("replace", show l, show l1, show l2, check3 SL.replace replace l l1 l2) | l <- sl, l1 <- sl, l2 <- sl ] ++ [("offsetIndexOf", show l, show l1, show i, check3 SL.offsetIndexOf offsetIndexOf l l1 i ) | l <- sl, l1 <- sl, i <- range l ]) where llen :: [Integer] -> Integer llen = fromIntegral . length range :: [Integer] -> [Integer] range l = map fromIntegral [0 .. length l - 1] indexOf :: [Integer] -> [Integer] -> Integer indexOf s1 s2 = go 0 s1 where go i x | s2 `isPrefixOf` x = i | True = case x of [] -> -1 (_:r) -> go (i+1) r listToListAt :: [Integer] -> Integer -> [Integer] s `listToListAt` i = [s `elemAt` i] elemAt :: [Integer] -> Integer -> Integer l `elemAt` i = l `genericIndex` i subList :: [Integer] -> Integer -> Integer -> [Integer] subList s i j = genericTake j (genericDrop i s) replace :: [Integer] -> [Integer] -> [Integer] -> [Integer] replace s [] y = y ++ s replace s x y = go s where go [] = [] go h@(c:rest) | x `isPrefixOf` h = y ++ drop (length x) h | True = c : go rest offsetIndexOf :: [Integer] -> [Integer] -> Integer -> Integer offsetIndexOf x y i = case indexOf (genericDrop i x) y of -1 -> -1 r -> r+i mkTest1 (nm, x, t) = testCase ("genLists-" ++ nm ++ "." ++ x) (assert t) mkTest2 (nm, x, y, t) = testCase ("genLists-" ++ nm ++ "." ++ x ++ "_" ++ y) (assert t) mkTest3 (nm, x, y, z, t) = testCase ("genLists-" ++ nm ++ "." ++ x ++ "_" ++ y ++ "_" ++ z) (assert t) checkI sop cop arg = case unliteral (sop (map literal arg)) of Nothing -> False Just x -> x == cop arg check1 sop cop arg = case unliteral (sop (literal arg)) of Nothing -> False Just x -> x == cop arg check2 sop cop arg1 arg2 = case unliteral (sop (literal arg1) (literal arg2)) of Nothing -> False Just x -> x == cop arg1 arg2 check3 sop cop arg1 arg2 arg3 = case unliteral (sop (literal arg1) (literal arg2) (literal arg3)) of Nothing -> False Just x -> x == cop arg1 arg2 arg3 -- Concrete test data xsUnsigned :: (Num a, Bounded a) => [a] xsUnsigned = take 5 (iterate (1+) minBound) ++ take 5 (iterate (\x -> x-1) maxBound) xsSigned :: (Num a, Enum a, Bounded a) => [a] xsSigned = xsUnsigned ++ [-5 .. 5] w8s :: [Word8] w8s = xsUnsigned sw8s :: [SWord8] sw8s = xsUnsigned w16s :: [Word16] w16s = xsUnsigned sw16s :: [SWord16] sw16s = xsUnsigned w32s :: [Word32] w32s = xsUnsigned sw32s :: [SWord32] sw32s = xsUnsigned w64s :: [Word64] w64s = xsUnsigned sw64s :: [SWord64] sw64s = xsUnsigned i8s :: [Int8] i8s = xsSigned si8s :: [SInt8] si8s = xsSigned i16s :: [Int16] i16s = xsSigned si16s :: [SInt16] si16s = xsSigned i32s :: [Int32] i32s = xsSigned si32s :: [SInt32] si32s = xsSigned i64s :: [Int64] i64s = xsSigned si64s :: [SInt64] si64s = xsSigned iUBs :: [Integer] iUBs = [-1000000 .. -999995] ++ [-5 .. 5] ++ [999995 .. 1000000] siUBs :: [SInteger] siUBs = map literal iUBs rs :: [AlgReal] rs = [fromRational (i % d) | i <- nums, d <- dens] where nums = [-1000000 .. -999998] ++ [-2 .. 2] ++ [999998 .. 1000001] dens = [2 .. 5] ++ [98 .. 102] ++ [999998 .. 1000000] srs :: [SReal] srs = map literal rs fs :: [Float] fs = xs ++ map (* (-1)) (filter (not . isNaN) xs) -- -nan is the same as nan where xs = [nan, infinity, 0, 0.5, 0.68302244, 0.5268265, 0.10283524, 5.8336496e-2, 1.0e-45] sfs :: [SFloat] sfs = map literal fs ds :: [Double] ds = xs ++ map (* (-1)) (filter (not . isNaN) xs) -- -nan is the same as nan where xs = [nan, infinity, 0, 0.5, 2.516632060108026e-2, 0.8601891300751106, 7.518897767550192e-2, 1.1656043286207285e-2, 5.0e-324] sds :: [SDouble] sds = map literal ds -- Currently we test over all latin-1 characters. But when Unicode comes along, we'll have to be more selective. cs :: String cs = map C.chr [0..255] -- For pair character ops, just take a subset iCs :: String iCs = map C.chr $ [0..5] ++ [98..102] ++ [250..255] siCs :: [SChar] siCs = map literal iCs -- Ditto for strings, just a few things ss :: [String] ss = ["", "palTRY", "teSTing", "SBV", "sTRIngs", "123", "surely", "thIS", "hI", "ly", "0"] sss :: [SString] sss = map literal ss -- Lists are the worst in coverage! sl :: [[Integer]] sl = [[], [0], [-1, 1], [-10, 0, 10], [3, 4, 5, 4, 5, 3]] -- Lists are the worst in coverage! ssl :: [SList Integer] ssl = map literal sl {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/SBVTestSuite/TestSuite/Basics/ArithSolver.hs0000644000000000000000000016343113405536617020705 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.ArithSolver -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for basic non-concrete arithmetic, i.e., testing all -- basic arithmetic reasoning using an SMT solver without any -- constant folding. ----------------------------------------------------------------------------- {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Basics.ArithSolver(tests) where import qualified Data.Numbers.CrackNum as RC (wordToFloat, wordToDouble, floatToWord, doubleToWord) import Data.SBV.Internals import Utils.SBVTestFramework import Data.List (genericIndex, isInfixOf, isPrefixOf, isSuffixOf, genericTake, genericDrop, genericLength) import qualified Data.Char as C import qualified Data.SBV.Char as SC import qualified Data.SBV.String as SS import qualified Data.SBV.List as SL -- Test suite tests :: TestTree tests = testGroup "Basics.ArithSolver" ( genReals ++ genFloats ++ genDoubles ++ genFPConverts ++ genQRems ++ genBinTest True "+" (+) ++ genBinTest True "-" (-) ++ genBinTest True "*" (*) ++ genUnTest True "negate" negate ++ genUnTest True "abs" abs ++ genUnTest True "signum" signum ++ genBinTest False ".&." (.&.) ++ genBinTest False ".|." (.|.) ++ genBoolTest "<" (<) (.<) ++ genBoolTest "<=" (<=) (.<=) ++ genBoolTest ">" (>) (.>) ++ genBoolTest ">=" (>=) (.>=) ++ genBoolTest "==" (==) (.==) ++ genBoolTest "/=" (/=) (./=) ++ genBinTest False "xor" xor ++ genUnTest False "complement" complement ++ genIntTest False "setBit" setBit ++ genIntTest False "clearBit" clearBit ++ genIntTest False "complementBit" complementBit ++ genIntTest True "shift" shift ++ genIntTest True "shiftL" shiftL ++ genIntTest True "shiftR" shiftR ++ genIntTest True "rotate" rotate ++ genIntTest True "rotateL" rotateL ++ genIntTest True "rotateR" rotateR ++ genShiftRotTest "shiftL_gen" sShiftLeft ++ genShiftRotTest "shiftR_gen" sShiftRight ++ genShiftRotTest "rotateL_gen" sRotateLeft ++ genShiftRotTest "rotateR_gen" sRotateRight ++ genShiftMixSize ++ genBlasts ++ genCounts ++ genIntCasts ++ genChars ++ genStrings ++ genLists ) genBinTest :: Bool -> String -> (forall a. (Num a, Bits a) => a -> a -> a) -> [TestTree] genBinTest unboundedOK nm op = map mkTest $ [(show x, show y, mkThm2 x y (x `op` y)) | x <- w8s, y <- w8s ] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- w16s, y <- w16s] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- w32s, y <- w32s] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- w64s, y <- w64s] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- i8s, y <- i8s ] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- i16s, y <- i16s] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- i32s, y <- i32s] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- i64s, y <- i64s] ++ [(show x, show y, mkThm2 x y (x `op` y)) | unboundedOK, x <- iUBs, y <- iUBs] where mkTest (x, y, t) = testCase ("genBinTest.arithmetic-" ++ nm ++ "." ++ x ++ "_" ++ y) (assert t) mkThm2 x y r = isTheorem $ do [a, b] <- mapM free ["x", "y"] constrain $ a .== literal x constrain $ b .== literal y return $ literal r .== a `op` b genBoolTest :: String -> (forall a. Ord a => a -> a -> Bool) -> (forall a. OrdSymbolic a => a -> a -> SBool) -> [TestTree] genBoolTest nm op opS = map mkTest $ [(show x, show y, mkThm2 x y (x `op` y)) | x <- w8s, y <- w8s ] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- w16s, y <- w16s ] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- w32s, y <- w32s ] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- w64s, y <- w64s ] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- i8s, y <- i8s ] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- i16s, y <- i16s ] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- i32s, y <- i32s ] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- i64s, y <- i64s ] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- iUBs, y <- iUBs ] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- reducedCS, y <- reducedCS ] ++ [(show x, show y, mkThm2 x y (x `op` y)) | x <- ss, y <- ss, nm `elem` allowedStringComps] ++ [(show x, show y, mkThm2L x y (x `op` y)) | x <- sl, y <- sl, nm `elem` allowedListComps ] where -- Currently Z3 doesn't allow for string/list comparisons, so only test equals and distinct -- See: http://github.com/LeventErkok/sbv/issues/368 for tracking issue. allowedStringComps = ["==", "/="] allowedListComps = ["==", "/="] mkTest (x, y, t) = testCase ("genBoolTest.arithmetic-" ++ nm ++ "." ++ x ++ "_" ++ y) (assert t) mkThm2 x y r = isTheorem $ do [a, b] <- mapM free ["x", "y"] constrain $ a .== literal x constrain $ b .== literal y return $ literal r .== a `opS` b mkThm2L x y r = isTheorem $ do [a, b :: SList Integer] <- mapM free ["x", "y"] constrain $ a .== literal x constrain $ b .== literal y return $ literal r .== a `opS` b genUnTest :: Bool -> String -> (forall a. (Num a, Bits a) => a -> a) -> [TestTree] genUnTest unboundedOK nm op = map mkTest $ [(show x, mkThm x (op x)) | x <- w8s ] ++ [(show x, mkThm x (op x)) | x <- w16s] ++ [(show x, mkThm x (op x)) | x <- w32s] ++ [(show x, mkThm x (op x)) | x <- w64s] ++ [(show x, mkThm x (op x)) | x <- i8s ] ++ [(show x, mkThm x (op x)) | x <- i16s] ++ [(show x, mkThm x (op x)) | x <- i32s] ++ [(show x, mkThm x (op x)) | x <- i64s] ++ [(show x, mkThm x (op x)) | unboundedOK, x <- iUBs] where mkTest (x, t) = testCase ("genUnTest.arithmetic-" ++ nm ++ "." ++ x) (assert t) mkThm x r = isTheorem $ do a <- free "x" constrain $ a .== literal x return $ literal r .== op a genIntTest :: Bool -> String -> (forall a. (Num a, Bits a) => (a -> Int -> a)) -> [TestTree] genIntTest overSized nm op = map mkTest $ [("u8", show x, show y, mkThm2 x y (x `op` y)) | x <- w8s, y <- is (intSizeOf x)] ++ [("u16", show x, show y, mkThm2 x y (x `op` y)) | x <- w16s, y <- is (intSizeOf x)] ++ [("u32", show x, show y, mkThm2 x y (x `op` y)) | x <- w32s, y <- is (intSizeOf x)] ++ [("u64", show x, show y, mkThm2 x y (x `op` y)) | x <- w64s, y <- is (intSizeOf x)] ++ [("s8", show x, show y, mkThm2 x y (x `op` y)) | x <- i8s, y <- is (intSizeOf x)] ++ [("s16", show x, show y, mkThm2 x y (x `op` y)) | x <- i16s, y <- is (intSizeOf x)] ++ [("s32", show x, show y, mkThm2 x y (x `op` y)) | x <- i32s, y <- is (intSizeOf x)] ++ [("s64", show x, show y, mkThm2 x y (x `op` y)) | x <- i64s, y <- is (intSizeOf x)] -- No size based tests for unbounded integers where is sz = [0 .. sz - 1] ++ extras where extras | overSized = map (sz +) ([0 .. 1] ++ [sz, sz+1]) | True = [] mkTest (l, x, y, t) = testCase ("genIntTest.arithmetic-" ++ nm ++ "." ++ l ++ "_" ++ x ++ "_" ++ y) (assert t) mkThm2 x y r = isTheorem $ do a <- free "x" constrain $ a .== literal x return $ literal r .== a `op` y genShiftRotTest :: String -> (forall a. (SIntegral a, SDivisible (SBV a)) => (SBV a -> SBV a -> SBV a)) -> [TestTree] genShiftRotTest nm op = map mkTest $ [("u8", show x, show y, mkThm2 x (fromIntegral y) (literal x `op` sFromIntegral (literal y))) | x <- w8s, y <- is (intSizeOf x)] ++ [("u16", show x, show y, mkThm2 x (fromIntegral y) (literal x `op` sFromIntegral (literal y))) | x <- w16s, y <- is (intSizeOf x)] ++ [("u32", show x, show y, mkThm2 x (fromIntegral y) (literal x `op` sFromIntegral (literal y))) | x <- w32s, y <- is (intSizeOf x)] ++ [("u64", show x, show y, mkThm2 x (fromIntegral y) (literal x `op` sFromIntegral (literal y))) | x <- w64s, y <- is (intSizeOf x)] ++ [("s8", show x, show y, mkThm2 x (fromIntegral y) (literal x `op` sFromIntegral (literal y))) | x <- i8s, y <- is (intSizeOf x)] ++ [("s16", show x, show y, mkThm2 x (fromIntegral y) (literal x `op` sFromIntegral (literal y))) | x <- i16s, y <- is (intSizeOf x)] ++ [("s32", show x, show y, mkThm2 x (fromIntegral y) (literal x `op` sFromIntegral (literal y))) | x <- i32s, y <- is (intSizeOf x)] ++ [("s64", show x, show y, mkThm2 x (fromIntegral y) (literal x `op` sFromIntegral (literal y))) | x <- i64s, y <- is (intSizeOf x)] -- NB. No generic shift/rotate for SMTLib unbounded integers where is sz = let b :: Word32 b = fromIntegral sz in [0 .. b - 1] ++ [b, b+1, 2*b, 2*b+1] mkTest (l, x, y, t) = testCase ("genShiftRotTest.arithmetic-" ++ nm ++ "." ++ l ++ "_" ++ x ++ "_" ++ y) (assert t) mkThm2 x y sr | Just r <- unliteral sr = isTheorem $ do [a, b] <- mapM free ["x", "y"] constrain $ a .== literal x constrain $ b .== literal y return $ literal r .== a `op` b | True = return False -- A few tests for mixed-size shifts genShiftMixSize :: [TestTree] genShiftMixSize = map mkTest $ [(show x, show y, "shl_w8_w16", mk sShiftLeft x y (x `shiftL` fromIntegral y)) | x <- w8s, y <- yw16s] ++ [(show x, show y, "shr_w8_w16", mk sShiftRight x y (x `shiftR` fromIntegral y)) | x <- w8s, y <- yw16s] ++ [(show x, show y, "shl_w16_w8", mk sShiftLeft x y (x `shiftL` fromIntegral y)) | x <- w16s, y <- w8s] ++ [(show x, show y, "shr_w16_w8", mk sShiftRight x y (x `shiftR` fromIntegral y)) | x <- w16s, y <- w8s] ++ [(show x, show y, "shl_i8_i16", mk sShiftLeft x y (x `shiftL` fromIntegral y)) | x <- i8s, y <- yi16s] ++ [(show x, show y, "shr_i8_i16", mk sShiftRight x y (x `shiftR` fromIntegral y)) | x <- i8s, y <- yi16s] ++ [(show x, show y, "shl_i16_i8", mk sShiftLeft x y (x `shiftL` fromIntegral y)) | x <- i16s, y <- i8s, y >= 0] ++ [(show x, show y, "shr_i16_i8", mk sShiftRight x y (x `shiftR` fromIntegral y)) | x <- i16s, y <- i8s, y >= 0] ++ [(show x, show y, "shl_w8_i16", mk sShiftLeft x y (x `shiftL` fromIntegral y)) | x <- w8s, y <- yi16s] ++ [(show x, show y, "shr_w8_i16", mk sShiftRight x y (x `shiftR` fromIntegral y)) | x <- w8s, y <- yi16s] ++ [(show x, show y, "shl_w16_i8", mk sShiftLeft x y (x `shiftL` fromIntegral y)) | x <- w16s, y <- i8s, y >= 0] ++ [(show x, show y, "shr_w16_i8", mk sShiftRight x y (x `shiftR` fromIntegral y)) | x <- w16s, y <- i8s, y >= 0] ++ [(show x, show y, "shl_i8_w16", mk sShiftLeft x y (x `shiftL` fromIntegral y)) | x <- i8s, y <- yw16s] ++ [(show x, show y, "shr_i8_w16", mk sShiftRight x y (x `shiftR` fromIntegral y)) | x <- i8s, y <- yw16s] ++ [(show x, show y, "shl_i16_w8", mk sShiftLeft x y (x `shiftL` fromIntegral y)) | x <- i16s, y <- w8s] ++ [(show x, show y, "shr_i16_w8", mk sShiftRight x y (x `shiftR` fromIntegral y)) | x <- i16s, y <- w8s] where yi16s :: [Int16] yi16s = [0, 255, 256, 257, maxBound] yw16s :: [Word16] yw16s = [0, 255, 256, 257, maxBound] mkTest (x, y, l, t) = testCase ("genShiftMixSize." ++ l ++ "." ++ x ++ "_" ++ y) (assert t) mk :: (SymWord a, SymWord b) => (SBV a -> SBV b -> SBV a) -> a -> b -> a -> IO Bool mk o x y r = isTheorem $ do a <- free "x" b <- free "y" constrain $ a .== literal x constrain $ b .== literal y return $ literal r .== a `o` b genBlasts :: [TestTree] genBlasts = map mkTest $ [(show x, mkThm fromBitsLE blastLE x) | x <- w8s ] ++ [(show x, mkThm fromBitsBE blastBE x) | x <- w8s ] ++ [(show x, mkThm fromBitsLE blastLE x) | x <- i8s ] ++ [(show x, mkThm fromBitsBE blastBE x) | x <- i8s ] ++ [(show x, mkThm fromBitsLE blastLE x) | x <- w16s] ++ [(show x, mkThm fromBitsBE blastBE x) | x <- w16s] ++ [(show x, mkThm fromBitsLE blastLE x) | x <- i16s] ++ [(show x, mkThm fromBitsBE blastBE x) | x <- i16s] ++ [(show x, mkThm fromBitsLE blastLE x) | x <- w32s] ++ [(show x, mkThm fromBitsBE blastBE x) | x <- w32s] ++ [(show x, mkThm fromBitsLE blastLE x) | x <- i32s] ++ [(show x, mkThm fromBitsBE blastBE x) | x <- i32s] ++ [(show x, mkThm fromBitsLE blastLE x) | x <- w64s] ++ [(show x, mkThm fromBitsBE blastBE x) | x <- w64s] ++ [(show x, mkThm fromBitsLE blastLE x) | x <- i64s] ++ [(show x, mkThm fromBitsBE blastBE x) | x <- i64s] where mkTest (x, t) = testCase ("genBlasts.blast-" ++ show x) (assert t) mkThm from to v = isTheorem $ do a <- free "x" constrain $ a .== literal v return $ a .== from (to a) genCounts :: [TestTree] genCounts = map mkTest $ [(show x, mkThm (fromBitsLE :: [SBool] -> SWord8 ) blastBE x) | x <- w8s ] ++ [(show x, mkThm (fromBitsBE :: [SBool] -> SWord8 ) blastLE x) | x <- w8s ] ++ [(show x, mkThm (fromBitsLE :: [SBool] -> SInt8 ) blastBE x) | x <- i8s ] ++ [(show x, mkThm (fromBitsBE :: [SBool] -> SInt8 ) blastLE x) | x <- i8s ] ++ [(show x, mkThm (fromBitsLE :: [SBool] -> SWord16) blastBE x) | x <- w16s] ++ [(show x, mkThm (fromBitsBE :: [SBool] -> SWord16) blastLE x) | x <- w16s] ++ [(show x, mkThm (fromBitsLE :: [SBool] -> SInt16 ) blastBE x) | x <- i16s] ++ [(show x, mkThm (fromBitsBE :: [SBool] -> SInt16 ) blastLE x) | x <- i16s] ++ [(show x, mkThm (fromBitsLE :: [SBool] -> SWord32) blastBE x) | x <- w32s] ++ [(show x, mkThm (fromBitsBE :: [SBool] -> SWord32) blastLE x) | x <- w32s] ++ [(show x, mkThm (fromBitsLE :: [SBool] -> SInt32 ) blastBE x) | x <- i32s] ++ [(show x, mkThm (fromBitsBE :: [SBool] -> SInt32 ) blastLE x) | x <- i32s] ++ [(show x, mkThm (fromBitsLE :: [SBool] -> SWord64) blastBE x) | x <- w64s] ++ [(show x, mkThm (fromBitsBE :: [SBool] -> SWord64) blastLE x) | x <- w64s] ++ [(show x, mkThm (fromBitsLE :: [SBool] -> SInt64 ) blastBE x) | x <- i64s] ++ [(show x, mkThm (fromBitsBE :: [SBool] -> SInt64 ) blastLE x) | x <- i64s] where mkTest (x, t) = testCase ("genCounts.count-" ++ show x) (assert t) mkThm from to v = isTheorem $ do a <- free "x" constrain $ a .== literal v return $ sCountTrailingZeros a .== sCountLeadingZeros (from (to a)) genIntCasts :: [TestTree] genIntCasts = map mkTest $ cast w8s ++ cast w16s ++ cast w32s ++ cast w64s ++ cast i8s ++ cast i16s ++ cast i32s ++ cast i64s ++ cast iUBs where mkTest (x, t) = testCase ("sIntCast-" ++ x) (assert t) cast :: forall a. (Show a, Integral a, SymWord a) => [a] -> [(String, IO Bool)] cast xs = toWords xs ++ toInts xs toWords xs = [(show x, mkThm x (fromIntegral x :: Word8 )) | x <- xs] ++ [(show x, mkThm x (fromIntegral x :: Word16)) | x <- xs] ++ [(show x, mkThm x (fromIntegral x :: Word32)) | x <- xs] ++ [(show x, mkThm x (fromIntegral x :: Word64)) | x <- xs] toInts xs = [(show x, mkThm x (fromIntegral x :: Int8 )) | x <- xs] ++ [(show x, mkThm x (fromIntegral x :: Int16)) | x <- xs] ++ [(show x, mkThm x (fromIntegral x :: Int32)) | x <- xs] ++ [(show x, mkThm x (fromIntegral x :: Int64)) | x <- xs] ++ [(show x, mkThm x (fromIntegral x :: Integer)) | x <- xs] mkThm v res = isTheorem $ do a <- free "x" constrain $ a .== literal v return $ literal res .== sFromIntegral a genReals :: [TestTree] genReals = map mkTest $ [("+", show x, show y, mkThm2 (+) x y (x + y)) | x <- rs, y <- rs ] ++ [("-", show x, show y, mkThm2 (-) x y (x - y)) | x <- rs, y <- rs ] ++ [("*", show x, show y, mkThm2 (*) x y (x * y)) | x <- rs, y <- rs ] ++ [("/", show x, show y, mkThm2 (/) x y (x / y)) | x <- rs, y <- rs, y /= 0] ++ [("<", show x, show y, mkThm2 (.<) x y (x < y)) | x <- rs, y <- rs ] ++ [("<=", show x, show y, mkThm2 (.<=) x y (x <= y)) | x <- rs, y <- rs ] ++ [(">", show x, show y, mkThm2 (.>) x y (x > y)) | x <- rs, y <- rs ] ++ [(">=", show x, show y, mkThm2 (.>=) x y (x >= y)) | x <- rs, y <- rs ] ++ [("==", show x, show y, mkThm2 (.==) x y (x == y)) | x <- rs, y <- rs ] ++ [("/=", show x, show y, mkThm2 (./=) x y (x /= y)) | x <- rs, y <- rs ] where mkTest (nm, x, y, t) = testCase ("genReals.arithmetic-" ++ nm ++ "." ++ x ++ "_" ++ y) (assert t) mkThm2 op x y r = isTheorem $ do [a, b] <- mapM free ["x", "y"] constrain $ a .== literal x constrain $ b .== literal y return $ literal r .== a `op` b genFloats :: [TestTree] genFloats = genIEEE754 "genFloats" fs genDoubles :: [TestTree] genDoubles = genIEEE754 "genDoubles" ds genIEEE754 :: (IEEEFloating a, Show a) => String -> [a] -> [TestTree] genIEEE754 origin vs = map tst1 [("pred_" ++ nm, x, y) | (nm, x, y) <- preds] ++ map tst1 [("unary_" ++ nm, x, y) | (nm, x, y) <- uns] ++ map tst2 [("binary_" ++ nm, x, y, r) | (nm, x, y, r) <- bins] where uns = [("abs", show x, mkThm1 abs x (abs x)) | x <- vs] ++ [("negate", show x, mkThm1 negate x (negate x)) | x <- vs] ++ [("signum", show x, mkThm1 signum x (signum x)) | x <- vs] ++ [("fpAbs", show x, mkThm1 fpAbs x (abs x)) | x <- vs] ++ [("fpNeg", show x, mkThm1 fpNeg x (negate x)) | x <- vs] ++ [("fpSqrt", show x, mkThm1 (m fpSqrt) x (sqrt x)) | x <- vs] ++ [("fpRoundToIntegral", show x, mkThm1 (m fpRoundToIntegral) x (fpRoundToIntegralH x)) | x <- vs] bins = [("+", show x, show y, mkThm2 (+) x y (x + y)) | x <- vs, y <- vs] ++ [("-", show x, show y, mkThm2 (-) x y (x - y)) | x <- vs, y <- vs] ++ [("*", show x, show y, mkThm2 (*) x y (x * y)) | x <- vs, y <- vs] ++ [("/", show x, show y, mkThm2 (/) x y (x / y)) | x <- vs, y <- vs] ++ [("<", show x, show y, mkThm2C False (.<) x y (x < y)) | x <- vs, y <- vs] ++ [("<=", show x, show y, mkThm2C False (.<=) x y (x <= y)) | x <- vs, y <- vs] ++ [(">", show x, show y, mkThm2C False (.>) x y (x > y)) | x <- vs, y <- vs] ++ [(">=", show x, show y, mkThm2C False (.>=) x y (x >= y)) | x <- vs, y <- vs] ++ [("==", show x, show y, mkThm2C False (.==) x y (x == y)) | x <- vs, y <- vs] ++ [("/=", show x, show y, mkThm2C True (./=) x y (x /= y)) | x <- vs, y <- vs] -- TODO. Can't possibly test fma, unless we FFI out to C. Leave it out for the time being ++ [("fpAdd", show x, show y, mkThm2 (m fpAdd) x y ((+) x y)) | x <- vs, y <- vs] ++ [("fpSub", show x, show y, mkThm2 (m fpSub) x y ((-) x y)) | x <- vs, y <- vs] ++ [("fpMul", show x, show y, mkThm2 (m fpMul) x y ((*) x y)) | x <- vs, y <- vs] ++ [("fpDiv", show x, show y, mkThm2 (m fpDiv) x y ((/) x y)) | x <- vs, y <- vs] ++ [("fpMin", show x, show y, mkThm2 fpMin x y (fpMinH x y)) | x <- vs, y <- vs, not (alt0 x y || alt0 y x)] ++ [("fpMax", show x, show y, mkThm2 fpMax x y (fpMaxH x y)) | x <- vs, y <- vs, not (alt0 x y || alt0 y x)] ++ [("fpIsEqualObject", show x, show y, mkThm2P fpIsEqualObject x y (fpIsEqualObjectH x y)) | x <- vs, y <- vs] ++ [("fpRem", show x, show y, mkThm2 fpRem x y (fpRemH x y)) | x <- vsFPRem, y <- vsFPRem] -- TODO: For doubles fpRem takes too long, so we only do a subset vsFPRem | origin == "genDoubles" = [nan, infinity, 0, 0.5, -infinity, -0, -0.5] | True = vs -- fpMin/fpMax: skip +0/-0 case as this is underspecified alt0 x y = isNegativeZero x && y == 0 && not (isNegativeZero y) m f = f sRNE preds = [(pn, show x, mkThmP ps x (pc x)) | (pn, ps, pc) <- predicates, x <- vs] tst2 (nm, x, y, t) = testCase (origin ++ ".arithmetic-" ++ nm ++ "." ++ x ++ "_" ++ y) (assert t) tst1 (nm, x, t) = testCase (origin ++ ".arithmetic-" ++ nm ++ "." ++ x) (assert t) eqF v val | isNaN val = constrain $ fpIsNaN v | isNegativeZero val = constrain $ fpIsNegativeZero v | val == 0 = constrain $ fpIsPositiveZero v | isInfinite val && val > 0 = constrain $ fpIsInfinite v &&& fpIsPositive v | isInfinite val && val < 0 = constrain $ fpIsInfinite v &&& fpIsNegative v | True = constrain $ v .== literal val -- Quickly pick which solver to use. Currently z3 or mathSAT supports FP fpProver :: SMTConfig fpProver = z3 -- mathSAT fpThm :: Provable a => a -> IO Bool fpThm = isTheoremWith fpProver mkThmP op x r = fpThm $ do a <- free "x" eqF a x return $ literal r .== op a mkThm2P op x y r = fpThm $ do [a, b] <- mapM free ["x", "y"] eqF a x eqF b y return $ literal r .== a `op` b mkThm1 op x r = fpThm $ do a <- free "x" eqF a x return $ literal r `fpIsEqualObject` op a mkThm2 op x y r = fpThm $ do [a, b] <- mapM free ["x", "y"] eqF a x eqF b y return $ literal r `fpIsEqualObject` (a `op` b) mkThm2C neq op x y r = fpThm $ do [a, b] <- mapM free ["x", "y"] eqF a x eqF b y return $ if isNaN x || isNaN y then (if neq then a `op` b else bnot (a `op` b)) else literal r .== a `op` b predicates :: (IEEEFloating a) => [(String, SBV a -> SBool, a -> Bool)] predicates = [ ("fpIsNormal", fpIsNormal, fpIsNormalizedH) , ("fpIsSubnormal", fpIsSubnormal, isDenormalized) , ("fpIsZero", fpIsZero, (== 0)) , ("fpIsInfinite", fpIsInfinite, isInfinite) , ("fpIsNaN", fpIsNaN, isNaN) , ("fpIsNegative", fpIsNegative, \x -> x < 0 || isNegativeZero x) , ("fpIsPositive", fpIsPositive, \x -> x >= 0 && not (isNegativeZero x)) , ("fpIsNegativeZero", fpIsNegativeZero, isNegativeZero) , ("fpIsPositiveZero", fpIsPositiveZero, \x -> x == 0 && not (isNegativeZero x)) , ("fpIsPoint", fpIsPoint, \x -> not (isNaN x || isInfinite x)) ] genFPConverts :: [TestTree] genFPConverts = map tst1 [("fpCast_" ++ nm, x, y) | (nm, x, y) <- converts] where converts = [("toFP_Int8_ToFloat", show x, mkThmC (m toSFloat) x (fromRational (toRational x))) | x <- i8s ] ++ [("toFP_Int16_ToFloat", show x, mkThmC (m toSFloat) x (fromRational (toRational x))) | x <- i16s] ++ [("toFP_Int32_ToFloat", show x, mkThmC (m toSFloat) x (fromRational (toRational x))) | x <- i32s] ++ [("toFP_Int64_ToFloat", show x, mkThmC (m toSFloat) x (fromRational (toRational x))) | x <- i64s] ++ [("toFP_Word8_ToFloat", show x, mkThmC (m toSFloat) x (fromRational (toRational x))) | x <- w8s ] ++ [("toFP_Word16_ToFloat", show x, mkThmC (m toSFloat) x (fromRational (toRational x))) | x <- w16s] ++ [("toFP_Word32_ToFloat", show x, mkThmC (m toSFloat) x (fromRational (toRational x))) | x <- w32s] ++ [("toFP_Word64_ToFloat", show x, mkThmC (m toSFloat) x (fromRational (toRational x))) | x <- w64s] ++ [("toFP_Float_ToFloat", show x, mkThm1 (m toSFloat) x x ) | x <- fs ] ++ [("toFP_Double_ToFloat", show x, mkThm1 (m toSFloat) x ( fp2fp x )) | x <- ds ] ++ [("toFP_Integer_ToFloat", show x, mkThmC (m toSFloat) x (fromRational (toRational x))) | x <- iUBs] ++ [("toFP_Real_ToFloat", show x, mkThmC (m toSFloat) x (fromRational (toRational x))) | x <- rs ] ++ [("toFP_Int8_ToDouble", show x, mkThmC (m toSDouble) x (fromRational (toRational x))) | x <- i8s ] ++ [("toFP_Int16_ToDouble", show x, mkThmC (m toSDouble) x (fromRational (toRational x))) | x <- i16s] ++ [("toFP_Int32_ToDouble", show x, mkThmC (m toSDouble) x (fromRational (toRational x))) | x <- i32s] ++ [("toFP_Int64_ToDouble", show x, mkThmC (m toSDouble) x (fromRational (toRational x))) | x <- i64s] ++ [("toFP_Word8_ToDouble", show x, mkThmC (m toSDouble) x (fromRational (toRational x))) | x <- w8s ] ++ [("toFP_Word16_ToDouble", show x, mkThmC (m toSDouble) x (fromRational (toRational x))) | x <- w16s] ++ [("toFP_Word32_ToDouble", show x, mkThmC (m toSDouble) x (fromRational (toRational x))) | x <- w32s] ++ [("toFP_Word64_ToDouble", show x, mkThmC (m toSDouble) x (fromRational (toRational x))) | x <- w64s] ++ [("toFP_Float_ToDouble", show x, mkThm1 (m toSDouble) x ( fp2fp x )) | x <- fs ] ++ [("toFP_Double_ToDouble", show x, mkThm1 (m toSDouble) x x ) | x <- ds ] ++ [("toFP_Integer_ToDouble", show x, mkThmC (m toSDouble) x (fromRational (toRational x))) | x <- iUBs] ++ [("toFP_Real_ToDouble", show x, mkThmC (m toSDouble) x (fromRational (toRational x))) | x <- rs ] ++ [("fromFP_Float_ToInt8", show x, mkThmC' (m fromSFloat :: SFloat -> SInt8) x (((fromIntegral :: Integer -> Int8) . fpRound0) x)) | x <- fs] ++ [("fromFP_Float_ToInt16", show x, mkThmC' (m fromSFloat :: SFloat -> SInt16) x (((fromIntegral :: Integer -> Int16) . fpRound0) x)) | x <- fs] ++ [("fromFP_Float_ToInt32", show x, mkThmC' (m fromSFloat :: SFloat -> SInt32) x (((fromIntegral :: Integer -> Int32) . fpRound0) x)) | x <- fs] ++ [("fromFP_Float_ToInt64", show x, mkThmC' (m fromSFloat :: SFloat -> SInt64) x (((fromIntegral :: Integer -> Int64) . fpRound0) x)) | x <- fs] ++ [("fromFP_Float_ToWord8", show x, mkThmC' (m fromSFloat :: SFloat -> SWord8) x (((fromIntegral :: Integer -> Word8) . fpRound0) x)) | x <- fs] ++ [("fromFP_Float_ToWord16", show x, mkThmC' (m fromSFloat :: SFloat -> SWord16) x (((fromIntegral :: Integer -> Word16) . fpRound0) x)) | x <- fs] ++ [("fromFP_Float_ToWord32", show x, mkThmC' (m fromSFloat :: SFloat -> SWord32) x (((fromIntegral :: Integer -> Word32) . fpRound0) x)) | x <- fs] ++ [("fromFP_Float_ToWord64", show x, mkThmC' (m fromSFloat :: SFloat -> SWord64) x (((fromIntegral :: Integer -> Word64) . fpRound0) x)) | x <- fs] ++ [("fromFP_Float_ToFloat", show x, mkThm1 (m fromSFloat :: SFloat -> SFloat) x x ) | x <- fs] ++ [("fromFP_Float_ToDouble", show x, mkThm1 (m fromSFloat :: SFloat -> SDouble) x ( fp2fp x)) | x <- fs] -- Neither Z3 nor MathSAT support Float->Integer/Float->Real conversion for the time being; so comment out. -- See GitHub issue: #191 -- ++ [("fromFP_Float_ToInteger", show x, mkThmC' (m fromSFloat :: SFloat -> SInteger) x (((fromIntegral :: Integer -> Integer) . fpRound0) x)) | x <- fs] -- ++ [("fromFP_Float_ToReal", show x, mkThmC' (m fromSFloat :: SFloat -> SReal) x ( (fromRational . fpRatio0) x)) | x <- fs] ++ [("fromFP_Double_ToInt8", show x, mkThmC' (m fromSDouble :: SDouble -> SInt8) x (((fromIntegral :: Integer -> Int8) . fpRound0) x)) | x <- ds] ++ [("fromFP_Double_ToInt16", show x, mkThmC' (m fromSDouble :: SDouble -> SInt16) x (((fromIntegral :: Integer -> Int16) . fpRound0) x)) | x <- ds] ++ [("fromFP_Double_ToInt32", show x, mkThmC' (m fromSDouble :: SDouble -> SInt32) x (((fromIntegral :: Integer -> Int32) . fpRound0) x)) | x <- ds] ++ [("fromFP_Double_ToInt64", show x, mkThmC' (m fromSDouble :: SDouble -> SInt64) x (((fromIntegral :: Integer -> Int64) . fpRound0) x)) | x <- ds] ++ [("fromFP_Double_ToWord8", show x, mkThmC' (m fromSDouble :: SDouble -> SWord8) x (((fromIntegral :: Integer -> Word8) . fpRound0) x)) | x <- ds] ++ [("fromFP_Double_ToWord16", show x, mkThmC' (m fromSDouble :: SDouble -> SWord16) x (((fromIntegral :: Integer -> Word16) . fpRound0) x)) | x <- ds] ++ [("fromFP_Double_ToWord32", show x, mkThmC' (m fromSDouble :: SDouble -> SWord32) x (((fromIntegral :: Integer -> Word32) . fpRound0) x)) | x <- ds] ++ [("fromFP_Double_ToWord64", show x, mkThmC' (m fromSDouble :: SDouble -> SWord64) x (((fromIntegral :: Integer -> Word64) . fpRound0) x)) | x <- ds] ++ [("fromFP_Double_ToFloat", show x, mkThm1 (m fromSDouble :: SDouble -> SFloat) x ( fp2fp x)) | x <- ds] ++ [("fromFP_Double_ToDouble", show x, mkThm1 (m fromSDouble :: SDouble -> SDouble) x x ) | x <- ds] -- Neither Z3 nor MathSAT support Float->Integer/Float->Real conversion for the time being; so comment out. -- See GitHub issue: #191 -- ++ [("fromFP_Double_ToInteger", show x, mkThmC' (m fromSDouble :: SDouble -> SInteger) x (((fromIntegral :: Integer -> Integer) . fpRound0) x)) | x <- ds] -- ++ [("fromFP_Double_ToReal", show x, mkThmC' (m fromSDouble :: SDouble -> SReal) x ( (fromRational . fpRatio0) x)) | x <- ds] ++ [("reinterp_Word32_Float", show x, mkThmC sWord32AsSFloat x (RC.wordToFloat x)) | x <- w32s] ++ [("reinterp_Word64_Double", show x, mkThmC sWord64AsSDouble x (RC.wordToDouble x)) | x <- w64s] ++ [("reinterp_Float_Word32", show x, mkThmP sFloatAsSWord32 x (RC.floatToWord x)) | x <- fs, not (isNaN x)] -- Not unique for NaN ++ [("reinterp_Double_Word64", show x, mkThmP sDoubleAsSWord64 x (RC.doubleToWord x)) | x <- ds, not (isNaN x)] -- Not unique for NaN m f = f sRNE tst1 (nm, x, t) = testCase ("fpConverts.arithmetic-" ++ nm ++ "." ++ x) (assert t) eqF v val | isNaN val = constrain $ fpIsNaN v | isNegativeZero val = constrain $ fpIsNegativeZero v | val == 0 = constrain $ fpIsPositiveZero v | isInfinite val && val > 0 = constrain $ fpIsInfinite v &&& fpIsPositive v | isInfinite val && val < 0 = constrain $ fpIsInfinite v &&& fpIsNegative v | True = constrain $ v .== literal val -- Quickly pick which solver to use. Currently z3 or mathSAT supports FP fpProver :: SMTConfig fpProver = z3 -- mathSAT fpThm :: Provable a => a -> IO Bool fpThm = isTheoremWith fpProver mkThmP op x r = fpThm $ do a <- free "x" eqF a x return $ literal r .== op a mkThm1 op x r = fpThm $ do a <- free "x" eqF a x return $ literal r `fpIsEqualObject` op a mkThmC op x r = fpThm $ do a <- free "x" constrain $ a .== literal x return $ literal r `fpIsEqualObject` op a mkThmC' op x r = fpThm $ do a <- free "x" eqF a x return $ literal r .== op a genQRems :: [TestTree] genQRems = map mkTest $ [("divMod", show x, show y, mkThm2 sDivMod x y (x `divMod'` y)) | x <- w8s, y <- w8s ] ++ [("divMod", show x, show y, mkThm2 sDivMod x y (x `divMod'` y)) | x <- w16s, y <- w16s] ++ [("divMod", show x, show y, mkThm2 sDivMod x y (x `divMod'` y)) | x <- w32s, y <- w32s] ++ [("divMod", show x, show y, mkThm2 sDivMod x y (x `divMod'` y)) | x <- w64s, y <- w64s] ++ [("divMod", show x, show y, mkThm2 sDivMod x y (x `divMod'` y)) | x <- i8s, y <- i8s , noOverflow x y] ++ [("divMod", show x, show y, mkThm2 sDivMod x y (x `divMod'` y)) | x <- i16s, y <- i16s, noOverflow x y] ++ [("divMod", show x, show y, mkThm2 sDivMod x y (x `divMod'` y)) | x <- i32s, y <- i32s, noOverflow x y] ++ [("divMod", show x, show y, mkThm2 sDivMod x y (x `divMod'` y)) | x <- i64s, y <- i64s, noOverflow x y] ++ [("divMod", show x, show y, mkThm2 sDivMod x y (x `divMod'` y)) | x <- iUBs, y <- iUBs] ++ [("quotRem", show x, show y, mkThm2 sQuotRem x y (x `quotRem'` y)) | x <- w8s, y <- w8s ] ++ [("quotRem", show x, show y, mkThm2 sQuotRem x y (x `quotRem'` y)) | x <- w16s, y <- w16s] ++ [("quotRem", show x, show y, mkThm2 sQuotRem x y (x `quotRem'` y)) | x <- w32s, y <- w32s] ++ [("quotRem", show x, show y, mkThm2 sQuotRem x y (x `quotRem'` y)) | x <- w64s, y <- w64s] ++ [("quotRem", show x, show y, mkThm2 sQuotRem x y (x `quotRem'` y)) | x <- i8s, y <- i8s , noOverflow x y] ++ [("quotRem", show x, show y, mkThm2 sQuotRem x y (x `quotRem'` y)) | x <- i16s, y <- i16s, noOverflow x y] ++ [("quotRem", show x, show y, mkThm2 sQuotRem x y (x `quotRem'` y)) | x <- i32s, y <- i32s, noOverflow x y] ++ [("quotRem", show x, show y, mkThm2 sQuotRem x y (x `quotRem'` y)) | x <- i64s, y <- i64s, noOverflow x y] ++ [("quotRem", show x, show y, mkThm2 sQuotRem x y (x `quotRem'` y)) | x <- iUBs, y <- iUBs] where divMod' x y = if y == 0 then (0, x) else x `divMod` y quotRem' x y = if y == 0 then (0, x) else x `quotRem` y mkTest (nm, x, y, t) = testCase ("genQRems.arithmetic-" ++ nm ++ "." ++ x ++ "_" ++ y) (assert t) mkThm2 op x y (e1, e2) = isTheorem $ do [a, b] <- mapM free ["x", "y"] constrain $ a .== literal x constrain $ b .== literal y return $ (literal e1, literal e2) .== a `op` b -- Haskell's divMod and quotRem overflows if x == minBound and y == -1 for signed types; so avoid that case noOverflow x y = not (x == minBound && y == -1) genChars :: [TestTree] genChars = map mkTest $ [("ord", show c, mkThm SC.ord cord c) | c <- cs] ++ [("toLower", show c, mkThm SC.toLower C.toLower c) | c <- cs] ++ [("toUpper", show c, mkThm SC.toUpper C.toUpper c) | c <- cs, toUpperExceptions c] ++ [("digitToInt", show c, mkThm SC.digitToInt dig2Int c) | c <- cs, digitToIntRange c] ++ [("intToDigit", show c, mkThm SC.intToDigit int2Dig c) | c <- [0 .. 15]] ++ [("isControl", show c, mkThm SC.isControl C.isControl c) | c <- cs] ++ [("isSpace", show c, mkThm SC.isSpace C.isSpace c) | c <- cs] ++ [("isLower", show c, mkThm SC.isLower C.isLower c) | c <- cs] ++ [("isUpper", show c, mkThm SC.isUpper C.isUpper c) | c <- cs] ++ [("isAlpha", show c, mkThm SC.isAlpha C.isAlpha c) | c <- cs] ++ [("isAlphaNum", show c, mkThm SC.isAlphaNum C.isAlphaNum c) | c <- cs] ++ [("isPrint", show c, mkThm SC.isPrint C.isPrint c) | c <- cs] ++ [("isDigit", show c, mkThm SC.isDigit C.isDigit c) | c <- cs] ++ [("isOctDigit", show c, mkThm SC.isOctDigit C.isOctDigit c) | c <- cs] ++ [("isHexDigit", show c, mkThm SC.isHexDigit C.isHexDigit c) | c <- cs] ++ [("isLetter", show c, mkThm SC.isLetter C.isLetter c) | c <- cs] ++ [("isMark", show c, mkThm SC.isMark C.isMark c) | c <- cs] ++ [("isNumber", show c, mkThm SC.isNumber C.isNumber c) | c <- cs] ++ [("isPunctuation", show c, mkThm SC.isPunctuation C.isPunctuation c) | c <- cs] ++ [("isSymbol", show c, mkThm SC.isSymbol C.isSymbol c) | c <- cs] ++ [("isSeparator", show c, mkThm SC.isSeparator C.isSeparator c) | c <- cs] ++ [("isAscii", show c, mkThm SC.isAscii C.isAscii c) | c <- cs] ++ [("isLatin1", show c, mkThm SC.isLatin1 C.isLatin1 c) | c <- cs] ++ [("isAsciiUpper", show c, mkThm SC.isAsciiUpper C.isAsciiUpper c) | c <- cs] ++ [("isAsciiLower", show c, mkThm SC.isAsciiLower C.isAsciiLower c) | c <- cs] where toUpperExceptions = (`notElem` "\181\255") digitToIntRange = (`elem` "0123456789abcdefABCDEF") cord :: Char -> Integer cord = fromIntegral . C.ord dig2Int :: Char -> Integer dig2Int = fromIntegral . C.digitToInt int2Dig :: Integer -> Char int2Dig = C.intToDigit . fromIntegral mkTest (nm, x, t) = testCase ("genChars-" ++ nm ++ "." ++ x) (assert t) mkThm sop cop arg = isTheorem $ do a <- free "a" constrain $ a .== literal arg return $ literal (cop arg) .== sop a genStrings :: [TestTree] genStrings = map mkTest1 ( [("length", show s, mkThm1 SS.length strLen s ) | s <- ss ] ++ [("null", show s, mkThm1 SS.null null s ) | s <- ss ] ++ [("head", show s, mkThm1 SS.head head s ) | s <- ss, not (null s) ] ++ [("tail", show s, mkThm1 SS.tail tail s ) | s <- ss, not (null s) ] ++ [("singleton", show c, mkThm1 SS.singleton (: []) c ) | c <- cs ] ++ [("implode", show s, mkThmI SS.implode s ) | s <- ss ] ++ [("strToNat", show s, mkThm1 SS.strToNat strToNat s ) | s <- ss ] ++ [("natToStr", show i, mkThm1 SS.natToStr natToStr i ) | i <- iUBs ]) ++ map mkTest2 ( [("strToStrAt", show s, show i, mkThm2 SS.strToStrAt strToStrAt s i ) | s <- ss, i <- range s ] ++ [("strToCharAt", show s, show i, mkThm2 SS.strToCharAt strToCharAt s i ) | s <- ss, i <- range s ] ++ [("concat", show s, show s1, mkThm2 SS.concat (++) s s1 ) | s <- ss, s1 <- ss ] ++ [("isInfixOf", show s, show s1, mkThm2 SS.isInfixOf isInfixOf s s1 ) | s <- ss, s1 <- ss ] ++ [("isSuffixOf", show s, show s1, mkThm2 SS.isSuffixOf isSuffixOf s s1 ) | s <- ss, s1 <- ss ] ++ [("isPrefixOf", show s, show s1, mkThm2 SS.isPrefixOf isPrefixOf s s1 ) | s <- ss, s1 <- ss ] ++ [("take", show s, show i, mkThm2 SS.take genericTake i s ) | s <- ss, i <- iUBs ] ++ [("drop", show s, show i, mkThm2 SS.drop genericDrop i s ) | s <- ss, i <- iUBs ] ++ [("indexOf", show s, show s1, mkThm2 SS.indexOf indexOf s s1 ) | s <- ss, s1 <- ss ]) ++ map mkTest3 ( [("subStr", show s, show i, show j, mkThm3 SS.subStr subStr s i j ) | s <- ss, i <- range s, j <- range s, i + j <= genericLength s] ++ [("replace", show s, show s1, show s2, mkThm3 SS.replace replace s s1 s2) | s <- ss, s1 <- ss, s2 <- ss ] ++ [("offsetIndexOf", show s, show s1, show i, mkThm3 SS.offsetIndexOf offsetIndexOf s s1 i ) | s <- ss, s1 <- ss, i <- range s ]) where strLen :: String -> Integer strLen = fromIntegral . length strToNat :: String -> Integer strToNat s | all C.isDigit s && not (null s) = read s | True = -1 natToStr :: Integer -> String natToStr i | i >= 0 = show i | True = "" range :: String -> [Integer] range s = map fromIntegral [0 .. length s - 1] indexOf :: String -> String -> Integer indexOf s1 s2 = go 0 s1 where go i x | s2 `isPrefixOf` x = i | True = case x of "" -> -1 (_:r) -> go (i+1) r strToStrAt :: String -> Integer -> String s `strToStrAt` i = [s `strToCharAt` i] strToCharAt :: String -> Integer -> Char s `strToCharAt` i = s `genericIndex` i subStr :: String -> Integer -> Integer -> String subStr s i j = genericTake j (genericDrop i s) replace :: String -> String -> String -> String replace s "" y = y ++ s replace s x y = go s where go "" = "" go h@(c:rest) | x `isPrefixOf` h = y ++ drop (length x) h | True = c : go rest offsetIndexOf :: String -> String -> Integer -> Integer offsetIndexOf x y i = case indexOf (genericDrop i x) y of -1 -> -1 r -> r+i mkTest1 (nm, x, t) = testCase ("genStrings-" ++ nm ++ "." ++ x) (assert t) mkTest2 (nm, x, y, t) = testCase ("genStrings-" ++ nm ++ "." ++ x ++ "_" ++ y) (assert t) mkTest3 (nm, x, y, z, t) = testCase ("genStrings-" ++ nm ++ "." ++ x ++ "_" ++ y ++ "_" ++ z) (assert t) mkThmI sop s = isTheorem $ do let v c = do sc <- free_ constrain $ sc .== literal c return sc vs <- mapM v s return $ literal s .== sop vs mkThm1 sop cop arg = isTheorem $ do a <- free "a" constrain $ a .== literal arg return $ literal (cop arg) .== sop a mkThm2 sop cop arg1 arg2 = isTheorem $ do a <- free "a" b <- free "b" constrain $ a .== literal arg1 constrain $ b .== literal arg2 return $ literal (cop arg1 arg2) .== sop a b mkThm3 sop cop arg1 arg2 arg3 = isTheorem $ do a <- free "a" b <- free "b" c <- free "c" constrain $ a .== literal arg1 constrain $ b .== literal arg2 constrain $ c .== literal arg3 return $ literal (cop arg1 arg2 arg3) .== sop a b c genLists :: [TestTree] genLists = map mkTest1 ( [("length", show l, mkThm1 SL.length llen l ) | l <- sl ] ++ [("null", show l, mkThm1 SL.null null l ) | l <- sl ] ++ [("head", show l, mkThm1 SL.head head l ) | l <- sl, not (null l) ] ++ [("tail", show l, mkThm1 SL.tail tail l ) | l <- sl, not (null l) ] ++ [("singleton", show i, mkThm1 SL.singleton (: []) i ) | i <- iUBs ] ++ [("implode", show l, mkThmI SL.implode id l ) | l <- sl ]) ++ map mkTest2 ( [("listToListAt", show l, show i, mkThm2 SL.listToListAt listToListAt l i ) | l <- sl, i <- range l ] ++ [("elemAt", show l, show i, mkThm2 SL.elemAt elemAt l i ) | l <- sl, i <- range l ] ++ [("concat", show l, show l1, mkThm2 SL.concat (++) l l1 ) | l <- sl, l1 <- sl ] ++ [("isInfixOf", show l, show l1, mkThm2 SL.isInfixOf isInfixOf l l1 ) | l <- sl, l1 <- sl ] ++ [("isSuffixOf", show l, show l1, mkThm2 SL.isSuffixOf isSuffixOf l l1 ) | l <- sl, l1 <- sl ] ++ [("isPrefixOf", show l, show l1, mkThm2 SL.isPrefixOf isPrefixOf l l1 ) | l <- sl, l1 <- sl ] ++ [("take", show l, show i, mkThm2 SL.take genericTake i l ) | l <- sl, i <- iUBs ] ++ [("drop", show l, show i, mkThm2 SL.drop genericDrop i l ) | l <- sl, i <- iUBs ] ++ [("indexOf", show l, show l1, mkThm2 SL.indexOf indexOf l l1 ) | l <- sl, l1 <- sl ]) ++ map mkTest3 ( [("subList", show l, show i, show j, mkThm3 SL.subList subList l i j ) | l <- sl, i <- range l, j <- range l, i + j <= genericLength l] ++ [("replace", show l, show l1, show l2, mkThm3 SL.replace replace l l1 l2) | l <- sl, l1 <- sl, l2 <- sl ] ++ [("offsetIndexOf", show l, show l1, show i, mkThm3 SL.offsetIndexOf offsetIndexOf l l1 i ) | l <- sl, l1 <- sl, i <- range l ]) where llen :: [Integer] -> Integer llen = fromIntegral . length range :: [Integer] -> [Integer] range l = map fromIntegral [0 .. length l - 1] indexOf :: [Integer] -> [Integer] -> Integer indexOf s1 s2 = go 0 s1 where go i x | s2 `isPrefixOf` x = i | True = case x of [] -> -1 (_:r) -> go (i+1) r listToListAt :: [Integer] -> Integer -> [Integer] s `listToListAt` i = [s `elemAt` i] elemAt :: [Integer] -> Integer -> Integer l `elemAt` i = l `genericIndex` i subList :: [Integer] -> Integer -> Integer -> [Integer] subList s i j = genericTake j (genericDrop i s) replace :: [Integer] -> [Integer] -> [Integer] -> [Integer] replace s [] y = y ++ s replace s x y = go s where go [] = [] go h@(c:rest) | x `isPrefixOf` h = y ++ drop (length x) h | True = c : go rest offsetIndexOf :: [Integer] -> [Integer] -> Integer -> Integer offsetIndexOf x y i = case indexOf (genericDrop i x) y of -1 -> -1 r -> r+i mkTest1 (nm, x, t) = testCase ("genLists-" ++ nm ++ "." ++ x) (assert t) mkTest2 (nm, x, y, t) = testCase ("genLists-" ++ nm ++ "." ++ x ++ "_" ++ y) (assert t) mkTest3 (nm, x, y, z, t) = testCase ("genLists-" ++ nm ++ "." ++ x ++ "_" ++ y ++ "_" ++ z) (assert t) mkThmI sop cop arg = isTheorem $ do let v c = do sc <- free_ constrain $ sc .== literal c return sc vs <- mapM v arg return $ literal (cop arg) .== sop vs mkThm1 sop cop arg = isTheorem $ do a <- free "a" constrain $ a .== literal arg return $ literal (cop arg) .== sop a mkThm2 sop cop arg1 arg2 = isTheorem $ do a <- free "a" b <- free "b" constrain $ a .== literal arg1 constrain $ b .== literal arg2 return $ literal (cop arg1 arg2) .== sop a b mkThm3 sop cop arg1 arg2 arg3 = isTheorem $ do a <- free "a" b <- free "b" c <- free "c" constrain $ a .== literal arg1 constrain $ b .== literal arg2 constrain $ c .== literal arg3 return $ literal (cop arg1 arg2 arg3) .== sop a b c -- Concrete test data xsSigned, xsUnsigned :: (Num a, Bounded a) => [a] xsUnsigned = [0, 1, maxBound - 1, maxBound] xsSigned = xsUnsigned ++ [minBound, minBound + 1, -1] w8s :: [Word8] w8s = xsUnsigned w16s :: [Word16] w16s = xsUnsigned w32s :: [Word32] w32s = xsUnsigned w64s :: [Word64] w64s = xsUnsigned i8s :: [Int8] i8s = xsSigned i16s :: [Int16] i16s = xsSigned i32s :: [Int32] i32s = xsSigned i64s :: [Int64] i64s = xsSigned iUBs :: [Integer] iUBs = [-1000000] ++ [-1 .. 1] ++ [1000000] rs :: [AlgReal] rs = [fromRational (i % d) | i <- is, d <- dens] where is = [-1000000] ++ [-1 .. 1] ++ [10000001] dens = [5,100,1000000] -- Admittedly paltry test-cases for float/double fs :: [Float] fs = xs ++ map (* (-1)) (filter (not . isNaN) xs) -- -nan is the same as nan where xs = [nan, infinity, 0, 0.5, 0.68302244, 0.5268265, 0.10283524, 5.8336496e-2, 1.0e-45] ds :: [Double] ds = xs ++ map (* (-1)) (filter (not . isNaN) xs) -- -nan is the same as nan where xs = [nan, infinity, 0, 0.5, 2.516632060108026e-2, 0.8601891300751106, 5.0e-324] -- Currently we test over all latin-1 characters. But when Unicode comes along, we'll have to be more selective. -- TODO: Unicode update here. cs :: String cs = map C.chr [0..255] -- For pair char ops, take a subset. reducedCS :: String reducedCS = map C.chr $ [0..5] ++ [98..102] ++ [250..255] -- Ditto for strings, just a few things ss :: [String] ss = ["", "palTRY", "teSTing", "SBV", "sTRIngs", "123", "surely", "thIS", "hI", "ly", "0"] -- Lists are the worst in coverage! sl :: [[Integer]] sl = [[], [0], [-1, 1], [-10, 0, 10], [3, 4, 5, 4, 5, 3]] {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/SBVTestSuite/TestSuite/Basics/Assert.hs0000644000000000000000000000156613405536617017704 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.Assert -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test the sAssert feature. ----------------------------------------------------------------------------- module TestSuite.Basics.Assert(tests) where import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.Assert" [ goldenCapturedIO "safe1" $ t $ \x -> sAssert Nothing "safe1" (x .> (2::SInteger)) (x .== 12) , goldenCapturedIO "safe2" $ t $ \x -> sAssert Nothing "safe2" (x .> (2::SInteger)) (12::SInteger) ] where t tc goldFile = do r <- safeWith z3{verbose=True, redirectVerbose=Just goldFile} tc appendFile goldFile ("\n FINAL: " ++ show r ++ "\nDONE!") sbv-7.13/SBVTestSuite/TestSuite/Basics/BasicTests.hs0000644000000000000000000000601113405536617020475 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.BasicTests -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.Basics.BasicTests ----------------------------------------------------------------------------- {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Basics.BasicTests(tests) where import Data.SBV.Internals import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.BasicTests" [ testCase "basic-0.1" $ test0 f1 `showsAs` "5" , testCase "basic-0.2" $ test0 f2 `showsAs` "5" , testCase "basic-0.3" $ test0 f3 `showsAs` "25" , testCase "basic-0.4" $ test0 f4 `showsAs` "25" , testCase "basic-0.5" $ test0 f5 `showsAs` "4" , goldenVsStringShow "basic-1_1" $ test1 f1 , goldenVsStringShow "basic-1_2" $ test1 f2 , goldenVsStringShow "basic-1_3" $ test1 f3 , goldenVsStringShow "basic-1_4" $ test1 f4 , goldenVsStringShow "basic-1_5" $ test1 f5 , goldenVsStringShow "basic-2_1" $ test2 f1 , goldenVsStringShow "basic-2_2" $ test2 f2 , goldenVsStringShow "basic-2_3" $ test2 f3 , goldenVsStringShow "basic-2_4" $ test2 f4 , goldenVsStringShow "basic-2_5" $ test2 f5 , goldenVsStringShow "basic-3_1" $ test3 f1 , goldenVsStringShow "basic-3_2" $ test3 f2 , goldenVsStringShow "basic-3_3" $ test3 f3 , goldenVsStringShow "basic-3_4" $ test3 f4 , goldenVsStringShow "basic-3_5" $ test3 f5 , goldenVsStringShow "basic-4_1" $ test4 f1 , goldenVsStringShow "basic-4_2" $ test4 f2 , goldenVsStringShow "basic-4_3" $ test4 f3 , goldenVsStringShow "basic-4_4" $ test4 f4 , goldenVsStringShow "basic-4_5" $ test4 f5 , goldenVsStringShow "basic-5_1" $ test5 f1 , goldenVsStringShow "basic-5_2" $ test5 f2 , goldenVsStringShow "basic-5_3" $ test5 f3 , goldenVsStringShow "basic-5_4" $ test5 f4 , goldenVsStringShow "basic-5_5" $ test5 f5 ] test0 :: (forall a. Num a => (a -> a -> a)) -> Word8 test0 f = f (3 :: Word8) 2 test1, test2, test3, test4, test5 :: (forall a. Num a => (a -> a -> a)) -> IO Result test1 f = runSAT $ do let x = literal (3 :: Word8) y = literal (2 :: Word8) output $ f x y test2 f = runSAT $ do let x = literal (3 :: Word8) y :: SWord8 <- forall "y" output $ f x y test3 f = runSAT $ do x :: SWord8 <- forall "x" y :: SWord8 <- forall "y" output $ f x y test4 f = runSAT $ do x :: SWord8 <- forall "x" output $ f x x test5 f = runSAT $ do x :: SWord8 <- forall "x" let r = f x x q :: SWord8 <- forall "q" _ <- output q output r f1, f2, f3, f4, f5 :: Num a => a -> a -> a f1 x y = (x+y)*(x-y) f2 x y = (x*x)-(y*y) f3 x y = (x+y)*(x+y) f4 x y = let z = x + y in z * z f5 x _ = x + 1 sbv-7.13/SBVTestSuite/TestSuite/Basics/BoundedList.hs0000644000000000000000000002000013405536617020637 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.BoundedList -- Copyright : (c) Joel Burget -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test the bounded sequence/list functions. ----------------------------------------------------------------------------- {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedLists #-} {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Basics.BoundedList(tests) where import Data.SBV.Control import Utils.SBVTestFramework import Data.SBV.List ((.:), (.!!)) import qualified Data.SBV.List as L import qualified Data.SBV.List.Bounded as BL import Control.Monad (unless) import Control.Monad.State -- | Flag to mark a failed computation newtype Failure = Failure SBool deriving (Boolean, Mergeable, EqSymbolic) -- | Evaluation monad with failure newtype Eval a = Eval { unEval :: State Failure a } deriving (Functor, Applicative, Monad, MonadState Failure) runEval :: Eval a -> (a, Failure) runEval (Eval eval) = runState eval false instance Mergeable a => Mergeable (Eval a) where symbolicMerge force test left right = Eval $ state $ \s0 -> let (resL, sL) = runState (unEval left) s0 (resR, sR) = runState (unEval right) s0 in ( symbolicMerge force test resL resR , symbolicMerge force test sL sR ) markFailure :: SBool -> Eval () markFailure failure = modify (||| Failure failure) -- Test suite tests :: TestTree tests = testGroup "Basics.BoundedList" [ goldenCapturedIO "concreteFoldr" $ \rf -> checkWith z3{redirectVerbose=Just rf} concreteFoldrSat Sat , goldenCapturedIO "concreteFoldl" $ \rf -> checkWith z3{redirectVerbose=Just rf} concreteFoldlSat Sat , goldenCapturedIO "foldrAB1" $ \rf -> checkWith z3{redirectVerbose=Just rf} (foldrAB 1) Unsat , goldenCapturedIO "foldrAB2" $ \rf -> checkWith z3{redirectVerbose=Just rf} (foldrAB 2) Sat , goldenCapturedIO "foldrAB3" $ \rf -> checkWith z3{redirectVerbose=Just rf} (foldrAB 3) Sat , goldenCapturedIO "foldlABC1" $ \rf -> checkWith z3{redirectVerbose=Just rf} (foldlABC 1) Unsat , goldenCapturedIO "foldlABC2" $ \rf -> checkWith z3{redirectVerbose=Just rf} (foldlABC 2) Unsat , goldenCapturedIO "foldlABC3" $ \rf -> checkWith z3{redirectVerbose=Just rf} (foldlABC 3) Sat , goldenCapturedIO "concreteReverse" $ \rf -> checkWith z3{redirectVerbose=Just rf} concreteReverseSat Sat , goldenCapturedIO "reverse" $ \rf -> checkWith z3{redirectVerbose=Just rf} reverseSat Sat , goldenCapturedIO "reverseAlt10" $ \rf -> checkWith z3{redirectVerbose=Just rf} (reverseAlt 10) Unsat , goldenCapturedIO "concreteSort" $ \rf -> checkWith z3{redirectVerbose=Just rf} concreteSortSat Sat , goldenCapturedIO "sort" $ \rf -> checkWith z3{redirectVerbose=Just rf} sortSat Sat , goldenCapturedIO "mapWithFailure" $ \rf -> checkWith z3{redirectVerbose=Just rf} mapWithFailure Sat , goldenCapturedIO "mapNoFailure" $ \rf -> checkWith z3{redirectVerbose=Just rf} mapNoFailure Unsat , goldenCapturedIO "maxlWithFailure" $ \rf -> checkWith z3{redirectVerbose=Just rf} maxlWithFailure Sat , goldenCapturedIO "maxrWithFailure" $ \rf -> checkWith z3{redirectVerbose=Just rf} maxrWithFailure Sat ] checkWith :: SMTConfig -> Symbolic () -> CheckSatResult -> IO () checkWith cfg props csExpected = runSMTWith cfg{verbose=True} $ do _ <- props query $ do cs <- checkSat unless (cs == csExpected) $ case cs of Unsat -> error $ "Failed! Expected " ++ show csExpected ++ ", got Unsat" Sat -> getModel >>= \r -> error $ "Failed! Expected " ++ show csExpected ++ ", got Sat:\n" ++ show (SatResult (Satisfiable cfg r)) Unk -> getUnknownReason >>= \r -> error $ "Failed! Expected " ++ show csExpected ++ ", got Unk:\n" ++ show r concreteFoldrSat :: Symbolic () concreteFoldrSat = constrain $ BL.bfoldr 3 (+) 0 [1..3] .== (6 :: SInteger) concreteFoldlSat :: Symbolic () concreteFoldlSat = constrain $ BL.bfoldl 10 (+) 0 [1..3] .== (6 :: SInteger) -- unsatisfiable at bound = 1, satisfiable at bound = 2 or bound = 3 foldrAB :: Int -> Symbolic () foldrAB bound = do [a, b] <- sIntegers ["a", "b"] constrain $ a .> 0 constrain $ b .> 0 constrain $ BL.bfoldr bound (+) 0 (L.implode [a, b]) .== a + b -- unsatisfiable at bound = 1 or bound = 2, satisfiable at bound = 3 foldlABC :: Int -> Symbolic () foldlABC bound = do [a, b, c] <- sIntegers ["a", "b", "c"] constrain $ a .> 0 constrain $ b .> 0 constrain $ c .> 0 constrain $ BL.bfoldr bound (+) 0 (L.implode [a, b, c]) .== a + b + c concreteReverseSat :: Symbolic () concreteReverseSat = constrain $ BL.breverse 10 [1..10] .== ([10,9..1] :: SList Integer) reverseSat :: Symbolic () reverseSat = do abcd <- sIntegers ["a", "b", "c", "d"] constrain $ BL.breverse 10 (L.implode abcd) .== L.implode (reverse abcd) reverseAlt :: Int -> Symbolic () reverseAlt i = do xs <- sList "xs" -- Assert the negation; so Unsat response means it's all good! constrain $ BL.breverse i xs ./= rev i xs ([] :: SList Integer) where -- classic reverse with accumulator rev 0 _ sofar = sofar rev c xs sofar = ite (L.null xs) sofar (rev (c-1) (L.tail xs) (L.head xs .: sofar)) concreteSortSat :: Symbolic () concreteSortSat = constrain $ BL.bsort 10 [5,6,3,8,9,2,1,7,10,4] .== ([1..10] :: SList Integer) sortSat :: Symbolic () sortSat = do [a, b, c] <- sIntegers ["a", "b", "c"] let sorted = BL.bsort 3 $ L.implode [a, b, c] ordered :: (SInteger, SInteger, SInteger) -> SBool ordered (x, y, z) = x .<= y &&& y .<= z constrain $ ordered (a, b, c) ==> sorted .== L.implode [a, b, c] constrain $ ordered (a, c, b) ==> sorted .== L.implode [a, c, b] constrain $ ordered (b, a, c) ==> sorted .== L.implode [b, a, c] constrain $ ordered (b, c, a) ==> sorted .== L.implode [b, c, a] constrain $ ordered (c, a, b) ==> sorted .== L.implode [c, a, b] constrain $ ordered (c, b, a) ==> sorted .== L.implode [c, b, a] -- | Increment, failing if a value lies outside of [0, 10] boundedIncr :: SList Integer -> Eval (SList Integer) boundedIncr = BL.bmapM 10 $ \i -> do markFailure $ i .< 0 ||| i .> 10 pure $ i + 1 -- | Max (based on foldr), failing if a value lies outside of [0, 10] boundedMaxr :: SList Integer -> Eval SInteger boundedMaxr = BL.bfoldrM 10 (\i maxi -> do markFailure $ i .< 0 ||| i .> 10 pure $ smax i maxi) 0 -- | Max (based on foldl), failing if a value lies outside of [0, 10] boundedMaxl :: SList Integer -> Eval SInteger boundedMaxl = BL.bfoldlM 10 (\maxi i -> do markFailure $ i .< 0 ||| i .> 10 pure $ smax i maxi) 0 -- the mapping will have failed if one of the resulting values is greater than -- 11 mapWithFailure :: Symbolic () mapWithFailure = do lst <- sList "ints" let (lst', failure) = runEval $ boundedIncr lst constrain $ lst' .!! 2 .> 11 ==> failure .== true -- mapping over these values of a, b, and c cannot fail (this is unsat) mapNoFailure :: Symbolic () mapNoFailure = do [a, b, c] <- sIntegers ["a", "b", "c"] let (_lst', Failure failure) = runEval $ boundedIncr $ L.implode [a, b, c] constrain $ a + b + c .== 6 constrain $ a .> 0 &&& b .> 0 &&& c .> 0 constrain failure -- boundedMaxl fails if one of the values is too big maxlWithFailure :: Symbolic () maxlWithFailure = do lst <- sList "ints" let (maxi, Failure failure) = runEval $ boundedMaxl lst constrain $ maxi .> 10 ==> failure -- boundedMaxl fails if one of the values is too big maxrWithFailure :: Symbolic () maxrWithFailure = do lst <- sList "ints" let (maxi, Failure failure) = runEval $ boundedMaxr lst constrain $ maxi .> 10 ==> failure sbv-7.13/SBVTestSuite/TestSuite/Basics/Exceptions.hs0000644000000000000000000000501413405536617020554 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.Exceptions -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test the exception mechanism ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Basics.Exceptions(testsLocal, testsRemote) where import Data.SBV.Control import Utils.SBVTestFramework import qualified Control.Exception as C -- Test suite testsLocal :: TestTree testsLocal = testGroup "Basics.exceptions.local" [ goldenCapturedIO "exceptionLocal1" yicesExc , goldenCapturedIO "exceptionLocal2" z3Exc1 ] -- Yices throws an exception for this since exponent is too large yicesExc :: FilePath -> IO () yicesExc rf = runSMTWith yices{verbose=True, redirectVerbose=Just rf} exc `C.catch` \(e :: SBVException) -> do appendFile rf "CAUGHT SMT EXCEPTION" appendFile rf (show e) where exc = do x <- sWord32 "x" constrain $ lsb x ==> (x * (x .^ (-1::SWord32))) .== 1 query $ do cs <- checkSat cs `seq` return () testsRemote :: TestTree testsRemote = testGroup "Basics.exceptions.remote" [ goldenCapturedIO "exceptionRemote1" z3Exc2 ] -- Create the case where we ask for integer-logic, but use reals z3Exc1 :: FilePath -> IO () z3Exc1 rf = runSMTWith z3{verbose=True, redirectVerbose=Just rf} exc `C.catch` \(e :: SBVException) -> do appendFile rf "CAUGHT SMT EXCEPTION" appendFile rf (show e) where exc = do setLogic QF_LIA x <- sReal "x" constrain $ x .== 2 query $ do cs <- checkSat cs `seq` return () -- Similar to above, except linear logic, but use non-linear constructs z3Exc2 :: FilePath -> IO () z3Exc2 rf = do r <- runSMT z3ExcCatch `C.catch` \(e :: SBVException) -> return ("OK, we got: " ++ sbvExceptionDescription e) appendFile rf ("\nFINAL: " ++ show r ++ "\nDONE!\n") where z3ExcCatch = do setLogic QF_LIA x <- sInteger "x" y <- sInteger "y" query $ do constrain $ x*y .== x*x show <$> checkSat {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/SBVTestSuite/TestSuite/Basics/GenBenchmark.hs0000644000000000000000000000152613405536617020763 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.GenBenchmark -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test the generateSMTBenchmark function. ----------------------------------------------------------------------------- module TestSuite.Basics.GenBenchmark(tests) where import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.genBenchmark" [ goldenString "genBenchMark1" $ gen False (\x -> x .== (x+1::SWord8)) , goldenString "genBenchMark2" $ gen True (\x -> x .== (x+1::SWord8)) ] where gen b f = -- the first line is time-stamp, get rid of it so test is repeatable unlines . tail . lines <$> generateSMTBenchmark b f sbv-7.13/SBVTestSuite/TestSuite/Basics/Higher.hs0000644000000000000000000000254313405536617017645 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.Higher -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.Basics.Higher ----------------------------------------------------------------------------- module TestSuite.Basics.Higher(tests) where import Utils.SBVTestFramework tests :: TestTree tests = testGroup "Basics.Higher" [ goldenVsStringShow "higher-1" (f11 === f11) , goldenVsStringShow "higher-2" (f12 === f12) , goldenVsStringShow "higher-3" (f21 === f21) , goldenVsStringShow "higher-4" (f22 === f22) , goldenVsStringShow "higher-5" (f31 === f31) , goldenVsStringShow "higher-6" (f32 === f32) , goldenVsStringShow "higher-7" (f33 === f33) , goldenVsStringShow "higher-8" double , goldenVsStringShow "higher-9" onlyFailsFor128 ] where double = (2*) === (\x -> x+(x::SWord8)) onlyFailsFor128 = (2*) === (\x -> ite (x .== 128) 5 (x+(x::SWord8))) type B = SWord8 f11 :: B -> B f11 x = x f12 :: B -> (B, B) f12 x = (x, x) f21 :: (B, B) -> B f21 (x, y) = x + y f22 :: (B, B) -> (B, B) f22 (x, y) = (x, y) f31 :: B -> B -> B f31 x y = x + y f32 :: B -> B -> (B, B) f32 x y = (x, y) f33 :: B -> B -> B -> (B, B, B) f33 x y z = (x, y, z) sbv-7.13/SBVTestSuite/TestSuite/Basics/Index.hs0000644000000000000000000000543713405536617017513 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.Index -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.Basics.Index ----------------------------------------------------------------------------- module TestSuite.Basics.Index(tests) where import Utils.SBVTestFramework tests :: TestTree tests = testGroup "Basics.Index" (zipWith mkTest [f x | f <- [test1, test2, test3], x <- [0..13]] [(0::Int)..]) mkTest :: IO Bool -> Int -> TestTree mkTest tst i = testCase ("index-" ++ show i) (assert tst) -- prove that the "select" primitive is working correctly test1 :: Int -> IO Bool test1 n = isTheorem $ do elts <- mkForallVars n err <- forall_ ind <- forall_ ind2 <- forall_ let r1 = (select :: [SWord8] -> SWord8 -> SInt8 -> SWord8) elts err ind r2 = (select :: [SWord8] -> SWord8 -> SWord8 -> SWord8) elts err ind2 r3 = slowSearch elts err ind r4 = slowSearch elts err ind2 return $ r1 .== r3 &&& r2 .== r4 where slowSearch elts err i = ite (i .< 0) err (go elts i) where go [] _ = err go (x:xs) curInd = ite (curInd .== 0) x (go xs (curInd - 1)) test2 :: Int -> IO Bool test2 n = isTheorem $ do elts1 <- mkForallVars n elts2 <- mkForallVars n let elts = zip elts1 elts2 err1 <- forall_ err2 <- forall_ let err = (err1, err2) ind <- forall_ ind2 <- forall_ let r1 = (select :: [(SWord8, SWord8)] -> (SWord8, SWord8) -> SInt8 -> (SWord8, SWord8)) elts err ind r2 = (select :: [(SWord8, SWord8)] -> (SWord8, SWord8) -> SWord8 -> (SWord8, SWord8)) elts err ind2 r3 = slowSearch elts err ind r4 = slowSearch elts err ind2 return $ r1 .== r3 &&& r2 .== r4 where slowSearch elts err i = ite (i .< 0) err (go elts i) where go [] _ = err go (x:xs) curInd = ite (curInd .== 0) x (go xs (curInd - 1)) test3 :: Int -> IO Bool test3 n = isTheorem $ do eltsI <- mkForallVars n let elts = map Left eltsI errI <- forall_ let err = Left errI ind <- forall_ let r1 = (select :: [Either SWord8 SWord8] -> Either SWord8 SWord8 -> SInt8 -> Either SWord8 SWord8) elts err ind r2 = slowSearch elts err ind return $ r1 .== r2 where slowSearch elts err i = ite (i .< 0) err (go elts i) where go [] _ = err go (x:xs) curInd = ite (curInd .== 0) x (go xs (curInd - 1)) sbv-7.13/SBVTestSuite/TestSuite/Basics/IteTest.hs0000644000000000000000000000241513405536617020016 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.IteTest -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test various incarnations of laziness in ite ----------------------------------------------------------------------------- module TestSuite.Basics.IteTest(tests) where import Utils.SBVTestFramework chk1 :: (SBool -> SBool -> SBool -> SBool) -> SWord8 -> SBool chk1 cond x = cond (x .== x) true undefined chk2 :: (SBool -> [SBool] -> [SBool] -> [SBool]) -> SWord8 -> SBool chk2 cond x = head (cond (x .== x) [true] [undefined]) chk3 :: (SBool -> (SBool, SBool) -> (SBool, SBool) -> (SBool, SBool)) -> SWord8 -> SBool chk3 cond x = fst (cond (x .== x) (true, undefined::SBool) (undefined, undefined)) -- Test suite tests :: TestTree tests = testGroup "Basics.Ite" [ goldenVsStringShow "iteTest1" (rs (chk1 ite)) , goldenVsStringShow "iteTest2" (rs (chk2 ite)) , goldenVsStringShow "iteTest3" (rs (chk3 ite)) , testCase "iteTest4" (assertIsThm (chk1 iteLazy)) , testCase "iteTest5" (assertIsThm (chk2 iteLazy)) , testCase "iteTest6" (assertIsThm (chk3 iteLazy)) ] where rs f = runSAT $ forAll ["x"] f sbv-7.13/SBVTestSuite/TestSuite/Basics/List.hs0000644000000000000000000001352613405536617017355 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.List -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test the sequence/list functions. -- Most of these tests are adopted from ----------------------------------------------------------------------------- {-# LANGUAGE OverloadedLists #-} {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Basics.List(tests) where import Data.SBV.Control import Utils.SBVTestFramework import Data.SBV.List ((.!!), (.++)) import qualified Data.SBV.List as L import Control.Monad (unless) import Data.Maybe (catMaybes) import Data.List (sort) -- Test suite tests :: TestTree tests = testGroup "Basics.List" [ goldenCapturedIO "seqConcat" $ \rf -> checkWith z3{redirectVerbose=Just rf} seqConcatSat Sat , goldenCapturedIO "seqConcatBad" $ \rf -> checkWith z3{redirectVerbose=Just rf} seqConcatUnsat Unsat , goldenCapturedIO "seqIndexOf" $ \rf -> checkWith z3{redirectVerbose=Just rf} seqIndexOfSat Sat , goldenCapturedIO "seqIndexOfBad" $ \rf -> checkWith z3{redirectVerbose=Just rf} seqIndexOfUnsat Unsat , goldenCapturedIO "seqExamples1" $ \rf -> checkWith z3{redirectVerbose=Just rf} seqExamples1 Sat , goldenCapturedIO "seqExamples2" $ \rf -> checkWith z3{redirectVerbose=Just rf} seqExamples2 Unsat , goldenCapturedIO "seqExamples3" $ \rf -> checkWith z3{redirectVerbose=Just rf} seqExamples3 Sat , goldenCapturedIO "seqExamples4" $ \rf -> checkWith z3{redirectVerbose=Just rf} seqExamples4 Sat , goldenCapturedIO "seqExamples5" $ \rf -> checkWith z3{redirectVerbose=Just rf} seqExamples5 Sat , goldenCapturedIO "seqExamples6" $ \rf -> checkWith z3{redirectVerbose=Just rf} seqExamples6 Unsat , goldenCapturedIO "seqExamples7" $ \rf -> checkWith z3{redirectVerbose=Just rf} seqExamples7 Sat , goldenCapturedIO "seqExamples8" $ \rf -> checkWith z3{redirectVerbose=Just rf} seqExamples8 Unsat , testCase "seqExamples9" $ assert seqExamples9 ] checkWith :: SMTConfig -> Symbolic () -> CheckSatResult -> IO () checkWith cfg props csExpected = runSMTWith cfg{verbose=True} $ do _ <- props query $ do cs <- checkSat unless (cs == csExpected) $ case cs of Unsat -> error "Failed! Expected Sat, got UNSAT" Sat -> getModel >>= \r -> error $ "Failed! Expected Unsat, got SAT:\n" ++ show (SatResult (Satisfiable cfg r)) Unk -> getUnknownReason >>= \r -> error $ "Failed! Expected Unsat, got UNK:\n" ++ show r seqConcatSat :: Symbolic () seqConcatSat = constrain $ [1..3] .++ [4..6] .== ([1..6] :: SList Integer) seqConcatUnsat :: Symbolic () seqConcatUnsat = constrain $ [1..3] .++ [4..6] .== ([1..7] :: SList Integer) seqIndexOfSat :: Symbolic () seqIndexOfSat = constrain $ L.indexOf ([1,2,3,1,2,3] :: SList Integer) [1] .== 0 seqIndexOfUnsat :: Symbolic () seqIndexOfUnsat = constrain $ L.indexOf ([1,2,3,1,2,3] :: SList Integer) [1] ./= 0 -- Basic sequence operations seqExamples1 :: Symbolic () seqExamples1 = constrain $ bAnd [ L.singleton (([1,2,3] :: SList Integer) .!! 1) .++ L.singleton (([1,2,3] :: SList Integer) .!! 0) .== [2,1] , ([1,2,3,1,2,3] :: SList Integer) `L.indexOf` [1] .== 0 , L.offsetIndexOf ([1,2,3,1,2,3] :: SList Integer) [1] 1 .== 3 , L.subList ([4,4,1,2,3,5,5] :: SList Integer) 2 3 .== [1,2,3] ] -- A list cannot overlap with two different elements seqExamples2 :: Symbolic () seqExamples2 = do a :: SList Integer <- sList "a" constrain $ a .++ [2] .== [1] .++ a -- Strings a, b, c can have a non-trivial overlap. seqExamples3 :: Symbolic () seqExamples3 = do [a, b, c :: SList Integer] <- sLists ["a", "b", "c"] constrain $ a .++ b .== [1..4] constrain $ b .++ c .== [3..6] constrain $ bnot $ b .== [] -- There is a solution to a of length at most 2. seqExamples4 :: Symbolic () seqExamples4 = do [a, b :: SList Integer] <- sLists ["a", "b"] constrain $ [1..3] .++ a .== b .++ [3..5] constrain $ L.length a .<= 2 -- There is a solution to a that is not a sequence of 1's. seqExamples5 :: Symbolic () seqExamples5 = do [a, b, c :: SList Integer] <- sLists ["a", "b", "c"] constrain $ a .++ [1,2] .++ b .== b .++ [2,1] .++ c constrain $ c .== a .++ b constrain $ bnot $ a.++ [1] .== [1] .++ a -- Contains is transitive. seqExamples6 :: Symbolic () seqExamples6 = do [a, b, c :: SList Integer] <- sLists ["a", "b", "c"] constrain $ b `L.isInfixOf` a constrain $ c `L.isInfixOf` b constrain $ bnot $ c `L.isInfixOf` a -- But containment is not a linear order. seqExamples7 :: Symbolic () seqExamples7 = do [a, b, c :: SList Integer] <- sLists ["a", "b", "c"] constrain $ b `L.isInfixOf` a constrain $ c `L.isInfixOf` a constrain $ bnot $ c `L.isInfixOf` b constrain $ bnot $ b `L.isInfixOf` c -- Any string is equal to the prefix and suffix that add up to a its length. seqExamples8 :: Symbolic () seqExamples8 = do [a, b, c :: SList Integer] <- sLists ["a", "b", "c"] constrain $ b `L.isPrefixOf` a constrain $ c `L.isSuffixOf` a constrain $ L.length a .== L.length b + L.length c constrain $ bnot $ a .== b .++ c -- Generate all length one sequences, to enumerate all and making sure we can parse correctly seqExamples9 :: IO Bool seqExamples9 = do m <- allSat $ do (s :: SList Word8) <- sList "s" return $ L.length s .== 1 let vals :: [Word8] vals = sort $ concat (catMaybes (getModelValues "s" m) :: [[Word8]]) return $ vals == [0..255] sbv-7.13/SBVTestSuite/TestSuite/Basics/ProofTests.hs0000644000000000000000000000340113405536617020541 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.ProofTests -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.Basics.ProofTests ----------------------------------------------------------------------------- module TestSuite.Basics.ProofTests(tests) where import Utils.SBVTestFramework tests :: TestTree tests = testGroup "Basics.Proof" [ testCase "proofs-1" (assertIsThm f1eqf2) , testCase "proofs-2" (assertIsntThm f1eqf3) , testCase "proofs-3" (assertIsThm f3eqf4) , testCase "proofs-4" (assertIsThm f1Single) , testCase "proofs-5" (assertIsSat (f1 `xyEq` f2)) , testCase "proofs-6" (assertIsSat (f1 `xyEq` f3)) , testCase "proofs-7" (assertIsntSat (exists "x" >>= \x -> return (x .== x + (1 :: SWord16)))) , testCase "proofs-8" (assertIsSat (exists "x" >>= \x -> return (x :: SBool))) , testCase "proofs-9" (assertIsSat (exists "x" >>= \x -> return x :: Predicate)) ] xyEq :: (EqSymbolic a, SymWord a1) => (SBV a1 -> SBV Word8 -> a) -> (SBV a1 -> SWord8 -> a) -> Symbolic SBool func1 `xyEq` func2 = do x <- exists_ y <- exists_ return $ func1 x y .== func2 x (y :: SWord8) f1, f2, f3, f4 :: Num a => a -> a -> a f1 x y = (x+y)*(x-y) f2 x y = (x*x)-(y*y) f3 x y = (x+y)*(x+y) f4 x y = x*x + 2*x*y + y*y f1eqf2 :: Predicate f1eqf2 = forAll_ $ \x y -> f1 x y .== f2 x (y :: SWord8) f1eqf3 :: Predicate f1eqf3 = forAll ["x", "y"] $ \x y -> f1 x y .== f3 x (y :: SWord8) f3eqf4 :: Predicate f3eqf4 = forAll_ $ \x y -> f3 x y .== f4 x (y :: SWord8) f1Single :: Predicate f1Single = forAll_ $ \x -> f1 x x .== (0 :: SWord16) sbv-7.13/SBVTestSuite/TestSuite/Basics/PseudoBoolean.hs0000644000000000000000000000734213405536617021200 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.PseudoBoolean -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test the pseudo-boolean functions ----------------------------------------------------------------------------- module TestSuite.Basics.PseudoBoolean(tests) where import Data.SBV.Control import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.pseudoBoolean" [ goldenCapturedIO "pbAtMost" $ \rf -> checkWith z3{redirectVerbose=Just rf} propPbAtMost , goldenCapturedIO "pbAtLeast" $ \rf -> checkWith z3{redirectVerbose=Just rf} propPbAtLeast , goldenCapturedIO "pbExactly" $ \rf -> checkWith z3{redirectVerbose=Just rf} propPbExactly , goldenCapturedIO "pbLe" $ \rf -> checkWith z3{redirectVerbose=Just rf} propPbLe , goldenCapturedIO "pbGe" $ \rf -> checkWith z3{redirectVerbose=Just rf} propPbGe , goldenCapturedIO "pbEq" $ \rf -> checkWith z3{redirectVerbose=Just rf} propPbEq , goldenCapturedIO "pbEq2" $ \rf -> checkWith z3{redirectVerbose=Just rf} propPbEq2 , goldenCapturedIO "pbMutexed" $ \rf -> checkWith z3{redirectVerbose=Just rf} propPbMutexed , goldenCapturedIO "pbStronglyMutexed" $ \rf -> checkWith z3{redirectVerbose=Just rf} propPbStronglyMutexed ] -- to test interactively, use: -- checkWith z3 propPbAtLeast checkWith :: SMTConfig -> ([SBool] -> SBool) -> IO () checkWith cfg spec = runSMTWith cfg{verbose=True} $ do bs <- sBools $ map (\i -> "b" ++ show i) [0..(9::Int)] constrain $ bnot (spec bs) query $ do cs <- checkSat case cs of Unsat -> return () Sat -> getModel >>= \r -> error $ "Failed! Expected Unsat, got SAT:\n" ++ show (SatResult (Satisfiable cfg r)) Unk -> getUnknownReason >>= \r -> error $ "Failed! Expected Unsat, got UNK:\n" ++ show r propPbAtMost :: [SBool] -> SBool propPbAtMost bs = pbAtMost bs 8 .== (sum (map oneIf bs) .<= (8::SWord32)) propPbAtLeast :: [SBool] -> SBool propPbAtLeast bs = pbAtLeast bs 5 .== (sum (map oneIf bs) .>= (5::SWord32)) propPbExactly :: [SBool] -> SBool propPbExactly bs = pbExactly bs 5 .== (sum (map oneIf bs) .== (5::SWord32)) propPbLe :: [SBool] -> SBool propPbLe bs = pbLe ibs 7 .== (sum (map valIf ibs) .<= (7::SInteger)) where ibs = zip [1..] bs valIf (i, b) = ite b (literal (fromIntegral i)) 0 propPbGe :: [SBool] -> SBool propPbGe bs = pbGe ibs 7 .== (sum (map valIf ibs) .>= (7::SInteger)) where ibs = zip [1..] bs valIf (i, b) = ite b (literal (fromIntegral i)) 0 propPbEq :: [SBool] -> SBool propPbEq bs = pbEq ibs 7 .== (sum (map valIf ibs) .== (7::SInteger)) where ibs = zip [1..] bs valIf (i, b) = ite b (literal (fromIntegral i)) 0 -- Reported here as a bug -- and SBV didn't catch this. So let's add it as a test case. propPbEq2 :: [SBool] -> SBool propPbEq2 bs = (c1 &&& c2) ==> ( ([a, b, c, d, e] .== [false, true, false, true, false]) ||| ([a, b, c, d, e] .== [false, true, false, false, true])) where ~(a : b : c : d : e : _) = take 5 bs c1 = ite a (pbEq [(1, b), (1, c)] 3) (pbEq [(1, b), (1, c)] 1) c2 = ite c (pbEq [(1, a), (1, d), (1, e)] 3) (pbEq [(1, a), (1, d), (1, e)] 1) propPbMutexed :: [SBool] -> SBool propPbMutexed bs = pbMutexed bs .== (sum (map oneIf bs) .<= (1::SWord32)) propPbStronglyMutexed :: [SBool] -> SBool propPbStronglyMutexed bs = pbStronglyMutexed bs .== (sum (map oneIf bs) .== (1::SWord32)) sbv-7.13/SBVTestSuite/TestSuite/Basics/QRem.hs0000644000000000000000000000226113405536617017300 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.QRem -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.Basics.QRem ----------------------------------------------------------------------------- module TestSuite.Basics.QRem(tests) where import Utils.SBVTestFramework tests :: TestTree tests = testGroup "Basics.QRem" [ testCase "qremW8" (assertIsThm (qrem :: SWord8 -> SWord8 -> SBool)) , testCase "qremI8" (assertIsThm (qrem :: SInt8 -> SInt8 -> SBool)) , testCase "qremI" (assertIsThm (qrem :: SInteger -> SInteger -> SBool)) ] -- check: if (a, b) = x `quotRem` y then x = y*a + b -- same is also true for divMod -- being careful about y = 0. When divisor is 0, then quotient is -- defined to be 0 and the remainder is the numerator qrem :: (Num a, EqSymbolic a, SDivisible a) => a -> a -> SBool qrem x y = ite (y .== 0) ((0, x) .== (q, r) &&& (0, x) .== (d, m)) (x .== y * q + r &&& x .== y * d + m) where (q, r) = x `sQuotRem` y (d, m) = x `sDivMod` y sbv-7.13/SBVTestSuite/TestSuite/Basics/Quantifiers.hs0000644000000000000000000000453413405536617020733 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.Quantifiers -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Various combinations of quantifiers ----------------------------------------------------------------------------- module TestSuite.Basics.Quantifiers(tests) where import Control.Monad (void) import Utils.SBVTestFramework tests :: TestTree tests = testGroup "Basics.Quantifiers" $ concatMap mkGoal goals ++ concatMap mkPred preds where mkGoal (g, nm) = [ goldenCapturedIO ("quantified_sat" ++ "_" ++ nm) $ \rf -> void $ satWith z3{verbose=True, redirectVerbose=Just rf} g , goldenCapturedIO ("quantified_prove" ++ "_" ++ nm) $ \rf -> void $ proveWith z3{verbose=True, redirectVerbose=Just rf} g ] mkPred (p, nm) = [ goldenCapturedIO ("quantified_sat" ++ "_" ++ nm) $ \rf -> void $ satWith z3{verbose=True, redirectVerbose=Just rf} p , goldenCapturedIO ("quantified_prove" ++ "_" ++ nm) $ \rf -> void $ proveWith z3{verbose=True, redirectVerbose=Just rf} p ] qs = [(exists, "exists"), (forall, "forall")] acts = [ (\x y -> x + (y - x) .== y , "thm") , (\x y -> x .== y &&& x ./= y, "contradiction") , (\x y -> x .== y + 1 , "satisfiable") ] goals = [(t1 q1 q2 a, nq1 ++ nq2 ++ "_" ++ an ++ "_c") | (q1, nq1) <- qs , (q2, nq2) <- qs , (a, an) <- acts ] preds = [(t2 q1 q2 a, nq1 ++ nq2 ++ "_" ++ an ++ "_p") | (q1, nq1) <- qs , (q2, nq2) <- qs , (a, an) <- acts ] t1 :: (String -> Symbolic SWord8) -> (String -> Symbolic SWord8) -> (SWord8 -> SWord8 -> SBool) -> Goal t1 q1 q2 act = q1 "x" >>= \x -> q2 "y" >>= \y -> constrain $ act x y t2 :: (String -> Symbolic SWord8) -> (String -> Symbolic SWord8) -> (SWord8 -> SWord8 -> SBool) -> Predicate t2 q1 q2 act = q1 "x" >>= \x -> q2 "y" >>= \y -> return $ act x y sbv-7.13/SBVTestSuite/TestSuite/Basics/Recursive.hs0000644000000000000000000000375613405536617020415 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.Recursive -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Some recursive definitions. ----------------------------------------------------------------------------- module TestSuite.Basics.Recursive(tests) where import Utils.SBVTestFramework import Control.Monad.Reader (ask) import Control.Monad.Trans (liftIO) import qualified Data.SBV.Dynamic as D -- This is recursive and suffers from the termination problem. -- But we can still prove a few things about it! mgcd :: SWord8 -> SWord8 -> SWord8 mgcd a b = ite (b .== 0) a (mgcd b (a `sMod` b)) -- Same construction, expressed in terms of the dynamic interface mgcdDyn :: Int -> IO ThmResult mgcdDyn i = D.proveWith z3 $ do let var8 :: String -> Symbolic D.SVal var8 nm = ask >>= liftIO . D.svMkSymVar (Just D.ALL) word8 (Just nm) word8 = KBounded False 8 zero8 = D.svInteger word8 0 gcdDyn a b = D.svIte (b `D.svEqual` zero8) a (gcdDyn b (a `D.svRem` b)) x <- var8 "x" let prop0 = gcdDyn zero8 x `D.svEqual` x prop1 = gcdDyn x zero8 `D.svEqual` x return $ if i == 0 then prop0 else prop1 checkThm :: ThmResult -> Assertion checkThm r = assert isThm where isThm = case r of ThmResult Unsatisfiable{} -> return True :: IO Bool ThmResult Satisfiable{} -> return False _ -> error "checkThm: Unexpected result!" -- Test suite tests :: TestTree tests = testGroup "Basics.Recursive" [ testCase "recursive1" $ assertIsThm $ \x -> mgcd 0 x .== x , testCase "recursive2" $ assertIsThm $ \x -> mgcd x 0 .== x , testCase "recursiveDyn1" $ checkThm =<< mgcdDyn 0 , testCase "recursiveDyn2" $ checkThm =<< mgcdDyn 1 ] sbv-7.13/SBVTestSuite/TestSuite/Basics/SmallShifts.hs0000644000000000000000000000351113405536617020664 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.SmallShift -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing small-shift amounts using the dynamic interface. See -- http://github.com/LeventErkok/sbv/issues/323 for the genesis. ----------------------------------------------------------------------------- module TestSuite.Basics.SmallShifts(tests) where import Utils.SBVTestFramework hiding (proveWith) import Control.Monad.Reader (ask) import Control.Monad.Trans (liftIO) import Data.SBV.Dynamic k1, k32, k33 :: Kind k1 = KBounded False 1 k32 = KBounded False 32 k33 = KBounded False 33 type SW32 = SVal type SW33 = SVal type SW1 = SVal b0 :: SW1 b0 = svInteger k1 0 b1 :: SW1 b1 = svInteger k1 1 average33 :: SW32 -> SW32 -> SW32 average33 x y = svExtract 31 0 (z' `svDivide` svInteger k33 2) where z' :: SW33 z' = (b0 `svJoin` x) `svPlus` (b0 `svJoin` y) average4 :: SW32 -> SW32 -> SW32 average4 x y = ((x `svShiftRight` b1) `svPlus` (y `svShiftRight` b1)) `svPlus` (x `svAnd` (y `svAnd` svInteger k32 1)) prop :: Symbolic SVal prop = do x <- ask >>= liftIO . svMkSymVar Nothing k32 (Just "x") y <- ask >>= liftIO . svMkSymVar Nothing k32 (Just "y") return $ average33 x y `svEqual` average4 x y checkThm :: ThmResult -> Assertion checkThm r = assert isThm where isThm = case r of ThmResult Unsatisfiable{} -> return True :: IO Bool ThmResult Satisfiable{} -> return False _ -> error "checkThm: Unexpected result!" -- Test suite tests :: TestTree tests = testGroup "Basics.SmallShifts" [ testCase "smallShift" $ checkThm =<< proveWith z3 prop ] sbv-7.13/SBVTestSuite/TestSuite/Basics/SquashReals.hs0000644000000000000000000000173013405536617020667 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.SquashReals -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test the "squash" reals feature ----------------------------------------------------------------------------- module TestSuite.Basics.SquashReals(tests) where import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.Reals.Squash" [ goldenVsStringShow "squashReals1" $ sat (\x -> x .>= 0 &&& x*x .== (59::SReal)) , goldenVsStringShow "squashReals2" $ sat (\x -> x .>= 0 &&& x*x .== (16::SReal)) , goldenVsStringShow "squashReals3" $ satWith z3{printRealPrec = 35} (\x -> x .>= 0 &&& x*x .== (59::SReal)) , goldenVsStringShow "squashReals4" $ satWith z3{printRealPrec = 35} (\x -> x .>= 0 &&& x*x .== (16::SReal)) ] sbv-7.13/SBVTestSuite/TestSuite/Basics/String.hs0000644000000000000000000001630713405536617017710 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.String -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test the string functions. -- Most of these tests are adopted from ----------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} module TestSuite.Basics.String(tests) where import Data.SBV.Control import Utils.SBVTestFramework import Data.SBV.String ((.!!), (.++)) import qualified Data.SBV.String as S import qualified Data.SBV.RegExp as R import Control.Monad (unless) import Data.List (sort) import qualified Data.Map.Strict as M import qualified Data.Char as C -- Test suite tests :: TestTree tests = testGroup "Basics.String" [ goldenCapturedIO "strConcat" $ \rf -> checkWith z3{redirectVerbose=Just rf} strConcatSat Sat , goldenCapturedIO "strConcatBad" $ \rf -> checkWith z3{redirectVerbose=Just rf} strConcatUnsat Unsat , goldenCapturedIO "strIndexOf" $ \rf -> checkWith z3{redirectVerbose=Just rf} strIndexOfSat Sat , goldenCapturedIO "strIndexOfBad" $ \rf -> checkWith z3{redirectVerbose=Just rf} strIndexOfUnsat Unsat , goldenCapturedIO "strExamples1" $ \rf -> checkWith z3{redirectVerbose=Just rf} strExamples1 Sat , goldenCapturedIO "strExamples2" $ \rf -> checkWith z3{redirectVerbose=Just rf} strExamples2 Unsat , goldenCapturedIO "strExamples3" $ \rf -> checkWith z3{redirectVerbose=Just rf} strExamples3 Sat , goldenCapturedIO "strExamples4" $ \rf -> checkWith z3{redirectVerbose=Just rf} strExamples4 Sat , goldenCapturedIO "strExamples5" $ \rf -> checkWith z3{redirectVerbose=Just rf} strExamples5 Sat , goldenCapturedIO "strExamples6" $ \rf -> checkWith z3{redirectVerbose=Just rf} strExamples6 Unsat , goldenCapturedIO "strExamples7" $ \rf -> checkWith z3{redirectVerbose=Just rf} strExamples7 Sat , goldenCapturedIO "strExamples8" $ \rf -> checkWith z3{redirectVerbose=Just rf} strExamples8 Unsat , goldenCapturedIO "strExamples9" $ \rf -> checkWith z3{redirectVerbose=Just rf} strExamples9 Sat , goldenCapturedIO "strExamples10" $ \rf -> checkWith z3{redirectVerbose=Just rf} strExamples10 Unsat , goldenCapturedIO "strExamples11" $ \rf -> checkWith z3{redirectVerbose=Just rf} strExamples11 Unsat , goldenCapturedIO "strExamples12" $ \rf -> checkWith z3{redirectVerbose=Just rf} strExamples12 Unsat , goldenCapturedIO "strExamples13" $ \rf -> checkWith z3{redirectVerbose=Just rf} strExamples13 Unsat , testCase "strExamples14" $ assert strExamples14 ] checkWith :: SMTConfig -> Symbolic () -> CheckSatResult -> IO () checkWith cfg props csExpected = runSMTWith cfg{verbose=True} $ do _ <- props query $ do cs <- checkSat unless (cs == csExpected) $ case cs of Unsat -> error "Failed! Expected Sat, got UNSAT" Sat -> getModel >>= \r -> error $ "Failed! Expected Unsat, got SAT:\n" ++ show (SatResult (Satisfiable cfg r)) Unk -> getUnknownReason >>= \r -> error $ "Failed! Expected Unsat, got UNK:\n" ++ show r strConcatSat :: Symbolic () strConcatSat = constrain $ "abc" .++ "def" .== "abcdef" strConcatUnsat :: Symbolic () strConcatUnsat = constrain $ "abc" .++ "def" .== "abcdefg" strIndexOfSat :: Symbolic () strIndexOfSat = constrain $ S.indexOf "abcabc" "a" .== 0 strIndexOfUnsat :: Symbolic () strIndexOfUnsat = constrain $ S.indexOf "abcabc" "a" ./= 0 -- Basic string operations strExamples1 :: Symbolic () strExamples1 = constrain $ bAnd [ S.singleton ("abc" .!! 1) .++ S.singleton ("abc" .!! 0) .== "ba" , "abcabc" `S.indexOf` "a" .== 0 , S.offsetIndexOf "abcabc" "a" 1 .== 3 , S.subStr "xxabcyy" 2 3 .== "abc" ] -- A string cannot overlap with two different characters. strExamples2 :: Symbolic () strExamples2 = do a <- sString "a" constrain $ a .++ "b" .== "a" .++ a -- Strings a, b, c can have a non-trivial overlap. strExamples3 :: Symbolic () strExamples3 = do [a, b, c] <- sStrings ["a", "b", "c"] constrain $ a .++ b .== "abcd" constrain $ b .++ c .== "cdef" constrain $ bnot $ b .== "" -- There is a solution to a of length at most 2. strExamples4 :: Symbolic () strExamples4 = do [a, b] <- sStrings ["a", "b"] constrain $ "abc" .++ a .== b .++ "cef" constrain $ S.length a .<= 2 -- There is a solution to a that is not a sequence of "a"'s. strExamples5 :: Symbolic () strExamples5 = do [a, b, c] <- sStrings ["a", "b", "c"] constrain $ a .++ "ab" .++ b .== b .++ "ba" .++ c constrain $ c .== a .++ b constrain $ bnot $ a.++ "a" .== "a" .++ a -- Contains is transitive. strExamples6 :: Symbolic () strExamples6 = do [a, b, c] <- sStrings ["a", "b", "c"] constrain $ b `S.isInfixOf` a constrain $ c `S.isInfixOf` b constrain $ bnot $ c `S.isInfixOf` a -- But containment is not a linear order. strExamples7 :: Symbolic () strExamples7 = do [a, b, c] <- sStrings ["a", "b", "c"] constrain $ b `S.isInfixOf` a constrain $ c `S.isInfixOf` a constrain $ bnot $ c `S.isInfixOf` b constrain $ bnot $ b `S.isInfixOf` c -- Any string is equal to the prefix and suffix that add up to a its length. strExamples8 :: Symbolic () strExamples8 = do [a, b, c] <- sStrings ["a", "b", "c"] constrain $ b `S.isPrefixOf` a constrain $ c `S.isSuffixOf` a constrain $ S.length a .== S.length b + S.length c constrain $ bnot $ a .== b .++ c -- The maximal length is 6 for a string of length 2 repeated at most 3 times strExamples9 :: Symbolic () strExamples9 = do a <- sString "a" constrain $ R.match a (R.Loop 1 3 "ab") constrain $ S.length a .== 6 -- The maximal length is 6 for a string of length 2 repeated at most 3 times strExamples10 :: Symbolic () strExamples10 = do a <- sString "a" constrain $ R.match a (R.Loop 1 3 "ab") constrain $ S.length a .> 6 -- Conversion from nat to string, only ground terms strExamples11 :: Symbolic () strExamples11 = do i <- sInteger "i" constrain $ i .== 11 constrain $ bnot $ S.natToStr i .== "11" -- Conversion from nat to string, negative values produce empty string strExamples12 :: Symbolic () strExamples12 = do i <- sInteger "i" constrain $ i .== -2 constrain $ bnot $ S.natToStr i .== "" -- Conversion from string to nat, only ground terms strExamples13 :: Symbolic () strExamples13 = do s <- sString "s" constrain $ s .== "13" constrain $ bnot $ S.strToNat s .== 13 -- Generate all length one strings, to enumerate all and making sure we can parse correctly strExamples14 :: IO Bool strExamples14 = do m <- allSat $ do s <- sString "s" return $ S.length s .== 1 let dicts = getModelDictionaries m vals :: [Int] vals = map C.ord $ concat $ sort $ map (fromCW . snd) (concatMap M.assocs dicts) case length dicts of 256 -> return $ vals == [0 .. 255] _ -> return False sbv-7.13/SBVTestSuite/TestSuite/Basics/TOut.hs0000644000000000000000000000117713405536617017334 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Basics.TOut -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test the basic timeout mechanism ----------------------------------------------------------------------------- module TestSuite.Basics.TOut(tests) where import Documentation.SBV.Examples.Puzzles.Euler185 import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.timeout" [ goldenVsStringShow "timeout1" $ sat $ setTimeOut 1000 >> euler185 ] sbv-7.13/SBVTestSuite/TestSuite/BitPrecise/0000755000000000000000000000000013405536617016724 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/BitPrecise/BitTricks.hs0000644000000000000000000000171313405536617021160 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.BitPrecise.BitTricks -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.BitPrecise.BitTricks ----------------------------------------------------------------------------- module TestSuite.BitPrecise.BitTricks(tests) where import Documentation.SBV.Examples.BitPrecise.BitTricks import Utils.SBVTestFramework tests :: TestTree tests = testGroup "BitPrecise.BitTricks" [ testCase "fast min" $ assertIsThm fastMinCorrect , testCase "fast max" $ assertIsThm fastMaxCorrect , testCase "opposite signs" $ assertIsThm oppositeSignsCorrect , testCase "conditional set clear" $ assertIsThm conditionalSetClearCorrect , testCase "power of two" $ assertIsThm powerOfTwoCorrect ] sbv-7.13/SBVTestSuite/TestSuite/BitPrecise/Legato.hs0000644000000000000000000000270113405536617020473 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.BitPrecise.Legato -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.BitPrecise.Legato ----------------------------------------------------------------------------- module TestSuite.BitPrecise.Legato(tests) where import Data.SBV.Internals import Documentation.SBV.Examples.BitPrecise.Legato import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "BitPrecise.Legato" [ goldenVsStringShow "legato" legatoPgm , goldenVsStringShow "legato_c" legatoC ] where legatoPgm = runSAT $ do x <- free "x" y <- free "y" lo <- free "lo" regX <- free "regX" regA <- free "regA" flagC <- free "flagC" flagZ <- free "flagZ" output $ legatoIsCorrect (x, y, lo, regX, regA, flagC, flagZ) legatoC = snd <$> compileToC' "legatoMult" (do cgSetDriverValues [87, 92] x <- cgInput "x" y <- cgInput "y" let (hi, lo) = runLegato (initMachine (x, y, 0, 0, 0, false, false)) cgOutput "hi" hi cgOutput "lo" lo) sbv-7.13/SBVTestSuite/TestSuite/BitPrecise/MergeSort.hs0000644000000000000000000000156313405536617021174 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.BitPrecise.MergeSort -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.BitPrecise.MergeSort ----------------------------------------------------------------------------- module TestSuite.BitPrecise.MergeSort(tests) where import Data.SBV.Internals import Documentation.SBV.Examples.BitPrecise.MergeSort import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "BitPrecise.MergeSort" [ goldenVsStringShow "merge" mergeC ] where mergeC = snd <$> compileToC' "merge" (do cgSetDriverValues [10, 6, 4, 82, 71] xs <- cgInputArr 5 "xs" cgOutputArr "ys" (mergeSort xs)) sbv-7.13/SBVTestSuite/TestSuite/BitPrecise/PrefixSum.hs0000644000000000000000000000137013405536617021203 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.BitPrecise.PrefixSum -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.PrefixSum.PrefixSum ----------------------------------------------------------------------------- module TestSuite.BitPrecise.PrefixSum(tests) where import Documentation.SBV.Examples.BitPrecise.PrefixSum import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "BitPrecise.PrefixSum" [ testCase "prefixSum1" $ assertIsThm $ flIsCorrect 8 (0, (+)) , testCase "prefixSum2" $ assertIsThm $ flIsCorrect 16 (0, smax) ] sbv-7.13/SBVTestSuite/TestSuite/CodeGeneration/0000755000000000000000000000000013405536617017561 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/CodeGeneration/AddSub.hs0000644000000000000000000000172313405536617021262 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.CodeGeneration.AddSub -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.CodeGeneration.AddSub ----------------------------------------------------------------------------- module TestSuite.CodeGeneration.AddSub(tests) where import Data.SBV.Internals import Documentation.SBV.Examples.CodeGeneration.AddSub import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "CodeGen.addSub" [ goldenVsStringShow "addSub" code ] where code = snd <$> compileToC' "addSub" (do cgSetDriverValues [76, 92] cgPerformRTCs True x <- cgInput "x" y <- cgInput "y" let (s, d) = addSub x y cgOutput "sum" s cgOutput "dif" d) sbv-7.13/SBVTestSuite/TestSuite/CodeGeneration/CgTests.hs0000644000000000000000000000300513405536617021467 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.CodeGeneration.CgTests -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for code-generation features ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.CodeGeneration.CgTests(tests) where import Data.SBV.Internals import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "CodeGeneration.CgTests" [ goldenVsStringShow "selChecked" $ genSelect True "selChecked" , goldenVsStringShow "selUnchecked" $ genSelect False "selUnChecked" , goldenVsStringShow "codeGen1" foo ] where genSelect b n = snd <$> compileToC' n (do cgSetDriverValues [65] cgPerformRTCs b let sel :: SWord8 -> SWord8 sel x = select [1, x+2] 3 x x <- cgInput "x" cgReturn $ sel x) foo = snd <$> compileToC' "foo" (do cgSetDriverValues $ repeat 0 (x::SInt16) <- cgInput "x" (ys::[SInt64]) <- cgInputArr 45 "xArr" cgOutput "z" (5 :: SWord16) cgOutputArr "zArr" (replicate 7 (x+1)) cgOutputArr "yArr" ys cgReturn (x*2)) sbv-7.13/SBVTestSuite/TestSuite/CodeGeneration/CRC_USB5.hs0000644000000000000000000000163013405536617021322 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.CodeGeneration.CRC_USB5 -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.CodeGeneration.CRC_USB5 ----------------------------------------------------------------------------- module TestSuite.CodeGeneration.CRC_USB5(tests) where import Data.SBV.Internals import Documentation.SBV.Examples.CodeGeneration.CRC_USB5 import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "CRC.CodeGen" [ goldenVsStringShow "crcUSB5_1" $ genC crcUSB , goldenVsStringShow "crcUSB5_2" $ genC crcUSB' ] where genC f = snd <$> compileToC' "crcUSB5" (do cgSetDriverValues [0xFEDC] msg <- cgInput "msg" cgReturn $ f msg) sbv-7.13/SBVTestSuite/TestSuite/CodeGeneration/Fibonacci.hs0000644000000000000000000000202613405536617021772 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.CodeGeneration.Fibonacci -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.CodeGeneration.Fibonacci ----------------------------------------------------------------------------- module TestSuite.CodeGeneration.Fibonacci(tests) where import Data.SBV.Internals import Documentation.SBV.Examples.CodeGeneration.Fibonacci import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "CodeGeneration.Fibonacci" [ goldenVsStringShow "fib1" $ tst [12] "fib1" (fib1 64) , goldenVsStringShow "fib2" $ tst [20] "fib2" (fib2 64) ] where tst vs nm f = snd <$> compileToC' nm (do cgPerformRTCs True cgSetDriverValues vs n <- cgInput "n" cgReturn $ f n) sbv-7.13/SBVTestSuite/TestSuite/CodeGeneration/Floats.hs0000644000000000000000000002411313405536617021346 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.CodeGeneration.Floats -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test-suite for generating floating-point related C code ----------------------------------------------------------------------------- module TestSuite.CodeGeneration.Floats(tests) where import Data.SBV.Internals import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "CodeGeneration.Floats" [ goldenVsStringShow "floats_cgen" code ] where code = snd <$> compileToCLib' "floatCodeGen" cases setup = do cgSRealType CgLongDouble cgIntegerSize 64 cgSetDriverValues [42, 43, 44] test1 nm f = (nm, do setup a <- cgInput "a" cgReturn (f a)) test2 nm f = (nm, do setup a <- cgInput "a" b <- cgInput "b" cgReturn (f a b)) test3 nm f = (nm, do setup a <- cgInput "a" b <- cgInput "b" c <- cgInput "c" cgReturn (f a b c)) cases = [ test1 "toFP_Int8_ToFloat" (toSFloat sRoundNearestTiesToEven :: SInt8 -> SFloat) , test1 "toFP_Int16_ToFloat" (toSFloat sRoundNearestTiesToEven :: SInt16 -> SFloat) , test1 "toFP_Int32_ToFloat" (toSFloat sRoundNearestTiesToEven :: SInt32 -> SFloat) , test1 "toFP_Int64_ToFloat" (toSFloat sRoundNearestTiesToEven :: SInt64 -> SFloat) , test1 "toFP_Word8_ToFloat" (toSFloat sRoundNearestTiesToEven :: SWord8 -> SFloat) , test1 "toFP_Word16_ToFloat" (toSFloat sRoundNearestTiesToEven :: SWord16 -> SFloat) , test1 "toFP_Word32_ToFloat" (toSFloat sRoundNearestTiesToEven :: SWord32 -> SFloat) , test1 "toFP_Word64_ToFloat" (toSFloat sRoundNearestTiesToEven :: SWord64 -> SFloat) , test1 "toFP_Float_ToFloat" (toSFloat sRoundNearestTiesToEven :: SFloat -> SFloat) , test1 "toFP_Double_ToFloat" (toSFloat sRoundNearestTiesToEven :: SDouble -> SFloat) , test1 "toFP_Integer_ToFloat" (toSFloat sRoundNearestTiesToEven :: SInteger -> SFloat) , test1 "toFP_Real_ToFloat" (toSFloat sRoundNearestTiesToEven :: SReal -> SFloat) , test1 "toFP_Int8_ToDouble" (toSDouble sRoundNearestTiesToEven :: SInt8 -> SDouble) , test1 "toFP_Int16_ToDouble" (toSDouble sRoundNearestTiesToEven :: SInt16 -> SDouble) , test1 "toFP_Int32_ToDouble" (toSDouble sRoundNearestTiesToEven :: SInt32 -> SDouble) , test1 "toFP_Int64_ToDouble" (toSDouble sRoundNearestTiesToEven :: SInt64 -> SDouble) , test1 "toFP_Word8_ToDouble" (toSDouble sRoundNearestTiesToEven :: SWord8 -> SDouble) , test1 "toFP_Word16_ToDouble" (toSDouble sRoundNearestTiesToEven :: SWord16 -> SDouble) , test1 "toFP_Word32_ToDouble" (toSDouble sRoundNearestTiesToEven :: SWord32 -> SDouble) , test1 "toFP_Word64_ToDouble" (toSDouble sRoundNearestTiesToEven :: SWord64 -> SDouble) , test1 "toFP_Float_ToDouble" (toSDouble sRoundNearestTiesToEven :: SFloat -> SDouble) , test1 "toFP_Double_ToDouble" (toSDouble sRoundNearestTiesToEven :: SDouble -> SDouble) , test1 "toFP_Integer_ToDouble" (toSDouble sRoundNearestTiesToEven :: SInteger -> SDouble) , test1 "toFP_Real_ToDouble" (toSDouble sRoundNearestTiesToEven :: SReal -> SDouble) , test1 "fromFP_Float_ToInt8" (fromSFloat sRoundNearestTiesToEven :: SFloat -> SInt8) , test1 "fromFP_Float_ToInt16" (fromSFloat sRoundNearestTiesToEven :: SFloat -> SInt16) , test1 "fromFP_Float_ToInt32" (fromSFloat sRoundNearestTiesToEven :: SFloat -> SInt32) , test1 "fromFP_Float_ToInt64" (fromSFloat sRoundNearestTiesToEven :: SFloat -> SInt64) , test1 "fromFP_Float_ToWord8" (fromSFloat sRoundNearestTiesToEven :: SFloat -> SWord8) , test1 "fromFP_Float_ToWord16" (fromSFloat sRoundNearestTiesToEven :: SFloat -> SWord16) , test1 "fromFP_Float_ToWord32" (fromSFloat sRoundNearestTiesToEven :: SFloat -> SWord32) , test1 "fromFP_Float_ToWord64" (fromSFloat sRoundNearestTiesToEven :: SFloat -> SWord64) , test1 "fromFP_Float_ToFloat" (fromSFloat sRoundNearestTiesToEven :: SFloat -> SFloat) , test1 "fromFP_Float_ToDouble" (fromSFloat sRoundNearestTiesToEven :: SFloat -> SDouble) , test1 "fromFP_Float_ToInteger" (fromSFloat sRoundNearestTiesToEven :: SFloat -> SInteger) , test1 "fromFP_Float_ToReal" (fromSFloat sRoundNearestTiesToEven :: SFloat -> SReal) , test1 "fromFP_DoubleTo_Int8" (fromSDouble sRoundNearestTiesToEven :: SDouble -> SInt8) , test1 "fromFP_DoubleTo_Int16" (fromSDouble sRoundNearestTiesToEven :: SDouble -> SInt16) , test1 "fromFP_DoubleTo_Int32" (fromSDouble sRoundNearestTiesToEven :: SDouble -> SInt32) , test1 "fromFP_DoubleTo_Int64" (fromSDouble sRoundNearestTiesToEven :: SDouble -> SInt64) , test1 "fromFP_DoubleTo_Word8" (fromSDouble sRoundNearestTiesToEven :: SDouble -> SWord8) , test1 "fromFP_DoubleTo_Word16" (fromSDouble sRoundNearestTiesToEven :: SDouble -> SWord16) , test1 "fromFP_DoubleTo_Word32" (fromSDouble sRoundNearestTiesToEven :: SDouble -> SWord32) , test1 "fromFP_DoubleTo_Word64" (fromSDouble sRoundNearestTiesToEven :: SDouble -> SWord64) , test1 "fromFP_DoubleTo_Float" (fromSDouble sRoundNearestTiesToEven :: SDouble -> SFloat) , test1 "fromFP_DoubleTo_Double" (fromSDouble sRoundNearestTiesToEven :: SDouble -> SDouble) , test1 "fromFP_DoubleTo_Integer" (fromSDouble sRoundNearestTiesToEven :: SDouble -> SInteger) , test1 "fromFP_DoubleTo_Real" (fromSDouble sRoundNearestTiesToEven :: SDouble -> SReal) , test1 "fromFP_SWord32_SFloat" (sWord32AsSFloat :: SWord32 -> SFloat) , test1 "fromFP_SWord64_SDouble" (sWord64AsSDouble :: SWord64 -> SDouble) , test1 "fromFP_SFloat_SWord32" (sFloatAsSWord32 :: SFloat -> SWord32) , test1 "fromFP_SDouble_SWord64" (sDoubleAsSWord64 :: SDouble -> SWord64) , test1 "f_FP_Abs" (abs :: SFloat -> SFloat) , test1 "d_FP_Abs" (abs :: SDouble -> SDouble) , test1 "f_FP_Neg" (negate :: SFloat -> SFloat) , test1 "d_FP_Neg" (negate :: SDouble -> SDouble) , test2 "f_FP_Add" (fpAdd sRoundNearestTiesToEven :: SFloat -> SFloat -> SFloat) , test2 "d_FP_Add" (fpAdd sRoundNearestTiesToEven :: SDouble -> SDouble -> SDouble) , test2 "f_FP_Sub" (fpSub sRoundNearestTiesToEven :: SFloat -> SFloat -> SFloat) , test2 "d_FP_Sub" (fpSub sRoundNearestTiesToEven :: SDouble -> SDouble -> SDouble) , test2 "f_FP_Mul" (fpMul sRoundNearestTiesToEven :: SFloat -> SFloat -> SFloat) , test2 "d_FP_Mul" (fpMul sRoundNearestTiesToEven :: SDouble -> SDouble -> SDouble) , test2 "f_FP_Div" (fpDiv sRoundNearestTiesToEven :: SFloat -> SFloat -> SFloat) , test2 "d_FP_Div" (fpDiv sRoundNearestTiesToEven :: SDouble -> SDouble -> SDouble) , test3 "f_FP_FMA" (fpFMA sRoundNearestTiesToEven :: SFloat -> SFloat -> SFloat -> SFloat) , test3 "d_FP_FMA" (fpFMA sRoundNearestTiesToEven :: SDouble -> SDouble -> SDouble -> SDouble) , test1 "f_FP_Sqrt" (fpSqrt sRoundNearestTiesToEven :: SFloat -> SFloat) , test1 "d_FP_Sqrt" (fpSqrt sRoundNearestTiesToEven :: SDouble -> SDouble) , test2 "f_FP_Rem" (fpRem :: SFloat -> SFloat -> SFloat) , test2 "d_FP_Rem" (fpRem :: SDouble -> SDouble -> SDouble) , test1 "f_FP_RoundToIntegral" (fpRoundToIntegral sRoundNearestTiesToEven :: SFloat -> SFloat) , test1 "d_FP_RoundToIntegral" (fpRoundToIntegral sRoundNearestTiesToEven :: SDouble -> SDouble) , test2 "f_FP_Min" (fpMin :: SFloat -> SFloat -> SFloat) , test2 "d_FP_Min" (fpMin :: SDouble -> SDouble -> SDouble) , test2 "f_FP_Max" (fpMax :: SFloat -> SFloat -> SFloat) , test2 "d_FP_Max" (fpMax :: SDouble -> SDouble -> SDouble) , test2 "f_FP_IsEqualObject" (fpIsEqualObject :: SFloat -> SFloat -> SBool) , test2 "d_FP_IsEqualObject" (fpIsEqualObject :: SDouble -> SDouble -> SBool) , test1 "f_FP_IsNormal" (fpIsNormal :: SFloat -> SBool) , test1 "d_FP_IsNormal" (fpIsNormal :: SDouble -> SBool) , test1 "f_FP_IsZero" (fpIsZero :: SFloat -> SBool) , test1 "d_FP_IsZero" (fpIsZero :: SDouble -> SBool) , test1 "f_FP_IsSubnormal" (fpIsSubnormal :: SFloat -> SBool) , test1 "d_FP_IsSubnormal" (fpIsSubnormal :: SDouble -> SBool) , test1 "f_FP_IsInfinite" (fpIsInfinite :: SFloat -> SBool) , test1 "d_FP_IsInfinite" (fpIsInfinite :: SDouble -> SBool) , test1 "f_FP_IsNaN" (fpIsNaN :: SFloat -> SBool) , test1 "d_FP_IsNaN" (fpIsNaN :: SDouble -> SBool) , test1 "f_FP_IsNegative" (fpIsNegative :: SFloat -> SBool) , test1 "d_FP_IsNegative" (fpIsNegative :: SDouble -> SBool) , test1 "f_FP_IsPositive" (fpIsPositive :: SFloat -> SBool) , test1 "d_FP_IsPositive" (fpIsPositive :: SDouble -> SBool) ] {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/SBVTestSuite/TestSuite/CodeGeneration/GCD.hs0000644000000000000000000000153513405536617020516 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.CodeGeneration.GCD -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.CodeGeneration.GCD ----------------------------------------------------------------------------- module TestSuite.CodeGeneration.GCD(tests) where import Data.SBV.Internals import Documentation.SBV.Examples.CodeGeneration.GCD import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "CodeGeneration.GCD" [ goldenVsStringShow "gcd" gcdC ] where gcdC = snd <$> compileToC' "sgcd" (do cgSetDriverValues [55,154] x <- cgInput "x" y <- cgInput "y" cgReturn $ sgcd x y) sbv-7.13/SBVTestSuite/TestSuite/CodeGeneration/PopulationCount.hs0000644000000000000000000000177413405536617023271 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.CodeGeneration.PopulationCount -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.CodeGeneration.PopulationCount ----------------------------------------------------------------------------- module TestSuite.CodeGeneration.PopulationCount(tests) where import Data.SBV.Internals import Documentation.SBV.Examples.CodeGeneration.PopulationCount import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "CodeGeneration.PopulationCount" [ goldenVsStringShow "popCount1" $ snd <$> genC False , goldenVsStringShow "popCount2" $ snd <$> genC True ] where genC b = compileToC' "popCount" $ do cgSetDriverValues [0x0123456789ABCDEF] cgPerformRTCs b x <- cgInput "x" cgReturn $ popCountFast x sbv-7.13/SBVTestSuite/TestSuite/CodeGeneration/Uninterpreted.hs0000644000000000000000000000172413405536617022751 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.CodeGeneration.Uninterpreted -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.CodeGeneration.Uninterpreted ----------------------------------------------------------------------------- module TestSuite.CodeGeneration.Uninterpreted(tests) where import Data.SBV.Internals import Documentation.SBV.Examples.CodeGeneration.Uninterpreted import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "CodeGeneration.Uninterpreted" [ goldenVsStringShow "cgUninterpret" genC ] where genC = snd <$> compileToC' "tstShiftLeft" (do cgSetDriverValues [1, 2, 3] [x, y, z] <- cgInputArr 3 "vs" cgReturn $ tstShiftLeft x y z) sbv-7.13/SBVTestSuite/TestSuite/CRC/0000755000000000000000000000000013405536617015302 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/CRC/CCITT.hs0000644000000000000000000000314113405536617016503 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.CRC.CCITT -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.CRC.CCITT ----------------------------------------------------------------------------- module TestSuite.CRC.CCITT(tests) where import Data.SBV.Tools.Polynomial import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "CRC.CCITT" [ goldenVsStringShow "ccitt" crcPgm ] where crcPgm = runSAT $ forAll_ crcGood >>= output -- We don't have native support for 48 bits in Data.SBV -- So, represent as 32 high-bits and 16 low type SWord48 = (SWord32, SWord16) extendData :: SWord48 -> SWord64 extendData (h, l) = h # l # 0 mkFrame :: SWord48 -> SWord64 mkFrame msg@(h, l) = h # l # crc_48_16 msg crc_48_16 :: SWord48 -> SWord16 crc_48_16 msg = res where msg64, divisor :: SWord64 msg64 = extendData msg divisor = polynomial [16, 12, 5, 0] crc64 = pMod msg64 divisor (_, res) = split (snd (split crc64)) diffCount :: SWord64 -> SWord64 -> SWord8 diffCount x y = count $ zipWith (.==) (blastLE x) (blastLE y) where count [] = 0 count (b:bs) = let r = count bs in ite b r (1+r) -- Claim: If there is an undetected corruption, it must be at least at 4 bits; i.e. HD is 4 crcGood :: SWord48 -> SWord48 -> SBool crcGood sent received = sent ./= received ==> diffCount frameSent frameReceived .> 3 where frameSent = mkFrame sent frameReceived = mkFrame received sbv-7.13/SBVTestSuite/TestSuite/CRC/CCITT_Unidir.hs0000644000000000000000000000362613405536617020025 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.CRC.CCITT_Unidir -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.CRC.CCITT_Unidir ----------------------------------------------------------------------------- module TestSuite.CRC.CCITT_Unidir(tests) where import Data.SBV.Tools.Polynomial import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "CCITT_Unidir" [ testCase "ccitHDis3" (assertIsThm (crcUniGood 3)) , testCase "ccitHDis4" (assertIsntThm (crcUniGood 4)) ] -- We don't have native support for 48 bits in Data.SBV -- So, represent as 32 high-bits and 16 low type SWord48 = (SWord32, SWord16) extendData :: SWord48 -> SWord64 extendData (h, l) = h # l # 0 mkFrame :: SWord48 -> SWord64 mkFrame msg@(h, l) = h # l # crc_48_16 msg crc_48_16 :: SWord48 -> SWord16 crc_48_16 msg = res where msg64, divisor :: SWord64 msg64 = extendData msg divisor = polynomial [16, 12, 5, 0] crc64 = pMod msg64 divisor (_, res) = split (snd (split crc64)) diffCount :: [SBool] -> [SBool] -> SWord8 diffCount xs ys = count $ zipWith (.==) xs ys where count [] = 0 count (b:bs) = let r = count bs in ite b r (1+r) -- returns true if there's a 0->1 error (1->0 is ok) nonUnidir :: [SBool] -> [SBool] -> SBool nonUnidir [] _ = false nonUnidir _ [] = false nonUnidir (a:as) (b:bs) = (bnot a &&& b) ||| nonUnidir as bs crcUniGood :: SWord8 -> SWord48 -> SWord48 -> SBool crcUniGood hd sent received = sent ./= received ==> nonUnidir frameSent frameReceived ||| diffCount frameSent frameReceived .> hd where frameSent = blastLE $ mkFrame sent frameReceived = blastLE $ mkFrame received {-# ANN crc_48_16 ("HLint: ignore Use camelCase" :: String) #-} sbv-7.13/SBVTestSuite/TestSuite/CRC/GenPoly.hs0000644000000000000000000000351113405536617017213 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.CRC.GenPoly -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.CRC.GenPoly ----------------------------------------------------------------------------- module TestSuite.CRC.GenPoly(tests) where import Data.SBV.Tools.Polynomial import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "CRC.GenPoly" [ testCase "crcGoodE" (assertIsSat crcGoodE) , testCase "crcGood" (assertIsntThm (crcGood 3 12)) ] crcGoodE :: Symbolic SBool crcGoodE = do x1 <- exists_ x2 <- exists_ y1 <- exists_ y2 <- exists_ return (crcGood 3 0 (x1,x2) (y1,y2)) -- We don't have native support for 48 bits in Data.SBV -- So, represent as 32 high-bits and 16 low type SWord48 = (SWord32, SWord16) extendData :: SWord48 -> SWord64 extendData (h, l) = h # l # 0 mkFrame :: SWord64 -> SWord48 -> SWord64 mkFrame poly msg@(h, l) = h # l # crc_48_16 msg poly crc_48_16 :: SWord48 -> SWord64 -> SWord16 crc_48_16 msg poly = res where msg64 = extendData msg crc64 = pMod msg64 poly (_, res) = split (snd (split crc64)) diffCount :: SWord64 -> SWord64 -> SWord8 diffCount x y = count $ zipWith (.==) (blastLE x) (blastLE y) where count [] = 0 count (b:bs) = let r = count bs in ite b r (1+r) crcGood :: SWord8 -> SWord16 -> SWord48 -> SWord48 -> SBool crcGood hd divisor sent received = sent ./= received ==> diffCount frameSent frameReceived .> hd where frameSent = mkFrame poly sent frameReceived = mkFrame poly received poly = mkPoly divisor mkPoly :: SWord16 -> SWord64 mkPoly d = 0 # 1 # d {-# ANN crc_48_16 ("HLint: ignore Use camelCase" :: String) #-} sbv-7.13/SBVTestSuite/TestSuite/CRC/Parity.hs0000644000000000000000000000176313405536617017115 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.CRC.Parity -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.CRC.Parity ----------------------------------------------------------------------------- module TestSuite.CRC.Parity(tests) where import Utils.SBVTestFramework tests :: TestTree tests = testGroup "CRC.Parity" [ testCase "parity" (assertIsThm parityOK) ] parity :: SWord64 -> SBool parity x = bnot (isOdd cnt) where cnt :: SWord8 cnt = sum $ map oneIf $ blastLE x isOdd :: SWord8 -> SBool isOdd = lsb -- Example suggested by Lee Pike -- If x and y differ in odd-number of bits, then their parities are flipped parityOK :: SWord64 -> SWord64 -> SBool parityOK x y = isOdd cnt ==> px .== bnot py where cnt = sum $ map oneIf $ zipWith (./=) (blastLE x) (blastLE y) px = parity x py = parity y sbv-7.13/SBVTestSuite/TestSuite/CRC/USB5.hs0000644000000000000000000000334413405536617016360 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.CRC.USB5 -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.CRC.USB5 ----------------------------------------------------------------------------- module TestSuite.CRC.USB5(tests) where import Data.SBV.Tools.Polynomial import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "CRC.USB5" [ testCase "usbGood" (assertIsThm usbGood) ] newtype SWord11 = S11 SWord16 instance EqSymbolic SWord11 where S11 w .== S11 w' = w .== w' mkSWord11 :: SWord16 -> SWord11 mkSWord11 w = S11 (w .&. 0x07FF) extendData :: SWord11 -> SWord16 extendData (S11 w) = w `shiftL` 5 mkFrame :: SWord11 -> SWord16 mkFrame w = extendData w .|. crc_11_16 w -- crc returns 16 bits, but the first 11 are always 0 crc_11_16 :: SWord11 -> SWord16 crc_11_16 msg = crc16 .&. 0x1F -- just get the last 5 bits where divisor :: SWord16 divisor = polynomial [5, 2, 0] crc16 = pMod (extendData msg) divisor diffCount :: SWord16 -> SWord16 -> SWord8 diffCount x y = count $ zipWith (.==) (blastLE x) (blastLE y) where count [] = 0 count (b:bs) = let r = count bs in ite b r (1+r) -- Claim: If there is an undetected corruption, it must be at least at 3 bits usbGood :: SWord16 -> SWord16 -> SBool usbGood sent16 received16 = sent ./= received ==> diffCount frameSent frameReceived .>= 3 where sent = mkSWord11 sent16 received = mkSWord11 received16 frameSent = mkFrame sent frameReceived = mkFrame received {-# ANN crc_11_16 ("HLint: ignore Use camelCase" :: String) #-} sbv-7.13/SBVTestSuite/TestSuite/Crypto/0000755000000000000000000000000013405536617016153 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/Crypto/AES.hs0000644000000000000000000000255613405536617017127 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Crypto.AES -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Crypto.AES ----------------------------------------------------------------------------- module TestSuite.Crypto.AES(tests) where import Data.SBV.Internals import Documentation.SBV.Examples.Crypto.AES import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Crypto.AES" [ goldenVsStringShow "aes128Enc" $ snd <$> compileToC' "aes128Enc" (aes128EncDec True) , goldenVsStringShow "aes128Dec" $ snd <$> compileToC' "aes128Dec" (aes128EncDec False) , goldenVsStringShow "aes128Lib" $ snd <$> compileToCLib' "aes128Lib" aes128Comps ] where aes128EncDec d = do pt <- cgInputArr 4 "pt" key <- cgInputArr 4 "key" cgSetDriverValues $ repeat 0 let (encKs, decKs) = aesKeySchedule key res | d = aesEncrypt pt encKs | True = aesDecrypt pt decKs cgOutputArr "ct" res aes128Comps = [(f, setVals c) | (f, c) <- aes128LibComponents] setVals c = cgSetDriverValues (repeat 0) >> c sbv-7.13/SBVTestSuite/TestSuite/Crypto/RC4.hs0000644000000000000000000000134713405536617017104 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Crypto.RC4 -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Crypto.RC4 ----------------------------------------------------------------------------- module TestSuite.Crypto.RC4(tests) where import Data.SBV.Tools.STree import Documentation.SBV.Examples.Crypto.RC4 import Utils.SBVTestFramework tests :: TestTree tests = testGroup "Crypto.RC4" [ testCase "rc4swap" (assertIsThm readWrite) ] readWrite :: SBV Word8 -> SBV Word8 -> SBV Bool readWrite i j = readSTree (writeSTree initS i j) i .== j sbv-7.13/SBVTestSuite/TestSuite/Existentials/0000755000000000000000000000000013405536617017347 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/Existentials/CRCPolynomial.hs0000644000000000000000000000204113405536617022353 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Existentials.CRCPolynomial -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Existentials.CRCPolynomial ----------------------------------------------------------------------------- module TestSuite.Existentials.CRCPolynomial(tests) where import Documentation.SBV.Examples.Existentials.CRCPolynomial import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Existentials.CRCPolynomial" [ goldenVsStringShow "crcPolyExist" pgm ] where pgm = runSAT $ do p <- exists "poly" s <- do sh <- forall "sh" sl <- forall "sl" return (sh, sl) r <- do rh <- forall "rh" rl <- forall "rl" return (rh, rl) output $ sTestBit p 0 &&& crcGood 4 p s r sbv-7.13/SBVTestSuite/TestSuite/GenTest/0000755000000000000000000000000013405536617016244 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/GenTest/GenTests.hs0000644000000000000000000000215713405536617020341 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.GenTest.GenTests -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test-suite for generating tests ----------------------------------------------------------------------------- module TestSuite.GenTest.GenTests(tests) where import Data.SBV.Tools.GenTest import System.Random import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "GenTest.GenTests" [ goldenCapturedIO "tgen_haskell" $ render (Haskell "haskTest") , goldenCapturedIO "tgen_c" $ render (C "CTest") , goldenCapturedIO "tgen_forte" $ render (Forte "ForteTest" True ([32,32], [32,32,32])) ] where simple = genTest 10 $ do x <- sWord32 "x" y <- sWord32 "y" return (x+y, x-y, x*y) render s f = do setStdGen (mkStdGen 0) -- make sure we always get the same results! r <- renderTest s <$> simple writeFile f r sbv-7.13/SBVTestSuite/TestSuite/Optimization/0000755000000000000000000000000013405536617017361 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/Optimization/AssertWithPenalty.hs0000644000000000000000000000351413405536617023352 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Optimization.AssertWithPenalty -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for optimization routines, soft assertions ----------------------------------------------------------------------------- module TestSuite.Optimization.AssertWithPenalty(tests) where import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Optimization.AssertWithPenalty" [ goldenVsStringShow "assertWithPenalty1" (optimize Lexicographic assertWithPenalty1) , goldenVsStringShow "assertWithPenalty2" (optimize Lexicographic assertWithPenalty2) ] assertWithPenalty1 :: Goal assertWithPenalty1 = do x <- sInteger "x" y <- sInteger "y" let a1 = x .> 0 a2 = x .< y a3 = x+y .<= 0 constrain $ a1 .== a3 constrain $ a3 ||| a2 assertWithPenalty "as1" a3 (Penalty 3 Nothing) assertWithPenalty "as2" (bnot a3) (Penalty 5 Nothing) assertWithPenalty "as3" (bnot a1) (Penalty 10 Nothing) assertWithPenalty "as4" (bnot a2) (Penalty 3 Nothing) assertWithPenalty2 :: Goal assertWithPenalty2 = do a1 <- sBool "a1" a2 <- sBool "a2" a3 <- sBool "a3" assertWithPenalty "as_a1" a1 (Penalty 0.1 Nothing) assertWithPenalty "as_a2" a2 (Penalty 1.0 Nothing) assertWithPenalty "as_a3" a3 (Penalty 1 Nothing) assertWithPenalty "as_a4" (bnot a1 ||| bnot a2) (Penalty 3.2 Nothing) sbv-7.13/SBVTestSuite/TestSuite/Optimization/Basics.hs0000644000000000000000000000452713405536617021131 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Optimization.Basics -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for optimization routines ----------------------------------------------------------------------------- module TestSuite.Optimization.Basics(tests) where import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Optimization.Basics" $ [ goldenVsStringShow "optBasics1" (optimize Lexicographic optBasics1) , goldenVsStringShow "optBasics2" (optimize Lexicographic optBasics2) ] ++ [ goldenVsStringShow ("optBasicsRange_" ++ n) (optimize Lexicographic f) | (n, f) <- [ ("08_unsigned_max", sWord8 "x" >>= maximize "m") , ("08_unsigned_min", sWord8 "x" >>= minimize "m") , ("16_unsigned_max", sWord16 "x" >>= maximize "m") , ("16_unsigned_min", sWord16 "x" >>= minimize "m") , ("32_unsigned_max", sWord32 "x" >>= maximize "m") , ("32_unsigned_min", sWord32 "x" >>= minimize "m") , ("64_unsigned_max", sWord64 "x" >>= maximize "m") , ("64_unsigned_min", sWord64 "x" >>= minimize "m") , ("08_signed_max", sInt8 "x" >>= maximize "m") , ("08_signed_min", sInt8 "x" >>= minimize "m") , ("16_signed_max", sInt16 "x" >>= maximize "m") , ("16_signed_min", sInt16 "x" >>= minimize "m") , ("32_signed_max", sInt32 "x" >>= maximize "m") , ("32_signed_min", sInt32 "x" >>= minimize "m") , ("64_signed_max", sInt64 "x" >>= maximize "m") , ("64_signed_min", sInt64 "x" >>= minimize "m") ] ] optBasics1 :: Goal optBasics1 = do x <- sInteger "x" y <- sInteger "y" constrain $ x .< 2 constrain $ y - x .< 1 maximize "x_plus_y" $ x+y optBasics2 :: Goal optBasics2 = do x <- sInteger "x" y <- sInteger "y" constrain $ x .< 4 constrain $ y - x .< 1 constrain $ y .> 1 minimize "x_plus_y" $ x+y sbv-7.13/SBVTestSuite/TestSuite/Optimization/Combined.hs0000644000000000000000000000565713405536617021452 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Optimization.Combined -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for optimization routines, combined objectives ----------------------------------------------------------------------------- module TestSuite.Optimization.Combined(tests) where import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Optimization.Combined" [ goldenVsStringShow "combined1" (optimize Lexicographic combined1) , goldenVsStringShow "combined2" (optimize Lexicographic combined2) , goldenVsStringShow "pareto1" (optimize (Pareto Nothing) pareto1) , goldenVsStringShow "pareto2" (optimize (Pareto (Just 30)) pareto2) , goldenVsStringShow "pareto3" (optimize (Pareto Nothing) pareto3) , goldenVsStringShow "boxed1" (optimize Independent boxed1) ] combined1 :: Goal combined1 = do x <- sInteger "x" y <- sInteger "y" z <- sInteger "z" constrain $ x .< z constrain $ y .< z constrain $ z .< 5 constrain $ x ./= y maximize "max_x" x maximize "max_y" y combined2 :: Goal combined2 = do a <- sBool "a" b <- sBool "b" c <- sBool "c" assertWithPenalty "soft_a" a (Penalty 1 (Just "A")) assertWithPenalty "soft_b" b (Penalty 2 (Just "B")) assertWithPenalty "soft_c" c (Penalty 3 (Just "A")) constrain $ a .== c constrain $ bnot (a &&& b) pareto1 :: Goal pareto1 = do x <- sInteger "x" y <- sInteger "y" constrain $ 5 .>= x constrain $ x .>= 0 constrain $ 4 .>= y constrain $ y .>= 0 minimize "min_x" x maximize "max_x_plus_y" $ x + y minimize "min_y" y pareto2 :: Goal pareto2 = do x <- sInteger "x" y <- sInteger "y" constrain $ 5 .>= x constrain $ x .>= 0 minimize "min_x" x maximize "max_y" y minimize "max_x_plus_y" $ x + y pareto3 :: Goal pareto3 = do x <- sInteger "x" constrain $ 1 .>= x constrain $ 0 .<= x minimize "min_x" x maximize "max_x_plus_x" $ x + x boxed1 :: Goal boxed1 = do x <- sReal "x" y <- sReal "y" constrain $ 5 .>= x-y constrain $ x .>= 0 constrain $ 4 .>= y constrain $ y .> 0 minimize "min_x" x maximize "max_x_plus_y" (x + y) minimize "min_y" y maximize "max_y" y {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/SBVTestSuite/TestSuite/Optimization/ExtensionField.hs0000644000000000000000000000303413405536617022635 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Optimization.ExtensionField -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for optimization routines, extension field ----------------------------------------------------------------------------- module TestSuite.Optimization.ExtensionField(tests) where import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Optimization.ExtensionField" [ goldenVsStringShow "optExtField1" (optimize Lexicographic optExtField1) , goldenVsStringShow "optExtField2" (optimize Lexicographic optExtField2) , goldenVsStringShow "optExtField3" (optimize Lexicographic optExtField3) ] optExtField1 :: Goal optExtField1 = do x <- sInteger "x" y <- sInteger "y" constrain $ x .< 4 constrain $ y - x .> 1 maximize "x_plus_y" $ x+y optExtField2 :: Goal optExtField2 = do x <- sInteger "x" y <- sInteger "y" constrain $ x .< 4 constrain $ y - x .< 1 constrain $ y .< 1 minimize "x_plus_y" $ x+y optExtField3 :: Goal optExtField3 = do x <- sReal "x" y <- sReal "y" constrain $ x .< 4 constrain $ y .< 5 maximize "x_plus_y" $ x + y {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/SBVTestSuite/TestSuite/Optimization/NoOpt.hs0000644000000000000000000000240513405536617020755 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Optimization.NoOpt -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Check that if optimization is done, there must be goals and vice versa ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Optimization.NoOpt(tests) where import qualified Control.Exception as C import Control.Monad (void) import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Optimization.NoOpt" [ goldenCapturedIO "noOpt1" $ \rf -> c rf $ optimizeWith z3{verbose=True, redirectVerbose=Just rf} Lexicographic (\x -> x .== (x::SWord8)) , goldenCapturedIO "noOpt2" $ \rf -> c rf $ satWith z3{verbose=True, redirectVerbose=Just rf} (\x -> maximize "mx" (x::SWord8)) ] where -- catch the exception and put it in the file. Note that we trim the last line since it contains the -- cabal hash of the library, which is bound to change c rf cont = void cont `C.catch` (\(e :: C.SomeException) -> appendFile rf ("\n\n" ++ unlines (init (lines (show e))) ++ "\n")) sbv-7.13/SBVTestSuite/TestSuite/Optimization/Quantified.hs0000644000000000000000000000474413405536617022017 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Optimization.Quantified -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for optimization iwth quantifiers ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Optimization.Quantified(tests) where import Data.List (isPrefixOf) import Utils.SBVTestFramework import qualified Control.Exception as C -- Test suite tests :: TestTree tests = testGroup "Optimization.Reals" [ goldenString "optQuant1" $ optE q1 , goldenVsStringShow "optQuant2" $ opt q2 , goldenVsStringShow "optQuant3" $ opt q3 , goldenVsStringShow "optQuant4" $ opt q4 , goldenString "optQuant5" $ optE q5 ] where opt = optimize Lexicographic optE q = (show <$> optimize Lexicographic q) `C.catch` (\(e::C.SomeException) -> return (pick (show e))) pick s = unlines [l | l <- lines s, "***" `isPrefixOf` l] q1 :: Goal q1 = do a <- sInteger "a" [b1, b2] <- sIntegers ["b1", "b2"] x <- forall "x" :: Symbolic SInteger constrain $ 2 * (a * x + b1) .== 2 constrain $ 4 * (a * x + b2) .== 4 constrain $ a .>= 0 minimize "goal" $ 2*x q2 :: Goal q2 = do a <- sInteger "a" [b1, b2] <- sIntegers ["b1", "b2"] x <- forall "x" :: Symbolic SInteger constrain $ 2 * (a * x + b1) .== 2 constrain $ 4 * (a * x + b2) .== 4 constrain $ a .>= 0 minimize "goal" a q3 :: Goal q3 = do a <- sInteger "a" [b1, b2] <- sIntegers ["b1", "b2"] minimize "goal" a x <- forall "x" :: Symbolic SInteger constrain $ 2 * (a * x + b1) .== 2 constrain $ 4 * (a * x + b2) .== 4 constrain $ a .>= 0 q4 :: Goal q4 = do a <- sInteger "a" [b1, b2] <- sIntegers ["b1", "b2"] minimize "goal" $ 2*a x <- forall "x" :: Symbolic SInteger constrain $ 2 * (a * x + b1) .== 2 constrain $ 4 * (a * x + b2) .== 4 constrain $ a .>= 0 q5 :: Goal q5 = do a <- sInteger "a" x <- forall "x" :: Symbolic SInteger y <- forall "y" :: Symbolic SInteger b <- sInteger "b" constrain $ a .>= 0 constrain $ b .>= 0 constrain $ x+y .>= 0 minimize "goal" $ a+b {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/SBVTestSuite/TestSuite/Optimization/Reals.hs0000644000000000000000000000172613405536617020771 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Optimization.Reals -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for optimization routines, reals ----------------------------------------------------------------------------- module TestSuite.Optimization.Reals(tests) where import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Optimization.Reals" [ goldenVsStringShow "optReal1" (optimize Lexicographic p) ] p :: Goal p = do x <- sReal "x" y <- sReal "y" z <- sReal "z" w <- sReal "w" constrain $ x .>= 0 constrain $ y .>= 0 constrain $ z .>= 0 constrain $ w .>= 0 constrain $ x + y + z + w .<= 40 constrain $ 2 * x + y - z - w .>= 10 constrain $ w - y .>= 10 maximize "p" $ 0.5 * x + 3 * y + z + 4 * w sbv-7.13/SBVTestSuite/TestSuite/Overflows/0000755000000000000000000000000013405536617016661 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/Overflows/Arithmetic.hs0000644000000000000000000004153513405536617021316 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Overflows.Arithmetic -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for overflow checking ----------------------------------------------------------------------------- {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Overflows.Arithmetic(tests) where import Data.SBV import Data.SBV.Dynamic import Data.SBV.Internals (unSBV, SBV(..)) import Data.SBV.Tools.Overflow import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Overflows" [testGroup "Arithmetic" ts] where ts = [ testGroup "add-uf" [ testCase "w8" $ assertIsThm $ underflow svPlus (bvAddO :: SWord8 -> SWord8 -> (SBool, SBool)) , testCase "w16" $ assertIsThm $ underflow svPlus (bvAddO :: SWord16 -> SWord16 -> (SBool, SBool)) , testCase "w32" $ assertIsThm $ underflow svPlus (bvAddO :: SWord32 -> SWord32 -> (SBool, SBool)) , testCase "w64" $ assertIsThm $ underflow svPlus (bvAddO :: SWord64 -> SWord64 -> (SBool, SBool)) , testCase "i8" $ assertIsThm $ underflow svPlus (bvAddO :: SInt8 -> SInt8 -> (SBool, SBool)) , testCase "i16" $ assertIsThm $ underflow svPlus (bvAddO :: SInt16 -> SInt16 -> (SBool, SBool)) , testCase "i32" $ assertIsThm $ underflow svPlus (bvAddO :: SInt32 -> SInt32 -> (SBool, SBool)) , testCase "i64" $ assertIsThm $ underflow svPlus (bvAddO :: SInt64 -> SInt64 -> (SBool, SBool)) ] , testGroup "add-of" [ testCase "w8" $ assertIsThm $ overflow svPlus (bvAddO :: SWord8 -> SWord8 -> (SBool, SBool)) , testCase "w16" $ assertIsThm $ overflow svPlus (bvAddO :: SWord16 -> SWord16 -> (SBool, SBool)) , testCase "w32" $ assertIsThm $ overflow svPlus (bvAddO :: SWord32 -> SWord32 -> (SBool, SBool)) , testCase "w64" $ assertIsThm $ overflow svPlus (bvAddO :: SWord64 -> SWord64 -> (SBool, SBool)) , testCase "i8" $ assertIsThm $ overflow svPlus (bvAddO :: SInt8 -> SInt8 -> (SBool, SBool)) , testCase "i16" $ assertIsThm $ overflow svPlus (bvAddO :: SInt16 -> SInt16 -> (SBool, SBool)) , testCase "i32" $ assertIsThm $ overflow svPlus (bvAddO :: SInt32 -> SInt32 -> (SBool, SBool)) , testCase "i64" $ assertIsThm $ overflow svPlus (bvAddO :: SInt64 -> SInt64 -> (SBool, SBool)) ] , testGroup "sub-uf" [ testCase "w8" $ assertIsThm $ underflow svMinus (bvSubO :: SWord8 -> SWord8 -> (SBool, SBool)) , testCase "w16" $ assertIsThm $ underflow svMinus (bvSubO :: SWord16 -> SWord16 -> (SBool, SBool)) , testCase "w32" $ assertIsThm $ underflow svMinus (bvSubO :: SWord32 -> SWord32 -> (SBool, SBool)) , testCase "w64" $ assertIsThm $ underflow svMinus (bvSubO :: SWord64 -> SWord64 -> (SBool, SBool)) , testCase "i8" $ assertIsThm $ underflow svMinus (bvSubO :: SInt8 -> SInt8 -> (SBool, SBool)) , testCase "i16" $ assertIsThm $ underflow svMinus (bvSubO :: SInt16 -> SInt16 -> (SBool, SBool)) , testCase "i32" $ assertIsThm $ underflow svMinus (bvSubO :: SInt32 -> SInt32 -> (SBool, SBool)) , testCase "i64" $ assertIsThm $ underflow svMinus (bvSubO :: SInt64 -> SInt64 -> (SBool, SBool)) ] , testGroup "sub-of" [ testCase "w8" $ assertIsThm $ overflow svMinus (bvSubO :: SWord8 -> SWord8 -> (SBool, SBool)) , testCase "w16" $ assertIsThm $ overflow svMinus (bvSubO :: SWord16 -> SWord16 -> (SBool, SBool)) , testCase "w32" $ assertIsThm $ overflow svMinus (bvSubO :: SWord32 -> SWord32 -> (SBool, SBool)) , testCase "w64" $ assertIsThm $ overflow svMinus (bvSubO :: SWord64 -> SWord64 -> (SBool, SBool)) , testCase "i8" $ assertIsThm $ overflow svMinus (bvSubO :: SInt8 -> SInt8 -> (SBool, SBool)) , testCase "i16" $ assertIsThm $ overflow svMinus (bvSubO :: SInt16 -> SInt16 -> (SBool, SBool)) , testCase "i32" $ assertIsThm $ overflow svMinus (bvSubO :: SInt32 -> SInt32 -> (SBool, SBool)) , testCase "i64" $ assertIsThm $ overflow svMinus (bvSubO :: SInt64 -> SInt64 -> (SBool, SBool)) ] , testGroup "mul-uf" [ testCase "w8" $ assertIsThm $ underflow svTimes (bvMulO :: SWord8 -> SWord8 -> (SBool, SBool)) , testCase "w16" $ assertIsThm $ underflow svTimes (bvMulO :: SWord16 -> SWord16 -> (SBool, SBool)) , testCase "w32" $ assertIsThm $ underflow svTimes (bvMulO :: SWord32 -> SWord32 -> (SBool, SBool)) , testCase "w64" $ assertIsThm $ underflow svTimes (bvMulO :: SWord64 -> SWord64 -> (SBool, SBool)) , testCase "i8" $ assertIsThm $ mulChkU bvMulOFast (bvMulO :: SInt8 -> SInt8 -> (SBool, SBool)) , testCase "i16" $ assertIsThm $ mulChkU bvMulOFast (bvMulO :: SInt16 -> SInt16 -> (SBool, SBool)) , testCase "i32" $ assertIsThm $ mulChkU bvMulOFast (bvMulO :: SInt32 -> SInt32 -> (SBool, SBool)) , testCase "i64" $ assertIsThm $ mulChkU bvMulOFast (bvMulO :: SInt64 -> SInt64 -> (SBool, SBool)) ] , testGroup "mul-of" [ testCase "w8" $ assertIsThm $ mulChkO bvMulOFast (bvMulO :: SWord8 -> SWord8 -> (SBool, SBool)) , testCase "w16" $ assertIsThm $ mulChkO bvMulOFast (bvMulO :: SWord16 -> SWord16 -> (SBool, SBool)) , testCase "w32" $ assertIsThm $ mulChkO bvMulOFast (bvMulO :: SWord32 -> SWord32 -> (SBool, SBool)) , testCase "w64" $ assertIsThm $ mulChkO bvMulOFast (bvMulO :: SWord64 -> SWord64 -> (SBool, SBool)) , testCase "i8" $ assertIsThm $ mulChkO bvMulOFast (bvMulO :: SInt8 -> SInt8 -> (SBool, SBool)) , testCase "i16" $ assertIsThm $ mulChkO bvMulOFast (bvMulO :: SInt16 -> SInt16 -> (SBool, SBool)) , testCase "i32" $ assertIsThm $ mulChkO bvMulOFast (bvMulO :: SInt32 -> SInt32 -> (SBool, SBool)) , testCase "i64" $ assertIsThm $ mulChkO bvMulOFast (bvMulO :: SInt64 -> SInt64 -> (SBool, SBool)) ] , testGroup "div-uf" [ testCase "w8" $ assertIsThm $ never svDivide (bvDivO :: SWord8 -> SWord8 -> (SBool, SBool)) , testCase "w16" $ assertIsThm $ never svDivide (bvDivO :: SWord16 -> SWord16 -> (SBool, SBool)) , testCase "w32" $ assertIsThm $ never svDivide (bvDivO :: SWord32 -> SWord32 -> (SBool, SBool)) , testCase "w64" $ assertIsThm $ never svDivide (bvDivO :: SWord64 -> SWord64 -> (SBool, SBool)) , testCase "i8" $ assertIsThm $ never svDivide (bvDivO :: SInt8 -> SInt8 -> (SBool, SBool)) , testCase "i16" $ assertIsThm $ never svDivide (bvDivO :: SInt16 -> SInt16 -> (SBool, SBool)) , testCase "i32" $ assertIsThm $ never svDivide (bvDivO :: SInt32 -> SInt32 -> (SBool, SBool)) , testCase "i64" $ assertIsThm $ never svDivide (bvDivO :: SInt64 -> SInt64 -> (SBool, SBool)) ] , testGroup "div-of" [ testCase "w8" $ assertIsThm $ never svDivide (bvDivO :: SWord8 -> SWord8 -> (SBool, SBool)) , testCase "w16" $ assertIsThm $ never svDivide (bvDivO :: SWord16 -> SWord16 -> (SBool, SBool)) , testCase "w32" $ assertIsThm $ never svDivide (bvDivO :: SWord32 -> SWord32 -> (SBool, SBool)) , testCase "w64" $ assertIsThm $ never svDivide (bvDivO :: SWord64 -> SWord64 -> (SBool, SBool)) , testCase "i8" $ assertIsThm $ divChk svDivide (bvDivO :: SInt8 -> SInt8 -> (SBool, SBool)) , testCase "i16" $ assertIsThm $ divChk svDivide (bvDivO :: SInt16 -> SInt16 -> (SBool, SBool)) , testCase "i32" $ assertIsThm $ divChk svDivide (bvDivO :: SInt32 -> SInt32 -> (SBool, SBool)) , testCase "i64" $ assertIsThm $ divChk svDivide (bvDivO :: SInt64 -> SInt64 -> (SBool, SBool)) ] , testGroup "neg-uf" [ testCase "w8" $ assertIsThm $ never1 svNeg0 (bvNegO :: SWord8 -> (SBool, SBool)) , testCase "w16" $ assertIsThm $ never1 svNeg0 (bvNegO :: SWord16 -> (SBool, SBool)) , testCase "w32" $ assertIsThm $ never1 svNeg0 (bvNegO :: SWord32 -> (SBool, SBool)) , testCase "w64" $ assertIsThm $ never1 svNeg0 (bvNegO :: SWord64 -> (SBool, SBool)) , testCase "i8" $ assertIsThm $ underflow1 svNeg0 (bvNegO :: SInt8 -> (SBool, SBool)) , testCase "i16" $ assertIsThm $ underflow1 svNeg0 (bvNegO :: SInt16 -> (SBool, SBool)) , testCase "i32" $ assertIsThm $ underflow1 svNeg0 (bvNegO :: SInt32 -> (SBool, SBool)) , testCase "i64" $ assertIsThm $ underflow1 svNeg0 (bvNegO :: SInt64 -> (SBool, SBool)) ] , testGroup "neg-of" [ testCase "w8" $ assertIsThm $ never1 svNeg0 (bvNegO :: SWord8 -> (SBool, SBool)) , testCase "w16" $ assertIsThm $ never1 svNeg0 (bvNegO :: SWord16 -> (SBool, SBool)) , testCase "w32" $ assertIsThm $ never1 svNeg0 (bvNegO :: SWord32 -> (SBool, SBool)) , testCase "w64" $ assertIsThm $ never1 svNeg0 (bvNegO :: SWord64 -> (SBool, SBool)) , testCase "i8" $ assertIsThm $ overflow1 svNeg0 (bvNegO :: SInt8 -> (SBool, SBool)) , testCase "i16" $ assertIsThm $ overflow1 svNeg0 (bvNegO :: SInt16 -> (SBool, SBool)) , testCase "i32" $ assertIsThm $ overflow1 svNeg0 (bvNegO :: SInt32 -> (SBool, SBool)) , testCase "i64" $ assertIsThm $ overflow1 svNeg0 (bvNegO :: SInt64 -> (SBool, SBool)) ] ] -- 256 bits is large enough to do all these proofs large :: Int large = 256 type SLarge = SVal svNeg0 :: SLarge -> SLarge svNeg0 v = z `svMinus` v where z = svInteger (KBounded (hasSign v) large) 0 exactlyWhen :: SBool -> SVal -> SBool exactlyWhen (SBV a) b = SBV $ (a `svAnd` b) `svOr` (svNot a `svAnd` svNot b) -- Properly extend to a dynamic large vector toLarge :: SBV a -> SLarge toLarge v | extra < 0 = error $ "toLarge: Unexpected size: " ++ show (n, large) | hasSign v = p `svJoin` dv | True = z `svJoin` dv where n = intSizeOf v extra = large - n dv = unSBV v mk = svInteger (KBounded True extra) z = mk 0 o = mk (-1) pos = (dv `svTestBit` (n-1)) `svEqual` svFalse p = svIte pos z o -- Multiplication checks are expensive. For these, we simply check that the SBV encodings and the z3 versions are equivalent mulChkO :: forall a. (SymWord a) => (SBV a -> SBV a -> (SBool, SBool)) -> (SBV a -> SBV a -> (SBool, SBool)) -> Predicate mulChkO fast slow = do setLogic Logic_NONE x <- free "x" y <- free "y" let (_, ov1) = x `fast` y (_, ov2) = x `slow` y return $ ov1 .== ov2 -- Underflow mults mulChkU :: forall a. (SymWord a) => (SBV a -> SBV a -> (SBool, SBool)) -> (SBV a -> SBV a -> (SBool, SBool)) -> Predicate mulChkU fast slow = do setLogic Logic_NONE x <- free "x" y <- free "y" let (uf1, _) = x `fast` y (uf2, _) = x `slow` y return $ uf1 .== uf2 -- Signed division can only underflow under one condition, check that simply instead of trying to do an expensive embedding proof divChk :: forall a. (Integral a, Bounded a, SymWord a) => (SLarge -> SLarge -> SLarge) -> (SBV a -> SBV a -> (SBool, SBool)) -> Predicate divChk _op cond = do x <- free "x" y <- free "y" let (_, overflowHappens) = x `cond` y special = (unSBV x `svEqual` topSet) `svAnd` (unSBV y `svEqual` neg1) n = intSizeOf x neg1 = svInteger (KBounded True n) (-1) topSet = svInteger (KBounded True n) (2^(n-1)) return $ overflowHappens `exactlyWhen` special -- For a few cases, we expect them to "never" overflow. The "embedding proofs" are either too expensive (in case of division), or -- not possible (in case of negation). We capture these here. never :: forall a. (Integral a, Bounded a, SymWord a) => (SLarge -> SLarge -> SLarge) -> (SBV a -> SBV a -> (SBool, SBool)) -> Predicate never _op cond = do x <- free "x" y <- free "y" let (underflowHappens, _) = x `cond` y return $ underflowHappens `exactlyWhen` svFalse never1 :: forall a. (Integral a, Bounded a, SymWord a) => (SLarge -> SLarge) -> (SBV a -> (SBool, SBool)) -> Predicate never1 _op cond = do x <- free "x" let (underflowHappens, _) = cond x return $ underflowHappens `exactlyWhen` svFalse underflow :: forall a. (Integral a, Bounded a, SymWord a) => (SLarge -> SLarge -> SLarge) -> (SBV a -> SBV a -> (SBool, SBool)) -> Predicate underflow op cond = do x <- free "x" y <- free "y" let (underflowHappens, _) = x `cond` y extResult :: SLarge extResult = toLarge x `op` toLarge y return $ underflowHappens `exactlyWhen` (extResult `svLessThan` toLarge (minBound :: SBV a)) overflow :: forall a. (Integral a, Bounded a, SymWord a) => (SLarge -> SLarge -> SLarge) -> (SBV a -> SBV a -> (SBool, SBool)) -> Predicate overflow op cond = do x <- free "x" y <- free "y" let (_, overflowHappens) = x `cond` y extResult :: SLarge extResult = toLarge x `op` toLarge y return $ overflowHappens `exactlyWhen` (extResult `svGreaterThan` toLarge (maxBound :: SBV a)) underflow1 :: forall a. (Integral a, Bounded a, SymWord a) => (SLarge -> SLarge) -> (SBV a -> (SBool, SBool)) -> Predicate underflow1 op cond = do x <- free "x" let (underflowHappens, _) = cond x extResult :: SLarge extResult = op $ toLarge x return $ underflowHappens `exactlyWhen` (extResult `svLessThan` toLarge (minBound :: SBV a)) overflow1 :: forall a. (Integral a, Bounded a, SymWord a) => (SLarge -> SLarge) -> (SBV a -> (SBool, SBool)) -> Predicate overflow1 op cond = do x <- free "x" let (_, overflowHappens) = cond x extResult :: SLarge extResult = op $ toLarge x return $ overflowHappens `exactlyWhen` (extResult `svGreaterThan` toLarge (maxBound :: SBV a)) {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/SBVTestSuite/TestSuite/Overflows/Casts.hs0000644000000000000000000003135513405536617020301 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Overflows.Casts -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for overflow checking ----------------------------------------------------------------------------- {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Overflows.Casts(tests) where import Data.SBV import Data.SBV.Tools.Overflow import Utils.SBVTestFramework type C a b = SBV a -> (SBV b, (SBool, SBool)) getBounds :: (Bounded a, Integral a) => a -> Maybe (Integer, Integer) getBounds x = Just (fromIntegral (minBound `asTypeOf` x), fromIntegral (maxBound `asTypeOf` x)) -- Test suite tests :: TestTree tests = testGroup "Overflows" [testGroup "Casts" ts] where ts = [ testGroup "w8" [ testCase "w8" $ assertIsThm $ chk (getBounds (undefined :: Word8 )) (sFromIntegralO :: C Word8 Word8) , testCase "w16" $ assertIsThm $ chk (getBounds (undefined :: Word16)) (sFromIntegralO :: C Word8 Word16) , testCase "w32" $ assertIsThm $ chk (getBounds (undefined :: Word32)) (sFromIntegralO :: C Word8 Word32) , testCase "w64" $ assertIsThm $ chk (getBounds (undefined :: Word64)) (sFromIntegralO :: C Word8 Word64) , testCase "i8" $ assertIsThm $ chk (getBounds (undefined :: Int8 )) (sFromIntegralO :: C Word8 Int8) , testCase "i16" $ assertIsThm $ chk (getBounds (undefined :: Int16 )) (sFromIntegralO :: C Word8 Int16) , testCase "i32" $ assertIsThm $ chk (getBounds (undefined :: Int32 )) (sFromIntegralO :: C Word8 Int32) , testCase "i64" $ assertIsThm $ chk (getBounds (undefined :: Int64 )) (sFromIntegralO :: C Word8 Int64) , testCase "i" $ assertIsThm $ chk Nothing (sFromIntegralO :: C Word8 Integer) ] , testGroup "w16" [ testCase "w8" $ assertIsThm $ chk (getBounds (undefined :: Word8 )) (sFromIntegralO :: C Word16 Word8) , testCase "w16" $ assertIsThm $ chk (getBounds (undefined :: Word16)) (sFromIntegralO :: C Word16 Word16) , testCase "w32" $ assertIsThm $ chk (getBounds (undefined :: Word32)) (sFromIntegralO :: C Word16 Word32) , testCase "w64" $ assertIsThm $ chk (getBounds (undefined :: Word64)) (sFromIntegralO :: C Word16 Word64) , testCase "i8" $ assertIsThm $ chk (getBounds (undefined :: Int8 )) (sFromIntegralO :: C Word16 Int8) , testCase "i16" $ assertIsThm $ chk (getBounds (undefined :: Int16 )) (sFromIntegralO :: C Word16 Int16) , testCase "i32" $ assertIsThm $ chk (getBounds (undefined :: Int32 )) (sFromIntegralO :: C Word16 Int32) , testCase "i64" $ assertIsThm $ chk (getBounds (undefined :: Int64 )) (sFromIntegralO :: C Word16 Int64) , testCase "i" $ assertIsThm $ chk Nothing (sFromIntegralO :: C Word16 Integer) ] , testGroup "w32" [ testCase "w8" $ assertIsThm $ chk (getBounds (undefined :: Word8 )) (sFromIntegralO :: C Word32 Word8) , testCase "w16" $ assertIsThm $ chk (getBounds (undefined :: Word16)) (sFromIntegralO :: C Word32 Word16) , testCase "w32" $ assertIsThm $ chk (getBounds (undefined :: Word32)) (sFromIntegralO :: C Word32 Word32) , testCase "w64" $ assertIsThm $ chk (getBounds (undefined :: Word64)) (sFromIntegralO :: C Word32 Word64) , testCase "i8" $ assertIsThm $ chk (getBounds (undefined :: Int8 )) (sFromIntegralO :: C Word32 Int8) , testCase "i16" $ assertIsThm $ chk (getBounds (undefined :: Int16 )) (sFromIntegralO :: C Word32 Int16) , testCase "i32" $ assertIsThm $ chk (getBounds (undefined :: Int32 )) (sFromIntegralO :: C Word32 Int32) , testCase "i64" $ assertIsThm $ chk (getBounds (undefined :: Int64 )) (sFromIntegralO :: C Word32 Int64) , testCase "i" $ assertIsThm $ chk Nothing (sFromIntegralO :: C Word32 Integer) ] , testGroup "w64" [ testCase "w8" $ assertIsThm $ chk (getBounds (undefined :: Word8 )) (sFromIntegralO :: C Word64 Word8) , testCase "w16" $ assertIsThm $ chk (getBounds (undefined :: Word16)) (sFromIntegralO :: C Word64 Word16) , testCase "w32" $ assertIsThm $ chk (getBounds (undefined :: Word32)) (sFromIntegralO :: C Word64 Word32) , testCase "w64" $ assertIsThm $ chk (getBounds (undefined :: Word64)) (sFromIntegralO :: C Word64 Word64) , testCase "i8" $ assertIsThm $ chk (getBounds (undefined :: Int8 )) (sFromIntegralO :: C Word64 Int8) , testCase "i16" $ assertIsThm $ chk (getBounds (undefined :: Int16 )) (sFromIntegralO :: C Word64 Int16) , testCase "i32" $ assertIsThm $ chk (getBounds (undefined :: Int32 )) (sFromIntegralO :: C Word64 Int32) , testCase "i64" $ assertIsThm $ chk (getBounds (undefined :: Int64 )) (sFromIntegralO :: C Word64 Int64) , testCase "i" $ assertIsThm $ chk Nothing (sFromIntegralO :: C Word64 Integer) ] , testGroup "i8" [ testCase "w8" $ assertIsThm $ chk (getBounds (undefined :: Word8 )) (sFromIntegralO :: C Int8 Word8) , testCase "w16" $ assertIsThm $ chk (getBounds (undefined :: Word16)) (sFromIntegralO :: C Int8 Word16) , testCase "w32" $ assertIsThm $ chk (getBounds (undefined :: Word32)) (sFromIntegralO :: C Int8 Word32) , testCase "w64" $ assertIsThm $ chk (getBounds (undefined :: Word64)) (sFromIntegralO :: C Int8 Word64) , testCase "i8" $ assertIsThm $ chk (getBounds (undefined :: Int8 )) (sFromIntegralO :: C Int8 Int8) , testCase "i16" $ assertIsThm $ chk (getBounds (undefined :: Int16 )) (sFromIntegralO :: C Int8 Int16) , testCase "i32" $ assertIsThm $ chk (getBounds (undefined :: Int32 )) (sFromIntegralO :: C Int8 Int32) , testCase "i64" $ assertIsThm $ chk (getBounds (undefined :: Int64 )) (sFromIntegralO :: C Int8 Int64) , testCase "i" $ assertIsThm $ chk Nothing (sFromIntegralO :: C Int8 Integer) ] , testGroup "i16" [ testCase "w8" $ assertIsThm $ chk (getBounds (undefined :: Word8 )) (sFromIntegralO :: C Int16 Word8) , testCase "w16" $ assertIsThm $ chk (getBounds (undefined :: Word16)) (sFromIntegralO :: C Int16 Word16) , testCase "w32" $ assertIsThm $ chk (getBounds (undefined :: Word32)) (sFromIntegralO :: C Int16 Word32) , testCase "w64" $ assertIsThm $ chk (getBounds (undefined :: Word64)) (sFromIntegralO :: C Int16 Word64) , testCase "i8" $ assertIsThm $ chk (getBounds (undefined :: Int8 )) (sFromIntegralO :: C Int16 Int8) , testCase "i16" $ assertIsThm $ chk (getBounds (undefined :: Int16 )) (sFromIntegralO :: C Int16 Int16) , testCase "i32" $ assertIsThm $ chk (getBounds (undefined :: Int32 )) (sFromIntegralO :: C Int16 Int32) , testCase "i64" $ assertIsThm $ chk (getBounds (undefined :: Int64 )) (sFromIntegralO :: C Int16 Int64) , testCase "i" $ assertIsThm $ chk Nothing (sFromIntegralO :: C Int16 Integer) ] , testGroup "i32" [ testCase "w8" $ assertIsThm $ chk (getBounds (undefined :: Word8 )) (sFromIntegralO :: C Int32 Word8) , testCase "w16" $ assertIsThm $ chk (getBounds (undefined :: Word16)) (sFromIntegralO :: C Int32 Word16) , testCase "w32" $ assertIsThm $ chk (getBounds (undefined :: Word32)) (sFromIntegralO :: C Int32 Word32) , testCase "w64" $ assertIsThm $ chk (getBounds (undefined :: Word64)) (sFromIntegralO :: C Int32 Word64) , testCase "i8" $ assertIsThm $ chk (getBounds (undefined :: Int8 )) (sFromIntegralO :: C Int32 Int8) , testCase "i16" $ assertIsThm $ chk (getBounds (undefined :: Int16 )) (sFromIntegralO :: C Int32 Int16) , testCase "i32" $ assertIsThm $ chk (getBounds (undefined :: Int32 )) (sFromIntegralO :: C Int32 Int32) , testCase "i64" $ assertIsThm $ chk (getBounds (undefined :: Int64 )) (sFromIntegralO :: C Int32 Int64) , testCase "i" $ assertIsThm $ chk Nothing (sFromIntegralO :: C Int32 Integer) ] , testGroup "i64" [ testCase "w8" $ assertIsThm $ chk (getBounds (undefined :: Word8 )) (sFromIntegralO :: C Int64 Word8) , testCase "w16" $ assertIsThm $ chk (getBounds (undefined :: Word16)) (sFromIntegralO :: C Int64 Word16) , testCase "w32" $ assertIsThm $ chk (getBounds (undefined :: Word32)) (sFromIntegralO :: C Int64 Word32) , testCase "w64" $ assertIsThm $ chk (getBounds (undefined :: Word64)) (sFromIntegralO :: C Int64 Word64) , testCase "i8" $ assertIsThm $ chk (getBounds (undefined :: Int8 )) (sFromIntegralO :: C Int64 Int8) , testCase "i16" $ assertIsThm $ chk (getBounds (undefined :: Int16 )) (sFromIntegralO :: C Int64 Int16) , testCase "i32" $ assertIsThm $ chk (getBounds (undefined :: Int32 )) (sFromIntegralO :: C Int64 Int32) , testCase "i64" $ assertIsThm $ chk (getBounds (undefined :: Int64 )) (sFromIntegralO :: C Int64 Int64) , testCase "i" $ assertIsThm $ chk Nothing (sFromIntegralO :: C Int64 Integer) ] , testGroup "i" [ testCase "w8" $ assertIsThm $ chk (getBounds (undefined :: Word8 )) (sFromIntegralO :: C Integer Word8) , testCase "w16" $ assertIsThm $ chk (getBounds (undefined :: Word16)) (sFromIntegralO :: C Integer Word16) , testCase "w32" $ assertIsThm $ chk (getBounds (undefined :: Word32)) (sFromIntegralO :: C Integer Word32) , testCase "w64" $ assertIsThm $ chk (getBounds (undefined :: Word64)) (sFromIntegralO :: C Integer Word64) , testCase "i8" $ assertIsThm $ chk (getBounds (undefined :: Int8 )) (sFromIntegralO :: C Integer Int8) , testCase "i16" $ assertIsThm $ chk (getBounds (undefined :: Int16 )) (sFromIntegralO :: C Integer Int16) , testCase "i32" $ assertIsThm $ chk (getBounds (undefined :: Int32 )) (sFromIntegralO :: C Integer Int32) , testCase "i64" $ assertIsThm $ chk (getBounds (undefined :: Int64 )) (sFromIntegralO :: C Integer Int64) , testCase "i" $ assertIsThm $ chk Nothing (sFromIntegralO :: C Integer Integer) ] ] chk :: forall a b. (SymWord a, SymWord b, Integral a, Integral b) => Maybe (Integer, Integer) -> (SBV a -> (SBV b, (SBool, SBool))) -> Predicate chk mb cvt = do (x :: SBV a) <- free "x" let (_ :: SBV b, (uf, ov)) = cvt x ix :: SInteger ix = sFromIntegral x (ufCorrect, ovCorrect) = case mb of Nothing -> (uf .== false, ov .== false) Just (lb, ub) -> (uf <=> ix .< literal lb, ov <=> ix .> literal ub) return $ ufCorrect &&& ovCorrect sbv-7.13/SBVTestSuite/TestSuite/Polynomials/0000755000000000000000000000000013405536617017201 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/Polynomials/Polynomials.hs0000644000000000000000000000143113405536617022042 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Polynomials.Polynomials -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Polynomials.Polynomials ----------------------------------------------------------------------------- module TestSuite.Polynomials.Polynomials(tests) where import Documentation.SBV.Examples.Misc.Polynomials import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Polynomials.Polynomials" [ testCase "polynomial-1" (assertIsThm multUnit) , testCase "polynomial-2" (assertIsThm multComm) , testCase "polynomial-3" (assertIsThm polyDivMod) ] sbv-7.13/SBVTestSuite/TestSuite/Puzzles/0000755000000000000000000000000013405536617016347 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/Puzzles/Coins.hs0000644000000000000000000000164213405536617017761 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Puzzles.Coins -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Puzzles.Coins ----------------------------------------------------------------------------- module TestSuite.Puzzles.Coins(tests) where import Documentation.SBV.Examples.Puzzles.Coins import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Puzzles.Coins" [ goldenVsStringShow "coins" coinsPgm ] where coinsPgm = runSAT $ do cs <- mapM mkCoin [1..6] mapM_ constrain [c s | s <- combinations cs, length s >= 2, c <- [c1, c2, c3, c4, c5, c6]] constrain $ bAnd $ zipWith (.>=) cs (tail cs) output $ sum cs .== 115 sbv-7.13/SBVTestSuite/TestSuite/Puzzles/Counts.hs0000644000000000000000000000141313405536617020155 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Puzzles.Counts -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Puzzles.Counts ----------------------------------------------------------------------------- module TestSuite.Puzzles.Counts(tests) where import Documentation.SBV.Examples.Puzzles.Counts import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Puzzles.Counts" [ goldenVsStringShow "counts" countPgm ] where countPgm = runSAT $ forAll_ puzzle' >>= output puzzle' d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 = puzzle [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9] sbv-7.13/SBVTestSuite/TestSuite/Puzzles/DogCatMouse.hs0000644000000000000000000000226713405536617021064 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Puzzles.DogCatMouse -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Puzzles.DogCatMouse ----------------------------------------------------------------------------- module TestSuite.Puzzles.DogCatMouse(tests) where import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Puzzles.DogCatMouse" [ goldenVsStringShow "dogCatMouse" (allSat p) ] where p = do [dog, cat, mouse] <- sIntegers ["dog", "cat", "mouse"] solve [ dog .>= 1 -- at least one dog , cat .>= 1 -- at least one cat , mouse .>= 1 -- at least one mouse , dog + cat + mouse .== 100 -- buy precisely 100 animals , 1500 * dog + 100 * cat + 25 * mouse .== 10000 -- spend exactly 100 dollars (use cents since we don't have fractions) ] sbv-7.13/SBVTestSuite/TestSuite/Puzzles/Euler185.hs0000644000000000000000000000122213405536617020212 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Puzzles.Euler185 -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Puzzles.Euler185 ----------------------------------------------------------------------------- module TestSuite.Puzzles.Euler185(tests) where import Documentation.SBV.Examples.Puzzles.Euler185 import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Puzzles.Euler185" [ goldenVsStringShow "euler185" (allSat euler185) ] sbv-7.13/SBVTestSuite/TestSuite/Puzzles/MagicSquare.hs0000644000000000000000000000144113405536617021104 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Puzzles.MagicSquare -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Puzzles.MagicSquare ----------------------------------------------------------------------------- module TestSuite.Puzzles.MagicSquare(tests) where import Documentation.SBV.Examples.Puzzles.MagicSquare import Utils.SBVTestFramework tests :: TestTree tests = testGroup "Puzzles.MagicSquare" [ testCase "magic 2" (assertIsntSat (mkMagic 2)) , testCase "magic 3" (assertIsSat (mkMagic 3)) ] mkMagic :: Int -> Symbolic SBool mkMagic n = (isMagic . chunk n) `fmap` mkExistVars (n*n) sbv-7.13/SBVTestSuite/TestSuite/Puzzles/NQueens.hs0000644000000000000000000000257213405536617020267 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Puzzles.NQueens -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Puzzles.NQueens ----------------------------------------------------------------------------- module TestSuite.Puzzles.NQueens(tests) where import Documentation.SBV.Examples.Puzzles.NQueens import Utils.SBVTestFramework tests :: TestTree tests = testGroup "Puzzles.NQueens" -- number of *distinct* solutions is given in http://en.wikipedia.org/wiki/Eight_queens_puzzle [ testCase "nQueens 1" (assert $ (== 1) `fmap` numberOfModels (mkQueens 1)) , testCase "nQueens 2" (assert $ (== 0) `fmap` numberOfModels (mkQueens 2)) , testCase "nQueens 3" (assert $ (== 0) `fmap` numberOfModels (mkQueens 3)) , testCase "nQueens 4" (assert $ (== 2) `fmap` numberOfModels (mkQueens 4)) , testCase "nQueens 5" (assert $ (== 10) `fmap` numberOfModels (mkQueens 5)) , testCase "nQueens 6" (assert $ (== 4) `fmap` numberOfModels (mkQueens 6)) , testCase "nQueens 7" (assert $ (== 40) `fmap` numberOfModels (mkQueens 7)) , testCase "nQueens 8" (assert $ (== 92) `fmap` numberOfModels (mkQueens 8)) ] mkQueens :: Int -> Symbolic SBool mkQueens n = isValid n `fmap` mkExistVars n sbv-7.13/SBVTestSuite/TestSuite/Puzzles/PowerSet.hs0000644000000000000000000000153013405536617020452 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Puzzles.PowerSet -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.Puzzles.PowerSet ----------------------------------------------------------------------------- module TestSuite.Puzzles.PowerSet(tests) where import Utils.SBVTestFramework tests :: TestTree tests = testGroup "Puzzles.PowerSet" [ testCase ("powerSet " ++ show i) (assert (pSet i)) | i <- [0 .. 7] ] pSet :: Int -> IO Bool pSet n = do cnt <- numberOfModels $ do mapM_ (\i -> sBool ("e" ++ show i)) [1..n] -- Look ma! No constraints! return (true :: SBool) return (cnt == 2^n) sbv-7.13/SBVTestSuite/TestSuite/Puzzles/Sudoku.hs0000644000000000000000000000155713405536617020165 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Puzzles.Sudoku -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Puzzles.Sudoku ----------------------------------------------------------------------------- module TestSuite.Puzzles.Sudoku(tests) where import Documentation.SBV.Examples.Puzzles.Sudoku import Utils.SBVTestFramework tests :: TestTree tests = testGroup "Puzzles.Sudoku" [ testCase ("sudoku " ++ show n) (assert (checkPuzzle s)) | (n, s) <- zip [(0::Int)..] [puzzle0, puzzle1, puzzle2, puzzle3, puzzle4, puzzle5, puzzle6] ] checkPuzzle :: Puzzle -> IO Bool checkPuzzle (i, f) = isSatisfiable $ (valid . f) `fmap` mkExistVars i sbv-7.13/SBVTestSuite/TestSuite/Puzzles/Temperature.hs0000644000000000000000000000230413405536617021177 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Puzzles.Temperature -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.Puzzles.Temperature ----------------------------------------------------------------------------- module TestSuite.Puzzles.Temperature(tests) where import Utils.SBVTestFramework import Data.List (sort) import qualified Data.Map as M -- Test suite tests :: TestTree tests = testGroup "Puzzles.Temperature" [ goldenVsStringShow "temperature" result ] where result = (sort . concatMap M.toList . getModelDictionaries) `fmap` allSat (revOf `fmap` exists_) type Temp = SInteger -- convert celcius to fahrenheit, rounding up/down properly -- we have to be careful here to make sure rounding is done properly.. d2f :: Temp -> Temp d2f d = 32 + ite (fr .>= 5) (1+fi) fi where (fi, fr) = (18 * d) `sQuotRem` 10 -- puzzle: What 2 digit fahrenheit/celcius values are reverses of each other? revOf :: Temp -> SBool revOf c = swap (digits c) .== digits (d2f c) where digits x = x `sQuotRem` 10 swap (a, b) = (b, a) sbv-7.13/SBVTestSuite/TestSuite/Puzzles/U2Bridge.hs0000644000000000000000000000250113405536617020304 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Puzzles.U2Bridge -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Puzzles.U2Bridge ----------------------------------------------------------------------------- module TestSuite.Puzzles.U2Bridge(tests) where import Documentation.SBV.Examples.Puzzles.U2Bridge import Data.List(sortOn) import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Puzzles.U2Bridge" [ testCase "U2Bridge_cnt1" (assert $ (0 ==) `fmap` count 1) , testCase "U2Bridge_cnt2" (assert $ (0 ==) `fmap` count 2) , testCase "U2Bridge_cnt3" (assert $ (0 ==) `fmap` count 3) , testCase "U2Bridge_cnt4" (assert $ (0 ==) `fmap` count 4) , testCase "U2Bridge_cnt6" (assert $ (0 ==) `fmap` count 6) , goldenVsStringShow "U2Bridge" (slv 5) ] where act = do b <- exists_; p1 <- exists_; p2 <- exists_; return (b, p1, p2) count n = numberOfModels $ isValid `fmap` mapM (const act) [1..(n::Int)] slv n = rearrange `fmap` allSat (isValid `fmap` mapM (const act) [1..(n::Int)]) rearrange (AllSatResult (b1, b2, ms)) = AllSatResult (b1, b2, sortOn (show . SatResult) ms) sbv-7.13/SBVTestSuite/TestSuite/Queries/0000755000000000000000000000000013405536617016310 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/Queries/BadOption.hs0000644000000000000000000000207113405536617020523 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.BadOption -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing that a bad option setting is caught properly. ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Queries.BadOption (tests) where import Data.SBV.Control import qualified Control.Exception as C import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.QueryIndividual" [ goldenCapturedIO "query_badOption" $ \rf -> runSMTWith z3{verbose=True, redirectVerbose=Just rf} q `C.catch` (\(e::C.SomeException) -> appendFile rf ("\n" ++ show e)) ] q :: Symbolic () q = do _ <- sInteger "x" setOption $ OptionKeyword ":there-is-no-such-option" ["bad", "argument"] query $ return () sbv-7.13/SBVTestSuite/TestSuite/Queries/BasicQuery.hs0000644000000000000000000001047513405536617020722 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.BasicQuery -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- A hodgepodge of query commands ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Queries.BasicQuery (tests) where import Data.SBV.Control import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.Query" [ goldenCapturedIO "query1" testQuery ] testQuery :: FilePath -> IO () testQuery rf = do r <- runSMTWith defaultSMTCfg{verbose=True, redirectVerbose=Just rf} query1 appendFile rf ("\n FINAL:" ++ show (SatResult r) ++ "\nDONE!\n") query1 :: Symbolic SMTResult query1 = do a <- sInteger "a" b <- sInteger "b" c <- sFloat "c" d <- sBool "d" e <- sReal "e" f :: SInt8 <- free_ namedConstraint "a > 0" $ a .> 0 constrain $ b .> 0 setOption $ ProduceUnsatCores True setOption $ ProduceUnsatAssumptions True setOption $ ProduceProofs True setOption $ ProduceInterpolants True setOption $ RandomSeed 123 setOption $ ProduceAssertions True setOption $ OptionKeyword ":smt.mbqi" ["true"] setOption $ ProduceAssignments True setInfo ":status" ["sat"] setInfo ":bad" ["what"] query $ do constrain $ a+2 .>= 5 namedConstraint "a+b_<_12" $ a+b .< 12 _ <- getOption DiagnosticOutputChannel _ <- getOption ProduceAssertions _ <- getOption ProduceAssignments _ <- getOption ProduceProofs _ <- getOption ProduceInterpolants _ <- getOption ProduceUnsatAssumptions _ <- getOption ProduceUnsatCores _ <- getOption RandomSeed _ <- getOption ReproducibleResourceLimit _ <- getOption SMTVerbosity _ <- getOption (OptionKeyword ":smt.mbqi") _ <- getOption (OptionKeyword ":smt.mbqi") _ <- getInfo ReasonUnknown _ <- getInfo (InfoKeyword ":version") _ <- getInfo (InfoKeyword ":status") namedConstraint "later, a > 4" $ a .> 4 cs <- checkSat case cs of Sat -> return () Unk -> getInfo ReasonUnknown >>= error . show r -> error $ "Something went bad, why not-sat/unk?: " ++ show r setInfo ":status" ["unknown"] _ <- checkSatAssumingWithUnsatisfiableSet [a .> 2] _ <- checkSatAssuming [a .> 2] _ <- getAssignment -- ends up printing different numbers on different machines.. -- _ <- getInfo AllStatistics _ <- getInfo AssertionStackLevels _ <- getInfo Authors _ <- getInfo ErrorBehavior _ <- getInfo Name _ <- getInfo ReasonUnknown _ <- getInfo Version _ <- getInfo (InfoKeyword ":memory") _ <- getInfo (InfoKeyword ":time") -- Query a/b av <- getValue a bv <- getValue b _ <- checkSatAssumingWithUnsatisfiableSet [a .> 100, a .> 9] push 5 pop 3 _ <- getAssertionStackDepth -- Now assert so that we get even a bigger value.. namedConstraint "bey" $ a .> literal (av + bv) namedConstraint "hey" $ a .< literal (av + bv) _ <- checkSat _ <- timeout 80000 getUnsatCore _ <- getProof _ <- timeout 90000 getAssertions echo "there we go" -- fake it! mkSMTResult [ a |-> 332 , b |-> 3 , c |-> 2.3 , d |-> True , e |-> 3.12 , f |-> (-12) ] sbv-7.13/SBVTestSuite/TestSuite/Queries/Enums.hs0000644000000000000000000000251013405536617017731 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.Enums -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Uninterpreted.AUF ----------------------------------------------------------------------------- {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Queries.Enums where import Data.SBV.Control import Utils.SBVTestFramework data BinOp = Plus | Minus | Times mkSymbolicEnumeration ''BinOp -- Test suite tests :: TestTree tests = testGroup "Queries.Enums" [ goldenCapturedIO "qEnum1" $ \rf -> runSMTWith defaultSMTCfg{verbose=True, redirectVerbose=Just rf} test ] type SBinOp = SBV BinOp test :: Symbolic () test = do p :: SBinOp <- free "p" m :: SBinOp <- free "m" t :: SBinOp <- free "t" constrain $ p .<= m constrain $ m .<= t constrain $ distinct [p, m, t] query $ do _ <- checkSat _ <- getValue p _ <- getValue m _ <- getValue t return () sbv-7.13/SBVTestSuite/TestSuite/Queries/FreshVars.hs0000644000000000000000000001741613405536617020560 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.FreshVars -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing fresh-vars in query mode ----------------------------------------------------------------------------- {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedLists #-} module TestSuite.Queries.FreshVars (tests) where import Data.SBV.Control import Utils.SBVTestFramework data BinOp = Plus | Minus | Times mkSymbolicEnumeration ''BinOp -- Test suite tests :: TestTree tests = testGroup "Basics.Query" [ goldenCapturedIO "freshVars" testQuery ] testQuery :: FilePath -> IO () testQuery rf = do r <- runSMTWith defaultSMTCfg{verbose=True, redirectVerbose=Just rf} fv appendFile rf ("\n FINAL:" ++ show (SatResult r) ++ "\nDONE!\n") type SBinOp = SBV BinOp fv :: Symbolic SMTResult fv = do a <- sInteger "a" constrain $ a .== 0 setOption $ OptionKeyword ":pp.max_depth" ["4294967295"] setOption $ OptionKeyword ":pp.min_alias_size" ["4294967295"] query $ do vBool :: SBool <- freshVar "vBool" vWord8 :: SWord8 <- freshVar "vWord8" vWord16 :: SWord16 <- freshVar_ vWord32 :: SWord32 <- freshVar_ vWord64 :: SWord64 <- freshVar "vWord64" vInt8 :: SInt8 <- freshVar "vInt8" vInt16 :: SInt16 <- freshVar_ vInt32 :: SInt32 <- freshVar_ vInt64 :: SInt64 <- freshVar "vInt64" vFloat :: SFloat <- freshVar "vFloat" vDouble :: SDouble <- freshVar_ vReal :: SReal <- freshVar_ vInteger :: SInteger <- freshVar "vInteger" vBinOp :: SBinOp <- freshVar "vBinOp" constrain vBool constrain $ vWord8 .== 1 constrain $ vWord16 .== 2 constrain $ vWord32 .== 3 constrain $ vWord64 .== 4 constrain $ vInt8 .== 5 constrain $ vInt16 .== 6 constrain $ vInt32 .== 7 constrain $ vInt64 .== 8 constrain $ vFloat .== 9 constrain $ vDouble .== 10 constrain $ vReal .== 11 constrain $ vInteger .== 12 constrain $ vBinOp .== literal Plus vSArray :: SArray Integer Integer <- freshArray "vSArray" Nothing vFArray :: SFunArray Bool Char <- freshArray "vFArray" Nothing vi1 <- freshVar "i1" vi2 <- freshVar "i2" constrain $ readArray vSArray vi1 .== 2 constrain $ readArray vFArray vi2 .== literal 'a' viSArray :: SArray Integer Integer <- freshArray "viSArray" (Just (literal 42)) viFArray :: SFunArray Bool Char <- freshArray "viFArray" (Just (literal 'X')) mustBe42 <- freshVar "mustBe42" mustBeX <- freshVar "mustBeX" constrain $ readArray viSArray 96 .== mustBe42 constrain $ readArray viFArray false .== mustBeX constrain $ vi1 .== 1 constrain $ bnot vi2 vString :: SString <- freshVar "vString" vList1 :: SList Integer <- freshVar "vList1" vList2 :: SList [Integer] <- freshVar "vList2" vList3 :: SList Word8 <- freshVar "vList3" vList4 :: SList [Word16] <- freshVar "vList4" constrain $ vString .== "hello" constrain $ vList1 .== [1,2,3,4] constrain $ vList2 .== [[1,2,3], [4,5,6,7]] constrain $ vList3 .== [1,2] constrain $ vList4 .== [[1,2,3],[],[4,5,6]] cs <- checkSat case cs of Sat -> do aVal <- getValue a vBoolVal <- getValue vBool vWord8Val <- getValue vWord8 vWord16Val <- getValue vWord16 vWord32Val <- getValue vWord32 vWord64Val <- getValue vWord64 vInt8Val <- getValue vInt8 vInt16Val <- getValue vInt16 vInt32Val <- getValue vInt32 vInt64Val <- getValue vInt64 vFloatVal <- getValue vFloat vDoubleVal <- getValue vDouble vRealVal <- getValue vReal vIntegerVal <- getValue vInteger vBinOpVal <- getValue vBinOp vi1Val <- getValue vi1 vi2Val <- getValue vi2 mustBe42Val <- getValue mustBe42 mustBeXVal <- getValue mustBeX vStringVal <- getValue vString vList1Val <- getValue vList1 vList2Val <- getValue vList2 vList3Val <- getValue vList3 vList4Val <- getValue vList4 mkSMTResult [ a |-> aVal , vBool |-> vBoolVal , vWord8 |-> vWord8Val , vWord16 |-> vWord16Val , vWord32 |-> vWord32Val , vWord64 |-> vWord64Val , vInt8 |-> vInt8Val , vInt16 |-> vInt16Val , vInt32 |-> vInt32Val , vInt64 |-> vInt64Val , vFloat |-> vFloatVal , vDouble |-> vDoubleVal , vReal |-> vRealVal , vInteger |-> vIntegerVal , vBinOp |-> vBinOpVal , vi1 |-> vi1Val , vi2 |-> vi2Val , mustBe42 |-> mustBe42Val , mustBeX |-> mustBeXVal , vString |-> vStringVal , vList1 |-> vList1Val , vList2 |-> vList2Val , vList3 |-> vList3Val , vList4 |-> vList4Val ] _ -> error "didn't expect non-Sat here!" sbv-7.13/SBVTestSuite/TestSuite/Queries/Int_ABC.hs0000644000000000000000000000300213405536617020036 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.Int_ABC -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing ABC specific interactive features. ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Queries.Int_ABC (tests) where import Data.SBV.Control import Control.Monad (unless) import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.QueryIndividual" [ goldenCapturedIO "query_abc" $ \rf -> runSMTWith abc{verbose=True, redirectVerbose=Just rf} q ] q :: Symbolic () q = do a <- sInt32 "a" b <- sInt32 "b" constrain $ a .> 0 constrain $ b .> 0 -- this is severely limited since ABC doesn't like multi check-sat calls, oh well. query $ do constrain $ a+2 .<= 15 constrain $ a .< 2 constrain $ b .< 2 constrain $ a+b .< 12 constrain $ a .< 2 cs <- checkSat case cs of Unk -> getInfo ReasonUnknown >>= error . show Unsat -> error "Got UNSAT!" Sat -> do -- Query a/b res <- (,) <$> getValue a <*> getValue b unless (res == (1, 1)) $ error $ "Didn't get (1,1): " ++ show res sbv-7.13/SBVTestSuite/TestSuite/Queries/Int_Boolector.hs0000644000000000000000000000312313405536617021405 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.Int_Boolector -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing Boolector specific interactive features. ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Queries.Int_Boolector (tests) where import Data.SBV.Control import Control.Monad (unless) import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.QueryIndividual" [ goldenCapturedIO "query_boolector" $ \rf -> runSMTWith boolector{verbose=True, redirectVerbose=Just rf} q ] q :: Symbolic () q = do a <- sInt32 "a" b <- sInt32 "b" constrain $ a .> 0 constrain $ b .> 0 query $ do constrain $ a+2 .<= 15 constrain $ a .< 3 constrain $ b .< 2 constrain $ a+b .< 12 constrain $ a .< 2 cs <- checkSat case cs of Sat -> return () Unk -> getInfo ReasonUnknown >>= error . show r -> error $ "Something went bad, why not-sat/unk?: " ++ show r -- Now assert so that we get even a bigger value.. constrain $ a .>= 1 _ <- checkSat res <- (,) <$> getValue a <*> getValue b unless (res == (1, 1)) $ error $ "Didn't get (1,1): " ++ show res sbv-7.13/SBVTestSuite/TestSuite/Queries/Int_CVC4.hs0000644000000000000000000000345113405536617020160 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.Int_CVC4 -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing CVC4 specific interactive features ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Queries.Int_CVC4 (tests) where import Data.SBV.Control import Control.Monad (unless) import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.QueryIndividual" [ goldenCapturedIO "query_cvc4" $ \rf -> runSMTWith cvc4{verbose=True, redirectVerbose=Just rf} q ] q :: Symbolic () q = do a <- sInt32 "a" b <- sInt32 "b" namedConstraint "a > 0" $ a .> 0 constrain $ b .> 0 query $ do constrain $ a+2 .<= 15 constrain $ a .< 3 constrain $ b .< 2 namedConstraint "a+b_<_12" $ a+b .< 12 av <- inNewAssertionStack $ do constrain $ a .< 2 cs <- checkSat case cs of Sat -> return () Unk -> getInfo ReasonUnknown >>= error . show r -> error $ "Something went bad, why not-sat/unk?: " ++ show r getValue a -- Now assert so that we get even a bigger value.. namedConstraint "extra" $ a .> literal av constrain $ b .< 2 _ <- checkSat res <- (,) <$> getValue a <*> getValue b unless (res == (2, 1)) $ error $ "Didn't get (2,1): " ++ show res sbv-7.13/SBVTestSuite/TestSuite/Queries/Int_Mathsat.hs0000644000000000000000000000316613405536617021065 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.Int_Mathsat -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing MathSAT specific interactive features. ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Queries.Int_Mathsat (tests) where import Data.SBV.Control import Control.Monad (unless) import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.QueryIndividual" [ goldenCapturedIO "query_mathsat" $ \rf -> runSMTWith mathSAT{verbose=True, redirectVerbose=Just rf} q ] q :: Symbolic () q = do a <- sInt32 "a" b <- sInt32 "b" namedConstraint "a > 0" $ a .> 0 constrain $ b .> 0 query $ do constrain $ a+2 .<= 15 constrain $ a .< 3 constrain $ b .< 2 namedConstraint "a+b_<_12" $ a+b .< 12 constrain $ a .< 2 cs <- checkSat case cs of Sat -> return () Unk -> getInfo ReasonUnknown >>= error . show r -> error $ "Something went bad, why not-sat/unk?: " ++ show r -- Now assert so that we get even a bigger value.. namedConstraint "extra" $ a .>= 1 _ <- checkSat res <- (,) <$> getValue a <*> getValue b unless (res == (1, 1)) $ error $ "Didn't get (1,1): " ++ show res sbv-7.13/SBVTestSuite/TestSuite/Queries/Int_Yices.hs0000644000000000000000000000315413405536617020535 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.Int_Yices -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing Yices specific interactive features. ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Queries.Int_Yices (tests) where import Data.SBV.Control import Control.Monad (unless) import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.QueryIndividual" [ goldenCapturedIO "query_yices" $ \rf -> runSMTWith yices{verbose=True, redirectVerbose=Just rf} q ] q :: Symbolic () q = do a <- sInt32 "a" b <- sInt32 "b" namedConstraint "a > 0" $ a .> 0 constrain $ b .> 0 query $ do constrain $ a+2 .<= 15 constrain $ a .< 3 constrain $ b .< 2 namedConstraint "a+b_<_12" $ a+b .< 12 constrain $ a .< 2 cs <- checkSat case cs of Sat -> return () Unk -> getInfo ReasonUnknown >>= error . show r -> error $ "Something went bad, why not-sat/unk?: " ++ show r -- Now assert so that we get even a bigger value.. namedConstraint "extra" $ a .>= 1 _ <- checkSat res <- (,) <$> getValue a <*> getValue b unless (res == (1, 1)) $ error $ "Didn't get (1,1): " ++ show res sbv-7.13/SBVTestSuite/TestSuite/Queries/Int_Z3.hs0000644000000000000000000000351213405536617017753 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.Int_Z3 -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing Z3 specific interactive features. ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Queries.Int_Z3 (tests) where import Data.SBV.Control import Control.Monad (unless) import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.QueryIndividual" [ goldenCapturedIO "query_z3" $ \rf -> runSMTWith z3{verbose=True, redirectVerbose=Just rf} q ] q :: Symbolic () q = do a <- sInt32 "a" b <- sInt32 "b" namedConstraint "a > 0" $ a .> 0 constrain $ b .> 0 query $ do constrain $ a+2 .<= 15 constrain $ a .< 3 constrain $ b .< 2 namedConstraint "a+b_<_12" $ a+b .< 12 gv <- inNewAssertionStack $ do constrain $ a .< 2 cs <- checkSat case cs of Sat -> return () Unk -> getInfo ReasonUnknown >>= error . show r -> error $ "Something went bad, why not-sat/unk?: " ++ show r -- Query a/b getValue a -- Now assert so that we get even a bigger value.. namedConstraint "extra" $ a .> literal gv constrain $ b .< 2 _ <- checkSat res <- (,) <$> getValue a <*> getValue b unless (res == (2, 1)) $ error $ "Didn't get (2,1): " ++ show res sbv-7.13/SBVTestSuite/TestSuite/Queries/Interpolants.hs0000644000000000000000000000362613405536617021335 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.Interpolants -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing a few interpolant computations. -- ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Queries.Interpolants (tests) where import Data.SBV.Control import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.QueryInterpolants" [ goldenCapturedIO "query_Interpolant1" $ testQuery q1 , goldenCapturedIO "query_Interpolant2" $ testQuery q2 ] testQuery :: Show a => Symbolic a -> FilePath -> IO () testQuery t rf = do r <- runSMTWith mathSAT{verbose=True, redirectVerbose=Just rf} t appendFile rf ("\nFINAL OUTPUT:\n" ++ show r ++ "\n") iConstraint :: String -> SBool -> Symbolic () iConstraint g = constrainWithAttribute [(":interpolation-group", g)] q1 :: Symbolic String q1 = do a <- sInteger "a" b <- sInteger "b" c <- sInteger "c" d <- sInteger "d" setOption $ ProduceInterpolants True iConstraint "c1" $ a .== b &&& a .== c iConstraint "c2" $ b .== d &&& bnot (c .== d) query $ do _ <- checkSat getInterpolant ["c1"] q2 :: Symbolic String q2 = do a <- sInteger "a" b <- sInteger "b" c <- sInteger "c" d <- sInteger "d" let f, g :: SInteger -> SInteger f = uninterpret "f" g = uninterpret "g" setOption $ ProduceInterpolants True iConstraint "c1" $ f a .== c &&& f b .== d iConstraint "c2" $ a .== b &&& g c ./= g d query $ do _ <- checkSat getInterpolant ["c1"] {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} sbv-7.13/SBVTestSuite/TestSuite/Queries/Lists.hs0000644000000000000000000000241613405536617017745 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.Lists -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing a few lists ----------------------------------------------------------------------------- {-# LANGUAGE OverloadedLists #-} {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Queries.Lists (tests) where import Data.SBV import Data.SBV.Control import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.QueryLists" [ goldenCapturedIO "query_Lists1" $ testQuery queryLists1 ] testQuery :: Show a => Symbolic a -> FilePath -> IO () testQuery t rf = do r <- runSMTWith defaultSMTCfg{verbose=True, redirectVerbose=Just rf} t appendFile rf ("\nFINAL OUTPUT:\n" ++ show r ++ "\n") queryLists1 :: Symbolic [Integer] queryLists1 = do a :: SList Integer <- sList "a" constrain $ a .== [1..5] query $ do _ <- checkSat av <- getValue a if av == [1..5] then return av else error $ "Didn't expect this: " ++ show av sbv-7.13/SBVTestSuite/TestSuite/Queries/Strings.hs0000644000000000000000000000343513405536617020302 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.Strings -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing a few strings ----------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} module TestSuite.Queries.Strings (tests) where import Data.SBV import Data.SBV.Control import qualified Data.SBV.Char as C import qualified Data.SBV.RegExp as R import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Basics.QueryStrings" [ goldenCapturedIO "query_Strings1" $ testQuery queryString1 , goldenCapturedIO "query_Chars1" $ testQuery queryChar1 ] testQuery :: Show a => Symbolic a -> FilePath -> IO () testQuery t rf = do r <- runSMTWith defaultSMTCfg{verbose=True, redirectVerbose=Just rf} t appendFile rf ("\nFINAL OUTPUT:\n" ++ show r ++ "\n") queryString1 :: Symbolic [String] queryString1 = do a <- sString "a" constrain $ a `R.match` R.Loop 5 5 "xyz" query $ do _ <- checkSat s <- getValue a if s == concat (replicate 5 "xyz") then return [s] else error $ "Didn't expect this: " ++ show s queryChar1 :: Symbolic Char queryChar1 = do a <- sChar "a" constrain $ C.ord a .>= 65 constrain $ C.ord a .< 66 query $ do _ <- checkSat s <- getValue a if s == 'A' then return s else error $ "Didn't expect this: " ++ show s sbv-7.13/SBVTestSuite/TestSuite/Queries/Uninterpreted.hs0000644000000000000000000000222013405536617021470 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Queries.Uninterpreted -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testing uninterpreted value extraction ----------------------------------------------------------------------------- {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE DeriveDataTypeable #-} module TestSuite.Queries.Uninterpreted where import Data.Generics import Data.SBV.Control import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Queries.Uninterpreted" [ goldenCapturedIO "qUninterp1" testQuery ] testQuery :: FilePath -> IO () testQuery rf = do r <- runSMTWith defaultSMTCfg{verbose=True, redirectVerbose=Just rf} unint1 appendFile rf ("\n FINAL:" ++ r ++ "\nDONE!\n") data L = A | B () deriving (Eq, Ord, Show, Read, Data) instance SymWord L instance HasKind L instance SMTValue L unint1 :: Symbolic String unint1 = do (x :: SBV L) <- free_ query $ do _ <- checkSat getUninterpretedValue x sbv-7.13/SBVTestSuite/TestSuite/QuickCheck/0000755000000000000000000000000013405536617016705 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/QuickCheck/QC.hs0000644000000000000000000000600113405536617017541 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.QuickCheck.QC -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Quick-check based test suite for SBV ----------------------------------------------------------------------------- {-# LANGUAGE Rank2Types #-} module TestSuite.QuickCheck.QC (tests) where import Utils.SBVTestFramework unaryArith :: String -> (forall a. Num a => a -> a) -> [TestTree] unaryArith nm op = qc1 (nm ++ ".SWord8" ) op (op :: SWord8 -> SWord8) ++ qc1 (nm ++ ".SWord16" ) op (op :: SWord16 -> SWord16) ++ qc1 (nm ++ ".SWord32" ) op (op :: SWord32 -> SWord32) ++ qc1 (nm ++ ".SWord64" ) op (op :: SWord64 -> SWord64) ++ qc1 (nm ++ ".SInt8" ) op (op :: SInt8 -> SInt8) ++ qc1 (nm ++ ".SInt16" ) op (op :: SInt16 -> SInt16) ++ qc1 (nm ++ ".SInt32" ) op (op :: SInt32 -> SInt32) ++ qc1 (nm ++ ".SInt64" ) op (op :: SInt64 -> SInt64) ++ qc1 (nm ++ ".SInteger") op (op :: SInteger -> SInteger) ++ qc1 (nm ++ ".SReal" ) op (op :: SReal -> SReal) ++ qc1 (nm ++ ".SFloat" ) op (op :: SFloat -> SFloat) ++ qc1 (nm ++ ".SDouble" ) op (op :: SDouble -> SDouble) binaryArith :: String -> (forall a. Num a => a -> a -> a) -> [TestTree] binaryArith nm op = qc2 (nm ++ ".SWord8" ) op (op :: SWord8 -> SWord8 -> SWord8) ++ qc2 (nm ++ ".SWord16" ) op (op :: SWord16 -> SWord16 -> SWord16) ++ qc2 (nm ++ ".SWord32" ) op (op :: SWord32 -> SWord32 -> SWord32) ++ qc2 (nm ++ ".SWord64" ) op (op :: SWord64 -> SWord64 -> SWord64) ++ qc2 (nm ++ ".SInt8" ) op (op :: SInt8 -> SInt8 -> SInt8) ++ qc2 (nm ++ ".SInt16" ) op (op :: SInt16 -> SInt16 -> SInt16) ++ qc2 (nm ++ ".SInt32" ) op (op :: SInt32 -> SInt32 -> SInt32) ++ qc2 (nm ++ ".SInt64" ) op (op :: SInt64 -> SInt64 -> SInt64) ++ qc2 (nm ++ ".SInteger") op (op :: SInteger -> SInteger -> SInteger) ++ qc2 (nm ++ ".SReal" ) op (op :: SReal -> SReal -> SReal) ++ qc2 (nm ++ ".SFloat" ) op (op :: SFloat -> SFloat -> SFloat) ++ qc2 (nm ++ ".SDouble" ) op (op :: SDouble -> SDouble -> SDouble) -- Test suite tests :: TestTree tests = testGroup "QuickCheck.QC" [ testGroup "Arithmetic" [ testGroup "Unary" $ unaryArith "negate" negate ++ unaryArith "abs" abs ++ unaryArith "signum" signum , testGroup "Binary" $ binaryArith "+" (+) ++ binaryArith "-" (-) ++ binaryArith "*" (*) ] ] sbv-7.13/SBVTestSuite/TestSuite/Uninterpreted/0000755000000000000000000000000013405536617017523 5ustar0000000000000000sbv-7.13/SBVTestSuite/TestSuite/Uninterpreted/AUF.hs0000644000000000000000000000236613405536617020501 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Uninterpreted.AUF -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Documentation.SBV.Examples.Uninterpreted.AUF ----------------------------------------------------------------------------- module TestSuite.Uninterpreted.AUF where import Documentation.SBV.Examples.Uninterpreted.AUF import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Uninterpreted.AUF" [ goldenVsStringShow "auf-0" $ runSAT $ newArray "a" Nothing >>= \a -> free "x" >>= \x -> free "y" >>= \y -> output (thm x y (a :: SFunArray Word32 Word32)) , goldenVsStringShow "auf-1" $ runSAT $ newArray "a" Nothing >>= \a -> free "x" >>= \x -> free "y" >>= \y -> output (thm x y (a :: SArray Word32 Word32)) , testCase "tc_auf-0" $ assertIsThm $ newArray "a" Nothing >>= \a -> free "x" >>= \x -> free "y" >>= \y -> return (thm x y (a :: SArray Word32 Word32)) , testCase "tc_auf-1" $ assertIsThm $ newArray "a" Nothing >>= \a -> free "x" >>= \x -> free "y" >>= \y -> return (thm x y (a :: SFunArray Word32 Word32)) ] sbv-7.13/SBVTestSuite/TestSuite/Uninterpreted/Axioms.hs0000644000000000000000000000241413405536617021320 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Uninterpreted.Axioms -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for basic axioms and uninterpreted functions ----------------------------------------------------------------------------- {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveDataTypeable #-} module TestSuite.Uninterpreted.Axioms(tests) where import Utils.SBVTestFramework import Data.Generics tests :: TestTree tests = testGroup "Uninterpreted.Axioms" [ testCase "unint-axioms" (assertIsThm p0) ] -- Example provided by Thomas DuBuisson: newtype Bitstring = Bitstring () deriving (Eq, Ord, Show, Read, Data, SymWord, HasKind) type SBitstring = SBV Bitstring a :: SBitstring -> SBool a = uninterpret "a" e :: SBitstring -> SBitstring -> SBitstring e = uninterpret "e" axE :: [String] axE = [ "(assert (forall ((p Bitstring) (k Bitstring))" , " (=> (and (a k) (a p)) (a (e k p)))))" ] p0 :: Symbolic SBool p0 = do p <- free "p" :: Symbolic SBitstring k <- free "k" :: Symbolic SBitstring addAxiom "axE" axE constrain $ a p constrain $ a k return $ a (e k p) sbv-7.13/SBVTestSuite/TestSuite/Uninterpreted/Function.hs0000644000000000000000000000122713405536617021646 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Uninterpreted.Function -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Testsuite for Documentation.SBV.Examples.Uninterpreted.Function ----------------------------------------------------------------------------- module TestSuite.Uninterpreted.Function(tests) where import Documentation.SBV.Examples.Uninterpreted.Function import Utils.SBVTestFramework tests :: TestTree tests = testGroup "Uninterpreted.Function" [ testCase "aufunc-0" (assertIsThm thmGood) ] sbv-7.13/SBVTestSuite/TestSuite/Uninterpreted/Sort.hs0000644000000000000000000000236113405536617021010 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : TestSuite.Uninterpreted.Sort -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for uninterpreted sorts ----------------------------------------------------------------------------- {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE ScopedTypeVariables #-} module TestSuite.Uninterpreted.Sort(tests) where import Utils.SBVTestFramework import Data.Generics tests :: TestTree tests = testGroup "Uninterpreted.Sort" [ testCase "unint-sort" (assert . (==4) . length . (extractModels :: AllSatResult -> [L]) =<< allSat p0) ] data L = Nil | Cons Int L deriving (Eq, Ord, Data, Read, Show) instance SymWord L instance HasKind L instance SatModel L where parseCWs = undefined -- make GHC shut up about the missing method, we won't actually call it type UList = SBV L len :: UList -> SInteger len = uninterpret "len" p0 :: Symbolic SBool p0 = do [l, l0, l1] <- symbolics ["l", "l0", "l1"] constrain $ len l0 .== 0 constrain $ len l1 .== 1 x :: SInteger <- symbolic "x" constrain $ x .== 0 ||| x.== 1 return $ l .== l0 ||| l .== l1 sbv-7.13/SBVTestSuite/TestSuite/Uninterpreted/Uninterpreted.hs0000644000000000000000000000207513405536617022713 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Examples.TestSuite.Uninterpreted -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Test suite for Examples.Uninterpreted.Uninterpreted ----------------------------------------------------------------------------- module TestSuite.Uninterpreted.Uninterpreted(tests) where import Utils.SBVTestFramework -- Test suite tests :: TestTree tests = testGroup "Uninterpreted.Uninterpreted" [ testCase "uninterpreted-0" (assertIsThm p0) , testCase "uninterpreted-1" (assertIsThm p1) , testCase "uninterpreted-2" (assertIsntThm p2) ] f :: SInt8 -> SWord32 f = uninterpret "f" g :: SInt8 -> SWord16 -> SWord32 g = uninterpret "g" p0 :: SInt8 -> SInt8 -> SBool p0 x y = x .== y ==> f x .== f y -- OK p1 :: SInt8 -> SWord16 -> SWord16 -> SBool p1 x y z = y .== z ==> g x y .== g x z -- OK p2 :: SInt8 -> SWord16 -> SWord16 -> SBool p2 x y z = y .== z ==> g x y .== f x -- Not true sbv-7.13/SBVTestSuite/Utils/0000755000000000000000000000000013405536617014042 5ustar0000000000000000sbv-7.13/SBVTestSuite/Utils/SBVTestFramework.hs0000644000000000000000000003557613405536617017566 0ustar0000000000000000----------------------------------------------------------------------------- -- | -- Module : Utils.SBVTestFramework -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Various goodies for testing SBV ----------------------------------------------------------------------------- {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} module Utils.SBVTestFramework ( showsAs , runSAT, numberOfModels , assert, assertIsThm, assertIsntThm, assertIsSat, assertIsntSat , goldenString , goldenVsStringShow , goldenCapturedIO , CIOS(..), TestEnvironment(..), getTestEnvironment , qc1, qc2 , pickTests -- module exports to simplify life , module Test.Tasty , module Test.Tasty.HUnit , module Data.SBV ) where import qualified Control.Exception as C import Control.Monad.Trans (liftIO) import qualified Data.ByteString.Lazy.Char8 as LBC import qualified Data.ByteString as BS import System.Directory (removeFile) import System.Environment (lookupEnv) import Test.Tasty (testGroup, TestTree, TestName) import Test.Tasty.HUnit ((@?), Assertion, testCase, AssertionPredicable) import Test.Tasty.Golden (goldenVsString) import Test.Tasty.Golden.Advanced (goldenTest) import qualified Test.Tasty.QuickCheck as QC import qualified Test.QuickCheck.Monadic as QC import Test.Tasty.Runners hiding (Result) import System.Random (randomRIO) import Data.SBV import Data.SBV.Control import Data.Char (chr, ord, isDigit) import Data.List (zip3) import Data.Maybe (fromMaybe, catMaybes) import System.FilePath ((), (<.>)) import Data.SBV.Internals (runSymbolic, Symbolic, Result, SBVRunMode(..), IStage(..), SBV(..), SVal(..), showModel, SMTModel(..)) --------------------------------------------------------------------------------------- -- Test environment; continuous integration data CIOS = CILinux | CIOSX | CIWindows deriving (Show, Eq) data TestEnvironment = TestEnvLocal | TestEnvCI CIOS | TestEnvUnknown deriving Show getTestEnvironment :: IO (TestEnvironment, Int) getTestEnvironment = do mbTestEnv <- lookupEnv "SBV_TEST_ENVIRONMENT" mbTestPerc <- lookupEnv "SBV_HEAVYTEST_PERCENTAGE" env <- case mbTestEnv of Just "local" -> return TestEnvLocal Just "linux" -> return $ TestEnvCI CILinux Just "osx" -> return $ TestEnvCI CIOSX Just "win" -> return $ TestEnvCI CIWindows Just other -> do putStrLn $ "Ignoring unexpected test env value: " ++ show other return TestEnvUnknown Nothing -> return TestEnvUnknown perc <- case mbTestPerc of Just n | all isDigit n -> return (read n) Just n -> do putStrLn $ "Ignoring unexpected test percentage value: " ++ show n return 100 Nothing -> return 100 return (env, perc) -- | Generic assertion. This is less safe than usual, but will do. assert :: AssertionPredicable t => t -> Assertion assert t = t @? "assertion-failure" -- | Checks that a particular result shows as @s@ showsAs :: Show a => a -> String -> Assertion showsAs r s = assert $ show r == s goldFile :: FilePath -> FilePath goldFile nm = "SBVTestSuite" "GoldFiles" nm <.> "gold" goldenString :: TestName -> IO String -> TestTree goldenString n res = goldenVsString n (goldFile n) (fmap LBC.pack res) goldenVsStringShow :: Show a => TestName -> IO a -> TestTree goldenVsStringShow n res = goldenVsString n (goldFile n) (fmap (LBC.pack . show) res) goldenCapturedIO :: TestName -> (FilePath -> IO ()) -> TestTree goldenCapturedIO n res = doTheDiff n gf gfTmp (rm gfTmp >> res gfTmp) where gf = goldFile n gfTmp = gf ++ "_temp" rm f = removeFile f `C.catch` (\(_ :: C.SomeException) -> return ()) -- | When comparing ignore \r's for windows's sake doTheDiff :: TestName -> FilePath -> FilePath -> IO () -> TestTree doTheDiff nm ref new act = goldenTest nm (BS.readFile ref) (act >> BS.readFile new) cmp upd where upd = BS.writeFile ref cmp :: BS.ByteString -> BS.ByteString -> IO (Maybe String) cmp x y | cleanUp x == cleanUp y = return Nothing | True = return $ Just $ unlines $ [ "Discrepancy found. Expected: " ++ ref , "============================================" ] ++ lxs ++ [ "Got: " ++ new , "============================================" ] ++ lys ++ [ "Diff: " , "============================================" ] ++ diff where xs = map (chr . fromIntegral) $ BS.unpack x ys = map (chr . fromIntegral) $ BS.unpack y lxs = lines xs lys = lines ys diffLen = length lxs `max` length lys diff = concatMap pick $ zip3 [1..diffLen] (lxs ++ repeat "") (lys ++ repeat "") pick (i, expected, got) | expected == got = [] | True = [ "== Line " ++ show i ++ " ==" , " Expected: " ++ show expected , " Got : " ++ show got ] -- deal with insane Windows \r stuff cleanUp = BS.filter (/= slashr) slashr = fromIntegral (ord '\r') -- | Count the number of models numberOfModels :: Provable a => a -> IO Int numberOfModels p = do AllSatResult (_, _, rs) <- allSat p return $ length rs -- | Symbolicly run a SAT instance using the default config runSAT :: Symbolic a -> IO Result runSAT cmp = snd <$> runSymbolic (SMTMode ISetup True defaultSMTCfg) cmp -- | Turn provable to an assertion, theorem case assertIsThm :: Provable a => a -> Assertion assertIsThm t = assert (isTheorem t) -- | Turn provable to a negative assertion, theorem case assertIsntThm :: Provable a => a -> Assertion assertIsntThm t = assert (fmap not (isTheorem t)) -- | Turn provable to an assertion, satisfiability case assertIsSat :: Provable a => a -> Assertion assertIsSat p = assert (isSatisfiable p) -- | Turn provable to a negative assertion, satisfiability case assertIsntSat :: Provable a => a -> Assertion assertIsntSat p = assert (fmap not (isSatisfiable p)) -- | Quick-check a unary function, creating one version for constant folding, and another for solver qc1 :: (SymWord a, SymWord b, Show a, QC.Arbitrary a, SMTValue b) => String -> (a -> b) -> (SBV a -> SBV b) -> [TestTree] qc1 nm opC opS = [cf, sm] where cf = QC.testProperty (nm ++ ".constantFold") $ do i <- free "i" let extract n = fromMaybe (error $ "qc1." ++ nm ++ ": Cannot extract value for: " ++ n) . unliteral v = extract "i" i expected = literal $ opC v result = opS i case (unliteral expected, unliteral result) of (Just _, Just _) -> return $ expected .== result _ -> return false sm = QC.testProperty (nm ++ ".symbolic") $ QC.monadicIO $ do ((i, expected), result) <- QC.run $ runSMT $ do v <- liftIO $ QC.generate QC.arbitrary i <- free_ res <- free_ constrain $ i .== literal v constrain $ res .== opS i let pre = (v, opC v) query $ do cs <- checkSat case cs of Unk -> return (pre, Left "Unexpected: Solver responded Unknown!") Unsat -> return (pre, Left "Unexpected: Solver responded Unsatisfiable!") Sat -> do r <- getValue res return (pre, Right r) let getCW vnm (SBV (SVal _ (Left c))) = (vnm, c) getCW vnm (SBV (SVal k _ )) = error $ "qc2.getCW: Impossible happened, non-CW value while extracting: " ++ show (vnm, k) vals = [ getCW "i" (literal i) , getCW "Expected" (literal expected) ] model = case result of Right v -> showModel defaultSMTCfg (SMTModel [] (vals ++ [getCW "Result" (literal v)])) Left e -> showModel defaultSMTCfg (SMTModel [] vals) ++ "\n" ++ e QC.monitor (QC.counterexample model) case result of Right a -> QC.assert $ expected == a _ -> QC.assert False -- | Quick-check a binary function, creating one version for constant folding, and another for solver qc2 :: (SymWord a, SymWord b, SymWord c, Show a, Show b, QC.Arbitrary a, QC.Arbitrary b, SMTValue c) => String -> (a -> b -> c) -> (SBV a -> SBV b -> SBV c) -> [TestTree] qc2 nm opC opS = [cf, sm] where cf = QC.testProperty (nm ++ ".constantFold") $ do i1 <- free "i1" i2 <- free "i2" let extract n = fromMaybe (error $ "qc2." ++ nm ++ ": Cannot extract value for: " ++ n) . unliteral v1 = extract "i1" i1 v2 = extract "i2" i2 expected = literal $ opC v1 v2 result = opS i1 i2 case (unliteral expected, unliteral result) of (Just _, Just _) -> return $ expected .== result _ -> return false sm = QC.testProperty (nm ++ ".symbolic") $ QC.monadicIO $ do ((i1, i2, expected), result) <- QC.run $ runSMT $ do v1 <- liftIO $ QC.generate QC.arbitrary v2 <- liftIO $ QC.generate QC.arbitrary i1 <- free_ i2 <- free_ res <- free_ constrain $ i1 .== literal v1 constrain $ i2 .== literal v2 constrain $ res .== i1 `opS` i2 let pre = (v1, v2, v1 `opC` v2) query $ do cs <- checkSat case cs of Unk -> return (pre, Left "Unexpected: Solver responded Unknown!") Unsat -> return (pre, Left "Unexpected: Solver responded Unsatisfiable!") Sat -> do r <- getValue res return (pre, Right r) let getCW vnm (SBV (SVal _ (Left c))) = (vnm, c) getCW vnm (SBV (SVal k _ )) = error $ "qc2.getCW: Impossible happened, non-CW value while extracting: " ++ show (vnm, k) vals = [ getCW "i1" (literal i1) , getCW "i2" (literal i2) , getCW "Expected" (literal expected) ] model = case result of Right v -> showModel defaultSMTCfg (SMTModel [] (vals ++ [getCW "Result" (literal v)])) Left e -> showModel defaultSMTCfg (SMTModel [] vals) ++ "\n" ++ e QC.monitor (QC.counterexample model) case result of Right a -> QC.assert $ expected == a _ -> QC.assert False -- | Picking a certain percent of tests. pickTests :: Int -> TestTree -> IO TestTree pickTests d origTests = fromMaybe noTestsSelected <$> walk origTests where noTestsSelected = TestGroup "pickTests.NoTestsSelected" [] walk t@SingleTest{} = do c <- randomRIO (0, 99) if c < d then return $ Just t else return Nothing walk (TestGroup tn ts) = do cs <- catMaybes <$> mapM walk ts case cs of [] -> return Nothing _ -> return $ Just $ TestGroup tn cs walk _ = error "pickTests: Unexpected test group!" {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}