> (∀ ys • (∀ f,zs • map f (ys ++
zs) = map f ys ++ map f zs))
>
> And now you can see that you want a proof of a one-variable
theorem
Thank you, Rustom Mody, that's it, reordering of universal
quantifiers.
By the way, I'm searching for a 'good' book about predicate logic
for quite some time now.
One with a strong link to mathematics and the quantification style
that is used there would be nice. By chance, is there a reference
(script/paper/book )
you would recommend?
I have rewritten my first proof a little. It mentions the other
variables now explicitly.
This way it should be cleaner:
-- 1. Induction Hypothesis (1. I.H.):
-- ----------------------------------
--
-- For an arbitrary but fixed list "ys", for all lists "zs" and
for all functions f the statement ...
--
-- map f (ys ++ zs) = map f ys ++ map f zs
--
-- ... holds.
When proving the proposition the first time I've used a different
approach
(the chapter heavily promoted generalization and because I tried
to get around
the dilemma that I wasn't sure if I understood 'simultaneous
induction' correctly):
-- ---------------
-- 1. Proposition:
-- ---------------
--
-- map f (ys ++ zs) = map f ys ++ map f zs
--
--
--
-- Proof By Generalization:
-- ------------------------
--
--
-- ------------------------------
-- 1. Specialization Proposition:
-- ------------------------------
--
-- map f (ys ++ zs) = map f ys ++ map f zs
--
--
-- ------------------------------
-- 1. Generalization Proposition:
-- ------------------------------
--
-- map f (foldr (++) [] ls) = foldr ( (++) . (f `map`) ) []
ls
--
--
-- Proof By Structural Induction:
-- ------------------------------
--
--
-- 1. Induction Beginning (1. I.B.):
-- ---------------------------------
--
--
-- (Base case 1.) :<=> ls := []
--
-- => (left) := map f (foldr (++) [] ls)
-- | (Base case
1.)
-- = map f (foldr (++) [] [])
-- | foldr
-- = map f []
-- | map
-- = []
--
--
-- (right) := foldr ( (++) . (f `map`) ) [] ls
-- |
(Base case 1.)
-- = foldr ( (++) . (f `map`) ) [] []
-- |
foldr
-- = []
--
--
-- => (left) = (right)
--
-- ✔
--
--
-- 1. Induction Hypothesis (1. I.H.):
-- ----------------------------------
--
-- For an arbitrary but fixed (list-of-)lists "ls" and ∀
functions f, the statement ...
--
-- map f ( foldr (++) [] ls ) = foldr ( (++) . (f `map`) )
[] ls
--
-- ... holds.
--
--
-- 1. Induction Step (1. I.S.):
-- ----------------------------
--
--
-- (left) := map f ( foldr (++) [] (l : ls) )
--
| foldr
-- = map f ( l ++ foldr (++) [] ls )
--
| (Specialized 1. I.H.)
-- = map f l ++ map f ( foldr (++) [] ls )
--
| (1. I.H.)
-- = map f l ++ ( foldr ( (++) . (f `map`) ) [] ls
)
--
--
-- (right) := foldr ( (++) . (f `map`) ) [] (l : ls)
--
| foldr
-- = ( (++) . (f `map`) ) l foldr ( (++) . (f `map`)
) [] ls
--
| General rule of function application (left associativity)
-- = ( ( (++) . (f `map`) ) l ) foldr ( (++) . (f
`map`) ) [] ls
--
| (.)
-- = ( (++) ( (f `map`) l ) ) foldr ( (++) . (f
`map`) ) [] ls
--
| (f `map`)
-- = ( (++) (map f l) ) foldr ( (++) . (f `map`) )
[] ls
--
| General rule of function application (left associativity)
-- = (++) (map f l) ( foldr ( (++) . (f `map`) ) []
ls )
--
| ++
-- = map f l ++ ( foldr ( (++) . (f `map`) ) [] ls
)
--
--
-- => (left) = (right)
--
--
-- ?■? (1. Generalization Proof)
--
--
-- (Generalization)
--
-- :<=> map f ( foldr (++) [] ls ) = foldr ( (++) .
(f `map`) ) [] ls
--
| ls := [ys , zs]
-- |=> map f ( foldr (++) [] [ys , zs] ) = foldr ( (++)
. (f `map`) ) [] [ys , zs]
--
-- <=> map f (ys ++ zs) = map f ys ++ map f zs
--
-- <=>: (Specialization)
--
--
-- ■ (1. Specialization Proof)
Is this also possible? Is it allowed to use a specialized
induction hypothesis like that ( see '| (Specialized 1. I.H.)'
above )?
Pascal
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners