Question: if user sent the 1.5 ETH then accepted the 1 ETH, but 0.5 ETH should be refunded to sender. 
I tried like `msg.sender.transfer(0.5)`

and tried like `msg.sender.transfer(500000000000000000)`

but nothing happened. I am not sure about that msg.sender.transfer is a right function.

is it possible do such way in Contracts?

Answer: 
They're not the same.

`view` functions have read-only access permission on state variables.

`pure` functions do not.

Those functions that you mention can all be declared `pure`.

Side note: this library is provided in OpenZeppelin GitHub as open source, which means that it has been viewed, tested and verified thoroughly. No reason to implement it yourself.
I think you cant find what you are looking for in the solidity official documentation here: <https://solidity.readthedocs.io/en/v0.4.25/contracts.html?highlight=view%20pure#view-functions>

Hope it helps