4 ms·
It is not reversible because you’re ereasing information. If you want to have a reversible addition you are not allowed to destroy the information. The same ha
by myaccount80 7y ago
It is not reversible because you’re ereasing information. If you want to have a reversible addition you are not allowed to destroy the information.
The same happens if you apply the standard AND operator to two bits because the output is only one bit, therefore it is impossible to figure out the two input bits. To have a reversible AND operator you can define it like this: f(x1, x2, b) = (x1, x2, b XOR (x1 AND x2)). E.g: f(1,1,0) = (1,1,1).
From this output you can get back to the input. This way you can implement a NOT gate as well, and all others gates. At the end you can implement addition using bits and your summation becomes reversible :)
You can see that with this definition we are not ereasing any information, hence it becomes reversible.
- codernyc16 7y agoYou’d have to do that for all results, not just one. This is basically what an event sourced system does: you store all the events and fold your state, so you can “play back” to any point in time. You could theoretically reverse from the end, but I haven’t seen it done.
- Zenst 7y agoA transactional database would tick that box, events are stored and can rollback to a point in time.
- acoma 7y agoNot quite. Dropping a column or updating a row is typically irreversible.
- Zenst 7y agoThat does depend upon the database, but can be done in some without resorting to a backup.
- continuational 7y agoIn PostgreSQL, schema changes are transactional.
- anarazel 7y ago> In PostgreSQL, schema changes are transactional. With a few exceptions (that refuse to run in an explicit transaction): E.g. {CREATE, DROP} DATABASE, {CREATE, DROP} TABLESPACE, {CREATE INDEX, DROP INDEX, REINDEX} CONCURRENTLY, REINDEX {SCHEMA, SYSTEM, DATABASE}.
- zcrackerz 7y agoAlso, try adding a value to an enum via ALTER TYPE ... ADD VALUE
- anarazel 7y agoNot anymore ;). Well, at least in the upcoming PG 12. https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=212fab9926b2f0f04b0187568e7124b70e8deee5 https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit... commit 212fab9926b2f0f04b0187568e7124b70e8deee5 Author: Thomas Munro <tmunro@postgresql.org> Date: 2018-10-09 12:51:01 +1300 Relax transactional restrictions on ALTER TYPE ... ADD VALUE (redux). There's still some restrictions: > This patch removes that restriction, and instead insists that an uncommitted enum value can't be referenced unless it belongs to an enum type created in the same transaction as the value.
- setr 7y agoUrbit ;-)
- fizx 7y agoQuantum computing is reversible in this way. Rabbit hole starts here: https://en.wikipedia.org/wiki/Ancilla_bit https://en.wikipedia.org/wiki/Ancilla_bit
- gigatexal 7y agoFamous last words... After reading: “oh my god it’s full of stars!”
- LifeLiverTransp 7y agoSo basically a deterministic simulation?