-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFinalProductionTest.lean
More file actions
39 lines (27 loc) · 930 Bytes
/
FinalProductionTest.lean
File metadata and controls
39 lines (27 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import Containers
/-!
# Smoke tests for lean-containers
Exercises the public API in `Containers` after `lake build`.
-/
open Containers
/-- List signature example -/
def testListSig : Container := ListSig
/-- Polynomial value and map -/
def testPoly : Poly ListSig Nat :=
{ shape := some (), children := fun _ => 42 }
def testPolyMapped : Poly ListSig String :=
Poly.map (fun n => s!"Number: {n}") testPoly
def testIdMap : Poly ListSig Nat :=
Poly.map id testPoly
def testCompMap : Poly ListSig String :=
Poly.map (fun s => s ++ "!") (Poly.map (fun n => s!"{n}") testPoly)
#check testListSig
#check testPoly
#check testPolyMapped
#check testIdMap
#check testCompMap
theorem testPolyMapId : Poly.map id testPoly = testPoly := rfl
theorem testPolyMapComp :
Poly.map (fun s => s ++ "!") (Poly.map (fun n => s!"{n}") testPoly) =
Poly.map (fun n => s!"{n}" ++ "!") testPoly := rfl
#check Functor (Poly ListSig)