1881 fun num_of_term vs (t as Free (xn, xT)) = (case AList.lookup (op =) vs t |
1881 fun num_of_term vs (t as Free (xn, xT)) = (case AList.lookup (op =) vs t |
1882 of NONE => error "Variable not found in the list!" |
1882 of NONE => error "Variable not found in the list!" |
1883 | SOME n => @{code Bound} n) |
1883 | SOME n => @{code Bound} n) |
1884 | num_of_term vs @{term "0::int"} = @{code C} 0 |
1884 | num_of_term vs @{term "0::int"} = @{code C} 0 |
1885 | num_of_term vs @{term "1::int"} = @{code C} 1 |
1885 | num_of_term vs @{term "1::int"} = @{code C} 1 |
1886 | num_of_term vs (@{term "number_of :: int \<Rightarrow> int"} $ t) = @{code C} (HOLogic.dest_numeral t) |
1886 | num_of_term vs (@{term "numeral :: _ \<Rightarrow> int"} $ t) = @{code C} (HOLogic.dest_num t) |
|
1887 | num_of_term vs (@{term "neg_numeral :: _ \<Rightarrow> int"} $ t) = @{code C} (~(HOLogic.dest_num t)) |
1887 | num_of_term vs (Bound i) = @{code Bound} i |
1888 | num_of_term vs (Bound i) = @{code Bound} i |
1888 | num_of_term vs (@{term "uminus :: int \<Rightarrow> int"} $ t') = @{code Neg} (num_of_term vs t') |
1889 | num_of_term vs (@{term "uminus :: int \<Rightarrow> int"} $ t') = @{code Neg} (num_of_term vs t') |
1889 | num_of_term vs (@{term "op + :: int \<Rightarrow> int \<Rightarrow> int"} $ t1 $ t2) = |
1890 | num_of_term vs (@{term "op + :: int \<Rightarrow> int \<Rightarrow> int"} $ t1 $ t2) = |
1890 @{code Add} (num_of_term vs t1, num_of_term vs t2) |
1891 @{code Add} (num_of_term vs t1, num_of_term vs t2) |
1891 | num_of_term vs (@{term "op - :: int \<Rightarrow> int \<Rightarrow> int"} $ t1 $ t2) = |
1892 | num_of_term vs (@{term "op - :: int \<Rightarrow> int \<Rightarrow> int"} $ t1 $ t2) = |