import Base import ./caps.bend as C import ./exec.bend as E import ./adjust.bend as A import ./LAWS.bend as Laws # Every set operation works bit by bit, so each fact about sets is proved by # induction on the width n of a word (the bits.* lemmas): at each bit, every # combination of the bits involved either satisfies the fact (and the rest is # the induction hypothesis) or contradicts a hypothesis. A set is a native # U32 (capabilities 0 to 31) and a Word(9n) (32 to 40): each set.* lemma # opens its sets into the U32's Word(32n) and the Word(9n), and applies the # bits.* lemma at widths 32 and 9 (set.bridge shows that the native subset # test on the low word, a & ~b == 0, is the bitwise one). The laws then # follow by unfolding the operations and choosing which set lemma each case # needs. Hypotheses are taken as arguments after the match ("convoy" style), # so that matching on a value refines them too. # Contradictions def bits.disc(b: Bool) -> Type: match b: case False{}: Unit case True{}: Empty def bits.disc2(b: Bool) -> Type: match b: case False{}: Empty case True{}: Unit def bits.ft(+e: {False{} == True{} : Bool}) -> bits.disc(True{}): %e : bits.disc(_) Unit{} def bits.tf(+e: {True{} == False{} : Bool}) -> bits.disc2(False{}): %e : bits.disc2(_) Unit{} def bits.absurd(-x: Bool, +e: {False{} == True{} : Bool}) -> {x == True{} : Bool}: Empty.absurd({x == True{} : Bool}, bits.ft(e)) def bits.absurd_eq(-T: Type, -x: T, -y: T, +e: {False{} == True{} : Bool}) -> {x == y : T}: Empty.absurd({x == y : T}, bits.ft(e)) def bits.absurd_tf(-T: Type, -x: T, -y: T, +e: {True{} == False{} : Bool}) -> {x == y : T}: Empty.absurd({x == y : T}, bits.tf(e)) # Conjunctions def bool.and_l(+x: Bool, +y: Bool) -> {Bool.and(x, y) == True{} : Bool} -> {x == True{} : Bool}: match x: case True{}: h => {==} case False{}: h => bits.absurd(False{}, h) def bool.and_r(+x: Bool, +y: Bool) -> {Bool.and(x, y) == True{} : Bool} -> {y == True{} : Bool}: match x: case True{}: h => h case False{}: h => bits.absurd(y, h) def bool.and3(+x: Bool, +y: Bool, +z: Bool) -> {x == True{} : Bool} -> {y == True{} : Bool} -> {z == True{} : Bool} -> {Bool.and(x, Bool.and(y, z)) == True{} : Bool}: match x y z: case True{} True{} True{}: hx => hy => hz => {==} case False{} y z: hx => hy => hz => bits.absurd(Bool.and(False{}, Bool.and(y, z)), hx) case True{} False{} z: hx => hy => hz => bits.absurd(Bool.and(True{}, Bool.and(False{}, z)), hy) case True{} True{} False{}: hx => hy => hz => bits.absurd(False{}, hz) # A state is valid exactly when its three subset tests pass def valid.intro(+s: C.CapState) -> {C.CapSet.subset(C.CapState.effective(s), C.CapState.permitted(s)) == True{} : Bool} -> {C.CapSet.subset(C.CapState.ambient(s), C.CapState.permitted(s)) == True{} : Bool} -> {C.CapSet.subset(C.CapState.ambient(s), C.CapState.inheritable(s)) == True{} : Bool} -> {C.CapState.valid(s) == True{} : Bool}: match s: case C.CapState{+p, +i, +e, +b, +a}: h1 => h2 => h3 => bool.and3(C.CapSet.subset(e, p), C.CapSet.subset(a, p), C.CapSet.subset(a, i))(h1)(h2)(h3) def valid.ep(+s: C.CapState) -> {C.CapState.valid(s) == True{} : Bool} -> {C.CapSet.subset(C.CapState.effective(s), C.CapState.permitted(s)) == True{} : Bool}: match s: case C.CapState{+p, +i, +e, +b, +a}: h => bool.and_l(C.CapSet.subset(e, p), Bool.and(C.CapSet.subset(a, p), C.CapSet.subset(a, i)))(h) def valid.ap(+s: C.CapState) -> {C.CapState.valid(s) == True{} : Bool} -> {C.CapSet.subset(C.CapState.ambient(s), C.CapState.permitted(s)) == True{} : Bool}: match s: case C.CapState{+p, +i, +e, +b, +a}: h => bool.and_l(C.CapSet.subset(a, p), C.CapSet.subset(a, i))(bool.and_r(C.CapSet.subset(e, p), Bool.and(C.CapSet.subset(a, p), C.CapSet.subset(a, i)))(h)) def valid.ai(+s: C.CapState) -> {C.CapState.valid(s) == True{} : Bool} -> {C.CapSet.subset(C.CapState.ambient(s), C.CapState.inheritable(s)) == True{} : Bool}: match s: case C.CapState{+p, +i, +e, +b, +a}: h => bool.and_r(C.CapSet.subset(a, p), C.CapSet.subset(a, i))(bool.and_r(C.CapSet.subset(e, p), Bool.and(C.CapSet.subset(a, p), C.CapSet.subset(a, i)))(h)) def bool.and2(+x: Bool, +y: Bool) -> {x == True{} : Bool} -> {y == True{} : Bool} -> {Bool.and(x, y) == True{} : Bool}: match x: case True{}: hx => hy => hy case False{}: hx => hy => bits.absurd(Bool.and(False{}, y), hx) # A set and its two parts. A set is a native U32 (capabilities 0 to 31) and # a Word(9n) (32 to 40); opening the U32 gives its Word(32n). The subset test # on the low word is native (a & ~b == 0), and is the bitwise test there: def set.fin_ff(+t: Cmp) -> {Cmp.is_eq(Word.cmp.fin(False{}, False{}, t)) == Cmp.is_eq(t) : Bool}: match t: case LT{}: {==} case EQ{}: {==} case GT{}: {==} def set.fin_tf(+t: Cmp) -> {Cmp.is_eq(Word.cmp.fin(True{}, False{}, t)) == False{} : Bool}: match t: case LT{}: {==} case EQ{}: {==} case GT{}: {==} def set.bridge(+n: Nat, +x: Word(n), +y: Word(n)) -> {Cmp.is_eq(Word.cmp(n, Word.and(n, x, Word.not(n, y)), Word.zero(n))) == C.CapBits.subset(n, x, y) : Bool}: match n: case 0n: {==} case 1n+p: match x y: case WCon{True{}, +xt} WCon{True{}, +yt}: Equal.trans(Bool, Cmp.is_eq(Word.cmp.fin(False{}, False{}, Word.cmp(p, Word.and(p, xt, Word.not(p, yt)), Word.zero(p)))), Cmp.is_eq(Word.cmp(p, Word.and(p, xt, Word.not(p, yt)), Word.zero(p))), C.CapBits.subset(p, xt, yt), set.fin_ff(Word.cmp(p, Word.and(p, xt, Word.not(p, yt)), Word.zero(p))), set.bridge(p, xt, yt)) case WCon{True{}, +xt} WCon{False{}, +yt}: set.fin_tf(Word.cmp(p, Word.and(p, xt, Word.not(p, yt)), Word.zero(p))) case WCon{False{}, +xt} WCon{+yb, +yt}: Equal.trans(Bool, Cmp.is_eq(Word.cmp.fin(False{}, False{}, Word.cmp(p, Word.and(p, xt, Word.not(p, yt)), Word.zero(p)))), Cmp.is_eq(Word.cmp(p, Word.and(p, xt, Word.not(p, yt)), Word.zero(p))), C.CapBits.subset(p, xt, yt), set.fin_ff(Word.cmp(p, Word.and(p, xt, Word.not(p, yt)), Word.zero(p))), set.bridge(p, xt, yt)) # a set within another, from its parts within theirs, and back def set.sub_intro(+al: Word(32n), +bl: Word(32n), +ah: Word(9n), +bh: Word(9n)) -> {C.CapBits.subset(32n, al, bl) == True{} : Bool} -> {C.CapBits.subset(9n, ah, bh) == True{} : Bool} -> {C.CapSet.subset(C.CapSetW{U32{al}, ah}, C.CapSetW{U32{bl}, bh}) == True{} : Bool}: hl => hh => %Equal.sym(Bool, Cmp.is_eq(Word.cmp(32n, Word.and(32n, al, Word.not(32n, bl)), Word.zero(32n))), C.CapBits.subset(32n, al, bl), set.bridge(32n, al, bl)) : {Bool.and(_, C.CapBits.subset(9n, ah, bh)) == True{} : Bool} bool.and2(C.CapBits.subset(32n, al, bl), C.CapBits.subset(9n, ah, bh))(hl)(hh) def set.sub_lo(+al: Word(32n), +bl: Word(32n), +ah: Word(9n), +bh: Word(9n)) -> {C.CapSet.subset(C.CapSetW{U32{al}, ah}, C.CapSetW{U32{bl}, bh}) == True{} : Bool} -> {C.CapBits.subset(32n, al, bl) == True{} : Bool}: h => %set.bridge(32n, al, bl) : {_ == True{} : Bool} bool.and_l(Cmp.is_eq(Word.cmp(32n, Word.and(32n, al, Word.not(32n, bl)), Word.zero(32n))), C.CapBits.subset(9n, ah, bh))(h) def set.sub_hi(+al: Word(32n), +bl: Word(32n), +ah: Word(9n), +bh: Word(9n)) -> {C.CapSet.subset(C.CapSetW{U32{al}, ah}, C.CapSetW{U32{bl}, bh}) == True{} : Bool} -> {C.CapBits.subset(9n, ah, bh) == True{} : Bool}: h => bool.and_r(Cmp.is_eq(Word.cmp(32n, Word.and(32n, al, Word.not(32n, bl)), Word.zero(32n))), C.CapBits.subset(9n, ah, bh))(h) # two sets are equal when their parts are def set.eq_intro(+l1: Word(32n), +l2: Word(32n), +h1: Word(9n), +h2: Word(9n), +e1: {l1 == l2 : Word(32n)}, +e2: {h1 == h2 : Word(9n)}) -> {C.CapSetW{U32{l1}, h1} == C.CapSetW{U32{l2}, h2} : C.CapSet()}: %e1 : {C.CapSetW{U32{l1}, h1} == C.CapSetW{U32{_}, h2} : C.CapSet()} %e2 : {C.CapSetW{U32{l1}, h1} == C.CapSetW{U32{l1}, _} : C.CapSet()} {==} # BEGIN GENERATED by gen/proof.py: lemmas # Per-bit lemmas (generated: every combination of the bits at each position) def bits.sub_refl(+n: Nat, +x: Word(n)) -> {C.CapBits.subset(n, x, x) == True{} : Bool}: match n: case 0n: {==} case 1n+n1: match x: case WCon{True{}, +xt}: bits.sub_refl(n1, xt) case WCon{False{}, +xt}: bits.sub_refl(n1, xt) def bits.sub_zero(+n: Nat, +x: Word(n)) -> {C.CapBits.subset(n, Word.zero(n), x) == True{} : Bool}: match n: case 0n: {==} case 1n+n1: match x: case WCon{True{}, +xt}: bits.sub_zero(n1, xt) case WCon{False{}, +xt}: bits.sub_zero(n1, xt) def bits.sub_or_r(+n: Nat, +x: Word(n), +c: Word(n)) -> {C.CapBits.subset(n, c, Word.or(n, x, c)) == True{} : Bool}: match n: case 0n: {==} case 1n+n1: match x c: case WCon{True{}, +xt} WCon{True{}, +ct}: bits.sub_or_r(n1, xt, ct) case WCon{True{}, +xt} WCon{False{}, +ct}: bits.sub_or_r(n1, xt, ct) case WCon{False{}, +xt} WCon{True{}, +ct}: bits.sub_or_r(n1, xt, ct) case WCon{False{}, +xt} WCon{False{}, +ct}: bits.sub_or_r(n1, xt, ct) def bits.sub_minus(+n: Nat, +x: Word(n), +y: Word(n)) -> {C.CapBits.subset(n, Word.and(n, x, Word.not(n, y)), x) == True{} : Bool}: match n: case 0n: {==} case 1n+n1: match x y: case WCon{True{}, +xt} WCon{True{}, +yt}: bits.sub_minus(n1, xt, yt) case WCon{True{}, +xt} WCon{False{}, +yt}: bits.sub_minus(n1, xt, yt) case WCon{False{}, +xt} WCon{True{}, +yt}: bits.sub_minus(n1, xt, yt) case WCon{False{}, +xt} WCon{False{}, +yt}: bits.sub_minus(n1, xt, yt) def bits.bound_a(+n: Nat, +i: Word(n), +fi: Word(n), +fp: Word(n), +b: Word(n), +a: Word(n)) -> {C.CapBits.subset(n, Word.or(n, Word.or(n, Word.and(n, i, fi), Word.and(n, fp, b)), a), Word.or(n, b, Word.or(n, i, a))) == True{} : Bool}: match n: case 0n: {==} case 1n+n1: match i fi fp b a: case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_a(n1, it, fit, fpt, bt, at) def bits.bound_z(+n: Nat, +i: Word(n), +fi: Word(n), +fp: Word(n), +b: Word(n), +a: Word(n)) -> {C.CapBits.subset(n, Word.or(n, Word.or(n, Word.and(n, i, fi), Word.and(n, fp, b)), Word.zero(n)), Word.or(n, b, Word.or(n, i, a))) == True{} : Bool}: match n: case 0n: {==} case 1n+n1: match i fi fp b a: case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: bits.bound_z(n1, it, fit, fpt, bt, at) def bits.bound_va(+n: Nat, +i: Word(n), +fi: Word(n), +fp: Word(n), +b: Word(n), +a: Word(n)) -> {C.CapBits.subset(n, a, i) == True{} : Bool} -> {C.CapBits.subset(n, Word.or(n, Word.or(n, Word.and(n, i, fi), Word.and(n, fp, b)), a), Word.or(n, b, i)) == True{} : Bool}: match n: case 0n: h0 => {==} case 1n+n1: match i fi fp b a: case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: h0 => bits.absurd(C.CapBits.subset(1n+n1, Word.or(1n+n1, Word.or(1n+n1, Word.and(1n+n1, WCon{False{}, it}, WCon{True{}, fit}), Word.and(1n+n1, WCon{True{}, fpt}, WCon{True{}, bt})), WCon{True{}, at}), Word.or(1n+n1, WCon{True{}, bt}, WCon{False{}, it})), h0) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: h0 => bits.absurd(C.CapBits.subset(1n+n1, Word.or(1n+n1, Word.or(1n+n1, Word.and(1n+n1, WCon{False{}, it}, WCon{True{}, fit}), Word.and(1n+n1, WCon{True{}, fpt}, WCon{False{}, bt})), WCon{True{}, at}), Word.or(1n+n1, WCon{False{}, bt}, WCon{False{}, it})), h0) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: h0 => bits.absurd(C.CapBits.subset(1n+n1, Word.or(1n+n1, Word.or(1n+n1, Word.and(1n+n1, WCon{False{}, it}, WCon{True{}, fit}), Word.and(1n+n1, WCon{False{}, fpt}, WCon{True{}, bt})), WCon{True{}, at}), Word.or(1n+n1, WCon{True{}, bt}, WCon{False{}, it})), h0) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: h0 => bits.absurd(C.CapBits.subset(1n+n1, Word.or(1n+n1, Word.or(1n+n1, Word.and(1n+n1, WCon{False{}, it}, WCon{True{}, fit}), Word.and(1n+n1, WCon{False{}, fpt}, WCon{False{}, bt})), WCon{True{}, at}), Word.or(1n+n1, WCon{False{}, bt}, WCon{False{}, it})), h0) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: h0 => bits.absurd(C.CapBits.subset(1n+n1, Word.or(1n+n1, Word.or(1n+n1, Word.and(1n+n1, WCon{False{}, it}, WCon{False{}, fit}), Word.and(1n+n1, WCon{True{}, fpt}, WCon{True{}, bt})), WCon{True{}, at}), Word.or(1n+n1, WCon{True{}, bt}, WCon{False{}, it})), h0) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: h0 => bits.absurd(C.CapBits.subset(1n+n1, Word.or(1n+n1, Word.or(1n+n1, Word.and(1n+n1, WCon{False{}, it}, WCon{False{}, fit}), Word.and(1n+n1, WCon{True{}, fpt}, WCon{False{}, bt})), WCon{True{}, at}), Word.or(1n+n1, WCon{False{}, bt}, WCon{False{}, it})), h0) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{True{}, +at}: h0 => bits.absurd(C.CapBits.subset(1n+n1, Word.or(1n+n1, Word.or(1n+n1, Word.and(1n+n1, WCon{False{}, it}, WCon{False{}, fit}), Word.and(1n+n1, WCon{False{}, fpt}, WCon{True{}, bt})), WCon{True{}, at}), Word.or(1n+n1, WCon{True{}, bt}, WCon{False{}, it})), h0) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{True{}, +at}: h0 => bits.absurd(C.CapBits.subset(1n+n1, Word.or(1n+n1, Word.or(1n+n1, Word.and(1n+n1, WCon{False{}, it}, WCon{False{}, fit}), Word.and(1n+n1, WCon{False{}, fpt}, WCon{False{}, bt})), WCon{True{}, at}), Word.or(1n+n1, WCon{False{}, bt}, WCon{False{}, it})), h0) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt} WCon{False{}, +at}: h0 => bits.bound_va(n1, it, fit, fpt, bt, at)(h0) def bits.bound_vz(+n: Nat, +i: Word(n), +fi: Word(n), +fp: Word(n), +b: Word(n)) -> {C.CapBits.subset(n, Word.or(n, Word.or(n, Word.and(n, i, fi), Word.and(n, fp, b)), Word.zero(n)), Word.or(n, b, i)) == True{} : Bool}: match n: case 0n: {==} case 1n+n1: match i fi fp b: case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{True{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{True{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{True{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{True{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{False{}, +it} WCon{True{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{False{}, +it} WCon{True{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{True{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{False{}, +it} WCon{False{}, +fit} WCon{True{}, +fpt} WCon{False{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{True{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) case WCon{False{}, +it} WCon{False{}, +fit} WCon{False{}, +fpt} WCon{False{}, +bt}: bits.bound_vz(n1, it, fit, fpt, bt) def bits.amb_p(+n: Nat, +a: Word(n), +p: Word(n), +i: Word(n)) -> {C.CapBits.subset(n, Word.and(n, Word.and(n, a, p), i), p) == True{} : Bool}: match n: case 0n: {==} case 1n+n1: match a p i: case WCon{True{}, +at} WCon{True{}, +pt} WCon{True{}, +it}: bits.amb_p(n1, at, pt, it) case WCon{True{}, +at} WCon{True{}, +pt} WCon{False{}, +it}: bits.amb_p(n1, at, pt, it) case WCon{True{}, +at} WCon{False{}, +pt} WCon{True{}, +it}: bits.amb_p(n1, at, pt, it) case WCon{True{}, +at} WCon{False{}, +pt} WCon{False{}, +it}: bits.amb_p(n1, at, pt, it) case WCon{False{}, +at} WCon{True{}, +pt} WCon{True{}, +it}: bits.amb_p(n1, at, pt, it) case WCon{False{}, +at} WCon{True{}, +pt} WCon{False{}, +it}: bits.amb_p(n1, at, pt, it) case WCon{False{}, +at} WCon{False{}, +pt} WCon{True{}, +it}: bits.amb_p(n1, at, pt, it) case WCon{False{}, +at} WCon{False{}, +pt} WCon{False{}, +it}: bits.amb_p(n1, at, pt, it) def bits.amb_i(+n: Nat, +a: Word(n), +p: Word(n), +i: Word(n)) -> {C.CapBits.subset(n, Word.and(n, Word.and(n, a, p), i), i) == True{} : Bool}: match n: case 0n: {==} case 1n+n1: match a p i: case WCon{True{}, +at} WCon{True{}, +pt} WCon{True{}, +it}: bits.amb_i(n1, at, pt, it) case WCon{True{}, +at} WCon{True{}, +pt} WCon{False{}, +it}: bits.amb_i(n1, at, pt, it) case WCon{True{}, +at} WCon{False{}, +pt} WCon{True{}, +it}: bits.amb_i(n1, at, pt, it) case WCon{True{}, +at} WCon{False{}, +pt} WCon{False{}, +it}: bits.amb_i(n1, at, pt, it) case WCon{False{}, +at} WCon{True{}, +pt} WCon{True{}, +it}: bits.amb_i(n1, at, pt, it) case WCon{False{}, +at} WCon{True{}, +pt} WCon{False{}, +it}: bits.amb_i(n1, at, pt, it) case WCon{False{}, +at} WCon{False{}, +pt} WCon{True{}, +it}: bits.amb_i(n1, at, pt, it) case WCon{False{}, +at} WCon{False{}, +pt} WCon{False{}, +it}: bits.amb_i(n1, at, pt, it) def bits.lub(+n: Nat, +a: Word(n), +s: Word(n), +p: Word(n)) -> {C.CapBits.subset(n, a, p) == True{} : Bool} -> {C.CapBits.subset(n, s, p) == True{} : Bool} -> {C.CapBits.subset(n, Word.or(n, a, s), p) == True{} : Bool}: match n: case 0n: h0 => h1 => {==} case 1n+n1: match a s p: case WCon{True{}, +at} WCon{True{}, +st} WCon{True{}, +pt}: h0 => h1 => bits.lub(n1, at, st, pt)(h0)(h1) case WCon{True{}, +at} WCon{True{}, +st} WCon{False{}, +pt}: h0 => h1 => bits.absurd(C.CapBits.subset(1n+n1, Word.or(1n+n1, WCon{True{}, at}, WCon{True{}, st}), WCon{False{}, pt}), h0) case WCon{True{}, +at} WCon{False{}, +st} WCon{True{}, +pt}: h0 => h1 => bits.lub(n1, at, st, pt)(h0)(h1) case WCon{True{}, +at} WCon{False{}, +st} WCon{False{}, +pt}: h0 => h1 => bits.absurd(C.CapBits.subset(1n+n1, Word.or(1n+n1, WCon{True{}, at}, WCon{False{}, st}), WCon{False{}, pt}), h0) case WCon{False{}, +at} WCon{True{}, +st} WCon{True{}, +pt}: h0 => h1 => bits.lub(n1, at, st, pt)(h0)(h1) case WCon{False{}, +at} WCon{True{}, +st} WCon{False{}, +pt}: h0 => h1 => bits.absurd(C.CapBits.subset(1n+n1, Word.or(1n+n1, WCon{False{}, at}, WCon{True{}, st}), WCon{False{}, pt}), h1) case WCon{False{}, +at} WCon{False{}, +st} WCon{True{}, +pt}: h0 => h1 => bits.lub(n1, at, st, pt)(h0)(h1) case WCon{False{}, +at} WCon{False{}, +st} WCon{False{}, +pt}: h0 => h1 => bits.lub(n1, at, st, pt)(h0)(h1) def bits.minus_within(+n: Nat, +a: Word(n), +y: Word(n), +p: Word(n)) -> {C.CapBits.subset(n, a, p) == True{} : Bool} -> {C.CapBits.subset(n, Word.and(n, a, Word.not(n, y)), p) == True{} : Bool}: match n: case 0n: h0 => {==} case 1n+n1: match a y p: case WCon{True{}, +at} WCon{True{}, +yt} WCon{True{}, +pt}: h0 => bits.minus_within(n1, at, yt, pt)(h0) case WCon{True{}, +at} WCon{True{}, +yt} WCon{False{}, +pt}: h0 => bits.absurd(C.CapBits.subset(1n+n1, Word.and(1n+n1, WCon{True{}, at}, Word.not(1n+n1, WCon{True{}, yt})), WCon{False{}, pt}), h0) case WCon{True{}, +at} WCon{False{}, +yt} WCon{True{}, +pt}: h0 => bits.minus_within(n1, at, yt, pt)(h0) case WCon{True{}, +at} WCon{False{}, +yt} WCon{False{}, +pt}: h0 => bits.absurd(C.CapBits.subset(1n+n1, Word.and(1n+n1, WCon{True{}, at}, Word.not(1n+n1, WCon{False{}, yt})), WCon{False{}, pt}), h0) case WCon{False{}, +at} WCon{True{}, +yt} WCon{True{}, +pt}: h0 => bits.minus_within(n1, at, yt, pt)(h0) case WCon{False{}, +at} WCon{True{}, +yt} WCon{False{}, +pt}: h0 => bits.minus_within(n1, at, yt, pt)(h0) case WCon{False{}, +at} WCon{False{}, +yt} WCon{True{}, +pt}: h0 => bits.minus_within(n1, at, yt, pt)(h0) case WCon{False{}, +at} WCon{False{}, +yt} WCon{False{}, +pt}: h0 => bits.minus_within(n1, at, yt, pt)(h0) def bits.root_a(+n: Nat, +i: Word(n), +b: Word(n), +a: Word(n)) -> {C.CapBits.subset(n, a, i) == True{} : Bool} -> {Word.or(n, Word.or(n, Word.and(n, i, C.CapBits.all(n)), Word.and(n, C.CapBits.all(n), b)), a) == Word.or(n, i, b) : Word(n)}: match n: case 0n: match i b a: case WNil{} WNil{} WNil{}: h0 => {==} case 1n+n1: match i b a: case WCon{True{}, +it} WCon{True{}, +bt} WCon{True{}, +at}: h0 => Equal.cong(Word(n1), Word(1n+n1), w => WCon{True{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, C.CapBits.all(n1)), Word.and(n1, C.CapBits.all(n1), bt)), at), Word.or(n1, it, bt), bits.root_a(n1, it, bt, at)(h0)) case WCon{True{}, +it} WCon{True{}, +bt} WCon{False{}, +at}: h0 => Equal.cong(Word(n1), Word(1n+n1), w => WCon{True{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, C.CapBits.all(n1)), Word.and(n1, C.CapBits.all(n1), bt)), at), Word.or(n1, it, bt), bits.root_a(n1, it, bt, at)(h0)) case WCon{True{}, +it} WCon{False{}, +bt} WCon{True{}, +at}: h0 => Equal.cong(Word(n1), Word(1n+n1), w => WCon{True{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, C.CapBits.all(n1)), Word.and(n1, C.CapBits.all(n1), bt)), at), Word.or(n1, it, bt), bits.root_a(n1, it, bt, at)(h0)) case WCon{True{}, +it} WCon{False{}, +bt} WCon{False{}, +at}: h0 => Equal.cong(Word(n1), Word(1n+n1), w => WCon{True{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, C.CapBits.all(n1)), Word.and(n1, C.CapBits.all(n1), bt)), at), Word.or(n1, it, bt), bits.root_a(n1, it, bt, at)(h0)) case WCon{False{}, +it} WCon{True{}, +bt} WCon{True{}, +at}: h0 => bits.absurd_eq(Word(1n+n1), Word.or(1n+n1, Word.or(1n+n1, Word.and(1n+n1, WCon{False{}, it}, C.CapBits.all(1n+n1)), Word.and(1n+n1, C.CapBits.all(1n+n1), WCon{True{}, bt})), WCon{True{}, at}), Word.or(1n+n1, WCon{False{}, it}, WCon{True{}, bt}), h0) case WCon{False{}, +it} WCon{True{}, +bt} WCon{False{}, +at}: h0 => Equal.cong(Word(n1), Word(1n+n1), w => WCon{True{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, C.CapBits.all(n1)), Word.and(n1, C.CapBits.all(n1), bt)), at), Word.or(n1, it, bt), bits.root_a(n1, it, bt, at)(h0)) case WCon{False{}, +it} WCon{False{}, +bt} WCon{True{}, +at}: h0 => bits.absurd_eq(Word(1n+n1), Word.or(1n+n1, Word.or(1n+n1, Word.and(1n+n1, WCon{False{}, it}, C.CapBits.all(1n+n1)), Word.and(1n+n1, C.CapBits.all(1n+n1), WCon{False{}, bt})), WCon{True{}, at}), Word.or(1n+n1, WCon{False{}, it}, WCon{False{}, bt}), h0) case WCon{False{}, +it} WCon{False{}, +bt} WCon{False{}, +at}: h0 => Equal.cong(Word(n1), Word(1n+n1), w => WCon{False{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, C.CapBits.all(n1)), Word.and(n1, C.CapBits.all(n1), bt)), at), Word.or(n1, it, bt), bits.root_a(n1, it, bt, at)(h0)) def bits.root_z(+n: Nat, +i: Word(n), +b: Word(n)) -> {Word.or(n, Word.or(n, Word.and(n, i, C.CapBits.all(n)), Word.and(n, C.CapBits.all(n), b)), Word.zero(n)) == Word.or(n, i, b) : Word(n)}: match n: case 0n: match i b: case WNil{} WNil{}: {==} case 1n+n1: match i b: case WCon{True{}, +it} WCon{True{}, +bt}: Equal.cong(Word(n1), Word(1n+n1), w => WCon{True{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, C.CapBits.all(n1)), Word.and(n1, C.CapBits.all(n1), bt)), Word.zero(n1)), Word.or(n1, it, bt), bits.root_z(n1, it, bt)) case WCon{True{}, +it} WCon{False{}, +bt}: Equal.cong(Word(n1), Word(1n+n1), w => WCon{True{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, C.CapBits.all(n1)), Word.and(n1, C.CapBits.all(n1), bt)), Word.zero(n1)), Word.or(n1, it, bt), bits.root_z(n1, it, bt)) case WCon{False{}, +it} WCon{True{}, +bt}: Equal.cong(Word(n1), Word(1n+n1), w => WCon{True{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, C.CapBits.all(n1)), Word.and(n1, C.CapBits.all(n1), bt)), Word.zero(n1)), Word.or(n1, it, bt), bits.root_z(n1, it, bt)) case WCon{False{}, +it} WCon{False{}, +bt}: Equal.cong(Word(n1), Word(1n+n1), w => WCon{False{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, C.CapBits.all(n1)), Word.and(n1, C.CapBits.all(n1), bt)), Word.zero(n1)), Word.or(n1, it, bt), bits.root_z(n1, it, bt)) def bits.nonroot(+n: Nat, +i: Word(n), +b: Word(n), +a: Word(n)) -> {Word.or(n, Word.or(n, Word.and(n, i, Word.zero(n)), Word.and(n, Word.zero(n), b)), a) == a : Word(n)}: match n: case 0n: match i b a: case WNil{} WNil{} WNil{}: {==} case 1n+n1: match i b a: case WCon{True{}, +it} WCon{True{}, +bt} WCon{True{}, +at}: Equal.cong(Word(n1), Word(1n+n1), w => WCon{True{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, Word.zero(n1)), Word.and(n1, Word.zero(n1), bt)), at), at, bits.nonroot(n1, it, bt, at)) case WCon{True{}, +it} WCon{True{}, +bt} WCon{False{}, +at}: Equal.cong(Word(n1), Word(1n+n1), w => WCon{False{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, Word.zero(n1)), Word.and(n1, Word.zero(n1), bt)), at), at, bits.nonroot(n1, it, bt, at)) case WCon{True{}, +it} WCon{False{}, +bt} WCon{True{}, +at}: Equal.cong(Word(n1), Word(1n+n1), w => WCon{True{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, Word.zero(n1)), Word.and(n1, Word.zero(n1), bt)), at), at, bits.nonroot(n1, it, bt, at)) case WCon{True{}, +it} WCon{False{}, +bt} WCon{False{}, +at}: Equal.cong(Word(n1), Word(1n+n1), w => WCon{False{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, Word.zero(n1)), Word.and(n1, Word.zero(n1), bt)), at), at, bits.nonroot(n1, it, bt, at)) case WCon{False{}, +it} WCon{True{}, +bt} WCon{True{}, +at}: Equal.cong(Word(n1), Word(1n+n1), w => WCon{True{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, Word.zero(n1)), Word.and(n1, Word.zero(n1), bt)), at), at, bits.nonroot(n1, it, bt, at)) case WCon{False{}, +it} WCon{True{}, +bt} WCon{False{}, +at}: Equal.cong(Word(n1), Word(1n+n1), w => WCon{False{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, Word.zero(n1)), Word.and(n1, Word.zero(n1), bt)), at), at, bits.nonroot(n1, it, bt, at)) case WCon{False{}, +it} WCon{False{}, +bt} WCon{True{}, +at}: Equal.cong(Word(n1), Word(1n+n1), w => WCon{True{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, Word.zero(n1)), Word.and(n1, Word.zero(n1), bt)), at), at, bits.nonroot(n1, it, bt, at)) case WCon{False{}, +it} WCon{False{}, +bt} WCon{False{}, +at}: Equal.cong(Word(n1), Word(1n+n1), w => WCon{False{}, w}, Word.or(n1, Word.or(n1, Word.and(n1, it, Word.zero(n1)), Word.and(n1, Word.zero(n1), bt)), at), at, bits.nonroot(n1, it, bt, at)) # The same facts on capability sets: each splits its sets into their two # parts and applies the per-bit lemma at widths 32 and 9. def set.sub_refl(+x: C.CapSet()) -> {C.CapSet.subset(x, x) == True{} : Bool}: match x: case C.CapSetW{U32{+xl}, +xh}: set.sub_intro(xl, xl, xh, xh)(bits.sub_refl(32n, xl))(bits.sub_refl(9n, xh)) def set.sub_zero(+x: C.CapSet()) -> {C.CapSet.subset(C.CapSet.empty(), x) == True{} : Bool}: match x: case C.CapSetW{U32{+xl}, +xh}: set.sub_intro(Word.zero(32n), xl, Word.zero(9n), xh)(bits.sub_zero(32n, xl))(bits.sub_zero(9n, xh)) def set.sub_or_r(+x: C.CapSet(), +c: C.CapSet()) -> {C.CapSet.subset(c, C.CapSet.union(x, c)) == True{} : Bool}: match x c: case C.CapSetW{U32{+xl}, +xh} C.CapSetW{U32{+cl}, +ch}: set.sub_intro(cl, Word.or(32n, xl, cl), ch, Word.or(9n, xh, ch))(bits.sub_or_r(32n, xl, cl))(bits.sub_or_r(9n, xh, ch)) def set.sub_minus(+x: C.CapSet(), +y: C.CapSet()) -> {C.CapSet.subset(C.CapSet.minus(x, y), x) == True{} : Bool}: match x y: case C.CapSetW{U32{+xl}, +xh} C.CapSetW{U32{+yl}, +yh}: set.sub_intro(Word.and(32n, xl, Word.not(32n, yl)), xl, Word.and(9n, xh, Word.not(9n, yh)), xh)(bits.sub_minus(32n, xl, yl))(bits.sub_minus(9n, xh, yh)) def set.bound_a(+i: C.CapSet(), +fi: C.CapSet(), +fp: C.CapSet(), +b: C.CapSet(), +a: C.CapSet()) -> {C.CapSet.subset(C.CapSet.union(C.CapSet.union(C.CapSet.inter(i, fi), C.CapSet.inter(fp, b)), a), C.CapSet.union(b, C.CapSet.union(i, a))) == True{} : Bool}: match i fi fp b a: case C.CapSetW{U32{+il}, +ih} C.CapSetW{U32{+fil}, +fih} C.CapSetW{U32{+fpl}, +fph} C.CapSetW{U32{+bl}, +bh} C.CapSetW{U32{+al}, +ah}: set.sub_intro(Word.or(32n, Word.or(32n, Word.and(32n, il, fil), Word.and(32n, fpl, bl)), al), Word.or(32n, bl, Word.or(32n, il, al)), Word.or(9n, Word.or(9n, Word.and(9n, ih, fih), Word.and(9n, fph, bh)), ah), Word.or(9n, bh, Word.or(9n, ih, ah)))(bits.bound_a(32n, il, fil, fpl, bl, al))(bits.bound_a(9n, ih, fih, fph, bh, ah)) def set.bound_z(+i: C.CapSet(), +fi: C.CapSet(), +fp: C.CapSet(), +b: C.CapSet(), +a: C.CapSet()) -> {C.CapSet.subset(C.CapSet.union(C.CapSet.union(C.CapSet.inter(i, fi), C.CapSet.inter(fp, b)), C.CapSet.empty()), C.CapSet.union(b, C.CapSet.union(i, a))) == True{} : Bool}: match i fi fp b a: case C.CapSetW{U32{+il}, +ih} C.CapSetW{U32{+fil}, +fih} C.CapSetW{U32{+fpl}, +fph} C.CapSetW{U32{+bl}, +bh} C.CapSetW{U32{+al}, +ah}: set.sub_intro(Word.or(32n, Word.or(32n, Word.and(32n, il, fil), Word.and(32n, fpl, bl)), Word.zero(32n)), Word.or(32n, bl, Word.or(32n, il, al)), Word.or(9n, Word.or(9n, Word.and(9n, ih, fih), Word.and(9n, fph, bh)), Word.zero(9n)), Word.or(9n, bh, Word.or(9n, ih, ah)))(bits.bound_z(32n, il, fil, fpl, bl, al))(bits.bound_z(9n, ih, fih, fph, bh, ah)) def set.bound_va(+i: C.CapSet(), +fi: C.CapSet(), +fp: C.CapSet(), +b: C.CapSet(), +a: C.CapSet()) -> {C.CapSet.subset(a, i) == True{} : Bool} -> {C.CapSet.subset(C.CapSet.union(C.CapSet.union(C.CapSet.inter(i, fi), C.CapSet.inter(fp, b)), a), C.CapSet.union(b, i)) == True{} : Bool}: match i fi fp b a: case C.CapSetW{U32{+il}, +ih} C.CapSetW{U32{+fil}, +fih} C.CapSetW{U32{+fpl}, +fph} C.CapSetW{U32{+bl}, +bh} C.CapSetW{U32{+al}, +ah}: +h0 => set.sub_intro(Word.or(32n, Word.or(32n, Word.and(32n, il, fil), Word.and(32n, fpl, bl)), al), Word.or(32n, bl, il), Word.or(9n, Word.or(9n, Word.and(9n, ih, fih), Word.and(9n, fph, bh)), ah), Word.or(9n, bh, ih))(bits.bound_va(32n, il, fil, fpl, bl, al)(set.sub_lo(al, il, ah, ih)(h0)))(bits.bound_va(9n, ih, fih, fph, bh, ah)(set.sub_hi(al, il, ah, ih)(h0))) def set.bound_vz(+i: C.CapSet(), +fi: C.CapSet(), +fp: C.CapSet(), +b: C.CapSet()) -> {C.CapSet.subset(C.CapSet.union(C.CapSet.union(C.CapSet.inter(i, fi), C.CapSet.inter(fp, b)), C.CapSet.empty()), C.CapSet.union(b, i)) == True{} : Bool}: match i fi fp b: case C.CapSetW{U32{+il}, +ih} C.CapSetW{U32{+fil}, +fih} C.CapSetW{U32{+fpl}, +fph} C.CapSetW{U32{+bl}, +bh}: set.sub_intro(Word.or(32n, Word.or(32n, Word.and(32n, il, fil), Word.and(32n, fpl, bl)), Word.zero(32n)), Word.or(32n, bl, il), Word.or(9n, Word.or(9n, Word.and(9n, ih, fih), Word.and(9n, fph, bh)), Word.zero(9n)), Word.or(9n, bh, ih))(bits.bound_vz(32n, il, fil, fpl, bl))(bits.bound_vz(9n, ih, fih, fph, bh)) def set.amb_p(+a: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapSet.subset(C.CapSet.inter(C.CapSet.inter(a, p), i), p) == True{} : Bool}: match a p i: case C.CapSetW{U32{+al}, +ah} C.CapSetW{U32{+pl}, +ph} C.CapSetW{U32{+il}, +ih}: set.sub_intro(Word.and(32n, Word.and(32n, al, pl), il), pl, Word.and(9n, Word.and(9n, ah, ph), ih), ph)(bits.amb_p(32n, al, pl, il))(bits.amb_p(9n, ah, ph, ih)) def set.amb_i(+a: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapSet.subset(C.CapSet.inter(C.CapSet.inter(a, p), i), i) == True{} : Bool}: match a p i: case C.CapSetW{U32{+al}, +ah} C.CapSetW{U32{+pl}, +ph} C.CapSetW{U32{+il}, +ih}: set.sub_intro(Word.and(32n, Word.and(32n, al, pl), il), il, Word.and(9n, Word.and(9n, ah, ph), ih), ih)(bits.amb_i(32n, al, pl, il))(bits.amb_i(9n, ah, ph, ih)) def set.lub(+a: C.CapSet(), +s: C.CapSet(), +p: C.CapSet()) -> {C.CapSet.subset(a, p) == True{} : Bool} -> {C.CapSet.subset(s, p) == True{} : Bool} -> {C.CapSet.subset(C.CapSet.union(a, s), p) == True{} : Bool}: match a s p: case C.CapSetW{U32{+al}, +ah} C.CapSetW{U32{+sl}, +sh} C.CapSetW{U32{+pl}, +ph}: +h0 => +h1 => set.sub_intro(Word.or(32n, al, sl), pl, Word.or(9n, ah, sh), ph)(bits.lub(32n, al, sl, pl)(set.sub_lo(al, pl, ah, ph)(h0))(set.sub_lo(sl, pl, sh, ph)(h1)))(bits.lub(9n, ah, sh, ph)(set.sub_hi(al, pl, ah, ph)(h0))(set.sub_hi(sl, pl, sh, ph)(h1))) def set.minus_within(+a: C.CapSet(), +y: C.CapSet(), +p: C.CapSet()) -> {C.CapSet.subset(a, p) == True{} : Bool} -> {C.CapSet.subset(C.CapSet.minus(a, y), p) == True{} : Bool}: match a y p: case C.CapSetW{U32{+al}, +ah} C.CapSetW{U32{+yl}, +yh} C.CapSetW{U32{+pl}, +ph}: +h0 => set.sub_intro(Word.and(32n, al, Word.not(32n, yl)), pl, Word.and(9n, ah, Word.not(9n, yh)), ph)(bits.minus_within(32n, al, yl, pl)(set.sub_lo(al, pl, ah, ph)(h0)))(bits.minus_within(9n, ah, yh, ph)(set.sub_hi(al, pl, ah, ph)(h0))) def set.root_a(+i: C.CapSet(), +b: C.CapSet(), +a: C.CapSet()) -> {C.CapSet.subset(a, i) == True{} : Bool} -> {C.CapSet.union(C.CapSet.union(C.CapSet.inter(i, C.CapSet.full()), C.CapSet.inter(C.CapSet.full(), b)), a) == C.CapSet.union(i, b) : C.CapSet()}: match i b a: case C.CapSetW{U32{+il}, +ih} C.CapSetW{U32{+bl}, +bh} C.CapSetW{U32{+al}, +ah}: +h0 => set.eq_intro(Word.or(32n, Word.or(32n, Word.and(32n, il, C.CapBits.all(32n)), Word.and(32n, C.CapBits.all(32n), bl)), al), Word.or(32n, il, bl), Word.or(9n, Word.or(9n, Word.and(9n, ih, C.CapBits.all(9n)), Word.and(9n, C.CapBits.all(9n), bh)), ah), Word.or(9n, ih, bh), bits.root_a(32n, il, bl, al)(set.sub_lo(al, il, ah, ih)(h0)), bits.root_a(9n, ih, bh, ah)(set.sub_hi(al, il, ah, ih)(h0))) def set.root_z(+i: C.CapSet(), +b: C.CapSet()) -> {C.CapSet.union(C.CapSet.union(C.CapSet.inter(i, C.CapSet.full()), C.CapSet.inter(C.CapSet.full(), b)), C.CapSet.empty()) == C.CapSet.union(i, b) : C.CapSet()}: match i b: case C.CapSetW{U32{+il}, +ih} C.CapSetW{U32{+bl}, +bh}: set.eq_intro(Word.or(32n, Word.or(32n, Word.and(32n, il, C.CapBits.all(32n)), Word.and(32n, C.CapBits.all(32n), bl)), Word.zero(32n)), Word.or(32n, il, bl), Word.or(9n, Word.or(9n, Word.and(9n, ih, C.CapBits.all(9n)), Word.and(9n, C.CapBits.all(9n), bh)), Word.zero(9n)), Word.or(9n, ih, bh), bits.root_z(32n, il, bl), bits.root_z(9n, ih, bh)) def set.nonroot(+i: C.CapSet(), +b: C.CapSet(), +a: C.CapSet()) -> {C.CapSet.union(C.CapSet.union(C.CapSet.inter(i, C.CapSet.empty()), C.CapSet.inter(C.CapSet.empty(), b)), a) == a : C.CapSet()}: match i b a: case C.CapSetW{U32{+il}, +ih} C.CapSetW{U32{+bl}, +bh} C.CapSetW{U32{+al}, +ah}: set.eq_intro(Word.or(32n, Word.or(32n, Word.and(32n, il, Word.zero(32n)), Word.and(32n, Word.zero(32n), bl)), al), al, Word.or(9n, Word.or(9n, Word.and(9n, ih, Word.zero(9n)), Word.and(9n, Word.zero(9n), bh)), ah), ah, bits.nonroot(32n, il, bl, al), bits.nonroot(9n, ih, bh, ah)) # END GENERATED: lemmas # a set that has capability k contains the set {k} (has is that subset test) def caps.has_of(+v: Bool, +s: C.CapSet(), +x: U32) -> {C.CapSet.has.go(v, s, x) == True{} : Bool} -> {C.CapSet.subset(C.CapSet.of.go(v, x), s) == True{} : Bool}: match v: case False{}: h => bits.absurd(C.CapSet.subset(C.CapSet.of.go(False{}, x), s), h) case True{}: h => h # BEGIN GENERATED by gen/proof.py: laws # execve: the transformation, for every flags record and state def ex.eff(+fl: E.CapExecFlags, +s: C.CapState) -> {C.CapSet.subset(C.CapState.effective(E.CapExec.sets(fl, s)), C.CapState.permitted(E.CapExec.sets(fl, s))) == True{} : Bool}: match fl s: case E.CapExecFlags{True{}, True{}, +fp, +fi} C.CapState{+p, +i, +e, +b, +a}: set.sub_refl(C.CapSet.union(C.CapSet.union(C.CapSet.inter(i, fi), C.CapSet.inter(fp, b)), C.CapSet.empty())) case E.CapExecFlags{True{}, False{}, +fp, +fi} C.CapState{+p, +i, +e, +b, +a}: set.sub_or_r(C.CapSet.union(C.CapSet.inter(i, fi), C.CapSet.inter(fp, b)), C.CapSet.empty()) case E.CapExecFlags{False{}, True{}, +fp, +fi} C.CapState{+p, +i, +e, +b, +a}: set.sub_refl(C.CapSet.union(C.CapSet.union(C.CapSet.inter(i, fi), C.CapSet.inter(fp, b)), a)) case E.CapExecFlags{False{}, False{}, +fp, +fi} C.CapState{+p, +i, +e, +b, +a}: set.sub_or_r(C.CapSet.union(C.CapSet.inter(i, fi), C.CapSet.inter(fp, b)), a) def ex.ap(+fl: E.CapExecFlags, +s: C.CapState) -> {C.CapSet.subset(C.CapState.ambient(E.CapExec.sets(fl, s)), C.CapState.permitted(E.CapExec.sets(fl, s))) == True{} : Bool}: match fl s: case E.CapExecFlags{True{}, feff, +fp, +fi} C.CapState{+p, +i, +e, +b, +a}: set.sub_or_r(C.CapSet.union(C.CapSet.inter(i, fi), C.CapSet.inter(fp, b)), C.CapSet.empty()) case E.CapExecFlags{False{}, feff, +fp, +fi} C.CapState{+p, +i, +e, +b, +a}: set.sub_or_r(C.CapSet.union(C.CapSet.inter(i, fi), C.CapSet.inter(fp, b)), a) def ex.ai(+fl: E.CapExecFlags, +s: C.CapState) -> {C.CapSet.subset(C.CapState.ambient(s), C.CapState.inheritable(s)) == True{} : Bool} -> {C.CapSet.subset(C.CapState.ambient(E.CapExec.sets(fl, s)), C.CapState.inheritable(E.CapExec.sets(fl, s))) == True{} : Bool}: match fl s: case E.CapExecFlags{True{}, feff, +fp, +fi} C.CapState{+p, +i, +e, +b, +a}: h => set.sub_zero(i) case E.CapExecFlags{False{}, feff, +fp, +fi} C.CapState{+p, +i, +e, +b, +a}: h => h def ex.bnd(+fl: E.CapExecFlags, +s: C.CapState) -> {C.CapState.bounding(E.CapExec.sets(fl, s)) == C.CapState.bounding(s) : C.CapSet()}: match fl s: case E.CapExecFlags{priv, feff, fp, fi} C.CapState{+p, +i, +e, +b, +a}: {==} def ex.inh(+fl: E.CapExecFlags, +s: C.CapState) -> {C.CapState.inheritable(E.CapExec.sets(fl, s)) == C.CapState.inheritable(s) : C.CapSet()}: match fl s: case E.CapExecFlags{priv, feff, fp, fi} C.CapState{+p, +i, +e, +b, +a}: {==} def ex.bound(+fl: E.CapExecFlags, +s: C.CapState) -> {C.CapSet.subset(C.CapState.permitted(E.CapExec.sets(fl, s)), C.CapSet.union(C.CapState.bounding(s), C.CapSet.union(C.CapState.inheritable(s), C.CapState.ambient(s)))) == True{} : Bool}: match fl s: case E.CapExecFlags{True{}, feff, +fp, +fi} C.CapState{+p, +i, +e, +b, +a}: set.bound_z(i, fi, fp, b, a) case E.CapExecFlags{False{}, feff, +fp, +fi} C.CapState{+p, +i, +e, +b, +a}: set.bound_a(i, fi, fp, b, a) def ex.bound_v(+fl: E.CapExecFlags, +s: C.CapState) -> {C.CapSet.subset(C.CapState.ambient(s), C.CapState.inheritable(s)) == True{} : Bool} -> {C.CapSet.subset(C.CapState.permitted(E.CapExec.sets(fl, s)), C.CapSet.union(C.CapState.bounding(s), C.CapState.inheritable(s))) == True{} : Bool}: match fl s: case E.CapExecFlags{True{}, feff, +fp, +fi} C.CapState{+p, +i, +e, +b, +a}: h => set.bound_vz(i, fi, fp, b) case E.CapExecFlags{False{}, feff, +fp, +fi} C.CapState{+p, +i, +e, +b, +a}: h => set.bound_va(i, fi, fp, b, a)(h) def ex.root_p(+priv: Bool, +s: C.CapState) -> {C.CapSet.subset(C.CapState.ambient(s), C.CapState.inheritable(s)) == True{} : Bool} -> {C.CapState.permitted(E.CapExec.sets(E.CapExecFlags{priv, True{}, C.CapSet.full(), C.CapSet.full()}, s)) == C.CapSet.union(C.CapState.inheritable(s), C.CapState.bounding(s)) : C.CapSet()}: match priv s: case True{} C.CapState{+p, +i, +e, +b, +a}: h => set.root_z(i, b) case False{} C.CapState{+p, +i, +e, +b, +a}: h => set.root_a(i, b, a)(h) def ex.root_e(+priv: Bool, +s: C.CapState) -> {C.CapSet.subset(C.CapState.ambient(s), C.CapState.inheritable(s)) == True{} : Bool} -> {C.CapState.effective(E.CapExec.sets(E.CapExecFlags{priv, True{}, C.CapSet.full(), C.CapSet.full()}, s)) == C.CapSet.union(C.CapState.inheritable(s), C.CapState.bounding(s)) : C.CapSet()}: match priv s: case True{} C.CapState{+p, +i, +e, +b, +a}: h => set.root_z(i, b) case False{} C.CapState{+p, +i, +e, +b, +a}: h => set.root_a(i, b, a)(h) def ex.nonroot_p(+nr: Bool, +r0: Bool, +e0: Bool, +s: C.CapState) -> {r0 == False{} : Bool} -> {e0 == False{} : Bool} -> {C.CapState.permitted(E.CapExec.sets(E.CapExec.flags.go(nr, r0, e0, False{}, None{}), s)) == C.CapState.ambient(s) : C.CapSet()}: match nr r0 e0 s: case True{} r0 e0 C.CapState{+p, +i, +e, +b, +a}: hr => he => set.nonroot(i, b, a) case False{} True{} e0 C.CapState{+p, +i, +e, +b, +a}: hr => he => bits.absurd_tf(C.CapSet(), C.CapState.permitted(E.CapExec.sets(E.CapExec.flags.go(False{}, True{}, e0, False{}, None{}), C.CapState{p, i, e, b, a})), a, hr) case False{} False{} True{} C.CapState{+p, +i, +e, +b, +a}: hr => he => bits.absurd_tf(C.CapSet(), C.CapState.permitted(E.CapExec.sets(E.CapExec.flags.go(False{}, False{}, True{}, False{}, None{}), C.CapState{p, i, e, b, a})), a, he) case False{} False{} False{} C.CapState{+p, +i, +e, +b, +a}: hr => he => set.nonroot(i, b, a) def ex.nonroot_e(+nr: Bool, +r0: Bool, +e0: Bool, +s: C.CapState) -> {r0 == False{} : Bool} -> {e0 == False{} : Bool} -> {C.CapState.effective(E.CapExec.sets(E.CapExec.flags.go(nr, r0, e0, False{}, None{}), s)) == C.CapState.ambient(s) : C.CapSet()}: match nr r0 e0 s: case True{} r0 e0 C.CapState{+p, +i, +e, +b, +a}: hr => he => {==} case False{} True{} e0 C.CapState{+p, +i, +e, +b, +a}: hr => he => bits.absurd_tf(C.CapSet(), C.CapState.effective(E.CapExec.sets(E.CapExec.flags.go(False{}, True{}, e0, False{}, None{}), C.CapState{p, i, e, b, a})), a, hr) case False{} False{} True{} C.CapState{+p, +i, +e, +b, +a}: hr => he => bits.absurd_tf(C.CapSet(), C.CapState.effective(E.CapExec.sets(E.CapExec.flags.go(False{}, False{}, True{}, False{}, None{}), C.CapState{p, i, e, b, a})), a, he) case False{} False{} False{} C.CapState{+p, +i, +e, +b, +a}: hr => he => {==} def ex.result(+ok: Bool, +c: C.CapCred, +eu: U32, +s: C.CapState) -> {C.Caps.sets_or(E.CapExec.fin(ok, c, eu, s), s) == s : C.CapState}: match ok c: case False{} c: {==} case True{} C.CapCred{r, e, sv, nr, na, st}: {==} # capset: each rule in turn def cs.p.done(+c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapSet.subset(p, C.CapState.permitted(C.CapCred.sets(c))) == True{} : Bool} -> {C.CapSet.subset(C.CapState.permitted(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.done(c, e, p, i), c))), C.CapState.permitted(C.CapCred.sets(c))) == True{} : Bool}: match c: case C.CapCred{r, eu, sv, nr, na, C.CapState{+op, +oi, +oe, +ob, +oa}}: h => h def cs.p.r4(+sp: Bool, +iok: Bool, +c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapSet.subset(p, C.CapState.permitted(C.CapCred.sets(c))) == True{} : Bool} -> {C.CapSet.subset(C.CapState.permitted(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.r4(sp, iok, c, e, p, i), c))), C.CapState.permitted(C.CapCred.sets(c))) == True{} : Bool}: match sp iok: case True{} iok: h => cs.p.done(c, e, p, i)(h) case False{} True{}: h => cs.p.done(c, e, p, i)(h) case False{} False{}: h => set.sub_refl(C.CapState.permitted(C.CapCred.sets(c))) def cs.p.r3(+ok: Bool, +c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapSet.subset(p, C.CapState.permitted(C.CapCred.sets(c))) == True{} : Bool} -> {C.CapSet.subset(C.CapState.permitted(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.r3(ok, c, e, p, i), c))), C.CapState.permitted(C.CapCred.sets(c))) == True{} : Bool}: match ok: case False{}: h => set.sub_refl(C.CapState.permitted(C.CapCred.sets(c))) case True{}: h => cs.p.r4(C.CapSet.has(C.CapState.effective(C.CapCred.sets(c)), C.Cap.setpcap()), C.CapSet.subset(i, C.CapSet.union(C.CapState.inheritable(C.CapCred.sets(c)), C.CapState.permitted(C.CapCred.sets(c)))), c, e, p, i)(h) def cs.p.r2(+ok: Bool, +c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapSet.subset(p, C.CapState.permitted(C.CapCred.sets(c))) == True{} : Bool} -> {C.CapSet.subset(C.CapState.permitted(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.r2(ok, c, e, p, i), c))), C.CapState.permitted(C.CapCred.sets(c))) == True{} : Bool}: match ok: case False{}: h => set.sub_refl(C.CapState.permitted(C.CapCred.sets(c))) case True{}: h => cs.p.r3(C.CapSet.subset(i, C.CapSet.union(C.CapState.inheritable(C.CapCred.sets(c)), C.CapState.bounding(C.CapCred.sets(c)))), c, e, p, i)(h) def cs.p.r1(+ok: Bool, +c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapSet.subset(p, C.CapState.permitted(C.CapCred.sets(c))) == ok : Bool} -> {C.CapSet.subset(C.CapState.permitted(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.r1(ok, c, e, p, i), c))), C.CapState.permitted(C.CapCred.sets(c))) == True{} : Bool}: match ok: case False{}: h => set.sub_refl(C.CapState.permitted(C.CapCred.sets(c))) case True{}: h => cs.p.r2(C.CapSet.subset(e, p), c, e, p, i)(h) def cs.b.done(+c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapState.bounding(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.done(c, e, p, i), c))) == C.CapState.bounding(C.CapCred.sets(c)) : C.CapSet()}: match c: case C.CapCred{r, eu, sv, nr, na, C.CapState{+op, +oi, +oe, +ob, +oa}}: {==} def cs.b.r4(+sp: Bool, +iok: Bool, +c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapState.bounding(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.r4(sp, iok, c, e, p, i), c))) == C.CapState.bounding(C.CapCred.sets(c)) : C.CapSet()}: match sp iok: case True{} iok: cs.b.done(c, e, p, i) case False{} True{}: cs.b.done(c, e, p, i) case False{} False{}: {==} def cs.b.r3(+ok: Bool, +c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapState.bounding(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.r3(ok, c, e, p, i), c))) == C.CapState.bounding(C.CapCred.sets(c)) : C.CapSet()}: match ok: case False{}: {==} case True{}: cs.b.r4(C.CapSet.has(C.CapState.effective(C.CapCred.sets(c)), C.Cap.setpcap()), C.CapSet.subset(i, C.CapSet.union(C.CapState.inheritable(C.CapCred.sets(c)), C.CapState.permitted(C.CapCred.sets(c)))), c, e, p, i) def cs.b.r2(+ok: Bool, +c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapState.bounding(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.r2(ok, c, e, p, i), c))) == C.CapState.bounding(C.CapCred.sets(c)) : C.CapSet()}: match ok: case False{}: {==} case True{}: cs.b.r3(C.CapSet.subset(i, C.CapSet.union(C.CapState.inheritable(C.CapCred.sets(c)), C.CapState.bounding(C.CapCred.sets(c)))), c, e, p, i) def cs.b.r1(+ok: Bool, +c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapState.bounding(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.r1(ok, c, e, p, i), c))) == C.CapState.bounding(C.CapCred.sets(c)) : C.CapSet()}: match ok: case False{}: {==} case True{}: cs.b.r2(C.CapSet.subset(e, p), c, e, p, i) def cs.v.done(+c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapSet.subset(e, p) == True{} : Bool} -> {C.CapState.valid(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.done(c, e, p, i), c))) == True{} : Bool}: match c: case C.CapCred{r, eu, sv, nr, na, C.CapState{+op, +oi, +oe, +ob, +oa}}: h => bool.and3(C.CapSet.subset(e, p), C.CapSet.subset(C.CapSet.inter(C.CapSet.inter(oa, p), i), p), C.CapSet.subset(C.CapSet.inter(C.CapSet.inter(oa, p), i), i))(h)(set.amb_p(oa, p, i))(set.amb_i(oa, p, i)) def cs.v.r4(+sp: Bool, +iok: Bool, +c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapSet.subset(e, p) == True{} : Bool} -> {C.CapState.valid(C.CapCred.sets(c)) == True{} : Bool} -> {C.CapState.valid(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.r4(sp, iok, c, e, p, i), c))) == True{} : Bool}: match sp iok: case True{} iok: h => hv => cs.v.done(c, e, p, i)(h) case False{} True{}: h => hv => cs.v.done(c, e, p, i)(h) case False{} False{}: h => hv => hv def cs.v.r3(+ok: Bool, +c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapSet.subset(e, p) == True{} : Bool} -> {C.CapState.valid(C.CapCred.sets(c)) == True{} : Bool} -> {C.CapState.valid(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.r3(ok, c, e, p, i), c))) == True{} : Bool}: match ok: case False{}: h => hv => hv case True{}: h => hv => cs.v.r4(C.CapSet.has(C.CapState.effective(C.CapCred.sets(c)), C.Cap.setpcap()), C.CapSet.subset(i, C.CapSet.union(C.CapState.inheritable(C.CapCred.sets(c)), C.CapState.permitted(C.CapCred.sets(c)))), c, e, p, i)(h)(hv) def cs.v.r2(+ok: Bool, +c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapSet.subset(e, p) == ok : Bool} -> {C.CapState.valid(C.CapCred.sets(c)) == True{} : Bool} -> {C.CapState.valid(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.r2(ok, c, e, p, i), c))) == True{} : Bool}: match ok: case False{}: h => hv => hv case True{}: h => hv => cs.v.r3(C.CapSet.subset(i, C.CapSet.union(C.CapState.inheritable(C.CapCred.sets(c)), C.CapState.bounding(C.CapCred.sets(c)))), c, e, p, i)(h)(hv) def cs.v.r1(+ok: Bool, +c: C.CapCred, +e: C.CapSet(), +p: C.CapSet(), +i: C.CapSet()) -> {C.CapState.valid(C.CapCred.sets(c)) == True{} : Bool} -> {C.CapState.valid(C.CapCred.sets(C.Caps.or(A.CapAdjust.capset.r1(ok, c, e, p, i), c))) == True{} : Bool}: match ok: case False{}: hv => hv case True{}: hv => cs.v.r2(C.CapSet.subset(e, p), c, e, p, i)({==})(hv) # prctl def bd.sub(+v: Bool, +sp: Bool, +c: C.CapCred, +x: U32) -> {C.CapSet.subset(C.CapState.bounding(C.CapCred.sets(C.Caps.or(A.CapAdjust.bset_drop.go(v, sp, c, x), c))), C.CapState.bounding(C.CapCred.sets(c))) == True{} : Bool}: match v sp c: case False{} sp c: set.sub_refl(C.CapState.bounding(C.CapCred.sets(c))) case True{} False{} c: set.sub_refl(C.CapState.bounding(C.CapCred.sets(c))) case True{} True{} C.CapCred{r, eu, sv, nr, na, C.CapState{+p, +i, +e, +b, +a}}: set.sub_minus(b, C.CapSet.of(x)) def bd.rest(+v: Bool, +sp: Bool, +c: C.CapCred, +x: U32) -> {C.CapState.with_bounding(C.CapCred.sets(C.Caps.or(A.CapAdjust.bset_drop.go(v, sp, c, x), c)), C.CapSet.empty()) == C.CapState.with_bounding(C.CapCred.sets(c), C.CapSet.empty()) : C.CapState}: match v sp c: case False{} sp c: {==} case True{} False{} c: {==} case True{} True{} C.CapCred{r, eu, sv, nr, na, C.CapState{+p, +i, +e, +b, +a}}: {==} def ar.valid(+v: Bool, +lk: Bool, +al: Bool, +c: C.CapCred, +x: U32) -> {A.CapAdjust.ambient.allowed(c, x) == al : Bool} -> {C.CapState.valid(C.CapCred.sets(c)) == True{} : Bool} -> {C.CapState.valid(C.CapCred.sets(C.Caps.or(A.CapAdjust.ambient_raise.go(v, lk, al, c, x), c))) == True{} : Bool}: match v lk al c: case False{} lk al c: h => hv => hv case True{} True{} al c: h => hv => hv case True{} False{} False{} c: h => hv => hv case True{} False{} True{} C.CapCred{r, eu, sv, nr, na, C.CapState{+p, +i, +e, +b, +a}}: +h => +hv => bool.and3(C.CapSet.subset(e, p), C.CapSet.subset(C.CapSet.union(a, C.CapSet.of(x)), p), C.CapSet.subset(C.CapSet.union(a, C.CapSet.of(x)), i))(valid.ep(C.CapState{p, i, e, b, a})(hv))(set.lub(a, C.CapSet.of(x), p)(valid.ap(C.CapState{p, i, e, b, a})(hv))(caps.has_of(C.Cap.valid(x), p, x)(bool.and_l(C.CapSet.has(p, x), C.CapSet.has(i, x))(h))))(set.lub(a, C.CapSet.of(x), i)(valid.ai(C.CapState{p, i, e, b, a})(hv))(caps.has_of(C.Cap.valid(x), i, x)(bool.and_r(C.CapSet.has(p, x), C.CapSet.has(i, x))(h)))) def al.valid(+v: Bool, +c: C.CapCred, +x: U32) -> {C.CapState.valid(C.CapCred.sets(c)) == True{} : Bool} -> {C.CapState.valid(C.CapCred.sets(C.Caps.or(A.CapAdjust.ambient_lower.go(v, c, x), c))) == True{} : Bool}: match v c: case False{} c: hv => hv case True{} C.CapCred{r, eu, sv, nr, na, C.CapState{+p, +i, +e, +b, +a}}: +hv => bool.and3(C.CapSet.subset(e, p), C.CapSet.subset(C.CapSet.minus(a, C.CapSet.of(x)), p), C.CapSet.subset(C.CapSet.minus(a, C.CapSet.of(x)), i))(valid.ep(C.CapState{p, i, e, b, a})(hv))(set.minus_within(a, C.CapSet.of(x), p)(valid.ap(C.CapState{p, i, e, b, a})(hv)))(set.minus_within(a, C.CapSet.of(x), i)(valid.ai(C.CapState{p, i, e, b, a})(hv))) def ar.rest(+v: Bool, +lk: Bool, +al: Bool, +c: C.CapCred, +x: U32) -> {C.CapState.with_ambient(C.CapCred.sets(C.Caps.or(A.CapAdjust.ambient_raise.go(v, lk, al, c, x), c)), C.CapSet.empty()) == C.CapState.with_ambient(C.CapCred.sets(c), C.CapSet.empty()) : C.CapState}: match v lk al c: case False{} lk al c: {==} case True{} True{} al c: {==} case True{} False{} False{} c: {==} case True{} False{} True{} C.CapCred{r, eu, sv, nr, na, C.CapState{+p, +i, +e, +b, +a}}: {==} def al.rest(+v: Bool, +c: C.CapCred, +x: U32) -> {C.CapState.with_ambient(C.CapCred.sets(C.Caps.or(A.CapAdjust.ambient_lower.go(v, c, x), c)), C.CapSet.empty()) == C.CapState.with_ambient(C.CapCred.sets(c), C.CapSet.empty()) : C.CapState}: match v c: case False{} c: {==} case True{} C.CapCred{r, eu, sv, nr, na, C.CapState{+p, +i, +e, +b, +a}}: {==} # The laws def Laws.execve_result(k, c, f, ign): ex.result(E.CapExec.dumb_ok(E.CapExec.file_caps(k, f, ign), C.CapState.permitted(E.Caps.execve.sets(k, c, f, ign))), c, E.CapExec.new_euid(c, f, ign), E.Caps.execve.sets(k, c, f, ign)) def Laws.execve_effective_within_permitted(k, c, f, ign): ex.eff(E.CapExec.flags(k, c, f, ign), C.CapCred.sets(c)) def Laws.execve_ambient_within_permitted(k, c, f, ign): ex.ap(E.CapExec.flags(k, c, f, ign), C.CapCred.sets(c)) def Laws.execve_bounding_unchanged(k, c, f, ign): ex.bnd(E.CapExec.flags(k, c, f, ign), C.CapCred.sets(c)) def Laws.execve_inheritable_unchanged(k, c, f, ign): ex.inh(E.CapExec.flags(k, c, f, ign), C.CapCred.sets(c)) def Laws.execve_permitted_bounded(k, c, f, ign): ex.bound(E.CapExec.flags(k, c, f, ign), C.CapCred.sets(c)) def Laws.execve_ambient_within_inheritable(k, c, f, ign, h): ex.ai(E.CapExec.flags(k, c, f, ign), C.CapCred.sets(c))(h) def Laws.execve_permitted_bounded_valid(k, c, f, ign, h): ex.bound_v(E.CapExec.flags(k, c, f, ign), C.CapCred.sets(c))(h) def Laws.execve_valid(k, c, f, ign, h): valid.intro(E.Caps.execve.sets(k, c, f, ign))(ex.eff(E.CapExec.flags(k, c, f, ign), C.CapCred.sets(c)))(ex.ap(E.CapExec.flags(k, c, f, ign), C.CapCred.sets(c)))(ex.ai(E.CapExec.flags(k, c, f, ign), C.CapCred.sets(c))(valid.ai(C.CapCred.sets(c))(h))) def Laws.execve_root_permitted(k, s, sv, na, u, sg, fc, ign, h): match ign: case True{}: ex.root_p(E.CapExec.privileged(True{}, False{}, sg, E.CapExec.file_caps(k, C.CapFile{u, False{}, sg, fc}, True{})), s)(h) case False{}: ex.root_p(E.CapExec.privileged(False{}, False{}, sg, E.CapExec.file_caps(k, C.CapFile{u, False{}, sg, fc}, False{})), s)(h) def Laws.execve_root_effective(k, s, sv, na, u, sg, fc, ign, h): match ign: case True{}: ex.root_e(E.CapExec.privileged(True{}, False{}, sg, E.CapExec.file_caps(k, C.CapFile{u, False{}, sg, fc}, True{})), s)(h) case False{}: ex.root_e(E.CapExec.privileged(False{}, False{}, sg, E.CapExec.file_caps(k, C.CapFile{u, False{}, sg, fc}, False{})), s)(h) def Laws.execve_nonroot_permitted(k, r, e, hr, he, s, sv, nr, na, u, ign): match k ign: case C.CapsKernel{l, True{}} True{}: ex.nonroot_p(nr, U32.is_eq(r, 0), U32.is_eq(e, 0), s)(hr)(he) case C.CapsKernel{l, True{}} False{}: ex.nonroot_p(nr, U32.is_eq(r, 0), U32.is_eq(e, 0), s)(hr)(he) case C.CapsKernel{l, False{}} True{}: ex.nonroot_p(nr, U32.is_eq(r, 0), U32.is_eq(e, 0), s)(hr)(he) case C.CapsKernel{l, False{}} False{}: ex.nonroot_p(nr, U32.is_eq(r, 0), U32.is_eq(e, 0), s)(hr)(he) def Laws.execve_nonroot_effective(k, r, e, hr, he, s, sv, nr, na, u, ign): match k ign: case C.CapsKernel{l, True{}} True{}: ex.nonroot_e(nr, U32.is_eq(r, 0), U32.is_eq(e, 0), s)(hr)(he) case C.CapsKernel{l, True{}} False{}: ex.nonroot_e(nr, U32.is_eq(r, 0), U32.is_eq(e, 0), s)(hr)(he) case C.CapsKernel{l, False{}} True{}: ex.nonroot_e(nr, U32.is_eq(r, 0), U32.is_eq(e, 0), s)(hr)(he) case C.CapsKernel{l, False{}} False{}: ex.nonroot_e(nr, U32.is_eq(r, 0), U32.is_eq(e, 0), s)(hr)(he) def Laws.capset_permitted_never_grows(c, e, p, i): cs.p.r1(C.CapSet.subset(p, C.CapState.permitted(C.CapCred.sets(c))), c, e, p, i)({==}) def Laws.capset_bounding_unchanged(c, e, p, i): cs.b.r1(C.CapSet.subset(p, C.CapState.permitted(C.CapCred.sets(c))), c, e, p, i) def Laws.capset_valid(c, e, p, i, h): cs.v.r1(C.CapSet.subset(p, C.CapState.permitted(C.CapCred.sets(c))), c, e, p, i)(h) def Laws.bset_drop_never_grows(k, c, x): bd.sub(C.CapsKernel.valid(k, x), C.CapSet.has(C.CapState.effective(C.CapCred.sets(c)), C.Cap.setpcap()), c, x) def Laws.bset_drop_rest_unchanged(k, c, x): bd.rest(C.CapsKernel.valid(k, x), C.CapSet.has(C.CapState.effective(C.CapCred.sets(c)), C.Cap.setpcap()), c, x) def Laws.ambient_raise_valid(k, c, x, h): ar.valid(C.CapsKernel.valid(k, x), C.CapCred.no_ambient_raise(c), A.CapAdjust.ambient.allowed(c, x), c, x)({==})(h) def Laws.ambient_raise_rest_unchanged(k, c, x): ar.rest(C.CapsKernel.valid(k, x), C.CapCred.no_ambient_raise(c), A.CapAdjust.ambient.allowed(c, x), c, x) def Laws.ambient_lower_valid(k, c, x, h): al.valid(C.CapsKernel.valid(k, x), c, x)(h) def Laws.ambient_lower_rest_unchanged(k, c, x): al.rest(C.CapsKernel.valid(k, x), c, x) def Laws.ambient_clear_all_empty(c): match c: case C.CapCred{r, eu, sv, nr, na, C.CapState{+p, +i, +e, +b, +a}}: {==} def Laws.name_first(): {==} def Laws.name_last(): {==} def Laws.name_beyond(): {==} def Laws.of_name_sys_admin(): {==} def Laws.show_full(): {==} def Laws.show_two(): {==} def Laws.vector_dumb_binary(): {==} def Laws.vector_suid_root_with_caps(): {==} def Laws.vector_suid_root_plain(): {==} def Laws.vector_suid_ignored(): {==} def Laws.vector_capset_grows(): {==} def Laws.vector_ambient_not_inheritable(): {==} def Laws.vector_drop_invalid(): {==} def Laws.witness_valid(): {==} def Laws.witness_ambient_inheritable(): {==} def Laws.witness_ambient_inheritable_state(): {==} def Laws.witness_nonzero_uid(): {==} # END GENERATED: laws