most of Tree.newt working
This commit is contained in:
@@ -45,7 +45,7 @@ _ <<= Top = Unit
|
||||
_ <<= _ = Void
|
||||
|
||||
data Intv : Bnd -> Bnd -> U where
|
||||
MkI : {l u : Bnd} (x : Nat) (lx : l <<= N x) (xu : N x <<= u) -> Intv l u
|
||||
intv : {l u : Bnd} (x : Nat) (lx : l <<= N x) (xu : N x <<= u) -> Intv l u
|
||||
|
||||
data T23 : Bnd -> Bnd -> Nat -> U where
|
||||
leaf : {l u : Bnd} {h : Nat} (lu : l <<= u) -> T23 l u Z
|
||||
@@ -64,6 +64,14 @@ infixr 1 _**_
|
||||
data Sg : (A : U) -> (A -> U) -> U where
|
||||
_**_ : {A : U} {B : A -> U} -> (a : A) -> B a -> Sg A B
|
||||
|
||||
|
||||
-- Accidentally defined this as a separate data because I was
|
||||
-- guessing the def behind _*_. I get an unsolved meta below if
|
||||
-- I define in terms of Sg.
|
||||
|
||||
-- _*_ : U -> U -> U
|
||||
-- A * B = Sg A (\ _ => B)
|
||||
|
||||
data _*_ : (A B : U) -> U where
|
||||
_,_ : {A B : U} -> A -> B -> A * B
|
||||
|
||||
@@ -71,13 +79,28 @@ TooBig : Bnd -> Bnd -> Nat -> U
|
||||
TooBig l u h = Sg Nat (\ x => T23 l (N x) h * T23 (N x) u h)
|
||||
|
||||
insert : {h : Nat} {l u : Bnd} -> Intv l u -> T23 l u h -> TooBig l u h + T23 l u h
|
||||
insert (MkI x lx xu) (leaf lu) = ?
|
||||
insert (MkI x lx xu) (node2 x1 t t1) = ?
|
||||
insert (MkI x lx xu) (node3 y z tly tyz tzu) = case cmp x y of
|
||||
-- Agda is yellow here, needs h = x on each leaf
|
||||
-- In Newt, we're getting an skolem escape error
|
||||
insert (intv x lx xu) (leaf lu) = inl (x ** (leaf lx , leaf xu))
|
||||
insert (intv x lx xu) (node2 y tly tyu) = case cmp x y of
|
||||
-- u := N y is not solved at this time
|
||||
inl xy => case insert (MkI {_} {N y} x lx xy) tly of
|
||||
-- NOW down to a non-linear issue now.
|
||||
-- Possibly due to the meta being applied to an extra argument
|
||||
inl xy => case insert (intv {_} {N y} x lx xy) tly of
|
||||
inl (z ** (tlz, tzy)) => inr (node3 z y tlz tzy tyu)
|
||||
inr tly' => inr (node2 y tly' tyu)
|
||||
inr yx => case insert (intv {N y} x yx xu) tyu of
|
||||
inl (z ** (tyz, tzu)) => inr (node3 y z tly tyz tzu)
|
||||
inr tyu' => inr (node2 y tly tyu')
|
||||
insert (intv x lx xu) (node3 y z tly tyz tzu) = case cmp x y of
|
||||
inl xy => case insert (intv {_} {N y} x lx xy) tly of
|
||||
-- TODO Here a meta is applied to an extra argument, if we ignore that
|
||||
-- constraint we get a better one later - _but_ we probably need to check
|
||||
-- the constraint later.
|
||||
inl (v ** (tlv , tvy)) => inl (y ** (node2 v tlv tvy, node2 z tyz tzu))
|
||||
inr x1 => ?
|
||||
inr x1 => ?
|
||||
inr tly' => inr (node3 y z tly' tyz tzu)
|
||||
inr yx => case cmp x z of
|
||||
inl xz => case insert (intv {N y} {N z} x yx xz) tyz of
|
||||
inl (w ** (tyw , twz)) => inl (w ** (node2 y tly tyw, node2 z twz tzu))
|
||||
inr tyz' => inr (node3 y z tly tyz' tzu)
|
||||
inr zx => case insert (intv {N z} x zx xu) tzu of
|
||||
inl (w ** (tzw, twu)) => inl (z ** (node2 y tly tyz, node2 w tzw twu))
|
||||
inr tzu' => inr (node3 y z tly tyz tzu')
|
||||
|
||||
Reference in New Issue
Block a user