Skip to content

Commit

Permalink
generalize the proof
Browse files Browse the repository at this point in the history
  • Loading branch information
LeventErkok committed Dec 10, 2024
1 parent 364f8d4 commit 343a23d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Documentation/SBV/Examples/KnuckleDragger/Lists.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,15 @@ revCons = runKD $ do
-- [Proven] mapAppend
mapAppend :: (SA -> SB) -> IO Proof
mapAppend f = runKD $ do
let p :: SList A -> SBool
p xs = quantifiedBool $ \(Forall @"ys" ys) -> map f (xs ++ ys) .== map f xs ++ map f ys
let p :: SList A -> SList A -> SBool
p xs ys = map f (xs ++ ys) .== map f xs ++ map f ys

lemma "mapAppend" (\(Forall @"xs" xs) -> p xs) [induct p]
genP :: SList A -> SBool
genP xs = quantifiedBool $ \(Forall @"ys" ys) -> p xs ys

gma <- lemma "genMapAppend" (\(Forall @"xs" xs) -> genP xs) [induct genP]

lemma "genAppend" (\(Forall @"xs" xs) (Forall @"ys" ys) -> p xs ys) [gma]

-- | @map f . reverse == reverse . map f@
--
Expand All @@ -121,9 +126,6 @@ mapReverse = runKD $ do
let f :: SA -> SB
f = uninterpret "f"

the problem here is that the mapAppend now has a nested quantifier, which messes things up..
hmm.

p :: SList A -> SBool
p xs = reverse (map f xs) .== map f (reverse xs)

Expand Down

0 comments on commit 343a23d

Please sign in to comment.