Parse an option.
(parse-option input) → (mv error? tree? rest-input)
The linear rules below are used in the guard verification proof.
Function:
(defun parse-option (input) (declare (xargs :guard (nat-listp input))) (seq input (tree-open-square := (parse-ichar #\[ input)) (trees-open-pad := (parse-*cwsp input)) (tree-alt := (parse-alternation input)) (trees-close-pad := (parse-*cwsp input)) (tree-close-square := (parse-ichar #\] input)) (return (make-tree-nonleaf :rulename? *option* :branches (list (list tree-open-square) trees-open-pad (list tree-alt) trees-close-pad (list tree-close-square))))))
Theorem:
(defthm len-of-parse-option-linear-1 (<= (len (mv-nth 2 (parse-option input))) (len input)) :rule-classes :linear)
Theorem:
(defthm len-of-parse-option-linear-2 (implies (not (mv-nth 0 (parse-option input))) (< (len (mv-nth 2 (parse-option input))) (len input))) :rule-classes :linear)