Function:
(defun deftrans-filepath (path name) (declare (xargs :guard (and (filepathp path) (stringp name)))) (let ((__function__ 'deftrans-filepath)) (declare (ignorable __function__)) (b* ((string (filepath->unwrap path)) ((unless (stringp string)) (raise "Misusage error: file path ~x0 is not a string." string) (filepath "irrelevant")) (chars (acl2::explode string)) (dot-pos-in-rev (index-of #\. (rev chars))) (name-chars (acl2::explode name)) ((when (not dot-pos-in-rev)) (filepath (acl2::implode (append chars (cons #\. name-chars))))) (last-dot-pos (- (len chars) dot-pos-in-rev)) (new-chars (append (take last-dot-pos chars) name-chars (list #\.) (nthcdr last-dot-pos chars))) (new-string (acl2::implode new-chars))) (filepath new-string))))
Theorem:
(defthm filepathp-of-deftrans-filepath (b* ((new-path (deftrans-filepath path name))) (filepathp new-path)) :rule-classes :rewrite)
Theorem:
(defthm deftrans-filepath-of-filepath-fix-path (equal (deftrans-filepath (c$::filepath-fix path) name) (deftrans-filepath path name)))
Theorem:
(defthm deftrans-filepath-filepath-equiv-congruence-on-path (implies (c$::filepath-equiv path path-equiv) (equal (deftrans-filepath path name) (deftrans-filepath path-equiv name))) :rule-classes :congruence)
Theorem:
(defthm deftrans-filepath-of-str-fix-name (equal (deftrans-filepath path (acl2::str-fix name)) (deftrans-filepath path name)))
Theorem:
(defthm deftrans-filepath-streqv-congruence-on-name (implies (acl2::streqv name name-equiv) (equal (deftrans-filepath path name) (deftrans-filepath path name-equiv))) :rule-classes :congruence)