Codebase list cafeobj / 7a03ee2
- allow :init without substitution tswd 4 years ago
4 changed file(s) with 37 addition(s) and 26 deletion(s). Raw diff Collapse all Expand all
328328 |}|))
329329
330330 (defparameter INIT
331 '((:+ |:init| init |:init!| init!)
331 '(|:init|
332332 (:if-present as :symbol)
333 (:one-of (\( (:one-of #.EqDeclaration
334 #.CeqDeclaration
335 #.RlDeclaration
336 #.CRlDeclaration
337 #.BeqDeclaration
338 #.BCeqDeclaration
339 #.BRLDeclaration
340 #.BCRLDeclaration
341 #.FoplAXDeclaration)
342 \))
343 (\[ (:symbol) \]))
344 |by| |{| ((:! SubstList)) |}|))
333 (:one-of ((:+ |{| \() (:one-of #.EqDeclaration
334 #.CeqDeclaration
335 #.RlDeclaration
336 #.CRlDeclaration
337 #.BeqDeclaration
338 #.BCeqDeclaration
339 #.BRLDeclaration
340 #.BCRLDeclaration
341 #.FoplAXDeclaration)
342 (:+ |}| \)))
343 (\[ :symbol \]))
344 (:if-present by |{| ((:! SubstList)) |}|)))
345
345346 (defparameter USE
346347 '(|:use|
347348 (:one-of (\( (:seq-of :symbol) \))
350351 (|id:| :chaos-item)
351352 (|identity:| :chaos-item))
352353 |}|))))
354
353355 (defparameter EMBED
354356 '(|:embed|
355357 (:one-of (\( (:seq-of :symbol) \) (:+ as into) :symbol)
901903 ;; Substitution
902904 ;; variable-1 <- term-1; ... variable-n <- term-n;
903905 (SubstList ((:! Subst) :append (:seq-of (:! Subst))))
904 (Subst ((:symbol <- :term) \;))
906 (Subst ((:symbol <- :term) (:+ |,| \;)))
905907 )) ; end of *cafeobj-scheme*
906908 ) ; end eval-when
907909
21862186 ;;; resolve-subst-form
21872187 ;;;
21882188 (defun resolve-subst-form (context subst-forms &optional (normalize nil))
2189 (unless subst-forms (return-from resolve-subst-form nil))
21892190 (with-in-module (context)
21902191 (let ((subst nil)
21912192 (*parse-variables* nil))
159159 ;;;
160160 ;;; :init {[<label>] | (<axiom>)} by { <var> <- <term>; ...<var> <- <term>; }
161161 ;;;
162 ;;; first second third four fifth
162163 ;;; (":init" ("[" ("test1") "]") "by" "{" (("X:S" "<-" ("X#S")) ";") "}"))
164 ;;; first second third fourth
165 ;;; (":init" ("as" "ts-ss-1") (#1="{" ("eq" ("ts.." "(" "SS:SeqSym" ")") "=" ("true") ".") #3="}") ("by" #1# (("SS:SeqSym" "<-" ("ss")) #2=";" ("XX:Bar" "<-" ("bb")) #2#) #3#)))
166 ;;; (":init" ("as" "ts-ss-1") (#1="(" ("eq" ("ts.." #1# "SS:SeqSym" #2=")") "=" ("true") ".") #2#) "by" ("{" ("SS:SeqSym" "<-" ("ss")) ";" "}"))
163167 ;;;
164168 (defun make-axiom-pattern (target)
165 (if (equal (first target) "[")
166 (cons :label (second target))
167 (cons :axiom (second target))))
169 (if (stringp target)
170 (cons :label (list target))
171 (cons :axiom target)))
168172
169173 (defun citp-parse-init (args)
170174 (let ((name (if (equal (first (second args)) "as")
171175 (second (second args))
172176 nil)))
173177 (let ((target-form (make-axiom-pattern (if name
174 (third args)
175 (second args))))
178 (second (third args))
179 (second (second args)))))
176180 (subst-list (if name
177 (sixth args)
178 (fifth args)))
181 (third (fourth args))
182 (third (third args))))
179183 (subst-pairs nil))
180184 (dolist (subst-form subst-list)
181185 (unless (atom subst-form)
297301 ;;; (":def" "tactic-1" "=" ("(" ("si" "rd" "tc") ")"))
298302 ;;; ==> (:seq "tactic-1" ("si" "rd" "tc"))
299303 ;;; (":define" "*disr" "=" (":init" ("[" ("*disr") "]") "by" "{" (("X:PNat.PNAT" "<-" ("X#PNat")) #1=";" ("Y:PNat.PNAT" "<-" ("Y@PNat")) #1# ("Z:PNat.PNAT" "<-" ("Z@PNat")) #1#) "}"))
304 ;;; (":define" "ts-ss2" "="(":init" ("as" "ts-ss-1") (#1="(" ("eq" ("ts.." #1# "SS:SeqSym" #2=")") "=" ("true") ".") #2#) "by" ("{" ("SS:SeqSym" "<-" ("ss")) ";" "}")))
300305 ;;; ==> (:init "*disr" nil (":init" ("[" ("*disr") "]") "by" "{" (("X:PNat.PNAT" "<-" #) #1=";" ("Y:PNat.PNAT" "<-" #) #1# ("Z:PNat.PNAT" "<-" #) #1#) "}"))
301306
302307 (defun citp-parse-define (args)
211211 (if (eq (first (tactic-init-kind obj)) :label)
212212 (format stream "[~a]" (second (tactic-init-kind obj)))
213213 (progn
214 (princ "(")
214 (princ "{")
215215 (print-axiom-brief (tactic-init-axiom obj))
216 (princ " .)")))
217 (print-next)
218 (princ "by subst form: ")
219 (princ (tactic-init-subst obj)))))
216 (princ " .}")))
217 (if (tactic-init-subst obj)
218 (progn
219 (print-next)
220 (princ "by subst form: ")
221 (princ (tactic-init-subst obj)))
222 (princ ".")))))
220223
221224 ;;; :ind as tactic
222225 ;;;