Skip to content

Commit

Permalink
Initial import.
Browse files Browse the repository at this point in the history
  • Loading branch information
yav committed Jan 7, 2009
0 parents commit 31996bc
Show file tree
Hide file tree
Showing 9 changed files with 461 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
/dist
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Original file line Diff line number Diff line change
@@ -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.
3 changes: 3 additions & 0 deletions Setup.hs
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,3 @@
import Distribution.Simple

main = defaultMain
1 change: 1 addition & 0 deletions doc/README
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
Some papers describing the relevant algorithms.
Binary file added doc/cooper.pdf
Binary file not shown.
Binary file added doc/hol.pdf
Binary file not shown.
17 changes: 17 additions & 0 deletions presburger.cabal
Original file line number Original file line Diff line number Diff line change
@@ -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

14 changes: 14 additions & 0 deletions src/Euclid.hs
Original file line number Original file line Diff line number Diff line change
@@ -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)


Loading

0 comments on commit 31996bc

Please sign in to comment.