Skip to content

Commit b25fb57

Browse files
committed
get List1#rec to translate to list_rect in Coq
1 parent e99d03d commit b25fb57

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

saw-core-coq/src/Verifier/SAW/Translation/Coq/SpecialTreatment.hs

+22-11
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,17 @@ sawCorePreludeSpecialTreatmentMap configuration =
553553
, ("FrameTuple", mapsToExpl specMModule "FrameTuple")
554554
, ("callS", mapsToExpl specMModule "CallS")
555555
, ("multiFixS", mapsToExpl specMModule "MultiFixS")
556+
, ("FunStackE_type", mapsToExpl specMModule "FunStackE")
557+
, ("FunStackE_enc", replace (Coq.Lambda [Coq.Binder "E" (Just (Coq.Var "SpecM.EvType"))]
558+
(Coq.App (Coq.ExplVar "SpecM.FunStackE_encodes")
559+
[Coq.App (Coq.Var "SpecM.evTypeType") [Coq.Var "E"],
560+
Coq.App (Coq.Var "SpecM.evRetType") [Coq.Var "E"]])))
561+
, ("SpecPreRel", mapsToExpl specMModule "SpecPreRel")
562+
, ("SpecPostRel", mapsToExpl specMModule "SpecPostRel")
563+
, ("eqPreRel", mapsToExpl specMModule "eqPreRel")
564+
, ("eqPostRel", mapsToExpl specMModule "eqPostRel")
565+
, ("refinesS", mapsToExpl specMModule "spec_refines")
566+
, ("refinesS_eq", mapsToExpl specMModule "spec_refines_eq")
556567
]
557568

558569
-- Dependent pairs
@@ -566,25 +577,25 @@ sawCorePreludeSpecialTreatmentMap configuration =
566577

567578
-- Lists
568579
++
569-
[ ("List", replace (Coq.ExplVar "Datatypes.list"))
570-
, ("Nil", replace (Coq.ExplVar "Datatypes.nil"))
571-
, ("Cons", replace (Coq.ExplVar "Datatypes.cons"))
572-
, ("List__rec", replace (Coq.ExplVar "Datatypes.list_rect"))
580+
[ ("List", mapsToExpl datatypesModule "list")
581+
, ("Nil", mapsToExpl datatypesModule "nil")
582+
, ("Cons", mapsToExpl datatypesModule "cons")
583+
, ("List__rec", mapsToExpl datatypesModule "list_rect")
573584
]
574585

575586
-- Lists at sort 1
576587
++
577-
[ ("List1", replace (Coq.ExplVar "Datatypes.list"))
578-
, ("Nil1", replace (Coq.ExplVar "Datatypes.nil"))
579-
, ("Cons1", replace (Coq.ExplVar "Datatypes.cons"))
588+
[ ("List1", mapsToExpl datatypesModule "list")
589+
, ("Nil1", mapsToExpl datatypesModule "nil")
590+
, ("Cons1", mapsToExpl datatypesModule "cons")
580591
]
581592

582593
-- Lists at sort 2
583594
++
584-
[ ("List2", replace (Coq.ExplVar "Datatypes.list"))
585-
, ("Nil2", replace (Coq.ExplVar "Datatypes.nil"))
586-
, ("Cons2", replace (Coq.ExplVar "Datatypes.cons"))
587-
, ("List2__rec", replace (Coq.ExplVar "Datatypes.list_rect"))
595+
[ ("List2", mapsToExpl datatypesModule "list")
596+
, ("Nil2", mapsToExpl datatypesModule "nil")
597+
, ("Cons2", mapsToExpl datatypesModule "cons")
598+
, ("List2__rec", mapsToExpl datatypesModule "list_rect")
588599
]
589600

590601
escapeIdent :: String -> String

saw-core-coq/src/Verifier/SAW/Translation/Coq/Term.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ flatTermFToExpr tf = -- traceFTermF "flatTermFToExpr" tf $
309309
Recursor (CompiledRecursor d parameters motive _motiveTy eliminators elimOrder) ->
310310
do maybe_d_trans <- translateIdentToIdent (primName d)
311311
rect_var <- case maybe_d_trans of
312-
Just i -> return $ Coq.Var (show i ++ "_rect")
312+
Just i -> return $ Coq.ExplVar (show i ++ "_rect")
313313
Nothing ->
314314
errorTermM ("Recursor for " ++ show d ++
315315
" cannot be translated because the datatype " ++

0 commit comments

Comments
 (0)