Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions LAWS.bend
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import ./laws/HasFindsKey.bend as HasFindsKey
import ./laws/IsArrIsObjTellKinds.bend as IsArrIsObjTellKinds
import ./laws/ItemsGivesElements.bend as ItemsGivesElements
import ./laws/LenCountsItems.bend as LenCountsItems
import ./laws/LexersAgree.bend as LexersAgree
import ./laws/NamesCompareDecoded.bend as NamesCompareDecoded
import ./laws/NumBuildsOrNull.bend as NumBuildsOrNull
import ./laws/NumOkIsNumberRule.bend as NumOkIsNumberRule
Expand Down
1 change: 1 addition & 0 deletions PROOF.bend
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import ./proofs/HasFindsKey.bend as PHasFindsKey
import ./proofs/IsArrIsObjTellKinds.bend as PIsArrIsObjTellKinds
import ./proofs/ItemsGivesElements.bend as PItemsGivesElements
import ./proofs/LenCountsItems.bend as PLenCountsItems
import ./proofs/LexersAgree.bend as PLexersAgree
import ./proofs/NamesCompareDecoded.bend as PNamesCompareDecoded
import ./proofs/NumBuildsOrNull.bend as PNumBuildsOrNull
import ./proofs/NumOkIsNumberRule.bend as PNumOkIsNumberRule
Expand Down
16 changes: 6 additions & 10 deletions bolt.bend
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# bolt.bend: how bolt lints this repo. Every rule is an error except
# `coverage`, which warns until the laws exist: the gate must see no errors.
# bolt.bend: how bolt lints this repo. Every rule is an error: the gate must
# see no errors.
# See bolt/config.bend for the groups and levels.
import Base

Expand All @@ -15,18 +15,14 @@ def suspicious() -> String:
def style() -> String:
"error"

# a def named by no quantified law: advice while guarantees are pending,
# since deleting the closed laws left defs no law names. That rule
# is `coverage` (L001).
# the law rules: `coverage` (a def no quantified law reaches) and `closed`
def laws() -> String:
"warn"
"error"

# a law with no binder
def closed() -> String:
"error"

# a def no quantified law reaches (L001); off since bolt 1.26 unless named.
# warn, not error: bolt 1.27's coverage finds defs bolt 1.22 passed (listed
# in the PR that set this); back to error once they are covered
# a def no quantified law reaches (L001); off since bolt 1.26 unless named
def coverage() -> String:
"warn"
"error"
6 changes: 3 additions & 3 deletions ez.lock.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ hub = "https://hub.bend-lang.com"
[tools]
[tools.bolt]
git = "https://github.com/Emerging-Patterns/bolt"
rev = "9700daf3a447089a8795d311912014382a74a2a9"
tag = "v1.27.0"
rev = "dfb06d0e5d6362739231b90bb090535af493b8f0"
tag = "v1.65.0"
root = "."
narHash = "sha256-0S48j2dongVcvP5Oms5a+s5I12sIy91KAgwW0bP7pxM="
narHash = "sha256-39sCydxFW7dWmf69CTJOXuC+j884fEhHWFKctdWCkAg="
entry = "main.bend"
6 changes: 3 additions & 3 deletions ez.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ entry = "main.bend"
[tools]
[tools.bolt]
git = "https://github.com/Emerging-Patterns/bolt"
rev = "9700daf3a447089a8795d311912014382a74a2a9"
tag = "v1.27.0"
rev = "dfb06d0e5d6362739231b90bb090535af493b8f0"
tag = "v1.65.0"
root = "."
narHash = "sha256-0S48j2dongVcvP5Oms5a+s5I12sIy91KAgwW0bP7pxM="
narHash = "sha256-39sCydxFW7dWmf69CTJOXuC+j884fEhHWFKctdWCkAg="
entry = "main.bend"
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions laws/LexersAgree.bend
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# For texts shorter than 2^32 - 1 characters: the span scanner `tokens`, the
# lexer `parse` reads, gives the tokens the character machine `run` gives from
# the idle state, once every span is read out into the characters it covers.
# The character machine is the lexer said one character at a time; the span
# scanner is the fast path, which keeps spans of the source instead of
# copying them. Internal: a law about the lexer holds it in place without
# making it interface
import Base
import ../src/value.bend as V
import ../src/lex.bend as Lex
import ./defs/CursorAndNumberRules.bend as D1

# a token with its span read out into the characters it covers
def tok.den(tok: Lex.Tok) -> Lex.Tok:
match tok:
case Lex.TStrS{cut, +nn}:
Lex.TStr{V.span.str(cut, nn, U32.is_zero(nn))}
case Lex.TWordS{cut, +nn}:
Lex.TWord{V.span.str(cut, nn, U32.is_zero(nn))}
case other:
other

# tokens with their spans read out
def toks.den(toks: List<&2, Lex.Tok>) -> List<&2, Lex.Tok>:
match toks:
case Nil{}:
Nil{}
case hd <> tl:
tok.den(hd) <> toks.den(tl)

# LAW: the span scanner and the character machine give the same tokens
law lexers_agree:
for +txt: String
for h_s: {D1.short(txt) == True{} : Bool}
{toks.den(Lex.tokens(txt)) == toks.den(Lex.finish(Lex.run(String.to_list(txt), Lex.Lex{Lex.Idle{}, [], []}))) :
List<&2, Lex.Tok>}
42 changes: 22 additions & 20 deletions proofs/CursorEventsMatchParse.bend
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ law dig_u:

def dig_u(ch, h, tl, left, acc, bb, stack, done, ff):
hs = Equal.sym(Bool, D2.hexd(ch), True{}, h)
%hs : {Pull.next.go(1n+ff, tl, Pull.uni.hit.go(ch, tl, left, acc, bb, stack, Pull.GNext{}, done, _))
%hs : {Pull.next.go(1n+ff, tl, Pull.uni.hit.go(ch, tl, left, acc, bb, Pull.C{stack, Pull.GNext{}, done}, _))
== Pull.next.go(1n+ff, tl, Pull.uni.put(tl, left, acc, Lex.hex(ch), bb, stack, Pull.GNext{}, done)) : Pull.Out}
{==}

Expand All @@ -1394,12 +1394,14 @@ law dig_l:
for +done: Bool
for +ff: Nat
{Pull.next.go(1n+ff, SCon{ch, tl}, Pull.S{Pull.MLo{left, acc, hi, bb}, stack, Pull.GNext{}, done, False{}})
== Pull.next.go(1n+ff, tl, Pull.lo.put(tl, left, acc, hi, Lex.hex(ch), bb, stack, Pull.GNext{}, done)) : Pull.Out}
== Pull.next.go(1n+ff, tl, Pull.lo.put(tl, left, acc, hi, Lex.hex(ch), bb, Pull.C{stack, Pull.GNext{},
done})) : Pull.Out}

def dig_l(ch, h, tl, left, acc, hi, bb, stack, done, ff):
hs = Equal.sym(Bool, D2.hexd(ch), True{}, h)
%hs : {Pull.next.go(1n+ff, tl, Pull.lo.hit.go(ch, tl, left, acc, hi, bb, stack, Pull.GNext{}, done, _))
== Pull.next.go(1n+ff, tl, Pull.lo.put(tl, left, acc, hi, Lex.hex(ch), bb, stack, Pull.GNext{}, done)) : Pull.Out}
%hs : {Pull.next.go(1n+ff, tl, Pull.lo.hit.go(ch, tl, left, acc, hi, bb, Pull.C{stack, Pull.GNext{}, done}, _))
== Pull.next.go(1n+ff, tl, Pull.lo.put(tl, left, acc, hi, Lex.hex(ch), bb, Pull.C{stack, Pull.GNext{},
done})) : Pull.Out}
{==}

# a \u escape's four digits, once the backslash is in: its character is copied
Expand Down Expand Up @@ -1562,7 +1564,7 @@ def et_pair(h1, h2, h3, h4, l1, l2, l3, l4, h, rest, bf, stack, done, ff):
Equal.trans(Pull.Out, Pull.next.go(1n+ff, SCon{l4, rest}, Pull.S{Pull.MLo{0n,
D2.hex.acc(D2.hex.acc(D2.hex.acc(0, l1), l2), l3), D2.hex4(h1, h2, h3, h4), bf}, stack, Pull.GNext{},
done, False{}}), Pull.next.go(1n+ff, rest, Pull.lo.put(rest, 0n, D2.hex.acc(D2.hex.acc(D2.hex.acc(0, l1),
l2), l3), D2.hex4(h1, h2, h3, h4), Lex.hex(l4), bf, stack, Pull.GNext{}, done)), Pull.next.go(1n+ff, rest,
l2), l3), D2.hex4(h1, h2, h3, h4), Lex.hex(l4), bf, Pull.C{stack, Pull.GNext{}, done})), Pull.next.go(1n+ff, rest,
Pull.S{Pull.MCopy{D2.piece.char(D2.PPair{h1, h2, h3, h4, l1, l2, l3, l4}) <> bf}, stack, Pull.GNext{}, done,
False{}}), dig_l(l4, M3.and4_4(D2.hexd(l1), D2.hexd(l2), D2.hexd(l3), D2.hexd(l4), hl), rest, 0n,
D2.hex.acc(D2.hex.acc(D2.hex.acc(0, l1), l2), l3), D2.hex4(h1, h2, h3, h4), bf, stack, done, ff),
Expand Down Expand Up @@ -5860,7 +5862,7 @@ law ss_uni:
for +hp: {M6.prel(stack, False{}, M6.pst(Lex.Lex{Lex.Uni{left, acc}, bf, tk})) == True{} : Bool}
for hx: Bool
for +ehx: {Lex.hex.ok(Char.to_u32(ch)) == hx : Bool}
M4.sinv(tt, tl, Pull.uni.hit.go(ch, tl, left, acc, buf, stack, Pull.GNext{}, False{}, hx))
M4.sinv(tt, tl, Pull.uni.hit.go(ch, tl, left, acc, buf, Pull.C{stack, Pull.GNext{}, False{}}, hx))

def ss_uni(tt, ch, tl, left, acc, buf, stack, bf, tk, h_s, e, hp, hx, ehx):
match hx:
Expand Down Expand Up @@ -5980,7 +5982,7 @@ law ss_lput:
for +h_s: {D1.short(tl) == True{} : Bool}
for +e: M6.lx_e(tt, tl, Lex.unicode.low.put(left, acc, hi, dig, bf, tk))
for +hp: {M6.prel(stack, False{}, M6.pst(Lex.Lex{Lex.Esc{}, bf, tk})) == True{} : Bool}
M4.sinv(tt, tl, Pull.lo.put(tl, left, acc, hi, dig, buf, stack, Pull.GNext{}, False{}))
M4.sinv(tt, tl, Pull.lo.put(tl, left, acc, hi, dig, buf, Pull.C{stack, Pull.GNext{}, False{}}))

def ss_lput(tt, tl, left, acc, hi, dig, buf, stack, bf, tk, h_s, e, hp):
match left:
Expand All @@ -6007,7 +6009,7 @@ law ss_lo:
for +hp: {M6.prel(stack, False{}, M6.pst(Lex.Lex{Lex.Lo{left, acc, hi}, bf, tk})) == True{} : Bool}
for hx: Bool
for +ehx: {Lex.hex.ok(Char.to_u32(ch)) == hx : Bool}
M4.sinv(tt, tl, Pull.lo.hit.go(ch, tl, left, acc, hi, buf, stack, Pull.GNext{}, False{}, hx))
M4.sinv(tt, tl, Pull.lo.hit.go(ch, tl, left, acc, hi, buf, Pull.C{stack, Pull.GNext{}, False{}}, hx))

def ss_lo(tt, ch, tl, left, acc, hi, buf, stack, bf, tk, h_s, e, hp, hx, ehx):
match hx:
Expand Down Expand Up @@ -6039,14 +6041,14 @@ law sm_copy.l:
for +e: M6.lx_e(tt, SCon{ch, tl}, lx)
for +hm: {M4.lxmode(lx) == M4.mo(Pull.MCopy{buf}) : Lex.Mode}
for +hp: {M6.prel(stack, False{}, M6.pst(lx)) == True{} : Bool}
M4.sinv(tt, tl, Pull.copy.hit(ch, tl, buf, stack, Pull.GNext{}, done, False{}, Lex.classify(ch),
M4.sinv(tt, tl, Pull.copy.hit(ch, tl, buf, Pull.C{stack, Pull.GNext{}, done}, False{}, Lex.classify(ch),
U32.is_lt(Char.to_u32(ch), 32)))

def sm_copy.l(tt, ch, tl, buf, stack, done, h_s, hd, lx, e, hm, hp):
match lx:
case Lex.Lex{+md, +bf, +tk}:
es = Equal.sym(Bool, done, False{}, hd)
%es : M4.sinv(tt, tl, Pull.copy.hit(ch, tl, buf, stack, Pull.GNext{}, _, False{}, Lex.classify(ch),
%es : M4.sinv(tt, tl, Pull.copy.hit(ch, tl, buf, Pull.C{stack, Pull.GNext{}, _}, False{}, Lex.classify(ch),
U32.is_lt(Char.to_u32(ch), 32)))
ss_copy(tt, ch, tl, buf, stack, bf, tk, h_s, lxfix_e(tt, SCon{ch, tl}, md, Lex.Str{}, bf, tk, hm, e),
lxfix_p(stack, md, Lex.Str{}, bf, tk, hm, hp), Lex.classify(ch), {==}, U32.is_lt(Char.to_u32(ch), 32), {==})
Expand All @@ -6060,7 +6062,7 @@ law sm_copy:
for +stack: List<&2, Pull.Frame>
for +done: Bool
for hh: M4.sminv(tt, SCon{ch, tl}, Pull.MCopy{buf}, stack, done)
M4.sinv(tt, tl, Pull.copy.hit(ch, tl, buf, stack, Pull.GNext{}, done, False{}, Lex.classify(ch),
M4.sinv(tt, tl, Pull.copy.hit(ch, tl, buf, Pull.C{stack, Pull.GNext{}, done}, False{}, Lex.classify(ch),
U32.is_lt(Char.to_u32(ch), 32)))

def sm_copy(tt, ch, tl, buf, stack, done, hh):
Expand Down Expand Up @@ -6200,13 +6202,13 @@ law sm_uni.l:
for +e: M6.lx_e(tt, SCon{ch, tl}, lx)
for +hm: {M4.lxmode(lx) == M4.mo(Pull.MUni{left, acc, buf}) : Lex.Mode}
for +hp: {M6.prel(stack, False{}, M6.pst(lx)) == True{} : Bool}
M4.sinv(tt, tl, Pull.uni.hit(ch, tl, left, acc, buf, stack, Pull.GNext{}, done, False{}))
M4.sinv(tt, tl, Pull.uni.hit(ch, tl, left, acc, buf, Pull.C{stack, Pull.GNext{}, done}, False{}))

def sm_uni.l(tt, ch, tl, left, acc, buf, stack, done, h_s, hd, lx, e, hm, hp):
match lx:
case Lex.Lex{+md, +bf, +tk}:
es = Equal.sym(Bool, done, False{}, hd)
%es : M4.sinv(tt, tl, Pull.uni.hit(ch, tl, left, acc, buf, stack, Pull.GNext{}, _, False{}))
%es : M4.sinv(tt, tl, Pull.uni.hit(ch, tl, left, acc, buf, Pull.C{stack, Pull.GNext{}, _}, False{}))
ss_uni(tt, ch, tl, left, acc, buf, stack, bf, tk, h_s, lxfix_e(tt, SCon{ch, tl}, md, Lex.Uni{left, acc}, bf, tk,
hm, e), lxfix_p(stack, md, Lex.Uni{left, acc}, bf, tk, hm, hp), Lex.hex.ok(Char.to_u32(ch)), {==})

Expand All @@ -6221,7 +6223,7 @@ law sm_uni:
for +stack: List<&2, Pull.Frame>
for +done: Bool
for hh: M4.sminv(tt, SCon{ch, tl}, Pull.MUni{left, acc, buf}, stack, done)
M4.sinv(tt, tl, Pull.uni.hit(ch, tl, left, acc, buf, stack, Pull.GNext{}, done, False{}))
M4.sinv(tt, tl, Pull.uni.hit(ch, tl, left, acc, buf, Pull.C{stack, Pull.GNext{}, done}, False{}))

def sm_uni(tt, ch, tl, left, acc, buf, stack, done, hh):
(h_s, (hd, (+lx, (e, (hm, hp))))) = hh
Expand Down Expand Up @@ -6326,13 +6328,13 @@ law sm_lo.l:
for +e: M6.lx_e(tt, SCon{ch, tl}, lx)
for +hm: {M4.lxmode(lx) == M4.mo(Pull.MLo{left, acc, hi, buf}) : Lex.Mode}
for +hp: {M6.prel(stack, False{}, M6.pst(lx)) == True{} : Bool}
M4.sinv(tt, tl, Pull.lo.hit(ch, tl, left, acc, hi, buf, stack, Pull.GNext{}, done, False{}))
M4.sinv(tt, tl, Pull.lo.hit(ch, tl, left, acc, hi, buf, Pull.C{stack, Pull.GNext{}, done}, False{}))

def sm_lo.l(tt, ch, tl, left, acc, hi, buf, stack, done, h_s, hd, lx, e, hm, hp):
match lx:
case Lex.Lex{+md, +bf, +tk}:
es = Equal.sym(Bool, done, False{}, hd)
%es : M4.sinv(tt, tl, Pull.lo.hit(ch, tl, left, acc, hi, buf, stack, Pull.GNext{}, _, False{}))
%es : M4.sinv(tt, tl, Pull.lo.hit(ch, tl, left, acc, hi, buf, Pull.C{stack, Pull.GNext{}, _}, False{}))
ss_lo(tt, ch, tl, left, acc, hi, buf, stack, bf, tk, h_s, lxfix_e(tt, SCon{ch, tl}, md, Lex.Lo{left, acc, hi},
bf, tk, hm, e), lxfix_p(stack, md, Lex.Lo{left, acc, hi}, bf, tk, hm, hp), Lex.hex.ok(Char.to_u32(ch)), {==})

Expand All @@ -6348,7 +6350,7 @@ law sm_lo:
for +stack: List<&2, Pull.Frame>
for +done: Bool
for hh: M4.sminv(tt, SCon{ch, tl}, Pull.MLo{left, acc, hi, buf}, stack, done)
M4.sinv(tt, tl, Pull.lo.hit(ch, tl, left, acc, hi, buf, stack, Pull.GNext{}, done, False{}))
M4.sinv(tt, tl, Pull.lo.hit(ch, tl, left, acc, hi, buf, Pull.C{stack, Pull.GNext{}, done}, False{}))

def sm_lo(tt, ch, tl, left, acc, hi, buf, stack, done, hh):
(h_s, (hd, (+lx, (e, (hm, hp))))) = hh
Expand Down Expand Up @@ -6705,7 +6707,7 @@ def pgo_inv(tt, ff, xx, st, hh, hst):
Empty.absurd(oinv(tt, Pull.next.go(1n+pp, SCon{ch, tl}, Pull.S{Pull.MSpan{c1, n1}, stack, Pull.GSkip{g1}, done,
True{}})), hh)
case 1n+pp SCon{+ch, +tl} Pull.S{Pull.MCopy{+b1}, +stack, Pull.GNext{}, +done, False{}}:
pgo_inv(tt, 1n+pp, tl, Pull.copy.hit(ch, tl, b1, stack, Pull.GNext{}, done, False{}, Lex.classify(ch),
pgo_inv(tt, 1n+pp, tl, Pull.copy.hit(ch, tl, b1, Pull.C{stack, Pull.GNext{}, done}, False{}, Lex.classify(ch),
U32.is_lt(Char.to_u32(ch), 32)),
sm_copy(tt, ch, tl, b1, stack, done, hh), hst)
case 1n+pp SCon{+ch, +tl} Pull.S{Pull.MCopy{+b1}, +stack, Pull.GNext{}, +done, True{}}:
Expand All @@ -6730,7 +6732,7 @@ def pgo_inv(tt, ff, xx, st, hh, hst):
Empty.absurd(oinv(tt, Pull.next.go(1n+pp, SCon{ch, tl}, Pull.S{Pull.MEsc{b1}, stack, Pull.GSkip{g1}, done,
True{}})), hh)
case 1n+pp SCon{+ch, +tl} Pull.S{Pull.MUni{+l1, +a1, +b1}, +stack, Pull.GNext{}, +done, False{}}:
pgo_inv(tt, 1n+pp, tl, Pull.uni.hit(ch, tl, l1, a1, b1, stack, Pull.GNext{}, done, False{}),
pgo_inv(tt, 1n+pp, tl, Pull.uni.hit(ch, tl, l1, a1, b1, Pull.C{stack, Pull.GNext{}, done}, False{}),
sm_uni(tt, ch, tl, l1, a1, b1, stack, done, hh), hst)
case 1n+pp SCon{+ch, +tl} Pull.S{Pull.MUni{+l1, +a1, +b1}, +stack, Pull.GNext{}, +done, True{}}:
Empty.absurd(oinv(tt, Pull.next.go(1n+pp, SCon{ch, tl}, Pull.S{Pull.MUni{l1, a1, b1}, stack, Pull.GNext{}, done,
Expand Down Expand Up @@ -6766,7 +6768,7 @@ def pgo_inv(tt, ff, xx, st, hh, hst):
Empty.absurd(oinv(tt, Pull.next.go(1n+pp, SCon{ch, tl}, Pull.S{Pull.MHiEsc{h1, b1}, stack, Pull.GSkip{g1}, done,
True{}})), hh)
case 1n+pp SCon{+ch, +tl} Pull.S{Pull.MLo{+l1, +a1, +h1, +b1}, +stack, Pull.GNext{}, +done, False{}}:
pgo_inv(tt, 1n+pp, tl, Pull.lo.hit(ch, tl, l1, a1, h1, b1, stack, Pull.GNext{}, done, False{}),
pgo_inv(tt, 1n+pp, tl, Pull.lo.hit(ch, tl, l1, a1, h1, b1, Pull.C{stack, Pull.GNext{}, done}, False{}),
sm_lo(tt, ch, tl, l1, a1, h1, b1, stack, done, hh), hst)
case 1n+pp SCon{+ch, +tl} Pull.S{Pull.MLo{+l1, +a1, +h1, +b1}, +stack, Pull.GNext{}, +done, True{}}:
Empty.absurd(oinv(tt, Pull.next.go(1n+pp, SCon{ch, tl}, Pull.S{Pull.MLo{l1, a1, h1, b1}, stack, Pull.GNext{},
Expand Down
57 changes: 57 additions & 0 deletions proofs/LexersAgree.bend
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# proofs of laws/LexersAgree.bend
import Base
import ../src/lex.bend as Lex
import ../laws/LexersAgree.bend as Laws
import ./lemmas/CharacterClasses.bend as M1
import ./lemmas/LexemeOrder.bend as M2

# the lemmas' span read-out is the law's, token by token
law den_same:
for +tok: Lex.Tok
{M2.den(tok) == Laws.tok.den(tok) : Lex.Tok}

def den_same(tok):
match tok:
case Lex.TOpenArr{}:
{==}
case Lex.TCloseArr{}:
{==}
case Lex.TOpenObj{}:
{==}
case Lex.TCloseObj{}:
{==}
case Lex.TColon{}:
{==}
case Lex.TComma{}:
{==}
case Lex.TStr{s}:
{==}
case Lex.TWord{raw}:
{==}
case Lex.TStrS{cut, nn}:
{==}
case Lex.TWordS{cut, nn}:
{==}
case Lex.TBad{}:
{==}

# and over a list
law dens_same:
for +toks: List<&2, Lex.Tok>
{M2.dens(toks) == Laws.toks.den(toks) : List<&2, Lex.Tok>}

def dens_same(toks):
match toks:
case Nil{}:
{==}
case hd <> tl:
%dens_same(tl) : {M2.den(hd) <> M2.dens(tl) == Laws.tok.den(hd) <> _ : List<&2, Lex.Tok>}
%den_same(hd) : {M2.den(hd) <> M2.dens(tl) == _ <> M2.dens(tl) : List<&2, Lex.Tok>}
{==}

def Laws.lexers_agree(txt, h_s):
%dens_same(Lex.tokens(txt)) : {_ == Laws.toks.den(Lex.finish(Lex.run(String.to_list(txt), Lex.Lex{Lex.Idle{}, [],
[]}))) : List<&2, Lex.Tok>}
%dens_same(Lex.finish(Lex.run(String.to_list(txt), Lex.Lex{Lex.Idle{}, [], []}))) : {M2.dens(Lex.tokens(txt)) == _ :
List<&2, Lex.Tok>}
M1.lexers_agree(txt, h_s)
Loading
Loading