(exload "mpc/nat0.scm")

(add-program-constant
 "natPlus" (py "nat=>nat=>nat") 1 'const 2)

(add-token
 "+"
 'add-op
 (lambda (x y)
   (mk-term-in-app-form
    (make-term-in-const-form (pconst-name-to-pconst "natPlus")) x y)))

(add-display
 (py "nat")
 (lambda (x)
   (let* ((op (term-in-app-form-to-final-op x))
	  (args (term-in-app-form-to-args x)))
     (if (and (term-in-const-form? op)
	      (string=? "natPlus"
			(const-to-name (term-in-const-form-to-const op)))
	      (= 2 (length args)))
	 (list 'add-op "+"
	       (term-to-token-tree (car args))
	       (term-to-token-tree (cadr args)))
	 #f))))

(add-computation-rule (pt "n+0") (pt "n"))
(add-computation-rule (pt "n+Succ m") (pt "Succ(n+m)"))

(set-goal (pf "all n 0+n=n"))
(ind)
(ng)
(use "Truth-Axiom")
(assume "n" "IH")
(ng)
(use "IH")

(cdp)

; ..0+0=0 -> (all n13.0+n13=n13 -> 0+Succ n13=Succ n13) -> all n12 0+n12=n12 by axiom Ind
; ..T by axiom Truth-Axiom
; .(all n13.0+n13=n13 -> 0+Succ n13=Succ n13) -> all n12 0+n12=n12 by imp elim
; ...0+n=n by assumption IH15
; ..0+n=n -> 0+n=n by imp intro IH15
; .all n.0+n=n -> 0+n=n by all intro
; all n12 0+n12=n12 by imp elim
