~ubuntu-branches/ubuntu/wily/acl2/wily

« back to all changes in this revision

Viewing changes to books/coi/defung/phony-induction.lisp

  • Committer: Package Import Robot
  • Author(s): Camm Maguire
  • Date: 2015-01-16 10:35:45 UTC
  • mfrom: (3.3.26 sid)
  • Revision ID: package-import@ubuntu.com-20150116103545-prehe9thgo79o8w8
Tags: 7.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#|-*-Lisp-*-=================================================================|#
2
 
#|                                                                           |#
3
 
#| coi: Computational Object Inference                                       |#
4
 
#|                                                                           |#
5
 
#|===========================================================================|#
 
1
; Computational Object Inference
 
2
; Copyright (C) 2005-2014 Kookamara LLC
 
3
;
 
4
; Contact:
 
5
;
 
6
;   Kookamara LLC
 
7
;   11410 Windermere Meadows
 
8
;   Austin, TX 78759, USA
 
9
;   http://www.kookamara.com/
 
10
;
 
11
; License: (An MIT/X11-style license)
 
12
;
 
13
;   Permission is hereby granted, free of charge, to any person obtaining a
 
14
;   copy of this software and associated documentation files (the "Software"),
 
15
;   to deal in the Software without restriction, including without limitation
 
16
;   the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
17
;   and/or sell copies of the Software, and to permit persons to whom the
 
18
;   Software is furnished to do so, subject to the following conditions:
 
19
;
 
20
;   The above copyright notice and this permission notice shall be included in
 
21
;   all copies or substantial portions of the Software.
 
22
;
 
23
;   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
24
;   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
25
;   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
26
;   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
27
;   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
28
;   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
29
;   DEALINGS IN THE SOFTWARE.
 
30
 
6
31
(in-package "DEFUNG")
7
32
 
8
33
(include-book "coi/generalize/generalize" :dir :system)
18
43
 
19
44
    `(encapsulate
20
45
         ()
21
 
       
22
 
       (defun ,phony-test (,@args) 
 
46
 
 
47
       (defun ,phony-test (,@args)
23
48
         (declare (ignore ,@args)) nil)
24
 
       
 
49
 
25
50
       (local (in-theory (disable (:type-prescription ,phony-test))))
26
 
       
 
51
 
27
52
       (defun ,phony-induction (,@args)
28
53
         (declare (xargs :measure 0))
29
54
         (if (,phony-test ,@args) (,phony-induction ,@args) nil))
30
 
       
 
55
 
31
56
       (defthm ,phony-induction-rule t
32
57
         :rule-classes ((:induction :pattern (,fn ,@args)
33
58
                                    :scheme (,phony-induction ,@args))))
34
 
       
 
59
 
35
60
       )))
36
61
 
37
62
 
42
67
   (defun goo (x)
43
68
     (if (zp x) 0
44
69
       (goo (1- x))))
45
 
   
 
70
 
46
71
   (in-theory (disable (:type-prescription goo)))
47
 
   
48
 
   (defun hoo (x) 
 
72
 
 
73
   (defun hoo (x)
49
74
     (declare (ignore x)) 0)
50
 
   
 
75
 
51
76
   (defthm hoo-is-goo
52
77
     (equal (hoo x) (goo (gensym::generalize x)))
53
78
     :otf-flg t
54
79
     :hints (("Goal" :expand (:free (x) (gensym::generalize x)))))
55
 
   
 
80
 
56
81
   (in-theory (disable (:type-prescription hoo) hoo))
57
 
   
 
82
 
58
83
   (def::phony-induction hoo (x))
59
 
   
 
84
 
60
85
   (defstub arg () nil)
61
86
 
62
87
   (acl2::add-generalization-pattern (arg))
65
90
     (integerp (hoo (arg)))
66
91
     :hints (("Goal" :induct (hoo (arg)))))
67
92
 
68
 
   ))
69
 
 
70
 
   
 
93
   ))
 
 
b'\\ No newline at end of file'