Skip to content

Commit 972ed9d

Browse files
committed
1) fixed a minor compilation error with the extract
2) added some stuff to make the program print the desired stuff. Then ran it successfully: $ ghc -o roboExtract roboExtract.hs [1 of 1] Compiling Main ( roboExtract.hs, roboExtract.o ) Linking roboExtract.exe ... Abhishek@abhishek-vaio /cygdrive/c/Users/Abhishek/Desktop/PhDWork/coq/ROSCOQ/extraction $ ./roboExtract.exe [((0,0),1),((1571,0),0),((1,1),0),((14142,0),0)] Eval vm_compute in robotOutputInts. (icreateConcrete.v:144) = [(0, 0, 1); (1571, 0, 0); (1, 1, 0); (14142, 0, 0)] : list ((Z and Z) and Z)
1 parent 555659c commit 972ed9d

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

extraction/roboExtract.hs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{-# OPTIONS_GHC -cpp -XMagicHash #-}
22
{- For Hugs, use the option -F"cpp -P -traditional" -}
33

4-
module RoboExtract where
4+
module Main where
55

66
import qualified Prelude
77

@@ -2373,7 +2373,7 @@ ap_Q_cotransitive0 x0 y0 z =
23732373
Prelude.True -> Prelude.Right __;
23742374
Prelude.False -> Prelude.Left __}
23752375

2376-
qplus_strext0 :: Q -> Q -> Q -> Q -> Prelude.Either () ()
2376+
qplus_strext0 :: Q -> Q -> Q -> Q -> Prelude.Either Any Any
23772377
qplus_strext0 x1 x2 y1 y2 =
23782378
case qeq_dec x1 x2 of {
23792379
Prelude.True -> Prelude.Right __;
@@ -3259,3 +3259,16 @@ map3 f inp =
32593259
case xy of {
32603260
(,) x0 y0 -> (,) ((,) (f x0) (f y0)) (f z)}}
32613261

3262+
{-the code below was manually written, not extracted from Coq-}
3263+
pos2Int :: Positive -> Prelude.Integer
3264+
pos2Int XH = 1
3265+
pos2Int (XO p) = (Prelude.+) (pos2Int p) (pos2Int p)
3266+
pos2Int (XI p) = (Prelude.+) (pos2Int p) ((Prelude.+) (pos2Int p) 1)
3267+
3268+
3269+
toInt :: Z -> Prelude.Integer
3270+
toInt Z0 = 0
3271+
toInt (Zpos p) = pos2Int p
3272+
toInt (Zneg p) = (Prelude.negate) (pos2Int p)
3273+
3274+
main = Prelude.print (Main.map (map3 toInt) robotOutputInts)

0 commit comments

Comments
 (0)