A Formal Foundation for XrML