*Fitted with NFC tags.
type passport_status =
| EReadable
| IssuedBefore2020
type scan_status =
| Checked(checksum)
| Failed
let classify_passport (
scan : scan_result ) :
passport_status =
match scan with
| Checked(checksum) -> EReadable
| Failed -> IssuedBefore2020class PassStatus
case class EReadable() extends PassStatus
case class Before2020() extends PassStatus
sealed
class ScanStatus
case class Checked(sum:Int) extends ScanStatus
case class Failed() extends ScanStatus
sealed
def classifyPassport (
scan : ScanResult ) : PassStatus =
scan match {
case Checked(checksum) => EReadable()
case Failed() => Before2020()
}OCaml
Scala
type passport_status =
| EReadable
| IssuedBefore2020
type scan_status =
| Checked(checksum)
| Failed
let classify_passport (
scan : scan_result ) :
passport_status =
match scan with
| Checked(checksum) -> EReadable
| Failed -> IssuedBefore2020OCaml
\[E:\mathbb{P}^0\to \mathbb{P}\]
\[O:\mathbb{P}^0\to\mathbb{P}\]
\[C(checksum):\mathbb{P}^0\to \mathbb{P}\]
\[F:\mathbb{P}^0\to\mathbb{P}\]
KL="K"lassical Logic
LP we can entail \(\neg E\wedge E\)
Use KL as long as no abnormalities.
Then switch to LP to fix abnormalities and continue in KL.
So this is KL except at the end where we use KL and label it as "conditional" on avoiding the abnormal case of LP.
\[\vdash_{LP} \frac{\neg E, E\vee O}{(\neg E\wedge E)\vee O}\]
type passport_status =
| EReadable
| IssuedBefore2020
type scan_status =
| Checked(checksum)
| Failed
let classify_passport (
scan : scan_result ) :
maybe passport_status =
match scan with
| Checked(checksum) -> just EReadable
| Failed -> print "If you passport is new than 2020"
print "clean scanner and retry;"
print "else go to manual line."
noneUse KL as long as no abnormalities. \(\Gamma\)
Then switch to LP to DEFEAT abnormalities and continue in KL.
...
let classify_passport (
scan : scan_result ) :
passport_status =
match scan with
| Checked(checksum) -> just EReadable
| Failed -> print "If you passport is new than 2020"
print "clean scanner and retry;"
print "else go to manual line."
rescan( scan )
let rescan( previous : scan_result ) :
passport_status =
match new_scan() with
| Checked(checksum) -> EReadable
| Failed -> IssuedBefore2020Use KL as long as no abnormalities. \(\Gamma\)
Then switch to LP to fix abnormalities and continue in KL.