Permalink
Browse files

Initial import.

  • Loading branch information...
0 parents commit 31996bcb487ae9fa2e6688ce591f7831c1104c5a @yav committed Jan 7, 2009
Showing with 461 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +7 −0 LICENSE
  3. +3 −0 Setup.hs
  4. +1 −0 doc/README
  5. BIN doc/cooper.pdf
  6. BIN doc/hol.pdf
  7. +17 −0 presburger.cabal
  8. +14 −0 src/Euclid.hs
  9. +418 −0 src/Presburger.hs
@@ -0,0 +1 @@
+/dist
@@ -0,0 +1,7 @@
+Copyright (c) 2009 Iavor S. Diatchki
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
+import Distribution.Simple
+
+main = defaultMain
@@ -0,0 +1 @@
+Some papers describing the relevant algorithms.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,17 @@
+Name: presburger
+Version: 0.1
+License: BSD3
+License-file: LICENSE
+Author: Iavor S. Diatchki
+Maintainer: diatchki@galois.com
+Category: Algorithms
+Synopsis: Cooper's decision procedure for Presburger arithmetic.
+Description: Cooper's decision procedure for Presburger arithmetic.
+hs-source-dirs: src
+Build-Depends: base, containers
+Build-type: Simple
+Exposed-modules: Presburger
+
+Extensions:
+GHC-options: -O2 -Wall
+
@@ -0,0 +1,14 @@
+module Euclid where
+
+-- | let (p,q,r) = extended_gcd x y
+-- in (x * p + y * q = r) && (gcd x y = r)
+extended_gcd :: Integral a => a -> a -> (a,a,a)
+extended_gcd a b = loop a b 0 1 1 0
+ where loop a b x lastx y lasty
+ | b /= 0 = let (q,b') = divMod a b
+ x' = lastx - q * x
+ y' = lasty - q * y
+ in x' `seq` y' `seq` loop b b' x' x y' y
+ | otherwise = (lastx,lasty,a)
+
+
Oops, something went wrong.

0 comments on commit 31996bc

Please sign in to comment.