Kind/book/String.equal.kind2
Victor Taelin 85ad65b026 use-notation
Now, there are two local binders:

let x = ...
use x = ...

The 'let' binder will create a local definition, type-check it, and
assign a name to it. When compiled, it will create 'dup' nodes.

The 'use' binder is just an alias. It will not bind a new variable, and,
when compiled, will create inline copies. Also, for type-checking, it
allows creating aliases that are definitionaly equal for the checker.
2024-03-08 17:39:37 -03:00

19 lines
555 B
Plaintext

String.equal
: ∀(a: String) ∀(b: String) Bool
= λa λb
use P = λx ∀(b: String) Bool
use cons = λa.head λa.tail λb
use P = λx ∀(a.head: Char) ∀(a.tail: String) Bool
use cons = λb.head λb.tail λa.head λa.tail
(Bool.and
(U60.equal a.head b.head)
(String.equal a.tail b.tail)
)
use nil = λa.head λa.tail Bool.false
(~b P cons nil a.head a.tail)
use nil = λb
use P = λx Bool
use cons = λb.head λb.tail Bool.false
use nil = Bool.true
(~b P cons nil)
(~a P cons nil b)