on master help sign in
Prove dropEnv is total
commit06914a6cc2fd6a2fc80756b5e240ac55ac52e93e authorEdwin Brady <ecb10@st-andrews.ac.uk> dateThu 17 Mar 2016, 17:11 (11 years ago) parent62b7952
1 file changed+6−2
libs/effects/Effects.idr+6−2
libs/effects/Effects.idr+6−2
@@ -95,6 +95,10 @@ data SubList : List a -> List a -> Type where
9595 SubNil : SubList [] xs
9696 InList : SubElem x ys -> SubList xs ys -> SubList (x :: xs) ys
9797
98+Uninhabited (SubElem x []) where
99+ uninhabited Z impossible
100+ uninhabited (S _) impossible
101+
98102-- Some useful hints for proof construction in polymorphic programs
99103%hint
100104public export total
@@ -150,9 +154,9 @@ envElem Z (x :: xs) = [x]
150154envElem (S k) (x :: xs) = envElem k xs
151155
152156||| make an environment corresponding to a sub-list
153−%assert_total dropEnv : Env m ys -> SubList xs ys -> Env m xs
157+total dropEnv : Env m ys -> SubList xs ys -> Env m xs
154158dropEnv [] SubNil = []
155−-- dropEnv [] (InList y z) impossible
159+dropEnv [] (InList idx rest) = absurd idx
156160dropEnv (y::ys) SubNil = []
157161dropEnv e@(y::ys) (InList idx rest) =
158162 let [x] = envElem idx e