CafeOBJ> in pnat-ps.cafe processing input : /Users/kokichi/Documents/d-f090205/lectureF0902/160916+23-NII-Tokyo/homePage/lecture1/pnat-ps.cafe --> **************************************************************** --> proof scores for associativity and commutativity of --> _+_ and _*_ over Nat.PNAT --> **************************************************************** --> ---------------------------------------------------------------- --> PNAT: Peano NATural numbers --> ---------------------------------------------------------------- -- defining module! PNAT -- reading in file : bool processing input : /Users/kokichi/Documents/cafeobjSystemsF0908/cafeobj155-151228/cafeobj-1.5.5-sbcl-x64Darwin/share/cafeobj-1.5/lib/bool.cafe processing input : /Users/kokichi/Documents/cafeobjSystemsF0908/cafeobj155-151228/cafeobj-1.5.5-sbcl-x64Darwin/share/cafeobj-1.5/lib/base_bool.cafe processing input : /Users/kokichi/Documents/cafeobjSystemsF0908/cafeobj155-151228/cafeobj-1.5.5-sbcl-x64Darwin/share/cafeobj-1.5/lib/truth.cafe -- defining module! TRUTH -- reading in file : truth -- done reading in file: truth .............._...........* done. -- defining module! BASE-BOOL.. -- reading in file : eql processing input : /Users/kokichi/Documents/cafeobjSystemsF0908/cafeobj155-151228/cafeobj-1.5.5-sbcl-x64Darwin/share/cafeobj-1.5/lib/eql.cafe -- defining module! EQL.._...* done. -- done reading in file: eql ........._* done. processing input : /Users/kokichi/Documents/cafeobjSystemsF0908/cafeobj155-151228/cafeobj-1.5.5-sbcl-x64Darwin/share/cafeobj-1.5/lib/sys_bool.cafe -- defining module! BOOL....._......................* done. -- done reading in file: bool ..._* done. --> ---------------------------------------------------------------- --> PNAT with addition _+_ --> ---------------------------------------------------------------- -- defining module! PNAT+.._..* done. --> **************************************************************** --> set trace whole on --> ---------------------------------------------------------------- --> ================================================================ --> proof score for proving right 0 of _+_: --> eq X:Nat + 0 = X . --> with the induction on X:Nat --> ---------------------------------------------------------------- --> induction base -- reduce in PNAT+ : ((0 + 0) = 0):Bool [1]: ((0 + 0) = 0):Bool ---> (0 = 0):Bool [2]: (0 = 0):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0010 sec for 2 rewrites + 2 matches) -- opening module PNAT+.. done. --> induction hypothesis_ -- reduce in %PNAT+ : (((s n) + 0) = (s n)):Bool [1]: (((s n) + 0) = (s n)):Bool ---> ((s (n + 0)) = (s n)):Bool [2]: ((s (n + 0)) = (s n)):Bool ---> ((s n) = (s n)):Bool [3]: ((s n) = (s n)):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0000 sec for 3 rewrites + 5 matches) --> QED --> ================================================================ --> ================================================================ --> proof score for proving right s_ of _+_: --> eq X:Nat + s Y:Nat = s (X + Y) . --> with the induction on X:Nat --> ---------------------------------------------------------------- --> induction base -- opening module PNAT+.. done. _-- reduce in %PNAT+ : ((0 + (s y)) = (s (0 + y))):Bool [1]: ((0 + (s y)) = (s (0 + y))):Bool ---> ((s y) = (s (0 + y))):Bool [2]: ((s y) = (s (0 + y))):Bool ---> ((s y) = (s y)):Bool [3]: ((s y) = (s y)):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0000 sec for 3 rewrites + 3 matches) --> induction step -- opening module PNAT+.. done. __-- reduce in %PNAT+ : (((s n) + (s y)) = (s ((s n) + y))):Bool [1]: (((s n) + (s y)) = (s ((s n) + y))):Bool ---> ((s (n + (s y))) = (s ((s n) + y))):Bool [2]: ((s (n + (s y))) = (s ((s n) + y))):Bool ---> ((s (s (n + y))) = (s ((s n) + y))):Bool [3]: ((s (s (n + y))) = (s ((s n) + y))):Bool ---> ((s (s (n + y))) = (s (s (n + y)))):Bool [4]: ((s (s (n + y))) = (s (s (n + y)))):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0000 sec for 4 rewrites + 14 matches) --> QED --> ================================================================ --> **************************************************************** --> set trace on --> ---------------------------------------------------------------- --> ================================================================ --> proof score for proving commutativity of _+_: --> eq (X:Nat + Y:Nat) = (Y + X) . --> with the induction on X:Nat --> ---------------------------------------------------------------- --> induction base -- opening module PNAT+.. done. _-- reduce in %PNAT+ : ((0 + y) = (y + 0)):Bool 1>[1] rule: eq (0 + Y:Nat) = Y { Y:Nat |-> y } 1<[1] (0 + y):Nat --> (y):Nat [1]: ((0 + y) = (y + 0)):Bool ---> (y = (y + 0)):Bool 1>[2] rule: eq (X:Nat + 0) = X { X:Nat |-> y } 1<[2] (y + 0):Nat --> (y):Nat [2]: (y = (y + 0)):Bool ---> (y = y):Bool 1>[3] rule: eq (CUX = CUX) = true { CUX |-> y } 1<[3] (y = y):Bool --> (true):Bool [3]: (y = y):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0010 sec for 3 rewrites + 4 matches) --> induction step -- opening module PNAT+.. done. __-- reduce in %PNAT+ : (((s n) + y) = (y + (s n))):Bool 1>[1] rule: eq ((s X:Nat) + Y:Nat) = (s (X + Y)) { X:Nat |-> n, Y:Nat |-> y } 1<[1] ((s n) + y):Nat --> (s (n + y)):Nat [1]: (((s n) + y) = (y + (s n))):Bool ---> ((s (n + y)) = (y + (s n))):Bool 1>[2] rule: eq (n + Y:Nat) = (Y + n) { Y:Nat |-> y } 1<[2] (n + y):Nat --> (y + n):Nat [2]: ((s (n + y)) = (y + (s n))):Bool ---> ((s (y + n)) = (y + (s n))):Bool 1>[3] rule: eq (X:Nat + (s Y:Nat)) = (s (X + Y)) { X:Nat |-> y, Y:Nat |-> n } 1<[3] (y + (s n)):Nat --> (s (y + n)):Nat [3]: ((s (y + n)) = (y + (s n))):Bool ---> ((s (y + n)) = (s (y + n))):Bool 1>[4] rule: eq (CUX = CUX) = true { CUX |-> (s (y + n)) } 1<[4] ((s (y + n)) = (s (y + n))):Bool --> (true):Bool [4]: ((s (y + n)) = (s (y + n))):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0000 sec for 4 rewrites + 16 matches) --> QED --> ================================================================ --> ---------------------------------------------------------------- --> set trace off --> **************************************************************** --> ================================================================ --> proof score for proving associativity of _+_: --> eq (X:Nat + Y:Nat) + Z:Nat = X + (Y + Z) . --> with the induction on X:Nat --> ---------------------------------------------------------------- --> induction base -- opening module PNAT+.. done. _-- reduce in %PNAT+ : (((0 + y) + z) = (0 + (y + z))):Bool [1]: (((0 + y) + z) = (0 + (y + z))):Bool ---> ((y + z) = (0 + (y + z))):Bool [2]: ((y + z) = (0 + (y + z))):Bool ---> ((y + z) = (y + z)):Bool [3]: ((y + z) = (y + z)):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0000 sec for 3 rewrites + 11 matches) --> induction step -- opening module PNAT+.. done. __-- reduce in %PNAT+ : ((((s n) + y) + z) = ((s n) + (y + z))):Bool [1]: ((((s n) + y) + z) = ((s n) + (y + z))):Bool ---> (((s (n + y)) + z) = ((s n) + (y + z))):Bool [2]: (((s (n + y)) + z) = ((s n) + (y + z))):Bool ---> ((s ((n + y) + z)) = ((s n) + (y + z))):Bool [3]: ((s ((n + y) + z)) = ((s n) + (y + z))):Bool ---> ((s (n + (y + z))) = ((s n) + (y + z))):Bool [4]: ((s (n + (y + z))) = ((s n) + (y + z))):Bool ---> ((s (n + (y + z))) = (s (n + (y + z)))):Bool [5]: ((s (n + (y + z))) = (s (n + (y + z)))):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0000 sec for 5 rewrites + 47 matches) --> QED --> ================================================================ --> ---------------------------------------------------------------- --> PNAT with associative and commutative addition _+_ --> ---------------------------------------------------------------- -- defining module! PNAT+ac.._..* done. --> ---------------------------------------------------------------- --> PNAT with multiplication _*_ --> ---------------------------------------------------------------- -- defining module! PNAT*.._..* done. --> ================================================================ --> proof score for proving right 0 of _*_: --> eq X:Nat * 0 = X . --> with the induction on X:Nat --> ---------------------------------------------------------------- --> induction base -- reduce in PNAT* : ((0 * 0) = 0):Bool [1]: ((0 * 0) = 0):Bool ---> (0 = 0):Bool [2]: (0 = 0):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0000 sec for 2 rewrites + 2 matches) --> induction step -- opening module PNAT*.. done. _-- reduce in %PNAT* : (((s n) * 0) = 0):Bool [1]: (((s n) * 0) = 0):Bool ---> ((0 + (n * 0)) = 0):Bool [2]: ((0 + (n * 0)) = 0):Bool ---> ((0 + 0) = 0):Bool [3]: ((0 + 0) = 0):Bool ---> (0 = 0):Bool [4]: (0 = 0):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0000 sec for 4 rewrites + 6 matches) --> QED --> ================================================================ --> ================================================================ --> induction base -- opening module PNAT*.. done. _-- reduce in %PNAT* : ((0 * (s y)) = (0 + (0 * y))):Bool [1]: ((0 * (s y)) = (0 + (0 * y))):Bool ---> (0 = (0 + (0 * y))):Bool [2]: (0 = (0 + (0 * y))):Bool ---> (0 = (0 + 0)):Bool [3]: (0 = (0 + 0)):Bool ---> (0 = 0):Bool [4]: (0 = 0):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0000 sec for 4 rewrites + 4 matches) --> induction step -- opening module PNAT*.. done. __-- reduce in %PNAT* : (((s n) * (s y)) = ((s n) + ((s n) * y))):Bool [1]: (((s n) * (s y)) = ((s n) + ((s n) * y))):Bool ---> (((s y) + (n * (s y))) = ((s n) + ((s n) * y))):Bool [2]: (((s y) + (n * (s y))) = ((s n) + ((s n) * y))):Bool ---> (((s y) + (n + (n * y))) = ((s n) + ((s n) * y))):Bool [3]: (((s y) + ((n * y) + n)) = ((s n) + ((s n) * y))):Bool ---> ((s (y + ((n * y) + n))) = ((s n) + ((s n) * y))):Bool [4]: ((s ((n * y) + (n + y))) = ((s n) + ((s n) * y))):Bool ---> ((s ((n * y) + (n + y))) = ((s n) + (y + (n * y)))):Bool [5]: ((s ((n * y) + (n + y))) = ((s n) + ((n * y) + y))):Bool ---> ((s ((n * y) + (n + y))) = (s (n + ((n * y) + y)))):Bool [6]: ((s ((n * y) + (n + y))) = (s ((n * y) + (y + n)))):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0010 sec for 6 rewrites + 50 matches) --> QED --> ================================================================ --> **************************************************************** --> set trace on --> ---------------------------------------------------------------- --> ================================================================ --> proof score for proving commutativity of _*_: --> eq (X:Nat * Y:Nat) = (Y * X) . --> with the induction on X:Nat --> ----------------------------------------------------------------- --> induction base -- opening module PNAT*.. done. _-- reduce in %PNAT* : ((0 * y) = (y * 0)):Bool 1>[1] rule: eq (0 * Y:Nat) = 0 { Y:Nat |-> y } 1<[1] (0 * y):Nat --> (0):Nat [1]: ((0 * y) = (y * 0)):Bool ---> (0 = (y * 0)):Bool 1>[2] rule: eq (X:Nat * 0) = 0 { X:Nat |-> y } 1<[2] (y * 0):Nat --> (0):Nat [2]: (0 = (y * 0)):Bool ---> (0 = 0):Bool 1>[3] rule: eq (CUX = CUX) = true { CUX |-> 0 } 1<[3] (0 = 0):Bool --> (true):Bool [3]: (0 = 0):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0000 sec for 3 rewrites + 4 matches) --> induction step -- opening module PNAT*.. done. __-- reduce in %PNAT* : (((s n) * y) = (y * (s n))):Bool 1>[1] rule: eq ((s X:Nat) * Y:Nat) = (Y + (X * Y)) { X:Nat |-> n, Y:Nat |-> y } 1<[1] ((s n) * y):Nat --> (y + (n * y)):Nat [1]: (((s n) * y) = (y * (s n))):Bool ---> ((y + (n * y)) = (y * (s n))):Bool 1>[2] rule: eq (n * Y:Nat) = (Y * n) { Y:Nat |-> y } 1<[2] (n * y):Nat --> (y * n):Nat [2]: ((y + (n * y)) = (y * (s n))):Bool ---> ((y + (y * n)) = (y * (s n))):Bool 1>[3] rule: eq (X:Nat * (s Y:Nat)) = (X + (X * Y)) { X:Nat |-> y, Y:Nat |-> n } 1<[3] (y * (s n)):Nat --> (y + (y * n)):Nat [3]: (((y * n) + y) = (y * (s n))):Bool ---> (((y * n) + y) = (y + (y * n))):Bool 1>[4] rule: eq (CUX = CUX) = true { CUX |-> ((y * n) + y) } 1<[4] (((y * n) + y) = ((y * n) + y)):Bool --> (true):Bool [4]: (((y * n) + y) = ((y * n) + y)):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0010 sec for 4 rewrites + 24 matches) --> QED --> ================================================================ --> ---------------------------------------------------------------- --> set trace off --> **************************************************************** --> ================================================================ --> proof score for proving distributivity of _*_ over _+_ --> from right: --> eq (X:Nat + Y:Nat) * Z:Nat = X * Z + Y * Z . --> with the induction on X:Nat --> ---------------------------------------------------------------- --> induction base -- opening module PNAT*.. done. _-- reduce in %PNAT* : (((0 + y) * z) = ((0 * z) + (y * z))):Bool [1]: (((0 + y) * z) = ((0 * z) + (y * z))):Bool ---> ((y * z) = ((0 * z) + (y * z))):Bool [2]: ((y * z) = ((0 * z) + (y * z))):Bool ---> ((y * z) = (0 + (y * z))):Bool [3]: ((y * z) = (0 + (y * z))):Bool ---> ((y * z) = (y * z)):Bool [4]: ((y * z) = (y * z)):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0010 sec for 4 rewrites + 16 matches) --> induction step -- opening module PNAT*.. done. __-- reduce in %PNAT* : ((((s n) + y) * z) = (((s n) * z) + (y * z))):Bool [1]: ((((s n) + y) * z) = (((s n) * z) + (y * z))):Bool ---> (((s (n + y)) * z) = (((s n) * z) + (y * z))):Bool [2]: (((s (y + n)) * z) = (((s n) * z) + (y * z))):Bool ---> ((z + ((y + n) * z)) = (((s n) * z) + (y * z))):Bool [3]: ((z + ((n + y) * z)) = (((s n) * z) + (y * z))):Bool ---> ((z + ((n * z) + (y * z))) = (((s n) * z) + (y * z))):Bool [4]: (((n * z) + ((y * z) + z)) = (((s n) * z) + (y * z))):Bool ---> (((n * z) + ((y * z) + z)) = ((z + (n * z)) + (y * z))):Bool [5]: (((n * z) + ((y * z) + z)) = ((y * z) + (z + (n * z)))):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0010 sec for 5 rewrites + 59 matches) --> QED --> ================================================================ --> ================================================================ --> proof score for proving associativity of _*_: --> eq (X:Nat * Y:Nat) * Z:Nat = X * (Y * Z) . --> with the induction on X:Nat --> ---------------------------------------------------------------- --> induction base -- opening module PNAT*.. done. _-- reduce in %PNAT* : (((0 * y) * z) = (0 * (y * z))):Bool [1]: (((0 * y) * z) = (0 * (y * z))):Bool ---> ((0 * z) = (0 * (y * z))):Bool [2]: ((0 * z) = (0 * (y * z))):Bool ---> (0 = (0 * (y * z))):Bool [3]: (0 = (0 * (y * z))):Bool ---> (0 = 0):Bool [4]: (0 = 0):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0010 sec for 4 rewrites + 4 matches) --> induction step -- opening module PNAT*.. done. __-- reduce in %PNAT* : ((((s n) * y) * z) = ((s n) * (y * z))):Bool [1]: ((((s n) * y) * z) = ((s n) * (y * z))):Bool ---> (((y + (n * y)) * z) = ((s n) * (y * z))):Bool [2]: ((((n * y) + y) * z) = ((s n) * (y * z))):Bool ---> ((((n * y) * z) + (y * z)) = ((s n) * (y * z))):Bool [3]: ((((n * y) * z) + (y * z)) = ((s n) * (y * z))):Bool ---> (((n * (y * z)) + (y * z)) = ((s n) * (y * z))):Bool [4]: (((y * z) + (n * (y * z))) = ((s n) * (y * z))):Bool ---> (((y * z) + (n * (y * z))) = ((y * z) + (n * (y * z)))):Bool [5]: (((y * z) + (n * (y * z))) = ((n * (y * z)) + (y * z))):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0010 sec for 5 rewrites + 80 matches) --> QED --> ================================================================ --> ---------------------------------------------------------------- --> Peano style natural numbers with assoc+comm _+_, _*_ --> which satisfy distributive law --> ---------------------------------------------------------------- -- defining module! PNAT*ac.._...* done. --> ---------------------------------------------------------------- --> factorial functions on Nat.PNAT*ac --> ---------------------------------------------------------------- -- defining module! FACT..._....* done. --> ================================================================ --> proof score for the property: --> eq fact2(N1:Nat,N2:Nat) = fact1(N1) * N2 . --> with the induction on N1:Nat --> ---------------------------------------------------------------- --> induction base -- opening module FACT.. done. _-- reduce in %FACT : (fact2(0,n2) = (fact1(0) * n2)):Bool [1]: (fact2(0,n2) = (fact1(0) * n2)):Bool ---> (n2 = (fact1(0) * n2)):Bool [2]: (n2 = (fact1(0) * n2)):Bool ---> (n2 = ((s 0) * n2)):Bool [3]: (n2 = ((s 0) * n2)):Bool ---> (n2 = (n2 + (0 * n2))):Bool [4]: (n2 = (n2 + (0 * n2))):Bool ---> (n2 = (n2 + 0)):Bool [5]: (n2 = (n2 + 0)):Bool ---> (n2 = n2):Bool [6]: (n2 = n2):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0000 sec for 6 rewrites + 8 matches) --> induction step -- opening module FACT.. done. __-- reduce in %FACT : (fact2((s n1),n2) = (fact1((s n1)) * n2)):Bool [1]: (fact2((s n1),n2) = (fact1((s n1)) * n2)):Bool ---> (fact2(n1,((s n1) * n2)) = (fact1((s n1)) * n2)):Bool [2]: (fact2(n1,((s n1) * n2)) = (fact1((s n1)) * n2)):Bool ---> ((fact1(n1) * ((s n1) * n2)) = (fact1((s n1)) * n2)):Bool [3]: ((fact1(n1) * ((s n1) * n2)) = (fact1((s n1)) * n2)):Bool ---> ((fact1(n1) * (n2 + (n1 * n2))) = (fact1((s n1)) * n2)):Bool [4]: ((fact1(n1) * ((n2 * n1) + n2)) = (fact1((s n1)) * n2)):Bool ---> (((fact1(n1) * (n2 * n1)) + (fact1(n1) * n2)) = (fact1((s n1)) * n2)):Bool [5]: (((n2 * fact1(n1)) + (n2 * (n1 * fact1(n1)))) = (fact1((s n1)) * n2)):Bool ---> (((n2 * fact1(n1)) + (n2 * (n1 * fact1(n1)))) = (((s n1) * fact1(n1)) * n2)):Bool [6]: (((n2 * fact1(n1)) + (n2 * (n1 * fact1(n1)))) = (((s n1) * fact1(n1)) * n2)):Bool ---> (((n2 * fact1(n1)) + (n2 * (n1 * fact1(n1)))) = ((fact1(n1) + (n1 * fact1(n1))) * n2)):Bool [7]: (((n2 * fact1(n1)) + (n2 * (n1 * fact1(n1)))) = (((fact1(n1) * n1) + fact1(n1)) * n2)):Bool ---> (((n2 * fact1(n1)) + (n2 * (n1 * fact1(n1)))) = ((n2 * fact1(n1)) + (n2 * (fact1(n1) * n1)))):Bool [8]: (((n2 * fact1(n1)) + (n2 * (n1 * fact1(n1)))) = ((fact1(n1) * (n1 * n2)) + (fact1(n1) * n2))):Bool ---> (true):Bool (true):Bool (0.0000 sec for parse, 0.0020 sec for 8 rewrites + 99 matches) --> QED --> ================================================================ --> ---------------------------------------------------------------- --> set trace whole off --> **************************************************************** --> **************************************************************** --> end of file PNAT*>