--> ========================================================== --> Proof scores for verifications of properties (including --> associativity and commutativity of _+_ and _*_) about --> Peano Style natural numbers with CafeOBJ/CITP --> ========================================================== --> :verbose on print outs an each generated goal. -- :verbose on --> ---------------------------------------------------------- --> Peano style natural numbers --> ---------------------------------------------------------- mod! PNAT { [ PNat ] op 0 : -> PNat {constr} . op s_ : PNat -> PNat {constr} . } --> ---------------------------------------------------------- --> PNAT with plus _+_ operation --> ---------------------------------------------------------- mod! PNAT+ { pr(PNAT) op _+_ : PNat PNat -> PNat {r-assoc} . eq 0 + Y:PNat = Y . eq (s X:PNat) + Y:PNat = s(X + Y) . } --> ********************************************************** --> proof scores of the properties about _+_ --> ********************************************************** --> ========================================================== select PNAT+ . --> ========================================================== --> ---------------------------------------------------------- :goal { eq [+rz]: M:PNat + 0 = M:PNat . eq [+rs]: M:PNat + s N:PNat = s(M:PNat + N:PNat). } --> ---------------------------------------------------------- **> we can prove two theorems together :ind on (M:PNat) :apply(si tc rd) --> QED --> ---------------------------------------------------------- :show proved --> ---------------------------------------------------------- :goal { eq [+assoc :nonexec]: (X:PNat + Y:PNat) + Z:PNat = X + (Y + Z) .} --> ---------------------------------------------------------- :ind on (X:PNat) :apply(si tc rd) --> QED --> ---------------------------------------------------------- :show discharged --> ---------------------------------------------------------- :goal { eq [+comm :non-exec]: X:PNat + Y:PNat = Y + X .} --> ---------------------------------------------------------- :use (+rz +rs) :ind on (X:PNat) :apply(si tc rd) --> QED --> ---------------------------------------------------------- :show proved --> ---------------------------------------------------------- --> PNAT+ac --> ---------------------------------------------------------- **> the current module is PNAT+ :embed [+assoc] {assoc} as PNAT+ac :embed [+comm] {comm} into PNAT+ac --> ---------------------------------------------------------- select PNAT+ac show . show op _+_ . --> ********************************************************** --> proof scores of properties about _*_ --> ********************************************************** --> ---------------------------------------------------------- --> PNAT with _+_{assoc comm} and _*_ operation --> ---------------------------------------------------------- mod! PNAT+ac* { pr(PNAT+ac) op _*_ : PNat PNat -> PNat {prec: 29 r-assoc} eq 0 * Y:PNat = 0 . eq s(X:PNat) * Y:PNat = Y + (X * Y) . } --> ========================================================== select PNAT+ac* . --> ========================================================== --> ---------------------------------------------------------- :goal { eq[*disr]: (X:PNat + Y:PNat) * Z:PNat = X * Z + Y * Z . } --> ---------------------------------------------------------- :ind on (X:PNat) :apply(si tc rd) --> QED --> ---------------------------------------------------------- :show proved --> ---------------------------------------------------------- :goal { eq[*assoc :nonexec]: (X:PNat * Y:PNat) * Z:PNat = X * (Y * Z) . } --> ---------------------------------------------------------- :use (*disr) :ind on (X:PNat) :apply(si tc rd) --> QED --> ---------------------------------------------------------- :show proved --> ---------------------------------------------------------- :goal { eq[*rz]: X:PNat * 0 = 0 .} --> ---------------------------------------------------------- :ind on (X:PNat) :apply (si tc rd) --> QED --> ---------------------------------------------------------- :show proved --> ---------------------------------------------------------- :goal { eq[*rs]: X:PNat * s(Y:PNat) = X + (X * Y) .} --> ---------------------------------------------------------- :ind on (X:PNat) :apply(si tc rd) --> QED --> ---------------------------------------------------------- :show proved --> ---------------------------------------------------------- :goal { eq[*comm :nonexec]: X:PNat * Y:PNat = Y * X .} --> ---------------------------------------------------------- :ind on (X:PNat) :use (*rz *rs) :apply(si tc rd) --> QED --> ---------------------------------------------------------- :show proved --> ---------------------------------------------------------- --> PNAT+ac*ac --> ---------------------------------------------------------- **> the current module is PNAT+ac* :embed [*comm] {comm} as PNAT+ac*ac :embed [*assoc] {assoc} into PNAT+ac*ac --> ---------------------------------------------------------- select PNAT+ac*ac . show . show op _*_ -- ========================================================== --> end end end -- ==========================================================