~/bend-docscommunity

proof_within.bend checks

raw source on the hub · import 0xeb25eff332574f4f1d48668b83cdda30/proof_within.bend as Proof_within

Proofs for bend-osdev-asn1: the decoder never reads past its buffer. A header takes at least its identifier and length octets and leaves its contents and what follows inside the input (pw.head_le); so each element's span (two octets, and its primitive contents) fits in what it was read from, with the octets left after it (pw.dec), by induction on the decoder's fuel. Bounds are stated as Bool functions (pw.rb, pw.nb, pw.mb, pw.lb) so that a failed decode satisfies them trivially.

17 imports
import Base
import bend-osdev-bytes@0.1.0.0/bytes.bend as B
import bend-osdev-bytes@0.1.0.0/LAWS.bend as BL
import ./error.bend as E
import ./number.bend as Nu
import ./tag.bend as T
import ./length.bend as L
import ./node.bend as N
import ./rules.bend as R
import ./encode.bend as En
import ./conform.bend as C
import ./asn1.bend as A
import ./proof_nat.bend as AN
import ./proof_list.bend as AL
import ./proof_u32.bend as AU
import ./proof_enc.bend as PE
import ./proof_num.bend as PN

Definitions

def pw.len source · line 26 · raw

@xs:List<&2, U32> -> Nat

def pw.hlen source · line 31 · raw

@h:0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Head -> Nat

the octets a header accounts for: identifier and length (two at least), contents, and what follows

def pw.rb source · line 47 · raw

@res:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Out> -> @+k:Nat -> Bool

a decoder result's elements and leftover octets fit in k octets

def pw.nb source · line 55 · raw

@res:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node> -> @+k:Nat -> Bool

an element result fits in k octets

def pw.mb source · line 63 · raw

@m:Maybe<&2, 0xeb25eff332574f4f1d48668b83cdda30/number.A1Num> -> @t:List<&2, U32> -> Bool

a number read from t leaves no more than t

def pw.lb source · line 71 · raw

@l:0xeb25eff332574f4f1d48668b83cdda30/length.A1Len -> @xs:List<&2, U32> -> Bool

length octets read from xs leave less than xs

def pw.le_succ_mono source · line 80 · raw

@+a:Nat -> @+b:Nat -> @+h:{Nat.is_le(a, b) == True{} : Bool} -> {Nat.is_le(a, 1n+b) == True{} : Bool}

def pw.span_cons source · line 85 · raw

@x:0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node -> @+ns:List<&2, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node> -> {0xeb25eff332574f4f1d48668b83cdda30/node.a1.span_list(x <> ns) == Nat.add(0xeb25eff332574f4f1d48668b83cdda30/node.a1.span_list([x]), 0xeb25eff332574f4f1d48668b83cdda30/node.a1.span_list(ns)) : Nat}

def pw.rb_mono source · line 94 · raw

@res:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Out> -> @+k:Nat -> @+k2:Nat -> @+hk:{Nat.is_le(k, k2) == True{} : Bool} -> @+h:{pw.rb(res, k) == True{} : Bool} -> {pw.rb(res, k2) == True{} : Bool}

def pw.rb_more source · line 101 · raw

@a:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node> -> @b:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Out> -> @+k1:Nat -> @+k2:Nat -> @+ha:{pw.nb(a, k1) == True{} : Bool} -> @+hb:{pw.rb(b, k2) == True{} : Bool} -> {pw.rb(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.more(a, b), Nat.add(k1, k2)) == True{} : Bool}

def pw.rb_one source · line 115 · raw

@a:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node> -> @+rest:List<&2, U32> -> @+k1:Nat -> @+ha:{pw.nb(a, k1) == True{} : Bool} -> {pw.rb(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.one(a, rest), Nat.add(k1, List.length(&2, U32, rest))) == True{} : Bool}

def pw.nb_pick source · line 124 · raw

@ok:Bool -> @+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @+o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> {pw.nb(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.mk_prim.pick(ok, t, o), 0xeb25eff332574f4f1d48668b83cdda30/node.a1.span_list([0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Prim{t, o}])) == True{} : Bool}

def pw.nb_prim source · line 131 · raw

@+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @+o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> {pw.nb(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.mk_prim(r, t, o), 0xeb25eff332574f4f1d48668b83cdda30/node.a1.span_list([0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Prim{t, o}])) == True{} : Bool}

def pw.nb_set source · line 134 · raw

@ok:Bool -> @+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @+xs:List<&2, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node> -> @+k:Nat -> @+hk:{Nat.is_le(0xeb25eff332574f4f1d48668b83cdda30/node.a1.span_list(xs), k) == True{} : Bool} -> {pw.nb(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.mk_cons.set(ok, t, xs), Nat.add(2n, k)) == True{} : Bool}

def pw.nb_form source · line 142 · raw

@ok:Bool -> @+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @+xs:List<&2, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node> -> @+k:Nat -> @+hk:{Nat.is_le(0xeb25eff332574f4f1d48668b83cdda30/node.a1.span_list(xs), k) == True{} : Bool} -> {pw.nb(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.mk_cons.form(ok, r, t, xs), Nat.add(2n, k)) == True{} : Bool}

def pw.nb_cons source · line 149 · raw

@+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @inner:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Out> -> @+k:Nat -> @+h:{pw.rb(inner, k) == True{} : Bool} -> {pw.nb(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.mk_cons(r, t, inner), Nat.add(2n, k)) == True{} : Bool}

def pw.indef_one source · line 159 · raw

@+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @inner:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Out> -> @+k:Nat -> @+h:{pw.rb(inner, k) == True{} : Bool} -> {pw.rb(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.one(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.mk_cons(r, t, inner), 0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.out_rest(inner)), Nat.add(2n, k)) == True{} : Bool}

an indefinite constructed element: its contents, and what follows its end-of-contents octets, fit in what follows its header

def pw.indef_more source · line 170 · raw

@+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @+mode:0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Mode -> @+g:Nat -> @inner:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Out> -> @+k:Nat -> @+h:{pw.rb(inner, k) == True{} : Bool} -> @ih:(@ys:List<&2, U32> -> {pw.rb(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.dec(g, r, mode, 0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head(r, ys)), List.length(&2, U32, ys)) == True{} : Bool}) -> {pw.rb(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.more(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.mk_cons(r, t, inner), 0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.dec(g, r, mode, 0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head(r, 0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.out_rest(inner)))), Nat.add(2n, k)) == True{} : Bool}

def pw.drop_le source · line 183 · raw

@k:Nat -> @xs:List<&2, U32> -> {Nat.is_le(List.length(&2, U32, 0x9df7f91779a4a1c215bfa96cd0864601/bytes.drop(k, xs)), List.length(&2, U32, xs)) == True{} : Bool}

def pw.take_drop_len source · line 192 · raw

@+n:Nat -> @+xs:List<&2, U32> -> {Nat.add(List.length(&2, U32, 0x9df7f91779a4a1c215bfa96cd0864601/bytes.take(n, xs)), List.length(&2, U32, 0x9df7f91779a4a1c215bfa96cd0864601/bytes.drop(n, xs))) == List.length(&2, U32, xs) : Nat}

def pw.lt_le_succ source · line 195 · raw

@+a:Nat -> @+b:Nat -> @+h:{Nat.is_lt(a, b) == True{} : Bool} -> {Nat.is_le(1n+a, b) == True{} : Bool}

def pw.mb_cons source · line 206 · raw

@+x:U32 -> @m:Maybe<&2, 0xeb25eff332574f4f1d48668b83cdda30/number.A1Num> -> @+u:List<&2, U32> -> @+h:{pw.mb(m, u) == True{} : Bool} -> {pw.mb(0xeb25eff332574f4f1d48668b83cdda30/number.a1.num_cons(x, m), x <> u) == True{} : Bool}

def pw.r128_mb source · line 213 · raw

@t:List<&2, U32> -> @more:Bool -> @k:Nat -> @+acc:Nat -> {pw.mb(0xeb25eff332574f4f1d48668b83cdda30/number.a1.r128(t, more, k, acc), t) == True{} : Bool}

def pw.rbe_pick source · line 229 · raw

@ok:Bool -> @+k:Nat -> @+xs:List<&2, U32> -> {pw.mb(0xeb25eff332574f4f1d48668b83cdda30/number.a1.rbe.pick(ok, k, xs), xs) == True{} : Bool}

def pw.lbytes source · line 236 · raw

@+y:U32 -> @m:Maybe<&2, 0xeb25eff332574f4f1d48668b83cdda30/number.A1Num> -> @+t:List<&2, U32> -> @+h:{pw.mb(m, t) == True{} : Bool} -> {pw.lb(0xeb25eff332574f4f1d48668b83cdda30/length.a1.len.bytes(y, m), y <> t) == True{} : Bool}

def pw.lmany source · line 243 · raw

@big:Bool -> @+k:Nat -> @+y:U32 -> @+t:List<&2, U32> -> {pw.lb(0xeb25eff332574f4f1d48668b83cdda30/length.a1.len.many(big, k, y, t), y <> t) == True{} : Bool}

def pw.lres source · line 250 · raw

@is127:Bool -> @+k:Nat -> @+y:U32 -> @+t:List<&2, U32> -> {pw.lb(0xeb25eff332574f4f1d48668b83cdda30/length.a1.len.reserved(is127, k, y, t), y <> t) == True{} : Bool}

def pw.llong source · line 257 · raw

@+k:Nat -> @+y:U32 -> @+t:List<&2, U32> -> {pw.lb(0xeb25eff332574f4f1d48668b83cdda30/length.a1.len.long(k, y, t), y <> t) == True{} : Bool}

def pw.lfirst source · line 264 · raw

@lt:Bool -> @+v:Nat -> @+y:U32 -> @+t:List<&2, U32> -> {pw.lb(0xeb25eff332574f4f1d48668b83cdda30/length.a1.len.first(lt, v, y, t), y <> t) == True{} : Bool}

def pw.lread source · line 271 · raw

@xs:List<&2, U32> -> {pw.lb(0xeb25eff332574f4f1d48668b83cdda30/length.a1.len.read(xs), xs) == True{} : Bool}

def pw.fit source · line 280 · raw

@ok:Bool -> @+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @cons:Bool -> @+n:Nat -> @+rest:List<&2, U32> -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.fit(ok, t, cons, n, rest)), Nat.add(2n, List.length(&2, U32, rest))) == True{} : Bool}

def pw.min source · line 291 · raw

@ok:Bool -> @+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @+cons:Bool -> @+n:Nat -> @+rest:List<&2, U32> -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.min(ok, t, cons, n, rest)), Nat.add(2n, List.length(&2, U32, rest))) == True{} : Bool}

def pw.indef source · line 298 · raw

@allowed:Bool -> @cons:Bool -> @+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @+rest:List<&2, U32> -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.indef(allowed, cons, t, rest)), Nat.add(2n, List.length(&2, U32, rest))) == True{} : Bool}

def pw.hl_len source · line 307 · raw

@+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @+cons:Bool -> @l:0xeb25eff332574f4f1d48668b83cdda30/length.A1Len -> @+xs:List<&2, U32> -> @+hl:{pw.lb(l, xs) == True{} : Bool} -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.len(r, t, cons, l)), Nat.add(1n, List.length(&2, U32, xs))) == True{} : Bool}

def pw.eoc2 source · line 317 · raw

@z:Bool -> @+t:List<&2, U32> -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.eoc2(z, t)), Nat.add(2n, List.length(&2, U32, t))) == True{} : Bool}

def pw.eoc source · line 324 · raw

@rest:List<&2, U32> -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.eoc(rest)), Nat.add(1n, List.length(&2, U32, rest))) == True{} : Bool}

def pw.res source · line 331 · raw

@u0:Bool -> @+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @+c:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Class -> @cons:Bool -> @+n:Nat -> @+rest:List<&2, U32> -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.res(u0, r, c, cons, n, rest)), Nat.add(1n, List.length(&2, U32, rest))) == True{} : Bool}

def pw.tag2 source · line 342 · raw

@ok:Bool -> @+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @+c:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Class -> @+cons:Bool -> @+n:Nat -> @+rest:List<&2, U32> -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.tag2(ok, r, c, cons, n, rest)), Nat.add(1n, List.length(&2, U32, rest))) == True{} : Bool}

def pw.num source · line 349 · raw

@+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @+c:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Class -> @+cons:Bool -> @+x:U32 -> @m:Maybe<&2, 0xeb25eff332574f4f1d48668b83cdda30/number.A1Num> -> @+t:List<&2, U32> -> @+hm:{pw.mb(m, t) == True{} : Bool} -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.num(r, c, cons, x, m)), Nat.add(1n, List.length(&2, U32, t))) == True{} : Bool}

def pw.hi source · line 357 · raw

@hi:Bool -> @+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @+c:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Class -> @+cons:Bool -> @+low:Nat -> @+x:U32 -> @+t:List<&2, U32> -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.hi(hi, r, c, cons, low, x, t)), Nat.add(1n, List.length(&2, U32, t))) == True{} : Bool}

def pw.id source · line 364 · raw

@+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @i:0xeb25eff332574f4f1d48668b83cdda30/tag.A1Id1 -> @+x:U32 -> @+t:List<&2, U32> -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.id(r, i, x, t)), Nat.add(1n, List.length(&2, U32, t))) == True{} : Bool}

def pw.head0_le source · line 370 · raw

@+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @xs:List<&2, U32> -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head0(r, xs)), List.length(&2, U32, xs)) == True{} : Bool}

a header fits in the octets it was read from

def pw.imp source · line 379 · raw

@a:Bool -> @b:Bool -> Bool

def pw.imp_i source · line 386 · raw

@a:Bool -> @-b:Bool -> @h:(@e:{a == True{} : Bool} -> {b == True{} : Bool}) -> {pw.imp(a, b) == True{} : Bool}

def pw.lb_ne.go source · line 393 · raw

@lt:Bool -> @+n:Nat -> @+hl:{Nat.is_lt(n, 128n) == lt : Bool} -> {Nat.is_le(1n, List.length(&2, U32, 0xeb25eff332574f4f1d48668b83cdda30/length.a1.len_bytes(n))) == True{} : Bool}

def pw.lb_ne source · line 402 · raw

@+n:Nat -> {Nat.is_le(1n, List.length(&2, U32, 0xeb25eff332574f4f1d48668b83cdda30/length.a1.len_bytes(n))) == True{} : Bool}

def pw.hdr2 source · line 406 · raw

@+c:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Class -> @+cons:Bool -> @+n:Nat -> @+l:Nat -> {Nat.is_le(2n, List.length(&2, U32, 0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.hdr(c, cons, n, l))) == True{} : Bool}

the octets before the contents are at least two

def pw.cbound source · line 413 · raw

@+c:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Class -> @+cons:Bool -> @+n:Nat -> @+l:Nat -> @+xs:List<&2, U32> -> @+e:{0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.canon.ok(c, cons, n, l, xs) == True{} : Bool} -> {Nat.is_le(Nat.add(2n, List.length(&2, U32, 0x9df7f91779a4a1c215bfa96cd0864601/bytes.drop(List.length(&2, U32, 0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.hdr(c, cons, n, l)), xs))), List.length(&2, U32, xs)) == True{} : Bool}

when the canonical check passes, the contents start two octets in or more

def pw.cmk source · line 431 · raw

@ok:Bool -> @+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @cons:Bool -> @+k:Nat -> @+l:Nat -> @+xs:List<&2, U32> -> @+hb:{pw.imp(ok, Nat.is_le(Nat.add(2n, List.length(&2, U32, 0x9df7f91779a4a1c215bfa96cd0864601/bytes.drop(k, xs))), List.length(&2, U32, xs))) == True{} : Bool} -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.canon.mk(ok, t, cons, k, l, xs)), List.length(&2, U32, xs)) == True{} : Bool}

def pw.canon_le source · line 444 · raw

@+xs:List<&2, U32> -> @h:0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Head -> @+hh:{Nat.is_le(pw.hlen(h), List.length(&2, U32, xs)) == True{} : Bool} -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.canon(xs, h)), List.length(&2, U32, xs)) == True{} : Bool}

def pw.ioff source · line 465 · raw

@a:Bool -> @h:0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Head -> @+xs:List<&2, U32> -> @+hh:{Nat.is_le(pw.hlen(h), List.length(&2, U32, xs)) == True{} : Bool} -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.indef_off(a, h)), List.length(&2, U32, xs)) == True{} : Bool}

def pw.fin2 source · line 484 · raw

@m:Bool -> @+xs:List<&2, U32> -> @h:0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Head -> @+hh:{Nat.is_le(pw.hlen(h), List.length(&2, U32, xs)) == True{} : Bool} -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.fin2(m, xs, h)), List.length(&2, U32, xs)) == True{} : Bool}

def pw.nend source · line 491 · raw

@xs:List<&2, U32> -> @h:0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Head -> @+hh:{Nat.is_le(pw.hlen(h), List.length(&2, U32, xs)) == True{} : Bool} -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head.nend(xs, h)), List.length(&2, U32, xs)) == True{} : Bool}

def pw.head_le source · line 510 · raw

@+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @+xs:List<&2, U32> -> {Nat.is_le(pw.hlen(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.head(r, xs)), List.length(&2, U32, xs)) == True{} : Bool}

def pw.olen_of source · line 517 · raw

@+cs:List<&2, U32> -> {0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets.len(0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets.of_list(cs)) == List.length(&2, U32, cs) : Nat}

def pw.prim_le source · line 521 · raw

@+t:0xeb25eff332574f4f1d48668b83cdda30/tag.Asn1Tag -> @+cs:List<&2, U32> -> @+rest:List<&2, U32> -> @+xs:List<&2, U32> -> @+hh:{Nat.is_le(Nat.add(2n, Nat.add(List.length(&2, U32, cs), List.length(&2, U32, rest))), List.length(&2, U32, xs)) == True{} : Bool} -> {Nat.is_le(Nat.add(0xeb25eff332574f4f1d48668b83cdda30/node.a1.span_list([0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Prim{t, 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets.of_list(cs)}]), List.length(&2, U32, rest)), List.length(&2, U32, xs)) == True{} : Bool}

a primitive element's span and what follows it fit where its header said

def pw.eoc_le source · line 527 · raw

@+rest:List<&2, U32> -> @+xs:List<&2, U32> -> @+hh:{Nat.is_le(Nat.add(2n, List.length(&2, U32, rest)), List.length(&2, U32, xs)) == True{} : Bool} -> {Nat.is_le(List.length(&2, U32, rest), List.length(&2, U32, xs)) == True{} : Bool}

def pw.dec source · line 531 · raw

@f:Nat -> @+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @mode:0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Mode -> @h:0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Head -> @+xs:List<&2, U32> -> @+hh:{Nat.is_le(pw.hlen(h), List.length(&2, U32, xs)) == True{} : Bool} -> {pw.rb(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.dec(f, r, mode, h), List.length(&2, U32, xs)) == True{} : Bool}

whatever the decoder answers from a header within xs fits in xs

def pw.run source · line 610 · raw

@+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @mode:0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Mode -> @+xs:List<&2, U32> -> {pw.rb(0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.run(r, mode, xs), List.length(&2, U32, xs)) == True{} : Bool}

the decoder from the start of xs

def pw.rdisc source · line 615 · raw

@r:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node> -> Type

def pw.fd source · line 622 · raw

@-x:0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error -> @-y:0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node -> @e:{Fail{x} == Done{y} : Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node>} -> Empty

def pw.dval source · line 626 · raw

@z:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node> -> @d:0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node -> 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node

def pw.end_inv source · line 633 · raw

@ok:Bool -> @+m:0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node -> @-n:0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node -> @+e:{0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.top.end(ok, m) == Done{n} : Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node>} -> {m == n : 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node}

def pw.top_inv source · line 640 · raw

@+r:0xeb25eff332574f4f1d48668b83cdda30/rules.Asn1Rules -> @res:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Out> -> @-n:0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node -> @+k:Nat -> @+hrb:{pw.rb(res, k) == True{} : Bool} -> @+e:{0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.top(r, res) == Done{n} : Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node>} -> {Nat.is_le(0xeb25eff332574f4f1d48668b83cdda30/node.a1.span_list([n]), k) == True{} : Bool}

def pw.prdisc source · line 656 · raw

@r:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.Asn1Read> -> Type

def pw.pfd source · line 663 · raw

@-x:0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error -> @-y:0xeb25eff332574f4f1d48668b83cdda30/asn1.Asn1Read -> @e:{Fail{x} == Done{y} : Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.Asn1Read>} -> Empty

def pw.read_node source · line 667 · raw

@z:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.Asn1Read> -> @d:0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node -> 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node

def pw.read_rest source · line 674 · raw

@z:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.Asn1Read> -> 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets

def pw.read_inv source · line 681 · raw

@res:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Out> -> @-n:0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node -> @-rest:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> @+k:Nat -> @+hrb:{pw.rb(res, k) == True{} : Bool} -> @+e:{0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.read.out(res) == Done{0xeb25eff332574f4f1d48668b83cdda30/asn1.Asn1Read{n, rest}} : Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.Asn1Read>} -> {Nat.is_le(Nat.add(0xeb25eff332574f4f1d48668b83cdda30/node.a1.span_list([n]), 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets.len(rest)), k) == True{} : Bool}

def pw.ardisc source · line 698 · raw

@r:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, List<&2, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node>> -> Type

def pw.afd source · line 705 · raw

@-x:0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error -> @-y:List<&2, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node> -> @e:{Fail{x} == Done{y} : Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, List<&2, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node>>} -> Empty

def pw.aval source · line 709 · raw

@z:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, List<&2, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node>> -> @d:List<&2, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node> -> List<&2, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node>

def pw.all_inv source · line 716 · raw

@res:Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, 0xeb25eff332574f4f1d48668b83cdda30/asn1.A1Out> -> @-ns:List<&2, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node> -> @+k:Nat -> @+hrb:{pw.rb(res, k) == True{} : Bool} -> @+e:{0xeb25eff332574f4f1d48668b83cdda30/asn1.a1.all.out(res) == Done{ns} : Result<&2, &2, 0xeb25eff332574f4f1d48668b83cdda30/error.Asn1Error, List<&2, 0xeb25eff332574f4f1d48668b83cdda30/node.Asn1Node>>} -> {Nat.is_le(0xeb25eff332574f4f1d48668b83cdda30/node.a1.span_list(ns), k) == True{} : Bool}

def pw.blen source · line 724 · raw

@+b:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> {List.length(&2, U32, 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets.to_list(b)) == 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets.len(b) : Nat}