forked from leanprover-community/batteries
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove Std.Data.List import from Omega (leanprover-community#568)
Co-authored-by: Scott Morrison <[email protected]>
- Loading branch information
Showing
8 changed files
with
238 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/- | ||
Copyright (c) 2016 Microsoft Corporation. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Leonardo de Moura | ||
-/ | ||
|
||
namespace List | ||
|
||
/-- | ||
Version of `List.zipWith` that continues to the end of both lists, passing `none` to one argument | ||
once the shorter list has run out. | ||
-/ | ||
-- TODO We should add a tail-recursive version as we do for other `zip` functions. | ||
def zipWithAll (f : Option α → Option β → γ) : List α → List β → List γ | ||
| [], bs => bs.map fun b => f none (some b) | ||
| a :: as, [] => (a :: as).map fun a => f (some a) none | ||
| a :: as, b :: bs => f a b :: zipWithAll f as bs | ||
|
||
@[simp] theorem zipWithAll_nil_right : | ||
zipWithAll f as [] = as.map fun a => f (some a) none := by | ||
cases as <;> rfl | ||
|
||
@[simp] theorem zipWithAll_nil_left : | ||
zipWithAll f [] bs = bs.map fun b => f none (some b) := by | ||
rw [zipWithAll] | ||
|
||
@[simp] theorem zipWithAll_cons_cons : | ||
zipWithAll f (a :: as) (b :: bs) = f (some a) (some b) :: zipWithAll f as bs := rfl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.