def AaQ.allowed
import bend-osdev-apparmor@0.1.0.0/parse.bend as Parseimport Base
964# the qualifier k may come at stage s (0 start, 1 after audit, 2 after allow
965# or deny, 3 after owner), and the stage after it
966def AaQ.allowed(k: Nat, s: Nat) -> Bool:
967 match k:
968 case 0n:
969 False{}
970 case 1n+k1:
971 match k1:
972 case 0n:
973 Nat.is_eq(s, 0n)
974 case 1n+k2:
975 match k2:
976 case 0n:
977 Nat.is_le(s, 1n)
978 case 1n+k3:
979 match k3:
980 case 0n:
981 Nat.is_le(s, 1n)
982 case 1n+k4:
983 Nat.is_le(s, 2n)