Skip to content

Commit

Permalink
More list proofs
Browse files Browse the repository at this point in the history
  • Loading branch information
LeventErkok committed Dec 24, 2024
1 parent 8be8a09 commit 7435458
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Documentation/SBV/Examples/KnuckleDragger/Lists.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

module Documentation.SBV.Examples.KnuckleDragger.Lists where

import Prelude (IO, ($), flip, Bool(..), Integer, Num(..), pure, id)
import Prelude (IO, ($), flip, Bool(..), Integer, Num(..), pure, id, (.))

import Data.SBV
import Data.SBV.List
Expand Down Expand Up @@ -242,8 +242,6 @@ filterEx2 = runKDWith z3{kdOptions = (kdOptions z3) {generateHOEquivs = False}}

pure ()

{-
-- * Foldr-map fusion

-- | @foldr f a . map g = foldr (f . g) a@
Expand Down Expand Up @@ -286,7 +284,7 @@ foldrMapFusion = runKD $ do
-- Lemma: foldrFusion Q.E.D.
-- [Proven] foldrFusion
foldrFusion :: IO Proof
foldrFusion = runKD $ do
foldrFusion = runKDWith cvc5 $ do
let a :: SA
a = uninterpret "a"

Expand All @@ -310,7 +308,7 @@ foldrFusion = runKD $ do
-- forall x, y: f (g x y) = h x (f y)
h2 <- axiom "f (g x) = h x (f y)" $ \(Forall @"x" x) (Forall @"y" y) -> f (g x y) .== h x (f y)

lemmaWith cvc5 "foldrFusion" (\(Forall @"xs" xs) -> p xs) [h1, h2, induct p]
lemma "foldrFusion" (\(Forall @"xs" xs) -> p xs) [h1, h2, induct p]

-- * Foldr over append

Expand All @@ -336,6 +334,7 @@ foldrOverAppend = runKD $ do
-- Induction is done on the last element. Here we want to induct on xs, hence the flip below.
[induct (flip p)]

{-
{- Can't converge
-- * Foldl over append
Expand Down

0 comments on commit 7435458

Please sign in to comment.