(parse-demo-long getopt::longname getopt::explicit-val args getopt::acc getopt::seen) → (mv getopt::errmsg getopt::acc rest)
Function:
(defun parse-demo-long (getopt::longname getopt::explicit-val args getopt::acc getopt::seen) (declare (xargs :guard (and (stringp getopt::longname) (or (not getopt::explicit-val) (stringp getopt::explicit-val)) (string-listp args) (demo-p getopt::acc) (string-listp getopt::seen)))) (let ((acl2::__function__ 'parse-demo-long)) (declare (ignorable acl2::__function__)) (cond ((equal getopt::longname "help") (b* (((when (member-equal getopt::longname getopt::seen)) (mv (msg "Option --~s0 given multiple times" getopt::longname) getopt::acc args)) ((mv getopt::err value rest) (getopt::parse-plain (str::cat "--" getopt::longname) getopt::explicit-val args)) ((when getopt::err) (mv getopt::err getopt::acc args)) (getopt::acc (change-demo getopt::acc :help value))) (mv nil getopt::acc rest))) ((equal getopt::longname "verbose") (b* (((when (member-equal getopt::longname getopt::seen)) (mv (msg "Option --~s0 given multiple times" getopt::longname) getopt::acc args)) ((mv getopt::err value rest) (getopt::parse-plain (str::cat "--" getopt::longname) getopt::explicit-val args)) ((when getopt::err) (mv getopt::err getopt::acc args)) (getopt::acc (change-demo getopt::acc :verbose value))) (mv nil getopt::acc rest))) ((equal getopt::longname "version") (b* (((when (member-equal getopt::longname getopt::seen)) (mv (msg "Option --~s0 given multiple times" getopt::longname) getopt::acc args)) ((mv getopt::err value rest) (getopt::parse-plain (str::cat "--" getopt::longname) getopt::explicit-val args)) ((when getopt::err) (mv getopt::err getopt::acc args)) (getopt::acc (change-demo getopt::acc :version value))) (mv nil getopt::acc rest))) ((equal getopt::longname "username") (b* (((when (member-equal getopt::longname getopt::seen)) (mv (msg "Option --~s0 given multiple times" getopt::longname) getopt::acc args)) ((mv getopt::err value rest) (getopt::parse-string (str::cat "--" getopt::longname) getopt::explicit-val args)) ((when getopt::err) (mv getopt::err getopt::acc args)) (getopt::acc (change-demo getopt::acc :username value))) (mv nil getopt::acc rest))) ((equal getopt::longname "port") (b* (((when (member-equal getopt::longname getopt::seen)) (mv (msg "Option --~s0 given multiple times" getopt::longname) getopt::acc args)) ((mv getopt::err value rest) (getopt::parse-nat (str::cat "--" getopt::longname) getopt::explicit-val args)) ((when getopt::err) (mv getopt::err getopt::acc args)) (getopt::acc (change-demo getopt::acc :port value))) (mv nil getopt::acc rest))) ((equal getopt::longname "dir") (b* (((mv getopt::err value rest) (getopt::parse-string (str::cat "--" getopt::longname) getopt::explicit-val args)) ((when getopt::err) (mv getopt::err getopt::acc args)) (getopt::old-value (demo->dirs getopt::acc)) (value (rcons value getopt::old-value)) (getopt::acc (change-demo getopt::acc :dirs value))) (mv nil getopt::acc rest))) (t (mv (msg "Unrecognized option --~s0" getopt::longname) getopt::acc args)))))
Theorem:
(defthm demo-p-of-parse-demo-long.acc (implies (force (demo-p getopt::acc)) (b* (((mv getopt::?errmsg getopt::?acc common-lisp::?rest) (parse-demo-long getopt::longname getopt::explicit-val args getopt::acc getopt::seen))) (demo-p getopt::acc))) :rule-classes :rewrite)
Theorem:
(defthm string-listp-of-parse-demo-long.rest (implies (force (string-listp args)) (b* (((mv getopt::?errmsg getopt::?acc common-lisp::?rest) (parse-demo-long getopt::longname getopt::explicit-val args getopt::acc getopt::seen))) (string-listp rest))) :rule-classes :rewrite)
Theorem:
(defthm parse-demo-long-makes-progress (<= (len (mv-nth 2 (parse-demo-long getopt::longname getopt::explicit-val args getopt::acc getopt::seen))) (len args)) :rule-classes ((:rewrite) (:linear)))