2474 | num_of_term vs (@{term "uminus :: real \<Rightarrow> real"} $ t') = @{code Neg} (num_of_term vs t') |
2474 | num_of_term vs (@{term "uminus :: real \<Rightarrow> real"} $ t') = @{code Neg} (num_of_term vs t') |
2475 | num_of_term vs (@{term "(+) :: real \<Rightarrow> real \<Rightarrow> real"} $ t1 $ t2) = |
2475 | num_of_term vs (@{term "(+) :: real \<Rightarrow> real \<Rightarrow> real"} $ t1 $ t2) = |
2476 @{code Add} (num_of_term vs t1, num_of_term vs t2) |
2476 @{code Add} (num_of_term vs t1, num_of_term vs t2) |
2477 | num_of_term vs (@{term "(-) :: real \<Rightarrow> real \<Rightarrow> real"} $ t1 $ t2) = |
2477 | num_of_term vs (@{term "(-) :: real \<Rightarrow> real \<Rightarrow> real"} $ t1 $ t2) = |
2478 @{code Sub} (num_of_term vs t1, num_of_term vs t2) |
2478 @{code Sub} (num_of_term vs t1, num_of_term vs t2) |
2479 | num_of_term vs (@{term "( * ) :: real \<Rightarrow> real \<Rightarrow> real"} $ t1 $ t2) = (case num_of_term vs t1 |
2479 | num_of_term vs (@{term "(*) :: real \<Rightarrow> real \<Rightarrow> real"} $ t1 $ t2) = (case num_of_term vs t1 |
2480 of @{code C} i => @{code Mul} (i, num_of_term vs t2) |
2480 of @{code C} i => @{code Mul} (i, num_of_term vs t2) |
2481 | _ => error "num_of_term: unsupported multiplication") |
2481 | _ => error "num_of_term: unsupported multiplication") |
2482 | num_of_term vs (@{term "real_of_int :: int \<Rightarrow> real"} $ t') = |
2482 | num_of_term vs (@{term "real_of_int :: int \<Rightarrow> real"} $ t') = |
2483 (mk_C (snd (HOLogic.dest_number t')) |
2483 (mk_C (snd (HOLogic.dest_number t')) |
2484 handle TERM _ => error ("num_of_term: unknown term")) |
2484 handle TERM _ => error ("num_of_term: unknown term")) |
2512 | term_of_num vs (@{code Neg} t') = @{term "uminus :: real \<Rightarrow> real"} $ term_of_num vs t' |
2512 | term_of_num vs (@{code Neg} t') = @{term "uminus :: real \<Rightarrow> real"} $ term_of_num vs t' |
2513 | term_of_num vs (@{code Add} (t1, t2)) = @{term "(+) :: real \<Rightarrow> real \<Rightarrow> real"} $ |
2513 | term_of_num vs (@{code Add} (t1, t2)) = @{term "(+) :: real \<Rightarrow> real \<Rightarrow> real"} $ |
2514 term_of_num vs t1 $ term_of_num vs t2 |
2514 term_of_num vs t1 $ term_of_num vs t2 |
2515 | term_of_num vs (@{code Sub} (t1, t2)) = @{term "(-) :: real \<Rightarrow> real \<Rightarrow> real"} $ |
2515 | term_of_num vs (@{code Sub} (t1, t2)) = @{term "(-) :: real \<Rightarrow> real \<Rightarrow> real"} $ |
2516 term_of_num vs t1 $ term_of_num vs t2 |
2516 term_of_num vs t1 $ term_of_num vs t2 |
2517 | term_of_num vs (@{code Mul} (i, t2)) = @{term "( * ) :: real \<Rightarrow> real \<Rightarrow> real"} $ |
2517 | term_of_num vs (@{code Mul} (i, t2)) = @{term "(*) :: real \<Rightarrow> real \<Rightarrow> real"} $ |
2518 term_of_num vs (@{code C} i) $ term_of_num vs t2 |
2518 term_of_num vs (@{code C} i) $ term_of_num vs t2 |
2519 | term_of_num vs (@{code CN} (n, i, t)) = term_of_num vs (@{code Add} (@{code Mul} (i, @{code Bound} n), t)); |
2519 | term_of_num vs (@{code CN} (n, i, t)) = term_of_num vs (@{code Add} (@{code Mul} (i, @{code Bound} n), t)); |
2520 |
2520 |
2521 fun term_of_fm vs @{code T} = @{term True} |
2521 fun term_of_fm vs @{code T} = @{term True} |
2522 | term_of_fm vs @{code F} = @{term False} |
2522 | term_of_fm vs @{code F} = @{term False} |