Commit dac0edc4 authored by Heiko Becker's avatar Heiko Becker

Some cleanup and progress on Error Validator soundness

parent 9325d322
This diff is collapsed.
This diff is collapsed.
......@@ -11,7 +11,6 @@ val _ = Datatype `
| DABS
| DCOND
| DGAMMA
| DFBITS
| DTYPE mType
| DFIXED
| DVAR
......@@ -81,7 +80,6 @@ val lex_def = tDefine "lex" `
| "PRE" => DPRE :: lex input''
| "ABS" => DABS :: lex input''
| "GAMMA" => DGAMMA :: lex input''
| "FBITS" => DFBITS :: lex input''
| "Var" => DVAR :: lex input''
| "Cast" => DCAST :: lex input''
| "F" => DFIXED :: lex input''
......@@ -147,7 +145,6 @@ val pp_token_def = Define `
| DVAR => "Var"
| DCONST num => str_of_num num
| DGAMMA => "GAMMA"
| DFBITS => "FBITS"
| DTYPE m => type_to_string m
| DFIXED => ""
| DNEG => "~"
......@@ -433,16 +430,23 @@ val parseAbsEnv_def = Define `
| _ => NONE`;
val defaultGamma_def = Define `
defaultGamma:num -> mType option = \n. NONE`;
val parseGammaRec_def = Define `
parseGammaRec (input: Token list) : ((num -> mType option) # Token list) option =
(case input of
| DVAR :: DCONST n :: DTYPE m :: inputRest =>
defaultGamma:mType fMap = FloverMapTree_empty`;
val parseGammaRec_def = tDefine "parseGammaRec"
`parseGammaRec (input: Token list) : (typeMap # Token list) option =
(case parseExp input of
|NONE => SOME (defaultGamma, input)
|SOME (e,residual) =>
(case residual of
| DCONST n :: DTYPE m :: inputRest =>
(case parseGammaRec inputRest of
| SOME (Gamma, rest) => SOME (updDefVars n m Gamma, rest)
| SOME (Gamma, rest) =>
SOME (FloverMapTree_insert e m Gamma, rest)
| NONE => NONE)
| _ => SOME (defaultGamma, input))`;
| _ => SOME (defaultGamma, input)))`
(WF_REL_TAC `measure LENGTH` \\ rw[]
\\ IMP_RES_TAC parseExp_LESS_EQ
\\ fs[]);
val parseGamma_def = Define `
parseGamma (input:Token list) =
......@@ -450,30 +454,6 @@ val parseGamma_def = Define `
| DGAMMA :: tokenRest => parseGammaRec tokenRest
| _ => NONE`;
val defaultFBits = Define `
defaultFBits = FloverMapTree_empty`;
val parseFBitsRec_def = tDefine "parseFBitsRec" `
parseFBitsRec (input: Token list) akk =
(case input of
| [] => SOME (akk, [])
| _ =>
(case parseExp input of
|NONE => SOME (akk, input)
|SOME (e, res1) =>
(case res1 of
|DCONST n :: res2 => parseFBitsRec res2 (FloverMapTree_insert e n akk)
| _ => SOME (akk, input))))`
(WF_REL_TAC `measure (LENGTH o FST)` \\ fs[]
\\ rpt strip_tac
\\ IMP_RES_TAC parseExp_LESS_EQ \\ fs[]);
val parseFBits_def = Define `
parseFBits input =
(case input of
|DFBITS:: tokRest => parseFBitsRec tokRest defaultFBits
|_ => NONE)`;
(* Global parsing function*)
val dParse_def = Define `
dParse (input:Token list) =
......@@ -494,9 +474,6 @@ val dParse_def = Define `
(case parseAbsEnv residual of
|NONE => NONE
|SOME (A, residual) =>
(case parseFBits residual of
|NONE => NONE
|SOME (fBits, residual) =>
SOME ((dCmd, P, A, Gamma, fBits), residual)))))`;
SOME ((dCmd, P, A, Gamma), residual))))`;
val _ = export_theory();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment