fix type error, re-add qbool matchers

This commit is contained in:
Victor Taelin 2024-03-01 23:31:05 -03:00
parent 3baa0e392e
commit b2eb7610f4
3 changed files with 72 additions and 3 deletions

42
book/QBool.match.kind2 Normal file
View File

@ -0,0 +1,42 @@
QBool.match
: ∀(a: QBool)
∀(P: ∀(x: QBool) *)
∀(t: (P QBool.true))
∀(f: (P QBool.false))
(P a)
= λa λP λt λf
(~(~a P)
λx (P a)
λtag
#match tag = tag {
#0: λx (x t)
#+: λx
(#match tag_1 = tag-1 {
#0: λx (x f)
#+: λx (x λe (Empty.absurd e *))
}: ∀(x:
∀(x:
#match tag_1 = tag_1 {
#0: (P QBool.false)
#+: ∀(x: Empty) *
}: *
)
(P a)
)
(P a)
x
)
}: ∀(x:
∀(x:
#match tag = tag {
#0: (P QBool.true)
#+: #match tag_1 = tag-1 {
#0: (P QBool.false)
#+: ∀(x: Empty) *
}: *
}: *
)
(P a)
)
(P a)
)

27
book/QBool2.match.kind2 Normal file
View File

@ -0,0 +1,27 @@
QBool2.match
: ∀(a: QBool2)
∀(P: ∀(x: QBool2) *)
∀(t: (P QBool2.true))
∀(f: (P QBool2.false))
(P a)
= λa λP λt λf
(~a
P
λtag
#match tag = tag {
#0: t
#+: #match tag_1 = tag-1 {
#0: f
#+: λe (~e λx *)
}: #match tag_1 = tag_1 {
#0: (P QBool2.false)
#+: ∀(e: Empty) *
}: *
}: #match tag = tag {
#0: (P QBool2.true)
#+: #match tag_1 = tag-1 {
#0: (P QBool2.false)
#+: ∀(e: Empty) *
}: *
}: *
)

View File

@ -320,13 +320,13 @@
(Similar (Op2 a.opr a.fst a.snd) (Op2 b.opr b.fst b.snd) dep) =
(Checker.bind (Equal a.fst b.fst dep) λe.fst
(Checker.bind (Equal a.snd b.snd dep) λe.snd
(Checker.pure (Same e.fst e.snd))))
(Checker.pure (& e.fst e.snd))))
(Similar (Mat a.nam a.x a.z a.s a.p) (Mat b.nam b.x b.z b.s b.p) dep) =
(Checker.bind (Equal a.x b.x dep) λe.x
(Checker.bind (Equal a.z b.z dep) λe.z
(Checker.bind (Equal (a.s (Var (String.concat a.nam "-1") dep)) (b.s (Var (String.concat b.nam "-1") dep)) dep) λe.s
(Checker.bind (Equal (a.p (Var a.nam dep)) (b.p (Var b.nam dep)) dep) λe.p
(& e.x (& e.z (& e.s e.p)))))))
(Checker.pure (& e.x (& e.z (& e.s e.p))))))))
(Similar a b dep) =
(Checker.pure 0)
@ -384,7 +384,7 @@
(Checker.bind (Identical a.z b.z dep) λi.z
(Checker.bind (Identical (a.s (Var (String.concat a.nam "-1") dep)) (b.s (Var (String.concat b.nam "-1") dep)) dep) λi.s
(Checker.bind (Identical (a.p (Var a.nam dep)) (b.p (Var b.nam dep)) dep) λi.p
(& i.x (& i.z (& i.s i.p)))))))
(Checker.pure (& i.x (& i.z (& i.s i.p))))))))
(Identical.go (Txt a.txt) (Txt b.txt) dep) =
(Checker.pure (Same a.txt b.txt))
(Identical.go (Src a.src a.val) b dep) =