Skip to content

Commit

Permalink
avoid doing the wrong induction
Browse files Browse the repository at this point in the history
  • Loading branch information
LeventErkok committed Sep 23, 2024
1 parent 5150915 commit d653d29
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Documentation/SBV/Examples/KnuckleDragger/InsertionSort.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ correctness = runKDWith cvc5 $ do

insertIntoNonDecreasing2 <- axiom "insertIntoNonDecreasing2"
(\(Forall @"e" e) (Forall @"x" x) (Forall @"xs" xs) -> e .> x .=> nonDecreasing (x .: xs) .== nonDecreasing (insert e (x .: xs)))
-- []
-- [induct (\xs e -> nonDecreasing (insert e xs))]

insertIntoNonDecreasing3 <- lemmaWith z3 "insertIntoNonDecreasing3"
(\(Forall @"e" e) (Forall @"xs" xs) -> nonDecreasing xs .== nonDecreasing (insert e xs))
[induct (\e -> nonDecreasing . insert e), insertIntoNonDecreasing1, insertIntoNonDecreasing2]
[induct (\xs e -> nonDecreasing (insert e xs)), insertIntoNonDecreasing1, insertIntoNonDecreasing2]

nonDecreasingInsert <- lemma "nonDecreasingInsert"
(\(Forall @"e" e) (Forall @"xs" xs) -> nonDecreasing xs .== nonDecreasing (insert e xs))
[induct (\e -> nonDecreasing . insert e), insertIntoNonDecreasing3]
[induct (\xs e -> nonDecreasing (insert e xs)), insertIntoNonDecreasing3]

lemma "insertionSortCorrect"
(\(Forall @"l" l) -> nonDecreasing (insertionSort l))
Expand Down

0 comments on commit d653d29

Please sign in to comment.