Typeclass Declaration
##Typeclass Declaration
TheThe name TF
for the type class bears no meaning for me, so I changed it to Prop
short for "Proposition".
##Typeclass Declaration
The name TF
for the type class bears no meaning for me, so I changed it to Prop
short for "Proposition".
Typeclass Declaration
The name TF
for the type class bears no meaning for me, so I changed it to Prop
short for "Proposition".
This is the key: contradiction
asks the question "Is this proposition false for all possible inputs"? To test this, we split f
into two parts: its first argument and the rest. If the first argument is True
, then is it possible to satisfy proposition f
with the remaining arguments? If not, then it's a contradiction. This is the part contradiction $ f True
.
f True
is itself a function of 1 Bool argument, so it is in class Prop
, and so we're able to apply contradiction
to it to see if it's a contradiction. We also need to be sure that it's not possible to satisfy f
if the first argument is False
either, which is why we &&
this with contradiction $ f False
.
This is the key: contradiction
asks the question "Is this proposition false for all possible inputs"? To test this, we split f
into two parts: its first argument and the rest. If the first argument is True
, then is it possible to satisfy proposition f
with the remaining arguments? If not, then it's a contradiction. This is the part contradiction $ f True
. We also need to be sure that it's not possible to satisfy f
if the first argument is False
either, which is why we &&
this with contradiction $ f False
.
This is the key: contradiction
asks the question "Is this proposition false for all possible inputs"? To test this, we split f
into two parts: its first argument and the rest. If the first argument is True
, then is it possible to satisfy proposition f
with the remaining arguments? If not, then it's a contradiction. This is the part contradiction $ f True
.
f True
is itself a function of 1 Bool argument, so it is in class Prop
, and so we're able to apply contradiction
to it to see if it's a contradiction. We also need to be sure that it's not possible to satisfy f
if the first argument is False
either, which is why we &&
this with contradiction $ f False
.
Alright, so f
is valid if and only if it evaluates to True
for both arguments! That's what we want.
Now for contradiction
:
contradiction f = (contradiction $ f True) && (contradiction $ f False)
This is the key: contradiction
asks the question "Is this proposition false for all possible inputs"? To test this, we split f
into two parts: its first argument and the rest. If the first argument is True
, then is it possible to satisfy proposition f
with the remaining arguments? If not, then it's a contradiction. This is the part contradiction $ f True
. We also need to be sure that it's not possible to satisfy f
if the first argument is False
either, which is why we &&
this with contradiction $ f False
.
I'll leave the other two functionslequiv
function as an exercise, and move on to the next inductive step.
Alright, so f
is valid if and only if it evaluates to True
for both arguments! That's what we want. I'll leave the other two functions as an exercise, and move on to the next inductive step.
Alright, so f
is valid if and only if it evaluates to True
for both arguments! That's what we want.
Now for contradiction
:
contradiction f = (contradiction $ f True) && (contradiction $ f False)
This is the key: contradiction
asks the question "Is this proposition false for all possible inputs"? To test this, we split f
into two parts: its first argument and the rest. If the first argument is True
, then is it possible to satisfy proposition f
with the remaining arguments? If not, then it's a contradiction. This is the part contradiction $ f True
. We also need to be sure that it's not possible to satisfy f
if the first argument is False
either, which is why we &&
this with contradiction $ f False
.
I'll leave the lequiv
function as an exercise, and move on to the next inductive step.