In languages like C, this might be written as
Function:
(defun logmask$inline (size) (declare (xargs :guard (natp size))) (let ((__function__ 'logmask)) (declare (ignorable __function__)) (mbe :logic (- (expt2 size) 1) :exec (the unsigned-byte (1- (the unsigned-byte (ash 1 size)))))))
Theorem:
(defthm logmask-type (b* ((nat (logmask$inline size))) (natp nat)) :rule-classes :type-prescription)