add Cmp files for String and U60

This commit is contained in:
Derenash 2024-02-21 12:10:56 -03:00
parent 7124036c94
commit 0e97867813
2 changed files with 29 additions and 0 deletions

22
book/String.cmp.kind2 Normal file
View File

@ -0,0 +1,22 @@
String.cmp
: ∀(a: String)
∀(b: String)
Cmp
= λa λb
let P = λx ∀(b: String) (Cmp)
let cons = λa.head λa.tail λb
let P = λx ∀(a.head: Char) ∀(a.tail: String) (Cmp)
let cons = λb.head λb.tail λa.head λa.tail
let P = λx Cmp
let ltn = Cmp.ltn
let eql = (String.cmp a.tail b.tail)
let gtn = Cmp.gtn
(~(U60.cmp a.head b.head) P ltn eql gtn)
let nil = λa.head λa.tail Cmp.gtn
((~b P cons nil) a.head a.tail)
let nil = λb
let P = λx Cmp
let cons = λb.head λb.tail Cmp.ltn
let nil = Cmp.eql
(~b P cons nil)
(~a P cons nil b)

7
book/U60.cmp.kind2 Normal file
View File

@ -0,0 +1,7 @@
U60.cmp
: ∀(a: #U60)
∀(b: #U60)
(Cmp)
= λa λb
(U60.if #(== a b) Cmp (U60.if #(< a b) Cmp Cmp.gtn Cmp.ltn) Cmp.eql)